Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mediaelement-plugins

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mediaelement-plugins - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

demo/airplay.html

11

changelog.md
### Version History
*2.5.0 (2017/11/17)*
* Fixed typo on `Playlist` plugin that caused error on Edge, removed `disabled` attribute on each item and fixed workflow to autoplay next element @rafa8626
* Fixed issue when mouse leave from `Quality` button, its selector does not hide (https://github.com/mediaelement/mediaelement-plugins/pull/89) @meathill
* Fixed typo in `Quality`, `Stop` and `Preview` plugins @rafa8626
* Added multiple demo files for plugins @rafa8626
* Integrated `VRView` plugin @rafa8626
* Update to allow video quality grouping for browser fallback media type (https://github.com/mediaelement/mediaelement-plugins/pull/93) @Gungrave223
* Fixed issue when changing quality when media is paused @rafa8626
*2.4.0 (2017/08/09)*

@@ -42,2 +52,3 @@

* Fixed issues in Safari related to `Source Chooser` plugin @rafa8626
* Integrated `VRView` plugin @rafa8626
* Added `babel-preset-env` to optimize bundles based on supported browsers @rafa8626

@@ -44,0 +55,0 @@ * Fixed issues with `Speed` and `Source chooser` related to their menu options (https://github.com/mediaelement/mediaelement-plugins/pull/41) @lebanggit

6

dist/ads-vast-vpaid/ads-vast-vpaid.js

@@ -274,3 +274,3 @@ /*!

if (t.media.canPlayType(type) !== '' || /(no|false)/i.test(t.media.canPlayType(type))) {
if (mediaFile.getAttribute('type') === 'application/javascript') {
if (type === 'application/javascript') {
var script = document.createElement('script'),

@@ -281,7 +281,7 @@ firstScriptTag = document.getElementsByTagName('script')[0];

firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
} else if (mediaFile.getAttribute('delivery') !== 'application/x-shockwave-flash') {
} else if (type !== 'application/x-shockwave-flash') {
adTag.mediaFiles.push({
id: mediaFile.getAttribute('id'),
delivery: mediaFile.getAttribute('delivery'),
type: mediaFile.getAttribute('type'),
type: type,
bitrate: mediaFile.getAttribute('bitrate'),

@@ -288,0 +288,0 @@ width: mediaFile.getAttribute('width'),

@@ -12,2 +12,2 @@ /*!

*/
!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");if(a.length){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");if(e.vpaidAdTags=[],e.options.indexPreroll=0,void 0!==a[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]);
!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");if(a.length){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"===x){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"!==x&&g.mediaFiles.push({id:y.getAttribute("id"),delivery:y.getAttribute("delivery"),type:x,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");if(e.vpaidAdTags=[],e.options.indexPreroll=0,void 0!==a[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]);

@@ -55,6 +55,8 @@ /*!

player.endedCallback = function () {
if (player.currentPlaylistItem < player.totalItems) {
if (player.currentPlaylistItem < player.listItems.length) {
player.setSrc(player.playlist[++player.currentPlaylistItem]);
player.load();
player.play();
setTimeout(function () {
player.play();
}, 200);
}

@@ -120,2 +122,3 @@ };

for (var _i2 = 0, _total2 = inputs.length; _i2 < _total2; _i2++) {
inputs[_i2].disabled = false;
inputs[_i2].addEventListener('click', function () {

@@ -339,3 +342,3 @@ var radios = player.playlistLayer.querySelectorAll('input[type="radio"]'),

item.tabIndex = 0;
item.classList = t.options.classPrefix + 'playlist-selector-list-item' + (_i4 === 0 ? ' ' + t.options.classPrefix + 'playlist-selected' : '');
item.className = t.options.classPrefix + 'playlist-selector-list-item' + (_i4 === 0 ? ' ' + t.options.classPrefix + 'playlist-selected' : '');
item.innerHTML = '<div class="' + t.options.classPrefix + 'playlist-item-inner">' + ('' + thumbnail) + ('<div class="' + t.options.classPrefix + 'playlist-item-content">') + ('<div><input type="radio" class="' + t.options.classPrefix + 'playlist-selector-input" ') + ('name="' + t.id + '_playlist" id="' + id + '" data-playlist-index="' + _i4 + '" value="' + element.src + '" disabled>') + ('<label class="' + t.options.classPrefix + 'playlist-selector-label" ') + ('for="' + id + '">' + (_i4 === 0 ? '<span>\u25B6</span> ' : '') + (element.title || _i4) + '</label></div>' + description + '</div></div>');

@@ -342,0 +345,0 @@

@@ -12,2 +12,2 @@ /*!

*/
!function t(e,l,s){function i(a,o){if(!l[a]){if(!e[a]){var r="function"==typeof require&&require;if(!o&&r)return r(a,!0);if(n)return n(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var c=l[a]={exports:{}};e[a][0].call(c.exports,function(t){var l=e[a][1][t];return i(l||t)},c,c.exports,t,e,l,s)}return l[a].exports}for(var n="function"==typeof require&&require,a=0;a<s.length;a++)i(s[a]);return i}({1:[function(t,e,l){"use strict";mejs.i18n.en["mejs.playlist"]="Toggle Playlist",mejs.i18n.en["mejs.playlist-prev"]="Previous",mejs.i18n.en["mejs.playlist-next"]="Next",mejs.i18n.en["mejs.playlist-loop"]="Loop",mejs.i18n.en["mejs.playlist-shuffle"]="Shuffle",Object.assign(mejs.MepDefaults,{playlist:[],showPlaylist:!0,autoClosePlaylist:!1,prevText:null,nextText:null,loopText:null,shuffleText:null,playlistTitle:null,currentMessage:null}),Object.assign(MediaElementPlayer.prototype,{buildplaylist:function(t,e,l,s){var i=mejs.i18n.t("mejs.playlist"),n=mejs.Utils.isString(t.options.playlistTitle)?t.options.playlistTitle:i;if(!t.createPlayList_()){if(t.currentPlaylistItem=0,t.originalControlsIndex=e.style.zIndex,e.style.zIndex=5,t.endedCallback=function(){t.currentPlaylistItem<t.totalItems&&(t.setSrc(t.playlist[++t.currentPlaylistItem]),t.load(),t.play())},s.addEventListener("ended",t.endedCallback),!t.isVideo){var a=document.createElement("div"),o=function(){a.innerHTML="",void 0!==t.playlist[t.currentPlaylistItem]["data-playlist-thumbnail"]&&(a.innerHTML+='<img tabindex="-1" src="'+t.playlist[t.currentPlaylistItem]["data-playlist-thumbnail"]+'">'),a.innerHTML+="<p>"+t.options.currentMessage+' <span class="'+t.options.classPrefix+'playlist-current-title">'+t.playlist[t.currentPlaylistItem].title+"</span>",void 0!==t.playlist[t.currentPlaylistItem].description&&(a.innerHTML+=' - <span class="'+t.options.classPrefix+'playlist-current-description">'+t.playlist[t.currentPlaylistItem].description+"</span>"),a.innerHTML+="</p>",t.resetSize()};a.className=t.options.classPrefix+"playlist-current "+t.options.classPrefix+"layer",o(),l.insertBefore(a,l.firstChild),s.addEventListener("play",o)}if(t.options.showPlaylist){t.playlistLayer=document.createElement("div"),t.playlistLayer.className=t.options.classPrefix+"playlist-layer "+t.options.classPrefix+"layer "+(t.isVideo?t.options.classPrefix+"playlist-hidden":"")+" "+t.options.classPrefix+"playlist-selector",t.playlistLayer.innerHTML='<ul class="'+t.options.classPrefix+'playlist-selector-list"></ul>',l.insertBefore(t.playlistLayer,l.firstChild);for(var r=0,p=t.listItems.length;r<p;r++)t.playlistLayer.querySelector("ul").innerHTML+=t.listItems[r];if(t.isVideo)t.playlistButton=document.createElement("div"),t.playlistButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"playlist-button",t.playlistButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+n+'" aria-label="'+n+'" tabindex="0"></button>',t.playlistButton.addEventListener("click",function(){mejs.Utils.toggleClass(t.playlistLayer,t.options.classPrefix+"playlist-hidden")}),t.addControlElement(t.playlistButton,"playlist");else{var c=t.playlistLayer.querySelectorAll("li");if(c.length<=10){for(var u=0,f=0,y=c.length;f<y;f++)u+=c[f].offsetHeight;t.container.style.height=u+"px"}}for(var d=t.playlistLayer.querySelectorAll("."+t.options.classPrefix+"playlist-selector-list-item"),m=t.playlistLayer.querySelectorAll("input[type=radio]"),v=0,x=m.length;v<x;v++)m[v].addEventListener("click",function(){for(var e=t.playlistLayer.querySelectorAll('input[type="radio"]'),l=t.playlistLayer.querySelectorAll("."+t.options.classPrefix+"playlist-selected"),s=0,i=e.length;s<i;s++)e[s].checked=!1;for(var n=0,a=l.length;n<a;n++)mejs.Utils.removeClass(l[n],t.options.classPrefix+"playlist-selected"),l[n].querySelector("label").querySelector("span").remove();this.checked=!0,this.closest("."+t.options.classPrefix+"playlist-selector-list-item").querySelector("label").innerHTML="<span>▶</span> "+this.closest("."+t.options.classPrefix+"playlist-selector-list-item").querySelector("label").innerHTML,mejs.Utils.addClass(this.closest("."+t.options.classPrefix+"playlist-selector-list-item"),t.options.classPrefix+"playlist-selected"),t.currentPlaylistItem=this.getAttribute("data-playlist-index"),t.setSrc(this.value),t.load(),t.play(),t.isVideo&&!0===t.options.autoClosePlaylist&&mejs.Utils.toggleClass(t.playlistLayer,t.options.classPrefix+"playlist-hidden")});for(var h=0,P=d.length;h<P;h++)d[h].addEventListener("click",function(){var e=mejs.Utils.siblings(this.querySelector("."+t.options.classPrefix+"playlist-selector-label"),function(t){return"INPUT"===t.tagName})[0],l=mejs.Utils.createEvent("click",e);e.dispatchEvent(l)});t.keydownCallback=function(t){var e=mejs.Utils.createEvent("click",t.target);return t.target.dispatchEvent(e),!1},t.playlistLayer.addEventListener("keydown",function(e){var l=e.which||e.keyCode||0;~[13,32,38,40].indexOf(l)&&t.keydownCallback(e)})}else mejs.Utils.addClass(t.container,t.options.classPrefix+"no-playlist")}},cleanplaylist:function(t,e,l,s){s.removeEventListener("ended",t.endedCallback)},buildprevtrack:function(t){var e=mejs.i18n.t("mejs.playlist-prev"),l=mejs.Utils.isString(t.options.prevText)?t.options.prevText:e;t.prevButton=document.createElement("div"),t.prevButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"prev-button",t.prevButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.prevPlaylistCallback=function(){t.playlist[--t.currentPlaylistItem]?(t.setSrc(t.playlist[t.currentPlaylistItem].src),t.load(),t.play()):++t.currentPlaylistItem},t.prevButton.addEventListener("click",t.prevPlaylistCallback),t.addControlElement(t.prevButton,"prevtrack")},cleanprevtrack:function(t){t.prevButton.removeEventListener("click",t.prevPlaylistCallback)},buildnexttrack:function(t){var e=mejs.i18n.t("mejs.playlist-next"),l=mejs.Utils.isString(t.options.nextText)?t.options.nextText:e;t.nextButton=document.createElement("div"),t.nextButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"next-button",t.nextButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.nextPlaylistCallback=function(){t.playlist[++t.currentPlaylistItem]?(t.setSrc(t.playlist[t.currentPlaylistItem].src),t.load(),t.play()):--t.currentPlaylistItem},t.nextButton.addEventListener("click",t.nextPlaylistCallback),t.addControlElement(t.nextButton,"nexttrack")},cleannexttrack:function(t){t.nextButton.removeEventListener("click",t.nextPlaylistCallback)},buildloop:function(t){var e=mejs.i18n.t("mejs.playlist-loop"),l=mejs.Utils.isString(t.options.loopText)?t.options.loopText:e;t.loopButton=document.createElement("div"),t.loopButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"loop-button "+(t.options.loop?t.options.classPrefix+"loop-on":t.options.classPrefix+"loop-off"),t.loopButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.loopCallback=function(){t.options.loop=!t.options.loop,t.options.loop?(mejs.Utils.removeClass(t.loopButton,t.options.classPrefix+"loop-off"),mejs.Utils.addClass(t.loopButton,t.options.classPrefix+"loop-on")):(mejs.Utils.removeClass(t.loopButton,t.options.classPrefix+"loop-on"),mejs.Utils.addClass(t.loopButton,t.options.classPrefix+"loop-off"))},t.loopButton.addEventListener("click",t.loopCallback),t.addControlElement(t.loopButton,"loop")},cleanloop:function(t){t.loopButton.removeEventListener("click",t.loopCallback)},buildshuffle:function(t){var e=mejs.i18n.t("mejs.playlist-shuffle"),l=mejs.Utils.isString(t.options.shuffleText)?t.options.shuffleText:e;t.shuffleButton=document.createElement("div"),t.shuffleButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"shuffle-button "+t.options.classPrefix+"shuffle-off",t.shuffleButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.shuffleButton.style.display="none",t.media.addEventListener("play",function(){t.shuffleButton.style.display="",t.resetSize()});var s=!1,i=[],n=function(){if(!t.options.loop){var e=Math.floor(Math.random()*t.playlist.length);-1===i.indexOf(e)?(t.setSrc(t.playlist[e].src),t.load(),t.play(),t.currentPlaylistItem=e,i.push(e)):i.length<t.playlist.length?t.shuffleCallback():i.length<t.playlist.length&&(i=[],t.currentPlaylistItem=e,i.push(e))}};t.shuffleCallback=function(){s?(mejs.Utils.removeClass(t.shuffleButton,t.options.classPrefix+"shuffle-on"),mejs.Utils.addClass(t.shuffleButton,t.options.classPrefix+"shuffle-off"),s=!1,t.media.removeEventListener("ended",n)):(mejs.Utils.removeClass(t.shuffleButton,t.options.classPrefix+"shuffle-off"),mejs.Utils.addClass(t.shuffleButton,t.options.classPrefix+"shuffle-on"),s=!0,t.media.addEventListener("ended",n))},t.shuffleButton.addEventListener("click",t.shuffleCallback),t.addControlElement(t.shuffleButton,"shuffle")},cleanshuffle:function(t){t.shuffleButton.removeEventListener("click",t.shuffleCallback)},createPlayList_:function(){var t=this;if(t.playlist=t.options.playlist.length?t.options.playlist:[],!t.playlist.length)for(var e=t.mediaFiles||t.media.originalNode.children,l=0,s=e.length;l<s;l++){var i=e[l];"source"===i.tagName.toLowerCase()&&function(){var e={};Array.prototype.slice.call(i.attributes).forEach(function(t){e[t.name]=t.value}),e.src&&e.type&&e.title&&(e.type=mejs.Utils.formatType(e.src,e.type),t.playlist.push(e))}()}if(!(t.playlist.length<2)){t.listItems=[];for(var n=0,a=t.playlist.length;n<a;n++){var o=t.playlist[n],r=document.createElement("li"),p=t.id+"_playlist_item_"+n,c=o["data-playlist-thumbnail"]?'<div class="'+t.options.classPrefix+'playlist-item-thumbnail"><img tabindex="-1" src="'+o["data-playlist-thumbnail"]+'"></div>':"",u=o["data-playlist-description"]?'<div class="'+t.options.classPrefix+'playlist-item-description">'+o["data-playlist-description"]+"</div>":"";r.tabIndex=0,r.classList=t.options.classPrefix+"playlist-selector-list-item"+(0===n?" "+t.options.classPrefix+"playlist-selected":""),r.innerHTML='<div class="'+t.options.classPrefix+'playlist-item-inner">'+c+'<div class="'+t.options.classPrefix+'playlist-item-content"><div><input type="radio" class="'+t.options.classPrefix+'playlist-selector-input" name="'+t.id+'_playlist" id="'+p+'" data-playlist-index="'+n+'" value="'+o.src+'" disabled><label class="'+t.options.classPrefix+'playlist-selector-label" for="'+p+'">'+(0===n?"<span>▶</span> ":"")+(o.title||n)+"</label></div>"+u+"</div></div>",t.listItems.push(r.outerHTML)}}}})},{}]},{},[1]);
!function t(e,l,s){function i(a,o){if(!l[a]){if(!e[a]){var r="function"==typeof require&&require;if(!o&&r)return r(a,!0);if(n)return n(a,!0);var p=new Error("Cannot find module '"+a+"'");throw p.code="MODULE_NOT_FOUND",p}var c=l[a]={exports:{}};e[a][0].call(c.exports,function(t){var l=e[a][1][t];return i(l||t)},c,c.exports,t,e,l,s)}return l[a].exports}for(var n="function"==typeof require&&require,a=0;a<s.length;a++)i(s[a]);return i}({1:[function(t,e,l){"use strict";mejs.i18n.en["mejs.playlist"]="Toggle Playlist",mejs.i18n.en["mejs.playlist-prev"]="Previous",mejs.i18n.en["mejs.playlist-next"]="Next",mejs.i18n.en["mejs.playlist-loop"]="Loop",mejs.i18n.en["mejs.playlist-shuffle"]="Shuffle",Object.assign(mejs.MepDefaults,{playlist:[],showPlaylist:!0,autoClosePlaylist:!1,prevText:null,nextText:null,loopText:null,shuffleText:null,playlistTitle:null,currentMessage:null}),Object.assign(MediaElementPlayer.prototype,{buildplaylist:function(t,e,l,s){var i=mejs.i18n.t("mejs.playlist"),n=mejs.Utils.isString(t.options.playlistTitle)?t.options.playlistTitle:i;if(!t.createPlayList_()){if(t.currentPlaylistItem=0,t.originalControlsIndex=e.style.zIndex,e.style.zIndex=5,t.endedCallback=function(){t.currentPlaylistItem<t.listItems.length&&(t.setSrc(t.playlist[++t.currentPlaylistItem]),t.load(),setTimeout(function(){t.play()},200))},s.addEventListener("ended",t.endedCallback),!t.isVideo){var a=document.createElement("div"),o=function(){a.innerHTML="",void 0!==t.playlist[t.currentPlaylistItem]["data-playlist-thumbnail"]&&(a.innerHTML+='<img tabindex="-1" src="'+t.playlist[t.currentPlaylistItem]["data-playlist-thumbnail"]+'">'),a.innerHTML+="<p>"+t.options.currentMessage+' <span class="'+t.options.classPrefix+'playlist-current-title">'+t.playlist[t.currentPlaylistItem].title+"</span>",void 0!==t.playlist[t.currentPlaylistItem].description&&(a.innerHTML+=' - <span class="'+t.options.classPrefix+'playlist-current-description">'+t.playlist[t.currentPlaylistItem].description+"</span>"),a.innerHTML+="</p>",t.resetSize()};a.className=t.options.classPrefix+"playlist-current "+t.options.classPrefix+"layer",o(),l.insertBefore(a,l.firstChild),s.addEventListener("play",o)}if(t.options.showPlaylist){t.playlistLayer=document.createElement("div"),t.playlistLayer.className=t.options.classPrefix+"playlist-layer "+t.options.classPrefix+"layer "+(t.isVideo?t.options.classPrefix+"playlist-hidden":"")+" "+t.options.classPrefix+"playlist-selector",t.playlistLayer.innerHTML='<ul class="'+t.options.classPrefix+'playlist-selector-list"></ul>',l.insertBefore(t.playlistLayer,l.firstChild);for(var r=0,p=t.listItems.length;r<p;r++)t.playlistLayer.querySelector("ul").innerHTML+=t.listItems[r];if(t.isVideo)t.playlistButton=document.createElement("div"),t.playlistButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"playlist-button",t.playlistButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+n+'" aria-label="'+n+'" tabindex="0"></button>',t.playlistButton.addEventListener("click",function(){mejs.Utils.toggleClass(t.playlistLayer,t.options.classPrefix+"playlist-hidden")}),t.addControlElement(t.playlistButton,"playlist");else{var c=t.playlistLayer.querySelectorAll("li");if(c.length<=10){for(var u=0,f=0,y=c.length;f<y;f++)u+=c[f].offsetHeight;t.container.style.height=u+"px"}}for(var d=t.playlistLayer.querySelectorAll("."+t.options.classPrefix+"playlist-selector-list-item"),m=t.playlistLayer.querySelectorAll("input[type=radio]"),v=0,x=m.length;v<x;v++)m[v].disabled=!1,m[v].addEventListener("click",function(){for(var e=t.playlistLayer.querySelectorAll('input[type="radio"]'),l=t.playlistLayer.querySelectorAll("."+t.options.classPrefix+"playlist-selected"),s=0,i=e.length;s<i;s++)e[s].checked=!1;for(var n=0,a=l.length;n<a;n++)mejs.Utils.removeClass(l[n],t.options.classPrefix+"playlist-selected"),l[n].querySelector("label").querySelector("span").remove();this.checked=!0,this.closest("."+t.options.classPrefix+"playlist-selector-list-item").querySelector("label").innerHTML="<span>▶</span> "+this.closest("."+t.options.classPrefix+"playlist-selector-list-item").querySelector("label").innerHTML,mejs.Utils.addClass(this.closest("."+t.options.classPrefix+"playlist-selector-list-item"),t.options.classPrefix+"playlist-selected"),t.currentPlaylistItem=this.getAttribute("data-playlist-index"),t.setSrc(this.value),t.load(),t.play(),t.isVideo&&!0===t.options.autoClosePlaylist&&mejs.Utils.toggleClass(t.playlistLayer,t.options.classPrefix+"playlist-hidden")});for(var h=0,P=d.length;h<P;h++)d[h].addEventListener("click",function(){var e=mejs.Utils.siblings(this.querySelector("."+t.options.classPrefix+"playlist-selector-label"),function(t){return"INPUT"===t.tagName})[0],l=mejs.Utils.createEvent("click",e);e.dispatchEvent(l)});t.keydownCallback=function(t){var e=mejs.Utils.createEvent("click",t.target);return t.target.dispatchEvent(e),!1},t.playlistLayer.addEventListener("keydown",function(e){var l=e.which||e.keyCode||0;~[13,32,38,40].indexOf(l)&&t.keydownCallback(e)})}else mejs.Utils.addClass(t.container,t.options.classPrefix+"no-playlist")}},cleanplaylist:function(t,e,l,s){s.removeEventListener("ended",t.endedCallback)},buildprevtrack:function(t){var e=mejs.i18n.t("mejs.playlist-prev"),l=mejs.Utils.isString(t.options.prevText)?t.options.prevText:e;t.prevButton=document.createElement("div"),t.prevButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"prev-button",t.prevButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.prevPlaylistCallback=function(){t.playlist[--t.currentPlaylistItem]?(t.setSrc(t.playlist[t.currentPlaylistItem].src),t.load(),t.play()):++t.currentPlaylistItem},t.prevButton.addEventListener("click",t.prevPlaylistCallback),t.addControlElement(t.prevButton,"prevtrack")},cleanprevtrack:function(t){t.prevButton.removeEventListener("click",t.prevPlaylistCallback)},buildnexttrack:function(t){var e=mejs.i18n.t("mejs.playlist-next"),l=mejs.Utils.isString(t.options.nextText)?t.options.nextText:e;t.nextButton=document.createElement("div"),t.nextButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"next-button",t.nextButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.nextPlaylistCallback=function(){t.playlist[++t.currentPlaylistItem]?(t.setSrc(t.playlist[t.currentPlaylistItem].src),t.load(),t.play()):--t.currentPlaylistItem},t.nextButton.addEventListener("click",t.nextPlaylistCallback),t.addControlElement(t.nextButton,"nexttrack")},cleannexttrack:function(t){t.nextButton.removeEventListener("click",t.nextPlaylistCallback)},buildloop:function(t){var e=mejs.i18n.t("mejs.playlist-loop"),l=mejs.Utils.isString(t.options.loopText)?t.options.loopText:e;t.loopButton=document.createElement("div"),t.loopButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"loop-button "+(t.options.loop?t.options.classPrefix+"loop-on":t.options.classPrefix+"loop-off"),t.loopButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.loopCallback=function(){t.options.loop=!t.options.loop,t.options.loop?(mejs.Utils.removeClass(t.loopButton,t.options.classPrefix+"loop-off"),mejs.Utils.addClass(t.loopButton,t.options.classPrefix+"loop-on")):(mejs.Utils.removeClass(t.loopButton,t.options.classPrefix+"loop-on"),mejs.Utils.addClass(t.loopButton,t.options.classPrefix+"loop-off"))},t.loopButton.addEventListener("click",t.loopCallback),t.addControlElement(t.loopButton,"loop")},cleanloop:function(t){t.loopButton.removeEventListener("click",t.loopCallback)},buildshuffle:function(t){var e=mejs.i18n.t("mejs.playlist-shuffle"),l=mejs.Utils.isString(t.options.shuffleText)?t.options.shuffleText:e;t.shuffleButton=document.createElement("div"),t.shuffleButton.className=t.options.classPrefix+"button "+t.options.classPrefix+"shuffle-button "+t.options.classPrefix+"shuffle-off",t.shuffleButton.innerHTML='<button type="button" aria-controls="'+t.id+'" title="'+l+'" aria-label="'+l+'" tabindex="0"></button>',t.shuffleButton.style.display="none",t.media.addEventListener("play",function(){t.shuffleButton.style.display="",t.resetSize()});var s=!1,i=[],n=function(){if(!t.options.loop){var e=Math.floor(Math.random()*t.playlist.length);-1===i.indexOf(e)?(t.setSrc(t.playlist[e].src),t.load(),t.play(),t.currentPlaylistItem=e,i.push(e)):i.length<t.playlist.length?t.shuffleCallback():i.length<t.playlist.length&&(i=[],t.currentPlaylistItem=e,i.push(e))}};t.shuffleCallback=function(){s?(mejs.Utils.removeClass(t.shuffleButton,t.options.classPrefix+"shuffle-on"),mejs.Utils.addClass(t.shuffleButton,t.options.classPrefix+"shuffle-off"),s=!1,t.media.removeEventListener("ended",n)):(mejs.Utils.removeClass(t.shuffleButton,t.options.classPrefix+"shuffle-off"),mejs.Utils.addClass(t.shuffleButton,t.options.classPrefix+"shuffle-on"),s=!0,t.media.addEventListener("ended",n))},t.shuffleButton.addEventListener("click",t.shuffleCallback),t.addControlElement(t.shuffleButton,"shuffle")},cleanshuffle:function(t){t.shuffleButton.removeEventListener("click",t.shuffleCallback)},createPlayList_:function(){var t=this;if(t.playlist=t.options.playlist.length?t.options.playlist:[],!t.playlist.length)for(var e=t.mediaFiles||t.media.originalNode.children,l=0,s=e.length;l<s;l++){var i=e[l];"source"===i.tagName.toLowerCase()&&function(){var e={};Array.prototype.slice.call(i.attributes).forEach(function(t){e[t.name]=t.value}),e.src&&e.type&&e.title&&(e.type=mejs.Utils.formatType(e.src,e.type),t.playlist.push(e))}()}if(!(t.playlist.length<2)){t.listItems=[];for(var n=0,a=t.playlist.length;n<a;n++){var o=t.playlist[n],r=document.createElement("li"),p=t.id+"_playlist_item_"+n,c=o["data-playlist-thumbnail"]?'<div class="'+t.options.classPrefix+'playlist-item-thumbnail"><img tabindex="-1" src="'+o["data-playlist-thumbnail"]+'"></div>':"",u=o["data-playlist-description"]?'<div class="'+t.options.classPrefix+'playlist-item-description">'+o["data-playlist-description"]+"</div>":"";r.tabIndex=0,r.className=t.options.classPrefix+"playlist-selector-list-item"+(0===n?" "+t.options.classPrefix+"playlist-selected":""),r.innerHTML='<div class="'+t.options.classPrefix+'playlist-item-inner">'+c+'<div class="'+t.options.classPrefix+'playlist-item-content"><div><input type="radio" class="'+t.options.classPrefix+'playlist-selector-input" name="'+t.id+'_playlist" id="'+p+'" data-playlist-index="'+n+'" value="'+o.src+'" disabled><label class="'+t.options.classPrefix+'playlist-selector-label" for="'+p+'">'+(0===n?"<span>▶</span> ":"")+(o.title||n)+"</label></div>"+u+"</div></div>",t.listItems.push(r.outerHTML)}}}})},{}]},{},[1]);

@@ -144,4 +144,4 @@ /*!

mouseOver = true;
t.container.querySelector('.' + t.options.classPrefix + 'overlay-loading').parentNode.style.display = 'block';
t.container.querySelector('.' + t.options.classPrefix + 'overlay-loading').parentNode.style.display = 'flex';
t.container.querySelector('.' + t.options.classPrefix + 'overlay-play').style.display = 'none';
if (t.media.paused) {

@@ -148,0 +148,0 @@ timeout = setTimeout(function () {

@@ -12,2 +12,2 @@ /*!

*/
!function e(t,o,n){function i(r,d){if(!o[r]){if(!t[r]){var s="function"==typeof require&&require;if(!d&&s)return s(r,!0);if(a)return a(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}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)>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)<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(){t?a.media.removeEventListener("timeupdate",r):o?a.media.removeEventListener("timeupdate",d):(r(),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 s="function"==typeof require&&require;if(!d&&s)return s(r,!0);if(a)return a(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}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)>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)<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(){t?a.media.removeEventListener("timeupdate",r):o?a.media.removeEventListener("timeupdate",d):(r(),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="flex",a.container.querySelector("."+a.options.classPrefix+"overlay-play").style.display="none",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]);

@@ -24,18 +24,22 @@ /*!

buildquality: function buildquality(player, controls, layers, media) {
var t = this,
qualities = [],
children = t.mediaFiles ? t.mediaFiles : t.node.children;
children = t.mediaFiles ? t.mediaFiles : t.node.children,
qualityMap = new Map();
for (var i = 0, total = children.length; i < total; i++) {
var s = children[i];
var mediaNode = children[i];
var quality = mediaNode instanceof HTMLElement ? mediaNode.getAttribute('data-quality') : mediaNode['data-quality'];
if (t.mediaFiles) {
qualities.push(s);
} else if (s.nodeName === 'SOURCE') {
qualities.push(s);
var source = document.createElement('source');
source.src = mediaNode['src'];
source.type = mediaNode['type'];
t.addValueToKey(qualityMap, quality, source);
} else if (mediaNode.nodeName === 'SOURCE') {
t.addValueToKey(qualityMap, quality, mediaNode);
}
}
if (qualities.length <= 1) {
if (qualityMap.size <= 1) {
return;

@@ -50,8 +54,12 @@ }

if (value === 'auto') {
var src = qualities[0];
label = src instanceof HTMLElement ? src.getAttribute('data-quality') : src['data-quality'];
var keyExist = t.keyExist(qualityMap, value);
if (keyExist) {
label = value;
} else {
var keyValue = t.getMapIndex(qualityMap, 0);
label = keyValue.key;
}
} else {
label = value;
}
return label;

@@ -67,10 +75,13 @@ },

for (var _i = 0, _total = qualities.length; _i < _total; _i++) {
var src = qualities[_i],
quality = src instanceof HTMLElement ? src.getAttribute('data-quality') : src['data-quality'],
inputId = t.id + '-qualities-' + quality;
media.setSrc(qualityMap.get(defaultValue)[0].src);
media.load();
player.qualitiesButton.querySelector('ul').innerHTML += '<li class="' + t.options.classPrefix + 'qualities-selector-list-item">' + ('<input class="' + t.options.classPrefix + 'qualities-selector-input" type="radio" name="' + t.id + '_qualities"') + ('disabled="disabled" value="' + quality + '" id="' + inputId + '" ') + ((quality === defaultValue ? ' checked="checked"' : '') + '/>') + ('<label for="' + inputId + '" class="' + t.options.classPrefix + 'qualities-selector-label') + ((quality === defaultValue ? ' ' + t.options.classPrefix + 'qualities-selected' : '') + '">') + ((src.title || quality) + '</label>') + '</li>';
}
qualityMap.forEach(function (value, key) {
if (key !== 'map_keys_1') {
var src = value[0],
_quality = key,
inputId = t.id + '-qualities-' + _quality;
player.qualitiesButton.querySelector('ul').innerHTML += '<li class="' + t.options.classPrefix + 'qualities-selector-list-item">' + ('<input class="' + t.options.classPrefix + 'qualities-selector-input" type="radio" name="' + t.id + '_qualities"') + ('disabled="disabled" value="' + _quality + '" id="' + inputId + '" ') + ((_quality === defaultValue ? ' checked="checked"' : '') + '/>') + ('<label for="' + inputId + '" class="' + t.options.classPrefix + 'qualities-selector-label') + ((_quality === defaultValue ? ' ' + t.options.classPrefix + 'qualities-selected' : '') + '">') + ((src.title || _quality) + '</label>') + '</li>';
}
});
var inEvents = ['mouseenter', 'focusin'],

@@ -82,4 +93,4 @@ outEvents = ['mouseleave', 'focusout'],

for (var _i2 = 0, _total2 = inEvents.length; _i2 < _total2; _i2++) {
player.qualitiesButton.addEventListener(inEvents[_i2], function () {
for (var _i = 0, _total = inEvents.length; _i < _total; _i++) {
player.qualitiesButton.addEventListener(inEvents[_i], function () {
mejs.Utils.removeClass(selector, t.options.classPrefix + 'offscreen');

@@ -91,12 +102,12 @@ selector.style.height = selector.querySelector('ul').offsetHeight + 'px';

for (var _i3 = 0, _total3 = outEvents.length; _i3 < _total3; _i3++) {
selector.addEventListener(outEvents[_i3], function () {
mejs.Utils.addClass(this, t.options.classPrefix + 'offscreen');
for (var _i2 = 0, _total2 = outEvents.length; _i2 < _total2; _i2++) {
player.qualitiesButton.addEventListener(outEvents[_i2], function () {
mejs.Utils.addClass(selector, t.options.classPrefix + 'offscreen');
});
}
for (var _i4 = 0, _total4 = radios.length; _i4 < _total4; _i4++) {
var radio = radios[_i4];
for (var _i3 = 0, _total3 = radios.length; _i3 < _total3; _i3++) {
var radio = radios[_i3];
radio.disabled = false;
radio.addEventListener('click', function () {
radio.addEventListener('change', function () {
var self = this,

@@ -106,4 +117,4 @@ newQuality = self.value;

var selected = player.qualitiesButton.querySelectorAll('.' + t.options.classPrefix + 'qualities-selected');
for (var _i5 = 0, _total5 = selected.length; _i5 < _total5; _i5++) {
mejs.Utils.removeClass(selected[_i5], t.options.classPrefix + 'qualities-selected');
for (var _i4 = 0, _total4 = selected.length; _i4 < _total4; _i4++) {
mejs.Utils.removeClass(selected[_i4], t.options.classPrefix + 'qualities-selected');
}

@@ -115,3 +126,3 @@

});
for (var j = 0, _total6 = siblings.length; j < _total6; j++) {
for (var j = 0, _total5 = siblings.length; j < _total5; j++) {
mejs.Utils.addClass(siblings[j], t.options.classPrefix + 'qualities-selected');

@@ -122,28 +133,23 @@ }

var paused = media.paused,
canPlayAfterSourceSwitchHandler = function canPlayAfterSourceSwitchHandler() {
if (!paused) {
media.setCurrentTime(currentTime);
media.play();
}
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
};
var paused = media.paused;
for (var _i6 = 0, _total7 = qualities.length; _i6 < _total7; _i6++) {
var _src = qualities[_i6],
_quality = _src instanceof HTMLElement ? _src.getAttribute('data-quality') : _src['data-quality'];
if (_quality === newQuality) {
player.qualitiesButton.querySelector('button').innerHTML = _src.title || getQualityNameFromValue(newQuality);
media.pause();
media.setSrc(_src.src);
media.load();
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler);
}
player.qualitiesButton.querySelector('button').innerHTML = newQuality;
if (!paused) {
media.pause();
}
t.updateVideoSource(media, qualityMap, newQuality);
media.setSrc(qualityMap.get(newQuality)[0].src);
media.load();
media.dispatchEvent(mejs.Utils.createEvent('seeking', media));
if (!paused) {
media.play();
}
media.addEventListener('canplay', function canPlayAfterSourceSwitchHandler() {
media.setCurrentTime(currentTime);
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
});
});
}
for (var _i7 = 0, _total8 = labels.length; _i7 < _total8; _i7++) {
labels[_i7].addEventListener('click', function () {
for (var _i5 = 0, _total6 = labels.length; _i5 < _total6; _i5++) {
labels[_i5].addEventListener('click', function () {
var radio = mejs.Utils.siblings(this, function (el) {

@@ -160,2 +166,3 @@ return el.tagName === 'INPUT';

});
media.setSrc(qualityMap.get(defaultValue)[0].src);
},

@@ -168,2 +175,58 @@ cleanquality: function cleanquality(player) {

}
},
addValueToKey: function addValueToKey(map, key, value) {
if (map.has('map_keys_1')) {
map.get('map_keys_1').push(key.toLowerCase());
} else {
map.set('map_keys_1', []);
}
if (map.has(key)) {
map.get(key).push(value);
} else {
map.set(key, []);
map.get(key).push(value);
}
},
updateVideoSource: function updateVideoSource(media, map, key) {
this.cleanMediaSource(media);
var sources = map.get(key);
var _loop = function _loop(i) {
var mediaNode = media.children[i];
if (mediaNode.tagName === 'VIDEO') {
sources.forEach(function (sourceElement) {
mediaNode.appendChild(sourceElement);
});
}
};
for (var i = 0; i < media.children.length; i++) {
_loop(i);
}
},
cleanMediaSource: function cleanMediaSource(media) {
for (var i = 0; i < media.children.length; i++) {
var _mediaNode = media.children[i];
if (_mediaNode.tagName === 'VIDEO') {
while (_mediaNode.firstChild) {
_mediaNode.removeChild(_mediaNode.firstChild);
}
}
}
},
getMapIndex: function getMapIndex(map, index) {
var counter = -1;
var keyValue = {};
map.forEach(function (value, key) {
if (counter === index) {
keyValue.key = key;
keyValue.value = value;
}
counter++;
});
return keyValue;
},
keyExist: function keyExist(map, searchKey) {
return -1 < map.get('map_keys_1').indexOf(searchKey.toLowerCase());
}

@@ -170,0 +233,0 @@ });

@@ -12,2 +12,2 @@ /*!

*/
!function e(t,i,s){function l(n,o){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!o&&r)return r(n,!0);if(a)return a(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return l(i||e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var a="function"==typeof require&&require,n=0;n<s.length;n++)l(s[n]);return l}({1:[function(e,t,i){"use strict";mejs.i18n.en["mejs.quality-chooser"]="Quality Chooser",Object.assign(mejs.MepDefaults,{defaultQuality:"auto",qualityText:null}),Object.assign(MediaElementPlayer.prototype,{buildquality:function(e,t,i,s){for(var l=this,a=[],n=l.mediaFiles?l.mediaFiles:l.node.children,o=0,r=n.length;o<r;o++){var u=n[o];l.mediaFiles?a.push(u):"SOURCE"===u.nodeName&&a.push(u)}if(!(a.length<=1)){l.cleanquality(e);var c=mejs.Utils.isString(l.options.qualityText)?l.options.qualityText:mejs.i18n.t("mejs.quality-quality"),f=function(e){var t=void 0;if("auto"===e){var i=a[0];t=i instanceof HTMLElement?i.getAttribute("data-quality"):i["data-quality"]}else t=e;return t},d=f(l.options.defaultQuality);e.qualitiesButton=document.createElement("div"),e.qualitiesButton.className=l.options.classPrefix+"button "+l.options.classPrefix+"qualities-button",e.qualitiesButton.innerHTML='<button type="button" aria-controls="'+l.id+'" title="'+c+'" aria-label="'+c+'" tabindex="0">'+d+'</button><div class="'+l.options.classPrefix+"qualities-selector "+l.options.classPrefix+'offscreen"><ul class="'+l.options.classPrefix+'qualities-selector-list"></ul></div>',l.addControlElement(e.qualitiesButton,"qualities");for(var q=0,p=a.length;q<p;q++){var v=a[q],m=v instanceof HTMLElement?v.getAttribute("data-quality"):v["data-quality"],y=l.id+"-qualities-"+m;e.qualitiesButton.querySelector("ul").innerHTML+='<li class="'+l.options.classPrefix+'qualities-selector-list-item"><input class="'+l.options.classPrefix+'qualities-selector-input" type="radio" name="'+l.id+'_qualities"disabled="disabled" value="'+m+'" id="'+y+'" '+(m===d?' checked="checked"':"")+'/><label for="'+y+'" class="'+l.options.classPrefix+"qualities-selector-label"+(m===d?" "+l.options.classPrefix+"qualities-selected":"")+'">'+(v.title||m)+"</label></li>"}for(var h=["mouseenter","focusin"],x=["mouseleave","focusout"],b=e.qualitiesButton.querySelectorAll('input[type="radio"]'),g=e.qualitiesButton.querySelectorAll("."+l.options.classPrefix+"qualities-selector-label"),P=e.qualitiesButton.querySelector("."+l.options.classPrefix+"qualities-selector"),E=0,j=h.length;E<j;E++)e.qualitiesButton.addEventListener(h[E],function(){mejs.Utils.removeClass(P,l.options.classPrefix+"offscreen"),P.style.height=P.querySelector("ul").offsetHeight+"px",P.style.top=-1*parseFloat(P.offsetHeight)+"px"});for(var L=0,B=x.length;L<B;L++)P.addEventListener(x[L],function(){mejs.Utils.addClass(this,l.options.classPrefix+"offscreen")});for(var T=0,U=b.length;T<U;T++){var C=b[T];C.disabled=!1,C.addEventListener("click",function(){for(var t=this,i=t.value,n=e.qualitiesButton.querySelectorAll("."+l.options.classPrefix+"qualities-selected"),o=0,r=n.length;o<r;o++)mejs.Utils.removeClass(n[o],l.options.classPrefix+"qualities-selected");t.checked=!0;for(var u=mejs.Utils.siblings(t,function(e){return mejs.Utils.hasClass(e,l.options.classPrefix+"qualities-selector-label")}),c=0,d=u.length;c<d;c++)mejs.Utils.addClass(u[c],l.options.classPrefix+"qualities-selected");for(var q=s.currentTime,p=s.paused,v=function e(){p||(s.setCurrentTime(q),s.play()),s.removeEventListener("canplay",e)},m=0,y=a.length;m<y;m++){var h=a[m];(h instanceof HTMLElement?h.getAttribute("data-quality"):h["data-quality"])===i&&(e.qualitiesButton.querySelector("button").innerHTML=h.title||f(i),s.pause(),s.setSrc(h.src),s.load(),s.addEventListener("canplay",v))}})}for(var S=0,M=g.length;S<M;S++)g[S].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)});P.addEventListener("keydown",function(e){e.stopPropagation()})}},cleanquality:function(e){e&&e.qualitiesButton&&e.qualitiesButton.remove()}})},{}]},{},[1]);
!function e(t,i,s){function a(n,o){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!o&&r)return r(n,!0);if(l)return l(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return a(i||e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var l="function"==typeof require&&require,n=0;n<s.length;n++)a(s[n]);return a}({1:[function(e,t,i){"use strict";mejs.i18n.en["mejs.quality-chooser"]="Quality Chooser",Object.assign(mejs.MepDefaults,{defaultQuality:"auto",qualityText:null}),Object.assign(MediaElementPlayer.prototype,{buildquality:function(e,t,i,s){for(var a=this,l=a.mediaFiles?a.mediaFiles:a.node.children,n=new Map,o=0,r=l.length;o<r;o++){var u=l[o],c=u instanceof HTMLElement?u.getAttribute("data-quality"):u["data-quality"];if(a.mediaFiles){var d=document.createElement("source");d.src=u.src,d.type=u.type,a.addValueToKey(n,c,d)}else"SOURCE"===u.nodeName&&a.addValueToKey(n,c,u)}if(!(n.size<=1)){a.cleanquality(e);var f=mejs.Utils.isString(a.options.qualityText)?a.options.qualityText:mejs.i18n.t("mejs.quality-quality"),p=function(e){return"auto"===e?a.keyExist(n,e)?e:a.getMapIndex(n,0).key:e}(a.options.defaultQuality);e.qualitiesButton=document.createElement("div"),e.qualitiesButton.className=a.options.classPrefix+"button "+a.options.classPrefix+"qualities-button",e.qualitiesButton.innerHTML='<button type="button" aria-controls="'+a.id+'" title="'+f+'" aria-label="'+f+'" tabindex="0">'+p+'</button><div class="'+a.options.classPrefix+"qualities-selector "+a.options.classPrefix+'offscreen"><ul class="'+a.options.classPrefix+'qualities-selector-list"></ul></div>',a.addControlElement(e.qualitiesButton,"qualities"),s.setSrc(n.get(p)[0].src),s.load(),n.forEach(function(t,i){if("map_keys_1"!==i){var s=t[0],l=i,n=a.id+"-qualities-"+l;e.qualitiesButton.querySelector("ul").innerHTML+='<li class="'+a.options.classPrefix+'qualities-selector-list-item"><input class="'+a.options.classPrefix+'qualities-selector-input" type="radio" name="'+a.id+'_qualities"disabled="disabled" value="'+l+'" id="'+n+'" '+(l===p?' checked="checked"':"")+'/><label for="'+n+'" class="'+a.options.classPrefix+"qualities-selector-label"+(l===p?" "+a.options.classPrefix+"qualities-selected":"")+'">'+(s.title||l)+"</label></li>"}});for(var q=["mouseenter","focusin"],y=["mouseleave","focusout"],m=e.qualitiesButton.querySelectorAll('input[type="radio"]'),v=e.qualitiesButton.querySelectorAll("."+a.options.classPrefix+"qualities-selector-label"),h=e.qualitiesButton.querySelector("."+a.options.classPrefix+"qualities-selector"),g=0,x=q.length;g<x;g++)e.qualitiesButton.addEventListener(q[g],function(){mejs.Utils.removeClass(h,a.options.classPrefix+"offscreen"),h.style.height=h.querySelector("ul").offsetHeight+"px",h.style.top=-1*parseFloat(h.offsetHeight)+"px"});for(var E=0,b=y.length;E<b;E++)e.qualitiesButton.addEventListener(y[E],function(){mejs.Utils.addClass(h,a.options.classPrefix+"offscreen")});for(var P=0,j=m.length;P<j;P++){var k=m[P];k.disabled=!1,k.addEventListener("change",function(){for(var t=this,i=t.value,l=e.qualitiesButton.querySelectorAll("."+a.options.classPrefix+"qualities-selected"),o=0,r=l.length;o<r;o++)mejs.Utils.removeClass(l[o],a.options.classPrefix+"qualities-selected");t.checked=!0;for(var u=mejs.Utils.siblings(t,function(e){return mejs.Utils.hasClass(e,a.options.classPrefix+"qualities-selector-label")}),c=0,d=u.length;c<d;c++)mejs.Utils.addClass(u[c],a.options.classPrefix+"qualities-selected");var f=s.currentTime,p=s.paused;e.qualitiesButton.querySelector("button").innerHTML=i,p||s.pause(),a.updateVideoSource(s,n,i),s.setSrc(n.get(i)[0].src),s.load(),s.dispatchEvent(mejs.Utils.createEvent("seeking",s)),p||s.play(),s.addEventListener("canplay",function e(){s.setCurrentTime(f),s.removeEventListener("canplay",e)})})}for(var C=0,S=v.length;C<S;C++)v[C].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)});h.addEventListener("keydown",function(e){e.stopPropagation()}),s.setSrc(n.get(p)[0].src)}},cleanquality:function(e){e&&e.qualitiesButton&&e.qualitiesButton.remove()},addValueToKey:function(e,t,i){e.has("map_keys_1")?e.get("map_keys_1").push(t.toLowerCase()):e.set("map_keys_1",[]),e.has(t)?e.get(t).push(i):(e.set(t,[]),e.get(t).push(i))},updateVideoSource:function(e,t,i){this.cleanMediaSource(e);for(var s=t.get(i),a=0;a<e.children.length;a++)!function(t){var i=e.children[t];"VIDEO"===i.tagName&&s.forEach(function(e){i.appendChild(e)})}(a)},cleanMediaSource:function(e){for(var t=0;t<e.children.length;t++){var i=e.children[t];if("VIDEO"===i.tagName)for(;i.firstChild;)i.removeChild(i.firstChild)}},getMapIndex:function(e,t){var i=-1,s={};return e.forEach(function(e,a){i===t&&(s.key=a,s.value=e),i++}),s},keyExist:function(e,t){return-1<e.get("map_keys_1").indexOf(t.toLowerCase())}})},{}]},{},[1]);

@@ -38,2 +38,3 @@ /*!

}
media.setSrc('');

@@ -46,5 +47,7 @@ media.load();

t.container.querySelector('.me_cannotplay').remove();
layers.querySelector('.' + t.options.classPrefix + 'overlay-error').parentNode.style.display = 'none';
layers.querySelector('.' + t.options.classPrefix + 'overlay-error').remove();
if (t.container.querySelector('.' + t.options.classPrefix + 'cannotplay')) {
t.container.querySelector('.' + t.options.classPrefix + 'cannotplay').remove();
layers.querySelector('.' + t.options.classPrefix + 'overlay-error').parentNode.style.display = 'none';
layers.querySelector('.' + t.options.classPrefix + 'overlay-error').remove();
}
}

@@ -51,0 +54,0 @@

@@ -12,2 +12,2 @@ /*!

*/
!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 p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var u=o[i]={exports:{}};t[i][0].call(u.exports,function(e){var o=t[i][1][e];return r(o||e)},u,u.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(){if("function"==typeof s.stop)s.stop();else if(s.readyState>0){s.paused||s.pause(),s.setSrc(""),s.load();var e=t.querySelector("."+r.options.classPrefix+"playpause-button");mejs.Utils.removeClass(e,r.options.classPrefix+"pause"),mejs.Utils.addClass(e,r.options.classPrefix+"play"),r.container.querySelector(".me_cannotplay").remove(),o.querySelector("."+r.options.classPrefix+"overlay-error").parentNode.style.display="none",o.querySelector("."+r.options.classPrefix+"overlay-error").remove()}var n=mejs.Utils.createEvent("timeupdate",s);s.dispatchEvent(n)})}})},{}]},{},[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 p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}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(){if("function"==typeof s.stop)s.stop();else if(s.readyState>0){s.paused||s.pause(),s.setSrc(""),s.load();var e=t.querySelector("."+r.options.classPrefix+"playpause-button");mejs.Utils.removeClass(e,r.options.classPrefix+"pause"),mejs.Utils.addClass(e,r.options.classPrefix+"play"),r.container.querySelector("."+r.options.classPrefix+"cannotplay")&&(r.container.querySelector("."+r.options.classPrefix+"cannotplay").remove(),o.querySelector("."+r.options.classPrefix+"overlay-error").parentNode.style.display="none",o.querySelector("."+r.options.classPrefix+"overlay-error").remove())}var n=mejs.Utils.createEvent("timeupdate",s);s.dispatchEvent(n)})}})},{}]},{},[1]);

