mediaelement-plugins
Advanced tools
Comparing version 2.2.0 to 2.2.1
### Version History | ||
*2.2.1 (2017/05/16)* | ||
* Fixed issues in Safari related to `Source Chooser` plugin @rafa8626 | ||
* Added `babel-preset-env` to optimize bundles based on supported browsers @rafa8626 | ||
* Fixed issues with `Speed` and `Source chooser` related to their menu options (https://github.com/mediaelement/mediaelement-plugins/pull/41) @lebanggit | ||
* Expanded demo file with `Ads` and `VAST/VPAID` plugins @rafa8626 | ||
* Added missing workflow to avoid interacting with progress bar and some buttons in control bar when playing Ads @rafa8626 | ||
* Added new config element for `Chromecast` plugin to enable tracks @rafa8626 | ||
* Changed `match` to `test` and `includes` to `indexOf` to improve performance @rafa8626 | ||
* Fixed issues with `Context Menu` plugin not being displayed properly @rafa8626 | ||
* Enforced `https` on Chromecast library (https://github.com/mediaelement/mediaelement-plugins/pull/46) @jimmywarting | ||
* Fixed issue with `Skip Back` plugin (https://github.com/mediaelement/mediaelement-plugins/pull/48) @joelkraft | ||
*2.2.0 (2017/04/28)* | ||
@@ -4,0 +17,0 @@ |
@@ -49,4 +49,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -335,13 +335,24 @@ */ | ||
if (t.media.canPlayType(type) !== '' || t.media.canPlayType(type).match(/(no|false)/) === null) { | ||
if (t.media.canPlayType(type) !== '' || /(no|false)/i.test(t.media.canPlayType(type))) { | ||
adTag.mediaFiles.push({ | ||
id: mediaFile.getAttribute('id'), | ||
delivery: mediaFile.getAttribute('delivery'), | ||
type: mediaFile.getAttribute('type'), | ||
bitrate: mediaFile.getAttribute('bitrate'), | ||
width: mediaFile.getAttribute('width'), | ||
height: mediaFile.getAttribute('height'), | ||
url: mediaFile.textContent.trim() | ||
}); | ||
// Execute JS files if found | ||
if (mediaFile.getAttribute('type') === 'application/javascript') { | ||
var script = document.createElement('script'), | ||
firstScriptTag = document.getElementsByTagName('script')[0]; | ||
script.src = mediaFile.textContent.trim(); | ||
firstScriptTag.parentNode.insertBefore(script, firstScriptTag); | ||
} | ||
// Avoid Flash | ||
else if (mediaFile.getAttribute('delivery') !== 'application/x-shockwave-flash') { | ||
adTag.mediaFiles.push({ | ||
id: mediaFile.getAttribute('id'), | ||
delivery: mediaFile.getAttribute('delivery'), | ||
type: mediaFile.getAttribute('type'), | ||
bitrate: mediaFile.getAttribute('bitrate'), | ||
width: mediaFile.getAttribute('width'), | ||
height: mediaFile.getAttribute('height'), | ||
url: mediaFile.textContent.trim() | ||
}); | ||
} | ||
} | ||
@@ -390,3 +401,3 @@ } | ||
if (trackingPoints.includes(trackingEvent.type)) { | ||
if (~trackingPoints.indexOf(trackingEvent.type)) { | ||
if (adTag.trackingEvents[trackingEvent.type] === undefined) { | ||
@@ -407,3 +418,3 @@ adTag.trackingEvents[trackingEvent.type] = []; | ||
if (t.media.canPlayType(type) !== '' || t.media.canPlayType(type).match(/(no|false)/) === null) { | ||
if (t.media.canPlayType(type) !== '' || /(no|false)/i.test(t.media.canPlayType(type))) { | ||
@@ -453,4 +464,8 @@ adTag.mediaFiles.push({ | ||
while (i < t.vastAdTags.length) { | ||
t.options.adsPrerollMediaUrl[i] = t.vastAdTags[i].mediaFiles[0].url; | ||
t.options.adsPrerollAdUrl[i] = t.vastAdTags[i].clickThrough; | ||
if (typeof t.vastAdTags[i].mediaFiles !== 'undefined' && t.vastAdTags[i].mediaFiles.length) { | ||
t.options.adsPrerollMediaUrl[i] = t.vastAdTags[i].mediaFiles[0].url; | ||
} | ||
if (typeof t.vastAdTags[i].clickThrough !== 'undefined') { | ||
t.options.adsPrerollAdUrl[i] = t.vastAdTags[i].clickThrough; | ||
} | ||
i++; | ||
@@ -457,0 +472,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function t(e,a,i){function n(s,o){if(!a[s]){if(!e[s]){var d="function"==typeof require&&require;if(!o&&d)return d(s,!0);if(r)return r(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var g=a[s]={exports:{}};e[s][0].call(g.exports,function(t){var a=e[s][1][t];return n(a?a:t)},g,g.exports,t,e,a,i)}return a[s].exports}for(var r="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(t,e,a){"use strict";Object.assign(mejs.MepDefaults,{vastAdTagUrl:"",vastAdsType:"vast"}),Object.assign(MediaElementPlayer.prototype,{vastAdTagIsLoading:!1,vastAdTagIsLoaded:!1,vastStartedPlaying:!1,vastAdTags:[],buildvast:function(t,e,a,i){var n=this;n.isVideo&&(""!==n.options.vastAdTagUrl&&n.vastLoadAdTagInfo(),n.buildads(t,e,a,i),n.vastSetupEvents())},vastSetupEvents:function(){var t=this,e=!1,a=!1,i=!1;t.container.addEventListener("mejsprerollinitialized",function(){if(t.vastAdTags.length>0){var e=t.vastAdTags[0];if(e.trackingEvents.initialization)for(var a=0,i=e.trackingEvents.initialization.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.initialization[a])}}),t.container.addEventListener("mejsprerollstarted",function(){if(t.vastAdTags.length>0){var e=t.vastAdTags[0];if(e.trackingEvents.start)for(var a=0,i=e.trackingEvents.start.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.start[a]);if(!e.shown&&e.impressions.length>0)for(var n=0,r=e.impressions.length;n<r;n++)t.adsLoadUrl(e.impressions[n]);e.shown=!0}}),t.container.addEventListener("mejsprerollvolumechanged",function(){if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length){var e=t.vastAdTags[t.options.indexPreroll];if(e.trackingEvents.mute&&!t.media.volume)for(var a=0,i=e.trackingEvents.mute.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.mute[a]);if(e.trackingEvents.unmute&&t.media.volume)for(var n=0,r=e.trackingEvents.unmute.length;n<r;n++)t.adsLoadUrl(e.trackingEvents.unmute[n])}}),t.container.addEventListener("mejsprerolltimeupdate",function(n){if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length){var r=n.detail.duration,s=n.detail.currentTime,o=100*Math.min(1,Math.max(0,s/r)),d=t.vastAdTags[t.options.indexPreroll],l=o>=25&&o<50,g=o>=50&&o<75,v=o>=75&&o<100;if(d.trackingEvents.firstQuartile&&!e&&l){for(var c=0,m=d.trackingEvents.firstQuartile.length;c<m;c++)t.adsLoadUrl(d.trackingEvents.firstQuartile[c]);e=!0}else if(d.trackingEvents.midpoint&&!a&&g){for(var p=0,u=d.trackingEvents.midpoint.length;p<u;p++)t.adsLoadUrl(d.trackingEvents.midpoint[p]);a=!0}else if(d.trackingEvents.thirdQuartile&&!i&&v){for(var h=0,f=d.trackingEvents.thirdQuartile.length;h<f;h++)t.adsLoadUrl(d.trackingEvents.thirdQuartile[h]);i=!0}}}),t.container.addEventListener("mejsprerollended",function(){var n=t.vastAdTags[t.options.indexPreroll];if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length&&n.trackingEvents.complete)for(var r=0,s=n.trackingEvents.complete.length;r<s;r++)t.adsLoadUrl(n.trackingEvents.complete[r]);e=!1,a=!1,i=!1}),t.container.addEventListener("mejsprerolladsclicked",function(){var e=t.vastAdTags[t.options.indexPreroll];t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length&&e.clickThrough&&e.clickTracking&&t.adsLoadUrl(e.clickTracking)}),t.container.addEventListener("mejsprerollskipclicked",function(){var e=t.vastAdTags[t.options.indexPreroll];if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length&&e.trackingEvents.skip)for(var a=0,i=e.trackingEvents.skip.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.skip[a])})},vastSetAdTagUrl:function(t){var e=this;e.options.vastAdTagUrl=t,e.options.indexPreroll=0,e.vastAdTagIsLoaded=!1,e.vastAdTags=[]},vastLoadAdTagInfo:function(){var t=this;t.adsDataIsLoading=!0,t.vastAdTagIsLoading=!0,t.loadAdTagInfoDirect()},loadAdTagInfoDirect:function(){var t=this;mejs.Utils.ajax(t.options.vastAdTagUrl,"xml",function(e){"vpaid"===t.options.vastAdsType?t.vpaidParseVpaidData(e):t.vastParseVastData(e)},function(e){t.loadAdTagInfoProxy()})},loadAdTagInfoProxy:function(){var t=this,e=location.protocol,a='select * from xml where url="'+encodeURI(t.options.vastAdTagUrl)+'"',i="http"+(/^https/.test(e)?"s":"")+"://query.yahooapis.com/v1/public/yql?format=xml&q="+a;mejs.Utils.ajax(i,"xml",function(e){"vpaid"===t.options.vastAdsType?t.vpaidParseVpaidData(e):t.vastParseVastData(e)},function(t){})},vastParseVastData:function(t){var e=this,a=t.getElementsByTagName("Ad");e.vastAdTags=[],e.options.indexPreroll=0;for(var i=0,n=a.length;i<n;i++){var r=a[i],s=r.getElementsByTagName("AdTitle").length?r.getElementsByTagName("AdTitle")[0].textContent.trim():"",o=r.getElementsByTagName("Description").length?r.getElementsByTagName("Description")[0].textContent.trim():"",d=r.getElementsByTagName("ClickThrough").length?r.getElementsByTagName("ClickThrough")[0].textContent.trim():"",l=r.getElementsByTagName("ClickTracking").length?r.getElementsByTagName("ClickTracking")[0].textContent.trim():"",g={id:r.getAttribute("id"),title:s,description:o,impressions:[],clickThrough:d,clickTracking:l,mediaFiles:[],trackingEvents:{},shown:!1},v=r.getElementsByTagName("Impression"),c=r.getElementsByTagName("MediaFile"),m=r.getElementsByTagName("Tracking");e.vastAdTags.push(g);for(var p=0,u=v.length;p<u;p++)g.impressions.push(v[p].textContent.trim());for(var h=0,f=m.length;h<f;h++){var T=m[h],A=T.getAttribute("event");void 0===g.trackingEvents[A]&&(g.trackingEvents[A]=[]),g.trackingEvents[A].push(T.textContent.trim())}for(var k=0,E=c.length;k<E;k++){var y=c[k],x=y.getAttribute("type");""===e.media.canPlayType(x)&&null!==e.media.canPlayType(x).match(/(no|false)/)||g.mediaFiles.push({id:y.getAttribute("id"),delivery:y.getAttribute("delivery"),type:y.getAttribute("type"),bitrate:y.getAttribute("bitrate"),width:y.getAttribute("width"),height:y.getAttribute("height"),url:y.textContent.trim()})}}e.vastLoaded()},vpaidParseVpaidData:function(t){var e=this,a=t.getElementsByTagName("AdParameters");e.vpaidAdTags=[],e.options.indexPreroll=0;var i=JSON.parse(a[0].textContent.trim()),n=t.getElementsByTagName("Duration"),r={id:i.ad_id.trim(),title:i.title.trim(),clickThrough:i.page_url,impressions:[],mediaFiles:[],trackingEvents:{},shown:!1};if("undefined"!=typeof i.media.tracking.beacon)for(var s=["initialization","start","firstQuartile","midpoint","thirdQuartile","complete"],o=0,d=i.media.tracking.beacon.length;o<d;o++){var l=i.media.tracking.beacon[o];s.includes(l.type)?(void 0===r.trackingEvents[l.type]&&(r.trackingEvents[l.type]=[]),r.trackingEvents[l.type].push(l.beacon_url.trim())):"impression"===l.type&&r.impressions.push(l.beacon_url.trim())}for(var g in i.media.video)if(i.media.video.hasOwnProperty(g)){var v=i.media.video[g],c=v.mime_type.trim();""===e.media.canPlayType(c)&&null!==e.media.canPlayType(c).match(/(no|false)/)||r.mediaFiles.push({id:v.media_id,format:v.format,type:c,transcoding:v.transcoding,width:v.width,height:v.height,duration:n,url:v.media_url})}e.vastAdTags.push(r),e.vastLoaded()},vastLoaded:function(){var t=this;t.vastAdTagIsLoaded=!0,t.vastAdTagIsLoading=!1,t.adsDataIsLoading=!1,t.vastStartPreroll()},vastStartPreroll:function(){for(var t=this,e=0;e<t.vastAdTags.length;)t.options.adsPrerollMediaUrl[e]=t.vastAdTags[e].mediaFiles[0].url,t.options.adsPrerollAdUrl[e]=t.vastAdTags[e].clickThrough,e++;t.adsStartPreroll()}})},{}]},{},[1]); | ||
!function t(e,a,i){function n(s,o){if(!a[s]){if(!e[s]){var d="function"==typeof require&&require;if(!o&&d)return d(s,!0);if(r)return r(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var g=a[s]={exports:{}};e[s][0].call(g.exports,function(t){var a=e[s][1][t];return n(a||t)},g,g.exports,t,e,a,i)}return a[s].exports}for(var r="function"==typeof require&&require,s=0;s<i.length;s++)n(i[s]);return n}({1:[function(t,e,a){"use strict";Object.assign(mejs.MepDefaults,{vastAdTagUrl:"",vastAdsType:"vast"}),Object.assign(MediaElementPlayer.prototype,{vastAdTagIsLoading:!1,vastAdTagIsLoaded:!1,vastStartedPlaying:!1,vastAdTags:[],buildvast:function(t,e,a,i){var n=this;n.isVideo&&(""!==n.options.vastAdTagUrl&&n.vastLoadAdTagInfo(),n.buildads(t,e,a,i),n.vastSetupEvents())},vastSetupEvents:function(){var t=this,e=!1,a=!1,i=!1;t.container.addEventListener("mejsprerollinitialized",function(){if(t.vastAdTags.length>0){var e=t.vastAdTags[0];if(e.trackingEvents.initialization)for(var a=0,i=e.trackingEvents.initialization.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.initialization[a])}}),t.container.addEventListener("mejsprerollstarted",function(){if(t.vastAdTags.length>0){var e=t.vastAdTags[0];if(e.trackingEvents.start)for(var a=0,i=e.trackingEvents.start.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.start[a]);if(!e.shown&&e.impressions.length>0)for(var n=0,r=e.impressions.length;n<r;n++)t.adsLoadUrl(e.impressions[n]);e.shown=!0}}),t.container.addEventListener("mejsprerollvolumechanged",function(){if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length){var e=t.vastAdTags[t.options.indexPreroll];if(e.trackingEvents.mute&&!t.media.volume)for(var a=0,i=e.trackingEvents.mute.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.mute[a]);if(e.trackingEvents.unmute&&t.media.volume)for(var n=0,r=e.trackingEvents.unmute.length;n<r;n++)t.adsLoadUrl(e.trackingEvents.unmute[n])}}),t.container.addEventListener("mejsprerolltimeupdate",function(n){if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length){var r=n.detail.duration,s=n.detail.currentTime,o=100*Math.min(1,Math.max(0,s/r)),d=t.vastAdTags[t.options.indexPreroll],l=o>=25&&o<50,g=o>=50&&o<75,v=o>=75&&o<100;if(d.trackingEvents.firstQuartile&&!e&&l){for(var c=0,m=d.trackingEvents.firstQuartile.length;c<m;c++)t.adsLoadUrl(d.trackingEvents.firstQuartile[c]);e=!0}else if(d.trackingEvents.midpoint&&!a&&g){for(var p=0,u=d.trackingEvents.midpoint.length;p<u;p++)t.adsLoadUrl(d.trackingEvents.midpoint[p]);a=!0}else if(d.trackingEvents.thirdQuartile&&!i&&v){for(var h=0,f=d.trackingEvents.thirdQuartile.length;h<f;h++)t.adsLoadUrl(d.trackingEvents.thirdQuartile[h]);i=!0}}}),t.container.addEventListener("mejsprerollended",function(){var n=t.vastAdTags[t.options.indexPreroll];if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length&&n.trackingEvents.complete)for(var r=0,s=n.trackingEvents.complete.length;r<s;r++)t.adsLoadUrl(n.trackingEvents.complete[r]);e=!1,a=!1,i=!1}),t.container.addEventListener("mejsprerolladsclicked",function(){var e=t.vastAdTags[t.options.indexPreroll];t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length&&e.clickThrough&&e.clickTracking&&t.adsLoadUrl(e.clickTracking)}),t.container.addEventListener("mejsprerollskipclicked",function(){var e=t.vastAdTags[t.options.indexPreroll];if(t.vastAdTags.length>0&&t.options.indexPreroll<t.vastAdTags.length&&e.trackingEvents.skip)for(var a=0,i=e.trackingEvents.skip.length;a<i;a++)t.adsLoadUrl(e.trackingEvents.skip[a])})},vastSetAdTagUrl:function(t){var e=this;e.options.vastAdTagUrl=t,e.options.indexPreroll=0,e.vastAdTagIsLoaded=!1,e.vastAdTags=[]},vastLoadAdTagInfo:function(){var t=this;t.adsDataIsLoading=!0,t.vastAdTagIsLoading=!0,t.loadAdTagInfoDirect()},loadAdTagInfoDirect:function(){var t=this;mejs.Utils.ajax(t.options.vastAdTagUrl,"xml",function(e){"vpaid"===t.options.vastAdsType?t.vpaidParseVpaidData(e):t.vastParseVastData(e)},function(e){console.error("vast3:direct:error",e),t.loadAdTagInfoProxy()})},loadAdTagInfoProxy:function(){var t=this,e=location.protocol,a='select * from xml where url="'+encodeURI(t.options.vastAdTagUrl)+'"',i="http"+(/^https/.test(e)?"s":"")+"://query.yahooapis.com/v1/public/yql?format=xml&q="+a;mejs.Utils.ajax(i,"xml",function(e){"vpaid"===t.options.vastAdsType?t.vpaidParseVpaidData(e):t.vastParseVastData(e)},function(t){console.error("vast:proxy:yahoo:error",t)})},vastParseVastData:function(t){var e=this,a=t.getElementsByTagName("Ad");e.vastAdTags=[],e.options.indexPreroll=0;for(var i=0,n=a.length;i<n;i++){var r=a[i],s=r.getElementsByTagName("AdTitle").length?r.getElementsByTagName("AdTitle")[0].textContent.trim():"",o=r.getElementsByTagName("Description").length?r.getElementsByTagName("Description")[0].textContent.trim():"",d=r.getElementsByTagName("ClickThrough").length?r.getElementsByTagName("ClickThrough")[0].textContent.trim():"",l=r.getElementsByTagName("ClickTracking").length?r.getElementsByTagName("ClickTracking")[0].textContent.trim():"",g={id:r.getAttribute("id"),title:s,description:o,impressions:[],clickThrough:d,clickTracking:l,mediaFiles:[],trackingEvents:{},shown:!1},v=r.getElementsByTagName("Impression"),c=r.getElementsByTagName("MediaFile"),m=r.getElementsByTagName("Tracking");e.vastAdTags.push(g);for(var p=0,u=v.length;p<u;p++)g.impressions.push(v[p].textContent.trim());for(var h=0,f=m.length;h<f;h++){var T=m[h],A=T.getAttribute("event");void 0===g.trackingEvents[A]&&(g.trackingEvents[A]=[]),g.trackingEvents[A].push(T.textContent.trim())}for(var k=0,E=c.length;k<E;k++){var y=c[k],x=y.getAttribute("type");if(""!==e.media.canPlayType(x)||/(no|false)/i.test(e.media.canPlayType(x)))if("application/javascript"===y.getAttribute("type")){var P=document.createElement("script"),L=document.getElementsByTagName("script")[0];P.src=y.textContent.trim(),L.parentNode.insertBefore(P,L)}else"application/x-shockwave-flash"!==y.getAttribute("delivery")&&g.mediaFiles.push({id:y.getAttribute("id"),delivery:y.getAttribute("delivery"),type:y.getAttribute("type"),bitrate:y.getAttribute("bitrate"),width:y.getAttribute("width"),height:y.getAttribute("height"),url:y.textContent.trim()})}}e.vastLoaded()},vpaidParseVpaidData:function(t){var e=this,a=t.getElementsByTagName("AdParameters");e.vpaidAdTags=[],e.options.indexPreroll=0;var i=JSON.parse(a[0].textContent.trim()),n=t.getElementsByTagName("Duration"),r={id:i.ad_id.trim(),title:i.title.trim(),clickThrough:i.page_url,impressions:[],mediaFiles:[],trackingEvents:{},shown:!1};if(void 0!==i.media.tracking.beacon)for(var s=["initialization","start","firstQuartile","midpoint","thirdQuartile","complete"],o=0,d=i.media.tracking.beacon.length;o<d;o++){var l=i.media.tracking.beacon[o];~s.indexOf(l.type)?(void 0===r.trackingEvents[l.type]&&(r.trackingEvents[l.type]=[]),r.trackingEvents[l.type].push(l.beacon_url.trim())):"impression"===l.type&&r.impressions.push(l.beacon_url.trim())}for(var g in i.media.video)if(i.media.video.hasOwnProperty(g)){var v=i.media.video[g],c=v.mime_type.trim();(""!==e.media.canPlayType(c)||/(no|false)/i.test(e.media.canPlayType(c)))&&r.mediaFiles.push({id:v.media_id,format:v.format,type:c,transcoding:v.transcoding,width:v.width,height:v.height,duration:n,url:v.media_url})}e.vastAdTags.push(r),e.vastLoaded()},vastLoaded:function(){var t=this;t.vastAdTagIsLoaded=!0,t.vastAdTagIsLoading=!1,t.adsDataIsLoading=!1,t.vastStartPreroll()},vastStartPreroll:function(){for(var t=this,e=0;e<t.vastAdTags.length;)void 0!==t.vastAdTags[e].mediaFiles&&t.vastAdTags[e].mediaFiles.length&&(t.options.adsPrerollMediaUrl[e]=t.vastAdTags[e].mediaFiles[0].url),void 0!==t.vastAdTags[e].clickThrough&&(t.options.adsPrerollAdUrl[e]=t.vastAdTags[e].clickThrough),e++;t.adsStartPreroll()}})},{}]},{},[1]); |
@@ -62,2 +62,10 @@ (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){ | ||
/** | ||
* Feature constructor. | ||
* | ||
* Always has to be prefixed with `build` and the name that will be used in MepDefaults.features list | ||
* @param {MediaElementPlayer} player | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
*/ | ||
buildads: function buildads(player, controls, layers) { | ||
@@ -176,3 +184,12 @@ | ||
// turn off controls until the preroll is done | ||
t.disableControls(); | ||
var controlElements = t.container.querySelector("." + t.options.classPrefix + "controls").childNodes; | ||
for (var i = 0, total = controlElements.length; i < total; i++) { | ||
var target = controlElements[i], | ||
button = target.querySelector('button'); | ||
if (button && !mejs.Utils.hasClass(target, t.options.classPrefix + "playpause-button")) { | ||
button.disabled = true; | ||
} else if (target.querySelector("." + t.options.classPrefix + "time-slider")) { | ||
target.querySelector("." + t.options.classPrefix + "time-slider").style.pointerEvents = 'none'; | ||
} | ||
} | ||
@@ -193,3 +210,3 @@ // enable clicking through | ||
if (t.options.adsPrerollAdSkipSeconds > 0) { | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info').replace('%1', t.options.adsPrerollAdSkipSeconds.toString()); | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info', t.options.adsPrerollAdSkipSeconds); | ||
t.adsSkipMessage.style.display = 'block'; | ||
@@ -218,3 +235,3 @@ t.adsSkipButton.style.display = 'none'; | ||
} else { | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info').replace('%1', Math.round(t.options.adsPrerollAdSkipSeconds - t.media.currentTime).toString()); | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info', Math.round(t.options.adsPrerollAdSkipSeconds - t.media.currentTime)); | ||
} | ||
@@ -262,3 +279,14 @@ } | ||
t.enableControls(); | ||
// turn on controls to restore original media | ||
var controlElements = t.container.querySelector("." + t.options.classPrefix + "controls").childNodes; | ||
for (var i = 0, total = controlElements.length; i < total; i++) { | ||
var target = controlElements[i], | ||
button = target.querySelector('button'); | ||
if (button && !mejs.Utils.hasClass(target, t.options.classPrefix + "playpause-button")) { | ||
button.disabled = false; | ||
} else if (target.querySelector("." + t.options.classPrefix + "time-slider")) { | ||
target.querySelector("." + t.options.classPrefix + "time-slider").style.pointerEvents = 'auto'; | ||
} | ||
} | ||
if (t.adsSkipBlock) { | ||
@@ -322,3 +350,3 @@ t.adsSkipBlock.remove(); | ||
img.src = "" + url + (url.includes('?') ? '&' : '?') + "random" + rnd + "=" + rnd; | ||
img.src = "" + url + (~url.indexOf('?') ? '&' : '?') + "random" + rnd + "=" + rnd; | ||
img.loaded = function () { | ||
@@ -325,0 +353,0 @@ img = null; |
@@ -1,1 +0,1 @@ | ||
!function e(a,r,s){function t(d,o){if(!r[d]){if(!a[d]){var n="function"==typeof require&&require;if(!o&&n)return n(d,!0);if(i)return i(d,!0);var l=new Error("Cannot find module '"+d+"'");throw l.code="MODULE_NOT_FOUND",l}var p=r[d]={exports:{}};a[d][0].call(p.exports,function(e){var r=a[d][1][e];return t(r?r:e)},p,p.exports,e,a,r,s)}return r[d].exports}for(var i="function"==typeof require&&require,d=0;d<s.length;d++)t(s[d]);return t}({1:[function(e,a,r){"use strict";mejs.i18n.en["mejs.ad-skip"]="Skip ad",mejs.i18n.en["mejs.ad-skip-info"]=["Skip in 1 second","Skip in %1 seconds"],Object.assign(mejs.MepDefaults,{adsPrerollMediaUrl:[],adsPrerollAdUrl:[],adsPrerollAdEnableSkip:!1,adsPrerollAdSkipSeconds:-1,indexPreroll:0}),Object.assign(MediaElementPlayer.prototype,{adsLoaded:!1,adsDataIsLoading:!1,adsCurrentMediaUrl:"",adsCurrentMediaDuration:0,adsPlayerHasStarted:!1,buildads:function(e,a,r){var s=this;s.adsLoaded||(s.adsLoaded=!0,e.adsLayer=document.createElement("div"),e.adsLayer.className=s.options.classPrefix+"layer "+s.options.classPrefix+"overlay "+s.options.classPrefix+"ads",e.adsLayer.innerHTML='<a href="#" target="_blank"></a>'+('<div class="'+s.options.classPrefix+'ads-skip-block">')+('<span class="'+s.options.classPrefix+'ads-skip-message"></span>')+('<span class="'+s.options.classPrefix+'ads-skip-button">'+mejs.i18n.t("mejs.ad-skip")+"</span>")+"</div>",e.adsLayer.style.display="none",r.insertBefore(e.adsLayer,r.querySelector("."+s.options.classPrefix+"overlay-play")),e.adsLayer.querySelector("a").addEventListener("click",s.adsAdClick.bind(s)),e.adsSkipBlock=e.adsLayer.querySelector("."+s.options.classPrefix+"ads-skip-block"),e.adsSkipBlock.style.display="none",e.adsSkipMessage=e.adsLayer.querySelector("."+s.options.classPrefix+"ads-skip-message"),e.adsSkipMessage.style.display="none",e.adsSkipButton=e.adsLayer.querySelector("."+s.options.classPrefix+"ads-skip-button"),e.adsSkipButton.addEventListener("click",s.adsSkipClick.bind(s)),s.adsMediaTryingToStartProxy=s.adsMediaTryingToStart.bind(s),s.adsPrerollStartedProxy=s.adsPrerollStarted.bind(s),s.adsPrerollMetaProxy=s.adsPrerollMeta.bind(s),s.adsPrerollUpdateProxy=s.adsPrerollUpdate.bind(s),s.adsPrerollVolumeProxy=s.adsPrerollVolume.bind(s),s.adsPrerollEndedProxy=s.adsPrerollEnded.bind(s),s.media.addEventListener("play",s.adsMediaTryingToStartProxy),s.media.addEventListener("playing",s.adsMediaTryingToStartProxy),s.media.addEventListener("canplay",s.adsMediaTryingToStartProxy),s.media.addEventListener("loadedmetadata",s.adsMediaTryingToStartProxy),s.options.indexPreroll<s.options.adsPrerollMediaUrl.length&&s.adsStartPreroll())},adsMediaTryingToStart:function(){var e=this;e.adsDataIsLoading&&!e.media.paused&&e.media.pause(),e.adsPlayerHasStarted=!0},adsStartPreroll:function(){var e=this;e.media.addEventListener("loadedmetadata",e.adsPrerollMetaProxy),e.media.addEventListener("playing",e.adsPrerollStartedProxy),e.media.addEventListener("ended",e.adsPrerollEndedProxy),e.media.addEventListener("timeupdate",e.adsPrerollUpdateProxy),e.media.addEventListener("volumechange",e.adsPrerollVolumeProxy),0===e.options.indexPreroll&&(e.adsCurrentMediaUrl=e.media.src,e.adsCurrentMediaDuration=e.media.duration),e.media.setSrc(e.options.adsPrerollMediaUrl[e.options.indexPreroll]),e.media.load(),e.adsPlayerHasStarted&&setTimeout(function(){e.media.play()},100)},adsPrerollMeta:function(){var e=this,a=0;e.options.duration>0?a=e.options.duration:isNaN(e.adsCurrentMediaDuration)||(a=e.adsCurrentMediaDuration),e.controls.querySelector("."+e.options.classPrefix+"duration")&&setTimeout(function(){e.controls.querySelector("."+e.options.classPrefix+"duration").innerHTML=mejs.Utils.secondsToTimeCode(a,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength)},250);var r=mejs.Utils.createEvent("mejsprerollinitialized",e.container);e.container.dispatchEvent(r)},adsPrerollStarted:function(){var e=this;e.media.removeEventListener("playing",e.adsPrerollStartedProxy),e.disableControls(),e.adsLayer.style.display="block",e.options.adsPrerollAdUrl[e.options.indexPreroll]?e.adsLayer.querySelector("a").href=e.options.adsPrerollAdUrl[e.options.indexPreroll]:(e.adsLayer.querySelector("a").href="#",e.adsLayer.querySelector("a").setAttribute("target","")),e.options.adsPrerollAdEnableSkip?(e.adsSkipBlock.style.display="block",e.options.adsPrerollAdSkipSeconds>0?(e.adsSkipMessage.innerHTML=mejs.i18n.t("mejs.ad-skip-info").replace("%1",e.options.adsPrerollAdSkipSeconds.toString()),e.adsSkipMessage.style.display="block",e.adsSkipButton.style.display="none"):(e.adsSkipMessage.style.display="none",e.adsSkipButton.style.display="block")):e.adsSkipBlock.style.display="none";var a=mejs.Utils.createEvent("mejsprerollstarted",e.container);e.container.dispatchEvent(a)},adsPrerollUpdate:function(){var e=this;e.options.adsPrerollAdEnableSkip&&e.options.adsPrerollAdSkipSeconds>0&&(e.media.currentTime>e.options.adsPrerollAdSkipSeconds?(e.adsSkipButton.style.display="block",e.adsSkipMessage.style.display="none"):e.adsSkipMessage.innerHTML=mejs.i18n.t("mejs.ad-skip-info").replace("%1",Math.round(e.options.adsPrerollAdSkipSeconds-e.media.currentTime).toString()));var a=mejs.Utils.createEvent("mejsprerolltimeupdate",e.container);a.detail.duration=e.media.duration,a.detail.currentTime=e.media.currentTime,e.container.dispatchEvent(a)},adsPrerollVolume:function(){var e=this,a=mejs.Utils.createEvent("mejsprerollvolumechanged",e.container);e.container.dispatchEvent(a)},adsPrerollEnded:function(){var e=this;e.media.removeEventListener("ended",e.adsPrerollEndedProxy),setTimeout(function(){e.options.indexPreroll++,e.options.indexPreroll<e.options.adsPrerollMediaUrl.length?e.adsStartPreroll():e.adRestoreMainMedia();var a=mejs.Utils.createEvent("mejsprerollended",e.container);e.container.dispatchEvent(a)},0)},adRestoreMainMedia:function(){var e=this;e.media.setSrc(e.adsCurrentMediaUrl),setTimeout(function(){e.media.load(),e.media.play()},10),e.enableControls(),e.adsSkipBlock&&e.adsSkipBlock.remove(),e.adsLayer.style.display="none",e.media.removeEventListener("ended",e.adsPrerollEndedProxy),e.media.removeEventListener("loadedmetadata",e.adsPrerollMetaProxy),e.media.removeEventListener("timeupdate",e.adsPrerollUpdateProxy);var a=mejs.Utils.createEvent("mejsprerollmainstarted",e.container);e.container.dispatchEvent(a)},adsAdClick:function(){var e=this;e.media.paused?e.media.play():e.media.pause();var a=mejs.Utils.createEvent("mejsprerolladsclicked",e.container);e.container.dispatchEvent(a)},adsSkipClick:function(e){var a=this;a.media.removeEventListener("ended",a.adsPrerollEndedProxy);var r=mejs.Utils.createEvent("mejsprerollskipclicked",a.container);a.container.dispatchEvent(r),r=mejs.Utils.createEvent("mejsprerollended",a.container),a.container.dispatchEvent(r),a.options.indexPreroll++,a.options.indexPreroll<a.options.adsPrerollMediaUrl.length?a.adsStartPreroll():a.adRestoreMainMedia(),e.preventDefault(),e.stopPropagation()},prerollAdsFinished:function(){var e=this;return e.options.indexPreroll===e.options.adsPrerollMediaUrl.length},adsLoadUrl:function(e){var a=new Image,r=Math.round(1e5*Math.random());a.src=""+e+(e.includes("?")?"&":"?")+"random"+r+"="+r,a.loaded=function(){a=null}}})},{}]},{},[1]); | ||
!function e(a,r,s){function t(o,d){if(!r[o]){if(!a[o]){var n="function"==typeof require&&require;if(!d&&n)return n(o,!0);if(i)return i(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var p=r[o]={exports:{}};a[o][0].call(p.exports,function(e){var r=a[o][1][e];return t(r||e)},p,p.exports,e,a,r,s)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<s.length;o++)t(s[o]);return t}({1:[function(e,a,r){"use strict";mejs.i18n.en["mejs.ad-skip"]="Skip ad",mejs.i18n.en["mejs.ad-skip-info"]=["Skip in 1 second","Skip in %1 seconds"],Object.assign(mejs.MepDefaults,{adsPrerollMediaUrl:[],adsPrerollAdUrl:[],adsPrerollAdEnableSkip:!1,adsPrerollAdSkipSeconds:-1,indexPreroll:0}),Object.assign(MediaElementPlayer.prototype,{adsLoaded:!1,adsDataIsLoading:!1,adsCurrentMediaUrl:"",adsCurrentMediaDuration:0,adsPlayerHasStarted:!1,buildads:function(e,a,r){var s=this;s.adsLoaded||(s.adsLoaded=!0,e.adsLayer=document.createElement("div"),e.adsLayer.className=s.options.classPrefix+"layer "+s.options.classPrefix+"overlay "+s.options.classPrefix+"ads",e.adsLayer.innerHTML='<a href="#" target="_blank"></a><div class="'+s.options.classPrefix+'ads-skip-block"><span class="'+s.options.classPrefix+'ads-skip-message"></span><span class="'+s.options.classPrefix+'ads-skip-button">'+mejs.i18n.t("mejs.ad-skip")+"</span></div>",e.adsLayer.style.display="none",r.insertBefore(e.adsLayer,r.querySelector("."+s.options.classPrefix+"overlay-play")),e.adsLayer.querySelector("a").addEventListener("click",s.adsAdClick.bind(s)),e.adsSkipBlock=e.adsLayer.querySelector("."+s.options.classPrefix+"ads-skip-block"),e.adsSkipBlock.style.display="none",e.adsSkipMessage=e.adsLayer.querySelector("."+s.options.classPrefix+"ads-skip-message"),e.adsSkipMessage.style.display="none",e.adsSkipButton=e.adsLayer.querySelector("."+s.options.classPrefix+"ads-skip-button"),e.adsSkipButton.addEventListener("click",s.adsSkipClick.bind(s)),s.adsMediaTryingToStartProxy=s.adsMediaTryingToStart.bind(s),s.adsPrerollStartedProxy=s.adsPrerollStarted.bind(s),s.adsPrerollMetaProxy=s.adsPrerollMeta.bind(s),s.adsPrerollUpdateProxy=s.adsPrerollUpdate.bind(s),s.adsPrerollVolumeProxy=s.adsPrerollVolume.bind(s),s.adsPrerollEndedProxy=s.adsPrerollEnded.bind(s),s.media.addEventListener("play",s.adsMediaTryingToStartProxy),s.media.addEventListener("playing",s.adsMediaTryingToStartProxy),s.media.addEventListener("canplay",s.adsMediaTryingToStartProxy),s.media.addEventListener("loadedmetadata",s.adsMediaTryingToStartProxy),s.options.indexPreroll<s.options.adsPrerollMediaUrl.length&&s.adsStartPreroll())},adsMediaTryingToStart:function(){var e=this;e.adsDataIsLoading&&!e.media.paused&&e.media.pause(),e.adsPlayerHasStarted=!0},adsStartPreroll:function(){var e=this;e.media.addEventListener("loadedmetadata",e.adsPrerollMetaProxy),e.media.addEventListener("playing",e.adsPrerollStartedProxy),e.media.addEventListener("ended",e.adsPrerollEndedProxy),e.media.addEventListener("timeupdate",e.adsPrerollUpdateProxy),e.media.addEventListener("volumechange",e.adsPrerollVolumeProxy),0===e.options.indexPreroll&&(e.adsCurrentMediaUrl=e.media.src,e.adsCurrentMediaDuration=e.media.duration),e.media.setSrc(e.options.adsPrerollMediaUrl[e.options.indexPreroll]),e.media.load(),e.adsPlayerHasStarted&&setTimeout(function(){e.media.play()},100)},adsPrerollMeta:function(){var e=this,a=0;e.options.duration>0?a=e.options.duration:isNaN(e.adsCurrentMediaDuration)||(a=e.adsCurrentMediaDuration),e.controls.querySelector("."+e.options.classPrefix+"duration")&&setTimeout(function(){e.controls.querySelector("."+e.options.classPrefix+"duration").innerHTML=mejs.Utils.secondsToTimeCode(a,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond,e.options.secondsDecimalLength)},250);var r=mejs.Utils.createEvent("mejsprerollinitialized",e.container);e.container.dispatchEvent(r)},adsPrerollStarted:function(){var e=this;e.media.removeEventListener("playing",e.adsPrerollStartedProxy);for(var a=e.container.querySelector("."+e.options.classPrefix+"controls").childNodes,r=0,s=a.length;r<s;r++){var t=a[r],i=t.querySelector("button");i&&!mejs.Utils.hasClass(t,e.options.classPrefix+"playpause-button")?i.disabled=!0:t.querySelector("."+e.options.classPrefix+"time-slider")&&(t.querySelector("."+e.options.classPrefix+"time-slider").style.pointerEvents="none")}e.adsLayer.style.display="block",e.options.adsPrerollAdUrl[e.options.indexPreroll]?e.adsLayer.querySelector("a").href=e.options.adsPrerollAdUrl[e.options.indexPreroll]:(e.adsLayer.querySelector("a").href="#",e.adsLayer.querySelector("a").setAttribute("target","")),e.options.adsPrerollAdEnableSkip?(e.adsSkipBlock.style.display="block",e.options.adsPrerollAdSkipSeconds>0?(e.adsSkipMessage.innerHTML=mejs.i18n.t("mejs.ad-skip-info",e.options.adsPrerollAdSkipSeconds),e.adsSkipMessage.style.display="block",e.adsSkipButton.style.display="none"):(e.adsSkipMessage.style.display="none",e.adsSkipButton.style.display="block")):e.adsSkipBlock.style.display="none";var o=mejs.Utils.createEvent("mejsprerollstarted",e.container);e.container.dispatchEvent(o)},adsPrerollUpdate:function(){var e=this;e.options.adsPrerollAdEnableSkip&&e.options.adsPrerollAdSkipSeconds>0&&(e.media.currentTime>e.options.adsPrerollAdSkipSeconds?(e.adsSkipButton.style.display="block",e.adsSkipMessage.style.display="none"):e.adsSkipMessage.innerHTML=mejs.i18n.t("mejs.ad-skip-info",Math.round(e.options.adsPrerollAdSkipSeconds-e.media.currentTime)));var a=mejs.Utils.createEvent("mejsprerolltimeupdate",e.container);a.detail.duration=e.media.duration,a.detail.currentTime=e.media.currentTime,e.container.dispatchEvent(a)},adsPrerollVolume:function(){var e=this,a=mejs.Utils.createEvent("mejsprerollvolumechanged",e.container);e.container.dispatchEvent(a)},adsPrerollEnded:function(){var e=this;e.media.removeEventListener("ended",e.adsPrerollEndedProxy),setTimeout(function(){e.options.indexPreroll++,e.options.indexPreroll<e.options.adsPrerollMediaUrl.length?e.adsStartPreroll():e.adRestoreMainMedia();var a=mejs.Utils.createEvent("mejsprerollended",e.container);e.container.dispatchEvent(a)},0)},adRestoreMainMedia:function(){var e=this;e.media.setSrc(e.adsCurrentMediaUrl),setTimeout(function(){e.media.load(),e.media.play()},10);for(var a=e.container.querySelector("."+e.options.classPrefix+"controls").childNodes,r=0,s=a.length;r<s;r++){var t=a[r],i=t.querySelector("button");i&&!mejs.Utils.hasClass(t,e.options.classPrefix+"playpause-button")?i.disabled=!1:t.querySelector("."+e.options.classPrefix+"time-slider")&&(t.querySelector("."+e.options.classPrefix+"time-slider").style.pointerEvents="auto")}e.adsSkipBlock&&e.adsSkipBlock.remove(),e.adsLayer.style.display="none",e.media.removeEventListener("ended",e.adsPrerollEndedProxy),e.media.removeEventListener("loadedmetadata",e.adsPrerollMetaProxy),e.media.removeEventListener("timeupdate",e.adsPrerollUpdateProxy);var o=mejs.Utils.createEvent("mejsprerollmainstarted",e.container);e.container.dispatchEvent(o)},adsAdClick:function(){var e=this;e.media.paused?e.media.play():e.media.pause();var a=mejs.Utils.createEvent("mejsprerolladsclicked",e.container);e.container.dispatchEvent(a)},adsSkipClick:function(e){var a=this;a.media.removeEventListener("ended",a.adsPrerollEndedProxy);var r=mejs.Utils.createEvent("mejsprerollskipclicked",a.container);a.container.dispatchEvent(r),r=mejs.Utils.createEvent("mejsprerollended",a.container),a.container.dispatchEvent(r),a.options.indexPreroll++,a.options.indexPreroll<a.options.adsPrerollMediaUrl.length?a.adsStartPreroll():a.adRestoreMainMedia(),e.preventDefault(),e.stopPropagation()},prerollAdsFinished:function(){var e=this;return e.options.indexPreroll===e.options.adsPrerollMediaUrl.length},adsLoadUrl:function(e){var a=new Image,r=Math.round(1e5*Math.random());a.src=e+(~e.indexOf("?")?"&":"?")+"random"+r+"="+r,a.loaded=function(){a=null}}})},{}]},{},[1]); |
@@ -11,2 +11,10 @@ (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){ | ||
var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { | ||
return typeof obj === "undefined" ? "undefined" : _typeof2(obj); | ||
} : function (obj) { | ||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj); | ||
}; | ||
var CastRenderer = { | ||
@@ -17,5 +25,3 @@ | ||
options: { | ||
prefix: 'chromecast', | ||
cast: {} | ||
prefix: 'chromecast' | ||
}, | ||
@@ -39,3 +45,3 @@ | ||
*/ | ||
create: function create(mediaElement, options, mediaFiles) { | ||
create: function create(mediaElement, options) { | ||
@@ -238,38 +244,38 @@ // API objects | ||
mediaInfo = new chrome.cast.media.MediaInfo(url, type), | ||
castSession = cast.framework.CastContext.getInstance().getCurrentSession(); | ||
// Find captions/audioTracks | ||
if (options.castEnableTracks === true) { | ||
var tracks = [], | ||
children = mediaElement.originalNode.childNodes; | ||
// children = mediaElement.originalNode.childNodes, | ||
castSession = cast.framework.CastContext.getInstance().getCurrentSession(); | ||
var counter = 1; | ||
// Find captions/audioTracks | ||
// const tracks = []; | ||
// | ||
// let counter = 1; | ||
// | ||
// for (let i = 0, total = children.length; i < total; i++) { | ||
// const child = children[i]; | ||
// | ||
// if (child.nodeType !== Node.TEXT_NODE) { | ||
// const tag = child.tagName.toLowerCase(); | ||
// | ||
// if (tag === 'track' && (child.getAttribute('kind') === 'subtitles' || child.getAttribute('kind') === 'captions')) { | ||
// const el = new chrome.cast.media.Track(counter, chrome.cast.media.TrackType.TEXT); | ||
// el.trackContentId = mejs.Utils.absolutizeUrl(child.getAttribute('src')); | ||
// el.trackContentType = 'text/vtt'; | ||
// el.subtype = chrome.cast.media.TextTrackType.SUBTITLES; | ||
// el.name = child.getAttribute('label'); | ||
// el.language = child.getAttribute('srclang'); | ||
// el.customData = null; | ||
// tracks.push(el); | ||
// counter++; | ||
// } | ||
// } | ||
// } | ||
for (var _i = 0, _total = children.length; _i < _total; _i++) { | ||
var child = children[_i]; | ||
if (child.nodeType !== Node.TEXT_NODE) { | ||
var tag = child.tagName.toLowerCase(); | ||
if (tag === 'track' && (child.getAttribute('kind') === 'subtitles' || child.getAttribute('kind') === 'captions')) { | ||
var el = new chrome.cast.media.Track(counter, chrome.cast.media.TrackType.TEXT); | ||
el.trackContentId = mejs.Utils.absolutizeUrl(child.getAttribute('src')); | ||
el.trackContentType = 'text/vtt'; | ||
el.subtype = chrome.cast.media.TextTrackType.SUBTITLES; | ||
el.name = child.getAttribute('label'); | ||
el.language = child.getAttribute('srclang'); | ||
el.customData = null; | ||
tracks.push(el); | ||
counter++; | ||
} | ||
} | ||
} | ||
mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle(); | ||
mediaInfo.tracks = tracks; | ||
} | ||
mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata(); | ||
mediaInfo.streamType = chrome.cast.media.StreamType.BUFFERED; | ||
mediaInfo.customData = null; | ||
mediaInfo.streamType = chrome.cast.media.StreamType.BUFFERED; | ||
// mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle(); | ||
mediaInfo.duration = null; | ||
// mediaInfo.tracks = tracks; | ||
@@ -291,4 +297,7 @@ if (mediaElement.originalNode.getAttribute('data-cast-title')) { | ||
castSession.loadMedia(request).then(function () { | ||
// Autoplay media | ||
// Autoplay media in the current position | ||
var currentTime = mediaElement.originalNode.getCurrentTime(); | ||
c.setCurrentTime(currentTime); | ||
castPlayerController.playOrPause(); | ||
setTimeout(function () { | ||
@@ -307,4 +316,4 @@ var event = mejs.Utils.createEvent('play', c); | ||
for (var _i = 0, _total = methods.length; _i < _total; _i++) { | ||
assignMethods(methods[_i]); | ||
for (var _i2 = 0, _total2 = methods.length; _i2 < _total2; _i2++) { | ||
assignMethods(methods[_i2]); | ||
} | ||
@@ -415,4 +424,15 @@ | ||
*/ | ||
castPolicy: 'origin' | ||
castPolicy: 'origin', | ||
/** | ||
* Whether to load tracks or not through Chromecast | ||
* | ||
* In order to process tracks correctly, `tracks` feature must be enable on the player configuration | ||
* and user MUST set a custom receiver application. | ||
* @see https://github.com/googlecast/CastReferencePlayer | ||
* @see https://developers.google.com/cast/docs/receiver_apps | ||
* @type {Boolean} | ||
*/ | ||
castEnableTracks: false | ||
}); | ||
@@ -427,4 +447,4 @@ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -507,2 +527,4 @@ */ | ||
var currentTime = 0; | ||
// Set up renderer and device data | ||
@@ -513,35 +535,59 @@ media.castPlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED, function () { | ||
if (media.castPlayer.isConnected) { | ||
var _ret = function () { | ||
var _renderInfo = mejs.Renderers.select(mediaFiles, ['chromecast']); | ||
media.changeRenderer(_renderInfo.rendererName, mediaFiles); | ||
var renderInfo = mejs.Renderers.select(mediaFiles, ['chromecast']); | ||
media.changeRenderer(renderInfo.rendererName, mediaFiles); | ||
var | ||
// captions = player.captionsButton.querySelectorAll('input[type=radio]'), | ||
castSession = cast.framework.CastContext.getInstance().getCurrentSession(), | ||
deviceInfo = layers.querySelector('.' + t.options.classPrefix + 'chromecast-info').querySelector('.device'); | ||
var castSession = cast.framework.CastContext.getInstance().getCurrentSession(), | ||
deviceInfo = layers.querySelector('.' + t.options.classPrefix + 'chromecast-info').querySelector('.device'); | ||
deviceInfo.innerText = castSession.getCastDevice().friendlyName; | ||
player.chromecastLayer.style.display = 'block'; | ||
deviceInfo.innerText = castSession.getCastDevice().friendlyName; | ||
player.chromecastLayer.style.display = 'block'; | ||
// for (let i = 0, total = captions.length; i < total; i++) { | ||
// captions[i].addEventListener('click', function () { | ||
// const | ||
// trackId = parseInt(captions[i].id.replace(/^.*?track_(\d+)_.*$/, "$1")), | ||
// setTracks = captions[i].value === 'none' ? [] : [trackId], | ||
// tracksInfo = new chrome.cast.media.EditTracksInfoRequest(setTracks) | ||
// ; | ||
// | ||
// castSession.getMediaSession().editTracksInfo(tracksInfo, () => {}, (e) => { | ||
// console.error(e); | ||
// }); | ||
// }); | ||
// } | ||
if (t.options.castEnableTracks === true) { | ||
(function () { | ||
var captions = player.captionsButton !== undefined ? player.captionsButton.querySelectorAll('input[type=radio]') : null; | ||
return; | ||
if (captions !== null) { | ||
var _loop = function _loop(i, total) { | ||
captions[i].addEventListener('click', function () { | ||
var trackId = parseInt(captions[i].id.replace(/^.*?track_(\d+)_.*$/, "$1")), | ||
setTracks = captions[i].value === 'none' ? [] : [trackId], | ||
tracksInfo = new chrome.cast.media.EditTracksInfoRequest(setTracks); | ||
castSession.getMediaSession().editTracksInfo(tracksInfo, function () {}, function (e) { | ||
console.error(e); | ||
}); | ||
}); | ||
}; | ||
for (var i = 0, total = captions.length; i < total; i++) { | ||
_loop(i, total); | ||
} | ||
} | ||
})(); | ||
} | ||
media.addEventListener('timeupdate', function () { | ||
currentTime = media.getCurrentTime(); | ||
}); | ||
return { | ||
v: void 0 | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
} | ||
} | ||
player.chromecastLayer.style.display = 'none'; | ||
media.style.display = ''; | ||
var renderInfo = mejs.Renderers.select(mediaFiles, media.renderers); | ||
media.changeRenderer(renderInfo.rendererName, mediaFiles); | ||
player.chromecastLayer.style.display = 'none'; | ||
media.style.display = ''; | ||
var renderInfo = mejs.Renderers.select(mediaFiles, media.renderers); | ||
media.changeRenderer(renderInfo.rendererName, mediaFiles); | ||
media.setCurrentTime(currentTime); | ||
// Continue playing if already started | ||
if (currentTime > 0 && !mejs.Features.IS_IOS && !mejs.Features.IS_ANDROID) { | ||
media.play(); | ||
} | ||
@@ -553,3 +599,3 @@ }); | ||
var script = document.createElement('script'); | ||
script.src = '//www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'; | ||
script.src = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'; | ||
document.body.appendChild(script); | ||
@@ -556,0 +602,0 @@ loadedCastAPI = true; |
@@ -1,1 +0,1 @@ | ||
!function e(t,a,r){function s(o,i){if(!a[o]){if(!t[o]){var c="function"==typeof require&&require;if(!i&&c)return c(o,!0);if(n)return n(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var d=a[o]={exports:{}};t[o][0].call(d.exports,function(e){var a=t[o][1][e];return s(a||e)},d,d.exports,e,t,a,r)}return a[o].exports}for(var n="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(e,t,a){"use strict";var r={name:"chromecast",options:{prefix:"chromecast",cast:{}},canPlayType:function(){return!0},create:function(e,t,a){var r={},s=function(e){var t=e.description?" : "+e.description:".",a=void 0;switch(e.code){case chrome.cast.ErrorCode.API_NOT_INITIALIZED:a="The API is not initialized"+t;break;case chrome.cast.ErrorCode.CANCEL:a="The operation was canceled by the user"+t;break;case chrome.cast.ErrorCode.CHANNEL_ERROR:a="A channel to the receiver is not available"+t;break;case chrome.cast.ErrorCode.EXTENSION_MISSING:a="The Cast extension is not available"+t;break;case chrome.cast.ErrorCode.INVALID_PARAMETER:a="The parameters to the operation were not valid"+t;break;case chrome.cast.ErrorCode.RECEIVER_UNAVAILABLE:a="No receiver was compatible with the session request"+t;break;case chrome.cast.ErrorCode.SESSION_ERROR:a="A session could not be created, or a session was invalid"+t;break;case chrome.cast.ErrorCode.TIMEOUT:a="The operation timed out"+t;break;default:a="Unknown error: "+e.code}console.error(a)},n=e.castPlayer,o=e.castPlayerController,i=1;r.options=t,r.id=e.id+"_"+t.prefix,r.mediaElement=e;for(var c=mejs.html5media.properties,l=0,d=c.length;l<d;l++)!function(t){var a=""+t.substring(0,1).toUpperCase()+t.substring(1);r["get"+a]=function(){if(null!==n){switch(t){case"currentTime":return n.currentTime;case"duration":return n.duration;case"volume":return i=n.volumeLevel;case"paused":return n.isPaused;case"ended":return n.ended;case"muted":return n.isMuted;case"src":return e.originalNode.getAttribute("src");case"readyState":return 4}return null}return null},r["set"+a]=function(a){if(null!==n)switch(t){case"src":var s="string"==typeof a?a:a[0].src;e.originalNode.setAttribute("src",s);break;case"currentTime":n.currentTime=a,o.seek(),setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",r);e.dispatchEvent(t)},50);break;case"muted":!0!==a||n.isMuted?!1===a&&n.isMuted&&o.muteOrUnmute():o.muteOrUnmute(),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",r);e.dispatchEvent(t)},50);break;case"volume":i=a,n.volumeLevel=a,o.setVolumeLevel(),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",r);e.dispatchEvent(t)},50);break;case"readyState":var c=mejs.Utils.createEvent("canplay",r);e.dispatchEvent(c);break;case"playbackRate":e.originalNode.playbackRate=a;break;default:console.log("Chromecast "+r.id,t,"UNSUPPORTED property")}}}(c[l]);for(var u=mejs.html5media.methods,m=0,p=u.length;m<p;m++)!function(t){r[t]=function(){if(null!==n)switch(t){case"play":n.isPaused&&(o.playOrPause(),setTimeout(function(){var t=mejs.Utils.createEvent("play",r);e.dispatchEvent(t)},50));break;case"pause":n.isPaused||(o.playOrPause(),setTimeout(function(){var t=mejs.Utils.createEvent("pause",r);e.dispatchEvent(t)},50));break;case"load":var a=e.originalNode.getAttribute("src"),i=mejs.Utils.getTypeFromFile(a),c=new chrome.cast.media.MediaInfo(a,i),l=cast.framework.CastContext.getInstance().getCurrentSession();c.metadata=new chrome.cast.media.GenericMediaMetadata,c.customData=null,c.streamType=chrome.cast.media.StreamType.BUFFERED,c.duration=null,e.originalNode.getAttribute("data-cast-title")&&(c.metadata.title=e.originalNode.getAttribute("data-cast-title")),e.originalNode.getAttribute("data-cast-description")&&(c.metadata.subtitle=e.originalNode.getAttribute("data-cast-description")),e.originalNode.getAttribute("poster")&&(c.metadata.images=[{url:mejs.Utils.absolutizeUrl(e.originalNode.getAttribute("poster"))}]);var d=new chrome.cast.media.LoadRequest(c);l.loadMedia(d).then(function(){o.playOrPause(),setTimeout(function(){var t=mejs.Utils.createEvent("play",r);e.dispatchEvent(t)},50)},function(e){s(e)})}}}(u[m]);return window["__ready__"+r.id]=function(){o.addEventListener(cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED,function(){n.isPaused?r.pause():r.play()}),o.addEventListener(cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED,function(){return r.setMuted(n.isMuted)}),o.addEventListener(cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED,function(){setTimeout(function(){var t=mejs.Utils.createEvent("loadedmetadata",r);e.dispatchEvent(t)},50)}),o.addEventListener(cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED,function(){var t=mejs.Utils.createEvent("volumechange",r);e.dispatchEvent(t)}),o.addEventListener(cast.framework.RemotePlayerEventType.DURATION_CHANGED,function(){setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",r);e.dispatchEvent(t)},50)}),o.addEventListener(cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,function(){setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",r);e.dispatchEvent(t)},50),e.castPlayer.currentTime>=e.castPlayer.duration&&setTimeout(function(){var t=mejs.Utils.createEvent("ended",r);e.dispatchEvent(t)},50)}),o.addEventListener(cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED,function(){return r.setMuted(n.isMuted)}),r.load()},e.autoplay=!1,window["__ready__"+r.id](),r.setSize=function(){},r.hide=function(){},r.show=function(){},r.destroy=function(){null!==n&&o.stop(),e.style.display=""},r}};mejs.i18n.en["mejs.chromecast-legend"]="Casting to:",Object.assign(mejs.MepDefaults,{castTitle:null,castAppID:null,castPolicy:"origin"}),Object.assign(MediaElementPlayer.prototype,{buildchromecast:function(e,t,a,s){var n=this,o=document.createElement("div"),i=mejs.Utils.isString(n.options.castTitle)?n.options.castTitle:"Chromecast";if(e.isVideo){e.chromecastLayer=document.createElement("div"),e.chromecastLayer.className=n.options.classPrefix+"chromecast-layer "+n.options.classPrefix+"layer",e.chromecastLayer.innerHTML='<div class="'+n.options.classPrefix+'chromecast-info"></div>',e.chromecastLayer.style.display="none",a.insertBefore(e.chromecastLayer,a.firstChild),o.className=n.options.classPrefix+"button "+n.options.classPrefix+"chromecast-button",o.innerHTML='<button type="button" is="google-cast-button" aria-controls="'+n.id+'" title="'+i+'" aria-label="'+i+'" tabindex="0"></button>',n.addControlElement(o,"chromecast"),n.castButton=o,e.chromecastLayer.innerHTML='<div class="'+n.options.classPrefix+'chromecast-container"><span class="'+n.options.classPrefix+'chromecast-icon"></span><span class="'+n.options.classPrefix+'chromecast-info">'+mejs.i18n.t("mejs.chromecast-legend")+' <span class="device"></span></span></div>',s.originalNode.getAttribute("poster")&&(e.chromecastLayer.innerHTML+='<img src="'+s.originalNode.getAttribute("poster")+'" width="100%" height="100%">');var c=s.originalNode.getAttribute("src"),l=[{src:c,type:mejs.Utils.getTypeFromFile(c)}],d=!1;if(!d){window.__onGCastApiAvailable=function(t){if(t){mejs.Renderers.add(r),o.style.width="20px",setTimeout(function(){n.setPlayerSize(n.width,n.height),n.setControlsSize()},0);var i=void 0;switch(n.options.castPolicy){case"tab":i="TAB_AND_ORIGIN_SCOPED";break;case"page":i="PAGE_SCOPED";break;default:i="ORIGIN_SCOPED"}cast.framework.CastContext.getInstance().setOptions({receiverApplicationId:n.options.castAppID||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy[i]}),s.castPlayer=new cast.framework.RemotePlayer,s.castPlayerController=new cast.framework.RemotePlayerController(s.castPlayer),s.castPlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED,function(){if(cast&&cast.framework){if(s.castPlayer.isConnected){var t=mejs.Renderers.select(l,["chromecast"]);s.changeRenderer(t.rendererName,l);var r=cast.framework.CastContext.getInstance().getCurrentSession();return a.querySelector("."+n.options.classPrefix+"chromecast-info").querySelector(".device").innerText=r.getCastDevice().friendlyName,void(e.chromecastLayer.style.display="block")}e.chromecastLayer.style.display="none",s.style.display="";var o=mejs.Renderers.select(l,s.renderers);s.changeRenderer(o.rendererName,l)}})}};var u=document.createElement("script");u.src="//www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",document.body.appendChild(u),d=!0}}},clearchromecast:function(e){e.castPlayerController.stop(),e.castButton&&e.castButton.remove(),e.chromecastLayer&&e.chromecastLayer.remove()}})},{}]},{},[1]); | ||
!function e(t,r,a){function n(s,i){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!i&&c)return c(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[s]={exports:{}};t[s][0].call(u.exports,function(e){var r=t[s][1][e];return n(r||e)},u,u.exports,e,t,r,a)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<a.length;s++)n(a[s]);return n}({1:[function(e,t,r){"use strict";var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n="function"==typeof Symbol&&"symbol"===a(Symbol.iterator)?function(e){return void 0===e?"undefined":a(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":a(e)},o={name:"chromecast",options:{prefix:"chromecast"},canPlayType:function(){return!0},create:function(e,t){var r={},a=function(e){var t=e.description?" : "+e.description:".",r=void 0;switch(e.code){case chrome.cast.ErrorCode.API_NOT_INITIALIZED:r="The API is not initialized"+t;break;case chrome.cast.ErrorCode.CANCEL:r="The operation was canceled by the user"+t;break;case chrome.cast.ErrorCode.CHANNEL_ERROR:r="A channel to the receiver is not available"+t;break;case chrome.cast.ErrorCode.EXTENSION_MISSING:r="The Cast extension is not available"+t;break;case chrome.cast.ErrorCode.INVALID_PARAMETER:r="The parameters to the operation were not valid"+t;break;case chrome.cast.ErrorCode.RECEIVER_UNAVAILABLE:r="No receiver was compatible with the session request"+t;break;case chrome.cast.ErrorCode.SESSION_ERROR:r="A session could not be created, or a session was invalid"+t;break;case chrome.cast.ErrorCode.TIMEOUT:r="The operation timed out"+t;break;default:r="Unknown error: "+e.code}console.error(r)},n=e.castPlayer,o=e.castPlayerController,s=1;r.options=t,r.id=e.id+"_"+t.prefix,r.mediaElement=e;for(var i=mejs.html5media.properties,c=0,l=i.length;c<l;c++)!function(t){var a=""+t.substring(0,1).toUpperCase()+t.substring(1);r["get"+a]=function(){if(null!==n){switch(t){case"currentTime":return n.currentTime;case"duration":return n.duration;case"volume":return s=n.volumeLevel;case"paused":return n.isPaused;case"ended":return n.ended;case"muted":return n.isMuted;case"src":return e.originalNode.getAttribute("src");case"readyState":return 4}return null}return null},r["set"+a]=function(a){if(null!==n)switch(t){case"src":var i="string"==typeof a?a:a[0].src;e.originalNode.setAttribute("src",i);break;case"currentTime":n.currentTime=a,o.seek(),setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",r);e.dispatchEvent(t)},50);break;case"muted":!0!==a||n.isMuted?!1===a&&n.isMuted&&o.muteOrUnmute():o.muteOrUnmute(),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",r);e.dispatchEvent(t)},50);break;case"volume":s=a,n.volumeLevel=a,o.setVolumeLevel(),setTimeout(function(){var t=mejs.Utils.createEvent("volumechange",r);e.dispatchEvent(t)},50);break;case"readyState":var c=mejs.Utils.createEvent("canplay",r);e.dispatchEvent(c);break;case"playbackRate":e.originalNode.playbackRate=a;break;default:console.log("Chromecast "+r.id,t,"UNSUPPORTED property")}}}(i[c]);for(var u=mejs.html5media.methods,d=0,m=u.length;d<m;d++)!function(s){r[s]=function(){if(null!==n)switch(s){case"play":n.isPaused&&(o.playOrPause(),setTimeout(function(){var t=mejs.Utils.createEvent("play",r);e.dispatchEvent(t)},50));break;case"pause":n.isPaused||(o.playOrPause(),setTimeout(function(){var t=mejs.Utils.createEvent("pause",r);e.dispatchEvent(t)},50));break;case"load":var i=e.originalNode.getAttribute("src"),c=mejs.Utils.getTypeFromFile(i),l=new chrome.cast.media.MediaInfo(i,c),u=cast.framework.CastContext.getInstance().getCurrentSession();if(!0===t.castEnableTracks){for(var d=[],m=e.originalNode.childNodes,p=1,f=0,v=m.length;f<v;f++){var y=m[f];if(y.nodeType!==Node.TEXT_NODE){if("track"===y.tagName.toLowerCase()&&("subtitles"===y.getAttribute("kind")||"captions"===y.getAttribute("kind"))){var E=new chrome.cast.media.Track(p,chrome.cast.media.TrackType.TEXT);E.trackContentId=mejs.Utils.absolutizeUrl(y.getAttribute("src")),E.trackContentType="text/vtt",E.subtype=chrome.cast.media.TextTrackType.SUBTITLES,E.name=y.getAttribute("label"),E.language=y.getAttribute("srclang"),E.customData=null,d.push(E),p++}}}l.textTrackStyle=new chrome.cast.media.TextTrackStyle,l.tracks=d}l.metadata=new chrome.cast.media.GenericMediaMetadata,l.streamType=chrome.cast.media.StreamType.BUFFERED,l.customData=null,l.duration=null,e.originalNode.getAttribute("data-cast-title")&&(l.metadata.title=e.originalNode.getAttribute("data-cast-title")),e.originalNode.getAttribute("data-cast-description")&&(l.metadata.subtitle=e.originalNode.getAttribute("data-cast-description")),e.originalNode.getAttribute("poster")&&(l.metadata.images=[{url:mejs.Utils.absolutizeUrl(e.originalNode.getAttribute("poster"))}]);var h=new chrome.cast.media.LoadRequest(l);u.loadMedia(h).then(function(){var t=e.originalNode.getCurrentTime();r.setCurrentTime(t),o.playOrPause(),setTimeout(function(){var t=mejs.Utils.createEvent("play",r);e.dispatchEvent(t)},50)},function(e){a(e)})}}}(u[d]);return window["__ready__"+r.id]=function(){o.addEventListener(cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED,function(){n.isPaused?r.pause():r.play()}),o.addEventListener(cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED,function(){return r.setMuted(n.isMuted)}),o.addEventListener(cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED,function(){setTimeout(function(){var t=mejs.Utils.createEvent("loadedmetadata",r);e.dispatchEvent(t)},50)}),o.addEventListener(cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED,function(){var t=mejs.Utils.createEvent("volumechange",r);e.dispatchEvent(t)}),o.addEventListener(cast.framework.RemotePlayerEventType.DURATION_CHANGED,function(){setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",r);e.dispatchEvent(t)},50)}),o.addEventListener(cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED,function(){setTimeout(function(){var t=mejs.Utils.createEvent("timeupdate",r);e.dispatchEvent(t)},50),e.castPlayer.currentTime>=e.castPlayer.duration&&setTimeout(function(){var t=mejs.Utils.createEvent("ended",r);e.dispatchEvent(t)},50)}),o.addEventListener(cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED,function(){return r.setMuted(n.isMuted)}),r.load()},e.autoplay=!1,window["__ready__"+r.id](),r.setSize=function(){},r.hide=function(){},r.show=function(){},r.destroy=function(){null!==n&&o.stop(),e.style.display=""},r}};mejs.i18n.en["mejs.chromecast-legend"]="Casting to:",Object.assign(mejs.MepDefaults,{castTitle:null,castAppID:null,castPolicy:"origin",castEnableTracks:!1}),Object.assign(MediaElementPlayer.prototype,{buildchromecast:function(e,t,r,a){var s=this,i=document.createElement("div"),c=mejs.Utils.isString(s.options.castTitle)?s.options.castTitle:"Chromecast";if(e.isVideo){e.chromecastLayer=document.createElement("div"),e.chromecastLayer.className=s.options.classPrefix+"chromecast-layer "+s.options.classPrefix+"layer",e.chromecastLayer.innerHTML='<div class="'+s.options.classPrefix+'chromecast-info"></div>',e.chromecastLayer.style.display="none",r.insertBefore(e.chromecastLayer,r.firstChild),i.className=s.options.classPrefix+"button "+s.options.classPrefix+"chromecast-button",i.innerHTML='<button type="button" is="google-cast-button" aria-controls="'+s.id+'" title="'+c+'" aria-label="'+c+'" tabindex="0"></button>',s.addControlElement(i,"chromecast"),s.castButton=i,e.chromecastLayer.innerHTML='<div class="'+s.options.classPrefix+'chromecast-container"><span class="'+s.options.classPrefix+'chromecast-icon"></span><span class="'+s.options.classPrefix+'chromecast-info">'+mejs.i18n.t("mejs.chromecast-legend")+' <span class="device"></span></span></div>',a.originalNode.getAttribute("poster")&&(e.chromecastLayer.innerHTML+='<img src="'+a.originalNode.getAttribute("poster")+'" width="100%" height="100%">');var l=a.originalNode.getAttribute("src"),u=[{src:l,type:mejs.Utils.getTypeFromFile(l)}],d=!1;if(!d){window.__onGCastApiAvailable=function(t){if(t){mejs.Renderers.add(o),i.style.width="20px",setTimeout(function(){s.setPlayerSize(s.width,s.height),s.setControlsSize()},0);var c=void 0;switch(s.options.castPolicy){case"tab":c="TAB_AND_ORIGIN_SCOPED";break;case"page":c="PAGE_SCOPED";break;default:c="ORIGIN_SCOPED"}cast.framework.CastContext.getInstance().setOptions({receiverApplicationId:s.options.castAppID||chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:chrome.cast.AutoJoinPolicy[c]}),a.castPlayer=new cast.framework.RemotePlayer,a.castPlayerController=new cast.framework.RemotePlayerController(a.castPlayer);var l=0;a.castPlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED,function(){if(cast&&cast.framework&&a.castPlayer.isConnected){var t=function(){var t=mejs.Renderers.select(u,["chromecast"]);a.changeRenderer(t.rendererName,u);var n=cast.framework.CastContext.getInstance().getCurrentSession();return r.querySelector("."+s.options.classPrefix+"chromecast-info").querySelector(".device").innerText=n.getCastDevice().friendlyName,e.chromecastLayer.style.display="block",!0===s.options.castEnableTracks&&function(){var t=void 0!==e.captionsButton?e.captionsButton.querySelectorAll("input[type=radio]"):null;if(null!==t)for(var r=0,a=t.length;r<a;r++)!function(e,r){t[e].addEventListener("click",function(){var r=parseInt(t[e].id.replace(/^.*?track_(\d+)_.*$/,"$1")),a="none"===t[e].value?[]:[r],o=new chrome.cast.media.EditTracksInfoRequest(a);n.getMediaSession().editTracksInfo(o,function(){},function(e){console.error(e)})})}(r)}(),a.addEventListener("timeupdate",function(){l=a.getCurrentTime()}),{v:void 0}}();if("object"===(void 0===t?"undefined":n(t)))return t.v}e.chromecastLayer.style.display="none",a.style.display="";var o=mejs.Renderers.select(u,a.renderers);a.changeRenderer(o.rendererName,u),a.setCurrentTime(l),l>0&&!mejs.Features.IS_IOS&&!mejs.Features.IS_ANDROID&&a.play()})}};var m=document.createElement("script");m.src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",document.body.appendChild(m),d=!0}}},clearchromecast:function(e){e.castPlayerController.stop(),e.castButton&&e.castButton.remove(),e.chromecastLayer&&e.chromecastLayer.remove()}})},{}]},{},[1]); |
@@ -15,4 +15,2 @@ (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){ | ||
Object.assign(mejs.MepDefaults, { | ||
isContextMenuEnabled: true, | ||
contextMenuTimeout: null, | ||
contextMenuItems: [{ | ||
@@ -74,19 +72,22 @@ // demo of a fullscreen option | ||
Object.assign(MediaElementPlayer.prototype, { | ||
isContextMenuEnabled: true, | ||
contextMenuTimeout: null, | ||
buildcontextmenu: function buildcontextmenu(player) { | ||
if (document.querySelector("." + player.options.classPrefix + "contextmenu")) { | ||
return; | ||
} | ||
// create context menu | ||
player.contextMenu = document.createElement('div'); | ||
player.contextMenu.className = player.options.classPrefix + "contextmenu"; | ||
player.contextMenu.style.display = 'none'; | ||
if (!document.querySelector("." + player.options.classPrefix + "contextmenu")) { | ||
player.contextMenu = document.createElement('div'); | ||
player.contextMenu.className = player.options.classPrefix + "contextmenu"; | ||
player.contextMenu.style.display = 'none'; | ||
document.body.appendChild(player.contextMenu); | ||
document.body.appendChild(player.contextMenu); | ||
} | ||
// create events for showing context menu | ||
player.container.addEventListener('contextmenu', function (e) { | ||
if (player.isContextMenuEnabled) { | ||
player.renderContextMenu(e.clientX - 1, e.clientY - 1); | ||
if (player.isContextMenuEnabled && (e.keyCode === 3 || e.which === 3)) { | ||
player.renderContextMenu(e); | ||
e.preventDefault(); | ||
@@ -104,3 +105,3 @@ e.stopPropagation(); | ||
cleancontextmenu: function cleancontextmenu(player) { | ||
player.contextMenu.parentNode.removeChild(player.contextMenu); | ||
player.contextMenu.remove(); | ||
}, | ||
@@ -134,3 +135,3 @@ enableContextMenu: function enableContextMenu() { | ||
}, | ||
renderContextMenu: function renderContextMenu(x, y) { | ||
renderContextMenu: function renderContextMenu(event) { | ||
@@ -161,6 +162,17 @@ // alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly | ||
t.contextMenu.innerHTML = html; | ||
t.contextMenu.style.top = y; | ||
t.contextMenu.style.left = x; | ||
t.contextMenu.style.display = 'block'; | ||
var width = t.contextMenu.offsetWidth, | ||
height = t.contextMenu.offsetHeight, | ||
x = event.pageX, | ||
y = event.pageY, | ||
doc = document.documentElement, | ||
scrollLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), | ||
scrollTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0), | ||
left = x + width > window.innerWidth + scrollLeft ? x - width : x, | ||
top = y + height > window.innerHeight + scrollTop ? y - height : y; | ||
t.contextMenu.style.display = ''; | ||
t.contextMenu.style.left = left + "px"; | ||
t.contextMenu.style.top = top + "px"; | ||
// bind events | ||
@@ -199,3 +211,3 @@ var contextItems = t.contextMenu.querySelectorAll("." + t.options.classPrefix + "contextmenu-item"); | ||
setTimeout(function () { | ||
t.killControlsTimer('rev3'); | ||
t.killControlsTimer(); | ||
}, 100); | ||
@@ -202,0 +214,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function e(n,t,o){function i(r,c){if(!t[r]){if(!n[r]){var l="function"==typeof require&&require;if(!c&&l)return l(r,!0);if(u)return u(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var a=t[r]={exports:{}};n[r][0].call(a.exports,function(e){var t=n[r][1][e];return i(t?t:e)},a,a.exports,e,n,t,o)}return t[r].exports}for(var u="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}({1:[function(e,n,t){"use strict";mejs.i18n.en["mejs.fullscreen-off"]="Turn off Fullscreen",mejs.i18n.en["mejs.fullscreen-on"]="Go Fullscreen",mejs.i18n.en["mejs.download-video"]="Download Video",Object.assign(mejs.MepDefaults,{isContextMenuEnabled:!0,contextMenuTimeout:null,contextMenuItems:[{render:function(e){return void 0===e.enterFullScreen?null:e.isFullScreen?mejs.i18n.t("mejs.fullscreen-off"):mejs.i18n.t("mejs.fullscreen-on")},click:function(e){e.isFullScreen?e.exitFullScreen():e.enterFullScreen()}},{render:function(e){return e.media.muted?mejs.i18n.t("mejs.unmute"):mejs.i18n.t("mejs.mute")},click:function(e){e.media.muted?e.setMuted(!1):e.setMuted(!0)}},{isSeparator:!0},{render:function(){return mejs.i18n.t("mejs.download-video")},click:function(e){window.location.href=e.media.currentSrc}}]}),Object.assign(MediaElementPlayer.prototype,{buildcontextmenu:function(e){document.querySelector("."+e.options.classPrefix+"contextmenu")||(e.contextMenu=document.createElement("div"),e.contextMenu.className=e.options.classPrefix+"contextmenu",e.contextMenu.style.display="none",document.body.appendChild(e.contextMenu),e.container.addEventListener("contextmenu",function(n){e.isContextMenuEnabled&&(e.renderContextMenu(n.clientX-1,n.clientY-1),n.preventDefault(),n.stopPropagation())}),e.container.addEventListener("click",function(){e.contextMenu.style.display="none"}),e.contextMenu.addEventListener("mouseleave",function(){e.startContextMenuTimer()}))},cleancontextmenu:function(e){e.contextMenu.parentNode.removeChild(e.contextMenu)},enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},startContextMenuTimer:function(){var e=this;e.killContextMenuTimer(),e.contextMenuTimer=setTimeout(function(){e.hideContextMenu(),e.killContextMenuTimer()},750)},killContextMenuTimer:function(){var e=this.contextMenuTimer;null!==e&&void 0!==e&&(clearTimeout(e),e=null)},hideContextMenu:function(){this.contextMenu.style.display="none"},renderContextMenu:function(e,n){for(var t=this,o="",i=t.options.contextMenuItems,u=0,r=i.length;u<r;u++){var c=i[u];if(c.isSeparator)o+='<div class="'+t.options.classPrefix+'contextmenu-separator"></div>';else{var l=c.render(t);null!==l&&void 0!==l&&(o+='<div class="'+t.options.classPrefix+'contextmenu-item" data-itemindex="'+u+'" id="element-'+1e6*Math.random()+'">'+l+"</div>")}}t.contextMenu.innerHTML=o,t.contextMenu.style.top=n,t.contextMenu.style.left=e,t.contextMenu.style.display="block";for(var s=t.contextMenu.querySelectorAll("."+t.options.classPrefix+"contextmenu-item"),a=function(e,n){var o=s[e],i=parseInt(o.getAttribute("data-itemindex"),10),u=t.options.contextMenuItems[i];"undefined"!=typeof u.show&&u.show(o,t),o.addEventListener("click",function(){"undefined"!=typeof u.click&&u.click(t),t.contextMenu.style.display="none"})},d=0,m=s.length;d<m;d++)a(d,m);setTimeout(function(){t.killControlsTimer("rev3")},100)}})},{}]},{},[1]); | ||
!function e(n,t,o){function i(r,c){if(!t[r]){if(!n[r]){var s="function"==typeof require&&require;if(!c&&s)return s(r,!0);if(u)return u(r,!0);var l=new Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}var a=t[r]={exports:{}};n[r][0].call(a.exports,function(e){var t=n[r][1][e];return i(t||e)},a,a.exports,e,n,t,o)}return t[r].exports}for(var u="function"==typeof require&&require,r=0;r<o.length;r++)i(o[r]);return i}({1:[function(e,n,t){"use strict";mejs.i18n.en["mejs.fullscreen-off"]="Turn off Fullscreen",mejs.i18n.en["mejs.fullscreen-on"]="Go Fullscreen",mejs.i18n.en["mejs.download-video"]="Download Video",Object.assign(mejs.MepDefaults,{contextMenuItems:[{render:function(e){return void 0===e.enterFullScreen?null:e.isFullScreen?mejs.i18n.t("mejs.fullscreen-off"):mejs.i18n.t("mejs.fullscreen-on")},click:function(e){e.isFullScreen?e.exitFullScreen():e.enterFullScreen()}},{render:function(e){return e.media.muted?mejs.i18n.t("mejs.unmute"):mejs.i18n.t("mejs.mute")},click:function(e){e.media.muted?e.setMuted(!1):e.setMuted(!0)}},{isSeparator:!0},{render:function(){return mejs.i18n.t("mejs.download-video")},click:function(e){window.location.href=e.media.currentSrc}}]}),Object.assign(MediaElementPlayer.prototype,{isContextMenuEnabled:!0,contextMenuTimeout:null,buildcontextmenu:function(e){document.querySelector("."+e.options.classPrefix+"contextmenu")||(e.contextMenu=document.createElement("div"),e.contextMenu.className=e.options.classPrefix+"contextmenu",e.contextMenu.style.display="none",document.body.appendChild(e.contextMenu)),e.container.addEventListener("contextmenu",function(n){!e.isContextMenuEnabled||3!==n.keyCode&&3!==n.which||(e.renderContextMenu(n),n.preventDefault(),n.stopPropagation())}),e.container.addEventListener("click",function(){e.contextMenu.style.display="none"}),e.contextMenu.addEventListener("mouseleave",function(){e.startContextMenuTimer()})},cleancontextmenu:function(e){e.contextMenu.remove()},enableContextMenu:function(){this.isContextMenuEnabled=!0},disableContextMenu:function(){this.isContextMenuEnabled=!1},startContextMenuTimer:function(){var e=this;e.killContextMenuTimer(),e.contextMenuTimer=setTimeout(function(){e.hideContextMenu(),e.killContextMenuTimer()},750)},killContextMenuTimer:function(){var e=this.contextMenuTimer;null!==e&&void 0!==e&&(clearTimeout(e),e=null)},hideContextMenu:function(){this.contextMenu.style.display="none"},renderContextMenu:function(e){for(var n=this,t="",o=n.options.contextMenuItems,i=0,u=o.length;i<u;i++){var r=o[i];if(r.isSeparator)t+='<div class="'+n.options.classPrefix+'contextmenu-separator"></div>';else{var c=r.render(n);null!==c&&void 0!==c&&(t+='<div class="'+n.options.classPrefix+'contextmenu-item" data-itemindex="'+i+'" id="element-'+1e6*Math.random()+'">'+c+"</div>")}}n.contextMenu.innerHTML=t;var s=n.contextMenu.offsetWidth,l=n.contextMenu.offsetHeight,a=e.pageX,d=e.pageY,f=document.documentElement,m=(window.pageXOffset||f.scrollLeft)-(f.clientLeft||0),x=(window.pageYOffset||f.scrollTop)-(f.clientTop||0),M=a+s>window.innerWidth+m?a-s:a,p=d+l>window.innerHeight+x?d-l:d;n.contextMenu.style.display="",n.contextMenu.style.left=M+"px",n.contextMenu.style.top=p+"px";for(var v=n.contextMenu.querySelectorAll("."+n.options.classPrefix+"contextmenu-item"),h=0,y=v.length;h<y;h++)!function(e,t){var o=v[e],i=parseInt(o.getAttribute("data-itemindex"),10),u=n.options.contextMenuItems[i];void 0!==u.show&&u.show(o,n),o.addEventListener("click",function(){void 0!==u.click&&u.click(n),n.contextMenu.style.display="none"})}(h);setTimeout(function(){n.killControlsTimer()},100)}})},{}]},{},[1]); |
@@ -48,4 +48,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -52,0 +52,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
!function e(n,t,o){function i(a,s){if(!t[a]){if(!n[a]){var g="function"==typeof require&&require;if(!s&&g)return g(a,!0);if(l)return l(a,!0);var r=new Error("Cannot find module '"+a+"'");throw r.code="MODULE_NOT_FOUND",r}var c=t[a]={exports:{}};n[a][0].call(c.exports,function(e){var t=n[a][1][e];return i(t?t:e)},c,c.exports,e,n,t,o)}return t[a].exports}for(var l="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,n,t){"use strict";Object.assign(mejs.MepDefaults,{googleAnalyticsTitle:"",googleAnalyticsCategory:"Videos",googleAnalyticsEventPlay:"Play",googleAnalyticsEventPause:"Pause",googleAnalyticsEventEnded:"Ended",googleAnalyticsEventTime:"Time"}),Object.assign(MediaElementPlayer.prototype,{buildgoogleanalytics:function(e,n,t,o){o.addEventListener("play",function(){"undefined"!=typeof ga&&ga("send","event",e.options.googleAnalyticsCategory,e.options.googleAnalyticsEventPlay,""===e.options.googleAnalyticsTitle?e.media.currentSrc:e.options.googleAnalyticsTitle)},!1),o.addEventListener("pause",function(){"undefined"!=typeof ga&&ga("send","event",e.options.googleAnalyticsCategory,e.options.googleAnalyticsEventPause,""===e.options.googleAnalyticsTitle?e.media.currentSrc:e.options.googleAnalyticsTitle)},!1),o.addEventListener("ended",function(){"undefined"!=typeof ga&&ga("send","event",e.options.googleAnalyticsCategory,e.options.googleAnalyticsEventEnded,""===e.options.googleAnalyticsTitle?e.media.currentSrc:e.options.googleAnalyticsTitle)},!1)}})},{}]},{},[1]); | ||
!function e(n,t,o){function i(a,s){if(!t[a]){if(!n[a]){var g="function"==typeof require&&require;if(!s&&g)return g(a,!0);if(l)return l(a,!0);var r=new Error("Cannot find module '"+a+"'");throw r.code="MODULE_NOT_FOUND",r}var c=t[a]={exports:{}};n[a][0].call(c.exports,function(e){var t=n[a][1][e];return i(t||e)},c,c.exports,e,n,t,o)}return t[a].exports}for(var l="function"==typeof require&&require,a=0;a<o.length;a++)i(o[a]);return i}({1:[function(e,n,t){"use strict";Object.assign(mejs.MepDefaults,{googleAnalyticsTitle:"",googleAnalyticsCategory:"Videos",googleAnalyticsEventPlay:"Play",googleAnalyticsEventPause:"Pause",googleAnalyticsEventEnded:"Ended",googleAnalyticsEventTime:"Time"}),Object.assign(MediaElementPlayer.prototype,{buildgoogleanalytics:function(e,n,t,o){o.addEventListener("play",function(){"undefined"!=typeof ga&&ga("send","event",e.options.googleAnalyticsCategory,e.options.googleAnalyticsEventPlay,""===e.options.googleAnalyticsTitle?e.media.currentSrc:e.options.googleAnalyticsTitle)},!1),o.addEventListener("pause",function(){"undefined"!=typeof ga&&ga("send","event",e.options.googleAnalyticsCategory,e.options.googleAnalyticsEventPause,""===e.options.googleAnalyticsTitle?e.media.currentSrc:e.options.googleAnalyticsTitle)},!1),o.addEventListener("ended",function(){"undefined"!=typeof ga&&ga("send","event",e.options.googleAnalyticsCategory,e.options.googleAnalyticsEventEnded,""===e.options.googleAnalyticsTitle?e.media.currentSrc:e.options.googleAnalyticsTitle)},!1)}})},{}]},{},[1]); |
@@ -31,4 +31,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -35,0 +35,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
!function r(t,e,n){function o(a,u){if(!e[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var m=e[a]={exports:{}};t[a][0].call(m.exports,function(r){var e=t[a][1][r];return o(e?e:r)},m,m.exports,r,t,e,n)}return e[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(r,t,e){"use strict";mejs.i18n.en["mejs.time-jump-forward"]=["Jump forward 1 second","Jump forward %1 seconds"],Object.assign(mejs.MepDefaults,{jumpForwardInterval:30,jumpForwardText:null}),Object.assign(MediaElementPlayer.prototype,{buildjumpforward:function(r,t,e,n){var o=this,i=mejs.i18n.t("mejs.time-jump-forward",o.options.jumpForwardInterval),a=mejs.Utils.isString(o.options.jumpForwardText)?o.options.jumpForwardText.replace("%1",o.options.jumpForwardInterval):i,u=document.createElement("div");u.className=o.options.classPrefix+"button "+o.options.classPrefix+"jump-forward-button",u.innerHTML='<button type="button" aria-controls="'+o.id+'" title="'+a+'" aria-label="'+a+'" tabindex="0">'+o.options.jumpForwardInterval+"</button>",o.addControlElement(u,"jumpforward"),u.addEventListener("click",function(){var r=isNaN(n.duration)?o.options.jumpForwardInterval:n.duration;if(r){var t=n.currentTime===1/0?0:n.currentTime;n.setCurrentTime(Math.min(t+o.options.jumpForwardInterval,r)),this.querySelector("button").blur()}})}})},{}]},{},[1]); | ||
!function r(t,e,n){function o(a,u){if(!e[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var m=e[a]={exports:{}};t[a][0].call(m.exports,function(r){var e=t[a][1][r];return o(e||r)},m,m.exports,r,t,e,n)}return e[a].exports}for(var i="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(r,t,e){"use strict";mejs.i18n.en["mejs.time-jump-forward"]=["Jump forward 1 second","Jump forward %1 seconds"],Object.assign(mejs.MepDefaults,{jumpForwardInterval:30,jumpForwardText:null}),Object.assign(MediaElementPlayer.prototype,{buildjumpforward:function(r,t,e,n){var o=this,i=mejs.i18n.t("mejs.time-jump-forward",o.options.jumpForwardInterval),a=mejs.Utils.isString(o.options.jumpForwardText)?o.options.jumpForwardText.replace("%1",o.options.jumpForwardInterval):i,u=document.createElement("div");u.className=o.options.classPrefix+"button "+o.options.classPrefix+"jump-forward-button",u.innerHTML='<button type="button" aria-controls="'+o.id+'" title="'+a+'" aria-label="'+a+'" tabindex="0">'+o.options.jumpForwardInterval+"</button>",o.addControlElement(u,"jumpforward"),u.addEventListener("click",function(){var r=isNaN(n.duration)?o.options.jumpForwardInterval:n.duration;if(r){var t=n.currentTime===1/0?0:n.currentTime;n.setCurrentTime(Math.min(t+o.options.jumpForwardInterval,r)),this.querySelector("button").blur()}})}})},{}]},{},[1]); |
@@ -29,7 +29,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} media | ||
*/ | ||
buildloop: function buildloop(player, controls) { | ||
buildloop: function buildloop(player) { | ||
var t = this, | ||
@@ -36,0 +33,0 @@ loopTitle = mejs.Utils.isString(t.options.loopText) ? t.options.loopText : mejs.i18n.t('mejs.loop'), |
@@ -1,1 +0,1 @@ | ||
!function o(t,e,s){function n(l,r){if(!e[l]){if(!t[l]){var p="function"==typeof require&&require;if(!r&&p)return p(l,!0);if(i)return i(l,!0);var a=new Error("Cannot find module '"+l+"'");throw a.code="MODULE_NOT_FOUND",a}var f=e[l]={exports:{}};t[l][0].call(f.exports,function(o){var e=t[l][1][o];return n(e?e:o)},f,f.exports,o,t,e,s)}return e[l].exports}for(var i="function"==typeof require&&require,l=0;l<s.length;l++)n(s[l]);return n}({1:[function(o,t,e){"use strict";mejs.i18n.en["mejs.loop"]="Toggle Loop",Object.assign(mejs.MepDefaults,{loopText:null}),Object.assign(MediaElementPlayer.prototype,{buildloop:function(o,t){var e=this,s=mejs.Utils.isString(e.options.loopText)?e.options.loopText:mejs.i18n.t("mejs.loop"),n=document.createElement("div");n.className=e.options.classPrefix+"button "+e.options.classPrefix+"loop-button "+(o.options.loop?e.options.classPrefix+"loop-on":e.options.classPrefix+"loop-off"),n.innerHTML='<button type="button" aria-controls="'+e.id+'" title="'+s+'" aria-label="'+s+'" tabindex="0"></button>',e.addControlElement(n,"loop"),n.addEventListener("click",function(){o.options.loop=!o.options.loop,o.options.loop?(mejs.Utils.removeClass(n,e.options.classPrefix+"loop-off"),mejs.Utils.addClass(n,e.options.classPrefix+"loop-on")):(mejs.Utils.removeClass(n,e.options.classPrefix+"loop-on"),mejs.Utils.addClass(n,e.options.classPrefix+"loop-off"))})}})},{}]},{},[1]); | ||
!function o(t,e,s){function n(l,r){if(!e[l]){if(!t[l]){var p="function"==typeof require&&require;if(!r&&p)return p(l,!0);if(i)return i(l,!0);var a=new Error("Cannot find module '"+l+"'");throw a.code="MODULE_NOT_FOUND",a}var f=e[l]={exports:{}};t[l][0].call(f.exports,function(o){var e=t[l][1][o];return n(e||o)},f,f.exports,o,t,e,s)}return e[l].exports}for(var i="function"==typeof require&&require,l=0;l<s.length;l++)n(s[l]);return n}({1:[function(o,t,e){"use strict";mejs.i18n.en["mejs.loop"]="Toggle Loop",Object.assign(mejs.MepDefaults,{loopText:null}),Object.assign(MediaElementPlayer.prototype,{buildloop:function(o){var t=this,e=mejs.Utils.isString(t.options.loopText)?t.options.loopText:mejs.i18n.t("mejs.loop"),s=document.createElement("div");s.className=t.options.classPrefix+"button "+t.options.classPrefix+"loop-button "+(o.options.loop?t.options.classPrefix+"loop-on":t.options.classPrefix+"loop-off"),s.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+e+'" aria-label="'+e+'" tabindex="0"></button>',t.addControlElement(s,"loop"),s.addEventListener("click",function(){o.options.loop=!o.options.loop,o.options.loop?(mejs.Utils.removeClass(s,t.options.classPrefix+"loop-off"),mejs.Utils.addClass(s,t.options.classPrefix+"loop-on")):(mejs.Utils.removeClass(s,t.options.classPrefix+"loop-on"),mejs.Utils.addClass(s,t.options.classPrefix+"loop-off"))})}})},{}]},{},[1]); |
@@ -37,4 +37,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -41,0 +41,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
!function r(e,t,o){function n(i,s){if(!t[i]){if(!e[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(a)return a(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var u=t[i]={exports:{}};e[i][0].call(u.exports,function(r){var t=e[i][1][r];return n(t?t:r)},u,u.exports,r,e,t,o)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<o.length;i++)n(o[i]);return n}({1:[function(r,e,t){"use strict";Object.assign(mejs.MepDefaults,{markerColor:"#E9BC3D",markers:[],markerCallback:function(){}}),Object.assign(MediaElementPlayer.prototype,{buildmarkers:function(r,e,t,o){if(r.options.markers.length){for(var n=this,a=-1,i=-1,s=-1,l=-1,f=0,u=r.options.markers.length;f<u;++f){var m=document.createElement("span");m.className=n.options.classPrefix+"time-marker",e.querySelector("."+n.options.classPrefix+"time-total").appendChild(m)}o.addEventListener("durationchange",function(){r.setmarkers(e)}),o.addEventListener("timeupdate",function(){if(a=Math.floor(o.currentTime),s>a?l>a&&(l=-1):s=a,r.options.markers.length)for(var e=0,t=r.options.markers.length;e<t;++e)i=Math.floor(r.options.markers[e]),a===i&&i!==l&&(r.options.markerCallback(o,o.currentTime),l=i)},!1)}},setmarkers:function(r){for(var e=this,t=r.querySelectorAll("."+e.options.classPrefix+"time-marker"),o=0,n=e.options.markers.length;o<n;++o)if(Math.floor(e.options.markers[o])<=e.media.duration&&Math.floor(e.options.markers[o])>=0){var a=100*Math.floor(e.options.markers[o])/e.media.duration,i=t[o];i.style.width="1px",i.style.left=a+"%",i.style.background=e.options.markerColor}}})},{}]},{},[1]); | ||
!function r(e,t,o){function n(i,s){if(!t[i]){if(!e[i]){var l="function"==typeof require&&require;if(!s&&l)return l(i,!0);if(a)return a(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var u=t[i]={exports:{}};e[i][0].call(u.exports,function(r){var t=e[i][1][r];return n(t||r)},u,u.exports,r,e,t,o)}return t[i].exports}for(var a="function"==typeof require&&require,i=0;i<o.length;i++)n(o[i]);return n}({1:[function(r,e,t){"use strict";Object.assign(mejs.MepDefaults,{markerColor:"#E9BC3D",markers:[],markerCallback:function(){}}),Object.assign(MediaElementPlayer.prototype,{buildmarkers:function(r,e,t,o){if(r.options.markers.length){for(var n=this,a=-1,i=-1,s=-1,l=-1,f=0,u=r.options.markers.length;f<u;++f){var m=document.createElement("span");m.className=n.options.classPrefix+"time-marker",e.querySelector("."+n.options.classPrefix+"time-total").appendChild(m)}o.addEventListener("durationchange",function(){r.setmarkers(e)}),o.addEventListener("timeupdate",function(){if(a=Math.floor(o.currentTime),s>a?l>a&&(l=-1):s=a,r.options.markers.length)for(var e=0,t=r.options.markers.length;e<t;++e)i=Math.floor(r.options.markers[e]),a===i&&i!==l&&(r.options.markerCallback(o,o.currentTime),l=i)},!1)}},setmarkers:function(r){for(var e=this,t=r.querySelectorAll("."+e.options.classPrefix+"time-marker"),o=0,n=e.options.markers.length;o<n;++o)if(Math.floor(e.options.markers[o])<=e.media.duration&&Math.floor(e.options.markers[o])>=0){var a=100*Math.floor(e.options.markers[o])/e.media.duration,i=t[o];i.style.width="1px",i.style.left=a+"%",i.style.background=e.options.markerColor}}})},{}]},{},[1]); |
@@ -31,5 +31,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} media | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
*/ | ||
@@ -36,0 +35,0 @@ buildpostroll: function buildpostroll(player, controls, layers) { |
@@ -1,1 +0,1 @@ | ||
!function e(o,t,r){function s(n,i){if(!t[n]){if(!o[n]){var a="function"==typeof require&&require;if(!i&&a)return a(n,!0);if(l)return l(n,!0);var p=new Error("Cannot find module '"+n+"'");throw p.code="MODULE_NOT_FOUND",p}var c=t[n]={exports:{}};o[n][0].call(c.exports,function(e){var t=o[n][1][e];return s(t?t:e)},c,c.exports,e,o,t,r)}return t[n].exports}for(var l="function"==typeof require&&require,n=0;n<r.length;n++)s(r[n]);return s}({1:[function(e,o,t){"use strict";mejs.i18n.en["mejs.close"]="Close",Object.assign(mejs.MepDefaults,{postrollCloseText:null}),Object.assign(MediaElementPlayer.prototype,{buildpostroll:function(e,o,t){var r=this,s=mejs.Utils.isString(r.options.postrollCloseText)?r.options.postrollCloseText:mejs.i18n.t("mejs.close"),l=r.container.querySelector('link[rel="postroll"]');l&&(e.postroll=document.createElement("div"),e.postroll.className=r.options.classPrefix+"postroll-layer "+r.options.classPrefix+"layer",e.postroll.innerHTML='<a class="'+r.options.classPrefix+'postroll-close" href="#">'+s+"</a>"+('<div class="'+r.options.classPrefix+'postroll-layer-content"></div>'),e.postroll.style.display="none",t.insertBefore(e.postroll,t.firstChild),e.postroll.querySelector("."+r.options.classPrefix+"postroll-close").addEventListener("click",function(e){this.parentNode.style.display="none",e.preventDefault(),e.stopPropagation()}),r.media.addEventListener("ended",function(){mejs.Utils.ajax(l.getAttribute("href"),"html",function(e){t.querySelector("."+r.options.classPrefix+"postroll-layer-content").innerHTML=e}),e.postroll.style.display="block"},!1))}})},{}]},{},[1]); | ||
!function e(o,t,r){function s(n,i){if(!t[n]){if(!o[n]){var a="function"==typeof require&&require;if(!i&&a)return a(n,!0);if(l)return l(n,!0);var p=new Error("Cannot find module '"+n+"'");throw p.code="MODULE_NOT_FOUND",p}var c=t[n]={exports:{}};o[n][0].call(c.exports,function(e){var t=o[n][1][e];return s(t||e)},c,c.exports,e,o,t,r)}return t[n].exports}for(var l="function"==typeof require&&require,n=0;n<r.length;n++)s(r[n]);return s}({1:[function(e,o,t){"use strict";mejs.i18n.en["mejs.close"]="Close",Object.assign(mejs.MepDefaults,{postrollCloseText:null}),Object.assign(MediaElementPlayer.prototype,{buildpostroll:function(e,o,t){var r=this,s=mejs.Utils.isString(r.options.postrollCloseText)?r.options.postrollCloseText:mejs.i18n.t("mejs.close"),l=r.container.querySelector('link[rel="postroll"]');l&&(e.postroll=document.createElement("div"),e.postroll.className=r.options.classPrefix+"postroll-layer "+r.options.classPrefix+"layer",e.postroll.innerHTML='<a class="'+r.options.classPrefix+'postroll-close" href="#">'+s+'</a><div class="'+r.options.classPrefix+'postroll-layer-content"></div>',e.postroll.style.display="none",t.insertBefore(e.postroll,t.firstChild),e.postroll.querySelector("."+r.options.classPrefix+"postroll-close").addEventListener("click",function(e){this.parentNode.style.display="none",e.preventDefault(),e.stopPropagation()}),r.media.addEventListener("ended",function(){mejs.Utils.ajax(l.getAttribute("href"),"html",function(e){t.querySelector("."+r.options.classPrefix+"postroll-layer-content").innerHTML=e}),e.postroll.style.display="block"},!1))}})},{}]},{},[1]); |
@@ -67,5 +67,2 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} media | ||
*/ | ||
@@ -88,30 +85,28 @@ buildpreview: function buildpreview(player) { | ||
if (Math.floor(t.media.currentTime) === t.options.fadeInAudioStart) { | ||
(function () { | ||
initFadeIn = true; | ||
initFadeIn = true; | ||
var volume = 0, | ||
audioInterval = t.options.fadeInAudioInterval, | ||
interval = setInterval(function () { | ||
var volume = 0, | ||
audioInterval = t.options.fadeInAudioInterval, | ||
interval = setInterval(function () { | ||
// Increase volume by step as long as it is below 1 | ||
if (volume < 1) { | ||
volume += t.options.fadePercent; | ||
if (volume > 1) { | ||
volume = 1; | ||
} | ||
// Increase volume by step as long as it is below 1 | ||
if (volume < 1) { | ||
volume += t.options.fadePercent; | ||
if (volume > 1) { | ||
volume = 1; | ||
} | ||
// limit to 2 decimal places | ||
t.media.setVolume(volume.toFixed(2)); | ||
} else { | ||
// Stop firing interval when 1 is reached | ||
clearInterval(interval); | ||
interval = null; | ||
t.media.setMuted(false); | ||
setTimeout(function () { | ||
initFadeIn = false; | ||
}, 300); | ||
} | ||
}, audioInterval); | ||
})(); | ||
// limit to 2 decimal places | ||
t.media.setVolume(volume.toFixed(2)); | ||
} else { | ||
// Stop firing interval when 1 is reached | ||
clearInterval(interval); | ||
interval = null; | ||
t.media.setMuted(false); | ||
setTimeout(function () { | ||
initFadeIn = false; | ||
}, 300); | ||
} | ||
}, audioInterval); | ||
} | ||
@@ -129,31 +124,29 @@ } | ||
if (Math.floor(t.media.currentTime) === t.options.fadeOutAudioStart) { | ||
(function () { | ||
initFadeOut = true; | ||
initFadeOut = true; | ||
var volume = 1, | ||
audioInterval = t.options.fadeOutAudioInterval, | ||
interval = setInterval(function () { | ||
var volume = 1, | ||
audioInterval = t.options.fadeOutAudioInterval, | ||
interval = setInterval(function () { | ||
// Increase volume by step as long as it is above 0 | ||
// Increase volume by step as long as it is above 0 | ||
if (volume > 0) { | ||
volume -= t.options.fadePercent; | ||
if (volume < 0) { | ||
volume = 0; | ||
} | ||
if (volume > 0) { | ||
volume -= t.options.fadePercent; | ||
if (volume < 0) { | ||
volume = 0; | ||
} | ||
// limit to 2 decimal places | ||
t.media.setVolume(volume.toFixed(2)); | ||
} else { | ||
// Stop firing interval when 0 is reached | ||
clearInterval(interval); | ||
interval = null; | ||
t.media.setMuted(false); | ||
setTimeout(function () { | ||
initFadeOut = false; | ||
}, 300); | ||
} | ||
}, audioInterval); | ||
})(); | ||
// limit to 2 decimal places | ||
t.media.setVolume(volume.toFixed(2)); | ||
} else { | ||
// Stop firing interval when 0 is reached | ||
clearInterval(interval); | ||
interval = null; | ||
t.media.setMuted(false); | ||
setTimeout(function () { | ||
initFadeOut = false; | ||
}, 300); | ||
} | ||
}, audioInterval); | ||
} | ||
@@ -160,0 +153,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function e(t,o,n){function i(r,d){if(!o[r]){if(!t[r]){var u="function"==typeof require&&require;if(!d&&u)return u(r,!0);if(a)return a(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var l=o[r]={exports:{}};t[r][0].call(l.exports,function(e){var o=t[r][1][e];return i(o?o:e)},l,l.exports,e,t,o,n)}return o[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)i(n[r]);return i}({1:[function(e,t,o){"use strict";Object.assign(mejs.MepDefaults,{previewMode:!1,muteOnPreviewMode:!0,fadeInAudioStart:0,fadeInAudioInterval:0,fadeOutAudioStart:0,fadeOutAudioInterval:0,fadePercent:.02,pauseOnlyOnPreview:!1,delayPreview:0}),Object.assign(MediaElementPlayer.prototype,{buildpreview:function(e){var t=!1,o=!1,n=void 0,i=!1,a=this,r=function(){a.options.fadeInAudioInterval&&(Math.floor(a.media.currentTime)<a.options.fadeIntAudioStart&&(a.media.setVolume(0),a.media.setMuted(!0)),Math.floor(a.media.currentTime)===a.options.fadeInAudioStart&&!function(){t=!0;var e=0,o=a.options.fadeInAudioInterval,n=setInterval(function(){e<1?(e+=a.options.fadePercent,e>1&&(e=1),a.media.setVolume(e.toFixed(2))):(clearInterval(n),n=null,a.media.setMuted(!1),setTimeout(function(){t=!1},300))},o)}())},d=function(){a.options.fadeOutAudioInterval&&(Math.floor(a.media.currentTime)<a.options.fadeOutAudioStart&&(a.media.setVolume(1),a.media.setMuted(!1)),Math.floor(a.media.currentTime)===a.options.fadeOutAudioStart&&!function(){o=!0;var e=1,t=a.options.fadeOutAudioInterval,n=setInterval(function(){e>0?(e-=a.options.fadePercent,e<0&&(e=0),a.media.setVolume(e.toFixed(2))):(clearInterval(n),n=null,a.media.setMuted(!1),setTimeout(function(){o=!1},300))},t)}())};a.options.muteOnPreviewMode||a.options.fadeInAudioInterval?(a.media.setVolume(0),a.media.setMuted(!0)):a.options.fadeOutAudioInterval&&(a.media.setVolume(1),a.media.setMuted(!1)),a.media.addEventListener("timeupdate",function(){return t?void a.media.removeEventListener("timeupdate",r):o?void a.media.removeEventListener("timeupdate",d):(r(),void d())}),e.isVideo&&(document.body.addEventListener("mouseover",function(e){e.target===a.container||e.target.closest("."+a.options.classPrefix+"container")?(i=!0,a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="block",a.media.paused?n=setTimeout(function(){i?a.media.play():(clearTimeout(n),n=null),a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none"},a.options.delayPreview):a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none"):(i=!1,clearTimeout(n),n=null,a.media.paused||a.media.pause(),a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none")}),document.body.addEventListener("mouseout",function(e){e.target===a.container||e.target.closest("."+a.options.classPrefix+"container")||(i=!1,a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none",a.media.paused||(a.media.pause(),a.options.pauseOnlyOnPreview||a.media.setCurrentTime(0)),clearTimeout(n),n=null)}),window.addEventListener("scroll",function(){i=!1,a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none",a.media.paused||a.media.pause()}))}})},{}]},{},[1]); | ||
!function e(t,o,n){function i(r,d){if(!o[r]){if(!t[r]){var u="function"==typeof require&&require;if(!d&&u)return u(r,!0);if(a)return a(r,!0);var s=new Error("Cannot find module '"+r+"'");throw s.code="MODULE_NOT_FOUND",s}var l=o[r]={exports:{}};t[r][0].call(l.exports,function(e){var o=t[r][1][e];return i(o||e)},l,l.exports,e,t,o,n)}return o[r].exports}for(var a="function"==typeof require&&require,r=0;r<n.length;r++)i(n[r]);return i}({1:[function(e,t,o){"use strict";Object.assign(mejs.MepDefaults,{previewMode:!1,muteOnPreviewMode:!0,fadeInAudioStart:0,fadeInAudioInterval:0,fadeOutAudioStart:0,fadeOutAudioInterval:0,fadePercent:.02,pauseOnlyOnPreview:!1,delayPreview:0}),Object.assign(MediaElementPlayer.prototype,{buildpreview:function(e){var t=!1,o=!1,n=void 0,i=!1,a=this,r=function(){if(a.options.fadeInAudioInterval&&(Math.floor(a.media.currentTime)<a.options.fadeIntAudioStart&&(a.media.setVolume(0),a.media.setMuted(!0)),Math.floor(a.media.currentTime)===a.options.fadeInAudioStart)){t=!0;var e=0,o=a.options.fadeInAudioInterval,n=setInterval(function(){e<1?(e+=a.options.fadePercent,e>1&&(e=1),a.media.setVolume(e.toFixed(2))):(clearInterval(n),n=null,a.media.setMuted(!1),setTimeout(function(){t=!1},300))},o)}},d=function(){if(a.options.fadeOutAudioInterval&&(Math.floor(a.media.currentTime)<a.options.fadeOutAudioStart&&(a.media.setVolume(1),a.media.setMuted(!1)),Math.floor(a.media.currentTime)===a.options.fadeOutAudioStart)){o=!0;var e=1,t=a.options.fadeOutAudioInterval,n=setInterval(function(){e>0?(e-=a.options.fadePercent,e<0&&(e=0),a.media.setVolume(e.toFixed(2))):(clearInterval(n),n=null,a.media.setMuted(!1),setTimeout(function(){o=!1},300))},t)}};a.options.muteOnPreviewMode||a.options.fadeInAudioInterval?(a.media.setVolume(0),a.media.setMuted(!0)):a.options.fadeOutAudioInterval&&(a.media.setVolume(1),a.media.setMuted(!1)),a.media.addEventListener("timeupdate",function(){return t?void a.media.removeEventListener("timeupdate",r):o?void a.media.removeEventListener("timeupdate",d):(r(),void d())}),e.isVideo&&(document.body.addEventListener("mouseover",function(e){e.target===a.container||e.target.closest("."+a.options.classPrefix+"container")?(i=!0,a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="block",a.media.paused?n=setTimeout(function(){i?a.media.play():(clearTimeout(n),n=null),a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none"},a.options.delayPreview):a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none"):(i=!1,clearTimeout(n),n=null,a.media.paused||a.media.pause(),a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none")}),document.body.addEventListener("mouseout",function(e){e.target===a.container||e.target.closest("."+a.options.classPrefix+"container")||(i=!1,a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none",a.media.paused||(a.media.pause(),a.options.pauseOnlyOnPreview||a.media.setCurrentTime(0)),clearTimeout(n),n=null)}),window.addEventListener("scroll",function(){i=!1,a.container.querySelector("."+a.options.classPrefix+"overlay-loading").parentNode.style.display="none",a.media.paused||a.media.pause()}))}})},{}]},{},[1]); |
@@ -33,4 +33,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -54,3 +54,3 @@ */ | ||
var current = media.currentTime === Infinity ? 0 : media.currentTime; | ||
media.setCurrentTime(Math.max(current - t.options.jumpForwardInterval, 0)); | ||
media.setCurrentTime(Math.max(current - t.options.skipBackInterval, 0)); | ||
this.querySelector('button').blur(); | ||
@@ -57,0 +57,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function t(e,i,n){function r(a,s){if(!i[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var p=i[a]={exports:{}};e[a][0].call(p.exports,function(t){var i=e[a][1][t];return r(i?i:t)},p,p.exports,t,e,i,n)}return i[a].exports}for(var o="function"==typeof require&&require,a=0;a<n.length;a++)r(n[a]);return r}({1:[function(t,e,i){"use strict";mejs.i18n.en["mejs.time-skip-back"]=["Skip back 1 second","Skip back %1 seconds"],Object.assign(mejs.MepDefaults,{skipBackInterval:30,skipBackText:null}),Object.assign(MediaElementPlayer.prototype,{buildskipback:function(t,e,i,n){var r=this,o=mejs.i18n.t("mejs.time-skip-back",r.options.skipBackInterval),a=mejs.Utils.isString(r.options.skipBackText)?r.options.skipBackText.replace("%1",r.options.skipBackInterval):o,s=document.createElement("div");s.className=r.options.classPrefix+"button "+r.options.classPrefix+"skip-back-button",s.innerHTML='<button type="button" aria-controls="'+r.id+'" title="'+a+'" aria-label="'+a+'" tabindex="0">'+r.options.skipBackInterval+"</button>",r.addControlElement(s,"skipback"),s.addEventListener("click",function(){var t=isNaN(n.duration)?r.options.skipBackInterval:n.duration;if(t){var e=n.currentTime===1/0?0:n.currentTime;n.setCurrentTime(Math.max(e-r.options.jumpForwardInterval,0)),this.querySelector("button").blur()}})}})},{}]},{},[1]); | ||
!function t(e,i,n){function r(o,a){if(!i[o]){if(!e[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var p=new Error("Cannot find module '"+o+"'");throw p.code="MODULE_NOT_FOUND",p}var u=i[o]={exports:{}};e[o][0].call(u.exports,function(t){var i=e[o][1][t];return r(i||t)},u,u.exports,t,e,i,n)}return i[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)r(n[o]);return r}({1:[function(t,e,i){"use strict";mejs.i18n.en["mejs.time-skip-back"]=["Skip back 1 second","Skip back %1 seconds"],Object.assign(mejs.MepDefaults,{skipBackInterval:30,skipBackText:null}),Object.assign(MediaElementPlayer.prototype,{buildskipback:function(t,e,i,n){var r=this,s=mejs.i18n.t("mejs.time-skip-back",r.options.skipBackInterval),o=mejs.Utils.isString(r.options.skipBackText)?r.options.skipBackText.replace("%1",r.options.skipBackInterval):s,a=document.createElement("div");a.className=r.options.classPrefix+"button "+r.options.classPrefix+"skip-back-button",a.innerHTML='<button type="button" aria-controls="'+r.id+'" title="'+o+'" aria-label="'+o+'" tabindex="0">'+r.options.skipBackInterval+"</button>",r.addControlElement(a,"skipback"),a.addEventListener("click",function(){if(isNaN(n.duration)?r.options.skipBackInterval:n.duration){var t=n.currentTime===1/0?0:n.currentTime;n.setCurrentTime(Math.max(t-r.options.skipBackInterval,0)),this.querySelector("button").blur()}})}})},{}]},{},[1]); |
@@ -29,4 +29,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -39,3 +39,3 @@ */ | ||
sources = [], | ||
children = t.node.childNodes; | ||
children = t.mediaFiles ? t.mediaFiles : t.node.childNodes; | ||
@@ -47,4 +47,7 @@ // add to list | ||
var s = children[i]; | ||
if (s.nodeName === 'SOURCE') { | ||
if (t.mediaFiles) { | ||
sources.push(s); | ||
} else if (s.nodeName === 'SOURCE') { | ||
sources.push(s); | ||
} | ||
@@ -65,3 +68,3 @@ } | ||
var src = sources[_i]; | ||
if (src.type !== undefined && src.nodeName === 'SOURCE' && typeof media.canPlayType === 'function') { | ||
if (src.type !== undefined && typeof media.canPlayType === 'function') { | ||
player.addSourceButton(src.src, src.title, src.type, media.src === src.src); | ||
@@ -79,3 +82,3 @@ } | ||
player.hideSourcechooserSelector(); | ||
}, 500); | ||
}, 0); | ||
}); | ||
@@ -151,23 +154,18 @@ | ||
if (media.currentSrc !== src) { | ||
(function () { | ||
var paused = media.paused, | ||
canPlayAfterSourceSwitchHandler = function canPlayAfterSourceSwitchHandler() { | ||
if (!paused) { | ||
media.play(); | ||
} | ||
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler, true); | ||
}; | ||
if (media.getSrc() !== src) { | ||
var currentTime = media.currentTime; | ||
var currentTime = media.currentTime; | ||
var paused = media.paused, | ||
canPlayAfterSourceSwitchHandler = function canPlayAfterSourceSwitchHandler() { | ||
if (!paused) { | ||
media.setCurrentTime(currentTime); | ||
media.play(); | ||
} | ||
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler); | ||
}; | ||
media.pause(); | ||
media.setSrc(src); | ||
media.load(); | ||
media.addEventListener('loadedmetadata', function () { | ||
media.currentTime = currentTime; | ||
}, true); | ||
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler, true); | ||
media.load(); | ||
})(); | ||
media.pause(); | ||
media.setSrc(src); | ||
media.load(); | ||
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler); | ||
} | ||
@@ -174,0 +172,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
!function e(o,t,r){function s(u,i){if(!t[u]){if(!o[u]){var n="function"==typeof require&&require;if(!i&&n)return n(u,!0);if(c)return c(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var l=t[u]={exports:{}};o[u][0].call(l.exports,function(e){var t=o[u][1][e];return s(t?t:e)},l,l.exports,e,o,t,r)}return t[u].exports}for(var c="function"==typeof require&&require,u=0;u<r.length;u++)s(r[u]);return s}({1:[function(e,o,t){"use strict";mejs.i18n.en["mejs.source-chooser"]="Source Chooser",Object.assign(mejs.MepDefaults,{sourcechooserText:null}),Object.assign(MediaElementPlayer.prototype,{buildsourcechooser:function(e,o,t,r){for(var s=this,c=mejs.Utils.isString(s.options.sourcechooserText)?s.options.sourcechooserText:mejs.i18n.t("mejs.source-chooser"),u=[],i=s.node.childNodes,n=void 0,a=0,l=i.length;a<l;a++){var h=i[a];"SOURCE"===h.nodeName&&u.push(h)}if(!(u.length<=1)){e.sourcechooserButton=document.createElement("div"),e.sourcechooserButton.className=s.options.classPrefix+"button "+s.options.classPrefix+"sourcechooser-button",e.sourcechooserButton.innerHTML='<button type="button" role="button" aria-haspopup="true" aria-owns="'+s.id+'" title="'+c+'" aria-label="'+c+'" tabindex="0"></button>'+('<div class="'+s.options.classPrefix+"sourcechooser-selector "+s.options.classPrefix+'offscreen" role="menu" aria-expanded="false" aria-hidden="true"><ul></ul></div>'),s.addControlElement(e.sourcechooserButton,"sourcechooser");for(var d=0,f=u.length;d<f;d++){var p=u[d];void 0!==p.type&&"SOURCE"===p.nodeName&&"function"==typeof r.canPlayType&&e.addSourceButton(p.src,p.title,p.type,r.src===p.src)}e.sourcechooserButton.addEventListener("mouseover",function(){clearTimeout(n),e.showSourcechooserSelector()}),e.sourcechooserButton.addEventListener("mouseout",function(){n=setTimeout(function(){e.hideSourcechooserSelector()},500)}),e.sourcechooserButton.addEventListener("keydown",function(o){if(s.options.keyActions.length){var t=o.which||o.keyCode||0;switch(t){case 32:mejs.MediaFeatures.isFirefox||e.showSourcechooserSelector(),e.sourcechooserButton.querySelector("input[type=radio]:checked").focus();break;case 13:e.showSourcechooserSelector(),e.sourcechooserButton.querySelector("input[type=radio]:checked").focus();break;case 27:e.hideSourcechooserSelector(),e.sourcechooserButton.querySelector("button").focus();break;default:return!0}o.preventDefault(),o.stopPropagation()}}),e.sourcechooserButton.addEventListener("focusout",mejs.Utils.debounce(function(){setTimeout(function(){var o=document.activeElement.closest("."+s.options.classPrefix+"sourcechooser-selector");o||e.hideSourcechooserSelector()},0)},100));for(var v=e.sourcechooserButton.querySelectorAll("input[type=radio]"),S=0,y=v.length;S<y;S++)v[S].addEventListener("click",function(){this.setAttribute("aria-selected",!0),this.checked=!0;for(var e=this.closest("."+s.options.classPrefix+"sourcechooser-selector").querySelectorAll("input[type=radio]"),o=0,t=e.length;o<t;o++)e[o]!==this&&(e[o].setAttribute("aria-selected","false"),e[o].removeAttribute("checked"));var c=this.value;r.currentSrc!==c&&!function(){var e=r.paused,o=function o(){e||r.play(),r.removeEventListener("canplay",o,!0)},t=r.currentTime;r.pause(),r.setSrc(c),r.load(),r.addEventListener("loadedmetadata",function(){r.currentTime=t},!0),r.addEventListener("canplay",o,!0),r.load()}()});e.sourcechooserButton.querySelector("button").addEventListener("click",function(){mejs.Utils.hasClass(mejs.Utils.siblings(this,"."+s.options.classPrefix+"sourcechooser-selector"),s.options.classPrefix+"offscreen")?(e.showSourcechooserSelector(),e.sourcechooserButton.querySelector("input[type=radio]:checked").focus()):e.hideSourcechooserSelector()})}},addSourceButton:function(e,o,t,r){var s=this;""!==o&&void 0!==o||(o=e),t=t.split("/")[1],s.sourcechooserButton.querySelector("ul").innerHTML+="<li>"+('<input type="radio" name="'+s.id+'_sourcechooser" id="'+s.id+"_sourcechooser_"+o+t+'"')+('role="menuitemradio" value="'+e+'" '+(r?'checked="checked"':"")+' aria-selected="'+r+'"/>')+('<label for="'+s.id+"_sourcechooser_"+o+t+'" aria-hidden="true">'+o+" ("+t+")</label>")+"</li>",s.adjustSourcechooserBox()},adjustSourcechooserBox:function(){var e=this;e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector").style.height=parseFloat(e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector ul").offsetHeight)+"px"},hideSourcechooserSelector:function(){var e=this;if(void 0!==e.sourcechooserButton&&e.sourcechooserButton.querySelector("input[type=radio]")){var o=e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector"),t=o.querySelectorAll("input[type=radio]");o.setAttribute("aria-expanded","false"),o.setAttribute("aria-hidden","true"),mejs.Utils.addClass(o,e.options.classPrefix+"offscreen");for(var r=0,s=t.length;r<s;r++)t[r].setAttribute("tabindex","-1")}},showSourcechooserSelector:function(){var e=this;if(void 0!==e.sourcechooserButton&&e.sourcechooserButton.querySelector("input[type=radio]")){var o=e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector"),t=o.querySelectorAll("input[type=radio]");o.setAttribute("aria-expanded","true"),o.setAttribute("aria-hidden","false"),mejs.Utils.removeClass(o,e.options.classPrefix+"offscreen");for(var r=0,s=t.length;r<s;r++)t[r].setAttribute("tabindex","0")}}})},{}]},{},[1]); | ||
!function e(o,t,r){function s(i,u){if(!t[i]){if(!o[i]){var n="function"==typeof require&&require;if(!u&&n)return n(i,!0);if(c)return c(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var l=t[i]={exports:{}};o[i][0].call(l.exports,function(e){var t=o[i][1][e];return s(t||e)},l,l.exports,e,o,t,r)}return t[i].exports}for(var c="function"==typeof require&&require,i=0;i<r.length;i++)s(r[i]);return s}({1:[function(e,o,t){"use strict";mejs.i18n.en["mejs.source-chooser"]="Source Chooser",Object.assign(mejs.MepDefaults,{sourcechooserText:null}),Object.assign(MediaElementPlayer.prototype,{buildsourcechooser:function(e,o,t,r){for(var s=this,c=mejs.Utils.isString(s.options.sourcechooserText)?s.options.sourcechooserText:mejs.i18n.t("mejs.source-chooser"),i=[],u=s.mediaFiles?s.mediaFiles:s.node.childNodes,n=void 0,a=0,l=u.length;a<l;a++){var h=u[a];s.mediaFiles?i.push(h):"SOURCE"===h.nodeName&&i.push(h)}if(!(i.length<=1)){e.sourcechooserButton=document.createElement("div"),e.sourcechooserButton.className=s.options.classPrefix+"button "+s.options.classPrefix+"sourcechooser-button",e.sourcechooserButton.innerHTML='<button type="button" role="button" aria-haspopup="true" aria-owns="'+s.id+'" title="'+c+'" aria-label="'+c+'" tabindex="0"></button><div class="'+s.options.classPrefix+"sourcechooser-selector "+s.options.classPrefix+'offscreen" role="menu" aria-expanded="false" aria-hidden="true"><ul></ul></div>',s.addControlElement(e.sourcechooserButton,"sourcechooser");for(var d=0,f=i.length;d<f;d++){var p=i[d];void 0!==p.type&&"function"==typeof r.canPlayType&&e.addSourceButton(p.src,p.title,p.type,r.src===p.src)}e.sourcechooserButton.addEventListener("mouseover",function(){clearTimeout(n),e.showSourcechooserSelector()}),e.sourcechooserButton.addEventListener("mouseout",function(){n=setTimeout(function(){e.hideSourcechooserSelector()},0)}),e.sourcechooserButton.addEventListener("keydown",function(o){if(s.options.keyActions.length){switch(o.which||o.keyCode||0){case 32:mejs.MediaFeatures.isFirefox||e.showSourcechooserSelector(),e.sourcechooserButton.querySelector("input[type=radio]:checked").focus();break;case 13:e.showSourcechooserSelector(),e.sourcechooserButton.querySelector("input[type=radio]:checked").focus();break;case 27:e.hideSourcechooserSelector(),e.sourcechooserButton.querySelector("button").focus();break;default:return!0}o.preventDefault(),o.stopPropagation()}}),e.sourcechooserButton.addEventListener("focusout",mejs.Utils.debounce(function(){setTimeout(function(){document.activeElement.closest("."+s.options.classPrefix+"sourcechooser-selector")||e.hideSourcechooserSelector()},0)},100));for(var v=e.sourcechooserButton.querySelectorAll("input[type=radio]"),S=0,y=v.length;S<y;S++)v[S].addEventListener("click",function(){this.setAttribute("aria-selected",!0),this.checked=!0;for(var e=this.closest("."+s.options.classPrefix+"sourcechooser-selector").querySelectorAll("input[type=radio]"),o=0,t=e.length;o<t;o++)e[o]!==this&&(e[o].setAttribute("aria-selected","false"),e[o].removeAttribute("checked"));var c=this.value;if(r.getSrc()!==c){var i=r.currentTime,u=r.paused,n=function e(){u||(r.setCurrentTime(i),r.play()),r.removeEventListener("canplay",e)};r.pause(),r.setSrc(c),r.load(),r.addEventListener("canplay",n)}});e.sourcechooserButton.querySelector("button").addEventListener("click",function(){mejs.Utils.hasClass(mejs.Utils.siblings(this,"."+s.options.classPrefix+"sourcechooser-selector"),s.options.classPrefix+"offscreen")?(e.showSourcechooserSelector(),e.sourcechooserButton.querySelector("input[type=radio]:checked").focus()):e.hideSourcechooserSelector()})}},addSourceButton:function(e,o,t,r){var s=this;""!==o&&void 0!==o||(o=e),t=t.split("/")[1],s.sourcechooserButton.querySelector("ul").innerHTML+='<li><input type="radio" name="'+s.id+'_sourcechooser" id="'+s.id+"_sourcechooser_"+o+t+'"role="menuitemradio" value="'+e+'" '+(r?'checked="checked"':"")+' aria-selected="'+r+'"/><label for="'+s.id+"_sourcechooser_"+o+t+'" aria-hidden="true">'+o+" ("+t+")</label></li>",s.adjustSourcechooserBox()},adjustSourcechooserBox:function(){var e=this;e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector").style.height=parseFloat(e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector ul").offsetHeight)+"px"},hideSourcechooserSelector:function(){var e=this;if(void 0!==e.sourcechooserButton&&e.sourcechooserButton.querySelector("input[type=radio]")){var o=e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector"),t=o.querySelectorAll("input[type=radio]");o.setAttribute("aria-expanded","false"),o.setAttribute("aria-hidden","true"),mejs.Utils.addClass(o,e.options.classPrefix+"offscreen");for(var r=0,s=t.length;r<s;r++)t[r].setAttribute("tabindex","-1")}},showSourcechooserSelector:function(){var e=this;if(void 0!==e.sourcechooserButton&&e.sourcechooserButton.querySelector("input[type=radio]")){var o=e.sourcechooserButton.querySelector("."+e.options.classPrefix+"sourcechooser-selector"),t=o.querySelectorAll("input[type=radio]");o.setAttribute("aria-expanded","true"),o.setAttribute("aria-hidden","false"),mejs.Utils.removeClass(o,e.options.classPrefix+"offscreen");for(var r=0,s=t.length;r<s;r++)t[r].setAttribute("tabindex","0")}}})},{}]},{},[1]); |
@@ -45,4 +45,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -52,3 +52,3 @@ */ | ||
var t = this, | ||
isNative = t.media.rendererName !== null && t.media.rendererName.match(/(native|html5)/) !== null; | ||
isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName); | ||
@@ -55,0 +55,0 @@ if (!isNative) { |
@@ -1,1 +0,1 @@ | ||
!function e(t,s,o){function n(r,a){if(!s[r]){if(!t[r]){var i="function"==typeof require&&require;if(!a&&i)return i(r,!0);if(l)return l(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var p=s[r]={exports:{}};t[r][0].call(p.exports,function(e){var s=t[r][1][e];return n(s?s:e)},p,p.exports,e,t,s,o)}return s[r].exports}for(var l="function"==typeof require&&require,r=0;r<o.length;r++)n(o[r]);return n}({1:[function(e,t,s){"use strict";mejs.i18n.en["mejs.speed-rate"]="Speed Rate",Object.assign(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x",speedText:null}),Object.assign(MediaElementPlayer.prototype,{buildspeed:function(e,t,s,o){var n=this,l=null!==n.media.rendererName&&null!==n.media.rendererName.match(/(native|html5)/);if(l){for(var r=[],a=mejs.Utils.isString(n.options.speedText)?n.options.speedText:mejs.i18n.t("mejs.speed-rate"),i=function(e){for(var t=0,s=r.length;t<s;t++)if(r[t].value===e)return r[t].name},d=void 0,p=!1,c=0,u=n.options.speeds.length;c<u;c++){var f=n.options.speeds[c];"string"==typeof f?(r.push({name:""+f+n.options.speedChar,value:f}),f===n.options.defaultSpeed&&(p=!0)):(r.push(f),f.value===n.options.defaultSpeed&&(p=!0))}p||r.push({name:n.options.defaultSpeed+n.options.speedChar,value:n.options.defaultSpeed}),r.sort(function(e,t){return parseFloat(t.value)-parseFloat(e.value)}),n.clearspeed(e),e.speedButton=document.createElement("div"),e.speedButton.className=n.options.classPrefix+"button "+n.options.classPrefix+"speed-button",e.speedButton.innerHTML='<button type="button" aria-controls="'+n.id+'" title="'+a+'" '+('aria-label="'+a+'" tabindex="0">'+i(n.options.defaultSpeed)+"</button>")+('<div class="'+n.options.classPrefix+"speed-selector "+n.options.classPrefix+'offscreen">')+('<ul class="'+n.options.classPrefix+'speed-selector-list"></ul>')+"</div>",n.addControlElement(e.speedButton,"speed");for(var v=0,m=r.length;v<m;v++){var h=n.id+"-speed-"+r[v].value;e.speedButton.querySelector("ul").innerHTML+='<li class="'+n.options.classPrefix+'speed-selector-list-item">'+('<input class="'+n.options.classPrefix+'speed-selector-input" type="radio" name="'+n.id+'_speed"')+('disabled="disabled" value="'+r[v].value+'" id="'+h+'" ')+((r[v].value===n.options.defaultSpeed?' checked="checked"':"")+"/>")+('<label class="'+n.options.classPrefix+"speed-selector-label")+((r[v].value===n.options.defaultSpeed?" "+n.options.classPrefix+"speed-selected":"")+'">')+(r[v].name+"</label>")+"</li>"}d=n.options.defaultSpeed,e.speedSelector=e.speedButton.querySelector("."+n.options.classPrefix+"speed-selector");for(var S=["mouseenter","focusin"],x=["mouseleave","focusout"],b=e.speedButton.querySelectorAll('input[type="radio"]'),g=e.speedButton.querySelectorAll("."+n.options.classPrefix+"speed-selector-label"),y=0,P=S.length;y<P;y++)e.speedButton.addEventListener(S[y],function(){mejs.Utils.removeClass(e.speedSelector,n.options.classPrefix+"offscreen"),e.speedSelector.style.height=e.speedSelector.querySelector("ul").offsetHeight,e.speedSelector.style.top=-1*parseFloat(e.speedSelector.offsetHeight)+"px"});for(var j=0,B=x.length;j<B;j++)e.speedSelector.addEventListener(x[j],function(){mejs.Utils.addClass(this,n.options.classPrefix+"offscreen")});for(var E=0,C=b.length;E<C;E++){var U=b[E];U.disabled=!1,U.addEventListener("click",function(){var t=this,s=t.value;d=s,o.playbackRate=parseFloat(s),e.speedButton.querySelector("button").innerHTML=i(s);for(var l=e.speedButton.querySelectorAll("."+n.options.classPrefix+"speed-selected"),r=0,a=l.length;r<a;r++)mejs.Utils.removeClass(l[r],n.options.classPrefix+"speed-selected");t.checked=!0;for(var p=mejs.Utils.siblings(t,function(e){return mejs.Utils.hasClass(e,n.options.classPrefix+"speed-selector-label")}),c=0,u=p.length;c<u;c++)mejs.Utils.addClass(p[c],n.options.classPrefix+"speed-selected")})}for(var q=0,L=g.length;q<L;q++)g[q].addEventListener("click",function(){var e=mejs.Utils.siblings(this,function(e){return"INPUT"===e.tagName})[0],t=mejs.Utils.createEvent("click",e);e.dispatchEvent(t)});e.speedSelector.addEventListener("keydown",function(e){e.stopPropagation()}),o.addEventListener("loadedmetadata",function(){d&&(o.playbackRate=parseFloat(d))})}},clearspeed:function(e){e&&(e.speedButton&&e.speedButton.parentNode.removeChild(e.speedButton),e.speedSelector&&e.speedSelector.parentNode.removeChild(e.speedSelector))}})},{}]},{},[1]); | ||
!function e(t,s,o){function n(l,i){if(!s[l]){if(!t[l]){var a="function"==typeof require&&require;if(!i&&a)return a(l,!0);if(r)return r(l,!0);var d=new Error("Cannot find module '"+l+"'");throw d.code="MODULE_NOT_FOUND",d}var p=s[l]={exports:{}};t[l][0].call(p.exports,function(e){var s=t[l][1][e];return n(s||e)},p,p.exports,e,t,s,o)}return s[l].exports}for(var r="function"==typeof require&&require,l=0;l<o.length;l++)n(o[l]);return n}({1:[function(e,t,s){"use strict";mejs.i18n.en["mejs.speed-rate"]="Speed Rate",Object.assign(mejs.MepDefaults,{speeds:["2.00","1.50","1.25","1.00","0.75"],defaultSpeed:"1.00",speedChar:"x",speedText:null}),Object.assign(MediaElementPlayer.prototype,{buildspeed:function(e,t,s,o){var n=this;if(null!==n.media.rendererName&&/(native|html5)/i.test(n.media.rendererName)){for(var r=[],l=mejs.Utils.isString(n.options.speedText)?n.options.speedText:mejs.i18n.t("mejs.speed-rate"),i=function(e){for(var t=0,s=r.length;t<s;t++)if(r[t].value===e)return r[t].name},a=void 0,d=!1,p=0,c=n.options.speeds.length;p<c;p++){var u=n.options.speeds[p];"string"==typeof u?(r.push({name:""+u+n.options.speedChar,value:u}),u===n.options.defaultSpeed&&(d=!0)):(r.push(u),u.value===n.options.defaultSpeed&&(d=!0))}d||r.push({name:n.options.defaultSpeed+n.options.speedChar,value:n.options.defaultSpeed}),r.sort(function(e,t){return parseFloat(t.value)-parseFloat(e.value)}),n.clearspeed(e),e.speedButton=document.createElement("div"),e.speedButton.className=n.options.classPrefix+"button "+n.options.classPrefix+"speed-button",e.speedButton.innerHTML='<button type="button" aria-controls="'+n.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0">'+i(n.options.defaultSpeed)+'</button><div class="'+n.options.classPrefix+"speed-selector "+n.options.classPrefix+'offscreen"><ul class="'+n.options.classPrefix+'speed-selector-list"></ul></div>',n.addControlElement(e.speedButton,"speed");for(var f=0,v=r.length;f<v;f++){var m=n.id+"-speed-"+r[f].value;e.speedButton.querySelector("ul").innerHTML+='<li class="'+n.options.classPrefix+'speed-selector-list-item"><input class="'+n.options.classPrefix+'speed-selector-input" type="radio" name="'+n.id+'_speed"disabled="disabled" value="'+r[f].value+'" id="'+m+'" '+(r[f].value===n.options.defaultSpeed?' checked="checked"':"")+'/><label class="'+n.options.classPrefix+"speed-selector-label"+(r[f].value===n.options.defaultSpeed?" "+n.options.classPrefix+"speed-selected":"")+'">'+r[f].name+"</label></li>"}a=n.options.defaultSpeed,e.speedSelector=e.speedButton.querySelector("."+n.options.classPrefix+"speed-selector");for(var h=["mouseenter","focusin"],S=["mouseleave","focusout"],x=e.speedButton.querySelectorAll('input[type="radio"]'),b=e.speedButton.querySelectorAll("."+n.options.classPrefix+"speed-selector-label"),g=0,y=h.length;g<y;g++)e.speedButton.addEventListener(h[g],function(){mejs.Utils.removeClass(e.speedSelector,n.options.classPrefix+"offscreen"),e.speedSelector.style.height=e.speedSelector.querySelector("ul").offsetHeight,e.speedSelector.style.top=-1*parseFloat(e.speedSelector.offsetHeight)+"px"});for(var P=0,j=S.length;P<j;P++)e.speedSelector.addEventListener(S[P],function(){mejs.Utils.addClass(this,n.options.classPrefix+"offscreen")});for(var B=0,E=x.length;B<E;B++){var C=x[B];C.disabled=!1,C.addEventListener("click",function(){var t=this,s=t.value;a=s,o.playbackRate=parseFloat(s),e.speedButton.querySelector("button").innerHTML=i(s);for(var r=e.speedButton.querySelectorAll("."+n.options.classPrefix+"speed-selected"),l=0,d=r.length;l<d;l++)mejs.Utils.removeClass(r[l],n.options.classPrefix+"speed-selected");t.checked=!0;for(var p=mejs.Utils.siblings(t,function(e){return mejs.Utils.hasClass(e,n.options.classPrefix+"speed-selector-label")}),c=0,u=p.length;c<u;c++)mejs.Utils.addClass(p[c],n.options.classPrefix+"speed-selected")})}for(var U=0,q=b.length;U<q;U++)b[U].addEventListener("click",function(){var e=mejs.Utils.siblings(this,function(e){return"INPUT"===e.tagName})[0],t=mejs.Utils.createEvent("click",e);e.dispatchEvent(t)});e.speedSelector.addEventListener("keydown",function(e){e.stopPropagation()}),o.addEventListener("loadedmetadata",function(){a&&(o.playbackRate=parseFloat(a))})}},clearspeed:function(e){e&&(e.speedButton&&e.speedButton.parentNode.removeChild(e.speedButton),e.speedSelector&&e.speedSelector.parentNode.removeChild(e.speedSelector))}})},{}]},{},[1]); |
@@ -30,4 +30,4 @@ (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){ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -34,0 +34,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
!function e(t,o,s){function r(i,a){if(!o[i]){if(!t[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(n)return n(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var c=o[i]={exports:{}};t[i][0].call(c.exports,function(e){var o=t[i][1][e];return r(o?o:e)},c,c.exports,e,t,o,s)}return o[i].exports}for(var n="function"==typeof require&&require,i=0;i<s.length;i++)r(s[i]);return r}({1:[function(e,t,o){"use strict";mejs.i18n.en["mejs.stop"]="Stop",Object.assign(mejs.MepDefaults,{stopText:null}),Object.assign(MediaElementPlayer.prototype,{buildstop:function(e,t,o,s){var r=this,n=mejs.Utils.isString(r.options.stopText)?r.options.stopText:mejs.i18n.t("mejs.stop"),i=document.createElement("div");i.className=r.options.classPrefix+"button "+r.options.classPrefix+"stop-button "+r.options.classPrefix+"stop",i.innerHTML='<button type="button" aria-controls="'+r.id+'" title="'+n+'" aria-label="'+n+'" tabindex="0"></button>',r.addControlElement(i,"stop"),i.addEventListener("click",function(){s.paused||s.pause(),s.currentTime>0&&(s.setCurrentTime(0),s.pause(),t.querySelector("."+r.options.classPrefix+"time-current").style.width="0px",t.querySelector("."+r.options.classPrefix+"time-handle").style.left="0px",t.querySelector("."+r.options.classPrefix+"time-float-current").innerHTML=mejs.Utils.secondsToTimeCode(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond),t.querySelector("."+r.options.classPrefix+"currenttime").innerHTML=mejs.Utils.secondsToTimeCode(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond),o.querySelector("."+r.options.classPrefix+"poster").style.display="block")})}})},{}]},{},[1]); | ||
!function e(t,o,s){function r(i,a){if(!o[i]){if(!t[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(n)return n(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var c=o[i]={exports:{}};t[i][0].call(c.exports,function(e){var o=t[i][1][e];return r(o||e)},c,c.exports,e,t,o,s)}return o[i].exports}for(var n="function"==typeof require&&require,i=0;i<s.length;i++)r(s[i]);return r}({1:[function(e,t,o){"use strict";mejs.i18n.en["mejs.stop"]="Stop",Object.assign(mejs.MepDefaults,{stopText:null}),Object.assign(MediaElementPlayer.prototype,{buildstop:function(e,t,o,s){var r=this,n=mejs.Utils.isString(r.options.stopText)?r.options.stopText:mejs.i18n.t("mejs.stop"),i=document.createElement("div");i.className=r.options.classPrefix+"button "+r.options.classPrefix+"stop-button "+r.options.classPrefix+"stop",i.innerHTML='<button type="button" aria-controls="'+r.id+'" title="'+n+'" aria-label="'+n+'" tabindex="0"></button>',r.addControlElement(i,"stop"),i.addEventListener("click",function(){s.paused||s.pause(),s.currentTime>0&&(s.setCurrentTime(0),s.pause(),t.querySelector("."+r.options.classPrefix+"time-current").style.width="0px",t.querySelector("."+r.options.classPrefix+"time-handle").style.left="0px",t.querySelector("."+r.options.classPrefix+"time-float-current").innerHTML=mejs.Utils.secondsToTimeCode(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond),t.querySelector("."+r.options.classPrefix+"currenttime").innerHTML=mejs.Utils.secondsToTimeCode(0,e.options.alwaysShowHours,e.options.showTimecodeFrameCount,e.options.framesPerSecond),o.querySelector("."+r.options.classPrefix+"poster").style.display="block")})}})},{}]},{},[1]); |
@@ -13,3 +13,3 @@ # VAST/VPAID | ||
------ | --------- | ------- | -------- | ||
vastAdTagUrl | string | `x` | Character used to stop speeding media | ||
vastAdTagUrl | string | __empty__ | VAST or VPAID URL | ||
vastAdsType | string | `vast` | Type of Ads (`vast` or `vpaid`) |
@@ -28,3 +28,4 @@ # Chromecast | ||
castTitle | string | `null` | Chromecast button title for ARIA purposes | ||
castAppId | string | `null` | Chromecast Application ID; if `null` is provided, it will default to `chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID` | ||
castPolicy | string | `origin` | Chromecast default policy: `origin` (by default, auto connect from same appId and page origin), `tab` (auto connect from same appId, page origin, and tab) and `page` (no auto connect) | ||
castAppId | string | `null` | Chromecast Application ID; if `null` is provided, it will default to `chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID` | ||
castEnableTracks | boolean | `false` | Whether to load tracks or not through Chromecast. In order to process tracks correctly, `tracks` feature must be enable on the player configuration and user **MUST** set a custom receiver application. Read [this](https://github.com/googlecast/CastReferencePlayer) and [this](https://developers.google.com/cast/docs/receiver_apps) pages for more references. |
@@ -17,4 +17,2 @@ # Context Menu | ||
------ | --------- | ------- | -------- | ||
isContextMenuEnabled | boolean | `true` | Whether to display context menu or not | ||
contextMenuTimeout | number | `null` | Time in milliseconds when the context should be hidden automatically; if `null` it will never disappears until an action is performed | ||
contextMenuItems | array | | An array of objects with format `{ render (player) { }, click (player) {} }` to render and perform click menu items, or `{ isSeparator: true }` to separate items |
{ | ||
"name": "mediaelement-plugins", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"repository": { | ||
@@ -16,3 +16,3 @@ "type": "git", | ||
"babel-core": "^6.18.2", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-env": "^1.4.0", | ||
"babel-register": "^6.18.0", | ||
@@ -48,6 +48,6 @@ "babelify": "^7.3.0", | ||
"airplay": "postcss --no-map -u autoprefixer -r src/airplay/airplay.css && cp src/airplay/airplay.css dist/airplay/airplay.css && cssnano dist/airplay/airplay.css dist/airplay/airplay.min.css && browserify -t browserify-versionify -t [babelify] -p browserify-derequire -p bundle-collapser/plugin src/airplay/airplay.js > dist/airplay/airplay.js && uglifyjs dist/airplay/airplay.js -c sequences=true,dead_code=true,conditionals=true,booleans=true,unused=true,if_return=true,join_vars=true,pure_funcs=['console.log'] -m --screw-ie8 > dist/airplay/airplay.min.js" | ||
}, | ||
}, | ||
"dependencies": { | ||
"global": "^4.3.1", | ||
"mediaelement": "~4.0.3" | ||
"mediaelement": "^4.0.7" | ||
}, | ||
@@ -62,4 +62,9 @@ "browserify": { | ||
{ | ||
"presets": "es2015", | ||
"sourceMapsAbsolute": true | ||
"presets": [ | ||
["env", { | ||
"targets": { | ||
"browsers": ["last 5 versions", "ie >= 9", "ios >= 8", "android >= 4"] | ||
} | ||
}] | ||
] | ||
} | ||
@@ -66,0 +71,0 @@ ] |
@@ -47,4 +47,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -351,13 +351,27 @@ */ | ||
if (t.media.canPlayType(type) !== '' || t.media.canPlayType(type).match(/(no|false)/) === null) { | ||
if (t.media.canPlayType(type) !== '' || /(no|false)/i.test(t.media.canPlayType(type))) { | ||
adTag.mediaFiles.push({ | ||
id: mediaFile.getAttribute('id'), | ||
delivery: mediaFile.getAttribute('delivery'), | ||
type: mediaFile.getAttribute('type'), | ||
bitrate: mediaFile.getAttribute('bitrate'), | ||
width: mediaFile.getAttribute('width'), | ||
height: mediaFile.getAttribute('height'), | ||
url: mediaFile.textContent.trim() | ||
}); | ||
// Execute JS files if found | ||
if (mediaFile.getAttribute('type') === 'application/javascript') { | ||
const | ||
script = document.createElement('script'), | ||
firstScriptTag = document.getElementsByTagName('script')[0] | ||
; | ||
script.src = mediaFile.textContent.trim(); | ||
firstScriptTag.parentNode.insertBefore(script, firstScriptTag); | ||
} | ||
// Avoid Flash | ||
else if (mediaFile.getAttribute('delivery') !== 'application/x-shockwave-flash') { | ||
adTag.mediaFiles.push({ | ||
id: mediaFile.getAttribute('id'), | ||
delivery: mediaFile.getAttribute('delivery'), | ||
type: mediaFile.getAttribute('type'), | ||
bitrate: mediaFile.getAttribute('bitrate'), | ||
width: mediaFile.getAttribute('width'), | ||
height: mediaFile.getAttribute('height'), | ||
url: mediaFile.textContent.trim() | ||
}); | ||
} | ||
} | ||
@@ -410,3 +424,3 @@ } | ||
if (trackingPoints.includes(trackingEvent.type)) { | ||
if (~trackingPoints.indexOf(trackingEvent.type)) { | ||
if (adTag.trackingEvents[trackingEvent.type] === undefined) { | ||
@@ -429,3 +443,3 @@ adTag.trackingEvents[trackingEvent.type] = []; | ||
if (t.media.canPlayType(type) !== '' || t.media.canPlayType(type).match(/(no|false)/) === null) { | ||
if (t.media.canPlayType(type) !== '' || /(no|false)/i.test(t.media.canPlayType(type))) { | ||
@@ -475,4 +489,8 @@ adTag.mediaFiles.push({ | ||
while (i < t.vastAdTags.length) { | ||
t.options.adsPrerollMediaUrl[i] = t.vastAdTags[i].mediaFiles[0].url; | ||
t.options.adsPrerollAdUrl[i] = t.vastAdTags[i].clickThrough; | ||
if (typeof t.vastAdTags[i].mediaFiles !== 'undefined' && t.vastAdTags[i].mediaFiles.length) { | ||
t.options.adsPrerollMediaUrl[i] = t.vastAdTags[i].mediaFiles[0].url; | ||
} | ||
if (typeof t.vastAdTags[i].clickThrough !== 'undefined') { | ||
t.options.adsPrerollAdUrl[i] = t.vastAdTags[i].clickThrough; | ||
} | ||
i++; | ||
@@ -479,0 +497,0 @@ } |
@@ -60,2 +60,10 @@ 'use strict'; | ||
/** | ||
* Feature constructor. | ||
* | ||
* Always has to be prefixed with `build` and the name that will be used in MepDefaults.features list | ||
* @param {MediaElementPlayer} player | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
*/ | ||
buildads (player, controls, layers) { | ||
@@ -184,3 +192,14 @@ | ||
// turn off controls until the preroll is done | ||
t.disableControls(); | ||
const controlElements = t.container.querySelector(`.${t.options.classPrefix}controls`).childNodes; | ||
for (let i = 0, total = controlElements.length; i < total; i++) { | ||
const | ||
target = controlElements[i], | ||
button = target.querySelector('button') | ||
; | ||
if (button && !mejs.Utils.hasClass(target, `${t.options.classPrefix}playpause-button`)) { | ||
button.disabled = true; | ||
} else if (target.querySelector(`.${t.options.classPrefix}time-slider`)) { | ||
target.querySelector(`.${t.options.classPrefix}time-slider`).style.pointerEvents = 'none'; | ||
} | ||
} | ||
@@ -201,3 +220,3 @@ // enable clicking through | ||
if (t.options.adsPrerollAdSkipSeconds > 0) { | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info').replace('%1', t.options.adsPrerollAdSkipSeconds.toString()); | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info', t.options.adsPrerollAdSkipSeconds); | ||
t.adsSkipMessage.style.display = 'block'; | ||
@@ -227,3 +246,3 @@ t.adsSkipButton.style.display = 'none'; | ||
} else { | ||
t.adsSkipMessage.innerHTML = (mejs.i18n.t('mejs.ad-skip-info').replace('%1', Math.round(t.options.adsPrerollAdSkipSeconds - t.media.currentTime).toString())); | ||
t.adsSkipMessage.innerHTML = mejs.i18n.t('mejs.ad-skip-info', Math.round(t.options.adsPrerollAdSkipSeconds - t.media.currentTime)); | ||
} | ||
@@ -276,3 +295,17 @@ | ||
t.enableControls(); | ||
// turn on controls to restore original media | ||
const controlElements = t.container.querySelector(`.${t.options.classPrefix}controls`).childNodes; | ||
for (let i = 0, total = controlElements.length; i < total; i++) { | ||
const | ||
target = controlElements[i], | ||
button = target.querySelector('button') | ||
; | ||
if (button && !mejs.Utils.hasClass(target, `${t.options.classPrefix}playpause-button`)) { | ||
button.disabled = false; | ||
} else if (target.querySelector(`.${t.options.classPrefix}time-slider`)) { | ||
target.querySelector(`.${t.options.classPrefix}time-slider`).style.pointerEvents = 'auto'; | ||
} | ||
} | ||
if (t.adsSkipBlock) { | ||
@@ -340,3 +373,3 @@ t.adsSkipBlock.remove(); | ||
img.src = `${url}${(url.includes('?') ? '&' : '?')}random${rnd}=${rnd}`; | ||
img.src = `${url}${(~url.indexOf('?') ? '&' : '?')}random${rnd}=${rnd}`; | ||
img.loaded = () => { | ||
@@ -343,0 +376,0 @@ img = null; |
@@ -14,5 +14,3 @@ 'use strict'; | ||
options: { | ||
prefix: 'chromecast', | ||
cast: {} | ||
prefix: 'chromecast' | ||
}, | ||
@@ -34,3 +32,3 @@ | ||
*/ | ||
create: (mediaElement, options, mediaFiles) => { | ||
create: (mediaElement, options) => { | ||
@@ -243,3 +241,2 @@ // API objects | ||
mediaInfo = new chrome.cast.media.MediaInfo(url, type), | ||
// children = mediaElement.originalNode.childNodes, | ||
castSession = cast.framework.CastContext.getInstance().getCurrentSession() | ||
@@ -249,32 +246,37 @@ ; | ||
// Find captions/audioTracks | ||
// const tracks = []; | ||
// | ||
// let counter = 1; | ||
// | ||
// for (let i = 0, total = children.length; i < total; i++) { | ||
// const child = children[i]; | ||
// | ||
// if (child.nodeType !== Node.TEXT_NODE) { | ||
// const tag = child.tagName.toLowerCase(); | ||
// | ||
// if (tag === 'track' && (child.getAttribute('kind') === 'subtitles' || child.getAttribute('kind') === 'captions')) { | ||
// const el = new chrome.cast.media.Track(counter, chrome.cast.media.TrackType.TEXT); | ||
// el.trackContentId = mejs.Utils.absolutizeUrl(child.getAttribute('src')); | ||
// el.trackContentType = 'text/vtt'; | ||
// el.subtype = chrome.cast.media.TextTrackType.SUBTITLES; | ||
// el.name = child.getAttribute('label'); | ||
// el.language = child.getAttribute('srclang'); | ||
// el.customData = null; | ||
// tracks.push(el); | ||
// counter++; | ||
// } | ||
// } | ||
// } | ||
if (options.castEnableTracks === true) { | ||
const | ||
tracks = [], | ||
children = mediaElement.originalNode.childNodes | ||
; | ||
let counter = 1; | ||
for (let i = 0, total = children.length; i < total; i++) { | ||
const child = children[i]; | ||
if (child.nodeType !== Node.TEXT_NODE) { | ||
const tag = child.tagName.toLowerCase(); | ||
if (tag === 'track' && (child.getAttribute('kind') === 'subtitles' || child.getAttribute('kind') === 'captions')) { | ||
const el = new chrome.cast.media.Track(counter, chrome.cast.media.TrackType.TEXT); | ||
el.trackContentId = mejs.Utils.absolutizeUrl(child.getAttribute('src')); | ||
el.trackContentType = 'text/vtt'; | ||
el.subtype = chrome.cast.media.TextTrackType.SUBTITLES; | ||
el.name = child.getAttribute('label'); | ||
el.language = child.getAttribute('srclang'); | ||
el.customData = null; | ||
tracks.push(el); | ||
counter++; | ||
} | ||
} | ||
} | ||
mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle(); | ||
mediaInfo.tracks = tracks; | ||
} | ||
mediaInfo.metadata = new chrome.cast.media.GenericMediaMetadata(); | ||
mediaInfo.streamType = chrome.cast.media.StreamType.BUFFERED; | ||
mediaInfo.customData = null; | ||
mediaInfo.streamType = chrome.cast.media.StreamType.BUFFERED; | ||
// mediaInfo.textTrackStyle = new chrome.cast.media.TextTrackStyle(); | ||
mediaInfo.duration = null; | ||
// mediaInfo.tracks = tracks; | ||
@@ -299,4 +301,7 @@ if (mediaElement.originalNode.getAttribute('data-cast-title')) { | ||
() => { | ||
// Autoplay media | ||
// Autoplay media in the current position | ||
const currentTime = mediaElement.originalNode.getCurrentTime(); | ||
c.setCurrentTime(currentTime); | ||
castPlayerController.playOrPause(); | ||
setTimeout(() => { | ||
@@ -445,4 +450,15 @@ const event = mejs.Utils.createEvent('play', c); | ||
*/ | ||
castPolicy: 'origin' | ||
castPolicy: 'origin', | ||
/** | ||
* Whether to load tracks or not through Chromecast | ||
* | ||
* In order to process tracks correctly, `tracks` feature must be enable on the player configuration | ||
* and user MUST set a custom receiver application. | ||
* @see https://github.com/googlecast/CastReferencePlayer | ||
* @see https://developers.google.com/cast/docs/receiver_apps | ||
* @type {Boolean} | ||
*/ | ||
castEnableTracks: false | ||
}); | ||
@@ -457,4 +473,4 @@ | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -545,2 +561,4 @@ */ | ||
let currentTime = 0; | ||
// Set up renderer and device data | ||
@@ -556,3 +574,2 @@ media.castPlayerController.addEventListener(cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED, () => { | ||
const | ||
// captions = player.captionsButton.querySelectorAll('input[type=radio]'), | ||
castSession = cast.framework.CastContext.getInstance().getCurrentSession(), | ||
@@ -565,23 +582,42 @@ deviceInfo = layers.querySelector(`.${t.options.classPrefix}chromecast-info`).querySelector('.device') | ||
// for (let i = 0, total = captions.length; i < total; i++) { | ||
// captions[i].addEventListener('click', function () { | ||
// const | ||
// trackId = parseInt(captions[i].id.replace(/^.*?track_(\d+)_.*$/, "$1")), | ||
// setTracks = captions[i].value === 'none' ? [] : [trackId], | ||
// tracksInfo = new chrome.cast.media.EditTracksInfoRequest(setTracks) | ||
// ; | ||
// | ||
// castSession.getMediaSession().editTracksInfo(tracksInfo, () => {}, (e) => { | ||
// console.error(e); | ||
// }); | ||
// }); | ||
// } | ||
if (t.options.castEnableTracks === true) { | ||
const captions = player.captionsButton !== undefined ? | ||
player.captionsButton.querySelectorAll('input[type=radio]') : null; | ||
if (captions !== null) { | ||
for (let i = 0, total = captions.length; i < total; i++) { | ||
captions[i].addEventListener('click', function () { | ||
const | ||
trackId = parseInt(captions[i].id.replace(/^.*?track_(\d+)_.*$/, "$1")), | ||
setTracks = captions[i].value === 'none' ? [] : [trackId], | ||
tracksInfo = new chrome.cast.media.EditTracksInfoRequest(setTracks) | ||
; | ||
castSession.getMediaSession().editTracksInfo(tracksInfo, () => {}, (e) => { | ||
console.error(e); | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
media.addEventListener('timeupdate', () => { | ||
currentTime = media.getCurrentTime(); | ||
}); | ||
return; | ||
} | ||
} | ||
player.chromecastLayer.style.display = 'none'; | ||
media.style.display = ''; | ||
const renderInfo = mejs.Renderers.select(mediaFiles, media.renderers); | ||
media.changeRenderer(renderInfo.rendererName, mediaFiles); | ||
player.chromecastLayer.style.display = 'none'; | ||
media.style.display = ''; | ||
const renderInfo = mejs.Renderers.select(mediaFiles, media.renderers); | ||
media.changeRenderer(renderInfo.rendererName, mediaFiles); | ||
media.setCurrentTime(currentTime); | ||
// Continue playing if already started | ||
if (currentTime > 0 && !mejs.Features.IS_IOS && !mejs.Features.IS_ANDROID) { | ||
media.play(); | ||
} | ||
@@ -593,3 +629,3 @@ }); | ||
const script = document.createElement('script'); | ||
script.src = '//www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'; | ||
script.src = 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1'; | ||
document.body.appendChild(script); | ||
@@ -612,2 +648,2 @@ loadedCastAPI = true; | ||
} | ||
}); | ||
}); |
@@ -13,4 +13,2 @@ 'use strict'; | ||
Object.assign(mejs.MepDefaults, { | ||
isContextMenuEnabled: true, | ||
contextMenuTimeout: null, | ||
contextMenuItems: [{ | ||
@@ -75,19 +73,21 @@ // demo of a fullscreen option | ||
isContextMenuEnabled: true, | ||
contextMenuTimeout: null, | ||
buildcontextmenu (player) { | ||
if (document.querySelector(`.${player.options.classPrefix}contextmenu`)) { | ||
return; | ||
} | ||
// create context menu | ||
player.contextMenu = document.createElement('div'); | ||
player.contextMenu.className = `${player.options.classPrefix}contextmenu`; | ||
player.contextMenu.style.display = 'none'; | ||
if (!document.querySelector(`.${player.options.classPrefix}contextmenu`)) { | ||
player.contextMenu = document.createElement('div'); | ||
player.contextMenu.className = `${player.options.classPrefix}contextmenu`; | ||
player.contextMenu.style.display = 'none'; | ||
document.body.appendChild(player.contextMenu); | ||
document.body.appendChild(player.contextMenu); | ||
} | ||
// create events for showing context menu | ||
player.container.addEventListener('contextmenu', (e) => { | ||
if (player.isContextMenuEnabled) { | ||
player.renderContextMenu(e.clientX - 1, e.clientY - 1); | ||
if (player.isContextMenuEnabled && (e.keyCode === 3 || e.which === 3)) { | ||
player.renderContextMenu(e); | ||
e.preventDefault(); | ||
@@ -107,3 +107,3 @@ e.stopPropagation(); | ||
cleancontextmenu (player) { | ||
player.contextMenu.parentNode.removeChild(player.contextMenu); | ||
player.contextMenu.remove(); | ||
}, | ||
@@ -141,3 +141,3 @@ | ||
renderContextMenu (x, y) { | ||
renderContextMenu (event) { | ||
@@ -149,3 +149,3 @@ // alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly | ||
items = t.options.contextMenuItems | ||
; | ||
; | ||
@@ -169,8 +169,22 @@ for (let i = 0, total = items.length; i < total; i++) { | ||
// position and show the context menu | ||
t.contextMenu.innerHTML = html; | ||
t.contextMenu.style.top = y; | ||
t.contextMenu.style.left = x; | ||
t.contextMenu.style.display = 'block'; | ||
const | ||
width = t.contextMenu.offsetWidth, | ||
height = t.contextMenu.offsetHeight, | ||
x = event.pageX, | ||
y = event.pageY, | ||
doc = document.documentElement, | ||
scrollLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), | ||
scrollTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0), | ||
left = (x + width > window.innerWidth + scrollLeft) ? x - width : x, | ||
top = (y + height > window.innerHeight + scrollTop) ? y - height : y | ||
; | ||
t.contextMenu.style.display = ''; | ||
t.contextMenu.style.left = `${left}px`; | ||
t.contextMenu.style.top = `${top}px`; | ||
// bind events | ||
@@ -185,3 +199,3 @@ const contextItems = t.contextMenu.querySelectorAll(`.${t.options.classPrefix}contextmenu-item`); | ||
item = t.options.contextMenuItems[itemIndex] | ||
; | ||
; | ||
@@ -207,3 +221,3 @@ // bind extra functionality? | ||
setTimeout(() => { | ||
t.killControlsTimer('rev3'); | ||
t.killControlsTimer(); | ||
}, 100); | ||
@@ -210,0 +224,0 @@ |
@@ -48,4 +48,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -52,0 +52,0 @@ */ |
@@ -29,4 +29,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -33,0 +33,0 @@ */ |
@@ -27,7 +27,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} media | ||
*/ | ||
buildloop (player, controls) { | ||
buildloop (player) { | ||
const | ||
@@ -34,0 +31,0 @@ t = this, |
@@ -37,4 +37,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -41,0 +41,0 @@ */ |
@@ -29,5 +29,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} media | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
*/ | ||
@@ -34,0 +33,0 @@ buildpostroll (player, controls, layers) { |
@@ -66,5 +66,2 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} media | ||
*/ | ||
@@ -71,0 +68,0 @@ buildpreview (player) { |
@@ -31,4 +31,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -54,3 +54,3 @@ */ | ||
const current = media.currentTime === Infinity ? 0 : media.currentTime; | ||
media.setCurrentTime(Math.max(current - t.options.jumpForwardInterval, 0)); | ||
media.setCurrentTime(Math.max(current - t.options.skipBackInterval, 0)); | ||
this.querySelector('button').blur(); | ||
@@ -57,0 +57,0 @@ } |
@@ -27,4 +27,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -38,3 +38,3 @@ */ | ||
sources = [], | ||
children = t.node.childNodes | ||
children = t.mediaFiles ? t.mediaFiles : t.node.childNodes | ||
; | ||
@@ -47,4 +47,7 @@ | ||
const s = children[i]; | ||
if (s.nodeName === 'SOURCE') { | ||
if (t.mediaFiles) { | ||
sources.push(s); | ||
} else if (s.nodeName === 'SOURCE') { | ||
sources.push(s); | ||
} | ||
@@ -67,3 +70,3 @@ } | ||
const src = sources[i]; | ||
if (src.type !== undefined && src.nodeName === 'SOURCE' && typeof media.canPlayType === 'function') { | ||
if (src.type !== undefined && typeof media.canPlayType === 'function') { | ||
player.addSourceButton(src.src, src.title, src.type, media.src === src.src); | ||
@@ -81,3 +84,3 @@ } | ||
player.hideSourcechooserSelector(); | ||
}, 500); | ||
}, 0); | ||
}); | ||
@@ -149,3 +152,5 @@ | ||
if (media.currentSrc !== src) { | ||
if (media.getSrc() !== src) { | ||
let currentTime = media.currentTime; | ||
const | ||
@@ -155,18 +160,13 @@ paused = media.paused, | ||
if (!paused) { | ||
media.setCurrentTime(currentTime); | ||
media.play(); | ||
} | ||
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler, true); | ||
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler); | ||
} | ||
; | ||
let currentTime = media.currentTime; | ||
media.pause(); | ||
media.setSrc(src); | ||
media.load(); | ||
media.addEventListener('loadedmetadata', () => { | ||
media.currentTime = currentTime; | ||
}, true); | ||
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler, true); | ||
media.load(); | ||
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler); | ||
} | ||
@@ -173,0 +173,0 @@ }); |
@@ -43,4 +43,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -51,3 +51,3 @@ */ | ||
t = this, | ||
isNative = t.media.rendererName !== null && t.media.rendererName.match(/(native|html5)/) !== null | ||
isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName) | ||
; | ||
@@ -54,0 +54,0 @@ |
@@ -28,4 +28,4 @@ 'use strict'; | ||
* @param {MediaElementPlayer} player | ||
* @param {$} controls | ||
* @param {$} layers | ||
* @param {HTMLElement} controls | ||
* @param {HTMLElement} layers | ||
* @param {HTMLElement} media | ||
@@ -32,0 +32,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
376812
148
6983
+ Addedmediaelement@4.2.17(transitive)
- Removedmediaelement@4.0.7(transitive)
Updatedmediaelement@^4.0.7