0f25607b by jrivera Committed by David LaPalomento

More fixes for tests and added a watch for automatic building

1 parent 4e23608e
'use strict';
var basename = require('path').basename;
var
basename = require('path').basename,
mediaSourcesPath = 'node_modules/videojs-contrib-media-sources/dist/',
mediaSourcesDebug = mediaSourcesPath + 'videojs-media-sources.js';
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
......@@ -24,16 +27,17 @@ module.exports = function(grunt) {
},
dist: {
nonull: true,
src: ['node_modules/videojs-contrib-media-sources/dist/videojs-media-sources.js',
'src/videojs-hls.js',
'src/xhr.js',
'src/stream.js',
'src/m3u8/m3u8-parser.js',
'src/playlist.js',
'src/playlist-loader.js',
'node_modules/pkcs7/dist/pkcs7.unpad.js',
'src/decrypter.js'
],
src: [
mediaSourcesDebug,
'src/videojs-hls.js',
'src/xhr.js',
'src/stream.js',
'src/m3u8/m3u8-parser.js',
'src/playlist.js',
'src/playlist-loader.js',
'node_modules/pkcs7/dist/pkcs7.unpad.js',
'src/decrypter.js'
],
dest: 'dist/videojs.hls.js'
}
},
......@@ -93,6 +97,10 @@ module.exports = function(grunt) {
}
},
watch: {
build: {
files: '<%= concat.dist.src %>',
tasks: ['clean', 'concat', 'uglify']
},
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
......
This diff could not be displayed because it is too large.
/*! videojs-contrib-hls - v0.17.6 - 2015-08-24
* Copyright (c) 2015 Brightcove; Licensed */
!function(a,b){var c=function(){this.init=function(){var a={};this.on=function(b,c){a[b]||(a[b]=[]),a[b].push(c)},this.off=function(b,c){var d;return a[b]?(d=a[b].indexOf(c),a[b].splice(d,1),d>-1):!1},this.trigger=function(b){var c,d,e,f;if(c=a[b])if(2===arguments.length)for(e=c.length,d=0;e>d;++d)c[d].call(this,arguments[1]);else{for(f=[],d=arguments.length,d=1;d<arguments.length;++d)f.push(arguments[d]);for(e=c.length,d=0;e>d;++d)c[d].apply(this,f)}},this.dispose=function(){a={}}}};c.prototype.pipe=function(a){this.on("data",function(b){a.push(b)})},a.muxjs=a.muxjs||{},a.muxjs.Stream=c}(this),function(a,b){b.ExpGolomb=function(a){var b=a.byteLength,c=0,d=0;this.length=function(){return 8*b},this.bitsAvailable=function(){return 8*b+d},this.loadWord=function(){var e=a.byteLength-b,f=new Uint8Array(4),g=Math.min(4,b);if(0===g)throw new Error("no bytes available");f.set(a.subarray(e,e+g)),c=new DataView(f.buffer).getUint32(0),d=8*g,b-=g},this.skipBits=function(a){var e;d>a?(c<<=a,d-=a):(a-=d,e=Math.floor(a/8),a-=8*e,b-=e,this.loadWord(),c<<=a,d-=a)},this.readBits=function(a){var e=Math.min(d,a),f=c>>>32-e;return console.assert(32>a,"Cannot read more than 32 bits at a time"),d-=e,d>0?c<<=e:b>0&&this.loadWord(),e=a-e,e>0?f<<e|this.readBits(e):f},this.skipLeadingZeros=function(){var a;for(a=0;d>a;++a)if(0!==(c&2147483648>>>a))return c<<=a,d-=a,a;return this.loadWord(),a+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var a=this.skipLeadingZeros();return this.readBits(a+1)-1},this.readExpGolomb=function(){var a=this.readUnsignedExpGolomb();return 1&a?1+a>>>1:-1*(a>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()}}(this,this.muxjs),function(a){a.videojs=a.videojs||{},a.muxjs=a.muxjs||{};var b=a.muxjs;b.FlvTag=function(a,c){var d,e=0,f=function(a,b){var c,d=a.position+b;d<a.bytes.byteLength||(c=new Uint8Array(2*d),c.set(a.bytes.subarray(0,a.position),0),a.bytes=c,a.view=new DataView(a.bytes.buffer))},g=b.FlvTag.widthBytes||new Uint8Array("width".length),h=b.FlvTag.heightBytes||new Uint8Array("height".length),i=b.FlvTag.videocodecidBytes||new Uint8Array("videocodecid".length);if(!b.FlvTag.widthBytes){for(d=0;d<"width".length;d++)g[d]="width".charCodeAt(d);for(d=0;d<"height".length;d++)h[d]="height".charCodeAt(d);for(d=0;d<"videocodecid".length;d++)i[d]="videocodecid".charCodeAt(d);b.FlvTag.widthBytes=g,b.FlvTag.heightBytes=h,b.FlvTag.videocodecidBytes=i}switch(this.keyFrame=!1,a){case b.FlvTag.VIDEO_TAG:this.length=16;break;case b.FlvTag.AUDIO_TAG:this.length=13,this.keyFrame=!0;break;case b.FlvTag.METADATA_TAG:this.length=29,this.keyFrame=!0;break;default:throw"Error Unknown TagType"}this.bytes=new Uint8Array(16384),this.view=new DataView(this.bytes.buffer),this.bytes[0]=a,this.position=this.length,this.keyFrame=c,this.pts=0,this.dts=0,this.writeBytes=function(a,b,c){var d,e=b||0;c=c||a.byteLength,d=e+c,f(this,c),this.bytes.set(a.subarray(e,d),this.position),this.position+=c,this.length=Math.max(this.length,this.position)},this.writeByte=function(a){f(this,1),this.bytes[this.position]=a,this.position++,this.length=Math.max(this.length,this.position)},this.writeShort=function(a){f(this,2),this.view.setUint16(this.position,a),this.position+=2,this.length=Math.max(this.length,this.position)},this.negIndex=function(a){return this.bytes[this.length-a]},this.nalUnitSize=function(){return 0===e?0:this.length-(e+4)},this.startNalUnit=function(){if(e>0)throw new Error("Attempted to create new NAL wihout closing the old one");e=this.length,this.length+=4,this.position=this.length},this.endNalUnit=function(a){var b,c;this.length===e+4?this.length-=4:e>0&&(b=e+4,c=this.length-b,this.position=e,this.view.setUint32(this.position,c),this.position=this.length,a&&a.push(this.bytes.subarray(b,b+c))),e=0},this.writeMetaDataDouble=function(a,b){var c;if(f(this,2+a.length+9),this.view.setUint16(this.position,a.length),this.position+=2,"width"===a)this.bytes.set(g,this.position),this.position+=5;else if("height"===a)this.bytes.set(h,this.position),this.position+=6;else if("videocodecid"===a)this.bytes.set(i,this.position),this.position+=12;else for(c=0;c<a.length;c++)this.bytes[this.position]=a.charCodeAt(c),this.position++;this.position++,this.view.setFloat64(this.position,b),this.position+=8,this.length=Math.max(this.length,this.position),++e},this.writeMetaDataBoolean=function(a,b){var c;for(f(this,2),this.view.setUint16(this.position,a.length),this.position+=2,c=0;c<a.length;c++)console.assert(a.charCodeAt(c)<255),f(this,1),this.bytes[this.position]=a.charCodeAt(c),this.position++;f(this,2),this.view.setUint8(this.position,1),this.position++,this.view.setUint8(this.position,b?1:0),this.position++,this.length=Math.max(this.length,this.position),++e},this.finalize=function(){var a,d;switch(this.bytes[0]){case b.FlvTag.VIDEO_TAG:this.bytes[11]=7|(this.keyFrame||c?16:32),this.bytes[12]=c?0:1,a=this.pts-this.dts,this.bytes[13]=(16711680&a)>>>16,this.bytes[14]=(65280&a)>>>8,this.bytes[15]=(255&a)>>>0;break;case b.FlvTag.AUDIO_TAG:this.bytes[11]=175,this.bytes[12]=c?0:1;break;case b.FlvTag.METADATA_TAG:this.position=11,this.view.setUint8(this.position,2),this.position++,this.view.setUint16(this.position,10),this.position+=2,this.bytes.set([111,110,77,101,116,97,68,97,116,97],this.position),this.position+=10,this.bytes[this.position]=8,this.position++,this.view.setUint32(this.position,e),this.position=this.length,this.bytes.set([0,0,9],this.position),this.position+=3,this.length=this.position}return d=this.length-11,this.bytes[1]=(16711680&d)>>>16,this.bytes[2]=(65280&d)>>>8,this.bytes[3]=(255&d)>>>0,this.bytes[4]=(16711680&this.dts)>>>16,this.bytes[5]=(65280&this.dts)>>>8,this.bytes[6]=(255&this.dts)>>>0,this.bytes[7]=(4278190080&this.dts)>>>24,this.bytes[8]=0,this.bytes[9]=0,this.bytes[10]=0,f(this,4),this.view.setUint32(this.length,this.length),this.length+=4,this.position+=4,this.bytes=this.bytes.subarray(0,this.length),this.frameTime=b.FlvTag.frameTime(this.bytes),console.assert(this.bytes.byteLength===this.length),this}},b.FlvTag.AUDIO_TAG=8,b.FlvTag.VIDEO_TAG=9,b.FlvTag.METADATA_TAG=18,b.FlvTag.isAudioFrame=function(a){return b.FlvTag.AUDIO_TAG===a[0]},b.FlvTag.isVideoFrame=function(a){return b.FlvTag.VIDEO_TAG===a[0]},b.FlvTag.isMetaData=function(a){return b.FlvTag.METADATA_TAG===a[0]},b.FlvTag.isKeyFrame=function(a){return b.FlvTag.isVideoFrame(a)?23===a[11]:b.FlvTag.isAudioFrame(a)?!0:b.FlvTag.isMetaData(a)?!0:!1},b.FlvTag.frameTime=function(a){var b=a[4]<<16;return b|=a[5]<<8,b|=a[6]<<0,b|=a[7]<<24}}(this),function(a){var b=a.muxjs.FlvTag,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3];a.muxjs.AacStream=function(){var a,d,e,f,g,h,i,j,k,l,m,n,o;this.tags=[],this.setTimeStampOffset=function(a){f=a-1e3},this.setNextTimeStamp=function(b,c,f){a=b,e=c,f&&(d=0)},this.writeBytes=function(p,q,r){var s,t,u;for(q=q||0,r=r||0,r=r>e?e:r,e-=r,s=q+r;s>q;)switch(d){default:d=0;break;case 0:if(q>=s)return;if(255!==p[q])return console.assert(!1,"Error no ATDS header found"),q+=1,void(d=0);q+=1,d=1;break;case 1:if(q>=s)return;if(240!==(240&p[q]))return console.assert(!1,"Error no ATDS header found"),q+=1,void(d=0);g=!!(1&p[q]),q+=1,d=2;break;case 2:if(q>=s)return;h=((192&p[q])>>>6)+1,i=(60&p[q])>>>2,j=(1&p[q])<<2,q+=1,d=3;break;case 3:if(q>=s)return;j|=(192&p[q])>>>6,k=(3&p[q])<<11,q+=1,d=4;break;case 4:if(q>=s)return;k|=p[q]<<3,q+=1,d=5;break;case 5:if(q>=s)return;k|=(224&p[q])>>>5,k-=g?7:9,q+=1,d=6;break;case 6:if(q>=s)return;l=1024*((3&p[q])+1),m=1e3*l/c[i],t=h<<11|i<<7|j<<3,(t!==o||a-f>=1e3)&&(n=new b(b.METADATA_TAG),n.pts=a,n.dts=a,n.writeMetaDataDouble("audiocodecid",10),n.writeMetaDataBoolean("stereo",2===j),n.writeMetaDataDouble("audiosamplerate",c[i]),n.writeMetaDataDouble("audiosamplesize",16),this.tags.push(n),o=t,n=new b(b.AUDIO_TAG,!0),n.pts=a,n.dts=n.pts,n.view.setUint16(n.position,t),n.position+=2,n.length=Math.max(n.length,n.position),this.tags.push(n),f=a),q+=1,d=7;break;case 7:if(!g){if(2>s-q)return;q+=2}n=new b(b.AUDIO_TAG),n.pts=a,n.dts=a,d=8;break;case 8:for(;k;){if(q>=s)return;u=k>s-q?s-q:k,n.writeBytes(p,q,u),q+=u,k-=u}this.tags.push(n),d=0,a+=m}}}}(this),function(a){var b,c,d=a.muxjs.FlvTag,e=a.muxjs.H264ExtraData;a.muxjs.NALUnitType=c={unspecified:0,slice_layer_without_partitioning_rbsp_non_idr:1,slice_data_partition_a_layer_rbsp:2,slice_data_partition_b_layer_rbsp:3,slice_data_partition_c_layer_rbsp:4,slice_layer_without_partitioning_rbsp_idr:5,sei_rbsp:6,seq_parameter_set_rbsp:7,pic_parameter_set_rbsp:8,access_unit_delimiter_rbsp:9,end_of_seq_rbsp:10,end_of_stream_rbsp:11},a.muxjs.H264Stream=b=function(){this._next_pts=0,this._next_dts=0,this._h264Frame=null,this._oldExtraData=new e,this._newExtraData=new e,this._nalUnitType=-1,this._state=0,this.tags=[]},b.prototype.setTimeStampOffset=function(){},b.prototype.setNextTimeStamp=function(a,b,c){this._next_pts=a,this._next_dts=b,c&&this.finishFrame()},b.prototype.finishFrame=function(){this._h264Frame&&(this._newExtraData.extraDataExists()&&(this._oldExtraData=this._newExtraData,this._newExtraData=new e),this._oldExtraData.extraDataExists()&&(this._h264Frame.keyFrame||0===this.tags.length)&&(this.tags.push(this._oldExtraData.metaDataTag(this._h264Frame.pts)),this.tags.push(this._oldExtraData.extraDataTag(this._h264Frame.pts))),this._h264Frame.endNalUnit(),this.tags.push(this._h264Frame)),this._h264Frame=null,this._nalUnitType=-1,this._state=0},b.prototype.writeBytes=function(a,b,e){var f,g,h,i;if(b=b||0,e=e||0,!(0>=e))switch(this._state){default:case 0:this._state=1;case 1:if(a[b]<=1&&(f=this._h264Frame?this._h264Frame.nalUnitSize():0,f>=1&&0===this._h264Frame.negIndex(1))){if(1===a[b]&&f>=2&&0===this._h264Frame.negIndex(2))return f>=3&&0===this._h264Frame.negIndex(3)?this._h264Frame.length-=3:this._h264Frame.length-=2,this._state=3,this.writeBytes(a,b+1,e-1);if(e>1&&0===a[b]&&1===a[b+1])return f>=2&&0===this._h264Frame.negIndex(2)?this._h264Frame.length-=2:this._h264Frame.length-=1,this._state=3,this.writeBytes(a,b+2,e-2);if(e>2&&0===a[b]&&0===a[b+1]&&1===a[b+2])return this._state=3,this.writeBytes(a,b+3,e-3)}this._state=2;case 2:for(g=b,h=g+e,i=h-3;i>b;)if(a[b+2]>1)b+=3;else if(0!==a[b+1])b+=2;else if(0!==a[b])b+=1;else{if(1===a[b+2])return b>g&&this._h264Frame.writeBytes(a,g,b-g),this._state=3,b+=3,this.writeBytes(a,b,h-b);if(h-b>=4&&0===a[b+2]&&1===a[b+3])return b>g&&this._h264Frame.writeBytes(a,g,b-g),this._state=3,b+=4,this.writeBytes(a,b,h-b);b+=3}return this._state=1,void(this._h264Frame&&this._h264Frame.writeBytes(a,g,e));case 3:if(this._h264Frame)switch(this._nalUnitType){case c.seq_parameter_set_rbsp:this._h264Frame.endNalUnit(this._newExtraData.sps);break;case c.pic_parameter_set_rbsp:this._h264Frame.endNalUnit(this._newExtraData.pps);break;case c.slice_layer_without_partitioning_rbsp_idr:this._h264Frame.endNalUnit();break;default:this._h264Frame.endNalUnit()}return this._nalUnitType=31&a[b],this._h264Frame&&(this._nalUnitType===c.access_unit_delimiter_rbsp?this.finishFrame():this._nalUnitType===c.slice_layer_without_partitioning_rbsp_idr&&(this._h264Frame.keyFrame=!0)),this._h264Frame||(this._h264Frame=new d(d.VIDEO_TAG),this._h264Frame.pts=this._next_pts,this._h264Frame.dts=this._next_dts),this._h264Frame.startNalUnit(),this._state=2,this.writeBytes(a,b,e)}}}(this),function(a,b,c){"use strict";var d,e=function(a,b,c){var d,e="";for(d=b;c>d;d++)e+="%"+("00"+a[d].toString(16)).slice(-2);return e},f=function(b,c,d){return a.decodeURIComponent(e(b,c,d))},g=function(b,c,d){return a.unescape(e(b,c,d))},h={TXXX:function(a){var b;if(3===a.data[0])for(b=1;b<a.data.length;b++)if(0===a.data[b]){a.description=f(a.data,1,b),a.value=f(a.data,b+1,a.data.length-1);break}},WXXX:function(a){var b;if(3===a.data[0])for(b=1;b<a.data.length;b++)if(0===a.data[b]){a.description=f(a.data,1,b),a.url=f(a.data,b+1,a.data.length);break}},PRIV:function(a){var b;for(b=0;b<a.data.length;b++)if(0===a.data[b]){a.owner=g(a.data,0,b);break}a.privateData=a.data.subarray(b+1)}};d=function(a){var c,e={debug:!(!a||!a.debug),descriptor:a&&a.descriptor},f=0,g=[],i=0;if(d.prototype.init.call(this),this.dispatchType=b.SegmentParser.STREAM_TYPES.metadata.toString(16),e.descriptor)for(c=0;c<e.descriptor.length;c++)this.dispatchType+=("00"+e.descriptor[c].toString(16)).slice(-2);this.push=function(a){var b,c,d,j,k;if(0===g.length&&(a.data.length<10||a.data[0]!=="I".charCodeAt(0)||a.data[1]!=="D".charCodeAt(0)||a.data[2]!=="3".charCodeAt(0)))return void(e.debug&&console.log("Skipping unrecognized metadata packet"));if(g.push(a),i+=a.data.byteLength,1===g.length&&(f=a.data[6]<<21|a.data[7]<<14|a.data[8]<<7|a.data[9],f+=10),!(f>i)){for(b={data:new Uint8Array(f),frames:[],pts:g[0].pts,dts:g[0].dts},k=0;f>k;)b.data.set(g[0].data,k),k+=g[0].data.byteLength,i-=g[0].data.byteLength,g.shift();c=10,64&b.data[5]&&(c+=4,c+=b.data[10]<<24|b.data[11]<<16|b.data[12]<<8|b.data[13],f-=b.data[16]<<24|b.data[17]<<16|b.data[18]<<8|b.data[19]);do{if(d=b.data[c+4]<<24|b.data[c+5]<<16|b.data[c+6]<<8|b.data[c+7],1>d)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");j={id:String.fromCharCode(b.data[c],b.data[c+1],b.data[c+2],b.data[c+3]),data:b.data.subarray(c+10,c+d+10)},h[j.id]&&h[j.id](j),b.frames.push(j),c+=10,c+=d}while(f>c);this.trigger("data",b)}}},d.prototype=new b.Stream,b.MetadataStream=d}(window,window.muxjs),function(){var a,b=window.muxjs.ExpGolomb,c=window.muxjs.FlvTag;window.muxjs.H264ExtraData=a=function(){this.sps=[],this.pps=[]},a.prototype.extraDataExists=function(){return this.sps.length>0},a.prototype.scaling_list=function(a,b){var c,d,e=8,f=8;for(c=0;a>c;++c)0!==f&&(d=b.readExpGolomb(),f=(e+d+256)%256),e=0===f?e:f},a.prototype.getSps0Rbsp=function(){for(var a=this.sps[0],b=1,c=1,d=0,e=a.byteLength-2,f=new Uint8Array(a.byteLength);e>b;)0===a[b]&&0===a[b+1]&&3===a[b+2]&&(f.set(a.subarray(c,b+1),d),d+=b+1-c,c=b+3),b++;return f.set(a.subarray(c),d),f.subarray(0,d+(a.byteLength-c))},a.prototype.metaDataTag=function(a){var d,e,f,g,h,i,j,k,l,m,n,o,p,q=new c(c.METADATA_TAG),r=0,s=0,t=0,u=0;if(q.dts=a,q.pts=a,d=new b(this.getSps0Rbsp()),e=d.readUnsignedByte(),d.skipBits(16),d.skipUnsignedExpGolomb(),(100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e)&&(f=d.readUnsignedExpGolomb(),3===f&&d.skipBits(1),d.skipUnsignedExpGolomb(),d.skipUnsignedExpGolomb(),d.skipBits(1),d.readBoolean()))for(g=3!==f?8:12,h=0;g>h;++h)d.readBoolean()&&(6>h?this.scaling_list(16,d):this.scaling_list(64,d));if(d.skipUnsignedExpGolomb(),i=d.readUnsignedExpGolomb(),0===i)d.readUnsignedExpGolomb();else if(1===i)for(d.skipBits(1),d.skipExpGolomb(),d.skipExpGolomb(),j=d.readUnsignedExpGolomb(),h=0;j>h;++h)d.skipExpGolomb();return d.skipUnsignedExpGolomb(),d.skipBits(1),k=d.readUnsignedExpGolomb(),l=d.readUnsignedExpGolomb(),m=d.readBits(1),0===m&&d.skipBits(1),d.skipBits(1),n=d.readBoolean(),n&&(r=d.readUnsignedExpGolomb(),s=d.readUnsignedExpGolomb(),t=d.readUnsignedExpGolomb(),u=d.readUnsignedExpGolomb()),o=16*(k+1)-2*r-2*s,p=(2-m)*(l+1)*16-2*t-2*u,q.writeMetaDataDouble("videocodecid",7),q.writeMetaDataDouble("width",o),q.writeMetaDataDouble("height",p),q},a.prototype.extraDataTag=function(a){var b,d=new c(c.VIDEO_TAG,!0);for(d.dts=a,d.pts=a,d.writeByte(1),d.writeByte(this.sps[0][1]),d.writeByte(this.sps[0][2]),d.writeByte(this.sps[0][3]),d.writeByte(255),d.writeByte(225),d.writeShort(this.sps[0].length),d.writeBytes(this.sps[0]),d.writeByte(this.pps.length),b=0;b<this.pps.length;++b)d.writeShort(this.pps[b].length),d.writeBytes(this.pps[b]);return d}}(),function(a){var b,c,d=muxjs.FlvTag,e=muxjs.H264Stream,f=muxjs.AacStream,g=muxjs.MetadataStream;muxjs.SegmentParser=function(){var a,h=this,i=new Uint8Array(b),j=0,k=new e,l=new f;h.stream={programMapTable:{}},h.metadataStream=new g,h.getFlvHeader=function(a,b,c){var e,f,g,h=new Uint8Array(9),i=new DataView(h.buffer);return a=a||0,b=void 0===b?!0:b,c=void 0===c?!0:c,i.setUint8(0,70),i.setUint8(1,76),i.setUint8(2,86),i.setUint8(3,1),i.setUint8(4,(b?4:0)|(c?1:0)),i.setUint32(5,h.byteLength),0>=a?(f=new Uint8Array(h.byteLength+4),f.set(h),f.set([0,0,0,0],h.byteLength),f):(e=new d(d.METADATA_TAG),e.pts=e.dts=0,e.writeMetaDataDouble("duration",a),g=e.finalize().length,f=new Uint8Array(h.byteLength+g),f.set(h),f.set(i.byteLength,g),f)},h.flushTags=function(){k.finishFrame()},h.tagsAvailable=function(){return k.tags.length+l.tags.length},h.getNextTag=function(){var a;return a=k.tags.length?l.tags.length&&l.tags[0].dts<k.tags[0].dts?l.tags.shift():k.tags.shift():l.tags.shift(),a.finalize()},h.parseSegmentBinaryData=function(c){var d,e=0;if(j>0){if(c.byteLength+j<b)return console.log("data.length + streamBuffer.length < MP2T_PACKET_LENGTH ??"),void i.readBytes(c,c.length,i.length);d=c.subarray(0,b-j),i.set(d,j),a(i),i=new Uint8Array(b),j=0}for(;;){for(;e<c.byteLength&&71!==c[e];)e++;if(c.byteLength-e<b)return void(c.byteLength-e>0&&(i.set(c.subarray(e),j),j+=c.byteLength-e));a(c.subarray(e,e+b))?e+=b:(console.log("error parsing m2ts packet, attempting to re-align"),e++)}},a=function(a){var d,e,f,g,i,j,m,n,o,p,q,r,s,t,u,v,w,x,y=0,z=y+b,A=!!(64&a[y+1]),B=(31&a[y+1])<<8|a[y+2],C=(48&a[y+3])>>>4;if(y+=4,C>1&&(y+=a[y]+1),0===B){if(A&&(y+=1+a[y]),d=a[y],0!==d&&console.log("the table_id of the PAT should be 0x00 but was"+d.toString(16)),e=!!(1&a[y+5]))for(f=(15&a[y+1])<<8|a[y+2],y+=8,j=y+(f-5-4);j>y;y+=4)if(g=a[y]<<8|a[y+1],i=(31&a[y+2])<<8|a[y+3],0===g)h.stream.networkPid=i;else if(void 0===h.stream.pmtPid)h.stream.pmtPid=i;else if(h.stream.pmtPid!==i)throw new Error("TS has more that 1 program")}else if(B===h.stream.programMapTable[c.h264]||B===h.stream.programMapTable[c.adts]||B===h.stream.programMapTable[c.metadata]){if(A){if(0!==a[y+0]||0!==a[y+1]||1!==a[y+2])throw new Error("PES did not begin with start code");m=a[y+4]<<8|a[y+5],n=0!==(4&a[y+6]),o=a[y+7],p=a[y+8],y+=9,192&o&&(q=(14&a[y+0])<<28|(255&a[y+1])<<21|(254&a[y+2])<<13|(255&a[y+3])<<6|(254&a[y+4])>>>2,q/=45,r=q,64&o&&(r=(14&a[y+5])<<28|(255&a[y+6])<<21|(254&a[y+7])<<13|(255&a[y+8])<<6|(254&a[y+9])>>>2,r/=45)),y+=p,B===h.stream.programMapTable[c.h264]?k.setNextTimeStamp(q,r,n):B===h.stream.programMapTable[c.adts]&&l.setNextTimeStamp(q,m,n)}B===h.stream.programMapTable[c.adts]?l.writeBytes(a,y,z-y):B===h.stream.programMapTable[c.h264]?k.writeBytes(a,y,z-y):B===h.stream.programMapTable[c.metadata]&&h.metadataStream.push({pts:q,dts:r,data:a.subarray(y)})}else if(h.stream.pmtPid===B){if(A&&(y+=1+a[y]),2!==a[y]&&console.log("The table_id of a PMT should be 0x02 but was "+a[y].toString(16)),s=!!(1&a[y+5]))for(h.stream.programMapTable={},u=(15&a[y+1])<<8|a[y+2],t=(15&a[y+10])<<8|a[y+11],u-=t,u-=13,h.stream.programMapTable.pcrPid=(31&a[y+8])<<8|a[y+9],y+=12+t;u>0;){if(v=a[y+0],w=(31&a[y+1])<<8|a[y+2],v===c.h264&&h.stream.programMapTable[v]&&h.stream.programMapTable[v]!==w)throw new Error("Program has more than 1 video stream");if(v===c.adts&&h.stream.programMapTable[v]&&h.stream.programMapTable[v]!==w)throw new Error("Program has more than 1 audio Stream");h.stream.programMapTable[v]=w,x=(15&a[y+3])<<8|a[y+4],v===c.metadata&&(h.metadataStream.descriptor=new Uint8Array(a.subarray(y+5,y+5+x))),y+=5+x,u-=5+x}}else h.stream.networkPid===B||17===B||8191===B||h.stream.programMapTable.pcrPid||console.log("Unknown PID parsing TS packet: "+B);return!0},h.getTags=function(){return k.tags},h.stats={h264Tags:function(){return k.tags.length},minVideoPts:function(){return k.tags[0].pts},maxVideoPts:function(){return k.tags[k.tags.length-1].pts},aacTags:function(){return l.tags.length},minAudioPts:function(){return l.tags[0].pts},maxAudioPts:function(){return l.tags[l.tags.length-1].pts}}},muxjs.SegmentParser.MP2T_PACKET_LENGTH=b=188,muxjs.SegmentParser.STREAM_TYPES=c={h264:27,adts:15,metadata:21}}(window),function(a,b,c){"use strict";var d,e,f,g,h,i=0,j=videojs.EventTarget,k="blob:vjs-media-source/";d={mode:"auto"},videojs.MediaSource=videojs["extends"](j,{constructor:function(b){var c;return this.settings_=videojs.mergeOptions(d,b),"auto"===this.settings_.mode&&videojs.MediaSource.supportsNativeMediaSources()||"html5"===this.settings_.mode?(c=new a.MediaSource,f(c),c):new videojs.FlashMediaSource}}),videojs.MediaSource.supportsNativeMediaSources=function(){return!!a.MediaSource},f=function(a){a.virtualBuffers=[],a.addSourceBuffer_=a.addSourceBuffer,a.addSourceBuffer=g},g=function(a){var b,c,d;return"video/mp2t"===a?(b=this.addSourceBuffer_("audio/mp4;codecs=mp4a.40.2"),c=this.addSourceBuffer_("video/mp4;codecs=avc1.4d400d"),d=new e(b,c),this.virtualBuffers.push(d),d):this.addSourceBuffer_(a)},e=videojs["extends"](j,{constructor:function(a,b){this.audioBuffer_=a,this.audioUpdating_=!1,this.videoBuffer_=b,this.videoUpdating_=!1,this.transmuxer_=new Worker(URL.createObjectURL(new Blob(['var muxjs={};!function(a,b){b.ExpGolomb=function(a){var b=a.byteLength,c=0,d=0;this.length=function(){return 8*b},this.bitsAvailable=function(){return 8*b+d},this.loadWord=function(){var e=a.byteLength-b,f=new Uint8Array(4),g=Math.min(4,b);if(0===g)throw new Error("no bytes available");f.set(a.subarray(e,e+g)),c=new DataView(f.buffer).getUint32(0),d=8*g,b-=g},this.skipBits=function(a){var e;d>a?(c<<=a,d-=a):(a-=d,e=Math.floor(a/8),a-=8*e,b-=e,this.loadWord(),c<<=a,d-=a)},this.readBits=function(a){var e=Math.min(d,a),f=c>>>32-e;return console.assert(32>a,"Cannot read more than 32 bits at a time"),d-=e,d>0?c<<=e:b>0&&this.loadWord(),e=a-e,e>0?f<<e|this.readBits(e):f},this.skipLeadingZeros=function(){var a;for(a=0;d>a;++a)if(0!==(c&2147483648>>>a))return c<<=a,d-=a,a;return this.loadWord(),a+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var a=this.skipLeadingZeros();return this.readBits(a+1)-1},this.readExpGolomb=function(){var a=this.readUnsignedExpGolomb();return 1&a?1+a>>>1:-1*(a>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()}}(this,this.muxjs),function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P;O=a.Uint8Array,P=a.DataView,function(){var a;A={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]};for(a in A)A.hasOwnProperty(a)&&(A[a]=[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)]);B=new O(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),D=new O(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),C=new O([0,0,0,1]),E=new O([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]),F=new O([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]),G={video:E,audio:F},J=new O([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),I=new O([0,0,0,0,0,0,0,0]),K=new O([0,0,0,0,0,0,0,0]),L=K,M=new O([0,0,0,0,0,0,0,0,0,0,0,0]),N=K,H=new O([0,0,0,1,0,0,0,0,0,0,0,0])}(),d=function(a){var b,c,d,e=[],f=0;for(b=1;b<arguments.length;b++)e.push(arguments[b]);for(b=e.length;b--;)f+=e[b].byteLength;for(c=new O(f+8),d=new P(c.buffer,c.byteOffset,c.byteLength),d.setUint32(0,c.byteLength),c.set(a,4),b=0,f=8;b<e.length;b++)c.set(e[b],f),f+=e[b].byteLength;return c},e=function(){return d(A.dinf,d(A.dref,J))},f=function(a){return d(A.esds,new O([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,a.audioobjecttype<<3|a.samplingfrequencyindex>>>1,a.samplingfrequencyindex<<7|a.channelcount<<3,6,1,2]))},g=function(){return d(A.ftyp,B,C,B,D)},s=function(a){return d(A.hdlr,G[a])},h=function(a){return d(A.mdat,a)},r=function(a){var b=new O([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,a.duration>>>24,a.duration>>>16&255,a.duration>>>8&255,255&a.duration,85,196,0,0]);return a.samplerate&&(b[12]=a.samplerate>>>24,b[13]=a.samplerate>>>16&255,b[14]=a.samplerate>>>8&255,b[15]=255&a.samplerate),d(A.mdhd,b)},q=function(a){return d(A.mdia,r(a),s(a.type),j(a))},i=function(a){return d(A.mfhd,new O([0,0,0,0,(4278190080&a)>>24,(16711680&a)>>16,(65280&a)>>8,255&a]))},j=function(a){return d(A.minf,"video"===a.type?d(A.vmhd,H):d(A.smhd,I),e(),u(a))},k=function(a,b){for(var c=[],e=b.length;e--;)c[e]=x(b[e]);return d.apply(null,[A.moof,i(a)].concat(c))},l=function(a){for(var b=a.length,c=[];b--;)c[b]=o(a[b]);return d.apply(null,[A.moov,n(4294967295)].concat(c).concat(m(a)))},m=function(a){for(var b=a.length,c=[];b--;)c[b]=y(a[b]);return d.apply(null,[A.mvex].concat(c))},n=function(a){var b=new O([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&a)>>24,(16711680&a)>>16,(65280&a)>>8,255&a,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 d(A.mvhd,b)},t=function(a){var b,c,e=a.samples||[],f=new O(4+e.length);for(c=0;c<e.length;c++)b=e[c].flags,f[c+4]=b.dependsOn<<4|b.isDependedOn<<2|b.hasRedundancy;return d(A.sdtp,f)},u=function(a){return d(A.stbl,v(a),d(A.stts,N),d(A.stsc,L),d(A.stsz,M),d(A.stco,K))},function(){var a,b;v=function(c){return d(A.stsd,new O([0,0,0,0,0,0,0,1]),"video"===c.type?a(c):b(c))},a=function(a){var b,c=a.sps||[],e=a.pps||[],f=[],g=[];for(b=0;b<c.length;b++)f.push((65280&c[b].byteLength)>>>8),f.push(255&c[b].byteLength),f=f.concat(Array.prototype.slice.call(c[b]));for(b=0;b<e.length;b++)g.push((65280&e[b].byteLength)>>>8),g.push(255&e[b].byteLength),g=g.concat(Array.prototype.slice.call(e[b]));return d(A.avc1,new O([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&a.width)>>8,255&a.width,(65280&a.height)>>8,255&a.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]),d(A.avcC,new O([1,a.profileIdc,a.profileCompatibility,a.levelIdc,255].concat([c.length]).concat(f).concat([e.length]).concat(g))),d(A.btrt,new O([0,28,156,128,0,45,198,192,0,45,198,192])))},b=function(a){return d(A.mp4a,new O([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&a.channelcount)>>8,255&a.channelcount,(65280&a.samplesize)>>8,255&a.samplesize,0,0,0,0,(65280&a.samplerate)>>8,255&a.samplerate,0,0]),f(a))}}(),w=function(){return d(A.styp,B,C,B)},p=function(a){var b=new O([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&a.id)>>24,(16711680&a.id)>>16,(65280&a.id)>>8,255&a.id,0,0,0,0,(4278190080&a.duration)>>24,(16711680&a.duration)>>16,(65280&a.duration)>>8,255&a.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,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,(65280&a.width)>>8,255&a.width,0,0,(65280&a.height)>>8,255&a.height,0,0]);return d(A.tkhd,b)},x=function(a){var b,c,e,f,g;return b=d(A.tfhd,new O([0,0,0,58,(4278190080&a.id)>>24,(16711680&a.id)>>16,(65280&a.id)>>8,255&a.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),c=d(A.tfdt,new O([0,0,0,0,0,0,0,0])),g=88,"audio"===a.type?(e=z(a,g),d(A.traf,b,c,e)):(f=t(a),e=z(a,f.length+g),d(A.traf,b,c,e,f))},o=function(a){return a.duration=a.duration||4294967295,d(A.trak,p(a),q(a))},y=function(a){var b=new O([0,0,0,0,(4278190080&a.id)>>24,(16711680&a.id)>>16,(65280&a.id)>>8,255&a.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==a.type&&(b[b.length-1]=0),d(A.trex,b)},function(){var a,b,e;e=function(a,b){var d=0,e=0,f=0,g=0;return a.length&&(a[0].duration!==c&&(d=1),a[0].size!==c&&(e=2),a[0].flags!==c&&(f=4),a[0].compositionTimeOffset!==c&&(g=8)),[0,0,d|e|f|g,1,(4278190080&a.length)>>>24,(16711680&a.length)>>>16,(65280&a.length)>>>8,255&a.length,(4278190080&b)>>>24,(16711680&b)>>>16,(65280&b)>>>8,255&b]},b=function(a,b){var c,f,g,h;for(f=a.samples||[],b+=20+16*f.length,c=e(f,b),h=0;h<f.length;h++)g=f[h],c=c.concat([(4278190080&g.duration)>>>24,(16711680&g.duration)>>>16,(65280&g.duration)>>>8,255&g.duration,(4278190080&g.size)>>>24,(16711680&g.size)>>>16,(65280&g.size)>>>8,255&g.size,g.flags.isLeading<<2|g.flags.dependsOn,g.flags.isDependedOn<<6|g.flags.hasRedundancy<<4|g.flags.paddingValue<<1|g.flags.isNonSyncSample,61440&g.flags.degradationPriority,15&g.flags.degradationPriority,(4278190080&g.compositionTimeOffset)>>>24,(16711680&g.compositionTimeOffset)>>>16,(65280&g.compositionTimeOffset)>>>8,255&g.compositionTimeOffset]);return d(A.trun,new O(c))},a=function(a,b){var c,f,g,h;for(f=a.samples||[],b+=20+8*f.length,c=e(f,b),h=0;h<f.length;h++)g=f[h],c=c.concat([(4278190080&g.duration)>>>24,(16711680&g.duration)>>>16,(65280&g.duration)>>>8,255&g.duration,(4278190080&g.size)>>>24,(16711680&g.size)>>>16,(65280&g.size)>>>8,255&g.size]);return d(A.trun,new O(c))},z=function(c,d){return"audio"===c.type?a(c,d):b(c,d)}}(),b.mp4={ftyp:g,mdat:h,moof:k,moov:l,initSegment:function(a){var b,c=g(),d=l(a);return b=new O(c.byteLength+d.byteLength),b.set(c),b.set(d,c.byteLength),b}}}(this,this.muxjs),function(a,b){var c=function(){this.init=function(){var a={};this.on=function(b,c){a[b]||(a[b]=[]),a[b].push(c)},this.off=function(b,c){var d;return a[b]?(d=a[b].indexOf(c),a[b].splice(d,1),d>-1):!1},this.trigger=function(b){var c,d,e,f;if(c=a[b])if(2===arguments.length)for(e=c.length,d=0;e>d;++d)c[d].call(this,arguments[1]);else{for(f=[],d=arguments.length,d=1;d<arguments.length;++d)f.push(arguments[d]);for(e=c.length,d=0;e>d;++d)c[d].apply(this,f)}},this.dispose=function(){a={}}}};c.prototype.pipe=function(a){this.on("data",function(b){a.push(b)})},a.muxjs=a.muxjs||{},a.muxjs.Stream=c}(this),function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q;m=188,n=27,o=15,p=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],q=b.mp4,d=function(){var a=new Uint8Array(m),b=0;d.prototype.init.call(this),this.push=function(c){var d,e;if(b>0){if(d=m-b,a.set(c.subarray(0,d),b),c.byteLength<d)return void(b+=c.byteLength);c=c.subarray(d),b=0,this.trigger("data",a)}if(c.byteLength<m)return a.set(c.subarray(e),b),void(b+=c.byteLength);e=0;do this.trigger("data",c.subarray(e,e+m)),e+=m,d=c.byteLength-e;while(e<c.byteLength&&d>=m);d>0&&(a.set(c.subarray(e)),b=d)}},d.prototype=new b.Stream,e=function(){var a,b,c,d,f;e.prototype.init.call(this),f=this,this.programMapTable={},a=function(a,d){var e=0;d.payloadUnitStartIndicator&&(e+=a[e]+1),"pat"===d.type?b(a.subarray(e),d):c(a.subarray(e),d)},b=function(a,b){b.section_number=a[7],b.last_section_number=a[8],f.pmtPid=(31&a[10])<<8|a[11],b.pmtPid=f.pmtPid},c=function(a,b){var c,d,e,g;if(1&a[5]){for(f.programMapTable={},c=(15&a[1])<<8|a[2],d=3+c-4,e=(15&a[10])<<8|a[11],g=12+e;d>g;)f.programMapTable[(31&a[g+1])<<8|a[g+2]]=a[g],g+=((15&a[g+3])<<8|a[g+4])+5;b.programMapTable=f.programMapTable}},d=function(a,b){var c;return b.payloadUnitStartIndicator?(b.dataAlignmentIndicator=0!==(4&a[6]),c=a[7],192&c&&(b.pts=(14&a[9])<<28|(255&a[10])<<21|(254&a[11])<<13|(255&a[12])<<6|(254&a[13])>>>2,b.pts*=2,b.pts+=2&a[13],b.dts=b.pts,64&c&&(b.dts=(14&a[14])<<28|(255&a[15])<<21|(254&a[16])<<13|(255&a[17])<<6|(254&a[18])>>>2,b.dts*=2,b.dts+=2&a[18])),void(b.data=a.subarray(9+a[8]))):void(b.data=a)},this.push=function(b){var c={},e=4;return 71!==b[0]?this.trigger("error","mis-aligned packet"):(c.payloadUnitStartIndicator=!!(64&b[1]),c.pid=31&b[1],c.pid<<=8,c.pid|=b[2],(48&b[3])>>>4>1&&(e+=b[e]+1),0===c.pid?(c.type="pat",a(b.subarray(e),c)):c.pid===this.pmtPid?(c.type="pmt",a(b.subarray(e),c)):(c.streamType=this.programMapTable[c.pid],c.type="pes",d(b.subarray(e),c)),void this.trigger("data",c))}},e.prototype=new b.Stream,e.STREAM_TYPES={h264:27,adts:15},f=function(){var a,b={data:[],size:0},c={data:[],size:0},d=function(b,c){var d,e={type:c,data:new Uint8Array(b.size)},f=0;if(b.data.length){for(e.trackId=b.data[0].pid,e.pts=b.data[0].pts,e.dts=b.data[0].dts;b.data.length;)d=b.data.shift(),e.data.set(d.data,f),f+=d.data.byteLength;b.size=0,a.trigger("data",e)}};f.prototype.init.call(this),a=this,this.push=function(e){({pat:function(){},pes:function(){var a,f;switch(e.streamType){case n:a=b,f="video";break;case o:a=c,f="audio";break;default:return}e.payloadUnitStartIndicator&&d(a,f),a.data.push(e),a.size+=e.data.byteLength},pmt:function(){var b,c,d={type:"metadata",tracks:[]},f=e.programMapTable;for(b in f)f.hasOwnProperty(b)&&(c={},c.id=+b,f[b]===n?(c.codec="avc",c.type="video"):f[b]===o&&(c.codec="adts",c.type="audio"),d.tracks.push(c));a.trigger("data",d)}})[e.type]()},this.flush=function(){d(b,"video"),d(c,"audio")}},f.prototype=new b.Stream,j=function(){var a,b,c=1;j.prototype.init.call(this),a=this,this.push=function(a){var d;if("audio"===a.type)for(b=a.data;c+4<b.length;)d=(3&b[c+2])<<11|b[c+3]<<3|(224&b[c+4])>>5,this.trigger("data",{audioobjecttype:(b[c+1]>>>6&3)+1,channelcount:(1&b[c+1])<<3|(192&b[c+2])>>>6,samplerate:p[(60&b[c+1])>>>2],samplingfrequencyindex:(60&b[c+1])>>>2,samplesize:16,data:b.subarray(c+6,c+d-1)}),b=b.subarray(c+d-1),c=1}},j.prototype=new b.Stream,h=function(a){var b=[],c=0,d=0;h.prototype.init.call(this),this.push=function(a){b.push(a),c+=a.data.byteLength},this.flush=function(){var e,f,g,h,i,j,k;if(0!==c){for(g=new Uint8Array(c),a.samples=[],i=0;b.length;)f=b[0],h={size:f.data.byteLength,duration:1024},a.samples.push(h),g.set(f.data,i),i+=f.data.byteLength,b.shift();c=0,j=q.mdat(g),k=q.moof(d,[a]),e=new Uint8Array(k.byteLength+j.byteLength),d++,e.set(k),e.set(j,k.byteLength),this.trigger("data",e)}}},h.prototype=new b.Stream,l=function(){var a,b,c=1;l.prototype.init.call(this),this.push=function(d){var e;for(b?(e=new Uint8Array(b.byteLength+d.data.byteLength),e.set(b),e.set(d.data,b.byteLength),b=e):b=d.data;c<b.byteLength-3;c++)if(1===b[c+2]){a=c+5;break}for(;a<b.byteLength;)switch(b[a]){case 0:if(0!==b[a-1]){a+=2;break}if(0!==b[a-2]){a++;break}this.trigger("data",b.subarray(c+3,a-2));do a++;while(1!==b[a]&&a<b.length);c=a-2,a+=3;break;case 1:if(0!==b[a-1]||0!==b[a-2]){a+=3;break}this.trigger("data",b.subarray(c+3,a-2)),c=a-2,a+=3;break;default:a+=3}b=b.subarray(c),a-=c,c=0},this.flush=function(){b&&b.byteLength>3&&this.trigger("data",b.subarray(c+3)),b=null,c=1}},l.prototype=new b.Stream,k=function(){var a,c,d,e,f,g,h,i=new l;k.prototype.init.call(this),a=this,this.push=function(a){"video"===a.type&&(c=a.trackId,d=a.pts,e=a.dts,i.push(a))},i.on("data",function(b){var h={trackId:c,pts:d,dts:e,data:b};switch(31&b[0]){case 5:h.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 7:h.nalUnitType="seq_parameter_set_rbsp",h.escapedRBSP=f(b.subarray(1)),h.config=g(h.escapedRBSP);break;case 8:h.nalUnitType="pic_parameter_set_rbsp";break;case 9:h.nalUnitType="access_unit_delimiter_rbsp"}a.trigger("data",h)}),this.flush=function(){i.flush()},h=function(a,b){var c,d,e=8,f=8;for(c=0;a>c;c++)0!==f&&(d=b.readExpGolomb(),f=(e+d+256)%256),e=0===f?e:f},f=function(a){for(var b,c,d=a.byteLength,e=[],f=1;d-2>f;)0===a[f]&&0===a[f+1]&&3===a[f+2]?(e.push(f+2),f+=2):f++;if(0===e.length)return a;b=d-e.length,c=new Uint8Array(b);var g=0;for(f=0;b>f;g++,f++)g===e[0]&&(g++,e.shift()),c[f]=a[g];return c},g=function(a){var c,d,e,f,g,i,j,k,l,m,n,o,p=0,q=0,r=0,s=0;if(c=new b.ExpGolomb(a),d=c.readUnsignedByte(),f=c.readUnsignedByte(),e=c.readUnsignedByte(),c.skipUnsignedExpGolomb(),(100===d||110===d||122===d||244===d||44===d||83===d||86===d||118===d||128===d||138===d||139===d||134===d)&&(g=c.readUnsignedExpGolomb(),3===g&&c.skipBits(1),c.skipUnsignedExpGolomb(),c.skipUnsignedExpGolomb(),c.skipBits(1),c.readBoolean()))for(n=3!==g?8:12,o=0;n>o;o++)c.readBoolean()&&(6>o?h(16,c):h(64,c));if(c.skipUnsignedExpGolomb(),i=c.readUnsignedExpGolomb(),0===i)c.readUnsignedExpGolomb();else if(1===i)for(c.skipBits(1),c.skipExpGolomb(),c.skipExpGolomb(),j=c.readUnsignedExpGolomb(),o=0;j>o;o++)c.skipExpGolomb();return c.skipUnsignedExpGolomb(),c.skipBits(1),k=c.readUnsignedExpGolomb(),l=c.readUnsignedExpGolomb(),m=c.readBits(1),0===m&&c.skipBits(1),c.skipBits(1),c.readBoolean()&&(p=c.readUnsignedExpGolomb(),q=c.readUnsignedExpGolomb(),r=c.readUnsignedExpGolomb(),s=c.readUnsignedExpGolomb()),{profileIdc:d,levelIdc:e,profileCompatibility:f,width:16*(k+1)-2*p-2*q,height:(2-m)*(l+1)*16-2*r-2*s}}},k.prototype=new b.Stream,g=function(a){var b=0,c=[],d=0;g.prototype.init.call(this),this.push=function(a){c.push(a),d+=a.data.byteLength},this.flush=function(){var e,f,g,h,i,j,k,l,m;if(0!==d){for(k=new Uint8Array(d+4*c.length),l=new DataView(k.buffer),a.samples=[],m={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0}},j=0;c.length;)f=c[0],"access_unit_delimiter_rbsp"===f.nalUnitType&&(e&&(m.duration=f.dts-e.dts,a.samples.push(m)),m={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0},compositionTimeOffset:f.pts-f.dts},e=f),"slice_layer_without_partitioning_rbsp_idr"===f.nalUnitType&&(m.flags.dependsOn=2),m.size+=4,m.size+=f.data.byteLength,l.setUint32(j,f.data.byteLength),j+=4,k.set(f.data,j),j+=f.data.byteLength,c.shift();a.samples.length&&(m.duration=a.samples[a.samples.length-1].duration),a.samples.push(m),d=0,h=q.mdat(k),g=q.moof(b,[a]),i=new Uint8Array(g.byteLength+h.byteLength),b++,i.set(g),i.set(h,g.byteLength),this.trigger("data",i)}}},g.prototype=new b.Stream,i=function(){var a,l,m,n,o,p,q,r,s,t,u,v=this;i.prototype.init.call(this),o=new d,p=new e,q=new f,r=new j,s=new k,o.pipe(p),p.pipe(q),q.pipe(r),q.pipe(s),s.on("data",function(b){"seq_parameter_set_rbsp"!==b.nalUnitType||m||(m=b.config,a.width=m.width,a.height=m.height,a.sps=[b.data],a.profileIdc=m.profileIdc,a.levelIdc=m.levelIdc,a.profileCompatibility=m.profileCompatibility),"pic_parameter_set_rbsp"!==b.nalUnitType||n||(n=b.data,a.pps=[b.data])}),r.on("data",function(a){l&&l.channelcount===c&&(l.audioobjecttype=a.audioobjecttype,l.channelcount=a.channelcount,l.samplerate=a.samplerate,l.samplingfrequencyindex=a.samplingfrequencyindex,l.samplesize=a.samplesize)}),q.on("data",function(c){var d,e=function(c){var d="video"===c?a:l;return function(a){var e=b.mp4.initSegment([d]),f=new Uint8Array(e.byteLength+a.byteLength);f.set(e),f.set(a,e.byteLength),v.trigger("data",{type:c,data:f})}};if("metadata"===c.type)for(d=c.tracks.length;d--;){if("video"===c.tracks[d].type&&!t){a=c.tracks[d],t=new g(a),s.pipe(t),t.on("data",e("video"));break}"audio"!==c.tracks[d].type||u||(l=c.tracks[d],u=new h(l),r.pipe(u),u.on("data",e("audio")))}}),this.push=function(a){o.push(a)},this.flush=function(){q.flush(),s.flush(),t&&t.flush(),u&&u.flush(),this.trigger("done")}},i.prototype=new b.Stream,b.mp2t={PAT_PID:0,MP2T_PACKET_LENGTH:m,H264_STREAM_TYPE:n,ADTS_STREAM_TYPE:o,TransportPacketStream:d,TransportParseStream:e,ElementaryStream:f,VideoSegmentStream:g,Transmuxer:i,AacStream:j,H264Stream:k}}(this,this.muxjs);var transmuxer=new muxjs.mp2t.Transmuxer;onmessage=function(a){if("push"===a.data.action){var b=new Uint8Array(a.data.data);transmuxer.push(b)}else"flush"===a.data.action&&transmuxer.flush()},transmuxer.on("data",function(a){postMessage({action:"data",type:a.type,data:a.data.buffer},[a.data.buffer])}),transmuxer.on("done",function(a){postMessage({action:"done"})});'],{
type:"application/javascript"}))),this.transmuxer_.onmessage=function(a){if("data"===a.data.action){var b,d=a.data;d.data=new Uint8Array(d.data),"video"===d.type?(b=this.videoBuffer_,this.videoUpdating_=!1):(b=this.audioBuffer_,this.audioUpdating_=!1),this.timestampOffset!==c&&(b.timestampOffset=this.timestampOffset),b.appendBuffer(d.data)}}.bind(this),Object.defineProperty(this,"updating",{get:function(){return this.audioUpdating_||this.videoUpdating_||this.audioBuffer_.updating||this.videoBuffer_.updating}}),Object.defineProperty(this,"buffered",{get:function(){var a,b;return 0===this.videoBuffer_.buffered.length||0===this.audioBuffer_.buffered.length?videojs.createTimeRange():(a=Math.max(this.videoBuffer_.buffered.start(0),this.audioBuffer_.buffered.start(0)),b=Math.min(this.videoBuffer_.buffered.end(0),this.audioBuffer_.buffered.end(0)),videojs.createTimeRange(a,b))}})},appendBuffer:function(a){this.audioUpdating_=this.videoUpdating_=!0,this.transmuxer_.postMessage({action:"push",data:a.buffer},[a.buffer]),this.transmuxer_.postMessage({action:"flush"})}}),videojs.FlashMediaSource=videojs["extends"](j,{constructor:function(){this.sourceBuffers=[],this.readyState="closed",this.on(["sourceopen","webkitsourceopen"],function(a){this.swfObj=document.getElementById(a.swfId),this.readyState="open",this.swfObj&&this.swfObj.vjs_load()})}}),videojs.FlashMediaSource.BYTES_PER_SECOND_GOAL=4194304,videojs.FlashMediaSource.TICKS_PER_SECOND=60,videojs.FlashMediaSource.prototype.addSourceBuffer=function(a){var b;if("video/mp2t"!==a)throw new Error("NotSupportedError (Video.js)");return b=new videojs.FlashSourceBuffer(this),this.sourceBuffers.push(b),b},Object.defineProperty(videojs.FlashMediaSource.prototype,"duration",{get:function(){return this.swfObj?this.swfObj.vjs_getProperty("duration"):NaN},set:function(a){return this.swfObj.vjs_setProperty("duration",a),a}}),videojs.FlashMediaSource.prototype.endOfStream=function(){this.readyState="ended"},videojs.mediaSources={},videojs.MediaSource.open=function(a,b){var c=videojs.mediaSources[a];if(!c)throw new Error("Media Source not found (Video.js)");c.trigger({type:"sourceopen",swfId:b})},h=function(b){a.setTimeout(b,Math.ceil(1e3/videojs.FlashMediaSource.TICKS_PER_SECOND))},videojs.FlashSourceBuffer=videojs["extends"](j,{constructor:function(c){var d;this.buffer_=[],this.bufferSize_=0,this.source=c,this.updating=!1,this.segmentParser_=new b.SegmentParser,d=a.btoa(String.fromCharCode.apply(null,this.segmentParser_.getFlvHeader())),this.source.swfObj.vjs_appendBuffer(d),Object.defineProperty(this,"buffered",{get:function(){return videojs.createTimeRange(0,this.source.swfObj.vjs_getProperty("buffered"))}})},appendBuffer:function(a){var b,c;if(this.updating)throw b=new Error("SourceBuffer.append() cannot be called while an update is in progress"),b.name="InvalidStateError",b.code=11,b;0===this.buffer_.length&&h(this.processBuffer_.bind(this)),this.updating=!0,this.source.readyState="open",this.trigger({type:"update"}),c=this.tsToFlv_(a),this.buffer_.push(c),this.bufferSize_+=c.byteLength},abort:function(){this.buffer_=[],this.bufferSize_=0,this.source.swfObj.vjs_abort(),this.updating&&(this.updating=!1,this.trigger({type:"updateend"}))},processBuffer_:function(){var b,c,d,e,f;if(this.buffer_.length){for(e=document.hidden?videojs.FlashMediaSource.BYTES_PER_SECOND_GOAL:Math.ceil(videojs.FlashMediaSource.BYTES_PER_SECOND_GOAL/videojs.FlashMediaSource.TICKS_PER_SECOND),d=new Uint8Array(Math.min(e,this.bufferSize_)),c=d.byteLength;c;)b=this.buffer_[0].subarray(0,c),d.set(b,d.byteLength-c),b.byteLength<this.buffer_[0].byteLength?this.buffer_[0]=this.buffer_[0].subarray(c):this.buffer_.shift(),c-=b.byteLength;this.bufferSize_-=d.byteLength,f=a.btoa(String.fromCharCode.apply(null,d)),this.source.swfObj.CallFunction('<invoke name="vjs_appendBuffer"returntype="javascript"><arguments><string>'+f+"</string></arguments></invoke>"),0!==this.bufferSize_?h(this.processBuffer_.bind(this)):(this.updating=!1,this.trigger({type:"updateend"}),"ended"===this.source.readyState&&this.source.swfObj.vjs_endOfStream())}},tsToFlv_:function(a){var b,c,d,e=0,f=[];for(this.segmentParser_.parseSegmentBinaryData(a),this.segmentParser_.flushTags();this.segmentParser_.tagsAvailable();)f.push(this.segmentParser_.getNextTag());for(b=0;b<f.length;b++)e+=f[b].bytes.byteLength;for(d=new Uint8Array(e),b=0,c=0;b<f.length;b++)d.set(f[b].bytes,c),c+=f[b].bytes.byteLength;return d}}),videojs.URL={createObjectURL:function(b){var c;return b instanceof videojs.FlashMediaSource?(c=k+i,i++,videojs.mediaSources[c]=b,c):a.URL.createObjectURL(b)}}}(this,this.muxjs),function(a,b,c,d){"use strict";var e,f,g,h=1.1,i=500,j=b.getComponent("Component");f=function(a){return a.retries&&a.retries>=2},b.Hls=b["extends"](j,{constructor:function(a,c){var d,e=this;j.call(this,a),a.options_&&a.options_.playerId&&(d=b(a.options_.playerId),d.hls||Object.defineProperty(d,"hls",{get:function(){return b.log.warn("player.hls is deprecated. Use player.tech.hls instead."),e}})),this.tech_=a,this.source_=c,this.bytesReceived=0,this.loadingState_="none","none"!==this.tech_.preload()&&(this.loadingState_="meta"),this.segmentBuffer_=[],this.startCheckingBuffer_(),this.on(this.tech_,"seeking",function(){this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"play",this.play)}}),b.Hls.canPlaySource=function(){return b.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},b.HlsSourceHandler={canHandleSource:function(a){var c=/^application\/(?:x-|vnd\.apple\.)mpegurl/i;return b.Hls.supportsNativeHls?!1:c.test(a.type)},handleSource:function(a,c){return c.hls=new b.Hls(c,a),c.hls.src(a.src),c.hls}},b.MediaSource.supportsNativeMediaSources()?b.getComponent("Html5").registerSourceHandler(b.HlsSourceHandler):b.getComponent("Flash").registerSourceHandler(b.HlsSourceHandler),b.Hls.GOAL_BUFFER_LENGTH=30,b.Hls.prototype.src=function(a){var c;a&&(this.mediaSource=new b.MediaSource,this.segmentBuffer_=[],this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen.bind(this)),this.mediaIndex=0,this.options_={},this.source_.withCredentials!==d?this.options_.withCredentials=this.source_.withCredentials:b.options.hls&&(this.options_.withCredentials=b.options.hls.withCredentials),this.playlists=new b.Hls.PlaylistLoader(this.source_.src,this.options_.withCredentials),this.playlists.on("loadedmetadata",function(){var a,b,e,f,g,h,i;c=this.playlists.media(),c.endList&&"metadata"!==this.tech_.preload()&&"none"!==this.tech_.preload()&&(this.loadingState_="segments"),this.bandwidth===d&&this.setBandwidth({bandwidth:5*this.playlists.bandwidth}),a=this.selectPlaylist(),e=c.attributes&&c.attributes.BANDWIDTH||0,f=a.attributes&&a.attributes.BANDWIDTH||0,g=c.segments&&c.segments[this.mediaIndex].duration||c.targetDuration,h=g*f/this.bandwidth,h||(h=1/0),i=10,f>e&&i>=h?(this.playlists.media(a),b=function(){this.setupFirstPlay(),this.fillBuffer(),this.tech_.trigger("loadedmetadata"),this.playlists.off("loadedplaylist",b)}.bind(this),this.playlists.on("loadedplaylist",b)):(this.setupFirstPlay(),this.fillBuffer(),this.tech_.trigger("loadedmetadata"))}.bind(this)),this.playlists.on("error",function(){this.tech_.error(this.playlists.error)}.bind(this)),this.playlists.on("loadedplaylist",function(){var a=this.playlists.media();a&&(this.updateDuration(this.playlists.media()),this.mediaIndex=b.Hls.translateMediaIndex(this.mediaIndex,c,a),c=a,this.fetchKeys_())}.bind(this)),this.playlists.on("mediachange",function(){e&&this.cancelKeyXhr(),this.tech_.trigger({type:"mediachange",bubbles:!0})}.bind(this)),this.tech_.el()&&this.tech_.src(b.URL.createObjectURL(this.mediaSource)))},b.Hls.getMediaIndexForLive_=function(a){if(!a.segments)return 0;for(var b=a.segments.length,c=0,d=3*(a.targetDuration||10);d>c&&b>0;)c+=a.segments[b-1].duration,b--;return b},b.Hls.prototype.handleSourceOpen=function(){this.sourceBuffer=this.mediaSource.addSourceBuffer("video/mp2t"),this.sourceBuffer.addEventListener("updateend",function(){this.duration()!==1/0&&this.mediaIndex===this.playlists.media().segments.length&&this.mediaSource.endOfStream()}.bind(this)),this.tech_.autoplay()&&this.play()},b.Hls.prototype.setupMetadataCueTranslation_=function(){var a,c=this.segmentParser_.metadataStream;this.tech_.addTextTrack&&(c.on("data",function(d){var e,f;if(!a)for(a=this.tech_.addTextTrack("metadata","Timed Metadata"),a.inBandMetadataTrackDispatchType=b.Hls.SegmentParser.STREAM_TYPES.metadata.toString(16).toUpperCase(),e=0;e<c.descriptor.length;e++)f=("00"+c.descriptor[e].toString(16).toUpperCase()).slice(-2),a.inBandMetadataTrackDispatchType+=f;this.tech_.segmentBuffer_[0].pendingMetadata.push({textTrack:a,metadata:d})}.bind(this)),this.on(this.tech_,"seeking",function(){var c,d,e;if(a)for(c=this.playlists.media(),d=this.tech_.playlists.expiredPreDiscontinuity_+this.tech_.playlists.expiredPostDiscontinuity_,d+=b.Hls.Playlist.duration(c,c.mediaSequence,c.mediaSequence+this.tech_.mediaIndex),e=a.cues.length;e--;)a.cues[e].startTime>=d&&a.removeCue(a.cues[e])}))},b.Hls.prototype.addCuesForMetadata_=function(c){var d,e,f,g,h,i,j,k,l;for(j=this.playlists.expiredPreDiscontinuity_,j+=this.playlists.expiredPostDiscontinuity_,j+=b.Hls.Playlist.duration(c.playlist,c.playlist.mediaSequence,c.playlist.mediaSequence+c.mediaIndex),i=c.playlist.segments[c.mediaIndex],h=Math.min(isFinite(i.minVideoPts)?i.minVideoPts:1/0,isFinite(i.minAudioPts)?i.minAudioPts:1/0);c.pendingMetadata.length;){for(g=c.pendingMetadata[0].metadata,k=c.pendingMetadata[0].textTrack,d=0;d<g.frames.length;d++)f=g.frames[d],l=j+.001*(g.pts-h),e=new a.VTTCue(l,l,f.value||f.url||""),e.frame=f,e.pts_=g.pts,k.addCue(e);c.pendingMetadata.shift()}},b.Hls.prototype.setupFirstPlay=function(){var a,b;b=this.playlists.media(),this.duration()===1/0&&0===this.tech_.played().length&&!this.tech_.paused()&&this.sourceBuffer&&b&&(a=this.seekable(),a.length&&this.tech_.setCurrentTime(a.end(0)))},b.Hls.prototype.play=function(){return this.loadingState_="segments",this.tech_.ended()&&(this.mediaIndex=0),0===this.tech_.played().length?this.setupFirstPlay():void(this.tech_.duration()===1/0&&this.tech_.currentTime()<this.tech_.seekable().start(0)&&this.tech_.setCurrentTime(this.tech_.seekable().start(0)))},b.Hls.prototype.setCurrentTime=function(a){var b,c;if(!this.playlists||!this.playlists.media())return 0;if(!this.playlists.media().segments)return 0;for(b=this.tech_.buffered(),c=0;c<b.length;c++)if(this.tech_.buffered().start(c)<=a&&this.tech_.buffered().end(c)>=a)return a;this.mediaIndex=this.playlists.getMediaIndexForTime_(a),this.cancelSegmentXhr(),e&&(e.aborted=!0,this.cancelKeyXhr()),this.segmentBuffer_=[],this.fillBuffer(1e3*a)},b.Hls.prototype.duration=function(){var a=this.playlists;return a?b.Hls.Playlist.duration(a.media()):0},b.Hls.prototype.seekable=function(){var a,c,d;return this.playlists&&(d=this.playlists.media())?(a=b.Hls.Playlist.seekable(d),a.length?(c=this.playlists.expiredPostDiscontinuity_-this.playlists.expiredPreDiscontinuity_,b.createTimeRange(c,c+(a.end(0)-a.start(0)))):a):b.createTimeRange()},b.Hls.prototype.updateDuration=function(a){var c=this.mediaSource.duration,d=b.Hls.Playlist.duration(a),e=function(){this.mediaSource.duration=d,this.tech_.trigger("durationchange"),this.mediaSource.removeEventListener("sourceopen",e)}.bind(this);c!==d&&("open"===this.mediaSource.readyState?(this.mediaSource.duration=d,this.tech_.trigger("durationchange")):this.mediaSource.addEventListener("sourceopen",e))},b.Hls.prototype.resetSrc_=function(){this.cancelSegmentXhr(),this.cancelKeyXhr(),this.sourceBuffer&&this.sourceBuffer.abort()},b.Hls.prototype.cancelKeyXhr=function(){e&&(e.onreadystatechange=null,e.abort(),e=null)},b.Hls.prototype.cancelSegmentXhr=function(){this.segmentXhr_&&(this.segmentXhr_.onreadystatechange=null,this.segmentXhr_.abort(),this.segmentXhr_=null)},b.Hls.prototype.dispose=function(){this.stopCheckingBuffer_(),this.playlists&&this.playlists.dispose(),this.resetSrc_()},b.Hls.prototype.selectPlaylist=function(){var a,c,d,e,f,g,i,j,k=this.playlists.master.playlists.slice(),l=[],m=k.length;for(k.sort(b.Hls.comparePlaylistBandwidth);m--;)c=k[m],c.attributes&&c.attributes.BANDWIDTH&&(a=c.attributes.BANDWIDTH*h,a<this.bandwidth&&(l.push(c),e||(e=c)));for(m=l.length,l.sort(b.Hls.comparePlaylistResolution),c=null,i=parseInt(getComputedStyle(this.tech_.el()).width,10),j=parseInt(getComputedStyle(this.tech_.el()).height,10);m--;)if(d=c,c=l[m],c.attributes&&c.attributes.RESOLUTION&&c.attributes.RESOLUTION.width&&c.attributes.RESOLUTION.height){if(c.attributes.RESOLUTION.width===i&&c.attributes.RESOLUTION.height===j){f=null,g=c;break}if(c.attributes.RESOLUTION.width<i&&c.attributes.RESOLUTION.height<j){d&&d.attributes&&d.attributes.RESOLUTION&&d.attributes.RESOLUTION.width&&d.attributes.RESOLUTION.height&&(f=d),g=c;break}}return f||g||e||k[0]},b.Hls.prototype.checkBuffer_=function(){this.checkBufferTimeout_&&(a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null),this.fillBuffer(),this.drainBuffer(),this.checkBufferTimeout_=a.setTimeout(this.checkBuffer_.bind(this),i)},b.Hls.prototype.startCheckingBuffer_=function(){this.tech_.on("waiting",this.drainBuffer.bind(this)),this.checkBuffer_()},b.Hls.prototype.stopCheckingBuffer_=function(){this.checkBufferTimeout_&&(a.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null),this.tech_.off("waiting",this.drainBuffer)},b.Hls.prototype.fillBuffer=function(a){var c,d,e=this.tech_,f=this.tech_.buffered(),g=0;"segments"===this.loadingState_&&e.currentSrc()&&this.playlists&&(this.segmentXhr_||"HAVE_NOTHING"!==this.playlists.state&&this.playlists.media()&&this.playlists.media().segments&&"SWITCHING_MEDIA"!==this.playlists.state&&(c=this.playlists.media().segments[this.mediaIndex],c&&(f&&f.length&&(g=e.buffered().end(0)-e.currentTime()),"number"!=typeof a&&g>=b.Hls.GOAL_BUFFER_LENGTH||(d=this.playlistUriToUrl(c.uri),this.loadSegment(d,a)))))},b.Hls.prototype.playlistUriToUrl=function(a){var b;return b=this.playlists.media().uri===this.source_.src?g(this.source_.src,a):g(g(this.source_.src,this.playlists.media().uri||""),a)},b.Hls.prototype.setBandwidth=function(a){this.segmentXhrTime=a.roundTripTime,this.bandwidth=a.bandwidth,this.bytesReceived+=a.bytesReceived||0,this.tech_.trigger("bandwidthupdate")},b.Hls.prototype.loadSegment=function(a,c){var d=this;this.segmentXhr_=b.Hls.xhr({uri:a,responseType:"arraybuffer",withCredentials:this.source_.withCredentials},function(b,e){var f;return d.segmentXhr_=null,b?e.timedout?(d.bandwidth=1,d.playlists.media(d.selectPlaylist())):(d.error={status:e.status,message:"HLS segment request error at URL: "+a,code:e.status>=500?4:2},void d.mediaIndex++):void(e.response&&(d.setBandwidth(e),f={mediaIndex:d.mediaIndex,playlist:d.playlists.media(),offset:c,bytes:null,encryptedBytes:null,decrypter:null,pendingMetadata:[]},f.playlist.segments[f.mediaIndex].key?f.encryptedBytes=new Uint8Array(e.response):f.bytes=new Uint8Array(e.response),d.segmentBuffer_.push(f),d.tech_.trigger("progress"),d.drainBuffer(),d.mediaIndex++,d.playlists.media(d.selectPlaylist())))})},b.Hls.prototype.drainBuffer=function(a){var c,d,e,g,h,i,j,k,l=0,m=this.segmentBuffer_;if(m.length&&this.sourceBuffer&&!this.sourceBuffer.updating){if(c=m[0],d=c.mediaIndex,e=c.playlist,g=c.offset,h=c.bytes,i=e.segments[d],i.key&&!h)return f(i.key)?m.shift():i.key.bytes?c.decrypter?void 0:(k=i.key.iv||new Uint32Array([0,0,0,d+e.mediaSequence]),j=new b.Hls.Decrypter(c.encryptedBytes,i.key.bytes,k,function(a,b){c.bytes=b}),void(c.decrypter=j)):this.fetchKeys_();a=a||{},this.addCuesForMetadata_(c),l=this.playlists.expiredPostDiscontinuity_+this.playlists.expiredPreDiscontinuity_,l+=b.Hls.Playlist.duration(e,e.mediaSequence,e.mediaSequence+d),this.sourceBuffer.timestampOffset=l,this.sourceBuffer.appendBuffer(h),m.shift()}},b.Hls.prototype.fetchKeys_=function(){var a,c,d,g,h,i,j,k;if(!e&&this.segmentBuffer_.length)for(d=this,g=this.player(),h=this.options_,k=function(a){return function(b,c){return e=null,b||!c.response||16!==c.response.byteLength?(a.retries=a.retries||0,a.retries++,void(c.aborted||d.fetchKeys_())):(j=new DataView(c.response),a.bytes=new Uint32Array([j.getUint32(0),j.getUint32(4),j.getUint32(8),j.getUint32(12)]),void d.checkBuffer_())}},a=0;a<d.segmentBuffer_.length;a++)if(i=d.segmentBuffer_[a].playlist.segments[d.segmentBuffer_[a].mediaIndex],c=i.key,c&&!c.bytes&&!f(c)){e=b.Hls.xhr({uri:this.playlistUriToUrl(c.uri),responseType:"arraybuffer",withCredentials:h.withCredentials},k(c));break}},b.Hls.supportsNativeHls=function(){var a,d,e=c.createElement("video");return b.getComponent("Html5").isSupported()?(a=e.canPlayType("application/x-mpegURL"),d=e.canPlayType("application/vnd.apple.mpegURL"),/probably|maybe/.test(a)||/probably|maybe/.test(d)):!1}(),b.Hls.isSupported=function(){return b.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")},b.Hls.getPlaylistDuration=function(a,c,d){return b.log.warn("videojs.Hls.getPlaylistDuration is deprecated. Use videojs.Hls.Playlist.duration instead"),b.Hls.Playlist.duration(a,c,d)},b.Hls.getPlaylistTotalDuration=function(a){return b.log.warn("videojs.Hls.getPlaylistTotalDuration is deprecated. Use videojs.Hls.Playlist.duration instead"),b.Hls.Playlist.duration(a)},b.Hls.translateMediaIndex=function(a,c,d){var e;return 0===a?0:d&&d.segments?(e=a+(c.mediaSequence-d.mediaSequence),e>d.segments.length||0>e?b.Hls.getMediaIndexForLive_(d)+1:e):0},b.Hls.getMediaIndexByTime=function(){return b.log.warn("getMediaIndexByTime is deprecated. Use PlaylistLoader.getMediaIndexForTime_ instead."),0},b.Hls.comparePlaylistBandwidth=function(b,c){var d,e;return b.attributes&&b.attributes.BANDWIDTH&&(d=b.attributes.BANDWIDTH),d=d||a.Number.MAX_VALUE,c.attributes&&c.attributes.BANDWIDTH&&(e=c.attributes.BANDWIDTH),e=e||a.Number.MAX_VALUE,d-e},b.Hls.comparePlaylistResolution=function(b,c){var d,e;return b.attributes&&b.attributes.RESOLUTION&&b.attributes.RESOLUTION.width&&(d=b.attributes.RESOLUTION.width),d=d||a.Number.MAX_VALUE,c.attributes&&c.attributes.RESOLUTION&&c.attributes.RESOLUTION.width&&(e=c.attributes.RESOLUTION.width),e=e||a.Number.MAX_VALUE,d===e&&b.attributes.BANDWIDTH&&c.attributes.BANDWIDTH?b.attributes.BANDWIDTH-c.attributes.BANDWIDTH:d-e},g=b.Hls.resolveUrl=function(a,b){var d,e,f=c.querySelector("base"),g=c.querySelector("head"),h=c.createElement("a"),i=f;return f?d=f.href:i=g.appendChild(c.createElement("base")),i.href=a,h.href=b,e=h.href,f?f.href=d:g.removeChild(i),e}}(window,window.videojs,document),function(a,b){var c=function(){this.init=function(){var a={};this.on=function(b,c){a[b]||(a[b]=[]),a[b].push(c)},this.off=function(b,c){var d;return a[b]?(d=a[b].indexOf(c),a[b].splice(d,1),d>-1):!1},this.trigger=function(b){var c,d,e,f;if(c=a[b])if(2===arguments.length)for(e=c.length,d=0;e>d;++d)c[d].call(this,arguments[1]);else for(f=Array.prototype.slice.call(arguments,1),e=c.length,d=0;e>d;++d)c[d].apply(this,f)},this.dispose=function(){a={}}}};c.prototype.pipe=function(a){this.on("data",function(b){a.push(b)})},a.Hls.Stream=c}(window.videojs),function(a,b,c,d,e){var f,g,h,i=function(){},j=function(){var a="[^=]*",b='"[^"]*"|[^,]*',c="(?:"+a+")=(?:"+b+")";return new RegExp("(?:^|,)("+c+")")}(),k=function(a){for(var b,c=a.split(j),d=c.length,e={};d--;)""!==c[d]&&(b=/([^=]*)=(.*)/.exec(c[d]).slice(1),b[0]=b[0].replace(/^\s+|\s+$/g,""),b[1]=b[1].replace(/^\s+|\s+$/g,""),b[1]=b[1].replace(/^['"](.*)['"]$/g,"$1"),e[b[0]]=b[1]);return e},l=a.Hls.Stream;f=function(){var a="";f.prototype.init.call(this),this.push=function(b){var c;for(a+=b,c=a.indexOf("\n");c>-1;c=a.indexOf("\n"))this.trigger("data",a.substring(0,c)),a=a.substring(c+1)}},f.prototype=new l,g=function(){g.prototype.init.call(this)},g.prototype=new l,g.prototype.push=function(a){var c,d;return a=a.replace(/^\s+|\s+$/g,""),0!==a.length?"#"!==a[0]?void this.trigger("data",{type:"uri",uri:a}):0!==a.indexOf("#EXT")?void this.trigger("data",{type:"comment",text:a.slice(1)}):(a=a.replace("\r",""),(c=/^#EXTM3U/.exec(a))?void this.trigger("data",{type:"tag",tagType:"m3u"}):(c=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(a))?(d={type:"tag",tagType:"inf"},c[1]&&(d.duration=parseFloat(c[1])),c[2]&&(d.title=c[2]),void this.trigger("data",d)):(c=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(a))?(d={type:"tag",tagType:"targetduration"},c[1]&&(d.duration=b(c[1],10)),void this.trigger("data",d)):(c=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(a))?(d={type:"tag",tagType:"totalduration"},c[1]&&(d.duration=b(c[1],10)),void this.trigger("data",d)):(c=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(a))?(d={type:"tag",tagType:"version"},c[1]&&(d.version=b(c[1],10)),void this.trigger("data",d)):(c=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(a))?(d={type:"tag",tagType:"media-sequence"},c[1]&&(d.number=b(c[1],10)),void this.trigger("data",d)):(c=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(a))?(d={type:"tag",tagType:"discontinuity-sequence"},c[1]&&(d.number=b(c[1],10)),void this.trigger("data",d)):(c=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(a))?(d={type:"tag",tagType:"playlist-type"},c[1]&&(d.playlistType=c[1]),void this.trigger("data",d)):(c=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(a))?(d={type:"tag",tagType:"byterange"},c[1]&&(d.length=b(c[1],10)),c[2]&&(d.offset=b(c[2],10)),void this.trigger("data",d)):(c=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(a))?(d={type:"tag",tagType:"allow-cache"},c[1]&&(d.allowed=!/NO/.test(c[1])),void this.trigger("data",d)):(c=/^#EXT-X-STREAM-INF:?(.*)$/.exec(a))?(d={type:"tag",tagType:"stream-inf"},c[1]&&(d.attributes=k(c[1]),d.attributes.RESOLUTION&&!function(){var a=d.attributes.RESOLUTION.split("x"),c={};a[0]&&(c.width=b(a[0],10)),a[1]&&(c.height=b(a[1],10)),d.attributes.RESOLUTION=c}(),d.attributes.BANDWIDTH&&(d.attributes.BANDWIDTH=b(d.attributes.BANDWIDTH,10)),d.attributes["PROGRAM-ID"]&&(d.attributes["PROGRAM-ID"]=b(d.attributes["PROGRAM-ID"],10))),void this.trigger("data",d)):(c=/^#EXT-X-ENDLIST/.exec(a))?void this.trigger("data",{type:"tag",tagType:"endlist"}):(c=/^#EXT-X-DISCONTINUITY/.exec(a))?void this.trigger("data",{type:"tag",tagType:"discontinuity"}):(c=/^#EXT-X-KEY:?(.*)$/.exec(a))?(d={type:"tag",tagType:"key"},c[1]&&(d.attributes=k(c[1]),d.attributes.IV&&("0x"===d.attributes.IV.substring(0,2)&&(d.attributes.IV=d.attributes.IV.substring(2)),d.attributes.IV=d.attributes.IV.match(/.{8}/g),d.attributes.IV[0]=b(d.attributes.IV[0],16),d.attributes.IV[1]=b(d.attributes.IV[1],16),d.attributes.IV[2]=b(d.attributes.IV[2],16),d.attributes.IV[3]=b(d.attributes.IV[3],16),d.attributes.IV=new Uint32Array(d.attributes.IV))),void this.trigger("data",d)):void this.trigger("data",{type:"tag",data:a.slice(4,a.length)})):void 0},h=function(){var a,b=this,j=[],k={};h.prototype.init.call(this),this.lineStream=new f,this.parseStream=new g,this.lineStream.pipe(this.parseStream),this.manifest={allowCache:!0,discontinuityStarts:[]},this.parseStream.on("data",function(f){({tag:function(){(({"allow-cache":function(){this.manifest.allowCache=f.allowed,"allowed"in f||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var a={};"length"in f&&(k.byterange=a,a.length=f.length,"offset"in f||(this.trigger("info",{message:"defaulting offset to zero"}),f.offset=0)),"offset"in f&&(k.byterange=a,a.offset=f.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),f.duration>=0&&(k.duration=f.duration),this.manifest.segments=j},key:function(){return f.attributes?"NONE"===f.attributes.METHOD?void(a=null):f.attributes.URI?(f.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:f.attributes.METHOD||"AES-128",uri:f.attributes.URI},void(f.attributes.IV!==e&&(a.iv=f.attributes.IV))):void this.trigger("warn",{message:"ignoring key declaration without URI"}):void this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){return c(f.number)?void(this.manifest.mediaSequence=f.number):void this.trigger("warn",{message:"ignoring invalid media sequence: "+f.number})},"discontinuity-sequence":function(){return c(f.number)?void(this.manifest.discontinuitySequence=f.number):void this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+f.number})},"playlist-type":function(){return/VOD|EVENT/.test(f.playlistType)?void(this.manifest.playlistType=f.playlistType):void this.trigger("warn",{message:"ignoring unknown playlist type: "+f.playlist})},"stream-inf":function(){return this.manifest.playlists=j,f.attributes?(k.attributes||(k.attributes={}),void(k.attributes=d(k.attributes,f.attributes))):void this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},discontinuity:function(){k.discontinuity=!0,this.manifest.discontinuityStarts.push(j.length)},targetduration:function(){return!c(f.duration)||f.duration<0?void this.trigger("warn",{message:"ignoring invalid target duration: "+f.duration}):void(this.manifest.targetDuration=f.duration)},totalduration:function(){return!c(f.duration)||f.duration<0?void this.trigger("warn",{message:"ignoring invalid total duration: "+f.duration}):void(this.manifest.totalDuration=f.duration)}})[f.tagType]||i).call(b)},uri:function(){k.uri=f.uri,j.push(k),!this.manifest.targetDuration||"duration"in k||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),k.duration=this.manifest.targetDuration),a&&(k.key=a),k={}},comment:function(){}})[f.type].call(b)})},h.prototype=new l,h.prototype.push=function(a){this.lineStream.push(a)},h.prototype.end=function(){this.lineStream.push("\n")},window.videojs.m3u8={LineStream:f,ParseStream:g,Parser:h}}(window.videojs,window.parseInt,window.isFinite,window.videojs.mergeOptions),function(a){"use strict";a.Hls.xhr=function(b,c){var d=a.xhr(b,function(a,b){b.response&&(b.responseTime=(new Date).getTime(),b.roundTripTime=b.responseTime-b.requestTime,b.bytesReceived=b.response.byteLength||b.response.length,b.bandwidth=Math.floor(b.bytesReceived/b.roundTripTime*8*1e3)),c(a,b)});return d.requestTime=(new Date).getTime(),d}}(window.videojs),function(a,b){"use strict";var c,d,e,f,g,h,i,j,k=10;g=function(a,b){return a=isFinite(a)?a:1/0,b=isFinite(b)?b:1/0,Math.min(a,b)},h=function(a,b){return a=isFinite(a)?a:-(1/0),b=isFinite(b)?b:-(1/0),Math.max(a,b)},d=function(a,b){return a-b},c=function(a,b,c,e){var f,g=[],h=(a.discontinuityStarts||[]).concat(c),j=0;if(b>=c)return 0;for(h.sort(d),f=0;f<h.length;f++)if(h[f]>b){g.push({start:b,end:h[f]}),f++;break}for(;f<h.length;f++){if(h[f]>=c){g.push({start:h[f-1],end:c});break}g.push({start:g[g.length-1].end,end:h[f]})}for(f=0;f<g.length;f++)j+=i(a,g[f],f===g.length-1&&e);return j},i=function(a,b,c){var d,e,f,i=0,j=a.targetDuration||k;for(e=b.start;e<b.end&&(d=a.segments[e],void 0===d.minVideoPts&&void 0===d.minAudioPts);e++)i+=d.duration||j;if(c&&(d=a.segments[b.end],d&&(void 0!==d.minVideoPts||void 0!==d.minAudioPts)))return i+=.001*(g(d.minVideoPts,d.minAudioPts)-g(a.segments[e].minVideoPts,a.segments[e].minAudioPts));for(f=b.end-1;f>=e&&(d=a.segments[f],void 0===d.maxVideoPts&&void 0===d.maxAudioPts);f--)i+=d.duration||j;return f>=e&&(i+=.001*(h(a.segments[f].maxVideoPts,a.segments[f].maxAudioPts)-g(a.segments[e].minVideoPts,a.segments[e].minAudioPts))),i},f=function(a,b,d,e){var f,g,i=0;return void 0===b&&(b=a.mediaSequence||0),void 0===d&&(d=b+(a.segments||[]).length),f=a.targetDuration||k,g=h(a.mediaSequence-b,0),i+=g*f,i+=c(a,b+g-a.mediaSequence,d-a.mediaSequence,e)},e=function(b,c,d,e){if(!b)return 0;if(void 0===e&&(e=!0),void 0===c&&void 0===d){if(b.totalDuration)return b.totalDuration;if(!b.endList)return a.Infinity}return f(b,c,d,e)},j=function(a){var c,d,h,i,j,l,m;if(!a.segments)return b.createTimeRange();if(a.endList)return b.createTimeRange(0,e(a));if(c=0,d=f(a,a.mediaSequence,a.mediaSequence+a.segments.length),i=a.targetDuration||k,!a.endList)for(h=3*i,m=a.segments.length-1;m>=0&&h>0;m--)j=a.segments[m],l=g(e(a,a.mediaSequence+m,a.mediaSequence+m+1),h),h-=l,d-=l;return b.createTimeRange(c,d)},b.Hls.Playlist={duration:e,seekable:j}}(window,window.videojs),function(a,b){"use strict";var c=b.Hls.resolveUrl,d=b.Hls.xhr,e=b.Hls.Playlist,f=b.mergeOptions,g=function(a,b){var c,d,e=!1,g=f(a,{});for(c=a.playlists.length;c--;)if(d=g.playlists[c],d.uri===b.uri){if(d.segments&&b.segments&&d.segments.length===b.segments.length&&d.mediaSequence===b.mediaSequence)continue;g.playlists[c]=f(d,b),g.playlists[b.uri]=g.playlists[c],d.segments&&(g.playlists[c].segments=h(d.segments,b.segments,b.mediaSequence-d.mediaSequence)),e=!0}return e?g:null},h=function(a,b,c){var d,e,g=b.slice();for(c=c||0,d=Math.min(a.length,b.length+c),e=c;d>e;e++)g[e-c]=f(a[e],g[e-c]);return g},i=function(e,f){var h,j,k,l,m=this;if(i.prototype.init.call(this),!e)throw new Error("A non-empty playlist URL is required");l=function(c,d,e){var f,h,i;return m.setBandwidth(k||d),k=null,c?(m.error={status:d.status,message:"HLS playlist request error at URL: "+e,responseText:d.responseText,code:d.status>=500?4:2},m.trigger("error")):(m.state="HAVE_METADATA",f=new b.m3u8.Parser,f.push(d.responseText),f.end(),f.manifest.uri=e,i=g(m.master,f.manifest),h=1e3*(f.manifest.targetDuration||10),i?(m.master=i,m.updateMediaPlaylist_(f.manifest)):h/=2,m.media().endList||(a.clearTimeout(j),j=a.setTimeout(function(){m.trigger("mediaupdatetimeout")},h)),void m.trigger("loadedplaylist"))},m.state="HAVE_NOTHING",m.expiredPostDiscontinuity_=0,m.expiredPreDiscontinuity_=0,h=this.dispose,m.dispose=function(){k&&(k.onreadystatechange=null,k.abort(),k=null),a.clearTimeout(j),h.call(this)},m.media=function(a){var b=!1;if(!a)return m.media_;if("HAVE_NOTHING"===m.state||"HAVE_MASTER"===m.state)throw new Error("Cannot switch media playlist from "+m.state);if("string"==typeof a){if(!m.master.playlists[a])throw new Error("Unknown playlist URI: "+a);a=m.master.playlists[a]}if(b=a.uri!==m.media_.uri,m.master.playlists[a.uri].endList)return k&&(k.onreadystatechange=null,k.abort(),k=null),m.state="HAVE_METADATA",m.media_=a,void(b&&m.trigger("mediachange"));if(b){if(m.state="SWITCHING_MEDIA",k){if(c(m.master.uri,a.uri)===k.url)return;k.onreadystatechange=null,k.abort(),k=null}k=d({uri:c(m.master.uri,a.uri),withCredentials:f},function(b,c){l(b,c,a.uri),m.trigger("mediachange")})}},m.setBandwidth=function(a){m.bandwidth=a.bandwidth},m.on("mediaupdatetimeout",function(){"HAVE_METADATA"===m.state&&(m.state="HAVE_CURRENT_METADATA",k=d({uri:c(m.master.uri,m.media().uri),withCredentials:f},function(a,b){l(a,b,m.media().uri)}))}),k=d({uri:e,withCredentials:f},function(g,h){var i,j;if(k=null,g)return m.error={status:h.status,message:"HLS playlist request error at URL: "+e,responseText:h.responseText,code:2},m.trigger("error");if(i=new b.m3u8.Parser,i.push(h.responseText),i.end(),m.state="HAVE_MASTER",i.manifest.uri=e,i.manifest.playlists){for(m.master=i.manifest,j=m.master.playlists.length;j--;)m.master.playlists[m.master.playlists[j].uri]=m.master.playlists[j];return k=d({uri:c(e,i.manifest.playlists[0].uri),withCredentials:f},function(a,b){l(a,b,i.manifest.playlists[0].uri),a||m.trigger("loadedmetadata")}),m.trigger("loadedplaylist")}return m.master={uri:a.location.href,playlists:[{uri:e}]},m.master.playlists[e]=m.master.playlists[0],l(null,h,e),m.trigger("loadedmetadata")})};i.prototype=new b.Hls.Stream,i.prototype.updateMediaPlaylist_=function(a){var b,c,d;if(this.media_){if(c=a.mediaSequence-this.media_.mediaSequence,b=this.media_.mediaSequence,this.media_.discontinuitySequence!==a.discontinuitySequence)for(d=c;d--;)if(this.media_.segments[d].discontinuity){b=d+this.media_.mediaSequence,this.expiredPreDiscontinuity_+=this.expiredPostDiscontinuity_,
this.expiredPostDiscontinuity_=0;break}this.expiredPreDiscontinuity_+=e.duration(this.media_,this.media_.mediaSequence,b),this.expiredPostDiscontinuity_+=e.duration(this.media_,b,a.mediaSequence)}this.media_=this.master.playlists[a.uri]},i.prototype.getMediaIndexForTime_=function(a){var b;if(!this.media_)return 0;if(a-=this.expiredPreDiscontinuity_+this.expiredPostDiscontinuity_,0>a)return 0;for(b=0;b<this.media_.segments.length;b++)if(a-=e.duration(this.media_,this.media_.mediaSequence+b,this.media_.mediaSequence+b+1,!1),0>=a)return b;return this.media_.segments.length-1},b.Hls.PlaylistLoader=i}(window,window.videojs),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);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.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(b){b.window.pkcs7={unpad:a("./unpad")}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./unpad":2}],2:[function(a,b,c){"use strict";b.exports=function(a){return a.subarray(0,a.byteLength-a[a.byteLength-1])}},{}]},{},[1]),function(a,b,c){"use strict";var d,e,f,g,h;h=function(a){return a<<24|(65280&a)<<8|(16711680&a)>>8|a>>>24},d=function(a){this._precompute();var b,c,d,e,f,g=this._tables[0][4],h=this._tables[1],i=a.length,j=1;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size");for(e=a.slice(0),f=[],this._key=[e,f],b=i;4*i+28>b;b++)d=e[b-1],(b%i===0||8===i&&b%i===4)&&(d=g[d>>>24]<<24^g[d>>16&255]<<16^g[d>>8&255]<<8^g[255&d],b%i===0&&(d=d<<8^d>>>24^j<<24,j=j<<1^283*(j>>7))),e[b]=e[b-i]^d;for(c=0;b;c++,b--)d=e[3&c?b:b-4],4>=b||4>c?f[c]=d:f[c]=h[0][g[d>>>24]]^h[1][g[d>>16&255]]^h[2][g[d>>8&255]]^h[3][g[255&d]]},d.prototype={_tables:[[[],[],[],[],[]],[[],[],[],[],[]]],_precompute:function(){var a,b,c,d,e,f,g,h,i,j=this._tables[0],k=this._tables[1],l=j[4],m=k[4],n=[],o=[];for(a=0;256>a;a++)o[(n[a]=a<<1^283*(a>>7))^a]=a;for(b=c=0;!l[b];b^=d||1,c=o[c]||1)for(g=c^c<<1^c<<2^c<<3^c<<4,g=g>>8^255&g^99,l[b]=g,m[g]=b,f=n[e=n[d=n[b]]],i=16843009*f^65537*e^257*d^16843008*b,h=257*n[g]^16843008*g,a=0;4>a;a++)j[a][b]=h=h<<24^h>>>8,k[a][g]=i=i<<24^i>>>8;for(a=0;5>a;a++)j[a]=j[a].slice(0),k[a]=k[a].slice(0)},decrypt:function(a,b,c,d,e,f){var g,h,i,j,k=this._key[1],l=a^k[0],m=d^k[1],n=c^k[2],o=b^k[3],p=k.length/4-2,q=4,r=this._tables[1],s=r[0],t=r[1],u=r[2],v=r[3],w=r[4];for(j=0;p>j;j++)g=s[l>>>24]^t[m>>16&255]^u[n>>8&255]^v[255&o]^k[q],h=s[m>>>24]^t[n>>16&255]^u[o>>8&255]^v[255&l]^k[q+1],i=s[n>>>24]^t[o>>16&255]^u[l>>8&255]^v[255&m]^k[q+2],o=s[o>>>24]^t[l>>16&255]^u[m>>8&255]^v[255&n]^k[q+3],q+=4,l=g,m=h,n=i;for(j=0;4>j;j++)e[(3&-j)+f]=w[l>>>24]<<24^w[m>>16&255]<<16^w[n>>8&255]<<8^w[255&o]^k[q++],g=l,l=m,m=n,n=o,o=g}},g=function(a,b,c){var e,f,g,i,j,k,l,m,n,o=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>2),p=new d(Array.prototype.slice.call(b)),q=new Uint8Array(a.byteLength),r=new Int32Array(q.buffer);for(e=c[0],f=c[1],g=c[2],i=c[3],n=0;n<o.length;n+=4)j=h(o[n]),k=h(o[n+1]),l=h(o[n+2]),m=h(o[n+3]),p.decrypt(j,k,l,m,r,n),r[n]=h(r[n]^e),r[n+1]=h(r[n+1]^f),r[n+2]=h(r[n+2]^g),r[n+3]=h(r[n+3]^i),e=j,f=k,g=l,i=m;return q},e=function(){this.jobs=[],this.delay=1,this.timeout_=null},e.prototype=new b.Hls.Stream,e.prototype.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},e.prototype.push=function(a){this.jobs.push(a),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},f=function(a,b,d,g){var i=f.STEP,j=new Int32Array(a.buffer),k=new Uint8Array(a.byteLength),l=0;for(this.asyncStream_=new e,this.asyncStream_.push(this.decryptChunk_(j.subarray(l,l+i),b,d,k,l)),l=i;l<j.length;l+=i)d=new Uint32Array([h(j[l-4]),h(j[l-3]),h(j[l-2]),h(j[l-1])]),this.asyncStream_.push(this.decryptChunk_(j.subarray(l,l+i),b,d,k));this.asyncStream_.push(function(){g(null,c(k))})},f.prototype=new b.Hls.Stream,f.prototype.decryptChunk_=function(a,b,c,d){return function(){var e=g(a,b,c);d.set(e,a.byteOffset)}},f.STEP=32e3,b.Hls.decrypt=g,b.Hls.Decrypter=f,b.Hls.AsyncStream=e}(window,window.videojs,window.pkcs7.unpad);
\ No newline at end of file