@@ -11,2 +11,7 @@ # VAST/VPAID

## Keyword to use it
```javascript
features: [..., 'vast']
```
## API

@@ -13,0 +18,0 @@

@@ -10,2 +10,7 @@ # Ads

## Keyword to use it
```javascript
features: [..., 'ads']
```
## API

@@ -12,0 +17,0 @@

@@ -9,2 +9,7 @@ # AirPlay

## Keyword to use it
```javascript
features: [..., 'airplay']
```
## API

@@ -11,0 +16,0 @@

@@ -24,3 +24,3 @@ # Chromecast

<source src="/path/to/media.mp3" type="audio/mp3">
</video>
</audio>
```

@@ -39,2 +39,7 @@

## Keyword to use it
```javascript
features: [..., 'chromecast']
```
## API

@@ -44,3 +49,3 @@

------ | --------- | ------- | --------
castTitle | string | `null` | Chromecast button title for ARIA purposes
castTitle | string | `null` | Chromecast button title for WARIA purposes
castAppId | string | `null` | Chromecast Application ID; if `null` is provided, it will default to `chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID`

@@ -47,0 +52,0 @@ 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)

@@ -13,2 +13,7 @@ # Context Menu

## Keyword to use it
```javascript
features: [..., 'contextmenu']
```
## API

@@ -18,2 +23,2 @@

------ | --------- | ------- | --------
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
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

@@ -9,2 +9,7 @@ # Facebook Pixel

## Keyword to use it
```javascript
features: [..., 'facebookpixel']
```
## API

@@ -11,0 +16,0 @@

@@ -11,2 +11,7 @@ # Google Analytics

## Keyword to use it
```javascript
features: [..., 'googleanalytics']
```
## API

@@ -13,0 +18,0 @@

@@ -11,2 +11,7 @@ # Google Tag Manager

## Keyword to use it
```javascript
features: [..., 'googletagmanager']
```
## API

@@ -13,0 +18,0 @@

@@ -9,2 +9,7 @@ # Jump Forward

## Keyword to use it
```javascript
features: [..., 'jumpforward']
```
## API

@@ -11,0 +16,0 @@

@@ -9,2 +9,7 @@ # Loop

## Keyword to use it
```javascript
features: [..., 'loop']
```
## API

@@ -11,0 +16,0 @@

@@ -13,2 +13,7 @@ # Markers

## Keyword to use it
```javascript
features: [..., 'markers']
```
## API

@@ -18,5 +23,5 @@

------ | --------- | ------- | --------
markerColor | string | `#E9BC3D` | Specify the color of marker
markerWidth | number | `1` | Specify the width of marker
markerColor | string | `#E9BC3D` | Specify the color of marker in hexadecimal code
markerWidth | number | `1` | Specify the width of marker in pixels
markers | array | `[]` | List of numbers to specify marker times in seconds
markerCallback | function | `function(media, time) {}` | Callback function invoked when a marker position is reached

