9 lines
246 KiB
JavaScript
9 lines
246 KiB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,function(){return function(e){function t(a){if(r[a])return r[a].exports;var n=r[a]={exports:{},id:a,loaded:!1};return e[a].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}();r(1);var s=r(5),o=function(){function e(t){var r=this;a(this,e),this.svg={play:["0 0 16 32","M15.552 15.168q0.448 0.32 0.448 0.832 0 0.448-0.448 0.768l-13.696 8.512q-0.768 0.512-1.312 0.192t-0.544-1.28v-16.448q0-0.96 0.544-1.28t1.312 0.192z"],pause:["0 0 17 32","M14.080 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048zM2.88 4.8q2.88 0 2.88 2.048v18.24q0 2.112-2.88 2.112t-2.88-2.112v-18.24q0-2.048 2.88-2.048z"],"volume-up":["0 0 21 32","M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528zM25.152 16q0 2.72-1.536 5.056t-4 3.36q-0.256 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.704 0.672-1.056 1.024-0.512 1.376-0.8 1.312-0.96 2.048-2.4t0.736-3.104-0.736-3.104-2.048-2.4q-0.352-0.288-1.376-0.8-0.672-0.352-0.672-1.056 0-0.448 0.32-0.8t0.8-0.352q0.224 0 0.48 0.096 2.496 1.056 4 3.36t1.536 5.056zM29.728 16q0 4.096-2.272 7.552t-6.048 5.056q-0.224 0.096-0.448 0.096-0.48 0-0.832-0.352t-0.32-0.8q0-0.64 0.704-1.056 0.128-0.064 0.384-0.192t0.416-0.192q0.8-0.448 1.44-0.896 2.208-1.632 3.456-4.064t1.216-5.152-1.216-5.152-3.456-4.064q-0.64-0.448-1.44-0.896-0.128-0.096-0.416-0.192t-0.384-0.192q-0.704-0.416-0.704-1.056 0-0.448 0.32-0.8t0.832-0.352q0.224 0 0.448 0.096 3.776 1.632 6.048 5.056t2.272 7.552z"],"volume-down":["0 0 21 32","M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8zM20.576 16q0 1.344-0.768 2.528t-2.016 1.664q-0.16 0.096-0.448 0.096-0.448 0-0.8-0.32t-0.32-0.832q0-0.384 0.192-0.64t0.544-0.448 0.608-0.384 0.512-0.64 0.192-1.024-0.192-1.024-0.512-0.64-0.608-0.384-0.544-0.448-0.192-0.64q0-0.48 0.32-0.832t0.8-0.32q0.288 0 0.448 0.096 1.248 0.48 2.016 1.664t0.768 2.528z"],"volume-off":["0 0 21 32","M13.728 6.272v19.456q0 0.448-0.352 0.8t-0.8 0.32-0.8-0.32l-5.952-5.952h-4.672q-0.48 0-0.8-0.352t-0.352-0.8v-6.848q0-0.48 0.352-0.8t0.8-0.352h4.672l5.952-5.952q0.32-0.32 0.8-0.32t0.8 0.32 0.352 0.8z"],loop:["0 0 32 32","M1.882 16.941c0 4.152 3.221 7.529 7.177 7.529v1.882c-4.996 0-9.060-4.222-9.060-9.412s4.064-9.412 9.060-9.412h7.96l-3.098-3.098 1.331-1.331 5.372 5.37-5.37 5.372-1.333-1.333 3.1-3.098h-7.962c-3.957 0-7.177 3.377-7.177 7.529zM22.94 7.529v1.882c3.957 0 7.177 3.377 7.177 7.529s-3.221 7.529-7.177 7.529h-7.962l3.098-3.098-1.331-1.331-5.37 5.37 5.372 5.372 1.331-1.331-3.1-3.1h7.96c4.998 0 9.062-4.222 9.062-9.412s-4.064-9.412-9.060-9.412z"],full:["0 0 32 33","M6.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v4h4c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333zM30.667 28h-5.333c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h4v-4c0-0.8 0.533-1.333 1.333-1.333s1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM30.667 12c-0.8 0-1.333-0.533-1.333-1.333v-4h-4c-0.8 0-1.333-0.533-1.333-1.333s0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333v5.333c0 0.8-0.533 1.333-1.333 1.333zM1.333 12c-0.8 0-1.333-0.533-1.333-1.333v-5.333c0-0.8 0.533-1.333 1.333-1.333h5.333c0.8 0 1.333 0.533 1.333 1.333s-0.533 1.333-1.333 1.333h-4v4c0 0.8-0.533 1.333-1.333 1.333z"],setting:["0 0 32 28","M28.633 17.104c0.035 0.21 0.026 0.463-0.026 0.76s-0.14 0.598-0.262 0.904c-0.122 0.306-0.271 0.581-0.445 0.825s-0.367 0.419-0.576 0.524c-0.209 0.105-0.393 0.157-0.55 0.157s-0.332-0.035-0.524-0.105c-0.175-0.052-0.393-0.1-0.655-0.144s-0.528-0.052-0.799-0.026c-0.271 0.026-0.541 0.083-0.812 0.17s-0.502 0.236-0.694 0.445c-0.419 0.437-0.664 0.934-0.734 1.493s0.009 1.092 0.236 1.598c0.175 0.349 0.148 0.699-0.079 1.048-0.105 0.14-0.271 0.284-0.498 0.432s-0.476 0.284-0.747 0.406-0.555 0.218-0.851 0.288c-0.297 0.070-0.559 0.105-0.786 0.105-0.157 0-0.306-0.061-0.445-0.183s-0.236-0.253-0.288-0.393h-0.026c-0.192-0.541-0.52-1.009-0.982-1.402s-1-0.589-1.611-0.589c-0.594 0-1.131 0.197-1.611 0.589s-0.816 0.851-1.009 1.375c-0.087 0.21-0.218 0.362-0.393 0.458s-0.367 0.144-0.576 0.144c-0.244 0-0.52-0.044-0.825-0.131s-0.611-0.197-0.917-0.327c-0.306-0.131-0.581-0.284-0.825-0.458s-0.428-0.349-0.55-0.524c-0.087-0.122-0.135-0.266-0.144-0.432s0.057-0.397 0.197-0.694c0.192-0.402 0.266-0.86 0.223-1.375s-0.266-0.991-0.668-1.428c-0.244-0.262-0.541-0.432-0.891-0.511s-0.681-0.109-0.995-0.092c-0.367 0.017-0.742 0.087-1.127 0.21-0.244 0.070-0.489 0.052-0.734-0.052-0.192-0.070-0.371-0.231-0.537-0.485s-0.314-0.533-0.445-0.838c-0.131-0.306-0.231-0.62-0.301-0.943s-0.087-0.59-0.052-0.799c0.052-0.384 0.227-0.629 0.524-0.734 0.524-0.21 0.995-0.555 1.415-1.035s0.629-1.017 0.629-1.611c0-0.611-0.21-1.144-0.629-1.598s-0.891-0.786-1.415-0.996c-0.157-0.052-0.288-0.179-0.393-0.38s-0.157-0.406-0.157-0.616c0-0.227 0.035-0.48 0.105-0.76s0.162-0.55 0.275-0.812 0.244-0.502 0.393-0.72c0.148-0.218 0.31-0.38 0.485-0.485 0.14-0.087 0.275-0.122 0.406-0.105s0.275 0.052 0.432 0.105c0.524 0.21 1.070 0.275 1.637 0.197s1.070-0.327 1.506-0.747c0.21-0.209 0.362-0.467 0.458-0.773s0.157-0.607 0.183-0.904c0.026-0.297 0.026-0.568 0-0.812s-0.048-0.419-0.065-0.524c-0.035-0.105-0.066-0.227-0.092-0.367s-0.013-0.262 0.039-0.367c0.105-0.244 0.293-0.458 0.563-0.642s0.563-0.336 0.878-0.458c0.314-0.122 0.62-0.214 0.917-0.275s0.533-0.092 0.707-0.092c0.227 0 0.406 0.074 0.537 0.223s0.223 0.301 0.275 0.458c0.192 0.471 0.507 0.886 0.943 1.244s0.952 0.537 1.546 0.537c0.611 0 1.153-0.17 1.624-0.511s0.803-0.773 0.996-1.297c0.070-0.14 0.179-0.284 0.327-0.432s0.301-0.223 0.458-0.223c0.244 0 0.511 0.035 0.799 0.105s0.572 0.166 0.851 0.288c0.279 0.122 0.537 0.279 0.773 0.472s0.423 0.402 0.563 0.629c0.087 0.14 0.113 0.293 0.079 0.458s-0.070 0.284-0.105 0.354c-0.227 0.506-0.297 1.039-0.21 1.598s0.341 1.048 0.76 1.467c0.419 0.419 0.934 0.651 1.546 0.694s1.179-0.057 1.703-0.301c0.14-0.087 0.31-0.122 0.511-0.105s0.371 0.096 0.511 0.236c0.262 0.244 0.493 0.616 0.694 1.113s0.336 1 0.406 1.506c0.035 0.297-0.013 0.528-0.144 0.694s-0.266 0.275-0.406 0.327c-0.542 0.192-1.004 0.528-1.388 1.009s-0.576 1.026-0.576 1.637c0 0.594 0.162 1.113 0.485 1.559s0.747 0.764 1.27 0.956c0.122 0.070 0.227 0.14 0.314 0.21 0.192 0.157 0.323 0.358 0.393 0.602v0zM16.451 19.462c0.786 0 1.528-0.149 2.227-0.445s1.305-0.707 1.821-1.231c0.515-0.524 0.921-1.131 1.218-1.821s0.445-1.428 0.445-2.214c0-0.786-0.148-1.524-0.445-2.214s-0.703-1.292-1.218-1.808c-0.515-0.515-1.122-0.921-1.821-1.218s-1.441-0.445-2.227-0.445c-0.786 0-1.524 0.148-2.214 0.445s-1.292 0.703-1.808 1.218c-0.515 0.515-0.921 1.118-1.218 1.808s-0.445 1.428-0.445 2.214c0 0.786 0.149 1.524 0.445 2.214s0.703 1.297 1.218 1.821c0.515 0.524 1.118 0.934 1.808 1.231s1.428 0.445 2.214 0.445v0z"],right:["0 0 32 32","M22 16l-10.105-10.6-1.895 1.987 8.211 8.613-8.211 8.612 1.895 1.988 8.211-8.613z"],comment:["0 0 32 32","M27.128 0.38h-22.553c-2.336 0-4.229 1.825-4.229 4.076v16.273c0 2.251 1.893 4.076 4.229 4.076h4.229v-2.685h8.403l-8.784 8.072 1.566 1.44 7.429-6.827h9.71c2.335 0 4.229-1.825 4.229-4.076v-16.273c0-2.252-1.894-4.076-4.229-4.076zM28.538 19.403c0 1.5-1.262 2.717-2.819 2.717h-8.36l-0.076-0.070-0.076 0.070h-11.223c-1.557 0-2.819-1.217-2.819-2.717v-13.589c0-1.501 1.262-2.718 2.819-2.718h19.734c1.557 0 2.819-0.141 2.819 1.359v14.947zM9.206 10.557c-1.222 0-2.215 0.911-2.215 2.036s0.992 2.035 2.215 2.035c1.224 0 2.216-0.911 2.216-2.035s-0.992-2.036-2.216-2.036zM22.496 10.557c-1.224 0-2.215 0.911-2.215 2.036s0.991 2.035 2.215 2.035c1.224 0 2.215-0.911 2.215-2.035s-0.991-2.036-2.215-2.036zM15.852 10.557c-1.224 0-2.215 0.911-2.215 2.036s0.991 2.035 2.215 2.035c1.222 0 2.215-0.911 2.215-2.035s-0.992-2.036-2.215-2.036z"],"comment-off":["0 0 32 32","M27.090 0.131h-22.731c-2.354 0-4.262 1.839-4.262 4.109v16.401c0 2.269 1.908 4.109 4.262 4.109h4.262v-2.706h8.469l-8.853 8.135 1.579 1.451 7.487-6.88h9.787c2.353 0 4.262-1.84 4.262-4.109v-16.401c0-2.27-1.909-4.109-4.262-4.109v0zM28.511 19.304c0 1.512-1.272 2.738-2.841 2.738h-8.425l-0.076-0.070-0.076 0.070h-11.311c-1.569 0-2.841-1.226-2.841-2.738v-13.696c0-1.513 1.272-2.739 2.841-2.739h19.889c1.569 0 2.841-0.142 2.841 1.37v15.064z"],send:["0 0 32 32","M13.725 30l3.9-5.325-3.9-1.125v6.45zM0 17.5l11.050 3.35 13.6-11.55-10.55 12.425 11.8 3.65 6.1-23.375-32 15.5z"],menu:["0 0 22 32","M20.8 14.4q0.704 0 1.152 0.48t0.448 1.12-0.48 1.12-1.12 0.48h-19.2q-0.64 0-1.12-0.48t-0.48-1.12 0.448-1.12 1.152-0.48h19.2zM1.6 11.2q-0.64 0-1.12-0.48t-0.48-1.12 0.448-1.12 1.152-0.48h19.2q0.704 0 1.152 0.48t0.448 1.12-0.48 1.12-1.12 0.48h-19.2zM20.8 20.8q0.704 0 1.152 0.48t0.448 1.12-0.48 1.12-1.12 0.48h-19.2q-0.64 0-1.12-0.48t-0.48-1.12 0.448-1.12 1.152-0.48h19.2z"]},this.getSVG=function(e){return'\n <svg xmlns:xlink="http://www.w3.org/1999/xlink" height="100%" version="1.1" viewBox="'+r.svg[e][0]+'" width="100%">\n <use xlink:href="#dplayer-'+e+'"></use>\n <path class="dplayer-fill" d="'+r.svg[e][1]+'" id="dplayer-'+e+'"></path>\n </svg>\n '},this.isMobile=navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i),this.isMobile&&(t.autoplay=!1);var n={element:document.getElementsByClassName("dplayer")[0],autoplay:!1,theme:"#b7daff",loop:!1,lang:"en"};for(var i in n)n.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=n[i]);this.option=t,this.loop=t.loop,this.tranZH={"Danmaku is loading":"弹幕加载中",Top:"顶部",Bottom:"底部",Rolling:"滚动","Input danmaku, hit Enter":"输入弹幕,回车发送","About author":"关于作者","DPlayer feedback":"播放器意见反馈","About DPlayer":"关于 DPlay 播放器",Loop:"洗脑循环",Speed:"速度","Opacity for danmaku":"弹幕透明度",Normal:"正常","Please input danmaku!":"要输入弹幕内容啊喂!"},this.getTran=function(e){return"en"===r.option.lang?e:"zh"===r.option.lang?r.tranZH[e]:void 0},this.secondToTime=function(e){var t=function(e){return e<10?"0"+e:""+e},r=parseInt(e/60),a=parseInt(e-60*r);return t(r)+":"+t(a)},this.updateBar=function(e,t,a){t=t>0?t:0,t=t<1?t:1,r[e+"Bar"].style[a]=100*t+"%"},this.eventTypes=["play","pause","canplay","playing","ended","error"],this.event={};for(var s=0;s<this.eventTypes.length;s++)this.event[this.eventTypes[s]]=[];this.trigger=function(e){for(var t=0;t<r.event[e].length;t++)r.event[e][t]()}}return i(e,[{key:"init",value:function(){var e=this;this.element=this.option.element,this.option.danmaku||this.element.classList.add("dplayer-no-danmaku"),this.element.innerHTML='\n <div class="dplayer-mask"></div>\n <div class="dplayer-video-wrap">\n <video class="dplayer-video" '+(this.option.video.pic?'poster="'+this.option.video.pic+'"':"")+'>\n <source src="'+this.option.video.url+'" type="video/mp4">\n </video>\n <div class="dplayer-danmaku"></div>\n <div class="dplayer-bezel">\n <span class="dplayer-bezel-icon"></span>\n '+(this.option.danmaku?'<span class="dplayer-danloading">'+this.getTran("Danmaku is loading")+"</span>":"")+'\n <span class="diplayer-loading-icon">\n <svg height="100%" version="1.1" viewBox="0 0 22 22" width="100%">\n <svg x="7" y="1">\n <circle class="diplayer-loading-dot diplayer-loading-dot-0" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="11" y="3">\n <circle class="diplayer-loading-dot diplayer-loading-dot-1" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="13" y="7">\n <circle class="diplayer-loading-dot diplayer-loading-dot-2" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="11" y="11">\n <circle class="diplayer-loading-dot diplayer-loading-dot-3" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="7" y="13">\n <circle class="diplayer-loading-dot diplayer-loading-dot-4" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="3" y="11">\n <circle class="diplayer-loading-dot diplayer-loading-dot-5" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="1" y="7">\n <circle class="diplayer-loading-dot diplayer-loading-dot-6" cx="4" cy="4" r="2"></circle>\n </svg>\n <svg x="3" y="3">\n <circle class="diplayer-loading-dot diplayer-loading-dot-7" cx="4" cy="4" r="2"></circle>\n </svg>\n </svg>\n </span>\n </div>\n </div>\n <div class="dplayer-controller-mask"></div>\n <div class="dplayer-controller">\n <div class="dplayer-icons dplayer-icons-left">\n <button class="dplayer-icon dplayer-play-icon">'+this.getSVG("play")+' </button>\n <div class="dplayer-volume">\n <button class="dplayer-icon dplayer-volume-icon">'+this.getSVG("volume-down")+(' </button>\n <div class="dplayer-volume-bar-wrap">\n <div class="dplayer-volume-bar">\n <div class="dplayer-volume-bar-inner" style="width: 70%; background: '+this.option.theme+';">\n <span class="dplayer-thumb" style="background: '+this.option.theme+'"></span>\n </div>\n </div>\n </div>\n </div>\n <span class="dplayer-time"><span class="dplayer-ptime">0:00</span> / <span class="dplayer-dtime">0:00</span></span>\n </div>\n <div class="dplayer-icons dplayer-icons-right">\n <div class="dplayer-comment">\n <button class="dplayer-icon dplayer-comment-icon">')+this.getSVG("comment")+' </button>\n <div class="dplayer-comment-box">\n <button class="dplayer-icon dplayer-comment-setting-icon">'+this.getSVG("menu")+(' </button>\n <div class="dplayer-comment-setting-box">\n <div class="dplayer-comment-setting-color">\n <div class="dplayer-comment-setting-title">设置弹幕颜色</div>\n <label>\n <input type="radio" name="dplayer-danmaku-color" value="#fff" checked>\n <span style="background: #fff; border: 1px solid rgba(0,0,0,.1);"></span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-color" value="#e54256">\n <span style="background: #e54256"></span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-color" value="#ffe133">\n <span style="background: #ffe133"></span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-color" value="#64DD17">\n <span style="background: #64DD17"></span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-color" value="#39ccff">\n <span style="background: #39ccff"></span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-color" value="#D500F9">\n <span style="background: #D500F9"></span>\n </label>\n </div>\n <div class="dplayer-comment-setting-type">\n <div class="dplayer-comment-setting-title">设置弹幕类型</div>\n <label>\n <input type="radio" name="dplayer-danmaku-type" value="top">\n <span>'+this.getTran("Top")+'</span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-type" value="right" checked>\n <span>'+this.getTran("Rolling")+'</span>\n </label>\n <label>\n <input type="radio" name="dplayer-danmaku-type" value="bottom">\n <span>'+this.getTran("Bottom")+'</span>\n </label>\n </div>\n </div>\n <input class="dplayer-comment-input" type="text" placeholder="'+this.getTran("Input danmaku, hit Enter")+'" maxlength="30">\n <button class="dplayer-icon dplayer-send-icon">')+this.getSVG("send")+' </button>\n </div>\n </div>\n <div class="dplayer-setting">\n <button class="dplayer-icon dplayer-setting-icon">'+this.getSVG("setting")+' </button>\n <div class="dplayer-setting-box"></div>\n </div>\n <button class="dplayer-icon dplayer-full-icon">'+this.getSVG("full")+(' </button>\n </div>\n <div class="dplayer-bar-wrap">\n <div class="dplayer-bar">\n <div class="dplayer-loaded" style="width: 0;"></div>\n <div class="dplayer-played" style="width: 0; background: '+this.option.theme+'">\n <span class="dplayer-thumb" style="background: '+this.option.theme+'"></span>\n </div>\n </div>\n </div>\n </div>\n <div class="dplayer-menu">\n <div class="dplayer-menu-item"><span class="dplayer-menu-label"><a target="_blank" href="http://diygod.me/">'+this.getTran("About author")+'</a></span></div>\n <div class="dplayer-menu-item"><span class="dplayer-menu-label"><a target="_blank" href="https://github.com/DIYgod/DPlayer/issues">'+this.getTran("DPlayer feedback")+'</a></span></div>\n <div class="dplayer-menu-item"><span class="dplayer-menu-label"><a target="_blank" href="https://github.com/DIYgod/DPlayer">'+this.getTran("About DPlayer")+"</a></span></div>\n </div>\n "),this.audio=this.element.getElementsByClassName("dplayer-video")[0],(this.option.video.url.match(/(m3u8)$/i)||s.isSupported())&&!function(){var t=new s;t.attachMedia(e.audio),t.on(s.Events.MEDIA_ATTACHED,function(){t.loadSource(e.option.video.url),t.on(s.Events.MANIFEST_PARSED,function(e,t){console.log("manifest loaded, found "+t.levels.length+" quality level")})})}(),this.bezel=this.element.getElementsByClassName("dplayer-bezel-icon")[0],this.bezel.addEventListener("animationend",function(){e.bezel.classList.remove("dplayer-bezel-transition")}),this.ptime=this.element.getElementsByClassName("dplayer-ptime")[0],this.playButton=this.element.getElementsByClassName("dplayer-play-icon")[0],this.shouldpause=!0,this.toggle=function(){e.audio.paused?e.play():e.pause()},this.playButton.addEventListener("click",this.toggle);var t=this.element.getElementsByClassName("dplayer-video-wrap")[0],r=this.element.getElementsByClassName("dplayer-controller-mask")[0];if(this.isMobile){var a=function(){e.element.classList.contains("dplayer-hide-controller")?e.element.classList.remove("dplayer-hide-controller"):e.element.classList.add("dplayer-hide-controller")};t.addEventListener("click",a),r.addEventListener("click",a)}else t.addEventListener("click",this.toggle),r.addEventListener("click",this.toggle);var i=function(t){var r=t.offsetLeft,a=t.offsetParent,n=void 0;if(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement)for(;null!==a&&a!==e.element;)r+=a.offsetLeft,a=a.offsetParent;else for(;null!==a;)r+=a.offsetLeft,a=a.offsetParent;return n=document.body.scrollLeft+document.documentElement.scrollLeft,r-n};this.playedBar=this.element.getElementsByClassName("dplayer-played")[0],this.loadedBar=this.element.getElementsByClassName("dplayer-loaded")[0],this.bar=this.element.getElementsByClassName("dplayer-bar-wrap")[0];var o=void 0;this.option.danmaku&&this.audio.addEventListener("seeking",function(){for(var t=0;t<e.dan.length;t++){if(e.dan[t].time>=e.audio.currentTime)return void(e.danIndex=t);e.danIndex=e.dan.length}});var l=0,d=0,u=!1;this.setTime=function(){e.playedTime=setInterval(function(){d=e.audio.currentTime,!u&&d<l+.01&&!e.audio.paused&&(e.element.classList.add("dplayer-loading"),u=!0),u&&d>l+.01&&!e.audio.paused&&(e.element.classList.remove("dplayer-loading"),u=!1),l=d,e.updateBar("played",e.audio.currentTime/e.audio.duration,"width"),e.ptime.innerHTML=e.secondToTime(e.audio.currentTime),e.trigger("playing")},100),e.option.danmaku&&(e.danmakuTime=setInterval(function(){for(var t=e.dan[e.danIndex];t&&e.audio.currentTime>=parseFloat(t.time);)e.danmakuIn(t.text,t.color,t.type),e.danIndex++,t=e.dan[e.danIndex]},0))},this.clearTime=function(){clearInterval(e.playedTime),e.option.danmaku&&clearInterval(e.danmakuTime)},this.bar.addEventListener("click",function(t){var r=t||window.event;o=e.bar.clientWidth;var a=(r.clientX-i(e.bar))/o;a=a>0?a:0,a=a<1?a:1,e.updateBar("played",a,"width"),e.audio.currentTime=parseFloat(e.playedBar.style.width)/100*e.audio.duration});var c=function(t){var r=t||window.event,a=(r.clientX-i(e.bar))/o;a=a>0?a:0,a=a<1?a:1,e.updateBar("played",a,"width"),e.element.getElementsByClassName("dplayer-ptime")[0].innerHTML=e.secondToTime(a*e.audio.duration)},h=function Z(){document.removeEventListener("mouseup",Z),document.removeEventListener("mousemove",c),e.audio.currentTime=parseFloat(e.playedBar.style.width)/100*e.audio.duration,e.setTime()};this.bar.addEventListener("mousedown",function(){o=e.bar.clientWidth,e.clearTime(),document.addEventListener("mousemove",c),document.addEventListener("mouseup",h)}),this.volumeBar=this.element.getElementsByClassName("dplayer-volume-bar-inner")[0];var f=this.element.getElementsByClassName("dplayer-volume")[0],p=this.element.getElementsByClassName("dplayer-volume-bar-wrap")[0],g=this.element.getElementsByClassName("dplayer-volume-bar")[0],y=this.element.getElementsByClassName("dplayer-volume-icon")[0],m=35,v=function(){e.audio.volume>=.8?y.innerHTML=e.getSVG("volume-up"):e.audio.volume>0?y.innerHTML=e.getSVG("volume-down"):y.innerHTML=e.getSVG("volume-off")},b=function(t){var r=t||window.event,a=(r.clientX-i(g)-5.5)/m;a=a>0?a:0,a=a<1?a:1,e.updateBar("volume",a,"width"),e.audio.volume=a,e.audio.muted&&(e.audio.muted=!1),v()},k=function $(){document.removeEventListener("mouseup",$),document.removeEventListener("mousemove",b),f.classList.remove("dplayer-volume-active")};p.addEventListener("click",function(t){var r=t||window.event,a=(r.clientX-i(g)-5.5)/m;a=a>0?a:0,a=a<1?a:1,e.updateBar("volume",a,"width"),e.audio.volume=a,e.audio.muted&&(e.audio.muted=!1),v()}),p.addEventListener("mousedown",function(){document.addEventListener("mousemove",b),document.addEventListener("mouseup",k),f.classList.add("dplayer-volume-active")}),y.addEventListener("click",function(){e.audio.muted?(e.audio.muted=!1,v(),e.updateBar("volume",e.audio.volume,"width")):(e.audio.muted=!0,y.innerHTML=e.getSVG("volume-off"),e.updateBar("volume",0,"width"))}),this.isMobile||!function(){var t=0,r=function(){e.element.classList.remove("dplayer-hide-controller"),clearTimeout(t),t=setTimeout(function(){e.audio.played.length&&(e.element.classList.add("dplayer-hide-controller"),R(),K())},2e3)};e.element.addEventListener("mousemove",r),e.element.addEventListener("click",r)}(),this.danOpacity=.7;var E={original:'\n <div class="dplayer-setting-item dplayer-setting-loop">\n <span class="dplayer-label">'+this.getTran("Loop")+'</span>\n <div class="dplayer-toggle">\n <input class="dplayer-toggle-setting-input" type="checkbox" name="dplayer-toggle" id="dplayer-toggle">\n <label for="dplayer-toggle"></label>\n </div>\n </div>\n <div class="dplayer-setting-item dplayer-setting-speed">\n <span class="dplayer-label">'+this.getTran("Speed")+'</span>\n <div class="dplayer-toggle">'+this.getSVG("right")+(' </div>\n </div>\n <div class="dplayer-setting-item dplayer-setting-danmaku">\n <span class="dplayer-label">'+this.getTran("Opacity for danmaku")+'</span>\n <div class="dplayer-danmaku-bar-wrap">\n <div class="dplayer-danmaku-bar">\n <div class="dplayer-danmaku-bar-inner" style="width: '+100*this.danOpacity+'%">\n <span class="dplayer-thumb"></span>\n </div>\n </div>\n </div>\n </div>'),speed:'\n <div class="dplayer-setting-speed-item" data-speed="0.5">\n <span class="dplayer-label">0.5</span>\n </div>\n <div class="dplayer-setting-speed-item" data-speed="0.75">\n <span class="dplayer-label">0.75</span>\n </div>\n <div class="dplayer-setting-speed-item" data-speed="1">\n <span class="dplayer-label">'+this.getTran("Normal")+'</span>\n </div>\n <div class="dplayer-setting-speed-item" data-speed="1.25">\n <span class="dplayer-label">1.25</span>\n </div>\n <div class="dplayer-setting-speed-item" data-speed="1.5">\n <span class="dplayer-label">1.5</span>\n </div>\n <div class="dplayer-setting-speed-item" data-speed="2">\n <span class="dplayer-label">2</span>\n </div>'},w=this.element.getElementsByClassName("dplayer-setting-icon")[0],x=this.element.getElementsByClassName("dplayer-setting-box")[0],T=this.element.getElementsByClassName("dplayer-mask")[0];x.innerHTML=E.original;var R=function(){x.classList.contains("dplayer-setting-box-open")&&(x.classList.remove("dplayer-setting-box-open"),T.classList.remove("dplayer-mask-show"),setTimeout(function(){x.classList.remove("dplayer-setting-box-narrow"),x.innerHTML=E.original,L()},300))},_=function(){x.classList.add("dplayer-setting-box-open"),T.classList.add("dplayer-mask-show")};T.addEventListener("click",function(){R()}),w.addEventListener("click",function(){_()});var L=function(){var t=e.element.getElementsByClassName("dplayer-setting-loop")[0],r=t.getElementsByClassName("dplayer-toggle-setting-input")[0];r.checked=e.loop,t.addEventListener("click",function(){r.checked=!r.checked,r.checked?(e.loop=!0,e.audio.loop=e.loop):(e.loop=!1,e.audio.loop=e.loop),R()}),r.addEventListener("change",function(){r.checked?(e.loop=!0,e.audio.loop=e.loop):(e.loop=!1,e.audio.loop=e.loop),R()});var a=e.element.getElementsByClassName("dplayer-setting-speed")[0];a.addEventListener("click",function(){x.classList.add("dplayer-setting-box-narrow"),x.innerHTML=E.speed;for(var t=x.getElementsByClassName("dplayer-setting-speed-item"),r=function(r){t[r].addEventListener("click",function(){e.audio.playbackRate=t[r].dataset.speed,R()})},a=0;a<t.length;a++)r(a)}),e.option.danmaku&&!function(){e.danmakuBar=e.element.getElementsByClassName("dplayer-danmaku-bar-inner")[0];var t=e.element.getElementsByClassName("dplayer-danmaku-bar-wrap")[0],r=e.element.getElementsByClassName("dplayer-danmaku-bar")[0],a=e.element.getElementsByClassName("dplayer-setting-danmaku")[0],n=130;e.updateBar("danmaku",e.danOpacity,"width");var s=function(t){var a=t||window.event,s=(a.clientX-i(r))/n;s=s>0?s:0,s=s<1?s:1,e.updateBar("danmaku",s,"width");for(var o=e.element.getElementsByClassName("dplayer-danmaku-item"),l=0;l<o.length;l++)o[l].style.opacity=s;e.danOpacity=s},o=function l(){document.removeEventListener("mouseup",l),document.removeEventListener("mousemove",s),a.classList.remove("dplayer-setting-danmaku-active")};t.addEventListener("click",function(t){var a=t||window.event,s=(a.clientX-i(r))/n;s=s>0?s:0,s=s<1?s:1,e.updateBar("danmaku",s,"width");for(var o=e.element.getElementsByClassName("dplayer-danmaku-item"),l=0;l<o.length;l++)o[l].style.opacity=s;e.danOpacity=s}),t.addEventListener("mousedown",function(){document.addEventListener("mousemove",s),document.addEventListener("mouseup",o),a.classList.add("dplayer-setting-danmaku-active")})}()};L(),this.audio.addEventListener("durationchange",function(){1!==e.audio.duration&&(e.element.getElementsByClassName("dplayer-dtime")[0].innerHTML=e.secondToTime(e.audio.duration))}),this.audio.addEventListener("progress",function(){var t=e.audio.buffered.length?e.audio.buffered.end(e.audio.buffered.length-1)/e.audio.duration:0;e.updateBar("loaded",t,"width")}),this.audio.addEventListener("error",function(){e.element.getElementsByClassName("dplayer-ptime")[0].innerHTML="Error happens ╥﹏╥",e.trigger("pause")}),this.audio.addEventListener("canplay",function(){e.trigger("canplay")}),this.ended=!1,this.audio.addEventListener("ended",function(){e.updateBar("played",1,"width"),e.loop||(e.ended=!0,e.pause(),e.trigger("ended"))}),this.audio.volume=parseInt(this.element.getElementsByClassName("dplayer-volume-bar-inner")[0].style.width)/100,this.audio.loop=this.loop,1!==this.audio.duration&&(this.element.getElementsByClassName("dplayer-dtime")[0].innerHTML=this.audio.duration?this.secondToTime(this.audio.duration):"00:00");
|
|
var A=this.element.getElementsByClassName("dplayer-danmaku")[0],S=30,D=void 0,O=void 0,C=void 0,P={right:{},top:{},bottom:{}},I=function(e){return A.getBoundingClientRect().right-e.getBoundingClientRect().right},M=function(e){return(D+e.offsetWidth)/5},N=function(e,t){for(var r=D/M(e),a=function(a){var n=P[t][a+""];if(!n||!n.length)return P[t][a+""]=[e],e.addEventListener("animationend",function(){P[t][a+""].splice(0,1)}),{v:a%C};for(var i=0;i<n.length;i++){var s=I(n[i])-10;if(s<=D-r*M(n[i])||s<=0)break;if(i===n.length-1)return P[t][a+""].push(e),e.addEventListener("animationend",function(){P[t][a+""].splice(0,1)}),{v:a%C}}},i=0;;i++){var s=a(i);if("object"===("undefined"==typeof s?"undefined":n(s)))return s.v}};this.danmakuIn=function(t,r,a){D=A.offsetWidth,O=A.offsetHeight,C=parseInt(O/S);var n=document.createElement("div");switch(n.classList.add("dplayer-danmaku-item"),n.classList.add("dplayer-danmaku-"+a),n.innerHTML=t,n.style.opacity=e.danOpacity,A.appendChild(n),n.style.color=r,a){case"right":n.style.top=S*N(n,a)+"px",n.style.width=n.offsetWidth+1+"px",n.style.transform="translateX(-"+D+"px)",n.addEventListener("animationend",function(){A.removeChild(n)});break;case"top":n.style.top=S*N(n,a)+"px",n.addEventListener("animationend",function(){A.removeChild(n)});break;case"bottom":n.style.bottom=S*N(n,a)+"px",n.addEventListener("animationend",function(){A.removeChild(n)});break;default:console.error("Can't handled danmaku type: "+a)}n.classList.add("dplayer-danmaku-move")},this.option.danmaku?!function(){e.danIndex=0;var t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState)if(t.status>=200&&t.status<300||304===t.status){var r=JSON.parse(t.responseText);1!==r.code?alert(r.msg):(e.dan=r.danmaku.sort(function(e,t){return e.time-t.time}),e.element.getElementsByClassName("dplayer-danloading")[0].style.display="none",e.option.autoplay&&!e.isMobile?e.play():e.isMobile&&e.pause())}else console.log("Request was unsuccessful: "+t.status)};var r=void 0;r=e.option.danmaku.maximum?e.option.danmaku.api+"?id="+e.option.danmaku.id+"&max="+e.option.danmaku.maximum:e.option.danmaku.api+"?id="+e.option.danmaku.id,t.open("get",r,!0),t.send(null)}():this.option.autoplay&&!this.isMobile?this.play():this.isMobile&&this.pause();var F=this.element.getElementsByClassName("dplayer-comment-input")[0],U=this.element.getElementsByClassName("dplayer-comment-icon")[0],B=this.element.getElementsByClassName("dplayer-comment-box")[0],G=this.element.getElementsByClassName("dplayer-comment-setting-icon")[0],Y=this.element.getElementsByClassName("dplayer-comment-setting-box")[0],j=this.element.getElementsByClassName("dplayer-send-icon")[0],z=function(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},H=function(){if(F.blur(),!F.value.replace(/^\s+|\s+$/g,""))return void alert(e.getTran("Please input danmaku!"));var t={token:e.option.danmaku.token,player:e.option.danmaku.id,author:"DIYgod",time:e.audio.currentTime,text:F.value,color:e.element.querySelector('input[name="dplayer-danmaku-color"]:checked').value,type:e.element.querySelector('input[name="dplayer-danmaku-type"]:checked').value},r=new XMLHttpRequest;r.onreadystatechange=function(){if(4===r.readyState)if(r.status>=200&&r.status<300||304===r.status){var e=JSON.parse(r.responseText);1!==e.code?alert(e.msg):console.log("Post danmaku: ",JSON.parse(r.responseText))}else console.log("Request was unsuccessful: "+r.status)},r.open("post",e.option.danmaku.api,!0),r.send(JSON.stringify(t)),F.value="",K(),e.dan.splice(e.danIndex,0,t),e.danIndex++,e.danmakuIn(z(t.text),t.color,t.type)},q=function(){Y.classList.contains("dplayer-comment-setting-open")&&Y.classList.remove("dplayer-comment-setting-open")},V=function(){Y.classList.contains("dplayer-comment-setting-open")?Y.classList.remove("dplayer-comment-setting-open"):Y.classList.add("dplayer-comment-setting-open")},W=0,K=function(){B.classList.contains("dplayer-comment-box-open")&&(B.classList.remove("dplayer-comment-box-open"),T.classList.remove("dplayer-mask-show"),clearInterval(W),e.element.classList.remove("dplayer-show-controller"),q(),document.addEventListener("keydown",Q))},X=function(){B.classList.add("dplayer-comment-box-open"),T.classList.add("dplayer-mask-show"),W=setInterval(function(){clearTimeout(hideTime)},1e3),e.element.classList.add("dplayer-show-controller"),document.removeEventListener("keydown",Q)};T.addEventListener("click",function(){K()}),U.addEventListener("click",function(){X(),setTimeout(function(){F.focus()},300)}),G.addEventListener("click",function(){V()}),this.element.getElementsByClassName("dplayer-comment-setting-color")[0].addEventListener("click",function(){var t=e.element.querySelector('input[name="dplayer-danmaku-color"]:checked+span');t&&(G.getElementsByClassName("dplayer-fill")[0].style.fill=e.element.querySelector('input[name="dplayer-danmaku-color"]:checked').value)}),F.addEventListener("click",function(){q()}),F.addEventListener("keydown",function(e){var t=e||window.event;13===t.keyCode&&H()}),j.addEventListener("click",H);var J=function(){D=A.offsetWidth;for(var t=e.element.getElementsByClassName("dplayer-danmaku-item"),r=0;r<t.length;r++)t[r].style.transform="translateX(-"+D+"px)"};this.element.addEventListener("fullscreenchange",function(){J()}),this.element.addEventListener("mozfullscreenchange",function(){J()}),this.element.addEventListener("webkitfullscreenchange",function(){J()}),this.element.getElementsByClassName("dplayer-full-icon")[0].addEventListener("click",function(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement?document.cancelFullScreen?document.cancelFullScreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():e.element.requestFullscreen?e.element.requestFullscreen():e.element.mozRequestFullScreen?e.element.mozRequestFullScreen():e.element.webkitRequestFullscreen&&e.element.webkitRequestFullscreen(),J()});var Q=function(t){var r=t||window.event,a=void 0;switch(r.keyCode){case 32:r.preventDefault(),e.toggle();break;case 37:r.preventDefault(),e.audio.currentTime=e.audio.currentTime-5;break;case 39:r.preventDefault(),e.audio.currentTime=e.audio.currentTime+5;break;case 38:r.preventDefault(),a=e.audio.volume+.1,a=a>0?a:0,a=a<1?a:1,e.updateBar("volume",a,"width"),e.audio.volume=a,e.audio.muted&&(e.audio.muted=!1),v();break;case 40:r.preventDefault(),a=e.audio.volume-.1,a=a>0?a:0,a=a<1?a:1,e.updateBar("volume",a,"width"),e.audio.volume=a,e.audio.muted&&(e.audio.muted=!1),v()}};document.addEventListener("keydown",Q),this.menu=this.element.getElementsByClassName("dplayer-menu")[0],this.element.addEventListener("contextmenu",function(t){var r=t||window.event;r.preventDefault(),e.menu.style.left=r.clientX-e.element.getBoundingClientRect().left+"px",e.menu.style.top=r.clientY-e.element.getBoundingClientRect().top+"px",e.menu.classList.add("dplayer-menu-show"),T.classList.add("dplayer-mask-show"),T.addEventListener("click",function(){T.classList.remove("dplayer-mask-show"),e.menu.classList.remove("dplayer-menu-show")})})}},{key:"play",value:function(){this.audio.paused&&(this.shouldpause=!1,this.bezel.innerHTML=this.getSVG("play"),this.bezel.classList.add("dplayer-bezel-transition"),this.playButton.innerHTML=this.getSVG("pause"),this.audio.play(),this.playedTime&&this.clearTime(),this.setTime(),this.element.classList.add("dplayer-playing"),this.trigger("play"))}},{key:"pause",value:function(){this.shouldpause&&!this.ended||(this.shouldpause=!0,this.element.classList.remove("dplayer-loading"),this.bezel.innerHTML=this.getSVG("pause"),this.bezel.classList.add("dplayer-bezel-transition"),this.ended=!1,this.playButton.innerHTML=this.getSVG("play"),this.audio.pause(),this.clearTime(),this.element.classList.remove("dplayer-playing"),this.trigger("pause"))}},{key:"on",value:function(e,t){"function"==typeof t&&this.event[e].push(t)}}]),e}();t.DPlayer=o},function(e,t,r){var a=r(2);"string"==typeof a&&(a=[[e.id,a,""]]);r(4)(a,{});a.locals&&(e.exports=a.locals)},function(e,t,r){t=e.exports=r(3)(),t.push([e.id,'.dplayer{position:relative;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:1}.dplayer:-webkit-full-screen{width:100%;height:100%;background:#000}.dplayer:-webkit-full-screen .dplayer-danmaku .dplayer-danmaku-bottom.dplayer-danmaku-move,.dplayer:-webkit-full-screen .dplayer-danmaku .dplayer-danmaku-top.dplayer-danmaku-move{-webkit-animation:danmaku-center 6s linear;animation:danmaku-center 6s linear;-webkit-animation-play-state:paused;animation-play-state:paused}.dplayer:-webkit-full-screen .dplayer-danmaku .dplayer-danmaku-right.dplayer-danmaku-move{-webkit-animation:danmaku 8s linear;animation:danmaku 8s linear;-webkit-animation-play-state:paused;animation-play-state:paused}.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box{height:60px}.dplayer.dplayer-no-danmaku .dplayer-controller .dplayer-icons .dplayer-comment,.dplayer.dplayer-no-danmaku .dplayer-danmaku{display:none}.dplayer.dplayer-playing .dplayer-danmaku .dplayer-danmaku-move{-webkit-animation-play-state:running!important;animation-play-state:running!important}@media (min-width:900px){.dplayer.dplayer-playing .dplayer-controller,.dplayer.dplayer-playing .dplayer-controller-mask{opacity:0}.dplayer.dplayer-playing:hover .dplayer-controller,.dplayer.dplayer-playing:hover .dplayer-controller-mask{opacity:1}}.dplayer.dplayer-loading .dplayer-bezel .diplayer-loading-icon{display:block}.dplayer.dplayer-loading .dplayer-danmaku .dplayer-danmaku-move{-webkit-animation-play-state:paused!important;animation-play-state:paused!important}.dplayer.dplayer-hide-controller .dplayer-controller,.dplayer.dplayer-hide-controller .dplayer-controller-mask{opacity:0;-webkit-transform:translateY(100%);transform:translateY(100%)}.dplayer.dplayer-show-controller .dplayer-controller,.dplayer.dplayer-show-controller .dplayer-controller-mask{opacity:1}.dplayer .dplayer-mask{position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;display:none}.dplayer .dplayer-mask.dplayer-mask-show{display:block}.dplayer .dplayer-video-wrap{position:relative;background:#000;font-size:0;width:100%;height:100%}.dplayer .dplayer-video-wrap .dplayer-video{width:100%;height:100%}.dplayer .dplayer-danmaku{position:absolute;left:0;right:0;top:0;bottom:0;font-size:22px;color:#fff}.dplayer .dplayer-danmaku .dplayer-danmaku-item{display:inline-block;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;white-space:nowrap;font-weight:bolder;text-shadow:.5px .5px .5px rgba(0,0,0,.5)}.dplayer .dplayer-danmaku .dplayer-danmaku-right{position:absolute;right:0;-webkit-transform:translateX(100%);transform:translateX(100%)}.dplayer .dplayer-danmaku .dplayer-danmaku-right.dplayer-danmaku-move{will-change:transform;-webkit-animation:danmaku 5s linear;animation:danmaku 5s linear;-webkit-animation-play-state:paused;animation-play-state:paused}@-webkit-keyframes danmaku{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}}@keyframes danmaku{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}}.dplayer .dplayer-danmaku .dplayer-danmaku-bottom,.dplayer .dplayer-danmaku .dplayer-danmaku-top{position:absolute;width:100%;text-align:center;visibility:hidden}.dplayer .dplayer-danmaku .dplayer-danmaku-bottom.dplayer-danmaku-move,.dplayer .dplayer-danmaku .dplayer-danmaku-top.dplayer-danmaku-move{will-change:visibility;-webkit-animation:danmaku-center 4s linear;animation:danmaku-center 4s linear;-webkit-animation-play-state:paused;animation-play-state:paused}@-webkit-keyframes danmaku-center{0%{visibility:visible}to{visibility:visible}}@keyframes danmaku-center{0%{visibility:visible}to{visibility:visible}}.dplayer .dplayer-bezel{position:absolute;left:0;right:0;top:0;bottom:0;font-size:22px;color:#fff;pointer-events:none}.dplayer .dplayer-bezel .dplayer-fill{fill:hsla(0,0%,100%,.8)}.dplayer .dplayer-bezel .dplayer-bezel-icon{position:absolute;top:50%;left:50%;margin:-26px 0 0 -26px;height:52px;width:52px;padding:12px;box-sizing:border-box;background:rgba(0,0,0,.5);border-radius:50%;opacity:0;pointer-events:none}.dplayer .dplayer-bezel .dplayer-bezel-icon.dplayer-bezel-transition{-webkit-animation:bezel-hide .5s linear;animation:bezel-hide .5s linear}@-webkit-keyframes bezel-hide{0%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform:scale(2);transform:scale(2)}}@keyframes bezel-hide{0%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}to{opacity:0;-webkit-transform:scale(2);transform:scale(2)}}.dplayer .dplayer-bezel .dplayer-danloading{position:absolute;top:50%;margin-top:-7px;width:100%;text-align:center;font-size:14px;line-height:14px;-webkit-animation:my-face 5s infinite ease-in-out;animation:my-face 5s infinite ease-in-out}.dplayer .dplayer-bezel .diplayer-loading-icon{display:none;position:absolute;top:50%;left:50%;margin:-18px 0 0 -18px;height:36px;width:36px;pointer-events:none}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-hide{display:none}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot{-webkit-animation:diplayer-loading-dot-fade .8s ease infinite;animation:diplayer-loading-dot-fade .8s ease infinite;opacity:0;fill:#fff;-webkit-transform-origin:4px 4px;transform-origin:4px 4px}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-7{-webkit-animation-delay:.7s;animation-delay:.7s}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-6{-webkit-animation-delay:.6s;animation-delay:.6s}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-5{-webkit-animation-delay:.5s;animation-delay:.5s}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-4{-webkit-animation-delay:.4s;animation-delay:.4s}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-3{-webkit-animation-delay:.3s;animation-delay:.3s}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-2{-webkit-animation-delay:.2s;animation-delay:.2s}.dplayer .dplayer-bezel .diplayer-loading-icon .diplayer-loading-dot.diplayer-loading-dot-1{-webkit-animation-delay:.1s;animation-delay:.1s}@-webkit-keyframes diplayer-loading-dot-fade{0%{opacity:.7;-webkit-transform:scale(1.2);transform:scale(1.2)}50%{opacity:.25;-webkit-transform:scale(.9);transform:scale(.9)}to{opacity:.25;-webkit-transform:scale(.85);transform:scale(.85)}}@keyframes diplayer-loading-dot-fade{0%{opacity:.7;-webkit-transform:scale(1.2);transform:scale(1.2)}50%{opacity:.25;-webkit-transform:scale(.9);transform:scale(.9)}to{opacity:.25;-webkit-transform:scale(.85);transform:scale(.85)}}.dplayer .dplayer-controller-mask{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAADGCAYAAAAT+OqFAAAAdklEQVQoz42QQQ7AIAgEF/T/D+kbq/RWAlnQyyazA4aoAB4FsBSA/bFjuF1EOL7VbrIrBuusmrt4ZZORfb6ehbWdnRHEIiITaEUKa5EJqUakRSaEYBJSCY2dEstQY7AuxahwXFrvZmWl2rh4JZ07z9dLtesfNj5q0FU3A5ObbwAAAABJRU5ErkJggg==) repeat-x bottom;height:98px;width:100%}.dplayer .dplayer-controller,.dplayer .dplayer-controller-mask{position:absolute;bottom:0;-webkit-transition:all .3s ease;transition:all .3s ease}.dplayer .dplayer-controller{left:0;right:0;height:41px;padding:0 20px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.dplayer .dplayer-controller .dplayer-bar-wrap{padding:5px 0;cursor:pointer;position:absolute;bottom:33px;width:calc(100% - 40px);height:3px}.dplayer .dplayer-controller .dplayer-bar-wrap:hover .dplayer-thumb{-webkit-transform:scale(1)!important;transform:scale(1)!important}.dplayer .dplayer-controller .dplayer-bar-wrap .dplayer-bar{position:relative;height:3px;width:100%;background:hsla(0,0%,100%,.2);cursor:pointer!important}.dplayer .dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-loaded{position:absolute;left:0;top:0;bottom:0;background:hsla(0,0%,100%,.4);height:3px;-webkit-transition:all .5s ease;transition:all .5s ease;will-change:width}.dplayer .dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-played{position:absolute;left:0;top:0;bottom:0;height:3px;will-change:width}.dplayer .dplayer-controller .dplayer-bar-wrap .dplayer-bar .dplayer-played .dplayer-thumb{position:absolute;top:0;right:5px;margin-top:-4px;margin-right:-10px;height:11px;width:11px;border-radius:50%;cursor:pointer!important;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:scale(0);transform:scale(0)}.dplayer .dplayer-controller .dplayer-icons{height:38px;position:absolute;bottom:0}.dplayer .dplayer-controller .dplayer-icons.dplayer-icons-left .dplayer-icon{padding:7px}.dplayer .dplayer-controller .dplayer-icons.dplayer-icons-right{right:20px}.dplayer .dplayer-controller .dplayer-icons.dplayer-icons-right .dplayer-icon{padding:8px}.dplayer .dplayer-controller .dplayer-icons #dplayer-menu{stroke:#ddd;stroke-width:1px}.dplayer .dplayer-controller .dplayer-icons .dplayer-time{line-height:38px;color:#eee;text-shadow:0 0 2px rgba(0,0,0,.5);vertical-align:middle;font-size:13px;cursor:default}.dplayer .dplayer-controller .dplayer-icons .dplayer-icon{width:46px;height:100%;border:none;background-color:transparent;outline:none;cursor:pointer;opacity:.8;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;vertical-align:middle}.dplayer .dplayer-controller .dplayer-icons .dplayer-icon:hover{opacity:1}.dplayer .dplayer-controller .dplayer-icons .dplayer-icon.dplayer-comment-icon{padding:10px 9px 9px}.dplayer .dplayer-controller .dplayer-icons .dplayer-icon.dplayer-setting-icon{padding-top:8.5px}.dplayer .dplayer-controller .dplayer-icons .dplayer-fill{fill:#fff}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume{position:relative;display:inline-block;cursor:pointer!important;height:100%}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume:hover .dplayer-volume-bar{width:45px!important}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume:hover .dplayer-thumb{-webkit-transform:scale(1)!important;transform:scale(1)!important}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume.dplayer-volume-active .dplayer-volume-bar{width:45px!important}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume.dplayer-volume-active .dplayer-thumb{-webkit-transform:scale(1)!important;transform:scale(1)!important}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap{display:inline-block;margin:0 5px 0 -5px;vertical-align:middle;height:100%}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar{position:relative;top:17px;width:0;height:3px;background:#aaa;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner{position:absolute;bottom:0;left:0;height:100%;-webkit-transition:all .1s ease;transition:all .1s ease;will-change:width}.dplayer .dplayer-controller .dplayer-icons .dplayer-volume .dplayer-volume-bar-wrap .dplayer-volume-bar .dplayer-volume-bar-inner .dplayer-thumb{position:absolute;top:0;right:5px;margin-top:-4px;margin-right:-10px;height:11px;width:11px;border-radius:50%;cursor:pointer!important;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:scale(0);transform:scale(0)}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting{display:inline-block;height:100%}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box{position:absolute;right:0;bottom:50px;-webkit-transform:translateX(170px);transform:translateX(170px);width:150px;height:90px;border-radius:2px;background:rgba(28,28,28,.9);padding:7px 0;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;overflow:hidden;z-index:2}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-open{-webkit-transform:translateX(0);transform:translateX(0)}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-box.dplayer-setting-box-narrow{width:70px;height:180px;text-align:center}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item,.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-speed-item{height:30px;padding:5px 10px;box-sizing:border-box;cursor:pointer}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-item:hover,.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-speed-item:hover{background-color:hsla(0,0%,100%,.1)}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku{padding:5px 0}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-label{padding:0 10px;display:inline}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku:hover .dplayer-label{display:none}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku:hover .dplayer-danmaku-bar-wrap{display:inline-block}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku.dplayer-setting-danmaku-active .dplayer-label{display:none}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku.dplayer-setting-danmaku-active .dplayer-danmaku-bar-wrap{display:inline-block}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap{padding:0 10px;box-sizing:border-box;display:none;vertical-align:middle;height:100%;width:100%}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar{position:relative;top:8.5px;width:100%;height:3px;background:#fff;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar .dplayer-danmaku-bar-inner{position:absolute;bottom:0;left:0;height:100%;-webkit-transition:all .1s ease;transition:all .1s ease;background:#aaa;will-change:width}.dplayer .dplayer-controller .dplayer-icons .dplayer-setting .dplayer-setting-danmaku .dplayer-danmaku-bar-wrap .dplayer-danmaku-bar .dplayer-danmaku-bar-inner .dplayer-thumb{position:absolute;top:0;right:5px;margin-top:-4px;margin-right:-10px;height:11px;width:11px;border-radius:50%;cursor:pointer!important;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;background:#aaa}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment{display:inline-block;height:100%}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box{position:absolute;right:0;bottom:50px;-webkit-transform:translateX(382px);transform:translateX(382px);border-radius:2px;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;z-index:2}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box.dplayer-comment-box-open{-webkit-transform:translateX(0);transform:translateX(0)}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-icon{height:24px;width:24px;position:absolute;top:5px;left:7px;padding:0;opacity:1}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-icon:hover .dplayer-fill{fill:#aaa}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-icon .dplayer-fill{-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;fill:#ddd}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box{position:absolute;background:#fff;bottom:40px;left:-93px;box-shadow:0 0 25px rgba(0,0,0,.3);border-radius:4px;padding:10px 10px 16px;font-size:14px;width:204px;-webkit-transition:all .3s ease-in-out;transition:all .3s ease-in-out;-webkit-transform:scale(0);transform:scale(0)}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box.dplayer-comment-setting-open{-webkit-transform:scale(1);transform:scale(1)}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box:after{content:\'\';position:absolute;top:100%;left:50%;margin-left:-12px;background:url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 12"><path fill="#FFF" d="M23.7,0c-1.2,0-2.4,0.5-3.2,1.3l-7.7,7.8c-0.4,0.4-1.1,0.4-1.5,0L3.5,1.3C2.7,0.5,1.5,0,0.3,0"/></svg>\');width:24px;height:12px}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box input[type=radio]{display:none}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box label{cursor:pointer}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-title{font-size:14px;color:#555;padding:6px}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type{font-size:0}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type label:nth-child(2) span{border-radius:4px 0 0 4px}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type label:nth-child(4) span{border-radius:0 4px 4px 0}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type span{width:33%;padding:4px 6px;line-height:16px;display:inline-block;font-size:12px;color:#555;border:1px solid #e4e4e6;margin-right:-1px;box-sizing:border-box;text-align:center;cursor:pointer}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-type input:checked+span{background:#e4e4e6}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color{font-size:0}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color label{font-size:0;padding:6px;display:inline-block}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color span{width:22px;height:22px;display:inline-block;border-radius:50%;box-sizing:border-box;cursor:pointer}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color span:hover{-webkit-animation:my-face 5s infinite ease-in-out;animation:my-face 5s infinite ease-in-out;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12)}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-setting-box .dplayer-comment-setting-color input:checked+span{box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);border:none!important}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-comment-input{outline:none;border:none;padding:8px 31px;font-size:14px;line-height:18px;text-align:center;border-radius:4px;width:300px}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-send-icon{height:22px;width:22px;position:absolute;top:6px;right:7px;padding:0;opacity:1}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-send-icon:hover .dplayer-fill{fill:#aaa}.dplayer .dplayer-controller .dplayer-icons .dplayer-comment .dplayer-comment-box .dplayer-send-icon .dplayer-fill{-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;fill:#ddd}.dplayer .dplayer-controller .dplayer-icons .dplayer-label{color:#eee;font-size:13px;display:inline-block;vertical-align:middle}.dplayer .dplayer-controller .dplayer-icons .dplayer-toggle{width:32px;height:100%;text-align:center;display:inline-block;font-size:0;vertical-align:middle;float:right}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle{max-height:0;max-width:0;display:none}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle+label{display:inline-block;position:relative;box-shadow:inset 0 0 0 0 #dfdfdf;border:1px solid #dfdfdf;height:20px;width:32px;border-radius:10px;box-sizing:border-box;cursor:pointer;-webkit-transition:.2s ease-in-out;transition:.2s ease-in-out}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle+label:after,.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle+label:before{content:"";position:absolute;display:block;height:18px;width:18px;top:0;left:0;border-radius:15px;-webkit-transition:.2s ease-in-out;transition:.2s ease-in-out}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle+label:after{background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.4)}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle:checked+label{border-color:hsla(0,0%,100%,.5)}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle:checked+label:before{width:30px;background:hsla(0,0%,100%,.5)}.dplayer .dplayer-controller .dplayer-icons input#dplayer-toggle:checked+label:after{left:12px}.dplayer .dplayer-menu{position:absolute;width:150px;border-radius:2px;background:rgba(28,28,28,.9);padding:5px 0;overflow:hidden;z-index:3;display:none}.dplayer .dplayer-menu.dplayer-menu-show{display:block}.dplayer .dplayer-menu .dplayer-menu-item{height:30px;padding:5px 10px;box-sizing:border-box;cursor:pointer}.dplayer .dplayer-menu .dplayer-menu-item:hover{background-color:hsla(0,0%,100%,.1)}.dplayer .dplayer-menu .dplayer-menu-item .dplayer-menu-label a{color:#eee;font-size:13px;display:inline-block;vertical-align:middle}@-webkit-keyframes my-face{2%{-webkit-transform:translateY(1.5px) rotate(1.5deg);transform:translateY(1.5px) rotate(1.5deg)}4%{-webkit-transform:translateY(-1.5px) rotate(-.5deg);transform:translateY(-1.5px) rotate(-.5deg)}6%{-webkit-transform:translateY(1.5px) rotate(-1.5deg);transform:translateY(1.5px) rotate(-1.5deg)}8%{-webkit-transform:translateY(-1.5px) rotate(-1.5deg);transform:translateY(-1.5px) rotate(-1.5deg)}10%{-webkit-transform:translateY(2.5px) rotate(1.5deg);transform:translateY(2.5px) rotate(1.5deg)}12%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}14%{-webkit-transform:translateY(-1.5px) rotate(1.5deg);transform:translateY(-1.5px) rotate(1.5deg)}16%{-webkit-transform:translateY(-.5px) rotate(-1.5deg);transform:translateY(-.5px) rotate(-1.5deg)}18%{-webkit-transform:translateY(.5px) rotate(-1.5deg);transform:translateY(.5px) rotate(-1.5deg)}20%{-webkit-transform:translateY(-1.5px) rotate(2.5deg);transform:translateY(-1.5px) rotate(2.5deg)}22%{-webkit-transform:translateY(.5px) rotate(-1.5deg);transform:translateY(.5px) rotate(-1.5deg)}24%{-webkit-transform:translateY(1.5px) rotate(1.5deg);transform:translateY(1.5px) rotate(1.5deg)}26%{-webkit-transform:translateY(.5px) rotate(.5deg);transform:translateY(.5px) rotate(.5deg)}28%{-webkit-transform:translateY(.5px) rotate(1.5deg);transform:translateY(.5px) rotate(1.5deg)}30%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}32%{-webkit-transform:translateY(1.5px) rotate(-.5deg);transform:translateY(1.5px) rotate(-.5deg)}34%{-webkit-transform:translateY(1.5px) rotate(-.5deg);transform:translateY(1.5px) rotate(-.5deg)}36%{-webkit-transform:translateY(-1.5px) rotate(2.5deg);transform:translateY(-1.5px) rotate(2.5deg)}38%{-webkit-transform:translateY(1.5px) rotate(-1.5deg);transform:translateY(1.5px) rotate(-1.5deg)}40%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}42%{-webkit-transform:translateY(2.5px) rotate(-1.5deg);transform:translateY(2.5px) rotate(-1.5deg)}44%{-webkit-transform:translateY(1.5px) rotate(.5deg);transform:translateY(1.5px) rotate(.5deg)}46%{-webkit-transform:translateY(-1.5px) rotate(2.5deg);transform:translateY(-1.5px) rotate(2.5deg)}48%{-webkit-transform:translateY(-.5px) rotate(.5deg);transform:translateY(-.5px) rotate(.5deg)}50%{-webkit-transform:translateY(.5px) rotate(.5deg);transform:translateY(.5px) rotate(.5deg)}52%{-webkit-transform:translateY(2.5px) rotate(2.5deg);transform:translateY(2.5px) rotate(2.5deg)}54%{-webkit-transform:translateY(-1.5px) rotate(1.5deg);transform:translateY(-1.5px) rotate(1.5deg)}56%{-webkit-transform:translateY(2.5px) rotate(2.5deg);transform:translateY(2.5px) rotate(2.5deg)}58%{-webkit-transform:translateY(.5px) rotate(2.5deg);transform:translateY(.5px) rotate(2.5deg)}60%{-webkit-transform:translateY(2.5px) rotate(2.5deg);transform:translateY(2.5px) rotate(2.5deg)}62%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}64%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}66%{-webkit-transform:translateY(1.5px) rotate(-.5deg);transform:translateY(1.5px) rotate(-.5deg)}68%{-webkit-transform:translateY(-1.5px) rotate(-.5deg);transform:translateY(-1.5px) rotate(-.5deg)}70%{-webkit-transform:translateY(1.5px) rotate(.5deg);transform:translateY(1.5px) rotate(.5deg)}72%{-webkit-transform:translateY(2.5px) rotate(1.5deg);transform:translateY(2.5px) rotate(1.5deg)}74%{-webkit-transform:translateY(-.5px) rotate(.5deg);transform:translateY(-.5px) rotate(.5deg)}76%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}78%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}80%{-webkit-transform:translateY(1.5px) rotate(1.5deg);transform:translateY(1.5px) rotate(1.5deg)}82%{-webkit-transform:translateY(-.5px) rotate(.5deg);transform:translateY(-.5px) rotate(.5deg)}84%{-webkit-transform:translateY(1.5px) rotate(2.5deg);transform:translateY(1.5px) rotate(2.5deg)}86%{-webkit-transform:translateY(-1.5px) rotate(-1.5deg);transform:translateY(-1.5px) rotate(-1.5deg)}88%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}90%{-webkit-transform:translateY(2.5px) rotate(-.5deg);transform:translateY(2.5px) rotate(-.5deg)}92%{-webkit-transform:translateY(.5px) rotate(-.5deg);transform:translateY(.5px) rotate(-.5deg)}94%{-webkit-transform:translateY(2.5px) rotate(.5deg);transform:translateY(2.5px) rotate(.5deg)}96%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}98%{-webkit-transform:translateY(-1.5px) rotate(-.5deg);transform:translateY(-1.5px) rotate(-.5deg)}0%,to{-webkit-transform:translate(0) rotate(0deg);transform:translate(0) rotate(0deg)}}@keyframes my-face{2%{-webkit-transform:translateY(1.5px) rotate(1.5deg);transform:translateY(1.5px) rotate(1.5deg)}4%{-webkit-transform:translateY(-1.5px) rotate(-.5deg);transform:translateY(-1.5px) rotate(-.5deg)}6%{-webkit-transform:translateY(1.5px) rotate(-1.5deg);transform:translateY(1.5px) rotate(-1.5deg)}8%{-webkit-transform:translateY(-1.5px) rotate(-1.5deg);transform:translateY(-1.5px) rotate(-1.5deg)}10%{-webkit-transform:translateY(2.5px) rotate(1.5deg);transform:translateY(2.5px) rotate(1.5deg)}12%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}14%{-webkit-transform:translateY(-1.5px) rotate(1.5deg);transform:translateY(-1.5px) rotate(1.5deg)}16%{-webkit-transform:translateY(-.5px) rotate(-1.5deg);transform:translateY(-.5px) rotate(-1.5deg)}18%{-webkit-transform:translateY(.5px) rotate(-1.5deg);transform:translateY(.5px) rotate(-1.5deg)}20%{-webkit-transform:translateY(-1.5px) rotate(2.5deg);transform:translateY(-1.5px) rotate(2.5deg)}22%{-webkit-transform:translateY(.5px) rotate(-1.5deg);transform:translateY(.5px) rotate(-1.5deg)}24%{-webkit-transform:translateY(1.5px) rotate(1.5deg);transform:translateY(1.5px) rotate(1.5deg)}26%{-webkit-transform:translateY(.5px) rotate(.5deg);transform:translateY(.5px) rotate(.5deg)}28%{-webkit-transform:translateY(.5px) rotate(1.5deg);transform:translateY(.5px) rotate(1.5deg)}30%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}32%{-webkit-transform:translateY(1.5px) rotate(-.5deg);transform:translateY(1.5px) rotate(-.5deg)}34%{-webkit-transform:translateY(1.5px) rotate(-.5deg);transform:translateY(1.5px) rotate(-.5deg)}36%{-webkit-transform:translateY(-1.5px) rotate(2.5deg);transform:translateY(-1.5px) rotate(2.5deg)}38%{-webkit-transform:translateY(1.5px) rotate(-1.5deg);transform:translateY(1.5px) rotate(-1.5deg)}40%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}42%{-webkit-transform:translateY(2.5px) rotate(-1.5deg);transform:translateY(2.5px) rotate(-1.5deg)}44%{-webkit-transform:translateY(1.5px) rotate(.5deg);transform:translateY(1.5px) rotate(.5deg)}46%{-webkit-transform:translateY(-1.5px) rotate(2.5deg);transform:translateY(-1.5px) rotate(2.5deg)}48%{-webkit-transform:translateY(-.5px) rotate(.5deg);transform:translateY(-.5px) rotate(.5deg)}50%{-webkit-transform:translateY(.5px) rotate(.5deg);transform:translateY(.5px) rotate(.5deg)}52%{-webkit-transform:translateY(2.5px) rotate(2.5deg);transform:translateY(2.5px) rotate(2.5deg)}54%{-webkit-transform:translateY(-1.5px) rotate(1.5deg);transform:translateY(-1.5px) rotate(1.5deg)}56%{-webkit-transform:translateY(2.5px) rotate(2.5deg);transform:translateY(2.5px) rotate(2.5deg)}58%{-webkit-transform:translateY(.5px) rotate(2.5deg);transform:translateY(.5px) rotate(2.5deg)}60%{-webkit-transform:translateY(2.5px) rotate(2.5deg);transform:translateY(2.5px) rotate(2.5deg)}62%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}64%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}66%{-webkit-transform:translateY(1.5px) rotate(-.5deg);transform:translateY(1.5px) rotate(-.5deg)}68%{-webkit-transform:translateY(-1.5px) rotate(-.5deg);transform:translateY(-1.5px) rotate(-.5deg)}70%{-webkit-transform:translateY(1.5px) rotate(.5deg);transform:translateY(1.5px) rotate(.5deg)}72%{-webkit-transform:translateY(2.5px) rotate(1.5deg);transform:translateY(2.5px) rotate(1.5deg)}74%{-webkit-transform:translateY(-.5px) rotate(.5deg);transform:translateY(-.5px) rotate(.5deg)}76%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}78%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}80%{-webkit-transform:translateY(1.5px) rotate(1.5deg);transform:translateY(1.5px) rotate(1.5deg)}82%{-webkit-transform:translateY(-.5px) rotate(.5deg);transform:translateY(-.5px) rotate(.5deg)}84%{-webkit-transform:translateY(1.5px) rotate(2.5deg);transform:translateY(1.5px) rotate(2.5deg)}86%{-webkit-transform:translateY(-1.5px) rotate(-1.5deg);transform:translateY(-1.5px) rotate(-1.5deg)}88%{-webkit-transform:translateY(-.5px) rotate(2.5deg);transform:translateY(-.5px) rotate(2.5deg)}90%{-webkit-transform:translateY(2.5px) rotate(-.5deg);transform:translateY(2.5px) rotate(-.5deg)}92%{-webkit-transform:translateY(.5px) rotate(-.5deg);transform:translateY(.5px) rotate(-.5deg)}94%{-webkit-transform:translateY(2.5px) rotate(.5deg);transform:translateY(2.5px) rotate(.5deg)}96%{-webkit-transform:translateY(-.5px) rotate(1.5deg);transform:translateY(-.5px) rotate(1.5deg)}98%{-webkit-transform:translateY(-1.5px) rotate(-.5deg);transform:translateY(-1.5px) rotate(-.5deg)}0%,to{-webkit-transform:translate(0) rotate(0deg);transform:translate(0) rotate(0deg)}}',""]);
|
|
},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var r=this[t];r[2]?e.push("@media "+r[2]+"{"+r[1]+"}"):e.push(r[1])}return e.join("")},e.i=function(t,r){"string"==typeof t&&(t=[[null,t,""]]);for(var a={},n=0;n<this.length;n++){var i=this[n][0];"number"==typeof i&&(a[i]=!0)}for(n=0;n<t.length;n++){var s=t[n];"number"==typeof s[0]&&a[s[0]]||(r&&!s[2]?s[2]=r:r&&(s[2]="("+s[2]+") and ("+r+")"),e.push(s))}},e}},function(e,t,r){function a(e,t){for(var r=0;r<e.length;r++){var a=e[r],n=f[a.id];if(n){n.refs++;for(var i=0;i<n.parts.length;i++)n.parts[i](a.parts[i]);for(;i<a.parts.length;i++)n.parts.push(d(a.parts[i],t))}else{for(var s=[],i=0;i<a.parts.length;i++)s.push(d(a.parts[i],t));f[a.id]={id:a.id,refs:1,parts:s}}}}function n(e){for(var t=[],r={},a=0;a<e.length;a++){var n=e[a],i=n[0],s=n[1],o=n[2],l=n[3],d={css:s,media:o,sourceMap:l};r[i]?r[i].parts.push(d):t.push(r[i]={id:i,parts:[d]})}return t}function i(e,t){var r=y(),a=b[b.length-1];if("top"===e.insertAt)a?a.nextSibling?r.insertBefore(t,a.nextSibling):r.appendChild(t):r.insertBefore(t,r.firstChild),b.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");r.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function o(e){var t=document.createElement("style");return t.type="text/css",i(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",i(e,t),t}function d(e,t){var r,a,n;if(t.singleton){var i=v++;r=m||(m=o(t)),a=u.bind(null,r,i,!1),n=u.bind(null,r,i,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(r=l(t),a=h.bind(null,r),n=function(){s(r),r.href&&URL.revokeObjectURL(r.href)}):(r=o(t),a=c.bind(null,r),n=function(){s(r)});return a(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;a(e=t)}else n()}}function u(e,t,r,a){var n=r?"":a.css;if(e.styleSheet)e.styleSheet.cssText=k(t,n);else{var i=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function c(e,t){var r=t.css,a=t.media;if(a&&e.setAttribute("media",a),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}function h(e,t){var r=t.css,a=t.sourceMap;a&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */");var n=new Blob([r],{type:"text/css"}),i=e.href;e.href=URL.createObjectURL(n),i&&URL.revokeObjectURL(i)}var f={},p=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},g=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),y=p(function(){return document.head||document.getElementsByTagName("head")[0]}),m=null,v=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=g()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var r=n(e);return a(r,t),function(e){for(var i=[],s=0;s<r.length;s++){var o=r[s],l=f[o.id];l.refs--,i.push(l)}if(e){var d=n(e);a(d,t)}for(var s=0;s<i.length;s++){var l=i[s];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete f[l.id]}}}};var k=function(){var e=[];return function(t,r){return e[t]=r,e.filter(Boolean).join("\n")}}()},function(e,t){!function(r){if("object"==typeof t&&"undefined"!=typeof e)e.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var a;a="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,a.Hls=r()}}(function(){return function e(t,r,a){function n(s,o){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(i)return i(s,!0);var d=new Error("Cannot find module '"+s+"'");throw d.code="MODULE_NOT_FOUND",d}var u=r[s]={exports:{}};t[s][0].call(u.exports,function(e){var r=t[s][1][e];return n(r?r:e)},u,u.exports,e,t,r,a)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<a.length;s++)n(a[s]);return n}({1:[function(e,t,r){function a(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._maxListeners=void 0,a.defaultMaxListeners=10,a.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},a.prototype.emit=function(e){var t,r,a,i,l,d;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),r.apply(this,i)}else if(s(r))for(i=Array.prototype.slice.call(arguments,1),d=r.slice(),a=d.length,l=0;l<a;l++)d[l].apply(this,i);return!0},a.prototype.addListener=function(e,t){var r;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?a.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},a.prototype.on=a.prototype.addListener,a.prototype.once=function(e,t){function r(){this.removeListener(e,r),a||(a=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var a=!1;return r.listener=t,this.on(e,r),this},a.prototype.removeListener=function(e,t){var r,a,i,o;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],i=r.length,a=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=i;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=o;break}if(a<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(a,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},a.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},a.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},a.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},a.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,r){var a=arguments[3],n=arguments[4],i=arguments[5],s=JSON.stringify;t.exports=function(e){for(var t,r=Object.keys(i),o=0,l=r.length;o<l;o++){var d=r[o],u=i[d].exports;if(u===e||u["default"]===e){t=d;break}}if(!t){t=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var c={},o=0,l=r.length;o<l;o++){var d=r[o];c[d]=d}n[t]=[Function(["require","module","exports"],"("+e+")(self)"),c]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),f={};f[t]=t,n[h]=[Function(["require"],"var f = require("+s(t)+");(f.default ? f.default : f)(self);"),f];var p="("+a+")({"+Object.keys(n).map(function(e){return s(e)+":["+n[e][0]+","+s(n[e][1])+"]"}).join(",")+"},{},["+s(h)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(g.createObjectURL(new Blob([p],{type:"text/javascript"})))}},{}],3:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../helper/buffer-helper"),f=a(h),p=e("../errors"),g=e("../utils/logger"),y=e("./ewma-bandwidth-estimator"),m=a(y),v=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].FRAG_LOADING,d["default"].FRAG_LOADED,d["default"].ERROR));return r.lastLoadedFragLevel=0,r._autoLevelCapping=-1,r._nextAutoLevel=-1,r.hls=e,r.onCheck=r.abandonRulesCheck.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.clearTimer(),c["default"].prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag;if("main"===t.type){if(this.timer||(this.timer=setInterval(this.onCheck,100)),!this.bwEstimator){var r=this.hls,a=e.frag.level,n=r.levels[a].details.live,i=r.config,s=void 0,o=void 0;n?(s=i.abrEwmaFastLive,o=i.abrEwmaSlowLive):(s=i.abrEwmaFastVoD,o=i.abrEwmaSlowVoD),this.bwEstimator=new m["default"](r,o,s,i.abrEwmaDefaultEstimate)}t.trequest=performance.now(),this.fragCurrent=t}}},{key:"abandonRulesCheck",value:function(){var e=this.hls,t=e.media,r=this.fragCurrent;if(!r.loader||r.loader.stats&&r.loader.stats.aborted)return g.logger.warn("frag loader destroy or aborted, disarm abandonRulesCheck"),void this.clearTimer();if(t&&(!t.paused&&0!==t.playbackRate||!t.readyState)&&r.autoLevel&&r.level){var a=performance.now()-r.trequest,n=Math.abs(t.playbackRate);if(a>500*r.duration/n){var i=e.levels,s=Math.max(1,1e3*r.loaded/a),o=Math.max(r.loaded,Math.round(r.duration*i[r.level].bitrate/8)),l=t.currentTime,u=(o-r.loaded)/s,c=(f["default"].bufferInfo(t,l,e.config.maxBufferHole).end-l)/n;if(c<2*r.duration/n&&u>c){var h=void 0,p=void 0;for(p=r.level-1;p>=0&&(h=r.duration*i[p].bitrate/(6.4*s),g.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+p+"] :"+u.toFixed(1)+"/"+c.toFixed(1)+"/"+h.toFixed(1)),!(h<c));p--);h<u&&(p=Math.max(0,p),e.nextLoadLevel=p,this.bwEstimator.sample(a,r.loaded),g.logger.warn("loading too slow, abort fragment loading and switch to level "+p),r.loader.abort(),this.clearTimer(),e.trigger(d["default"].FRAG_LOAD_EMERGENCY_ABORTED,{frag:r}))}}}}},{key:"onFragLoaded",value:function(e){var t=e.frag;if("main"===t.type){var r=e.stats;void 0===r.aborted&&1===t.loadCounter&&this.bwEstimator.sample(performance.now()-r.trequest,r.loaded),this.clearTimer(),this.lastLoadedFragLevel=t.level,this._nextAutoLevel=-1}}},{key:"onError",value:function(e){switch(e.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var e=this.hls,t=e.config,r=e.levels,a=e.media,n=void 0,i=void 0;if(i=this._autoLevelCapping===-1&&r&&r.length?r.length-1:this._autoLevelCapping,this._nextAutoLevel!==-1)return Math.min(this._nextAutoLevel,i);var s=a&&0!==a.playbackRate?Math.abs(a.playbackRate):1,o=this.bwEstimator?this.bwEstimator.getEstimate()/s:t.abrEwmaDefaultEstimate/s,l=void 0;for(n=0;n<=i;n++)if(l=n<=this.lastLoadedFragLevel?t.abrBandWidthFactor*o:t.abrBandWidthUpFactor*o,l<r[n].bitrate)return Math.max(0,n-1);return n-1},set:function(e){this._nextAutoLevel=e}}]),t}(c["default"]);r["default"]=v},{"../errors":24,"../event-handler":25,"../events":26,"../helper/buffer-helper":28,"../utils/logger":43,"./ewma-bandwidth-estimator":8}],4:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../utils/binary-search"),d=a(l),u=e("../helper/buffer-helper"),c=a(u),h=e("../demux/demuxer"),f=a(h),p=e("../events"),g=a(p),y=e("../event-handler"),m=a(y),v=e("../helper/level-helper"),b=a(v),k=e("../utils/timeRanges"),E=a(k),w=e("../errors"),x=e("../utils/logger"),T={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR"},R=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,g["default"].MEDIA_ATTACHED,g["default"].MEDIA_DETACHING,g["default"].AUDIO_TRACKS_UPDATED,g["default"].AUDIO_TRACK_SWITCH,g["default"].AUDIO_TRACK_LOADED,g["default"].KEY_LOADED,g["default"].FRAG_LOADED,g["default"].FRAG_PARSING_INIT_SEGMENT,g["default"].FRAG_PARSING_DATA,g["default"].FRAG_PARSED,g["default"].ERROR,g["default"].BUFFER_CREATED,g["default"].BUFFER_APPENDED,g["default"].BUFFER_FLUSHED));return r.config=e.config,r.audioCodecSwap=!1,r.ticks=0,r.ontick=r.tick.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),m["default"].prototype.destroy.call(this),this.state=T.STOPPED}},{key:"startLoad",value:function(e){if(this.tracks){var t=this.media,r=this.lastCurrentTime;this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.fragLoadError=0,t&&r?(x.logger.log("configure startPosition @"+r),this.state=T.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=T.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else x.logger.warn("cannot start loading as audio tracks not parsed yet"),this.startPosition=e,this.state=T.STOPPED}},{key:"stopLoad",value:function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=T.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var e,t,r,a=this,n=this.hls,i=n.config;switch(this.state){case T.ERROR:case T.PAUSED:break;case T.STARTING:this.state=T.WAITING_TRACK,this.loadedmetadata=!1;break;case T.IDLE:if(!this.media&&(this.startFragRequested||!i.startFragPrefetch))break;e=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition;var s=this.mediaBuffer?this.mediaBuffer:this.media,o=c["default"].bufferInfo(s,e,i.maxBufferHole),l=o.len,u=o.end,h=this.fragPrevious,f=i.maxMaxBufferLength;if(l<f&&this.trackId<this.tracks.length){if(r=this.tracks[this.trackId].details,"undefined"==typeof r){this.state=T.WAITING_TRACK;break}var p=r.fragments,y=p.length,m=p[0].start,v=p[y-1].start+p[y-1].duration,b=void 0;if(u<m?b=p[0]:!function(){var e=void 0,t=i.maxFragLookUpTolerance;u<v?(u>v-t&&(t=0),e=d["default"].search(p,function(e){return e.start+e.duration-t<=u?1:e.start-t>u?-1:0})):e=p[y-1],e&&(b=e,m=e.start,h&&b.level===h.level&&b.sn===h.sn&&(b.sn<r.endSN?(b=p[b.sn+1-r.startSN],x.logger.log("SN just loaded, load next one: "+b.sn)):(r.live||(a.state=T.ENDED),b=null)))}(),b)if(null!=b.decryptdata.uri&&null==b.decryptdata.key)x.logger.log("Loading key for "+b.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+this.trackId),this.state=T.KEY_LOADING,n.trigger(g["default"].KEY_LOADING,{frag:b});else{if(x.logger.log("Loading "+b.sn+" of ["+r.startSN+" ,"+r.endSN+"],track "+this.trackId+", currentTime:"+e+",bufferEnd:"+u.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,b.loadCounter){b.loadCounter++;var k=i.fragLoadingLoopThreshold;if(b.loadCounter>k&&Math.abs(this.fragLoadIdx-b.loadIdx)<k)return void n.trigger(g["default"].ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:b})}else b.loadCounter=1;b.loadIdx=this.fragLoadIdx,this.fragCurrent=b,this.startFragRequested=!0,n.trigger(g["default"].FRAG_LOADING,{frag:b}),this.state=T.FRAG_LOADING}}break;case T.WAITING_TRACK:t=this.tracks[this.trackId],t&&t.details&&(this.state=T.IDLE);break;case T.FRAG_LOADING_WAITING_RETRY:var E=performance.now(),R=this.retryDate;s=this.media;var _=s&&s.seeking;(!R||E>=R||_)&&(x.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=T.IDLE);break;case T.STOPPED:case T.FRAG_LOADING:case T.PARSING:case T.PARSED:case T.ENDED:}}},{key:"onMediaAttached",value:function(e){var t=this.media=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended);var r=this.config;this.tracks&&r.autoStartLoad&&this.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(x.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.tracks;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){this.state===T.ENDED&&(this.state=T.IDLE),this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaEnded",value:function(){this.startPosition=this.lastCurrentTime=0}},{key:"onAudioTracksUpdated",value:function(e){x.logger.log("audio tracks updated"),this.tracks=e.audioTracks}},{key:"onAudioTrackSwitch",value:function(e){this.trackId=e.id,this.state=T.IDLE,this.fragCurrent=null,this.state=T.PAUSED,this.hls.trigger(g["default"].BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),this.tick()}},{key:"onAudioTrackLoaded",value:function(e){var t=e.details,r=e.id,a=this.tracks[r],n=t.totalduration;if(x.logger.log("track "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+n),t.PTSKnown=!1,a.details=t,!this.startFragRequested){if(this.startPosition===-1){var i=t.startTimeOffset;isNaN(i)?this.startPosition=0:(x.logger.log("start time offset found in playlist, adjust startPosition to "+i),this.startPosition=i)}this.nextLoadPosition=this.startPosition}this.state===T.WAITING_TRACK&&(this.state=T.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===T.KEY_LOADING&&(this.state=T.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent;if(this.state===T.FRAG_LOADING&&t&&"audio"===e.frag.type&&e.frag.level===t.level&&e.frag.sn===t.sn){this.state=T.PARSING,this.stats=e.stats;var r=this.tracks[this.trackId],a=r.details,n=a.totalduration,i=t.start,s=t.level,o=t.sn,l=this.config.defaultAudioCodec||r.audioCodec;this.pendingAppending=0,this.demuxer||(this.demuxer=new f["default"](this.hls,"audio")),x.logger.log("Demuxing "+o+" of ["+a.startSN+" ,"+a.endSN+"],track "+s),this.demuxer.push(e.payload,l,null,i,t.cc,s,o,n,t.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent;if(t&&"audio"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING){var r=e.tracks,a=void 0;if(a=r.audio){a.levelCodec="mp4a.40.2",a.id=e.id,this.hls.trigger(g["default"].BUFFER_CODECS,r),x.logger.log("track:audio,container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var n=a.initSegment;n&&(this.pendingAppending++,this.hls.trigger(g["default"].BUFFER_APPENDING,{type:"audio",data:n,parent:"audio"})),this.tick()}}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent;if(r&&"audio"===e.id&&e.sn===r.sn&&e.level===r.level&&this.state===T.PARSING){var a=this.tracks[this.trackId],n=this.fragCurrent;x.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb),b["default"].updateFragPTSDTS(a.details,n.sn,e.startPTS,e.endPTS),[e.data1,e.data2].forEach(function(r){r&&(t.pendingAppending++,t.hls.trigger(g["default"].BUFFER_APPENDING,{type:e.type,data:r,parent:"audio"}))}),this.nextLoadPosition=e.endPTS,this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent;t&&"audio"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING&&(this.stats.tparsed=performance.now(),this.state=T.PARSED,this._checkAppendedParsed())}},{key:"onBufferCreated",value:function(e){var t=e.tracks.audio;t&&(this.mediaBuffer=t.buffer,this.loadedmetadata=!0)}},{key:"onBufferAppended",value:function(e){if("audio"===e.parent)switch(this.state){case T.PARSING:case T.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===T.PARSED&&0===this.pendingAppending){var e=this.fragCurrent,t=this.stats;if(e){this.fragPrevious=e,t.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*t.length/(t.tbuffered-t.tfirst)),this.hls.trigger(g["default"].FRAG_BUFFERED,{stats:t,frag:e,id:"audio"});var r=this.mediaBuffer?this.mediaBuffer:this.media;x.logger.log("audio buffered : "+E["default"].toString(r.buffered)),this.state=T.IDLE}this.tick()}}},{key:"onError",value:function(e){var t=e.frag;if(!t||"audio"===t.type)switch(e.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!e.fatal){var r=this.fragLoadError;if(r?r++:r=1,r<=this.config.fragLoadingMaxRetry){this.fragLoadError=r,t.loadCounter=0;var a=Math.min(Math.pow(2,r-1)*this.config.fragLoadingRetryDelay,64e3);x.logger.warn("audioStreamController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.state=T.FRAG_LOADING_WAITING_RETRY}else x.logger.error("audioStreamController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.trigger(g["default"].ERROR,e),this.state=T.ERROR}break;case w.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case w.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case w.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==T.ERROR&&(this.state=e.fatal?T.ERROR:T.IDLE,x.logger.warn("audioStreamController: "+e.details+" while loading frag,switch to "+this.state+" state ..."))}}},{key:"onBufferFlushed",value:function(){this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=T.IDLE,this.fragPrevious=null,this.tick()}}]),t}(m["default"]);r["default"]=R},{"../demux/demuxer":20,"../errors":24,"../event-handler":25,"../events":26,"../helper/buffer-helper":28,"../helper/level-helper":29,"../utils/binary-search":39,"../utils/logger":43,"../utils/timeRanges":45}],5:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../utils/logger"),f=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].MANIFEST_LOADING,d["default"].MANIFEST_LOADED,d["default"].AUDIO_TRACK_LOADED));return r.tracks=[],r.trackId=0,r}return s(t,e),o(t,[{key:"destroy",value:function(){c["default"].prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.trackId=0}},{key:"onManifestLoaded",value:function(e){var t=this,r=e.audioTracks||[];this.tracks=r,this.hls.trigger(d["default"].AUDIO_TRACKS_UPDATED,{audioTracks:r}),r.forEach(function(e){if(e["default"])return void(t.audioTrack=e.id)})}},{key:"onAudioTrackLoaded",value:function(e){e.id<this.tracks.length&&(h.logger.log("audioTrack "+e.id+" loaded"),this.tracks[e.id].details=e.details,e.details.live&&!this.timer&&(this.timer=setInterval(this.ontick,1e3*e.details.targetduration)),!e.details.live&&this.timer&&(clearInterval(this.timer),this.timer=null))}},{key:"setAudioTrackInternal",value:function(e){if(e>=0&&e<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=e,h.logger.log("switching to audioTrack "+e),this.hls.trigger(d["default"].AUDIO_TRACK_SWITCH,{id:e});var t=this.tracks[e];void 0!==t.details&&t.details.live!==!0||(h.logger.log("(re)loading playlist for audioTrack "+e),this.hls.trigger(d["default"].AUDIO_TRACK_LOADING,{url:t.url,id:e}))}}},{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this.trackId},set:function(e){this.trackId===e&&void 0!==this.tracks[e].details||this.setAudioTrackInternal(e)}}]),t}(c["default"]);r["default"]=f},{"../event-handler":25,"../events":26,"../utils/logger":43}],6:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../utils/logger"),f=e("../errors"),p=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].MEDIA_ATTACHING,d["default"].MEDIA_DETACHING,d["default"].MANIFEST_PARSED,d["default"].BUFFER_RESET,d["default"].BUFFER_APPENDING,d["default"].BUFFER_CODECS,d["default"].BUFFER_EOS,d["default"].BUFFER_FLUSHING,d["default"].LEVEL_UPDATED));return r._msDuration=null,r._levelDuration=null,r.onsbue=r.onSBUpdateEnd.bind(r),r.onsbe=r.onSBUpdateError.bind(r),r.pendingTracks={},r}return s(t,e),o(t,[{key:"destroy",value:function(){c["default"].prototype.destroy.call(this)}},{key:"onManifestParsed",value:function(e){var t=e.audio,r=e.video,a=0;(t||r)&&(a=(t?1:0)+(r?1:0),h.logger.log(a+" sourceBuffer(s) expected")),this.sourceBufferNb=a}},{key:"onMediaAttaching",value:function(e){var t=this.media=e.media;if(t){var r=this.mediaSource=new MediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),r.addEventListener("sourceopen",this.onmso),r.addEventListener("sourceended",this.onmse),r.addEventListener("sourceclose",this.onmsc),t.src=URL.createObjectURL(r)}}},{key:"onMediaDetaching",value:function(){h.logger.log("media source detaching");var e=this.mediaSource;if(e){if("open"===e.readyState)try{e.endOfStream()}catch(t){h.logger.warn("onMediaDetaching:"+t.message+" while calling endOfStream")}e.removeEventListener("sourceopen",this.onmso),e.removeEventListener("sourceended",this.onmse),e.removeEventListener("sourceclose",this.onmsc);try{this.media.src="",this.media.removeAttribute("src")}catch(t){h.logger.warn("onMediaDetaching:"+t.message+" while unlinking video.src")}this.mediaSource=null,this.media=null,this.pendingTracks={},this.sourceBuffer={}}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(d["default"].MEDIA_DETACHED)}},{key:"onMediaSourceOpen",value:function(){h.logger.log("media source opened"),this.hls.trigger(d["default"].MEDIA_ATTACHED,{media:this.media}),this.mediaSource.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()}},{key:"checkPendingTracks",value:function(){var e=this.pendingTracks,t=Object.keys(e).length;!t||this.sourceBufferNb!==t&&0!==this.sourceBufferNb||(this.createSourceBuffers(e),this.pendingTracks={},this.doAppending())}},{key:"onMediaSourceClose",value:function(){h.logger.log("media source closed")}},{key:"onMediaSourceEnded",value:function(){h.logger.log("media source ended")}},{key:"onSBUpdateEnd",value:function(){this._needsFlush&&this.doFlush(),this._needsEos&&this.onBufferEos(),this.appending=!1,this.hls.trigger(d["default"].BUFFER_APPENDED,{parent:this.parent}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()}},{key:"onSBUpdateError",value:function(e){h.logger.error("sourceBuffer error:"+e),this.hls.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferReset",value:function(){var e=this.sourceBuffer;for(var t in e){var r=e[t];try{this.mediaSource.removeSourceBuffer(r),r.removeEventListener("updateend",this.onsbue),r.removeEventListener("error",this.onsbe)}catch(a){}}this.sourceBuffer={},this.flushRange=[],this.appended=0}},{key:"onBufferCodecs",value:function(e){if(0===Object.keys(this.sourceBuffer).length){for(var t in e)this.pendingTracks[t]=e[t];var r=this.mediaSource;r&&"open"===r.readyState&&this.checkPendingTracks();
|
|
}}},{key:"createSourceBuffers",value:function(e){var t=this.sourceBuffer,r=this.mediaSource;for(var a in e)if(!t[a]){var n=e[a],i=n.levelCodec||n.codec,s=n.container+";codecs="+i;h.logger.log("creating sourceBuffer with mimeType:"+s);try{var o=t[a]=r.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe),n.buffer=o}catch(l){h.logger.error("error while trying to add sourceBuffer:"+l.message),this.hls.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:l,mimeType:s})}}this.hls.trigger(d["default"].BUFFER_CREATED,{tracks:e})}},{key:"onBufferAppending",value:function(e){this._needsFlush||(this.segments?this.segments.push(e):this.segments=[e],this.doAppending())}},{key:"onBufferAppendFail",value:function(e){h.logger.error("sourceBuffer error:"+e.event),this.hls.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1,frag:this.fragCurrent})}},{key:"onBufferEos",value:function(){var e=this.sourceBuffer,t=this.mediaSource;t&&"open"===t.readyState&&(e.audio&&e.audio.updating||e.video&&e.video.updating?this._needsEos=!0:(h.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment"),t.endOfStream(),this._needsEos=!1))}},{key:"onBufferFlushing",value:function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset,type:e.type}),this.flushBufferCounter=0,this.doFlush()}},{key:"onLevelUpdated",value:function(e){var t=e.details;0!==t.fragments.length&&(this._levelDuration=t.totalduration+t.fragments[0].start,this.updateMediaElementDuration())}},{key:"updateMediaElementDuration",value:function(){if(null!==this._levelDuration){var e=this.media,t=this.mediaSource,r=this.sourceBuffer;if(e&&t&&r&&0!==e.readyState&&"open"===t.readyState){for(var a in r)if(r[a].updating)return;null===this._msDuration&&(this._msDuration=t.duration),this._levelDuration>this._msDuration&&(h.logger.log("Updating mediasource duration to "+this._levelDuration),t.duration=this._levelDuration,this._msDuration=this._levelDuration)}}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var e=this.flushRange[0];if(!this.flushBuffer(e.start,e.end,e.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var t=0,r=this.sourceBuffer;for(var a in r)t+=r[a].buffered.length;this.appended=t,this.hls.trigger(d["default"].BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var e=this.hls,t=this.sourceBuffer,r=this.segments;if(Object.keys(t).length){if(this.media.error)return this.segments=[],void h.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(r&&r.length){var a=r.shift();try{t[a.type]?(this.parent=a.parent,t[a.type].appendBuffer(a.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(n){h.logger.error("error while trying to append buffer:"+n.message),r.unshift(a);var i={type:f.ErrorTypes.MEDIA_ERROR};if(22===n.code)return this.segments=[],i.details=f.ErrorDetails.BUFFER_FULL_ERROR,void e.trigger(d["default"].ERROR,i);if(this.appendError?this.appendError++:this.appendError=1,i.details=f.ErrorDetails.BUFFER_APPEND_ERROR,i.frag=this.fragCurrent,this.appendError>e.config.appendErrorMaxRetry)return h.logger.log("fail "+e.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),r=[],i.fatal=!0,void e.trigger(d["default"].ERROR,i);i.fatal=!1,e.trigger(d["default"].ERROR,i)}}}}},{key:"flushBuffer",value:function(e,t,r){var a,n,i,s,o,l;if(this.flushBufferCounter<this.appended&&this.sourceBuffer){for(var d in this.sourceBuffer)if(!r||d===r){if(a=this.sourceBuffer[d],a.updating)return h.logger.warn("cannot flush, sb updating in progress"),!1;for(n=0;n<a.buffered.length;n++)if(i=a.buffered.start(n),s=a.buffered.end(n),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&&t===Number.POSITIVE_INFINITY?(o=e,l=t):(o=Math.max(i,e),l=Math.min(s,t)),Math.min(l,s)-o>.5)return this.flushBufferCounter++,h.logger.log("flush "+d+" ["+o+","+l+"], of ["+i+","+s+"], pos:"+this.media.currentTime),a.remove(o,l),!1}}else h.logger.warn("abort flushing too many retries");return h.logger.log("buffer flushed"),!0}}]),t}(c["default"]);r["default"]=p},{"../errors":24,"../event-handler":25,"../events":26,"../utils/logger":43}],7:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=function(e){function t(e){return n(this,t),i(this,Object.getPrototypeOf(t).call(this,e,d["default"].FPS_DROP_LEVEL_CAPPING,d["default"].MEDIA_ATTACHING,d["default"].MANIFEST_PARSED))}return s(t,e),o(t,[{key:"destroy",value:function(){this.hls.config.capLevelToPlayerSize&&(this.media=this.restrictedLevels=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer)))}},{key:"onFpsDropLevelCapping",value:function(e){this.restrictedLevels||(this.restrictedLevels=[]),this.isLevelRestricted(e.droppedLevel)||this.restrictedLevels.push(e.droppedLevel)}},{key:"onMediaAttaching",value:function(e){this.media=e.media instanceof HTMLVideoElement?e.media:null}},{key:"onManifestParsed",value:function(e){this.hls.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=e.levels,this.hls.firstLevel=this.getMaxLevel(e.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"detectPlayerSize",value:function(){if(this.media){var e=this.levels?this.levels.length:0;e&&(this.hls.autoLevelCapping=this.getMaxLevel(e-1),this.hls.autoLevelCapping>this.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(e){var t=0,r=void 0,a=void 0,n=this.mediaWidth,i=this.mediaHeight,s=0,o=0;for(r=0;r<=e&&(a=this.levels[r],!this.isLevelRestricted(r))&&(t=r,s=a.width,o=a.height,!(n<=s||i<=o));r++);return t}},{key:"isLevelRestricted",value:function(e){return!(!this.restrictedLevels||this.restrictedLevels.indexOf(e)===-1)}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(t){}return e}},{key:"mediaWidth",get:function(){var e=void 0;return this.media&&(e=this.media.width||this.media.clientWidth||this.media.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0;return this.media&&(e=this.media.height||this.media.clientHeight||this.media.offsetHeight,e*=this.contentScaleFactor),e}}]),t}(c["default"]);r["default"]=h},{"../event-handler":25,"../events":26}],8:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("../utils/ewma"),o=a(s),l=function(){function e(t,r,a,i){n(this,e),this.hls=t,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new o["default"](r),this.fast_=new o["default"](a)}return i(e,[{key:"sample",value:function(e,t){e=Math.max(e,this.minDelayMs_);var r=8e3*t/e,a=e/1e3;this.fast_.sample(a,r),this.slow_.sample(a,r)}},{key:"getEstimate",value:function(){return!this.fast_||!this.slow_||this.fast_.getTotalWeight()<this.minWeight_?this.defaultEstimate_:Math.min(this.fast_.getEstimate(),this.slow_.getEstimate())}},{key:"destroy",value:function(){}}]),e}();r["default"]=l},{"../utils/ewma":42}],9:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../utils/logger"),f=function(e){function t(e){return n(this,t),i(this,Object.getPrototypeOf(t).call(this,e,d["default"].MEDIA_ATTACHING))}return s(t,e),o(t,[{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1}},{key:"onMediaAttaching",value:function(e){this.hls.config.capLevelOnFPSDrop&&(this.video=e.media instanceof HTMLVideoElement?e.media:null,"function"==typeof this.video.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),this.hls.config.fpsDroppedMonitoringPeriod))}},{key:"checkFPS",value:function(e,t,r){var a=performance.now();if(t){if(this.lastTime){var n=a-this.lastTime,i=r-this.lastDroppedFrames,s=t-this.lastDecodedFrames,o=1e3*i/n;if(this.hls.trigger(d["default"].FPS_DROP,{currentDropped:i,currentDecoded:s,totalDroppedFrames:r}),o>0&&i>this.hls.config.fpsDroppedMonitoringThreshold*s){var l=this.hls.currentLevel;h.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(this.hls.autoLevelCapping===-1||this.hls.autoLevelCapping>=l)&&(l-=1,this.hls.trigger(d["default"].FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:this.hls.currentLevel}),this.hls.autoLevelCapping=l,this.hls.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}},{key:"checkFPSInterval",value:function(){if(this.video)if(this.isVideoPlaybackQualityAvailable){var e=this.video.getVideoPlaybackQuality();this.checkFPS(this.video,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(this.video,this.video.webkitDecodedFrameCount,this.video.webkitDroppedFrameCount)}}]),t}(c["default"]);r["default"]=f},{"../event-handler":25,"../events":26,"../utils/logger":43}],10:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../utils/logger"),f=e("../errors"),p=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].MANIFEST_LOADED,d["default"].LEVEL_LOADED,d["default"].ERROR));return r.ontick=r.tick.bind(r),r._manualLevel=r._autoLevelCapping=-1,r}return s(t,e),o(t,[{key:"destroy",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this._manualLevel=-1}},{key:"startLoad",value:function(){this.canload=!0,this.timer&&this.tick()}},{key:"stopLoad",value:function(){this.canload=!1}},{key:"onManifestLoaded",value:function(e){var t,r,a=[],n=[],i={},s=!1,o=!1,l=this.hls;if(e.levels.forEach(function(e){e.videoCodec&&(s=!0),(e.audioCodec||e.attrs&&e.attrs.AUDIO)&&(o=!0);var t=i[e.bitrate];void 0===t?(i[e.bitrate]=a.length,e.url=[e.url],e.urlId=0,a.push(e)):a[t].url.push(e.url)}),s&&o?a.forEach(function(e){e.videoCodec&&n.push(e)}):n=a,n=n.filter(function(e){var t=function(e){return MediaSource.isTypeSupported("audio/mp4;codecs="+e)},r=function(e){return MediaSource.isTypeSupported("video/mp4;codecs="+e)},a=e.audioCodec,n=e.videoCodec;return(!a||t(a))&&(!n||r(n))}),n.length){for(t=n[0].bitrate,n.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=n,r=0;r<n.length;r++)if(n[r].bitrate===t){this._firstLevel=r,h.logger.log("manifest loaded,"+n.length+" level(s) found, first bitrate:"+t);break}l.trigger(d["default"].MANIFEST_PARSED,{levels:this._levels,firstLevel:this._firstLevel,stats:e.stats,audio:o,video:s})}else l.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:l.url,reason:"no level with compatible codecs found in manifest"})}},{key:"setLevelInternal",value:function(e){var t=this._levels;if(e>=0&&e<t.length){this.timer&&(clearTimeout(this.timer),this.timer=null),this._level=e,h.logger.log("switching to level "+e),this.hls.trigger(d["default"].LEVEL_SWITCH,{level:e});var r=t[e];if(void 0===r.details||r.details.live===!0){h.logger.log("(re)loading playlist for level "+e);var a=r.urlId;this.hls.trigger(d["default"].LEVEL_LOADING,{url:r.url[a],level:e,id:a})}}else this.hls.trigger(d["default"].ERROR,{type:f.ErrorTypes.OTHER_ERROR,details:f.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:!1,reason:"invalid level idx"})}},{key:"onError",value:function(e){if(!e.fatal){var t=e.details,r=this.hls,a=void 0,n=void 0,i=!1;switch(t){case f.ErrorDetails.FRAG_LOAD_ERROR:case f.ErrorDetails.FRAG_LOAD_TIMEOUT:case f.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case f.ErrorDetails.KEY_LOAD_ERROR:case f.ErrorDetails.KEY_LOAD_TIMEOUT:a=e.frag.level;break;case f.ErrorDetails.LEVEL_LOAD_ERROR:case f.ErrorDetails.LEVEL_LOAD_TIMEOUT:a=e.context.level,i=!0}if(void 0!==a)if(n=this._levels[a],n.urlId<n.url.length-1)n.urlId++,n.details=void 0,h.logger.warn("level controller,"+t+" for level "+a+": switching to redundant stream id "+n.urlId);else{var s=this._manualLevel===-1&&a;s?(h.logger.warn("level controller,"+t+": emergency switch-down for next fragment"),r.abrController.nextAutoLevel=0):n&&n.details&&n.details.live?(h.logger.warn("level controller,"+t+" on live stream, discard"),i&&(this._level=void 0)):t!==f.ErrorDetails.FRAG_LOAD_ERROR&&t!==f.ErrorDetails.FRAG_LOAD_TIMEOUT&&(h.logger.error("cannot recover "+t+" error"),this._level=void 0,this.timer&&(clearTimeout(this.timer),this.timer=null),e.fatal=!0,r.trigger(d["default"].ERROR,e))}}}},{key:"onLevelLoaded",value:function(e){if(e.level===this._level){var t=e.details;if(t.live){var r=1e3*(t.averagetargetduration?t.averagetargetduration:t.targetduration),a=this._levels[e.level],n=a.details;n&&t.endSN===n.endSN&&(r/=2,h.logger.log("same live playlist, reload twice faster")),r-=performance.now()-e.stats.trequest,r=Math.max(1e3,Math.round(r)),h.logger.log("live playlist, reload in "+r+" ms"),this.timer=setTimeout(this.ontick,r)}else this.timer=null}}},{key:"tick",value:function(){var e=this._level;if(void 0!==e&&this.canload){var t=this._levels[e],r=t.urlId;this.hls.trigger(d["default"].LEVEL_LOADING,{url:t.url[r],level:e,id:r})}}},{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this._level},set:function(e){var t=this._levels;t&&t.length>e&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),e!==-1&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return this._manualLevel!==-1?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,this._manualLevel===-1&&(this.hls.abrController.nextAutoLevel=e)}}]),t}(c["default"]);r["default"]=p},{"../errors":24,"../event-handler":25,"../events":26,"../utils/logger":43}],11:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../utils/binary-search"),d=a(l),u=e("../helper/buffer-helper"),c=a(u),h=e("../demux/demuxer"),f=a(h),p=e("../events"),g=a(p),y=e("../event-handler"),m=a(y),v=e("../helper/level-helper"),b=a(v),k=e("../utils/timeRanges"),E=a(k),w=e("../errors"),x=e("../utils/logger"),T={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR"},R=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,g["default"].MEDIA_ATTACHED,g["default"].MEDIA_DETACHING,g["default"].MANIFEST_LOADING,g["default"].MANIFEST_PARSED,g["default"].LEVEL_LOADED,g["default"].KEY_LOADED,g["default"].FRAG_LOADED,g["default"].FRAG_LOAD_EMERGENCY_ABORTED,g["default"].FRAG_PARSING_INIT_SEGMENT,g["default"].FRAG_PARSING_DATA,g["default"].FRAG_PARSED,g["default"].ERROR,g["default"].BUFFER_CREATED,g["default"].BUFFER_APPENDED,g["default"].BUFFER_FLUSHED));return r.config=e.config,r.audioCodecSwap=!1,r.ticks=0,r.ontick=r.tick.bind(r),r}return s(t,e),o(t,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),m["default"].prototype.destroy.call(this),this.state=T.STOPPED}},{key:"startLoad",value:function(e){if(this.levels){var t=this.media,r=this.lastCurrentTime;this.stopLoad(),this.demuxer=new f["default"](this.hls,"main"),this.timer||(this.timer=setInterval(this.ontick,100)),this.level=-1,this.fragLoadError=0,t&&r>0?(x.logger.log("configure startPosition @"+r),this.lastPaused||(x.logger.log("resuming video"),t.play()),this.state=T.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:e,this.state=T.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else x.logger.warn("cannot start loading as manifest not parsed yet"),this.state=T.STOPPED}},{key:"stopLoad",value:function(){var e=this.fragCurrent;e&&(e.loader&&e.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=T.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){switch(this.state){case T.STARTING:var e=this.hls,t=e.startLevel;t===-1&&(t=0,this.fragBitrateTest=!0),this.level=e.nextLoadLevel=t,this.state=T.WAITING_LEVEL,this.loadedmetadata=!1;break;case T.IDLE:if(!this._doTickIdle())return;break;case T.WAITING_LEVEL:var r=this.levels[this.level];r&&r.details&&(this.state=T.IDLE);break;case T.FRAG_LOADING_WAITING_RETRY:var a=performance.now(),n=this.retryDate;(!n||a>=n||this.media&&this.media.seeking)&&(x.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=T.IDLE);break;case T.ERROR:case T.PAUSED:case T.STOPPED:case T.FRAG_LOADING:case T.PARSING:case T.PARSED:case T.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"_doTickIdle",value:function(){var e=this.hls,t=e.config,r=this.media;if(!r&&(this.startFragRequested||!t.startFragPrefetch))return!0;var a=void 0;a=this.loadedmetadata?r.currentTime:this.nextLoadPosition;var n=e.nextLoadLevel,i=void 0;this.levels[n].hasOwnProperty("bitrate")?(i=Math.max(8*t.maxBufferSize/this.levels[n].bitrate,t.maxBufferLength),i=Math.min(i,t.maxMaxBufferLength)):i=t.maxBufferLength;var s=c["default"].bufferInfo(this.mediaBuffer?this.mediaBuffer:r,a,t.maxBufferHole),o=s.len;if(o>=i)return!0;x.logger.trace("buffer length of "+o.toFixed(3)+" is below max of "+i.toFixed(3)+". checking for more payload ..."),e.nextLoadLevel=n,this.level=n;var l=this.levels[n].details;return"undefined"==typeof l||l.live&&this.levelLastLoaded!==n?(this.state=T.WAITING_LEVEL,!0):this._fetchPayloadOrEos({pos:a,bufferInfo:s,levelDetails:l})}},{key:"_fetchPayloadOrEos",value:function(e){var t=e.pos,r=e.bufferInfo,a=e.levelDetails,n=this.fragPrevious,i=this.level,s=a.fragments,o=s.length,l=s[0].start,d=s[o-1].start+s[o-1].duration,u=r.end,c=void 0;if(a.live){if(c=this._ensureFragmentAtLivePoint({levelDetails:a,bufferEnd:u,start:l,end:d,fragPrevious:n,fragments:s,fragLen:o}),null===c)return!1}else u<l&&(c=s[0]);return c||(c=this._findFragment({start:l,fragPrevious:n,fragLen:o,fragments:s,bufferEnd:u,end:d,levelDetails:a})),!c||this._loadFragmentOrKey({frag:c,level:i,levelDetails:a,pos:t,bufferEnd:u})}},{key:"_ensureFragmentAtLivePoint",value:function(e){var t=e.levelDetails,r=e.bufferEnd,a=e.start,n=e.end,i=e.fragPrevious,s=e.fragments,o=e.fragLen,l=this.hls.config,d=void 0,u=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*t.targetduration;if(r<Math.max(a,n-u)){var c=void 0!==l.liveSyncDuration?l.liveSyncDuration:l.liveSyncDurationCount*t.targetduration,h=a+Math.max(0,t.totalduration-c);x.logger.log("buffer end: "+r+" is located too far from the end of live sliding playlist, reset currentTime to : "+h.toFixed(3)),r=h;var f=this.media;f&&f.readyState&&f.duration>h&&(f.currentTime=h)}if(t.PTSKnown&&r>n)return null;if(this.startFragRequested&&!t.PTSKnown){if(i){var p=i.sn+1;p>=t.startSN&&p<=t.endSN&&(d=s[p-t.startSN],x.logger.log("live playlist, switching playlist, load frag with next SN: "+d.sn))}d||(d=s[Math.min(o-1,Math.round(o/2))],x.logger.log("live playlist, switching playlist, unknown, load middle frag : "+d.sn))}return d}},{key:"_findFragment",value:function(e){var t=e.start,r=e.fragPrevious,a=e.fragLen,n=e.fragments,i=e.bufferEnd,s=e.end,o=e.levelDetails,l=this.hls.config,u=void 0,c=void 0,h=l.maxFragLookUpTolerance;if(i<s?(i>s-h&&(h=0),c=d["default"].search(n,function(e){return e.start+e.duration-h<=i?1:e.start-h>i&&e.start?-1:0})):c=n[a-1],c&&(u=c,t=c.start,r&&u.level===r.level&&u.sn===r.sn))if(u.sn<o.endSN){var f=r.deltaPTS,p=u.sn-o.startSN;f&&f>l.maxBufferHole&&r.dropped&&p?(u=n[p-1],x.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),r.loadCounter--):(u=n[p+1],x.logger.log("SN just loaded, load next one: "+u.sn))}else o.live||(this.hls.trigger(g["default"].BUFFER_EOS),this.media.seeking||(this.state=T.ENDED)),u=null;return u}},{key:"_loadFragmentOrKey",value:function(e){var t=e.frag,r=e.level,a=e.levelDetails,n=e.pos,i=e.bufferEnd,s=this.hls,o=s.config;if(null==t.decryptdata.uri||null!=t.decryptdata.key){if(x.logger.log("Loading "+t.sn+" of ["+a.startSN+" ,"+a.endSN+"],level "+r+", currentTime:"+n+",bufferEnd:"+i.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,t.loadCounter){t.loadCounter++;var l=o.fragLoadingLoopThreshold;if(t.loadCounter>l&&Math.abs(this.fragLoadIdx-t.loadIdx)<l)return s.trigger(g["default"].ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:t}),!1}else t.loadCounter=1;return t.loadIdx=this.fragLoadIdx,t.autoLevel=s.autoLevelEnabled,this.fragCurrent=t,this.startFragRequested=!0,s.trigger(g["default"].FRAG_LOADING,{frag:t}),this.state=T.FRAG_LOADING,!0}x.logger.log("Loading key for "+t.sn+" of ["+a.startSN+" ,"+a.endSN+"],level "+r),this.state=T.KEY_LOADING,s.trigger(g["default"].KEY_LOADING,{frag:t})}},{key:"getBufferRange",value:function(e){var t,r,a=this.bufferRange;if(a)for(t=a.length-1;t>=0;t--)if(r=a[t],e>=r.start&&e<=r.end)return r;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(e){var t=this.media;if(t)for(var r=t.buffered,a=0;a<r.length;a++)if(e>=r.start(a)&&e<=r.end(a))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var e,t,r=this.media;if(r&&r.seeking===!1&&(t=r.currentTime,t>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=t),this.isBuffered(t)?e=this.getBufferRange(t):this.isBuffered(t+.1)&&(e=this.getBufferRange(t+.1)),e)){var a=e.frag;a!==this.fragPlaying&&(this.fragPlaying=a,this.hls.trigger(g["default"].FRAG_CHANGED,{frag:a}))}}},{key:"immediateLevelSwitch",value:function(){if(x.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e=this.media,t=void 0;e?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.state=T.PAUSED,this.hls.trigger(g["default"].BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){var e=this.media;e&&e.buffered.length&&(this.immediateSwitch=!1,this.isBuffered(e.currentTime)&&(e.currentTime-=1e-4),this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var e=this.media;if(e&&e.readyState){var t=void 0,r=void 0,a=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,r=this.getBufferRange(e.currentTime),r&&r.start>1&&(this.state=T.PAUSED,this.hls.trigger(g["default"].BUFFER_FLUSHING,{startOffset:0,endOffset:r.start-1})),e.paused)t=0;else{var n=this.hls.nextLoadLevel,i=this.levels[n],s=this.fragLastKbps;t=s&&this.fragCurrent?this.fragCurrent.duration*i.bitrate/(1e3*s)+1:0}if(a=this.getBufferRange(e.currentTime+t),a&&(a=this.followingBufferRange(a))){var o=this.fragCurrent;o&&o.loader&&o.loader.abort(),this.fragCurrent=null,this.state=T.PAUSED,this.hls.trigger(g["default"].BUFFER_FLUSHING,{startOffset:a.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(e){var t=this.media=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("seeked",this.onvseeked),t.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.hls.startLoad(r.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(x.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var t=this.levels;t&&t.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){var e=this.media,t=e?e.currentTime:void 0;if(x.logger.log("media seeking to "+t),this.state===T.FRAG_LOADING){var r=c["default"].bufferInfo(e,t,this.config.maxBufferHole),a=this.fragCurrent;if(0===r.len&&a){var n=this.config.maxFragLookUpTolerance,i=a.start-n,s=a.start+a.duration+n;t<i||t>s?(a.loader&&(x.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),a.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=T.IDLE):x.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===T.ENDED&&(this.state=T.IDLE);e&&(this.lastCurrentTime=t),this.state!==T.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){x.logger.log("media seeked to "+this.media.currentTime),this.tick()}},{key:"onMediaEnded",value:function(){x.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){x.logger.log("trigger BUFFER_RESET"),this.hls.trigger(g["default"].BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(e){var t,r=!1,a=!1;e.levels.forEach(function(e){t=e.audioCodec,t&&(t.indexOf("mp4a.40.2")!==-1&&(r=!0),t.indexOf("mp4a.40.5")!==-1&&(a=!0))}),this.audioCodecSwitch=r&&a,this.audioCodecSwitch&&x.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;var n=this.config;n.autoStartLoad&&this.hls.startLoad(n.startPosition)}},{key:"onLevelLoaded",value:function(e){var t=e.details,r=e.level,a=this.levels[r],n=t.totalduration,i=0;if(x.logger.log("level "+r+" loaded ["+t.startSN+","+t.endSN+"],duration:"+n),this.levelLastLoaded=r,t.live){var s=a.details;s?(b["default"].mergeDetails(s,t),i=t.fragments[0].start,t.PTSKnown?x.logger.log("live playlist sliding:"+i.toFixed(3)):x.logger.log("live playlist - outdated PTS, unknown sliding")):(t.PTSKnown=!1,x.logger.log("live playlist - first load, unknown sliding"))}else t.PTSKnown=!1;if(a.details=t,this.hls.trigger(g["default"].LEVEL_UPDATED,{details:t,level:r}),this.startFragRequested===!1){if(this.startPosition===-1){var o=t.startTimeOffset;if(isNaN(o))if(t.live){var l=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*t.targetduration;this.startPosition=Math.max(0,i+n-l),x.logger.log("configure startPosition to "+this.startPosition)}else this.startPosition=0;else o<0&&(x.logger.log("negative start time offset "+o+", count from end of last fragment"),o=i+n+o),x.logger.log("start time offset found in playlist, adjust startPosition to "+o),this.startPosition=o}this.nextLoadPosition=this.startPosition}this.state===T.WAITING_LEVEL&&(this.state=T.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===T.KEY_LOADING&&(this.state=T.IDLE,this.tick())}},{key:"onFragLoaded",value:function(e){var t=this.fragCurrent;if(this.state===T.FRAG_LOADING&&t&&"main"===e.frag.type&&e.frag.level===t.level&&e.frag.sn===t.sn)if(x.logger.log("Loaded "+t.sn+" of level "+t.level),
|
|
this.fragBitrateTest===!0)this.state=T.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,e.stats.tparsed=e.stats.tbuffered=performance.now(),this.hls.trigger(g["default"].FRAG_BUFFERED,{stats:e.stats,frag:t,id:"main"});else{this.state=T.PARSING,this.stats=e.stats;var r=this.levels[this.level],a=r.details,n=a.totalduration,i=void 0!==t.startDTS?t.startDTS:t.start,s=t.level,o=t.sn,l=this.config.defaultAudioCodec||r.audioCodec;this.audioCodecSwap&&(x.logger.log("swapping playlist audio codec"),void 0===l&&(l=this.lastAudioCodec),l&&(l=l.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,x.logger.log("Demuxing "+o+" of ["+a.startSN+" ,"+a.endSN+"],level "+s+", cc "+t.cc);var d=this.demuxer;d&&d.push(e.payload,l,r.videoCodec,i,t.cc,s,o,n,t.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(e){var t=this.fragCurrent;if(t&&"main"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING){var r,a,n=e.tracks;if(a=n.audio){var i=this.levels[this.level].audioCodec,s=navigator.userAgent.toLowerCase();i&&this.audioCodecSwap&&(x.logger.log("swapping playlist audio codec"),i=i.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&s.indexOf("firefox")===-1&&(i="mp4a.40.5"),s.indexOf("android")!==-1&&(i="mp4a.40.2",x.logger.log("Android: force audio codec to"+i)),a.levelCodec=i,a.id=e.id}if(a=n.video,a&&(a.levelCodec=this.levels[this.level].videoCodec,a.id=e.id),e.unique){var o={codec:"",levelCodec:""};for(r in e.tracks)a=n[r],o.container=a.container,o.codec&&(o.codec+=",",o.levelCodec+=","),a.codec&&(o.codec+=a.codec),a.levelCodec&&(o.levelCodec+=a.levelCodec);n={audiovideo:o}}this.hls.trigger(g["default"].BUFFER_CODECS,n);for(r in n){a=n[r],x.logger.log("track:"+r+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var l=a.initSegment;l&&(this.pendingAppending++,this.hls.trigger(g["default"].BUFFER_APPENDING,{type:r,data:l,parent:"main"}))}this.tick()}}},{key:"onFragParsingData",value:function(e){var t=this,r=this.fragCurrent;if(r&&"main"===e.id&&e.sn===r.sn&&e.level===r.level&&this.state===T.PARSING){var a=this.levels[this.level],n=this.fragCurrent;x.logger.log("parsed "+e.type+",PTS:["+e.startPTS.toFixed(3)+","+e.endPTS.toFixed(3)+"],DTS:["+e.startDTS.toFixed(3)+"/"+e.endDTS.toFixed(3)+"],nb:"+e.nb+",dropped:"+(e.dropped||0));var i=b["default"].updateFragPTSDTS(a.details,n.sn,e.startPTS,e.endPTS,e.startDTS,e.endDTS),s=this.hls;s.trigger(g["default"].LEVEL_PTS_UPDATED,{details:a.details,level:this.level,drift:i}),"video"===e.type&&(n.dropped=e.dropped),[e.data1,e.data2].forEach(function(r){r&&(t.pendingAppending++,s.trigger(g["default"].BUFFER_APPENDING,{type:e.type,data:r,parent:"main"}))}),this.nextLoadPosition=e.endPTS,this.bufferRange.push({type:e.type,start:e.startPTS,end:e.endPTS,frag:n}),this.tick()}}},{key:"onFragParsed",value:function(e){var t=this.fragCurrent;t&&"main"===e.id&&e.sn===t.sn&&e.level===t.level&&this.state===T.PARSING&&(this.stats.tparsed=performance.now(),this.state=T.PARSED,this._checkAppendedParsed())}},{key:"onBufferCreated",value:function(e){var t=e.tracks,r=void 0,a=void 0,n=!1;for(var i in t){var s=t[i];"main"===s.id?(a=i,r=s):n=!0}n&&r?(x.logger.log("alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media}},{key:"onBufferAppended",value:function(e){if("main"===e.parent)switch(this.state){case T.PARSING:case T.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===T.PARSED&&0===this.pendingAppending){var e=this.fragCurrent,t=this.stats;if(e){this.fragPrevious=e,t.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*t.length/(t.tbuffered-t.tfirst)),this.hls.trigger(g["default"].FRAG_BUFFERED,{stats:t,frag:e,id:"main"});var r=this.mediaBuffer?this.mediaBuffer:this.media;x.logger.log("main buffered : "+E["default"].toString(r.buffered)),this.state=T.IDLE}this.tick()}}},{key:"onError",value:function(e){var t=e.frag;if(!t||"main"===t.type)switch(e.details){case w.ErrorDetails.FRAG_LOAD_ERROR:case w.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!e.fatal){var r=this.fragLoadError;if(r?r++:r=1,r<=this.config.fragLoadingMaxRetry){this.fragLoadError=r,t.loadCounter=0;var a=Math.min(Math.pow(2,r-1)*this.config.fragLoadingRetryDelay,64e3);x.logger.warn("mediaController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.state=T.FRAG_LOADING_WAITING_RETRY}else x.logger.error("mediaController: "+e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.trigger(g["default"].ERROR,e),this.state=T.ERROR}break;case w.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case w.ErrorDetails.LEVEL_LOAD_ERROR:case w.ErrorDetails.LEVEL_LOAD_TIMEOUT:case w.ErrorDetails.KEY_LOAD_ERROR:case w.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==T.ERROR&&(this.state=e.fatal?T.ERROR:T.IDLE,x.logger.warn("mediaController: "+e.details+" while loading frag,switch to "+this.state+" state ..."));break;case w.ErrorDetails.BUFFER_FULL_ERROR:this.state!==T.PARSING&&this.state!==T.PARSED||(this.config.maxMaxBufferLength/=2,x.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and switch to IDLE state"),this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=T.IDLE)}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e&&e.readyState){var t=e.currentTime,r=e.buffered;if(!this.loadedmetadata&&r.length){this.loadedmetadata=!0;var a=this.startPosition,n=this.isBuffered(a);t===a&&n||(x.logger.log("target start position:"+a),n||(a=r.start(0),x.logger.log("target start position not buffered, seek to buffered.start(0) "+a)),x.logger.log("adjust currentTime from "+t+" to "+a),e.currentTime=a)}else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var i=c["default"].bufferInfo(e,t,0),s=!(e.paused||e.ended||0===e.buffered.length),o=.4,l=t>e.playbackRate*this.lastCurrentTime;if(this.stalled&&l&&(this.stalled=!1,x.logger.log("playback not stuck anymore @"+t)),s&&i.len<=o&&(l?(o=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,x.logger.log("playback seems stuck @"+t),this.hls.trigger(g["default"].ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),i.len<=o)){var d=i.nextStart,u=d-t;if(d&&u<this.config.maxSeekHole&&u>0){x.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+d+" + nudge "+this.seekHoleNudgeDuration);var h=d+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=d+this.seekHoleNudgeDuration,this.hls.trigger(g["default"].ERROR,{type:w.ErrorTypes.MEDIA_ERROR,details:w.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:h})}}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=T.IDLE,this.tick()}},{key:"onBufferFlushed",value:function(){var e,t,r=[];for(t=0;t<this.bufferRange.length;t++)e=this.bufferRange[t],this.isBuffered((e.start+e.end)/2)&&r.push(e);this.bufferRange=r,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=T.IDLE,this.fragPrevious=null}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"state",set:function(e){if(this.state!==e){var t=this.state;this._state=e,x.logger.log("engine state transition from "+t+" to "+e),this.hls.trigger(g["default"].STREAM_STATE_TRANSITION,{previousState:t,nextState:e})}},get:function(){return this._state}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),t}(m["default"]);r["default"]=R},{"../demux/demuxer":20,"../errors":24,"../event-handler":25,"../events":26,"../helper/buffer-helper":28,"../helper/level-helper":29,"../utils/binary-search":39,"../utils/logger":43,"../utils/timeRanges":45}],12:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../utils/cea-608-parser"),f=a(h),p=e("../utils/cues"),g=a(p),y=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].MEDIA_ATTACHING,d["default"].MEDIA_DETACHING,d["default"].FRAG_PARSING_USERDATA,d["default"].MANIFEST_LOADING,d["default"].FRAG_LOADED,d["default"].LEVEL_SWITCH));if(r.hls=e,r.config=e.config,r.enabled=!0,r.config.enableCEA708Captions){var a=r,s={newCue:function(e,t,r){a.textTrack1||(a.textTrack1=a.createTextTrack("captions","Unknown CC1","en")),g["default"].newCue(a.textTrack1,e,t,r)}},o={newCue:function(e,t,r){a.textTrack2||(a.textTrack2=a.createTextTrack("captions","Unknown CC2","es")),g["default"].newCue(a.textTrack2,e,t,r)}};r.cea608Parser=new f["default"](0,s,o)}return r}return s(t,e),o(t,[{key:"clearCurrentCues",value:function(e){if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}},{key:"createTextTrack",value:function(e,t,r){if(this.media)return this.media.addTextTrack(e,t,r)}},{key:"destroy",value:function(){c["default"].prototype.destroy.call(this)}},{key:"onMediaAttaching",value:function(e){this.media=e.media}},{key:"onMediaDetaching",value:function(){}},{key:"onManifestLoading",value:function(){this.lastPts=Number.NEGATIVE_INFINITY}},{key:"onLevelSwitch",value:function(){"NONE"===this.hls.currentLevel.closedCaptions?this.enabled=!1:this.enabled=!0}},{key:"onFragLoaded",value:function(e){if("main"===e.frag.type){var t=e.frag.start;t<=this.lastPts&&(this.clearCurrentCues(this.textTrack1),this.clearCurrentCues(this.textTrack2)),this.lastPts=t}}},{key:"onFragParsingUserdata",value:function(e){if(this.enabled)for(var t=0;t<e.samples.length;t++){var r=this.extractCea608Data(e.samples[t].bytes);this.cea608Parser.addData(e.samples[t].pts,r)}}},{key:"extractCea608Data",value:function(e){for(var t,r,a,n,i,s=31&e[0],o=2,l=[],d=0;d<s;d++)t=e[o++],r=127&e[o++],a=127&e[o++],n=0!==(4&t),i=3&t,0===r&&0===a||n&&0===i&&(l.push(r),l.push(a));return l}}]),t}(c["default"]);r["default"]=y},{"../event-handler":25,"../events":26,"../utils/cea-608-parser":40,"../utils/cues":41}],13:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(t){a(this,e),this._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],this._precompute();var r,n,i,s,o,l=this._tables[0][4],d=this._tables[1],u=t.length,c=1;if(4!==u&&6!==u&&8!==u)throw new Error("Invalid aes key size="+u);for(s=t.slice(0),o=[],this._key=[s,o],r=u;r<4*u+28;r++)i=s[r-1],(r%u===0||8===u&&r%u===4)&&(i=l[i>>>24]<<24^l[i>>16&255]<<16^l[i>>8&255]<<8^l[255&i],r%u===0&&(i=i<<8^i>>>24^c<<24,c=c<<1^283*(c>>7))),s[r]=s[r-u]^i;for(n=0;r;n++,r--)i=s[3&n?r:r-4],r<=4||n<4?o[n]=i:o[n]=d[0][l[i>>>24]]^d[1][l[i>>16&255]]^d[2][l[i>>8&255]]^d[3][l[255&i]]}return n(e,[{key:"_precompute",value:function(){var e,t,r,a,n,i,s,o,l,d=this._tables[0],u=this._tables[1],c=d[4],h=u[4],f=[],p=[];for(e=0;e<256;e++)p[(f[e]=e<<1^283*(e>>7))^e]=e;for(t=r=0;!c[t];t^=a||1,r=p[r]||1)for(s=r^r<<1^r<<2^r<<3^r<<4,s=s>>8^255&s^99,c[t]=s,h[s]=t,i=f[n=f[a=f[t]]],l=16843009*i^65537*n^257*a^16843008*t,o=257*f[s]^16843008*s,e=0;e<4;e++)d[e][t]=o=o<<24^o>>>8,u[e][s]=l=l<<24^l>>>8;for(e=0;e<5;e++)d[e]=d[e].slice(0),u[e]=u[e].slice(0)}},{key:"decrypt",value:function(e,t,r,a,n,i){var s,o,l,d,u=this._key[1],c=e^u[0],h=a^u[1],f=r^u[2],p=t^u[3],g=u.length/4-2,y=4,m=this._tables[1],v=m[0],b=m[1],k=m[2],E=m[3],w=m[4];for(d=0;d<g;d++)s=v[c>>>24]^b[h>>16&255]^k[f>>8&255]^E[255&p]^u[y],o=v[h>>>24]^b[f>>16&255]^k[p>>8&255]^E[255&c]^u[y+1],l=v[f>>>24]^b[p>>16&255]^k[c>>8&255]^E[255&h]^u[y+2],p=v[p>>>24]^b[c>>16&255]^k[h>>8&255]^E[255&f]^u[y+3],y+=4,c=s,h=o,f=l;for(d=0;d<4;d++)n[(3&-d)+i]=w[c>>>24]<<24^w[h>>16&255]<<16^w[f>>8&255]<<8^w[255&p]^u[y++],s=c,c=h,h=f,f=p,p=s}}]),e}();r["default"]=i},{}],14:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("./aes"),o=a(s),l=function(){function e(t,r){n(this,e),this.key=t,this.iv=r}return i(e,[{key:"ntoh",value:function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}},{key:"doDecrypt",value:function(e,t,r){var a,n,i,s,l,d,u,c,h,f=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),p=new o["default"](Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),y=new Int32Array(g.buffer);for(a=~~r[0],n=~~r[1],i=~~r[2],s=~~r[3],h=0;h<f.length;h+=4)l=~~this.ntoh(f[h]),d=~~this.ntoh(f[h+1]),u=~~this.ntoh(f[h+2]),c=~~this.ntoh(f[h+3]),p.decrypt(l,d,u,c,y,h),y[h]=this.ntoh(y[h]^a),y[h+1]=this.ntoh(y[h+1]^n),y[h+2]=this.ntoh(y[h+2]^i),y[h+3]=this.ntoh(y[h+3]^s),a=l,n=d,i=u,s=c;return g}},{key:"localDecrypt",value:function(e,t,r,a){var n=this.doDecrypt(e,t,r);a.set(n,e.byteOffset)}},{key:"decrypt",value:function(e){var t=32e3,r=new Int32Array(e),a=new Uint8Array(e.byteLength),n=0,i=this.key,s=this.iv;for(this.localDecrypt(r.subarray(n,n+t),i,s,a),n=t;n<r.length;n+=t)s=new Uint32Array([this.ntoh(r[n-4]),this.ntoh(r[n-3]),this.ntoh(r[n-2]),this.ntoh(r[n-1])]),this.localDecrypt(r.subarray(n,n+t),i,s,a);return a}}]),e}();r["default"]=l},{"./aes":13}],15:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("./aes128-decrypter"),o=a(s),l=e("../errors"),d=e("../utils/logger"),u=function(){function e(t){n(this,e),this.hls=t;try{var r=window?window.crypto:crypto;this.subtle=r.subtle||r.webkitSubtle,this.disableWebCrypto=!this.subtle}catch(a){this.disableWebCrypto=!0}}return i(e,[{key:"destroy",value:function(){}},{key:"decrypt",value:function(e,t,r,a){this.disableWebCrypto&&this.hls.config.enableSoftwareAES?this.decryptBySoftware(e,t,r,a):this.decryptByWebCrypto(e,t,r,a)}},{key:"decryptByWebCrypto",value:function(e,t,r,a){var n=this;d.logger.log("decrypting by WebCrypto API"),this.subtle.importKey("raw",t,{name:"AES-CBC",length:128},!1,["decrypt"]).then(function(i){n.subtle.decrypt({name:"AES-CBC",iv:r.buffer},i,e).then(a)["catch"](function(i){n.onWebCryptoError(i,e,t,r,a)})})["catch"](function(i){n.onWebCryptoError(i,e,t,r,a)})}},{key:"decryptBySoftware",value:function(e,t,r,a){d.logger.log("decrypting by JavaScript Implementation");var n=new DataView(t.buffer),i=new Uint32Array([n.getUint32(0),n.getUint32(4),n.getUint32(8),n.getUint32(12)]);n=new DataView(r.buffer);var s=new Uint32Array([n.getUint32(0),n.getUint32(4),n.getUint32(8),n.getUint32(12)]),l=new o["default"](i,s);a(l.decrypt(e).buffer)}},{key:"onWebCryptoError",value:function(e,t,r,a,n){this.hls.config.enableSoftwareAES?(d.logger.log("disabling to use WebCrypto API"),this.disableWebCrypto=!0,this.decryptBySoftware(t,r,a,n)):(d.logger.error("decrypting error : "+e.message),this.hls.trigger(Event.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,details:l.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:e.message}))}}]),e}();r["default"]=u},{"../errors":24,"../utils/logger":43,"./aes128-decrypter":14}],16:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("./adts"),o=a(s),l=e("../utils/logger"),d=e("../demux/id3"),u=a(d),c=function(){function e(t,r,a,i){n(this,e),this.observer=t,this.id=r,this.remuxerClass=a,this.config=i,this.remuxer=new this.remuxerClass(t,r,i),this.insertDiscontinuity()}return i(e,[{key:"insertDiscontinuity",value:function(){this._aacTrack={container:"audio/adts",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0}}},{key:"push",value:function(e,t,r,a,n,i,s,d){var c,h,f,p,g,y,m,v,b,k,E=new u["default"](e),w=90*E.timeStamp,x=!1;for(n!==this.lastCC?(l.logger.log(this.id+" discontinuity detected"),this.lastCC=n,this.insertDiscontinuity(),this.remuxer.switchLevel(),this.remuxer.insertDiscontinuity()):i!==this.lastLevel?(l.logger.log("audio track switch detected"),this.lastLevel=i,this.remuxer.switchLevel(),this.insertDiscontinuity()):s===this.lastSN+1&&(x=!0),c=this._aacTrack,this.lastSN=s,this.lastLevel=i,y=E.length,b=e.length;y<b-1&&(255!==e[y]||240!==(240&e[y+1]));y++);for(c.audiosamplerate||(h=o["default"].getAudioConfig(this.observer,e,y,t),c.config=h.config,c.audiosamplerate=h.samplerate,c.channelCount=h.channelCount,c.codec=h.codec,c.duration=d,l.logger.log("parsed codec:"+c.codec+",rate:"+h.samplerate+",nb channel:"+h.channelCount)),g=0,p=9216e4/c.audiosamplerate;y+5<b&&(m=1&e[y+1]?7:9,f=(3&e[y+3])<<11|e[y+4]<<3|(224&e[y+5])>>>5,f-=m,f>0&&y+m+f<=b);)for(v=w+g*p,k={unit:e.subarray(y+m,y+m+f),pts:v,dts:v},c.samples.push(k),c.len+=f,y+=f+m,g++;y<b-1&&(255!==e[y]||240!==(240&e[y+1]));y++);this.remuxer.remux(i,s,this._aacTrack,{samples:[]},{samples:[{pts:w,dts:w,unit:E.payload}]},{samples:[]},a,x)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(e){var t,r,a=new u["default"](e);if(a.hasTimeStamp)for(t=a.length,r=e.length;t<r-1;t++)if(255===e[t]&&240===(240&e[t+1]))return!0;return!1}}]),e}();r["default"]=c},{"../demux/id3":22,"../utils/logger":43,"./adts":17}],17:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=e("../utils/logger"),s=e("../errors"),o=function(){function e(){a(this,e)}return n(e,null,[{key:"getAudioConfig",value:function(e,t,r,a){var n,o,l,d,u,c=navigator.userAgent.toLowerCase(),h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return n=((192&t[r+2])>>>6)+1,o=(60&t[r+2])>>>2,o>h.length-1?void e.trigger(Event.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+o}):(d=(1&t[r+2])<<2,d|=(192&t[r+3])>>>6,i.logger.log("manifest codec:"+a+",ADTS data:type:"+n+",sampleingIndex:"+o+"["+h[o]+"Hz],channelConfig:"+d),c.indexOf("firefox")!==-1?o>=6?(n=5,u=new Array(4),l=o-3):(n=2,u=new Array(2),l=o):c.indexOf("android")!==-1?(n=2,u=new Array(2),l=o):(n=5,u=new Array(4),a&&(a.indexOf("mp4a.40.29")!==-1||a.indexOf("mp4a.40.5")!==-1)||!a&&o>=6?l=o-3:((a&&a.indexOf("mp4a.40.2")!==-1&&o>=6&&1===d||!a&&1===d)&&(n=2,u=new Array(2)),l=o)),u[0]=n<<3,u[0]|=(14&o)>>1,u[1]|=(1&o)<<7,u[1]|=d<<3,5===n&&(u[1]|=(14&l)>>1,u[2]=(1&l)<<7,u[2]|=8,u[3]=0),{config:u,samplerate:h[o],channelCount:d,codec:"mp4a.40."+n})}}]),e}();r["default"]=o},{"../errors":24,"../utils/logger":43}],18:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("../events"),o=a(s),l=e("../errors"),d=e("../demux/aacdemuxer"),u=a(d),c=e("../demux/tsdemuxer"),h=a(c),f=e("../remux/mp4-remuxer"),p=a(f),g=e("../remux/passthrough-remuxer"),y=a(g),m=function(){function e(t,r,a){var i=arguments.length<=3||void 0===arguments[3]?null:arguments[3];n(this,e),this.hls=t,this.id=r,this.config=this.hls.config||i,this.typeSupported=a}return i(e,[{key:"destroy",value:function(){var e=this.demuxer;e&&e.destroy()}},{key:"push",value:function(e,t,r,a,n,i,s,d){var c=this.demuxer;if(!c){var f=this.hls,g=this.id;if(h["default"].probe(e))c=this.typeSupported.mp2t===!0?new h["default"](f,g,y["default"],this.config):new h["default"](f,g,p["default"],this.config);else{if(!u["default"].probe(e))return void f.trigger(o["default"].ERROR,{type:l.ErrorTypes.MEDIA_ERROR,id:g,details:l.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});c=new u["default"](f,g,p["default"],this.config)}this.demuxer=c}c.push(e,t,r,a,n,i,s,d)}}]),e}();r["default"]=m},{"../demux/aacdemuxer":16,"../demux/tsdemuxer":23,"../errors":24,"../events":26,"../remux/mp4-remuxer":36,"../remux/passthrough-remuxer":37}],19:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var n=e("../demux/demuxer-inline"),i=a(n),s=e("../events"),o=a(s),l=e("events"),d=a(l),u=function(e){var t=new d["default"];t.trigger=function(e){for(var r=arguments.length,a=Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];t.emit.apply(t,[e,e].concat(a))},t.off=function(e){for(var r=arguments.length,a=Array(r>1?r-1:0),n=1;n<r;n++)a[n-1]=arguments[n];t.removeListener.apply(t,[e].concat(a))},e.addEventListener("message",function(r){var a=r.data;switch(a.cmd){case"init":e.demuxer=new i["default"](t,a.id,a.typeSupported,JSON.parse(a.config));break;case"demux":e.demuxer.push(new Uint8Array(a.data),a.audioCodec,a.videoCodec,a.timeOffset,a.cc,a.level,a.sn,a.duration)}});var r=function(t,r){e.postMessage({event:t,data:r})};t.on(o["default"].FRAG_PARSING_INIT_SEGMENT,r),t.on(o["default"].FRAG_PARSED,r),t.on(o["default"].ERROR,r),t.on(o["default"].FRAG_PARSING_METADATA,r),t.on(o["default"].FRAG_PARSING_USERDATA,r),t.on(o["default"].FRAG_PARSING_DATA,function(t,r){var a=r.data1.buffer,n=r.data2.buffer;delete r.data1,delete r.data2,e.postMessage({event:t,data:r,data1:a,data2:n},[a,n])})};r["default"]=u},{"../demux/demuxer-inline":18,"../events":26,events:1}],20:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("../events"),o=a(s),l=e("../demux/demuxer-inline"),d=a(l),u=e("../demux/demuxer-worker"),c=a(u),h=e("../utils/logger"),f=e("../crypt/decrypter"),p=a(f),g=function(){function t(r,a){n(this,t),this.hls=r,this.id=a;var i={mp4:MediaSource.isTypeSupported("video/mp4"),mp2t:r.config.enableMP2TPassThrough&&MediaSource.isTypeSupported("video/mp2t")};if(r.config.enableWorker&&"undefined"!=typeof Worker){h.logger.log("demuxing in webworker");try{var s=e("webworkify");this.w=s(c["default"]),this.onwmsg=this.onWorkerMessage.bind(this),this.w.addEventListener("message",this.onwmsg),this.w.postMessage({cmd:"init",typeSupported:i,id:a,config:JSON.stringify(r.config)})}catch(o){h.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),this.demuxer=new d["default"](r,a,i)}}else this.demuxer=new d["default"](r,a,i);this.demuxInitialized=!0}return i(t,[{key:"destroy",value:function(){this.w?(this.w.removeEventListener("message",this.onwmsg),this.w.terminate(),this.w=null):(this.demuxer.destroy(),this.demuxer=null),this.decrypter&&(this.decrypter.destroy(),this.decrypter=null)}},{key:"pushDecrypted",value:function(e,t,r,a,n,i,s,o){this.w?this.w.postMessage({cmd:"demux",data:e,audioCodec:t,videoCodec:r,timeOffset:a,cc:n,level:i,sn:s,duration:o},[e]):this.demuxer.push(new Uint8Array(e),t,r,a,n,i,s,o)}},{key:"push",value:function(e,t,r,a,n,i,s,o,l){if(e.byteLength>0&&null!=l&&null!=l.key&&"AES-128"===l.method){null==this.decrypter&&(this.decrypter=new p["default"](this.hls));var d=this;this.decrypter.decrypt(e,l.key,l.iv,function(e){d.pushDecrypted(e,t,r,a,n,i,s,o)})}else this.pushDecrypted(e,t,r,a,n,i,s,o)}},{key:"onWorkerMessage",value:function(e){var t=e.data,r=this.hls;switch(t.event){case o["default"].FRAG_PARSING_DATA:t.data.data1=new Uint8Array(t.data1),t.data.data2=new Uint8Array(t.data2);default:r.trigger(t.event,t.data)}}}]),t}();r["default"]=g},{"../crypt/decrypter":15,"../demux/demuxer-inline":18,"../demux/demuxer-worker":19,"../events":26,"../utils/logger":43,webworkify:2}],21:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=e("../utils/logger"),s=function(){function e(t){a(this,e),this.data=t,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return n(e,[{key:"loadWord",value:function(){var e=this.data.byteLength-this.bytesAvailable,t=new Uint8Array(4),r=Math.min(4,this.bytesAvailable);if(0===r)throw new Error("no bytes available");t.set(this.data.subarray(e,e+r)),this.word=new DataView(t.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}},{key:"skipBits",value:function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&i.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),t=e-t,t>0?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!==(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(e){var t,r,a=8,n=8;for(t=0;t<e;t++)0!==n&&(r=this.readEG(),n=(a+r+256)%256),a=0===n?a:n}},{key:"readSPS",value:function(){var e,t,r,a,n,i,s,o,l,d=0,u=0,c=0,h=0,f=1;if(this.readUByte(),e=this.readUByte(),t=this.readBits(5),this.skipBits(3),r=this.readUByte(),this.skipUEG(),100===e||110===e||122===e||244===e||44===e||83===e||86===e||118===e||128===e){var p=this.readUEG();if(3===p&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==p?8:12,l=0;l<o;l++)this.readBoolean()&&(l<6?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var g=this.readUEG();if(0===g)this.readUEG();else if(1===g)for(this.skipBits(1),this.skipEG(),this.skipEG(),a=this.readUEG(),l=0;l<a;l++)this.skipEG();if(this.skipUEG(),this.skipBits(1),n=this.readUEG(),i=this.readUEG(),s=this.readBits(1),0===s&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(d=this.readUEG(),u=this.readUEG(),c=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var y=void 0,m=this.readUByte();switch(m){case 1:y=[1,1];break;case 2:y=[12,11];break;case 3:y=[10,11];break;case 4:y=[16,11];break;case 5:y=[40,33];break;case 6:y=[24,11];break;case 7:y=[20,11];break;case 8:y=[32,11];break;case 9:y=[80,33];break;case 10:y=[18,11];break;case 11:y=[15,11];break;case 12:y=[64,33];break;case 13:y=[160,99];break;case 14:y=[4,3];break;case 15:y=[3,2];break;case 16:y=[2,1];break;case 255:y=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}y&&(f=y[0]/y[1])}return{width:Math.ceil((16*(n+1)-2*d-2*u)*f),height:(2-s)*(i+1)*16-(s?2:4)*(c+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();r["default"]=s},{"../utils/logger":43}],22:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=e("../utils/logger"),s=function(){function e(t){a(this,e),this._hasTimeStamp=!1;for(var r,n,s,o,l,d,u,c,h=0;;)if(u=this.readUTF(t,h,3),h+=3,"ID3"===u)h+=3,r=127&t[h++],n=127&t[h++],s=127&t[h++],o=127&t[h++],l=(r<<21)+(n<<14)+(s<<7)+o,d=h+l,this._parseID3Frames(t,h,d),h=d;else{if("3DI"!==u)return h-=3,c=h,void(c&&(this.hasTimeStamp||i.logger.warn("ID3 tag found, but no timestamp"),this._length=c,this._payload=t.subarray(0,c)));h+=7,i.logger.log("3DI footer found, end: "+h)}}return n(e,[{key:"readUTF",value:function(e,t,r){var a="",n=t,i=t+r;do a+=String.fromCharCode(e[n++]);while(n<i);return a}},{key:"_parseID3Frames",value:function(e,t,r){for(var a,n,s,o,l;t+8<=r;)switch(a=this.readUTF(e,t,4),t+=4,n=e[t++]<<24+e[t++]<<16+e[t++]<<8+e[t++],o=e[t++]<<8+e[t++],s=t,a){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(e,t,44)){t+=44,t+=4;var d=1&e[t++];this._hasTimeStamp=!0,l=((e[t++]<<23)+(e[t++]<<15)+(e[t++]<<7)+e[t++])/45,d&&(l+=47721858.84),l=Math.round(l),i.logger.trace("ID3 timestamp found: "+l),this._timeStamp=l}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length;
|
|
}},{key:"payload",get:function(){return this._payload}}]),e}();r["default"]=s},{"../utils/logger":43}],23:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("./adts"),o=a(s),l=e("../events"),d=a(l),u=e("./exp-golomb"),c=a(u),h=e("../utils/logger"),f=e("../errors"),p=function(){function e(t,r,a,i){n(this,e),this.observer=t,this.id=r,this.remuxerClass=a,this.config=i,this.lastCC=0,this.remuxer=new this.remuxerClass(t,r,i)}return i(e,[{key:"switchLevel",value:function(){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,sequenceNumber:0,samples:[],len:0,nbNalu:0,dropped:0},this._aacTrack={container:"video/mp2t",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0},this._id3Track={type:"id3",id:-1,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcNaluState=0,this.remuxer.switchLevel()}},{key:"insertDiscontinuity",value:function(){this.switchLevel(),this.remuxer.insertDiscontinuity()}},{key:"push",value:function(e,t,r,a,n,i,s,o){var l,u,c,p,g,y,m,v,b=e.length,k=this.remuxer.passthrough,E=!1;this.audioCodec=t,this.videoCodec=r,this.timeOffset=a,this._duration=o,this.contiguous=!1,n!==this.lastCC&&(h.logger.log("discontinuity detected"),this.insertDiscontinuity(),this.lastCC=n),i!==this.lastLevel?(h.logger.log("level switch detected"),this.switchLevel(),this.lastLevel=i):s===this.lastSN+1&&(this.contiguous=!0),this.lastSN=s;var w=this.pmtParsed,x=this._avcTrack.id,T=this._aacTrack.id,R=this._id3Track.id;for(b-=b%188,p=0;p<b;p+=188)if(71===e[p]){if(g=!!(64&e[p+1]),y=((31&e[p+1])<<8)+e[p+2],m=(48&e[p+3])>>4,m>1){if(v=p+5+e[p+4],v===p+188)continue}else v=p+4;if(w)if(y===x){if(g){if(l&&(this._parseAVCPES(this._parsePES(l)),k&&this._avcTrack.codec&&(T===-1||this._aacTrack.codec)))return void this.remux(i,s,e);l={data:[],size:0}}l&&(l.data.push(e.subarray(v,p+188)),l.size+=p+188-v)}else if(y===T){if(g){if(u&&(this._parseAACPES(this._parsePES(u)),k&&this._aacTrack.codec&&(x===-1||this._avcTrack.codec)))return void this.remux(i,s,e);u={data:[],size:0}}u&&(u.data.push(e.subarray(v,p+188)),u.size+=p+188-v)}else y===R&&(g&&(c&&this._parseID3PES(this._parsePES(c)),c={data:[],size:0}),c&&(c.data.push(e.subarray(v,p+188)),c.size+=p+188-v));else g&&(v+=e[v]+1),0===y?this._parsePAT(e,v):y===this._pmtId?(this._parsePMT(e,v),w=this.pmtParsed=!0,x=this._avcTrack.id,T=this._aacTrack.id,R=this._id3Track.id,E&&(h.logger.log("reparse from beginning"),E=!1,p=-188)):(h.logger.log("unknown PID found before PAT/PMT"),E=!0)}else this.observer.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,id:this.id,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});l&&this._parseAVCPES(this._parsePES(l)),u&&this._parseAACPES(this._parsePES(u)),c&&this._parseID3PES(this._parsePES(c)),this.remux(i,s,null)}},{key:"remux",value:function(e,t,r){this.remuxer.remux(e,t,this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,r)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(e,t){var r,a,n,i;for(r=(15&e[t+1])<<8|e[t+2],a=t+3+r-4,n=(15&e[t+10])<<8|e[t+11],t+=12+n;t<a;){switch(i=(31&e[t+1])<<8|e[t+2],e[t]){case 15:this._aacTrack.id===-1&&(this._aacTrack.id=i);break;case 21:this._id3Track.id=i;break;case 27:this._avcTrack.id===-1&&(this._avcTrack.id=i);break;default:h.logger.log("unkown stream type:"+e[t])}t+=((15&e[t+3])<<8|e[t+4])+5}}},{key:"_parsePES",value:function(e){var t,r,a,n,i,s,o,l,d,u=0,c=e.data;if(t=c[0],a=(t[0]<<16)+(t[1]<<8)+t[2],1===a){for(n=(t[4]<<8)+t[5],r=t[7],192&r&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,o>4294967295&&(o-=8589934592),64&r?(l=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,l>4294967295&&(l-=8589934592)):l=o),i=t[8],d=i+9,e.size-=d,s=new Uint8Array(e.size);c.length;){t=c.shift();var h=t.byteLength;if(d){if(d>h){d-=h;continue}t=t.subarray(d),h-=d,d=0}s.set(t,u),u+=h}return{data:s,pts:o,dts:l,len:n}}return null}},{key:"_parseAVCPES",value:function(e){var t,r,a,n,i=this,s=this._avcTrack,o=s.samples,l=this._parseAVCNALu(e.data),d=[],u=!1,f=!1,p=0;if(0===l.length&&o.length>0){var g=o[o.length-1],y=g.units.units[g.units.units.length-1],m=new Uint8Array(y.data.byteLength+e.data.byteLength);m.set(y.data,0),m.set(e.data,y.data.byteLength),y.data=m,g.units.length+=e.data.byteLength,s.len+=e.data.byteLength}e.data=null;var v="",b=function(){d.length&&(!this.config.forceKeyFrameOnDiscontinuity||f===!0||s.sps&&(o.length||this.contiguous)?(r={units:{units:d,length:p},pts:e.pts,dts:e.dts,key:f},o.push(r),s.len+=p,s.nbNalu+=d.length):s.dropped++,d=[],p=0)}.bind(this);l.forEach(function(r){switch(r.type){case 1:a=!0,u&&(v+="NDR ");break;case 5:a=!0,u&&(v+="IDR "),f=!0;break;case 6:a=!0,u&&(v+="SEI "),r.data=i.discardEPB(r.data),t=new c["default"](r.data),t.readUByte();for(var o=0,l=0,h=!1;!h&&t.bytesAvailable>1;){o=0;do 0!==t.bytesAvailable&&(o+=t.readUByte());while(255===o);l=0;do 0!==t.bytesAvailable&&(l+=t.readUByte());while(255===l);if(4===o&&0!==t.bytesAvailable){h=!0;var g=t.readUByte();if(181===g){var y=t.readUShort();if(49===y){var m=t.readUInt();if(1195456820===m){var k=t.readUByte();if(3===k){var E=t.readUByte(),w=t.readUByte(),x=31&E,T=[E,w];for(n=0;n<x;n++)T.push(t.readUByte()),T.push(t.readUByte()),T.push(t.readUByte());i._insertSampleInOrder(i._txtTrack.samples,{type:3,pts:e.pts,bytes:T})}}}}}else if(l<t.bytesAvailable)for(n=0;n<l;n++)t.readUByte()}break;case 7:if(a=!0,u&&(v+="SPS "),!s.sps){t=new c["default"](r.data);var R=t.readSPS();s.width=R.width,s.height=R.height,s.sps=[r.data],s.duration=i._duration;var _=r.data.subarray(1,4),L="avc1.";for(n=0;n<3;n++){var A=_[n].toString(16);A.length<2&&(A="0"+A),L+=A}s.codec=L}break;case 8:a=!0,u&&(v+="PPS "),s.pps||(s.pps=[r.data]);break;case 9:a=!1,u&&(v+="AUD "),b();break;default:a=!1,v+="unknown NAL "+r.type+" "}a&&(d.push(r),p+=r.data.byteLength)}),(u||v.length)&&h.logger.log(v),b()}},{key:"_insertSampleInOrder",value:function(e,t){var r=e.length;if(r>0){if(t.pts>=e[r-1].pts)e.push(t);else for(var a=r-1;a>=0;a--)if(t.pts<e[a].pts){e.splice(a,0,t);break}}else e.push(t)}},{key:"_parseAVCNALu",value:function(e){for(var t,r,a,n,i,s,o=0,l=e.byteLength,d=this.avcNaluState,u=[];o<l;)switch(t=e[o++],d){case 0:0===t&&(d=1);break;case 1:d=0===t?2:0;break;case 2:case 3:if(0===t)d=3;else if(1===t&&o<l){if(n=31&e[o],i)a={data:e.subarray(i,o-d-1),type:s},u.push(a);else{var c=this.avcNaluState;if(c&&o<=4-c){var h=this._avcTrack,f=h.samples;if(f.length){var p=f[f.length-1],g=p.units.units,y=g[g.length-1];y.state&&(y.data=y.data.subarray(0,y.data.byteLength-c),p.units.length-=c,h.len-=c)}}if(r=o-d-1,r>0){var m=this._avcTrack,v=m.samples;if(v.length){var b=v[v.length-1],k=b.units.units,E=k[k.length-1],w=new Uint8Array(E.data.byteLength+r);w.set(E.data,0),w.set(e.subarray(0,r),E.data.byteLength),E.data=w,b.units.length+=r,m.len+=r}}}i=o,s=n,d=0}else d=0}return i&&(a={data:e.subarray(i,l),type:s,state:d},u.push(a),this.avcNaluState=d),u}},{key:"discardEPB",value:function(e){for(var t,r,a=e.byteLength,n=[],i=1;i<a-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(n.push(i+2),i+=2):i++;if(0===n.length)return e;t=a-n.length,r=new Uint8Array(t);var s=0;for(i=0;i<t;s++,i++)s===n[0]&&(s++,n.shift()),r[i]=e[s];return r}},{key:"_parseAACPES",value:function(e){var t,r,a,n,i,s,l,u,c,p=this._aacTrack,g=e.data,y=e.pts,m=0,v=this._duration,b=this.audioCodec,k=this.aacOverFlow,E=this.aacLastPTS;if(k){var w=new Uint8Array(k.byteLength+g.byteLength);w.set(k,0),w.set(g,k.byteLength),g=w}for(i=m,u=g.length;i<u-1&&(255!==g[i]||240!==(240&g[i+1]));i++);if(i){var x,T;if(i<u-1?(x="AAC PES did not start with ADTS header,offset:"+i,T=!1):(x="no ADTS header found in AAC PES",T=!0),this.observer.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,id:this.id,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:T,reason:x}),T)return}if(p.audiosamplerate||(t=o["default"].getAudioConfig(this.observer,g,i,b),p.config=t.config,p.audiosamplerate=t.samplerate,p.channelCount=t.channelCount,p.codec=t.codec,p.duration=v,h.logger.log("parsed codec:"+p.codec+",rate:"+t.samplerate+",nb channel:"+t.channelCount)),n=0,a=9216e4/p.audiosamplerate,k&&E){var R=E+a;Math.abs(R-y)>1&&(h.logger.log("AAC: align PTS for overlapping frames by "+Math.round((R-y)/90)),y=R)}for(;i+5<u&&(s=1&g[i+1]?7:9,r=(3&g[i+3])<<11|g[i+4]<<3|(224&g[i+5])>>>5,r-=s,r>0&&i+s+r<=u);)for(l=y+n*a,c={unit:g.subarray(i+s,i+s+r),pts:l,dts:l},p.samples.push(c),p.len+=r,i+=r+s,n++;i<u-1&&(255!==g[i]||240!==(240&g[i+1]));i++);k=i<u?g.subarray(i,u):null,this.aacOverFlow=k,this.aacLastPTS=l}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),e}();r["default"]=p},{"../errors":24,"../events":26,"../utils/logger":43,"./adts":17,"./exp-golomb":21}],24:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},r.ErrorDetails={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],25:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),o=e("./utils/logger"),l=e("./errors"),d=e("./events"),u=a(d),c=function(){function e(t){n(this,e),this.hls=t,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,a=Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];this.handledEvents=a,this.useGenericHandler=!0,this.registerListeners()}return s(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===i(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var r=function(e,t){var r="on"+e.replace("hls","");if("function"!=typeof this[r])throw new Error("Event "+e+" has no generic handler in this "+this.constructor.name+" class (tried "+r+")");return this[r].bind(this,t)};try{r.call(this,e,t).call()}catch(a){o.logger.error("internal error happened while processing "+e+":"+a.message),this.hls.trigger(u["default"].ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:a})}}}]),e}();r["default"]=c},{"./errors":24,"./events":26,"./utils/logger":43}],26:[function(e,t,r){"use strict";t.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCH:"hlsAudioTrackSwitch",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},{}],27:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(){a(this,e)}return n(e,null,[{key:"getSilentFrame",value:function(e){return 1===e?new Uint8Array([0,200,0,128,35,128]):2===e?new Uint8Array([33,0,73,144,2,25,0,35,128]):3===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]):4===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]):5===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]):6===e?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]):null}}]),e}();r["default"]=i},{}],28:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(){a(this,e)}return n(e,null,[{key:"bufferInfo",value:function(e,t,r){if(e){var a,n=e.buffered,i=[];for(a=0;a<n.length;a++)i.push({start:n.start(a),end:n.end(a)});return this.bufferedInfo(i,t,r)}return{len:0,start:0,end:0,nextStart:void 0}}},{key:"bufferedInfo",value:function(e,t,r){var a,n,i,s,o,l=[];for(e.sort(function(e,t){var r=e.start-t.start;return r?r:t.end-e.end}),o=0;o<e.length;o++){var d=l.length;if(d){var u=l[d-1].end;e[o].start-u<r?e[o].end>u&&(l[d-1].end=e[o].end):l.push(e[o])}else l.push(e[o])}for(o=0,a=0,n=i=t;o<l.length;o++){var c=l[o].start,h=l[o].end;if(t+r>=c&&t<h)n=c,i=h,a=i-t;else if(t+r<c){s=c;break}}return{len:a,start:n,end:i,nextStart:s}}}]),e}();r["default"]=i},{}],29:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=e("../utils/logger"),s=function(){function e(){a(this,e)}return n(e,null,[{key:"mergeDetails",value:function(t,r){var a,n=Math.max(t.startSN,r.startSN)-r.startSN,s=Math.min(t.endSN,r.endSN)-r.startSN,o=r.startSN-t.startSN,l=t.fragments,d=r.fragments,u=0;if(s<n)return void(r.PTSKnown=!1);for(var c=n;c<=s;c++){var h=l[o+c],f=d[c];f&&h&&(u=h.cc-f.cc,isNaN(h.startPTS)||(f.start=f.startPTS=h.startPTS,f.endPTS=h.endPTS,f.duration=h.duration,a=f))}if(u)for(i.logger.log("discontinuity sliding from playlist, take drift into account"),c=0;c<d.length;c++)d[c].cc+=u;if(a)e.updateFragPTSDTS(r,a.sn,a.startPTS,a.endPTS,a.startDTS,a.endDTS);else if(o>=0&&o<l.length){var p=l[o].start;for(c=0;c<d.length;c++)d[c].start+=p}r.PTSKnown=t.PTSKnown}},{key:"updateFragPTSDTS",value:function(t,r,a,n,i,s){var o,l,d,u;if(r<t.startSN||r>t.endSN)return 0;if(o=r-t.startSN,l=t.fragments,d=l[o],!isNaN(d.startPTS)){var c=Math.abs(d.startPTS-a);isNaN(d.deltaPTS)?d.deltaPTS=c:d.deltaPTS=Math.max(c,d.deltaPTS),a=Math.min(a,d.startPTS),n=Math.max(n,d.endPTS),i=Math.min(i,d.startDTS),s=Math.max(s,d.endDTS)}var h=a-d.start;for(d.start=d.startPTS=a,d.endPTS=n,d.startDTS=i,d.endDTS=s,d.duration=n-a,u=o;u>0;u--)e.updatePTS(l,u,u-1);for(u=o;u<l.length-1;u++)e.updatePTS(l,u,u+1);return t.PTSKnown=!0,h}},{key:"updatePTS",value:function(e,t,r){var a=e[t],n=e[r],s=n.startPTS;isNaN(s)?r>t?n.start=a.start+a.duration:n.start=a.start-n.duration:r>t?(a.duration=s-a.start,a.duration<0&&i.logger.error("negative duration computed for frag "+a.sn+",level "+a.level+", there should be some duration drift between playlist and fragment!")):(n.duration=a.start-s,n.duration<0&&i.logger.error("negative duration computed for frag "+n.sn+",level "+n.level+", there should be some duration drift between playlist and fragment!"))}}]),e}();r["default"]=s},{"../utils/logger":43}],30:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("./events"),o=a(s),l=e("./errors"),d=e("./loader/playlist-loader"),u=a(d),c=e("./loader/fragment-loader"),h=a(c),f=e("./controller/abr-controller"),p=a(f),g=e("./controller/buffer-controller"),y=a(g),m=e("./controller/cap-level-controller"),v=a(m),b=e("./controller/audio-stream-controller"),k=a(b),E=e("./controller/stream-controller"),w=a(E),x=e("./controller/level-controller"),T=a(x),R=e("./controller/timeline-controller"),_=a(R),L=e("./controller/fps-controller"),A=a(L),S=e("./controller/audio-track-controller"),D=a(S),O=e("./utils/logger"),C=e("./utils/xhr-loader"),P=a(C),I=e("events"),M=a(I),N=e("./loader/key-loader"),F=a(N),U=e("./utils/cues"),B=a(U),G=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];n(this,e);var r=e.DefaultConfig;if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var a in r)a in t||(t[a]=r[a]);if(void 0!==t.liveMaxLatencyDurationCount&&t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(t.liveMaxLatencyDuration<=t.liveSyncDuration||void 0===t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');(0,O.enableLogs)(t.debug),this.config=t;var i=this.observer=new M["default"];i.trigger=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];i.emit.apply(i,[e,e].concat(r))},i.off=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];i.removeListener.apply(i,[e].concat(r))},this.on=i.on.bind(i),this.off=i.off.bind(i),this.trigger=i.trigger.bind(i),this.playlistLoader=new u["default"](this),this.fragmentLoader=new h["default"](this),this.levelController=new T["default"](this),this.abrController=new t.abrController(this),this.bufferController=new t.bufferController(this),this.capLevelController=new t.capLevelController(this),this.fpsController=new t.fpsController(this),this.streamController=new t.streamController(this),this.audioStreamController=new t.audioStreamController(this),this.timelineController=new t.timelineController(this),this.audioTrackController=new D["default"](this),this.keyLoader=new F["default"](this)}return i(e,null,[{key:"isSupported",value:function(){return window.MediaSource&&"function"==typeof window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"version",get:function(){return"0.6.2-2"}},{key:"Events",get:function(){return o["default"]}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return e.defaultConfig||(e.defaultConfig={autoStartLoad:!0,startPosition:-1,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:P["default"],fLoader:void 0,pLoader:void 0,abrController:p["default"],bufferController:y["default"],capLevelController:v["default"],fpsController:A["default"],streamController:w["default"],audioStreamController:k["default"],timelineController:_["default"],cueHandler:B["default"],enableCEA708Captions:!0,enableMP2TPassThrough:!1,stretchShortVideoTrack:!1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:5,abrEwmaSlowLive:9,abrEwmaFastVoD:4,abrEwmaSlowVoD:15,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.8,abrBandWidthUpFactor:.7}),e.defaultConfig},set:function(t){e.defaultConfig=t}}]),i(e,[{key:"destroy",value:function(){O.logger.log("destroy"),this.trigger(o["default"].DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.fpsController.destroy(),this.streamController.destroy(),this.audioStreamController.destroy(),this.timelineController.destroy(),this.audioTrackController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(e){O.logger.log("attachMedia"),this.media=e,this.trigger(o["default"].MEDIA_ATTACHING,{media:e})}},{key:"detachMedia",value:function(){O.logger.log("detachMedia"),this.trigger(o["default"].MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(e){O.logger.log("loadSource:"+e),this.url=e,this.trigger(o["default"].MANIFEST_LOADING,{url:e})}},{key:"startLoad",value:function(){var e=arguments.length<=0||void 0===arguments[0]?-1:arguments[0];O.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(e),this.audioStreamController.startLoad(e)}},{key:"stopLoad",value:function(){O.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad(),this.audioStreamController.stopLoad()}},{key:"swapAudioCodec",value:function(){O.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){O.logger.log("recoverMediaError");var e=this.media;this.detachMedia(),this.attachMedia(e)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){O.logger.log("set currentLevel:"+e),this.loadLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){O.logger.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){O.logger.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(e){O.logger.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(e){O.logger.log("set startLevel:"+e),this.levelController.startLevel=e}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(e){O.logger.log("set autoLevelCapping:"+e),this.abrController.autoLevelCapping=e}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"audioTracks",get:function(){return this.audioTrackController.audioTracks}},{key:"audioTrack",get:function(){return this.audioTrackController.audioTrack},set:function(e){this.audioTrackController.audioTrack=e}}]),e}();r["default"]=G},{"./controller/abr-controller":3,"./controller/audio-stream-controller":4,"./controller/audio-track-controller":5,"./controller/buffer-controller":6,"./controller/cap-level-controller":7,"./controller/fps-controller":9,"./controller/level-controller":10,"./controller/stream-controller":11,"./controller/timeline-controller":12,"./errors":24,"./events":26,"./loader/fragment-loader":32,"./loader/key-loader":33,"./loader/playlist-loader":34,"./utils/cues":41,"./utils/logger":43,"./utils/xhr-loader":47,events:1}],31:[function(e,t,r){"use strict";t.exports=e("./hls.js")["default"]},{"./hls.js":30}],32:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../errors"),f=e("../utils/logger"),p=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].FRAG_LOADING));return r.loaders={},r}return s(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},c["default"].prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag,r=t.type,a=this.loaders[r],n=this.hls.config;t.loaded=0,a&&(f.logger.warn("abort previous fragment loader for type:"+r),a.abort()),a=this.loaders[r]=t.loader="undefined"!=typeof n.fLoader?new n.fLoader(n):new n.loader(n),a.load(t.url,{frag:t},"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),n.fragLoadingTimeOut,1,0,this.loadprogress.bind(this),t)}},{key:"loadsuccess",value:function(e,t,r){var a=e.currentTarget.response,n=r.frag;t.length=a.byteLength,n.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(d["default"].FRAG_LOADED,{payload:a,frag:n,stats:t})}},{key:"loaderror",value:function(e,t){var r=t.loader;r&&r.abort(),this.loaders[t.type]=void 0,this.hls.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t.frag,response:e})}},{key:"loadtimeout",value:function(e,t,r){var a=r.loader;a&&a.abort(),this.loaders[r.type]=void 0,this.hls.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:r.frag})}},{key:"loadprogress",value:function(e,t,r){var a=r.frag;a.loaded=t.loaded,this.hls.trigger(d["default"].FRAG_LOAD_PROGRESS,{frag:a,stats:t})}}]),t}(c["default"]);r["default"]=p},{"../errors":24,"../event-handler":25,"../events":26,"../utils/logger":43}],33:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../errors"),f=e("../utils/logger"),p=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].KEY_LOADING));return r.loaders={},r.decryptkey=null,r.decrypturl=null,r}return s(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},c["default"].prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(e){var t=e.frag,r=t.type,a=this.loaders[r],n=t.decryptdata,i=n.uri;if(i!==this.decrypturl||null===this.decryptkey){var s=this.hls.config;a&&(f.logger.warn("abort previous fragment loader for type:"+r),a.abort()),t.loader=this.loaders[r]=new s.loader(s),this.decrypturl=i,this.decryptkey=null,t.loader.load(i,{
|
|
frag:t},"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),s.fragLoadingTimeOut,s.fragLoadingMaxRetry,s.fragLoadingRetryDelay,this.loadprogress.bind(this),t)}else this.decryptkey&&(n.key=this.decryptkey,this.hls.trigger(d["default"].KEY_LOADED,{frag:t}))}},{key:"loadsuccess",value:function(e,t,r){var a=r.frag;this.decryptkey=a.decryptdata.key=new Uint8Array(e.currentTarget.response),a.loader=void 0,this.loaders[r.type]=void 0,this.hls.trigger(d["default"].KEY_LOADED,{frag:a})}},{key:"loaderror",value:function(e,t){var r=t.frag,a=r.loader;a&&a.abort(),this.loaders[t.type]=void 0,this.hls.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:r,response:e})}},{key:"loadtimeout",value:function(e,t,r){var a=r.frag,n=a.loader;n&&n.abort(),this.loaders[r.type]=void 0,this.hls.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:a})}},{key:"loadprogress",value:function(){}}]),t}(c["default"]);r["default"]=p},{"../errors":24,"../event-handler":25,"../events":26,"../utils/logger":43}],34:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),d=a(l),u=e("../event-handler"),c=a(u),h=e("../errors"),f=e("../utils/url"),p=a(f),g=e("../utils/attr-list"),y=a(g),m=e("../utils/logger"),v=function(e){function t(e){n(this,t);var r=i(this,Object.getPrototypeOf(t).call(this,e,d["default"].MANIFEST_LOADING,d["default"].LEVEL_LOADING,d["default"].AUDIO_TRACK_LOADING));return r.loaders={},r}return s(t,e),o(t,[{key:"destroy",value:function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy()}this.loaders={},c["default"].prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,{type:"manifest"})}},{key:"onLevelLoading",value:function(e){this.load(e.url,{type:"level",level:e.level,id:e.id})}},{key:"onAudioTrackLoading",value:function(e){this.load(e.url,{type:"audioTrack",id:e.id})}},{key:"load",value:function(e,t){var r,a,n,i=this.hls.config;"manifest"===t.type?(r=i.manifestLoadingMaxRetry,a=i.manifestLoadingTimeOut,n=i.manifestLoadingRetryDelay):(r=i.levelLoadingMaxRetry,a=i.levelLoadingTimeOut,n=i.levelLoadingRetryDelay);var s=this.loaders[t.type];s&&(m.logger.warn("abort previous loader for type:"+t.type),s.abort()),s=this.loaders[t.type]=t.loader="undefined"!=typeof i.pLoader?new i.pLoader(i):new i.loader(i),s.load(e,t,"",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),a,r,n)}},{key:"resolve",value:function(e,t){return p["default"].buildAbsoluteURL(t,e)}},{key:"parseMasterPlaylist",value:function(e,t){for(var r=[],a=void 0,n=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g;null!=(a=n.exec(e));){var i={},s=i.attrs=new y["default"](a[1]);i.url=this.resolve(a[2],t);var o=s.decimalResolution("RESOLUTION");o&&(i.width=o.width,i.height=o.height),i.bitrate=s.decimalInteger("AVERAGE-BANDWIDTH")||s.decimalInteger("BANDWIDTH"),i.name=s.NAME;var l=s.CODECS;if(l){l=l.split(",");for(var d=0;d<l.length;d++){var u=l[d];u.indexOf("avc1")!==-1?i.videoCodec=this.avc1toavcoti(u):i.audioCodec=u}}r.push(i)}return r}},{key:"parseMasterPlaylistMedia",value:function(e,t,r){for(var a=[],n=void 0,i=0,s=/#EXT-X-MEDIA:(.*)/g;null!=(n=s.exec(e));){var o={},l=new y["default"](n[1]);l.TYPE===r&&(o.groupId=l["GROUP-ID"],o.name=l.NAME,o["default"]="YES"===l.DEFAULT,o.autoselect="YES"===l.AUTOSELECT,o.forced="YES"===l.FORCED,o.url=l.URI?this.resolve(l.URI,t):"",o.lang=l.LANGUAGE,o.name||(o.name=o.lang),o.id=i++,a.push(o))}return a}},{key:"createInitializationVector",value:function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,t){var r=e;return e&&e.method&&e.uri&&!e.iv&&(r=this.cloneObj(e),r.iv=this.createInitializationVector(t)),r}},{key:"avc1toavcoti",value:function(e){var t,r=e.split(".");return r.length>2?(t=r.shift()+".",t+=parseInt(r.shift()).toString(16),t+=("000"+parseInt(r.shift()).toString(16)).substr(-4)):t=e,t}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(e,t,r,a){var n,i,s,o=0,l=0,d={type:null,version:null,url:t,fragments:[],live:!0,startSN:0},u={method:null,key:null,iv:null,uri:null},c=0,h=null,f=null,p=null,g=null,v=null,b=null,k=[];for(s=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF):(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE):(\d+(?:@\d+(?:\.\d+)?))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g;null!==(i=s.exec(e));)switch(i.shift(),i=i.filter(function(e){return void 0!==e}),i[0]){case"PLAYLIST-TYPE":d.type=i[1].toUpperCase();break;case"MEDIA-SEQUENCE":o=d.startSN=parseInt(i[1]);break;case"TARGETDURATION":d.targetduration=parseFloat(i[1]);break;case"VERSION":d.version=parseInt(i[1]);break;case"EXTM3U":break;case"ENDLIST":d.live=!1;break;case"DIS":c++,k.push(i);break;case"BYTERANGE":var E=i[1].split("@");b=1===E.length?v:parseInt(E[1]),v=parseInt(E[0])+b;break;case"INF":p=parseFloat(i[1]),g=i[2]?i[2]:null,k.push(i);break;case"":if(!isNaN(p)){var w=o++;n=this.fragmentDecryptdataFromLevelkey(u,w);var x=i[1]?this.resolve(i[1],t):null;f={url:x,type:a,duration:p,title:g,start:l,sn:w,level:r,cc:c,decryptdata:n,programDateTime:h,tagList:k},null!==b&&(f.byteRangeStartOffset=b,f.byteRangeEndOffset=v),d.fragments.push(f),l+=p,p=null,g=null,b=null,h=null,k=[]}break;case"KEY":var T=i[1],R=new y["default"](T),_=R.enumeratedString("METHOD"),L=R.URI,A=R.hexadecimalInteger("IV");_&&(u={method:null,key:null,iv:null,uri:null},L&&"AES-128"===_&&(u.method=_,u.uri=this.resolve(L,t),u.key=null,u.iv=A));break;case"START":var S=i[1],D=new y["default"](S),O=D.decimalFloatingPoint("TIME-OFFSET");O&&(d.startTimeOffset=O);break;case"PROGRAM-DATE-TIME":h=new Date(Date.parse(i[1])),k.push(i);break;case"#":i.shift(),k.push(i);break;default:m.logger.warn("line parsed but not handled: "+i)}return f&&!f.url&&(d.fragments.pop(),l-=f.duration),d.totalduration=l,d.averagetargetduration=l/d.fragments.length,d.endSN=o-1,d}},{key:"loadsuccess",value:function(e,t,r){var a=e.currentTarget,n=a.responseText,i=a.responseURL,s=r.type,o=r.id,l=r.level,u=this.hls;if(this.loaders[s]=void 0,void 0!==i&&0!==i.indexOf("data:")||(i=r.url),t.tload=performance.now(),t.mtime=new Date(a.getResponseHeader("Last-Modified")),0===n.indexOf("#EXTM3U"))if(n.indexOf("#EXTINF:")>0)if("manifest"===s)u.trigger(d["default"].MANIFEST_LOADED,{levels:[{url:i}],url:i,stats:t});else{var c="level"===s,f=this.parseLevelPlaylist(n,i,l||o,c?"main":"audio");t.tparsed=performance.now(),c?u.trigger(d["default"].LEVEL_LOADED,{details:f,level:l,id:o,stats:t}):u.trigger(d["default"].AUDIO_TRACK_LOADED,{details:f,id:o,stats:t})}else{var p=this.parseMasterPlaylist(n,i),g=this.parseMasterPlaylistMedia(n,i,"AUDIO");p.length?u.trigger(d["default"].MANIFEST_LOADED,{levels:p,audioTracks:g,url:i,stats:t}):u.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:i,reason:"no level found in manifest"})}else u.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:i,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(e,t){var r,a,n=t.loader;switch(t.type){case"manifest":r=h.ErrorDetails.MANIFEST_LOAD_ERROR,a=!0;break;case"level":r=h.ErrorDetails.LEVEL_LOAD_ERROR,a=!1;break;case"audioTrack":r=h.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,a=!1}n&&(n.abort(),this.loaders[t.type]=void 0),this.hls.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:r,fatal:a,url:n.url,loader:n,response:e.currentTarget,context:t})}},{key:"loadtimeout",value:function(e,t,r){var a,n,i=r.loader;switch(r.type){case"manifest":a=h.ErrorDetails.MANIFEST_LOAD_TIMEOUT,n=!0;break;case"level":a=h.ErrorDetails.LEVEL_LOAD_TIMEOUT,n=!1;break;case"audioTrack":a=h.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT,n=!1}i&&(i.abort(),this.loaders[r.type]=void 0),this.hls.trigger(d["default"].ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:a,fatal:n,url:i.url,loader:i,context:r})}}]),t}(c["default"]);r["default"]=v},{"../errors":24,"../event-handler":25,"../events":26,"../utils/attr-list":38,"../utils/logger":43,"../utils/url":46}],35:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(){a(this,e)}return n(e,null,[{key:"init",value:function(){e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),a=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:r,audio:a};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=i,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,s,l,s,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))}},{key:"box",value:function(e){for(var t,r=Array.prototype.slice.call(arguments,1),a=8,n=r.length,i=n;n--;)a+=r[n].byteLength;for(t=new Uint8Array(a),t[0]=a>>24&255,t[1]=a>>16&255,t[2]=a>>8&255,t[3]=255&a,t.set(e,4),n=0,a=8;n<i;n++)t.set(r[n],a),a+=r[n].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return r*=t,e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,a){return e.box(e.types.moof,e.mfhd(t),e.traf(a,r))}},{key:"moov",value:function(t){for(var r=t.length,a=[];r--;)a[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(a).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var r=t.length,a=[];r--;)a[r]=e.trex(t[r]);return e.box.apply(null,[e.types.mvex].concat(a))}},{key:"mvhd",value:function(t,r){r*=t;var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)}},{key:"sdtp",value:function(t){var r,a,n=t.samples||[],i=new Uint8Array(4+n.length);for(a=0;a<n.length;a++)r=n[a].flags,i[a+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,i)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,a,n,i=[],s=[];for(r=0;r<t.sps.length;r++)a=t.sps[r],n=a.byteLength,i.push(n>>>8&255),i.push(255&n),i=i.concat(Array.prototype.slice.call(a));for(r=0;r<t.pps.length;r++)a=t.pps[r],n=a.byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(a));var o=e.box(e.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),l=t.width,d=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,d>>8&255,255&d,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,a=t.duration*t.timescale,n=t.width,i=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,n>>8&255,255&n,0,0,i>>8&255,255&i,0,0]))}},{key:"traf",value:function(t,r){var a=e.sdtp(t),n=t.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.trun(t,a.length+16+16+8+16+8+8),a)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var r=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,r){var a,n,i,s,o,l,d=t.samples||[],u=d.length,c=12+16*u,h=new Uint8Array(c);for(r+=8+c,h.set([0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),a=0;a<u;a++)n=d[a],i=n.duration,s=n.size,o=n.flags,l=n.cts,h.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*a);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t){e.types||e.init();var r,a=e.moov(t);return r=new Uint8Array(e.FTYP.byteLength+a.byteLength),r.set(e.FTYP),r.set(a,e.FTYP.byteLength),r}}]),e}();r["default"]=i},{}],36:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("../helper/aac"),o=a(s),l=e("../events"),d=a(l),u=e("../utils/logger"),c=e("../remux/mp4-generator"),h=a(c),f=e("../errors");e("../utils/polyfill");var p=function(){function e(t,r,a){n(this,e),this.observer=t,this.id=r,this.config=a,this.ISGenerated=!1,this.PES2MP4SCALEFACTOR=4,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR}return i(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){this._initPTS=this._initDTS=void 0}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,a,n,i,s,o){if(this.level=e,this.sn=t,this.ISGenerated||this.generateIS(r,a,s),this.ISGenerated)if(r.samples.length){var l=this.remuxAudio(r,s,o);if(a.samples.length){var u=void 0;l&&(u=l.endPTS-l.startPTS),this.remuxVideo(a,s,o,u)}}else{var c=void 0;a.samples.length&&(c=this.remuxVideo(a,s,o)),c&&r.codec&&this.remuxEmptyAudio(r,s,o,c)}n.samples.length&&this.remuxID3(n,s),i.samples.length&&this.remuxText(i,s),this.observer.trigger(d["default"].FRAG_PARSED,{id:this.id,level:this.level,sn:this.sn})}},{key:"generateIS",value:function(e,t,r){var a,n,i=this.observer,s=e.samples,o=t.samples,l=this.PES_TIMESCALE,c={},p={id:this.id,level:this.level,sn:this.sn,tracks:c,unique:!1},g=void 0===this._initPTS;g&&(a=n=1/0),e.config&&s.length&&(e.timescale=e.audiosamplerate,e.timescale*e.duration>Math.pow(2,32)&&!function(){var t=function r(e,t){return t?r(t,e%t):e};e.timescale=e.audiosamplerate/t(e.audiosamplerate,1024)}(),u.logger.log("audio mp4 timescale :"+e.timescale),c.audio={container:"audio/mp4",codec:e.codec,initSegment:h["default"].initSegment([e]),metadata:{channelCount:e.channelCount}},g&&(a=n=s[0].pts-l*r)),t.sps&&t.pps&&o.length&&(t.timescale=this.MP4_TIMESCALE,c.video={container:"video/mp4",codec:t.codec,initSegment:h["default"].initSegment([t]),metadata:{width:t.width,height:t.height}},g&&(a=Math.min(a,o[0].pts-l*r),n=Math.min(n,o[0].dts-l*r))),Object.keys(c).length?(i.trigger(d["default"].FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,g&&(this._initPTS=a,this._initDTS=n)):i.trigger(d["default"].ERROR,{type:f.ErrorTypes.MEDIA_ERROR,id:this.id,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(e,t,r,a){var n,i,s,o,l,c,f,p,g=8,y=this.PES_TIMESCALE,m=this.PES2MP4SCALEFACTOR,v=e.samples,b=[],k=void 0;k=r?this.nextAvcDts:t*y;var E=v[0];l=Math.max(this._PTSNormalize(E.dts,k)-this._initDTS,0),o=Math.max(this._PTSNormalize(E.pts,k)-this._initDTS,0);var w=Math.round((l-k)/90);r&&w&&(w>1?u.logger.log("AVC:"+w+" ms hole between fragments detected,filling it"):w<-1&&u.logger.log("AVC:"+-w+" ms overlapping between fragments detected"),l=k,v[0].dts=l+this._initDTS,o=Math.max(o-w,k),v[0].pts=o+this._initDTS,u.logger.log("Video/PTS/DTS adjusted: "+o+"/"+l+",delta:"+w)),c=l,E=v[v.length-1],p=Math.max(this._PTSNormalize(E.dts,k)-this._initDTS,0),f=Math.max(this._PTSNormalize(E.pts,k)-this._initDTS,0),f=Math.max(f,p);var x=navigator.vendor,T=navigator.userAgent,R=x&&x.indexOf("Apple")>-1&&T&&!T.match("CriOS");R&&(n=Math.round((p-l)/(m*(v.length-1))));for(var _=0;_<v.length;_++){var L=v[_];R?L.dts=l+_*m*n:(L.dts=Math.max(this._PTSNormalize(L.dts,k)-this._initDTS,l),L.dts=Math.round(L.dts/m)*m),L.pts=Math.max(this._PTSNormalize(L.pts,k)-this._initDTS,L.dts),L.pts=Math.round(L.pts/m)*m}i=new Uint8Array(e.len+4*e.nbNalu+8);var A=new DataView(i.buffer);A.setUint32(0,i.byteLength),i.set(h["default"].types.mdat,4);for(var S=0;S<v.length;S++){for(var D=v[S],O=0,C=void 0;D.units.units.length;){var P=D.units.units.shift();A.setUint32(g,P.data.byteLength),g+=4,i.set(P.data,g),g+=P.data.byteLength,O+=4+P.data.byteLength}if(R)C=Math.max(0,n*Math.round((D.pts-D.dts)/(m*n)));else{if(S<v.length-1)n=v[S+1].dts-D.dts;else{var I=this.config,M=D.dts-v[S>0?S-1:S].dts;if(I.stretchShortVideoTrack){var N=I.maxBufferHole,F=I.maxSeekHole,U=Math.floor(Math.min(N,F)*y),B=(a?o+a*y:this.nextAacPts)-D.pts;B>U?(n=B-M,n<0&&(n=M),u.logger.log("It is approximately "+B/90+" ms to the next segment; using duration "+n/90+" ms for the last video frame.")):n=M}else n=M}n/=m,C=Math.round((D.pts-D.dts)/m)}b.push({size:O,duration:n,cts:C,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:D.key?2:1,isNonSync:D.key?0:1}})}this.nextAvcDts=p+n*m;var G=e.dropped;if(e.len=0,e.nbNalu=0,e.dropped=0,b.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var Y=b[0].flags;Y.dependsOn=2,Y.isNonSync=0}e.samples=b,s=h["default"].moof(e.sequenceNumber++,l/m,e),e.samples=[];var j={id:this.id,level:this.level,sn:this.sn,data1:s,data2:i,startPTS:o/y,endPTS:(f+m*n)/y,startDTS:l/y,endDTS:this.nextAvcDts/y,type:"video",nb:b.length,dropped:G};return this.observer.trigger(d["default"].FRAG_PARSING_DATA,j),j}},{key:"remuxAudio",value:function(e,t,r){var a,n,i,s,l,c,f,p,g,y,m,v,b,k=this.PES_TIMESCALE,E=e.timescale,w=k/E,x=1024*e.timescale/e.audiosamplerate,T=8,R=[],_=[];e.samples.sort(function(e,t){return e.pts-t.pts}),_=e.samples;for(var L=r?this.nextAacPts:t*k,A=this._PTSNormalize(_[0].pts-this._initPTS,L),S=x*w,D=A+S,O=1;O<_.length;){var C=_[O],P=this._PTSNormalize(C.pts-this._initPTS,L),I=P-D;if(I<-.5*S)u.logger.log("Dropping frame due to "+Math.abs(I/90)+" ms overlap."),_.splice(O,1),e.len-=C.unit.length;else if(I>.5*S){var M=Math.round(I/S);u.logger.log("Injecting "+M+" frame"+(M>1?"s":"")+" of missing audio due to "+Math.round(I/90)+" ms gap.");for(var N=0;N<M;N++){var F=_[O-1].pts+S,U=o["default"].getSilentFrame(e.channelCount);U||(u.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),U=C.unit.slice(0)),_.splice(O,0,{unit:U,pts:F,dts:F}),e.len+=U.length,O+=1}D+=(M+1)*S,C.pts=_[O-1].pts+S,O+=1}else Math.abs(I)>.1*S&&u.logger.log("Invalid frame delta "+(P-D+S)+" at PTS "+Math.round(P/90)+" (should be "+S+")."),D+=S,C.pts=_[O-1].pts+S,O+=1}for(;_.length;){if(n=_.shift(),s=n.unit,y=n.pts-this._initDTS,m=n.dts-this._initDTS,void 0!==g)v=this._PTSNormalize(y,g),b=this._PTSNormalize(m,g),i.duration=(b-g)/w;else{v=this._PTSNormalize(y,L),b=this._PTSNormalize(m,L);var B=Math.round(1e3*(v-L)/k);if(r&&B){if(B>0)u.logger.log(B+" ms hole between AAC samples detected,filling it");else if(B<-12){u.logger.log(-B+" ms overlapping between AAC samples detected, drop frame"),e.len-=s.byteLength;continue}v=b=L}if(f=Math.max(0,v),p=Math.max(0,b),!(e.len>0))return;l=new Uint8Array(e.len+8),a=new DataView(l.buffer),a.setUint32(0,l.byteLength),l.set(h["default"].types.mdat,4)}l.set(s,T),T+=s.byteLength,i={size:s.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},R.push(i),g=b}var G=0,Y=R.length;if(Y>=2&&(G=R[Y-2].duration,i.duration=G),Y){this.nextAacPts=v+w*G,e.len=0,e.samples=R,c=h["default"].moof(e.sequenceNumber++,p/w,e),e.samples=[];var j={id:this.id,level:this.level,sn:this.sn,data1:c,data2:l,startPTS:f/k,endPTS:this.nextAacPts/k,startDTS:p/k,endDTS:(b+w*G)/k,type:"audio",nb:Y};return this.observer.trigger(d["default"].FRAG_PARSING_DATA,j),j}return null}},{key:"remuxEmptyAudio",value:function(e,t,r,a){var n=this.PES_TIMESCALE,i=e.timescale?e.timescale:e.audiosamplerate,s=n/i,l=a.startDTS*n,d=a.endDTS*n,c=1024,h=s*c,f=Math.ceil((d-l)/h),p=o["default"].getSilentFrame(e.channelCount);if(!p)return void u.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var g=[],y=0;y<f;y++){var m=l+y*h;g.push({unit:p.slice(0),pts:m,dts:m}),e.len+=p.length}e.samples=g,this.remuxAudio(e,t,r)}},{key:"remuxID3",value:function(e,t){var r,a=e.samples.length;if(a){for(var n=0;n<a;n++)r=e.samples[n],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE,r.dts=(r.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(d["default"].FRAG_PARSING_METADATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],t=t}},{key:"remuxText",value:function(e,t){e.samples.sort(function(e,t){return e.pts-t.pts});var r,a=e.samples.length;if(a){for(var n=0;n<a;n++)r=e.samples[n],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(d["default"].FRAG_PARSING_USERDATA,{id:this.id,level:this.level,sn:this.sn,samples:e.samples})}e.samples=[],t=t}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=t<e?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),e}();r["default"]=p},{"../errors":24,"../events":26,"../helper/aac":27,"../remux/mp4-generator":35,"../utils/logger":43,"../utils/polyfill":44}],37:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=e("../events"),o=a(s),l=function(){function e(t,r){n(this,e),this.observer=t,this.id=r,this.ISGenerated=!1}return i(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(e,t,r,a,n,i){var s=this.observer;if(!this.ISGenerated){var l={},d={id:this.id,tracks:l,unique:!0},u=t,c=u.codec;c&&(d.tracks.video={container:u.container,codec:c,metadata:{width:u.width,height:u.height}}),u=e,c=u.codec,c&&(d.tracks.audio={container:u.container,codec:c,metadata:{channelCount:u.channelCount}}),this.ISGenerated=!0,s.trigger(o["default"].FRAG_PARSING_INIT_SEGMENT,d)}s.trigger(o["default"].FRAG_PARSING_DATA,{id:this.id,data1:i,startPTS:n,startDTS:n,type:"audiovideo",nb:1,dropped:0})}},{key:"passthrough",get:function(){return!0}}]),e}();r["default"]=l},{"../events":26}],38:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(t){a(this,e),"string"==typeof t&&(t=e.parseAttrList(t));for(var r in t)t.hasOwnProperty(r)&&(this[r]=t[r])}return n(e,[{key:"decimalInteger",value:function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"hexadecimalInteger",value:function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),a=0;a<t.length/2;a++)r[a]=parseInt(t.slice(2*a,2*a+2),16);return r}return null}},{key:"hexadecimalIntegerAsNumber",value:function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(e){var t=/^(\d+)x(\d+)$/.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}}],[{key:"parseAttrList",value:function(e){for(var t,r=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,a={};null!==(t=r.exec(e));){var n=t[2],i='"';0===n.indexOf(i)&&n.lastIndexOf(i)===n.length-1&&(n=n.slice(1,-1)),a[t[1]]=n}return a}}]),e}();r["default"]=i},{}],39:[function(e,t,r){"use strict";var a={search:function(e,t){for(var r=0,a=e.length-1,n=null,i=null;r<=a;){n=(r+a)/2|0,i=e[n];var s=t(i);if(s>0)r=n+1;else{if(!(s<0))return i;a=n-1}}return null}};t.exports=a},{}],40:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i={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},s=function(e){var t=e;return i.hasOwnProperty(e)&&(t=i[e]),String.fromCharCode(t)},o=15,l=32,d={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},u={17:2,18:4,21:6,22:8,23:10,19:13,20:15},c={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},h={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],p={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)}},g=function(e){for(var t=[],r=0;r<e.length;r++)t.push(e[r].toString(16));return t},y=function(){function e(t,r,n,i,s){a(this,e),this.foreground=t||"white",this.underline=r||!1,this.italics=n||!1,this.background=i||"black",this.flash=s||!1}return n(e,[{key:"reset",value:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}},{key:"setStyles",value:function(e){for(var t=["foreground","underline","italics","background","flash"],r=0;r<t.length;r++){var a=t[r];e.hasOwnProperty(a)&&(this[a]=e[a])}}},{key:"isDefault",value:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}},{key:"equals",value:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}},{key:"copy",value:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}},{key:"toString",value:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),e}(),m=function(){function e(t,r,n,i,s,o){a(this,e),this.uchar=t||" ",this.penState=new y(r,n,i,s,o)}return n(e,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(e,t){this.uchar=e,this.penState.copy(t)}},{key:"setPenState",value:function(e){this.penState.copy(e)}},{key:"equals",value:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}},{key:"copy",value:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)}},{key:"isEmpty",value:function(){return" "===this.uchar&&this.penState.isDefault()}}]),e}(),v=function(){function e(){a(this,e),
|
|
this.chars=[];for(var t=0;t<l;t++)this.chars.push(new m);this.pos=0,this.currPenState=new y}return n(e,[{key:"equals",value:function(e){for(var t=!0,r=0;r<l;r++)if(!this.chars[r].equals(e.chars[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<l;t++)this.chars[t].copy(e.chars[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<l;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}},{key:"setCursor",value:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(p.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>l&&(p.log("ERROR","Too large cursor position "+this.pos),this.pos=l)}},{key:"moveCursor",value: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)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(e){e>=144&&this.backSpace();var t=s(e);return this.pos>=l?void p.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),void this.moveCursor(1))}},{key:"clearFromPos",value:function(e){var t;for(t=e;t<l;t++)this.chars[t].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(var e=[],t=!0,r=0;r<l;r++){var a=this.chars[r].uchar;" "!==a&&(t=!1),e.push(a)}return t?"":e.join("")}},{key:"setPenStyles",value:function(e){this.currPenState.setStyles(e);var t=this.chars[this.pos];t.setPenState(this.currPenState)}}]),e}(),b=function(){function e(){a(this,e),this.rows=[];for(var t=0;t<o;t++)this.rows.push(new v);this.currRow=o-1,this.nrRollUpRows=null,this.reset()}return n(e,[{key:"reset",value:function(){for(var e=0;e<o;e++)this.rows[e].clear();this.currRow=o-1}},{key:"equals",value:function(e){for(var t=!0,r=0;r<o;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}},{key:"copy",value:function(e){for(var t=0;t<o;t++)this.rows[t].copy(e.rows[t])}},{key:"isEmpty",value:function(){for(var e=!0,t=0;t<o;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}},{key:"backSpace",value:function(){var e=this.rows[this.currRow];e.backSpace()}},{key:"clearToEndOfRow",value:function(){var e=this.rows[this.currRow];e.clearToEndOfRow()}},{key:"insertChar",value:function(e){var t=this.rows[this.currRow];t.insertChar(e)}},{key:"setPen",value:function(e){var t=this.rows[this.currRow];t.setPenStyles(e)}},{key:"moveCursor",value:function(e){var t=this.rows[this.currRow];t.moveCursor(e)}},{key:"setCursor",value:function(e){p.log("INFO","setCursor: "+e);var t=this.rows[this.currRow];t.setCursor(e)}},{key:"setPAC",value:function(e){p.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 a=e.indent,n=Math.max(a-1,0);r.setCursor(e.indent),e.color=r.chars[n].penState.foreground}var i={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(i)}},{key:"setBkgData",value:function(e){p.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}},{key:"setRollUpRows",value:function(e){this.nrRollUpRows=e}},{key:"rollUp",value:function(){if(null===this.nrRollUpRows)return void p.log("DEBUG","roll_up but nrRollUpRows not set yet");p.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),p.log("INFO","Rolling up")}},{key:"getDisplayText",value:function(e){e=e||!1;for(var t=[],r="",a=-1,n=0;n<o;n++){var i=this.rows[n].getTextString();i&&(a=n+1,e?t.push("Row "+a+": '"+i+"'"):t.push(i.trim()))}return t.length>0&&(r=e?"["+t.join(" | ")+"]":t.join("\n")),r}},{key:"getTextAndFormat",value:function(){return this.rows}}]),e}(),k=function(){function e(t,r){a(this,e),this.chNr=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new b,this.nonDisplayedMemory=new b,this.lastOutputScreen=new b,this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return n(e,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[o-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(e){this.outputFilter=e}},{key:"setPAC",value:function(e){this.writeScreen.setPAC(e)}},{key:"setBkgData",value:function(e){this.writeScreen.setBkgData(e)}},{key:"setMode",value:function(e){e!==this.mode&&(this.mode=e,p.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)}},{key:"insertChars",value:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";p.log("INFO",r+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(p.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}},{key:"ccRCL",value:function(){p.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}},{key:"ccBS",value:function(){p.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}},{key:"ccAOF",value:function(){}},{key:"ccAON",value:function(){}},{key:"ccDER",value:function(){p.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}},{key:"ccRU",value:function(e){p.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}},{key:"ccFON",value:function(){p.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})}},{key:"ccRDC",value:function(){p.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}},{key:"ccTR",value:function(){p.log("INFO","TR"),this.setMode("MODE_TEXT")}},{key:"ccRTD",value:function(){p.log("INFO","RTD"),this.setMode("MODE_TEXT")}},{key:"ccEDM",value:function(){p.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()}},{key:"ccCR",value:function(){p.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()}},{key:"ccENM",value:function(){p.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}},{key:"ccEOC",value:function(){if(p.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,p.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()}},{key:"ccTO",value:function(e){p.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}},{key:"ccMIDROW",value: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,a=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=a[r]}p.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}},{key:"outputDataUpdate",value:function(){var e=p.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))}},{key:"cueSplitAtTime",value:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}]),e}(),E=function(){function e(t,r,n){a(this,e),this.field=t||1,this.outputs=[r,n],this.channels=[new k(1,r),new k(2,n)],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}}return n(e,[{key:"getHandler",value:function(e){return this.channels[e].getHandler()}},{key:"setHandler",value:function(e,t){this.channels[e].setHandler(t)}},{key:"addData",value:function(e,t){var r,a,n,i=!1;this.lastTime=e,p.setTime(e);for(var s=0;s<t.length;s+=2)if(a=127&t[s],n=127&t[s+1],0!==a||0!==n){if(p.log("DATA","["+g([t[s],t[s+1]])+"] -> ("+g([a,n])+")"),r=this.parseCmd(a,n),r||(r=this.parseMidrow(a,n)),r||(r=this.parsePAC(a,n)),r||(r=this.parseBackgroundAttributes(a,n)),!r&&(i=this.parseChars(a,n)))if(this.currChNr&&this.currChNr>=0){var o=this.channels[this.currChNr-1];o.insertChars(i)}else p.log("WARNING","No channel found yet. TEXT-MODE?");r?this.dataCounters.cmd+=2:i?this.dataCounters["char"]+=2:(this.dataCounters.other+=2,p.log("WARNING","Couldn't parse cleaned data "+g([a,n])+" orig: "+g([t[s],t[s+1]])))}else this.dataCounters.padding+=2}},{key:"parseCmd",value:function(e,t){var r=null,a=(20===e||28===e)&&32<=t&&t<=47,n=(23===e||31===e)&&33<=t&&t<=35;if(!a&&!n)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,p.log("DEBUG","Repeated command ("+g([e,t])+") is dropped"),!0;r=20===e||23===e?1:2;var i=this.channels[r-1];return 20===e||28===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.ccTO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0}},{key:"parseMidrow",value:function(e,t){var r=null;if((17===e||25===e)&&32<=t&&t<=47){if(r=17===e?1:2,r!==this.currChNr)return p.log("ERROR","Mismatch channel in midrow parsing"),!1;var a=this.channels[r-1];return a.ccMIDROW(t),p.log("DEBUG","MIDROW ("+g([e,t])+")"),!0}return!1}},{key:"parsePAC",value:function(e,t){var r=null,a=null,n=(17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127,i=(16===e||24===e)&&64<=t&&t<=95;if(!n&&!i)return!1;if(e===this.lastCmdA&&t===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;r=e<=23?1:2,a=64<=t&&t<=95?1===r?d[e]:c[e]:1===r?u[e]:h[e];var s=this.interpretPAC(a,t),o=this.channels[r-1];return o.setPAC(s),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=r,!0}},{key:"interpretPAC",value:function(e,t){var r=t,a={color:null,italics:!1,indent:null,underline:!1,row:e};return r=t>95?t-96:t-64,a.underline=1===(1&r),r<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(a.italics=!0,a.color="white"):a.indent=4*Math.floor((r-16)/2),a}},{key:"parseChars",value:function(e,t){var r=null,a=null,n=null;if(e>=25?(r=2,n=e-8):(r=1,n=e),17<=n&&n<=19){var i=t;i=17===n?t+80:18===n?t+112:t+144,p.log("INFO","Special char '"+s(i)+"' in channel "+r),a=[i]}else 32<=e&&e<=127&&(a=0===t?[e]:[e,t]);if(a){var o=g(a);p.log("DEBUG","Char codes = "+o.join(",")),this.lastCmdA=null,this.lastCmdB=null}return a}},{key:"parseBackgroundAttributes",value:function(e,t){var r,a,n,i,s=(16===e||24===e)&&32<=t&&t<=47,o=(23===e||31===e)&&45<=t&&t<=47;return!(!s&&!o)&&(r={},16===e||24===e?(a=Math.floor((t-32)/2),r.background=f[a],t%2===1&&(r.background=r.background+"_semi")):45===t?r.background="transparent":(r.foreground="black",47===t&&(r.underline=!0)),n=e<24?1:2,i=this.channels[n-1],i.setBkgData(r),this.lastCmdA=null,this.lastCmdB=null,!0)}},{key:"reset",value:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null}},{key:"cueSplitAtTime",value:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}}]),e}();r["default"]=E},{}],41:[function(e,t,r){"use strict";var a={newCue:function(e,t,r,a){for(var n,i,s,o,l,d=window.VTTCue||window.TextTrackCue,u=0;u<a.rows.length;u++)if(n=a.rows[u],s=!0,o=0,l="",!n.isEmpty()){for(var c=0;c<n.chars.length;c++)n.chars[c].uchar.match(/\s/)&&s?o++:(l+=n.chars[c].uchar,s=!1);i=new d(t,r,l.trim()),o>=16?o--:o++,navigator.userAgent.match(/Firefox\//)?i.line=u+1:i.line=u>7?u-2:u+1,i.align="left",i.position=100*(o/32)+(navigator.userAgent.match(/Firefox\//)?50:0),e.addCue(i)}}};t.exports=a},{}],42:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(t){a(this,e),this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}return n(e,[{key:"sample",value:function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_}}]),e}();r["default"]=i},{}],43:[function(e,t,r){"use strict";function a(){}function n(e,t){return t="["+e+"] > "+t}function i(e){var t=window.console[e];return t?function(){for(var r=arguments.length,a=Array(r),i=0;i<r;i++)a[i]=arguments[i];a[0]&&(a[0]=n(e,a[0])),t.apply(window.console,a)}:a}function s(e){for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];r.forEach(function(t){d[t]=e[t]?e[t].bind(e):i(t)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},l={trace:a,debug:a,log:a,warn:a,info:a,error:a},d=l;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{d.log()}catch(t){d=l}}else d=l},r.logger=d},{}],44:[function(e,t,r){"use strict";"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(e,t){var r=new Uint8Array(this);void 0===t&&(t=r.length);for(var a=new ArrayBuffer(t-e),n=new Uint8Array(a),i=0;i<n.length;i++)n[i]=r[i+e];return a})},{}],45:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=function(){function e(){a(this,e)}return n(e,null,[{key:"toString",value:function(e){for(var t="",r=e.length,a=0;a<r;a++)t+="["+e.start(a)+","+e.end(a)+"]";return t}}]),e}();r["default"]=i},{}],46:[function(e,t,r){"use strict";var a={buildAbsoluteURL:function(e,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var r=null,n=null,i=/^([^#]*)(.*)$/.exec(t);i&&(n=i[2],t=i[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(r=s[2],t=s[1]);var o=/^([^#]*)(.*)$/.exec(e);o&&(e=o[1]);var l=/^([^\?]*)(.*)$/.exec(e);l&&(e=l[1]);var d=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(e);if(!d)throw new Error("Error trying to parse base URL.");var u=d[2]||"",c=d[1]||"",h=d[4],f=null;return f=/^\/\//.test(t)?u+"//"+a.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?c+"/"+a.buildAbsolutePath("",t.substring(1)):a.buildAbsolutePath(c+h,t),r&&(f+=r),n&&(f+=n),f},buildAbsolutePath:function(e,t){for(var r,a,n=t,i="",s=e.replace(/[^\/]*$/,n.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),o=0;a=s.indexOf("/../",o),a>-1;o=a+r)r=/^\/(?:\.\.\/)*/.exec(s.slice(a))[0].length,i=(i+s.substring(o,a)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(r-1)/3+"}$"),"/");return i+s.substr(o)}};t.exports=a},{}],47:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=e("../utils/logger"),s=function(){function e(t){a(this,e),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}return n(e,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){var e=this.loader;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"load",value:function(e,t,r,a,n,i,s,o,l){var d=arguments.length<=9||void 0===arguments[9]?null:arguments[9],u=arguments.length<=10||void 0===arguments[10]?null:arguments[10];this.url=e,this.context=t,t&&(t.url=e),!u||isNaN(u.byteRangeStartOffset)||isNaN(u.byteRangeEndOffset)||(this.byteRange=u.byteRangeStartOffset+"-"+(u.byteRangeEndOffset-1)),this.responseType=r,this.onSuccess=a,this.onProgress=d,this.onTimeout=i,this.onError=n,this.stats={trequest:performance.now(),retry:0},this.timeout=s,this.maxRetry=o,this.retryDelay=l,this.loadInternal()}},{key:"loadInternal",value:function(){var e;e="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest,e.onloadend=this.loadend.bind(this),e.onprogress=this.loadprogress.bind(this),e.open("GET",this.url,!0),this.byteRange&&e.setRequestHeader("Range","bytes="+this.byteRange),e.responseType=this.responseType;var t=this.stats;t.tfirst=0,t.loaded=0,this.xhrSetup&&this.xhrSetup(e,this.url),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.timeout),e.send()}},{key:"loadend",value:function(e){var t=e.currentTarget,r=t.status,a=this.stats,n=this.context;a.aborted||(window.clearTimeout(this.requestTimeout),r>=200&&r<300?(a.tload=Math.max(a.tfirst,performance.now()),this.onSuccess(e,a,n)):a.retry<this.maxRetry?(i.logger.warn(r+" while loading "+this.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),a.retry++):(i.logger.error(r+" while loading "+this.url),this.onError(e,n)))}},{key:"loadtimeout",value:function(){i.logger.warn("timeout while loading "+this.url),this.onTimeout(null,this.stats,this.context)}},{key:"loadprogress",value:function(e){var t=this.stats;0===t.tfirst&&(t.tfirst=Math.max(performance.now(),t.trequest)),t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total),this.onProgress&&this.onProgress(e,t,this.context)}}]),e}();r["default"]=s},{"../utils/logger":43}]},{},[31])(31)})}])});
|
|
//# sourceMappingURL=DPlayer.min.js.map
|