mirror of
https://github.com/iv-org/invidious
synced 2024-11-05 06:00:43 +00:00
3 lines
9.9 KiB
JavaScript
3 lines
9.9 KiB
JavaScript
/*! videojs-contrib-dash - v2.8.2 - 2018-09-24
|
|
* Copyright (c) 2018 Brightcove */
|
|
!function(){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||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}return a}()({1:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d=function(a,b){var c={};return c.id=a.qualityIndex+"",c.width=a.width,c.height=a.height,c.bandwidth=a.bitrate,c.isEnabled_=!0,c.enabled=function(a){return void 0===a?c.isEnabled_:void(a!==c.isEnabled_&&(a!==!0&&a!==!1||(c.isEnabled_=a,b())))},c},e=function(a){var b=[],c=function(){var c=b.filter(function(a){return a.enabled()});if(c.length===b.length||0===c.length)return a.setMinAllowedBitrateFor("video",NaN),void a.setMaxAllowedBitrateFor("video",NaN);c.sort(function(a,b){return a.bandwidth-b.bandwidth});var d=c[0].bandwidth,e=c[c.length-1].bandwidth;a.setMinAllowedBitrateFor("video",d/1e3),a.setMaxAllowedBitrateFor("video",e/1e3)};return function(){return b=b.length?b:a.getBitrateInfoListFor("video").map(function(a){return d(a,c)})}};c.default=e},{}],2:[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:{})},{}],3:[function(a,b,c){"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d=function(a,b){if(a.dash&&a.dash.representations&&a.qualityLevels){var c=a.qualityLevels();c.dispose();var d=function(){a.dash.representations().forEach(c.addQualityLevel.bind(c))},e=function(a){"video"===a.mediaType&&(c.selectedIndex_=a.newQuality,c.trigger("change"))};b.on("playbackMetaDataLoaded",d),b.on("qualityChangeRendered",e)}};c.default=d},{}],4:[function(a,b,c){(function(a){"use strict";function b(a){return a&&a.__esModule?a:{default:a}}function d(a,b,c){function d(){for(var b=a.dash.mediaPlayer,d=a.textTracks(),f=-1,g=function(a){var b=d[a];if("showing"===b.mode){var g=e.find(function(a){var c=a.textTrack;return c===b}),h=g?g.dashTrack:null;h&&(f=c.indexOf(h))}},h=0;h<d.length;h+=1)g(h);f!==b.getCurrentTextTrackIndex()&&b.setTextTrack(f)}var e=[],f=c.map(function(a){return{dashTrack:a,trackConfig:{default:a.defaultTrack,kind:a.kind,label:a.lang,language:a.lang,srclang:a.lang}}}).map(function(b){var c=b.trackConfig,d=b.dashTrack,f=a.addRemoteTextTrack(c,!0);return e.push({textTrack:f.track,dashTrack:d}),f});a.textTracks().on("change",d),a.one("loadstart",function(){a.textTracks().off("change",d)});for(var g=a.textTracks(),h=0;h<g.length;h+=1){var i=g[h];"subtitles"!==i.kind&&"captions"!==i.kind||(i.mode=i.default?"showing":"hidden")}return d(),f}function e(a,b,c){function e(){j.forEach(a.removeRemoteTextTrack.bind(a)),j=[]}function f(h){var i=(h.index,h.tracks);k.off(g.default.MediaPlayer.events.TEXT_TRACKS_ADDED,f),e(),i.length&&(j=d(a,b,i,c))}function h(){k.off(g.default.MediaPlayer.events.TEXT_TRACKS_ADDED,f),a.one("loadstart",e)}var j=[];if(b.featuresNativeTextTracks)return void i.default.log.error("You must pass {html: {nativeCaptions: false}} in the videojs constructor to use text tracks in videojs-contrib-dash");var k=a.dash.mediaPlayer;k.on(g.default.MediaPlayer.events.TEXT_TRACKS_ADDED,f),k.on(g.default.MediaPlayer.events.CAN_PLAY,h)}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:{})},{}],5:[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=a("./setup-text-tracks"),q=d(p),r=a("./create-representations"),s=d(r),t=a("./setup-quality-levels"),u=d(t),v=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.el_=c.el(),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,i=a.buildDashJSProtData(b.keySystemOptions);this.player.dash.mediaPlayer=m.default.MediaPlayer().create(),this.mediaPlayer_=this.player.dash.mediaPlayer,this.mediaPlayer_.setFastSwitchEnabled(!0),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_)),this.player.dash.representations=(0,s.default)(this.mediaPlayer_),(0,u.default)(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)?(Array.isArray(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),q.default.call(null,this.player,c,d),this.mediaPlayer_.setProtectionData(i),this.mediaPlayer_.attachSource(h),c.triggerReady()}}return g(a,[{key:"dispose",value:function(){this.mediaPlayer_&&this.mediaPlayer_.reset(),this.player.dash&&delete this.player.dash,this.player.qualityLevels&&this.player.qualityLevels().dispose()}},{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||!Array.isArray(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}();v.hooks_={};var w=function(a){a=JSON.parse(JSON.stringify(a)),v.updateSourceData&&(k.default.log.warn('updateSourceData has been deprecated. Please switch to using hook("updatesource", callback).'),a=v.updateSourceData(a)),v.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 w(a)?k.default.DashSourceHandler.canPlayType(a.type)?"probably":b.test(a.src)?"maybe":"":""},handleSource:function(a,b,c){return new v(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=v,c.default=v}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./create-representations":1,"./setup-audio-tracks":2,"./setup-quality-levels":3,"./setup-text-tracks":4,"global/window":6}],6:[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:{})},{}]},{},[5]); |