@@ -19,2 +19,7 @@ # Playlist

## Keyword to use it
```javascript
features: [..., 'playlist', 'nexttrack', 'prevtrack', 'shuffle', 'loop']
```
## API

@@ -21,0 +26,0 @@

@@ -18,2 +18,7 @@ # Postroll

## Keyword to use it
```javascript
features: [..., 'postroll']
```
## API

@@ -20,0 +25,0 @@

@@ -7,2 +7,7 @@ # Preview

## Keyword to use it
```javascript
features: [..., 'preview']
```
## API

@@ -12,2 +17,3 @@

------ | --------- | ------- | --------
previewMode | boolean | `false` | Media starts playing when users mouse hovers on it, and resets when leaving player area
muteOnPreviewMode | boolean | `true` | When playing in preview mode, turn on/off sound

@@ -14,0 +20,0 @@ fadeInAudioStart | number | `0` | If `fadeInAudioInterval` is set, time when it starts fading in

@@ -8,2 +8,7 @@ # Quality

## Keyword to use it
```javascript
features: [..., 'quality']
```
## API

@@ -14,2 +19,2 @@

defaultQuality | string | `null` | Initial media quality; if `null`, it will take the first available source
qualityText | string | `null` | Title for Qualities button for WARIA purposes
qualityText | string | `null` | Title for Quality button for WARIA purposes

