mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 19:38:20 -07:00
4 lines
78 KiB
JavaScript
4 lines
78 KiB
JavaScript
|
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Hls=t()}}(function(){return function n(e,t,i){function r(s,d){if(!t[s]){if(!e[s]){var l="function"==typeof require&&require;if(!d&&l)return l(s,!0);if(a)return a(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var o=t[s]={exports:{}};e[s][0].call(o.exports,function(t){var i=e[s][1][t];return r(i?i:t)},o,o.exports,n,e,t,i)}return t[s].exports}for(var a="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(n,s,o){function e(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function t(e){return"function"==typeof e}function a(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function r(e){return void 0===e}s.exports=e,e.EventEmitter=e,e.prototype._events=void 0,e.prototype._maxListeners=void 0,e.defaultMaxListeners=10,e.prototype.setMaxListeners=function(e){if(!a(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(u){var o,s,a,n,e,l;if(this._events||(this._events={}),"error"===u&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(o=arguments[1],o instanceof Error)throw o;throw TypeError('Uncaught, unspecified "error" event.')}if(s=this._events[u],r(s))return!1;if(t(s))switch(arguments.length){case 1:s.call(this);break;case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:for(a=arguments.length,n=new Array(a-1),e=1;a>e;e++)n[e-1]=arguments[e];s.apply(this,n)}else if(i(s)){for(a=arguments.length,n=new Array(a-1),e=1;a>e;e++)n[e-1]=arguments[e];for(l=s.slice(),a=l.length,e=0;a>e;e++)l[e].apply(this,n)}return!0},e.prototype.addListener=function(s,a){var n;if(!t(a))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",s,t(a.listener)?a.listener:a),this._events[s]?i(this._events[s])?this._events[s].push(a):this._events[s]=[this._events[s],a]:this._events[s]=a,i(this._events[s])&&!this._events[s].warned){var n;n=r(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[s].length>n&&(this._events[s].warned=!0,"function"==typeof console.trace)}return this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(r,e){function i(){this.removeListener(r,i),s||(s=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var s=!1;return i.listener=e,this.on(r,i),this},e.prototype.removeListener=function(s,r){var e,n,o,a;if(!t(r))throw TypeError("listener must be a function");if(!this._events||!this._events[s])return this;if(e=this._events[s],o=e.length,n=-1,e===r||t(e.listener)&&e.listener===r)delete this._events[s],this._events.removeListener&&this.emit("removeListener",s,r);else if(i(e)){for(a=o;a-->0;)if(e[a]===r||e[a].listener&&e[a].listener===r){n=a;break}if(0>n)return this;1===e.length?(e.length=0,delete this._events[s]):e.splice(n,1),this._events.removeListener&&this.emit("removeListener",s,r)}return this},e.prototype.removeAllListeners=function(e){var r,i;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(r in this._events)"removeListener"!==r&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],t(i))this.removeListener(e,i);else for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},e.prototype.listeners=function(e){var i;return i=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.listenerCount=function(e,i){var r;return r=e._events&&e._events[i]?t(e._events[i])?1:e._events[i].length:0}},{}],2:[func
|
||
|
var t={event:r,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,moof:e.moof.buffer,mdat:e.mdat.buffer,nb:e.nb};i.postMessage(t,[t.moof,t.mdat])}),t.on(e.default.FRAG_PARSED,function(e){i.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){i.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var r={event:e,samples:t.samples};i.postMessage(r)})};r.default=o,n.exports=r.default},{"../demux/demuxer-inline":6,"../events":12,"../remux/mp4-remuxer":18,events:1}],8:[function(e,l,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var f=function(){function e(r,i){for(var t=0;t<i.length;t++){var e=i[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,e.key,e)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),v=e("../events"),t=i(v),g=e("../demux/demuxer-inline"),s=i(g),d=e("../demux/demuxer-worker"),h=i(d),a=e("../utils/logger"),c=e("../remux/mp4-remuxer"),n=i(c),o=function(){function i(t){if(u(this,i),this.hls=t,t.config.enableWorker&&"undefined"!=typeof Worker){a.logger.log("demuxing in webworker");try{var r=e("webworkify");this.w=r(h.default),this.onwmsg=this.onWorkerMessage.bind(this),this.w.addEventListener("message",this.onwmsg),this.w.postMessage({cmd:"init"})}catch(e){a.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),this.demuxer=new s.default(t,n.default)}}else this.demuxer=new s.default(t,n.default);this.demuxInitialized=!0}return f(i,[{key:"destroy",value:function(){this.w?(this.w.removeEventListener("message",this.onwmsg),this.w.terminate(),this.w=null):this.demuxer.destroy()}},{key:"push",value:function(e,t,i,r,s,a,n){this.w?this.w.postMessage({cmd:"demux",data:e,audioCodec:t,videoCodec:i,timeOffset:r,cc:s,level:a,duration:n},[e]):(this.demuxer.push(new Uint8Array(e),t,i,r,s,a,n),this.demuxer.remux())}},{key:"onWorkerMessage",value:function(e){switch(e.data.event){case t.default.FRAG_PARSING_INIT_SEGMENT:var i={};e.data.audioMoov&&(i.audioMoov=new Uint8Array(e.data.audioMoov),i.audioCodec=e.data.audioCodec,i.audioChannelCount=e.data.audioChannelCount),e.data.videoMoov&&(i.videoMoov=new Uint8Array(e.data.videoMoov),i.videoCodec=e.data.videoCodec,i.videoWidth=e.data.videoWidth,i.videoHeight=e.data.videoHeight),this.hls.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,i);break;case t.default.FRAG_PARSING_DATA:this.hls.trigger(t.default.FRAG_PARSING_DATA,{moof:new Uint8Array(e.data.moof),mdat:new Uint8Array(e.data.mdat),startPTS:e.data.startPTS,endPTS:e.data.endPTS,startDTS:e.data.startDTS,endDTS:e.data.endDTS,type:e.data.type,nb:e.data.nb});break;case t.default.FRAG_PARSING_METADATA:this.hls.trigger(t.default.FRAG_PARSING_METADATA,{samples:e.data.samples});break;default:this.hls.trigger(e.data.event,e.data.data)}}}]),i}();r.default=o,l.exports=r.default},{"../demux/demuxer-inline":6,"../demux/demuxer-worker":7,"../events":12,"../remux/mp4-remuxer":18,"../utils/logger":19,webworkify:2}],9:[function(t,i,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function e(r,i){for(var t=0;t<i.length;t++){var e=i[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(r,e.key,e)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),a=t("../utils/logger"),n=function(){function e(t){r(this,e),this.data=t,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return s(e,[{key:"loadWord",value:function(){var t=this.data.byteLength-this.bytesAvailable,i=new Uint8Array(4),e=Math.min(4,this.bytesAvailable);if(0===e)throw new Error("no bytes available");i.set(this.data.subarray(t,t+e)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*e,this.bytesAvailable-=e}},{key:"skipBits",value:function(e){var
|
||
|
trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);e.MAJOR_BRAND=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),e.AVC1_BRAND=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),e.MINOR_VERSION=new Uint8Array([0,0,0,1]),e.VIDEO_HDLR=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),e.AUDIO_HDLR=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),e.HDLR_TYPES={video:e.VIDEO_HDLR,audio:e.AUDIO_HDLR},e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO,e.STTS=e.STCO,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]),e.FTYP=e.box(e.types.ftyp,e.MAJOR_BRAND,e.MINOR_VERSION,e.MAJOR_BRAND,e.AVC1_BRAND),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,e.DREF))}},{key:"box",value:function(a){for(var t,s,i=Array.prototype.slice.call(arguments,1),r=0,e=i.length;e--;)r+=i[e].byteLength;for(t=new Uint8Array(r+8),s=new DataView(t.buffer),s.setUint32(0,t.byteLength),t.set(a,4),e=0,r=8;e<i.length;e++)t.set(i[e],r),r+=i[e].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,i){return e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,i,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,i))}},{key:"moov",value:function(t){for(var i=t.length,r=[];i--;)r[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(r).concat(e.mvex(t)))}},{key:"mvex",value:function(i){for(var t=i.length,r=[];t--;)r[t]=e.trex(i[t]);return e.box.apply(null,[e.types.mvex].concat(r))}},{key:"mvhd",value:function(t,i){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24&255,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,r)}},{key:"sdtp",value:function(a){var i,t,r=a.samples||[],s=new Uint8Array(4+r.length);for(t=0;t<r.length;t++)i=r[t].flags,s[t+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return e.box(e.types.sdtp,s)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var i,r=[],s=[];for(i=0;i<t.sps.length;i++)r.push(t.sps[i].byteLength>>>8&255),r.push(255&t.sps[i].byteLength),r=r.concat(Array.prototype.slice.call(t.sps[i]));for(i=0;i<t.pps.length;i++)s.push(t.pps[i].byteLength>>>8&255),s.push(255&t.pps[i].byteLength),s=s.concat(Array.prototype.slice.call(t.pps[i]));return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,t.width>>8&255,255&t.width,t.height>>8&255,255&t.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),e.box(e.types.avcC,new Uint8Array([1,t.profileIdc,t.profileCompat,t.levelIdc,255].concat([t.sps.length]).concat(r).concat([t.pps.le
|