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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/samvera_hls/version.rb +1 -1
  3. data/vendor/assets/flash/mediaelement-flash-audio-ogg.swf +0 -0
  4. data/vendor/assets/flash/mediaelement-flash-audio.swf +0 -0
  5. data/vendor/assets/flash/mediaelement-flash-video-hls.swf +0 -0
  6. data/vendor/assets/flash/mediaelement-flash-video-mdash.swf +0 -0
  7. data/vendor/assets/flash/mediaelement-flash-video.swf +0 -0
  8. data/vendor/assets/images/mejs-controls.png +0 -0
  9. data/vendor/assets/images/mejs-controls.svg +1 -0
  10. data/vendor/assets/images/playlist-controls.svg +52 -0
  11. data/vendor/assets/javascripts/lang/ca.js +89 -0
  12. data/vendor/assets/javascripts/lang/cs.js +90 -0
  13. data/vendor/assets/javascripts/lang/de.js +90 -0
  14. data/vendor/assets/javascripts/lang/es.js +90 -0
  15. data/vendor/assets/javascripts/lang/fa.js +90 -0
  16. data/vendor/assets/javascripts/lang/fr.js +91 -0
  17. data/vendor/assets/javascripts/lang/hr.js +87 -0
  18. data/vendor/assets/javascripts/lang/hu.js +90 -0
  19. data/vendor/assets/javascripts/lang/it.js +90 -0
  20. data/vendor/assets/javascripts/lang/ja.js +90 -0
  21. data/vendor/assets/javascripts/lang/ko.js +90 -0
  22. data/vendor/assets/javascripts/lang/nl.js +91 -0
  23. data/vendor/assets/javascripts/lang/pl.js +90 -0
  24. data/vendor/assets/javascripts/lang/pt.js +92 -0
  25. data/vendor/assets/javascripts/lang/ro.js +90 -0
  26. data/vendor/assets/javascripts/lang/ru.js +90 -0
  27. data/vendor/assets/javascripts/lang/sk.js +90 -0
  28. data/vendor/assets/javascripts/lang/sv.js +89 -0
  29. data/vendor/assets/javascripts/lang/uk.js +89 -0
  30. data/vendor/assets/javascripts/lang/zh-cn.js +90 -0
  31. data/vendor/assets/javascripts/lang/zh.js +91 -0
  32. data/vendor/assets/javascripts/mediaelement-and-player.js +8497 -0
  33. data/vendor/assets/javascripts/playlist-i18n.js +149 -0
  34. data/vendor/assets/javascripts/playlist.js +348 -0
  35. data/vendor/assets/javascripts/renderers/dailymotion.js +415 -0
  36. data/vendor/assets/javascripts/renderers/dailymotion.min.js +12 -0
  37. data/vendor/assets/javascripts/renderers/facebook.js +361 -0
  38. data/vendor/assets/javascripts/renderers/facebook.min.js +12 -0
  39. data/vendor/assets/javascripts/renderers/soundcloud.js +306 -0
  40. data/vendor/assets/javascripts/renderers/soundcloud.min.js +12 -0
  41. data/vendor/assets/javascripts/renderers/twitch.js +374 -0
  42. data/vendor/assets/javascripts/renderers/twitch.min.js +12 -0
  43. data/vendor/assets/javascripts/renderers/vimeo.js +411 -0
  44. data/vendor/assets/javascripts/renderers/vimeo.min.js +12 -0
  45. data/vendor/assets/stylesheets/mediaelementplayer-legacy.css.erb +774 -0
  46. data/vendor/assets/stylesheets/mediaelementplayer.css.erb +774 -0
  47. data/vendor/assets/stylesheets/playlist.css.erb +229 -0
  48. metadata +46 -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 a(s,o){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[s]={exports:{}};t[s][0].call(d.exports,function(e){var n=t[s][1][e];return a(n||e)},d,d.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)a(r[s]);return a}({1:[function(e,t,n){"use strict";var r={promise:null,load:function(e){"undefined"!=typeof SC?r._createPlayer(e):(r.promise=r.promise||mejs.Utils.loadScript("https://w.soundcloud.com/player/api.js"),r.promise.then(function(){r._createPlayer(e)}))},_createPlayer:function(e){var t=SC.Widget(e.iframe);window["__ready__"+e.id](t)}},a={name:"soundcloud_iframe",options:{prefix:"soundcloud_iframe"},canPlayType:function(e){return~["video/soundcloud","video/x-soundcloud"].indexOf(e.toLowerCase())},create:function(e,t,n){var a={},i=[],s=e.originalNode.autoplay,o=0,u=0,c=0,d=!0,l=!1,p=null,f=null;a.options=t,a.id=e.id+"_"+t.prefix,a.mediaElement=e;for(var v=mejs.html5media.properties,m=0,h=v.length;m<h;m++)!function(t){var n=""+t.substring(0,1).toUpperCase()+t.substring(1);a["get"+n]=function(){if(null!==p){switch(t){case"currentTime":return u;case"duration":return o;case"volume":return 1;case"paused":return d;case"ended":return l;case"muted":return!1;case"buffered":return{start:function(){return 0},end:function(){return c*o},length:1};case"src":return f?f.src:"";case"readyState":return 4}return null}return null},a["set"+n]=function(n){if(null!==p)switch(t){case"src":var r="string"==typeof n?n:n[0].src;p.load(r),s&&p.play();break;case"currentTime":p.seekTo(1e3*n);break;case"muted":n?p.setVolume(0):p.setVolume(1),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",a);e.dispatchEvent(t)},50);break;case"volume":p.setVolume(n),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",a);e.dispatchEvent(t)},50);break;case"readyState":var o=mejs.Utils.createEvent("canplay",a);e.dispatchEvent(o)}else i.push({type:"set",propName:t,value:n})}}(v[m]);for(var y=mejs.html5media.methods,E=0,g=y.length;E<g;E++)!function(e){a[e]=function(){if(null!==p)switch(e){case"play":return p.play();case"pause":return p.pause();case"load":return null}else i.push({type:"call",methodName:e})}}(y[E]);window["__ready__"+a.id]=function(t){if(e.scPlayer=p=t,s&&p.play(),i.length)for(var n=0,r=i.length;n<r;n++){var f=i[n];if("set"===f.type){var v=f.propName,m=""+v.substring(0,1).toUpperCase()+v.substring(1);a["set"+m](f.value)}else"call"===f.type&&a[f.methodName]()}p.bind(SC.Widget.Events.PLAY_PROGRESS,function(){d=!1,l=!1,p.getPosition(function(t){u=t/1e3;var n=mejs.Utils.createEvent("timeupdate",a);e.dispatchEvent(n)})}),p.bind(SC.Widget.Events.PAUSE,function(){d=!0;var t=mejs.Utils.createEvent("pause",a);e.dispatchEvent(t)}),p.bind(SC.Widget.Events.PLAY,function(){d=!1,l=!1;var t=mejs.Utils.createEvent("play",a);e.dispatchEvent(t)}),p.bind(SC.Widget.Events.FINISHED,function(){d=!1,l=!0;var t=mejs.Utils.createEvent("ended",a);e.dispatchEvent(t)}),p.bind(SC.Widget.Events.READY,function(){p.getDuration(function(t){o=t/1e3;var n=mejs.Utils.createEvent("loadedmetadata",a);e.dispatchEvent(n)})}),p.bind(SC.Widget.Events.LOAD_PROGRESS,function(){p.getDuration(function(t){if(o>0){c=o*t;var n=mejs.Utils.createEvent("progress",a);e.dispatchEvent(n)}}),p.getDuration(function(t){o=t;var n=mejs.Utils.createEvent("loadedmetadata",a);e.dispatchEvent(n)})});for(var h=["rendererready","loadeddata","loadedmetadata","canplay"],y=0,E=h.length;y<E;y++){var g=mejs.Utils.createEvent(h[y],a);e.dispatchEvent(g)}},(f=document.createElement("iframe")).id=a.id,f.width=10,f.height=10,f.frameBorder=0,f.style.visibility="hidden",f.src=n[0].src,f.scrolling="no",e.appendChild(f),e.originalNode.style.display="none";var S={iframe:f,id:a.id};return r.load(S),a.setSize=function(){},a.hide=function(){a.pause(),f&&(f.style.display="none")},a.show=function(){f&&(f.style.display="")},a.destroy=function(){p.destroy()},a}};mejs.Utils.typeChecks.push(function(e){return/\/\/(w\.)?soundcloud.com/i.test(e)?"video/x-soundcloud":null}),mejs.Renderers.add(a)},{}]},{},[1]);