@@ -9,2 +9,7 @@ # Skip Back

## Keyword to use it
```javascript
features: [..., 'skipback']
```
## API

@@ -11,0 +16,0 @@

@@ -15,2 +15,7 @@ # Source Chooser

## Keyword to use it
```javascript
features: [..., 'sourcechooser']
```
## API

@@ -17,0 +22,0 @@

@@ -7,2 +7,7 @@ # Speed

## Keyword to use it
```javascript
features: [..., 'speed']
```
## API

@@ -9,0 +14,0 @@

@@ -10,2 +10,7 @@ # Stop

## Keyword to use it
```javascript
features: [..., 'stop']
```
## API

@@ -12,0 +17,0 @@

@@ -60,3 +60,4 @@ module.exports = function (grunt) {

'dist/speed/speed.js': 'src/speed/speed.js',
'dist/stop/stop.js': 'src/stop/stop.js'
'dist/stop/stop.js': 'src/stop/stop.js',
'dist/vrview/vrview.js': 'src/vrview/vrview.js',
},

@@ -125,3 +126,4 @@ options: {

'dist/speed/speed.css': 'src/speed/speed.css',
'dist/stop/stop.css': 'src/stop/stop.css'
'dist/stop/stop.css': 'src/stop/stop.css',
'dist/vrview/vrview.css': 'src/vrview/vrview.css'
}

