samvera_hls 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/samvera_hls/version.rb +1 -1
- data/vendor/assets/flash/mediaelement-flash-audio-ogg.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-audio.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-video-hls.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-video-mdash.swf +0 -0
- data/vendor/assets/flash/mediaelement-flash-video.swf +0 -0
- data/vendor/assets/images/mejs-controls.png +0 -0
- data/vendor/assets/images/mejs-controls.svg +1 -0
- data/vendor/assets/images/playlist-controls.svg +52 -0
- data/vendor/assets/javascripts/lang/ca.js +89 -0
- data/vendor/assets/javascripts/lang/cs.js +90 -0
- data/vendor/assets/javascripts/lang/de.js +90 -0
- data/vendor/assets/javascripts/lang/es.js +90 -0
- data/vendor/assets/javascripts/lang/fa.js +90 -0
- data/vendor/assets/javascripts/lang/fr.js +91 -0
- data/vendor/assets/javascripts/lang/hr.js +87 -0
- data/vendor/assets/javascripts/lang/hu.js +90 -0
- data/vendor/assets/javascripts/lang/it.js +90 -0
- data/vendor/assets/javascripts/lang/ja.js +90 -0
- data/vendor/assets/javascripts/lang/ko.js +90 -0
- data/vendor/assets/javascripts/lang/nl.js +91 -0
- data/vendor/assets/javascripts/lang/pl.js +90 -0
- data/vendor/assets/javascripts/lang/pt.js +92 -0
- data/vendor/assets/javascripts/lang/ro.js +90 -0
- data/vendor/assets/javascripts/lang/ru.js +90 -0
- data/vendor/assets/javascripts/lang/sk.js +90 -0
- data/vendor/assets/javascripts/lang/sv.js +89 -0
- data/vendor/assets/javascripts/lang/uk.js +89 -0
- data/vendor/assets/javascripts/lang/zh-cn.js +90 -0
- data/vendor/assets/javascripts/lang/zh.js +91 -0
- data/vendor/assets/javascripts/mediaelement-and-player.js +8497 -0
- data/vendor/assets/javascripts/playlist-i18n.js +149 -0
- data/vendor/assets/javascripts/playlist.js +348 -0
- data/vendor/assets/javascripts/renderers/dailymotion.js +415 -0
- data/vendor/assets/javascripts/renderers/dailymotion.min.js +12 -0
- data/vendor/assets/javascripts/renderers/facebook.js +361 -0
- data/vendor/assets/javascripts/renderers/facebook.min.js +12 -0
- data/vendor/assets/javascripts/renderers/soundcloud.js +306 -0
- data/vendor/assets/javascripts/renderers/soundcloud.min.js +12 -0
- data/vendor/assets/javascripts/renderers/twitch.js +374 -0
- data/vendor/assets/javascripts/renderers/twitch.min.js +12 -0
- data/vendor/assets/javascripts/renderers/vimeo.js +411 -0
- data/vendor/assets/javascripts/renderers/vimeo.min.js +12 -0
- data/vendor/assets/stylesheets/mediaelementplayer-legacy.css.erb +774 -0
- data/vendor/assets/stylesheets/mediaelementplayer.css.erb +774 -0
- data/vendor/assets/stylesheets/playlist.css.erb +229 -0
- metadata +46 -1
@@ -0,0 +1,361 @@
|
|
1
|
+
/*!
|
2
|
+
* MediaElement.js
|
3
|
+
* http://www.mediaelementjs.com/
|
4
|
+
*
|
5
|
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6
|
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7
|
+
*
|
8
|
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9
|
+
* License: MIT
|
10
|
+
*
|
11
|
+
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var FacebookApi = {
|
15
|
+
|
16
|
+
promise: null,
|
17
|
+
|
18
|
+
load: function load(settings) {
|
19
|
+
|
20
|
+
if (typeof FB !== 'undefined') {
|
21
|
+
FacebookApi._createPlayer(settings);
|
22
|
+
} else {
|
23
|
+
FacebookApi.promise = FacebookApi.promise || mejs.Utils.loadScript('https://connect.facebook.net/' + settings.options.lang + '/sdk.js');
|
24
|
+
FacebookApi.promise.then(function () {
|
25
|
+
FB.init(settings.options);
|
26
|
+
|
27
|
+
setTimeout(function () {
|
28
|
+
FacebookApi._createPlayer(settings);
|
29
|
+
}, 50);
|
30
|
+
});
|
31
|
+
}
|
32
|
+
},
|
33
|
+
|
34
|
+
_createPlayer: function _createPlayer(settings) {
|
35
|
+
window['__ready__' + settings.id]();
|
36
|
+
}
|
37
|
+
};
|
38
|
+
var FacebookRenderer = {
|
39
|
+
name: 'facebook',
|
40
|
+
options: {
|
41
|
+
prefix: 'facebook',
|
42
|
+
facebook: {
|
43
|
+
appId: '',
|
44
|
+
xfbml: true,
|
45
|
+
version: 'v2.10',
|
46
|
+
lang: 'en_US'
|
47
|
+
}
|
48
|
+
},
|
49
|
+
|
50
|
+
canPlayType: function canPlayType(type) {
|
51
|
+
return ~['video/facebook', 'video/x-facebook'].indexOf(type.toLowerCase());
|
52
|
+
},
|
53
|
+
|
54
|
+
create: function create(mediaElement, options, mediaFiles) {
|
55
|
+
var apiStack = [],
|
56
|
+
fb = {},
|
57
|
+
readyState = 4;
|
58
|
+
|
59
|
+
var hasStartedPlaying = false,
|
60
|
+
paused = true,
|
61
|
+
ended = false,
|
62
|
+
fbPlayer = null,
|
63
|
+
src = '',
|
64
|
+
poster = '',
|
65
|
+
autoplay = mediaElement.originalNode.autoplay;
|
66
|
+
|
67
|
+
fb.options = options;
|
68
|
+
fb.id = mediaElement.id + '_' + options.prefix;
|
69
|
+
fb.mediaElement = mediaElement;
|
70
|
+
|
71
|
+
if (mejs.Features.isiPhone && mediaElement.originalNode.getAttribute('poster')) {
|
72
|
+
poster = mediaElement.originalNode.getAttribute('poster');
|
73
|
+
mediaElement.originalNode.removeAttribute('poster');
|
74
|
+
}
|
75
|
+
|
76
|
+
var props = mejs.html5media.properties,
|
77
|
+
assignGettersSetters = function assignGettersSetters(propName) {
|
78
|
+
|
79
|
+
var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
80
|
+
|
81
|
+
fb['get' + capName] = function () {
|
82
|
+
|
83
|
+
if (fbPlayer !== null) {
|
84
|
+
var value = null;
|
85
|
+
|
86
|
+
switch (propName) {
|
87
|
+
case 'currentTime':
|
88
|
+
return fbPlayer.getCurrentPosition();
|
89
|
+
case 'duration':
|
90
|
+
return fbPlayer.getDuration();
|
91
|
+
case 'volume':
|
92
|
+
return fbPlayer.getVolume();
|
93
|
+
case 'paused':
|
94
|
+
return paused;
|
95
|
+
case 'ended':
|
96
|
+
return ended;
|
97
|
+
case 'muted':
|
98
|
+
return fbPlayer.isMuted();
|
99
|
+
case 'buffered':
|
100
|
+
return {
|
101
|
+
start: function start() {
|
102
|
+
return 0;
|
103
|
+
},
|
104
|
+
end: function end() {
|
105
|
+
return 0;
|
106
|
+
},
|
107
|
+
length: 1
|
108
|
+
};
|
109
|
+
case 'src':
|
110
|
+
return src;
|
111
|
+
case 'readyState':
|
112
|
+
return readyState;
|
113
|
+
}
|
114
|
+
|
115
|
+
return value;
|
116
|
+
} else {
|
117
|
+
return null;
|
118
|
+
}
|
119
|
+
};
|
120
|
+
|
121
|
+
fb['set' + capName] = function (value) {
|
122
|
+
|
123
|
+
if (fbPlayer !== null) {
|
124
|
+
|
125
|
+
switch (propName) {
|
126
|
+
case 'src':
|
127
|
+
var url = typeof value === 'string' ? value : value[0].src;
|
128
|
+
src = url;
|
129
|
+
|
130
|
+
fbContainer.remove();
|
131
|
+
fbContainer = document.createElement('div');
|
132
|
+
fbContainer.id = fb.id;
|
133
|
+
fbContainer.className = 'fb-video';
|
134
|
+
fbContainer.setAttribute('data-href', url);
|
135
|
+
fbContainer.setAttribute('data-allowfullscreen', 'true');
|
136
|
+
fbContainer.setAttribute('data-controls', 'false');
|
137
|
+
|
138
|
+
mediaElement.originalNode.parentNode.insertBefore(fbContainer, mediaElement.originalNode);
|
139
|
+
mediaElement.originalNode.style.display = 'none';
|
140
|
+
|
141
|
+
FacebookApi.load({
|
142
|
+
lang: fb.options.lang,
|
143
|
+
id: fb.id
|
144
|
+
});
|
145
|
+
|
146
|
+
FB.XFBML.parse();
|
147
|
+
|
148
|
+
if (autoplay) {
|
149
|
+
fbPlayer.play();
|
150
|
+
}
|
151
|
+
break;
|
152
|
+
case 'currentTime':
|
153
|
+
fbPlayer.seek(value);
|
154
|
+
break;
|
155
|
+
case 'muted':
|
156
|
+
if (value) {
|
157
|
+
fbPlayer.mute();
|
158
|
+
} else {
|
159
|
+
fbPlayer.unmute();
|
160
|
+
}
|
161
|
+
setTimeout(function () {
|
162
|
+
var event = mejs.Utils.createEvent('volumechange', fb);
|
163
|
+
mediaElement.dispatchEvent(event);
|
164
|
+
}, 50);
|
165
|
+
break;
|
166
|
+
case 'volume':
|
167
|
+
fbPlayer.setVolume(value);
|
168
|
+
setTimeout(function () {
|
169
|
+
var event = mejs.Utils.createEvent('volumechange', fb);
|
170
|
+
mediaElement.dispatchEvent(event);
|
171
|
+
}, 50);
|
172
|
+
break;
|
173
|
+
case 'readyState':
|
174
|
+
var event = mejs.Utils.createEvent('canplay', fb);
|
175
|
+
mediaElement.dispatchEvent(event);
|
176
|
+
break;
|
177
|
+
default:
|
178
|
+
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
} else {
|
182
|
+
apiStack.push({ type: 'set', propName: propName, value: value });
|
183
|
+
}
|
184
|
+
};
|
185
|
+
};
|
186
|
+
|
187
|
+
for (var i = 0, total = props.length; i < total; i++) {
|
188
|
+
assignGettersSetters(props[i]);
|
189
|
+
}
|
190
|
+
|
191
|
+
var methods = mejs.html5media.methods,
|
192
|
+
assignMethods = function assignMethods(methodName) {
|
193
|
+
fb[methodName] = function () {
|
194
|
+
if (fbPlayer !== null) {
|
195
|
+
switch (methodName) {
|
196
|
+
case 'play':
|
197
|
+
return fbPlayer.play();
|
198
|
+
case 'pause':
|
199
|
+
return fbPlayer.pause();
|
200
|
+
case 'load':
|
201
|
+
return null;
|
202
|
+
}
|
203
|
+
} else {
|
204
|
+
apiStack.push({ type: 'call', methodName: methodName });
|
205
|
+
}
|
206
|
+
};
|
207
|
+
};
|
208
|
+
|
209
|
+
for (var _i = 0, _total = methods.length; _i < _total; _i++) {
|
210
|
+
assignMethods(methods[_i]);
|
211
|
+
}
|
212
|
+
|
213
|
+
function assignEvents(events) {
|
214
|
+
for (var _i2 = 0, _total2 = events.length; _i2 < _total2; _i2++) {
|
215
|
+
var event = mejs.Utils.createEvent(events[_i2], fb);
|
216
|
+
mediaElement.dispatchEvent(event);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
window['__ready__' + fb.id] = function () {
|
221
|
+
FB.Event.subscribe('xfbml.ready', function (msg) {
|
222
|
+
if (msg.type === 'video' && fb.id === msg.id) {
|
223
|
+
mediaElement.fbPlayer = fbPlayer = msg.instance;
|
224
|
+
|
225
|
+
var fbIframe = document.getElementById(fb.id),
|
226
|
+
width = fbIframe.offsetWidth,
|
227
|
+
height = fbIframe.offsetHeight,
|
228
|
+
events = ['mouseover', 'mouseout'],
|
229
|
+
assignIframeEvents = function assignIframeEvents(e) {
|
230
|
+
var event = mejs.Utils.createEvent(e.type, fb);
|
231
|
+
mediaElement.dispatchEvent(event);
|
232
|
+
};
|
233
|
+
|
234
|
+
fb.setSize(width, height);
|
235
|
+
if (!mediaElement.originalNode.muted) {
|
236
|
+
fbPlayer.unmute();
|
237
|
+
}
|
238
|
+
|
239
|
+
if (autoplay) {
|
240
|
+
fbPlayer.play();
|
241
|
+
}
|
242
|
+
|
243
|
+
for (var _i3 = 0, _total3 = events.length; _i3 < _total3; _i3++) {
|
244
|
+
fbIframe.addEventListener(events[_i3], assignIframeEvents);
|
245
|
+
}
|
246
|
+
|
247
|
+
fb.eventHandler = {};
|
248
|
+
|
249
|
+
var fbEvents = ['startedPlaying', 'paused', 'finishedPlaying', 'startedBuffering', 'finishedBuffering'];
|
250
|
+
for (var _i4 = 0, _total4 = fbEvents.length; _i4 < _total4; _i4++) {
|
251
|
+
var event = fbEvents[_i4],
|
252
|
+
handler = fb.eventHandler[event];
|
253
|
+
if (handler !== undefined && handler !== null && !mejs.Utils.isObjectEmpty(handler) && typeof handler.removeListener === 'function') {
|
254
|
+
handler.removeListener(event);
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
if (apiStack.length) {
|
259
|
+
for (var _i5 = 0, _total5 = apiStack.length; _i5 < _total5; _i5++) {
|
260
|
+
var stackItem = apiStack[_i5];
|
261
|
+
|
262
|
+
if (stackItem.type === 'set') {
|
263
|
+
var propName = stackItem.propName,
|
264
|
+
capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
265
|
+
|
266
|
+
fb['set' + capName](stackItem.value);
|
267
|
+
} else if (stackItem.type === 'call') {
|
268
|
+
fb[stackItem.methodName]();
|
269
|
+
}
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
assignEvents(['rendererready', 'loadeddata', 'canplay', 'progress', 'loadedmetadata', 'timeupdate']);
|
274
|
+
|
275
|
+
var timer = void 0;
|
276
|
+
|
277
|
+
fb.eventHandler.startedPlaying = fbPlayer.subscribe('startedPlaying', function () {
|
278
|
+
if (!hasStartedPlaying) {
|
279
|
+
hasStartedPlaying = true;
|
280
|
+
}
|
281
|
+
paused = false;
|
282
|
+
ended = false;
|
283
|
+
assignEvents(['play', 'playing', 'timeupdate']);
|
284
|
+
|
285
|
+
timer = setInterval(function () {
|
286
|
+
fbPlayer.getCurrentPosition();
|
287
|
+
assignEvents(['timeupdate']);
|
288
|
+
}, 250);
|
289
|
+
});
|
290
|
+
fb.eventHandler.paused = fbPlayer.subscribe('paused', function () {
|
291
|
+
paused = true;
|
292
|
+
ended = false;
|
293
|
+
assignEvents(['pause']);
|
294
|
+
});
|
295
|
+
fb.eventHandler.finishedPlaying = fbPlayer.subscribe('finishedPlaying', function () {
|
296
|
+
paused = true;
|
297
|
+
ended = true;
|
298
|
+
|
299
|
+
assignEvents(['ended']);
|
300
|
+
clearInterval(timer);
|
301
|
+
timer = null;
|
302
|
+
});
|
303
|
+
fb.eventHandler.startedBuffering = fbPlayer.subscribe('startedBuffering', function () {
|
304
|
+
assignEvents(['progress', 'timeupdate']);
|
305
|
+
});
|
306
|
+
fb.eventHandler.finishedBuffering = fbPlayer.subscribe('finishedBuffering', function () {
|
307
|
+
assignEvents(['progress', 'timeupdate']);
|
308
|
+
});
|
309
|
+
}
|
310
|
+
});
|
311
|
+
};
|
312
|
+
|
313
|
+
src = mediaFiles[0].src;
|
314
|
+
var fbContainer = document.createElement('div');
|
315
|
+
fbContainer.id = fb.id;
|
316
|
+
fbContainer.className = 'fb-video';
|
317
|
+
fbContainer.setAttribute('data-href', src);
|
318
|
+
fbContainer.setAttribute('data-allowfullscreen', true);
|
319
|
+
fbContainer.setAttribute('data-controls', !!mediaElement.originalNode.controls);
|
320
|
+
mediaElement.originalNode.parentNode.insertBefore(fbContainer, mediaElement.originalNode);
|
321
|
+
mediaElement.originalNode.style.display = 'none';
|
322
|
+
|
323
|
+
FacebookApi.load({
|
324
|
+
options: fb.options.facebook,
|
325
|
+
id: fb.id
|
326
|
+
});
|
327
|
+
|
328
|
+
fb.hide = function () {
|
329
|
+
fb.pause();
|
330
|
+
if (fbPlayer) {
|
331
|
+
fbContainer.style.display = 'none';
|
332
|
+
}
|
333
|
+
};
|
334
|
+
fb.setSize = function (width) {
|
335
|
+
if (fbPlayer !== null && !isNaN(width)) {
|
336
|
+
fbContainer.style.width = width;
|
337
|
+
}
|
338
|
+
};
|
339
|
+
fb.show = function () {
|
340
|
+
if (fbPlayer) {
|
341
|
+
fbContainer.style.display = '';
|
342
|
+
}
|
343
|
+
};
|
344
|
+
|
345
|
+
fb.destroy = function () {
|
346
|
+
if (poster) {
|
347
|
+
mediaElement.originalNode.setAttribute('poster', poster);
|
348
|
+
}
|
349
|
+
};
|
350
|
+
|
351
|
+
return fb;
|
352
|
+
}
|
353
|
+
};
|
354
|
+
|
355
|
+
mejs.Utils.typeChecks.push(function (url) {
|
356
|
+
return ~url.toLowerCase().indexOf('//www.facebook') ? 'video/x-facebook' : null;
|
357
|
+
});
|
358
|
+
|
359
|
+
mejs.Renderers.add(FacebookRenderer);
|
360
|
+
|
361
|
+
},{}]},{},[1]);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/*!
|
2
|
+
* MediaElement.js
|
3
|
+
* http://www.mediaelementjs.com/
|
4
|
+
*
|
5
|
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6
|
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7
|
+
*
|
8
|
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9
|
+
* License: MIT
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
!function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var u="function"==typeof require&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";var r={promise:null,load:function(e){"undefined"!=typeof FB?r._createPlayer(e):(r.promise=r.promise||mejs.Utils.loadScript("https://connect.facebook.net/"+e.options.lang+"/sdk.js"),r.promise.then(function(){FB.init(e.options),setTimeout(function(){r._createPlayer(e)},50)}))},_createPlayer:function(e){window["__ready__"+e.id]()}},i={name:"facebook",options:{prefix:"facebook",facebook:{appId:"",xfbml:!0,version:"v2.10",lang:"en_US"}},canPlayType:function(e){return~["video/facebook","video/x-facebook"].indexOf(e.toLowerCase())},create:function(e,t,n){function i(t){for(var n=0,r=t.length;n<r;n++){var i=mejs.Utils.createEvent(t[n],o);e.dispatchEvent(i)}}var a=[],o={},s=!1,u=!0,l=!1,d=null,c="",f="",p=e.originalNode.autoplay;o.options=t,o.id=e.id+"_"+t.prefix,o.mediaElement=e,mejs.Features.isiPhone&&e.originalNode.getAttribute("poster")&&(f=e.originalNode.getAttribute("poster"),e.originalNode.removeAttribute("poster"));for(var m=mejs.html5media.properties,v=0,g=m.length;v<g;v++)!function(t){var n=""+t.substring(0,1).toUpperCase()+t.substring(1);o["get"+n]=function(){if(null!==d){switch(t){case"currentTime":return d.getCurrentPosition();case"duration":return d.getDuration();case"volume":return d.getVolume();case"paused":return u;case"ended":return l;case"muted":return d.isMuted();case"buffered":return{start:function(){return 0},end:function(){return 0},length:1};case"src":return c;case"readyState":return 4}return null}return null},o["set"+n]=function(n){if(null!==d)switch(t){case"src":var i="string"==typeof n?n:n[0].src;c=i,N.remove(),(N=document.createElement("div")).id=o.id,N.className="fb-video",N.setAttribute("data-href",i),N.setAttribute("data-allowfullscreen","true"),N.setAttribute("data-controls","false"),e.originalNode.parentNode.insertBefore(N,e.originalNode),e.originalNode.style.display="none",r.load({lang:o.options.lang,id:o.id}),FB.XFBML.parse(),p&&d.play();break;case"currentTime":d.seek(n);break;case"muted":n?d.mute():d.unmute(),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",o);e.dispatchEvent(t)},50);break;case"volume":d.setVolume(n),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",o);e.dispatchEvent(t)},50);break;case"readyState":var s=mejs.Utils.createEvent("canplay",o);e.dispatchEvent(s)}else a.push({type:"set",propName:t,value:n})}}(m[v]);for(var y=mejs.html5media.methods,b=0,h=y.length;b<h;b++)!function(e){o[e]=function(){if(null!==d)switch(e){case"play":return d.play();case"pause":return d.pause();case"load":return null}else a.push({type:"call",methodName:e})}}(y[b]);window["__ready__"+o.id]=function(){FB.Event.subscribe("xfbml.ready",function(t){if("video"===t.type&&o.id===t.id){e.fbPlayer=d=t.instance;var n=document.getElementById(o.id),r=n.offsetWidth,c=n.offsetHeight,f=["mouseover","mouseout"];o.setSize(r,c),e.originalNode.muted||d.unmute(),p&&d.play();for(var m=0,v=f.length;m<v;m++)n.addEventListener(f[m],function(t){var n=mejs.Utils.createEvent(t.type,o);e.dispatchEvent(n)});o.eventHandler={};for(var g=["startedPlaying","paused","finishedPlaying","startedBuffering","finishedBuffering"],y=0,b=g.length;y<b;y++){var h=g[y],N=o.eventHandler[h];void 0===N||null===N||mejs.Utils.isObjectEmpty(N)||"function"!=typeof N.removeListener||N.removeListener(h)}if(a.length)for(var E=0,w=a.length;E<w;E++){var k=a[E];if("set"===k.type){var _=k.propName,j=""+_.substring(0,1).toUpperCase()+_.substring(1);o["set"+j](k.value)}else"call"===k.type&&o[k.methodName]()}i(["rendererready","loadeddata","canplay","progress","loadedmetadata","timeupdate"]);var B=void 0;o.eventHandler.startedPlaying=d.subscribe("startedPlaying",function(){s||(s=!0),u=!1,l=!1,i(["play","playing","timeupdate"]),B=setInterval(function(){d.getCurrentPosition(),i(["timeupdate"])},250)}),o.eventHandler.paused=d.subscribe("paused",function(){u=!0,l=!1,i(["pause"])}),o.eventHandler.finishedPlaying=d.subscribe("finishedPlaying",function(){u=!0,l=!0,i(["ended"]),clearInterval(B),B=null}),o.eventHandler.startedBuffering=d.subscribe("startedBuffering",function(){i(["progress","timeupdate"])}),o.eventHandler.finishedBuffering=d.subscribe("finishedBuffering",function(){i(["progress","timeupdate"])})}})},c=n[0].src;var N=document.createElement("div");return N.id=o.id,N.className="fb-video",N.setAttribute("data-href",c),N.setAttribute("data-allowfullscreen",!0),N.setAttribute("data-controls",!!e.originalNode.controls),e.originalNode.parentNode.insertBefore(N,e.originalNode),e.originalNode.style.display="none",r.load({options:o.options.facebook,id:o.id}),o.hide=function(){o.pause(),d&&(N.style.display="none")},o.setSize=function(e){null===d||isNaN(e)||(N.style.width=e)},o.show=function(){d&&(N.style.display="")},o.destroy=function(){f&&e.originalNode.setAttribute("poster",f)},o}};mejs.Utils.typeChecks.push(function(e){return~e.toLowerCase().indexOf("//www.facebook")?"video/x-facebook":null}),mejs.Renderers.add(i)},{}]},{},[1]);
|
@@ -0,0 +1,306 @@
|
|
1
|
+
/*!
|
2
|
+
* MediaElement.js
|
3
|
+
* http://www.mediaelementjs.com/
|
4
|
+
*
|
5
|
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6
|
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7
|
+
*
|
8
|
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9
|
+
* License: MIT
|
10
|
+
*
|
11
|
+
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
var SoundCloudApi = {
|
15
|
+
|
16
|
+
promise: null,
|
17
|
+
|
18
|
+
load: function load(settings) {
|
19
|
+
|
20
|
+
if (typeof SC !== 'undefined') {
|
21
|
+
SoundCloudApi._createPlayer(settings);
|
22
|
+
} else {
|
23
|
+
SoundCloudApi.promise = SoundCloudApi.promise || mejs.Utils.loadScript('https://w.soundcloud.com/player/api.js');
|
24
|
+
SoundCloudApi.promise.then(function () {
|
25
|
+
SoundCloudApi._createPlayer(settings);
|
26
|
+
});
|
27
|
+
}
|
28
|
+
},
|
29
|
+
|
30
|
+
_createPlayer: function _createPlayer(settings) {
|
31
|
+
var player = SC.Widget(settings.iframe);
|
32
|
+
window['__ready__' + settings.id](player);
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
var SoundCloudIframeRenderer = {
|
37
|
+
name: 'soundcloud_iframe',
|
38
|
+
options: {
|
39
|
+
prefix: 'soundcloud_iframe'
|
40
|
+
},
|
41
|
+
|
42
|
+
canPlayType: function canPlayType(type) {
|
43
|
+
return ~['video/soundcloud', 'video/x-soundcloud'].indexOf(type.toLowerCase());
|
44
|
+
},
|
45
|
+
|
46
|
+
create: function create(mediaElement, options, mediaFiles) {
|
47
|
+
var sc = {},
|
48
|
+
apiStack = [],
|
49
|
+
readyState = 4,
|
50
|
+
autoplay = mediaElement.originalNode.autoplay;
|
51
|
+
|
52
|
+
var duration = 0,
|
53
|
+
currentTime = 0,
|
54
|
+
bufferedTime = 0,
|
55
|
+
volume = 1,
|
56
|
+
muted = false,
|
57
|
+
paused = true,
|
58
|
+
ended = false,
|
59
|
+
scPlayer = null,
|
60
|
+
scIframe = null;
|
61
|
+
|
62
|
+
sc.options = options;
|
63
|
+
sc.id = mediaElement.id + '_' + options.prefix;
|
64
|
+
sc.mediaElement = mediaElement;
|
65
|
+
|
66
|
+
var props = mejs.html5media.properties,
|
67
|
+
assignGettersSetters = function assignGettersSetters(propName) {
|
68
|
+
var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
69
|
+
|
70
|
+
sc['get' + capName] = function () {
|
71
|
+
if (scPlayer !== null) {
|
72
|
+
var value = null;
|
73
|
+
|
74
|
+
switch (propName) {
|
75
|
+
case 'currentTime':
|
76
|
+
return currentTime;
|
77
|
+
case 'duration':
|
78
|
+
return duration;
|
79
|
+
case 'volume':
|
80
|
+
return volume;
|
81
|
+
case 'paused':
|
82
|
+
return paused;
|
83
|
+
case 'ended':
|
84
|
+
return ended;
|
85
|
+
case 'muted':
|
86
|
+
return muted;
|
87
|
+
case 'buffered':
|
88
|
+
return {
|
89
|
+
start: function start() {
|
90
|
+
return 0;
|
91
|
+
},
|
92
|
+
end: function end() {
|
93
|
+
return bufferedTime * duration;
|
94
|
+
},
|
95
|
+
length: 1
|
96
|
+
};
|
97
|
+
case 'src':
|
98
|
+
return scIframe ? scIframe.src : '';
|
99
|
+
case 'readyState':
|
100
|
+
return readyState;
|
101
|
+
}
|
102
|
+
return value;
|
103
|
+
} else {
|
104
|
+
return null;
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
sc['set' + capName] = function (value) {
|
109
|
+
if (scPlayer !== null) {
|
110
|
+
switch (propName) {
|
111
|
+
case 'src':
|
112
|
+
var url = typeof value === 'string' ? value : value[0].src;
|
113
|
+
scPlayer.load(url);
|
114
|
+
if (autoplay) {
|
115
|
+
scPlayer.play();
|
116
|
+
}
|
117
|
+
break;
|
118
|
+
case 'currentTime':
|
119
|
+
scPlayer.seekTo(value * 1000);
|
120
|
+
break;
|
121
|
+
case 'muted':
|
122
|
+
if (value) {
|
123
|
+
scPlayer.setVolume(0);
|
124
|
+
} else {
|
125
|
+
scPlayer.setVolume(1);
|
126
|
+
}
|
127
|
+
setTimeout(function () {
|
128
|
+
var event = mejs.Utils.createEvent('volumechange', sc);
|
129
|
+
mediaElement.dispatchEvent(event);
|
130
|
+
}, 50);
|
131
|
+
break;
|
132
|
+
case 'volume':
|
133
|
+
scPlayer.setVolume(value);
|
134
|
+
setTimeout(function () {
|
135
|
+
var event = mejs.Utils.createEvent('volumechange', sc);
|
136
|
+
mediaElement.dispatchEvent(event);
|
137
|
+
}, 50);
|
138
|
+
break;
|
139
|
+
case 'readyState':
|
140
|
+
var event = mejs.Utils.createEvent('canplay', sc);
|
141
|
+
mediaElement.dispatchEvent(event);
|
142
|
+
break;
|
143
|
+
|
144
|
+
default:
|
145
|
+
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
} else {
|
149
|
+
apiStack.push({ type: 'set', propName: propName, value: value });
|
150
|
+
}
|
151
|
+
};
|
152
|
+
};
|
153
|
+
|
154
|
+
for (var i = 0, total = props.length; i < total; i++) {
|
155
|
+
assignGettersSetters(props[i]);
|
156
|
+
}
|
157
|
+
|
158
|
+
var methods = mejs.html5media.methods,
|
159
|
+
assignMethods = function assignMethods(methodName) {
|
160
|
+
sc[methodName] = function () {
|
161
|
+
if (scPlayer !== null) {
|
162
|
+
switch (methodName) {
|
163
|
+
case 'play':
|
164
|
+
return scPlayer.play();
|
165
|
+
case 'pause':
|
166
|
+
return scPlayer.pause();
|
167
|
+
case 'load':
|
168
|
+
return null;
|
169
|
+
}
|
170
|
+
} else {
|
171
|
+
apiStack.push({ type: 'call', methodName: methodName });
|
172
|
+
}
|
173
|
+
};
|
174
|
+
};
|
175
|
+
|
176
|
+
for (var _i = 0, _total = methods.length; _i < _total; _i++) {
|
177
|
+
assignMethods(methods[_i]);
|
178
|
+
}
|
179
|
+
|
180
|
+
window['__ready__' + sc.id] = function (_scPlayer) {
|
181
|
+
|
182
|
+
mediaElement.scPlayer = scPlayer = _scPlayer;
|
183
|
+
|
184
|
+
if (autoplay) {
|
185
|
+
scPlayer.play();
|
186
|
+
}
|
187
|
+
|
188
|
+
if (apiStack.length) {
|
189
|
+
for (var _i2 = 0, _total2 = apiStack.length; _i2 < _total2; _i2++) {
|
190
|
+
|
191
|
+
var stackItem = apiStack[_i2];
|
192
|
+
|
193
|
+
if (stackItem.type === 'set') {
|
194
|
+
var propName = stackItem.propName,
|
195
|
+
capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
|
196
|
+
|
197
|
+
sc['set' + capName](stackItem.value);
|
198
|
+
} else if (stackItem.type === 'call') {
|
199
|
+
sc[stackItem.methodName]();
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
|
204
|
+
scPlayer.bind(SC.Widget.Events.PLAY_PROGRESS, function () {
|
205
|
+
paused = false;
|
206
|
+
ended = false;
|
207
|
+
scPlayer.getPosition(function (_currentTime) {
|
208
|
+
currentTime = _currentTime / 1000;
|
209
|
+
var event = mejs.Utils.createEvent('timeupdate', sc);
|
210
|
+
mediaElement.dispatchEvent(event);
|
211
|
+
});
|
212
|
+
});
|
213
|
+
scPlayer.bind(SC.Widget.Events.PAUSE, function () {
|
214
|
+
paused = true;
|
215
|
+
var event = mejs.Utils.createEvent('pause', sc);
|
216
|
+
mediaElement.dispatchEvent(event);
|
217
|
+
});
|
218
|
+
scPlayer.bind(SC.Widget.Events.PLAY, function () {
|
219
|
+
paused = false;
|
220
|
+
ended = false;
|
221
|
+
var event = mejs.Utils.createEvent('play', sc);
|
222
|
+
mediaElement.dispatchEvent(event);
|
223
|
+
});
|
224
|
+
scPlayer.bind(SC.Widget.Events.FINISHED, function () {
|
225
|
+
paused = false;
|
226
|
+
ended = true;
|
227
|
+
var event = mejs.Utils.createEvent('ended', sc);
|
228
|
+
mediaElement.dispatchEvent(event);
|
229
|
+
});
|
230
|
+
scPlayer.bind(SC.Widget.Events.READY, function () {
|
231
|
+
scPlayer.getDuration(function (_duration) {
|
232
|
+
duration = _duration / 1000;
|
233
|
+
var event = mejs.Utils.createEvent('loadedmetadata', sc);
|
234
|
+
mediaElement.dispatchEvent(event);
|
235
|
+
});
|
236
|
+
});
|
237
|
+
scPlayer.bind(SC.Widget.Events.LOAD_PROGRESS, function () {
|
238
|
+
scPlayer.getDuration(function (loadProgress) {
|
239
|
+
if (duration > 0) {
|
240
|
+
bufferedTime = duration * loadProgress;
|
241
|
+
var event = mejs.Utils.createEvent('progress', sc);
|
242
|
+
mediaElement.dispatchEvent(event);
|
243
|
+
}
|
244
|
+
});
|
245
|
+
scPlayer.getDuration(function (_duration) {
|
246
|
+
duration = _duration;
|
247
|
+
|
248
|
+
var event = mejs.Utils.createEvent('loadedmetadata', sc);
|
249
|
+
mediaElement.dispatchEvent(event);
|
250
|
+
});
|
251
|
+
});
|
252
|
+
|
253
|
+
var initEvents = ['rendererready', 'loadeddata', 'loadedmetadata', 'canplay'];
|
254
|
+
for (var _i3 = 0, _total3 = initEvents.length; _i3 < _total3; _i3++) {
|
255
|
+
var event = mejs.Utils.createEvent(initEvents[_i3], sc);
|
256
|
+
mediaElement.dispatchEvent(event);
|
257
|
+
}
|
258
|
+
};
|
259
|
+
|
260
|
+
scIframe = document.createElement('iframe');
|
261
|
+
scIframe.id = sc.id;
|
262
|
+
scIframe.width = 10;
|
263
|
+
scIframe.height = 10;
|
264
|
+
scIframe.frameBorder = 0;
|
265
|
+
scIframe.style.visibility = 'hidden';
|
266
|
+
scIframe.src = mediaFiles[0].src;
|
267
|
+
scIframe.scrolling = 'no';
|
268
|
+
|
269
|
+
mediaElement.appendChild(scIframe);
|
270
|
+
mediaElement.originalNode.style.display = 'none';
|
271
|
+
|
272
|
+
var scSettings = {
|
273
|
+
iframe: scIframe,
|
274
|
+
id: sc.id
|
275
|
+
};
|
276
|
+
|
277
|
+
SoundCloudApi.load(scSettings);
|
278
|
+
|
279
|
+
sc.setSize = function () {};
|
280
|
+
sc.hide = function () {
|
281
|
+
sc.pause();
|
282
|
+
if (scIframe) {
|
283
|
+
scIframe.style.display = 'none';
|
284
|
+
}
|
285
|
+
};
|
286
|
+
sc.show = function () {
|
287
|
+
if (scIframe) {
|
288
|
+
scIframe.style.display = '';
|
289
|
+
}
|
290
|
+
};
|
291
|
+
sc.destroy = function () {
|
292
|
+
scPlayer.destroy();
|
293
|
+
};
|
294
|
+
|
295
|
+
return sc;
|
296
|
+
}
|
297
|
+
};
|
298
|
+
|
299
|
+
mejs.Utils.typeChecks.push(function (url) {
|
300
|
+
return (/\/\/(w\.)?soundcloud.com/i.test(url) ? 'video/x-soundcloud' : null
|
301
|
+
);
|
302
|
+
});
|
303
|
+
|
304
|
+
mejs.Renderers.add(SoundCloudIframeRenderer);
|
305
|
+
|
306
|
+
},{}]},{},[1]);
|