@@ -0,0 +1,374 @@
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 TwitchApi = {
15
+
16
+ promise: null,
17
+
18
+ load: function load(settings) {
19
+ if (typeof Twitch !== 'undefined') {
20
+ TwitchApi.promise = new Promise(function (resolve) {
21
+ resolve();
22
+ }).then(function () {
23
+ TwitchApi._createPlayer(settings);
24
+ });
25
+ } else {
26
+ TwitchApi.promise = TwitchApi.promise || mejs.Utils.loadScript('https://player.twitch.tv/js/embed/v1.js');
27
+ TwitchApi.promise.then(function () {
28
+ TwitchApi._createPlayer(settings);
29
+ });
30
+ }
31
+ },
32
+
33
+ _createPlayer: function _createPlayer(settings) {
34
+ var player = new Twitch.Player(settings.id, settings);
35
+ window['__ready__' + settings.id](player);
36
+ },
37
+
38
+ getTwitchId: function getTwitchId(url) {
39
+ var twitchId = '';
40
+
41
+ if (url.indexOf('?') > 0) {
42
+ twitchId = TwitchApi.getTwitchIdFromParam(url);
43
+ if (twitchId === '') {
44
+ twitchId = TwitchApi.getTwitchIdFromUrl(url);
45
+ }
46
+ } else {
47
+ twitchId = TwitchApi.getTwitchIdFromUrl(url);
48
+ }
49
+
50
+ return twitchId;
51
+ },
52
+
53
+ getTwitchIdFromParam: function getTwitchIdFromParam(url) {
54
+ if (url === undefined || url === null || !url.trim().length) {
55
+ return null;
56
+ }
57
+
58
+ var parts = url.split('?'),
59
+ parameters = parts[1].split('&');
60
+
61
+ var twitchId = '';
62
+
63
+ for (var i = 0, total = parameters.length; i < total; i++) {
64
+ var paramParts = parameters[i].split('=');
65
+ if (~paramParts[0].indexOf('channel')) {
66
+ twitchId = paramParts[1];
67
+ break;
68
+ } else if (~paramParts[0].indexOf('video')) {
69
+ twitchId = 'v' + paramParts[1];
70
+ break;
71
+ }
72
+ }
73
+
74
+ return twitchId;
75
+ },
76
+
77
+ getTwitchIdFromUrl: function getTwitchIdFromUrl(url) {
78
+ if (url === undefined || url === null || !url.trim().length) {
79
+ return null;
80
+ }
81
+
82
+ var parts = url.split('?');
83
+ url = parts[0];
84
+ var id = url.substring(url.lastIndexOf('/') + 1);
85
+ return (/^\d+$/i.test(id) ? 'v' + id : id
86
+ );
87
+ },
88
+
89
+ getTwitchType: function getTwitchType(id) {
90
+ return (/^v\d+/i.test(id) ? 'video' : 'channel'
91
+ );
92
+ }
93
+ };
94
+
95
+ var TwitchIframeRenderer = {
96
+ name: 'twitch_iframe',
97
+ options: {
98
+ prefix: 'twitch_iframe'
99
+ },
100
+
101
+ canPlayType: function canPlayType(type) {
102
+ return ~['video/twitch', 'video/x-twitch'].indexOf(type.toLowerCase());
103
+ },
104
+
105
+ create: function create(mediaElement, options, mediaFiles) {
106
+ var twitch = {},
107
+ apiStack = [],
108
+ readyState = 4,
109
+ twitchId = TwitchApi.getTwitchId(mediaFiles[0].src);
110
+
111
+ var twitchPlayer = null,
112
+ paused = true,
113
+ ended = false,
114
+ hasStartedPlaying = false,
115
+ volume = 1,
116
+ duration = Infinity,
117
+ time = 0;
118
+
119
+ twitch.options = options;
120
+ twitch.id = mediaElement.id + '_' + options.prefix;
121
+ twitch.mediaElement = mediaElement;
122
+
123
+ var props = mejs.html5media.properties,
124
+ assignGettersSetters = function assignGettersSetters(propName) {
125
+ var capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
126
+
127
+ twitch['get' + capName] = function () {
128
+ if (twitchPlayer !== null) {
129
+ var value = null;
130
+
131
+ switch (propName) {
132
+ case 'currentTime':
133
+ time = twitchPlayer.getCurrentTime();
134
+ return time;
135
+ case 'duration':
136
+ duration = twitchPlayer.getDuration();
137
+ return duration;
138
+ case 'volume':
139
+ volume = twitchPlayer.getVolume();
140
+ return volume;
141
+ case 'paused':
142
+ paused = twitchPlayer.isPaused();
143
+ return paused;
144
+ case 'ended':
145
+ ended = twitchPlayer.getEnded();
146
+ return ended;
147
+ case 'muted':
148
+ return twitchPlayer.getMuted();
149
+ case 'buffered':
150
+ return {
151
+ start: function start() {
152
+ return 0;
153
+ },
154
+ end: function end() {
155
+ return 0;
156
+ },
157
+ length: 1
158
+ };
159
+ case 'src':
160
+ return TwitchApi.getTwitchType(twitchId) === 'channel' ? twitchPlayer.getChannel() : twitchPlayer.getVideo();
161
+ case 'readyState':
162
+ return readyState;
163
+ }
164
+
165
+ return value;
166
+ } else {
167
+ return null;
168
+ }
169
+ };
170
+
171
+ twitch['set' + capName] = function (value) {
172
+ if (twitchPlayer !== null) {
173
+ switch (propName) {
174
+ case 'src':
175
+ var url = typeof value === 'string' ? value : value[0].src,
176
+ videoId = TwitchApi.getTwitchId(url);
177
+
178
+ if (TwitchApi.getTwitchType(twitchId) === 'channel') {
179
+ twitchPlayer.setChannel(videoId);
180
+ } else {
181
+ twitchPlayer.setVideo(videoId);
182
+ }
183
+ break;
184
+ case 'currentTime':
185
+ twitchPlayer.seek(value);
186
+ setTimeout(function () {
187
+ var event = mejs.Utils.createEvent('timeupdate', twitch);
188
+ mediaElement.dispatchEvent(event);
189
+ }, 50);
190
+ break;
191
+ case 'muted':
192
+ twitchPlayer.setMuted(value);
193
+ setTimeout(function () {
194
+ var event = mejs.Utils.createEvent('volumechange', twitch);
195
+ mediaElement.dispatchEvent(event);
196
+ }, 50);
197
+ break;
198
+ case 'volume':
199
+ volume = value;
200
+ twitchPlayer.setVolume(value);
201
+ setTimeout(function () {
202
+ var event = mejs.Utils.createEvent('volumechange', twitch);
203
+ mediaElement.dispatchEvent(event);
204
+ }, 50);
205
+ break;
206
+ case 'readyState':
207
+ var event = mejs.Utils.createEvent('canplay', twitch);
208
+ mediaElement.dispatchEvent(event);
209
+ break;
210
+ default:
211
+
212
+ break;
213
+ }
214
+ } else {
215
+ apiStack.push({ type: 'set', propName: propName, value: value });
216
+ }
217
+ };
218
+ };
219
+
220
+ for (var i = 0, total = props.length; i < total; i++) {
221
+ assignGettersSetters(props[i]);
222
+ }
223
+
224
+ var methods = mejs.html5media.methods,
225
+ assignMethods = function assignMethods(methodName) {
226
+ twitch[methodName] = function () {
227
+ if (twitchPlayer !== null) {
228
+ switch (methodName) {
229
+ case 'play':
230
+ paused = false;
231
+ return twitchPlayer.play();
232
+ case 'pause':
233
+ paused = true;
234
+ return twitchPlayer.pause();
235
+ case 'load':
236
+ return null;
237
+ }
238
+ } else {
239
+ apiStack.push({ type: 'call', methodName: methodName });
240
+ }
241
+ };
242
+ };
243
+
244
+ for (var _i = 0, _total = methods.length; _i < _total; _i++) {
245
+ assignMethods(methods[_i]);
246
+ }
247
+
248
+ function sendEvents(events) {
249
+ for (var _i2 = 0, _total2 = events.length; _i2 < _total2; _i2++) {
250
+ var event = mejs.Utils.createEvent(events[_i2], twitch);
251
+ mediaElement.dispatchEvent(event);
252
+ }
253
+ }
254
+
255
+ window['__ready__' + twitch.id] = function (_twitchPlayer) {
256
+ mediaElement.twitchPlayer = twitchPlayer = _twitchPlayer;
257
+
258
+ if (apiStack.length) {
259
+ for (var _i3 = 0, _total3 = apiStack.length; _i3 < _total3; _i3++) {
260
+ var stackItem = apiStack[_i3];
261
+
262
+ if (stackItem.type === 'set') {
263
+ var propName = stackItem.propName,
264
+ capName = '' + propName.substring(0, 1).toUpperCase() + propName.substring(1);
265
+
266
+ twitch['set' + capName](stackItem.value);
267
+ } else if (stackItem.type === 'call') {
268
+ twitch[stackItem.methodName]();
269
+ }
270
+ }
271
+ }
272
+
273
+ var twitchIframe = document.getElementById(twitch.id).firstChild;
274
+ twitchIframe.style.width = '100%';
275
+ twitchIframe.style.height = '100%';
276
+
277
+ var events = ['mouseover', 'mouseout'],
278
+ assignEvents = function assignEvents(e) {
279
+ var event = mejs.Utils.createEvent(e.type, twitch);
280
+ mediaElement.dispatchEvent(event);
281
+ };
282
+
283
+ for (var _i4 = 0, _total4 = events.length; _i4 < _total4; _i4++) {
284
+ twitchIframe.addEventListener(events[_i4], assignEvents, false);
285
+ }
286
+
287
+ var timer = void 0;
288
+
289
+ twitchPlayer.addEventListener(Twitch.Player.READY, function () {
290
+ paused = false;
291
+ ended = false;
292
+ sendEvents(['rendererready', 'loadedmetadata', 'loadeddata', 'canplay']);
293
+ });
294
+ twitchPlayer.addEventListener(Twitch.Player.PLAY, function () {
295
+ if (!hasStartedPlaying) {
296
+ hasStartedPlaying = true;
297
+ }
298
+ paused = false;
299
+ ended = false;
300
+ sendEvents(['play', 'playing', 'progress']);
301
+
302
+ timer = setInterval(function () {
303
+ twitchPlayer.getCurrentTime();
304
+ sendEvents(['timeupdate']);
305
+ }, 250);
306
+ });
307
+ twitchPlayer.addEventListener(Twitch.Player.PAUSE, function () {
308
+ paused = true;
309
+ ended = false;
310
+ if (!twitchPlayer.getEnded()) {
311
+ sendEvents(['pause']);
312
+ }
313
+ });
314
+ twitchPlayer.addEventListener(Twitch.Player.ENDED, function () {
315
+ paused = true;
316
+ ended = true;
317
+ sendEvents(['ended']);
318
+ clearInterval(timer);
319
+ hasStartedPlaying = false;
320
+ timer = null;
321
+ });
322
+ };
323
+
324
+ var height = mediaElement.originalNode.height,
325
+ width = mediaElement.originalNode.width,
326
+ twitchContainer = document.createElement('div'),
327
+ type = TwitchApi.getTwitchType(twitchId),
328
+ twitchSettings = {
329
+ id: twitch.id,
330
+ width: width,
331
+ height: height,
332
+ playsinline: false,
333
+ autoplay: mediaElement.originalNode.autoplay,
334
+ muted: mediaElement.originalNode.muted
335
+ };
336
+
337
+ twitchSettings[type] = twitchId;
338
+ twitchContainer.id = twitch.id;
339
+ twitchContainer.style.width = '100%';
340
+ twitchContainer.style.height = '100%';
341
+
342
+ mediaElement.originalNode.parentNode.insertBefore(twitchContainer, mediaElement.originalNode);
343
+ mediaElement.originalNode.style.display = 'none';
344
+ mediaElement.originalNode.autoplay = false;
345
+
346
+ twitch.setSize = function (width, height) {
347
+ if (TwitchApi !== null && !isNaN(width) && !isNaN(height)) {
348
+ twitchContainer.setAttribute('width', width);
349
+ twitchContainer.setAttribute('height', height);
350
+ }
351
+ };
352
+ twitch.hide = function () {
353
+ twitch.pause();
354
+ twitchContainer.style.display = 'none';
355
+ };
356
+ twitch.show = function () {
357
+ twitchContainer.style.display = '';
358
+ };
359
+ twitch.destroy = function () {};
360
+
361
+ TwitchApi.load(twitchSettings);
362
+
363
+ return twitch;
364
+ }
365
+ };
366
+
367
+ mejs.Utils.typeChecks.push(function (url) {
368
+ return (/\/\/(www|player).twitch.tv/i.test(url) ? 'video/x-twitch' : null
369
+ );
370
+ });
371
+
372
+ mejs.Renderers.add(TwitchIframeRenderer);
373
+
374
+ },{}]},{},[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(s,o){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var d=n[s]={exports:{}};t[s][0].call(d.exports,function(e){var n=t[s][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,n){"use strict";var r={promise:null,load:function(e){"undefined"!=typeof Twitch?r.promise=new Promise(function(e){e()}).then(function(){r._createPlayer(e)}):(r.promise=r.promise||mejs.Utils.loadScript("https://player.twitch.tv/js/embed/v1.js"),r.promise.then(function(){r._createPlayer(e)}))},_createPlayer:function(e){var t=new Twitch.Player(e.id,e);window["__ready__"+e.id](t)},getTwitchId:function(e){var t="";return e.indexOf("?")>0?""===(t=r.getTwitchIdFromParam(e))&&(t=r.getTwitchIdFromUrl(e)):t=r.getTwitchIdFromUrl(e),t},getTwitchIdFromParam:function(e){if(void 0===e||null===e||!e.trim().length)return null;for(var t=e.split("?")[1].split("&"),n="",r=0,i=t.length;r<i;r++){var a=t[r].split("=");if(~a[0].indexOf("channel")){n=a[1];break}if(~a[0].indexOf("video")){n="v"+a[1];break}}return n},getTwitchIdFromUrl:function(e){if(void 0===e||null===e||!e.trim().length)return null;var t=(e=e.split("?")[0]).substring(e.lastIndexOf("/")+1);return/^\d+$/i.test(t)?"v"+t:t},getTwitchType:function(e){return/^v\d+/i.test(e)?"video":"channel"}},i={name:"twitch_iframe",options:{prefix:"twitch_iframe"},canPlayType:function(e){return~["video/twitch","video/x-twitch"].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],a);e.dispatchEvent(i)}}var a={},s=[],o=r.getTwitchId(n[0].src),u=null,l=!0,d=!1,c=!1,h=1,f=1/0,p=0;a.options=t,a.id=e.id+"_"+t.prefix,a.mediaElement=e;for(var v=mejs.html5media.properties,m=0,g=v.length;m<g;m++)!function(t){var n=""+t.substring(0,1).toUpperCase()+t.substring(1);a["get"+n]=function(){if(null!==u){switch(t){case"currentTime":return p=u.getCurrentTime();case"duration":return f=u.getDuration();case"volume":return h=u.getVolume();case"paused":return l=u.isPaused();case"ended":return d=u.getEnded();case"muted":return u.getMuted();case"buffered":return{start:function(){return 0},end:function(){return 0},length:1};case"src":return"channel"===r.getTwitchType(o)?u.getChannel():u.getVideo();case"readyState":return 4}return null}return null},a["set"+n]=function(n){if(null!==u)switch(t){case"src":var i="string"==typeof n?n:n[0].src,l=r.getTwitchId(i);"channel"===r.getTwitchType(o)?u.setChannel(l):u.setVideo(l);break;case"currentTime":u.seek(n),setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",a);e.dispatchEvent(t)},50);break;case"muted":u.setMuted(n),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",a);e.dispatchEvent(t)},50);break;case"volume":h=n,u.setVolume(n),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",a);e.dispatchEvent(t)},50);break;case"readyState":var d=mejs.Utils.createEvent("canplay",a);e.dispatchEvent(d)}else s.push({type:"set",propName:t,value:n})}}(v[m]);for(var y=mejs.html5media.methods,w=0,T=y.length;w<T;w++)!function(e){a[e]=function(){if(null!==u)switch(e){case"play":return l=!1,u.play();case"pause":return l=!0,u.pause();case"load":return null}else s.push({type:"call",methodName:e})}}(y[w]);window["__ready__"+a.id]=function(t){if(e.twitchPlayer=u=t,s.length)for(var n=0,r=s.length;n<r;n++){var o=s[n];if("set"===o.type){var h=o.propName,f=""+h.substring(0,1).toUpperCase()+h.substring(1);a["set"+f](o.value)}else"call"===o.type&&a[o.methodName]()}var p=document.getElementById(a.id).firstChild;p.style.width="100%",p.style.height="100%";for(var v=["mouseover","mouseout"],m=0,g=v.length;m<g;m++)p.addEventListener(v[m],function(t){var n=mejs.Utils.createEvent(t.type,a);e.dispatchEvent(n)},!1);var y=void 0;u.addEventListener(Twitch.Player.READY,function(){l=!1,d=!1,i(["rendererready","loadedmetadata","loadeddata","canplay"])}),u.addEventListener(Twitch.Player.PLAY,function(){c||(c=!0),l=!1,d=!1,i(["play","playing","progress"]),y=setInterval(function(){u.getCurrentTime(),i(["timeupdate"])},250)}),u.addEventListener(Twitch.Player.PAUSE,function(){l=!0,d=!1,u.getEnded()||i(["pause"])}),u.addEventListener(Twitch.Player.ENDED,function(){l=!0,d=!0,i(["ended"]),clearInterval(y),c=!1,y=null})};var E=e.originalNode.height,N=e.originalNode.width,P=document.createElement("div"),U=r.getTwitchType(o),_={id:a.id,width:N,height:E,playsinline:!1,autoplay:e.originalNode.autoplay,muted:e.originalNode.muted};return _[U]=o,P.id=a.id,P.style.width="100%",P.style.height="100%",e.originalNode.parentNode.insertBefore(P,e.originalNode),e.originalNode.style.display="none",e.originalNode.autoplay=!1,a.setSize=function(e,t){null===r||isNaN(e)||isNaN(t)||(P.setAttribute("width",e),P.setAttribute("height",t))},a.hide=function(){a.pause(),P.style.display="none"},a.show=function(){P.style.display=""},a.destroy=function(){},r.load(_),a}};mejs.Utils.typeChecks.push(function(e){return/\/\/(www|player).twitch.tv/i.test(e)?"video/x-twitch":null}),mejs.Renderers.add(i)},{}]},{},[1]);