jellyfin-web/dashboard-ui/bower_components/hlsjs/dist/hls.min.js

7 lines
183 KiB
JavaScript
Raw Normal View History

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){var e;return function e(t,r,i){function a(s,o){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[s]={exports:{}};t[s][0].call(d.exports,function(e){var r=t[s][1][e];return a(r?r:e)},d,d.exports,e,t,r,i)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<i.length;s++)a(i[s]);return a}({1:[function(e,t,r){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function a(e){return"function"==typeof e}function n(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,r,i,n,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var d=new Error('Uncaught, unspecified "error" event. ('+t+")");throw d.context=t,d}if(r=this._events[e],o(r))return!1;if(a(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}else if(s(r))for(n=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;l<i;l++)u[l].apply(this,n);return!0},i.prototype.addListener=function(e,t){var r;if(!a(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,a(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?i.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,"function"==typeof console.trace)),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!a(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){var r,i,n,o;if(!a(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],n=r.length,i=-1,r===t||a(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=n;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){i=o;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],a(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?a(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(a(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,
var a=e[i],n=a.levelCodec||a.codec,s=a.container+";codecs="+n;f.logger.log("creating sourceBuffer("+s+")");try{var o=t[i]=r.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe),this.tracks[i]={codec:n,container:a.container},a.buffer=o}catch(e){f.logger.error("error while trying to add sourceBuffer:"+e.message),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:e,mimeType:s})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:e})}},{key:"onBufferAppending",value:function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())}},{key:"onBufferAppendFail",value:function(e){f.logger.error("sourceBuffer error:"+e.event),this.hls.trigger(u.default.ERROR,{type:c.ErrorTypes.MEDIA_ERROR,details:c.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1,frag:this.fragCurrent})}},{key:"onBufferEos",value:function(e){var t=this.sourceBuffer,r=e.type;for(var i in t)r&&i!==r||t[i].ended||(t[i].ended=!0,f.logger.log(i+" sourceBuffer now EOS"));this.checkEos()}},{key:"checkEos",value:function(){var e=this.sourceBuffer,t=this.mediaSource;if(!t||"open"!==t.readyState)return void(this._needsEos=!1);for(var r in e){if(!e[r].ended)return;if(e[r].updating)return void(this._needsEos=!0)}f.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment"),t.endOfStream(),this._needsEos=!1}},{key:"onBufferFlushing",value:function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}),this.flushBufferCounter=0,this.doFlush()}},{key:"onLevelUpdated",value:function(e){var t=e.details;0!==t.fragments.length&&(this._levelDuration=t.totalduration+t.fragments[0].start,this.updateMediaElementDuration())}},{key:"updateMediaElementDuration",value:function(){var e=this.media,t=this.mediaSource,r=this.sourceBuffer,i=this._levelDuration;if(null!==i&&e&&t&&r&&0!==e.readyState&&"open"===t.readyState){for(var a in r)if(r[a].updating)return;null===this._msDuration&&(this._msDuration=t.duration),i>this._msDuration&&i>e.duration&&(f.logger.log("Updating mediasource duration to "+i.toFixed(3)),this._msDuration=t.duration=i)}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;for(var i in r)t+=r[i].buffered.length;this.appended=t,this.hls.trigger(u.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var e=this.hls,t=this.sourceBuffer,r=this.segments;if(Object.keys(t).length){if(this.media.error)return this.segments=[],void f.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var i=r.shift();try{var a=i.type;t[a]?(t[a].ended=!1,this.parent=i.parent,t[a].appendBuffer(i.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(t){f.logger.error("error while trying to append buffer:"+t.message),r.unshift(i);var n={type:c.ErrorTypes.MEDIA_ERROR};if(22===t.code)return this.segments=[],n.details=c.ErrorDetails.BUFFER_FULL_ERROR,void e.trigger(u.default.ERROR,n);if(this.appendError?this.appendError++:this.appendError=1,n.details=c.ErrorDetails.BUFFER_APPEND_ERROR,n.frag=this.fragCurrent,this.appendError>e.config.appendErrorMaxRetry)return f.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],n.fatal=!0,void e.trigger(u.default.ERROR,n);n.fatal=!1,e.trigger(u.default.ERROR,n)}}}}},{key:"flushBuffer",value:function(e,t,r){var i,a,n,s,o,l,u=this.sourceBuffer;if(Object.keys(u).length){if(f.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime+"/"+e+"/"+t),this.flushBufferCounter<this.appended){for(var d in u)if(!r||d===r){if(i=u[d],i.ended=!1,i.updating)return f.logger.warn("cannot flush, sb updating in progress"),!1;for(a=0;a<i.buffered.length;a++)if(n=i.buffered.sta
this.startPosition=o)}this.nextLoadPosition=this.startPosition}this.state===T.WAITING_LEVEL&&(this.state=T.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===T.KEY_LOADING&&(this.state=T.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent,r=e.frag;if(this.state===T.FRAG_LOADING&&t&&"main"===r.type&&r.level===t.level&&r.sn===t.sn){var i=e.stats,a=this.levels[t.level],n=a.details;if(k.logger.log("Loaded "+t.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+t.level),this.bitrateTest=!1,r.bitrateTest===!0&&this.hls.nextLoadLevel)this.state=T.IDLE,this.startFragRequested=!1,i.tparsed=i.tbuffered=performance.now(),this.hls.trigger(g.default.FRAG_BUFFERED,{stats:i,frag:t,id:"main"}),this.tick();else{this.state=T.PARSING,this.stats=i;var s=n.totalduration,o=isNaN(t.startDTS)?t.start:t.startDTS,l=t.level,u=t.sn,d=this.config.defaultAudioCodec||a.audioCodec;this.audioCodecSwap&&(k.logger.log("swapping playlist audio codec"),void 0===d&&(d=this.lastAudioCodec),d&&(d=d.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,k.logger.log("Parsing "+u+" of ["+n.startSN+" ,"+n.endSN+"],level "+l+", cc "+t.cc);var h=this.demuxer;h||(h=this.demuxer=new c.default(this.hls,"main"));var f=n.PTSKnown||!n.live;h.push(e.payload,d,a.videoCodec,o,t.cc,l,u,s,t.decryptdata,f)}}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent;if(t&&"main"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING){var r,i,a=e.tracks;if(a.audio&&this.altAudio&&delete a.audio,i=a.audio){var n=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();n&&this.audioCodecSwap&&(k.logger.log("swapping playlist audio codec"),n=n.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==i.metadata.channelCount&&s.indexOf("firefox")===-1&&(n="mp4a.40.5"),s.indexOf("android")!==-1&&"audio/mpeg"!==i.container&&(n="mp4a.40.2",k.logger.log("Android: force audio codec to"+n)),i.levelCodec=n,i.id=e.id}if(i=a.video,i&&(i.levelCodec=this.levels[this.level].videoCodec,i.id=e.id),e.unique){var o={codec:"",levelCodec:""};for(r in e.tracks)i=a[r],o.container=i.container,o.codec&&(o.codec+=",",o.levelCodec+=","),i.codec&&(o.codec+=i.codec),i.levelCodec&&(o.levelCodec+=i.levelCodec);a={audiovideo:o}}this.hls.trigger(g.default.BUFFER_CODECS,a);for(r in a){i=a[r],k.logger.log("main track:"+r+",container:"+i.container+",codecs[level/parsed]=["+i.levelCodec+"/"+i.codec+"]");var l=i.initSegment;l&&(this.pendingAppending++,this.hls.trigger(g.default.BUFFER_APPENDING,{type:r,data:l,parent:"main",content:"initSegment"}))}this.tick()}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent;if(r&&"main"===e.id&&e.sn===r.sn&&e.level===r.level&&("audio"!==e.type||!this.altAudio)&&this.state===T.PARSING){var i=this.levels[this.level],a=this.fragCurrent;k.logger.log("Parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0));var n=E.default.updateFragPTSDTS(i.details,a.sn,e.startPTS,e.endPTS,e.startDTS,e.endDTS),s=this.hls;s.trigger(g.default.LEVEL_PTS_UPDATED,{details:i.details,level:this.level,drift:n,type:e.type,start:e.startPTS,end:e.endPTS}),"video"===e.type&&(a.dropped=e.dropped),[e.data1,e.data2].forEach(function(r){r&&(t.pendingAppending++,s.trigger(g.default.BUFFER_APPENDING,{type:e.type,data:r,parent:"main",content:"data"}))}),this.nextLoadPosition=e.endPTS,this.bufferRange.push({type:e.type,start:e.startPTS,end:e.endPTS,frag:a}),this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent;t&&"main"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING&&(this.stats.tparsed=performance.now(),this.state=T.PARSED,this._checkAppendedParsed())}},{key:"onAudioTrackSwitch",value:function(e){var t=!!e.url;if(t)this.videoBuffer&&this.mediaBuffer!==this.videoBuffer&&(k.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=this.videoBuffer);else if(t
this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),t=e-t,t>0&&this.bitsAvailable?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!==(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(e){var t,r,i=8,a=8;for(t=0;t<e;t++)0!==a&&(r=this.readEG(),a=(i+r+256)%256),i=0===a?i:a}},{key:"readSPS",value:function(){var e,t,r,i,a,n,s,o,l,u=0,d=0,h=0,f=0,c=1;if(this.readUByte(),e=this.readUByte(),t=this.readBits(5),this.skipBits(3),r=this.readUByte(),this.skipUEG(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var v=this.readUEG();if(3===v&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==v?8:12,l=0;l<o;l++)this.readBoolean()&&(l<6?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var g=this.readUEG();if(0===g)this.readUEG();else if(1===g)for(this.skipBits(1),this.skipEG(),this.skipEG(),i=this.readUEG(),l=0;l<i;l++)this.skipEG();if(this.skipUEG(),this.skipBits(1),a=this.readUEG(),n=this.readUEG(),s=this.readBits(1),0===s&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(u=this.readUEG(),d=this.readUEG(),h=this.readUEG(),f=this.readUEG()),this.readBoolean()&&this.readBoolean()){var p=void 0,y=this.readUByte();switch(y){case 1:p=[1,1];break;case 2:p=[12,11];break;case 3:p=[10,11];break;case 4:p=[16,11];break;case 5:p=[40,33];break;case 6:p=[24,11];break;case 7:p=[20,11];break;case 8:p=[32,11];break;case 9:p=[80,33];break;case 10:p=[18,11];break;case 11:p=[15,11];break;case 12:p=[64,33];break;case 13:p=[160,99];break;case 14:p=[4,3];break;case 15:p=[3,2];break;case 16:p=[2,1];break;case 255:p=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}p&&(c=p[0]/p[1])}return{width:Math.ceil((16*(a+1)-2*u-2*d)*c),height:(2-s)*(n+1)*16-(s?2:4)*(h+f)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();r.default=s},{45:45}],24:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=e(45),s=function(){function e(t){i(this,e),this._hasTimeStamp=!1;for(var r,a,s,o,l,u,d,h,f=0;;)if(d=this.readUTF(t,f,3),f+=3,"ID3"===d)f+=3,r=127&t[f++],a=127&t[f++],s=127&t[f++],o=127&t[f++],l=(r<<21)+(a<<14)+(s<<7)+o,u=f+l,this._parseID3Frames(t,f,u),f=u;else{if("3DI"!==d)return f-=3,h=f,void(h&&(this.hasTimeStamp||n.logger.warn("ID3 tag found, but no timestamp"),this._length=h,this._payload=t.subarray(0,h)));f+=7,n.logger.log("3DI footer found, end: "+f)}}return a(e,[{key:"readUTF",value:function(e,t,r){var i="",a=t,n=t+r;do i+=String.fromCharCode(e[a++]);while(a<n);return i}},{key:"_parseID3Frames",value:function(e,t,r){for(var i,a,s,o,l;t+8<=r;)switch(i=this.readUTF(e,t,4),t+=4,a=e[t++]<<24+e[t++]<<16+e[t++]<<8+e[t++],o=e[t++]<<8+e[t++],s=t,i){case"PRIV":if("com.apple.streaming.transportStreamTime
}},{key:"recoverMediaError",value:function(){P.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),this.attachMedia(e)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){P.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){P.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){P.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.abrController.minAutoLevel)},set:function(e){P.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){P.logger.log("set startLevel:"+e);var t=this.abrController.minAutoLevel;this.levelController.startLevel=Math.max(e,t)}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(e){P.logger.log("set autoLevelCapping:"+e),this.abrController.autoLevelCapping=e}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"audioTracks",get:function(){return this.audioTrackController.audioTracks}},{key:"audioTrack",get:function(){return this.audioTrackController.audioTrack},set:function(e){this.audioTrackController.audioTrack=e}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}}]),e}();r.default=B},{1:1,10:10,11:11,12:12,13:13,26:26,28:28,34:34,35:35,36:36,4:4,43:43,45:45,48:48,5:5,6:6,7:7,8:8}],33:[function(e,t,r){"use strict";t.exports=e(32).default},{32:32}],34:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),l=e(28),u=i(l),d=e(27),h=i(d),f=e(26),c=e(45),v=function(e){function t(e){a(this,t);var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,u.default.FRAG_LOADING));return r.loaders={},r}return s(t,e),o(t,[{key:"destroy",value:function(){var e=this.loaders;for(var t in e){var r=e[t];r&&r.destroy()}this.loaders={},h.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag,r=t.type,i=this.loaders[r],a=this.hls.config;t.loaded=0,i&&(c.logger.warn("abort previous fragment loader for type:"+r),i.abort()),i=this.loaders[r]=t.loader="undefined"!=typeof a.fLoader?new a.fLoader(a):new a.loader(a);var n=void 0,s=void 0,o=void 0;n={url:t.url,frag:t,responseType:"arraybuffer",progressData:!1};var l=t.byteRangeStartOffset,u=t.byteRangeEndOffset;isNaN(l)||isNaN(u)||(n.rangeStart=l,n.rangeEnd=u),s={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout},o={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout
s.duration=H),K){this.nextAacPts=E+S*H,e.len=0,e.samples=O,c=f.default.moof(e.sequenceNumber++,g/S,e),e.samples=[];var V={id:this.id,level:this.level,sn:this.sn,data1:c,data2:h,startPTS:v/T,endPTS:this.nextAacPts/T,startDTS:g/T,endDTS:(b+S*H)/T,type:"audio",nb:K};return this.observer.trigger(u.default.FRAG_PARSING_DATA,V),V}return null}},{key:"remuxEmptyAudio",value:function(e,t,r,i){var a=this.PES_TIMESCALE,n=e.timescale?e.timescale:e.audiosamplerate,s=a/n,l=this.nextAacPts,u=(void 0!==l?l:i.startDTS*a)+this._initDTS,h=i.endDTS*a+this._initDTS,f=1024,c=s*f,v=Math.ceil((h-u)/c),g=o.default.getSilentFrame(e.channelCount);if(d.logger.warn("remux empty Audio"),!g)return void d.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var p=[],y=0;y<v;y++){var m=u+y*c;p.push({unit:g.slice(0),pts:m,dts:m}),e.len+=g.length}e.samples=p,this.remuxAudio(e,t,r)}},{key:"remuxID3",value:function(e,t){var r,i=e.samples.length;if(i){for(var a=0;a<i;a++)r=e.samples[a],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE,r.dts=(r.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(u.default.FRAG_PARSING_METADATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],t=t}},{key:"remuxText",value:function(e,t){e.samples.sort(function(e,t){return e.pts-t.pts});var r,i=e.samples.length;if(i){for(var a=0;a<i;a++)r=e.samples[a],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(u.default.FRAG_PARSING_USERDATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],t=t}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),e}();r.default=v},{26:26,28:28,29:29,37:37,45:45,46:46}],39:[function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=e(28),o=i(s),l=function(){function e(t,r){a(this,e),this.observer=t,this.id=r,this.ISGenerated=!1}return n(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,i,a,n){var s=this.observer;if(!this.ISGenerated){var l={},u={id:this.id,tracks:l,unique:!0},d=t,h=d.codec;h&&(u.tracks.video={container:d.container,codec:h,metadata:{width:d.width,height:d.height}}),d=e,h=d.codec,h&&(u.tracks.audio={container:d.container,codec:h,metadata:{channelCount:d.channelCount}}),this.ISGenerated=!0,s.trigger(o.default.FRAG_PARSING_INIT_SEGMENT,u)}s.trigger(o.default.FRAG_PARSING_DATA,{id:this.id,data1:n,startPTS:a,startDTS:a,type:"audiovideo",nb:1,dropped:0})}},{key:"passthrough",get:function(){return!0}}]),e}();r.default=l},{28:28}],40:[function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),n=/^(\d+)x(\d+)$/,s=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function e(t){i(this,e),"string"==typeof t&&(t=e.parseAttrList(t));for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r])}return a(e,[{key:"decimalInteger",value:function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),