UNPKG

tplayer.js

Version:

Flexible and easy Dash/HLS/DRM integration for HTML5 video.

2 lines 1.06 MB
/*! For license information please see index.js.LICENSE.txt */ (()=>{var e,t,r={452:e=>{var t;window,t=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/dist/",r(r.s="./index.js")}({"./externals/base64.js":function(e,t,r){var n,i,o,u,l,c=function(e){for(var t=[],r=0;r<e.length;++r){var n=e.charCodeAt(r);n<128?t.push(n):n<2048?(t.push(192|n>>6),t.push(128|63&n)):n<65536?(t.push(224|n>>12),t.push(128|63&n>>6),t.push(128|63&n)):(t.push(240|n>>18),t.push(128|63&n>>12),t.push(128|63&n>>6),t.push(128|63&n))}return t},f=function(e){for(var t=[],r=0;r<e.length;){var n=e[r++];n<128||(n<224?(n=(31&n)<<6,n|=63&e[r++]):n<240?(n=(15&n)<<12,n|=(63&e[r++])<<6,n|=63&e[r++]):(n=(7&n)<<18,n|=(63&e[r++])<<12,n|=(63&e[r++])<<6,n|=63&e[r++])),t.push(String.fromCharCode(n))}return t.join("")},d={};n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=function(e){for(var t=0,r=[],i=0|e.length/3;0<i--;){var a=(e[t]<<16)+(e[t+1]<<8)+e[t+2];t+=3,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push(n.charAt(63&a))}return 2==e.length-t?(a=(e[t]<<16)+(e[t+1]<<8),r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push("=")):1==e.length-t&&(a=e[t]<<16,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push("==")),r.join("")},o=function(){for(var e=[],t=0;t<n.length;++t)e[n.charCodeAt(t)]=t;return e["=".charCodeAt(0)]=0,e}(),u=function(e){for(var t=0,r=[],n=0|e.length/4;0<n--;){var i=(o[e.charCodeAt(t)]<<18)+(o[e.charCodeAt(t+1)]<<12)+(o[e.charCodeAt(t+2)]<<6)+o[e.charCodeAt(t+3)];r.push(255&i>>16),r.push(255&i>>8),r.push(255&i),t+=4}return r&&("="==e.charAt(t-2)?(r.pop(),r.pop()):"="==e.charAt(t-1)&&r.pop()),r},l={encode:function(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t},decode:function(e){for(var t=0;t<s.length;++t)a[t]=String.fromCharCode(a[t]);return a.join("")}},d.decodeArray=function(e){var t=u(e);return new Uint8Array(t)},d.encodeASCII=function(e){var t=l.encode(e);return i(t)},d.decodeASCII=function(e){var t=u(e);return l.decode(t)},d.encode=function(e){var t=c(e);return i(t)},d.decode=function(e){var t=u(e);return f(t)},t.decode=d.decode,t.decodeArray=d.decodeArray,t.encode=d.encode,t.encodeASCII=d.encodeASCII},"./externals/cea608-parser.js":function(e,t,r){!function(e){"use strict";var t={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},r=function(e){var r=e;return t.hasOwnProperty(e)&&(r=t[e]),String.fromCharCode(r)},n=15,i=32,a={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},s={17:2,18:4,21:6,22:8,23:10,19:13,20:15},o={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},u={25:2,26:4,29:6,30:8,31:10,27:13,28:15},l=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],c={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){var r=this.verboseFilter[e];this.verboseLevel>=r&&console.log(this.time+" ["+e+"] "+t)}},f=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},d=function(e,t,r,n,i){this.foreground=e||"white",this.underline=t||!1,this.italics=r||!1,this.background=n||"black",this.flash=i||!1};d.prototype={reset:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},setStyles:function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var n=t[r];e.hasOwnProperty(n)&&(this[n]=e[n])}},isDefault:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},equals:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},copy:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},toString:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}};var h=function(e,t,r,n,i,a){this.uchar=e||" ",this.penState=new d(t,r,n,i,a)};h.prototype={reset:function(){this.uchar=" ",this.penState.reset()},setChar:function(e,t){this.uchar=e,this.penState.copy(t)},setPenState:function(e){this.penState.copy(e)},equals:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},copy:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},isEmpty:function(){return" "===this.uchar&&this.penState.isDefault()}};var g=function(){this.chars=[];for(var e=0;e<i;e++)this.chars.push(new h);this.pos=0,this.currPenState=new d};g.prototype={equals:function(e){for(var t=!0,r=0;r<i;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t},copy:function(e){for(var t=0;t<i;t++)this.chars[t].copy(e.chars[t])},isEmpty:function(){for(var e=!0,t=0;t<i;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},setCursor:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(c.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>i&&(c.log("ERROR","Too large cursor position "+this.pos),this.pos=i)},moveCursor:function(e){var t=this.pos+e;if(e>1)for(var r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)},backSpace:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},insertChar:function(e){e>=144&&this.backSpace();var t=r(e);this.pos>=i?c.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},clearFromPos:function(e){var t;for(t=e;t<i;t++)this.chars[t].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var e=[],t=!0,r=0;r<i;r++){var n=this.chars[r].uchar;" "!==n&&(t=!1),e.push(n)}return t?"":e.join("")},setPenStyles:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var p=function(){this.rows=[];for(var e=0;e<n;e++)this.rows.push(new g);this.currRow=14,this.nrRollUpRows=null,this.reset()};p.prototype={reset:function(){for(var e=0;e<n;e++)this.rows[e].clear();this.currRow=14},equals:function(e){for(var t=!0,r=0;r<n;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t},copy:function(e){for(var t=0;t<n;t++)this.rows[t].copy(e.rows[t])},isEmpty:function(){for(var e=!0,t=0;t<n;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(e){this.rows[this.currRow].insertChar(e)},setPen:function(e){this.rows[this.currRow].setPenStyles(e)},moveCursor:function(e){this.rows[this.currRow].moveCursor(e)},setCursor:function(e){c.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},setPAC:function(e){c.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.currRow=t;var r=this.rows[this.currRow];if(null!==e.indent){var n=e.indent,i=Math.max(n-1,0);r.setCursor(e.indent),e.color=r.chars[i].penState.foreground}var a={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(a)},setBkgData:function(e){c.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},setRollUpRows:function(e){this.nrRollUpRows=e},rollUp:function(){if(null!==this.nrRollUpRows){c.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),c.log("INFO","Rolling up")}else c.log("DEBUG","roll_up but nrRollUpRows not set yet")},getDisplayText:function(e){e=e||!1;for(var t=[],r="",i=-1,a=0;a<n;a++){var s=this.rows[a].getTextString();s&&(i=a+1,e?t.push("Row "+i+': "'+s+'"'):t.push(s.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r},getTextAndFormat:function(){return this.rows}};var m=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new p,this.nonDisplayedMemory=new p,this.lastOutputScreen=new p,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};m.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(e){this.outputFilter=e},setPAC:function(e){this.writeScreen.setPAC(e)},setBkgData:function(e){this.writeScreen.setBkgData(e)},setMode:function(e){e!==this.mode&&(this.mode=e,c.log("INFO","MODE="+e),"MODE_POP-ON"==this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},insertChars:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";c.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(c.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},cc_RCL:function(){c.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},cc_BS:function(){c.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},cc_AOF:function(){},cc_AON:function(){},cc_DER:function(){c.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},cc_RU:function(e){c.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},cc_FON:function(){c.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},cc_RDC:function(){c.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},cc_TR:function(){c.log("INFO","TR"),this.setMode("MODE_TEXT")},cc_RTD:function(){c.log("INFO","RTD"),this.setMode("MODE_TEXT")},cc_EDM:function(){c.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},cc_CR:function(){c.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},cc_ENM:function(){c.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},cc_EOC:function(){if(c.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,c.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()},cc_TO:function(e){c.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},cc_MIDROW:function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var r=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][r]}c.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=c.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var v=function(e,t,r){this.field=e||1,this.outputs=[t,r],this.channels=[new m(1,t),new m(2,r)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};v.prototype={getHandler:function(e){return this.channels[e].getHandler()},setHandler:function(e,t){this.channels[e].setHandler(t)},addData:function(e,t){var r,n,i,a=!1;this.lastTime=e,c.setTime(e);for(var s=0;s<t.length;s+=2)n=127&t[s],i=127&t[s+1],n>=16&&n<=31&&n===this.lastCmdA&&i===this.lastCmdB?(this.lastCmdA=null,this.lastCmdB=null,c.log("DEBUG","Repeated command ("+f([n,i])+") is dropped")):0!==n||0!==i?(c.log("DATA","["+f([t[s],t[s+1]])+"] -> ("+f([n,i])+")"),(r=this.parseCmd(n,i))||(r=this.parseMidrow(n,i)),r||(r=this.parsePAC(n,i)),r||(r=this.parseBackgroundAttributes(n,i)),r||(a=this.parseChars(n,i))&&(this.currChNr&&this.currChNr>=0?this.channels[this.currChNr-1].insertChars(a):c.log("WARNING","No channel found yet. TEXT-MODE?")),r?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,c.log("WARNING","Couldn't parse cleaned data "+f([n,i])+" orig: "+f([t[s],t[s+1]])))):this.dataCounters.padding+=2},parseCmd:function(e,t){var r;if(!((20===e||21===e||28===e||29===e)&&32<=t&&t<=47||(23===e||31===e)&&33<=t&&t<=35))return!1;r=20===e||21===e||23===e?1:2;var n=this.channels[r-1];return 20===e||21===e||28===e||29===e?32===t?n.cc_RCL():33===t?n.cc_BS():34===t?n.cc_AOF():35===t?n.cc_AON():36===t?n.cc_DER():37===t?n.cc_RU(2):38===t?n.cc_RU(3):39===t?n.cc_RU(4):40===t?n.cc_FON():41===t?n.cc_RDC():42===t?n.cc_TR():43===t?n.cc_RTD():44===t?n.cc_EDM():45===t?n.cc_CR():46===t?n.cc_ENM():47===t&&n.cc_EOC():n.cc_TO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0},parseMidrow:function(e,t){var r=null;if((17===e||25===e)&&32<=t&&t<=47){if((r=17===e?1:2)!==this.currChNr)return c.log("ERROR","Mismatch channel in midrow parsing"),!1;var n=this.channels[r-1];return n.insertChars([32]),n.cc_MIDROW(t),c.log("DEBUG","MIDROW ("+f([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var r,n;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127||(16===e||24===e)&&64<=t&&t<=95))return!1;r=e<=23?1:2,n=64<=t&&t<=95?1===r?a[e]:o[e]:1===r?s[e]:u[e];var i=this.interpretPAC(n,t);return this.channels[r-1].setPAC(i),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0},interpretPAC:function(e,t){var r,n={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n},parseChars:function(e,t){var n=null,i=null,a=null;if(e>=25?(n=2,a=e-8):(n=1,a=e),17<=a&&a<=19){var s;s=17===a?t+80:18===a?t+112:t+144,c.log("INFO","Special char '"+r(s)+"' in channel "+n),i=[s],this.lastCmdA=e,this.lastCmdB=t}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t],this.lastCmdA=null,this.lastCmdB=null);if(i){var o=f(i);c.log("DEBUG","Char codes = "+o.join(","))}return i},parseBackgroundAttributes:function(e,t){var r,n,i;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(r={},16===e||24===e?(n=Math.floor((t-32)/2),r.background=l[n],t%2==1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),i=e<24?1:2,this.channels[i-1].setBkgData(r),this.lastCmdA=e,this.lastCmdB=t,!0)},reset:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null},cueSplitAtTime:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}},e.logger=c,e.PenState=d,e.CaptionScreen=p,e.Cea608Parser=v,e.findCea608Nalus=function(e,t,r){for(var n=0,i=t,a=[],s=function(e,t,r,n){if(4!==e||t<8)return null;var i=r.getUint8(n),a=r.getUint16(n+1),s=r.getUint32(n+3),o=r.getUint8(n+7);return 181==i&&49==a&&1195456820==s&&3==o};i<t+r;){if(n=e.getUint32(i),6==(31&e.getUint8(i+4)))for(var o=i+5,u=-1;o<i+4+n-1;){u=0;for(var l=255;255===l;)u+=l=e.getUint8(o),o++;var c=0;for(l=255;255===l;)c+=l=e.getUint8(o),o++;s(u,c,e,o)&&a.push([o,c]),o+=c}i+=n+4}return a},e.extractCea608DataFromRange=function(e,t){var r=t[0],n=[[],[]];r+=8;var i=31&e.getUint8(r);r+=2;for(var a=0;a<i;a++){var s=e.getUint8(r),o=4&s,u=3&s;r++;var l=e.getUint8(r);r++;var c=e.getUint8(r);r++,o&&(127&l)+(127&c)!=0&&(0===u?(n[0].push(l),n[0].push(c)):1===u&&(n[1].push(l),n[1].push(c)))}return n}}(t)},"./externals/xml2json.js":function(e,t,r){"use strict";r.r(t),t.default=function(e){void 0===(e=e||{}).escapeMode&&(e.escapeMode=!0),void 0===e.attributePrefix&&(e.attributePrefix="_"),e.arrayAccessForm=e.arrayAccessForm||"none",e.emptyNodeForm=e.emptyNodeForm||"text",void 0===e.enableToStringFunc&&(e.enableToStringFunc=!0),e.arrayAccessFormPaths=e.arrayAccessFormPaths||[],void 0===e.skipEmptyTextNodesForObj&&(e.skipEmptyTextNodesForObj=!0),void 0===e.stripWhitespaces&&(e.stripWhitespaces=!0),e.datetimeAccessFormPaths=e.datetimeAccessFormPaths||[],void 0===e.useDoubleQuotes&&(e.useDoubleQuotes=!1),e.xmlElementsFilter=e.xmlElementsFilter||[],e.jsonPropertiesFilter=e.jsonPropertiesFilter||[],void 0===e.keepCData&&(e.keepCData=!1),void 0===e.ignoreRoot&&(e.ignoreRoot=!1);function t(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!=t||(t=e.nodeName),t}function r(e){return"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"):e}function n(e,t,r,n){for(var i=0;i<e.length;i++){var a=e[i];if("string"==typeof a){if(a==n)break}else if(a instanceof RegExp){if(a.test(n))break}else if("function"==typeof a&&a(t,r,n))break}return i!=e.length}function i(t,r,i){"property"===e.arrayAccessForm&&(t[r]instanceof Array?t[r+"_asArray"]=t[r]:t[r+"_asArray"]=[t[r]]),!(t[r]instanceof Array)&&e.arrayAccessFormPaths.length>0&&n(e.arrayAccessFormPaths,t,r,i)&&(t[r]=[t[r]])}function a(e){var t=e.split(/[-T:+Z]/g),r=new Date(t[0],t[1]-1,t[2]),n=t[5].split(".");if(r.setHours(t[3],t[4],n[0]),n.length>1&&r.setMilliseconds(n[1]),t[6]&&t[7]){var i=60*t[6]+Number(t[7]);i=0+("-"==(/\d\d-\d\d:\d\d$/.test(e)?"-":"+")?-1*i:i),r.setMinutes(r.getMinutes()-i-r.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(r=new Date(Date.UTC(r.getFullYear(),r.getMonth(),r.getDate(),r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds())));return r}function s(t,r,i,a){return!(1==r&&e.xmlElementsFilter.length>0)||n(e.xmlElementsFilter,t,i,a)}function o(r,u){if(9==r.nodeType){for(var l=new Object,c=r.childNodes,f=0;f<c.length;f++)1==(h=c[f]).nodeType&&(e.ignoreRoot?l=o(h):(l={})[g=t(h)]=o(h));return l}if(1==r.nodeType){(l=new Object).__cnt=0;var d=[];for(c=r.childNodes,f=0;f<c.length;f++){var h,g=t(h=c[f]);if(8!=h.nodeType){var p=u+"."+g;if(s(l,h.nodeType,g,p))if(l.__cnt++,null==l[g]){var m=o(h,p);("#text"!=g||/[^\s]/.test(m))&&((v={})[g]=m,d.push(v)),l[g]=m,i(l,g,p)}else{var v;null!=l[g]&&(l[g]instanceof Array||(l[g]=[l[g]],i(l,g,p))),m=o(h,p),("#text"!=g||/[^\s]/.test(m))&&((v={})[g]=m,d.push(v)),l[g][l[g].length]=m}}}l.__children=d;for(var y=t(r),E=0;E<r.attributes.length;E++){var T=r.attributes[E];l.__cnt++;for(var _=T.value,S=0,b=e.matchers.length;S<b;S++){var A=e.matchers[S];A.test(T,y)&&(_=A.converter(T.value))}l[e.attributePrefix+T.name]=_}var R=function(e){return e.prefix}(r);return null!=R&&""!=R&&(l.__cnt++,l.__prefix=R),null!=l["#text"]&&(l.__text=l["#text"],l.__text instanceof Array&&(l.__text=l.__text.join("\n")),e.stripWhitespaces&&(l.__text=l.__text.trim()),delete l["#text"],"property"==e.arrayAccessForm&&delete l["#text_asArray"],l.__text=function(t,r,i){if(e.datetimeAccessFormPaths.length>0){var s=i.split(".#")[0];return n(e.datetimeAccessFormPaths,t,r,s)?a(t):t}return t}(l.__text,g,u+"."+g)),null!=l["#cdata-section"]&&(l.__cdata=l["#cdata-section"],delete l["#cdata-section"],"property"==e.arrayAccessForm&&delete l["#cdata-section_asArray"]),0==l.__cnt&&"text"==e.emptyNodeForm?l="":1==l.__cnt&&null!=l.__text?l=l.__text:1!=l.__cnt||null==l.__cdata||e.keepCData?l.__cnt>1&&null!=l.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==l.__text||""==l.__text.trim())&&delete l.__text:l=l.__cdata,delete l.__cnt,!e.enableToStringFunc||null==l.__text&&null==l.__cdata||(l.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),l}if(3==r.nodeType||4==r.nodeType)return r.nodeValue}function u(t,n,i,a){var s="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+n;if(null!=i)for(var o=0;o<i.length;o++){var u=i[o],l=t[u];e.escapeMode&&(l=r(l)),s+=" "+u.substr(e.attributePrefix.length)+"=",e.useDoubleQuotes?s+='"'+l+'"':s+="'"+l+"'"}return s+(a?"/>":">")}function l(e,t){return"</"+(null!=e.__prefix?e.__prefix+":":"")+t+">"}function c(t,r){return"property"==e.arrayAccessForm&&(i="_asArray",-1!==(n=r.toString()).indexOf(i,n.length-i.length))||0==r.toString().indexOf(e.attributePrefix)||0==r.toString().indexOf("__")||t[r]instanceof Function;var n,i}function f(e){var t=0;if(e instanceof Object)for(var r in e)c(e,r)||t++;return t}function d(t,r,i){return 0==e.jsonPropertiesFilter.length||""==i||n(e.jsonPropertiesFilter,t,r,i)}function h(t){var r=[];if(t instanceof Object)for(var n in t)-1==n.toString().indexOf("__")&&0==n.toString().indexOf(e.attributePrefix)&&r.push(n);return r}function g(t){var n="";return t instanceof Object?n+=function(t){var n="";return null!=t.__cdata&&(n+="<![CDATA["+t.__cdata+"]]>"),null!=t.__text&&(e.escapeMode?n+=r(t.__text):n+=t.__text),n}(t):null!=t&&(e.escapeMode?n+=r(t):n+=t),n}function p(e,t){return""===e?t:e+"."+t}function m(e,t,r,n){var i="";if(0==e.length)i+=u(e,t,r,!0);else for(var a=0;a<e.length;a++)i+=u(e[a],t,h(e[a]),!1),i+=v(e[a],p(n,t)),i+=l(e[a],t);return i}function v(e,t){var r="";if(f(e)>0)for(var n in e)if(!c(e,n)&&(""==t||d(e,n,p(t,n)))){var i=e[n],a=h(i);null==i||null==i?r+=u(i,n,a,!0):i instanceof Object?i instanceof Array?r+=m(i,n,a,t):i instanceof Date?(r+=u(i,n,a,!1),r+=i.toISOString(),r+=l(i,n)):f(i)>0||null!=i.__text||null!=i.__cdata?(r+=u(i,n,a,!1),r+=v(i,p(t,n)),r+=l(i,n)):r+=u(i,n,a,!0):(r+=u(i,n,a,!1),r+=g(i),r+=l(i,n))}return r+g(e)}this.parseXmlString=function(e){var t;if(window.ActiveXObject||window,void 0===e)return null;if(window.DOMParser){var r=new window.DOMParser;try{(t=r.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}}else 0==e.indexOf("<?")&&(e=e.substr(e.indexOf("?>")+2)),(t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e);return t},this.asArray=function(e){return void 0===e||null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?a(e):e},this.xml2json=function(e){return o(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return v(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}}},"./index.js":function(e,t,r){"use strict";r.r(t);var n=r("./index_mediaplayerOnly.js");r.d(t,"MediaPlayer",(function(){return n.MediaPlayer}));var i=r("./src/streaming/utils/Capabilities.js");r.d(t,"supportsMediaSource",(function(){return i.supportsMediaSource}));var a=r("./src/streaming/metrics/MetricsReporting.js");r.d(t,"MetricsReporting",(function(){return a.default}));var s=r("./src/streaming/protection/Protection.js");r.d(t,"Protection",(function(){return s.default}));var o=r("./src/streaming/MediaPlayerFactory.js");r.d(t,"MediaPlayerFactory",(function(){return o.default}));var u=r("./src/core/Debug.js");r.d(t,"Debug",(function(){return u.default})),dashjs.Protection=s.default,dashjs.MetricsReporting=a.default,dashjs.MediaPlayerFactory=o.default,dashjs.Debug=u.default,dashjs.supportsMediaSource=i.supportsMediaSource,t.default=dashjs},"./index_mediaplayerOnly.js":function(e,t,r){"use strict";r.r(t),function(e){var n=r("./src/streaming/MediaPlayer.js");r.d(t,"MediaPlayer",(function(){return n.default}));var i=r("./src/core/FactoryMaker.js");r.d(t,"FactoryMaker",(function(){return i.default}));var a=r("./src/core/Debug.js");r.d(t,"Debug",(function(){return a.default}));var s=r("./src/core/Version.js"),o=(r("./node_modules/es6-promise/auto.js"),"undefined"!=typeof window&&window||e),u=o.dashjs;u||(u=o.dashjs={}),u.MediaPlayer=n.default,u.FactoryMaker=i.default,u.Debug=a.default,u.Version=Object(s.getVersionString)(),t.default=u}.call(this,r("./node_modules/webpack/buildin/global.js"))},"./node_modules/base64-js/index.js":function(e,t,r){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){for(var t,r=l(e),n=r[0],s=r[1],o=new a(function(e,t,r){return 3*(t+r)/4-r}(0,n,s)),u=0,c=s>0?n-4:n,f=0;f<c;f+=4)t=i[e.charCodeAt(f)]<<18|i[e.charCodeAt(f+1)]<<12|i[e.charCodeAt(f+2)]<<6|i[e.charCodeAt(f+3)],o[u++]=t>>16&255,o[u++]=t>>8&255,o[u++]=255&t;return 2===s&&(t=i[e.charCodeAt(f)]<<2|i[e.charCodeAt(f+1)]>>4,o[u++]=255&t),1===s&&(t=i[e.charCodeAt(f)]<<10|i[e.charCodeAt(f+1)]<<4|i[e.charCodeAt(f+2)]>>2,o[u++]=t>>8&255,o[u++]=255&t),o},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],s=16383,o=0,u=r-i;o<u;o+=s)a.push(c(e,o,o+s>u?u:o+s));return 1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=s.length;o<u;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var i,a,s=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},"./node_modules/codem-isoboxer/dist/iso_boxer.js":function(e,t,r){var n={parseBuffer:function(e){return new i(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(a.prototype._boxProcessors[e]=t)},createFile:function(){return new i},createBox:function(e,t,r){var n=a.create(e);return t&&t.append(n,r),n},createFullBox:function(e,t,r){var i=n.createBox(e,t,r);return i.version=0,i.flags=0,i},Utils:{}};n.Utils.dataViewToString=function(e,t){var r=t||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(r).decode(e);var n=[],i=0;if("utf-8"===r)for(;i<e.byteLength;){var a=e.getUint8(i++);a<128||(a<224?(a=(31&a)<<6,a|=63&e.getUint8(i++)):a<240?(a=(15&a)<<12,a|=(63&e.getUint8(i++))<<6,a|=63&e.getUint8(i++)):(a=(7&a)<<18,a|=(63&e.getUint8(i++))<<12,a|=(63&e.getUint8(i++))<<6,a|=63&e.getUint8(i++))),n.push(String.fromCharCode(a))}else for(;i<e.byteLength;)n.push(String.fromCharCode(e.getUint8(i++)));return n.join("")},n.Utils.utf8ToByteArray=function(e){var t,r;if("undefined"!=typeof TextEncoder)t=(new TextEncoder).encode(e);else for(t=[],r=0;r<e.length;++r){var n=e.charCodeAt(r);n<128?t.push(n):n<2048?(t.push(192|n>>6),t.push(128|63&n)):n<65536?(t.push(224|n>>12),t.push(128|63&n>>6),t.push(128|63&n)):(t.push(240|n>>18),t.push(128|63&n>>12),t.push(128|63&n>>6),t.push(128|63&n))}return t},n.Utils.appendBox=function(e,t,r){if(t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,-1!==r)if(null!=r){var n,i=-1;if("number"==typeof r)i=r;else{if("string"==typeof r)n=r;else{if("object"!=typeof r||!r.type)return void e.boxes.push(t);n=r.type}for(var a=0;a<e.boxes.length;a++)if(n===e.boxes[a].type){i=a+1;break}}e.boxes.splice(i,0,t)}else e.boxes.push(t)},t.parseBuffer=n.parseBuffer,t.addBoxProcessor=n.addBoxProcessor,t.createFile=n.createFile,t.createBox=n.createBox,t.createFullBox=n.createFullBox,t.Utils=n.Utils,n.Cursor=function(e){this.offset=void 0===e?0:e};var i=function(e){this._cursor=new n.Cursor,this.boxes=[],e&&(this._raw=new DataView(e))};i.prototype.fetch=function(e){var t=this.fetchAll(e,!0);return t.length?t[0]:null},i.prototype.fetchAll=function(e,t){var r=[];return i._sweep.call(this,e,r,t),r},i.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var e=a.parse(this);if(void 0===e.type)break;this.boxes.push(e)}return this},i._sweep=function(e,t,r){for(var n in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;i._sweep.call(this.boxes[n],e,t,r)}},i.prototype.write=function(){var e,t=0;for(e=0;e<this.boxes.length;e++)t+=this.boxes[e].getLength(!1);var r=new Uint8Array(t);for(this._rawo=new DataView(r.buffer),this.bytes=r,this._cursor.offset=0,e=0;e<this.boxes.length;e++)this.boxes[e].write();return r.buffer},i.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)};var a=function(){this._cursor=new n.Cursor};a.parse=function(e){var t=new a;return t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,t._parseBox(),e._cursor.offset=t._raw.byteOffset+t._raw.byteLength,t},a.create=function(e){var t=new a;return t.type=e,t.boxes=[],t},a.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],a.prototype._boxProcessors={},a.prototype._procField=function(e,t,r){this._parsing?this[e]=this._readField(t,r):this._writeField(t,r,this[e])},a.prototype._procFieldArray=function(e,t,r,n){var i;if(this._parsing)for(this[e]=[],i=0;i<t;i++)this[e][i]=this._readField(r,n);else for(i=0;i<this[e].length;i++)this._writeField(r,n,this[e][i])},a.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},a.prototype._procEntries=function(e,t,r){var n;if(this._parsing)for(this[e]=[],n=0;n<t;n++)this[e].push({}),r.call(this,this[e][n]);else for(n=0;n<t;n++)r.call(this,this[e][n])},a.prototype._procSubEntries=function(e,t,r,n){var i;if(this._parsing)for(e[t]=[],i=0;i<r;i++)e[t].push({}),n.call(this,e[t][i]);else for(i=0;i<r;i++)n.call(this,e[t][i])},a.prototype._procEntryField=function(e,t,r,n){this._parsing?e[t]=this._readField(r,n):this._writeField(r,n,e[t])},a.prototype._procSubBoxes=function(e,t){var r;if(this._parsing)for(this[e]=[],r=0;r<t;r++)this[e].push(a.parse(this));else for(r=0;r<t;r++)this._rawo?this[e][r].write():this.size+=this[e][r].getLength()},a.prototype._readField=function(e,t){switch(e){case"uint":return this._readUint(t);case"int":return this._readInt(t);case"template":return this._readTemplate(t);case"string":return-1===t?this._readTerminatedString():this._readString(t);case"data":return this._readData(t);case"utf8":return this._readUTF8String();default:return-1}},a.prototype._readInt=function(e){var t=null,r=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:t=this._raw.getInt8(r);break;case 16:t=this._raw.getInt16(r);break;case 32:t=this._raw.getInt32(r);break;case 64:var n=this._raw.getInt32(r),i=this._raw.getInt32(r+4);t=n*Math.pow(2,32)+i}return this._cursor.offset+=e>>3,t},a.prototype._readUint=function(e){var t,r,n=null,i=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:n=this._raw.getUint8(i);break;case 16:n=this._raw.getUint16(i);break;case 24:n=((t=this._raw.getUint16(i))<<8)+(r=this._raw.getUint8(i+2));break;case 32:n=this._raw.getUint32(i);break;case 64:t=this._raw.getUint32(i),r=this._raw.getUint32(i+4),n=t*Math.pow(2,32)+r}return this._cursor.offset+=e>>3,n},a.prototype._readString=function(e){for(var t="",r=0;r<e;r++){var n=this._readUint(8);t+=String.fromCharCode(n)}return t},a.prototype._readTemplate=function(e){return this._readUint(e/2)+this._readUint(e/2)/Math.pow(2,e/2)},a.prototype._readTerminatedString=function(){for(var e="";this._cursor.offset-this._offset<this._raw.byteLength;){var t=this._readUint(8);if(0===t)break;e+=String.fromCharCode(t)}return e},a.prototype._readData=function(e){var t=e>0?e:this._raw.byteLength-(this._cursor.offset-this._offset);if(t>0){var r=new Uint8Array(this._raw.buffer,this._cursor.offset,t);return this._cursor.offset+=t,r}return null},a.prototype._readUTF8String=function(){var e=this._raw.byteLength-(this._cursor.offset-this._offset),t=null;return e>0&&(t=new DataView(this._raw.buffer,this._cursor.offset,e),this._cursor.offset+=e),t?n.Utils.dataViewToString(t):t},a.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset+8);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())}},a.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},a.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(a.parse(this))},a.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)},a.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.size+=this.boxes[e].getLength();return this._data&&this._writeData(this._data),this.size},a.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.boxes[e].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},a.prototype._writeInt=function(e,t){if(this._rawo){var r=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setInt8(r,t);break;case 16:this._rawo.setInt16(r,t);break;case 32:this._rawo.setInt32(r,t);break;case 64:var n=Math.floor(t/Math.pow(2,32)),i=t-n*Math.pow(2,32);this._rawo.setUint32(r,n),this._rawo.setUint32(r+4,i)}this._cursor.offset+=e>>3}else this.size+=e>>3},a.prototype._writeUint=function(e,t){if(this._rawo){var r,n,i=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setUint8(i,t);break;case 16:this._rawo.setUint16(i,t);break;case 24:r=(16776960&t)>>8,n=255&t,this._rawo.setUint16(i,r),this._rawo.setUint8(i+2,n);break;case 32:this._rawo.setUint32(i,t);break;case 64:n=t-(r=Math.floor(t/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(i,r),this._rawo.setUint32(i+4,n)}this._cursor.offset+=e>>3}else this.size+=e>>3},a.prototype._writeString=function(e,t){for(var r=0;r<e;r++)this._writeUint(8,t.charCodeAt(r))},a.prototype._writeTerminatedString=function(e){if(0!==e.length){for(var t=0;t<e.length;t++)this._writeUint(8,e.charCodeAt(t));this._writeUint(8,0)}},a.prototype._writeTemplate=function(e,t){var r=Math.floor(t),n=(t-r)*Math.pow(2,e/2);this._writeUint(e/2,r),this._writeUint(e/2,n)},a.prototype._writeData=function(e){if(e)if(this._rawo){if(e instanceof Array){for(var t=this._cursor.offset-this._rawo.byteOffset,r=0;r<e.length;r++)this._rawo.setInt8(t+r,e[r]);this._cursor.offset+=e.length}e instanceof Uint8Array&&(this._root.bytes.set(e,this._cursor.offset),this._cursor.offset+=e.length)}else this.size+=e.length},a.prototype._writeUTF8String=function(e){var t=n.Utils.utf8ToByteArray(e);if(this._rawo)for(var r=new DataView(this._rawo.buffer,this._cursor.offset,t.length),i=0;i<t.length;i++)r.setUint8(i,t[i]);else this.size+=t.length},a.prototype._writeField=function(e,t,r){switch(e){case"uint":this._writeUint(t,r);break;case"int":this._writeInt(t,r);break;case"template":this._writeTemplate(t,r);break;case"string":-1==t?this._writeTerminatedString(r):this._writeString(t,r);break;case"data":this._writeData(r);break;case"utf8":this._writeUTF8String(r)}},a.prototype._boxProcessors.avc1=a.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},a.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},a.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"segment_duration","uint",1===this.version?64:32),this._procEntryField(e,"media_time","int",1===this.version?64:32),this._procEntryField(e,"media_rate_integer","int",16),this._procEntryField(e,"media_rate_fraction","int",16)}))},a.prototype._boxProcessors.emsg=function(){this._procFullBox(),1==this.version?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},a.prototype._boxProcessors.free=a.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},a.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},a.prototype._boxProcessors.ftyp=a.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var e=-1;this._parsing&&(e=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",e,"string",4)},a.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},a.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},a.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},a.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},a.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},a.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},a.prototype._boxProcessors.mp4a=a.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},a.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},a.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},a.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},a.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},a.prototype._boxProcessors.sdtp=function(){this._procFullBox();var e=-1;this._parsing&&(e=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",e,"uint",8)},a.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(e){this._parsing||(e.reference=(1&e.reference_type)<<31,e.reference|=2147483647&e.referenced_size,e.sap=(1&e.starts_with_SAP)<<31,e.sap|=(3&e.SAP_type)<<28,e.sap|=268435455&e.SAP_delta_time),this._procEntryField(e,"reference","uint",32),this._procEntryField(e,"subsegment_duration","uint",32),this._procEntryField(e,"sap","uint",32),this._parsing&&(e.reference_type=e.reference>>31&1,e.referenced_size=2147483647&e.reference,e.starts_with_SAP=e.sap>>31&1,e.SAP_type=e.sap>>28&7,e.SAP_delta_time=268435455&e.sap)}))},a.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},a.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(e){this._procEntryField(e,"ranges_count","uint",32),this._procSubEntries(e,"ranges",e.ranges_count,(function(e){this._procEntryField(e,"level","uint",8),this._procEntryField(e,"range_size","uint",24)}))}))},a.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},a.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_delta","uint",32),this._procEntryField(e,"subsample_count","uint",16),this._procSubEntries(e,"subsamples",e.subsample_count,(function(e){this._procEntryField(e,"subsample_size","uint",1===this.version?32:16),this._procEntryField(e,"subsample_priority","uint",8),this._procEntryField(e,"discardable","uint",8),this._procEntryField(e,"codec_specific_parameters","uint",32)}))}))},a.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},a.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},a.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},a.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(e){this._procEntryField(e,"time","uint",1===this.version?64:32),this._procEntryField(e,"moof_offset","uint",1===this.version?64:32),this._procEntryField(e,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(e,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(e,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},a.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},a.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},a.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(e){256&this.flags&&this._procEntryField(e,"sample_duration","uint",32),512&this.flags&&this._procEntryField(e,"sample_size","uint",32),1024&this.flags&&this._procEntryField(e,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(e,"sample_composition_time_of