forked from webodf/ViewerJS
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMultimediaViewerPlugin.js
More file actions
executable file
·87 lines (68 loc) · 2.03 KB
/
MultimediaViewerPlugin.js
File metadata and controls
executable file
·87 lines (68 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
* Multimedia Viewer Plugin using Video.js
*
* @author Christoph Haas <christoph.h@sprinternet.at>
*/
function MultimediaViewerPlugin() {
"use strict";
var videoElement = undefined,
videoSource = undefined,
self = this;
this.initialize = function (viewerElement, documentUrl) {
if(window.mimetype.indexOf("audio/") === 0) {
videoElement=document.createElement("audio");
videoElement.setAttribute('poster', 'images/musicbg.png');
} else {
videoElement=document.createElement("video");
}
videoElement.setAttribute('preload', 'auto');
videoElement.setAttribute('id', 'multimedia_viewer');
videoElement.setAttribute('controls', 'controls');
videoElement.setAttribute('class', 'video-js vjs-default-skin');
videoSource=document.createElement("source");
videoSource.setAttribute('src', documentUrl);
videoSource.setAttribute('type', window.mimetype);
videoElement.appendChild(videoSource);
viewerElement.appendChild(videoElement);
viewerElement.style.overflow = "auto";
// init viewerjs
videojs(document.getElementById('multimedia_viewer'), {controls:'enabled', techOrder:['flash','html5']}, function() {
// This is functionally the same as the previous example.
});
self.onLoad();
};
this.isSlideshow = function () {
return false;
};
this.onLoad = function () {
};
this.fitToWidth = function (width) {
};
this.fitToHeight = function (height) {
};
this.fitToPage = function (width, height) {
};
this.fitSmart = function (width) {
};
this.getZoomLevel = function () {
};
this.setZoomLevel = function (value) {
};
// return a list of tuples (pagename, pagenode)
this.getPages = function () {
return [videoElement];
};
this.showPage = function (n) {
// hide middle toolbar
document.getElementById('toolbarMiddleContainer').style.visibility = "hidden";
};
this.getPluginName = function () {
return "MultimediaViewerPlugin";
};
this.getPluginVersion = function () {
return "From Source";
};
this.getPluginURL = function () {
return "https://sprinternet.at";
};
}