@@ -153,3 +155,4 @@ },

'dist/speed/speed.min.css': 'dist/speed/speed.css',
'dist/stop/stop.min.css': 'dist/stop/stop.css'
'dist/stop/stop.min.css': 'dist/stop/stop.css',
'dist/vrview/vrview.min.css': 'dist/vrview/vrview.css'
}

@@ -156,0 +159,0 @@ },

{
"name": "mediaelement-plugins",
"version": "2.4.0",
"version": "2.5.0",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

@@ -42,5 +42,5 @@ # ![MediaElementJS](https://cloud.githubusercontent.com/assets/910829/22357262/e6cf32b4-e404-11e6-876b-59afa009f65c.png)

<!-- Include any languages from `build/lang` folder -->
<script src="/path/to/dist/speed/speed.min,js"></script>
<script src="/path/to/dist/speed/speed.min.js"></script>
<!-- Translation file for plugin (includes ALL languages available on player)-->
<script src="/path/to/dist/speed/speed-i18n,js"></script>
<script src="/path/to/dist/speed/speed-i18n.js"></script>
<script>

@@ -202,2 +202,3 @@ var player = new MediaElementPlayer('playerId', {

* [VAST/VPAID](docs/ads-vast.md)
* [VRView](docs/vrview.md)

@@ -204,0 +205,0 @@ # Changelog

@@ -357,3 +357,3 @@ 'use strict';

// Execute JS files if found
if (mediaFile.getAttribute('type') === 'application/javascript') {
if (type === 'application/javascript') {
const

@@ -369,7 +369,7 @@ script = document.createElement('script'),

// Avoid Flash
else if (mediaFile.getAttribute('delivery') !== 'application/x-shockwave-flash') {
else if (type !== 'application/x-shockwave-flash') {
adTag.mediaFiles.push({
id: mediaFile.getAttribute('id'),
delivery: mediaFile.getAttribute('delivery'),
type: mediaFile.getAttribute('type'),
type: type,
bitrate: mediaFile.getAttribute('bitrate'),

@@ -376,0 +376,0 @@ width: mediaFile.getAttribute('width'),

@@ -83,6 +83,8 @@ 'use strict';

player.endedCallback = () => {
if (player.currentPlaylistItem < player.totalItems) {
if (player.currentPlaylistItem < player.listItems.length) {
player.setSrc(player.playlist[++player.currentPlaylistItem]);
player.load();
player.play();
setTimeout(() => {
player.play();
}, 200);
}

@@ -153,2 +155,3 @@ };

for (let i = 0, total = inputs.length; i < total; i++) {
inputs[i].disabled = false;
inputs[i].addEventListener('click', function () {

@@ -389,3 +392,3 @@ const

item.tabIndex = 0;
item.classList = `${t.options.classPrefix}playlist-selector-list-item${(i === 0 ? ` ${t.options.classPrefix}playlist-selected` : '')}`;
item.className = `${t.options.classPrefix}playlist-selector-list-item${(i === 0 ? ` ${t.options.classPrefix}playlist-selected` : '')}`;
item.innerHTML = `<div class="${t.options.classPrefix}playlist-item-inner">` +

@@ -392,0 +395,0 @@ `${thumbnail}` +

@@ -198,4 +198,4 @@ 'use strict';

mouseOver = true;
t.container.querySelector(`.${t.options.classPrefix}overlay-loading`).parentNode.style.display = 'block';
t.container.querySelector(`.${t.options.classPrefix}overlay-loading`).parentNode.style.display = 'flex';
t.container.querySelector(`.${t.options.classPrefix}overlay-play`).style.display = 'none';
if (t.media.paused) {

@@ -202,0 +202,0 @@ timeout = setTimeout(() => {

@@ -37,20 +37,24 @@ 'use strict';

buildquality (player, controls, layers, media) {
const
t = this,
qualities = [],
children = t.mediaFiles ? t.mediaFiles : t.node.children
children = t.mediaFiles ? t.mediaFiles : t.node.children,
qualityMap = new Map()
;
for (let i = 0, total = children.length; i < total; i++) {
const s = children[i];
const mediaNode = children[i];
const quality = mediaNode instanceof HTMLElement ? mediaNode.getAttribute('data-quality') : mediaNode['data-quality'];
if (t.mediaFiles) {
qualities.push(s);
} else if (s.nodeName === 'SOURCE') {
qualities.push(s);
const source = document.createElement('source');
source.src = mediaNode['src'];
source.type = mediaNode['type'];
t.addValueToKey(qualityMap, quality, source);
} else if (mediaNode.nodeName === 'SOURCE') {
t.addValueToKey(qualityMap, quality, mediaNode);
}
}
if (qualities.length <= 1) {
if (qualityMap.size <= 1) {
return;

@@ -66,8 +70,12 @@ }

if (value === 'auto') {
const src = qualities[0];
label = src instanceof HTMLElement ? src.getAttribute('data-quality') : src['data-quality']
const keyExist = t.keyExist(qualityMap, value);
if (keyExist) {
label = value;
} else {
let keyValue = t.getMapIndex(qualityMap, 0);
label = keyValue.key;
}
} else {
label = value;
}
return label;

@@ -82,27 +90,30 @@ },

player.qualitiesButton.className = `${t.options.classPrefix}button ${t.options.classPrefix}qualities-button`;
player.qualitiesButton.innerHTML =`<button type="button" aria-controls="${t.id}" title="${qualityTitle}" ` +
player.qualitiesButton.innerHTML = `<button type="button" aria-controls="${t.id}" title="${qualityTitle}" ` +
`aria-label="${qualityTitle}" tabindex="0">${defaultValue}</button>` +
`<div class="${t.options.classPrefix}qualities-selector ${t.options.classPrefix}offscreen">` +
`<ul class="${t.options.classPrefix}qualities-selector-list"></ul>` +
`</div>`;
`</div>`;
t.addControlElement(player.qualitiesButton, 'qualities');
for (let i = 0, total = qualities.length; i < total; i++) {
const
src = qualities[i],
quality = src instanceof HTMLElement ? src.getAttribute('data-quality') : src['data-quality'],
inputId = `${t.id}-qualities-${quality}`
;
media.setSrc(qualityMap.get(defaultValue)[0].src); // ensure the default sources to set to play
media.load();
player.qualitiesButton.querySelector('ul').innerHTML += `<li class="${t.options.classPrefix}qualities-selector-list-item">` +
`<input class="${t.options.classPrefix}qualities-selector-input" type="radio" name="${t.id}_qualities"` +
qualityMap.forEach(function (value, key) {
if (key !== 'map_keys_1') {
const
src = value[0],
quality = key,
inputId = `${t.id}-qualities-${quality}`
;
player.qualitiesButton.querySelector('ul').innerHTML += `<li class="${t.options.classPrefix}qualities-selector-list-item">` +
`<input class="${t.options.classPrefix}qualities-selector-input" type="radio" name="${t.id}_qualities"` +
`disabled="disabled" value="${quality}" id="${inputId}" ` +
`${(quality === defaultValue ? ' checked="checked"' : '')}/>` +
`<label for="${inputId}" class="${t.options.classPrefix}qualities-selector-label` +
`<label for="${inputId}" class="${t.options.classPrefix}qualities-selector-label` +
`${(quality === defaultValue ? ` ${t.options.classPrefix}qualities-selected` : '')}">` +
`${src.title || quality}</label>` +
`</li>`;
}
`</li>`;
}
});
const

@@ -127,4 +138,4 @@ inEvents = ['mouseenter', 'focusin'],

for (let i = 0, total = outEvents.length; i < total; i++) {
selector.addEventListener(outEvents[i], function () {
mejs.Utils.addClass(this, `${t.options.classPrefix}offscreen`);
player.qualitiesButton.addEventListener(outEvents[i], () => {
mejs.Utils.addClass(selector, `${t.options.classPrefix}offscreen`);
});

@@ -136,3 +147,3 @@ }

radio.disabled = false;
radio.addEventListener('click', function() {
radio.addEventListener('change', function () {
const

@@ -154,35 +165,25 @@ self = this,

let currentTime = media.currentTime;
const
paused = media.paused,
canPlayAfterSourceSwitchHandler = () => {
if (!paused) {
media.setCurrentTime(currentTime);
media.play();
}
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
}
;
const paused = media.paused;
for (let i = 0, total = qualities.length; i < total; i++) {
const
src = qualities[i],
quality = src instanceof HTMLElement ? src.getAttribute('data-quality') : src['data-quality']
;
if (quality === newQuality) {
player.qualitiesButton.querySelector('button').innerHTML = src.title || getQualityNameFromValue(newQuality);
media.pause();
media.setSrc(src.src);
media.load();
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler);
}
player.qualitiesButton.querySelector('button').innerHTML = newQuality;
if (!paused) {
media.pause();
}
t.updateVideoSource(media, qualityMap, newQuality);
media.setSrc(qualityMap.get(newQuality)[0].src);
media.load();
media.dispatchEvent(mejs.Utils.createEvent('seeking', media));
if (!paused) {
media.play();
}
media.addEventListener('canplay', function canPlayAfterSourceSwitchHandler () {
media.setCurrentTime(currentTime);
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
});
});
}
for (let i = 0, total = labels.length; i < total; i++) {
labels[i].addEventListener('click', function () {
labels[i].addEventListener('click', function () {
const

@@ -200,2 +201,3 @@ radio = mejs.Utils.siblings(this, (el) => el.tagName === 'INPUT')[0],

});
media.setSrc(qualityMap.get(defaultValue)[0].src);
},

@@ -209,3 +211,3 @@

*/
cleanquality (player) {
cleanquality (player) {
if (player) {

@@ -216,4 +218,87 @@ if (player.qualitiesButton) {

}
},
/**
* Populate the source map
* @param {Map} map the map the quality source is being added
* @param {String} key the key to the quality source (value stored in data-quality)
* @param {String} value the the video.source tag
*/
addValueToKey (map, key, value) {
if (map.has('map_keys_1')) {
map.get('map_keys_1').push(key.toLowerCase());
} else {
map.set('map_keys_1', []);
}
if (map.has(key)) {
map.get(key).push(value);
} else {
map.set(key, []);
map.get(key).push(value);
}
},
/**
* Set the source tag for the mejs player
* @param {MediaElement} media
* @param {Map} map the map containing the video quality source tags
* @param {String} key the user selected quality
*/
updateVideoSource (media, map, key) {
this.cleanMediaSource(media);
let sources = map.get(key);
for (let i = 0; i < media.children.length; i++) {
let mediaNode = media.children[i];
if (mediaNode.tagName === 'VIDEO') {
sources.forEach(function (sourceElement) {
mediaNode.appendChild(sourceElement);
});
}
}
},
/**
* Remove all the source tag for the mejs player
* @param {MediaElement} media
*/
cleanMediaSource (media) {
for (let i = 0; i < media.children.length; i++) {
let mediaNode = media.children[i];
if (mediaNode.tagName === 'VIDEO') {
while (mediaNode.firstChild) {
mediaNode.removeChild(mediaNode.firstChild);
}
}
}
},
/**
* Search a map for a value key pair stored at a specified index
* @param {Map} map the map being searched
* @param {Number} index the index of the requested key value pair
* @return {Object} a key:value object
*/
getMapIndex (map, index) {
let counter = -1;
let keyValue = {};
map.forEach(function (value, key) {
if (counter === index) {
keyValue.key = key;
keyValue.value = value;
}
counter++;
});
return keyValue;
},
/**
* Returns flag for whether or not a given key exist in a give map
* @param {Map} map the map being searched
* @param {String} searchKey the map searching being searched
* @return {boolean}
*/
keyExist (map, searchKey) {
return -1 < map.get('map_keys_1').indexOf(searchKey.toLowerCase());
}
});

@@ -51,2 +51,3 @@ 'use strict';

}
media.setSrc('');

@@ -60,5 +61,7 @@ media.load();

// It will throw an error trying to load an empty source, so remove it since it's expected
t.container.querySelector('.me_cannotplay').remove();
layers.querySelector(`.${t.options.classPrefix}overlay-error`).parentNode.style.display = 'none';
layers.querySelector(`.${t.options.classPrefix}overlay-error`).remove();
if (t.container.querySelector(`.${t.options.classPrefix}cannotplay`)) {
t.container.querySelector(`.${t.options.classPrefix}cannotplay`).remove();
layers.querySelector(`.${t.options.classPrefix}overlay-error`).parentNode.style.display = 'none';
layers.querySelector(`.${t.options.classPrefix}overlay-error`).remove();
}
}

@@ -65,0 +68,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc