mirror of
https://github.com/iv-org/invidious
synced 2024-12-11 04:13:30 +01:00
3 lines
6.5 KiB
JavaScript
3 lines
6.5 KiB
JavaScript
/*! videojs-contrib-dash - v2.8.2 - 2017-04-26
|
|
* Copyright (c) 2017 Brightcove */
|
|
!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){(function(a){"use strict";function b(a){return a&&a.__esModule?a:{default:a}}function d(a,b){function c(a){return"dash-audio-"+a}function d(a,b){return a.find(function(a){var d=a.index;return c(d)===b.id})}var e=a.dash.mediaPlayer,f=e.getTracksFor("audio"),g=a.audioTracks();g.length&&b.clearTracks(["audio"]);var h=e.getCurrentTrackFor("audio");f.forEach(function(a){var b=a.lang;a.roles&&a.roles.length&&(b+=" ("+a.roles.join(", ")+")"),g.addTrack(new i.default.AudioTrack({enabled:a===h,id:c(a.index),kind:a.kind||"main",label:b,language:a.lang}))}),g.addEventListener("change",function(){for(var a=0;a<g.length;a++){var b=g[a];if(b.enabled){var c=d(f,b);e.setCurrentTrack(c)}else;}})}function e(a,b){a.dash.mediaPlayer.on(g.default.MediaPlayer.events.PLAYBACK_METADATA_LOADED,d.bind(null,a,b))}Object.defineProperty(c,"__esModule",{value:!0}),c.default=e;var f="undefined"!=typeof window?window.dashjs:"undefined"!=typeof a?a.dashjs:null,g=b(f),h="undefined"!=typeof window?window.videojs:"undefined"!=typeof a?a.videojs:null,i=b(h)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(a,b,c){(function(b){"use strict";function d(a){return a&&a.__esModule?a:{default:a}}function e(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function f(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(c,"__esModule",{value:!0});var g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),h=a("global/window"),i=d(h),j="undefined"!=typeof window?window.videojs:"undefined"!=typeof b?b.videojs:null,k=d(j),l="undefined"!=typeof window?window.dashjs:"undefined"!=typeof b?b.dashjs:null,m=d(l),n=a("./setup-audio-tracks"),o=d(n),p=function(a){return"[object Array]"===Object.prototype.toString.call(a)},q=function(){function a(b,c,d){var g=this;if(f(this,a),d=d||c.options_,this.player=(0,k.default)(d.playerId),this.player.dash=this.player.dash||{},this.tech_=c,this.el_=c.el(),this.elParent_=this.el_.parentNode,b.src){c.isReady_=!1,a.updateSourceData&&(k.default.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),b=a.updateSourceData(b)),a.hooks("updatesource").forEach(function(a){b=a(b)});var h=b.src;this.keySystemOptions_=a.buildDashJSProtData(b.keySystemOptions),this.player.dash.mediaPlayer=m.default.MediaPlayer().create(),this.mediaPlayer_=this.player.dash.mediaPlayer,a.useVideoJSDebug&&(k.default.log.warn('useVideoJSDebug has been deprecated. Please switch to using hook("beforeinitialize", callback).'),a.useVideoJSDebug(this.mediaPlayer_)),a.beforeInitialize&&(k.default.log.warn('beforeInitialize has been deprecated. Please switch to using hook("beforeinitialize", callback).'),a.beforeInitialize(this.player,this.mediaPlayer_)),a.hooks("beforeinitialize").forEach(function(a){a(g.player,g.mediaPlayer_)}),this.mediaPlayer_.initialize(),d.dash&&Object.keys(d.dash).forEach(function(a){var b,c="set"+a.charAt(0).toUpperCase()+a.slice(1),f=d.dash[a];return g.mediaPlayer_.hasOwnProperty(c)&&(k.default.log.warn("Using dash options in videojs-contrib-dash without the set prefix "+("has been deprecated. Change '"+a+"' to '"+c+"'")),a=c),g.mediaPlayer_.hasOwnProperty(a)?(p(f)||(f=[f]),void(b=g.mediaPlayer_)[a].apply(b,e(f))):void k.default.log.warn("Warning: dash configuration option unrecognized: "+a)}),this.mediaPlayer_.attachView(this.el_),this.mediaPlayer_.setAutoPlay(!1),o.default.call(null,this.player,c),this.mediaPlayer_.setProtectionData(this.keySystemOptions_),this.mediaPlayer_.attachSource(h),this.tech_.triggerReady()}}return g(a,[{key:"dispose",value:function(){this.mediaPlayer_&&this.mediaPlayer_.reset(),this.player.dash&&delete this.player.dash}},{key:"duration",value:function a(){var a=this.el_.duration;return a===Number.MAX_VALUE?1/0:a}}],[{key:"buildDashJSProtData",value:function(a){var b={};if(!a||!p(a))return null;for(var c=0;c<a.length;c++){var d=a[c],e=k.default.mergeOptions({},d.options);e.licenseUrl&&(e.serverURL=e.licenseUrl,delete e.licenseUrl),b[d.name]=e}return b}},{key:"hooks",value:function(b,c){return a.hooks_[b]=a.hooks_[b]||[],c&&(a.hooks_[b]=a.hooks_[b].concat(c)),a.hooks_[b]}},{key:"hook",value:function(b,c){a.hooks(b,c)}},{key:"removeHook",value:function(b,c){var d=a.hooks(b).indexOf(c);return d!==-1&&(a.hooks_[b]=a.hooks_[b].slice(),a.hooks_[b].splice(d,1),!0)}}]),a}();q.hooks_={};var r=function(a){a=JSON.parse(JSON.stringify(a)),q.updateSourceData&&(k.default.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),a=q.updateSourceData(a)),q.hooks("updatesource").forEach(function(b){a=b(a)});var b=document.createElement("video");return!(a.keySystemOptions&&!navigator.requestMediaKeySystemAccess&&!b.msSetMediaKeys)};k.default.DashSourceHandler=function(){return{canHandleSource:function(a){var b=/\.mpd/i;return r(a)?k.default.DashSourceHandler.canPlayType(a.type)?"probably":b.test(a.src)?"maybe":"":""},handleSource:function(a,b,c){return new q(a,b,c)},canPlayType:function(a){return k.default.DashSourceHandler.canPlayType(a)}}},k.default.DashSourceHandler.canPlayType=function(a){var b=/^application\/dash\+xml/i;return b.test(a)?"probably":""},i.default.MediaSource&&k.default.getTech("Html5").registerSourceHandler(k.default.DashSourceHandler(),0),k.default.Html5DashJS=q,c.default=q}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./setup-audio-tracks":1,"global/window":3}],3:[function(a,b,c){(function(a){var c;c="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{},b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[2]); |