equal
deleted
inserted
replaced
1 // VideojsPlayer |
1 // VideojsPlayer |
2 import "videojs-youtube/dist/Youtube.js"; |
2 import "videojs-youtube/dist/Youtube.js"; |
3 import Vimeo from './videojs_plugins/Vimeo.js'; |
3 import Vimeo from './videojs_plugins/Vimeo.js'; |
|
4 import Dailymotion from "./videojs_plugins/Dailymotion.js"; |
4 import videojs from "video.js"; |
5 import videojs from "video.js"; |
5 |
6 |
6 import videojsStyles from "./VideojsPlayer.module.css"; |
7 import videojsStyles from "./VideojsPlayer.module.css"; |
7 import mime from "mime-types"; |
8 import mime from "mime-types"; |
8 |
9 |
10 regex:/^(https?:\/\/)?((?:www|m)\.)?(?:youtube(?:-nocookie)?\.com|youtu.be)/, |
11 regex:/^(https?:\/\/)?((?:www|m)\.)?(?:youtube(?:-nocookie)?\.com|youtu.be)/, |
11 type: "video/youtube" |
12 type: "video/youtube" |
12 }, { |
13 }, { |
13 regex:/^(https?:\/\/)?(www\.)?vimeo\.com/, |
14 regex:/^(https?:\/\/)?(www\.)?vimeo\.com/, |
14 type: "video/vimeo" |
15 type: "video/vimeo" |
|
16 }, { |
|
17 regex:/^(https?:\/\/)?(www\.)?dailymotion\.com/, |
|
18 type: "video/dailymotion" |
15 } |
19 } |
16 ] |
20 ] |
17 |
21 |
18 const VideojsPlayerWidget = function (ns) { |
22 const VideojsPlayerWidget = function (ns) { |
19 return class extends ns.Widgets.Widget { |
23 return class extends ns.Widgets.Widget { |
22 } |
26 } |
23 |
27 |
24 static defaults = {}; |
28 static defaults = {}; |
25 |
29 |
26 draw() { |
30 draw() { |
27 var _opts = { techOrder: [ 'html5', 'Youtube', 'Vimeo'] }, |
31 |
|
32 const techOrder = [ 'html5', 'Youtube', 'Vimeo' ]; |
|
33 if(this.dailymotionPlayerId) { |
|
34 techOrder.push("Dailymotion"); |
|
35 Dailymotion.loadLibrary(this.dailymotionPlayerId); |
|
36 } |
|
37 |
|
38 var _opts = { techOrder }, |
28 _seekPause = false, |
39 _seekPause = false, |
29 _pauseState = true; |
40 _pauseState = true; |
30 |
41 |
31 if (typeof this.video === "undefined") { |
42 if (typeof this.video === "undefined") { |
32 this.video = this.media.video; |
43 this.video = this.media.video; |
155 _media.trigger("pause"); |
166 _media.trigger("pause"); |
156 return value; |
167 return value; |
157 }, |
168 }, |
158 setMuted: function (value) { |
169 setMuted: function (value) { |
159 _media.muted = value; |
170 _media.muted = value; |
|
171 _media.trigger("muted"); |
160 _media.trigger("volumechange"); |
172 _media.trigger("volumechange"); |
161 return value; |
173 return value; |
162 }, |
174 }, |
163 setVolume: function (value) { |
175 setVolume: function (value) { |
164 _media.volume = value; |
176 _media.volume = value; |
171 this.videojsPlayer = _player; |
183 this.videojsPlayer = _player; |
172 } |
184 } |
173 }; |
185 }; |
174 }; |
186 }; |
175 |
187 |
176 export { VideojsPlayerWidget as VideojsPlayer, videojsStyles, Vimeo }; |
188 export { VideojsPlayerWidget as VideojsPlayer, videojsStyles, Vimeo, Dailymotion }; |