negromate/web/static/js/videojs-playlist/dist/videojs-playlist.min.js

3 lines
4.2 KiB
JavaScript
Raw Normal View History

2021-09-29 09:36:46 +02:00
/*! @name videojs-playlist @version 4.2.6 @license Apache-2.0 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):e.videojsPlaylist=t(e.videojs)}(this,function(e){"use strict";var t=function(e){var t=e.playlist.autoadvance_;t.timeout&&e.clearTimeout(t.timeout),t.trigger&&e.off("ended",t.trigger),t.timeout=null,t.trigger=null},r=function e(r,n){var i;(t(r),"number"==typeof(i=n)&&!isNaN(i)&&i>=0&&i<1/0)?(r.playlist.autoadvance_.delay=n,r.playlist.autoadvance_.trigger=function(){var i=function(){return e(r,n)};r.one("play",i),r.playlist.autoadvance_.timeout=r.setTimeout(function(){t(r),r.off("play",i),r.playlist.next()},1e3*n)},r.one("ended",r.playlist.autoadvance_.trigger)):r.playlist.autoadvance_.delay=null},n=function(e,t){var n=!e.paused()||e.ended();return e.trigger("beforeplaylistitem",t),e.poster(t.poster||""),e.src(t.sources),function(e){for(var t=e.remoteTextTracks(),r=t&&t.length||0;r--;)e.removeRemoteTextTrack(t[r])}(e),e.ready(function(){if((t.textTracks||[]).forEach(e.addRemoteTextTrack.bind(e)),e.trigger("playlistitem",t),n){var i=e.play();void 0!==i&&"function"==typeof i.then&&i.then(null,function(e){})}r(e,e.playlist.autoadvance_.delay)}),e},i=function(e,t){for(var r=0;r<e.length;r++){var n=e[r].sources;if(Array.isArray(n))for(var i=0;i<n.length;i++){var a=n[i];if(a&&(l=void 0,c=void 0,l=o=a,c=u=t,"object"==typeof o&&(l=o.src),"object"==typeof u&&(c=u.src),/^\/\//.test(l)&&(c=c.slice(c.indexOf("//"))),/^\/\//.test(c)&&(l=l.slice(l.indexOf("//"))),l===c))return r}}var o,u,l,c;return-1},a=function(e){for(var t=-1,r=e.length-1;++t<e.length;){var n=t+Math.floor(Math.random()*(r-t+1)),i=e[n];e[n]=e[t],e[t]=i}return e};var o=function(o,u){!function(o,u,l){void 0===l&&(l=0);var c=null,s=!1,d=o.playlist=function(e,t){if(void 0===t&&(t=0),s)throw new Error("do not call playlist() during a playlist change");if(Array.isArray(e)){var r=Array.isArray(c)?c.slice():null;c=e.slice(),s=!0,o.trigger({type:"duringplaylistchange",nextIndex:t,nextPlaylist:c,previousIndex:d.currentIndex_,previousPlaylist:r||[]}),s=!1,-1!==t&&d.currentItem(t),r&&o.setTimeout(function(){o.trigger("playlistchange")},0)}return c.slice()};o.on("loadstart",function(){-1===d.currentItem()&&t(o)}),d.currentIndex_=-1,d.player_=o,d.autoadvance_={},d.repeat_=!1,d.currentItem=function(e){return s?d.currentIndex_:("number"==typeof e&&d.currentIndex_!==e&&e>=0&&e<c.length?(d.currentIndex_=e,n(d.player_,c[d.currentIndex_])):d.currentIndex_=d.indexOf(d.player_.currentSrc()||""),d.currentIndex_)},d.contains=function(e){return-1!==d.indexOf(e)},d.indexOf=function(e){if("string"==typeof e)return i(c,e);for(var t=Array.isArray(e)?e:e.sources,r=0;r<t.length;r++){var n=t[r];if("string"==typeof n)return i(c,n);if(n.src)return i(c,n.src)}return-1},d.currentIndex=function(){return d.currentItem()},d.lastIndex=function(){return c.length-1},d.nextIndex=function(){var e=d.currentItem();if(-1===e)return-1;var t=d.lastIndex();return d.repeat_&&e===t?0:Math.min(e+1,t)},d.previousIndex=function(){var e=d.currentItem();return-1===e?-1:d.repeat_&&0===e?d.lastIndex():Math.max(e-1,0)},d.first=function(){if(!s)return c.length?c[d.currentItem(0)]:void(d.currentIndex_=-1)},d.last=function(){if(!s)return c.length?c[d.currentItem(d.lastIndex())]:void(d.currentIndex_=-1)},d.next=function(){if(!s){var e=d.nextIndex();return e!==d.currentIndex_?c[d.currentItem(e)]:void 0}},d.previous=function(){if(!s){var e=d.previousIndex();return e!==d.currentIndex_?c[d.currentItem(e)]:void 0}},d.autoadvance=function(e){r(d.player_,e)},d.repeat=function(t){return void 0===t?d.repeat_:"boolean"==typeof t?(d.repeat_=!!t,d.repeat_):void e.log.error("videojs-playlist: Invalid value for repeat",t)},d.sort=function(e){c.length&&(c.sort(e),s||o.trigger("playlistsorted"))},d.reverse=function(){c.length&&(c.reverse(),s||o.trigger("playlistsorted"))},d.shuffle=function(e){var t,r=(void 0===e?{}:e).rest,n=0,i=c;(r&&(n=d.currentIndex_+1,i=c.slice(n)),i.length<=1)||(a(i),r&&(t=c).splice.apply(t,[n,i.length].concat(i)),s||o.trigger("playlistsorted"))},Array.isArray