1(self.webpackChunknimo_web_frontend=self.webpackChunknimo_web_frontend||[]).push([[78070],{26336:function(t){t.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(s,r,(function(e){return t[e]}).bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=100)}([function(t,e){var i=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=i)},function(t,e,i){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}},function(t,e,i){var s=i(4),r=i(0),a=i(12),n=i(13),o=i(16),u=function(t,e,i){var l,d,c,f=t&u.F,p=t&u.G,m=t&u.S,_=t&u.P,y=t&u.B,v=t&u.W,S=p?r:r[e]||(r[e]={}),g=S.prototype,T=p?s:m?s[e]:(s[e]||{}).prototype;for(l in p&&(i=e),i)(d=!f&&T&&void 0!==T[l])&&o(S,l)||(c=d?T[l]:i[l],S[l]=p&&"function"!=typeof T[l]?i[l]:y&&d?a(c,s):v&&T[l]==c?function(t){var e=function(e,i,s){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,s)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(c):_&&"function"==typeof c?a(Function.call,c):c,_&&((S.virtual||(S.virtual={}))[l]=c,t&u.R&&g&&!g[l]&&n(g,l,c)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,i){"use strict";e.__esModule=!0;var s=i(84),r=s&&s.__esModule?s:{default:s};e.default=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),(0,r.default)(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}()},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e,i){var s=i(56)("wks"),r=i(40),a=i(4).Symbol,n="function"==typeof a;(t.exports=function(t){return s[t]||(s[t]=n&&a[t]||(n?a:r)("Symbol."+t))}).store=s},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){t.exports=!i(15)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(9),r=i(71),a=i(49),n=Object.defineProperty;e.f=i(7)?Object.defineProperty:function(t,e,i){if(s(t),e=a(e,!0),s(i),r)try{return n(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){var s=i(6);t.exports=function(t){if(!s(t))throw TypeError(t+" is not an object!");return t}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(44),r=s&&s.__esModule?s:{default:s},a=99;function n(t,e){var i=Math.max(0,e-t.toString().length),s="";if(i>0)for(var r=0;r<i;r++)s+="0";return s+t}function o(){var t=new Date;return t.getFullYear()+"-"+n(t.getMonth()+1,2)+"-"+n(t.getDate(),2)+" "+n(t.getHours(),2)+":"+n(t.getMinutes(),2)+":"+n(t.getSeconds(),2)+"."+n(t.getMilliseconds(),3)+" "}var u={_data:[],_length:0,debug:function(){var t=o(),e=Array.prototype.slice.call(arguments);e[0]=t+e[0],a<=-1&&console.log.apply(console,e)},log:function(t){var e=o(),i=Array.prototype.slice.call(arguments);i[0]=e+i[0],a<=0&&console.log.apply(console,i),u.record(i,"log")},info:function(t){var e=o(),i=Array.prototype.slice.call(arguments);i[0]=e+i[0],a<=1&&console.info.apply(console,i),u.record(i,"info")},warn:function(t){var e=o(),i=Array.prototype.slice.call(arguments);i[0]=e+i[0],a<=2&&console.warn.apply(console,i),u.record(i,"warn")},error:function(t){var e=o(),i=Array.prototype.slice.call(arguments);i[0]=e+i[0],a<=3&&console.error.apply(console,i),u.record(i,"error")},group:function(t){var e=o(),i=Array.prototype.slice.call(arguments);i[0]=e+i[0],a<=1&&(console.groupCollapsed||console.group||console.log).apply(console,i),u.record(i,"group")},groupEnd:function(){console.groupEnd&&console.groupEnd.apply(console)}
1,setLevel:function(t){t!=a&&(console.log(o()+" set log level from "+a+" to "+t),a=t)},getLevel:function(){return a},record:function(t,e){1100===u._length&&(u._data.splice(0,100),u._length=1e3);var i=0,s=(t.shift()||"").toString();for(s=s.replace(/\%c/gi,function(t,e){return i++,""});i--&&t.length;)t.shift();for(var a=0,n=t.length;a<n;a++){var o=t[a];"object"==(void 0===o?"undefined":(0,r.default)(o))&&(t[a]="")}t.unshift(s);var l=t.join(" ");u._length++,u._data.push("["+e+"]"+l)},getLog:function(){return u._data}};e.default=u},function(t,e,i){"use strict";(function(t){var s,r,a=T(i(70)),n=T(i(108)),o=T(i(111)),u=T(i(114)),l=T(i(29)),d=T(i(74)),c=T(i(122)),f=T(i(125)),p=T(i(14)),m=T(i(130)),_=T(i(82)),y=T(i(135)),v=T(i(83)),S=T(i(84)),g=T(i(44));function T(t){return t&&t.__esModule?t:{default:t}}r=function(){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||(0,S.default)(t,e,{enumerable:!0,get:s})},i.r=function(t){void 0!==v.default&&y.default&&(0,S.default)(t,y.default,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e||4&e&&"object"==(void 0===t?"undefined":(0,g.default)(t))&&t&&t.__esModule)return t;var s=(0,_.default)(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(s,r,(function(e){return t[e]}).bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=53)}([function(t,e){var i=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=i)},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e,i){e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var s=i(1),r=i(0),a=i(36),n=i(8),o=i(3),u=function t(e,i,u){var l,d,c,f=e&t.F,p=e&t.G,m=e&t.S,_=e&t.P,y=e&t.B,v=e&t.W,S=p?r:r[i]||(r[i]={}),g=S.prototype,T=p?s:m?s[i]:(s[i]||{}).prototype;for(l in p&&(u=i),u)(d=!f&&T&&void 0!==T[l])&&o(S,l)||(c=d?T[l]:u[l],S[l]=p&&"function"!=typeof T[l]?u[l]:y&&d?a(c,s):v&&T[l]==c?function(t){var e=function(e,i,s){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,s)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(c):_&&"function"==typeof c?a(Function.call,c):c,_&&((S.virtual||(S.virtual={}))[l]=c,e&t.R&&g&&!g[l]&&n(g,l,c)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,i){var s=i(12),r=i(37),a=i(23),n=S.default;e.f=i(6)?S.default:function(t,e,i){if(s(t),e=a(e,!0),s(i),r)try{return n(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){t.exports=!i(13)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,i){e.__esModule=!0;var s,r=(s=i(60))&&s.__esModule?s:{default:s};e.default=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),(0,r.default)(t,s.key,s)}}return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}()},function(t,e,i){var s=i(5),r=i(18);t.exports=i(6)?function(t,e,i){return s.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e){t.exports=function(t){return"object"==(void 0===t?"undefined":(0,g.default)(t))?null!==t:"function"==typeof t}},function(t,e,i){var s=i(70),r=i(20);t.exports=function(t){return s(r(t))}},function(t,e,i){var s=i(22)("wks"),r=i(17),a=i(1).Symbol,n="function"==typeof a;(t.exports=function(t){return s[t]||(s[t]=n&&a[t]||(n?a:r)("Symbol."+t))}).store=s}
1,function(t,e,i){var s=i(9);t.exports=function(t){if(!s(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default={logger:null,Signal:null,Timer:null,init:function(t){this.logger=t.logger,this.Signal=t.Signal,this.Timer=t.Timer}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s={},r={setTaf:function(t){return s=t}};e.default=r,r.EMediaNetType={ENET_WIFI:0,ENET_MOB:1,ENET_DISCONNECT:2,ENET_2G:3,ENET_3G:4,ENET_4G:5,ENET_UNKNOWN:127},r.MediaUserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sUA="",this.sCookie="",this.iAppid=0,this.sStrUid="",this.sUAppId="",this.iNetType=127},r.MediaUserId.prototype._clone=function(){return new r.MediaUserId},r.MediaUserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaUserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaUserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sUA),t.writeString(4,this.sCookie),t.writeInt32(6,this.iAppid),t.writeString(8,this.sStrUid),t.writeString(9,this.sUAppId),t.writeInt32(10,this.iNetType)},r.MediaUserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sUA=t.readString(3,!1,this.sUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iAppid=t.readInt32(6,!1,this.iAppid),this.sStrUid=t.readString(8,!1,this.sStrUid),this.sUAppId=t.readString(9,!1,this.sUAppId),this.iNetType=t.readInt32(10,!1,this.iNetType)},r.LoginVerifyReq=function(){this.tId=new r.MediaUserId,this.iCookieDeadTime=0},r.LoginVerifyReq.prototype._clone=function(){return new r.LoginVerifyReq},r.LoginVerifyReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LoginVerifyReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LoginVerifyReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt32(1,this.iCookieDeadTime)},r.LoginVerifyReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.iCookieDeadTime=t.readInt32(1,!1,this.iCookieDeadTime)},r.LoginVerifyRsp=function(){this.iResCode=0,this.lUid=0,this.sCookie="",this.sUid="",this.iAppId=0},r.LoginVerifyRsp.prototype._clone=function(){return new r.LoginVerifyRsp},r.LoginVerifyRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LoginVerifyRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LoginVerifyRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iResCode),t.writeInt64(1,this.lUid),t.writeString(2,this.sCookie),t.writeString(3,this.sUid),t.writeInt32(4,this.iAppId)},r.LoginVerifyRsp.prototype.readFrom=function(t){this.iResCode=t.readInt32(0,!1,this.iResCode),this.lUid=t.readInt64(1,!1,this.lUid),this.sCookie=t.readString(2,!1,this.sCookie),this.sUid=t.readString(3,!1,this.sUid),this.iAppId=t.readInt32(4,!1,this.iAppId)},r.RefreshCookieReq=function(){this.tId=new r.MediaUserId,this.iCookieDeadTime=0},r.RefreshCookieReq.prototype._clone=function(){return new r.RefreshCookieReq},r.RefreshCookieReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RefreshCookieReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RefreshCookieReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt32(1,this.iCookieDeadTime)},r.RefreshCookieReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.iCookieDeadTime=t.readInt32(1,!1,this.iCookieDeadTime)},r.RefreshCookieRsp=function(){this.iResCode=0,this.sCookie=""},r.RefreshCookieRsp.prototype._clone=function(){return new r.RefreshCookieRsp},r.RefreshCookieRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RefreshCookieRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RefreshCookieRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iResCode),t.writeString(1,this.sCookie)},r.RefreshCookieRsp.prototype.readFrom=function(t){this.iResCode=t.readInt32(0,!1,this.iResCode),this.sCookie=t.readString(1,!1,this.sCookie)},r.MediaStreamInfo=function(){this.sCdnName="",this.sStreamName="",this.sFlvUrl="",this.sFlvSuffix="",this.sHlsUrl="",this.sHlsSuffix="",this.iLineIndex=0,this.vFlvIPList=new s.Vector(new s.STRING),this.iIsP2PSupport=0,this.sP2pUrl="",this.sP2pSuffix="",this.lFreeFlag=0,this.iIsHEVCSupport=0,this.vP2pIPList=new s.Vector(new s.STRING),this.iPCPriorityRate=0,this.iWebPriorityRate=0,this.iMobilePriorityRate=0,this.sAdditionalParam="",this.mMediaStreamFormatInfo=new s.Map(new s.STRING,new r.MediaStreamFormatInfo)},r.MediaStreamInfo.prototype._clone=function(){return new r.MediaStreamInfo}
1,r.MediaStreamInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamInfo.prototype.writeTo=function(t){t.writeString(0,this.sCdnName),t.writeString(1,this.sStreamName),t.writeString(2,this.sFlvUrl),t.writeString(3,this.sFlvSuffix),t.writeString(4,this.sHlsUrl),t.writeString(5,this.sHlsSuffix),t.writeInt32(6,this.iLineIndex),t.writeVector(7,this.vFlvIPList),t.writeInt32(8,this.iIsP2PSupport),t.writeString(9,this.sP2pUrl),t.writeString(10,this.sP2pSuffix),t.writeInt64(11,this.lFreeFlag),t.writeInt32(12,this.iIsHEVCSupport),t.writeVector(13,this.vP2pIPList),t.writeInt32(14,this.iPCPriorityRate),t.writeInt32(15,this.iWebPriorityRate),t.writeInt32(16,this.iMobilePriorityRate),t.writeString(17,this.sAdditionalParam),t.writeMap(18,this.mMediaStreamFormatInfo)},r.MediaStreamInfo.prototype.readFrom=function(t){this.sCdnName=t.readString(0,!1,this.sCdnName),this.sStreamName=t.readString(1,!1,this.sStreamName),this.sFlvUrl=t.readString(2,!1,this.sFlvUrl),this.sFlvSuffix=t.readString(3,!1,this.sFlvSuffix),this.sHlsUrl=t.readString(4,!1,this.sHlsUrl),this.sHlsSuffix=t.readString(5,!1,this.sHlsSuffix),this.iLineIndex=t.readInt32(6,!1,this.iLineIndex),this.vFlvIPList=t.readVector(7,!1,this.vFlvIPList),this.iIsP2PSupport=t.readInt32(8,!1,this.iIsP2PSupport),this.sP2pUrl=t.readString(9,!1,this.sP2pUrl),this.sP2pSuffix=t.readString(10,!1,this.sP2pSuffix),this.lFreeFlag=t.readInt64(11,!1,this.lFreeFlag),this.iIsHEVCSupport=t.readInt32(12,!1,this.iIsHEVCSupport),this.vP2pIPList=t.readVector(13,!1,this.vP2pIPList),this.iPCPriorityRate=t.readInt32(14,!1,this.iPCPriorityRate),this.iWebPriorityRate=t.readInt32(15,!1,this.iWebPriorityRate),this.iMobilePriorityRate=t.readInt32(16,!1,this.iMobilePriorityRate),this.sAdditionalParam=t.readString(17,!1,this.sAdditionalParam),this.mMediaStreamFormatInfo=t.readMap(18,!1,this.mMediaStreamFormatInfo)},r.QuitMediaGroupReq=function(){this.tId=new r.MediaUserId,this.vGroupId=new s.Vector(new s.STRING),this.iGroupType=0,this.sRoomId=""},r.QuitMediaGroupReq.prototype._clone=function(){return new r.QuitMediaGroupReq},r.QuitMediaGroupReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.QuitMediaGroupReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.QuitMediaGroupReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeVector(1,this.vGroupId),t.writeInt32(2,this.iGroupType),t.writeString(3,this.sRoomId)},r.QuitMediaGroupReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.vGroupId=t.readVector(1,!1,this.vGroupId),this.iGroupType=t.readInt32(2,!1,this.iGroupType),this.sRoomId=t.readString(3,!1,this.sRoomId)},r.QuitMediaGroupRsp=function(){this.iCode=0,this.sMsg="",this.vGroupId=new s.Vector(new s.STRING),this.iGroupType=0,this.sRoomId=""},r.QuitMediaGroupRsp.prototype._clone=function(){return new r.QuitMediaGroupRsp},r.QuitMediaGroupRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.QuitMediaGroupRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.QuitMediaGroupRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iCode),t.writeString(1,this.sMsg),t.writeVector(2,this.vGroupId),t.writeInt32(3,this.iGroupType),t.writeString(4,this.sRoomId)},r.QuitMediaGroupRsp.prototype.readFrom=function(t){this.iCode=t.readInt32(0,!1,this.iCode),this.sMsg=t.readString(1,!1,this.sMsg),this.vGroupId=t.readVector(2,!1,this.vGroupId),this.iGroupType=t.readInt32(3,!1,this.iGroupType),this.sRoomId=t.readString(4,!1,this.sRoomId)},r.GetStreamInfoByRoomReq=function(){this.tId=new r.MediaUserId,this.sRoomId="",this.iMediaPackType=0,this.iLoopTime=0,this.iType=0,this.sArea="",this.mBusiParams=new s.Map(new s.STRING,new s.STRING),this.iVGroupType=0},r.GetStreamInfoByRoomReq.prototype._clone=function(){return new r.GetStreamInfoByRoomReq},r.GetStreamInfoByRoomReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetStreamInfoByRoomReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetStreamInfoByRoomReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sRoomId),t.writeInt32(2,this.iMediaPackType),t.writeInt32(3,this.iLoopTime),t.writeInt32(4,this.iType),t.writeString(5,this.sArea),t.writeMap(6,this.mBusiParams),t.writeInt32(7,this.iVGroupType)},r.GetStreamInfoByRoomReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,
1!1,this.tId),this.sRoomId=t.readString(1,!1,this.sRoomId),this.iMediaPackType=t.readInt32(2,!1,this.iMediaPackType),this.iLoopTime=t.readInt32(3,!1,this.iLoopTime),this.iType=t.readInt32(4,!1,this.iType),this.sArea=t.readString(5,!1,this.sArea),this.mBusiParams=t.readMap(6,!1,this.mBusiParams),this.iVGroupType=t.readInt32(7,!1,this.iVGroupType)},r.GetStreamInfoByRoomRsp=function(){this.tStreamInfoPack=new r.MediaStreamInfoPack,this.sRoomId="",this.sRoomGroupId="",this.lModifyTime=0,this.tABInfo=new r.McABTestInfo,this.lLiveId=0,this.lAnchorUid=0},r.GetStreamInfoByRoomRsp.prototype._clone=function(){return new r.GetStreamInfoByRoomRsp},r.GetStreamInfoByRoomRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetStreamInfoByRoomRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetStreamInfoByRoomRsp.prototype.writeTo=function(t){t.writeStruct(0,this.tStreamInfoPack),t.writeString(1,this.sRoomId),t.writeString(2,this.sRoomGroupId),t.writeInt64(3,this.lModifyTime),t.writeStruct(4,this.tABInfo),t.writeInt64(5,this.lLiveId),t.writeInt64(6,this.lAnchorUid)},r.GetStreamInfoByRoomRsp.prototype.readFrom=function(t){this.tStreamInfoPack=t.readStruct(0,!1,this.tStreamInfoPack),this.sRoomId=t.readString(1,!1,this.sRoomId),this.sRoomGroupId=t.readString(2,!1,this.sRoomGroupId),this.lModifyTime=t.readInt64(3,!1,this.lModifyTime),this.tABInfo=t.readStruct(4,!1,this.tABInfo),this.lLiveId=t.readInt64(5,!1,this.lLiveId),this.lAnchorUid=t.readInt64(6,!1,this.lAnchorUid)},r.MediaStreamInfoPack=function(){this.mMediaStreamInfoPack=new s.Map(new s.STRING,new r.MediaStreamNameInfoPack)},r.MediaStreamInfoPack.prototype._clone=function(){return new r.MediaStreamInfoPack},r.MediaStreamInfoPack.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamInfoPack.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamInfoPack.prototype.writeTo=function(t){t.writeMap(0,this.mMediaStreamInfoPack)},r.MediaStreamInfoPack.prototype.readFrom=function(t){this.mMediaStreamInfoPack=t.readMap(0,!1,this.mMediaStreamInfoPack)},r.MediaStreamNameInfoPack=function(){this.vMediaStreamInfo=new s.Vector(new r.MediaStreamInfo),this.vStreamGearInfo=new s.Vector(new r.StreamGearInfo),this.sStreamGroupId="",this.lLiveCompatibleFlag=0,this.sAntiCode="",this.lStreamId=0,this.lUid=0,this.iStreamProperty=0,this.iBitRate=0,this.iStreamType=0,this.iPcDefaultBitRate=0,this.iWebDefaultBitRate=0,this.iMobileDefaultBitRate=0,this.sStreamBusiProperty="",this.sAdditionalParam="",this.iStreamCategory=0,this.iAppId=0,this.lNotifySeq=0},r.MediaStreamNameInfoPack.prototype._clone=function(){return new r.MediaStreamNameInfoPack},r.MediaStreamNameInfoPack.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamNameInfoPack.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamNameInfoPack.prototype.writeTo=function(t){t.writeVector(0,this.vMediaStreamInfo),t.writeVector(1,this.vStreamGearInfo),t.writeString(2,this.sStreamGroupId),t.writeInt64(3,this.lLiveCompatibleFlag),t.writeString(4,this.sAntiCode),t.writeInt64(5,this.lStreamId),t.writeInt64(6,this.lUid),t.writeInt32(7,this.iStreamProperty),t.writeInt32(8,this.iBitRate),t.writeInt32(9,this.iStreamType),t.writeInt32(10,this.iPcDefaultBitRate),t.writeInt32(11,this.iWebDefaultBitRate),t.writeInt32(12,this.iMobileDefaultBitRate),t.writeString(13,this.sStreamBusiProperty),t.writeString(14,this.sAdditionalParam),t.writeInt32(15,this.iStreamCategory),t.writeInt32(16,this.iAppId),t.writeInt64(17,this.lNotifySeq)},r.MediaStreamNameInfoPack.prototype.readFrom=function(t){this.vMediaStreamInfo=t.readVector(0,!1,this.vMediaStreamInfo),this.vStreamGearInfo=t.readVector(1,!1,this.vStreamGearInfo),this.sStreamGroupId=t.readString(2,!1,this.sStreamGroupId),this.lLiveCompatibleFlag=t.readInt64(3,!1,this.lLiveCompatibleFlag),this.sAntiCode=t.readString(4,!1,this.sAntiCode),this.lStreamId=t.readInt64(5,!1,this.lStreamId),this.lUid=t.readInt64(6,!1,this.lUid),this.iStreamProperty=t.readInt32(7,!1,this.iStreamProperty),this.iBitRate=t.readInt32(8,!1,this.iBitRate),this.iStreamType=t.readInt32(9,!1,this.iStreamType),this.iPcDefaultBitRate=t.readInt32(10,!1,this.iPcDefaultBitRate),this.iWebDefaultBitRate=t.readInt32(11,!1,this.iWebDefaultBitRate),this.iMobileDefaultBitRate=t.readInt32(12,!1,this.iMobileDefaultBitRate),this.sStreamBusiProperty=t.readString(13,!1,this.sStreamBusiProperty),this.sAdditionalParam=t.readString(14,!1,this.sAdditionalParam),this.iStreamCategory=t.readInt32(15,!1,this.iStreamCategory),this.iAppId=t.readInt32(16,!1,this.iAppId),this.lNotifySeq=t.readInt64(17,!1,this.lNotifySeq)},r.StreamGearInfo=function(){this.sDisplayName="",this.iBitRate=0,this.iCodecType=0,this.iHEVCBitRate=-1,this.tResolution=new r.MediaResolution,this.sAdditionalParam="",this.mSupportFormat=new s.Map(new s.STRING,new s.INT64),this.sBusiGearIndex=""},r.StreamGearInfo.prototype._clone=function(){return new r.StreamGearInfo}
1,r.StreamGearInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.StreamGearInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.StreamGearInfo.prototype.writeTo=function(t){t.writeString(0,this.sDisplayName),t.writeInt32(1,this.iBitRate),t.writeInt32(2,this.iCodecType),t.writeInt32(3,this.iHEVCBitRate),t.writeStruct(4,this.tResolution),t.writeString(5,this.sAdditionalParam),t.writeMap(6,this.mSupportFormat),t.writeString(7,this.sBusiGearIndex)},r.StreamGearInfo.prototype.readFrom=function(t){this.sDisplayName=t.readString(0,!1,this.sDisplayName),this.iBitRate=t.readInt32(1,!1,this.iBitRate),this.iCodecType=t.readInt32(2,!1,this.iCodecType),this.iHEVCBitRate=t.readInt32(3,!1,this.iHEVCBitRate),this.tResolution=t.readStruct(4,!1,this.tResolution),this.sAdditionalParam=t.readString(5,!1,this.sAdditionalParam),this.mSupportFormat=t.readMap(6,!1,this.mSupportFormat),this.sBusiGearIndex=t.readString(7,!1,this.sBusiGearIndex)},r.MediaResolution=function(){this.iWidth=0,this.iHeight=0},r.MediaResolution.prototype._clone=function(){return new r.MediaResolution},r.MediaResolution.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaResolution.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaResolution.prototype.writeTo=function(t){t.writeInt32(0,this.iWidth),t.writeInt32(1,this.iHeight)},r.MediaResolution.prototype.readFrom=function(t){this.iWidth=t.readInt32(0,!1,this.iWidth),this.iHeight=t.readInt32(1,!1,this.iHeight)},r.EMediaStreamType={EMST_UNKNOWN:-1,EMST_WS_RTMP:1,EMST_AL_RTMP:3,EMST_HUYA_UDP:5,EMST_TX_RTMP:6,EMST_JS_RTMP:8,EMST_HUYA_RTMP:15,EMST_HW_RTMP:16,EMST_BD_RTMP:17,EMST_WS2_RTMP:18,EMST_SW_UDP:20,EMST_ZG_UDP:21,EMST_HWVR_RTMP:22},r.EMediaStreamProperty={EOriginalStream:1,EMixStream:2,ECommStream:3},r.McABTestInfo=function(){this.mConfig=new s.Map(new s.STRING,new s.STRING),this.sOexp=""},r.McABTestInfo.prototype._clone=function(){return new r.McABTestInfo},r.McABTestInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.McABTestInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.McABTestInfo.prototype.writeTo=function(t){t.writeMap(0,this.mConfig),t.writeString(1,this.sOexp)},r.McABTestInfo.prototype.readFrom=function(t){this.mConfig=t.readMap(0,!1,this.mConfig),this.sOexp=t.readString(1,!1,this.sOexp)},r.GetStreamInfoByRoomFakeReq=function(){this.tId=new r.MediaUserId,this.sRoomId="",this.mpVariable=new s.Map(new s.STRING,new s.STRING),this.iMediaPackType=-1,this.mBusiParams=new s.Map(new s.STRING,new s.STRING),this.iLoopTime=0},r.GetStreamInfoByRoomFakeReq.prototype._clone=function(){return new r.GetStreamInfoByRoomFakeReq},r.GetStreamInfoByRoomFakeReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetStreamInfoByRoomFakeReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetStreamInfoByRoomFakeReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sRoomId),t.writeMap(2,this.mpVariable),t.writeInt32(3,this.iMediaPackType),t.writeMap(4,this.mBusiParams),t.writeInt32(5,this.iLoopTime)},r.GetStreamInfoByRoomFakeReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.sRoomId=t.readString(1,!1,this.sRoomId),this.mpVariable=t.readMap(2,!1,this.mpVariable),this.iMediaPackType=t.readInt32(3,!1,this.iMediaPackType),this.mBusiParams=t.readMap(4,!1,this.mBusiParams),this.iLoopTime=t.readInt32(5,!1,this.iLoopTime)},r.GetStreamInfoByRoomFakeRsp=function(){this.tStreamInfoPack=new r.MediaStreamInfoPack,this.mpConfig=new s.Map(new s.STRING,new s.STRING),this.sRoomId="",this.lAnchorUid=0},r.GetStreamInfoByRoomFakeRsp.prototype._clone=function(){return new r.GetStreamInfoByRoomFakeRsp},r.GetStreamInfoByRoomFakeRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetStreamInfoByRoomFakeRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetStreamInfoByRoomFakeRsp.prototype.writeTo=function(t){t.writeStruct(0,this.tStreamInfoPack),t.writeMap(1,this.mpConfig),t.writeString(2,this.sRoomId),t.writeInt64(3,this.lAnchorUid)},r.GetStreamInfoByRoomFakeRsp.prototype.readFrom=function(t){this.tStreamInfoPack=t.readStruct(0,
1!1,this.tStreamInfoPack),this.mpConfig=t.readMap(1,!1,this.mpConfig),this.sRoomId=t.readString(2,!1,this.sRoomId),this.lAnchorUid=t.readInt64(3,!1,this.lAnchorUid)},r.MediaStreamFormatInfo=function(){this.sFormatName="",this.sUrl="",this.sSuffix="",this.vIPList=new s.Vector(new s.STRING),this.iIsSupport=0,this.iRate=0,this.sAdditionalParam="",this.lFormatPropertyFlag=0},r.MediaStreamFormatInfo.prototype._clone=function(){return new r.MediaStreamFormatInfo},r.MediaStreamFormatInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamFormatInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamFormatInfo.prototype.writeTo=function(t){t.writeString(0,this.sFormatName),t.writeString(1,this.sUrl),t.writeString(2,this.sSuffix),t.writeVector(3,this.vIPList),t.writeInt32(4,this.iIsSupport),t.writeInt32(5,this.iRate),t.writeString(6,this.sAdditionalParam),t.writeInt64(7,this.lFormatPropertyFlag)},r.MediaStreamFormatInfo.prototype.readFrom=function(t){this.sFormatName=t.readString(0,!1,this.sFormatName),this.sUrl=t.readString(1,!1,this.sUrl),this.sSuffix=t.readString(2,!1,this.sSuffix),this.vIPList=t.readVector(3,!1,this.vIPList),this.iIsSupport=t.readInt32(4,!1,this.iIsSupport),this.iRate=t.readInt32(5,!1,this.iRate),this.sAdditionalParam=t.readString(6,!1,this.sAdditionalParam),this.lFormatPropertyFlag=t.readInt64(7,!1,this.lFormatPropertyFlag)},r.StreamChangeNotice=function(){this.tStreamPack=new r.MediaStreamInfoPack,this.sRoomId="",this.lNotifySeq=0},r.StreamChangeNotice.prototype._clone=function(){return new r.StreamChangeNotice},r.StreamChangeNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.StreamChangeNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.StreamChangeNotice.prototype.writeTo=function(t){t.writeStruct(0,this.tStreamPack),t.writeString(1,this.sRoomId),t.writeInt64(2,this.lNotifySeq)},r.StreamChangeNotice.prototype.readFrom=function(t){this.tStreamPack=t.readStruct(0,!1,this.tStreamPack),this.sRoomId=t.readString(1,!1,this.sRoomId),this.lNotifySeq=t.readInt64(2,!1,this.lNotifySeq)},r.RoomStreamChangeNotic=function(){this.sRoomId="",this.sSeq="",this.iDelay=0},r.RoomStreamChangeNotic.prototype._clone=function(){return new r.RoomStreamChangeNotic},r.RoomStreamChangeNotic.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RoomStreamChangeNotic.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RoomStreamChangeNotic.prototype.writeTo=function(t){t.writeString(0,this.sRoomId),t.writeString(1,this.sSeq),t.writeInt32(2,this.iDelay)},r.RoomStreamChangeNotic.prototype.readFrom=function(t){this.sRoomId=t.readString(0,!1,this.sRoomId),this.sSeq=t.readString(1,!1,this.sSeq),this.iDelay=t.readInt32(2,!1,this.iDelay)},r.MediaChangeUpStreamNotic=function(){this.iStreamtype=0,this.sUpUrl="",this.vIps=new s.Vector(new s.STRING)},r.MediaChangeUpStreamNotic.prototype._clone=function(){return new r.MediaChangeUpStreamNotic},r.MediaChangeUpStreamNotic.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaChangeUpStreamNotic.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaChangeUpStreamNotic.prototype.writeTo=function(t){t.writeInt32(0,this.iStreamtype),t.writeString(1,this.sUpUrl),t.writeVector(2,this.vIps)},r.MediaChangeUpStreamNotic.prototype.readFrom=function(t){this.iStreamtype=t.readInt32(0,!1,this.iStreamtype),this.sUpUrl=t.readString(1,!1,this.sUpUrl),this.vIps=t.readVector(2,!1,this.vIps)},r.MediaStopStreamNotice=function(){this.iAppId=0,this.lSequence=0,this.sStreamName="",this.sReason="",this.iReason=0,this.iFlag=0},r.MediaStopStreamNotice.prototype._clone=function(){return new r.MediaStopStreamNotice},r.MediaStopStreamNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStopStreamNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStopStreamNotice.prototype.writeTo=function(t){t.writeInt32(0,this.iAppId),t.writeInt64(1,this.lSequence),t.writeString(2,this.sStreamName),t.writeString(3,this.sReason),t.writeInt32(4,this.iReason),t.writeInt32(5,this.iFlag)},r.MediaStopStreamNotice.prototype.readFrom=function(t){this.iAppId=t.readInt32(0,!1,this.iAppId),this.lSequence=t.readInt64(1,!1,this.lSequence),this.sStreamName=t.readString(2,!1,this.sStreamName),this.sReason=t.readString(3,!1,this.sReason),this.iReason=t.readInt32(4,!1,this.iReason),this.iFlag=t.readInt32(5,!1,this.iFlag)},r.GetMediaConfigReq=function(){this.tId=new r.MediaUserId,this.mpVariable=new s.Map(new s.STRING,new s.STRING)},r.GetMediaConfigReq.prototype._clone=function(){return new r.GetMediaConfigReq}
1,r.GetMediaConfigReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetMediaConfigReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetMediaConfigReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeMap(1,this.mpVariable)},r.GetMediaConfigReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.mpVariable=t.readMap(1,!1,this.mpVariable)},r.GetMediaConfigRsp=function(){this.mpConfig=new s.Map(new s.STRING,new s.STRING)},r.GetMediaConfigRsp.prototype._clone=function(){return new r.GetMediaConfigRsp},r.GetMediaConfigRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetMediaConfigRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetMediaConfigRsp.prototype.writeTo=function(t){t.writeMap(0,this.mpConfig)},r.GetMediaConfigRsp.prototype.readFrom=function(t){this.mpConfig=t.readMap(0,!1,this.mpConfig)},r.GetAntiCodeForStreamReq=function(){this.tId=new r.MediaUserId,this.sStreamName=""},r.GetAntiCodeForStreamReq.prototype._clone=function(){return new r.GetAntiCodeForStreamReq},r.GetAntiCodeForStreamReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetAntiCodeForStreamReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetAntiCodeForStreamReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sStreamName)},r.GetAntiCodeForStreamReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.sStreamName=t.readString(1,!1,this.sStreamName)},r.GetAntiCodeForStreamRsp=function(){this.sAntiCode="",this.sStreamName=""},r.GetAntiCodeForStreamRsp.prototype._clone=function(){return new r.GetAntiCodeForStreamRsp},r.GetAntiCodeForStreamRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetAntiCodeForStreamRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetAntiCodeForStreamRsp.prototype.writeTo=function(t){t.writeString(0,this.sAntiCode),t.writeString(1,this.sStreamName)},r.GetAntiCodeForStreamRsp.prototype.readFrom=function(t){this.sAntiCode=t.readString(0,!1,this.sAntiCode),this.sStreamName=t.readString(1,!1,this.sStreamName)}},function(t,e){t.exports=!0},function(t,e){var i=0,s=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+s).toString(36))}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){var s=i(20);t.exports=function(t){return Object(s(t))}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var s=i(22)("keys"),r=i(17);t.exports=function(t){return s[t]||(s[t]=r(t))}},function(t,e,i){var s=i(0),r=i(1),a=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:s.version,mode:i(16)?"pure":"global",copyright:"\xa9 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e,i){var s=i(9);t.exports=function(t,e){var i,r;if(!s(t))return t;if(e&&"function"==typeof(i=t.toString)&&!s(r=i.call(t))||"function"==typeof(i=t.valueOf)&&!s(r=i.call(t))||!e&&"function"==typeof(i=t.toString)&&!s(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e){var i=Math.ceil,s=Math.floor;t.exports=function(t){return isNaN(t*=1)?0:(t>0?s:i)(t)}},function(t,e){t.exports={}},function(t,e,i){var s=i(12),r=i(69),a=i(28),n=i(21)("IE_PROTO"),o=function(){},u=function(){var t,e=i(38)("iframe"),s=a.length;for(e.style.display="none",i(74).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;s--;)delete u.prototype[a[s]];return u()};t.exports=_.default||function(t,e){var i;return null!==t?(o.prototype=s(t),i=new o,o.prototype=null,i[n]=t):i=u(),void 0===e?i:r(i,e)}},function(t,e,i){var s=i(42),r=i(28);t.exports=m.default||function(t){return s(t,r)}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,e,i){var s=i(5).f,r=i(3),a=i(11)("toStringTag");
1t.exports=function(t,e,i){t&&!r(t=i?t:t.prototype,a)&&s(t,a,{configurable:!0,value:e})}},function(t,e,i){e.f=i(11)},function(t,e,i){var s=i(1),r=i(0),a=i(16),n=i(30),o=i(5).f;t.exports=function(t){var e=r.Symbol||(r.Symbol=a?{}:s.Symbol||{});"_"==t.charAt(0)||t in e||o(e,t,{value:n.f(t)})}},function(t,e){e.f=({}).propertyIsEnumerable},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=y(i(34)),r=y(i(55)),a=y(i(2)),n=y(i(7)),o=y(i(63)),u=y(i(89)),l=y(i(15)),d=y(i(14)),c=y(i(97)),f=y(i(47)),p=y(i(48)),m=y(i(49)),_=y(i(50));function y(t){return t&&t.__esModule?t:{default:t}}var v={"web_magics-audi_test":173,"web_magics-audi":174};e.default=new(function(t){function e(){(0,a.default)(this,e);var t=(0,o.default)(this,(e.__proto__||(0,r.default)(e)).call(this));return t.isLogin=!1,t.config=null,t.appId=0,t.sHuYaUA="media_"+_.default[1]+"&2504031618&sea",t.mediaUid=Math.floor(1e5*Math.random()+0x3b9ac9ff),t.sUid="",t.sToken="",t.sCookie="",t.deviceId="",t.bAnonymous=0,t.netType=t.getNetType(),t.mediaUserId=new l.default.MediaUserId,t._loginFailCnt=0,t._refreshCookieReq=new l.default.RefreshCookieReq,t._refreshCookieTs=0,t._onLoginMediaBind=t._onLoginMedia.bind(t),t._onRefreshCookieBind=t._onRefreshCookie.bind(t),t._onGetMediaCofigBind=t._onGetMediaCofig.bind(t),t.Events={LOGIN_SUC:"LOGIN_SUC",ON_GET_CONFIG:"ON_GET_CONFIG",LOGIN_INVALID:"LOGIN_INVALID"},t.PlayerClass=null,t.anonymousuid=0,t}return(0,u.default)(e,t),(0,n.default)(e,[{key:"isSupported",value:function(){return 1!=Number(localStorage._closeMse)&&window.HYPlayer&&window.HYPlayer.isSupported()}},{key:"getMediaUserId",value:function(){return this.mediaUserId.lUid=0==this.mediaUid?this.anonymousuid:this.mediaUid,this.mediaUserId.sGuid=this.deviceId,this.mediaUserId.sToken=this.sToken,this.mediaUserId.sUA=this.sHuYaUA,this.mediaUserId.sCookie=this.sCookie,this.mediaUserId.iAppid=this.appId,this.mediaUserId.bAnonymous=this.bAnonymous,this.mediaUserId.sStrUid=this.sUid,this.mediaUserId.sUAppId=this.appId,this.mediaUserId.iNetType=this.netType,this.mediaUserId}},{key:"setAppId",value:function(t){v.hasOwnProperty(t)?this.appId=v[t]:this.appId=Number(t)||81}},{key:"setProperties",value:function(t){t.hasOwnProperty("deviceId")&&(this.deviceId=t.deviceId)}},{key:"createPlayer",value:function(t){return new this.PlayerClass(t)}},{key:"loginMedia",value:function(t){t.hasOwnProperty("sToken")&&(this.sToken=t.sToken),t.hasOwnProperty("uid")&&(this.mediaUid=t.uid,this.sUid=t.uid),this.isLogin||this._loginMedia()}},{key:"_loginMedia",value:function(){var t=new l.default.LoginVerifyReq;t.tId=this.getMediaUserId(),d.default.logger.log("Main._loginMedia "+(0,s.default)(t)),d.default.Signal.sendWup(f.default.MEDIAUISEA,f.default.LOGIN_VERIFY,t,this._onLoginMediaBind)}},{key:"_onLoginMedia",value:function(t){d.default.logger.log("Main._onLoginMedia rsp="+(0,s.default)(t)),0===t.iResCode?(this.isLogin=!0,this.sCookie=t.sCookie,d.default.Timer.add(this._refreshCookie,this,1e3),this._getMediaConfig(),this.trigger(this.Events.LOGIN_SUC)):(this._loginFailCnt++,this._loginFailCnt<5?d.default.Timer.once(this._loginMedia,this,5e3):this.trigger(this.Events.LOGIN_INVALID))}},{key:"_getMediaConfig",value:function(){var t=new l.default.GetMediaConfigReq;t.tId=this.getMediaUserId(),d.default.Signal.sendWup(f.default.MEDIAUISEA,f.default.GET_MEDIA_CONFIG,t,this._onGetMediaCofigBind)}},{key:"_onGetMediaCofig",value:function(t){var e=t.mpConfig.value;if(1==localStorage._closeCfgH265&&e&&e.hasOwnProperty("nimoConfig")){var i=JSON.parse(e.nimoConfig);i.isConfigSupportH265=0,e.nimoConfig=(0,s.default)(i)}if(this.config=e,e&&e.hasOwnProperty("nimoConfig"))try{var r=JSON.parse(e.nimoConfig);m.default.setConfig(r),p.default.setConfig(r)}catch(t){d.default.logger.log("get config error")}this.trigger(this.Events.ON_GET_CONFIG)}},{key:"_refreshCookie",value:function(t,e){this.isLogin&&(0===this._refreshCookieTs?this._refreshCookieTs=t:t-this._refreshCookieTs>6e4&&(this._refreshCookieTs=t,this._refreshCookieReq.tId=this.getMediaUserId(),d.default.logger.log("Main._refreshCookie "+(0,s.default)(this._refreshCookieReq)),d.default.Signal.sendWup(f.default.MEDIAUISEA,f.default.REFRESH_COOKIE,this._refreshCookieReq,this._onRefreshCookieBind)))}},{key:"_onRefreshCookie",value:function(t){d.default.logger.log("Main._onRefreshCookie old="+this.sCookie+" "+(0,s.default)(t)),0!==t.bcode||0!==t.sdkcode||0!==t.iResCode?(
1d.default.logger.log("Main._onRefreshCookie error retry loginMedia"),this.isLogin=!1,this.sCookie="",this.mediaUserId.sCookie="",this.trigger(this.Events.LOGIN_INVALID)):(this.sCookie=t.sCookie,this.mediaUserId.sCookie=t.sCookie)}},{key:"getNetType",value:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(t){if(t.effectiveType){if("4g"===t.effectiveType)return l.default.EMediaNetType.ENET_4G;if("3g"===t.effectiveType)return l.default.EMediaNetType.ENET_3G;if("2g"===t.effectiveType||"slow-2g"===t.effectiveType)return l.default.EMediaNetType.ENET_2G}else if(t.type&&"wifi"===t.type)return l.default.EMediaNetType.ENET_WIFI}return l.default.EMediaNetType.ENET_UNKNOWN}}]),e}(c.default))},function(t,e,i){t.exports={default:i(54),__esModule:!0}},function(t,e,i){var s=i(3),r=i(19),a=i(21)("IE_PROTO"),n=Object.prototype;t.exports=p.default||function(t){return s(t=r(t),a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?n:null}},function(t,e,i){var s=i(59);t.exports=function(t,e,i){if(s(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,s){return t.call(e,i,s)};case 3:return function(i,s,r){return t.call(e,i,s,r)}}return function(){return t.apply(e,arguments)}}},function(t,e,i){t.exports=!i(6)&&!i(13)(function(){return 7!=Object.defineProperty(i(38)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(9),r=i(1).document,a=s(r)&&s(r.createElement);t.exports=function(t){return a?r.createElement(t):{}}},function(t,e,i){e.__esModule=!0;var s=n(i(64)),r=n(i(79)),a="function"==typeof r.default&&"symbol"==(0,g.default)(s.default)?function(t){return void 0===t?"undefined":(0,g.default)(t)}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":void 0===t?"undefined":(0,g.default)(t)};function n(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof r.default&&"symbol"===a(s.default)?function(t){return void 0===t?"undefined":a(t)}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":void 0===t?"undefined":a(t)}},function(t,e,i){var s=i(16),r=i(4),a=i(41),n=i(8),o=i(25),u=i(68),l=i(29),d=i(35),c=i(11)("iterator"),f=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,e,i,m,_,y,v){u(i,e,m);var S,g,T,P=function(t){if(!f&&t in k)return k[t];switch(t){case"keys":case"values":return function(){return new i(this,t)}}return function(){return new i(this,t)}},C=e+" Iterator",E="values"==_,I=!1,k=t.prototype,A=k[c]||k["@@iterator"]||_&&k[_],R=A||P(_),D=_?E?P("entries"):R:void 0,O="Array"==e&&k.entries||A;if(O&&(T=d(O.call(new t)))!==Object.prototype&&T.next&&(l(T,C,!0),s||"function"==typeof T[c]||n(T,c,p)),E&&A&&"values"!==A.name&&(I=!0,R=function(){return A.call(this)}),(!s||v)&&(f||I||!k[c])&&n(k,c,R),o[e]=R,o[C]=p,_)if(S={values:E?R:P("values"),keys:y?R:P("keys"),entries:D},v)for(g in S)g in k||a(k,g,S[g]);else r(r.P+r.F*(f||I),e,S);return S}},function(t,e,i){t.exports=i(8)},function(t,e,i){var s=i(3),r=i(10),a=i(71)(!1),n=i(21)("IE_PROTO");t.exports=function(t,e){var i,o=r(t),u=0,l=[];for(i in o)i!=n&&s(o,i)&&l.push(i);for(;e.length>u;)s(o,i=e[u++])&&(~a(l,i)||l.push(i));return l}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){e.f=f.default},function(t,e,i){var s=i(42),r=i(28).concat("length","prototype");e.f=c.default||function(t){return s(t,r)}},function(t,e,i){var s=i(32),r=i(18),a=i(10),n=i(23),o=i(3),u=i(37),l=d.default;e.f=i(6)?l:function(t,e){if(t=a(t),e=n(e,!0),u)try{return l(t,e)}catch(t){}if(o(t,e))return r(!s.f.call(t,e),t[e])}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s,r=(s=i(2))&&s.__esModule?s:{default:s},a=function t(){(0,r.default)(this,t)};a.MEDIAUISEA="mediauisea",a.GET_MEDIA_CONFIG="getMediaConfig",a.GET_INFO_FROM_VGM="getInfoFromVGM",a.CHECK_ID_BY_STR="checkIdByStr",a.LOGIN_VERIFY="loginVerify",a.REFRESH_COOKIE="refreshCookie",a.JOIN_GROUP="joinGroup",a.QUIT_GROUP="quitGroup",a.GET_STREAM_INFO_BY_ROOM="getStreamInfoByRoom",a.GET_STREAM_INFO_BY_STREAMNAME="getStreamInfoByStreamName",a.GET_STREAM_INFO_BY_ROOM_FAKE="getStreamInfoByRoomFake",e.default=a}
1,function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(34)),r=n(i(2)),a=n(i(7));function n(t){return t&&t.__esModule?t:{default:t}}var o="ctrlConfig";e.default=new(function(){function t(){(0,r.default)(this,t),this._localKey="_"+o,this._config={},this._initLocalConfig(),this.CTRL_KEY={SWITCH_PLAY:"switchPlay",SWITCH_LEVEL:"switchLevel",ANTICODE:"anticode",OPEN_SDK_STREAM:"openSdkStream"}}return(0,a.default)(t,[{key:"_initLocalConfig",value:function(){localStorage.hasOwnProperty(this._localKey)?this._config=JSON.parse(localStorage.getItem(this._localKey)):this._config={}}},{key:"setConfig",value:function(t){t&&t.hasOwnProperty(o)?(this._config=t[o],localStorage.setItem(this._localKey,(0,s.default)(this._config))):(this._config={},localStorage.removeItem(this._localKey))}},{key:"isOpen",value:function(t,e){if(this._config.hasOwnProperty(e)){var i=this._config[e];return"all"===i||-1!==i.indexOf(t+"")}return!1}}]),t}())},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(2)),r=a(i(7));function a(t){return t&&t.__esModule?t:{default:t}}e.default=new(function(){function t(){(0,s.default)(this,t),this.bitrates={6e3:"_veryhigh",2500:"_high",1e3:"_mid",500:"_low",250:"_verylow",0:""}}return(0,r.default)(t,[{key:"setConfig",value:function(t){t&&t.hasOwnProperty("testRooms")?localStorage._testRooms=t.testRooms:localStorage.removeItem("_testRooms")}},{key:"isTest",value:function(t){var e=localStorage._testRooms;return e&&-1!==e.indexOf(t.toString())}},{key:"getStreamName",value:function(t,e,i){return i&&(t+=this.bitrates[e]),t}}]),t}())},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default={1:"web",2:"wap",web:1,wap:2}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default={p2p:"video/p2p",flv:"video/flv",mp4:"video/mp4",hls:"video/hls",playback:"video/playback",f_p2p:"p2p",f_flv:"flv",f_hls:"hls",f_mp4:"mp4",isLivingFormat:function(t){return t===this.f_p2p||t===this.f_flv||t===this.f_hls}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default={VIDEO_ERROR:"VIDEO_ERROR",VIDEO_FRAME_LOADED:"VIDEO_FRAME_LOADED",VIDEO_PLAY:"VIDEO_PLAY",VIDEO_REAL_PLAY:"VIDEO_REAL_PLAY",VIDEO_STOP:"VIDEO_STOP",VIDEO_PAUSE:"VIDEO_PAUSE",VIDEO_WAITING:"VIDEO_WAITING",VIDEO_SEEK:"VIDEO_SEEK",VIDEO_ENDED:"VIDEO_ENDED",ANCHOR_STOP:"ANCHOR_STOP",PLAY_STATUS:"PLAY_STATUS",PLAY_DOWNLINK_INFO:"PLAY_DOWNLINK_INFO",PLAY_TIME:"PLAY_TIME",LINK_TIMEOUT:"LINK_TIMEOUT",LOAD_DATA_TIMEOUT:"LOAD_DATA_TIMEOUT",LINK_UNAVAILABLE:"LINK_UNAVAILABLE",NO_DATA_RECEIVED:"NO_DATA_RECEIVED",VIDEO_CLOSE:"VIDEO_CLOSE",METADATA:"METADATA",VIDEO_FRAME_JITTERBUFFER:"VIDEO_FRAME_JITTERBUFFER",AUTO_PLAY_ERR:"AUTO_PLAY_ERR",PLAY_TIMEOUT:"PLAY_TIMEOUT",SEEK_TIMEOUT:"SEEK_TIMEOUT",MEDIA_STREAMSTOP_NOTICE:"MEDIA_STREAMSTOP_NOTICE",ROOM_STREAM_CHANGE:"ROOM_STREAM_CHANGE",ROOM_NO_STREAM:"ROOM_NO_STREAM",LOGIN_INVALID:"LOGIN_INVALID",SWITCH_DONE:"SWITCH_DONE",UPDATE_INTERSITY:"UPDATE_INTERSITY",MEDIA_STREAM_UPDATE:"MEDIA_STREAM_UPDATE",MEDIA_STREAM_INFO_ERROR:"MEDIA_STREAM_INFO_ERROR",NEED_UPDATE_M3U8:"NEED_UPDATE_M3U8",PLAYBACK_M3U8_UPDATED:"PLAYBACK_M3U8_UPDATED",SEI_INFO:"SEI_INFO",AUTO_BITRATE_CHANGED:"AUTO_BITRATE_CHANGED",BROWSER_PAUSE:"BROWSER_PAUSE"}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=p(i(15)),r=p(i(33)),a=p(i(48)),n=p(i(49)),o=p(i(98)),u=p(i(14)),l=p(i(99)),d=p(i(103)),c=p(i(52)),f=p(i(51));function p(t){return t&&t.__esModule?t:{default:t}}e.default={initPrivate:function(t){u.default.init(t)},MainImpl:r.default,ConfigCtrl:a.default,StreamUrl:n.default,HUYA:s.default,TafMx:o.default,LivingInfo:l.default,Room:d.default,PlayerEvents:c.default,MediaType:f.default}},function(t,e,i){var s=i(0),r=s.JSON||(s.JSON={stringify:l.default});t.exports=function(t){return r.stringify.apply(r,arguments)}},function(t,e,i){t.exports={default:i(56),__esModule:!0}},function(t,e,i){i(57),t.exports=i(0).Object.getPrototypeOf},function(t,e,i){var s=i(19),r=i(35);i(58)("getPrototypeOf",function(){return function(t){return r(s(t))}})},function(t,e,i){var s=i(4),r=i(0),a=i(13);t.exports=function(t,e){var i=(r.Object||{})[t]||Object[t],n={};n[t]=e(i),s(s.S+s.F*a(function(){i(1)}),"Object",n)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}}
vendor: 6,674 bytes, line 1
1,function(t,e,i){t.exports={default:i(61),__esModule:!0}},function(t,e,i){i(62);var s=i(0).Object;t.exports=function(t,e,i){return s.defineProperty(t,e,i)}},function(t,e,i){var s=i(4);s(s.S+!i(6)*s.F,"Object",{defineProperty:i(5).f})},function(t,e,i){e.__esModule=!0;var s,r=(s=i(39))&&s.__esModule?s:{default:s};e.default=function(t,e){if(!t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"===(void 0===e?"undefined":(0,r.default)(e))||"function"==typeof e)?e:t}},function(t,e,i){t.exports={default:i(65),__esModule:!0}},function(t,e,i){i(66),i(75),t.exports=i(30).f("iterator")},function(t,e,i){var s=i(67)(!0);i(40)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=s(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e,i){var s=i(24),r=i(20);t.exports=function(t){return function(e,i){var a,n,o=String(r(e)),u=s(i),l=o.length;return u<0||u>=l?t?"":void 0:(a=o.charCodeAt(u))<55296||a>56319||u+1===l||(n=o.charCodeAt(u+1))<56320||n>57343?t?o.charAt(u):a:t?o.slice(u,u+2):n-56320+(a-55296<<10)+65536}}},function(t,e,i){var s=i(26),r=i(18),a=i(29),n={};i(8)(n,i(11)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=s(n,{next:r(1,i)}),a(t,e+" Iterator")}},function(t,e,i){var s=i(5),r=i(12),a=i(27);t.exports=i(6)?u.default:function(t,e){r(t);for(var i,n=a(e),o=n.length,u=0;o>u;)s.f(t,i=n[u++],e[i]);return t}},function(t,e,i){var s=i(43);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==s(t)?t.split(""):Object(t)}},function(t,e,i){var s=i(10),r=i(72),a=i(73);t.exports=function(t){return function(e,i,n){var o,u=s(e),l=r(u.length),d=a(n,l);if(t&&i!=i){for(;l>d;)if((o=u[d++])!=o)return!0}else for(;l>d;d++)if((t||d in u)&&u[d]===i)return t||d||0;return!t&&-1}}},function(t,e,i){var s=i(24),r=Math.min;t.exports=function(t){return t>0?r(s(t),0x1fffffffffffff):0}},function(t,e,i){var s=i(24),r=Math.max,a=Math.min;t.exports=function(t,e){return(t=s(t))<0?r(t+e,0):a(t,e)}},function(t,e,i){var s=i(1).document;t.exports=s&&s.documentElement},function(t,e,i){i(76);for(var s=i(1),r=i(8),a=i(25),n=i(11)("toStringTag"),o="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<o.length;u++){var l=o[u],d=s[l],c=d&&d.prototype;c&&!c[n]&&r(c,n,l),a[l]=a.Array}},function(t,e,i){var s=i(77),r=i(78),a=i(25),n=i(10);t.exports=i(40)(Array,"Array",function(t,e){this._t=n(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?i:"values"==e?t[i]:[i,t[i]])},"values"),a.Arguments=a.Array,s("keys"),s("values"),s("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,i){t.exports={default:i(80),__esModule:!0}},function(t,e,i){i(81),i(86),i(87),i(88),t.exports=i(0).Symbol},function(t,e,i){var s=i(1),r=i(3),a=i(6),n=i(4),o=i(41),u=i(82).KEY,l=i(13),d=i(22),c=i(29),f=i(17),p=i(11),m=i(30),_=i(31),y=i(83),v=i(84),S=i(12),T=i(9),P=i(19),C=i(10),E=i(23),I=i(18),k=i(26),A=i(85),R=i(46),D=i(44),O=i(5),b=i(27),w=R.f,L=O.f,F=A.f,M=s.Symbol,N=s.JSON,B=N&&N.stringify,V=p("_hidden"),U=p("toPrimitive"),x={}.propertyIsEnumerable,H=d("symbol-registry"),G=d("symbols"),W=d("op-symbols"),j=Object.prototype,Y="function"==typeof M&&!!D.f,q=s.QObject,K=!q||!q.prototype||!q.prototype.findChild,z=a&&l(function(){return 7!=k(L({},"a",{get:function(){return L(this,"a",{value:7}).a}})).a})?function(t,e,i){var s=w(j,e);s&&delete j[e],L(t,e,i),s&&t!==j&&L(j,e,s)}:L,J=function(t){var e=G[t]=k(M.prototype);return e._k=t,e},Q=Y&&"symbol"==(0,g.default)(M.iterator)?function(t){return"symbol"==(void 0===t?"undefined":(0,g.default)(t))}:function(t){return t instanceof M},X=function t(e,i,s){return e===j&&t(W,i,s),S(e),i=E(i,!0),S(s),r(G,i)?(s.enumerable?(r(e,V)&&e[V][i]&&(e[V][i]=!1),s=k(s,{enumerable:I(0,!1)})):(r(e,V)||L(e,V,I(1,{})),e[V][i]=!0),z(e,i,s)):L(e,i,s)},$=function(t,e){S(t);for(var i,s=y(e=C(e)),r=0,a=s.length;a>r;)X(t,i=s[r++],e[i]);return t},Z=function(t){var e=x.call(this,t=E(t,!0));return!(this===j&&r(G,t)&&!r(W,t))&&(!(e||!r(this,t)||!r(G,t)||r(this,V)&&this[V][t])||e)},tt=function(t,e){if(t=C(t),e=E(e,!0),t!==j||!r(G,e)||r(W,e)){var i=w(t,e);return!i||!r(G,e)||r(t,V)&&t[V][e]||(i.enumerable=!0),i}},te=function(t){for(var e,i=F(C(t)),s=[],a=0;i.length>a;)r(G,e=i[a++])||e==V||e==u||s.push(e);return s},ti=function(t){for(var e,i=t===j,s=F(i?W:C(t)),a=[],n=0;s.length>n;)r(G,e=s[n++])&&(!i||r(j,e))&&a.push(G[e]);return a};Y||(o((M=function(){if(this instanceof M)throw TypeError("Symbol is not a constructor!");var t=f(arguments.length>0?arguments[0]:void 0);return a&&K&&z(j,t,{configurable:!0,set:function e(i){this===j&&e.call(W,i),r(this,V)&&r(this[V],t)&&(this[V][t]=!1),z(this,t,I(1,i))}}),J(t)}).prototype,"toString",function(){return this._k}),R.f=tt,O.f=X,i(45).f=A.f=te,i(32).f=Z,D.f=ti,a&&!i(16)&&o(j,"propertyIsEnumerable",Z,!0),m.f=function(t){return J(p(t))}),n(n.G+n.W+!Y*n.F,{Symbol:M});for(var ts="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tr=0;ts.length>tr;)p(ts[tr++]);for(var ta=b(p.store),tn=0;ta.length>tn;)_(ta[tn++]);n(n.S+!Y*n.F,"Symbol",{for:function(t){return r(H,t+="")?H[t]:H[t]=M(t)},keyFor:function(t){if(!Q(t))throw TypeError(t+" is not a symbol!");for(var e in H)if(H[e]===t)return e},useSetter:function(){K=!0},useSimple:function(){K=!1}}),n(n.S+!Y*n.F,"Object",{create:function(t,e){return void 0===e?k(t):$(k(t),e)},defineProperty:X,defineProperties:$,getOwnPropertyDescriptor:tt,getOwnPropertyNames:te,getOwnPropertySymbols:ti});var to=l(function(){D.f(1)});n(n.S+n.F*to,"Object",{getOwnPropertySymbols:function(t){return D.f(P(t))}}),N&&n(n.S+n.F*(!Y||l(function(){var t=M();return"[null]"!=B([t])||"{}"!=B({a:t})||"{}"!=B(Object(t))})),"JSON",{stringify:function(t){for(var e,i,s=[t],r=1;arguments.length>r;)s.push(arguments[r++]);if(i=e=s[1],(T(e)||void 0!==t)&&!Q(t))return v(e)||(e=function(t,e){if("function"==typeof i&&(e=i.call(this,t,e)),!Q(e))return e}),s[1]=e,B.apply(N,s)}}),M.prototype[U]||i(8)(M.prototype,U,M.prototype.valueOf),c(M,"Symbol"),c(Math,"Math",!0),c(s.JSON,"JSON",!0)}
1,function(t,e,i){var s=i(17)("meta"),r=i(9),a=i(3),u=i(5).f,l=0,d=o.default||function(){return!0},c=!i(13)(function(){return d((0,n.default)({}))}),f=function(t){u(t,s,{value:{i:"O"+ ++l,w:{}}})},p=t.exports={KEY:s,NEED:!1,fastKey:function(t,e){if(!r(t))return"symbol"==(void 0===t?"undefined":(0,g.default)(t))?t:("string"==typeof t?"S":"P")+t;if(!a(t,s)){if(!d(t))return"F";if(!e)return"E";f(t)}return t[s].i},getWeak:function(t,e){if(!a(t,s)){if(!d(t))return!0;if(!e)return!1;f(t)}return t[s].w},onFreeze:function(t){return c&&p.NEED&&d(t)&&!a(t,s)&&f(t),t}}},function(t,e,i){var s=i(27),r=i(44),a=i(32);t.exports=function(t){var e=s(t),i=r.f;if(i)for(var n,o=i(t),u=a.f,l=0;o.length>l;)u.call(t,n=o[l++])&&e.push(n);return e}},function(t,e,i){var s=i(43);t.exports=Array.isArray||function(t){return"Array"==s(t)}},function(t,e,i){var s=i(10),r=i(45).f,a={}.toString,n="object"==("undefined"==typeof window?"undefined":(0,g.default)(window))&&window&&c.default?(0,c.default)(window):[];t.exports.f=function(t){return n&&"[object Window]"==a.call(t)?function(t){try{return r(t)}catch(t){return n.slice()}}(t):r(s(t))}},function(t,e){},function(t,e,i){i(31)("asyncIterator")},function(t,e,i){i(31)("observable")},function(t,e,i){e.__esModule=!0;var s=n(i(90)),r=n(i(94)),a=n(i(39));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,a.default)(e)));t.prototype=(0,r.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(s.default?(0,s.default)(t,e):t.__proto__=e)}},function(t,e,i){t.exports={default:i(91),__esModule:!0}},function(t,e,i){i(92),t.exports=i(0).Object.setPrototypeOf},function(t,e,i){var s=i(4);s(s.S,"Object",{setPrototypeOf:i(93).set})},function(t,e,i){var s=i(9),r=i(12),n=function(t,e){if(r(t),!s(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:a.default||("__proto__"in{}?function(t,e,s){try{(s=i(36)(Function.call,i(46).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,i){return n(t,i),e?t.__proto__=i:s(t,i),t}}({},!1):void 0),check:n}},function(t,e,i){t.exports={default:i(95),__esModule:!0}},function(t,e,i){i(96);var s=i(0).Object;t.exports=function(t,e){return s.create(t,e)}},function(t,e,i){var s=i(4);s(s.S,"Object",{create:i(26)})},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(2)),r=a(i(7));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.listeners={}}return(0,r.default)(t,[{key:"has",value:function(t,e,i){var s=this.listeners[t];if(!s)return!1;for(var r=0,a=s.length;r<a;r++){var n=s[r];if(n.callback==e&&n.thisObj==i)return!0}return!1}},{key:"on",value:function(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!this.has(t,e,i)){var a=this.listeners[t]||[];a.push({once:r,priority:s||0,callback:e,thisObj:i,bindCallback:i&&e?e.bind(i):e}),a.sort(function(t,e){return e.priority-t.priority}),this.listeners[t]=a}}},{key:"once",value:function(t,e,i,s){this.on(t,e,i,s,!0)}},{key:"off",value:function(t,e,i){var s=this.listeners[t];if(s)for(var r=s.length-1;r>=0;r--){var a=s[r];if(a.callback==e&&a.thisObj==i)return void s.splice(r,1)}}},{key:"clear",value:function(){this.listeners={}}},{key:"trigger",value:function(t,e,i){var s=this.listeners[t];if(s){s.forEach(function(t){var s=t.bindCallback;"function"==typeof s&&s(e,i)});for(var r=s.length-1;r>=0;r--)s[r].once&&s.splice(r,1)}}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s,r=(s=i(15))&&s.__esModule?s:{default:s},a={};a.UriMapping={1e5:r.default.StreamChangeNotice,100102:r.default.MediaStopStreamNotice,100200:r.default.MediaChangeUpStreamNotic,100300:r.default.RoomStreamChangeNotic},a.WupMapping={loginVerify:r.default.LoginVerifyRsp,refreshCookie:r.default.RefreshCookieRsp,getMediaConfig:r.default.GetMediaConfigRsp,quitGroup:r.default.QuitMediaGroupRsp,getAntiCodeForStream:r.default.GetAntiCodeForStreamRs
1p,getStreamInfoByRoom:r.default.GetStreamInfoByRoomRsp,getStreamInfoByRoomFake:r.default.GetStreamInfoByRoomFakeRsp},a.NoLog={loginVerify:1,refreshCookie:1,getMediaConfig:1,getInfoFromVGM:1,getStreamInfoByRoomFake:1},e.default=a},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=l(i(100)),r=l(i(2)),a=l(i(7)),n=l(i(50)),o=l(i(51)),u=l(i(14));function l(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t)}return(0,a.default)(t,[{key:"setParams",value:function(t,e){this.pid=Number(t)||0,this.gearIndexList=e}},{key:"setLivingInfo",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=arguments[3],a=[],n=r.line||-1,o=r.mediaFormat||"";for(var u in e.streams){var l=e.streams[u],d=l.iBitRate,c=[],f=0,p=0,m=-1,_=[],y=l.vMediaStreamInfo,v=l.vStreamGearInfo;p=-1==i?l.iWebDefaultBitRate:i;for(var S=0;S<y.length;S++){var g=y[S];if(g.iWebPriorityRate<0)_.push(S);else{var T=g.iLineIndex;f+=g.iWebPriorityRate,c.push({line:T,rate:g.iWebPriorityRate}),n==T&&(m=T)}}for(var P=_.length-1;P>=0;P--){var C=_[P];y.splice(C,1)}if(0==y.length)break;if(1===y.length||0===f)m=y[0].iLineIndex;else if(-1===m)for(var E=0,I=Math.random(),k=0,A=c.length;k<A;k++){var R=c[k];if(I<=(E+=R.rate/f)){m=R.line;break}}p=this.checkDefalutBitRate(v,p,s);for(var D=null,O=0;O<y.length;O++)if(y[O].iLineIndex==m){D=t.getMediaStreamFormat(y[O].mMediaStreamFormatInfo.value,o,!0);break}var b={streamName:u,vMediaStreamInfo:y,chooseLine:m,vStreamGearInfo:v,defaultBitRate:p,iBitRate:d,playFormat:D,sAdditionalParam:l.sAdditionalParam,sAntiCode:l.sAntiCode};a.push(b)}return a}},{key:"checkDefalutBitRate",value:function(t,e,i){var s=this.getByGearIndex(t,i);return -1===s&&(s=this.getByBitrate(t,e)),s}},{key:"getByBitrate",value:function(t,e){for(var i=t.length>0?-1:0,r=0,a=s.default,n=0;n<t.length;n++){var o=t[n].iBitRate;if(0===e){if(0===o){i=o;break}}else if(o>0&&o<=e){i=o;break}r=Math.max(r,o),a=Math.min(a,o)}return -1===i&&(i=0===e?r:a),i}},{key:"getByGearIndex",value:function(t,e){if(!this.gearIndexList||0===this.gearIndexList.length||-1===(e=Number(e)))return -1;var i=this.gearIndexList.indexOf(e);if(-1===i)return -1;var s=this._getByGearIndex(t,e);if(-1===s)for(var r=this.gearIndexList.length,a=0;a<r;a++){var n=i-a,o=i+a;if(o<r&&(s=this._getByGearIndex(t,this.gearIndexList[o])),-1===s&&n>0&&(s=this._getByGearIndex(t,this.gearIndexList[n])),-1!==s)break}return s}},{key:"_getByGearIndex",value:function(t,e){for(var i=0;i<t.length;i++)if(Number(t[i].sBusiGearIndex)===e)return Number(t[i].iBitRate);return -1}},{key:"setLiveRoomBinData",value:function(t){try{for(var e=new ArrayBuffer(t.length/2),i=new Uint8Array(e),s=0,r=t.length/2;s<r;s++){var a=parseInt(t[2*s]+t[2*s+1]+"",16);i[s]=a}return u.default.Signal.rspDecode(i.buffer,"HUYA.GetStreamInfoByRoomRsp")}catch(t){u.default.logger.warn("LivingInfo.setLiveRoomBinData",t.message)}return null}}],[{key:"reSelectFormat",value:function(e,i){for(var s=0;s<e.vMediaStreamInfo.length;s++){var r=e.vMediaStreamInfo[s];if(r.iLineIndex==e.chooseLine){e.playFormat=t.getMediaStreamFormat(r.mMediaStreamFormatInfo.value,null,i);break}}}},{key:"getMediaStreamFormat",value:function(e,i,s){var r=[];for(var a in e)if(o.default.isLivingFormat(a)){if(i&&i===a)return e[a];r.push(e[a])}return 1===n.default.wap?t.getMediaStreamFormatWap(r):t.getMediaStreamFormatNew(r,s)}},{key:"getMediaStreamFormatOld",value:function(t){var e=t.length,i=0,s=0;for(i=0;i<e;i++)s+=t[i].iRate;var r=Math.random()*s,a=0,n=null;for(i=0;i<e;i++){if(a<r&&r<=t[i].iRate+a){n=t[i];break}a+=t[i].iRate}return null===n&&e>0&&(n=t[0]),n}},{key:"getMediaStreamFormatNew",value:function(t,e){var i=null,s=null,r=null;return t.forEach(function(t){t.sFormatName===o.default.f_p2p&&e?i=t:t.sFormatName===o.default.f_flv?s=t:t.sFormatName===o.default.f_hls&&(r=t)}),i||s||r}},{key:"getMediaStreamFormatWap",value:function(t){var e=null;return t.forEach(function(t){t.sFormatName===o.default.f_flv||t.sFormatName===o.default.f_hls&&(e=t)}),e}}]),t}()}
1,function(t,e,i){t.exports={default:i(101),__esModule:!0}},function(t,e,i){i(102),t.exports=0x1fffffffffffff},function(t,e,i){var s=i(4);s(s.S,"Number",{MAX_SAFE_INTEGER:0x1fffffffffffff})},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=f(i(2)),r=f(i(7)),a=f(i(14)),n=f(i(33)),o=f(i(15)),u=f(i(47)),l=f(i(104)),d=f(i(105)),c=f(i(52));function f(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(e){(0,s.default)(this,t),this._player=e,this.enableLowLatency=!1,this.roomId=0,this.pid=0,this.myid=0,this.gameid=0,this.videoBoxid="",this.place="",this.getStreamSuc=!1,this.needSeek=!1,this.hasStream=!1,this.busiState=0,this.httpState=0,this.signalState=0,this._onGetStreamInfoByRoomBind=this._onGetStreamInfoByRoom.bind(this),this._onGetStreamInfoByRoomFakeBind=this._onGetStreamInfoByRoomFake.bind(this)}return(0,r.default)(t,[{key:"destroy",value:function(){n.default.off(n.default.Events.LOGIN_SUC,this._onLoginSuc,this),n.default.off(n.default.Events.ON_GET_CONFIG,this._checkConfig,this),n.default.off(n.default.Events.LOGIN_INVALID,this._onLoginInvalid,this),a.default.Signal.off(d.default.kMediaPackTypeRoomStreamChangeNotice,this._roomStreamChangeNotice,this)}},{key:"_checkConfig",value:function(){n.default.config?(n.default.off(n.default.Events.ON_GET_CONFIG,this._checkConfig,this),this._player.setConfig(n.default.config)):n.default.on(n.default.Events.ON_GET_CONFIG,this._checkConfig,this)}},{key:"update",value:function(t){this.enableLowLatency=t.enableLowLatency,this.roomId=t.roomId,this.pid=t.pid,this.videoBoxid=t.id,this.place=t.place}},{key:"_roomStreamChangeNotice",value:function(t){a.default.logger.log("HYChannel.roomStreamChangeNotice roomId="+t.sRoomId+" delay="+t.iDelay),t.sRoomId===this.roomId+""&&a.default.Timer.once(this._onUpdateRoomStreamInfoTime,this,t.iDelay+1e3)}},{key:"_onUpdateRoomStreamInfoTime",value:function(){this.join(d.default.kMediaPackTypeRoomStreamChangeNotice)}},{key:"quit",value:function(t){var e=new o.default.QuitMediaGroupReq;e.tId=n.default.getMediaUserId(),e.vGroupId.value=[t+""],a.default.Signal.sendWup(u.default.MEDIAUISEA,u.default.QUIT_GROUP,e),a.default.Signal.off(d.default.kMediaPackTypeRoomStreamChangeNotice,this._roomStreamChangeNotice,this)}},{key:"join",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];a.default.logger.log("Room.join mediaPackType",t,"loadInfoImmediately",e),a.default.Signal.on(d.default.kMediaPackTypeRoomStreamChangeNotice,this._roomStreamChangeNotice,this),n.default.isLogin&&""!==n.default.sCookie?this._getStreamInfoByRoom(t):(e&&this._getStreamInfoByRoomFake(),n.default.on(n.default.Events.LOGIN_SUC,this._onLoginSuc,this)),n.default.on(n.default.Events.LOGIN_INVALID,this._onLoginInvalid,this)}},{key:"_onLoginInvalid",value:function(){this._player&&this._player.trigger(c.default.LOGIN_INVALID)}},{key:"_onLoginSuc",value:function(){this._getStreamInfoByRoom(-1)}},{key:"onGetStreamByBusi",value:function(t){a.default.logger.log("Room.onGetStreamByBusi",t),this.setStreamState(1,1),this._updateMediaStream(t.tStreamInfoPack,1,t.lAnchorUid)}},{key:"_getStreamInfoByRoom",value:function(t){this.handleReqFrom(3);var e=new o.default.GetStreamInfoByRoomReq;e.tId=n.default.getMediaUserId(),e.sRoomId=this.roomId+"",e.iMediaPackType=t||-1,a.default.logger.log("Room._getStreamInfoByRoom",e.tId.lUid,e.sRoomId,e.iMediaPackType,e),a.default.Signal.sendWup(u.default.MEDIAUISEA,u.default.GET_STREAM_INFO_BY_ROOM,e,this._onGetStreamInfoByRoomBind)}},{key:"_onGetStreamInfoByRoom",value:function(t){a.default.logger.log("Room._onGetStreamInfoByRoom",t,t.sRoomId,this.roomId),""===t.sRoomId&&0!==this.roomId?this._getStreamInfoByRoomFake():(this.setStreamState(1,3),this._updateMediaStream(t.tStreamInfoPack,3,t.lAnchorUid))}},{key:"_getStreamInfoByRoomFake",value:function(){this.handleReqFrom(2),this.getStreamSuc=!1,a.default.Timer.once(this._onGetStreamInfoByRoomFakeFailed,this,2e3);var t=new o.default.GetStreamInfoByRoomFakeReq;t.tId=n.default.getMediaUserId(),t.sRoomId=this.roomId+"",a.default.logger.log("Room._getStreamInfoByRoomFake",t.tId.lUid,t.sRoomId,t),a.default.Signal.sendWupHttp(u.default.MEDIAUISEA,u.default.GET_STREAM_INFO_BY_ROOM_FAKE,t,this._onGetStreamInfoByRoomFakeBind)}},{key:"_onGetStreamInfoByRoomFake",value:function(t){a.default.logger.log("Room._onGetStreamInfoByRoomFake",t,t.sdkcode,t.sRoomId,this.roomId);var e=Number(t.sRoomId);0!==e&&e===Number(this.roomId)&&(a.default.Timer.remove(this._onGetStreamInfoByRoomFakeFailed,this),0===t.sdkcode?(this.getStreamSuc=!0,this.setStreamState(1,2),this._updateMediaStream(t.tStreamInfoPack,2,t.lAnchorUid)):this._onGetStreamInfoByRoomFakeFailed())}},{key:"_onGetStreamInfoByRoomFakeFailed",value:function(){a.default.logger.log("Room._onGetStreamInfoByRoomFakeFailed"),this._player.onUpdateStreamInfoFail()}}
1,{key:"_updateMediaStream",value:function(t,e,i){var s=this;0!=this.pid?i=this.pid:i||(i=0);var r=t.mMediaStreamInfoPack.value,n={streams:{}};n.vproto=t.mMediaStreamInfoPack.vproto;var u=0,d=!1;for(var f in r){var p=r[f];if((p.iStreamType!==o.default.EMediaStreamType.EMST_HUYA_UDP||p.iStreamProperty!==o.default.EMediaStreamProperty.EOriginalStream)&&(0==i||p.lUid==i)){d=!0;for(var m=[],_=p.vMediaStreamInfo.value,y=0;y<_.length;y++){var v=_[y];v.iLineIndex<1||4===v.iLineIndex||0!==v.mMediaStreamFormatInfo.size()&&m.push(v)}if(m.length>0){m.sort(function(t,e){return t.iLineIndex-e.iLineIndex});var S=new l.default;S.streamName=f,S.lLiveCompatibleFlag=p.lLiveCompatibleFlag,S.lStreamId=p.lStreamId,S.sAntiCode=p.sAntiCode,S.iWebDefaultBitRate=p.iWebDefaultBitRate,S.vStreamGearInfo=p.vStreamGearInfo.value,S.vMediaStreamInfo=m,S.iStreamProperty=p.iStreamProperty,S.iBitRate=p.iBitRate,S.iStreamType=p.iStreamType,S.sAdditionalParam=p.sAdditionalParam,S.lUid=p.lUid,n.streams[f]=S,S.vStreamGearInfo.forEach(function(t){"auto"==t.sDisplayName&&(s._player.hasAutoBitrate=!0)}),S.vStreamGearInfo.sort(function(t,e){return 0==t.iBitRate?-1:0==e.iBitRate?1:e.iBitRate-t.iBitRate})}u=p.iBitRate}}this.hasStream||(this.hasStream=d),d?(a.default.logger.log("Room._updateMediaStream",n),this.setStreamState(2,e),this._player.onUpdateStreamInfo({liveStreams:n,from:e,broadcastBitrate:u}),this.handleReqSuccessFrom(e)):(this.setStreamState(3,e),a.default.logger.warn("Room._updateMediaStream has no streams"),this._player.trigger(c.default.ROOM_NO_STREAM),this._player&&this._player.reportNoStream&&this._player.reportNoStream(e))}},{key:"setStreamState",value:function(t,e){1===e?this.busiState=t:2===e?this.httpState=t:3===e&&(this.signalState=t)}},{key:"handleReqFrom",value:function(t){2!==t&&3!==t||this._player&&this._player.reportSdkStream&&this._player.reportSdkStream(0,t)}},{key:"handleReqSuccessFrom",value:function(t){2!==t&&3!==t||this._player&&this._player.reportSdkStream&&this._player.reportSdkStream(1,t)}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(2)),r=n(i(7)),a=n(i(14));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.streamName="",this.lLiveCompatibleFlag=0,this.lStreamId=0,this.sAntiCode="",this.vStreamGearInfo=null,this.vMediaStreamInfo=null,this.lUid=0}return(0,r.default)(t,[{key:"getLineInfo",value:function(t){var e=this.vMediaStreamInfo;if(e){for(var i=0;i<e.length;i++){var s=e[i];if(s.iLineIndex==Number(t))return s}return null}a.default.logger.warn("StreamInfo.getLineInfo streamInfo=null")}}]),t}()},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.default={kMediaPackTypeStreamChangeNotice:1e5,kMediaPackTypeMediaStopStream:100102,kMediaPackTypeMediaChgUpStream:100200,kMediaPackTypeRoomStreamChangeNotice:100300}}]).default},"object"==(0,g.default)(e)&&"object"==(0,g.default)(t)?t.exports=r():void 0===(s=r.apply(e,[]))||(t.exports=s)}).call(this,i(104)(t))},function(t,e,i){var s=i(25);t.exports=function(t,e,i){if(s(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,s){return t.call(e,i,s)};case 3:return function(i,s,r){return t.call(e,i,s,r)}}return function(){return t.apply(e,arguments)}}},function(t,e,i){var s=i(8),r=i(37);t.exports=i(7)?function(t,e,i){return s.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){t.exports={default:i(128),__esModule:!0}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var s=i(51),r=i(52);t.exports=function(t){return s(r(t))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s,r=i(11),a=u(i(10)),n=u(i(22)),o=u(i(34));function u(t){return t&&t.__esModule?t:{default:t}}isNaN(s=Number(localStorage.channelLogLevel))||a.default.setLevel(s),(0,r.initPrivate)({logger:a.default,Signal:o.default,Timer:n.default}),e.default=r.MainImpl},function(t,e,i){var s=i(2),r=i(0),a=i(15);t.exports=function(t,e){var i=(r.Object||{})[t]||Object[t],n={};n[t]=e(i),s(s.S+s.F*a(function(){i(1)}),"Object",n)}}
1,function(t,e,i){var s=i(52);t.exports=function(t){return Object(s(t))}},function(t,e){t.exports={}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(10)),r=a(i(33));function a(t){return t&&t.__esModule?t:{default:t}}var n=!1,o=[],u=0;function l(t,e){for(var i=0,s=o.length;i<s;i++){var r=o[i];if(r.callback==t&&r.thisObj==e)return r}return null}function d(t,e,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if((i=0|(Number(i)||0))<10||i%10!=0||!t)return s.default.error("Timer.add Invalide interval value or callback function."),!1;var n=l(t,e);return n||(n={callback:t,thisObj:e,bindCallback:e?t.bind(e):t,param:r},o.push(n)),n.times=a,n.tickCount=0,n.interval=i/10,n.delayDel=!1,!u&&o.length>0&&(u=setInterval(c,10)),!0}function c(){if(0==o.length)return clearInterval(u),void(u=0);n=!0;for(var t=r.default.now(),e=o.length-1;e>=0;e--){var i=o[e];if(i&&!i.delayDel){if(++i.tickCount%i.interval==0){var s=i.bindCallback,a=i.tickCount/i.interval;s(t,a,i.param),i.times>0&&i.times<=a&&i.tickCount>0&&o.splice(e,1)}}else o.splice(e,1)}n=!1}e.default={has:function(t,e){return!!l(t,e)},add:d,remove:function(t,e){for(var i=0,s=o.length;i<s;i++){var r=o[i];if(r.callback==t&&r.thisObj==e)return n?r.delayDel=!0:o.splice(i,1),!0}return!1},once:function(t,e,i,s){d(t,e,i+10,s,1)},getSize:function(){return o.length}}},function(t,e,i){"use strict";e.__esModule=!0;var s=i(44),r=s&&s.__esModule?s:{default:s};e.default=function(t,e){if(!t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"===(void 0===e?"undefined":(0,r.default)(e))||"function"==typeof e)?e:t}},function(t,e,i){"use strict";e.__esModule=!0;var s=n(i(70)),r=n(i(82)),a=n(i(44));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,a.default)(e)));t.prototype=(0,r.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(s.default?(0,s.default)(t,e):t.__proto__=e)}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var s=i(73),r=i(57);t.exports=Object.keys||function(t){return s(t,r)}},function(t,e){t.exports=!0},function(t,e,i){t.exports={default:i(119),__esModule:!0}},function(t,e,i){var s=i(8).f,r=i(16),a=i(5)("toStringTag");t.exports=function(t,e,i){t&&!r(t=i?t:t.prototype,a)&&s(t,a,{configurable:!0,value:e})}},function(t,e,i){"use strict";var s=i(144)(!0);i(60)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=s(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e,i){i(146);for(var s=i(4),r=i(13),a=i(21),n=i(5)("toStringTag"),o="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<o.length;u++){var l=o[u],d=s[l],c=d&&d.prototype;c&&!c[n]&&r(c,n,l),a[l]=a.Array}},function(t,e,i){"use strict";function s(t,e){var i=Math.max(0,e-t.toString().length);return"0".repeat(i)+t}Object.defineProperty(e,"__esModule",{value:!0});var r=0;e.default={now:function(){0===r&&(r=Date.now()-1);var t=Date.now()-r;return t>0xffffffff?(r+=0xffffffff,t-0xffffffff):t},utc:function(){return Math.round(Date.now()/1e3)},getDateStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=null;return(e=t?new Date(t):new Date).getFullYear()+"-"+s(e.getMonth()+1,2)+"-"+s(e.getDate(),2)},getTimeStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null,r=s((i=t?new Date(t):new Date).getHours(),2)+":"+s(i.getMinutes(),2)+":"+s(i.getSeconds(),2);return e&&(r+="."+s(i.getMilliseconds(),3)),r},getDateTimeStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null,r=(i=t?new Date(t):new Date).getFullYear()+"-"+s(i.getMonth()+1,2)+"-"+s(i.getDate(),2)+" "+s(i.getHours(),2)+":"+s(i.getMinutes(),2)+":"+s(i.getSeconds(),2);return e&&(r+="."+s(i.getMilliseconds(),3)),r}}}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=m(i(14)),r=m(i(1)),a=m(i(3)),n=m(i(23)),o=m(i(24)),u=m(i(86)),l=m(i(148)),d=m(i(61)),c=m(i(149)),f=m(i(150)),p=m(i(45));function m(t){return t&&t.__esModule?t:{default:t}}var _="http";e.default=new(function(t){function e(){(0,r.default)(this,e);var t=(0,n.default)(this,(e.__proto__||(0,s.default)(e)).call(this));return t._signalSdk=null,t._waits=[],t._onNoticeBind=t._onNotice.bind(t),t._onkMediaPackTypeRoomStreamChangeNoticeBind=t._onkMediaPackTypeRoomStreamChangeNotice.bind(t),t.SIGNAL_INIT="SIGNAL_INIT",t}return(0,o.default)(e,t),(0,a.default)(e,[{key:"getSignalSdk",value:function(){return this._signalSdk}},{key:"getTaf",value:function(){return this._signalSdk?this._signalSdk.getTaf():null}},{key:"init",value:function(t){t&&this._signalSdk!=t&&(this.destroy(),this._signalSdk=t,u.default.setTaf(t.getTaf()),t.registerWupMap(l.default.WupMapping),t.registerUriMap(l.default.UriMapping),t.on(c.default.kMediaPackTypeStreamChangeNotice,this._onNoticeBind),t.on(c.default.kMediaPackTypeMediaStopStream,this._onNoticeBind),t.on(c.default.kMediaPackTypeMediaChgUpStream,this._onNoticeBind),t.on(c.default.kMediaPackTypeRoomStreamChangeNotice,this._onkMediaPackTypeRoomStreamChangeNoticeBind),t.on(f.default.WEBSOCKET_CONNECTED,this._onNoticeBind),t.on(f.default.WEBSOCKET_DOLAUNCH,this._onNoticeBind),this._checkWaits(),this.trigger(this.SIGNAL_INIT))}},{key:"isWSConnected",value:function(){return this._signalSdk&&this._signalSdk.isWSConnected()}},{key:"isWSLaunch",value:function(){return this._signalSdk&&this._signalSdk.isWSLaunch()}},{key:"rspDecode",value:function(t,e){return this._signalSdk&&this._signalSdk.rspDecode?this._signalSdk.rspDecode(t,e):null}},{key:"_checkWaits",value:function(){for(;this._waits.length>0;){var t=this._waits.shift();"wup"===t.type?this.sendWup.apply(this,t.params):t.type===_&&this.sendWupHttp.apply(this,t.params)}}},{key:"_onNotice",value:function(t,e){this.trigger(t,e)}},{key:"_onkMediaPackTypeRoomStreamChangeNotice",value:function(t){this.trigger(c.default.kMediaPackTypeRoomStreamChangeNotice,t)}},{key:"destroy",value:function(){if(this._signalSdk){var t=this._signalSdk;t.off(c.default.kMediaPackTypeStreamChangeNotice,this._onNoticeBind),t.off(c.default.kMediaPackTypeMediaStopStream,this._onNoticeBind),t.off(c.default.kMediaPackTypeMediaChgUpStream,this._onNoticeBind),t.off(c.default.kMediaPackTypeRoomStreamChangeNotice,this._onkMediaPackTypeRoomStreamChangeNoticeBind)}this._signalSdk=null}},{key:"sendWup",value:function(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;this._signalSdk?this._signalSdk.sendWup(t,e,i,s,r):this._waits.push({type:"wup",params:[t,e,i,s,r]})}},{key:"sendWupHttp",value:function(t,e,i,s){this._signalSdk?this._signalSdk.sendWupHttp(t,e,i,s):this._waits.push({type:_,params:[t,e,i,s]})}},{key:"sendDataMetric",value:function(t){this._signalSdk&&this._signalSdk.sendDataMetric(t,(1===p.default.wap?"wap":"webh5")+"&2601201125&websocket")}}]),e}(d.default))},function(t,e,i){var s=i(12),r=i(161),a=i(162),n=i(9),o=i(53),u=i(89),l={},d={};(e=t.exports=function(t,e,i,c,f){var p,m,_,y,v=f?function(){return t}:u(t),S=s(i,c,e?2:1),g=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(a(v)){for(p=o(t.length);p>g;g++)if((y=e?S(n(m=t[g])[0],m[1]):S(t[g]))===l||y===d)return y}else for(_=v.call(t);!(m=_.next()).done;)if((y=r(_,S,m.value,e))===l||y===d)return y}).BREAK=l,e.RETURN=d},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(11).PlayerEvents},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){e.f=({}).propertyIsEnumerable},function(t,e,i){var s=i(40)("meta"),r=i(6),a=i(16),n=i(8).f,o=0,u=Object.isExtensible||function(){return!0},l=!i(15)(function(){return u(Object.preventExtensions({}))}),d=function(t){n(t,s,{value:{i:"O"+ ++o,w:{}}})},c=t.exports={KEY:s,NEED:!1,fastKey:function(t,e){if(!r(t))return"symbol"==typeof t?t:("str
1ing"==typeof t?"S":"P")+t;if(!a(t,s)){if(!u(t))return"F";if(!e)return"E";d(t)}return t[s].i},getWeak:function(t,e){if(!a(t,s)){if(!u(t))return!0;if(!e)return!1;d(t)}return t[s].w},onFreeze:function(t){return l&&c.NEED&&u(t)&&!a(t,s)&&d(t),t}}},function(t,e){var i=0,s=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+s).toString(36))}},function(t,e,i){e.f=i(5)},function(t,e,i){var s=i(9),r=i(72),a=i(57),n=i(55)("IE_PROTO"),o=function(){},u=function(){var t,e=i(48)("iframe"),s=a.length;for(e.style.display="none",i(80).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;s--;)delete u.prototype[a[s]];return u()};t.exports=Object.create||function(t,e){var i;return null!==t?(o.prototype=s(t),i=new o,o.prototype=null,i[n]=t):i=u(),void 0===e?i:r(i,e)}},function(t,e){},function(t,e,i){"use strict";e.__esModule=!0;var s=n(i(142)),r=n(i(83)),a="function"==typeof r.default&&"symbol"==typeof s.default?function(t){return typeof t}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":typeof t};function n(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof r.default&&"symbol"===a(s.default)?function(t){return void 0===t?"undefined":a(t)}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":void 0===t?"undefined":a(t)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={1:"web",2:"wap",web:1,wap:2}},function(t,e,i){var s=i(26),r=i(5)("toStringTag"),a="Arguments"==s(function(){return arguments}());t.exports=function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),r))?i:a?s(e):"Object"==(n=s(e))&&"function"==typeof e.callee?"Arguments":n}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=d(i(64)),r=d(i(1)),a=d(i(3)),n=d(i(18)),o=d(i(34)),u=d(i(45)),l=d(i(67));function d(t){return t&&t.__esModule?t:{default:t}}e.default=new(function(){function t(){(0,r.default)(this,t),this.anonymousuid=0,this.myid=0,this.pageId=Date.now()}return(0,a.default)(t,[{key:"onNimoDataMetric2",value:function(t,e,i,r,a,d,c,f,p,m){var _={anchoruid:e,line:a,coderate:i,coderatebps:1e3*i,gameId:f,place_p:d,room_id:c,stream_from:m,platform_h5:u.default[1],appid:n.default.appId,p2p_cool_flag:+!!n.default.isLogin,oexp:n.default.sCookie,session_id:this.pageId};p&&(_.oexp=p),0==this.myid&&(_.anonymousuid=0==this.anonymousuid?l.default.getAnonymousUid():this.anonymousuid),t.forEach(function(t){t.vDimension||(t.vDimension={}),(0,s.default)(t.vDimension,_)}),o.default.sendDataMetric(t)}}]),t}())},function(t,e,i){var s=i(6),r=i(4).document,a=s(r)&&s(r.createElement);t.exports=function(t){return a?r.createElement(t):{}}},function(t,e,i){var s=i(6);t.exports=function(t,e){var i,r;if(!s(t))return t;if(e&&"function"==typeof(i=t.toString)&&!s(r=i.call(t))||"function"==typeof(i=t.valueOf)&&!s(r=i.call(t))||!e&&"function"==typeof(i=t.toString)&&!s(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var s=i(38),r=i(37),a=i(17),n=i(49),o=i(16),u=i(71),l=Object.getOwnPropertyDescriptor;e.f=i(7)?l:function(t,e){if(t=a(t),e=n(e,!0),u)try{return l(t,e)}catch(t){}if(o(t,e))return r(!s.f.call(t,e),t[e])}},function(t,e,i){var s=i(26);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==s(t)?t.split(""):Object(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var s=i(54),r=Math.min;t.exports=function(t){return t>0?r(s(t),0x1fffffffffffff):0}},function(t,e){var i=Math.ceil,s=Math.floor;t.exports=function(t){return isNaN(t*=1)?0:(t>0?s:i)(t)}},function(t,e,i){var s=i(56)("keys"),r=i(40);t.exports=function(t){return s[t]||(s[t]=r(t))}},function(t,e,i){var s=i(0),r=i(4),a=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:s.version,mode:i(28)?"pure":"global",copyright:"\xa9 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleStr
1ing,toString,valueOf".split(",")},function(t,e,i){var s=i(4),r=i(0),a=i(28),n=i(41),o=i(8).f;t.exports=function(t){var e=r.Symbol||(r.Symbol=a?{}:s.Symbol||{});"_"==t.charAt(0)||t in e||o(e,t,{value:n.f(t)})}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){"use strict";var s=i(28),r=i(2),a=i(78),n=i(13),o=i(21),u=i(145),l=i(30),d=i(81),c=i(5)("iterator"),f=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,e,i,m,_,y,v){u(i,e,m);var S,g,T,P=function(t){if(!f&&t in k)return k[t];switch(t){case"keys":case"values":return function(){return new i(this,t)}}return function(){return new i(this,t)}},C=e+" Iterator",E="values"==_,I=!1,k=t.prototype,A=k[c]||k["@@iterator"]||_&&k[_],R=A||P(_),D=_?E?P("entries"):R:void 0,O="Array"==e&&k.entries||A;if(O&&(T=d(O.call(new t)))!==Object.prototype&&T.next&&(l(T,C,!0),s||"function"==typeof T[c]||n(T,c,p)),E&&A&&"values"!==A.name&&(I=!0,R=function(){return A.call(this)}),(!s||v)&&(f||I||!k[c])&&n(k,c,R),o[e]=R,o[C]=p,_)if(S={values:E?R:P("values"),keys:y?R:P("keys"),entries:D},v)for(g in S)g in k||a(k,g,S[g]);else r(r.P+r.F*(f||I),e,S);return S}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(1)),r=n(i(3)),a=n(i(10));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.listeners={}}return(0,r.default)(t,[{key:"has",value:function(t,e,i){var s=this.listeners[t];if(!s)return!1;for(var r=0,a=s.length;r<a;r++){var n=s[r];if(n.callback==e&&n.thisObj==i)return!0}return!1}},{key:"on",value:function(t,e,i,s){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!this.has(t,e,i)){var a=this.listeners[t]||[];a.push({once:r,priority:s||0,callback:e,thisObj:i,bindCallback:i&&e?e.bind(i):e}),a.sort(function(t,e){return e.priority-t.priority}),this.listeners[t]=a}}},{key:"once",value:function(t,e,i,s){this.on(t,e,i,s,!0)}},{key:"off",value:function(t,e,i){var s=this.listeners[t];if(s)for(var r=s.length-1;r>=0;r--){var a=s[r];if(a.callback==e&&a.thisObj==i)return void s.splice(r,1)}}},{key:"clear",value:function(){this.listeners={}}},{key:"trigger",value:function(t,e,i){var s=this.listeners[t];if(s){s.forEach(function(s){var r=s.bindCallback;"function"==typeof r?r(e,i):a.default.warn("logger.trigger uri="+t+" callback=undefined",s)});for(var r=s.length-1;r>=0;r--)s[r].once&&s.splice(r,1)}}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=localStorage||{}},function(t,e,i){t.exports={default:i(153),__esModule:!0}},function(t,e,i){t.exports={default:i(155),__esModule:!0}},function(t,e,i){var s=i(13);t.exports=function(t,e,i){for(var r in e)i&&t[r]?t[r]=e[r]:s(t,r,e[r]);return t}},function(t,e){t.exports=function(t,e,i,s){if(!(t instanceof e)||void 0!==s&&s in t)throw TypeError(i+": incorrect invocation!");return t}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(1)),r=n(i(3)),a=n(i(62));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t)}return(0,r.default)(t,null,[{key:"setCookie",value:function(t,e,i,s,r){var a=new Date;a.setTime(a.getTime()+24*i*36e5);var n=t+"="+e+"; expires="+a.toUTCString();s&&(n+="; domain="+s),r&&(n+="; path="+r),document.cookie=n}},{key:"setWholeCookie",value:function(t,e){var i=new Date;i.setTime(i.getTime()+24*e*36e5);var s="expires="+i.toUTCString();document.cookie=t+"; "+s}},{key:"setCompleteCookie",value:function(t){document.cookie=t}},{key:"getCookie",value:function(t){for(var e=t+"=",i=document.cookie.split(";"),s=0,r=i.length;s<r;s++){var a=i[s].trim();if(0==a.indexOf(e))return a.substr(e.length)}return""}},{key:"storeIps",value:function(e){for(var i="",s=t.getIpsKey(!0),r=e.join("|").toLocaleLowerCase(),n=0,o=r.length;n<o;n++){var u=s[r.charAt(n)],l=Math.random()*u.length|0;i+=u.charAt(l)}a.default.wssips=i}},{key:"getIps",value:function(){var e=a.default.wssips;if(!e)return[];for(var i="",s=t.getIpsKey(!1),r=0,n=e.length;r<n;r++)i+=s[e.charAt(r)];return i.split("|")}},{key:"getIpsKey",value:function(t){for(var e=["-",".",":","|"],i="_N1Y%/ny^6?Mi7|wCe#$VmT=.GBut]3L*f<acX2Eop>d}WqKPQ@r;zx!s`(:IHFRZ~[A{Jb-O&D)v0Ukj95,8lg+h4S",s={},r=0;r<40;r++){var a=r<11?3:2,n=i.substr(0,a);i=i.substr(a);var o=r+"";if(r>13?o=String.fromCharCode(r+83):r>
vendor: 5,518 bytes, line 1
19&&(o=e[r-10]),t)s[o]=n;else for(var u=0;u<n.length;u++)s[n.charAt(u)]=o}return s}},{key:"removeUrlEndSlash",value:function(t){if(!t)return t;var e=t.split("");return"/"===e[e.length-1]&&e.pop(),e.join("")}},{key:"getAnonymousUid",value:function(){return Number((Date.now()%1e10*1e3+(1e3*Math.random()|0))%0xffffffff)}},{key:"logcss",value:function(t,e,i){var s="font-weight:900";return t&&(s+=";color:"+t),e&&(s+=";background:"+e),i&&(s+=";border:3px solid "+i),s}},{key:"getURIParam",value:function(t,e){return RegExp("(^|\\?|&)"+e+"=([^&^#]*)(\\s|&|$|#)","i").test(t)?decodeURIComponent(RegExp.$2):""}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={STREAM_ERROR:"stream_error",BUSI_STREAM:"busi_stream",DIF_STREAM:"dif_stream",VIDEO_LOAD_TS:"video_load_ts",BLACK_SCREEN:"black_screen",ROOM_SDK_STREAM:"room_sdk_stream",LOGIN_MEDIA:"login_media"}},function(t,e,i){"use strict";var s=i(25);function r(t){var e,i;this.promise=new t(function(t,s){if(void 0!==e||void 0!==i)throw TypeError("Bad Promise constructor");e=t,i=s}),this.resolve=s(e),this.reject=s(i)}t.exports.f=function(t){return new r(t)}},function(t,e,i){t.exports={default:i(105),__esModule:!0}},function(t,e,i){t.exports=!i(7)&&!i(15)(function(){return 7!=Object.defineProperty(i(48)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(8),r=i(9),a=i(27);t.exports=i(7)?Object.defineProperties:function(t,e){r(t);for(var i,n=a(e),o=n.length,u=0;o>u;)s.f(t,i=n[u++],e[i]);return t}},function(t,e,i){var s=i(16),r=i(17),a=i(117)(!1),n=i(55)("IE_PROTO");t.exports=function(t,e){var i,o=r(t),u=0,l=[];for(i in o)i!=n&&s(o,i)&&l.push(i);for(;e.length>u;)s(o,i=e[u++])&&(~a(l,i)||l.push(i));return l}},function(t,e,i){t.exports={default:i(120),__esModule:!0}},function(t,e,i){var s=i(17),r=i(76).f,a={}.toString,n="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return n&&"[object Window]"==a.call(t)?function(t){try{return r(t)}catch(t){return n.slice()}}(t):r(s(t))}},function(t,e,i){var s=i(73),r=i(57).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return s(t,r)}},function(t,e,i){"use strict";var s=i(4),r=i(16),a=i(7),n=i(2),o=i(78),u=i(39).KEY,l=i(15),d=i(56),c=i(30),f=i(40),p=i(5),m=i(41),_=i(58),y=i(127),v=i(79),S=i(9),g=i(6),T=i(20),P=i(17),C=i(49),E=i(37),I=i(42),k=i(75),A=i(50),R=i(59),D=i(8),O=i(27),b=A.f,w=D.f,L=k.f,F=s.Symbol,M=s.JSON,N=M&&M.stringify,B=p("_hidden"),V=p("toPrimitive"),U={}.propertyIsEnumerable,x=d("symbol-registry"),H=d("symbols"),G=d("op-symbols"),W=Object.prototype,j="function"==typeof F&&!!R.f,Y=s.QObject,q=!Y||!Y.prototype||!Y.prototype.findChild,K=a&&l(function(){return 7!=I(w({},"a",{get:function(){return w(this,"a",{value:7}).a}})).a})?function(t,e,i){var s=b(W,e);s&&delete W[e],w(t,e,i),s&&t!==W&&w(W,e,s)}:w,z=function(t){var e=H[t]=I(F.prototype);return e._k=t,e},J=j&&"symbol"==typeof F.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof F},Q=function(t,e,i){return t===W&&Q(G,e,i),S(t),e=C(e,!0),S(i),r(H,e)?(i.enumerable?(r(t,B)&&t[B][e]&&(t[B][e]=!1),i=I(i,{enumerable:E(0,!1)})):(r(t,B)||w(t,B,E(1,{})),t[B][e]=!0),K(t,e,i)):w(t,e,i)},X=function(t,e){S(t);for(var i,s=y(e=P(e)),r=0,a=s.length;a>r;)Q(t,i=s[r++],e[i]);return t},$=function(t){var e=U.call(this,t=C(t,!0));return!(this===W&&r(H,t)&&!r(G,t))&&(!(e||!r(this,t)||!r(H,t)||r(this,B)&&this[B][t])||e)},Z=function(t,e){if(t=P(t),e=C(e,!0),t!==W||!r(H,e)||r(G,e)){var i=b(t,e);return!i||!r(H,e)||r(t,B)&&t[B][e]||(i.enumerable=!0),i}},tt=function(t){for(var e,i=L(P(t)),s=[],a=0;i.length>a;)r(H,e=i[a++])||e==B||e==u||s.push(e);return s},te=function(t){for(var e,i=t===W,s=L(i?G:P(t)),a=[],n=0;s.length>n;)r(H,e=s[n++])&&(!i||r(W,e))&&a.push(H[e]);return a};j||(o((F=function(){if(this instanceof F)throw TypeError("Symbol is not a constructor!");var t=f(arguments.length>0?arguments[0]:void 0),e=function(i){this===W&&e.call(G,i),r(this,B)&&r(this[B],t)&&(this[B][t]=!1),K(this,t,E(1,i))};return a&&q&&K(W,t,{configurable:!0,set:e}),z(t)}).prototype,"toString",function(){return this._k}),A.f=Z,D.f=Q,i(76).f=k.f=tt,i(38).f=$,R.f=te,a&&!i(28)&&o(W,"propertyIsEnumerable",$,!0),m.f=function(t){return z(p(t))}),n(n.G+n.W+!j*n.F,{Symbol:F});for(var ti="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ts=0;ti.length>ts;)p(ti[ts++]);for(var tr=O(p.store),ta=0;tr.length>ta;)_(tr[ta++]);n(n.S+!j*n.F,"Symbol",{for:function(t){return r(x,t+="")?x[t]:x[t]=F(t)},keyFor:function(t){if(!J(t))throw TypeError(t+" is not a symbol!");for(var e in x)if(x[e]===t)return e},useSetter:function(){q=!0},useSimple:function(){q=!1}}),n(n.S+!j*n.F,"Object",{create:function(t,e){return void 0===e?I(t):X(I(t),e)},defineProperty:Q,defineProperties:X,getOwnPropertyDescriptor:Z,getOwnPropertyNames:tt,getOwnPropertySymbols:te});var tn=l(function(){R.f(1)});n(n.S+n.F*tn,"Object",{getOwnPropertySymbols:function(t){return R.f(T(t))}}),M&&n(n.S+n.F*(!j||l(function(){var t=F();return"[null]"!=N([t])||"{}"!=N({a:t})||"{}"!=N(Object(t))})),"JSON",{stringify:function(t){for(var e,i,s=[t],r=1;arguments.length>r;)s.push(arguments[r++]);if(i=e=s[1],(g(e)||void 0!==t)&&!J(t))return v(e)||(e=function(t,e){if("function"==typeof i&&(e=i.call(this,t,e)),!J(e))return e}),s[1]=e,N.apply(M,s)}}),F.prototype[V]||i(13)(F.prototype,V,F.prototype.valueOf),c(F,"Symbol"),c(Math,"Math",!0),c(s.JSON,"JSON",!0)}
1,function(t,e,i){t.exports=i(13)},function(t,e,i){var s=i(26);t.exports=Array.isArray||function(t){return"Array"==s(t)}},function(t,e,i){var s=i(4).document;t.exports=s&&s.documentElement},function(t,e,i){var s=i(16),r=i(20),a=i(55)("IE_PROTO"),n=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return s(t=r(t),a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?n:null}},function(t,e,i){t.exports={default:i(133),__esModule:!0}},function(t,e,i){t.exports={default:i(137),__esModule:!0}},function(t,e,i){t.exports={default:i(140),__esModule:!0}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(11).HUYA},function(t,e,i){"use strict";e.__esModule=!0;var s=a(i(14)),r=a(i(74));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function t(e,i,a){null===e&&(e=Function.prototype);var n=(0,r.default)(e,i);if(void 0===n){var o=(0,s.default)(e);return null===o?void 0:t(o,i,a)}if("value"in n)return n.value;var u=n.get;return void 0!==u?u.call(a):void 0}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(63)),r=u(i(64)),a=u(i(90)),n=u(i(1)),o=u(i(3));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,n.default)(this,t),this.comDim=new a.default,this.coreDim=new a.default,this.actDim=new a.default,this.extDim=new a.default,this.coreMap=new a.default,this.compMap=new a.default,this.heart_type=0}return(0,o.default)(t,[{key:"reset",value:function(){this.comDim.clear(),this.coreDim.clear(),this.actDim.clear(),this.extDim.clear(),this.coreMap.clear(),this.compMap.clear(),this.heart_type=0}},{key:"createAct",value:function(t,e){return this._createAct(t,e)}},{key:"_createAct",value:function(t,e){var i={sMetricName:"yspwl.web.live.user.act",vField:{},vDimension:{}};if(i.vDimension.act_type=t,this._fillFromMap(i.vDimension,this.comDim),this._fillFromMap(i.vDimension,this.actDim),e){var s=0;if(e.hasOwnProperty("value")){var a=e.value;for(s=0;s<a.length;s++)i.vField["value"+(s+1)]=a[s]}if(e.hasOwnProperty("str")){var n=e.str;for(s=0;s<n.length;s++)i.vDimension["str"+(s+1)]=n[s]}e.hasOwnProperty("dim")&&(0,r.default)(i.vDimension,e.dim)}return this.actDim.clear(),i}},{key:"fill",value:function(t,e){e&&(this.heart_type=2),this._fill(t)}},{key:"_fill",value:function(t){var e={sMetricName:"yspwl.web.live.user.heart20",vField:{},vDimension:{},vExLog:{}};this.coreDim.set("heart_type",this.heart_type),this._fillFromMap(e.vDimension,this.comDim),this._fillFromMap(e.vDimension,this.coreDim),this._fillFromMap(e.vExLog,this.extDim),this._fillFromMap(e.vField,this.coreMap),this._fillComp(e.vDimension),this.coreDim.clear(),this.extDim.clear(),this.coreMap.clear(),this.compMap.clear(),0==this.heart_type&&(this.heart_type=1),t.push(e)}},{key:"_fillComp",value:function(t){var e=!0,i=!1,r=void 0;try{for(var a,n=(0,s.default)(this.compMap.keys());!(e=(a=n.next()).done);e=!0){var o=a.value,u=this.compMap.get(o),l="",d=!0,c=!1,f=void 0;
1try{for(var p,m=(0,s.default)(u.keys());!(d=(p=m.next()).done);d=!0){var _=p.value;l.length>0&&(l+=";"),l+=_+","+u.get(_)}}catch(t){c=!0,f=t}finally{try{!d&&m.return&&m.return()}finally{if(c)throw f}}t[o]=l}}catch(t){i=!0,r=t}finally{try{!e&&n.return&&n.return()}finally{if(i)throw r}}}},{key:"_fillFromMap",value:function(t,e){var i=!0,r=!1,a=void 0;try{for(var n,o=(0,s.default)(e.keys());!(i=(n=o.next()).done);i=!0){var u=n.value;t[u]=e.get(u)}}catch(t){r=!0,a=t}finally{try{!i&&o.return&&o.return()}finally{if(r)throw a}}}},{key:"setComDim",value:function(t,e){this.comDim.set(t,e)}},{key:"setCoreDim",value:function(t,e){this.coreDim.set(t,e)}}]),t}()},function(t,e,i){var s=i(46),r=i(5)("iterator"),a=i(21);t.exports=i(0).getIteratorMethod=function(t){if(null!=t)return t[r]||t["@@iterator"]||a[s(t)]}},function(t,e,i){t.exports={default:i(158),__esModule:!0}},function(t,e,i){"use strict";var s=i(4),r=i(0),a=i(8),n=i(7),o=i(5)("species");t.exports=function(t){var e="function"==typeof r[t]?r[t]:s[t];n&&e&&!e[o]&&a.f(e,o,{configurable:!0,get:function(){return this}})}},function(t,e,i){var s=i(6);t.exports=function(t,e){if(!s(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(11).LivingInfo},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=l(i(63)),r=l(i(64)),a=l(i(90)),n=l(i(1)),o=l(i(3)),u=l(i(181));function l(t){return t&&t.__esModule?t:{default:t}}var d=function(){function t(){(0,n.default)(this,t),this.pid=0,this.roomid=0,this.autoFeedbackKeys={},this.autoFeedbackRooms="",this.initKeys=!1,this.waitMap=new a.default}return(0,o.default)(t,[{key:"setRoomid",value:function(t,e){this.pid=t,this.roomid=e,this._sendWait()}},{key:"setConfig",value:function(t){this.initKeys=!0;try{(t=JSON.parse(t)).hasOwnProperty("autoFeedbackRooms")&&(this.autoFeedbackRooms=t.autoFeedbackRooms),t.autoFeedbackKeys&&(0,r.default)(this.autoFeedbackKeys,t.autoFeedbackKeys)}catch(t){}this._sendWait()}},{key:"_sendWait",value:function(){if(0!=this.roomid&&this.initKeys){var t=!0,e=!1,i=void 0;try{for(var r,a=(0,s.default)(this.waitMap.keys());!(t=(r=a.next()).done);t=!0){var n=r.value;this.feedback(n,this.waitMap.get(n))}}catch(t){e=!0,i=t}finally{try{!t&&a.return&&a.return()}finally{if(e)throw i}}this.waitMap.clear()}}},{key:"_checkAble",value:function(){if("all"===this.autoFeedbackRooms)return!0;var t=this.roomid+"";return""!==t&&-1!==this.autoFeedbackRooms.indexOf(t)}},{key:"_feedbackAble",value:function(t){return!!(this.autoFeedbackKeys.hasOwnProperty(t)&&100*Math.random()<Number(this.autoFeedbackKeys[t]))&&this._checkAble()}},{key:"feedback",value:function(t,e){this.initKeys&&0!=this.roomid?this._feedbackAble(t)&&this._feedback(t,e):this.waitMap.set(t,e)}},{key:"_feedback",value:function(t,e){(new u.default).feedBack(this.pid,e,t)}}]),t}();d.PLAY_VIDEO="playVideo",d.BLACK_SCREEN="blackScreen",d.BLACK_SCREEN_WAP="blackScreenWap",d.BAD_RESEND="badResend",d.RESEND="resend",d.BAD="bad",e.default=d},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(11).MediaType},function(t,e,i){var s=i(9),r=i(25),a=i(5)("species");t.exports=function(t,e){var i,n=s(t).constructor;return void 0===n||null==(i=s(n)[a])?e:r(i)}},function(t,e,i){var s,r,a,n=i(12),o=i(189),u=i(80),l=i(48),d=i(4),c=d.process,f=d.setImmediate,p=d.clearImmediate,m=d.MessageChannel,_=d.Dispatch,y=0,v={},S=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},g=function(t){S.call(t.data)};f&&p||(f=function(t){for(var e=[],i=1;arguments.length>i;)e.push(arguments[i++]);return v[++y]=function(){o("function"==typeof t?t:Function(t),e)},s(y),y},p=function(t){delete v[t]},"process"==i(26)(c)?s=function(t){c.nextTick(n(S,t,1))}:_&&_.now?s=function(t){_.now(n(S,t,1))}:m?(a=(r=new m).port2,r.port1.onmessage=g,s=n(a.postMessage,a,1)):d.addEventListener&&"function"==typeof postMessage&&!d.importScripts?(s=function(t){d.postMessage(t+"","*")},d.addEventListener("message",g,!1)):s="onreadystatechange"in l("script")?function(t){u.appendChild(l("script")).onreadystatechange=function(){u.removeChild(this),S.call(t)}}:function(t){setTimeout(n(S,t,1),0)}),t.exports={set:f,clear:p}},function(t,e){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}}
1,function(t,e,i){var s=i(9),r=i(6),a=i(69);t.exports=function(t,e){if(s(t),r(e)&&e.constructor===t)return e;var i=a.f(t);return(0,i.resolve)(e),i.promise}},function(t,e,i){i(101),t.exports=i(102)},function(t,e){var i=[function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}i.d(e,"a",function(){return s})},function(t,e,i){"use strict";function s(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function r(t,e,i){return e&&s(t.prototype,e),i&&s(t,i),t}i.d(e,"a",function(){return r})},function(t,e,i){"use strict";function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}i.d(e,"a",function(){return s})},function(t,e,i){"use strict";i.d(e,"a",function(){return r});var s=i(2);function r(t,e,i){return(r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Object(s.a)(t)););return t}(t,e);if(r){var a=Object.getOwnPropertyDescriptor(r,e);return a.get?a.get.call(i):a.value}})(t,e,i||t)}},function(t,e,i){"use strict";i.r(e);var s=i(0),r=i(1);function a(t,e){var i=Math.max(0,e-t.toString().length),s="";if(i>0)for(var r=0;r<i;r++)s+="0";return s+t}e.default=new(function(){function t(){Object(s.a)(this,t),this.logArr=[]}return Object(r.a)(t,[{key:"getNow",value:function(){return performance.now()}},{key:"log",value:function(){for(var t,e,i,s,r,n,o,u=(e=(t=new Date).getFullYear(),i=a(t.getMonth()+1,2),s=a(t.getDate(),2),r=a(t.getHours(),2),n=a(t.getMinutes(),2),o=a(t.getSeconds(),2),"["+"".concat(e,"-").concat(i,"-").concat(s," ").concat(r,":").concat(n,":").concat(o)+"."+a(t.getMilliseconds(),3)+"][w-webcodecs]"),l=arguments.length,d=Array(l),c=0;c<l;c++)d[c]=arguments[c];d[0]=u+d[0],this.logArr.push(d)}},{key:"postMessage",value:function(t,e){var i={type:t};null!=e&&(i.data=e),self.postMessage(i)}}]),t}())},function(t,e,i){"use strict";i.d(e,"c",function(){return s}),i.d(e,"b",function(){return r}),i.d(e,"d",function(){return a}),i.d(e,"e",function(){return n}),i.d(e,"a",function(){return o});var s={START:1,POSTFRAME:2,RESIZE:3,CLOSE:4,VISIBILITYCHANGE:5,AUDIOSAMPLES:6,VIDEOSAMPLES:7,AVCCONFIG:8,AVCPPS:9,AVCSPS:10,AACCONFIG:11,UPDATE_VIDEOFPS:12,SET_PLAY_MINBUFFER:13,SET_JITTER:14,SET_USE_SOFTACCELERATION:15,LOCAL_CONFIG:16,PAUSE_VIDEO_DECODE:17,PAUSE_AUDIO_DECODE:18,ENABLE_DISCARD_VIDEO:19,SET_AUDIO_WRITER:20,UPDATE_CURBITRATE:21,INIT_CONFIG:22,AVCVPS:23,RECV_FPS:24,FAST_OVER:25,LOG_CFG:26,UPDATE_SOFTACCELERATION:27,SET_ENHANCE:28,SET_SEGMENTTION:29,RECV_FAST_OVER:30,AV1_INIT_SEG:31,SEEK_TIME:32,SET_PLAYBACKRATE:33,SET_VOD_AV1:34},r={WEBGLPLAY:1,STAT:2,PAUSE:3,WORKERSHAREBUFFER:4,RENDERERROR:5,LOG:6,AUDIODECODEDFRAME:7,VIDEODECODEERROR:8,AUDIODECODEERROR:9,INTERVAL:10,WOREKR_READY:11,TURN_TO_WEBCODECS_SOFT:12,AUDIO_PLAY:13,AUDIORENDERERROR:14,SOFT_TURN_TO_MSE:15,AUDIO_FRAME_DECODED:16,DECODE_COST:17,DECODE_DTS:18,WAIT_KEY_FRAME:19,SET_FRAME_PAUSE:20,SET_FRMAE_RESUME:21,RENDER_FPS_PAUSE:22,AUDIO_FORMAT_ERROR:23,VIDEO_ENHANCE_ERROR:24,VIDEO_ENHANCE_SUCCESS:25,ON_WCS_VIDEO_SEEK:26},a={VIDEODECODEERROR:1,AUDIODECODEERROR:2,VIDEORENDEERROR:3,VIDEOFAST:4,AUDIOFAST:5,WORKERERROR:6,AUDIORENDERERROR:7,NOT_SUPPORT_MEDIASRTREAMTRACK:8,DISABLE_HARDWARE_ACCELERATION:9,SOFT_TURN_TO_MSE:10,WIN_PERF_INSUFFICIENT:11,RETRY_MAX_TIMES:12,DECODE_COST:13,DECODE_DTS:14,BROWSER_NOT_SUPPORTED:15,IS_PUREAUDIO:16,ANGLE_NULL:17,DECODE_ERROR_COOL:18,CHROME_H265_RENDER_INFO_EMPTY:19,IS_NOT_SUPPORT_CONFIGURE:20,IS_NOT_SUPPORT_OS:21,AUDIO_DATA_NAN:22,AUDIO_FORMAT_ERROR:23,AUDIO_DATA_MUTE:24,IS_NOT_SUPPORT_CATEGORY:25,BROWSER_VERSION_NOT_SUPPORTED_WCS:26,BROWSER_VERSION_NOT_SUPPORTED_WCS_H265:27,BROWSER_VERSION_NOT_SUPPORTED_WCS_H264:28,VOD_AV1_CLOSE_CFg:29,NOT_SUPPORT_AUDIO_SAMPLERATE:30},n={VIDEO_PTS:0,VIDEO_RENDER_NUMS:1,VIDEO_NOT_RENDERD_BUFFER:2,AUDIO_TODECODE_NUMS:3,VIDEO_TODECODE_NUMS:4,AUDIO_DECODE_NUMS:5,VIDEO_DECODE_NUMS:6,VIDEO_DECODED_DELAY:7,VIDEO_READY_TO_RENDER_LIST_LEN:8,VIDEO_BUFFER_LEN:9,VIDEO_THROW_FRAME_FPS:11,AUDIO_DTS:12,AUDIO_RENDER_NUMS:13,VIDEO_DECODE_DISCARD_NUMS:14,VIDEO_DECODED_DELAY_SMOOTH:21,VIDEO_ENHANCE_NUMS:22,VIDEO_ENAHNCE_COST:23,VIDEO_ENHANCE_
1LESS30_NUMS:24,VIDEO_ENHANCE_LESS150_NUMS:25,VIDEO_ENHANCE_LESS200_NUMS:26,VIDEO_ENHANCE_LARGE200_NUMS:27,VIDEO_ENHANCE_TOTAL:28,AUDIO_WORKER_UN_RENDER_AUDIO_FRAMES:31,VIDEO_FIRST_FRAME_DECODEC_COST:32,AUDIO_FIRST_FRAME_DECODEC_COST:33},o={AUDIO_DECODED_BUFFER:15,PAUSE_STATUS:16,AUDIO_DECODED_BUFFER_LEN:17,VIDEO_REAL_FPS:18,IS_SHIELD_AUDIO:19,FRAME_BUFFER_LEN:20,LAST_VIDEO_RCV_TS:29,BROWSER_PAUSE_STATUS:30}},function(t,e,i){"use strict";i.d(e,"a",function(){return n});var s=i(2);function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var a=i(8);function n(t){return function(){var e,i=Object(s.a)(t);return e=!function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?i.apply(this,arguments):Reflect.construct(i,arguments,Object(s.a)(this).constructor),e&&("object"===r(e)||"function"==typeof e)?e:Object(a.a)(this)}}},function(t,e,i){"use strict";function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function r(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}i.d(e,"a",function(){return r})},function(t,e,i){"use strict";function s(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}i.d(e,"a",function(){return s})},function(t,e,i){"use strict";i.r(e),i.d(e,"WebCodecsErrType",function(){return s}),i.d(e,"ReceiveMessageType",function(){return r}),i.d(e,"ToMainMessageType",function(){return a}),i.d(e,"StoreWorkerType",function(){return n}),i.d(e,"MainSharedBufferType",function(){return o});var s={VIDEODECODEERROR:1,AUDIODECODEERROR:2,VIDEORENDEERROR:3,VIDEOFAST:4,AUDIOFAST:5,WORKERERROR:6},r={START:1,POSTFRAME:2,RESIZE:3,CLOSE:4,VISIBILITYCHANGE:5,AUDIOSAMPLES:6,VIDEOSAMPLES:7,AVCCONFIG:8,AVCPPS:9,AVCSPS:10,AACCONFIG:11,UPDATE_VIDEOFPS:12,SET_PLAY_MINBUFFER:13,SET_JITTER:14,SET_USE_SOFTACCELERATION:15,LOCAL_CONFIG:16,PAUSE_VIDEO_DECODE:17,PAUSE_AUDIO_DECODE:18,ENABLE_DISCARD_VIDEO:19,SET_AUDIO_WRITER:20,UPDATE_CURBITRATE:21,INIT_CONFIG:22,AVCVPS:23,RECV_FPS:24,FAST_OVER:25,LOG_CFG:26,UPDATE_SOFTACCELERATION:27,SET_ENHANCE:28,SET_SEGMENTTION:29,RECV_FAST_OVER:30,AV1_INIT_SEG:31,SEEK_TIME:32,SET_PLAYBACKRATE:33,SET_VOD_AV1:34},a={WebGLPLAY:1,STAT:2,PAUSE:3,WORKERSHAREBUFFER:4,VIDEORENDERERROR:5,LOG:6,AUDIODECODEDFRAME:7,VIDEODECODEERROR:8,AUDIODECODEERROR:9,INTERVAL:10,WOREKR_READY:11,TURN_TO_WEBCODECS_SOFT:12,AUDIO_PLAY:13,AUDIORENDERERROR:14,SOFT_TURN_TO_MSE:15,AUDIO_FRAME_DECODED:16,DECODE_COST:17,DECODE_DTS:18,WAIT_KEY_FRAME:19,SET_FRAME_PAUSE:20,SET_FRMAE_RESUME:21,RENDER_FPS_PAUSE:22,AUDIO_FORMAT_ERROR:23,VIDEO_ENHANCE_ERROR:24,VIDEO_ENHANCE_SUCCESS:25,ON_WCS_VIDEO_SEEK:26},n={VIDEO_PTS:0,VIDEO_RENDER_NUMS:1,VIDEO_NOT_RENDERD_BUFFER:2,AUDIO_TODECODE_NUMS:3,VIDEO_TODECODE_NUMS:4,AUDIO_DECODE_NUMS:5,VIDEO_DECODE_NUMS:6,VIDEO_DECODED_DELAY:7,VIDEO_READY_TO_RENDER_LIST_LEN:8,VIDEO_BUFFER_LEN:9,VIDEO_THROW_FRAME_FPS:11,AUDIO_DTS:12,AUDIO_RENDER_NUMS:13,VIDEO_DECODE_DISCARD_NUMS:14,VIDEO_DECODED_DELAY_SMOOTH:21,VIDEO_ENHANCE_NUMS:22,VIDEO_ENAHNCE_COST:23,VIDEO_ENHANCE_LESS30_NUMS:24,VIDEO_ENHANCE_LESS150_NUMS:25,VIDEO_ENHANCE_LESS200_NUMS:26,VIDEO_ENHANCE_LARGE200_NUMS:27,VIDEO_ENHANCE_TOTAL:28,AUDIO_WORKER_UN_RENDER_AUDIO_FRAMES:31,VIDEO_FIRST_FRAME_DECODEC_COST:32,AUDIO_FIRST_FRAME_DECODEC_COST:33},o={AUDIO_DECODED_BUFFER:15,PAUSE_STATUS:16,AUDIO_DECODED_BUFFER_LEN:17,VIDEO_REAL_FPS:18,IS_SHIELD_AUDIO:19,FRAME_BUFFER_LEN:20,LAST_VIDEO_RCV_TS:29,BROWSER_PAUSE_STATUS:30}},function(t,e,i){t.exports=i(28)},function(t,e,i){"use strict";i.d(e,"a",function(){return r});var s=i(14);function r(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=Object(s.a)(t))){var e=0,i=function(){};return{s:i,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a,n=!0,o=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return n=t.done,t},e:function(t){o=!0,a=t},f:function(){try{n||null==r.return||r.return()}finally{if(o)throw a}}}}}
vendor: 5,701 bytes, line 1
1,function(t,e,i){"use strict";e.a={printTodecodeVideo:!1,printToDecodeAudio:!1,printDecodedVideo:!1,printDecodedAudio:!1,printTorenderVideo:!1,printTorenderAudio:!1,printAppendVideo:!1,printAppendAudio:!1,printVideoDecodeFast:!1,printRenderSkipFrame:!1,setCfg:function(t){for(var e in t)this[e]=t[e]}}},function(t,e,i){"use strict";i.d(e,"a",function(){return n});var s=i(22),r=i(14),a=i(23);function n(t,e){return Object(s.a)(t)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var i=[],s=!0,r=!1,a=void 0;try{for(var n,o=t[Symbol.iterator]();!(s=(n=o.next()).done)&&(i.push(n.value),!e||i.length!==e);s=!0);}catch(t){r=!0,a=t}finally{try{s||null==o.return||o.return()}finally{if(r)throw a}}return i}}(t,e)||Object(r.a)(t,e)||Object(a.a)()}},function(t,e,i){"use strict";i.d(e,"a",function(){return r});var s=i(18);function r(t,e){if(t){if("string"==typeof t)return Object(s.a)(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Object(s.a)(t,e):void 0}}},function(t,e,i){"use strict";var s,r="object"==typeof Reflect?Reflect:null,a=r&&"function"==typeof r.apply?r.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)};s=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise(function(i,s){function r(i){t.removeListener(e,a),s(i)}function a(){"function"==typeof t.removeListener&&t.removeListener("error",r),i([].slice.call(arguments))}v(t,e,a,{once:!0}),"error"!==e&&"function"==typeof t.on&&v(t,"error",r,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(t){if("function"!=typeof t)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function d(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,i,s){var r,a,n;if(l(i),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),a=t._events),n=a[e]),void 0===n)n=a[e]=i,++t._eventsCount;else if("function"==typeof n?n=a[e]=s?[i,n]:[n,i]:s?n.unshift(i):n.push(i),(r=d(t))>0&&n.length>r&&!n.warned){n.warned=!0;var o=Error("Possible EventEmitter memory leak detected. "+n.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=t,o.type=e,o.count=n.length,console&&console.warn&&console.warn(o)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(t,e,i){var s={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},r=f.bind(s);return r.listener=i,s.wrapFn=r,r}function m(t,e,i){var s=t._events;if(void 0===s)return[];var r=s[e];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(t){for(var e=Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}(r):y(r,r.length)}function _(t){var e=this._events;if(void 0!==e){var i=e[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function y(t,e){for(var i=Array(e),s=0;s<e;++s)i[s]=t[s];return i}function v(t,e,i,s){if("function"==typeof t.on)s.once?t.once(e,i):t.on(e,i);else{if("function"!=typeof t.addEventListener)throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function r(a){s.once&&t.removeEventListener(e,r),i(a)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||n(t))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||n(t))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var s="error"===t,r=this._events;if(void 0!==r)s=s&&void 0===r.error;else if(!s)return!1;if(s){if(e.length>0&&(n=e[0]),n instanceof Error)throw n;var n,o=Error("Unhandled error."+(n?" ("+n.message+")":""));throw o.context=n,o}var u=r[t];if(void 0===u)return!1;if("function"==typeof u)a(u,this,e);else{var l=u.length,d=y(u,l);for(i=0;i<l;++i)a(d[i],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return l(e),this.on(t,p(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return l(e),this.prependListener(t,p(this,t,e)),this},o.prototype.removeListener=function(t,e){var i,s,r,a,n;if(l(e),void 0===(s=this._events)||void 0===(i=s[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit
1("removeListener",t,i.listener||e));else if("function"!=typeof i){for(r=-1,a=i.length-1;a>=0;a--)if(i[a]===e||i[a].listener===e){n=i[a].listener,r=a;break}if(r<0)return this;0===r?i.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(i,r),1===i.length&&(s[t]=i[0]),void 0!==s.removeListener&&this.emit("removeListener",t,n||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,i,s;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var r,a=Object.keys(i);for(s=0;s<a.length;++s)"removeListener"!==(r=a[s])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(void 0!==e)for(s=e.length-1;s>=0;s--)this.removeListener(t,e[s]);return this},o.prototype.listeners=function(t){return m(this,t,!0)},o.prototype.rawListeners=function(t){return m(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},o.prototype.listenerCount=_,o.prototype.eventNames=function(){return this._eventsCount>0?s(this._events):[]}},function(t,e,i){"use strict";function s(t,e,i,s,r,a,n){try{var o=t[a](n),u=o.value}catch(t){return void i(t)}o.done?e(u):Promise.resolve(u).then(s,r)}function r(t){return function(){var e=this,i=arguments;return new Promise(function(r,a){var n=t.apply(e,i);function o(t){s(n,r,a,o,u,"next",t)}function u(t){s(n,r,a,o,u,"throw",t)}o(void 0)})}}i.d(e,"a",function(){return r})},function(t,e,i){t.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(s,r,(function(e){return t[e]}).bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";function s(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function r(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s.key,s)}}function a(t,e,i){return e&&r(t.prototype,e),i&&r(t,i),t}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}function o(t,e){var i=Math.max(0,e-t.toString().length),s="";if(i>0)for(var r=0;r<i;r++)s+="0";return s+t}i.r(e);var u=[];function l(){for(var t,e,i,s,r,a,n,l,d=(e=(t=new Date).getFullYear(),i=o(t.getMonth()+1,2),s=o(t.getDate(),2),r=o(t.getHours(),2),a=o(t.getMinutes(),2),n=o(t.getSeconds(),2),"["+"".concat(e,"-").concat(i,"-").concat(s," ").concat(r,":").concat(a,":").concat(n)+"."+o(t.getMilliseconds(),3)+"][w265]"),c=arguments.length,f=Array(c),p=0;p<c;p++)f[p]=arguments[p];f[0]=d+f[0],self.logCallback?(l=self.logCallback).call.apply(l,[null].concat(f)):u.push(f)}var d=function(){function t(e,i){s(this,t),this.width=e,this.height=i,this.stridey=this.width,this.strideu=this.stridey/2,this.stridev=this.stridey/2}return a(t,[{key:"calc",value:function(t){for(var e=new Uint8Array(this.stridey*this.height).fill(128,0,this.stridey*this.height),i=new Uint8Array(this.strideu*this.height).fill(128,0,this.strideu*this.height),s=new Uint8Array(this.stridev*this.height).fill(128,0,this.stridev*this.height),r=new Uint8Array(this.width*this.height*4),a=1e3*window.performance.now(),n=0;n<t;n++)this.convertYUV420(e,i,s,this.width,this.height,this.stridey,this.strideu,this.stridev,r);return 1e3*window.performance.now()-a}}
1,{key:"convertYUV420",value:function(t,e,i,s,r,a,n,o,u){for(var l,d,c,f,p,m=0,_=0,y=s>>1,v=y*r,S=0,g=0,T=0,P=0;P<v;P++)p=P<<1,l=1.164*(t[S+(f=m<<1)]-16),d=e[g+m]-128,c=i[T+m]-128,u[0+(p<<2)]=l+1.596*c,u[1+(p<<2)]=l-.813*c-.391*d,u[2+(p<<2)]=l+2.018*d,u[3+(p<<2)]=255,l=1.164*(t[S+f+1]-16),u[0+(p+1<<2)]=l+1.596*c,u[1+(p+1<<2)]=l-.813*c-.391*d,u[2+(p+1<<2)]=l+2.018*d,u[3+(p+1<<2)]=255,++m===y&&(m=0,S+=a,g=(++_>>1)*n,T=(_>>1)*o)}}]),t}(),c=function(){function t(){s(this,t)}return a(t,null,[{key:"isSupportWasm",value:function(){return"object"==typeof WebAssembly}},{key:"isSupportWasmThread",value:function(){if("undefined"==typeof SharedArrayBuffer||"undefined"==typeof Atomics)return l("hevcd","SharedArrayBuffer undefined or Atomics undefined"),!1;var t=new WebAssembly.Memory({initial:1,maximum:1,shared:!0}).buffer instanceof SharedArrayBuffer;return self.SharedArrayBuffer&&self.Atomics&&t}}]),t}(),f=function(){function t(){s(this,t),this.cla="hevcd",this.configs=null,this.costUs=0,this.reason=0,this.cores=navigator.hardwareConcurrency,this.is64bit=this.is64bitSoftware(),this.enableCost=!0}return a(t,[{key:"parseConfigs",value:function(t){this.configs=t,l(this.cla,"parse",JSON.stringify(t),"cfg",this.configs.enableWebH265)}},{key:"isSupportH265",value:function(t,e){if(null==this.configs)return l(this.cla,"isSupportH265 configs==null"),!1;this.reason=0;var i=this.isConfigEnable()&&this.isCPUCoresSatisfy(e)&&this.isWasm()&&this.isBitrateInRange(e)&&this.isCostInRange(e);return l(this.cla,"isSupportH265",i,"kbps=",e,"costUs",this.costUs.toFixed(0),"cores",this.cores,"64b",this.is64bit,"reason",this.reason,"version",t,"cfg",JSON.stringify(this.configs)),l("ua:",navigator.userAgent),{isSupport:i,costUs:this.costUs.toFixed(0),reason:this.reason}}},{key:"isWasm",value:function(){return!!c.isSupportWasm()||(this.reason=7,!1)}},{key:"isConfigEnable",value:function(){return!(!this.hasOwnProperty("enableWebH265")||1!=this.configs.enableWebH265&&(this.reason=1,1))}},{key:"isCPUCoresSatisfy",value:function(t){if(this.hasOwnProperty("core")){var e=this.configs.core[2e3];if(this.configs.core.hasOwnProperty(t)&&(e=this.configs.core[t]),this.cores>e)return!0}else if(this.cores>4)return!0;return this.reason=2,!1}},{key:"is64bitSoftware",value:function(){return -1!=navigator.userAgent.indexOf("Macintosh")||-1!=navigator.userAgent.indexOf("x64")}},{key:"isBitrateInRange",value:function(t){return c.isSupportWasmThread()?!(!this.hasOwnProperty("multiThreadBitKbps")||((t>=4e3||0==t)&&!this.checkX86(t)?(this.reason=4,1):(!Array.isArray(this.configs.multiThreadBitKbps)||!this.configs.multiThreadBitKbps.includes(t))&&(this.reason=3,1))):(this.reason=6,!1)}},{key:"checkX86",value:function(t){if(this.is64bit)return!0;if(!this.hasOwnProperty("x86"))return!1;var e=!1;return this.configs.x86.hasOwnProperty(t)&&(e=1==this.configs.x86[t]),e}},{key:"isCostInRange",value:function(t){if(!this.enableCost)return!0;if(!this.hasOwnProperty("baseCostUs"))return!1;var e=this.configs.baseCostUs[2e3];return this.configs.baseCostUs.hasOwnProperty(t)&&(e=this.configs.baseCostUs[t]),this.costUs=this.getCost(),this.costUs<=e||(this.reason=5,!1)}},{key:"getCost",value:function(){var t=this;if(!this.hasOwnProperty("loopCount"))return l(this.cla,"getCost configs==null or has no key=loopCount"),0;var e=0;try{localStorage.hasOwnProperty("w265LastCost")&&(e=Number(localStorage.w265LastCost))}catch(t){e=99999}return this.sid&&clearTimeout(this.sid),this.sid=setTimeout(function(){var e=Math.floor(new d(120,120).calc(t.configs.loopCount));try{localStorage.w265LastCost=e}catch(t){}},5e3),e}},{key:"hasOwnProperty",value:function(t){return!!this.configs.hasOwnProperty(t)||(this.reason=1,!1)}}]),t}();e.default=function(){function t(){s(this,t),this.configMgr=new f}return a(t,[{key:"parseConfigs",value:function(t){this.configMgr.parseConfigs(t)}},{key:"isSupportH265",value:function(t){return this.configMgr.isSupportH265(this.version(),t)}},{key:"version",value:function(){return"1.5.3"}},{key:"setLogCallback",value:function(t){self.logCallback=t,l("Logger setLogCallback"),u.length>0&&(u.forEach(function(t){var e;(e=self.logCallback).call.apply(e,[null].concat(function(t){if(Array.isArray(t))return n(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return n(t,void 0);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(t,void 0):void 0}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()))}),u.length=0)}},{key:"isStripe",value:function(){return -1!==navigator.userAgent.indexOf("Windows")}}],[{key:"getInstance",value:function(){return this.instance||(this.instance=new t),this.instance}}]),t}()}]).default}
1,function(t,e,i){"use strict";function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}i.d(e,"a",function(){return s})},function(t,e,i){"use strict";var s={buildAbsoluteURL:function(t,e){if(e=e.trim(),/^[a-z]+:/i.test(e))return e;var i=null,r=null,a=/^([^#]*)(.*)$/.exec(e);a&&(r=a[2],e=a[1]);var n=/^([^\?]*)(.*)$/.exec(e);n&&(i=n[2],e=n[1]);var o=/^([^#]*)(.*)$/.exec(t);o&&(t=o[1]);var u=/^([^\?]*)(.*)$/.exec(t);u&&(t=u[1]);var l=/^((([a-z]+):)?\/\/[a-z0-9\.-]+(:[0-9]+)?\/)(.*)$/i.exec(t),d=l[3],c=l[1],f=l[5],p=null;return p=/^\/\//.test(e)?d+"://"+s.buildAbsolutePath("",e.substring(2)):/^\//.test(e)?c+s.buildAbsolutePath("",e.substring(1)):c+s.buildAbsolutePath(f,e),i&&(p+=i),r&&(p+=r),p},buildAbsolutePath:function(t,e){for(var i,s,r="",a=t.replace(/[^\/]*$/,e.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),n=0;(s=a.indexOf("/../",n))>-1;n=s+i)i=/^\/(?:\.\.\/)*/.exec(a.slice(s))[0].length,r=(r+a.substring(n,s)).replace(RegExp("(?:\\/+[^\\/]*){0,"+(i-1)/3+"}$"),"/");var o=/\.\.\//g;if(o.test(e)){var u=t.split("/"),l=e.match(o).length;r=u.splice(0,u.length-1-l);var d=a.substr(n);return d.startsWith("/")?r.join("/")+d:r.join("/")+"/"+d}return r+a.substr(n)},getTimeFromUrl:function(t,e){var i=t.match(e?/\d+_(\d+)_\d+.ts?/:/(\d+)_\d+_\d+.ts?/);return i?e?i[1]:Math.round(i[1]/1e3):-1},getVodUrl:function(t,e,i,s){return"http://106.38.255.95:9123/xcrs/"+t+"_"+e+"_"+i+".m3u8?btime="+s}};t.exports=s},function(t,e,i){"use strict";function s(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}i.d(e,"a",function(){return s})},function(t,e,i){function s(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i.oe=function(t){throw console.error(t),t};var s=i(i.s=ENTRY_MODULE);return s.default||s}function r(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}t.exports=function(t,e){e=e||{};var a={main:i.m},n=e.all?{main:Object.keys(a.main)}:function(t,e){for(var s={main:[e]},a={main:[]},n={main:{}};Object.keys(s).reduce(function(t,e){return t||s[e].length>0},!1);)for(var o=Object.keys(s),u=0;u<o.length;u++){var l=o[u],d=s[l].pop();if(n[l]=n[l]||{},!n[l][d]&&t[l][d]){n[l][d]=!0,a[l]=a[l]||[],a[l].push(d);for(var c=function(t,e,s){var a={};a[s]=[];var n=e.toString(),o=n.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var u,l=o[1],d=RegExp("(\\\\n|\\W)"+r(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=d.exec(n);)"dll-reference"!==u[3]&&a[s].push(u[3]);for(d=RegExp("\\("+r(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=d.exec(n);)t[u[2]]||(a[s].push(u[1]),t[u[2]]=i(u[1]).m),a[u[2]]=a[u[2]]||[],a[u[2]].push(u[4]);for(var c=Object.keys(a),f=0;f<c.length;f++)for(var p=0;p<a[c[f]].length;p++)isNaN(+a[c[f]][p])||(a[c[f]][p]=+a[c[f]][p]);return a}(t,t[l][d],l),f=Object.keys(c),p=0;p<f.length;p++)s[f[p]]=s[f[p]]||[],s[f[p]]=s[f[p]].concat(c[f[p]])}}return a}(a,t),o="";Object.keys(n).filter(function(t){return"main"!==t}).forEach(function(t){for(var e=0;n[t][e];)e++;n[t].push(e),a[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+t+" = ("+s.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+n[t].map(function(e){return JSON.stringify(e)+": "+a[t][e].toString()}).join(",")+"});\n"}),o=o+"new (("+s.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+n.main.map(function(t){return JSON.stringify(t)+": "+a.main[t].toString()}).join(",")+"}))(self);";var u=new window.Blob([o],{type:"text/javascript"});if(e.bare)return u;var l=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(l);return d.objectURL=l,d}}
1,function(t,e,i){"use strict";function s(t){if(Array.isArray(t))return t}i.d(e,"a",function(){return s})},function(t,e,i){"use strict";function s(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}i.d(e,"a",function(){return s})},function(t,e,i){"use strict";i.r(e);var s=i(0),r=i(1),a=i(7),n=i(6),o=i(15),u=i(10);e.default=new(function(t){Object(a.a)(i,t);var e=Object(n.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this))._taf=null,t._tafLink=new u.TafLinkImpl,t.requestId=1,t.TAFLINK_INITED="TAFLINK_INITED",t}return Object(r.a)(i,[{key:"inited",get:function(){return this._tafLink.inited}},{key:"connected",get:function(){return this._tafLink.connected}},{key:"getTaf",value:function(){return this._tafLink.getTaf()}},{key:"getUserId",value:function(){return this._tafLink.getUserId()}},{key:"getRequestId",value:function(){return this._tafLink.getRequestId()}},{key:"setTafHandler",value:function(t){this._tafLink.setTafHandler(t)}},{key:"sendWup",value:function(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:-1,n=arguments.length>6&&void 0!==arguments[6]&&arguments[6];this._tafLink.sendWup(t,e,i,s,r,a,n)}},{key:"sendYY",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this._tafLink.sendYY(t,e,i,s)}},{key:"on",value:function(t,e){return this._tafLink.on(t,e)}},{key:"off",value:function(t,e){return this._tafLink.off(t,e)}},{key:"addListener",value:function(t,e){return this._tafLink.addListener(t,e)}},{key:"removeListener",value:function(t,e){return this._tafLink.removeListener(t,e)}}]),i}(o.EventEmitter))},function(t,e){t.exports=function(t){console.log("[ Timer worker init ]");var e=null;function i(){clearInterval(e),e=null}t.addEventListener("message",function(s){switch(s.data){case"start":i(),e=setInterval(function(){t.postMessage({type:1})},10);break;case"stop":i()}}),t.addEventListener("messageerror",function(t){console.error("[TimerWorker.messageerror]",t)});var s=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||t.oRequestAnimationFrame,r=0,a=0,n=0;s(function e(){requestAnimationFrame(e),function(){var e=performance&&performance.now?performance.now():Date.now();if(r++,0===a)a=e;else{var i=e-a;if(i>=1e3){a=e;var s=Math.round(r/(i/1e3));r=0,n=Math.max(s,n),t.postMessage({type:2,data:n})}}}()})}},function(t,e,i){function s(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.i=function(t){return t},i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:s})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/",i.oe=function(t){throw console.error(t),t};var s=i(i.s=ENTRY_MODULE);return s.default||s}function r(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}t.exports=function(t,e){e=e||{};var a={main:i.m},n=e.all?{main:Object.keys(a.main)}:function(t,e){for(var s={main:[e]},a={main:[]},n={main:{}};Object.keys(s).reduce(function(t,e){return t||s[e].length>0},!1);)for(var o=Object.keys(s),u=0;u<o.length;u++){var l=o[u],d=s[l].pop();if(n[l]=n[l]||{},!n[l][d]&&t[l][d]){n[l][d]=!0,a[l]=a[l]||[],a[l].push(d);for(var c=function(t,e,s){var a={};a[s]=[];var n=e.toString(),o=n.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!o)return a;for(var u,l=o[1],d=RegExp("(\\\\n|\\W)"+r(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=d.exec(n);)"dll-reference"!==u[3]&&a[s].push(u[3]);for(d=RegExp("\\("+r(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=d.exec(n);)t[u[2]]||(a[s].push(u[1]),t[u[2]]=i(u[1]).m),a[u[2]]=a[u[2]]||[],a[u[2]].push(u[4]);for(var c=Object.keys(a),f=0;f<c.length;f++)for(var p=0;p<a[c[f]].length;p++)isNaN(+a[c[f]][p])||(a[c[f]][p]=+a[c[f]][p]);return a}(t,t[l][d],l),f=Object.keys(c),p=0;p<f.length;p++)s[f[p]]=s[f[p]]||[],s[f[p]]=s[f[p]].concat(c[f[p]])}}return a}(a,t),o="";Object.keys(n).filter(function(t){return"main"!==t}
vendor: 9,740 bytes, line 1
1).forEach(function(t){for(var e=0;n[t][e];)e++;n[t].push(e),a[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",o=o+"var "+t+" = ("+s.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+n[t].map(function(e){return JSON.stringify(e)+": "+a[t][e].toString()}).join(",")+"});\n"}),o=o+"new (("+s.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+n.main.map(function(t){return JSON.stringify(t)+": "+a.main[t].toString()}).join(",")+"}))(self);";var u=new window.Blob([o],{type:"text/javascript"});if(e.bare)return u;var l=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(u),d=new window.Worker(l);return d.objectURL=l,d}},function(t,e,i){t.exports=i(29)('!function(t){var e={};function s(i){if(e[i])return e[i].exports;var a=e[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,s),a.l=!0,a.exports}s.m=t,s.c=e,s.d=function(t,e,i){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)s.d(i,a,function(e){return t[e]}.bind(null,a));return i},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=0)}([function(t,e,s){"use strict";function i(t,e){for(var s=0;s<e.length;s++){var i=e[s];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function a(t,e,s){return e&&i(t.prototype,e),s&&i(t,s),t}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}s.r(e);var h=a((function t(){r(this,t)}));h.INIT="init",h.INITED="inited",h.STOP="stop",h.PAUSE="pause",h.RESUME="resume",h.PLAY="play",h.AUDIO_FRAME="audio_frame",h.UPDATE_CURRENT_TIME="update_current_time",h.TIME_STAMP="timestamp",h.VOLUME="volume",h.AUDIO_DATA_NAN="AUDIO_DATA_NAN",h.AUDIO_DATA_MUTE="AUDIO_DATA_MUTE",h.LOG_CFG="LOG_CFG",h.UPDATE_PLAYBACKRATE="UPDATE_PLAYBACKRATE",h.SEEK="SEEK",h.ON_VIDEO_SEEK="ON_VIDEO_SEEK";var o=h,n=12,u=13,m=31,l=function(){function t(){r(this,t),this.m_sampleRate=44100,this.MAX_WSOLA_DELAY_MS=80,this.MIN_32bit=-2147483648,this.m_DelaySamples=this.m_sampleRate*this.MAX_WSOLA_DELAY_MS/1e3,this.m_channels=2,this.m_leftSampleNum=0,this.m_speedWsola=1,this.m_tempoInstr=0,this.m_outBuffer=[],this.m_inBuffer=[],this.dataCallback=null,this.lastFrameTimeStamp=0}return a(t,[{key:"updateSpeed",value:function(t){t=(t=t<.2?.2:t)>2?2:t,this.m_speedWsola=t,1==this.m_speedWsola?this.m_tempoInstr=0:this.m_speedWsola>=1?this.m_speedWsola>=1.25?(this.m_speedWsola=this.m_speedWsola>2?2:this.m_speedWsola,this.m_tempoInstr=2):this.m_tempoInstr=1:this.m_speedWsola<.5?(this.m_speedWsola=this.m_speedWsola<.2?.2:this.m_speedWsola,this.m_tempoInstr=-2):this.m_tempoInstr=-1}},{key:"init",value:function(t,e,s,i){this.dataCallback=i,this.m_sampleRate=t,this.m_DelaySamples=this.m_sampleRate*this.MAX_WSOLA_DELAY_MS/1e3,this.m_channels=e,this.updateSpeed(s)}},{key:"clearInputBuffer",value:function(){this.m_leftSampleNum=0,this.lastFrameTimeStamp=0,this.m_inBuffer=[],this.m_outBuffer=[]}},{key:"tempo_processData",value:function(t,e,s){this.lastFrameTimeStamp=s;for(var i,a=this.m_sampleRate/100,r=0,h=0,o=0,n=0,u=0,m=0,l=0,f=0,p=0,d=0,_=0,c=1,A=0,N=0,S=0,D=0;D<t.length;D++)this.m_inBuffer.push(t[D]);if(this.m_leftSampleNum+=e,this.m_leftSampleNum<this.m_DelaySamples)return 0;switch(this.m_tempoInstr){case 2:case 1:r=4*a,h=u=2*a,o=Math.floor(a*(4*this.m_speedWsola-2)),n=a+1>>1;break;case-1:r=8*a,h=u=4*a,o=Math.floor(a*(8*this.m_speedWsola-4)),n=a+1>>1;break;case-2:e>this.m_leftSampleNum&&(e=this.m_leftSampleNum),this.m_leftSampleNum-=e,this.m_inBuffer.splice(0,e*this.m_channels);for(var T=[],y=e*this.m_channels/this.m_speedWsola,g=0;g<y;g++)T.push(0);var b=this.m_leftSampleNum/e*10,B=this.lastFrameTimeStamp-b;return this.dataCallback(T,B),e*this.m_channels;case 0:this.m_outBuffer=[];for(var E=0;E<e*this.m_channels;E++)this.m_outBuffer.push(this.m_inBuffer[E]);e>this.m_leftSampleNum&&(e=this.m_leftSampleNum),this.m_leftSampleNum-=e,this.m_inBuffer.splice(0,e*this.m_channels);for(var k=[],v=0;v<e*this.m_channels;v++)k.push(this.m_outBuffer.shift());var L=this.m_leftSampleNum/e*10,M=this.lastFrameTimeStamp-L;return this.dataCallback(k,M),e*this.m_channels}i=1/u;for(var C=(new Date).getTime();this.m_leftSampleNum>=this.m_DelaySamples;){if((new Date).getTime()-C>2e3)return;for(f=0;f<r*this.m_channels;f++)this.m_outBuffer[f]=this.m_inBuffer[f];if(l=this.MIN_32bit,2==this.m_channels){for(f=0;f<2*n;f++){m=0;for(var F=(r-u)*this.m_channels,O=0;O<u;O++)m+=Math.floor(this.m_outBuffer[F+2*O]*this.m_inBuffer[2*(o+f-n)+2*O]),m+=Math.floor(this.m_outBuffer[F+2*O+1]*this.m_inBuffer[2*(o+f-n)+2*O+1]);l<m&&(l=m,d=f)}for(_=d-n,c=1,A=0,f=0;f<u;f++)this.m_outBuffer[2*(f+h)]=c*this.m_outBuffer[2*(f+h)]+A*this.m_inBuffer[2*(f+o+_)],this.m_outBuffer[2*(f+h)+1]=c*this.m_outBuffer[2*(f+h)+1]+A*this.m_inBuffer[2*(f+o+_)+1],c-=i,A+=i}else{for(f=0;f<2*n;f++){for(m=0,p=0;p<u;p++)m+=Math.floor(psOutBuffer[r-u+p]*psInBuffer[o+f-n+p]);l<m&&(l=m,d=f)}for(_=d-n,c=1,A=0,f=0;f<u;f++)this.m_outBuffer[f+h]=c*this.m_outBuffer[f+h]+A*this.m_inBuffer[f+o+_],c-=i,A+=i}N+=r*this.m_channels,(S=o+_+u)>this.m_leftSampleNum&&(S=this.m_leftSampleNum),this.m_leftSampleNum-=S,this.m_inBuffer.splice(0,2*S)}for(var I=[],P=0;P<N;P++)I.push(this.m_outBuffer.shift());var w=this.m_leftSampleNum/e*10,U=this.lastFrameTimeStamp-w;this.dataCallback(I,U)}}]),t}();class f extends AudioWorkletProcessor{constructor(t){super(t),this.port.onmessage=this.onMessage.bind(this),this.audioList=[],this.channelDataLength=128,this.outputChannelNums=2,this.traceNums=0,this.currentTime=0,this.inited=!1,this.renderNums=0,this._id=0,this.postMessage(o.INITED),this.isAudioDataNaNCnt=0,this.isAudioDataZeroCnt=0,this.printProcess=!1,this.printAudioData=!1,this.overFlowTs=0,this.volume=1,this.simulateTempo=null,this.audioSampleRate=44100,this.playbackRate=1,this.playMode=0,this.isSeek=!1,this.recvNums=0,this.paused=!1}postMessage(t,e){this.port.postMessage({type:t,data:e})}onMessage(t){switch(t.data.type){case o.INIT:this.outputChannelNums=t.data.data.outputChannelCount,this.inited=!0,this._id=t.data.data.id,this.playMode=t.data.data.playMode,this.mainSharedArrayBuffer=t.data.data.mainSharedArrayBuffer,this.playbackRate=t.data.data.playbackRate,this.initSimulateTempo();break;case o.PAUSE:this.paused=!0;break;case o.STOP:this.audioList.length=0;break;case o.PLAY:case o.RESUME:this.paused=!1;break;case o.AUDIO_FRAME:if(this.recvNums++,this.isSeek)return;0==this.playMode?this.audioFrameTransToFloat32Array_new(t.data.data):this.audioFrameTransToFloat32Array_playbackrate(t.data.data);break;case o.VOLUME:this.volume=t.data.data;break;case o.LOG_CFG:this.printProcess=t.data.data.printProcess,this.printAudioData=t.data.data.printAudioData,this.printRenderSkipAudio=t.data.data.printRenderSkipAudio;break;case o.UPDATE_PLAYBACKRATE:this.playbackRate=t.data.data,this.simulateTempo.updateSpeed(this.playbackRate);break;case o.SEEK:this.printProcess&&console.log("AudioWorkletNodeRenderer web seek"),this.isSeek=!0,this.audioList.length=0,this.simulateTempo&&this.simulateTempo.clearInputBuffer();break;case o.ON_VIDEO_SEEK:this.printProcess&&console.log("AudioWorkletNodeRenderer web onVideoSeek"),this.isSeek=!1}}initSimulateTempo(){this.simulateTempo=new l,this.simulateTempo.init(this.audioSampleRate,this.outputChannelNums,this.playbackRate,this.simulateTempoDataCallback.bind(this))}setAudioCurrentDts(t){this.currentTime!=t&&(this.printProcess&&console.log("BypassProcessor.setAudioCurrentDts now",t,"diff",t-this.currentTime),this.currentTime=t,this.currentTime&&(this.renderNums+=1,this.mainSharedArrayBuffer&&Atomics.store(this.mainSharedArrayBuffer,n,this.currentTime),this.mainSharedArrayBuffer&&Atomics.store(this.mainSharedArrayBuffer,u,this.renderNums),this.mainSharedArrayBuffer&&Atomics.store(this.mainSharedArrayBuffer,m,this.recvNums-this.renderNums)),this.postMessage("timestamp",{timeStamp:t,renderNums:this.renderNums}))}handleOuputs(t,e){if(this.audioList.length<1||this.paused)return!0;const s=t[0];this.channelDataLength=s[0].length;let i=this.audioList.shift(),a=i.buffer,r=this.renderNums<5?0:this.volume;i.isEmptyAudioFrame&&(r=0);for(var h=0;h<a.byteLength;h++)for(var o=0;o<s.length;o++)s[o][h]=a[h*s.length+o]*r,this.traceNums++;return this.setAudioCurrentDts(i.timestamp),!0}handleOuputs_playbackrate(t,e){if(this.audioList.length<1||this.paused)return!0;const s=t[0];this.channelDataLength=s[0].length;let i=this.audioList[0],a=i.buffer,r=i.offset,h=this.renderNums<5?0:this.volume;for(var o=0;o<this.channelDataLength;o++)for(var n=0;n<s.length;n++)if(s[n][o]=a[r]*h,r++,r==a.length){if(this.audioList.shift(),this.audioList.length<1)return!0;r=0,i=this.audioList[0],a=i.buffer}return i.offset=r,this.setAudioCurrentDts(i.timestamp),!0}checkDrop(){let t=this.audioList.length;if(t>2){let e=this.audioList[0];if(this.audioList[t-1].timestamp-e.timestamp>80){let s=Date.now();if(0===this.overFlowTs)this.overFlowTs=s;else if(s-this.overFlowTs>4e3&&this.renderNums%10==0){let s=0,i=0,a=0;for(let r=0;r<t;r++){let t=this.audioList[r];if(0===s&&e.timestamp<t.timestamp)i=r,s=t.timestamp;else if(s>0&&t.timestamp>s){a=r;break}}let r=this.audioList.splice(i,a-i);if(this.printRenderSkipAudio){let t=[];
1r.forEach(e=>{t.push(e.timestamp)}),console.log(`BypassProcessor.checkDrop pts=${s} dropIndex=[${i},${a}] ${t.toString()}`)}}}else this.overFlowTs=0}}audioFrameTransToFloat32Array_new(t){if(!this.inited)return;t.frameBuffer;let e=!0,s=[];for(let e=0;e<t.frameBuffers.length;e++){let i=new Float32Array(t.frameBuffers[e],0,1024);s.push(i)}let i=[],a=s[0].length;for(var r=0;r<a;r++)for(let a=0;a<s.length;a++){if(Number.isNaN(s[a][r])&&(this.isAudioDataNaNCnt++,this.isAudioDataNaNCnt>=3)){this.postMessage(o.AUDIO_DATA_NAN);break}if(0!=s[a][r]&&(e=!1),i.push(s[a][r]),i.length===this.channelDataLength*this.outputChannelNums){let e=new Float32Array(this.channelDataLength*this.outputChannelNums);e.set(i.splice(0,this.channelDataLength*this.outputChannelNums)),this.audioList.push({timestamp:t.timeStamp,buffer:e,isEmptyAudioFrame:t.isEmptyAudioFrame})}}this.printAudioData&&console.log(`BypassProcessor.audioFrameTransToFloat32Array_new timeStamp=${t.timeStamp} audioList.length=${this.audioList.length}`),e&&0!=this.volume&&(this.isAudioDataZeroCnt++,this.isAudioDataZeroCnt>=100&&this.postMessage(o.AUDIO_DATA_MUTE))}simulateTempoDataCallback(t,e){let s=new Float32Array(t.length);s.set(t),this.audioList.push({timestamp:e,buffer:s,offset:0})}audioFrameTransToFloat32Array_playbackrate(t){if(!this.inited)return;t.frameBuffer;let e=!0,s=[];for(let e=0;e<t.frameBuffers.length;e++){let i=new Float32Array(t.frameBuffers[e],0,1024);s.push(i)}let i=[],a=s[0].length;for(var r=0;r<a;r++)for(let t=0;t<s.length;t++){if(Number.isNaN(s[t][r])&&(this.isAudioDataNaNCnt++,this.isAudioDataNaNCnt>=3)){this.postMessage(o.AUDIO_DATA_NAN);break}0!=s[t][r]&&(e=!1),i.push(s[t][r])}this.simulateTempo.tempo_processData(i,i.length/this.outputChannelNums,t.timeStamp),this.printAudioData&&console.log(`BypassProcessor.audioFrameTransToFloat32Array_new timeStamp=${t.timeStamp} audioList.length=${this.audioList.length}`),e&&0!=this.volume&&(this.isAudioDataZeroCnt++,this.isAudioDataZeroCnt>=100&&this.postMessage(o.AUDIO_DATA_MUTE))}audioFrameTransToFloat32Array(t){if(!this.inited)return;let e=t.frameBuffer,s=new Float32Array(e),i=[],a=!0;for(let e=0;e<s.length;e++){if(Number.isNaN(s[e])&&(this.isAudioDataNaNCnt++,this.isAudioDataNaNCnt>=3)){this.postMessage(o.AUDIO_DATA_NAN);break}if(0!=s[e]&&(a=!1),i.push(s[e]),i.length===this.channelDataLength*this.outputChannelNums){let e=new Float32Array(this.channelDataLength*this.outputChannelNums);e.set(i.splice(0,this.channelDataLength*this.outputChannelNums)),this.audioList.push({timestamp:t.timeStamp,buffer:e,isEmptyAudioFrame:t.isEmptyAudioFrame})}}a&&0!=this.volume&&(this.isAudioDataZeroCnt++,this.isAudioDataZeroCnt>=100&&this.postMessage(o.AUDIO_DATA_MUTE))}process(t,e){return 0==this.playMode?this.handleOuputs(e):this.handleOuputs_playbackrate(e)}}registerProcessor("bypass-processor",f)}]);')},function(t,e,i){t.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(s,r,(function(e){return t[e]}).bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=98)}([function(t,e,i){"use strict";e.__esModule=!0,e.default=function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}},function(t,e,i){"use strict";e.__esModule=!0;var s,r=(s=i(105))&&s.__esModule?s:{default:s};e.default=function(){function t(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),(0,r.default)(t,s.key,s)}}
1return function(e,i,s){return i&&t(e.prototype,i),s&&t(e,s),e}}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(0)),r=a(i(1));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];(0,s.default)(this,t),this.hasHeader=e,this.segments=[],this.data=null,this.totalLen=0,this.uri=0,this.hasHeader&&(this.pushUInt32(10),this.pushUInt32(this.uri),this.pushUInt16(200))}return(0,r.default)(t,[{key:"marshall",value:function(){if(0===this.segments.length)return null;this.data=new Uint8Array(this.totalLen);for(var t=0,e=0;e<this.segments.length;++e){var i=this.segments[e];this.data.set(i,t),t+=i.length}return this.hasHeader&&(this.replaceUInt32(0,this.totalLen),this.replaceUInt32(4,this.uri)),this.data}},{key:"setUri",value:function(t){this.uri=t}},{key:"replaceUInt32",value:function(t,e){new DataView(this.data.buffer).setUint32(t,e,!0)}},{key:"pushBool",value:function(t){this.pushUInt8(+!!t)}},{key:"pushUInt8",value:function(t){var e=new Uint8Array(1);new DataView(e.buffer).setUint8(0,t),this.segments.push(e),this.totalLen++}},{key:"pushUInt16",value:function(t){var e=new Uint8Array(2);new DataView(e.buffer).setUint16(0,t,!0),this.segments.push(e),this.totalLen+=2}},{key:"pushUInt32",value:function(t){var e=new Uint8Array(4);new DataView(e.buffer).setUint32(0,t,!0),this.segments.push(e),this.totalLen+=4}},{key:"pushUInt64",value:function(t){var e=new Uint8Array(8),i=new DataView(e.buffer);i.setUint32(0,t%0x100000000,!0),i.setUint32(4,t/0x100000000|0,!0),this.segments.push(e),this.totalLen+=8}},{key:"pushUint8Array",value:function(t){this.pushUInt16(t.length),this.segments.push(t),this.totalLen+=t.length}},{key:"pushUint8ArrayWithoutLen",value:function(t){this.segments.push(t),this.totalLen+=t.length}},{key:"pushUint8Array32",value:function(t){this.pushUInt32(t.length),this.segments.push(t),this.totalLen+=t.length}},{key:"pushUInt32Vector",value:function(t){this.pushUInt32(t.length);for(var e=0;e<t.length;e++)this.pushUInt32(t[e])}},{key:"pushUInt64Vector",value:function(t){this.pushUInt32(t.length);for(var e=0;e<t.length;e++)this.pushUInt64(t[e])}},{key:"pushUInt16Vector",value:function(t){this.pushUInt32(t.length);for(var e=0;e<t.length;e++)this.pushUInt16(t[e])}},{key:"popObjVector",value:function(t){for(var e=this.popUInt32(),i=[],s=0;s<e;s++){var r=new t;i.push(r.unmarshall(this))}return i}},{key:"pushString",value:function(t){this.pushUInt16(t.length);for(var e=new Uint8Array(t.length),i=new DataView(e.buffer),s=0;s<t.length;++s)i.setUint8(s,t.charCodeAt(s));this.segments.push(e),this.totalLen+=t.length}},{key:"pushString32",value:function(t){this.pushUInt32(t.length);for(var e=new Uint8Array(t.length),i=new DataView(e.buffer),s=0;s<t.length;++s)i.setUint8(s,t.charCodeAt(s));this.segments.push(e),this.totalLen+=t.length}}]),t}()},function(t,e){var i=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=i)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={PAudienceGetProxyListReq:530178,PAudienceGetProxyListRsp:530434,PNotifyStreamSwitch:268034,PLoginVideoProxyUniformly:5650690,PLoginVideoProxyUniformlyRes:5650434,PNotifyCurrentCdnStream:2739202,PNotifyCurrentStream4:2675714,PSubscribeStream3:2667266,PSubscribeStreamRes3:2667522,PStreamData3:2666754,PStopStream3:2666498,PStopStream:2560514,PPullStreamData:2694146,PResendStreamData4:2689026,PResendStreamDataFailAck:2694402,PVideoSyncSpeakerTime3:2674690,PForceConnectVideoProxy3:2685442,PVideoProxyPing3:2669570,PVideoProxyPingRes4:2683650,PNotifyMultiVideo:2746370,PLoginAndSubscribe:4097282,PLoginAndSubscribeRes:4097538,PNotifyUplinkRecvCount3:2672642,PVideoBroadcast4:2754050,PUpdateVideoConfig2:2569474,PVideoQualityStatistics:2591746,PP2pPing2:40706,PP2pPing3:41218,PP2pVideoPing3:2671874,VIDEOP2P_PFlashP2PKeepAlive:3072514,VIDEOP2P_PFlashP2PKeepAliveRes:3072770,P2PGetNodesProxy3:2673410,P2PGetNodesProxyRes3:2673666,P2PSubscribeStream3:2673922,P2PRemoveSubscribe3:2674178,P2PKeepAlive:3074562,P2PKeepAliveRes:3074818,P2PNotifyNodeLeave:3075074,P2PSyncDepth:3075330,P2PKeepAliveWebrtc:3075842,P2PKeepAliveWebrtcRes:3076098,PP2PWSForward:2757378,PP2PWSForwardReject:5653506,P2PSubStream:3073026,P2PSubStreamRes:3073282,P2PSyncSubTree:3073538,P2PTest:3073794,P2PRemoveSub:3074306,P2PRemoveSubRes:3075586,P2PStreamAlive:3076354,P2POffer:0xbbee02,P2PAnswer:0xbbef02,P2PCandidate:0xbbf002,P2POfferReject:0xbbf102,P2PRequestOffer:0xbbf202,P2PVersionFailed:0xbbf302,P2PPingOverProxy:0xbbf402,P2PPunchBackReq:0xbbf502,P2PPunchBackRsp:0xbbf602,PCDNNotifyUrl:0x13c7b02,PCDNStatusReport:0x13c7c02,PCDNGetUrl:0x13c7d02,PCDNSwitchUrl:0x13c7e02,PCdnP2PWSForward:53283,PCdnP2PWSForwardReject:53539,PCdnProxyPing:26147,PCdnProxyPingRes:26403,PCdnP2PStatics:26659,PCdnP2PErrStatics:26915,PCdnP2pGetNode:51235,PCdnP2pGetNodeRes:51491,PCdnP2PNodePingThroughProxy:52259,PCdnP2PNodePunchThroughProxy:52515,PCdnP2PUserRegister:52771,PCdnP2PUserRegisterRes:53027,PCdnP2pReportLog:54051,PCdnForceConnect
1VideoProxy:54563,PCDNGetProxyListReq:153635,PCDNGetProxyListRsp:153891,PCDNGetSliceStreamInfoReq:154147,PCDNGetSliceStreamInfoRsp:154403,PCDNSubscribeReq:768547,PCDNSubscribeRes:768803,PCDNCompeteSubscribeReq:769059,PCDNCompeteSubscribeRes:769315,PCDNForceSubscribeNotify:769571,PCdnP2pUserUnRegister:770083,PP2pSliceData:511779,PP2pSliceAudioData:512035,PP2pSliceVideoData:512291,PP2pSliceCommonData:514083,PP2pSliceSignalData:514595,PP2pSliceAudioDataV2:517411,PP2pSliceAudioDataV3:517667,PP2pSliceControlData:1024547,PForceConnectCdnVideoProxy3:2711042,HuyaDelaySeiData:0x1117302};!function t(){if(!t.done){t.done=!0;var e=[];for(var i in s){var r=s[i];e.push({uri:r,name:i})}e.forEach(function(t){s[t.uri]=t.name})}}(),e.default=s},function(t,e,i){var s=i(8),r=i(3),a=i(17),n=i(12),o=i(14),u=function t(e,i,u){var l,d,c,f=e&t.F,p=e&t.G,m=e&t.S,_=e&t.P,y=e&t.B,v=e&t.W,S=p?r:r[i]||(r[i]={}),g=S.prototype,T=p?s:m?s[i]:(s[i]||{}).prototype;for(l in p&&(u=i),u)(d=!f&&T&&void 0!==T[l])&&o(S,l)||(c=d?T[l]:u[l],S[l]=p&&"function"!=typeof T[l]?u[l]:y&&d?a(c,s):v&&T[l]==c?function(t){var e=function(e,i,s){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,i)}return new t(e,i,s)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(c):_&&"function"==typeof c?a(Function.call,c):c,_&&((S.virtual||(S.virtual={}))[l]=c,e&t.R&&g&&!g[l]&&n(g,l,c)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},function(t,e,i){t.exports=!i(15)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(39)("wks"),r=i(27),a=i(8).Symbol,n="function"==typeof a;(t.exports=function(t){return s[t]||(s[t]=n&&a[t]||(n?a:r)("Symbol."+t))}).store=s},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e,i){var s=i(13),r=i(67),a=i(40),n=Object.defineProperty;e.f=i(6)?Object.defineProperty:function(t,e,i){if(s(t),e=a(e,!0),s(i),r)try{return n(t,e,i)}catch(t){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(t[e]=i.value),t}},function(t,e,i){t.exports={default:i(132),__esModule:!0}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,i){var s=i(9),r=i(28);t.exports=i(6)?function(t,e,i){return s.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var s=i(11);t.exports=function(t){if(!s(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={logger:null}},function(t,e,i){var s=i(66);t.exports=function(t,e,i){if(s(t),void 0===e)return t;switch(i){case 1:return function(i){return t.call(e,i)};case 2:return function(i,s){return t.call(e,i,s)};case 3:return function(i,s,r){return t.call(e,i,s,r)}}return function(){return t.apply(e,arguments)}}},function(t,e,i){var s=i(44),r=i(37);t.exports=function(t){return s(r(t))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(55)),n=o(i(2));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.streamName="",this.codecType=0,this.cdnBrand=0}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new n.default(!1);return t.pushString(this.streamName),t.pushUInt16(this.codecType),t.pushUInt16(this.cdnBrand),t.marshall()}},{key:"unmarshall",value:function(t){return this.streamName=t.popString(),this.codecType=t.popUInt16(),this.cdnBrand=t.popUInt16(),this}},{key:"getDefCodecRate",value:function(){return this.codecType>=a.default.VIDEO_264_START&&this.codecType<=a.default.VIDEO_H264_END?100*(this.codecType-a.default.VIDEO_264_START):this.codecType>=a.default.VIDEO_265_START&&this.codecType<=a.default.VIDEO_H265_END?100*(this.codecType-a.default.VIDEO_265_START):128}},{key:"text",value:function(){return this.streamName+"_"+this.codecType+"_"+this.cdnBrand}},{key:"equal",value:function(t){return!!t&&this.streamName==t.streamName&&this.codecType==t.codecType&&this.cdnBrand==t.cdnBrand}}
1,{key:"isValidID",get:function(){return this.codecType>0}},{key:"isH264",get:function(){return this.codecType>=a.default.VIDEO_264_START&&this.codecType<=a.default.VIDEO_H264_END}},{key:"isH265",get:function(){return this.codecType>=a.default.VIDEO_265_START&&this.codecType<=a.default.VIDEO_H265_END}}]),t}()},function(t,e,i){t.exports={default:i(102),__esModule:!0}},function(t,e,i){var s=i(37);t.exports=function(t){return Object(s(t))}},function(t,e,i){"use strict";e.__esModule=!0;var s,r=(s=i(69))&&s.__esModule?s:{default:s};e.default=function(t,e){if(!t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"===(void 0===e?"undefined":(0,r.default)(e))||"function"==typeof e)?e:t}},function(t,e){t.exports={}},function(t,e,i){"use strict";e.__esModule=!0;var s=n(i(125)),r=n(i(129)),a=n(i(69));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":(0,a.default)(e)));t.prototype=(0,r.default)(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(s.default?(0,s.default)(t,e):t.__proto__=e)}},function(t,e,i){"use strict";function s(t,e){var i=Math.max(0,e-t.toString().length),s="";if(i>0)for(var r=0;r<i;r++)s+="0";return s+t}Object.defineProperty(e,"__esModule",{value:!0});var r=0;e.default={now:function(){if(void 0!==window.performance){var t=window.performance;if(void 0!==t.now)return~~t.now();if(void 0!==t.webkitNow)return~~t.webkitNow();if(void 0!==t.mozNow)return~~t.mozNow();if(void 0!==t.msNow)return~~t.msNow()}0===r&&(r=Date.now()-1);var e=Date.now()-r;return e>0xffffffff?(r+=0xffffffff,e-0xffffffff):e},utc:function(){return Math.round(Date.now()/1e3)},getDateStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=null;return(e=t?new Date(t):new Date).getFullYear()+"-"+s(e.getMonth()+1,2)+"-"+s(e.getDate(),2)},getTimeStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null,r=s((i=t?new Date(t):new Date).getHours(),2)+":"+s(i.getMinutes(),2)+":"+s(i.getSeconds(),2);return e&&(r+="."+s(i.getMilliseconds(),3)),r},getDateTimeStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null,r=(i=t?new Date(t):new Date).getFullYear()+"-"+s(i.getMonth()+1,2)+"-"+s(i.getDate(),2)+" "+s(i.getHours(),2)+":"+s(i.getMinutes(),2)+":"+s(i.getSeconds(),2);return e&&(r+="."+s(i.getMilliseconds(),3)),r}}},function(t,e){t.exports=!0},function(t,e){var i=0,s=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+s).toString(36))}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,i){var s=i(13),r=i(112),a=i(47),n=i(38)("IE_PROTO"),o=function(){},u=function(t){function e(){return t.apply(this,arguments)}return e.toString=function(){return t.toString()},e}(function(){var t,e=i(68)("iframe"),s=a.length;for(e.style.display="none",i(115).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;s--;)delete u.prototype[a[s]];return u()});t.exports=Object.create||function(t,e){var i;return null!==t?(o.prototype=s(t),i=new o,o.prototype=null,i[n]=t):i=u(),void 0===e?i:r(i,e)}},function(t,e,i){var s=i(71),r=i(47);t.exports=Object.keys||function(t){return s(t,r)}},function(t,e,i){var s=i(9).f,r=i(14),a=i(7)("toStringTag");t.exports=function(t,e,i){t&&!r(t=i?t:t.prototype,a)&&s(t,a,{configurable:!0,value:e})}},function(t,e){e.f=({}).propertyIsEnumerable},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(10)),r=n(i(0)),a=n(i(1));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(e){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];(0,r.default)(this,t),this.view=e,this.pos=0,this.len=0,this.uri=0,this.resCode=0,!0===i&&(this.len=this.popUInt32(),this.uri=this.popUInt32(),this.resCode=this.popUInt16())}return(0,a.default)(t,[{key:"bytesAvailable",value:function(){return this.view.byteLength-this.pos}},{key:"popBool",value:function(){return 1==this.popUInt8()}},{key:"popUInt8",value:function(){if(this.pos+1>this.view.byteLength)return 0;var t=this.view.getUint8(this.pos);return this.pos++,t}},{key:"popUInt16",value:function(){if(this.pos+2>this.view.byteLength)return 0;var t=this.view.getUint16(this.pos,!0);return this.pos+=2,t}},{key:"popUInt32",value:function(){if(this.pos+4>this.view.byteLength)return 0;var t=this.view.getUint32(this.pos,!0);return this.pos+=4,t}},{key:"popUInt64",value:function(){if(this.pos+8>this.view.byteLength)return 0;var t=this.view.getUint32(this.pos,!0);this.pos+=4;var e=this.view.getUint32(this.pos,!0);return this.pos+=4,0x100000000*e+t}},{key:"popInt64",value:function(){for(var t=0,e=(128&this.view.getUint8(this.pos+7))>0,i=!0,s=0;s<8;s++){var r=this.view.getUint8(this.pos+s);e&&(i?0!=r&&(r=255&~(r-1),i=!1):r=255&~r),t+=r*Math.pow(2,8*s)}return e&&(t=-t),this.pos+=8,t}},{key:"popUint8Array",value:function(){var t=this.popUInt16();if(this.pos+t>this.view.byteLength)return null;var e=new Uint8Array(this.view.buffer,this.pos,t);return this.pos+=t,e.slice()}},{key:"popUint8Array32",value:function(){var t=this.popUInt32();if(this.pos+t>this.view.byteLength)return null;var e=new Uint8Array(this.view.buffer,this.pos,t);return this.pos+=t,e.slice()}},{key:"popUInt64Vector",value:function(){var t=this.popUInt32();if(this.pos+8*t>this.view.byteLength)return null;for(var e=[],i=0;i<t;i++)e.push(this.popUInt64());return e}},{key:"popUInt32Vector",value:function(){var t=this.popUInt32();if(this.pos+4*t>this.view.byteLength)return null;for(var e=[],i=0;i<t;i++)e.push(this.popUInt32());return e}},{key:"popUInt16Vector",value:function(){var t=this.popUInt32();if(this.pos+2*t>this.view.byteLength)return null;for(var e=[],i=0;i<t;i++)e.push(this.popUInt16());return e}},{key:"popString",value:function(){var t=this.popUInt16();if(this.pos+t>this.view.byteLength)return null;for(var e=[],i=0;i<t;++i)e[i]=String.fromCharCode(this.popUInt8());return e.join("")}},{key:"popMapKey8Val32",value:function(){for(var t=this.popUInt32(),e=new s.default,i=0;i<t;i++){var r=this.popUInt8(),a=this.popUInt32();e.set(r,a)}return e}},{key:"popMapKey64Val64",value:function(){for(var t=this.popUInt32(),e=new s.default,i=0;i<t;i++){var r=this.popUInt64(),a=this.popUInt64();e.set(r,a)}return e}}]),t}()}
1,function(t,e,i){var s=i(17),r=i(135),a=i(136),n=i(13),o=i(46),u=i(80),l={},d={};(e=t.exports=function(t,e,i,c,f){var p,m,_,y,v=f?function(){return t}:u(t),S=s(i,c,e?2:1),g=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(a(v)){for(p=o(t.length);p>g;g++)if((y=e?S(n(m=t[g])[0],m[1]):S(t[g]))===l||y===d)return y}else for(_=v.call(t);!(m=_.next()).done;)if((y=r(_,S,m.value,e))===l||y===d)return y}).BREAK=l,e.RETURN=d},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(10)),r=o(i(0)),a=o(i(1)),n=o(i(2));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.ip=0,this.tcpPorts=[],this.udpPorts=[],this.videoProxyInfo=new s.default}return(0,a.default)(t,[{key:"marshall",value:function(){var t=new n.default(!1);return"number"==typeof this.ip?t.pushUInt32(this.ip):t.pushUInt32(this.ip2uint(this.ip)),t.pushUInt16Vector(this.tcpPorts),t.pushUInt16Vector(this.udpPorts),t.pushUInt32(this.videoProxyInfo.size),this.videoProxyInfo.forEach(function(e,i){t.pushUInt8(i),t.pushUInt32(e)}),t.marshall()}},{key:"unmarshall",value:function(t){this.ip=this.uint2ip(t.popUInt32()),this.tcpPorts=t.popUInt16Vector(),this.udpPorts=t.popUInt16Vector(),this.videoProxyInfo.clear();for(var e=t.popUInt32(),i=0;i<e;i++){var s=t.popUInt8(),r=t.popUInt32();this.videoProxyInfo.set(s,r)}return this}},{key:"ip2uint",value:function(t){for(var e=0,i=t.split("."),s=0;s<i.length;s++)e|=Number(i[s])<<8*s;return e<0&&(e+=0x100000000),e}},{key:"uint2ip",value:function(t){return(255&t)+"."+(t>>8&255)+"."+(t>>16&255)+"."+(t>>24&255)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(63).default},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var s=i(39)("keys"),r=i(27);t.exports=function(t){return s[t]||(s[t]=r(t))}},function(t,e,i){var s=i(3),r=i(8),a=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:s.version,mode:i(26)?"pure":"global",copyright:"\xa9 2020 Denis Pushkarev (zloirock.ru)"})},function(t,e,i){var s=i(11);t.exports=function(t,e){var i,r;if(!s(t))return t;if(e&&"function"==typeof(i=t.toString)&&!s(r=i.call(t))||"function"==typeof(i=t.valueOf)&&!s(r=i.call(t))||!e&&"function"==typeof(i=t.toString)&&!s(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){"use strict";var s=i(110)(!0);i(43)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,i=this._i;return i>=e.length?{value:void 0,done:!0}:(t=s(e,i),this._i+=t.length,{value:t,done:!1})})},function(t,e){var i=Math.ceil,s=Math.floor;t.exports=function(t){return isNaN(t*=1)?0:(t>0?s:i)(t)}},function(t,e,i){"use strict";var s=i(26),r=i(5),a=i(70),n=i(12),o=i(23),u=i(111),l=i(31),d=i(65),c=i(7)("iterator"),f=!([].keys&&"next"in[].keys()),p=function(){return this};t.exports=function(t,e,i,m,_,y,v){u(i,e,m);var S,g,T,P=function(t){if(!f&&t in k)return k[t];switch(t){case"keys":case"values":return function(){return new i(this,t)}}return function(){return new i(this,t)}},C=e+" Iterator",E="values"==_,I=!1,k=t.prototype,A=k[c]||k["@@iterator"]||_&&k[_],R=A||P(_),D=_?E?P("entries"):R:void 0,O="Array"==e&&k.entries||A;if(O&&(T=d(O.call(new t)))!==Object.prototype&&T.next&&(l(T,C,!0),s||"function"==typeof T[c]||n(T,c,p)),E&&A&&"values"!==A.name&&(I=!0,R=function(){return A.call(this)}),(!s||v)&&(f||I||!k[c])&&n(k,c,R),o[e]=R,o[C]=p,_)if(S={values:E?R:P("values"),keys:y?R:P("keys"),entries:D},v)for(g in S)g in k||a(k,g,S[g]);else r(r.P+r.F*(f||I),e,S);return S}},function(t,e,i){var s=i(45);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==s(t)?t.split(""):Object(t)}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e,i){var s=i(42),r=Math.min;t.exports=function(t){return t>0?r(s(t),0x1fffffffffffff):0}},function(t,e){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleStr
1ing,toString,valueOf".split(",")},function(t,e,i){i(116);for(var s=i(8),r=i(12),a=i(23),n=i(7)("toStringTag"),o="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),u=0;u<o.length;u++){var l=o[u],d=s[l],c=d&&d.prototype;c&&!c[n]&&r(c,n,l),a[l]=a.Array}},function(t,e,i){e.f=i(7)},function(t,e,i){var s=i(27)("meta"),r=i(11),a=i(14),n=i(9).f,o=0,u=Object.isExtensible||function(){return!0},l=!i(15)(function(){return u(Object.preventExtensions({}))}),d=function(t){n(t,s,{value:{i:"O"+ ++o,w:{}}})},c=t.exports={KEY:s,NEED:!1,fastKey:function(t,e){if(!r(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,s)){if(!u(t))return"F";if(!e)return"E";d(t)}return t[s].i},getWeak:function(t,e){if(!a(t,s)){if(!u(t))return!0;if(!e)return!1;d(t)}return t[s].w},onFreeze:function(t){return l&&c.NEED&&u(t)&&!a(t,s)&&d(t),t}}},function(t,e,i){var s=i(8),r=i(3),a=i(26),n=i(49),o=i(9).f;t.exports=function(t){var e=r.Symbol||(r.Symbol=a?{}:s.Symbol||{});"_"==t.charAt(0)||t in e||o(e,t,{value:n.f(t)})}},function(t,e){e.f=Object.getOwnPropertySymbols},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){var t=null;try{t=window.localStorage}catch(e){t={removeItem:function(t){},getItem:function(t){return null},setItem:function(t,e){},clear:function(){}}}return t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(19)),n=o(i(35));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.streamId=new a.default,this.videoProxyInfos=[],this.token="",this.streamSeqSN=0,this.quickAccessBeginIndex=0,this.quickAccessEndIndex=0,this.ip=0,this.urlTokenTime=0,this.urlToken=""}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.streamId.unmarshall(t),this.videoProxyInfos=[];for(var e=t.popUInt32(),i=0;i<e;i++){var s=new n.default;this.videoProxyInfos.push(s.unmarshall(t))}return this.token=t.popString(),this.streamSeqSN=t.popUInt64(),this.quickAccessBeginIndex=t.popUInt64(),this.quickAccessEndIndex=t.popUInt64(),this.ip=t.popUInt32(),this.urlTokenTime=t.popUInt32(),this.urlToken=t.popString(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={STREAM_UNKNOWN:0,AUDIO_SPEEX:0,AUDIO_AACPLUS:1,AUDIO_SILK:2,AUDIO_AAC_44100HZ_STEREO_128KBPS:35,AUDIO_AAC_44100HZ_STEREO_160KBPS:36,AUDIO_AAC_44100HZ_STEREO_192KBPS:37,AUDIO_ELD_AAC_44100HZ_STEREO:38,AUDIO_ELD_AAC_SBR_44100HZ_STEREO:39,SIGNAL_STREAM_DATA:47,SIGNAL_STREAM_COMPRESS_DATA:48,AUDIO_MP3:50,AUDIO_NELLYMOSER:54,VIDEO_264_START:401,VIDEO_H264_100K:401,VIDEO_H264_500K:405,VIDEO_H264_800K:408,VIDEO_H264_1200K:412,VIDEO_H264_1500K:415,VIDEO_H264_2000K:420,VIDEO_H264_3000K:430,VIDEO_H264_4000K:440,VIDEO_H264_6000K:460,VIDEO_H264_8000K:480,VIDEO_H264_END:480,VIDEO_265_START:503,VIDEO_H265_300K:503,VIDEO_H265_500K:505,VIDEO_H265_800K:508,VIDEO_H265_1200K:512,VIDEO_H265_1500K:515,VIDEO_H265_2000K:520,VIDEO_H265_3000K:530,VIDEO_H265_4000K:540,VIDEO_H265_6000K:560,VIDEO_H265_8000K:580,VIDEO_H265_END:580,VIDEO_H264_EX_BASE:1e3,VIDEO_H264_EX_START:1005,VIDEO_H264_EX_500K:1005,VIDEO_H264_EX_1M:1010,VIDEO_H264_EX_5M:1050,VIDEO_H264_EX_8M:1080,VIDEO_H264_EX_10M:1100,VIDEO_H264_EX_12M:1120,VIDEO_H264_EX_15M:1150,VIDEO_H264_EX_20M:1200,VIDEO_H264_EX_END:1200,VIDEO_H265_EX_BASE:4e3,VIDEO_H265_EX_START:4005,VIDEO_H265_EX_500K:4005,VIDEO_H265_EX_1M:4010,VIDEO_H265_EX_5M:4050,VIDEO_H265_EX_8M:4080,VIDEO_H265_EX_10M:4100,VIDEO_H265_EX_12M:4120,VIDEO_H265_EX_15M:4150,VIDEO_H265_EX_20M:4200,VIDEO_H265_EX_END:4200}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=l(i(10)),r=l(i(0)),a=l(i(1)),n=l(i(2)),o=l(i(19)),u=l(i(35));function l(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.currentProxyInfos=new s.default}return(0,a.default)(t,[{key:"marshall",value:function(){var t=new n.default(!1);return t.pushUInt32(this.currentProxyInfos.size),this.currentProxyInfos.forEach(function(e,i){t.pushUint8ArrayWithoutLen(i.marshall()),t.pushUInt32(e.length),e.forEach(function(e){t.pushUint8ArrayWithoutLen(e.marshall())})}),t.marshall()}},{key:"unmarshall",value:function(t){this.currentProxyInfos.clear();for(var e=t.popUInt32(),i=0;i<e;i++){var s=new o.default;s.unmarshall(t);for(var r=[],a=t.popUInt32(),n=0;n<a;n++){var l=new u.default;r.push(l.unmarshall(t))}this.currentProxyInfos.set(s,r)}return this}}]),t}()}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(4)),n=o(i(2));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.seq=0,this.uri=0,this.from=0,this.uid=0,this.streamSeqSN=0,this.payload=null}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new n.default;return t.setUri(a.default.PP2pSliceData),t.pushUInt64(this.seq),t.pushUInt32(this.uri),t.pushUInt8(this.from),t.pushUInt64(this.uid),t.pushUInt64(this.streamSeqSN),t.pushUint8Array(this.payload),t.marshall()}},{key:"unmarshall",value:function(t){return this.seq=t.popUInt64(),this.uri=t.popUInt32(),this.from=t.popUInt8(),this.uid=t.popUInt64(),this.streamSeqSN=t.popUInt64(),this.payload=t.popUint8Array(),this}},{key:"isAudio",get:function(){return this.uri==a.default.PP2pSliceAudioData}},{key:"isVideo",get:function(){return this.uri==a.default.PP2pSliceVideoData}},{key:"isCtrlSlice",get:function(){return this.uri==a.default.PP2pSliceControlData}},{key:"isFullSlice",get:function(){return 1==this.from}},{key:"isSubSlice",get:function(){return 2==this.from}},{key:"isResend",get:function(){return 3==this.from&&0==this.uid}},{key:"isPatchSlice",get:function(){return 4==this.from}},{key:"isFromPeer",get:function(){return 0!==this.uid}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={},r={setTaf:function(t){return s=t}};e.default=r,r.UserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sHuYaUA="",this.sCookie="",this.iTokenType=0},r.UserId.prototype._clone=function(){return new r.UserId},r.UserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.UserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.UserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sHuYaUA),t.writeString(4,this.sCookie),t.writeInt32(5,this.iTokenType)},r.UserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sHuYaUA=t.readString(3,!1,this.sHuYaUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iTokenType=t.readInt32(5,!1,this.iTokenType)},r.VideoGatewayProxy2VGPingReq=function(){this.lLocalTime=0},r.VideoGatewayProxy2VGPingReq.prototype._clone=function(){return new r.VideoGatewayProxy2VGPingReq},r.VideoGatewayProxy2VGPingReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.VideoGatewayProxy2VGPingReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.VideoGatewayProxy2VGPingReq.prototype.writeTo=function(t){t.writeInt64(0,this.lLocalTime)},r.VideoGatewayProxy2VGPingReq.prototype.readFrom=function(t){this.lLocalTime=t.readInt64(0,!1,this.lLocalTime)},r.VideoGatewayProxy2VGPingRsp=function(){this.lLocalTime=0},r.VideoGatewayProxy2VGPingRsp.prototype._clone=function(){return new r.VideoGatewayProxy2VGPingRsp},r.VideoGatewayProxy2VGPingRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.VideoGatewayProxy2VGPingRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.VideoGatewayProxy2VGPingRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lLocalTime)},r.VideoGatewayProxy2VGPingRsp.prototype.readFrom=function(t){this.lLocalTime=t.readInt64(0,!1,this.lLocalTime)},r.GetInfoFromVGReq=function(){this.lUid=0,this.iServiceType=0,this.iClientType=0,this.iClientIp=0,this.iTerminalType=0,this.iRequestVPType=0,this.sMsg=new s.BinBuffer,this.iUri=0,this.sProtoName="",this.lSid=0,this.vStreamName=new s.Vector(new s.STRING),this.tId=new r.UserId},r.GetInfoFromVGReq.prototype._clone=function(){return new r.GetInfoFromVGReq},r.GetInfoFromVGReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetInfoFromVGReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetInfoFromVGReq.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeInt32(1,this.iServiceType),t.writeInt32(2,this.iClientType),t.writeInt64(3,this.iClientIp),t.writeInt32(4,this.iTerminalType),t.writeInt32(5,this.iRequestVPType),t.writeBytes(6,this.sMsg),t.writeInt64(7,this.iUri),t.writeString(8,this.sProtoName),t.writeInt64(9,this.lSid),t.writeVector(10,this.vStreamName),t.writeStruct(11,this.tId)},r.GetInfoFromVGReq.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.iServiceType=t.readInt32(1,!1,this.iServiceType),this.iClientType=t.readInt32(2,!1,this.iClientType),this.iClientIp=t.readInt64(3,!1,this.iClientIp),this.iTerminalType=t.readInt32(4,!1,this.iTerminalType),this.iRequestVPType=t.readInt32(5,!1,this.iRequestVPType),this.sMsg=t.readBytes(6,!1,this.sMsg),this.iUri=t.readInt64(7,!1,this.iUri),this.sProtoName=t.readString(8,!1,this.sProtoName),this.lSid=t.readInt64(9,!1,this.lSid),this.vStreamName=t.readVector(10,!1,this.vStreamName),this.tId=t.readStruct(11,!1,this.tId)},r.GetInfoFromVGRsp=function(){this.lUid=0,this.ServerId=0,this.sMsg=new s.BinBuffer,this.iUri=0,this.sProtoName=""},r.GetInfoFromVGRsp.prototype._clone=function(){return new r.GetInfoFromVGRsp}
1,r.GetInfoFromVGRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetInfoFromVGRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetInfoFromVGRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeInt64(1,this.ServerId),t.writeBytes(2,this.sMsg),t.writeInt64(3,this.iUri),t.writeString(4,this.sProtoName)},r.GetInfoFromVGRsp.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.ServerId=t.readInt64(1,!1,this.ServerId),this.sMsg=t.readBytes(2,!1,this.sMsg),this.iUri=t.readInt64(3,!1,this.iUri),this.sProtoName=t.readString(4,!1,this.sProtoName)},r.GetCdnTokenExReq=function(){this.sFlvUrl="",this.sStreamName="",this.iLoopTime=0,this.tId=new r.UserId,this.iAppId=66},r.GetCdnTokenExReq.prototype._clone=function(){return new r.GetCdnTokenExReq},r.GetCdnTokenExReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetCdnTokenExReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetCdnTokenExReq.prototype.writeTo=function(t){t.writeString(0,this.sFlvUrl),t.writeString(1,this.sStreamName),t.writeInt32(2,this.iLoopTime),t.writeStruct(3,this.tId),t.writeInt32(4,this.iAppId)},r.GetCdnTokenExReq.prototype.readFrom=function(t){this.sFlvUrl=t.readString(0,!1,this.sFlvUrl),this.sStreamName=t.readString(1,!1,this.sStreamName),this.iLoopTime=t.readInt32(2,!1,this.iLoopTime),this.tId=t.readStruct(3,!1,this.tId),this.iAppId=t.readInt32(4,!1,this.iAppId)},r.GetCdnTokenExRsp=function(){this.sFlvToken="",this.iExpireTime=0},r.GetCdnTokenExRsp.prototype._clone=function(){return new r.GetCdnTokenExRsp},r.GetCdnTokenExRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetCdnTokenExRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetCdnTokenExRsp.prototype.writeTo=function(t){t.writeString(0,this.sFlvToken),t.writeInt32(1,this.iExpireTime)},r.GetCdnTokenExRsp.prototype.readFrom=function(t){this.sFlvToken=t.readString(0,!1,this.sFlvToken),this.iExpireTime=t.readInt32(1,!1,this.iExpireTime)},r.LiveScenarioType={ECommon_Live:0,EAudio_Only:1,EVideo_Only:2,ELink_Live:3},r.LimitedStreamInfo=function(){this.iVerMin=0,this.iVerMax=0,this.sCdnType="",this.iIsMaster=0,this.lChannelId=0,this.lSubChannelId=0,this.lPresenterUid=0,this.sStreamName="",this.sFlvUrl="",this.sFlvUrlSuffix="",this.sFlvAntiCode="",this.sHlsUrl="",this.sHlsUrlSuffix="",this.sHlsAntiCode="",this.iLineIndex=0,this.iIsMultiStream=0,this.iPCPriorityRate=0,this.iWebPriorityRate=0,this.iMobilePriorityRate=0,this.vFlvIPList=new s.Vector(new s.STRING),this.iIsP2PSupport=0,this.sP2pUrl="",this.sP2pUrlSuffix="",this.sP2pAntiCode="",this.lFreeFlag=0},r.LimitedStreamInfo.prototype._clone=function(){return new r.LimitedStreamInfo},r.LimitedStreamInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LimitedStreamInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LimitedStreamInfo.prototype.writeTo=function(t){t.writeInt32(0,this.iVerMin),t.writeInt32(1,this.iVerMax),t.writeString(2,this.sCdnType),t.writeInt32(3,this.iIsMaster),t.writeInt64(4,this.lChannelId),t.writeInt64(5,this.lSubChannelId),t.writeInt64(6,this.lPresenterUid),t.writeString(7,this.sStreamName),t.writeString(8,this.sFlvUrl),t.writeString(9,this.sFlvUrlSuffix),t.writeString(10,this.sFlvAntiCode),t.writeString(11,this.sHlsUrl),t.writeString(12,this.sHlsUrlSuffix),t.writeString(13,this.sHlsAntiCode),t.writeInt32(14,this.iLineIndex),t.writeInt32(15,this.iIsMultiStream),t.writeInt32(16,this.iPCPriorityRate),t.writeInt32(17,this.iWebPriorityRate),t.writeInt32(18,this.iMobilePriorityRate),t.writeVector(19,this.vFlvIPList),t.writeInt32(20,this.iIsP2PSupport),t.writeString(21,this.sP2pUrl),t.writeString(22,this.sP2pUrlSuffix),t.writeString(23,this.sP2pAntiCode),t.writeInt64(24,this.lFreeFlag)},r.LimitedStreamInfo.prototype.readFrom=function(t){this.iVerMin=t.readInt32(0,!1,this.iVerMin),this.iVerMax=t.readInt32(1,!1,this.iVerMax),this.sCdnType=t.readString(2,!1,this.sCdnType),this.iIsMaster=t.readInt32(3,!1,this.iIsMaster),this.lChannelId=t.readInt64(4,!1,this.lChannelId),this.lSubChannelId=t.readInt64(5,!1,this.lSubChannelId),this.lPresenterUid=t.readInt64(6,!1,this.lPresenterUid),this.sStreamName=t.readString(7,!1,this.sStreamName),this.sFlvUrl=t.readString(8,!1,this.sFlvUrl),this.sFlvUrlSuffix=t.readString(9,!1,this.sFlvUrlSuffix
1),this.sFlvAntiCode=t.readString(10,!1,this.sFlvAntiCode),this.sHlsUrl=t.readString(11,!1,this.sHlsUrl),this.sHlsUrlSuffix=t.readString(12,!1,this.sHlsUrlSuffix),this.sHlsAntiCode=t.readString(13,!1,this.sHlsAntiCode),this.iLineIndex=t.readInt32(14,!1,this.iLineIndex),this.iIsMultiStream=t.readInt32(15,!1,this.iIsMultiStream),this.iPCPriorityRate=t.readInt32(16,!1,this.iPCPriorityRate),this.iWebPriorityRate=t.readInt32(17,!1,this.iWebPriorityRate),this.iMobilePriorityRate=t.readInt32(18,!1,this.iMobilePriorityRate),this.vFlvIPList=t.readVector(19,!1,this.vFlvIPList),this.iIsP2PSupport=t.readInt32(20,!1,this.iIsP2PSupport),this.sP2pUrl=t.readString(21,!1,this.sP2pUrl),this.sP2pUrlSuffix=t.readString(22,!1,this.sP2pUrlSuffix),this.sP2pAntiCode=t.readString(23,!1,this.sP2pAntiCode),this.lFreeFlag=t.readInt64(24,!1,this.lFreeFlag)},r.ClassifiedStreamInfoPack=function(){this.iLiveScenarioType=0,this.vStreamInfo=new s.Vector(new r.LimitedStreamInfo),this.vCdnList=new s.Vector(new s.STRING),this.lLiveId=0,this.sLinkGroupId="",this.mStreamRatioWeb=new s.Map(new s.STRING,new s.INT32),this.mStreamRatioPC=new s.Map(new s.STRING,new s.INT32),this.mStreamRatioMobile=new s.Map(new s.STRING,new s.INT32)},r.ClassifiedStreamInfoPack.prototype._clone=function(){return new r.ClassifiedStreamInfoPack},r.ClassifiedStreamInfoPack.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClassifiedStreamInfoPack.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClassifiedStreamInfoPack.prototype.writeTo=function(t){t.writeInt32(0,this.iLiveScenarioType),t.writeVector(1,this.vStreamInfo),t.writeVector(2,this.vCdnList),t.writeInt64(3,this.lLiveId),t.writeString(4,this.sLinkGroupId),t.writeMap(5,this.mStreamRatioWeb),t.writeMap(6,this.mStreamRatioPC),t.writeMap(7,this.mStreamRatioMobile)},r.ClassifiedStreamInfoPack.prototype.readFrom=function(t){this.iLiveScenarioType=t.readInt32(0,!1,this.iLiveScenarioType),this.vStreamInfo=t.readVector(1,!1,this.vStreamInfo),this.vCdnList=t.readVector(2,!1,this.vCdnList),this.lLiveId=t.readInt64(3,!1,this.lLiveId),this.sLinkGroupId=t.readString(4,!1,this.sLinkGroupId),this.mStreamRatioWeb=t.readMap(5,!1,this.mStreamRatioWeb),this.mStreamRatioPC=t.readMap(6,!1,this.mStreamRatioPC),this.mStreamRatioMobile=t.readMap(7,!1,this.mStreamRatioMobile)},r.LivingStreamInfoNotice=function(){this.lPresenterUid=0,this.lLiveId=0,this.mStreamInfo=new s.Map(new s.INT32,new r.ClassifiedStreamInfoPack)},r.LivingStreamInfoNotice.prototype._clone=function(){return new r.LivingStreamInfoNotice},r.LivingStreamInfoNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LivingStreamInfoNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LivingStreamInfoNotice.prototype.writeTo=function(t){t.writeInt64(0,this.lPresenterUid),t.writeInt64(1,this.lLiveId),t.writeMap(2,this.mStreamInfo)},r.LivingStreamInfoNotice.prototype.readFrom=function(t){this.lPresenterUid=t.readInt64(0,!1,this.lPresenterUid),this.lLiveId=t.readInt64(1,!1,this.lLiveId),this.mStreamInfo=t.readMap(2,!1,this.mStreamInfo)},r.LivingStreamEndNotice=function(){this.sStreamName="",this.sCdnType="",this.iLineIndex=0,this.lLiveId=0,this.iLiveScenarioType=0},r.LivingStreamEndNotice.prototype._clone=function(){return new r.LivingStreamEndNotice},r.LivingStreamEndNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LivingStreamEndNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LivingStreamEndNotice.prototype.writeTo=function(t){t.writeString(0,this.sStreamName),t.writeString(1,this.sCdnType),t.writeInt32(2,this.iLineIndex),t.writeInt64(3,this.lLiveId),t.writeInt32(4,this.iLiveScenarioType)},r.LivingStreamEndNotice.prototype.readFrom=function(t){this.sStreamName=t.readString(0,!1,this.sStreamName),this.sCdnType=t.readString(1,!1,this.sCdnType),this.iLineIndex=t.readInt32(2,!1,this.iLineIndex),this.lLiveId=t.readInt64(3,!1,this.lLiveId),this.iLiveScenarioType=t.readInt32(4,!1,this.iLiveScenarioType)},r.GetLivingStreamInfoReq=function(){this.tId=new r.UserId,this.lTopSid=0,this.lSubSid=0,this.lPresenterUid=0,this.sTraceSource=""},r.GetLivingStreamInfoReq.prototype._clone=function(){return new r.GetLivingStreamInfoReq}
1,r.GetLivingStreamInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetLivingStreamInfoReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetLivingStreamInfoReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt64(1,this.lTopSid),t.writeInt64(2,this.lSubSid),t.writeInt64(3,this.lPresenterUid),t.writeString(4,this.sTraceSource)},r.GetLivingStreamInfoReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.lTopSid=t.readInt64(1,!1,this.lTopSid),this.lSubSid=t.readInt64(2,!1,this.lSubSid),this.lPresenterUid=t.readInt64(3,!1,this.lPresenterUid),this.sTraceSource=t.readString(4,!1,this.sTraceSource)},r.GetLivingStreamInfoRsp=function(){this.bIsLiving=0,this.tNotice=new r.LivingStreamInfoNotice,this.bIsSelfLiving=0},r.GetLivingStreamInfoRsp.prototype._clone=function(){return new r.GetLivingStreamInfoRsp},r.GetLivingStreamInfoRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetLivingStreamInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetLivingStreamInfoRsp.prototype.writeTo=function(t){t.writeInt32(0,this.bIsLiving),t.writeStruct(1,this.tNotice),t.writeInt32(2,this.bIsSelfLiving)},r.GetLivingStreamInfoRsp.prototype.readFrom=function(t){this.bIsLiving=t.readInt32(0,!1,this.bIsLiving),this.tNotice=t.readStruct(1,!1,this.tNotice),this.bIsSelfLiving=t.readInt32(2,!1,this.bIsSelfLiving)},r.VideoClientReportReq=function(){this.iReportType=0,this.sReportString="",this.sMsg=new s.BinBuffer,this.lUid=0},r.VideoClientReportReq.prototype._clone=function(){return new r.VideoClientReportReq},r.VideoClientReportReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.VideoClientReportReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.VideoClientReportReq.prototype.writeTo=function(t){t.writeInt32(0,this.iReportType),t.writeString(1,this.sReportString),t.writeBytes(2,this.sMsg),t.writeInt64(3,this.lUid)},r.VideoClientReportReq.prototype.readFrom=function(t){this.iReportType=t.readInt32(0,!1,this.iReportType),this.sReportString=t.readString(1,!1,this.sReportString),this.sMsg=t.readBytes(2,!1,this.sMsg),this.lUid=t.readInt64(3,!1,this.lUid)},r.LiveMeetingSyncNotice=function(){this.tStat=new r.MeetingStat,this.vSeats=new s.Vector(new r.MeetingSeat),this.iVersion=0,this.sMessage=""},r.LiveMeetingSyncNotice.prototype._clone=function(){return new r.LiveMeetingSyncNotice},r.LiveMeetingSyncNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LiveMeetingSyncNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LiveMeetingSyncNotice.prototype.writeTo=function(t){t.writeStruct(0,this.tStat),t.writeVector(1,this.vSeats),t.writeInt32(2,this.iVersion),t.writeString(3,this.sMessage)},r.LiveMeetingSyncNotice.prototype.readFrom=function(t){this.tStat=t.readStruct(0,!1,this.tStat),this.vSeats=t.readVector(1,!1,this.vSeats),this.iVersion=t.readInt32(2,!1,this.iVersion),this.sMessage=t.readString(3,!1,this.sMessage)},r.MeetingStat=function(){this.lPresenterUid=0,this.sPresenterNick="",this.sPresenterAvatarUrl="",this.mpContext=new s.Map(new s.STRING,new s.STRING),this.iVersion=0,this.iCurAction=0,this.sPassword="",this.lSessionId=0,this.vApplyList=new s.Vector(new r.ApplyUser),this.iState=0,this.iSilence=0,this.iActiveTime=0,this.iLastSyncTime=0,this.mpUserSession=new s.Map(new s.INT64,new s.STRING),this.iBeginTime=0,this.iPresenterGender=0,this.tTransferRoom=new r.TransferLiveRoomState,this.iMode=0,this.iModeV2=0,this.iOfficialType=0},r.MeetingStat.prototype._clone=function(){return new r.MeetingStat},r.MeetingStat.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MeetingStat.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MeetingStat.prototype.writeTo=function(t){t.writeInt64(0,this.lPresenterUid),t.writeString(1,this.sPresenterNick),t.writeString(2,this.sPresenterAvatarUrl),t.writeMap(4,this.mpContext),t.writeInt32(5,this.iVersion),t.writeInt32(6,this.iCurAction),t.writeString(7,this.sPassword),t.writeInt64(8,this.lSessionId),t.writeVector(9,this.vApplyList),t.writeInt32(10,this.iState),t.writeInt32(11,this.iSilence),t.writeInt32(12,this.iActiveTime),t.writeInt32(13,this.iLastSyncTime),t.writeMap(14,this.mpUserSession),t.writeInt32(15,this.iBeginTime),t.writeInt32(16,this.iPresenterGender),t.writeStruct(17,this.tTransferRoom),t.writeInt32(18,this.iMode),t.writeInt32(19,this.iModeV2),t.writeInt32(20,this.iOfficialType)},r.MeetingStat.prototype.readFrom=function(t){this.lPresenterUid=t.readInt64(0,!1,this.lPresenterUid),this.sPresenterNick=t.readString(1,!1,this.sPresenterNick),this.sPresenterAvatarUrl=t.readString(2,!1,this.sPresenterAvatarUrl),this.mpContext=t.readMap(4,!1,this.mpContext),this.iVersion=t.readInt32(5,!1,this.iVersion),this.iCurAction=t.readInt32(6,!1,this.iCurAction),this.sPassword=t.readString(7,!1,this.sPassword),this.lSessionId=t.readInt64(8,!1,this.lSessionId),this.vApplyList=t.readVector(9,!1,this.vApplyList),this.iState=t.readInt32(10,!1,this.iState),this.iSilence=t.readInt32(11,!1,this.iSilence),this.iActiveTime=t.readInt32(12,!1,this.iActiveTime),this.iLastSyncTime=t.readInt32(13,!1,this.iLastSyncTime),this.mpUserSession=t.readMap(14,!1,this.mpUserSession),this.iBeginTime=t.readInt32(15,!1,this.iBeginTime),this.iPresenterGender=t.readInt32(16,!1,this.iPresenterGender),this.tTransferRoom=t.readStruct(17,!1,this.tTransferRoom),this.iMode=t.readInt32(18,!1,this.iMode),this.iModeV2=t.readInt32(19,!1,this.iModeV2),this.iOfficialType=t.readInt32(20,!1,this.iOfficialType)},r.MeetingSeat=function(){this.mpContext=new s.Map(new s.STRING,new s.STRING),this.iPos=0,this.iLocked=0,this.lUid=0,this.sNick="",this.sAvatarUrl="",this.iMute=0,this.iVersion=0,this.iCurAction=0,this.iActiveTime=0,this.iSilence=0,this.iGender=0,this.lOfferSeatTimeStamp=0,this.iSilenceTime=0,this.iMuteTime=0,this.iSeatType=0,this.iSeatTypeV2=0,this.sSeatUrl="",this.sCharm="",this.sName="",this.sSourceUrl="",this.sRippleUrl=""},r.MeetingSeat.prototype._clone=function(){return new r.MeetingSeat}
1,r.MeetingSeat.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MeetingSeat.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MeetingSeat.prototype.writeTo=function(t){t.writeMap(0,this.mpContext),t.writeInt32(1,this.iPos),t.writeInt32(2,this.iLocked),t.writeInt64(3,this.lUid),t.writeString(4,this.sNick),t.writeString(5,this.sAvatarUrl),t.writeInt32(7,this.iMute),t.writeInt32(8,this.iVersion),t.writeInt32(9,this.iCurAction),t.writeInt32(10,this.iActiveTime),t.writeInt32(11,this.iSilence),t.writeInt32(12,this.iGender),t.writeInt64(13,this.lOfferSeatTimeStamp),t.writeInt32(14,this.iSilenceTime),t.writeInt32(15,this.iMuteTime),t.writeInt32(16,this.iSeatType),t.writeInt32(17,this.iSeatTypeV2),t.writeString(18,this.sSeatUrl),t.writeString(19,this.sCharm),t.writeString(20,this.sName),t.writeString(21,this.sSourceUrl),t.writeString(22,this.sRippleUrl)},r.MeetingSeat.prototype.readFrom=function(t){this.mpContext=t.readMap(0,!1,this.mpContext),this.iPos=t.readInt32(1,!1,this.iPos),this.iLocked=t.readInt32(2,!1,this.iLocked),this.lUid=t.readInt64(3,!1,this.lUid),this.sNick=t.readString(4,!1,this.sNick),this.sAvatarUrl=t.readString(5,!1,this.sAvatarUrl),this.iMute=t.readInt32(7,!1,this.iMute),this.iVersion=t.readInt32(8,!1,this.iVersion),this.iCurAction=t.readInt32(9,!1,this.iCurAction),this.iActiveTime=t.readInt32(10,!1,this.iActiveTime),this.iSilence=t.readInt32(11,!1,this.iSilence),this.iGender=t.readInt32(12,!1,this.iGender),this.lOfferSeatTimeStamp=t.readInt64(13,!1,this.lOfferSeatTimeStamp),this.iSilenceTime=t.readInt32(14,!1,this.iSilenceTime),this.iMuteTime=t.readInt32(15,!1,this.iMuteTime),this.iSeatType=t.readInt32(16,!1,this.iSeatType),this.iSeatTypeV2=t.readInt32(17,!1,this.iSeatTypeV2),this.sSeatUrl=t.readString(18,!1,this.sSeatUrl),this.sCharm=t.readString(19,!1,this.sCharm),this.sName=t.readString(20,!1,this.sName),this.sSourceUrl=t.readString(21,!1,this.sSourceUrl),this.sRippleUrl=t.readString(22,!1,this.sRippleUrl)},r.ApplyUser=function(){this.lUid=0,this.sNick="",this.sAvatarUrl="",this.lActiveTime=0,this.mpContext=new s.Map(new s.STRING,new s.STRING),this.iGender=0,this.sStreamName="",this.iSeatType=0},r.ApplyUser.prototype._clone=function(){return new r.ApplyUser},r.ApplyUser.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ApplyUser.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ApplyUser.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sNick),t.writeString(2,this.sAvatarUrl),t.writeInt64(3,this.lActiveTime),t.writeMap(4,this.mpContext),t.writeInt32(5,this.iGender),t.writeString(6,this.sStreamName),t.writeInt32(7,this.iSeatType)},r.ApplyUser.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sNick=t.readString(1,!1,this.sNick),this.sAvatarUrl=t.readString(2,!1,this.sAvatarUrl),this.lActiveTime=t.readInt64(3,!1,this.lActiveTime),this.mpContext=t.readMap(4,!1,this.mpContext),this.iGender=t.readInt32(5,!1,this.iGender),this.sStreamName=t.readString(6,!1,this.sStreamName),this.iSeatType=t.readInt32(7,!1,this.iSeatType)},r.TransferLiveRoomState=function(){this.lTargetUid=0,this.iInviteTime=0,this.iTokeOverTime=0,this.iBeginLiveTime=0,this.lNewLiveId=0,this.iInviteExpire=0,this.iState=0,this.iResult=0,this.iSuccessTime=0,this.sTargetNick=""},r.TransferLiveRoomState.prototype._clone=function(){return new r.TransferLiveRoomState},r.TransferLiveRoomState.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.TransferLiveRoomState.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.TransferLiveRoomState.prototype.writeTo=function(t){t.writeInt64(0,this.lTargetUid),t.writeInt32(1,this.iInviteTime),t.writeInt32(2,this.iTokeOverTime),t.writeInt32(3,this.iBeginLiveTime),t.writeInt64(4,this.lNewLiveId),t.writeInt32(5,this.iInviteExpire),t.writeInt32(6,this.iState),t.writeInt32(7,this.iResult),t.writeInt32(8,this.iSuccessTime),t.writeString(9,this.sTargetNick)},r.TransferLiveRoomState.prototype.readFrom=function(t){this.lTargetUid=t.readInt64(0,!1,this.lTargetUid),this.iInviteTime=t.readInt32(1,!1,this.iInviteTime),this.iTokeOverTime=t.readInt32(2,!1,this.iTokeOverTime),this.iBeginLiveTime=t.readInt32(3,!1,this.iBeginLiveTime),this.lNewLiveId=t.readInt64(4,!1,this.lNewLiveId),this.iInviteExpire=t.readInt32(5,!1,this.iInviteExpire),this.iState=t.readInt32(6,!1,this.iState),this.iResult=t.readInt32(7,!1,this.iResult),this.iSuccessTime=t.readInt32(8,!1,this.iSuccessTime),this.sTargetNick=t.readString(9,!1,this.sTargetNick)},r.GetP2PStreamInfoReq=function(){this.lUid=0,this.sStreamName="",this.iP2PType=0,this.sClientUA=""},r.GetP2PStreamInfoReq.prototype._clone=function(){return new r.GetP2PStreamInfoReq}
1,r.GetP2PStreamInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetP2PStreamInfoReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetP2PStreamInfoReq.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sStreamName),t.writeInt32(2,this.iP2PType),t.writeString(3,this.sClientUA)},r.GetP2PStreamInfoReq.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sStreamName=t.readString(1,!1,this.sStreamName),this.iP2PType=t.readInt32(2,!1,this.iP2PType),this.sClientUA=t.readString(3,!1,this.sClientUA)},r.GetP2PStreamInfoRsp=function(){this.lUid=0,this.sStreamName="",this.iP2PType=0,this.sP2PToken="",this.iP2PExpireTime=0,this.sP2PUrl="",this.sCodecType="",this.sCdnBrand="",this.mpOption=new s.Map(new s.INT16,new s.INT64),this.line=0},r.GetP2PStreamInfoRsp.prototype._clone=function(){return new r.GetP2PStreamInfoRsp},r.GetP2PStreamInfoRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetP2PStreamInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetP2PStreamInfoRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sStreamName),t.writeInt32(2,this.iP2PType),t.writeString(3,this.sP2PToken),t.writeInt32(4,this.iP2PExpireTime),t.writeString(5,this.sP2PUrl),t.writeString(6,this.sCodecType),t.writeString(7,this.sCdnBrand),t.writeMap(8,this.mpOption),t.writeUInt8(9,this.line)},r.GetP2PStreamInfoRsp.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sStreamName=t.readString(1,!1,this.sStreamName),this.iP2PType=t.readInt32(2,!1,this.iP2PType),this.sP2PToken=t.readString(3,!1,this.sP2PToken),this.iP2PExpireTime=t.readInt32(4,!1,this.iP2PExpireTime),this.sP2PUrl=t.readString(5,!1,this.sP2PUrl),this.sCodecType=t.readString(6,!1,this.sCodecType),this.sCdnBrand=t.readString(7,!1,this.sCdnBrand),this.mpOption=t.readMap(8,!1,this.mpOption),this.line=t.readUInt8(9,!1,this.line)},r.GetP2PStreamTokenExReq=function(){this.sStreamName="",this.iLoopTime=0},r.GetP2PStreamTokenExReq.prototype._clone=function(){return new r.GetP2PStreamTokenExReq},r.GetP2PStreamTokenExReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetP2PStreamTokenExReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetP2PStreamTokenExReq.prototype.writeTo=function(t){t.writeString(0,this.sStreamName),t.writeInt32(1,this.iLoopTime)},r.GetP2PStreamTokenExReq.prototype.readFrom=function(t){this.sStreamName=t.readString(0,!1,this.sStreamName),this.iLoopTime=t.readInt32(1,!1,this.iLoopTime)},r.GetP2PStreamTokenExRsp=function(){this.sP2PToken="",this.iExpireTime=0},r.GetP2PStreamTokenExRsp.prototype._clone=function(){return new r.GetP2PStreamTokenExRsp},r.GetP2PStreamTokenExRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetP2PStreamTokenExRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetP2PStreamTokenExRsp.prototype.writeTo=function(t){t.writeString(0,this.sP2PToken),t.writeInt32(1,this.iExpireTime)},r.GetP2PStreamTokenExRsp.prototype.readFrom=function(t){this.sP2PToken=t.readString(0,!1,this.sP2PToken),this.iExpireTime=t.readInt32(1,!1,this.iExpireTime)},r.HttpDnsItem=function(){this.vIp=new s.Vector(new s.STRING),this.iExpireTime=0,this.vIpv6=new s.Vector(new s.STRING)},r.HttpDnsItem.prototype._clone=function(){return new r.HttpDnsItem},r.HttpDnsItem.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.HttpDnsItem.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.HttpDnsItem.prototype.writeTo=function(t){t.writeVector(0,this.vIp),t.writeInt64(1,this.iExpireTime),t.writeVector(2,this.vIpv6)},r.HttpDnsItem.prototype.readFrom=function(t){this.vIp=t.readVector(0,!1,this.vIp),this.iExpireTime=t.readInt64(1,!1,this.iExpireTime),this.vIpv6=t.readVector(2,!1,this.vIpv6)},r.QueryHttpDnsReq=function(){this.lUid=0,this.sUA="",this.vDomain=new s.Vector(new s.STRING),this.sAppSrc=""},r.QueryHttpDnsReq.prototype._clone=function(){return new r.QueryHttpDnsReq},r.QueryHttpDnsReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.QueryHttpDnsReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.QueryHttpDnsReq.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sUA),t.writeVector(2,this.vDomain),t.writeString(3,this.sAppSr
1c)},r.QueryHttpDnsReq.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sUA=t.readString(1,!1,this.sUA),this.vDomain=t.readVector(2,!1,this.vDomain),this.sAppSrc=t.readString(3,!1,this.sAppSrc)},r.QueryHttpDnsRsp=function(){this.mDomain2Ip=new s.Map(new s.STRING,new r.HttpDnsItem)},r.QueryHttpDnsRsp.prototype._clone=function(){return new r.QueryHttpDnsRsp},r.QueryHttpDnsRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.QueryHttpDnsRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.QueryHttpDnsRsp.prototype.writeTo=function(t){t.writeMap(0,this.mDomain2Ip)},r.QueryHttpDnsRsp.prototype.readFrom=function(t){this.mDomain2Ip=t.readMap(0,!1,this.mDomain2Ip)},r.WSTimeSyncReq=function(){this.sGuid="",this.lClientTime=0},r.WSTimeSyncReq.prototype._clone=function(){return new r.WSTimeSyncReq},r.WSTimeSyncReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.WSTimeSyncReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.WSTimeSyncReq.prototype.writeTo=function(t){t.writeString(0,this.sGuid),t.writeInt64(1,this.lClientTime)},r.WSTimeSyncReq.prototype.readFrom=function(t){this.sGuid=t.readString(0,!1,this.sGuid),this.lClientTime=t.readInt64(1,!1,this.l
1ClientTime)},r.WSTimeSyncRsp=function(){this.lServerTime=0},r.WSTimeSyncRsp.prototype._clone=function(){return new r.WSTimeSyncRsp},r.WSTimeSyncRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.WSTimeSyncRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.WSTimeSyncRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lServerTime)},r.WSTimeSyncRsp.prototype.readFrom=function(t){this.lServerTime=t.readInt64(0,!1,this.lServerTime)},r.MediaUserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sUA="",this.sCookie="",this.iTokenType=0,this.iAppid=0,this.bAnonymous=0,this.sStrUid=""},r.MediaUserId.prototype._clone=function(){return new r.MediaUserId},r.MediaUserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaUserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaUserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sUA),t.writeString(4,this.sCookie),t.writeInt32(5,this.iTokenType),t.writeInt32(6,this.iAppid),t.writeInt32(7,this.bAnonymous),t.writeString(8,this.sStrUid)},r.MediaUserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sUA=t.readString(3,!1,this.sUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iTokenType=t.readInt32(5,!1,this.iTokenType),this.iAppid=t.readInt32(6,!1,this.iAppid),this.bAnonymous=t.readInt32(7,!1,this.bAnonymous),this.sStrUid=t.readString(8,!1,this.sStrUid)},r.LoginVerifyReq=function(){this.tId=new r.MediaUserId,this.iCookieDeadTime=0},r.LoginVerifyReq.prototype._clone=function(){return new r.LoginVerifyReq},r.LoginVerifyReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LoginVerifyReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LoginVerifyReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt32(1,this.iCookieDeadTime)},r.LoginVerifyReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.iCookieDeadTime=t.readInt32(1,!1,this.iCookieDeadTime)},r.LoginVerifyRsp=function(){this.iResCode=0,this.lUid=0,this.sCookie="",this.sUid="",this.iAppId=0},r.LoginVerifyRsp.prototype._clone=function(){return new r.LoginVerifyRsp},r.LoginVerifyRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.LoginVerifyRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.LoginVerifyRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iResCode),t.writeInt64(1,this.lUid),t.writeString(2,this.sCookie),t.writeString(3,this.sUid),t.writeInt32(4,this.iAppId)},r.LoginVerifyRsp.prototype.readFrom=function(t){this.iResCode=t.readInt32(0,!1,this.iResCode),this.lUid=t.readInt64(1,!1,this.lUid),this.sCookie=t.readString(2,!1,this.sCookie),this.sUid=t.readString(3,!1,this.sUid),this.iAppId=t.readInt32(4,!1,this.iAppId)},r.JoinMediaGroupReq=function(){this.tId=new r.MediaUserId,this.vGroupId=new s.Vector(new s.STRING)},r.JoinMediaGroupReq.prototype._clone=function(){return new r.JoinMediaGroupReq},r.JoinMediaGroupReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.JoinMediaGroupReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.JoinMediaGroupReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeVector(1,this.vGroupId)},r.JoinMediaGroupReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.vGroupId=t.readVector(1,!1,this.vGroupId)},r.JoinMediaGroupRsp=function(){this.iCode=0,this.sMsg="",this.vGroupId=new s.Vector(new s.STRING)},r.JoinMediaGroupRsp.prototype._clone=function(){return new r.JoinMediaGroupRsp},r.JoinMediaGroupRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.JoinMediaGroupRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.JoinMediaGroupRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iCode),t.writeString(1,this.sMsg),t.writeVector(2,this.vGroupId)},r.JoinMediaGroupRsp.prototype.readFrom=function(t){this.iCode=t.readInt32(0,!1,this.iCode),this.sMsg=t.readString(1,!1,this.sMsg),this.vGroupId=t.readVector(2,!1,this.vGroupId)},r.QuitMediaGroupReq=function(){this.tId=new r.MediaUserId,this.vGroupId=new s.Vector(new s.STRING)},r.QuitMediaGroupReq.prototype._clone=function(){return new r.QuitMediaGroupReq}
1,r.QuitMediaGroupReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.QuitMediaGroupReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.QuitMediaGroupReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeVector(1,this.vGroupId)},r.QuitMediaGroupReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.vGroupId=t.readVector(1,!1,this.vGroupId)},r.QuitMediaGroupRsp=function(){this.iCode=0,this.sMsg="",this.vGroupId=new s.Vector(new s.STRING)},r.QuitMediaGroupRsp.prototype._clone=function(){return new r.QuitMediaGroupRsp},r.QuitMediaGroupRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.QuitMediaGroupRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.QuitMediaGroupRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iCode),t.writeString(1,this.sMsg),t.writeVector(2,this.vGroupId)},r.QuitMediaGroupRsp.prototype.readFrom=function(t){this.iCode=t.readInt32(0,!1,this.iCode),this.sMsg=t.readString(1,!1,this.sMsg),this.vGroupId=t.readVector(2,!1,this.vGroupId)},r.ikk=1,r.skk="123",r.eIType={k4AM:10001,k6AM:10002},r.EM_PCDN_MODE={E_PcdnMode_Min:0,E_PcdnMode_P2pHttpSubstream:1,E_PcdnMode_P2pOutsideSdkSubstream:2,E_PcdnMode_FlvHttpFullstream:3,E_PcdnMode_FlvOutsideSdkFullstream:4,E_PcdnMode_Max:255,E_PcdnVodMode_Http302:21},r.EM_BUSI_TYPE={E_BusiType_Min:0,E_BusiType_Live:1,E_BusiType_Max:255,E_BusiType_Vod:2},r.EM_CLINET_TYPE={E_CLIENT_MIN:0,E_CLIENT_PC:1,E_CLIENT_ADR:2,E_CLIENT_IOS:3,E_CLIENT_WEB:4,E_CLIENT_MAX:255,E_CLIENT_NFTV:5},r.ERR_CODE_FOR_HY_PCDNGW_CLIENT_RSP={E_SUCCESS:0,E_HYGW_ERR:1,E_PCDNGW_40X:2,E_PCDNGW_50X:3,E_PCDNGW_TIO:4,E_PCDNGW_RSPERR:5,E_CLIREQ_ERR:6,E_PCDN_OFF:7,E_LIMIT_FLOWS:8},r.MyReq=function(){this.name="",this.opt="",this.mMap=new s.Map(new s.STRING,new s.STRING)},r.MyReq.prototype._clone=function(){return new r.MyReq},r.MyReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MyReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MyReq.prototype.writeTo=function(t){t.writeString(0,this.name),t.writeString(1,this.opt),t.writeMap(2,this.mMap)},r.MyReq.prototype.readFrom=function(t){this.name=t.readString(0,!1,this.name),this.opt=t.readString(1,!1,this.opt),this.mMap=t.readMap(2,!1,this.mMap)},r.MyRsp=function(){this.value=0,this.origin=new r.MyReq,this.types=new s.Vector(new s.INT32),this.eType=0},r.MyRsp.prototype._clone=function(){return new r.MyRsp},r.MyRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MyRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MyRsp.prototype.writeTo=function(t){t.writeInt32(0,this.value),t.writeStruct(1,this.origin),t.writeVector(2,this.types),t.writeInt32(3,this.eType)},r.MyRsp.prototype.readFrom=function(t){this.value=t.readInt32(0,!1,this.value),this.origin=t.readStruct(1,!1,this.origin),this.types=t.readVector(2,!1,this.types),this.eType=t.readInt32(3,!1,this.eType)},r.ClientQueryPcdnScheduleReq=function(){this.lReqTs=0,this.lUid=0,this.sGuid="",this.lAnchorUid=0,this.iCdnLine=0,this.iCliType=0,this.lBucketPara=0,this.vPcdnMode=new s.Vector(new s.INT32),this.iBusiType=0,this.sStreamName="",this.mPcdnModeCliSupportPcdns=new s.Map(new s.INT32,new s.Vector(new s.STRING)),this.vSupportMode=new s.Vector(new s.INT32),this.sUserAgent="",this.iRatio=0,this.sCodec=""},r.ClientQueryPcdnScheduleReq.prototype._clone=function(){return new r.ClientQueryPcdnScheduleReq},r.ClientQueryPcdnScheduleReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientQueryPcdnScheduleReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientQueryPcdnScheduleReq.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lUid),t.writeString(2,this.sGuid),t.writeInt64(3,this.lAnchorUid),t.writeInt32(4,this.iCdnLine),t.writeInt32(5,this.iCliType),t.writeInt64(6,this.lBucketPara),t.writeVector(30,this.vPcdnMode),t.writeInt32(31,this.iBusiType),t.writeString(32,this.sStreamName),t.writeMap(100,this.mPcdnModeCliSupportPcdns),t.writeVector(101,this.vSupportMode),t.writeString(102,this.sUserAgent),t.writeInt32(103,this.iRatio),t.writeString(104,this.sCodec)},r.ClientQueryPcdnScheduleReq.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lUid=t.readInt64(1,!1,this.lUid),this.sGuid=t.readString(2,!1,this.sGuid),this.lAnchorUid=t.readInt64(3,!1,this.lAnchorUid),this.iCdnLine=t.readInt32(4,!1,this.iCdnLine),this.iCliType=t.readInt32(5,!1,this.iCliType),this.lBucketPara=t.readInt64(6,!1,this.lBucketPara),this.vPcdnMode=t.readVector(30,!1,this.vPcdnMode),this.iBusiType=t.readInt32(31,!1,this.iBusiType),this.sStreamName=t.readString(32,!1,this.sStreamName),this.mPcdnModeCliSupportPcdns=t.readMap(100,!1,this.mPcdnModeCliSupportPcdns),this.vSupportMode=t.readVector(101,!1,this.vSupportMode),this.sUserAgent=t.readString(102,!1,this.sUserAgent),this.iRatio=t.readInt32(103,!1,this.iRatio),this.sCodec=t.readString(104,!1,this.sCodec)},r.ClientQueryPcdnScheduleRsp=function(){this.lReqTs=0,this.lRspTs=0,this.iErrCode=0,this.mPcdnModeSwitch=new s.Map(new s.INT32,new s.INT32),this.cliProv="",this.cliIsp="",this.lUid=0,this.iCdnLine=0,this.sStreamName="",this.mPcdnModePcdnName=new s.Map(new s.INT32,new s.STRING)},r.ClientQueryPcdnScheduleRsp.prototype._clone=function(){return new r.ClientQueryPcdnScheduleRsp}
1,r.ClientQueryPcdnScheduleRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientQueryPcdnScheduleRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientQueryPcdnScheduleRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lRspTs),t.writeInt32(2,this.iErrCode),t.writeMap(10,this.mPcdnModeSwitch),t.writeString(30,this.cliProv),t.writeString(31,this.cliIsp),t.writeInt64(100,this.lUid),t.writeInt32(101,this.iCdnLine),t.writeString(102,this.sStreamName),t.writeMap(200,this.mPcdnModePcdnName)},r.ClientQueryPcdnScheduleRsp.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lRspTs=t.readInt64(1,!1,this.lRspTs),this.iErrCode=t.readInt32(2,!1,this.iErrCode),this.mPcdnModeSwitch=t.readMap(10,!1,this.mPcdnModeSwitch),this.cliProv=t.readString(30,!1,this.cliProv),this.cliIsp=t.readString(31,!1,this.cliIsp),this.lUid=t.readInt64(100,!1,this.lUid),this.iCdnLine=t.readInt32(101,!1,this.iCdnLine),this.sStreamName=t.readString(102,!1,this.sStreamName),this.mPcdnModePcdnName=t.readMap(200,!1,this.mPcdnModePcdnName)},r.ClientGetStunAndPcdnProxyReq=function(){this.lReqTs=0,this.lUid=0,this.sStreamname="",this.iBaseSubs=0,this.vSub=new s.Vector(new s.INT32),this.sGuid="",this.lAnchorUid=0,this.iCdnLine=0,this.iCliType=0,this.lBucketPara=0,this.iBusiType=0,this.curPcdnName="",this.supportV6=0,this.retryCnt=0,this.sUserAgent="",this.iRatio=0,this.sCodec="",this.natType=9,this.recentMinutes=0,this.recentMiniPcdnFailedTimes=new s.Map(new s.INT32,new s.INT32),this.hotReqFlag=0,this.isSupportMiniPcdn=0,this.extMap=new s.Map(new s.STRING,new s.STRING)},r.ClientGetStunAndPcdnProxyReq.prototype._clone=function(){return new r.ClientGetStunAndPcdnProxyReq},r.ClientGetStunAndPcdnProxyReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetStunAndPcdnProxyReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetStunAndPcdnProxyReq.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lUid),t.writeString(2,this.sStreamname),t.writeInt32(3,this.iBaseSubs),t.writeVector(4,this.vSub),t.writeString(5,this.sGuid),t.writeInt64(6,this.lAnchorUid),t.writeInt32(7,this.iCdnLine),t.writeInt32(8,this.iCliType),t.writeInt64(9,this.lBucketPara),t.writeInt32(10,this.iBusiType),t.writeString(11,this.curPcdnName),t.writeInt32(12,this.supportV6),t.writeInt32(13,this.retryCnt),t.writeString(14,this.sUserAgent),t.writeInt32(15,this.iRatio),t.writeString(16,this.sCodec),t.writeInt32(17,this.natType),t.writeInt32(18,this.recentMinutes),t.writeMap(19,this.recentMiniPcdnFailedTimes),t.writeInt32(20,this.hotReqFlag),t.writeInt32(21,this.isSupportMiniPcdn),t.writeMap(22,this.extMap)},r.ClientGetStunAndPcdnProxyReq.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lUid=t.readInt64(1,!1,this.lUid),this.sStreamname=t.readString(2,!1,this.sStreamname),this.iBaseSubs=t.readInt32(3,!1,this.iBaseSubs),this.vSub=t.readVector(4,!1,this.vSub),this.sGuid=t.readString(5,!1,this.sGuid),this.lAnchorUid=t.readInt64(6,!1,this.lAnchorUid),this.iCdnLine=t.readInt32(7,!1,this.iCdnLine),this.iCliType=t.readInt32(8,!1,this.iCliType),this.lBucketPara=t.readInt64(9,!1,this.lBucketPara),this.iBusiType=t.readInt32(10,!1,this.iBusiType),this.curPcdnName=t.readString(11,!1,this.curPcdnName),this.supportV6=t.readInt32(12,!1,this.supportV6),this.retryCnt=t.readInt32(13,!1,this.retryCnt),this.sUserAgent=t.readString(14,!1,this.sUserAgent),this.iRatio=t.readInt32(15,!1,this.iRatio),this.sCodec=t.readString(16,!1,this.sCodec),this.natType=t.readInt32(17,!1,this.natType),this.recentMinutes=t.readInt32(18,!1,this.recentMinutes),this.recentMiniPcdnFailedTimes=t.readMap(19,!1,this.recentMiniPcdnFailedTimes),this.hotReqFlag=t.readInt32(20,!1,this.hotReqFlag),this.isSupportMiniPcdn=t.readInt32(21,!1,this.isSupportMiniPcdn),this.extMap=t.readMap(22,!1,this.extMap)},r.PCdnProxyUrl=function(){this.sProtocol="",this.vUrl=new s.Vector(new s.STRING),this.iStatusPcdn=0,this.iPcdnThresholdHotDegreeIn=-1,this.iPcdnThresholdHotDegreeKick=-1,this.iPcdnNowHotDegree=-1,this.iPcdnNowPullstreamUcnt=-1,this.iPcdnNowGetpcdnUcnt=-1},r.PCdnProxyUrl.prototype._clone=function(){return new r.PCdnProxyUrl}
1,r.PCdnProxyUrl.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.PCdnProxyUrl.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.PCdnProxyUrl.prototype.writeTo=function(t){t.writeString(0,this.sProtocol),t.writeVector(2,this.vUrl),t.writeInt32(3,this.iStatusPcdn),t.writeInt32(10,this.iPcdnThresholdHotDegreeIn),t.writeInt32(11,this.iPcdnThresholdHotDegreeKick),t.writeInt32(12,this.iPcdnNowHotDegree),t.writeInt32(13,this.iPcdnNowPullstreamUcnt),t.writeInt32(14,this.iPcdnNowGetpcdnUcnt)},r.PCdnProxyUrl.prototype.readFrom=function(t){this.sProtocol=t.readString(0,!1,this.sProtocol),this.vUrl=t.readVector(2,!1,this.vUrl),this.iStatusPcdn=t.readInt32(3,!1,this.iStatusPcdn),this.iPcdnThresholdHotDegreeIn=t.readInt32(10,!1,this.iPcdnThresholdHotDegreeIn),this.iPcdnThresholdHotDegreeKick=t.readInt32(11,!1,this.iPcdnThresholdHotDegreeKick),this.iPcdnNowHotDegree=t.readInt32(12,!1,this.iPcdnNowHotDegree),this.iPcdnNowPullstreamUcnt=t.readInt32(13,!1,this.iPcdnNowPullstreamUcnt),this.iPcdnNowGetpcdnUcnt=t.readInt32(14,!1,this.iPcdnNowGetpcdnUcnt)},r.ClientGetStunAndPcdnProxyRsp=function(){this.lReqTs=0,this.lRspTs=0,this.lUid=0,this.sStreamname="",this.iErrCode=0,this.iBaseSubs=0,this.mSubToPullStreamUrl=new s.Map(new s.INT32,new s.Map(new s.STRING,new r.PCdnProxyUrl)),this.cliProv="",this.cliIsp="",this.pcdnName="",this.iCdnLine=0,this.sPcdnIsp="",this.sPcdnArea="",this.requestGap=0,this.subIndexPcdnName=new s.Map(new s.INT32,new s.STRING),this.minipcdnFailedTimesLimit=3,this.expectPcdnNane="",this.extMap=new s.Map(new s.STRING,new s.STRING)},r.ClientGetStunAndPcdnProxyRsp.prototype._clone=function(){return new r.ClientGetStunAndPcdnProxyRsp},r.ClientGetStunAndPcdnProxyRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetStunAndPcdnProxyRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetStunAndPcdnProxyRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lRspTs),t.writeInt64(2,this.lUid),t.writeString(3,this.sStreamname),t.writeInt32(4,this.iErrCode),t.writeInt32(5,this.iBaseSubs),t.writeMap(12,this.mSubToPullStreamUrl),t.writeString(13,this.cliProv),t.writeString(14,this.cliIsp),t.writeString(15,this.pcdnName),t.writeInt32(100,this.iCdnLine),t.writeString(200,this.sPcdnIsp),t.writeString(201,this.sPcdnArea),t.writeInt32(210,this.requestGap),t.writeMap(211,this.subIndexPcdnName),t.writeInt32(212,this.minipcdnFailedTimesLimit),t.writeString(213,this.expectPcdnNane),t.writeMap(214,this.extMap)},r.ClientGetStunAndPcdnProxyRsp.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lRspTs=t.readInt64(1,!1,this.lRspTs),this.lUid=t.readInt64(2,!1,this.lUid),this.sStreamname=t.readString(3,!1,this.sStreamname),this.iErrCode=t.readInt32(4,!1,this.iErrCode),this.iBaseSubs=t.readInt32(5,!1,this.iBaseSubs),this.mSubToPullStreamUrl=t.readMap(12,!1,this.mSubToPullStreamUrl),this.cliProv=t.readString(13,!1,this.cliProv),this.cliIsp=t.readString(14,!1,this.cliIsp),this.pcdnName=t.readString(15,!1,this.pcdnName),this.iCdnLine=t.readInt32(100,!1,this.iCdnLine),this.sPcdnIsp=t.readString(200,!1,this.sPcdnIsp),this.sPcdnArea=t.readString(201,!1,this.sPcdnArea),this.requestGap=t.readInt32(210,!1,this.requestGap),this.subIndexPcdnName=t.readMap(211,!1,this.subIndexPcdnName),this.minipcdnFailedTimesLimit=t.readInt32(212,!1,this.minipcdnFailedTimesLimit),this.expectPcdnNane=t.readString(213,!1,this.expectPcdnNane),this.extMap=t.readMap(214,!1,this.extMap)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq=function(){this.lReqTs=0,this.lUid=0,this.sGuid="",this.lAnchorUid=0,this.iCdnLine=0,this.sStreamname="",this.iBaseSubs=0,this.vSub=new s.Vector(new s.INT32),this.iCliType=0,this.lBucketPara=0,this.iBusiType=0,this.vCliSupportPcdns=new s.Vector(new s.STRING),this.curPcdnName=""},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq.prototype._clone=function(){return new r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq.prototype._read=function(t,e,
1i){return t.readStruct(e,!0,i)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lUid),t.writeString(2,this.sGuid),t.writeInt64(3,this.lAnchorUid),t.writeInt32(4,this.iCdnLine),t.writeString(5,this.sStreamname),t.writeInt32(6,this.iBaseSubs),t.writeVector(7,this.vSub),t.writeInt32(8,this.iCliType),t.writeInt64(9,this.lBucketPara),t.writeInt32(10,this.iBusiType),t.writeVector(11,this.vCliSupportPcdns),t.writeString(12,this.curPcdnName)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoReq.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lUid=t.readInt64(1,!1,this.lUid),this.sGuid=t.readString(2,!1,this.sGuid),this.lAnchorUid=t.readInt64(3,!1,this.lAnchorUid),this.iCdnLine=t.readInt32(4,!1,this.iCdnLine),this.sStreamname=t.readString(5,!1,this.sStreamname),this.iBaseSubs=t.readInt32(6,!1,this.iBaseSubs),this.vSub=t.readVector(7,!1,this.vSub),this.iCliType=t.readInt32(8,!1,this.iCliType),this.lBucketPara=t.readInt64(9,!1,this.lBucketPara),this.iBusiType=t.readInt32(10,!1,this.iBusiType),this.vCliSupportPcdns=t.readVector(11,!1,this.vCliSupportPcdns),this.curPcdnName=t.readString(12,!1,this.curPcdnName)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp=function(){this.lReqTs=0,this.lRspTs=0,this.iErrCode=0,this.sPcdnName="",this.mP2pSubstreamUrl=new s.Map(new s.INT32,new s.STRING),this.cliProv="",this.cliIsp="",this.lUid=0,this.iCdnLine=0,this.sStreamname=""},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp.prototype._clone=function(){return new r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lRspTs),t.writeInt32(2,this.iErrCode),t.writeString(10,this.sPcdnName),t.writeMap(11,this.mP2pSubstreamUrl),t.writeString(30,this.cliProv),t.writeString(31,this.cliIsp),t.writeInt64(100,this.lUid),t.writeInt32(101,this.iCdnLine),t.writeString(102,this.sStreamname)},r.ClientGetPcdnP2pOutsideSdkSubstreamInfoRsp.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lRspTs=t.readInt64(1,!1,this.lRspTs),this.iErrCode=t.readInt32(2,!1,this.iErrCode),this.sPcdnName=t.readString(10,!1,this.sPcdnName),this.mP2pSubstreamUrl=t.readMap(11,!1,this.mP2pSubstreamUrl),this.cliProv=t.readString(30,!1,this.cliProv),this.cliIsp=t.readString(31,!1,this.cliIsp),this.lUid=t.readInt64(100,!1,this.lUid),this.iCdnLine=t.readInt32(101,!1,this.iCdnLine),this.sStreamname=t.readString(102,!1,this.sStreamname)},r.ClientGetPcdnFlvHttpFullstreamInfoReq=function(){this.lReqTs=0,this.lUid=0,this.sGuid="",this.lAnchorUid=0,this.iCdnLine=0,this.iCliType=0,this.sStreamName="",this.iRatio=0,this.sCodec="",this.lBucketPara=0,this.iBusiType=0,this.curPcdnName="",this.supportV6=0,this.sUserAgent=""},r.ClientGetPcdnFlvHttpFullstreamInfoReq.prototype._clone=function(){return new r.ClientGetPcdnFlvHttpFullstreamInfoReq},r.ClientGetPcdnFlvHttpFullstreamInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetPcdnFlvHttpFullstreamInfoReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetPcdnFlvHttpFullstreamInfoReq.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lUid),t.writeString(2,this.sGuid),t.writeInt64(3,this.lAnchorUid),t.writeInt32(4,this.iCdnLine),t.writeInt32(5,this.iCliType),t.writeString(6,this.sStreamName),t.writeInt32(7,this.iRatio),t.writeString(8,this.sCodec),t.writeInt64(9,this.lBucketPara),t.writeInt32(10,this.iBusiType),t.writeString(11,this.curPcdnName),t.writeInt32(12,this.supportV6),t.writeString(13,this.sUserAgent)},r.ClientGetPcdnFlvHttpFullstreamInfoReq.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lUid=t.readInt64(1,!1,this.lUid),this.sGuid=t.readString(2,!1,this.sGuid),this.lAnchorUid=t.readInt64(3,!1,this.lAnchorUid),this.iCdnLine=t.readInt32(4,!1,this.iCdnLine),this.iCliType=t.readInt32(5,!1,this.iCliType),this.sStreamName=t.readString(6,
1!1,this.sStreamName),this.iRatio=t.readInt32(7,!1,this.iRatio),this.sCodec=t.readString(8,!1,this.sCodec),this.lBucketPara=t.readInt64(9,!1,this.lBucketPara),this.iBusiType=t.readInt32(10,!1,this.iBusiType),this.curPcdnName=t.readString(11,!1,this.curPcdnName),this.supportV6=t.readInt32(12,!1,this.supportV6),this.sUserAgent=t.readString(13,!1,this.sUserAgent)},r.ClientGetPcdnFlvHttpFullstreamInfoRsp=function(){this.lReqTs=0,this.lRspTs=0,this.lUid=0,this.sStreamName="",this.iErrCode=0,this.sPcdnName="",this.pullStreamUrl=new r.PCdnProxyUrl,this.cliProv="",this.cliIsp="",this.iCdnLine=0,this.iRatio=0,this.sCodec="",this.mAllPullStreamUrl=new s.Map(new s.STRING,new r.PCdnProxyUrl)},r.ClientGetPcdnFlvHttpFullstreamInfoRsp.prototype._clone=function(){return new r.ClientGetPcdnFlvHttpFullstreamInfoRsp},r.ClientGetPcdnFlvHttpFullstreamInfoRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetPcdnFlvHttpFullstreamInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetPcdnFlvHttpFullstreamInfoRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lRspTs),t.writeInt64(2,this.lUid),t.writeString(3,this.sStreamName),t.writeInt32(4,this.iErrCode),t.writeString(5,this.sPcdnName),t.writeStruct(6,this.pullStreamUrl),t.writeString(7,this.cliProv),t.writeString(8,this.cliIsp),t.writeInt32(9,this.iCdnLine),t.writeInt32(10,this.iRatio),t.writeString(11,this.sCodec),t.writeMap(12,this.mAllPullStreamUrl)},r.ClientGetPcdnFlvHttpFullstreamInfoRsp.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lRspTs=t.readInt64(1,!1,this.lRspTs),this.lUid=t.readInt64(2,!1,this.lUid),this.sStreamName=t.readString(3,!1,this.sStreamName),this.iErrCode=t.readInt32(4,!1,this.iErrCode),this.sPcdnName=t.readString(5,!1,this.sPcdnName),this.pullStreamUrl=t.readStruct(6,!1,this.pullStreamUrl),this.cliProv=t.readString(7,!1,this.cliProv),this.cliIsp=t.readString(8,!1,this.cliIsp),this.iCdnLine=t.readInt32(9,!1,this.iCdnLine),this.iRatio=t.readInt32(10,!1,this.iRatio),this.sCodec=t.readString(11,!1,this.sCodec),this.mAllPullStreamUrl=t.readMap(12,!1,this.mAllPullStreamUrl)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq=function(){this.lReqTs=0,this.lUid=0,this.sGuid="",this.lAnchorUid=0,this.iCdnLine=0,this.sStreamName="",this.iRatio=0,this.sCodec="",this.iCliType=0,this.lBucketPara=0,this.iBusiType=0,this.vCliSupportPcdns=new s.Vector(new s.STRING),this.curPcdnName=""},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq.prototype._clone=function(){return new r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lUid),t.writeString(2,this.sGuid),t.writeInt64(3,this.lAnchorUid),t.writeInt32(4,this.iCdnLine),t.writeString(5,this.sStreamName),t.writeInt32(6,this.iRatio),t.writeString(7,this.sCodec),t.writeInt32(8,this.iCliType),t.writeInt64(9,this.lBucketPara),t.writeInt32(10,this.iBusiType),t.writeVector(11,this.vCliSupportPcdns),t.writeString(12,this.curPcdnName)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lUid=t.readInt64(1,!1,this.lUid),this.sGuid=t.readString(2,!1,this.sGuid),this.lAnchorUid=t.readInt64(3,!1,this.lAnchorUid),this.iCdnLine=t.readInt32(4,!1,this.iCdnLine),this.sStreamName=t.readString(5,!1,this.sStreamName),this.iRatio=t.readInt32(6,!1,this.iRatio),this.sCodec=t.readString(7,!1,this.sCodec),this.iCliType=t.readInt32(8,!1,this.iCliType),this.lBucketPara=t.readInt64(9,!1,this.lBucketPara),this.iBusiType=t.readInt32(10,!1,this.iBusiType),this.vCliSupportPcdns=t.readVector(11,!1,this.vCliSupportPcdns),this.curPcdnName=t.readString(12,!1,this.curPcdnName)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp=function(){this.lReqTs=0,this.lRspTs=0,this.iErrCode=0,this.sPcdnName="",this.sFlvFullstreamUrl="",this.cliProv="",this.cliIsp="",this.lUid=0,this.iCdnLine=0,this.sStreamName="",this.iRatio=0,this.sTransUid=""},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp.prototype._clone=function(){return new r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp.prototype._write=function(t,e,
1i){t.writeStruct(e,i)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lReqTs),t.writeInt64(1,this.lRspTs),t.writeInt32(2,this.iErrCode),t.writeString(10,this.sPcdnName),t.writeString(11,this.sFlvFullstreamUrl),t.writeString(30,this.cliProv),t.writeString(31,this.cliIsp),t.writeInt64(100,this.lUid),t.writeInt32(101,this.iCdnLine),t.writeString(102,this.sStreamName),t.writeInt32(103,this.iRatio),t.writeString(104,this.sTransUid)},r.ClientGetPcdnFlvOutsideSdkFullstreamInfoRsp.prototype.readFrom=function(t){this.lReqTs=t.readInt64(0,!1,this.lReqTs),this.lRspTs=t.readInt64(1,!1,this.lRspTs),this.iErrCode=t.readInt32(2,!1,this.iErrCode),this.sPcdnName=t.readString(10,!1,this.sPcdnName),this.sFlvFullstreamUrl=t.readString(11,!1,this.sFlvFullstreamUrl),this.cliProv=t.readString(30,!1,this.cliProv),this.cliIsp=t.readString(31,!1,this.cliIsp),this.lUid=t.readInt64(100,!1,this.lUid),this.iCdnLine=t.readInt32(101,!1,this.iCdnLine),this.sStreamName=t.readString(102,!1,this.sStreamName),this.iRatio=t.readInt32(103,!1,this.iRatio),this.sTransUid=t.readString(104,!1,this.sTransUid)},r.RecSysInfo=function(){this.sAnchorUid="",this.sRoomId="",this.sDispatchId="",this.iScene=0,this.sStrategy="",this.lServerTs=0,this.lAction=0,this.sActionReason="",this.sActValue=""},r.RecSysInfo.prototype._clone=function(){return new r.RecSysInfo},r.RecSysInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysInfo.prototype.writeTo=function(t){t.writeString(0,this.sAnchorUid),t.writeString(1,this.sRoomId),t.writeString(2,this.sDispatchId),t.writeInt32(3,this.iScene),t.writeString(4,this.sStrategy),t.writeInt64(5,this.lServerTs),t.writeInt64(6,this.lAction),t.writeString(7,this.sActionReason),t.writeString(8,this.sActValue)},r.RecSysInfo.prototype.readFrom=function(t){this.sAnchorUid=t.readString(0,!1,this.sAnchorUid),this.sRoomId=t.readString(1,!1,this.sRoomId),this.sDispatchId=t.readString(2,!1,this.sDispatchId),this.iScene=t.readInt32(3,!1,this.iScene),this.sStrategy=t.readString(4,!1,this.sStrategy),this.lServerTs=t.readInt64(5,!1,this.lServerTs),this.lAction=t.readInt64(6,!1,this.lAction),this.sActionReason=t.readString(7,!1,this.sActionReason),this.sActValue=t.readString(8,!1,this.sActValue)},r.RecSysReq=function(){this.tId=new r.MediaUserId,this.sAnchorUid="",this.sRoomId="",this.sDispatchId="",this.iScene=0,this.bDebug=0,this.sNet="",this.sSdkVer="",this.mAppendInfo=new s.Map(new s.STRING,new s.STRING)},r.RecSysReq.prototype._clone=function(){return new r.RecSysReq},r.RecSysReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sAnchorUid),t.writeString(2,this.sRoomId),t.writeString(3,this.sDispatchId),t.writeInt32(4,this.iScene),t.writeInt32(5,this.bDebug),t.writeString(6,this.sNet),t.writeString(7,this.sSdkVer),t.writeMap(8,this.mAppendInfo)},r.RecSysReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.sAnchorUid=t.readString(1,!1,this.sAnchorUid),this.sRoomId=t.readString(2,!1,this.sRoomId),this.sDispatchId=t.readString(3,!1,this.sDispatchId),this.iScene=t.readInt32(4,!1,this.iScene),this.bDebug=t.readInt32(5,!1,this.bDebug),this.sNet=t.readString(6,!1,this.sNet),this.sSdkVer=t.readString(7,!1,this.sSdkVer),this.mAppendInfo=t.readMap(8,!1,this.mAppendInfo)},r.RecSysRsp=function(){this.iStatus=0,this.sError="",this.tRecSysInfo=new r.RecSysInfo},r.RecSysRsp.prototype._clone=function(){return new r.RecSysRsp},r.RecSysRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iStatus),t.writeString(1,this.sError),t.writeStruct(2,this.tRecSysInfo)},r.RecSysRsp.prototype.readFrom=function(t){this.iStatus=t.readInt32(0,!1,this.iStatus),this.sError=t.readString(1,!1,this.sError),this.tRecSysInfo=t.readStruct(2,!1,this.tRecSysInfo)},r.RecSysNotice=function(){this.tRecSysInfo=new r.RecSysInfo},r.RecSysNotice.prototype._clone=function(){return new r.RecSysNotice}
1,r.RecSysNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysNotice.prototype.writeTo=function(t){t.writeStruct(0,this.tRecSysInfo)},r.RecSysNotice.prototype.readFrom=function(t){this.tRecSysInfo=t.readStruct(0,!1,this.tRecSysInfo)},r.VodUrlRange=function(){this.sUrl="",this.sRange="",this.index=0},r.VodUrlRange.prototype._clone=function(){return new r.VodUrlRange},r.VodUrlRange.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.VodUrlRange.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.VodUrlRange.prototype.writeTo=function(t){t.writeString(0,this.sUrl),t.writeString(1,this.sRange),t.writeInt64(2,this.index)},r.VodUrlRange.prototype.readFrom=function(t){this.sUrl=t.readString(0,!1,this.sUrl),this.sRange=t.readString(1,!1,this.sRange),this.index=t.readInt64(2,!1,this.index)},r.VodPcdnProxyUrl=function(){this.reqKey=new r.VodUrlRange,this.iStatusPcdn=0,this.iVodPcdnHotDegreeIn=-1,this.iVodPcdnHotDegreeNow=-1,this.vUrls=new s.Vector(new s.STRING)},r.VodPcdnProxyUrl.prototype._clone=function(){return new r.VodPcdnProxyUrl},r.VodPcdnProxyUrl.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.VodPcdnProxyUrl.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.VodPcdnProxyUrl.prototype.writeTo=function(t){t.writeStruct(0,this.reqKey),t.writeInt32(1,this.iStatusPcdn),t.writeInt32(2,this.iVodPcdnHotDegreeIn),t.writeInt32(3,this.iVodPcdnHotDegreeNow),t.writeVector(4,this.vUrls)},r.VodPcdnProxyUrl.prototype.readFrom=function(t){this.reqKey=t.readStruct(0,!1,this.reqKey),this.iStatusPcdn=t.readInt32(1,!1,this.iStatusPcdn),this.iVodPcdnHotDegreeIn=t.readInt32(2,!1,this.iVodPcdnHotDegreeIn),this.iVodPcdnHotDegreeNow=t.readInt32(3,!1,this.iVodPcdnHotDegreeNow),this.vUrls=t.readVector(4,!1,this.vUrls)},r.ClientGetVodPcdnProxyReq=function(){this.appid=0,this.lReqTs=0,this.lUid=0,this.sGuid="",this.iCliType=0,this.lBucketPara=0,this.sOrigUrl="",this.vKeys=new s.Vector(new r.VodUrlRange)},r.ClientGetVodPcdnProxyReq.prototype._clone=function(){return new r.ClientGetVodPcdnProxyReq},r.ClientGetVodPcdnProxyReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetVodPcdnProxyReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetVodPcdnProxyReq.prototype.writeTo=function(t){t.writeInt32(0,this.appid),t.writeInt64(1,this.lReqTs),t.writeInt64(2,this.lUid),t.writeString(3,this.sGuid),t.writeInt32(4,this.iCliType),t.writeInt64(5,this.lBucketPara),t.writeString(6,this.sOrigUrl),t.writeVector(7,this.vKeys)},r.ClientGetVodPcdnProxyReq.prototype.readFrom=function(t){this.appid=t.readInt32(0,!1,this.appid),this.lReqTs=t.readInt64(1,!1,this.lReqTs),this.lUid=t.readInt64(2,!1,this.lUid),this.sGuid=t.readString(3,!1,this.sGuid),this.iCliType=t.readInt32(4,!1,this.iCliType),this.lBucketPara=t.readInt64(5,!1,this.lBucketPara),this.sOrigUrl=t.readString(6,!1,this.sOrigUrl),this.vKeys=t.readVector(7,!1,this.vKeys)},r.ClientGetVodPcdnProxyReqRsp=function(){this.appid=0,this.lReqTs=0,this.lRspTs=0,this.lUid=0,this.sOrigUrl="",this.iErrCode=0,this.vPcdnUrls=new s.Vector(new r.VodPcdnProxyUrl),this.cliProv="",this.cliIsp="",this.pcdnName="",this.sPcdnIsp="",this.sPcdnArea=""},r.ClientGetVodPcdnProxyReqRsp.prototype._clone=function(){return new r.ClientGetVodPcdnProxyReqRsp},r.ClientGetVodPcdnProxyReqRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ClientGetVodPcdnProxyReqRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ClientGetVodPcdnProxyReqRsp.prototype.writeTo=function(t){t.writeInt32(0,this.appid),t.writeInt64(1,this.lReqTs),t.writeInt64(2,this.lRspTs),t.writeInt64(3,this.lUid),t.writeString(4,this.sOrigUrl),t.writeInt32(5,this.iErrCode),t.writeVector(6,this.vPcdnUrls),t.writeString(7,this.cliProv),t.writeString(8,this.cliIsp),t.writeString(9,this.pcdnName),t.writeString(10,this.sPcdnIsp),t.writeString(11,this.sPcdnArea)},r.ClientGetVodPcdnProxyReqRsp.prototype.readFrom=function(t){this.appid=t.readInt32(0,!1,this.appid),this.lReqTs=t.readInt64(1,!1,this.lReqTs),this.lRspTs=t.readInt64(2,!1,this.lRspTs),this.lUid=t.readInt64(3,!1,this.lUid),this.sOrigUrl=t.readString(4,!1,this.sOrigUrl),this.iErrCode=t.readInt32(5,!1,this.iErrCode),this.vPcdnUrls=t.readVector(6,!1,this.vPcdnUrls),this.cliProv=t.readString(7,!1,this.cliProv),this.cliIsp=t.readString(8,!1,this.cliIsp
1),this.pcdnName=t.readString(9,!1,this.pcdnName),this.sPcdnIsp=t.readString(10,!1,this.sPcdnIsp),this.sPcdnArea=t.readString(11,!1,this.sPcdnArea)},r.GetVideoHisUponReq=function(){this.lUid=0,this.lLiveId=0,this.tId=new r.UserId},r.GetVideoHisUponReq.prototype._clone=function(){return new r.GetVideoHisUponReq},r.GetVideoHisUponReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetVideoHisUponReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetVideoHisUponReq.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeInt64(1,this.lLiveId),t.writeStruct(2,this.tId)},r.GetVideoHisUponReq.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.lLiveId=t.readInt64(1,!1,this.lLiveId),this.tId=t.readStruct(2,!1,this.tId)},r.GetVideoHisUponRsp=function(){this.lUid=0,this.vHistoryList=new s.Vector(new r.GameLiveHlsInfo)},r.GetVideoHisUponRsp.prototype._clone=function(){return new r.GetVideoHisUponRsp},r.GetVideoHisUponRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetVideoHisUponRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetVideoHisUponRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeVector(1,this.vHistoryList)},r.GetVideoHisUponRsp.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.vHistoryList=t.readVector(1,!1,this.vHistoryList)},r.ImgplusABTestNotice=function(){this.lPid=0,this.iAppid=0,this.iSwitch=0},r.ImgplusABTestNotice.prototype._clone=function(){return new r.ImgplusABTestNotice},r.ImgplusABTestNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.ImgplusABTestNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.ImgplusABTestNotice.prototype.writeTo=function(t){t.writeInt64(0,this.lPid),t.writeInt32(1,this.iAppid),t.writeInt32(2,this.iSwitch)},r.ImgplusABTestNotice.prototype.readFrom=function(t){this.lPid=t.readInt64(0,!1,this.lPid),this.iAppid=t.readInt32(1,!1,this.iAppid),this.iSwitch=t.readInt32(2,!1,this.iSwitch)},r.MediaUserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sUA="",this.sCookie="",this.iAppid=0,this.sStrUid="",this.sUAppId="",this.iNetType=127},r.MediaUserId.prototype._clone=function(){return new r.MediaUserId},r.MediaUserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaUserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaUserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sUA),t.writeString(4,this.sCookie),t.writeInt32(6,this.iAppid),t.writeString(8,this.sStrUid),t.writeString(9,this.sUAppId),t.writeInt32(10,this.iNetType)},r.MediaUserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sUA=t.readString(3,!1,this.sUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iAppid=t.readInt32(6,!1,this.iAppid),this.sStrUid=t.readString(8,!1,this.sStrUid),this.sUAppId=t.readString(9,!1,this.sUAppId),this.iNetType=t.readInt32(10,!1,this.iNetType)},r.MediaResolution=function(){this.iWidth=0,this.iHeight=0},r.MediaResolution.prototype._clone=function(){return new r.MediaResolution},r.MediaResolution.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaResolution.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaResolution.prototype.writeTo=function(t){t.writeInt32(0,this.iWidth),t.writeInt32(1,this.iHeight)},r.MediaResolution.prototype.readFrom=function(t){this.iWidth=t.readInt32(0,!1,this.iWidth),this.iHeight=t.readInt32(1,!1,this.iHeight)},r.MediaStreamFormatInfo=function(){this.sFormatName="",this.sUrl="",this.sSuffix="",this.vIPList=new s.Vector(new s.STRING),this.iIsSupport=0,this.iRate=0,this.sAdditionalParam="",this.lFormatPropertyFlag=0},r.MediaStreamFormatInfo.prototype._clone=function(){return new r.MediaStreamFormatInfo},r.MediaStreamFormatInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamFormatInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamFormatInfo.prototype.writeTo=function(t){t.writeString(0,this.sFormatName),t.writeString(1,this.sUrl),t.writeString(2,this.sSuffix),t.writeVector(3,this.vIPList),t.writeInt32(4,this.iIsSupport),t.writeInt32(5,this.iRate),t.writeString(6,this.sAdditionalParam),t.writeInt64(7,this.lFormatPropertyFlag)},r.MediaStreamFormatInfo.prototype.readFrom=function(t){this.sFormatName=t.readString(0,!1,this.sFormatName),this.sUrl=t.readString(1,!1,this.sUrl),this.sSuffix=t.readString(2,!1,this.sSuffix),this.vIPList=t.readVector(3,!1,this.vIPList),this.iIsSupport=t.readInt32(4,!1,this.iIsSupport),this.iRate=t.readInt32(5,!1,this.iRate),this.sAdditionalParam=t.readString(6,
1!1,this.sAdditionalParam),this.lFormatPropertyFlag=t.readInt64(7,!1,this.lFormatPropertyFlag)},r.MediaStreamInfo=function(){this.sCdnName="",this.sStreamName="",this.sFlvUrl="",this.sFlvSuffix="",this.sHlsUrl="",this.sHlsSuffix="",this.iLineIndex=0,this.vFlvIPList=new s.Vector(new s.STRING),this.iIsP2PSupport=0,this.sP2pUrl="",this.sP2pSuffix="",this.lFreeFlag=0,this.iIsHEVCSupport=0,this.vP2pIPList=new s.Vector(new s.STRING),this.iPCPriorityRate=0,this.iWebPriorityRate=0,this.iMobilePriorityRate=0,this.sAdditionalParam="",this.mMediaStreamFormatInfo=new s.Map(new s.STRING,new r.MediaStreamFormatInfo)},r.MediaStreamInfo.prototype._clone=function(){return new r.MediaStreamInfo},r.MediaStreamInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamInfo.prototype.writeTo=function(t){t.writeString(0,this.sCdnName),t.writeString(1,this.sStreamName),t.writeString(2,this.sFlvUrl),t.writeString(3,this.sFlvSuffix),t.writeString(4,this.sHlsUrl),t.writeString(5,this.sHlsSuffix),t.writeInt32(6,this.iLineIndex),t.writeVector(7,this.vFlvIPList),t.writeInt32(8,this.iIsP2PSupport),t.writeString(9,this.sP2pUrl),t.writeString(10,this.sP2pSuffix),t.writeInt64(11,this.lFreeFlag),t.writeInt32(12,this.iIsHEVCSupport),t.writeVector(13,this.vP2pIPList),t.writeInt32(14,this.iPCPriorityRate),t.writeInt32(15,this.iWebPriorityRate),t.writeInt32(16,this.iMobilePriorityRate),t.writeString(17,this.sAdditionalParam),t.writeMap(18,this.mMediaStreamFormatInfo)},r.MediaStreamInfo.prototype.readFrom=function(t){this.sCdnName=t.readString(0,!1,this.sCdnName),this.sStreamName=t.readString(1,!1,this.sStreamName),this.sFlvUrl=t.readString(2,!1,this.sFlvUrl),this.sFlvSuffix=t.readString(3,!1,this.sFlvSuffix),this.sHlsUrl=t.readString(4,!1,this.sHlsUrl),this.sHlsSuffix=t.readString(5,!1,this.sHlsSuffix),this.iLineIndex=t.readInt32(6,!1,this.iLineIndex),this.vFlvIPList=t.readVector(7,!1,this.vFlvIPList),this.iIsP2PSupport=t.readInt32(8,!1,this.iIsP2PSupport),this.sP2pUrl=t.readString(9,!1,this.sP2pUrl),this.sP2pSuffix=t.readString(10,!1,this.sP2pSuffix),this.lFreeFlag=t.readInt64(11,!1,this.lFreeFlag),this.iIsHEVCSupport=t.readInt32(12,!1,this.iIsHEVCSupport),this.vP2pIPList=t.readVector(13,!1,this.vP2pIPList),this.iPCPriorityRate=t.readInt32(14,!1,this.iPCPriorityRate),this.iWebPriorityRate=t.readInt32(15,!1,this.iWebPriorityRate),this.iMobilePriorityRate=t.readInt32(16,!1,this.iMobilePriorityRate),this.sAdditionalParam=t.readString(17,!1,this.sAdditionalParam),this.mMediaStreamFormatInfo=t.readMap(18,!1,this.mMediaStreamFormatInfo)},r.StreamGearInfo=function(){this.sDisplayName="",this.iBitRate=0,this.iCodecType=0,this.iHEVCBitRate=-1,this.tResolution=new r.MediaResolution,this.sAdditionalParam="",this.mSupportFormat=new s.Map(new s.STRING,new s.INT64),this.sBusiGearIndex=""},r.StreamGearInfo.prototype._clone=function(){return new r.StreamGearInfo},r.StreamGearInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.StreamGearInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.StreamGearInfo.prototype.writeTo=function(t){t.writeString(0,this.sDisplayName),t.writeInt32(1,this.iBitRate),t.writeInt32(2,this.iCodecType),t.writeInt32(3,this.iHEVCBitRate),t.writeStruct(4,this.tResolution),t.writeString(5,this.sAdditionalParam),t.writeMap(6,this.mSupportFormat),t.writeString(7,this.sBusiGearIndex)},r.StreamGearInfo.prototype.readFrom=function(t){this.sDisplayName=t.readString(0,!1,this.sDisplayName),this.iBitRate=t.readInt32(1,!1,this.iBitRate),this.iCodecType=t.readInt32(2,!1,this.iCodecType),this.iHEVCBitRate=t.readInt32(3,!1,this.iHEVCBitRate),this.tResolution=t.readStruct(4,!1,this.tResolution),this.sAdditionalParam=t.readString(5,!1,this.sAdditionalParam),this.mSupportFormat=t.readMap(6,!1,this.mSupportFormat),this.sBusiGearIndex=t.readString(7,!1,this.sBusiGearIndex)},r.MediaStreamNameInfoPack=function(){this.vMediaStreamInfo=new s.Vector(new r.MediaStreamInfo),this.vStreamGearInfo=new s.Vector(new r.StreamGearInfo),this.sStreamGroupId="",this.lLiveCompatibleFlag=0,this.sAntiCode="",this.lStreamId=0,this.lUid=0,this.iStreamProperty=0,this.iBitRate=0,this.iStreamType=0,this.iPcDefaultBitRate=0,this.iWebDefaultBitRate=0,this.iMobileDefaultBitRate=0,this.sStreamBusiProperty="",this.sAdditionalParam="",this.iStreamCategory=0},r.MediaStreamNameInfoPack.prototype._clone=function(){return new r.MediaStreamNameInfoPack}
1,r.MediaStreamNameInfoPack.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamNameInfoPack.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamNameInfoPack.prototype.writeTo=function(t){t.writeVector(0,this.vMediaStreamInfo),t.writeVector(1,this.vStreamGearInfo),t.writeString(2,this.sStreamGroupId),t.writeInt64(3,this.lLiveCompatibleFlag),t.writeString(4,this.sAntiCode),t.writeInt64(5,this.lStreamId),t.writeInt64(6,this.lUid),t.writeInt32(7,this.iStreamProperty),t.writeInt32(8,this.iBitRate),t.writeInt32(9,this.iStreamType),t.writeInt32(10,this.iPcDefaultBitRate),t.writeInt32(11,this.iWebDefaultBitRate),t.writeInt32(12,this.iMobileDefaultBitRate),t.writeString(13,this.sStreamBusiProperty),t.writeString(14,this.sAdditionalParam),t.writeInt32(15,this.iStreamCategory)},r.MediaStreamNameInfoPack.prototype.readFrom=function(t){this.vMediaStreamInfo=t.readVector(0,!1,this.vMediaStreamInfo),this.vStreamGearInfo=t.readVector(1,!1,this.vStreamGearInfo),this.sStreamGroupId=t.readString(2,!1,this.sStreamGroupId),this.lLiveCompatibleFlag=t.readInt64(3,!1,this.lLiveCompatibleFlag),this.sAntiCode=t.readString(4,!1,this.sAntiCode),this.lStreamId=t.readInt64(5,!1,this.lStreamId),this.lUid=t.readInt64(6,!1,this.lUid),this.iStreamProperty=t.readInt32(7,!1,this.iStreamProperty),this.iBitRate=t.readInt32(8,!1,this.iBitRate),this.iStreamType=t.readInt32(9,!1,this.iStreamType),this.iPcDefaultBitRate=t.readInt32(10,!1,this.iPcDefaultBitRate),this.iWebDefaultBitRate=t.readInt32(11,!1,this.iWebDefaultBitRate),this.iMobileDefaultBitRate=t.readInt32(12,!1,this.iMobileDefaultBitRate),this.sStreamBusiProperty=t.readString(13,!1,this.sStreamBusiProperty),this.sAdditionalParam=t.readString(14,!1,this.sAdditionalParam),this.iStreamCategory=t.readInt32(15,!1,this.iStreamCategory)},r.MediaStreamInfoPack=function(){this.mMediaStreamInfoPack=new s.Map(new s.STRING,new r.MediaStreamNameInfoPack)},r.MediaStreamInfoPack.prototype._clone=function(){return new r.MediaStreamInfoPack},r.MediaStreamInfoPack.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaStreamInfoPack.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaStreamInfoPack.prototype.writeTo=function(t){t.writeMap(0,this.mMediaStreamInfoPack)},r.MediaStreamInfoPack.prototype.readFrom=function(t){this.mMediaStreamInfoPack=t.readMap(0,!1,this.mMediaStreamInfoPack)},r.GetStreamInfoByRoomFakeReq=function(){this.tId=new r.MediaUserId,this.sRoomId="",this.mpVariable=new s.Map(new s.STRING,new s.STRING),this.iMediaPackType=-1,this.mBusiParams=new s.Map(new s.STRING,new s.STRING)},r.GetStreamInfoByRoomFakeReq.prototype._clone=function(){return new r.GetStreamInfoByRoomFakeReq},r.GetStreamInfoByRoomFakeReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetStreamInfoByRoomFakeReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetStreamInfoByRoomFakeReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sRoomId),t.writeMap(2,this.mpVariable),t.writeInt32(3,this.iMediaPackType),t.writeMap(4,this.mBusiParams)},r.GetStreamInfoByRoomFakeReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.sRoomId=t.readString(1,!1,this.sRoomId),this.mpVariable=t.readMap(2,!1,this.mpVariable),this.iMediaPackType=t.readInt32(3,!1,this.iMediaPackType),this.mBusiParams=t.readMap(4,!1,this.mBusiParams)},r.GetStreamInfoByRoomFakeRsp=function(){this.tStreamInfoPack=new r.MediaStreamInfoPack,this.mpConfig=new s.Map(new s.STRING,new s.STRING),this.sRoomId=""},r.GetStreamInfoByRoomFakeRsp.prototype._clone=function(){return new r.GetStreamInfoByRoomFakeRsp},r.GetStreamInfoByRoomFakeRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetStreamInfoByRoomFakeRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetStreamInfoByRoomFakeRsp.prototype.writeTo=function(t){t.writeStruct(0,this.tStreamInfoPack),t.writeMap(1,this.mpConfig),t.writeString(2,this.sRoomId)},r.GetStreamInfoByRoomFakeRsp.prototype.readFrom=function(t){this.tStreamInfoPack=t.readStruct(0,!1,this.tStreamInfoPack),this.mpConfig=t.readMap(1,!1,this.mpConfig),this.sRoomId=t.readString(2,!1,this.sRoomId)}
1,r.PingSignalContext=function(){this.sWupServant="launch",this.sFuncName="pingSignal",this.mTracePoint=new s.Map(new s.STRING,new s.INT64)},r.PingSignalContext.prototype._clone=function(){return new r.PingSignalContext},r.PingSignalContext.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.PingSignalContext.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.PingSignalContext.prototype.writeTo=function(t){t.writeString(0,this.sWupServant),t.writeString(1,this.sFuncName),t.writeMap(2,this.mTracePoint)},r.PingSignalContext.prototype.readFrom=function(t){this.sWupServant=t.readString(0,!1,this.sWupServant),this.sFuncName=t.readString(1,!1,this.sFuncName),this.mTracePoint=t.readMap(2,!1,this.mTracePoint)},r.GetVodAntiCodeReq=function(){this.iAppId=0,this.sUrl="",this.iValidTime=0,this.lClientUid=0,this.sClientUa="",this.sStreamId=""},r.GetVodAntiCodeReq.prototype._clone=function(){return new r.GetVodAntiCodeReq},r.GetVodAntiCodeReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetVodAntiCodeReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetVodAntiCodeReq.prototype.writeTo=function(t){t.writeInt32(0,this.iAppId),t.writeString(1,this.sUrl),t.writeInt32(2,this.iValidTime),t.writeInt64(3,this.lClientUid),t.writeString(4,this.sClientUa),t.writeString(5,this.sStreamId)},r.GetVodAntiCodeReq.prototype.readFrom=function(t){this.iAppId=t.readInt32(0,!1,this.iAppId),this.sUrl=t.readString(1,!1,this.sUrl),this.iValidTime=t.readInt32(2,!1,this.iValidTime),this.lClientUid=t.readInt64(3,!1,this.lClientUid),this.sClientUa=t.readString(4,!1,this.sClientUa),this.sStreamId=t.readString(5,!1,this.sStreamId)},r.GetVodAntiCodeRsp=function(){this.sAntiCode="",this.iExpireTime=0,this.sStreamId=""},r.GetVodAntiCodeRsp.prototype._clone=function(){return new r.GetVodAntiCodeRsp},r.GetVodAntiCodeRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetVodAntiCodeRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetVodAntiCodeRsp.prototype.writeTo=function(t){t.writeString(0,this.sAntiCode),t.writeInt32(1,this.iExpireTime),t.writeString(2,this.sStreamId)},r.GetVodAntiCodeRsp.prototype.readFrom=function(t){this.sAntiCode=t.readString(0,!1,this.sAntiCode),this.iExpireTime=t.readInt32(1,!1,this.iExpireTime),this.sStreamId=t.readString(2,!1,this.sStreamId)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=p(i(20)),r=p(i(0)),a=p(i(1)),n=p(i(22)),o=p(i(24)),u=p(i(95)),l=p(i(4)),d=p(i(33)),c=p(i(16)),f=p(i(53));function p(t){return t&&t.__esModule?t:{default:t}}var m=function(t){function e(){(0,r.default)(this,e);var t=(0,n.default)(this,(e.__proto__||(0,s.default)(e)).call(this));return t.printProtocol=!!Number(f.default._printProtocol),t}return(0,o.default)(e,t),(0,a.default)(e,[{key:"onData",value:function(t,e){var i=this.unmarshall(t,e);this.trigger(t,i)}},{key:"unmarshall",value:function(t,e){var i=new d.default(e),s=l.default[t],r=i,a=null;try{a=this.getClass(s)}catch(e){c.default.logger.warn("%c[x] Unmatched protocol "+(t>>8)+" "+s,"color:red;background:#FFF0F0")}return a&&(void 0===(r=new a).unmarshall?c.default.logger.error("[x]"+s+".unmarshall undefined!"):r.unmarshall(i)),this.printProtocol&&!_[s]&&c.default.logger.debug("%c<<<<< "+s,"font-weight:900;color:#0000E3",r),r}},{key:"getClass",value:function(t){return null}}]),e}(u.default),_={PCdnProxyPing:1,PCdnProxyPingRes:1,PP2pSliceAudioData:1,PP2pSliceVideoData:1,PP2pSliceControlData:1,PCdnP2pGetNode:1,PCdnP2pGetNodeRes:1,P2POffer:1,P2PAnswer:1,P2PCandidate:1,P2POfferReject:1,P2PRequestOffer:1,PCdnP2PWSForward:1,PCdnP2PWSForwardReject:1,PCdnP2pReportLog:1,PCDNSubscribeReq:1,PCDNSubscribeRes:1,PCDNCompeteSubscribeReq:1,PCDNCompeteSubscribeRes:1,P2PPunchBackReq:1,P2PPunchBackRsp:1,HuyaDelaySeiData:1};e.default=m},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(0)),r=a(i(1));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.uid=0,this.encoderSource=0,this.uploadType=0,this.frameDts=0,this.caputureTime=0,this.encodeEndTime=0,this.sendFrameTime=0}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.uid=t.popUInt64(),this.encoderSource=t.popUInt8(),this.uploadType=t.popUInt8(),this.frameDts=t.popUInt64(),this.caputureTime=t.popUInt64(),this.encodeEndTime=t.popUInt64(),this.sendFrameTime=t.popUInt64()}}]),t}()}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(0)),r=n(i(1)),a=n(i(62));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.dtsGapSum=0,this.delaySum=0,this.serverInfos=[]}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.dtsGapSum=t.popInt64(),this.delaySum=t.popUInt64();for(var e=t.popUInt32();e>0;){e--;var i=new a.default;i.unmarshall(t),this.serverInfos.push(i)}}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(0)),r=a(i(1));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.enable=0,this.proxyIdLow=0,this.proxyIdHigh=0,this.proxyType=0,this.serverDelay=0,this.lastPeriodDelay=0}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.enable=t.popUInt8(),this.proxyIdLow=t.popUInt32(),this.proxyIdHigh=t.popUInt32(),this.proxyType=t.popUInt16(),this.serverDelay=t.popUInt32(),this.lastPeriodDelay=t.popUInt32()}},{key:"getProxyIdStr",value:function(){return this.proxyIdHigh.toString(16)+this.proxyIdLow.toString(16)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={},r={setTaf:function(t){return s=t}};e.default=r,r.UserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sHuYaUA="",this.sCookie="",this.iTokenType=0,this.sDeviceInfo=""},r.UserId.prototype._clone=function(){return new r.UserId},r.UserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.UserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.UserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sHuYaUA),t.writeString(4,this.sCookie),t.writeInt32(5,this.iTokenType),t.writeString(6,this.sDeviceInfo)},r.UserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sHuYaUA=t.readString(3,!1,this.sHuYaUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iTokenType=t.readInt32(5,!1,this.iTokenType),this.sDeviceInfo=t.readString(6,!1,this.sDeviceInfo)},r.GetInfoFromVGReq=function(){this.lUid=0,this.iServiceType=0,this.iClientType=0,this.iClientIp=0,this.iTerminalType=0,this.iRequestVPType=0,this.sMsg=new s.BinBuffer,this.iUri=0,this.sProtoName="",this.lSid=0,this.vStreamName=new s.Vector(new s.STRING),this.tId=new r.UserId},r.GetInfoFromVGReq.prototype._clone=function(){return new r.GetInfoFromVGReq},r.GetInfoFromVGReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetInfoFromVGReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetInfoFromVGReq.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeInt32(1,this.iServiceType),t.writeInt32(2,this.iClientType),t.writeInt64(3,this.iClientIp),t.writeInt32(4,this.iTerminalType),t.writeInt32(5,this.iRequestVPType),t.writeBytes(6,this.sMsg),t.writeInt64(7,this.iUri),t.writeString(8,this.sProtoName),t.writeInt64(9,this.lSid),t.writeVector(10,this.vStreamName),t.writeStruct(11,this.tId)},r.GetInfoFromVGReq.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.iServiceType=t.readInt32(1,!1,this.iServiceType),this.iClientType=t.readInt32(2,!1,this.iClientType),this.iClientIp=t.readInt64(3,!1,this.iClientIp),this.iTerminalType=t.readInt32(4,!1,this.iTerminalType),this.iRequestVPType=t.readInt32(5,!1,this.iRequestVPType),this.sMsg=t.readBytes(6,!1,this.sMsg),this.iUri=t.readInt64(7,!1,this.iUri),this.sProtoName=t.readString(8,!1,this.sProtoName),this.lSid=t.readInt64(9,!1,this.lSid),this.vStreamName=t.readVector(10,!1,this.vStreamName),this.tId=t.readStruct(11,!1,this.tId)},r.GetInfoFromVGRsp=function(){this.lUid=0,this.ServerId=0,this.sMsg=new s.BinBuffer,this.iUri=0,this.sProtoName=""},r.GetInfoFromVGRsp.prototype._clone=function(){return new r.GetInfoFromVGRsp},r.GetInfoFromVGRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetInfoFromVGRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetInfoFromVGRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeInt64(1,this.ServerId),t.writeBytes(2,this.sMsg),t.writeInt64(3,this.iUri),t.writeString(4,this.sProtoName)},r.GetInfoFromVGRsp.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.ServerId=t.readInt64(1,!1,this.ServerId),this.sMsg=t.readBytes(2,!1,this.sMsg),this.iUri=t.readInt64(3,!1,this.iUri),this.sProtoName=t.readString(4,!1,this.sProtoName)},r.GetCdnTokenExReq=function(){this.sFlvUrl="",this.sStreamName="",this.iLoopTime=0,this.tId=new r.UserId,this.iAppId=66},r.GetCdnTokenExReq.prototype._clone=function(){return new r.GetCdnTokenExReq}
1,r.GetCdnTokenExReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetCdnTokenExReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetCdnTokenExReq.prototype.writeTo=function(t){t.writeString(0,this.sFlvUrl),t.writeString(1,this.sStreamName),t.writeInt32(2,this.iLoopTime),t.writeStruct(3,this.tId),t.writeInt32(4,this.iAppId)},r.GetCdnTokenExReq.prototype.readFrom=function(t){this.sFlvUrl=t.readString(0,!1,this.sFlvUrl),this.sStreamName=t.readString(1,!1,this.sStreamName),this.iLoopTime=t.readInt32(2,!1,this.iLoopTime),this.tId=t.readStruct(3,!1,this.tId),this.iAppId=t.readInt32(4,!1,this.iAppId)},r.GetCdnTokenExRsp=function(){this.sFlvToken="",this.iExpireTime=0},r.GetCdnTokenExRsp.prototype._clone=function(){return new r.GetCdnTokenExRsp},r.GetCdnTokenExRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetCdnTokenExRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetCdnTokenExRsp.prototype.writeTo=function(t){t.writeString(0,this.sFlvToken),t.writeInt32(1,this.iExpireTime)},r.GetCdnTokenExRsp.prototype.readFrom=function(t){this.sFlvToken=t.readString(0,!1,this.sFlvToken),this.iExpireTime=t.readInt32(1,!1,this.iExpireTime)},r.WSTimeSyncReq=function(){this.sGuid="",this.lClientTime=0},r.WSTimeSyncReq.prototype._clone=function(){return new r.WSTimeSyncReq},r.WSTimeSyncReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.WSTimeSyncReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.WSTimeSyncReq.prototype.writeTo=function(t){t.writeString(0,this.sGuid),t.writeInt64(1,this.lClientTime)},r.WSTimeSyncReq.prototype.readFrom=function(t){this.sGuid=t.readString(0,!1,this.sGuid),this.lClientTime=t.readInt64(1,!1,this.l
1ClientTime)},r.WSTimeSyncRsp=function(){this.lServerTime=0},r.WSTimeSyncRsp.prototype._clone=function(){return new r.WSTimeSyncRsp},r.WSTimeSyncRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.WSTimeSyncRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.WSTimeSyncRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lServerTime)},r.WSTimeSyncRsp.prototype.readFrom=function(t){this.lServerTime=t.readInt64(0,!1,this.lServerTime)},r.MediaUserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sUA="",this.sCookie="",this.iTokenType=0,this.iAppid=0,this.bAnonymous=0,this.sStrUid=""},r.MediaUserId.prototype._clone=function(){return new r.MediaUserId},r.MediaUserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.MediaUserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.MediaUserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sUA),t.writeString(4,this.sCookie),t.writeInt32(5,this.iTokenType),t.writeInt32(6,this.iAppid),t.writeInt32(7,this.bAnonymous),t.writeString(8,this.sStrUid)},r.MediaUserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sUA=t.readString(3,!1,this.sUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iTokenType=t.readInt32(5,!1,this.iTokenType),this.iAppid=t.readInt32(6,!1,this.iAppid),this.bAnonymous=t.readInt32(7,!1,this.bAnonymous),this.sStrUid=t.readString(8,!1,this.sStrUid)},r.RecSysInfo=function(){this.sAnchorUid="",this.sRoomId="",this.sDispatchId="",this.iScene=0,this.sStrategy="",this.lServerTs=0,this.lAction=0,this.sActionReason="",this.sActValue=""},r.RecSysInfo.prototype._clone=function(){return new r.RecSysInfo},r.RecSysInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysInfo.prototype.writeTo=function(t){t.writeString(0,this.sAnchorUid),t.writeString(1,this.sRoomId),t.writeString(2,this.sDispatchId),t.writeInt32(3,this.iScene),t.writeString(4,this.sStrategy),t.writeInt64(5,this.lServerTs),t.writeInt64(6,this.lAction),t.writeString(7,this.sActionReason),t.writeString(8,this.sActValue)},r.RecSysInfo.prototype.readFrom=function(t){this.sAnchorUid=t.readString(0,!1,this.sAnchorUid),this.sRoomId=t.readString(1,!1,this.sRoomId),this.sDispatchId=t.readString(2,!1,this.sDispatchId),this.iScene=t.readInt32(3,!1,this.iScene),this.sStrategy=t.readString(4,!1,this.sStrategy),this.lServerTs=t.readInt64(5,!1,this.lServerTs),this.lAction=t.readInt64(6,!1,this.lAction),this.sActionReason=t.readString(7,!1,this.sActionReason),this.sActValue=t.readString(8,!1,this.sActValue)},r.RecSysReq=function(){this.tId=new r.MediaUserId,this.sAnchorUid="",this.sRoomId="",this.sDispatchId="",this.iScene=0,this.bDebug=0,this.sNet="",this.sSdkVer="",this.mAppendInfo=new s.Map(new s.STRING,new s.STRING)},r.RecSysReq.prototype._clone=function(){return new r.RecSysReq},r.RecSysReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sAnchorUid),t.writeString(2,this.sRoomId),t.writeString(3,this.sDispatchId),t.writeInt32(4,this.iScene),t.writeInt32(5,this.bDebug),t.writeString(6,this.sNet),t.writeString(7,this.sSdkVer),t.writeMap(8,this.mAppendInfo)},r.RecSysReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.sAnchorUid=t.readString(1,!1,this.sAnchorUid),this.sRoomId=t.readString(2,!1,this.sRoomId),this.sDispatchId=t.readString(3,!1,this.sDispatchId),this.iScene=t.readInt32(4,!1,this.iScene),this.bDebug=t.readInt32(5,!1,this.bDebug),this.sNet=t.readString(6,!1,this.sNet),this.sSdkVer=t.readString(7,!1,this.sSdkVer),this.mAppendInfo=t.readMap(8,!1,this.mAppendInfo)},r.RecSysRsp=function(){this.iStatus=0,this.sError="",this.tRecSysInfo=new r.RecSysInfo},r.RecSysRsp.prototype._clone=function(){return new r.RecSysRsp}
1,r.RecSysRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iStatus),t.writeString(1,this.sError),t.writeStruct(2,this.tRecSysInfo)},r.RecSysRsp.prototype.readFrom=function(t){this.iStatus=t.readInt32(0,!1,this.iStatus),this.sError=t.readString(1,!1,this.sError),this.tRecSysInfo=t.readStruct(2,!1,this.tRecSysInfo)},r.RecSysNotice=function(){this.tRecSysInfo=new r.RecSysInfo},r.RecSysNotice.prototype._clone=function(){return new r.RecSysNotice},r.RecSysNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.RecSysNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.RecSysNotice.prototype.writeTo=function(t){t.writeStruct(0,this.tRecSysInfo)},r.RecSysNotice.prototype.readFrom=function(t){this.tRecSysInfo=t.readStruct(0,!1,this.tRecSysInfo)},r.GetAntiCodeForStreamReq=function(){this.tId=new r.MediaUserId,this.sStreamName=""},r.GetAntiCodeForStreamReq.prototype._clone=function(){return new r.GetAntiCodeForStreamReq},r.GetAntiCodeForStreamReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetAntiCodeForStreamReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetAntiCodeForStreamReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeString(1,this.sStreamName)},r.GetAntiCodeForStreamReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.sStreamName=t.readString(1,!1,this.sStreamName)},r.GetAntiCodeForStreamRsp=function(){this.sAntiCode="",this.sStreamName=""},r.GetAntiCodeForStreamRsp.prototype._clone=function(){return new r.GetAntiCodeForStreamRsp},r.GetAntiCodeForStreamRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetAntiCodeForStreamRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetAntiCodeForStreamRsp.prototype.writeTo=function(t){t.writeString(0,this.sAntiCode),t.writeString(1,this.sStreamName)},r.GetAntiCodeForStreamRsp.prototype.readFrom=function(t){this.sAntiCode=t.readString(0,!1,this.sAntiCode),this.sStreamName=t.readString(1,!1,this.sStreamName)},r.GetVodAntiCodeReq=function(){this.iAppId=0,this.sUrl="",this.iValidTime=0,this.lClientUid=0,this.sClientUa="",this.sStreamId=""},r.GetVodAntiCodeReq.prototype._clone=function(){return new r.GetVodAntiCodeReq},r.GetVodAntiCodeReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetVodAntiCodeReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetVodAntiCodeReq.prototype.writeTo=function(t){t.writeInt32(0,this.iAppId),t.writeString(1,this.sUrl),t.writeInt32(2,this.iValidTime),t.writeInt64(3,this.lClientUid),t.writeString(4,this.sClientUa),t.writeString(5,this.sStreamId)},r.GetVodAntiCodeReq.prototype.readFrom=function(t){this.iAppId=t.readInt32(0,!1,this.iAppId),this.sUrl=t.readString(1,!1,this.sUrl),this.iValidTime=t.readInt32(2,!1,this.iValidTime),this.lClientUid=t.readInt64(3,!1,this.lClientUid),this.sClientUa=t.readString(4,!1,this.sClientUa),this.sStreamId=t.readString(5,!1,this.sStreamId)},r.GetVodAntiCodeRsp=function(){this.sAntiCode="",this.iExpireTime=0,this.sStreamId=""},r.GetVodAntiCodeRsp.prototype._clone=function(){return new r.GetVodAntiCodeRsp},r.GetVodAntiCodeRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},r.GetVodAntiCodeRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},r.GetVodAntiCodeRsp.prototype.writeTo=function(t){t.writeString(0,this.sAntiCode),t.writeInt32(1,this.iExpireTime),t.writeString(2,this.sStreamId)},r.GetVodAntiCodeRsp.prototype.readFrom=function(t){this.sAntiCode=t.readString(0,!1,this.sAntiCode),this.iExpireTime=t.readInt32(1,!1,this.iExpireTime),this.sStreamId=t.readString(2,!1,this.sStreamId)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s={};e.default=s,s.INT8=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt8(e,i)},this._read=function(t,e,i){return t.readInt8(e,!0,i)},this._className=function(){return s.CHAR}},s.INT16=function(){this._clone=function(){return 0}
1,this._write=function(t,e,i){return t.writeInt16(e,i)},this._read=function(t,e,i){return t.readInt16(e,!0,i)},this._className=function(){return s.SHORT}},s.INT32=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt32(e,i)},this._read=function(t,e,i){return t.readInt32(e,!0,i)},this._className=function(){return s.INT32}},s.INT64=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt64(e,i)},this._read=function(t,e,i){return t.readInt64(e,!0,i)},this._className=function(){return s.INT64}},s.UINT8=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt16(e,i)},this._read=function(t,e,i){return t.readInt16(e,!0,i)},this._className=function(){return s.SHORT}},s.UInt16=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt32(e,i)},this._read=function(t,e,i){return t.readInt32(e,!0,i)},this._className=function(){return s.INT32}},s.UInt32=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt64(e,i)},this._read=function(t,e,i){return t.readInt64(e,!0,i)},this._className=function(){return s.INT64}},s.Float=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeFloat(e,i)},this._read=function(t,e,i){return t.readFloat(e,!0,i)},this._className=function(){return s.FLOAT}},s.Double=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeDouble(e,i)},this._read=function(t,e,i){return t.readDouble(e,!0,i)},this._className=function(){return s.DOUBLE}},s.STRING=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeString(e,i)},this._read=function(t,e,i){return t.readString(e,!0,i)},this._className=function(){return s.STRING}},s.BOOLEAN=function(){this._clone=function(){return!1},this._write=function(t,e,i){return t.writeBoolean(e,i)},this._read=function(t,e,i){return t.readBoolean(e,!0,i)},this._className=function(){return s.BOOLEAN}},s.ENUM=function(){this._clone=function(){return 0},this._write=function(t,e,i){return t.writeInt32(e,i)},this._read=function(t,e,i){return t.readInt32(e,!0,i)}},s.Vector=function(t){this.proto=t,this.value=[]},s.Vector.prototype._clone=function(){return new s.Vector(this.proto)},s.Vector.prototype._write=function(t,e,i){return t.writeVector(e,i)},s.Vector.prototype._read=function(t,e,i){return t.readVector(e,!0,i)},s.Vector.prototype._className=function(){return s.TypeHelp.VECTOR.replace("$t",this.proto._className())},s.Map=function(t,e){this.kproto=t,this.vproto=e,this.value={}},s.Map.prototype._clone=function(){return new s.Map(this.kproto,this.vproto)},s.Map.prototype._write=function(t,e,i){return t.writeMap(e,i)},s.Map.prototype._read=function(t,e,i){return t.readMap(e,!0,i)},s.Map.prototype.put=function(t,e){this.value[t]=e},s.Map.prototype.get=function(t){return this.value[t]},s.Map.prototype.getKeys=function(){var t=[];for(var e in this.value)""!=e&&t.push(e);return t},s.Map.prototype.hasKey=function(t){return this.value.hasOwnProperty(t)},s.Map.prototype.remove=function(t){delete this.value[t]},s.Map.prototype.clear=function(){this.value={}},s.Map.prototype.size=function(){var t=0;for(var e in this.value)t++;return t},s.Vector.prototype._className=function(){return s.TypeHelp.Map.replace("$k",this.kproto._className()).replace("$v",this.vproto._className())},s.DataHelp={EN_INT8:0,EN_INT16:1,EN_INT32:2,EN_INT64:3,EN_FLOAT:4,EN_DOUBLE:5,EN_STRING1:6,EN_STRING4:7,EN_MAP:8,EN_LIST:9,EN_STRUCTBEGIN:10,EN_STRUCTEND:11,EN_ZERO:12,EN_SIMPLELIST:13},s.TypeHelp={BOOLEAN:"bool",CHAR:"char",SHORT:"short",INT32:"int32",INT64:"int64",FLOAT:"float",DOUBLE:"double",STRING:"string",VECTOR:"list<$t>",MAP:"map<$k, $v>"},s.BinBuffer=function(t){this.buf=null,this.vew=null,this.len=0,this.position=0,null!=t&&null!=t&&(t instanceof ArrayBuffer?(this.buf=t,this.vew=new DataView(this.buf),this.len=this.vew.byteLength,this.position=0):(this.buf=t.buf,this.vew=new DataView(this.buf),this.len=t.length,this.position=t.position)),this.__defineGetter__("length",function(){return this.len}),this.__defineGetter__("buffer",function(){return this.buf})}
1,s.BinBuffer.prototype._write=function(t,e,i){return t.writeBytes(e,i)},s.BinBuffer.prototype._read=function(t,e,i){return t.readBytes(e,!0,i)},s.BinBuffer.prototype._clone=function(){return new s.BinBuffer},s.BinBuffer.prototype.allocate=function(t){if(t=this.position+t,!(null!=this.buf&&this.buf.length>t)){var e=new ArrayBuffer(Math.max(256,2*t));null!=this.buf&&(new Uint8Array(e).set(new Uint8Array(this.buf)),this.buf=void 0),this.buf=e,this.vew=void 0,this.vew=new DataView(this.buf)}},s.BinBuffer.prototype.getBuffer=function(){var t=new ArrayBuffer(this.len);return new Uint8Array(t).set(new Uint8Array(this.buf,0,this.len)),t},s.BinBuffer.prototype.memset=function(t,e,i){this.allocate(i),new Uint8Array(this.buf).set(new Uint8Array(t,e,i),this.position)},s.BinBuffer.prototype.writeInt8=function(t){this.allocate(1),this.vew.setInt8(this.position,t),this.position+=1,this.len=this.position},s.BinBuffer.prototype.writeUInt8=function(t){this.allocate(1),this.vew.setUint8(this.position++,t),this.len=this.position},s.BinBuffer.prototype.writeInt16=function(t){this.allocate(2),this.vew.setInt16(this.position,t),this.position+=2,this.len=this.position},s.BinBuffer.prototype.writeUInt16=function(t){this.allocate(2),this.vew.setUint16(this.position,t),this.position+=2,this.len=this.position},s.BinBuffer.prototype.writeInt32=function(t){this.allocate(4),this.vew.setInt32(this.position,t),this.position+=4,this.len=this.position},s.BinBuffer.prototype.writeUInt32=function(t){this.allocate(4),this.vew.setUint32(this.position,t),this.position+=4,this.len=this.position},s.BinBuffer.prototype.writeInt64=function(t){this.allocate(8),this.vew.setUint32(this.position,parseInt(t/0x100000000)),this.vew.setUint32(this.position+4,t%0x100000000),this.position+=8,this.len=this.position},s.BinBuffer.prototype.writeFloat=function(t){this.allocate(4),this.vew.setFloat32(this.position,t),this.position+=4,this.len=this.position},s.BinBuffer.prototype.writeDouble=function(t){this.allocate(8),this.vew.setFloat64(this.position,t),this.position+=8,this.len=this.position},s.BinBuffer.prototype.writeString=function(t){for(var e=[],i=0;i<t.length;i++)e.push(255&t.charCodeAt(i));this.allocate(e.length),new Uint8Array(this.buf).set(new Uint8Array(e),this.position),this.position+=e.length,this.len=this.position},s.BinBuffer.prototype.writeBytes=function(t){0!=t.length&&null!=t.buf&&(this.allocate(t.length),new Uint8Array(this.buf).set(new Uint8Array(t.buf,0,t.length),this.position),this.position+=t.length,this.len=this.position)},s.BinBuffer.prototype.readInt8=function(){return this.vew.getInt8(this.position++)},s.BinBuffer.prototype.readInt16=function(){return this.position+=2,this.vew.getInt16(this.position-2)},s.BinBuffer.prototype.readInt32=function(){return this.position+=4,this.vew.getInt32(this.position-4)},s.BinBuffer.prototype.readUInt8=function(){return this.position+=1,this.vew.getUint8(this.position-1)},s.BinBuffer.prototype.readUInt16=function(){return this.position+=2,this.vew.getUint16(this.position-2)},s.BinBuffer.prototype.readUInt32=function(){return this.position+=4,this.vew.getUint32(this.position-4)},s.BinBuffer.prototype.readInt64=function(){var t=this.vew.getUint32(this.position),e=this.vew.getUint32(this.position+4);return this.position+=8,0x100000000*t+e},s.BinBuffer.prototype.readFloat=function(){var t=this.vew.getFloat32(this.position);return this.position+=4,t},s.BinBuffer.prototype.readDouble=function(){var t=this.vew.getFloat64(this.position);return this.position+=8,t},s.BinBuffer.prototype.readString=function(t){for(var e=[],i=0;i<t;i++)e.push(String.fromCharCode(this.vew.getUint8(this.position++)));var s=e.join("");try{s=decodeURIComponent(escape(s))}catch(t){}return s},s.BinBuffer.prototype.readBytes=function(t){var e=new s.BinBuffer;return e.allocate(t),e.memset(this.buf,this.position,t),e.position=0,e.len=t,this.position=this.position+t,e},s.JceOutputStream=function(){this.buf=new s.BinBuffer,this.getBinBuffer=function(){return this.buf},this.getBuffer=function(){return this.buf.getBuffer()}},s.JceOutputStream.prototype.clear=function(){return this.buf=new s.BinBuffer,this},s.JceOutputStream.prototype.writeTo=function(t,e){t<15?this.buf.writeUInt8(t<<4&240|e):this.buf.writeUInt16((240|e)<<8|t)},s.JceOutputStream.prototype.writeBoolean=function(t,e){this.writeInt8(t,+(1==e))},s.JceOutputStream.prototype.writeInt8=function(t,e){0==e?this.writeTo(t,s.DataHelp.EN_ZERO):(this.writeTo(t,s.DataHelp.EN_INT8),this.buf.writeInt8(e))},s.JceOutputStream.prototype.writeInt16=function(t,e){e>=-128&&e<=127?this.writeInt8(t,e):(this.writeTo(t,s.DataHelp.EN_INT16),this.buf.writeInt16(e))},s.JceOutputStream.prototype.writeInt32=function(t,e){e>=-32768&&e<=32767?this.writeInt16(t,e):(this.writeTo(t,s.DataHelp.EN_INT32),this.buf.writeInt32(e))},s.JceOutputStream.prototype.writeInt64=function(t,e){e>=-0x80000000&&e<=0x7fffffff?this.writeInt32(t,e):(this.writeTo(t,s.DataHelp.EN_INT64),this.buf.writeInt64(e))},s.JceOutputStream.prototype.writeUInt8=function(t,e){this.writeInt16(t,e)},s.JceOutputStream.prototype.writeUInt16=function(t,e){this.writeInt32(t,e)},s.JceOutputStream.prototype.writeUInt32=function(t,e){this.writeInt64(t,e)},s.JceOutputStream.prototype.writeFloat=function(t,e){0==e?this.writeTo(t,s.DataHelp.EN_ZERO):(this.writeTo(t,s.DataHelp.EN_FLOAT),this.buf.writeFloat(e))},s.JceOutputStream.prototype.writeDouble=function(t,e){0==e?this.writeTo(t,s.DataHelp.EN_ZERO):(this.writeTo(t,s.DataHelp.EN_DOUBLE),this.buf.writeDouble(e))},s.JceOutputStream.prototype.writeStruct=function(t,e){if(null==e.writeTo)throw Error("not defined writeTo Function");this.writeTo(t,s.DataHelp.EN_STRUCTBEGIN),e.writeTo(this),this.writeTo(0,s.DataHelp.EN_STRUCTEND)},s.JceOutputStream.prototype.writeString=function(t,e){var i=e;try{i=unescape(encodeURIComponent(i))}catch(t){}i.length>255?(this.writeTo(t,s.DataHelp.EN_STRING4),this.buf.writeUInt32(i.length)):(this.writeTo(t,s.DataHelp.EN_STRING1),this.buf.writeUInt8(i.length)),this.buf.writeString(i)},s.JceOutputStream.prototype.writeBytes=function(t,e){this.writeTo(t,s.DataHelp.EN_SIMPLELIST),this.writeTo(0,s.DataHelp.EN_INT8),this.writeInt32(0,e.length),this.buf.writeBytes(e)},s.JceOutputStream.prototype.writeVector=function(t,e){this.writeTo(t,s.DataHelp.EN_LIST),this.writeInt32(0,e.value.length);for(var i=0;i<e.value.length;i++)e.proto._write(this,0,e.value[i])},s.JceOutputStream.prototype.writeMap=function(t,e){for(var i in this.writeTo(t,s.DataHelp.EN_MAP),this.writeInt32(0,e.size()),e.value)e.kproto._write(this,0,i),e.vproto._write(this,1,e.value[i])},s.JceInputStream=function(t){this.buf=new s.BinBuffer(t)},s.JceInputStream.prototype.setBuffer=function(t){return this.buf=new s.BinBuffer(t),this},s.JceInputStream.prototype.readFrom=function(){var t=this.buf.readUInt8(),e=(240&t)>>4;return e>=15&&(e=this.buf.readUInt8()),{tag:e,type:15&t}},s.JceInputStream.prototype.peekFrom=function(){var t=this.buf.position,e=this.readFrom();return this.buf.position=t,{tag:e.tag,type:e.type,size:e.tag>=15?2:1}},s.JceInputStream.prototype.skipField=function(t){switch(t){case s.DataHelp.EN_INT8:this.buf.position+=1;break;case s.DataHelp.EN_INT16:this.buf.position+=2;break;case s.DataHelp.EN_INT32:this.buf.position+=4;break;case s.DataHelp.EN_INT64:this.buf.position+=8;break;case s.DataHelp.EN_STRING1:var e=this.buf.readUInt8();this.buf.position+=e;break;case s.DataHelp.EN_STRING4:var i=this.buf.readInt32();this.buf.position+=i;break;case s.DataHelp.EN_STRUCTBEGIN:this.skipToStructEnd();break;case s.DataHelp.EN_STRUCTEND:case s.DataHelp.EN_ZERO:break;case s.DataHelp.EN_MAP:for(var r=this.readInt32(0,!0),a=0;a<2*r;++a){var n=this.readFrom();this.skipField(n.type)}break;
1case s.DataHelp.EN_SIMPLELIST:if((n=this.readFrom()).type!=s.DataHelp.EN_INT8)throw Error("skipField with invalid type, type value: "+t+","+n.type);e=this.readInt32(0,!0),this.buf.position+=e;break;case s.DataHelp.EN_LIST:for(r=this.readInt32(0,!0),a=0;a<r;++a)n=this.readFrom(),this.skipField(n.type);break;default:throw Error("skipField with invalid type, type value: "+t)}},s.JceInputStream.prototype.skipToStructEnd=function(){for(;;){var t=this.readFrom();if(this.skipField(t.type),t.type==s.DataHelp.EN_STRUCTEND)return}},s.JceInputStream.prototype.skipToTag=function(t,e){for(;this.buf.position<this.buf.length;){var i=this.peekFrom();if(t<=i.tag||i.type==s.DataHelp.EN_STRUCTEND)return i.type!=s.DataHelp.EN_STRUCTEND&&t==i.tag;this.buf.position+=i.size,this.skipField(i.type)}if(e)throw Error("require field not exist, tag:"+t);return!1},s.JceInputStream.prototype.readBoolean=function(t,e,i){return 1==this.readInt8(t,e,i)},s.JceInputStream.prototype.readInt8=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();switch(r.type){case s.DataHelp.EN_ZERO:return 0;case s.DataHelp.EN_INT8:return this.buf.readInt8()}throw Error("read int8 type mismatch, tag:"+t+", get type:"+r.type)},s.JceInputStream.prototype.readInt16=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();switch(r.type){case s.DataHelp.EN_ZERO:return 0;case s.DataHelp.EN_INT8:return this.buf.readInt8();case s.DataHelp.EN_INT16:return this.buf.readInt16()}throw Error("read int8 type mismatch, tag:"+t+", get type:"+r.type)},s.JceInputStream.prototype.readInt32=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();switch(r.type){case s.DataHelp.EN_ZERO:return 0;case s.DataHelp.EN_INT8:return this.buf.readInt8();case s.DataHelp.EN_INT16:return this.buf.readInt16();case s.DataHelp.EN_INT32:return this.buf.readInt32()}throw Error("read int8 type mismatch, tag:"+t+", get type:"+r.type)},s.JceInputStream.prototype.readInt64=function(t,e,i){if(0==this.skipToTag(t,e))return i;switch(this.readFrom().type){case s.DataHelp.EN_ZERO:return 0;case s.DataHelp.EN_INT8:return this.buf.readInt8();case s.DataHelp.EN_INT16:return this.buf.readInt16();case s.DataHelp.EN_INT32:return this.buf.readInt32();case s.DataHelp.EN_INT64:return this.buf.readInt64()}throw Error("read int64 type mismatch, tag:"+t+", get type:"+h.type)},s.JceInputStream.prototype.readFloat=function(t,e,i){if(0==this.skipToTag(t,e))return i;switch(this.readFrom().type){case s.DataHelp.EN_ZERO:return 0;case s.DataHelp.EN_FLOAT:return this.buf.readFloat()}throw Error("read float type mismatch, tag:"+t+", get type:"+h.type)},s.JceInputStream.prototype.readDouble=function(t,e,i){if(0==this.skipToTag(t,e))return i;switch(this.readFrom().type){case s.DataHelp.EN_ZERO:return 0;case s.DataHelp.EN_DOUBLE:return this.buf.readDouble()}throw Error("read double type mismatch, tag:"+t+", get type:"+h.type)},s.JceInputStream.prototype.readUInt8=function(t,e,i){return this.readInt16(t,e,i)},s.JceInputStream.prototype.readUInt16=function(t,e,i){return this.readInt32(t,e,i)},s.JceInputStream.prototype.readUInt32=function(t,e,i){return this.readInt64(t,e,i)},s.JceInputStream.prototype.readStruct=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();if(r.type!=s.DataHelp.EN_STRUCTBEGIN)throw Error("read struct type mismatch, tag: "+t+", get type:"+r.type);return i.readFrom(this),this.skipToStructEnd(),i},s.JceInputStream.prototype.readString=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();if(r.type==s.DataHelp.EN_STRING1)return this.buf.readString(this.buf.readUInt8());if(r.type==s.DataHelp.EN_STRING4)return this.buf.readString(this.buf.readUInt32());throw Error("read 'string' type mismatch, tag: "+t+", get type: "+r.type+".")},s.JceInputStream.prototype.readString2=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();if(r.type==s.DataHelp.EN_STRING1)return this.buf.readBytes(this.buf.readUInt8());if(r.type==s.DataHelp.EN_STRING4)return this.buf.readBytes(this.buf.readUInt32());throw Error("read 'string' type mismatch, tag: "+t+", get type: "+r.type+".")}
1,s.JceInputStream.prototype.readBytes=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();if(r.type==s.DataHelp.EN_SIMPLELIST){var a=this.readFrom();if(a.type!=s.DataHelp.EN_INT8)throw Error("type mismatch, tag:"+t+",type:"+r.type+","+a.type);if((n=this.readInt32(0,!0))<0)throw Error("invalid size, tag:"+t+",type:"+r.type+","+a.type);return this.buf.readBytes(n)}if(r.type==s.DataHelp.EN_LIST){var n=this.readInt32(0,!0);return this.buf.readBytes(n)}throw Error("type mismatch, tag:"+t+",type:"+r.type)},s.JceInputStream.prototype.readVector=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();if(r.type!=s.DataHelp.EN_LIST)throw Error("read 'vector' type mismatch, tag: "+t+", get type: "+r.type);var a=this.readInt32(0,!0);if(a<0)throw Error("invalid size, tag: "+t+", type: "+r.type+", size: "+a);for(var n=0;n<a;++n)i.value.push(i.proto._read(this,0,i.proto._clone()));return i},s.JceInputStream.prototype.readMap=function(t,e,i){if(0==this.skipToTag(t,e))return i;var r=this.readFrom();if(r.type!=s.DataHelp.EN_MAP)throw Error("read 'map' type mismatch, tag: "+t+", get type: "+r.type);var a=this.readInt32(0,!0);if(a<0)throw Error("invalid map, tag: "+t+", size: "+a);for(var n=0;n<a;n++){var o=i.kproto._read(this,0,i.kproto._clone()),u=i.vproto._read(this,1,i.vproto._clone());i.put(o,u)}return i},s.Wup=function(){this.iVersion=3,this.cPacketType=0,this.iMessageType=0,this.iRequestId=0,this.sServantName="",this.sFuncName="",this.sBuffer=new s.BinBuffer,this.iTimeout=0,this.context=new s.Map(new s.STRING,new s.STRING),this.status=new s.Map(new s.STRING,new s.STRING),this.data=new s.Map(new s.STRING,new s.Map(new s.STRING,new s.BinBuffer)),this.newdata=new s.Map(new s.STRING,new s.BinBuffer),this.iStream=new s.JceInputStream,this.oStream=new s.JceOutputStream},s.Wup.prototype.hasKey=function(t){return this.newdata.hasKey(t)},s.Wup.prototype.setVersion=function(t){this.iVersion=t},s.Wup.prototype.getVersion=function(t){return this.iVersion},s.Wup.prototype.setServant=function(t){this.sServantName=t},s.Wup.prototype.setFunc=function(t){this.sFuncName=t},s.Wup.prototype.setRequestId=function(t){this.iRequestId=t||++this.iRequestId},s.Wup.prototype.getRequestId=function(){return this.iRequestId},s.Wup.prototype.setTimeOut=function(t){this.iTimeout=t},s.Wup.prototype.getTimeOut=function(){return this.iTimeout},s.Wup.prototype.writeTo=function(){var t=this.oStream.clear();return t.writeInt16(1,this.iVersion),t.writeInt8(2,this.cPacketType),t.writeInt32(3,this.iMessageType),t.writeInt32(4,this.iRequestId),t.writeString(5,this.sServantName),t.writeString(6,this.sFuncName),t.writeBytes(7,this.sBuffer),t.writeInt32(8,this.iTimeout),t.writeMap(9,this.context),t.writeMap(10,this.status),new s.BinBuffer(t.getBuffer())},s.Wup.prototype.encode=function(){var t=this.oStream.clear();3==this.iVersion?t.writeMap(0,this.newdata):t.writeMap(0,this.data),this.sBuffer=t.getBinBuffer();var e=this.writeTo(),i=new s.BinBuffer;return i.writeInt32(4+e.len),i.writeBytes(e),i},s.Wup.prototype.writeBoolean=function(t,e){var i=this.oStream.clear();if(i.writeBoolean(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.BOOLEAN;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new s.BinBuffer(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeInt8=function(t,e){var i=this.oStream.clear();if(i.writeInt8(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.CHAR;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new s.BinBuffer(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeInt16=function(t,e){var i=this.oStream.clear();if(i.writeInt16(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.SHORT;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeInt32=function(t,e){var i=this.oStream.clear();if(i.writeInt32(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.INT32;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeInt64=function(t,e){var i=this.oStream.clear();if(i.writeInt64(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.INT64;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeFloat=function(t,e){var i=this.oStream.clear();if(i.writeFloat(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.FLOAT;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeDouble=function(t,e){var i=this.oStream.clear();if(i.writeDouble(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=TAF.TypeHelp.DOUBLE;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeString=function(t,e){var i=this.oStream.clear();if(i.writeString(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=s.TypeHelp.STRING;null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeVector=function(t,e){var i=this.oStream.clear();if(i.writeVector(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBinBuffer()));else{var r=this.data.get(t),a=e._className();null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeStruct=function(t,e){var i=this.oStream.clear();if(i.writeStruct(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t);null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(" ",new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeBytes=function(t,e){var i=this.oStream.clear();if(i.writeBytes(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t);null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put("vec",new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.writeMap=function(t,e){var i=this.oStream.clear();if(i.writeMap(0,e),3==this.iVersion)this.newdata.put(t,new s.BinBuffer(i.getBuffer()));else{var r=this.data.get(t),a=s.Util.getClassType(e);null==r&&(r=new s.Map(s.STRING,s.STRING)),r.put(a,new Uint8Array(i.getBuffer())),this.data.put(t,r)}},s.Wup.prototype.readFrom=function(t){this.iVersion=t.readInt16(1,!0),this.cPacketType=t.readInt8(2,!0),this.iMessageType=t.readInt32(3,!0),this.iRequestId=t.readInt32(4,!0),this.sServantName=t.readString(5,!0),this.sFuncName=t.readString(6,
1!0),this.sBuffer=t.readBytes(7,!0),this.iTimeout=t.readInt32(8,!0),this.context=t.readMap(9,!0,this.context),this.status=t.readMap(10,!0,this.status)},s.Wup.prototype.decode=function(t){var e=this.iStream.setBuffer(t);if(e.buf.vew.getInt32(e.buf.position)<4)throw Error("packet length too short");e.buf.position+=4,this.readFrom(e),e=this.iStream.setBuffer(this.sBuffer.getBuffer()),3==this.iVersion?(this.newdata.clear(),e.readMap(0,!0,this.newdata)):(this.data.clear(),e.readMap(0,!0,this.data))},s.Wup.prototype.readBoolean=function(t){var e,i;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);i=this.iStream.setBuffer(e.buffer).readBoolean(0,!0,i)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.BOOLEAN,a=e.get(r);if(null==a)throw Error("UniAttribute not found type:"+r);i=this.iStream.setBuffer(a).readBoolean(0,!0,i)}return i},s.Wup.prototype.readInt8=function(t){var e,i;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);i=this.iStream.setBuffer(e.buffer).readInt8(0,!0,i)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.CHAR,a=e.get(r);if(null==a)throw Error("UniAttribute not found type:"+r);i=this.iStream.setBuffer(a).readInt8(0,!0,i)}return i},s.Wup.prototype.readInt16=function(t){var e,i;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);i=(n=this.iStream.setBuffer(e.buffer)).readInt16(0,!0,i)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.SHORT,a=e.get(r),n=this.iStream.setBuffer(a);if(null==a)throw Error("UniAttribute not found type:"+r);i=n.readInt16(0,!0,i)}return i},s.Wup.prototype.readInt32=function(t){var e,i;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);i=this.iStream.setBuffer(e.buffer).readInt32(0,!0,i)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.INT32,a=e.get(r);if(null==a)throw Error("UniAttribute not found type:"+r);i=this.iStream.setBuffer(a).readInt32(0,!0,i)}return i},s.Wup.prototype.readInt64=function(t){var e,i;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);i=this.iStream.setBuffer(e.buffer).readInt64(0,!0,i)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.INT64,a=e.get(r);if(null==a)throw Error("UniAttribute not found type:"+r);i=this.iStream.setBuffer(a).readInt64(0,!0,i)}return i},s.Wup.prototype.readFloat=function(t){var e,i;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);i=this.iStream.setBuffer(e.buffer).readFloat(0,!0,i)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.FLOAT,a=e.get(r);if(null==a)throw Error("UniAttribute not found type:"+r);i=this.iStream.setBuffer(a).readFloat(0,!0,i)}return i},s.Wup.prototype.readDouble=function(t){var e;if(3==this.iVersion){if(null==(e=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);var i=this.iStream.setBuffer(e.buffer);def=i.readDouble(0,!0,def)}else{if(null==(e=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.TypeHelp.DOUBLE,a=e.get(r);if(null==a)throw Error("UniAttribute not found type:"+r);def=(i=this.iStream.setBuffer(a)).readDouble(0,!0,def)}return def},s.Wup.prototype.readVector=function(t,e,i){var s;if(3==this.iVersion){if(null==(s=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);e=this.iStream.setBuffer(s.buffer).readVector(0,!0,e)}else{if(null==(s=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.get(i);if(null==r)throw Error("UniAttribute not found type:"+i);e=this.iStream.setBuffer(r).readVector(0,!0,e)}return e},s.Wup.prototype.readStruct=function(t,e,i){var s;if(3==this.iVersion){if(null==(s=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);
1e=this.iStream.setBuffer(s.buffer).readStruct(0,!0,e)}else{if(null==(s=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.get(i);if(null==r)throw Error("UniAttribute not found type:"+i);e=this.iStream.setBuffer(r).readStruct(0,!0,e)}return e},s.Wup.prototype.readMap=function(t,e,i){var s;if(3==this.iVersion){if(null==(s=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);e=this.iStream.setBuffer(s.buffer).readMap(0,!0,e)}else{if(null==(s=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.get(i);if(null==r)throw Error("UniAttribute not found type:"+i);e=this.iStream.setBuffer(r).readMap(0,!0,e)}return e},s.Wup.prototype.readBytes=function(t,e,i){var s;if(3==this.iVersion){if(null==(s=this.newdata.get(t)))throw Error("UniAttribute not found key:"+t);e=this.iStream.setBuffer(s.buffer).readBytes(0,!0,e)}else{if(null==(s=this.data.get(t)))throw Error("UniAttribute not found key:"+t);var r=s.get(i);if(null==r)throw Error("UniAttribute not found type:"+i);e=this.iStream.setBuffer(r).readBytes(0,!0,e)}return e},s.Util=s.Util||{}
1,s.Util.jcestream=function(t,e){if(null!=t&&null!=t)if(t instanceof ArrayBuffer){e=e||16;for(var i=new Uint8Array(t),s="",r=0;r<i.length;r++)0!=r&&r%e==0?s+="\n":0!=r&&(s+=" "),s+=(i[r]>15?"":"0")+i[r].toString(16);console.log(s.toUpperCase())}else console.log("Taf.Util.jcestream::value is not ArrayBuffer");else console.log("Taf.Util.jcestream::value is null or undefined")},s.Util.str2ab=function(t){var e,i=t.length,s=Array(i);for(e=0;e<i;++e)s[e]=t.charCodeAt(e);return new Uint8Array(s).buffer},s.Util.ajax=function(t,e,i,r){var a=new XMLHttpRequest;a.overrideMimeType("text/plain; charset=x-user-defined"),a.addEventListener("readystatechange",function t(){4===a.readyState&&(200===a.status||304===a.status?i(s.Util.str2ab(a.response)):r(a.status),a.removeEventListener("readystatechange",t),a=void 0)}),a.open("post",t),a.send(e)}},function(t,e,i){var s=i(14),r=i(21),a=i(38)("IE_PROTO"),n=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return s(t=r(t),a)?t[a]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?n:null}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){t.exports=!i(6)&&!i(15)(function(){return 7!=Object.defineProperty(i(68)("div"),"a",{get:function(){return 7}}).a})},function(t,e,i){var s=i(11),r=i(8).document,a=s(r)&&s(r.createElement);t.exports=function(t){return a?r.createElement(t):{}}},function(t,e,i){"use strict";e.__esModule=!0;var s=n(i(108)),r=n(i(118)),a="function"==typeof r.default&&"symbol"==typeof s.default?function(t){return typeof t}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":typeof t};function n(t){return t&&t.__esModule?t:{default:t}}e.default="function"==typeof r.default&&"symbol"===a(s.default)?function(t){return void 0===t?"undefined":a(t)}:function(t){return t&&"function"==typeof r.default&&t.constructor===r.default&&t!==r.default.prototype?"symbol":void 0===t?"undefined":a(t)}},function(t,e,i){t.exports=i(12)},function(t,e,i){var s=i(14),r=i(18),a=i(113)(!1),n=i(38)("IE_PROTO");t.exports=function(t,e){var i,o=r(t),u=0,l=[];for(i in o)i!=n&&s(o,i)&&l.push(i);for(;e.length>u;)s(o,i=e[u++])&&(~a(l,i)||l.push(i));return l}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,i){var s=i(45);t.exports=Array.isArray||function(t){return"Array"==s(t)}},function(t,e,i){var s=i(71),r=i(47).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return s(t,r)}},function(t,e,i){var s=i(32),r=i(28),a=i(18),n=i(40),o=i(14),u=i(67),l=Object.getOwnPropertyDescriptor;e.f=i(6)?l:function(t,e){if(t=a(t),e=n(e,!0),u)try{return l(t,e)}catch(t){}if(o(t,e))return r(!s.f.call(t,e),t[e])}},function(t,e){},function(t,e,i){"use strict";var s,r="object"==typeof Reflect?Reflect:null,a=r&&"function"==typeof r.apply?r.apply:function(t,e,i){return Function.prototype.apply.call(t,e,i)};s=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function o(){o.init.call(this)}t.exports=o,t.exports.once=function(t,e){return new Promise(function(i,s){function r(i){t.removeListener(e,a),s(i)}function a(){"function"==typeof t.removeListener&&t.removeListener("error",r),i([].slice.call(arguments))}v(t,e,a,{once:!0}),"error"!==e&&"function"==typeof t.on&&v(t,"error",r,{once:!0})})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var u=10;function l(t){if("function"!=typeof t)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function d(t){return void 0===t._maxListeners?o.defaultMaxListeners:t._maxListeners}function c(t,e,i,s){var r,a,n;if(l(i),void 0===(a=t._events)?(a=t._events=Object.create(null),t._eventsCount=0):(void 0!==a.newListener&&(t.emit("newListener",e,i.listener?i.listener:i),a=t._events),n=a[e]),void 0===n)n=a[e]=i,++t._eventsCount;else if("function"==typeof n?n=a[e]=s?[i,n]:[n,i]:s?n.unshift(i):n.push(i),(r=d(t))>0&&n.length>r&&!n.warned){n.warned=!0;var o=Error("Possible EventEmitter memory leak detected. "+n.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=t,o.type=e,o.count=n.length,console&&console.warn&&console.warn(o)}return t}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}
vendor: 4,118 bytes, line 1
1function p(t,e,i){var s={fired:!1,wrapFn:void 0,target:t,type:e,listener:i},r=f.bind(s);return r.listener=i,s.wrapFn=r,r}function m(t,e,i){var s=t._events;if(void 0===s)return[];var r=s[e];return void 0===r?[]:"function"==typeof r?i?[r.listener||r]:[r]:i?function(t){for(var e=Array(t.length),i=0;i<e.length;++i)e[i]=t[i].listener||t[i];return e}(r):y(r,r.length)}function _(t){var e=this._events;if(void 0!==e){var i=e[t];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function y(t,e){for(var i=Array(e),s=0;s<e;++s)i[s]=t[s];return i}function v(t,e,i,s){if("function"==typeof t.on)s.once?t.once(e,i):t.on(e,i);else{if("function"!=typeof t.addEventListener)throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,function r(a){s.once&&t.removeEventListener(e,r),i(a)})}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(t){if("number"!=typeof t||t<0||n(t))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");u=t}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||n(t))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},o.prototype.getMaxListeners=function(){return d(this)},o.prototype.emit=function(t){for(var e=[],i=1;i<arguments.length;i++)e.push(arguments[i]);var s="error"===t,r=this._events;if(void 0!==r)s=s&&void 0===r.error;else if(!s)return!1;if(s){if(e.length>0&&(n=e[0]),n instanceof Error)throw n;var n,o=Error("Unhandled error."+(n?" ("+n.message+")":""));throw o.context=n,o}var u=r[t];if(void 0===u)return!1;if("function"==typeof u)a(u,this,e);else{var l=u.length,d=y(u,l);for(i=0;i<l;++i)a(d[i],this,e)}return!0},o.prototype.addListener=function(t,e){return c(this,t,e,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(t,e){return c(this,t,e,!0)},o.prototype.once=function(t,e){return l(e),this.on(t,p(this,t,e)),this},o.prototype.prependOnceListener=function(t,e){return l(e),this.prependListener(t,p(this,t,e)),this},o.prototype.removeListener=function(t,e){var i,s,r,a,n;if(l(e),void 0===(s=this._events)||void 0===(i=s[t]))return this;if(i===e||i.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit("removeListener",t,i.listener||e));else if("function"!=typeof i){for(r=-1,a=i.length-1;a>=0;a--)if(i[a]===e||i[a].listener===e){n=i[a].listener,r=a;break}if(r<0)return this;0===r?i.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(i,r),1===i.length&&(s[t]=i[0]),void 0!==s.removeListener&&this.emit("removeListener",t,n||e)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(t){var e,i,s;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[t]),this;if(0===arguments.length){var r,a=Object.keys(i);for(s=0;s<a.length;++s)"removeListener"!==(r=a[s])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=i[t]))this.removeListener(t,e);else if(void 0!==e)for(s=e.length-1;s>=0;s--)this.removeListener(t,e[s]);return this},o.prototype.listeners=function(t){return m(this,t,!0)},o.prototype.rawListeners=function(t){return m(this,t,!1)},o.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},o.prototype.listenerCount=_,o.prototype.eventNames=function(){return this._eventsCount>0?s(this._events):[]}},function(t,e,i){var s=i(12);t.exports=function(t,e,i){for(var r in e)i&&t[r]?t[r]=e[r]:s(t,r,e[r]);return t}}
1,function(t,e){t.exports=function(t,e,i,s){if(!(t instanceof e)||void 0!==s&&s in t)throw TypeError(i+": incorrect invocation!");return t}},function(t,e,i){var s=i(81),r=i(7)("iterator"),a=i(23);t.exports=i(3).getIteratorMethod=function(t){if(null!=t)return t[r]||t["@@iterator"]||a[s(t)]}},function(t,e,i){var s=i(45),r=i(7)("toStringTag"),a="Arguments"==s(function(){return arguments}());t.exports=function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),r))?i:a?s(e):"Object"==(n=s(e))&&"function"==typeof e.callee?"Arguments":n}},function(t,e,i){var s=i(11);t.exports=function(t,e){if(!s(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},function(t,e,i){var s={"./CdnAllocateInfo":54,"./CdnAllocateInfo.js":54,"./CdnGroupID":19,"./CdnGroupID.js":19,"./CurrentCdnProxyInfo":56,"./CurrentCdnProxyInfo.js":56,"./PCDNGetProxyListReq":84,"./PCDNGetProxyListReq.js":84,"./PCDNGetProxyListRsp":85,"./PCDNGetProxyListRsp.js":85,"./PP2pSliceAudioData":86,"./PP2pSliceAudioData.js":86,"./PP2pSliceAudioDataV2":87,"./PP2pSliceAudioDataV2.js":87,"./PP2pSliceAudioDataV3":88,"./PP2pSliceAudioDataV3.js":88,"./PP2pSliceControlData":89,"./PP2pSliceControlData.js":89,"./PP2pSliceData":57,"./PP2pSliceData.js":57,"./PP2pSliceVideoData":90,"./PP2pSliceVideoData.js":90,"./SlaveProxyInfo":35,"./SlaveProxyInfo.js":35,"./StreamCodecType":55,"./StreamCodecType.js":55};function r(t){return i(a(t))}function a(t){if(!i.o(s,t)){var e=Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return s[t]}r.keys=function(){return Object.keys(s)},r.resolve=a,t.exports=r,r.id=83},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=d(i(149)),r=d(i(10)),a=d(i(0)),n=d(i(1)),o=d(i(4)),u=d(i(2)),l=(d(i(19)),d(i(56)));function d(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,a.default)(this,t),this.uid=0,this.version=0,this.cdnGroupIdList=[],this.currentInfo=new l.default,this.appid=0,this.clientAppid=0,this.clientType=0,this.ip=0,this.sendTime=0,this.sdkVersion=0,this.imsi=0,this.appId=0,this.anchorStreamNam2UId=new r.default}return(0,n.default)(t,[{key:"marshall",value:function(){var t=new u.default;t.setUri(o.default.PCDNGetProxyListReq),t.pushUInt64(this.uid),t.pushUInt8(this.version),t.pushUInt32(this.cdnGroupIdList.length),this.cdnGroupIdList.forEach(function(e){t.pushUint8ArrayWithoutLen(e.marshall())}),t.pushUint8ArrayWithoutLen(this.currentInfo.marshall()),t.pushUInt8(this.appid),t.pushUInt32(this.clientAppid),t.pushUInt32(this.clientType),t.pu
1shUInt32(this.ip),t.pushUInt32(this.sendTime),t.pushUInt32(this.sdkVersion),t.pushUInt64(this.imsi),t.pushUInt32(this.appId),t.pushUInt32(this.anchorStreamNam2UId.size);var e=!0,i=!1,r=void 0;try{for(var a,n=(0,s.default)(this.anchorStreamNam2UId.keys());!(e=(a=n.next()).done);e=!0){var l=a.value;t.pushString(l),t.pushUInt64(this.anchorStreamNam2UId.get(l))}}catch(t){i=!0,r=t}finally{try{!e&&n.return&&n.return()}finally{if(i)throw r}}return t.marshall()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(0)),r=n(i(1)),a=(n(i(4)),n(i(54)));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.uid=0,this.allocatedStreams=[],this.clientAppid=0,this.clientType=0,this.sendTime=0,this.userArea=0,this.videoGroupId=0,this.retryType=0,this.retryFreq=0,this.result=0,this.proxyType=0,this.tokenVersion=0,this.sslUrl="",this.appId=0}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.uid=t.popUInt64(),this.allocatedStream
1s=[];for(var e=t.popUInt32(),i=0;i<e;i++){var s=new a.default;this.allocatedStreams.push(s.unmarshall(t))}return this.clientAppid=t.popUInt32(),this.clientType=t.popUInt32(),this.sendTime=t.popUInt32(),this.userArea=t.popUInt32(),this.videoGroupId=t.popUInt32(),this.retryType=t.popUInt8(),this.retryFreq=t.popUInt16(),this.result=t.popUInt32(),this.proxyType=t.popUInt32(),this.tokenVersion=t.popUInt32(),this.sslUrl=t.popString(),this.appId=t.popUInt32(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(4)),n=o(i(2));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.seq=0,this.checkSum=0,this.codecType=0,this.streamData=null}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new n.default;return t.setUri(a.default.PP2pSliceAudioData),t.pushUInt8(this.checkSum),t.pushUInt16(this.codecType),t.pushUint8Array(this.streamData),t.marshall()}},{key:"unmarshall",value:function(t){return this.checkSum=t.popUInt8(),this.codecType=t.popUInt16(),this.streamData=t.popUint8Array(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(2)),n=o(i(4));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.checkSum=0,this.codecType=0,this.seqNum=0,this.frameNum=0,this.frameId=0,this.audioHeader=null,this.streamData=null}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new a.default;t.setUri(n.default.PP2pSliceAudioDataV2),t.pushUInt8(this.checkSum),t.pushUInt16(this.codecType),t.pushUInt16(this.seqNum),t.pushUInt16(this.frameNum),t.pushUInt32(this.frameId),t.pushUint8Array(this.audioHeader),t.pushUint8Array(this.streamData)}},{key:"unmarshall",value:function(t){this.checkSum=t.popUInt8(),this.codecType=t.popUInt16(),this.seqNum=t.popUInt16(),this.frameNum=t.popUInt16(),this.frameId=t.popUInt32(),this.audioHeader=t.popUint8Array(),this.streamData=t.popUint8Array()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(2)),n=o(i(4));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.checkSum=0,this.codecType=0,this.seqNum=0,this.frameNum=0,this.frameId=0,this.audioHeader=null,this.streamData=null}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new a.default;return t.setUri(n.default.PP2pSliceAudioDataV3),t.pushUInt8(this.checkSum),t.pushUInt16(this.codecType),t.pushUInt16(this.seqNum),t.pushUInt16(this.frameNum),t.pushUInt32(this.frameId),t.pushUint8Array(this.audioHeader),t.pushUint8Array(this.streamData),t.marshall()}},{key:"unmarshall",value:function(t){this.checkSum=t.popUInt8(),this.codecType=t.popUInt16(),this.seqNum=t.popUInt16(),this.frameNum=t.popUInt16(),this.frameId=t.popUInt32(),this.audioHeader=t.popUint8Array(),this.streamData=t.popUint8Array()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(4)),n=o(i(2));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.seq=0,this.strData=null}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new n.default;return t.setUri(a.default.PP2pSliceControlData),t.pushUint8Array(this.strData),t.marshall()}},{key:"unmarshall",value:function(t){return this.strData=t.popUint8Array(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(10)),r=u(i(0)),a=u(i(1)),n=u(i(4)),o=u(i(2));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.seq=0,this.uid=0,this.isResend=!1,this.checkSum=0,this.seqNum=0,this.frameNum=0,this.frameId=0,this.config=new s.default,this.streamData=null}return(0,a.default)(t,[{key:"marshall",value:function(){var t=new o.default;return t.setUri(n.default.PP2pSliceVideoData),t.pushUInt8(this.checkSum),t.pushUInt16(this.seqNum),t.pushUInt16(this.frameNum),t.pushUInt32(this.frameId),t.pushUInt32(this.config.size),this.config.forEach(function(e,i){t.pushUInt8(i),t.pushUInt32(e)}),t.pushUint8Array(this.streamData),t.marshall()}},{key:"unmarshall",value:function(t){this.checkSum=t.popUInt8(),this.seqNum=t.popUInt16(),this.frameNum=t.popUInt16(),this.frameId=t.popUInt32(),this.config.clear();for(var e=t.popUInt32(),i=0;i<e;i++){var s=t.popUInt8(),r=t.popUInt32();this.config.set(s,r)}return this.streamData=t.popUint8Array(),this}}]),t}()}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(2)),n=o(i(158));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.sid=0,this.fuzzyParam=new n.default}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new a.default(!1);return t.pushUInt64(this.sid),t.pushUint8ArrayWithoutLen(this.fuzzyParam.marshall()),t.marshall()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(0)),r=u(i(1)),a=u(i(161)),n=u(i(162)),o=u(i(2));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.appid=0,this.streamType=0,this.codecType=0,this.sid=0,this.startTs=0,this.serverGenSeq=0}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new o.default(!1);return t.pushUInt8(this.appid),t.pushUInt8(this.streamType),t.pushUInt16(this.codecType),t.pushUInt64(this.sid),t.pushUInt32(this.startTs),t.pushUInt16(this.serverGenSeq),t.marshall()}},{key:"unmarshall",value:function(t){return this.appid=t.popUInt8(),this.streamType=t.popUInt8(),this.codecType=t.popUInt16(),this.sid=t.popUInt64(),this.startTs=t.popUInt32(),this.serverGenSeq=t.popUInt16(),this}},{key:"text",value:function(){return this.appid+"-"+this.streamType+"-"+this.codecType+"-"+this.sid+"-"+this.startTs+"-"+this.serverGenSeq}},{key:"equal",value:function(t){return null!==t&&this.appid===t.appid&&this.streamType===t.streamType&&this.codecType===t.codecType&&this.sid===t.sid&&this.startTs===t.startTs&&this.serverGenSeq===t.serverGenSeq}},{key:"isValidID",get:function(){return this.appid>0}},{key:"isTransStream",get:function(){return 1==(1&this.streamType)}},{key:"isAudioStream",get:function(){return this.streamType>=a.default.STRAEM_TYPE_AUDIO_START}},{key:"isVideoStream",get:function(){return this.streamType<a.default.STRAEM_TYPE_AUDIO_START}},{key:"isH264VideoStream",get:function(){return this.isVideoStream&&this.codecType>=n.default.VIDEO_264_START&&this.codecType<=n.default.VIDEO_H264_END}},{key:"isH265VideoStream",get:function(){return this.isVideoStream&&this.codecType>=n.default.VIDEO_265_START&&this.codecType<=n.default.VIDEO_H265_END}},{key:"videoTypeId",get:function(){return this.appid<<24|this.streamType<<16|this.codecType}},{key:"hashKey",get:function(){return 0x100000000*this.sid+(this.codecType<<16|this.appid<<8|this.streamType)}},{key:"streamId",get:function(){return 0x1000000000000*this.streamType+0x100000000*this.codecType+this.startTs}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(10)),r=o(i(0)),a=o(i(1)),n=o(i(2));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.ip=0,this.tcpPorts=[],this.udpPorts=[],this.videoProxyInfo=new s.default}return(0,a.default)(t,[{key:"marshall",value:function(){var t=new n.default(!1);return"number"==typeof this.ip?t.pushUInt32(this.ip):t.pushUInt32(this.ip2uint(this.ip)),t.pushUInt16Vector(this.tcpPorts),t.pushUInt16Vector(this.udpPorts),t.pushUInt32(this.videoProxyInfo.size),this.videoProxyInfo.forEach(function(e,i){t.pushUInt8(i),t.pushUInt32(e)}),t.marshall()}},{key:"unmarshall",value:function(t){this.ip=this.uint2ip(t.popUInt32()),this.tcpPorts=t.popUInt16Vector(),this.udpPorts=t.popUInt16Vector(),this.videoProxyInfo.clear();for(var e=t.popUInt32(),i=0;i<e;i++){var s=t.popUInt8(),r=t.popUInt32();this.videoProxyInfo.set(s,r)}return this}},{key:"ip2uint",value:function(t){for(var e=0,i=t.split("."),s=0;s<i.length;s++)e|=Number(i[s])<<8*s;return e<0&&(e+=0x100000000),e}},{key:"uint2ip",value:function(t){return(255&t)+"."+(t>>8&255)+"."+(t>>16&255)+"."+(t>>24&255)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={getCookie:function(t){for(var e=t+"=",i=document.cookie.split(";"),s=0,r=i.length;s<r;s++){var a=i[s].trim();if(0==a.indexOf(e))return a.substr(e.length)}return""}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(0)),r=a(i(1));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.listeners={}}return(0,r.default)(t,[{key:"clear",value:function(){this.listeners={}}}
1,{key:"has",value:function(t,e,i){var s=this.listeners[t];if(!s)return!1;for(var r=0,a=s.length;r<a;r++){var n=s[r];if(n.callback==e&&n.thisObj==i)return!0}return!1}},{key:"on",value:function(t,e,i,s){if(!this.has(t,e,i)){var r=this.listeners[t]||[];r.push({priority:s||0,callback:e,thisObj:i,bindCallback:i?e.bind(i):e}),r.sort(function(t,e){return e.priority-t.priority}),this.listeners[t]=r}}},{key:"off",value:function(t,e,i){var s=this.listeners[t];if(s)for(var r=s.length-1;r>=0;r--){var a=s[r];if(a.callback==e&&a.thisObj==i)return void s.splice(r,1)}}},{key:"trigger",value:function(t,e){var i=this.listeners[t];if(i)for(var s=i.length-1;s>=0;s--)(0,i[s].bindCallback)(e)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(0)),r=a(i(1));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.systime=0,this.encode_delay=0,this.send_buffer=0}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.systime=t.popUInt64(),this.encode_delay=t.popUInt32(),this.send_buffer=t.popUInt32()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(60)),n=o(i(61));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.anchorSei=new a.default,this.serverSei=new n.default}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.anchorSei.unmarshall(t),this.serverSei.unmarshall(t)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=I(i(36)),r=I(i(99)),a=I(i(100)),n=I(i(152)),o=I(i(4)),u=I(i(2)),l=I(i(33)),d=I(i(154)),c=I(i(155)),f=I(i(19)),p=I(i(57)),m=I(i(64)),_=I(i(165)),y=I(i(95)),v=I(i(25)),S=I(i(166)),g=I(i(59)),T=I(i(167)),P=I(i(169)),C=I(i(16)),E=I(i(174));function I(t){return t&&t.__esModule?t:{default:t}}e.default={setLogger:function(t){C.default.logger=t},TafBase:m.default,HUYA:s.default,HUYA_Local:r.default,ProtoUri:o.default,ProtoMarshall:u.default,ProtoUnmarshall:l.default,TafLinkImpl:a.default,NtpImpl:n.default,SignalRttImpl:d.default,TafLinkSignalImpl:c.default,MediaLink:_.default,ListenerImpl:y.default,TimeUtilImpl:v.default,BrowserImpl:P.default,CdnGroupID:f.default,PP2pSliceData:p.default,PcdnVodProxy:E.default,ProtoHandler:g.default,SliceProtoHandler:S.default,SeiProtoHandler:T.default}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s,r=(s=i(64))&&s.__esModule?s:{default:s},a={};e.default=a,a.EWebSocketCommandType={EWSCmd_NULL:0,EWSCmd_RegisterReq:1,EWSCmd_RegisterRsp:2,EWSCmd_WupReq:3,EWSCmd_WupRsp:4,EWSCmdC2S_HeartBeat:5,EWSCmdS2C_HeartBeatAck:6,EWSCmdS2C_MsgPushReq:7,EWSCmdC2S_DeregisterReq:8,EWSCmdS2C_DeRegisterRsp:9,EWSCmdC2S_VerifyCookieReq:10,EWSCmdS2C_VerifyCookieRsp:11,EWSCmdC2S_VerifyHuyaTokenReq:12,EWSCmdS2C_VerifyHuyaTokenRsp:13,EWSCmdC2S_UNVerifyReq:14,EWSCmdS2C_UNVerifyRsp:15,EWSCmdC2S_RegisterGroupReq:16,EWSCmdS2C_RegisterGroupRsp:17,EWSCmdC2S_UnRegisterGroupReq:18,EWSCmdS2C_UnRegisterGroupRsp:19,EWSCmdC2S_HeartBeatReq:20,EWSCmdS2C_HeartBeatRsp:21,EWSCmdS2C_MsgPushReq_V2:22},a.WebSocketCommand=function(){this.iCmdType=0,this.vData=new r.default.BinBuffer,this.lRequestId=0,this.traceId=""},a.WebSocketCommand.prototype._clone=function(){return new a.WebSocketCommand},a.WebSocketCommand.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.WebSocketCommand.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.WebSocketCommand.prototype.writeTo=function(t){t.writeInt32(0,this.iCmdType),t.writeBytes(1,this.vData),t.writeInt64(2,this.lRequestId),t.writeString(3,this.traceId)},a.WebSocketCommand.prototype.readFrom=function(t){this.iCmdType=t.readInt32(0,!1,this.iCmdType),this.vData=t.readBytes(1,!1,this.vData),this.lRequestId=t.readInt64(2,!1,this.lRequestId),this.traceId=t.readString(3,!1,this.traceId)},a.WSPushMessage=function(){this.ePushType=0,this.iUri=0,this.sMsg=new r.default.BinBuffer,this.iProtocolType=0,this.sGroupId=""},a.WSPushMessage.prototype._clone=function(){return new a.WSPushMessage}
1,a.WSPushMessage.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.WSPushMessage.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.WSPushMessage.prototype.writeTo=function(t){t.writeInt32(0,this.ePushType),t.writeInt64(1,this.iUri),t.writeBytes(2,this.sMsg),t.writeInt32(3,this.iProtocolType),t.writeString(4,this.sGroupId)},a.WSPushMessage.prototype.readFrom=function(t){this.ePushType=t.readInt32(0,!1,this.ePushType),this.iUri=t.readInt64(1,!1,this.iUri),this.sMsg=t.readBytes(2,!1,this.sMsg),this.iProtocolType=t.readInt32(3,!1,this.iProtocolType),this.sGroupId=t.readString(4,!1,this.sGroupId)},a.WSUserInfo=function(){this.lUid=0,this.bAnonymous=!0,this.sGuid="",this.sToken="",this.lTid=0,this.lSid=0,this.lGroupId=0,this.lGroupType=0,this.sAppId="",this.sUA=""},a.WSUserInfo.prototype._clone=function(){return new a.WSUserInfo},a.WSUserInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.WSUserInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.WSUserInfo.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeBoolean(1,this.bAnonymous),t.writeString(2,this.sGuid),t.writeString(3,this.sToken),t.writeInt64(4,this.lTid),t.writeInt64(5,this.lSid),t.writeInt64(6,this.lGroupId),t.writeInt64(7,this.lGroupType),t.writeString(8,this.sAppId),t.writeString(9,this.sUA)},a.WSUserInfo.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.bAnonymous=t.readBoolean(1,!1,this.bAnonymous),this.sGuid=t.readString(2,!1,this.sGuid),this.sToken=t.readString(3,!1,this.sToken),this.lTid=t.readInt64(4,!1,this.lTid),this.lSid=t.readInt64(5,!1,this.lSid),this.lGroupId=t.readInt64(6,!1,this.lGroupId),this.lGroupType=t.readInt64(7,!1,this.lGroupType),this.sAppId=t.readString(8,!1,this.sAppId),this.sUA=t.readString(9,!1,this.sUA)},a.WSRegisterRsp=function(){this.iResCode=0,this.lRequestId=0,this.sMessage="",this.sBCConnHost=""},a.WSRegisterRsp.prototype._clone=function(){return new a.WSRegisterRsp},a.WSRegisterRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.WSRegisterRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.WSRegisterRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iResCode),t.writeInt64(1,this.lRequestId),t.writeString(2,this.sMessage),t.writeString(3,this.sBCConnHost)},a.WSRegisterRsp.prototype.readFrom=function(t){this.iResCode=t.readInt32(0,!1,this.iResCode),this.lRequestId=t.readInt64(1,!1,this.lRequestId),this.sMessage=t.readString(2,!1,this.sMessage),this.sBCConnHost=t.readString(3,!1,this.sBCConnHost)},a.UserChannelReq=function(){this.tId=new a.UserId,this.lTopcid=0,this.lSubcid=0,this.sSendContent=""},a.UserChannelReq.prototype._clone=function(){return new a.UserChannelReq},a.UserChannelReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.UserChannelReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.UserChannelReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt64(1,this.lTopcid),t.writeInt64(2,this.lSubcid),t.writeString(3,this.sSendContent)},a.UserChannelReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.lTopcid=t.readInt64(1,!1,this.lTopcid),this.lSubcid=t.readInt64(2,!1,this.lSubcid),this.sSendContent=t.readString(3,!1,this.sSendContent)},a.UserId=function(){this.lUid=0,this.sGuid="",this.sToken="",this.sHuYaUA="",this.sCookie="",this.iTokenType=0},a.UserId.prototype._clone=function(){return new a.UserId},a.UserId.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.UserId.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.UserId.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeString(1,this.sGuid),t.writeString(2,this.sToken),t.writeString(3,this.sHuYaUA),t.writeString(4,this.sCookie),t.writeInt32(5,this.iTokenType)},a.UserId.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.sGuid=t.readString(1,!1,this.sGuid),this.sToken=t.readString(2,!1,this.sToken),this.sHuYaUA=t.readString(3,!1,this.sHuYaUA),this.sCookie=t.readString(4,!1,this.sCookie),this.iTokenType=t.readInt32(5,!1,this.iTokenType)},a.LiveLaunchReq=function(){this.tId=new a.UserId,this.tLiveUB=new a.LiveUserbase,this.bSupportDomain=0},a.LiveLaunchReq.prototype._clone=function(){return new a.LiveLaunchReq}
1,a.LiveLaunchReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.LiveLaunchReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.LiveLaunchReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeStruct(1,this.tLiveUB),t.writeInt32(2,this.bSupportDomain)},a.LiveLaunchReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.tLiveUB=t.readStruct(1,!1,this.tLiveUB),this.bSupportDomain=t.readInt32(2,!1,this.bSupportDomain)},a.LiveLaunchRsp=function(){this.sGuid="",this.iTime=0,this.vProxyList=new r.default.Vector(new a.LiveProxyValue),this.eAccess=0,this.sClientIp=""},a.LiveLaunchRsp.prototype._clone=function(){return new a.LiveLaunchRsp},a.LiveLaunchRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.LiveLaunchRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.LiveLaunchRsp.prototype.writeTo=function(t){t.writeString(0,this.sGuid),t.writeInt32(1,this.iTime),t.writeVector(2,this.vProxyList),t.writeInt32(3,this.eAccess),t.writeString(4,this.sClientIp)},a.LiveLaunchRsp.prototype.readFrom=function(t){this.sGuid=t.readString(0,!1,this.sGuid),this.iTime=t.readInt32(1,!1,this.iTime),this.vProxyList=t.readVector(2,!1,this.vProxyList),this.eAccess=t.readInt32(3,!1,this.eAccess),this.sClientIp=t.readString(4,!1,this.sClientIp)},a.LiveUserbase=function(){this.eSource=0,this.eType=0,this.tUAEx=new a.LiveAppUAEx},a.LiveUserbase.prototype._clone=function(){return new a.LiveUserbase},a.LiveUserbase.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.LiveUserbase.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.LiveUserbase.prototype.writeTo=function(t){t.writeInt32(0,this.eSource),t.writeInt32(1,this.eType),t.writeStruct(2,this.tUAEx)},a.LiveUserbase.prototype.readFrom=function(t){this.eSource=t.readInt32(0,!1,this.eSource),this.eType=t.readInt32(1,!1,this.eType),this.tUAEx=t.readStruct(2,!1,this.tUAEx)},a.LiveAppUAEx=function(){this.sIMEI="",this.sAPN="",this.sNetType="",this.sDeviceId=""},a.LiveAppUAEx.prototype._clone=function(){return new a.LiveAppUAEx},a.LiveAppUAEx.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.LiveAppUAEx.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.LiveAppUAEx.prototype.writeTo=function(t){t.writeString(1,this.sIMEI),t.writeString(2,this.sAPN),t.writeString(3,this.sNetType),t.writeString(4,this.sDeviceId)},a.LiveAppUAEx.prototype.readFrom=function(t){this.sIMEI=t.readString(1,!1,this.sIMEI),this.sAPN=t.readString(2,!1,this.sAPN),this.sNetType=t.readString(3,!1,this.sNetType),this.sDeviceId=t.readString(4,!1,this.sDeviceId)},a.LiveProxyValue=function(){this.eProxyType=0,this.sProxy=new r.default.Vector(new r.default.STRING)},a.LiveProxyValue.prototype._clone=function(){return new a.LiveProxyValue},a.LiveProxyValue.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.LiveProxyValue.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.LiveProxyValue.prototype.writeTo=function(t){t.writeInt32(0,this.eProxyType),t.writeVector(1,this.sProxy)},a.LiveProxyValue.prototype.readFrom=function(t){this.eProxyType=t.readInt32(0,!1,this.eProxyType),this.sProxy=t.readVector(1,!1,this.sProxy)},a.GetLivingInfoReq=function(){this.tId=new a.UserId,this.lTopSid=0,this.lSubSid=0,this.lPresenterUid=0,this.sTraceSource="",this.sPassword="",this.iRoomId=0,this.iFreeFlowFlag=0},a.GetLivingInfoReq.prototype._clone=function(){return new a.GetLivingInfoReq},a.GetLivingInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GetLivingInfoReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GetLivingInfoReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt64(1,this.lTopSid),t.writeInt64(2,this.lSubSid),t.writeInt64(3,this.lPresenterUid),t.writeString(4,this.sTraceSource),t.writeString(5,this.sPassword),t.writeInt64(6,this.iRoomId),t.writeInt32(7,this.iFreeFlowFlag)},a.GetLivingInfoReq.prototype.readFrom=function(t){this.tId=t.readStruct(0,!1,this.tId),this.lTopSid=t.readInt64(1,!1,this.lTopSid),this.lSubSid=t.readInt64(2,!1,this.lSubSid),this.lPresenterUid=t.readInt64(3,!1,this.lPresenterUid),this.sTraceSource=t.readString(4,!1,this.sTraceSource),this.sPassword=t.readString(5,!1,this.sPassword),this.iRoomId=t.readInt64(6,!1,this.iRoomId),this.iFreeFlowFlag=t.readInt32(7,!1,this.iFreeFlowFlag)},a.GetLivingInfoRsp=function(){this.bIsLiving=0,this.tNotice=new a.BeginLiveNotice,this.tStreamSettingNotice=new a.StreamSettingNotice,this.bIsSelfLiving=0,this.sMessage=""},a.GetLivingInfoRsp.prototype._clone=function(){return new a.GetLivingInfoRsp}
1,a.GetLivingInfoRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GetLivingInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GetLivingInfoRsp.prototype.writeTo=function(t){t.writeInt32(0,this.bIsLiving),t.writeStruct(1,this.tNotice),t.writeStruct(2,this.tStreamSettingNotice),t.writeInt32(3,this.bIsSelfLiving),t.writeString(4,this.sMessage)},a.GetLivingInfoRsp.prototype.readFrom=function(t){this.bIsLiving=t.readInt32(0,!1,this.bIsLiving),this.tNotice=t.readStruct(1,!1,this.tNotice),this.tStreamSettingNotice=t.readStruct(2,!1,this.tStreamSettingNotice),this.bIsSelfLiving=t.readInt32(3,!1,this.bIsSelfLiving),this.sMessage=t.readString(4,!1,this.sMessage)},a.BeginLiveNotice=function(){this.lPresenterUid=0,this.iGameId=0,this.sGameName="",this.iRandomRange=0,this.iStreamType=0,this.vStreamInfo=new r.default.Vector(new a.StreamInfo),this.vCdnList=new r.default.Vector(new r.default.STRING),this.lLiveId=0,this.iPCDefaultBitRate=0,this.iWebDefaultBitRate=0,this.iMobileDefaultBitRate=0,this.lMultiStreamFlag=0,this.sNick="",this.lYYId=0,this.lAttendeeCount=0,this.iCodecType=0,this.iScreenType=0,this.vMultiStreamInfo=new r.default.Vector(new a.MultiStreamInfo),this.sLiveDesc="",this.lLiveCompatibleFlag=0,this.sAvatarUrl="",this.iSourceType=0,this.sSubchannelName="",this.sVideoCaptureUrl="",this.iStartTime=0,this.lChannelId=0,this.lSubChannelId=0,this.sLocation="",this.iCdnPolicyLevel=0,this.iGameType=0,this.mMiscInfo=new r.default.Map(new r.default.STRING,new r.default.STRING),this.iShortChannel=0,this.iRoomId=0,this.bIsRoomSecret=0,this.iHashPolicy=0},a.BeginLiveNotice.prototype._clone=function(){return new a.BeginLiveNotice},a.BeginLiveNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.BeginLiveNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.BeginLiveNotice.prototype.writeTo=function(t){t.writeInt64(0,this.lPresenterUid),t.writeInt32(1,this.iGameId),t.writeString(2,this.sGameName),t.writeInt32(3,this.iRandomRange),t.writeInt32(4,this.iStreamType),t.writeVector(5,this.vStreamInfo),t.writeVector(6,this.vCdnList),t.writeInt64(7,this.lLiveId),t.writeInt32(8,this.iPCDefaultBitRate),t.writeInt32(9,this.iWebDefaultBitRate),t.writeInt32(10,this.iMobileDefaultBitRate),t.writeInt64(11,this.lMultiStreamFlag),t.writeString(12,this.sNick),t.writeInt64(13,this.lYYId),t.writeInt64(14,this.lAttendeeCount),t.writeInt32(15,this.iCodecType),t.writeInt32(16,this.iScreenType),t.writeVector(17,this.vMultiStreamInfo),t.writeString(18,this.sLiveDesc),t.writeInt64(19,this.lLiveCompatibleFlag),t.writeString(20,this.sAvatarUrl),t.writeInt32(21,this.iSourceType),t.writeString(22,this.sSubchannelName),t.writeString(23,this.sVideoCaptureUrl),t.writeInt32(24,this.iStartTime),t.writeInt64(25,this.lChannelId),t.writeInt64(26,this.lSubChannelId),t.writeString(27,this.sLocation),t.writeInt32(28,this.iCdnPolicyLevel),t.writeInt32(29,this.iGameType),t.writeMap(30,this.mMiscInfo),t.writeInt32(31,this.iShortChannel),t.writeInt32(32,this.iRoomId),t.writeInt32(33,this.bIsRoomSecret),t.writeInt32(34,this.iHashPolicy)},a.BeginLiveNotice.prototype.readFrom=function(t){this.lPresenterUid=t.readInt64(0,!1,this.lPresenterUid),this.iGameId=t.readInt32(1,!1,this.iGameId),this.sGameName=t.readString(2,!1,this.sGameName),this.iRandomRange=t.readInt32(3,!1,this.iRandomRange),this.iStreamType=t.readInt32(4,!1,this.iStreamType),this.vStreamInfo=t.readVector(5,!1,this.vStreamInfo),this.vCdnList=t.readVector(6,!1,this.vCdnList),this.lLiveId=t.readInt64(7,!1,this.lLiveId),this.iPCDefaultBitRate=t.readInt32(8,!1,this.iPCDefaultBitRate),this.iWebDefaultBitRate=t.readInt32(9,!1,this.iWebDefaultBitRate),this.iMobileDefaultBitRate=t.readInt32(10,!1,this.iMobileDefaultBitRate),this.lMultiStreamFlag=t.readInt64(11,!1,this.lMultiStreamFlag),this.sNick=t.readString(12,!1,this.sNick),this.lYYId=t.readInt64(13,!1,this.lYYId),this.lAttendeeCount=t.readInt64(14,!1,this.lAttendeeCount),this.iCodecType=t.readInt32(15,!1,this.iCodecType),this.iScreenType=t.readInt32(16,!1,this.iScreenType),this.vMultiStreamInfo=t.readVector(17,!1,this.vMultiStreamInfo),this.sLiveDesc=t.readString(18,!1,this.sLiveDesc),this.lLiveCompatibleFlag=t.readInt64(19,!1,this.lLiveCompatibleFlag),this.sAvatarUrl=t.readString(20,!1,this.sAvatarUrl),this.iSourceType=t.readInt32(21,!1,this.iSourceType),this.sSubchannelName=t.readString(22,!1,this.sSubchannelName),this.sVideoCaptureUrl=t.readString(23,!1,this.sVideoCaptureUrl),this.iStartTime=t.readInt32(24,!1,this.iStartTime),this.l
1ChannelId=t.readInt64(25,!1,this.lChannelId),this.lSubChannelId=t.readInt64(26,!1,this.lSubChannelId),this.sLocation=t.readString(27,!1,this.sLocation),this.iCdnPolicyLevel=t.readInt32(28,!1,this.iCdnPolicyLevel),this.iGameType=t.readInt32(29,!1,this.iGameType),this.mMiscInfo=t.readMap(30,!1,this.mMiscInfo),this.iShortChannel=t.readInt32(31,!1,this.iShortChannel),this.iRoomId=t.readInt32(32,!1,this.iRoomId),this.bIsRoomSecret=t.readInt32(33,!1,this.bIsRoomSecret),this.iHashPolicy=t.readInt32(34,!1,this.iHashPolicy)},a.StreamSettingNotice=function(){this.lPresenterUid=0,this.iBitRate=0,this.iResolution=0,this.iFrameRate=0,this.lLiveId=0,this.sDisplayName=""},a.StreamSettingNotice.prototype._clone=function(){return new a.StreamSettingNotice},a.StreamSettingNotice.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.StreamSettingNotice.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.StreamSettingNotice.prototype.writeTo=function(t){t.writeInt64(0,this.lPresenterUid),t.writeInt32(1,this.iBitRate),t.writeInt32(2,this.iResolution),t.writeInt32(3,this.iFrameRate),t.writeInt64(4,this.lLiveId),t.writeString(5,this.sDisplayName)},a.StreamSettingNotice.prototype.readFrom=function(t){this.lPresenterUid=t.readInt64(0,!1,this.lPresenterUid),this.iBitRate=t.readInt32(1,!1,this.iBitRate),this.iResolution=t.readInt32(2,!1,this.iResolution),this.iFrameRate=t.readInt32(3,!1,this.iFrameRate),this.lLiveId=t.readInt64(4,!1,this.lLiveId),this.sDisplayName=t.readString(5,!1,this.sDisplayName)},a.StreamInfo=function(){this.sCdnType="",this.iIsMaster=0,this.lChannelId=0,this.lSubChannelId=0,this.lPresenterUid=0,this.sStreamName="",this.sFlvUrl="",this.sFlvUrlSuffix="",this.sFlvAntiCode="",this.sHlsUrl="",this.sHlsUrlSuffix="",this.sHlsAntiCode="",this.iLineIndex=0,this.iIsMultiStream=0,this.iPCPriorityRate=0,this.iWebPriorityRate=0,this.iMobilePriorityRate=0,this.vFlvIPList=new r.default.Vector(new r.default.STRING),this.iIsP2PSupport=0,this.sP2pUrl="",this.sP2pUrlSuffix="",this.sP2pAntiCode="",this.lFreeFlag=0,this.iIsHEVCSupport=0,this.vP2pIPList=new r.default.Vector(new r.default.STRING),this.mpExtArgs=new r.default.Map(new r.default.STRING,new r.default.STRING),this.lTimespan=0},a.StreamInfo.prototype._clone=function(){return new a.StreamInfo},a.StreamInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.StreamInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.StreamInfo.prototype.writeTo=function(t){t.writeString(0,this.sCdnType),t.writeInt32(1,this.iIsMaster),t.writeInt64(2,this.lChannelId),t.writeInt64(3,this.lSubChannelId),t.writeInt64(4,this.lPresenterUid),t.writeString(5,this.sStreamName),t.writeString(6,this.sFlvUrl),t.writeString(7,this.sFlvUrlSuffix),t.writeString(8,this.sFlvAntiCode),t.writeString(9,this.sHlsUrl),t.writeString(10,this.sHlsUrlSuffix),t.writeString(11,this.sHlsAntiCode),t.writeInt32(12,this.iLineIndex),t.writeInt32(13,this.iIsMultiStream),t.writeInt32(14,this.iPCPriorityRate),t.writeInt32(15,this.iWebPriorityRate),t.writeInt32(16,this.iMobilePriorityRate),t.writeVector(17,this.vFlvIPList),t.writeInt32(18,this.iIsP2PSupport),t.writeString(19,this.sP2pUrl),t.writeString(20,this.sP2pUrlSuffix),t.writeString(21,this.sP2pAntiCode),t.writeInt64(22,this.lFreeFlag),t.writeInt32(23,this.iIsHEVCSupport),t.writeVector(24,this.vP2pIPList),t.writeMap(25,this.mpExtArgs),t.writeInt64(26,this.lTimespan)},a.StreamInfo.prototype.readFrom=function(t){this.sCdnType=t.readString(0,!1,this.sCdnType),this.iIsMaster=t.readInt32(1,!1,this.iIsMaster),this.lChannelId=t.readInt64(2,!1,this.lChannelId),this.lSubChannelId=t.readInt64(3,!1,this.lSubChannelId),this.lPresenterUid=t.readInt64(4,!1,this.lPresenterUid),this.sStreamName=t.readString(5,!1,this.sStreamName),this.sFlvUrl=t.readString(6,!1,this.sFlvUrl),this.sFlvUrlSuffix=t.readString(7,!1,this.sFlvUrlSuffix),this.sFlvAntiCode=t.readString(8,!1,this.sFlvAntiCode),this.sHlsUrl=t.readString(9,!1,this.sHlsUrl),this.sHlsUrlSuffix=t.readString(10,!1,this.sHlsUrlSuffix),this.sHlsAntiCode=t.readString(11,!1,this.sHlsAntiCode),this.iLineIndex=t.readInt32(12,!1,this.iLineIndex),this.iIsMultiStream=t.readInt32(13,!1,this.iIsMultiStream),this.iPCPriorityRate=t.readInt32(14,!1,this.iPCPriorityRate),this.iWebPriorityRate=t.readInt32(15,!1,this.iWebPriorityRate),this.iMobilePriorityRate=t.readInt32(16,!1,this.iMobilePriorityRate),this.vFlvIPList=t.readVector(17,!1,this.vFlvIPList),this.iIsP2PSupport=t.readInt32(18,!1,this.iIsP2PSupport),this.sP2pUrl=t.readString(19,!1,this.sP2pUrl),this.sP2pUrlSuffix=t.readString(20,!1,this.sP2pUrlSuffix
1),this.sP2pAntiCode=t.readString(21,!1,this.sP2pAntiCode),this.lFreeFlag=t.readInt64(22,!1,this.lFreeFlag),this.iIsHEVCSupport=t.readInt32(23,!1,this.iIsHEVCSupport),this.vP2pIPList=t.readVector(24,!1,this.vP2pIPList),this.mpExtArgs=t.readMap(25,!1,this.mpExtArgs),this.lTimespan=t.readInt64(26,!1,this.lTimespan)},a.MultiStreamInfo=function(){this.sDisplayName="",this.iBitRate=0,this.iCodecType=0,this.iCompatibleFlag=0,this.iHEVCBitRate=-1},a.MultiStreamInfo.prototype._clone=function(){return new a.MultiStreamInfo},a.MultiStreamInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.MultiStreamInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.MultiStreamInfo.prototype.writeTo=function(t){t.writeString(0,this.sDisplayName),t.writeInt32(1,this.iBitRate),t.writeInt32(2,this.iCodecType),t.writeInt32(3,this.iCompatibleFlag),t.writeInt32(4,this.iHEVCBitRate)},a.MultiStreamInfo.prototype.readFrom=function(t){this.sDisplayName=t.readString(0,!1,this.sDisplayName),this.iBitRate=t.readInt32(1,!1,this.iBitRate),this.iCodecType=t.readInt32(2,!1,this.iCodecType),this.iCompatibleFlag=t.readInt32(3,!1,this.iCompatibleFlag),this.iHEVCBitRate=t.readInt32(4,!1,this.iHEVCBitRate)},a.WSRegisterGroupReq=function(){this.vGroupId=new r.default.Vector(new r.default.STRING),this.sToken=""},a.WSRegisterGroupReq.prototype._clone=function(){return new a.WSRegisterGroupReq},a.WSRegisterGroupReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.WSRegisterGroupReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.WSRegisterGroupReq.prototype.writeTo=function(t){t.writeVector(0,this.vGroupId),t.writeString(1,this.sToken)},a.WSRegisterGroupReq.prototype.readFrom=function(t){this.vGroupId=t.readVector(0,!1,this.vGroupId),this.sToken=t.readString(1,!1,this.sToken)},a.WSRegisterGroupRsp=function(){this.iResCode=0,this.vSupportP2PGroupId=new r.default.Vector(new r.default.STRING)},a.WSRegisterGroupRsp.prototype._clone=function(){return new a.WSRegisterGroupRsp},a.WSRegisterGroupRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.WSRegisterGroupRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.WSRegisterGroupRsp.prototype.writeTo=function(t){t.writeInt32(0,this.iResCode),t.writeVector(1,this.vSupportP2PGroupId)},a.WSRegisterGroupRsp.prototype.readFrom=function(t){this.iResCode=t.readInt32(0,!1,this.iResCode),this.vSupportP2PGroupId=t.readVector(1,!1,this.vSupportP2PGroupId)},a.GetOrderBroadcastInfoReq=function(){this.busses=new r.default.Vector(new r.default.STRING),this.anthorId=0,this.streamName="",this.appid=0},a.GetOrderBroadcastInfoReq.prototype._clone=function(){return new a.GetOrderBroadcastInfoReq},a.GetOrderBroadcastInfoReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GetOrderBroadcastInfoReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GetOrderBroadcastInfoReq.prototype.writeTo=function(t){t.writeVector(0,this.busses),t.writeInt64(1,this.anthorId),t.writeString(2,this.streamName),t.writeInt32(3,this.appid)},a.GetOrderBroadcastInfoReq.prototype.readFrom=function(t){this.busses=t.readVector(0,!1,this.busses),this.anthorId=t.readInt64(1,!1,this.anthorId),this.streamName=t.readString(2,!1,this.streamName),this.appid=t.readInt32(3,!1,this.appid)},a.GetOrderBroadcastInfoRsp=function(){this.ret=0,this.anthorId=0,this.broadcastInfos=new r.default.Vector(new a.OrderBroadcastInfo)},a.GetOrderBroadcastInfoRsp.prototype._clone=function(){return new a.GetOrderBroadcastInfoRsp},a.GetOrderBroadcastInfoRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GetOrderBroadcastInfoRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GetOrderBroadcastInfoRsp.prototype.writeTo=function(t){t.writeInt32(0,this.ret),t.writeInt64(1,this.anthorId),t.writeVector(2,this.broadcastInfos)},a.GetOrderBroadcastInfoRsp.prototype.readFrom=function(t){this.ret=t.readInt32(0,!1,this.ret),this.anthorId=t.readInt64(1,!1,this.anthorId),this.broadcastInfos=t.readVector(2,!1,this.broadcastInfos)},a.OrderBroadcastInfo=function(){this.buss="",this.enable=0,this.broadcastGroup="",this.uri=0,this.configJson=""},a.OrderBroadcastInfo.prototype._clone=function(){return new a.OrderBroadcastInfo}
1,a.OrderBroadcastInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.OrderBroadcastInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.OrderBroadcastInfo.prototype.writeTo=function(t){t.writeString(0,this.buss),t.writeInt32(1,this.enable),t.writeString(2,this.broadcastGroup),t.writeInt32(3,this.uri),t.writeString(4,this.configJson)},a.OrderBroadcastInfo.prototype.readFrom=function(t){this.buss=t.readString(0,!1,this.buss),this.enable=t.readInt32(1,!1,this.enable),this.broadcastGroup=t.readString(2,!1,this.broadcastGroup),this.uri=t.readInt32(3,!1,this.uri),this.configJson=t.readString(4,!1,this.configJson)},(a=a||{}).PixelateInfo=function(){this.dtsType=0,this.beginDts=0,this.endDts=0,this.pixelateKey=0,this.shapeInfos=new r.default.BinBuffer},a.PixelateInfo.prototype._clone=function(){return new a.PixelateInfo},a.PixelateInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.PixelateInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.PixelateInfo.prototype.writeTo=function(t){t.writeInt32(0,this.dtsType),t.writeUInt32(1,this.beginDts),t.writeUInt32(2,this.endDts),t.writeUInt32(3,this.pixelateKey),t.writeBytes(4,this.shapeInfos)},a.PixelateInfo.prototype.readFrom=function(t){this.dtsType=t.readInt32(0,!1,this.dtsType),this.beginDts=t.readUInt32(1,!1,this.beginDts),this.endDts=t.readUInt32(2,!1,this.endDts),this.pixelateKey=t.readUInt32(3,!1,this.pixelateKey),this.shapeInfos=t.readBytes(4,!1,this.shapeInfos)},a.MaskShape=function(){this.points=new r.default.Vector(new r.default.INT64),this.type=0,this.x=0,this.y=0,this.w=0,this.h=0,this.ext="",this.pixelcolor=0},a.MaskShape.prototype._clone=function(){return new a.MaskShape},a.MaskShape.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.MaskShape.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.MaskShape.prototype.writeTo=function(t){t.writeVector(0,this.points),t.writeUInt32(1,this.type),t.writeUInt32(2,this.x),t.writeUInt32(3,this.y),t.writeUInt32(4,this.w),t.writeUInt32(5,this.h),t.writeString(6,this.ext),t.writeUInt32(8,this.pixelcolor)},a.MaskShape.prototype.readFrom=function(t){this.points=t.readVector(0,!1,this.points),this.type=t.readUInt32(1,!1,this.type),this.x=t.readUInt32(2,!1,this.x),this.y=t.readUInt32(3,!1,this.y),this.w=t.readUInt32(4,!1,this.w),this.h=t.readUInt32(5,!1,this.h),this.ext=t.readString(6,!1,this.ext),this.pixelcolor=t.readUInt32(8,!1,this.pixelcolor)},a.SafeRoiMaskProto=function(){this.ver_no=0,this.dts=0,this.frame_width=0,this.frame_height=0,this.contrs=new r.default.Vector(new a.MaskShape),this.ext=""},a.SafeRoiMaskProto.prototype._clone=function(){return new a.SafeRoiMaskProto},a.SafeRoiMaskProto.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.SafeRoiMaskProto.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.SafeRoiMaskProto.prototype.writeTo=function(t){t.writeUInt32(0,this.ver_no),t.writeUInt32(1,this.dts),t.writeUInt32(2,this.frame_width),t.writeUInt32(3,this.frame_height),t.writeVector(4,this.contrs),t.writeString(5,this.ext)},a.SafeRoiMaskProto.prototype.readFrom=function(t){this.ver_no=t.readUInt32(0,!1,this.ver_no),this.dts=t.readUInt32(1,!1,this.dts),this.frame_width=t.readUInt32(2,!1,this.frame_width),this.frame_height=t.readUInt32(3,!1,this.frame_height),this.contrs=t.readVector(4,!1,this.contrs),this.ext=t.readString(5,!1,this.ext)},a.GetVideoHisUponReq=function(){this.lUid=0,this.lLiveId=0,this.tId=new a.UserId},a.GetVideoHisUponReq.prototype._clone=function(){return new a.GetVideoHisUponReq},a.GetVideoHisUponReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GetVideoHisUponReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GetVideoHisUponReq.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeInt64(1,this.lLiveId),t.writeStruct(2,this.tId)},a.GetVideoHisUponReq.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.lLiveId=t.readInt64(1,!1,this.lLiveId),this.tId=t.readStruct(2,!1,this.tId)},a.GetVideoHisUponRsp=function(){this.lUid=0,this.vHistoryList=new r.default.Vector(new a.GameLiveHlsInfo)},a.GetVideoHisUponRsp.prototype._clone=function(){return new a.GetVideoHisUponRsp}
1,a.GetVideoHisUponRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GetVideoHisUponRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GetVideoHisUponRsp.prototype.writeTo=function(t){t.writeInt64(0,this.lUid),t.writeVector(1,this.vHistoryList)},a.GetVideoHisUponRsp.prototype.readFrom=function(t){this.lUid=t.readInt64(0,!1,this.lUid),this.vHistoryList=t.readVector(1,!1,this.vHistoryList)},a.GameLiveHlsInfo=function(){this.tGameInfo=new a.GameLiveInfo,this.sHlsUrl="",this.iVideoSyncTime=0,this.vDefinitions=new r.default.Vector(new a.VideoDefinition)},a.GameLiveHlsInfo.prototype._clone=function(){return new a.GameLiveHlsInfo},a.GameLiveHlsInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GameLiveHlsInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GameLiveHlsInfo.prototype.writeTo=function(t){t.writeStruct(0,this.tGameInfo),t.writeString(1,this.sHlsUrl),t.writeInt32(2,this.iVideoSyncTime),t.writeVector(3,this.vDefinitions)},a.GameLiveHlsInfo.prototype.readFrom=function(t){this.tGameInfo=t.readStruct(0,!1,this.tGameInfo),this.sHlsUrl=t.readString(1,!1,this.sHlsUrl),this.iVideoSyncTime=t.readInt32(2,!1,this.iVideoSyncTime),this.vDefinitions=t.readVector(3,!1,this.vDefinitions)},a.EGender={MALE:0,FEMALE:1},a.VideoStreamInfo=function(){this.sSize="",this.sWidth="",this.sHeight="",this.sFormat="",this.sUrl="",this.sM3u8="",this.sTs1Url="",this.sTs1Offset="",this.iBitRate=0,this.sCodec="",this.mpExtraParam=new r.default.Map(new r.default.STRING,new r.default.STRING)},a.VideoStreamInfo.prototype._clone=function(){return new a.VideoStreamInfo},a.VideoStreamInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.VideoStreamInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.VideoStreamInfo.prototype.writeTo=function(t){t.writeString(0,this.sSize),t.writeString(1,this.sWidth),t.writeString(2,this.sHeight),t.writeString(3,this.sFormat),t.writeString(4,this.sUrl),t.writeString(5,this.sM3u8),t.writeString(6,this.sTs1Url),t.writeString(7,this.sTs1Offset),t.writeInt32(8,this.iBitRate),t.writeString(9,this.sCodec),t.writeMap(10,this.mpExtraParam)},a.VideoStreamInfo.prototype.readFrom=function(t){this.sSize=t.readString(0,!1,this.sSize),this.sWidth=t.readString(1,!1,this.sWidth),this.sHeight=t.readString(2,!1,this.sHeight),this.sFormat=t.readString(3,!1,this.sFormat),this.sUrl=t.readString(4,!1,this.sUrl),this.sM3u8=t.readString(5,!1,this.sM3u8),this.sTs1Url=t.readString(6,!1,this.sTs1Url),this.sTs1Offset=t.readString(7,!1,this.sTs1Offset),this.iBitRate=t.readInt32(8,!1,this.iBitRate),this.sCodec=t.readString(9,!1,this.sCodec),this.mpExtraParam=t.readMap(10,!1,this.mpExtraParam)},a.VideoDefinition=function(){this.sSize="",this.sWidth="",this.sHeight="",this.sDefinition="",this.sUrl="",this.sM3u8="",this.sDefName="",this.sTs1Url="",this.sTs1Offset="",this.iLineIndex=0,this.iBitRate=0,this.mpExtraParam=new r.default.Map(new r.default.STRING,new r.default.STRING),this.vStreamInfo=new r.default.Vector(new a.VideoStreamInfo),this.sCodec="",this.sFormat="",this.sDuration=""},a.VideoDefinition.prototype._clone=function(){return new a.VideoDefinition},a.VideoDefinition.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.VideoDefinition.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.VideoDefinition.prototype.writeTo=function(t){t.writeString(0,this.sSize),t.writeString(1,this.sWidth),t.writeString(2,this.sHeight),t.writeString(3,this.sDefinition),t.writeString(4,this.sUrl),t.writeString(5,this.sM3u8),t.writeString(6,this.sDefName),t.writeString(7,this.sTs1Url),t.writeString(8,this.sTs1Offset),t.writeInt32(9,this.iLineIndex),t.writeInt32(10,this.iBitRate),t.writeMap(11,this.mpExtraParam),t.writeVector(12,this.vStreamInfo),t.writeString(13,this.sCodec),t.writeString(14,this.sFormat),t.writeString(15,this.sDuration)},a.VideoDefinition.prototype.readFrom=function(t){this.sSize=t.readString(0,!1,this.sSize),this.sWidth=t.readString(1,!1,this.sWidth),this.sHeight=t.readString(2,!1,this.sHeight),this.sDefinition=t.readString(3,!1,this.sDefinition),this.sUrl=t.readString(4,!1,this.sUrl),this.sM3u8=t.readString(5,!1,this.sM3u8),this.sDefName=t.readString(6,
1!1,this.sDefName),this.sTs1Url=t.readString(7,!1,this.sTs1Url),this.sTs1Offset=t.readString(8,!1,this.sTs1Offset),this.iLineIndex=t.readInt32(9,!1,this.iLineIndex),this.iBitRate=t.readInt32(10,!1,this.iBitRate),this.mpExtraParam=t.readMap(11,!1,this.mpExtraParam),this.vStreamInfo=t.readVector(12,!1,this.vStreamInfo),this.sCodec=t.readString(13,!1,this.sCodec),this.sFormat=t.readString(14,!1,this.sFormat),this.sDuration=t.readString(15,!1,this.sDuration)},a.GameLiveTag=function(){this.iTagId=0,this.sTagName="",this.bIsShow=!0,this.iBindingGameId=0,this.iShowType=0},a.GameLiveTag.prototype._clone=function(){return new a.GameLiveTag},a.GameLiveTag.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GameLiveTag.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GameLiveTag.prototype.writeTo=function(t){t.writeInt32(0,this.iTagId),t.writeString(1,this.sTagName),t.writeBoolean(2,this.bIsShow),t.writeInt32(3,this.iBindingGameId),t.writeInt32(4,this.iShowType)},a.GameLiveTag.prototype.readFrom=function(t){this.iTagId=t.readInt32(0,!1,this.iTagId),this.sTagName=t.readString(1,!1,this.sTagName),this.bIsShow=t.readBoolean(2,!1,this.bIsShow),this.iBindingGameId=t.readInt32(3,!1,this.iBindingGameId),this.iShowType=t.readInt32(4,!1,this.iShowType)},a.GameLiveInfo=function(){this.lLiveId=0,this.lUid=0,this.lChannelId=0,this.iShortChannel=0,this.lSubchannel=0,this.sSubchannelName="",this.iGameId=0,this.sGameName="",this.iAttendeeCount=0,this.eGender=a.EGender.MALE,this.iAid=0,this.sNick="",this.sAvatarUrl="",this.iStartTime=0,this.iEndTime=0,this.iSourceType=0,this.bIsCameraOpen=!1,this.bIsRoomSecret=!1,this.sVideoCaptureUrl="",this.iCdnAttendee=0,this.lYYId=0,this.bCertified=!1,this.iRecType=0,this.lSignChannel=0,this.sLiveDesc="",this.iLevel=0,this.sGameShortName="",this.iGameType=0,this.sPrivateHost="",this.iActivityCount=0,this.iStreamType=0,this.iBitRate=0,this.iResolution=0,this.iFrameRate=0,this.iIsMultiStream=0,this.iExeGameId=0,this.lExp=0,this.sReplayHls="",this.lMultiStreamFlag=0,this.iScreenType=0,this.iChannelType=0,this.sLocation="",this.iCodecType=0,this.vPresenterTags=new r.default.Vector(new a.GameLiveTag),this.vGameTags=new r.default.Vector(new a.GameLiveTag),this.lLiveCompatibleFlag=0,this.sTraceId="",this.iRoomId=0,this.mpExtInfo=new r.default.Map(new r.default.STRING,new r.default.STRING)},a.GameLiveInfo.prototype._clone=function(){return new a.GameLiveInfo},a.GameLiveInfo.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.GameLiveInfo.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.GameLiveInfo.prototype.writeTo=function(t){t.writeInt64(0,this.lLiveId),t.writeInt64(1,this.lUid),t.writeInt64(2,this.lChannelId),t.writeInt32(3,this.iShortChannel),t.writeInt64(4,this.lSubchannel),t.writeString(5,this.sSubchannelName),t.writeInt32(6,this.iGameId),t.writeString(7,this.sGameName),t.writeInt32(8,this.iAttendeeCount),t.writeInt32(9,this.eGender),t.writeInt32(10,this.iAid),t.writeString(11,this.sNick),t.writeString(12,this.sAvatarUrl),t.writeInt32(13,this.iStartTime),t.writeInt32(14,this.iEndTime),t.writeInt32(15,this.iSourceType),t.writeBoolean(16,this.bIsCameraOpen),t.writeBoolean(17,this.bIsRoomSecret),t.writeString(18,this.sVideoCaptureUrl),t.writeInt32(19,this.iCdnAttendee),t.writeInt64(20,this.lYYId),t.writeBoolean(21,this.bCertified),t.writeInt32(22,this.iRecType),t.writeInt64(23,this.lSignChannel),t.writeString(24,this.sLiveDesc),t.writeInt32(25,this.iLevel),t.writeString(26,this.sGameShortName),t.writeInt32(27,this.iGameType),t.writeString(28,this.sPrivateHost),t.writeInt32(29,this.iActivityCount),t.writeInt32(30,this.iStreamType),t.writeInt32(31,this.iBitRate),t.writeInt32(32,this.iResolution),t.writeInt32(33,this.iFrameRate),t.writeInt32(34,this.iIsMultiStream),t.writeInt32(35,this.iExeGameId),t.writeInt64(36,this.lExp),t.writeString(37,this.sReplayHls),t.writeInt64(38,this.lMultiStreamFlag),t.writeInt32(39,this.iScreenType),t.writeInt32(40,this.iChannelType),t.writeString(41,this.sLocation),t.writeInt32(42,this.iCodecType),t.writeVector(43,this.vPresenterTags),t.writeVector(44,this.vGameTags),t.writeInt64(45,this.lLiveCompatibleFlag),t.writeString(46,this.sTraceId),t.writeInt32(47,this.iRoomId),t.writeMap(48,this.mpExtInfo)},a.GameLiveInfo.prototype.readFrom=function(t){this.lLiveId=t.readInt64(0,!1,this.lLiveId),this.lUid=t.readInt64(1,!1,this.lUid),this.lChannelId=t.readInt64(2,!1,this.l
1ChannelId),this.iShortChannel=t.readInt32(3,!1,this.iShortChannel),this.lSubchannel=t.readInt64(4,!1,this.lSubchannel),this.sSubchannelName=t.readString(5,!1,this.sSubchannelName),this.iGameId=t.readInt32(6,!1,this.iGameId),this.sGameName=t.readString(7,!1,this.sGameName),this.iAttendeeCount=t.readInt32(8,!1,this.iAttendeeCount),this.eGender=t.readInt32(9,!1,this.eGender),this.iAid=t.readInt32(10,!1,this.iAid),this.sNick=t.readString(11,!1,this.sNick),this.sAvatarUrl=t.readString(12,!1,this.sAvatarUrl),this.iStartTime=t.readInt32(13,!1,this.iStartTime),this.iEndTime=t.readInt32(14,!1,this.iEndTime),this.iSourceType=t.readInt32(15,!1,this.iSourceType),this.bIsCameraOpen=t.readBoolean(16,!1,this.bIsCameraOpen),this.bIsRoomSecret=t.readBoolean(17,!1,this.bIsRoomSecret),this.sVideoCaptureUrl=t.readString(18,!1,this.sVideoCaptureUrl),this.iCdnAttendee=t.readInt32(19,!1,this.iCdnAttendee),this.lYYId=t.readInt64(20,!1,this.lYYId),this.bCertified=t.readBoolean(21,!1,this.bCertified),this.iRecType=t.readInt32(22,!1,this.iRecType),this.lSignChannel=t.readInt64(23,!1,this.lSignChannel),this.sLiveDesc=t.readString(24,!1,this.sLiveDesc),this.iLevel=t.readInt32(25,!1,this.iLevel),this.sGameShortName=t.readString(26,!1,this.sGameShortName),this.iGameType=t.readInt32(27,!1,this.iGameType),this.sPrivateHost=t.readString(28,!1,this.sPrivateHost),this.iActivityCount=t.readInt32(29,!1,this.iActivityCount),this.iStreamType=t.readInt32(30,!1,this.iStreamType),this.iBitRate=t.readInt32(31,!1,this.iBitRate),this.iResolution=t.readInt32(32,!1,this.iResolution),this.iFrameRate=t.readInt32(33,!1,this.iFrameRate),this.iIsMultiStream=t.readInt32(34,!1,this.iIsMultiStream),this.iExeGameId=t.readInt32(35,!1,this.iExeGameId),this.lExp=t.readInt64(36,!1,this.lExp),this.sReplayHls=t.readString(37,!1,this.sReplayHls),this.lMultiStreamFlag=t.readInt64(38,!1,this.lMultiStreamFlag),this.iScreenType=t.readInt32(39,!1,this.iScreenType),this.iChannelType=t.readInt32(40,!1,this.iChannelType),this.sLocation=t.readString(41,!1,this.sLocation),this.iCodecType=t.readInt32(42,!1,this.iCodecType),this.vPresenterTags=t.readVector(43,!1,this.vPresenterTags),this.vGameTags=t.readVector(44,!1,this.vGameTags),this.lLiveCompatibleFlag=t.readInt64(45,!1,this.lLiveCompatibleFlag),this.sTraceId=t.readString(46,!1,this.sTraceId),this.iRoomId=t.readInt32(47,!1,this.iRoomId),this.mpExtInfo=t.readMap(48,!1,this.mpExtInfo)},a.UserEventReq=function(){this.tId=new a.UserId,this.lTid=0,this.lSid=0,this.eOp=0,this.sChan="",this.eSource=0,this.lPid=0,this.bWatchVideo=!1,this.bAnonymous=!1,this.eTemplateType=a.TemplateType.PRIMARY,this.sTraceSource=""},a.UserEventReq.prototype._clone=function(){return new a.UserEventReq},a.UserEventReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.UserEventReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.UserEventReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt64(1,this.lTid),t.writeInt64(2,this.lSid),t.writeInt32(4,this.eOp),t.writeString(5,this.sChan),t.writeInt32(6,this.eSource),t.writeInt64(7,this.lPid),t.writeBoolean(8,this.bWatchVideo),t.writeBoolean(9,this.bAnonymous),t.writeInt32(10,this.eTemplateType),t.writeString(11,this.sTraceSource)},a.UserEventRsp=function(){this.lTid=0,this.lSid=0,this.iUserHeartBeatInterval=60,this.iPresentHeartBeatInterval=60},a.UserEventRsp.prototype._clone=function(){return new a.UserEventRsp},a.UserEventRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.UserEventRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.UserEventRsp.prototype.readFrom=function(t){this.lTid=t.readInt64(0,!1,this.lTid),this.lSid=t.readInt64(1,!1,this.lSid),this.iUserHeartBeatInterval=t.readInt32(2,!1,this.iUserHeartBeatInterval),this.iPresentHeartBeatInterval=t.readInt32(3,!1,this.iPresentHeartBeatInterval)},a.UserHeartBeatReq=function(){this.tId=new a.UserId,this.lTid=0,this.lSid=0,this.lPid=0,this.bWatchVideo=!1,this.eLineType=0,this.iFps=0,this.iAttendee=0,this.iBandwidth=0,this.iLastHeartElapseTime=0},a.UserHeartBeatReq.prototype._clone=function(){return new a.UserHeartBeatReq}
1,a.UserHeartBeatReq.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.UserHeartBeatReq.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.UserHeartBeatReq.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeInt64(1,this.lTid),t.writeInt64(2,this.lSid),t.writeInt64(4,this.lPid),t.writeBoolean(5,this.bWatchVideo),t.writeInt32(6,this.eLineType),t.writeInt32(7,this.iFps),t.writeInt32(8,this.iAttendee),t.writeInt32(9,this.iBandwidth),t.writeInt32(10,this.iLastHeartElapseTime)},a.UserHeartBeatRsp=function(){this.iRet=0},a.UserHeartBeatRsp.prototype._clone=function(){return new a.UserHeartBeatRsp},a.UserHeartBeatRsp.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.UserHeartBeatRsp.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.UserHeartBeatRsp.prototype.readFrom=function(t){this.iRet=t.readInt32(0,!1,this.iRet)},a.TemplateType={PRIMARY:1,RECEPTION:2},a.MetricDetailSet=function(){this.tId=new a.UserId,this.vMetricDetail=new r.default.Vector(new a.MetricDetail)},a.MetricDetailSet.prototype._clone=function(){return new a.MetricDetailSet},a.MetricDetailSet.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.MetricDetailSet.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.MetricDetailSet.prototype.writeTo=function(t){t.writeStruct(0,this.tId),t.writeVector(1,this.vMetricDetail)},a.MetricDetailSet.prototype.readFrom=function(t){this.tId=t.readStruct(0,!0,this.tId),this.vMetricDetail=t.readVector(1,!0,this.vMetricDetail)},a.MetricDetail=function(){this.sMetricName="",this.iTS=0,this.vDimension=new r.default.Vector(new a.Dimension),this.vFiled=new r.default.Vector(new a.Field),this.vExLog=new r.default.Vector(new a.Dimension)},a.MetricDetail.prototype._clone=function(){return new a.MetricDetail},a.MetricDetail.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.MetricDetail.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.MetricDetail.prototype.writeTo=function(t){t.writeString(0,this.sMetricName),t.writeInt64(1,this.iTS),t.writeVector(2,this.vDimension),t.writeVector(3,this.vFiled),t.writeVector(4,this.vExLog)},a.MetricDetail.prototype.readFrom=function(t){this.sMetricName=t.readString(0,!0,this.sMetricName),this.iTS=t.readInt64(1,!1,this.iTS),this.vDimension=t.readVector(2,!1,this.vDimension),this.vFiled=t.readVector(3,!1,this.vFiled),this.vExLog=t.readVector(4,!1,this.vExLog)},a.Field=function(){this.sName="",this.fValue=0},a.Field.prototype._clone=function(){return new a.Field},a.Field.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.Field.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.Field.prototype.writeTo=function(t){t.writeString(0,this.sName),t.writeDouble(1,this.fValue)},a.Field.prototype.readFrom=function(t){this.sName=t.readString(0,!1,this.sName),this.fValue=t.readDouble(1,!1,this.fValue)},a.Metric=function(){this.sMetricName="",this.vDimension=new r.default.Vector(new a.Dimension),this.iTS=0,this.iSuccess=0,this.iRetCode=0,this.fValue=0,this.eUnit=0,this.tStatsSet=new a.StatsSet,this.sExtDesc="",this.vExLog=new r.default.Vector(new a.Dimension)},a.Metric.prototype._clone=function(){return new a.Metric},a.Metric.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.Metric.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.Metric.prototype.writeTo=function(t){t.writeString(0,this.sMetricName),t.writeVector(1,this.vDimension),t.writeInt64(2,this.iTS),t.writeInt32(3,this.iSuccess),t.writeInt32(4,this.iRetCode),t.writeDouble(5,this.fValue),t.writeInt32(6,this.eUnit),t.writeStruct(7,this.tStatsSet),t.writeString(8,this.sExtDesc),t.writeVector(9,this.vExLog)},a.Metric.prototype.readFrom=function(t){this.sMetricName=t.readString(0,!0,this.sMetricName),this.vDimension=t.readVector(1,!1,this.vDimension),this.iTS=t.readInt64(2,!1,this.iTS),this.iSuccess=t.readInt32(3,!1,this.iSuccess),this.iRetCode=t.readInt32(4,!1,this.iRetCode),this.fValue=t.readDouble(5,!1,this.fValue),this.eUnit=t.readInt32(6,!1,this.eUnit),this.tStatsSet=t.readStruct(7,!1,this.tStatsSet),this.sExtDesc=t.readString(8,!1,this.sExtDesc),this.vExLog=t.readVector(9,!1,this.vExLog)},a.Dimension=function(){this.sName="",this.sValue=""},a.Dimension.prototype._clone=function(){return new a.Dimension}
1,a.Dimension.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.Dimension.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.Dimension.prototype.writeTo=function(t){t.writeString(0,this.sName),t.writeString(1,this.sValue)},a.Dimension.prototype.readFrom=function(t){this.sName=t.readString(0,!1,this.sName),this.sValue=t.readString(1,!1,this.sValue)},a.HuYaUdbNotify=function(){this.eNotifyType=0,this.sMsg=""},a.HuYaUdbNotify.prototype._clone=function(){return new a.HuYaUdbNotify},a.HuYaUdbNotify.prototype._write=function(t,e,i){t.writeStruct(e,i)},a.HuYaUdbNotify.prototype._read=function(t,e,i){return t.readStruct(e,!0,i)},a.HuYaUdbNotify.prototype.writeTo=function(t){t.writeInt32(0,this.eNotifyType),t.writeString(1,this.sMsg)},a.HuYaUdbNotify.prototype.readFrom=function(t){this.eNotifyType=t.readInt32(0,!1,this.eNotifyType),this.sMsg=t.readString(1,!1,this.sMsg)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(101).default},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=m(i(20)),r=m(i(0)),a=m(i(1)),n=m(i(22)),o=m(i(24)),u=m(i(63)),l=i(77),d=m(i(4)),c=m(i(33)),f=m(i(16)),p=m(i(53));function m(t){return t&&t.__esModule?t:{default:t}}var _=!!Number(p.default._printProtocol),y=!!Number(p.default._printGateway);function v(t,e,i){var s="font-weight:900";return t&&(s+=";color:"+t),e&&(s+=";background:"+e),i&&(s+=";border:3px solid "+i),s}e.default=function(t){function e(){(0,r.default)(this,e);var t=(0,n.default)(this,(e.__proto__||(0,s.default)(e)).call(this));return t._taf=null,t.requestId=1,t.TAFLINK_INITED="TAFLINK_INITED",t}return(0,o.default)(e,t),(0,a.default)(e,[{key:"destroy",value:function(){this._taf=null}},{key:"getTaf",value:function(){return this._taf}},{key:"getUserId",value:function(){return this._taf.getUserId()}},{key:"getRequestId",value:function(){return this.requestId++,1e5===this.requestId&&(this.requestId=1),this.requestId}},{key:"setTafHandler",value:function(t){t.registerWupMap({getCdnTokenInfoEx:u.default.GetCdnTokenExRsp,wsTimeSync:u.default.WSTimeSyncRsp,getInfoFromVG:u.default.GetInfoFromVGRsp,GetInfoFromVG:u.default.GetInfoFromVGRsp,getInfoFromCdnVG:u.default.GetInfoFromVGRsp,getMediaRec:u.default.RecSysRsp,getAntiCodeForStream:u.default.GetAntiCodeForStreamRsp,getVodAntiCode:u.default.GetVodAntiCodeRsp}),this._taf=t,t.getTaf&&u.default.setTaf(t.getTaf()),this.emit(this.TAFLINK_INITED)}},{key:"sendWup",value:function(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:-1,n=arguments.length>6&&void 0!==arguments[6]&&arguments[6];this._taf.sendWup2?this._taf.sendWup2(t,e,i,s,r,a,n):this._taf.sendWup(t,e,i,s,r,a,n)}},{key:"sendYY",value:function(t,e){var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(this._taf){var r=t.constructor.name,a=d.default[r];a||"function"!=typeof t.marshall||(a=new DataView(t.marshall().buffer).getUint32(4,!0));var n=this._taf.getTaf().BinBuffer,o=new u.default.GetInfoFromVGReq;o.lUid=s||0,o.sMsg=new n(t.marshall().buffer),o.sProtoName="yy",o.iUri=a||0,this.sendWup("videogateway","getInfoFromCdnVG",o,function(t){if(0!=t.sMsg.len)if(t.lUid&&o.lUid&&t.lUid!=o.lUid)f.default.logger.warn("GetInfoFromVG response lUid dif.req="+o.lUid+" rsp="+t.lUid);else{var s=new DataView(t.sMsg.buffer),a=new c.default(s);if(!(r=d.default[a.uri]))throw y||f.default.logger.log("%c<<<<<<< %crspWup:%c GetInfoFromVG",v("#0000E3"),v("black"),v("#0000E3"),"videogateway",t),Error("[x] Unmatched protocol, uri="+(a.uri>>8)+" resCode="+a.resCode+" len="+a.len);var n=a,u=null;try{u=i(83)("./"+r).default}catch(t){f.default.logger.warn("[x] Unmatched protocol",a.uri>>8,r)}_&&f.default.logger.log("%c<<<<<<< "+r,v("#0000E3"),n),u&&(n=new u).unmarshall(a),e&&e(n)}else f.default.logger.warn("GetInfoFromVG response an empty pkg.")})}else f.default.logger.warn("TafLink.sendYY taf not init!")}},{key:"inited",get:function(){return!!this._taf}},{key:"connected",get:function(){return!!this._taf&&(this._taf.isWSConnected?this._taf.isWSConnected():this._taf.connected)}}]),e}(l.EventEmitter)}
vendor: 2,369 bytes, line 1
1,function(t,e,i){i(103),t.exports=i(3).Object.getPrototypeOf},function(t,e,i){var s=i(21),r=i(65);i(104)("getPrototypeOf",function(){return function(t){return r(s(t))}})},function(t,e,i){var s=i(5),r=i(3),a=i(15);t.exports=function(t,e){var i=(r.Object||{})[t]||Object[t],n={};n[t]=e(i),s(s.S+s.F*a(function(){i(1)}),"Object",n)}},function(t,e,i){t.exports={default:i(106),__esModule:!0}},function(t,e,i){i(107);var s=i(3).Object;t.exports=function(t,e,i){return s.defineProperty(t,e,i)}},function(t,e,i){var s=i(5);s(s.S+!i(6)*s.F,"Object",{defineProperty:i(9).f})},function(t,e,i){t.exports={default:i(109),__esModule:!0}},function(t,e,i){i(41),i(48),t.exports=i(49).f("iterator")},function(t,e,i){var s=i(42),r=i(37);t.exports=function(t){return function(e,i){var a,n,o=String(r(e)),u=s(i),l=o.length;return u<0||u>=l?t?"":void 0:(a=o.charCodeAt(u))<55296||a>56319||u+1===l||(n=o.charCodeAt(u+1))<56320||n>57343?t?o.charAt(u):a:t?o.slice(u,u+2):n-56320+(a-55296<<10)+65536}}},function(t,e,i){"use strict";var s=i(29),r=i(28),a=i(31),n={};i(12)(n,i(7)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=s(n,{next:r(1,i)}),a(t,e+" Iterator")}},function(t,e,i){var s=i(9),r=i(13),a=i(30);t.exports=i(6)?Object.defineProperties:function(t,e){r(t);for(var i,n=a(e),o=n.length,u=0;o>u;)s.f(t,i=n[u++],e[i]);return t}},function(t,e,i){var s=i(18),r=i(46),a=i(114);t.exports=function(t){return function(e,i,n){var o,u=s(e),l=r(u.length),d=a(n,l);if(t&&i!=i){for(;l>d;)if((o=u[d++])!=o)return!0}else for(;l>d;d++)if((t||d in u)&&u[d]===i)return t||d||0;return!t&&-1}}},function(t,e,i){var s=i(42),r=Math.max,a=Math.min;t.exports=function(t,e){return(t=s(t))<0?r(t+e,0):a(t,e)}},function(t,e,i){var s=i(8).document;t.exports=s&&s.documentElement},function(t,e,i){"use strict";var s=i(117),r=i(72),a=i(23),n=i(18);t.exports=i(43)(Array,"Array",function(t,e){this._t=n(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?i:"values"==e?t[i]:[i,t[i]])},"values"),a.Arguments=a.Array,s("keys"),s("values"),s("entries")},function(t,e){t.exports=function(){}},function(t,e,i){t.exports={default:i(119),__esModule:!0}},function(t,e,i){i(120),i(76),i(123),i(124),t.exports=i(3).Symbol},function(t,e,i){"use strict";var s=i(8),r=i(14),a=i(6),n=i(5),o=i(70),u=i(50).KEY,l=i(15),d=i(39),
vendor: 4,128 bytes, line 1
1c=i(31),f=i(27),p=i(7),m=i(49),_=i(51),y=i(121),v=i(73),S=i(13),g=i(11),T=i(21),P=i(18),C=i(40),E=i(28),I=i(29),k=i(122),A=i(75),R=i(52),D=i(9),O=i(30),b=A.f,w=D.f,L=k.f,F=s.Symbol,M=s.JSON,N=M&&M.stringify,B=p("_hidden"),V=p("toPrimitive"),U={}.propertyIsEnumerable,x=d("symbol-registry"),H=d("symbols"),G=d("op-symbols"),W=Object.prototype,j="function"==typeof F&&!!R.f,Y=s.QObject,q=!Y||!Y.prototype||!Y.prototype.findChild,K=a&&l(function(){return 7!=I(w({},"a",{get:function(){return w(this,"a",{value:7}).a}})).a})?function(t,e,i){var s=b(W,e);s&&delete W[e],w(t,e,i),s&&t!==W&&w(W,e,s)}:w,z=function(t){var e=H[t]=I(F.prototype);return e._k=t,e},J=j&&"symbol"==typeof F.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof F},Q=function t(e,i,s){return e===W&&t(G,i,s),S(e),i=C(i,!0),S(s),r(H,i)?(s.enumerable?(r(e,B)&&e[B][i]&&(e[B][i]=!1),s=I(s,{enumerable:E(0,!1)})):(r(e,B)||w(e,B,E(1,{})),e[B][i]=!0),K(e,i,s)):w(e,i,s)},X=function(t,e){S(t);for(var i,s=y(e=P(e)),r=0,a=s.length;a>r;)Q(t,i=s[r++],e[i]);return t},$=function(t){var e=U.call(this,t=C(t,!0));return!(this===W&&r(H,t)&&!r(G,t))&&(!(e||!r(this,t)||!r(H,t)||r(this,B)&&this[B][t])||e)},Z=function(t,e){if(t=P(t),e=C(e,!0),t!==W||!r(H,e)||r(G,e)){var i=b(t,e);return!i||!r(H,e)||r(t,B)&&t[B][e]||(i.enumerable=!0),i}},tt=function(t){for(var e,i=L(P(t)),s=[],a=0;i.length>a;)r(H,e=i[a++])||e==B||e==u||s.push(e);return s},te=function(t){for(var e,i=t===W,s=L(i?G:P(t)),a=[],n=0;s.length>n;)r(H,e=s[n++])&&(!i||r(W,e))&&a.push(H[e]);return a};j||(o((F=function(){if(this instanceof F)throw TypeError("Symbol is not a constructor!");var t=f(arguments.length>0?arguments[0]:void 0);return a&&q&&K(W,t,{configurable:!0,set:function e(i){this===W&&e.call(G,i),r(this,B)&&r(this[B],t)&&(this[B][t]=!1),K(this,t,E(1,i))}}),z(t)}).prototype,"toString",function(){return this._k}),A.f=Z,D.f=Q,i(74).f=k.f=tt,i(32).f=$,R.f=te,a&&!i(26)&&o(W,"propertyIsEnumerable",$,!0),m.f=function(t){return z(p(t))}),n(n.G+n.W+!j*n.F,{Symbol:F});for(var ti="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ts=0;ti.length>ts;)p(ti[ts++]);for(var tr=O(p.store),ta=0;tr.length>ta;)_(tr[ta++]);n(n.S+!j*n.F,"Symbol",{for:function(t){return r(x,t+="")?x[t]:x[t]=F(t)},keyFor:function(t){if(!J(t))throw TypeError(t+" is not a symbol!");for(var e in x)if(x[e]===t)return e},useSetter:function(){q=!0},useSimple:function(){q=!1}}),n(n.S+!j*n.F,"Object",{create:function(t,e){return void 0===e?I(t):X(I(t),e)},defineProperty:Q,defineProperties:X,getOwnPropertyDescriptor:Z,getOwnPropertyNames:tt,getOwnPropertySymbols:te});var tn=l(function(){R.f(1)});n(n.S+n.F*tn,"Object",{getOwnPropertySymbols:function(t){return R.f(T(t))}}),M&&n(n.S+n.F*(!j||l(function(){var t=F();return"[null]"!=N([t])||"{}"!=N({a:t})||"{}"!=N(Object(t))})),"JSON",{stringify:function(t){for(var e,i,s=[t],r=1;arguments.length>r;)s.push(arguments[r++]);if(i=e=s[1],(g(e)||void 0!==t)&&!J(t))return v(e)||(e=function(t,e){if("function"==typeof i&&(e=i.call(this,t,e)),!J(e))return e}),s[1]=e,N.apply(M,s)}}),F.prototype[V]||i(12)(F.prototype,V,F.prototype.valueOf),c(F,"Symbol"),c(Math,"Math",!0),c(s.JSON,"JSON",!0)},function(t,e,i){var s=i(30),r=i(52),a=i(32);t.exports=function(t){var e=s(t),i=r.f;if(i)for(var n,o=i(t),u=a.f,l=0;o.length>l;)u.call(t,n=o[l++])&&e.push(n);return e}},function(t,e,i){var s=i(18),r=i(74).f,a={}.toString,n="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return n&&"[object Window]"==a.call(t)?function(t){try{return r(t)}catch(t){return n.slice()}}(t):r(s(t))}},function(t,e,i){i(51)("asyncIterator")},function(t,e,i){i(51)("observable")},function(t,e,i){t.exports={default:i(126),__esModule:!0}},function(t,e,i){i(127),t.exports=i(3).Object.setPrototypeOf},function(t,e,i){var s=i(5);s(s.S,"Object",{setPrototypeOf:i(128).set})},function(t,e,i){var s=i(11),r=i(13),a=function(t,e){if(r(t),!s(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}
vendor: 4,292 bytes, line 1
1?function(t,e,s){try{(s=i(17)(Function.call,i(75).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,i){return a(t,i),e?t.__proto__=i:s(t,i),t}}({},!1):void 0),check:a}},function(t,e,i){t.exports={default:i(130),__esModule:!0}},function(t,e,i){i(131);var s=i(3).Object;t.exports=function(t,e){return s.create(t,e)}},function(t,e,i){var s=i(5);s(s.S,"Object",{create:i(29)})},function(t,e,i){i(76),i(41),i(48),i(133),i(142),i(145),i(147),t.exports=i(3).Map},function(t,e,i){"use strict";var s=i(134),r=i(82);t.exports=i(138)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=s.getEntry(r(this,"Map"),t);return e&&e.v},set:function(t,e){return s.def(r(this,"Map"),0===t?0:t,e)}},s,!0)},function(t,e,i){"use strict";var s=i(9).f,r=i(29),a=i(78),n=i(17),o=i(79),u=i(34),l=i(43),d=i(72),c=i(137),f=i(6),p=i(50).fastKey,m=i(82),_=f?"_s":"size",y=function(t,e){var i,s=p(e);if("F"!==s)return t._i[s];for(i=t._f;i;i=i.n)if(i.k==e)return i};t.exports={getConstructor:function(t,e,i,l){var d=t(function(t,s){o(t,d,e,"_i"),t._t=e,t._i=r(null),t._f=void 0,t._l=void 0,t[_]=0,null!=s&&u(s,i,t[l],t)});return a(d.prototype,{clear:function(){for(var t=m(this,e),i=t._i,s=t._f;s;s=s.n)s.r=!0,s.p&&(s.p=s.p.n=void 0),delete i[s.i];t._f=t._l=void 0,t[_]=0},delete:function(t){var i=m(this,e),s=y(i,t);if(s){var r=s.n,a=s.p;delete i._i[s.i],s.r=!0,a&&(a.n=r),r&&(r.p=a),i._f==s&&(i._f=r),i._l==s&&(i._l=a),i[_]--}return!!s},forEach:function(t){m(this,e);for(var i,s=n(t,arguments.length>1?arguments[1]:void 0,3);i=i?i.n:this._f;)for(s(i.v,i.k,this);i&&i.r;)i=i.p},has:function(t){return!!y(m(this,e),t)}}),f&&s(d.prototype,"size",{get:function(){return m(this,e)[_]}}),d},def:function(t,e,i){var s,r,a=y(t,e);return a?a.v=i:(t._l=a={i:r=p(e,!0),k:e,v:i,p:s=t._l,n:void 0,r:!1},t._f||(t._f=a),s&&(s.n=a),t[_]++,"F"!==r&&(t._i[r]=a)),t},getEntry:y,setStrong:function(t,e,i){l(t,e,function(t,i){this._t=m(t,e),this._k=i,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?d(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,d(1))},i?"entries":"values",!i,!0),c(e)}}},function(t,e,i){var s=i(13);t.exports=function(t,e,i,r){try{return r?e(s(i)[0],i[1]):e(i)}catch(e){var a=t.return;throw void 0!==a&&s(a.call(t)),e}}},function(t,e,i){var s=i(23),r=i(7)("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(s.Array===t||a[r]===t)}},function(t,e,i){"use strict";var s=i(8),r=i(3),a=i(9),n=i(6),o=i(7)("species");t.exports=function(t){var e="function"==typeof r[t]?r[t]:s[t];n&&e&&!e[o]&&a.f(e,o,{configurable:!0,get:function(){return this}})}},function(t,e,i){"use strict";var s=i(8),r=i(5),a=i(50),n=i(15),o=i(12),u=i(78),l=i(34),d=i(79),c=i(11),f=i(31),p=i(9).f,m=i(139)(0),_=i(6);t.exports=function(t,e,i,y,v,S){var g=s[t],T=g,P=v?"set":"add",C=T&&T.prototype,E={};return _&&"function"==typeof T&&(S||C.forEach&&!n(function(){(new T).entries().next()}))?(T=e(function(e,i){d(e,T,t,"_c"),e._c=new g,null!=i&&l(i,v,e[P],e)}),m("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(t){var e="add"==t||"set"==t;t in C&&(!S||"clear"!=t)&&o(T.prototype,t,function(i,s){if(d(this,T,t),!e&&S&&!c(i))return"get"==t&&void 0;var r=this._c[t](0===i?0:i,s);return e?this:r})}),S||p(T.prototype,"size",{get:function(){return this._c.size}})):(u((T=y.getConstructor(e,t,v,P)).prototype,i),a.NEED=!0),f(T,t),E[t]=T,r(r.G+r.W+r.F,E),S||y.setStrong(T,t,v),T}},function(t,e,i){var s=i(17),r=i(44),a=i(21),n=i(46),o=i(140);t.exports=function(t,e){var i=1==t,u=2==t,l=3==t,d=4==t,c=6==t,f=5==t||c,p=e||o;return function(e,o,m){for(var _,y,v=a(e),S=r(v),g=s(o,m,3),T=n(S.length),P=0,C=i?p(e,T):u?p(e,0):void 0;T>P;P++)if((f||P in S)&&(y=g(_=S[P],P,v),t)){if(i)C[P]=y;else if(y)switch(t){case 3:return!0;case 5:return _;case 6:return P;case 2:C.push(_)}else if(d)return!1}return c?-1:l||d?d:C}}},function(t,e,i){var s=i(141);t.exports=function(t,e){return new(s(t))(e)}},function(t,e,i){var s=i(11),r=i(73),a=i(7)("species");t.exports=function(t){var e;return r(t)&&("function"==typeof(e=t.constructor)&&(e===Array||r(e.prototype))&&(e=void 0),s(e)&&null===(e=e[a])&&(e=void 0)),void 0===e?Array:e}}
1,function(t,e,i){var s=i(5);s(s.P+s.R,"Map",{toJSON:i(143)("Map")})},function(t,e,i){var s=i(81),r=i(144);t.exports=function(t){return function(){if(s(this)!=t)throw TypeError(t+"#toJSON isn't generic");return r(this)}}},function(t,e,i){var s=i(34);t.exports=function(t,e){var i=[];return s(t,!1,i.push,i,e),i}},function(t,e,i){i(146)("Map")},function(t,e,i){"use strict";var s=i(5);t.exports=function(t){s(s.S,t,{of:function(){for(var t=arguments.length,e=Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},function(t,e,i){i(148)("Map")},function(t,e,i){"use strict";var s=i(5),r=i(66),a=i(17),n=i(34);t.exports=function(t){s(s.S,t,{from:function(t){var e,i,s,o,u=arguments[1];return r(this),(e=void 0!==u)&&r(u),null==t?new this:(i=[],e?(s=0,o=a(u,arguments[2],2),n(t,!1,function(t){i.push(o(t,s++))})):n(t,!1,i.push,i),new this(i))}})}},function(t,e,i){t.exports={default:i(150),__esModule:!0}},function(t,e,i){i(48),i(41),t.exports=i(151)},function(t,e,i){var s=i(13),r=i(80);t.exports=i(3).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return s(e.call(t))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(0)),r=u(i(1)),a=u(i(25)),n=u(i(153)),o=u(i(36));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(e){(0,s.default)(this,t),this._tafLink=e,this._info=new n.default,this._lastTs=0,this._started=!1,this._sguid="",this._clientTime=0,this._requestId=0,this._onWsTimeSyncBind=this._onWsTimeSync.bind(this)}return(0,r.default)(t,[{key:"destroy",value:function(){this._started=!1,this._tafLink=null}},{key:"start",value:function(t){this._started||""===t||(this._started=!0,this._sguid=t,this.wsTimeSync())}},{key:"onTimer",value:function(t){this._started&&(0===this._lastTs?this._lastTs=t:t-this._lastTs>=6e4&&(this._lastTs=t,this.wsTimeSync()))}},{key:"wsTimeSync",value:function(){this._req||(this._req=new o.default.WSTimeSyncReq),this._requestId=this._tafLink.getRequestId(),this._clientTime=a.default.now(),this._req.sGuid=this._sguid,this._req.lClientTime=this._clientTime,this._tafLink.sendWup("launch","wsTimeSync",this._req,this._onWsTimeSyncBind,!0,this._requestId)}},{key:"_onWsTimeSync",value:function(t){this._info.ntpProcess(this._clientTime,Number(t.lServerTime))}},{key:"getSyncTime",value:function(){return this._info.convertToSrvTime(a.default.now())}},{key:"isFinishNtp",value:function(){return this._info.isFinishNtp()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(0)),r=n(i(1)),a=n(i(25));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.osTime=0,this.syncLocalTime=0,this.rttList=[]}
1return(0,r.default)(t,[{key:"convertToSrvTime",value:function(t){if(0===this.osTime)return 0;var e=t-this.osTime;return this.syncLocalTime+e}},{key:"isFinishNtp",value:function(){return 0!==this.osTime}},{key:"ntpProcess",value:function(t,e){var i=a.default.now(),s=i-t,r=Math.round(e+s/2);if(0===this.osTime&&0===this.syncLocalTime)this.osTime=i,this.syncLocalTime=r,this.rttList.push(s);else if(this.rttList.length<10)this.osTime=i,this.syncLocalTime=r,this.rttList.push(s);else{for(var n=[],o=0;o<this.rttList.length;++o)n.push(this.rttList[o]);n.sort(function(t,e){return t-e});for(var u=0,l=0;l<4;++l)u+=n[l];var d=u>>2;(4*s>3*d&&4*s<5*d||s>6e4)&&(this.osTime=i,this.syncLocalTime=r),this.rttList.shift(),this.rttList.push(s),n=null}}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(0)),r=u(i(1)),a=u(i(58)),n=u(i(25)),o=u(i(16));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(e){(0,s.default)(this,t),this.TafLink=e,this._rttCur=0,this._rttMax=0,this._rttSmooth=0,this._rttSamples=[],this._lastPingTs=0,this._lastSampleTs=0,this._pingRspBind=this._pingRsp.bind(this)}return(0,r.default)(t,[{key:"getStats",value:function(){var t={rttMax:this._rttMax,rttSmooth:this._rttSmooth,rttSamples:this._rttSamples.slice()};return this._rttMax=0,this._rttSamples=[],t}},{key:"onTimer",value:function(t){0===this._lastPingTs?this._lastPingTs=t:t-this._lastPingTs>=3e3&&(this._lastPingTs=t,this._pingReq(t)),0===this._lastSampleTs?this._lastSampleTs=t:t-this._lastSampleTs>=1e3&&(this._lastSampleTs=t,this._rttSamples.push(this._rttCur))}},{key:"_pingReq",value:function(t){if(this.TafLink.connected){var e=new a.default.PingSignalContext;e.mTracePoint.put("sendTime",t),this.TafLink.sendWup("launch","pingSignal",e,this._pingRspBind,!0,this.TafLink.getRequestId())}}},{key:"_pingRsp",value:function(t){var e=n.default.now(),i=t.mTracePoint.get("sendTime");if(i>0){var s=Math.round((e-i)/2);this._rttCur=s,0===this._rttSmooth?this._rttSmooth=s:this._rttSmooth=Math.round((7*this._rttSmooth+s)/8),this._rttMax<s&&(this._rttMax=s)}else o.default.logger.warn("[SignalRtt] pingRsp not a number: sendTime="+i)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=S(i(156)),r=S(i(20)),a=S(i(0)),n=S(i(1)),o=S(i(22)),u=S(i(24)),l=S(i(58)),d=S(i(91)),c=S(i(4)),f=S(i(33)),p=S(i(159)),m=S(i(163)),_=i(77),y=S(i(94)),v=S(i(16));function S(t){return t&&t.__esModule?t:{default:t}}var g=function(t){function e(t){var i=arguments[2];(0,a.default)(this,e);var s=(0,o.default)(this,(e.__proto__||(0,r.default)(e)).call(this));return s.player=t,s.wupProtocolList=[],s.vpRequestId=0,s.vpGetted=!1,s.TafLink=i,s}return(0,u.default)(e,t),(0,n.default)(e,[{key:"getRequestId",value:function(){return this.TafLink.getRequestId()}},{key:"resetVpRequest",value:function(){this.vpRequestId=0}},{key:"setTafWup",value:function(t){v.default.logger.log("TafLinkSignal.setTafWup wup="+!t),this._tafwup=t,l.default.setTaf(this._tafwup),this.emit(e.TAF_WUP_READY)}},{key:"getVoiceProxy",value:function(t){var i=this;t&&t.requestId?this.vpRequestId=t.requestId:(this.vpRequestId=this.getRequestId(),t.requestId=this.vpRequestId),this.vpGetted=!1,v.default.logger.log("TafLinkSignal.getVoiceProxy "+(t&&(0,s.default)(t))+" wup="+!this._tafwup),this._tafwup?this._getVoiceProxyHttp(t):this.on(e.TAF_WUP_READY,function(){i.vpGetted?v.default.logger.log("vp had been getted by socket"):i._getVoiceProxyHttp(t)})}},{key:"_getVoiceProxyHttp",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.vpGetted=!0;var i=e.userid,r=e.presenterUid,a=e.streamName,n=e.sid,o=e.latencyModel,u=new d.default;u.sid=r,u.fuzzyParam.h264Only=!0,u.fuzzyParam.maxCodeRateH264=0,u.fuzzyParam.maxCodeRateH265=0;var f=new p.default;f.uid=i,f.version=1,f.sdkVersion=1,f.fuzzyQueryKeys=[u],f.streamNames=[a],f.appid=e.appid,f.clientAppid=0,f.clientType=14,f.sendTime=.001*Date.now()|0,f.useCase=e.useCase||3,f.appUA="webh5&2505061114&websocket";var m=((e.playerdata||{}).gameId||0)+"";f.extInfo.set("categoryId",m),e&&e.rtctrans&&f.extInfo.set("rtctrans",e.rtctrans),e&&void 0!==e.iBitRate&&f.extInfo.set("co
1derate",String(e.iBitRate)),f.latencyModel=o;var _=f.constructor.name,y=c.default[_],S=new l.default.GetInfoFromVGReq;S.lUid=i,S.sProtoName="yy",S.iUri=y||0,S.lSid=n||0,S.tId=this._getUserId(),S.sMsg=new this._tafwup.BinBuffer(f.marshall().buffer);var g=new this._tafwup.Wup;g.setServant("videogateway"),g.setFunc("getInfoFromVG"),g.writeStruct("tReq",S);var T=g.encode().getBuffer(),P=67==e.appid?"//testws.va.huya.com":"//cdn.wup.huya.com";v.default.logger.log("TafLinkSignal._getVoiceProxyHttp url="+P+" req="+(0,s.default)(f),f),this._tafwup.Util.ajax(P,T,function(e){var i=new t._tafwup.Wup;i.decode(e);var s=new l.default.GetInfoFromVGRsp;i.readStruct("tRsp",s,l.default.GetInfoFromVGRsp),t._onGetProxyResp(s)},function(t){v.default.logger.error("Get vp error, status=",t)})}},{key:"_getVoiceProxy",value:function(t){var e=t.playerdata,i=t.appid,s=t.streamName,r=(t.subSid,t.presenterUid),a=(t.serviceType,t.userid),n=t.latencyModel,o=(t.maxCodeRateH264,t.maxCodeRateH265,t.clientType,t.sid),u=t.requestId,f=t.rtctrans,m=t.iBitRate;this.vpGetted=!0;var _=new d.default;_.sid=r,_.fuzzyParam.h264Only=!0,_.fuzzyParam.maxCodeRateH264=0,_.fuzzyParam.maxCodeRateH265=0;var y=a||(Date.now()%1e10*1e3+(1e3*Math.random()|0))%0xffffffff,S=new p.default;S.uid=y,S.version=1,S.sdkVersion=1,S.fuzzyQueryKeys=[_],S.streamNames=[s],S.appid=i,S.clientAppid=0,S.clientType=14,S.sendTime=.001*Date.now()|0,S.useCase=3,S.appUA="webh5&2505061114&websocket";var g=((e=e||{}).gameId||0)+"";S.extInfo.set("categoryId",g),f&&S.extInfo.set("rtctrans",f),void 0!==m&&S.extInfo.set("coderate",String(m)),S.latencyModel=n,v.default.logger.log("TafLinkSignal._getVoiceProxy uid=%s, requestId=%s",y,u,S);var T=S.constructor.name,P=c.default[T],C=new l.default.GetInfoFromVGReq;C.lUid=y,C.sMsg=new(this.TafLink.getTaf().getTaf()).BinBuffer(S.marshall().buffer),C.sProtoName="yy",C.iUri=P||0,C.lSid=o||0,C.tId=this.TafLink.getUserId(),this.TafLink.sendWup("videogateway","getInfoFromVG",C,this._onGetProxyResp.bind(this),!0,u)}},{key:"_onGetProxyResp",value:function(t){v.default.logger.log("TafLinkSignal.onGetProxyResp",t);var e=t.iRequestId;if(e&&e!==this.vpRequestId)v.default.logger.error("Request id is inequality iRequestId=%d, vpRequestId=%d",e,this.vpRequestId);else{var i=new DataView(t.sMsg.buffer),s=new f.default(i),r=new m.default;r.unmarshall(s);var a=[];
1r.allocatedStreams.forEach(function(t,e){a=a.concat(t)}),this.emit(c.default.PAudienceGetProxyListRsp,r)}}},{key:"_getUserId",value:function(t){var e=new l.default.UserId;return e.lUid=t,e.sGuid=y.default.getCookie("guid"),e.sToken="",e.sHuYaUA="webh5&0.0.0&websocket",e.sCookie=document.cookie,e}}]),e}(_.EventEmitter);g.TAF_WUP_READY="TAF_WUP_READY",e.default=g},function(t,e,i){t.exports={default:i(157),__esModule:!0}},function(t,e,i){var s=i(3),r=s.JSON||(s.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(0)),r=n(i(1)),a=n(i(2));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.h264Only=!1,this.maxCodeRateH264=0,this.maxCodeRateH265=0,this.reserve=0}return(0,r.default)(t,[{key:"marshall",value:function(){var t=new a.default(!1);return t.pushBool(this.h264Only),t.pushUInt16(this.maxCodeRateH264),t.pushUInt16(this.maxCodeRateH265),t.pushUInt32(this.reserve),t.marshall()}},{key:"unmarshall",value:function(t){return this.h264Only=t.popBool(),this.maxCodeRateH264=t.popUInt16(),this.maxCodeRateH265=t.popUInt16(),this.reserve=t.popUInt32(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=l(i(10)),r=l(i(0)),a=l(i(1)),n=l(i(4)),o=l(i(2)),u=(l(i(91)),l(i(160)));function l(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.uid=0,this.version=0,this.streamNames=[],this.fuzzyQueryKeys=[],this.currentInfo=new u.default,this.appid=0,this.clientAppid=0,this.clientType=0,this.ip=0,this.sendTime=0,this.sdkVersion=0,this.imsi=0,this.useCase=0,this.appSysName="",this.appUA="",this.retryFailCount=0,this.extInfo=new s.default,this.latencyModel=0}return(0,a.default)(t,[{key:"marshall",value:function(){var t=new o.default;return t.setUri(n.default.PAudienceGetProxyListReq),t.pushUInt64(this.uid),t.pushUInt8(this.version),t.pushUInt32(this.streamNames.length),this.streamNames.forEach(function(e){t.pushString(e)}),t.pushUInt32(this.fuzzyQueryKeys.length),this.fuzzyQueryKeys.forEach(function(e){t.pushUint8ArrayWithoutLen(e.marshall())}),t.pushUint8ArrayWithoutLen(this.currentInfo.marshall()),t.pushUInt8(this.appid),t.pushUInt32(this.clientAppid),t.pushUInt32(this.clientType),t.pu
1shUInt32(this.ip),t.pushUInt32(this.sendTime),t.pushUInt32(this.sdkVersion),t.pushUInt64(this.imsi),t.pushUInt8(this.useCase),t.pushString(this.appSysName),t.pushString(this.appUA),t.pushUInt8(this.retryFailCount),t.pushUInt32(this.extInfo.size),this.extInfo.forEach(function(e,i){t.pushString(i),t.pushString(e)}),t.pushUInt16(this.latencyModel),t.marshall()}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=l(i(10)),r=l(i(0)),a=l(i(1)),n=l(i(2)),o=l(i(92)),u=l(i(93));function l(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.currentProxyInfos=new s.default}return(0,a.default)(t,[{key:"marshall",value:function(){var t=new n.default(!1);return t.pushUInt32(this.currentProxyInfos.size),this.currentProxyInfos.forEach(function(e,i){t.pushUint8ArrayWithoutLen(i.marshall()),t.pushUInt32(e.length),e.forEach(function(e){t.pushUint8ArrayWithoutLen(e.marshall())})}),t.marshall()}},{key:"unmarshall",value:function(t){this.currentProxyInfos.clear();for(var e=t.popUInt32(),i=0;i<e;i++){var s=new o.default;s.unmarshall(t);for(var r=[],a=t.popUInt32(),n=0;n<a;n++){var l=new u.default;r.push(l.unmarshall(t))}this.currentProxyInfos.set(s,r)}return this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={STREAM_VIDEO_RAW:0,STREAM_VIDEO_TRANSCODE:1,STREAM_VIDEO_RTMP_RAW:2,STREAM_VIDEO_RTMP_TRANSCODE:3,STRAEM_TYPE_AUDIO_START:32,STREAM_AUDIO_RAW:32,STREAM_AUDIO_TRANSCODE:33,STREAM_AUDIO_FLV_RAW:34,STREAM_AUDIO_FLV_TRANSCODE:35,STREAM_AUDIO_RTMP_RAW:36,STREAM_AUDIO_RTMP_TRANSCODE:37,STREAM_AUDIO_ALL_SID:39,STREAM_TYPE_UNKNOWN:255}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={STREAM_UNKNOWN:0,AUDIO_SPEEX:0,AUDIO_AACPLUS:1,AUDIO_SILK:2,AUDIO_AAC_44100HZ_STEREO_128KBPS:35,AUDIO_AAC_44100HZ_STEREO_160KBPS:36,AUDIO_AAC_44100HZ_STEREO_192KBPS:37,AUDIO_ELD_AAC_44100HZ_STEREO:38,AUDIO_ELD_AAC_SBR_44100HZ_STEREO:39,AUDIO_MP3:50,AUDIO_NELLYMOSER:54,VIDEO_264_START:401,VIDEO_H264_100K:401,VIDEO_H264_500K:405,VIDEO_H264_800K:408,VIDEO_H264_1200K:412,VIDEO_H264_1500K:415,VIDEO_H264_2000K:420,VIDEO_H264_3000K:430,VIDEO_H264_4000K:440,VIDEO_H264_6000K:460,VIDEO_H264_8000K:480,VIDEO_H264_END:480,VIDEO_265_START:503,VIDEO_H265_300K:503,VIDEO_H265_500K:505,VIDEO_H265_800K:508,VIDEO_H265_1200K:512,VIDEO_H265_1500K:515,VIDEO_H265_2000K:520,VIDEO_H265_3000K:530,VIDEO_H265_4000K:540,VIDEO_H265_6000K:560,VIDEO_H265_8000K:580,VIDEO_H265_END:580}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(10)),r=o(i(0)),a=o(i(1)),n=(o(i(4)),o(i(164)));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,r.default)(this,t),this.uid=0,this.allocatedStream
1s=new s.default,this.clientAppid=0,this.clientType=0,this.sendTime=0,this.userArea=0,this.videoGroupId=0,this.retryType=0,this.retryFreq=0,this.result=0,this.proxyType=0,this.tokenVersion=0,this.sslUrl=""}return(0,a.default)(t,[{key:"unmarshall",value:function(t){this.uid=t.popUInt64(),this.allocatedStreams.clear();for(var e=t.popUInt32(),i=0;i<e;i++){for(var s=t.popString(),r=[],a=t.popUInt32(),o=0;o<a;o++){var u=new n.default;r.push(u.unmarshall(t))}this.allocatedStreams.set(s,r)}return this.clientAppid=t.popUInt32(),this.clientType=t.popUInt32(),this.sendTime=t.popUInt32(),this.userArea=t.popUInt32(),this.videoGroupId=t.popUInt32(),this.retryType=t.popUInt8(),this.retryFreq=t.popUInt16(),this.result=t.popUInt32(),this.proxyType=t.popUInt32(),this.tokenVersion=t.popUInt32(),this.sslUrl=t.popString(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=o(i(0)),r=o(i(1)),a=o(i(92)),n=o(i(93));function o(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.streamId=new a.default,this.videoProxyInfos=[],this.token=""}return(0,r.default)(t,[{key:"unmarshall",value:function(t){this.streamId.unmarshall(t),this.videoProxyInfos=[];for(var e=t.popUInt32(),i=0;i<e;i++){var s=new n.default;this.videoProxyInfos.push(s.unmarshall(t))}return this.token=t.popString(),this}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(0)),r=u(i(1)),a=u(i(58)),n=u(i(94)),o=u(i(16));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(e){(0,s.default)(this,t),this._tafLink=e,this._mediaUserId=null,this._bAnonymous=0,this._tryTimes=0,this._isLogin=!1,this._roomId=0}return(0,r.default)(t,[{key:"destroy",value:function(){this._tafLink=null,this._mediaUserId=null}},{key:"loginMedia",value:function(t,e,i,s){if(this._roomId=e,!this._mediaUserId){var r=new a.default.MediaUserId;r.lUid=i,r.sGuid=n.default.getCookie("guid"),r.sToken=t,r.sUA="media_web&1000&",r.iAppid=s,r.sStrUid="",this._mediaUserId=r}this._login()}},{key:"_login",value:function(){this._mediaUserId.bAnonymous=this._bAnonymous;var t=new a.default.LoginVerifyReq;t.tId=this._mediaUserId,this._tafLink.sendWup("mediaui","loginVerify",t,this._onLogin.bind(this),!0,this._tafLink.getRequestId(),!0)}},{key:"_onLogin",value:function(t){o.default.logger.log("MediaLink._onLogin iResCode="+t.iResCode),0===t.iResCode?(this._isLogin=!0,this._mediaUserId.sCookie=t.sCookie,this._join()):1===t.iResCode&&(this._tryTimes++,this._tryTimes<5&&(this._bAnonymous=1,this._login()))}},{key:"_join",value:function(){var t=new a.default.JoinMediaGroupReq;t.tId=this._mediaUserId,t.vGroupId.value=[this._roomId],this._tafLink.sendWup("mediaui","joinGroup",t,this._onJoin.bind(this),!0,this._tafLink.getRequestId(),!0)}},{key:"_onJoin",value:function(t){o.default.logger.log("MediaLink._onJoin iCode="+t.iCode)}},{key:"quitMedia",value:function(){var t=new a.default.QuitMediaGroupReq;t.tId=this._mediaUserId,t.vGroupId.value=[this._roomId],this._tafLink.sendWup("mediaui","quitGroup",t,this._onQuit.bind(this),!0,this._tafLink.getRequestId(),!0)}},{key:"_onQuit",value:function(t){o.default.logger.log("MediaLink._onQuit iCode="+t.iCode)}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=d(i(20)),r=d(i(0)),a=d(i(1)),n=d(i(22)),o=d(i(24)),u=d(i(59)),l=d(i(4));function d(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){function e(){return(0,r.default)(this,e),(0,n.default)(this,(e.__proto__||(0,s.default)(e)).call(this))}return(0,o.default)(e,t),(0,a.default)(e,[{key:"onSlice",value:function(t){var e=new DataView(t.payload.buffer),i=this.unmarshall(t.uri,e);i.seq=t.seq,this.trigger(l.default.PP2pSliceData,{parent:t,child:i})}},{key:"getClass",value:function(t){return i(83)("./"+t).default}}]),e}(u.default)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(20)),r=u(i(0)),a=u(i(1)),n=u(i(22)),o=u(i(24));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){function e(){return(0,r.default)(this,e),(0,n.default)(this,(e.__proto__||(0,s.default)(e)).call(this))}return(0,o.default)(e,t),(0,a.default)(e,[{key:"getClass",value:function(t){return i(168)("./"+t).default}}]),e}(u(i(59)).default)}
1,function(t,e,i){var s={"./AnchorDtsSei":60,"./AnchorDtsSei.js":60,"./AnchorSeiInfo":96,"./AnchorSeiInfo.js":96,"./HuyaDelaySeiData":97,"./HuyaDelaySeiData.js":97,"./ServerDtsSei":61,"./ServerDtsSei.js":61,"./ServerNodeInfo":62,"./ServerNodeInfo.js":62};function r(t){return i(a(t))}function a(t){if(!i.o(s,t)){var e=Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return s[t]}r.keys=function(){return Object.keys(s)},r.resolve=a,t.exports=r,r.id=168},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s,r=(s=i(170))&&s.__esModule?s:{default:s},a={};self||(self=window),function(){var t=self.navigator.userAgent.toLowerCase(),e=/(edge)\/([\w.]+)/.exec(t)||/(edg)\/([\w.]+)/.exec(t)||/(opr)[\/]([\w.]+)/.exec(t)||/(chrome)[ \/]([\w.]+)/.exec(t)||/(iemobile)[\/]([\w.]+)/.exec(t)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(t)||[],i=/(ipad)/.exec(t)||/(ipod)/.exec(t)||/(windows phone)/.exec(t)||/(iphone)/.exec(t)||/(kindle)/.exec(t)||/(android)/.exec(t)||/(windows)/.exec(t)||/(mac)/.exec(t)||/(linux)/.exec(t)||/(cros)/.exec(t)||[],s={browser:e[5]||e[3]||e[1]||"",version:e[2]||e[4]||"0",majorVersion:e[4]||e[2]||"0",platform:i[0]||""},n={};if(s.browser){n[s.browser]=!0;var o=s.majorVersion.split(".");n.version={major:parseInt(s.majorVersion,10),string:s.version,majorVersion:s.majorVersion},o.length>1&&(n.version.minor=parseInt(o[1],10)),o.length>2&&(n.version.build=parseInt(o[2],10))}for(var u in s.platform&&(n[s.platform]=!0),(n.chrome||n.opr||n.safari)&&(n.webkit=!0),(n.rv||n.iemobile)&&(n.rv&&delete n.rv,s.browser="msie",n.msie=!0),n.edge&&(delete n.edge,s.browser="msedge",n.chrome=!0),n.edg&&(delete n.edg,s.browser="msedge",n.chrome=!0),n.opr&&(s.browser="opera",n.opera=!0),n.safari&&n.android&&(s.browser="android",n.android=!0),n.name=s.browser,n.platform=s.platform,a)a.hasOwnProperty(u)&&delete a[u];(0,r.default)(a,n)}(),a.version||(a.version={major:0,minor:0,build:0,string:"0.0.0"}),e.default=a},function(t,e,i){t.exports={default:i(171),__esModule:!0}},function(t,e,i){i(172),t.exports=i(3).Object.assign},function(t,e,i){var s=i(5);s(s.S+s.F,"Object",{assign:i(173)})},function(t,e,i){"use strict";var s=i(6),r=i(30),a=i(52),n=i(32),o=i(21),u=i(44),l=Object.assign;t.exports=!l||i(15)(function(){var t={},e={},i=Symbol(),s="abcdefghijklmnopqrst";return t[i]=7,s.split("").forEach(function(t){e[t]=t}),7!=l({},t)[i]||Object.keys(l({},e)).join("")!=s})?function(t,e){for(var i=o(t),l=arguments.length,d=1,c=a.f,f=n.f;l>d;)for(var p,m=u(arguments[d++]),_=c?r(m).concat(c(m)):r(m),y=_.length,v=0;y>v;)p=_[v++],s&&!f.call(m,p)||(i[p]=m[p]);return i}:l},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=d(i(10)),r=d(i(0)),a=d(i(1)),n=d(i(36)),o=d(i(16)),u=d(i(25)),l=d(i(53));function d(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(e,i,a,n,o){(0,r.default)(this,t),this.StatCfg=a,this.VodPcdnState=n,this.Timer=o,this._statVod=e,this._oldStat=i,this._open=!0,this._fragsMap=new s.default,this._subsUrlReqTs=0,this.isLoading=!1,this.isAborted=!1,this._onGetVodPcdnProxyBind=this._onGetVodPcdnProxy.bind(this),this._onGetVodPcdnProxyTimeoutBind=this._onGetVodPcdnProxyTimeout.bind(this)}return(0,a.default)(t,[{key:"destroy",value:function(){this.Timer.remove(this._onGetVodPcdnProxyTimeoutBind,this),this.isAborted=!0,this.StatCfg=null,this.Timer=null,this.VodPcdnState=null,this._statVod=null,this._oldStat=null,this._fragsMap&&this._fragsMap.clear(),this._fragsMap=null}},{key:"_getVodPcdnProxy",value:function(t,e,i){var s=i.uid,r=i.appid,a=i.sGuid,d=i.TafLink;if(this._open&&!this.isLoading){this.isLoading=!0,this.isAborted=!1,this._subsUrlReqTs=u.default.now();var c=new n.default.ClientGetVodPcdnProxyReq;c.appid=r,c.lReqTs=Date.now(),c.lUid=s,c.sGuid=a,c.iCliType=n.default.EM_CLINET_TYPE.E_CLIENT_WEB,c.lBucketPara=0,
1c.sOrigUrl=t,this._fragsMap.clear();for(var f=e.length,p=0;p<f;p++){var m=e[p],_=m.url.replace(/http.*?\/\//,"");this._fragsMap.set(m.sn,m);var y=new n.default.VodUrlRange;y.sUrl=_,m.byteRangeEndOffset&&(y.sRange="bytes="+m.byteRangeStartOffset+"-"+(m.byteRangeEndOffset-1)),y.index=m.sn,c.vKeys.value.push(y)}Number(l.default._print_pcdn_req)<=1&&o.default.logger.log("PcdnVodProxy.getVodPcdnProxy",c),d.sendWup("hypcdnvodgw","onClientGetVodPcdnProxyReq",c,this._onGetVodPcdnProxyBind),this.Timer.has(this._onGetVodPcdnProxyTimeoutBind,this)||this.Timer.once(this._onGetVodPcdnProxyTimeoutBind,this,5e3)}}},{key:"_onGetVodPcdnProxy",value:function(t){if(Number(l.default._print_pcdn_req)<=1&&o.default.logger.log("PcdnVodProxy._onGetVodPcdnProxy rsp:",t),!this.isAborted)if(this.Timer.remove(this._onGetVodPcdnProxyTimeoutBind,this),this.isLoading=!1,this._subsUrlReqTs>0&&(this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_SUBS_URL_TIME,u.default.now()-this._subsUrlReqTs),this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_SUBS_URL_TIME_CNT,1),this._subsUrlReqTs=0),t)if(this._oldStat.setComDim(this.StatCfg.DIM_COM.PCDN_ORIGIN,t.pcdnName),this._statVod.setComDim(this.StatCfg.DIM_COM.PCDN_ORIGIN,t.pcdnName),this._statVod.setComDim(this.StatCfg.DIM_COM.CLI_ISP,t.cliIsp),this._statVod.setComDim(this.StatCfg.DIM_COM.CLI_PROV,t.cliProv),this._statVod.setCoreDim(this.StatCfg.DIM_CORE.PCDN_SVR_ISP,t.sPcdnIsp),this._statVod.setCoreDim(this.StatCfg.DIM_CORE.PCDN_SVR_AREA,t.sPcdnArea),t.iErrCode===n.default.ERR_CODE_FOR_HY_PCDNGW_CLIENT_RSP.E_SUCCESS){this._statVod.setComDim(this.StatCfg.PCDN_DATA.USE_PCDN,1);for(var e=t.vPcdnUrls.value.length,i=0;i<e;i++){var s=t.vPcdnUrls.value[i],r=this._fragsMap.get(s.reqKey.index);if(r){switch(!r.statPcdn&&this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_URL_TOTAL_CNT,1),s.iStatusPcdn){case 100:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_URL_SUCCESS,1),this._updateFragPcdnState(this.VodPcdnState.PCDN_REALTIME,s),this._rspVodPcdnProxyUrl(s);break;case 101:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_ERR_NOT_REACHED,1),this._updateFragPcdnState(this.VodPcdnState.REALTIME_NOT_REACHED,s);break;case 102:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_ERR_OVER_RUN,1),this._updateFragPcdnState(this.VodPcdnState.REALTIME_OVER_RUN,s);break;case 200:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_URL_SUC_FREETIME,1),this._updateFragPcdnState(this.VodPcdnState.PCDN_FREETIME,s),this._rspVodPcdnProxyUrl(s);break;case 201:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_ERR_OVER_RUN_FREETIME,1),this._updateFragPcdnState(this.VodPcdnState.FREETIME_OVER_RUN,s);break;case 301:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_ERR_NOT_COVERD,1),this._updateFragPcdnState(this.VodPcdnState.FREETIME_NOT_COVERD,s);break;case 302:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_ERROR_REQ,1),this._updateFragPcdnState(this.VodPcdnState.ERROR_REQ,s);break;default:r.statPcdn||this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_ERR_OTHER,1),this._updateFragPcdnState(this.VodPcdnState.PCDN_REQ_OTHER,s)}r.statPcdn=!0}}}else t.iErrCode===n.default.ERR_CODE_FOR_HY_PCDNGW_CLIENT_RSP.E_PCDN_OFF?(this._open=!1,this._statVod.setComDim(this.StatCfg.PCDN_DATA.USE_PCDN,0),this._updateFragPcdnState(this.VodPcdnState.PCDN_NOT_OPEN)):(this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_URL_TOTAL_CNT,1),this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_SUBS_URL_ERROR_CNT,1),this._updateFragPcdnState(this.VodPcdnState.TAF_REQ_ERROR));else this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_URL_TOTAL_CNT,1),this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_SUBS_URL_ERROR_CNT,1),this._updateFragPcdnState(this.VodPcdnState.TAF_REQ_ERROR)}},{key:"_onGetVodPcdnProxyTimeout",value:function(){o.default.logger.warn("PcdnVodProxy._onGetVodPcdnProxyTimeout pcdn proxy time out"),this.isLoading=!1,this.isAborted=!0,this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_PCDN_URL_TOTAL_CNT,1),this._statVod.addCore(this.StatCfg.PCDN_DATA.GET_SUBS_URL_ERROR_CNT,1),this._updateFragPcdnState(this.VodPcdnState.TAF_REQ_ERROR),this.Timer.remove(this._onGetVodPcdnProxyTimeoutBind,this)}},{key:"_rspVodPcdnProxyUrl",value:function(t){var e=this._fragsMap.get(t.reqKey.index);e&&(e.pcdnUrls=t.vUrls.value.slice(),e.tryCnt=e.pcdnUrls.length,e.pcdnFreetime=200===t.iStatusPcdn)}},{key:"_updateFragPcdnState",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)if(e){var i=this._fragsMap.get(e.reqKey.index);i&&(i.pcdnStatus=t)}
1else this._fragsMap.forEach(function(e,i){return e.pcdnStatus=t})}},{key:"isPcdnOpen",get:function(){return this._open}}]),t}()}]).default},function(t,e,i){"use strict";var s=window.URL||window.webkitURL;t.exports=function(t){try{var e;try{(e=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(t),e=e.getBlob("application/javascript; charset=utf-8")}catch(i){e=new Blob([t],{type:"application/javascript; charset=utf-8"})}return s.createObjectURL(e)}catch(e){return"data:application/javascript,"+encodeURIComponent(t)}}},function(t,e,i){"use strict";i.r(e),i.d(e,"default",function(){return r});var s=i(12);function r(t){var e=i(32).default,r=i(4).default,a=i(9),n=a.ToMainMessageType,o=a.ReceiveMessageType;r.postMessage(n.WOREKR_READY);var u=new e;function l(){r.postMessage(n.VIDEORENDERERROR)}requestAnimationFrame(function t(){u.rafHandler(r.getNow()),requestAnimationFrame(t)}),t.addEventListener("message",function(e){var i=e.data,a=i.data;switch(i.type){case o.START:u.startVideoRender(a,l),t.mainSharedArrayBuffer=a.mainSharedArrayBuffer;break;case o.POSTFRAME:break;case o.RESIZE:u.updateRect(a.sizes.width,a.sizes.height);break;case o.CLOSE:t.audioSamples=[],t.isBrowserHidden=!1,t.userPaused=!1,u.destroy();break;case o.VISIBILITYCHANGE:t.isBrowserHidden="hidden"==a.state,u.setBrowserHidden(t.isBrowserHidden);break;case o.FAST_OVER:u.fastOver();break;case o.VIDEOSAMPLES:u.appendVideoFrame(a.videoSamples);break;case o.AUDIOSAMPLES:u.appendAudioFrame(a.audioSamples);break;case o.AVCCONFIG:u.updateAVCConfig(a);break;case o.AVCPPS:case o.AVCSPS:case o.AVCVPS:break;case o.AACCONFIG:u.updateAudioConfig(a.codec,a.sampleRate,a.numberOfChannels,a.timestamp);break;case o.UPDATE_VIDEOFPS:u.updateVideoFPS(a.fps,a.noReferFps);break;case o.SET_PLAY_MINBUFFER:u.setPlayMinBuffer(a.bufferLen);break;case o.SET_JITTER:u.setJitter(a);break;case o.SET_USE_SOFTACCELERATION:u.setUseSoftAcceleration();break;case o.UPDATE_SOFTACCELERATION:u.updateSoftAcceleration();break;case o.LOCAL_CONFIG:r.log("ReceiveMessageType.LOCAL_CONFIG",a),u.setLocalConfig(a);break;case o.PAUSE_VIDEO_DECODE:r.log("ReceiveMessageType.PAUSE_VIDEO_DECODE",a),u.setPauseVideoDecode(a);break;case o.PAUSE_AUDIO_DECODE:r.log("ReceiveMessageType.PAUSE_AUDIO_DECODE",a),u.setPauseAudioDecode(a);break;case o.ENABLE_DISCARD_VIDEO:r.log("ReceiveMessageType.ENABLE_DISCARD_VIDEO",a.enableDiscard),u.setEnableDiscard(a);break;case o.SET_AUDIO_WRITER:r.log("ReceiveMessageType.SET_AUDIO_WRITER"),u.startAudioRender(a.ageneratorWriter);break;case o.UPDATE_CURBITRATE:r.log("ReceiveMessageType.UPDATE_CURBITRATE",a.curBitrate),u.updateCurBitrate(a.curBitrate);break;case o.INIT_CONFIG:r.log("ReceiveMessageType.INIT_CONFIG",JSON.stringify(a));var n=JSON.parse(a.config);u.initWebcodecCfg(n);break;case o.RECV_FPS:u.setRealFps(a.recvFps);break;case o.LOG_CFG:r.log("ReceiveMessageType.LOG_CFG ".concat(JSON.stringify(a))),s.a.setCfg(a);break;case o.SET_ENHANCE:r.log("ReceiveMessageType.LOG_CFG ".concat(JSON.stringify(a))),u.setEnhance(a);break;case o.SET_SEGMENTTION:r.log("ReceiveMessageType.LOG_CFG setSegmenttion ".concat(JSON.stringify(a))),u.setSegmenttion(a);break;case o.RECV_FAST_OVER:r.log("ReceiveMessageType.LOG_CFG onRevFastOver"),u.onRevFastOver();break;case o.AV1_INIT_SEG:u.initAv1Seg(a);break;case o.SEEK_TIME:u.seek(a);break;case o.SET_PLAYBACKRATE:u.setPlaybackRate(a);break;case o.SET_VOD_AV1:u.setVodAv1()}})}},function(t,e,i){"use strict";i.r(e);var s=i(0),r=i(1),a=i(8),n=i(3),o=i(2),u=i(7),l=i(6),d=i(10),c=function(){function t(){Object(s.a)(this,t),this.filterDom=null,this.containerId=null}return Object(r.a)(t,[{key:"destroy",value:function(){this.filterDom&&(this.filterDom.remove(),this.filterDom=null)}},{key:"setBackDropFilter",value:function(t,e,i){if(i&&(this.containerId=i),t){this.filterDom||(this.filterDom=document.createElement("div"),this.filterDom.style.position="absolute",this.filterDom.style.width="100%",this.filterDom.style.height="100%",this.filterDom.style.top=0,this.filterDom.style.left=0);var s=Math.floor(30*e/100);document.getElementById(this.containerId).appendChild(this.filterDom),this.filterDom.style.backdropFilter="blur(".concat(s,"px)"),this.filterDom.style.WebkitBackdropFilter="blur(".concat(s,"px)")}else this.filterDom&&this.containerId&&document.getElementById(this.containerId).removeChild(this.filterDom),this.filterDom=null}}]),t}(),f=navigator.userAgent,p=new(function(){function t(){Object(s.a)(this,t),this.matches=null,this.versionFuncs=null,this.device="",this.language="",this.browser="",this.version={major:0,full:""},this.kernel="",this.kernelVersion=0,this.os="",this.osVersion="",this.genBrowserInfo(),this.amendOSVersionCallback=null}return Object(r.a)(t,[{key:"getMatches",value:function(){this.matches={Trident:f.indexOf("Trident")>-1||f.indexOf("NET CLR")>-1,Presto:f.indexOf("Presto")>-1,WebKit:f.indexOf("AppleWebKit")>-1,Gecko:f.indexOf("Gecko/")>-1,KHTML:f.indexOf("KHTML/")>-1,Safari:f.indexOf("Safari")>-1,Chrome:f.indexOf("Chrome")>-1||f.indexOf("CriOS")>-1,IE:f.indexOf("MSIE")>-1||f.indexOf("Trident")>-1,Edge:f.indexOf("Edge")>-1||f.indexOf("Edg/")>-1,Firefox:f.indexOf("Firefox")>-1||f.indexOf("FxiOS")>-1,"Firefox Focus":f.indexOf("Focus")>-1,Chromium:f.indexOf("Chromium")>-1,Opera:f.indexOf("Opera")>-1||f.indexOf("OPR")>-1,Vivaldi:f.indexOf("Vivaldi")>-1,Yandex:f.indexOf("YaBrowser")>-1,Arora:f.indexOf("Arora")>-1,Lunascape:f.indexOf("Lunascape")>-1,QupZilla:f.indexOf("QupZilla")>-1,"Coc Coc":f.indexOf("coc_coc_browser")>-1,Kindle:f.indexOf("Kindle")>-1||f.indexOf("Silk/")>-1,Iceweasel:f.indexOf("Iceweasel")>-1,Konqueror:f.indexOf("Konqueror")>-1,Iceape:f.indexOf("Iceape")>-1,SeaMonkey:f.indexOf("SeaMonkey")>-1,Epiphany:f.indexOf("Epiphany")>-1,360:f.indexOf("QihooBrowser")>-1||f.indexOf("QHBrowser")>-1,"360EE":f.indexOf("360EE")>-1,"360SE":f.indexOf("360SE")>-1,UC:f.indexOf("UCBrowser")>-1||f.indexOf(" UBrowser")>-1||f.indexOf("UCWEB")>-1,QQBrowser:f.indexOf("QQBrowser")>-1,QQ:f.indexOf("QQ/")>-1,Baidu:f.indexOf("Baidu")>-1||f.indexOf("BIDUBrowser")>-1||f.indexOf("baidubrowser")>-1||f.indexOf("baiduboxapp")>-1||f.indexOf("BaiduHD")>-1,Maxthon:f.indexOf("Maxthon")>-1,Sogou:f.indexOf("MetaSr")>-1||f.indexOf("Sogou")>-1,Liebao:f.indexOf("LBBROWSER")>-1||f.indexOf("LieBaoFast")>-1,"2345Explorer":f.indexOf("2345Explorer")>-1||f.indexOf("Mb2345Browser")>-1||f.indexOf("2345chrome")>-1,"115Browser":f.indexOf("115Browser")>
1-1,TheWorld:f.indexOf("TheWorld")>-1,XiaoMi:f.indexOf("MiuiBrowser")>-1,Quark:f.indexOf("Quark")>-1,Qiyu:f.indexOf("Qiyu")>-1,Wechat:f.indexOf("MicroMessenger")>-1,WechatWork:f.indexOf("wxwork/")>-1,Taobao:f.indexOf("AliApp(TB")>-1,Alipay:f.indexOf("AliApp(AP")>-1,Weibo:f.indexOf("Weibo")>-1,Douban:f.indexOf("com.douban.frodo")>-1,Suning:f.indexOf("SNEBUY-APP")>-1,iQiYi:f.indexOf("IqiyiApp")>-1,DingTalk:f.indexOf("DingTalk")>-1,Huawei:f.indexOf("HuaweiBrowser")>-1||f.indexOf("HUAWEI/")>-1||f.indexOf("HONOR")>-1,Vivo:f.indexOf("VivoBrowser")>-1,Windows:f.indexOf("Windows")>-1,Linux:f.indexOf("Linux")>-1||f.indexOf("X11")>-1,"Mac OS":f.indexOf("Macintosh")>-1,Android:f.indexOf("Android")>-1||f.indexOf("Adr")>-1,HarmonyOS:f.indexOf("HarmonyOS")>-1,Ubuntu:f.indexOf("Ubuntu")>-1,FreeBSD:f.indexOf("FreeBSD")>-1,Debian:f.indexOf("Debian")>-1,"Windows Phone":f.indexOf("IEMobile")>-1||f.indexOf("Windows Phone")>-1,BlackBerry:f.indexOf("BlackBerry")>-1||f.indexOf("RIM")>-1,MeeGo:f.indexOf("MeeGo")>-1,Symbian:f.indexOf("Symbian")>-1,iOS:f.indexOf("like Mac OS X")>-1,"Chrome OS":f.indexOf("CrOS")>-1,WebOS:f.indexOf("hpwOS")>-1,Mobile:f.indexOf("Mobi")>-1||f.indexOf("iPh")>-1||f.indexOf("480")>-1,Tablet:f.indexOf("Tablet")>-1||f.indexOf("Pad")>-1||f.indexOf("Nexus 7")>-1},this.matches.Mobile?this.matches.Mobile=!(f.indexOf("iPad")>-1):this.is360()&&(this.mime("type","application/gameplugin")||navigator&&void 0!==navigator.connection&&void 0===navigator.connection.saveData?this.matches["360SE"]=!0:this.matches["360EE"]=!0),this.matches.Baidu&&this.matches.Opera?this.matches.Baidu=!1:this.matches.iOS&&(this.matches.Safari=!0),window.chrome&&(window.chrome.adblock2345||window.chrome.common2345)&&(this.matches["2345Explorer"]=!0)}},{key:"genBrowserInfo",value:function(){this.getMatches();var t,e={kernel:["WebKit","Trident","Gecko","Presto","KHTML"],browser:["Safari","Chrome","Edge","IE","Firefox","Firefox Focus","Chromium","Opera","Vivaldi","Yandex","Arora","Lunascape","QupZilla","Coc Coc","Kindle","Iceweasel","Konqueror","Iceape","SeaMonkey","Epiphany","XiaoMi","Vivo","360","360SE","360EE","UC","QQBrowser","QQ","Huawei","Baidu","Maxthon","Sogou","Liebao","2345Explorer","115Browser","TheWorld","Quark","Qiyu","Wechat","WechatWork","Taobao","Alipay","Weibo","Douban","Suning","iQiYi","DingTalk"],os:["Windows","Linux","Mac OS","Android","HarmonyOS","Ubuntu","FreeBSD","Debian","iOS","Windows Phone","BlackBerry","MeeGo","Symbian","Chrome OS","WebOS"],device:["Mobile","Tablet"]};for(var i in this.device="PC",this.language=((t=(navigator.browserLanguage||navigator.language).split("-"))[1]&&(t[1]=t[1].toUpperCase()),t.join("_")),e)for(var s=0;s<e[i].length;s++){var r=e[i][s];this.matches[r]&&(this[i]=r)}this.getOSVersion(),this.getBrowserVersion(),this.amendSpecialCase(),this.amendOSVersion()}},{key:"getOSVersion",value:function(){var t={Windows:function(){var t=f.replace(/^Mozilla\/\d.0 \(Windows NT ([\d.]+)[;)].*$/,"$1");return({10:"10",6.4:"10",6.3:"8.1",6.2:"8",6.1:"7","6.0":"Vista",5.2:"XP",5.1:"XP","5.0":"2000"})[t]||t},Android:function(){return f.replace(/^.*Android ([\d.]+);.*$/,"$1")},HarmonyOS:function(){return({10:"2"})[f.replace(/^Mozilla.*Android ([\d.]+)[;)].*$/,"$1")]||""},iOS:function(){return f.replace(/^.*OS ([\d_]+) like.*$/,"$1").replace(/_/g,".")},Debian:function(){return f.replace(/^.*Debian\/([\d.]+).*$/,"$1")},"Windows Phone":function(){return f.replace(/^.*Windows Phone( OS)? ([\d.]+);.*$/,"$2")},"Mac OS":function(){return f.replace(/^.*Mac OS X ([\d_]+).*$/,"$1").replace(/_/g,".")},WebOS:function(){return f.replace(/^.*hpwOS\/([\d.]+);.*$/,"$1")}};this.osVersion="",t[this.os]&&(this.osVersion=t[this.os](),this.osVersion==f&&(this.osVersion=""))}},{key:"amendOSVersion",value:function(){var t=this;"Windows"===this.os&&navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then(function(e){e.platformVersion&&parseInt(e.platformVersion.split(".")[0])>=13&&(t.osVersion="11",t.amendOSVersionCallback&&t.amendOSVersionCallback())})}},{key:"getBrowserVersion",value:function(){if(this.versionFuncs={Safari:function(){return f.replace(/^.*Version\/([\d.]+).*$/,"$1")},Chrome:function(){return f.replace(/^.*Chrome\/([\d.]+).*$/,"$1").replace(/^.*CriOS\/([\d.]+).*$/,"$1")},IE:function(){return f.replace(/^.*MSIE ([\d.]+).*$/,"$1").replace(/^.*rv:([\d.]+).*$/,"$1")},Edge:function(){return f.replace(/^.*Edge\/([\d.]+).*$/,"$1").replace(/^.*Edg\/([\d.]+).*$/,"$1")},Firefox:function(){return f.replace(/^.*Firefox\/([\d.]+).*$/,"$1").replace(/^.*FxiOS\/([\d.]+).*$/,"$1")},"Firefox Focus":function(){return f.replace(/^.*Focus\/([\d.]+).*$/,"$1")},Chromium:function(){return f.replace(/^.*Chromium\/([\d.]+).*$/,"$1")},Opera:function(){return f.replace(/^.*Opera\/([\d.]+).*$/,"$1").replace(/^.*OPR\/([\d.]+).*$/,"$1")},Vivaldi:function(){return f.replace(/^.*Vivaldi\/([\d.]+).*$/,"$1")},Yandex:function(){return f.replace(/^.*YaBrowser\/([\d.]+).*$/,"$1")},Arora:function(){return f.replace(/^.*Arora\/([\d.]+).*$/,"$1")},Lunascape:function(){return f.replace(/^.*Lunascape[\/\s]([\d.]+).*$/,"$1")},QupZilla:function(){return f.replace(/^.*QupZilla[\/\s]([\d.]+).*$/,"$1")},"Coc Coc":function(){return f.replace(/^.*coc_coc_browser\/([\d.]+).*$/,"$1")},Kindle:function(){return f.replace(/^.*Version\/([\d.]+).*$/,"$1")},Iceweasel:function(){return f.replace(/^.*Iceweasel\/([\d.]+).*$/,"$1")},Konqueror:function(){return f.replace(/^.*Konqueror\/([\d.]+).*$/,"$1")},Iceape:function(){return f.replace(/^.*Iceape\/([\d.]+).*$/,"$1")},SeaMonkey:function(){return f.replace(/^.*SeaMonkey\/([\d.]+).*$/,"$1")},Epiphany:function(){return f.replace(/^.*Epiphany\/([\d.]+).*$/,"$1")},360:function(){return f.replace(/^.*QihooBrowser\/([\d.]+).*$/,"$1")},"360SE":function(){return({86:"13.0",78:"12.0",69:"11.0",63:"10.0",55:"9.1",45:"8.1",42:"8.0",31:"7.0",21:"6.3"})[f.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},"360EE":function(){return({86:"13.0",78:"12.0",69:"11.0",63:"9.5",55:"9.0",50:"8.7",30:"7.5"})[f.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||""},Maxthon:function(){return f.replace(/^.*Maxthon\/([\d.]+).*$/,"$1")},QQBrowser:function(){return f.replace(/^.*QQBrowser\/([\d.]+).*$/,"$1")},QQ:function(){return f.replace(/^.*QQ\/([\d.]+).*$/,"$1")},Baidu:function(){return f.replace(/^.*BIDUBrowser[\s\/]([\d.]+).*$/,"$1").replace(/^.*baiduboxapp\/([\d.]+).*$/,"$1")},UC:function(){return f.replace(/^.*UC?Browser\/([\d.]+).*$/,"$1")},Sogou:function(){return f.replace(/^.*SE ([\d.X]+).*$/,"$1").replace(/^.*SogouMobileBrowser\/([\d.]+).*$/,"$1")},Liebao:function(){var t="";f.indexOf("LieBaoFast")>-1&&(t=f.replace(/^.*LieBaoFast\/([\d.]+).*$/,"$1"));var e=f.replace(/^.*Chrome\/([\d]+).*$/,"$1");
1return t||({57:"6.5",49:"6.0",46:"5.9",42:"5.3",39:"5.2",34:"5.0",29:"4.5",21:"4.0"})[e]||""},"2345Explorer":function(){return({69:"10.0",55:"9.9"})[navigator.userAgent.replace(/^.*Chrome\/([\d]+).*$/,"$1")]||f.replace(/^.*2345Explorer\/([\d.]+).*$/,"$1").replace(/^.*Mb2345Browser\/([\d.]+).*$/,"$1")},"115Browser":function(){return f.replace(/^.*115Browser\/([\d.]+).*$/,"$1")},TheWorld:function(){return f.replace(/^.*TheWorld ([\d.]+).*$/,"$1")},XiaoMi:function(){return f.replace(/^.*MiuiBrowser\/([\d.]+).*$/,"$1")},Vivo:function(){return f.replace(/^.*VivoBrowser\/([\d.]+).*$/,"$1")},Quark:function(){return f.replace(/^.*Quark\/([\d.]+).*$/,"$1")},Qiyu:function(){return f.replace(/^.*Qiyu\/([\d.]+).*$/,"$1")},Wechat:function(){return f.replace(/^.*MicroMessenger\/([\d.]+).*$/,"$1")},WechatWork:function(){return f.replace(/^.*wxwork\/([\d.]+).*$/,"$1")},Taobao:function(){return f.replace(/^.*AliApp\(TB\/([\d.]+).*$/,"$1")},Alipay:function(){return f.replace(/^.*AliApp\(AP\/([\d.]+).*$/,"$1")},Weibo:function(){return f.replace(/^.*weibo__([\d.]+).*$/,"$1")},Douban:function(){return f.replace(/^.*com.douban.frodo\/([\d.]+).*$/,"$1")},Suning:function(){return f.replace(/^.*SNEBUY-APP([\d.]+).*$/,"$1")},iQiYi:function(){return f.replace(/^.*IqiyiVersion\/([\d.]+).*$/,"$1")},DingTalk:function(){return f.replace(/^.*DingTalk\/([\d.]+).*$/,"$1")},Huawei:function(){return f.replace(/^.*Version\/([\d.]+).*$/,"$1").replace(/^.*HuaweiBrowser\/([\d.]+).*$/,"$1")}},this.versionFuncs[this.browser]){var t=this.versionFuncs[this.browser]();t!==f&&(this.version.major=parseInt(t),this.version.full=t)}}},{key:"amendSpecialCase",value:function(){if("Chrome"==this.browser&&f.match(/\S+Browser/)){this.browser=f.match(/\S+Browser/)[0];var t=f.replace(/^.*Browser\/([\d.]+).*$/,"$1");this.version.major=parseInt(t),this.version.full=t}if("Firefox"!=this.browser||!window.clientInformation&&window.u2f||(this.kernel=this.browser,this.kernelVersion=this.version.major,this.browser+=" Nightly"),"Edge"==this.browser)this.version.major>75?(this.kernel="Chrome",this.kernelVersion=parseInt(this.versionFuncs.Chrome())):(this.kernel="EdgeHTML",this.kernelVersion=0);else if(this.matches.Chrome&&"WebKit"===this.kernel&&parseInt(this.versionFuncs.Chrome())>27)this.kernel="Chrome",this.kernelVersion=parseInt(this.versionFuncs.Chrome());else if("Opera"==this.browser&&this.version.major>12)this.kernel="Chrome",this.kernelVersion=parseInt(this.versionFuncs.Chrome());else if("Yandex"==this.browser)this.kernel="Chrome",this.kernelVersion=parseInt(this.versionFuncs.Chrome());else if(this.matches.Safari&&"WebKit"===this.kernel){var e=f.replace(/^.*Version\/([\d.]+).*$/,"$1");e===f&&(e=f.replace(/^.*AppleWebKit\/([\d.]+).*$/,"$1")),this.kernelVersion=parseInt(e)||0}}},{key:"is360",value:function(){var t=!1;if(window.chrome){var e=Number(f.replace(/^.*Chrome\/([\d]+).*$/,"$1"));this.mime("type","application/360softmgrplugin")||this.mime("type","application/mozilla-npqihooquicklogin")||e>36&&window.showModalDialog?t=!0:e>45&&((t=this.mime("type","application/vnd.chromium.remoting-viewer"))||!(e>=69)||(t=this.mime("type","application/hwepass2001.installepass2001")||this.mime("type","application/asx")))}return t}},{key:"mime",value:function(t,e){var i=navigator.mimeTypes;for(var s in i)if(i[s][t]==e)return!0;return!1}}]),t}()),m=i(18),_=i(20),y=i(14);function v(t){return function(t){if(Array.isArray(t))return Object(m.a)(t)}(t)||Object(_.a)(t)||Object(y.a)(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var S=d.BrowserImpl,g=d.TimeUtilImpl,T=99;function P(){return g.getDateTimeStr()+" "}var C=!1,E=!0,I={_data:[],_data2:[],_length:0,debug:function(){var t=P(),e=Array.apply(null,arguments);e[0]=t+e[0],T<=-1&&console.log.apply(console,e)},log:function(t){var e=P(),i=Array.apply(null,arguments);i[0]=e+i[0],T<=0&&console.log.apply(console,i),I.record(i,"log")},info:function(t){var e=P(),i=Array.apply(null,arguments);i[0]=e+i[0],T<=1&&console.info.apply(console,i),I.record(i,"info")},warn:function(t){var e=P(),i=Array.apply(null,arguments);i[0]=e+i[0],T<=2&&console.warn.apply(console,i),I.record(i,"warn")},error:function(t){var e=P(),i=Array.apply(null,arguments);i[0]=e+i[0],T<=3&&console.error.apply(console,i),I.record(i,"error")},group:function(t){var e=P(),i=Array.apply(null,arguments);i[0]=e+i[0],T<=1&&(console.groupCollapsed||console.group||console.log).apply(console,i),I.record(i,"group")},groupEnd:function(){console.groupEnd&&console.groupEnd.apply(console)}
1,setLevel:function(t){t!=T&&(console.log(P()+" set log level from "+T+" to "+t),T=t)},getLevel:function(){return T},record:function(t,e){if(E){var i=F.logMaxLen||1e3;I._length===i+100&&(I._data.splice(0,100),I._data2.splice(0,100),I._length=i);var s=0,r=(t.shift()||"").toString();for(r=r.replace(/\%c/gi,function(t,e){return s++,""});s--&&t.length;)t.shift();for(var a=0,n=t.length;a<n;a++)"object"==typeof t[a]&&(t[a]="");t.unshift(r);var o=t.join(" ");I._length++,I._data.push("[".concat(e,"]").concat(o)),I._data2.push("[".concat(e,"]").concat(o))}},getLog:function(){return C||(C=!0,I._data.unshift(S.platform+" "+S.name+" "+S.version.string)),I._data},getNewLog:function(){C||(C=!0,I._data2.unshift(S.platform+" "+S.name+" "+S.version.string));var t=v(I._data2);return I._data2.length=0,t},logcss:function(t,e,i){var s="font-weight:900";return t&&(s+=";color:"+t),e&&(s+=";background:"+e),i&&(s+=";border:3px solid "+i),s},padNum:function(t,e){var i=Math.max(0,e-t.toString().length);return"0".repeat(i)+t},setLogFlag:function(t){E=t},loggerCallback:function(){var t=Array.apply(null,arguments);I.log("HYCodec.setLogCallback",t.join(" "))}},k=function(){function t(){Object(s.a)(this,t)}return Object(r.a)(t,null,[{key:"getMediaSource",value:function(t){return window.ManagedMediaSource&&t?window.ManagedMediaSource:window.MediaSource?window.MediaSource:null}},{key:"isManagedMediaSource",value:function(t){return t===window.ManagedMediaSource}}]),t}(),A={AVC1:"avc1.42E01E,mp4a.40.2",HVC1:"hvc1.1.6.L93,mp4a.40.2",AV01:"av01.0.08M.08,mp4a.40.2",isMseSupportedH264:function(){return this._isSupported(this.AVC1)},isMseSupportedHevc:function(){return this._isSupported(this.HVC1)},isMseSupportedAV01:function(){return this._isSupported(this.AV01)},_isSupported:function(t){var e=k.getMediaSource(F.mmsOpen);return e&&e.isTypeSupported("video/mp4; codecs=".concat(t))}},R={KEY_VALUE:"value",KEY_STR:"str",KEY_DIM:"dim",K:"k",LIVE_TYPE:{FLV:0,P2P:1,HLS:2},HEART_TYPE:{START:0,CONTINUS:1,END:2},DIM_COM:{SDK_VER:"sdk_ver",P2P:"p2p",AD_BLOCK:"ad_block",STAT_BW_FLAG:"stat_bw_flag",OEXP:"oexp",MPS_CROSS:"mps_cross",STREAM_URL:"stream_url",STREAM_302_URL:"stream_302_url",CDNDOMAIN:"cdndomain",USER_UUID:"user_uuid",STREAM:"stream",CDNP_CONNECT_IP:"cdnp_connect_ip",CDNP_CONNECTED:"cdnp_connected",CDP_ID:"cdp_id",USER_WAN_IP:"user_wan_ip",VIDEO_LOGIN_FAIL:"video_login_fail",ORIGINAL_BITRATE:"original_bitrate",BROWSER_NAME:"browser_name",BROWSER_VERSION:"browser_version",BROWSER_KERNEL:"browser_kernel",BROWSER_KERNEL_VERSION:"browser_kernel_version",OS_NAME:"os_name",OS_VERSION:"os_version",RENDER_INFO:"render_info",SPHD_TYPE:"sphd_type",DPI:"dpi",CDNIP:"cdnip",AUTO_BITRATE:"auto_bitrate",P2P_COOL_FLAG:"p2p_cool_flag",MP_EXPERIMENT:"mp_experiment",ACT_LOAD_TYPE:"act_load_type",STREAM_INDEX:"stream_index",OBS_RENDER_MODE:"obs_render_mode",PLAYER_TYPE:"player_type",LIVE_TYPE:"live_type",STREAM_TYPE:"stream_type",HLS_TYPE:"hls_type",VR_ENABLE:"vr_enable",VR_MODE:"vr_mode",CODEC_TYPE:"codec_type",SUPPORT_AV1:"support_av1",BITREATE_AV1_SUPPORT:"bitreate_av1_support",SRE_SUPPORT_AV1:"sre_support_av1",CDN_CIP:"cdn_cip",CDN_SIP:"cdn_sip",ALT_SVC:"alt_svc",QUIC:"quic",START_TYPE:"start_type",PCDN_ORIGIN:"pcdn_origin",EXPECT_PCDN_NAME:"expect_pcdn_name",CLI_ISP:"cli_isp",CLI_PROV:"cli_prov",SUB_PCDN_STATE:"sub_pcdn_state",STREAM_TOTAL_DURATION:"stream_total_duration",CODERATE_BPS:"coderatebps",LINE:"line",CODERATE:"coderate",VOD_CODERATE:"vod_coderate",PLAYBACK_RATE:"playbackrate",ANCHOR_UID:"anchoruid",FLV_PCDN_STATE:"flv_pcdn_state",H265:"h265",V_DECODEC:"v_decodec",V_RECV_FRAME:"v_recv_frames",V_TO_DECODE_FRAMES:"v_to_decode_frames",V_DECODE_FRAME:"v_decode_frames",V_PLAY_FRAME:"v_play_frame",V_TO_PLAY_FRAME:"v_to_play_frames",AV_DELTA:"av_delta",A_RENDER_SILENCE_TIME:"a_render_silence_time",SIGNAL_RTT:"signal_rtt",SIGNAL_RTT_MAX:"signal_rtt_max",CDNP_RTT:"cdnp_rtt",CDNP_RTT_MAX:"cdnp_rtt_max",SUB_CHANGE_STATE:"sub_change_state",FORCE_SUB_TYPE:"force_sub_type",USE_PCDN:"use_pcdn",MUTE_DATA:"mute_data",VISIBILITY_STATE:"visibility_state",SESSION_ID:"session_id",VIDEO_MIN_BUF:"video_min_buf",AUTO_VERSION:"auto_version",MSE_PLAYER:"mse_player",DECODE_HARDWARE_ACCELERATION:"decode_hardware_acceleration",HARDWARE_CONCURRENCY:"hardware_concurrency",START_CODERATEBPS:"start_coderatebps",DEFAULT_BITRATEBPS:"default_bitratebps",MEMORY_BITRATEBPS:"memory_bitratebps",RECOMMEND_BITRATEBPS:"recommend_bitratebps",AUTO_USER_TAGS:"auto_user_tags",AUTO_OPEN:"auto_open",V_RECV_FRAMES:"v_recv_frames",H265_SUPPORT_REASON:"h265_support_reason",PLACE:"place",PULLSTREAM_REASOM:"pullstream_reason",VIDEO_PAUSE_BUFFERS:"video_pause_buffers",VIDEO_PAUSE_CONTINUE_BUFFERS:"video_pause_continue_buffers",HARD
1DECODE:"harddecode",DECODE_SUPPORT:"deocode_support",IS_TIE_STREAM:"is_tie_stream",IS_REDIRECT:"is_redirect",CLOSE_EXTSTREAM:"close_extstream",MOSAIC_DATA:"mosaic_data",PCDN_IAAS:"pcdn_iaas",P2P_TO_FLV_DOMAIN:"p2p_to_flv_domain",DECODE_CAPABILITY:"decode_capability",WEBCODECS_BACK_REASON:"webcodecs_back_reason",STREAM_FORMAT:"stream_format",A_CFG:"a_cfg",IS_MUTE:"is_mute",IS_MOSAIC:"is_mosaic",I_GPU:"i_gpu",P_IAAS_INFO:"p_iaas_info",UA:"ua",IAAS_BW_INFO:"iaas_bw_info",IS_PAID_ROOM:"is_paid_room",SUB_STATA_INFO:"sub_state_info",PSUB_PROXY_INFO:"psub_proxy_info",I_AVC_CHANGE:"i_avc_change",FEATURE_STATUS:"features_status",V_ENHANCE_TYPE:"v_enhance_type",V_ENHANCE_ENTRY:"v_enhance_entry",ENHANCE_BACK_REASON:"enhance_back_reason",FRAMERATE:"framerate",GAMEID:"gameid",NAT:"nat",NAT_SYNC:"nat_sync",MPS_STATUS:"mps_status",IP_STACK_TYPE:"ip_stack_type",TEAM_PORT:"team_port"},DIM_CORE:{V_BAD_FRONT:"v_bad_front",REPROT_TIME:"reprot_time",BATCH_ID:"batch_id",REPORT_TYPE:"report_type",CREATE_TIME:"create_time",VIDEO_BAD_QUALITY_OLD:"video_bad_quality_old",VIDEO_BAD_QUALITY:"video_bad_quality",VIDEO_BAD_REASON:"video_bad_reason",USER_PROPERTY:"user_property",HEART_TYPE:"heart_type",SIGNAL_USER_PROPERTY:"signal_user_property",F_BUF:"f_buf",VTDAVG:"vtdavg",VTDMAX:"vtdmax",ATDAVG:"atdavg",ATDMAX:"atdmax",VRTADE:"vrtade",VRTADEMAX:"vrtademax",VATRDE:"vatrde",VATRDEMAX:"vatrdemax",ARTADE:"artade",ARTADEMAX:"artademax",AATRDE:"aatrde",AATRDEMAX:"aatrdemax",VRDFPS:"vrdfps",VRCFPS:"vrcfps",VDF:"vdf",PFPS:"pfps",PFPSMAX:"pfpsmax",PFPSMIN:"pfpsmin",VRBQ:"vrbq",VRBQC:"vrbqc",VRBQD:"vrbqd",AVSDA:"avsda",AVSDM:"avsdm",AVEFS:"avefs",VIDEO_H265_BAD_QUALITY:"video_h265_bad_quality",AUTO_U_REASON:"auto_u_reason",AUTO_D_REASON:"auto_down_reason",AUTO_HEART_TYPE:"auto_heart_type",AUTO_CODEC_CHANGE_TYPE:"auto_codec_change_type",AUTO_BAD_REASON:"auto_bad_reason",AUTO_BAD_MIN_REASON:"auto_bad_min_reason",DISPATCH_ID:"dispatch_id",PCDN_SVR_ISP:"pcdn_svr_isp",PCDN_SVR_AREA:"pcdn_svr_area",UNOPEND_CPFLV_BW:"unopend_cpflv_bw",NORETURN_CPFLV_BW:"noreturn_cpflv_bw",UNSUPPORT_CPFLV_BW:"unsupport_cpflv_bw",LOAD_LIB_CPFLV_BW:"load_lib_cpflv_bw",GATHER_CPFLV_BW:"gather_cpflv_bw",GATHER_FAIL_CPFLV_BW:"gather_fail_cpflv_bw",LOAD_SUC_CPFLV_BW:"load_suc_cpflv_bw",ERROR_CPFLV_BW:"error_cpflv_bw",KICK_CPFLV_BW:"kick_cpflv_bw",WAIT_CDN_LOAD_CPFLV_BW:"wait_cdn_load_cpflv_bw",DTS_ERROR_CPFLV_BW:"dts_error_cpflv_bw",OTHER_CPFLV_BW:"other_cpflv_bw",ENHANCE_TOTAL:"enhance_total",ENHACNE_LESS_30:"enhance_less_30",ENHACNE_LESS_150:"enhance_less_150",ENHACNE_LESS_200:"enhance_less_200",ENHACNE_LARGE_200:"enhance_large_200"},PCDN_DATA:{GET_PCDN_URL_TOTAL_CNT:"get_pcdn_url_total_cnt",GET_PCDN_URL_SUCCESS:"get_pcdn_url_success",GET_PCDN_URL_SUC_FREETIME:"get_pcdn_url_suc_freetime",GET_PCDN_ERR_NOT_REACHED:"get_pcdn_err_not_reached",GET_PCDN_ERR_OVER_RUN:"get_pcdn_err_over_run",GET_PCDN_ERR_OVER_RUN_FREETIME:"get_pcdn_err_over_run_freetime",GET_PCDN_ERR_NOT_COVERD:"get_pcdn_err_not_coverd",GET_PCDN_ERR_OTHER:"get_pcdn_err_other",GET_PCDN_ERROR_REQ:"get_pcdn_err_req",GET_SUBS_URL_ERROR_CNT:"get_subs_url_error_cnt",GET_PCDN_DATA_TIME:"get_pcdn_data_time",GET_PCDN_DATA_TIME_CNT:"get_pcdn_data_time_cnt",GET_PCDN_SUBS_URL_TIME:"get_pcdn_subs_url_time",GET_PCDN_SUBS_URL_TIME_CNT:"get_pcdn_subs_url_time_cnt",GET_CDN_DATA_TIME:"get_cdn_data_time",GET_CDN_DATA_TIME_CNT:"get_cdn_data_time_cnt",PCDN_REPEAT_BW:"pcdn_repeat_bw",USE_PCDN:"use_pcdn"},DIM_LINK_STA:{name:"link_sta",CONNECT_SUC:"cns",HAS_DATA:"hd",DATA_ENOUGH:"de",AUDIO_CONFIG:"acf",VIDEO_CONFIG:"vcf",VIDEO_IFRAME:"vif",VIDEO_FRAME:"vf",AUDIO_FRAME:"af",NO_SLICE_DATA:"nsd",H265:"h265"},DIM_LINK_SAM:{name:"link_sam",AUDIO_DTS:"ad",VIDEO_DTS:"vd",AUDIO_RATE:"ar",VIDEO_RATE:"vr",AUDIO_WAIT_PUSH:"awp",VIDEO_WAIT_PUSH:"vwp",AUDIO_WAIT_REASON:"awr",VIDEO_WAIT_REASON:"vwr",AUDIO_WAIT_GAP:"awg",VIDEO_WAIT_GAP:"vwg",VIDEO_DROP_FRAMES:"vdf",VIDEO_AUDIO_GAP:"vag",VIDEO_BUFFER_EMPTY_TIME:"vbet",VIDEO_BUFFER_EMPTY_COUNT:"vbec",SPEED:"sp"},DIM_H265_SAM:{name:"h265_sam",decode_fps:"decode_fps",render_fps:"render_fps",frame_list_len:"frame_list_len"},DIM_EXT:{CDN_IP:"cdn_ip"},CORE:{name:"yspwl.web.live.user.heart20",PUNCHED_UUIDS:"punched_uuids",MPS_SUBS:"mps_subs",MPS_SRC:"mps_src",MPS_UP:"mps_up",MPS_SRC_BW:"mps_src_bw",MPS_UP_BW:"mps_up_bw",HTD:"htd",AUDIO_CNT:"audio_cnt",BIG_AUDIO_CNT:"big_audio_cnt",A_VOL:"a_vol",A_E_DUR:"a_e_dur",A_E_CNT:"a_e_cnt",V_CAPTURE_JITTERS:"v_c
1apture_jitters",V_CAPTURE_JITTER_MAX:"v_capture_jitter_max",V_CTS_MAX:"v_cts_max",A_CAPTURE_JITTERS:"a_capture_jitters",A_CAPTURE_JITTER_MAX:"a_capture_jitter_max",STAT_BW:"stat_bw",CDN_TOTAL_BW:"cdn_total_bw",CDN_VALID_BW:"cdn_valid_bw",CDN_REPEAT_BW:"cdn_repeat_bw",P2P_TOTAL_BW:"p2p_total_bw",P2P_REPEAT_BW:"p2p_repeat_bw",P2P_VALID_BW:"p2p_valid_bw",RANGE_TOTAL_BW:"range_total_bw",RANGE_VALID_BW:"range_valid_bw",PEER_RANGE_TOTAL_BW:"peer_range_total_bw",PEER_RANGE_VALID_BW:"peer_range_valid_bw",PEER_RANGE_REPEAT_BW:"peer_range_repeat_bw",DEFAULT_BW:"default_bw",FAST_BW:"fast_bw",PATCH_BW:"patch_bw",COMPETE_BW:"compete_bw",FIXED_BW:"fixed_bw",FORCE_BW:"force_bw",SIGNAL_UP_BW:"signal_up_bw",SIGNAL_DOWN_BW:"signal_down_bw",ENC_FLOW:"enc_flow",DEC_FLOW:"dec_flow",DEC_OK_CNT:"dec_ok_cnt",DEC_FAIL_CNT:"dec_fail_cnt",BUFFER_LENGTH:"buffer_length",PLAY_DELAY:"play_delay",DELAY_ANCHOR:"delay_anchor",DELAY_SERVER:"delay_server",DELAY_NET:"delay_net",SVR_DELAY_INFOS:"svr_delay_infos",DELAY_NODE_INFO:"delay_node_info",SVR_LAST_P_DELAY:"svr_last_p_delay",UPLOADER_TYPE:"uploader_type",ENCODER_SOURCE:"encoder_source",OBS_FPS:"obs_fps",OBS_UPLOAD_TS:"obs_upload_ts",VIDEO_BLOCK_COUNT:"video_block_count",VIDEO_BLOCK_DURATION:"video_block_duration",VIDEO_BAD_BUFFER:"video_bad_buffer",VIDEO_CONTINUE_BUFFER:"video_continue_buffer",PRTTCNT:"prttcnt",PRSUCNT:"prsucnt",PRNNCnt:"prnncnt",PRTOCNT:"prtocnt",PRFTCNT:"prftcnt",PRFSCNT:"prfscnt",PRNPID:"prnpid",PRNSDK:"prnsdk",PRNPUB:"prnpub",PRNSUB:"prnsub",PRNPEER:"prnpeer",PRNSTREAM:"prnstream",PRNLATE:"prnlate",PRNRTT:"prnrtt",PRNNONE:"prnnone",AUTO_SWITCH_CNT:"auto_switch_cnt",AUTO_SWITCH_SAME_CNT:"auto_switch_same_cnt",AUTO_BAD_QUALITY:"auto_bad_quality",AUTO_BAD_QUALITY_UP:"auto_bad_quality_up",AUTO_BAD_DURATION:"auto_bad_duration",AUTO_BAD_DURATION_UP:"auto_bad_duration_up",AUTO_BAD_SWITCH:"auto_bad_switch",AUTO_BAD_SWITCH_SAME:"auto_bad_switch_same",AUTO_BAD_SWITCH_UP:"auto_bad_switch_up",AUTO_BAD_DONE:"auto_bad_done",AUTO_BAD_BUFFER:"auto_bad_buffer",AUTO_CONTINUE_BUFFER:"auto_continue_buffer",PCDN_TOTAL_BW:"pcdn_total_bw",PCDN_FREETIME_BW:"pcdn_freetime_bw",PCDN_REALTIME_BW:"pcdn_realtime_bw",SWITCH_CDN_CNT:"switch_cdn_cnt",GET_STREAM_CNT:"get_stream_cnt",GET_STREAM_ERROR_CNT:"get_stream_error_cnt",GET_STREAM_LINK_ERROR_CNT:"get_stream_link_error_cnt",GET_STREAM_LINK_TIMEOUT_CNT:"get_stream_link_timeout_cnt",GET_STREAM_LOW_DATA_CNT:"get_stream_low_data_cnt",REAL_KBPS_SAMPLE:"real_kbps_sample",REAL_FLAC_KBPS_SAMPLE:"real_flac_kbps_sample",RECV_TOTAL_SAMPLE:"recv_total_sample",RECV_LAN_SAMPLE:"recv_lan_sample",HAS_PUNCH_NODES:"has_punch_nodes",HAS_PUNCH_NODES_SDKV2:"has_punch_nodes_sdkv2",HAS_PUNCH_NODES_WEBV2:"has_punch_nodes_webv2",HAS_PUNCH_NODES_MEDIA:"has_punch_nodes_media",HAS_PUNCH_NODES_SIGNAL:"has_punch_nodes_signal",FORWARD_REJECT_CNT
1:"forward_reject_cnt",FRAME_BUFFER_DELAY:"frame_buffer_delay",STREAM_BUFFERED:"stream_buffered",RANGE_SIP_SUC_CNT:"range_sip_suc_cnt",RANGE_SIP_DIF_CNT:"range_sip_dif_cnt",RANGE_REQ_CNT:"range_req_cnt",RANGE_RSP_CNT:"range_rsp_cnt",RANGE_CONNECT_TIME:"range_connect_time",RANGE_RSP_TIME:"range_rsp_time",VISIBILITY_HIDDEN_TIME:"visibility_hidden_time",VIDEO_PERFPAUSE_CONTINUE_CNT:"video_perfpause_continue_cnt",VIDEO_PERFPAUSE_CNT:"video_perfpause_cnt",FULL_CDN_CNT:"full_cdn_cnt",SUB_CDN_CNT:"sub_cdn_cnt",PATCH_CDN_CNT:"patch_cdn_cnt",MOSAIC_DURATION:"mosaic_duration",MOSAIC_COUNT:"mosaic_count",MUTE_DURATION:"mute_duration",MUTE_COUNT:"mute_count",USED_XP2P:"used_xp2p"},VIDEO_LINK:{PVSSC:"pvssc",PVFSC:"pvfsc",PVLSC:"pvlsc",PVLFC:"pvlfc",PVPFC:"pvpfc",PVPTC:"pvptc",PVPAFC:"pvpafc",PVRFC:"pvrfc"},UPDOWN_INFO:{name:"updown_info",UPLINK_BW:"uplink_bw",DOWNLINK_BW:"downlink_bw",UPLINK_CNT:"uplink_cnt",UPLINK_LIMIT_CNT:"uplink_limit_cnt"},SIGNAL_HEART20:{name:"yspwl.web.live.signal.heart20",STREAM_NAME:"stream_name",STREAM_DELAY:"stream_delay",FULL_FRAME_NUM:"full_frame_num",LOST_FRAME_NUM:"lost_frame_num",P2P_FLOW_DANMU:"p2p_flow_danmu",P2P_FLOW_EMPTY:"p2p_flow_empty",RESEND_TOTAL_CNT:"resend_total_cnt",RESEND_TIMEOUT_CNT:"resend_timeout_cnt",RESEND_ERROR_CNT:"resend_error_cnt",MIN_DELAY:"min_delay",MAX_DELAY:"max_delay",AVE_DELAY:"ave_delay",SER_2_REC_DELAY:"ser_2_rec_delay",REC_2_MERGE_DELAY:"rec_2_merge_delay",MERGE_2_NOTIFY_DELAY:"merge_2_notify_delay",CDN_FLOW_DANMU_VALID:"cdn_flow_danmu_valid",CDN_FLOW_DANMU_TOTAL:"cdn_flow_danmu_total",CDN_FLOW_EMPTY_VALID:"cdn_flow_empty_valid",CDN_FLOW_EMPTY_TOTAL:"cdn_flow_empty_total"},HLS_INFO:{name:"hls_info",M3U8_CNT:"m3u8_cnt",M3U8_SUC_CNT:"m3u8_suc_cnt",M3U8_FAIL_CNT:"m3u8_fail_cnt",M3U8_EMPTY_CNT:"m3u8_empty_cnt",M3U8_WRONG_CNT:"m3u8_wrong_cnt",M3U8_TIMEOUT_CNT:"m3u8_timeout_cnt",TS_CNT:"ts_cnt",TS_SUC_CNT:"ts_suc_cnt",TS_FAIL_CNT:"ts_fail_cnt",TS_TIMEOUT_CNT:"ts_timeout_cnt",TS_OPEN_AVG:"ts_open_avg",TS_LOADED_AVG:"ts_loaded_avg",TS_SPEED_AVG:"ts_speed_avg",TS_SIZE_AVG:"ts_size_avg"},FRAME_INFO:{name:"frame_info",LATE_SEQS:"late_seqs",LOSS_FRAMES:"loss_frames",PLAY_FRAMES:"play_frames",DTS_JUMPPAUSE_CNT:"dts_jumppause_cnt",SKIP_PAUSE_CNT:"skip_pause_cnt",EMPTY_FRAMES:"empty_frames",FULL_RATIO:"full_ratio"},SUB_INFO:{name:"sub_info",TOTAL_CNT:"total_cnt",SUCC_CNT:"succ_cnt",FAIL_CNT:"fail_cnt",TIMEOUT_CNT:"timeout_cnt",KICK_CNT:"kick_cnt",TRY_CNT:"try_cnt",CMP_TOTAL_CNT:"cmp_total_cnt",CMP_SUCC_CNT:"cmp_succ_cnt",CMP_FAIL_CNT:"cmp_fail_cnt",CMP_TIMEOUT_CNT:"cmp_timeout_cnt",FORCE_CNT:"force_cnt"},PUNCH_INFO:{name:"punch_info",TOTAL_CNT:"total_cnt",VALID_CNT:"valid_cnt",TRY_CNT:"try_cnt",SUCC_CNT:"succ_cnt",BACK_CNT:"back_cnt",BACK_SUCC_CNT:"back_succ_cnt",BACK_TRY_CNT:"back_try_cnt"},PUNCH_BACK_RET:{name:"punch_back_ret"},RESEND_INFO:{name:"resend_info",RESEND_CNT:"resend_cnt",TIMEOUT_CNT:"timeout_cnt",ERROR_CNT:"error_cnt",SLICE_CNT:"slice_cnt",RESPOND_CNT:"respond_cnt",LATE_CNT:"late_cnt",MISS_CNT:"miss_cnt",REPEAT_CNT:"repeat_cnt",REPEAT_SUCC_CNT:"repeat_succ_cnt",REPEAT_FAIL_CNT:"repeat_fail_cnt",LIMIT_CNT:"limit_cnt"},SUBSTREAM_INFO:{name:"substream_info",FIXED_CNT:"fixed_cnt",FORCE_CNT:"force_cnt",COMPETE_CNT:"compete_cnt"},FORCESUB_REASON:{name:"forcesub_reason",NOPEER_CNT:"nopeer_cnt",SUBEND_CNT:"subend_cnt",TIMEOUT_CNT:"timeout_cnt"},SUB_RETURN:{sub_name:"sub_return",switch_name:"switch_return",last_name:"last_return"},NONODE_RETURN:{name:"nonode_return",PRESENTER_CNT:"presenter_cnt",UPLINK_LESS_CNT:"uplink_less_cnt",PULL_SAME_CNT:"pull_same_cnt",SUBED_CNT:"subed_cnt",COOL_CNT:"cool_cnt",DELAY_CNT:"delay_cnt",RTT_CNT:"rtt_cnt",LATE_CNT:"late_cnt",FAST_CNT:"fast_cnt",NONE_CNT:"none_cnt"},AUTO_INFO:{name:"auto_info",UP_CNT:"up_cnt",DOWN_CNT:"down_cnt",BACK_CNT:"back_cnt"},P2P_TCP_TYPE:{name:"p2p_tcp_type"},P2P_TCP_STATE:{name:"p2p_tcp_state"},PCDN_BW_DATA:{name:"pcdn_bw_data"},AI_CONTROL_DATA:{name:"ai_control_data",AI_P2P_CNT:"ai_p2p_cnt",AI_FLV_CNT:"ai_flv_cnt",AI_P2P_TIMEOUT_CNT:"ai_p2p_timeout_cnt",AI_FLV_TIMEOUT_CNT:"ai_flv_timeout_cnt",AI_P2P_ERROR_CNT:"ai_p2p_error_cnt",AI_FLV_ERROR_CNT:"ai_flv_error_cnt",AI_P2P_SWITCH_CNT:"ai_p2p_switch_cnt",AI_FLV_SWITCH_CNT:"ai_flv_switch_cnt",AI_P2P_NOT_SWITCH_CNT:"ai_p2p_not_switch_cnt",AI_FLV_NOT_SWITCH_CNT:"ai_flv_not_switch_cnt",AI_FLV_ERROR_SWITCH_CNT:"ai_flv_error_switch_cnt",AI_FLV_ERROR_NOT_SWITCH_CNT:"ai_flv_error_not_switch_cntï¼flv",AI_START_P2P_CNT
1:"ai_start_p2p_cnt",AI_START_FLV_CNT:"ai_start_flv_cnt"},ACT:{name:"yspwl.web.live.user.act",field:"act_type",SWITCH_BITRATE:"switch_bitrate",SWITCH_AUTO:"switch_auto",SWITCH_LINE:"switch_line",SWITCH_PTS:"switch_pts",FAST_SAMPLE:"fast_sample",NO_PICTURE:"no_picture",NO_PICTURE_ALL:"no_picture_all",NO_PICTURE_P2P:"no_picture_p2p",LINK_STA:"link_sta",HLS_PLAY_SUCC:"hls_play_succ",HLS_LOAD_SUCC:"hls_load_succ",P2P_PLAY_FAIL:"p2p_play_fail",P2P_LOAD_VIDEO:"p2p_load_video",P2P_RESTART:"p2p_restart",TCP_NO_SLICE:"tcp_no_slice",TCP_OPEN_TIME:"tcp_open_time",HTTP_CODE_:"http_code_",HTTP_CLOSE:"http_close",TCP_TIMEOUT:"tcp_timeout",P2P_COOLING:"p2p_cooling",CONNECT_VIDEO_TS:"connect_video_ts",RECV_VIDEO_TS:"recv_video_ts",FIRST_VIDEO_PKG_TS:"first_video_pkg_ts",FIRST_VIDEO_IFRAME_TS:"first_video_iframe_ts",VIDEO_IFRAME_TS:"video_iframe_ts",FIRST_VIDEO_RENDER_TS:"first_video_render_ts",VIDEO_PLAYED_TS:"video_played_ts",VIDEO_LOAD_TS:"video_load_ts",VIDEO_LOAD_SEG:"video_load_seg",VIDEO_LOAD_TS_ALL:"video_load_ts_all",VIDEO_LOAD_TS_V2:"video_load_ts_v2",AUTO_TEST_RESULT:"auto_test_result",VIDEO_GET_VP_TS:"video_get_vp_ts",VIDEO_LOGIN_TS:"video_login_ts",LOAD_M3U8_TS:"load_m3u8_ts",FIRST_FRAG_LOAD_TS:"first_frag_load_ts",FIRST_FRAG_LOADED_TS:"first_frag_loaded_ts",FIRST_FRAG_SIZE:"first_frag_size",SIGNAL_TURN_BACK:"signal_turn_back",SWITCH_COST:"switch_cost",OB_BG_DURATION:"ob_bg_duration",LOAD_P2PLIB_ERROR:"load_p2plib_error",LOAD_PCDNLIB_ERROR:"load_pcdnlib_error",PCDN_TO_CDN:"pcdn_to_cdn",MUTE_STATUS:"mute_status",NO_PICTURE2:"no_picture2",H265_WORKER_LOAD_TS:"h265_worker_load_ts",H265_STATUS:"h265_status",MOSAIC_STATUS:"mosaic_status",AI_P2P_FLV_SWITCH:"ai_p2p_flv_switch",BLOCK_BAD:"block_bad",SWITCH_AUDIO_RES:"switch_audio_res"},VOD_ACT:{name:"yspwl.web.vod.user.act"},VOD_CORE:{name:"yspwl.web.vod.user.heart20",AV1_SVR:"av1_svr",AV1_SPT:"av1_spt",AV1_USE:"av1_use",VOD_BAD_QUALITY:"vod_bad_quality",VOD_BAD_REASON:"vod_bad_reason",VOD_NO_PICTURE:"vod_no_picture",VOD_NO_PICTURE_REASON:"vod_no_picture_reason",VOD_DTS_JUMP:"vod_dts_jump",V_BAD_FRONT:"v_bad_front",VOD_BLOCK_COUNT:"vod_block_count",VOD_BLOCK_DURATION:"vod_block_duration",M3U8_FILE_BW:"m3u8_file_bw",TS_PLAY_TIME:"ts_play_time",TS_SIZE:"ts_size",VOD_PCDN_STATE:"vod_pcdn_state",VIDEO_H265_BAD_QUALITY:"video_h265_bad_quality"},VOD_DIM_CORE:{TS_START_TIME:"ts_start_time",TS_END_TIME:"ts_end_time",ENHANCE_TOTAL:"enhance_total",ENHACNE_LESS_30:"enhance_less_30",ENHACNE_LESS_150:"enhance_less_150",ENHACNE_LESS_200:"enhance_less_200",ENHACNE_LARGE_200:"enhance_large_200"},VOD_DIM_COM:{VOD_VIDEOSOURCEID:"vod_videosourceid",VOD_CODERATE:"vod_coderate",VODANCHORID:"vodanchorid",STREAMTYPE:"streamtype",RESOURCE_TYPE:"resource_type",HAS_302:"has_302",VOD_FIRST_TS:"vod_first_ts",SGUID:"sguid",M3U8_FILE_BW:"m3u8_file_bw",VOD_AB_SWITCH:"vod_ab_switch",CREATE_TIME:"create_time",VOD_PLACE:"vod_place",VOD_MP4_SIZE:"vod_mp4_size",VOD_DURATION:"vod_duration",VOD_NO_PICTURE_REASON:"vod_no_picture_reason",LINE:"line",BACKUP_FIELD1:"backup_field1",BACKUP_FIELD2:"backup_field2",BACKUP_FIELD3:"backup_field3",BACKUP_FIELD4:"backup_field4",BACKUP_FIELD5:"backup_field5",BACKUP_FIELD6:"backup_field6",RENDER_INFO:"render_info",HARDWARE_CONCURRENCY:"hardware_concurrency",MSE_PLAYER:"mse_player",DECODE_HARDWARE_ACCELERATION:"decode_hard_acc",HARDDECODE:"harddecode",DECODE_SUPPORT:"deocode_support",DECODE_CAPABILITY:"decode_capability",WEBCODECS_BACK_REASON:"webcodecs_back_reason",I_GPU:"i_gpu",FEATURE_STATUS:"features_status",V_ENHANCE_TYPE:"v_enhance_type",V_ENHANCE_ENTRY:"v_enhance_entry",ENHANCE_BACK_REASON:"enhance_back_reason",FRAMERATE:"framerate",GAMEID:"gameid",PULLSTREAM_REASOM:"pullstream_reason",IS_MEMORY_GEAR:"is_memory_gear"},VOD_EXT_COM:{VID:"vid",CLIENT:"client",PID:"pid",BITRATE:"bitrate",DEFINITION:"definition",SCENE:"scene"},ROOM_HEART60:{name:"yspwl.sdk.liveroom.user.heart",DURATION:"duration",SESSION_ID:"session_id",ANCHORUID:"anchoruid",LINE:"line",CODERATE:"coderate",H265:"h265",P2P:"p2p",BLIVE:"blive",BUSI_PLAY:"busi_play",BUSI_STOP:"busi_stop",RNR_CNT:"rnr_cnt",RNR_DUR:"rnr_dur",RNR_DUR_MAX:"rnr_dur_max",SNR_INFOS:"snr_infos"}},D=function(){var t=null;try{t=window.localStorage}catch(e){t={removeItem:function(t){},getItem:function(t){return null},setItem:function(t,e){},clear:function(){}}}return t}
1(),O=function(){function t(){Object(s.a)(this,t)}return Object(r.a)(t,null,[{key:"turnStr",value:function(t,e,i){for(var s=t.toString(e),r=s.length;r<i;r++)s="0"+s;return s}},{key:"rotl64",value:function(e,i){var s=t.turnStr(e,2,64),r=s.substring(0,32),a=s.substring(32);return parseInt(r+(a.substr(i,32-i)+a.substr(0,i)),2)}},{key:"rotr64",value:function(e,i){var s=t.turnStr(e,2,64),r=s.substring(0,32),a=s.substring(32);return parseInt(r+(a.substr(32-i,i)+a.substr(0,32-i)),2)}},{key:"rotUid",value:function(e,i){return 0===e&&(e="1234"+t.turnStr(parseInt(9999*Math.random()),10,4)),isNaN(i)&&(i=0),e=parseInt(e),i=parseInt(i),t.rotl64(e,8)}},{key:"revertUid",value:function(e,i){return e=parseInt(e),t.rotr64(e,8)}},{key:"inet_ntoa",value:function(t){var e,i,s,r=new DataView(new Uint8Array(4).buffer);return r.setUint32(0,t),e=r.getUint8(0),i=r.getUint8(1),s=r.getUint8(2),r.getUint8(3)+"."+s+"."+i+"."+e}},{key:"ip2uint",value:function(t){for(var e=0,i=t.split("."),s=0;s<i.length;s++)e|=Number(i[s])<<8*s;return e<0&&(e+=0x100000000),e}},{key:"isBiggerUint",value:function(t,e){return t!==e&&(t>e?t-e<0x7fffffff:!(e-t<0x7fffffff))}},{key:"isEqualOrBiggerUint",value:function(t,e){return t===e||(t>e?t-e<0x7fffffff:!(e-t<0x7fffffff))}},{key:"isUintMax",value:function(t){return 0xffffffff===t}},{key:"isUint64Max",value:function(t){return 0xffffffffffffffff===t}},{key:"getQueryString",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=RegExp("(^|&)"+t+"=([^&]*)(&|$)"),s=(e||window.location.search.substr(1)).match(i);return null!=s?unescape(s[2]):null}},{key:"printHexBytes",value:function(t){for(var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=new DataView(t.buffer),s=10*!!e,r=[];s<i.byteLength;){var a=i.getUint8(s++);(a=a.toString(16).toUpperCase()).length<2&&(a="0"+a),r.push(a," "),s%10==0&&r.push("\n")}console.log(r.join("")+" size:",i.byteLength)}},{key:"getCookie",value:function(t){for(var e=t+"=",i=document.cookie.split(";"),s=0,r=i.length;s<r;s++){var a=i[s].trim();if(0==a.indexOf(e))return a.substr(e.length)}return""}},{key:"formatByteSize",value:function(t){var e=t/1024;return e>1024?(e/=1024).toFixed(1)+"MB":e.toFixed(1)+"KB"}},{key:"padStrLen",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t.length>=e)return t;var s=" ".repeat(e-t.length);return i?s+t:t+s}},{key:"xhr",value:function(t,e,i,s,r){var a=new XMLHttpRequest;a.overrideMimeType("text/plain; charset=x-user-defined"),a.addEventListener("readystatechange",function t(){4===a.readyState&&(200===a.status||304===a.status?s(a.response):r(a.status),a.removeEventListener("readystatechange",t),a=void 0)}),a.open(e,t,!0),a.send(i)}},{key:"getAv1Random",value:function(t,e){if(!t)return!1;var i=D.av1PresentUid,s=t.presenterUid;D.randomAv1Percent&&i==s||(D.randomAv1Percent=Math.floor(1e4*Math.random()));var r=Number(D.randomAv1Percent);return D.av1PresentUid=t.presenterUid,r<e}},{key:"is64bitSoftware",value:function(){return -1!=navigator.userAgent.indexOf("Macintosh")||-1!=navigator.userAgent.indexOf("x64")}},{key:"isGameIdSupport265",value:function(t,e){if(t[0])return!0;var i=!1;return t[1].map(function(t){e&&e.toString()==t.toString()&&(i=!0)}),i}},{key:"unescapeHTML",value:function(t){return(t=""+t).replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace("âµ","")}},{key:"getSdkAbRandom",value:function(t,e){var i=D.abPresentUid;D.randomAbPercent&&i==t.presenterUid||(D.randomAbPercent=Math.floor(1e4*Math.random()));var s=Number(D.randomAbPercent);return D.abPresentUid=t.presenterUid,s<e}},{key:"removeUrlParam",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t)return t;var i=t.split("?"),s=i[0],r=i.length>1?i[1]:"";if(!r)return t;for(var a={},n=r.split("&"),o=0;o<n.length;o++)n[o]=n[o].split("="),a[n[o][0]]=n[o][1];return e.forEach(function(t){r.indexOf(t)>-1&&delete a[t]}),s+JSON.stringify(a).replace(/[\"\{\}]/g,"").replace(/\:/g,"=").replace(/\,/g,"&")}},{key:"removeUrlAllParam",value:function(t){return t?t.split("?")[0]:t}},{key:"getBrowserHidden",value:function(){return document.hidden||document.webkitHidden||document.mozHidden||document.msHidden}},{key:"isWebCodecsSupported",value:function(){return"undefined"!=typeof VideoDecoder&&"undefined"!=typeof SharedArrayBuffer&&"undefined"!=typeof Atomics&&navigator.hardwareConcurrency>=F.webCodecCfg[0]}}
1,{key:"isManagerMediaSourceSupported",value:function(){return!!window.ManagedMediaSource||!!window.MediaSource}},{key:"isWebcodecsBrowserSupported",value:function(){var t=navigator.userAgent.toLowerCase(),e=-1!=t.indexOf("yabrowser")||-1!=t.indexOf("yowser");return"opera"!=S.name&&!e}},{key:"checkWebCodec",value:function(e,i,s){if(s&&!A.isMseSupportedHevc()||s&&0==F.vodH265Config[0]&&1!=e.liveType)return!1;var r=e.presenterUid,a=(e.uid,e.curBitrate);F.webCodecsAnchoruids.indexOf(Number(r))>=0&&F.enableWebCodec(),1!=e.liveType&&(2==e.liveType?-1!==F.replayWebcodecsGameIds.indexOf(e.gameId)&&F.enableVodWebCodecs():-1!==F.vodWebcodecsGameIds.indexOf(e.gameId)&&F.enableVodWebCodecs(),-1!==F.vodWebcodecsVids.indexOf(e.vid)&&F.enableVodWebCodecs());var n=a<=F.webCodecCfg[1],o=F.openWebcodec&&n;1!=e.liveType&&(o=F.vodOpenWebcodecs&&n,S.version.major<F.vodWcsBroCfg[0]&&(o=!1));var u=p.os||"",l=p.osVersion||"",d=!0;if("windows"==u.toLocaleLowerCase()&&Number(l)>=10&&-1!==S.name.indexOf("edg")&&S.version.major>=F.h265MseChromeConfig[0]&&s||"windows"==u.toLocaleLowerCase()&&Number(l)>=10&&-1!==S.name.indexOf("chrome")&&S.version.major>=F.h265MseChromeConfig[0]&&s?d=!0:s&&(d=!1),s&&(o=o&&d),-1!==F.wcs265BlackUids.indexOf(Number(e.uid))&&(o=!1),F.webCodecBlackUids.indexOf(Number(r))>=0&&(o=!1),F.wcsBlackAids.indexOf(Number(r))>=0&&(o=!1),-1!=F.wcsBlackBrowVers.indexOf(S.version.major)&&(o=!1,i.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,26)),-1!==F.wcs265BlackBrowVers.indexOf(S.version.major)&&s){o=!1;var c=F.bitrateBrowHard265Cfg[0],f=F.bitrateBrowHard265Cfg[1],m=F.bitrateBrowHard265Cfg[2];1==c&&e.curBitrate<=f&&-1!==m.indexOf(S.version.major)&&(o=!0),o||i.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,27)}return -1===F.wcs264BlackBrowVers.indexOf(S.version.major)||s||(o=!1,i.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,28)),I.log("Utils.checkWebCodec",F.wcs265BlackBrowNames,S.name),F.wcs265BlackBrowNames.map(function(t){-1!==S.name.indexOf(t)&&s&&(o=!1,i.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,32),I.log("Utils.checkWebCodec, Browser name close webcodecs!"))}),o=o&&t.isWebCodecsSupported(),1==Number(D._forceWebcodecs)&&(o=!0),1==Number(D._forceMse)&&(o=!1),o}},{key:"getDecodeMod",value:function(t,e,i){var s="mseh";return t?s="wcs":e?s="wasm":i&&(s=S.chrome&&S.version.major>104||"safari"==S.name?"mseh":"mses"),s}},{key:"getDMod",value:function(t,e){return"mseh"!==t&&"wcs"!==t&&"wasm"!==t&&"mses"!==t&&(t="unknow"),isNaN(e=Number(e))&&(e=0),"".concat(t,"-").concat(e)}},{key:"checkDMod",value:function(e,i,s){return -1===e.indexOf("&dMod=")&&(e+=-1===e.indexOf("?")?"?":"&",e+="dMod=".concat(t.getDMod(i,s))),e}},{key:"getAv1Support",value:function(t,e,i,s){var r=5;return t&&(r=e?i?2:s?3:4:1),r}},{key:"getSupportMod",value:function(e,i,s,r){var a=A.isMseSupportedHevc(),n=a&&S.chrome&&S.version.major>=F.h265MseChromeConfig[0],o=0;if(s&&(o|=64),3!==r&&4!==r||(o|=128),t.isWebCodecsSupported()&&(o|=1),e&&(o|=2),n&&(o|=8,t.isWebCodecsSupported()&&(o|=16)),a){var u=F.h265MseConfig[1];if(u.length>0){var l=S.version.major;S.chrome&&u.indexOf(l)>=0&&(o|=4)}}return i&&(o|=32),o}},{key:"isOpen",value:function(e,i,s){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=t.getCfgValue(e,i,s);return -1===a?r:100*Math.random()<a}},{key:"getCfgValue",value:function(e,i,s){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1;i+="|",s="line"+s+":";for(var a=(e+="").split(","),n="",o="",u=a.length,l=0;l<u;l++){var d=a[l];-1!==d.indexOf(i)?n=d.replace(i,""):-1!==d.indexOf("all|")&&(o=d.replace("all|",""))}var c=r,f=r;return""!==n&&(c=t.getLineValue(n,s,r)),""!==o&&(f=t.getLineValue(o,s,r)),c!==r?c:f!==r?f:r}},{key:"getLineValue",value:function(e,i){for(var s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=e.split("_"),a=r.length,n=s,o=s,u=0;u<a;u++){var l=r[u];-1!==l.indexOf("all")?n=t.getValue(l,s):-1!==l.indexOf(i)&&(o=t.getValue(l,s))}return o!==s?o:n!==s?n:s}},{key:"getValue",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=e,s=t.split(":");return s.length>1&&isNaN(i=parseInt(s[1]))&&(i=e),i}},{key:"isMseSupportedHevc",value:function(){return A.isMseSupportedHevc()}},{key:"isXiaomi",value:function(t){var e="mi "==(t=t.toLowerCase()).match(/mi\s/i)||"xiaomi"==t.match(/xiaomi/i)||"xiaomi"==t.match(/miuibrowser/i),i="mix "==t.match(/mix\s/i),s="redmi"==t.match(/redmi/i);return e||i||s}},{key:"urlInfoParams",value:function(e,i){return e+="&sv=".concat(0x9b0b2ddf,"&sdk_sid=").concat(i._sessionId,"&a_block=").concat(+(1===Number(i.adBlock))),t.isWupFail()&&(e+="&sf=1"),e}},{key:"isWupFail",value:function(){if(!D.hasOwnProperty("statInfo"))return!1;try{t=JSON.parse(D.statInfo)}catch(t){return!1}var t,e=Number(t.totalCnt),i=Number(t.failCnt);if(!(e>=0&&i>=0&&e>=i))return D.removeItem("statInfo"),!1;t.days&&"object"==typeof t.days||(t.days={},t.prevTotalCnt=e,t.prevFailCnt=i);var s=new Date,r=function(t){var e=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),s=String(t.getDate()).padStart(2,"0");return"".concat(e,"_").concat(i,"_").concat(s)},a=r(s),n=t.lastDayKey,o=Number(t.lastTotalCnt)||0,u=Number(t.lastFailCnt)||0;if(n&&n!==a){var l=o-(t.prevTotalCnt||0),d=u-(t.prevFailCnt||0);l>=0&&d>=0&&l>=d&&(t.days[n]={total:l,fail:d}),t.prevTotalCnt=o,t.prevFailCnt=u}for(var c=e-o,f=i-u,p=0,m=0,_=2;_>=1;_--){var y=new Date(s);y.setDate(y.getDate()-_);var v=r(y),S=t.days[v];S&&(p+=Number(S.total)||0,m+=Number(S.fail)||0)}c>=0&&f>=0&&c>=f&&(p+=c,m+=f);var g=!1;p>=F.wupFailCnt&&p>0&&(g=m/p*100>F.wupFailPer),t.lastDayKey=a,t.lastTotalCnt=e,t.lastFailCnt=i;for(var T=Object.keys(t.days).sort();T.length>7;)delete t.days[T.shift()];return D.setItem("statInfo",JSON.stringify(t)),g}},{key:"getBufferedLog",value:function(t){if(t){for(var e=t.buffered,i=[],s=0;s<e.length;s++)i.push("[".concat(e.start(s),", ").concat(e.end(s),"]"));return"video.buffered=".concat(i.join(" "),", video.currentTime=").concat(t.currentTime)}return"video.buffered=null"}}]),t}();function b(t){return atob(t)}
1O.indateLocalStorage={set:function(t,e,i){var s={value:e,expirse:new Date(i).getTime()};D[t]=JSON.stringify(s)},get:function(t){var e=JSON.parse(D[t]);if(null!==e){if(!(null!=e.expirse&&e.expirse<(new Date).getTime()))return e.value;delete D[t]}return null},update:function(t,e){var i=JSON.parse(D[t]);i&&(i.value=e,D[t]=JSON.stringify(i))}},O.IntMax=0x7fffffff,O.IntMin=-0x7fffffff,O.UintMax=0xffffffff;var w=new(function(){function t(){Object(s.a)(this,t),this.sdkVersion=0x9b0b2ddf,this.version=1100,this.baseSubs=10,this.uid=0,this.sGuid="",this.roomId=0,this.uuid=0,this.convertUid=0,this.appId=66,this.appid=66,this.p2pCooling=!1,this.flvTryToP2P=0}return Object(r.a)(t,[{key:"initUUId",value:function(){0===this.uuid&&(this.uuid=Number((Date.now()%1e10*1e3+(1e3*Math.random()|0))%0xffffffff));var t=Number(D.appid);t&&(this.appid=t,I.warn("--- test appid "+t+" ---",this))}},{key:"getAnonymouUid",value:function(){var t=Number(D.sdk_anonymousuid);return t||(D.sdk_anonymousuid=t=Number((Date.now()%1e10*1e3+(1e3*Math.random()|0))%0xffffffff)),t}}]),t}()),L={SLICE_SPEED:12.5,MAX_PACKET_CNT:1e4,SWITCH_INTERVAL:10,MAX_DELAY:66e4,DEFAULT_DELAY:65535,SUBSCRIBE_TIMEOUT:1e4,PUNCH_BACK_COOLING:2e4,PUNCH_IGNORE_TIME:3e5,SUB_TIMEOUT:5e3,RESUB_TIMEOUT:3e4,STREAM_DELAY:2e3,EMULATE_DELAY:1800,MAX_DEPTH:1,PROXY_NUM:3,MAX_PEER_STREAM_NUM:8,MAX_PUSH_NUM:3,MAX_PULL_NUM:3,SLICE_DELAY:100,SLICE_LATE:50,SLICE_FAST:50,SLICE_TIMEOUT:2e3,SWITCH_DELAY:500,AV1_DECODE_FAIL_KEY:"__AV1_DECODE_FAIL_KEY__",AV1_DECODE_FAIL_TIME:"__AV1_DECODE_FAIL_TIME__",StreamType:{NONE:0,FORCE:1,FIXED:2,COMPETE:3,PEER:4},LeaveReason:{PING_DIF:1,RESET:2},DEL_REASON:{CHANNEL_CLOSE:1,CHANNEL_ERROR:2,NODE_LEAVE:3,SERVER_REJECT:5,PEER_ERROR:6,PEER_TIMEOUT:7,PING_TIMEOUT:8,OTHER_SID:9,EMPTY_SLICE:10,SUB_TIMEOUT:11,SUB_FAIL_TIMES:12,NODE_REJECT:13,DIF_CDNP:14,PEER_HANDLER_ERR:15},PERIOD:{UPLINK_CALC:10,CHECK_SEED:20,GET_NODE:5},SubType:{SUBSCRIBE_FORCE:0,SUBSCRIBE_NORMAL:1},LoadVideoTimeoutReason:{FLV_DISCONNECTED:0,FLV_CONNECTED:1,FLV_CONNECT_ERROR:2,FLV_RECV_DATA:3,FLV_DATA_INVALID:4,FLV_STARTPLAY:5,FLV_PLAYERROR:6,HLS_DISCONNECTED:7,HLS_LOADMANIFEST_ERROR:8,HLS_LOADMANIFEST_SUCCESS:9,HLS_LOADFRAMENT:10,HLS_LOADFRAMENT_ERROR:11,HLS_LOADFRAMENT_SUCCESS:12,HLS_PLAY_ERROR:13},SubResCode:{ACCEPT_SUBSCRIBE:0,EMPTY_UPLOAD_NUM:1,DETECT_SUBSCRIBE_CYCLE:2,EMPTY_PEER_INFO:3,SUBSCRIBE_UPLINK_NOT_ENOUGH:4,PUBLISHER_KICK_OFF:5,NOT_SUBSCRIBER:6,INVALID_SUB_STREAM:7,ACCEPT_BY_SUBSCRIBER_UPLINK:9,INVALID_STREAMID:10,SERVER_EMPTY_BW:11,PUBLISHER_LEAVE:12,DIFFERENT_VIDEO_PROXY:13,OLD_VERSION_REQ:14,INVALID_TREE_DEPTH:15,INVALID_MAX_SUBSTREAM_NUM:16,STREAM_LATE:17,DEPTH_LARGE:18,STREAM_LIMIT:19,SLICE_LARGE:20,NOT_FOUND_PKG:21,KICK_OUT:22,SELF_WORST:23,SLICE_LATE:24,SLICE_FAST:25,RESTART:26,RESET:27,DIF_BASE_SUBS:28},VIDEO_COMPETE_UID:0xffffffff,VIDEO_FORCE_UID:0,VIDEO_FIXED_UID:-1,VIDEO_DEFAULT_UID:-2,isProxyUid:function(t){return t===L.VIDEO_COMPETE_UID||t===L.VIDEO_FORCE_UID||t===L.VIDEO_FIXED_UID||t===L.VIDEO_DEFAULT_UID},isCompete:function(t){return t===L.VIDEO_COMPETE_UID},isForce:function(t){return t===L.VIDEO_FORCE_UID},isFixed:function(t){return t===L.VIDEO_FIXED_UID},isDefault:function(t){return t===L.VIDEO_DEFAULT_UID},isSliceJumpFromPeer:function(t,e){return e.isFromPeer&&t>0&&e.seq-t>10*L.LOST_SEQ_NUM},offerReject:{REASON_NOTSTART:1,REASON_PUNCHFAILED_CD:2,REASON_PUNCHED_FULL:3,REASON_QUOTA_EXHAUST:4,REASON_VERSION:5,REASON_DIF_LINE:6,REASON_FAIL:7,REASON_IGNORE:8,REASON_HAS_NODE:9,REASON_WAITING:10,REASON_OTHER:100},offerRejectTime:12e4,punchBackRet:{SUC:0,DIF_STREAM:1,CLOSING:2,COOLING:3,REQUEST:4,REJECT:5},restartReason:{RANGE_SEQ_MAX:1,RANGE_SEQ_LARGE:2,CDN_JUMP:3,PLAYER_NO_DATA:4,LOST_SEQ:5,CONNECT:6,WORKER_ERROR:7,MULTI_CDN:8,FLV_TO_P2P:9,PLAYER_ERROR:10,PLAYER_DISPOSE:11,LOST_SEQ_JUMP:12},turnToFlvReason:{FULL_PLAY_FAIL:1,FULL_CONNECT_TIMEOUT:2,SUB_CONNECT_TIMEOUT:3,FULL_NO_DATA:4,SUB_NO_DATA:5,P2P_ARGS_ERROR:6,P2P_COOLING:7,FLV_TO_P2P_FAIL:8,FLV_TO_P2P_FULL_STREAM_COMPLETE:9,FULL_ERROR:10,FULL_CLOSE:11,SUB_ERROR:12,SUB_CLOSE:13,RESTART_TIMES:14,SIGNAL_TIMEOUT:15,PROBE_TIMEOUT:16,PROBE_ERROR:17,NO_DATA_TIMEOUT:18,IS_NOT_FIRST_FETCH:19,VIDEO_BUFFER_EMPTY:20,PLAY_TIMEOUT:21,NOT_SUPPORT_P2P:22}
1,userProperty:{SERVER_CLOSE:1,CLIENT_CLOSE:2,BROWSER_UN_SUPPORT:3,FLASH:4,UNKNOW:5,P2P:6,FIRST_FULL_CONNECT_TIMEOUT:7,FIRST_FULL_PLAY_FAIL:8,FIRST_FULL_NO_DATA:17,RESTART_RANGE_MAX:9,RESTART_RANGE_LARGE:10,RESTART_CONNECT:11,RESTART_MUTI_CDN:12,RESTART_PLAYER_NO_DATA:13,RESTART_PLAYER_ERROR:14,SUB_NO_DATA:15,SUB_CONNECT_TIMEOUT:16,P2P_ARGS_ERROR:18,FLV_TO_P2P:19,LOST_SEQ:20,P2P_COOLING:21,IS_NOT_FIRST_FETCH:22,VIDEO_BUFFER_EMPTY:23},h265TurnToH264Reason:{DECODE_ERROR:1,RENDER_ERROR:2},pauseReason:{FLV_NO_BUFF:1,FLV_UNKNOW_PAUSE:2,FLV_NET_SLOW:3,P2P_NO_BUFF:4,P2P_UNKNOW_PAUSE:5,P2P_FULL_LOADER_NO_DATA:10,P2P_FULL_LOADER_CONNECT_FAIL:11,P2P_SUB_LOADER_NO_DATA:12,P2P_SUB_LOADER_CONNECT_FAIL:13,FLV_NO_DATA:14,P2P_NO_SLICE:15,P2P_RESEND_SKIP_FRAME:20,P2P_RESEND_TOOLATE:21,P2P_RESEND_TIMEOUT:22,P2P_RESEND_ERROR:23,P2P_RESEND_MISSING:24,P2P_DTS_JUMP:25,P2P_NET_SLOW:26},DataType:{SIGNALLING:0,PING:1,SLICE:2},LOST_SEQ_NUM:4e3,BAD_REASONS:{UNKNOW:100,SUB_LINK:1,DOWN_LINK:2,RANGE_MISS:3,RANGE_RECV_TIMEOUT:4,FRAME_SEQ_LOST:5,BUFFER_JUMP:6,TIMESTAMP_JUMP:7,FRAME_VIDEO_JUMP:8,FRAME_AUDIO_JUMP:9,FRAME_DROP:10,PERFORMANCE:11},initConfig:function(t,e){for(var i=e.coderates,s=null,r=0;r<i.length;r++)if(t>Number((s=i[r])[0])){L.PROXY_NUM=Number(s[1]),L.SLICE_DELAY=Number(s[2]),L.MAX_PUSH_NUM=Number(s[3]),L.MAX_PULL_NUM=Number(s[4]),L.SLICE_LARGE=Number(s[5]);break}L.MAX_PEER_STREAM_NUM=Number(e.maxPeerStreamNum)||8;var a=L.SLICE_SPEED*w.baseSubs*(t/1e3);L.SLICE_LATE=parseInt(a*((Number(e.sliceLate)||1e3)/1e3)),L.SLICE_FAST=parseInt(a*((Number(e.sliceFast)||2e3)/1e3)),L.STREAM_DELAY=Number(e.badDelay)||2e3,L.EMULATE_DELAY=Number(e.emuteDelay)||1800,L.RESUB_TIMEOUT=Number(e.resubTime)||3e4,L.SLICE_TIMEOUT=Number(e.sliceTimeout)||2e3,L.SWITCH_DELAY=Number(e.switchDelay)||500},HLS_LOAD_TYPE:{FETCH:1,XHR:2},LATENCY_MODEL_TYPE:{NONE:0,CONTROL_MODEL:2,RTC_MODEL:4,TOPSPEED_MODEL:99},PLATFORM_TYPE:{web:100,mini_app:102,wap:103,huya_liveshareh5:104,adr:2,ios:3},PLATFORM_TYPE_NAME:{web:"web",wap:"wap"},H5_ERROR_CODE:{VIDEO_ERROR:-1e3,PLAY_TIMEOUT:-1001},VISIBILITY_STATE:{VISIBLE:"visible",HIDDEN:"hidden",PRERENDER:"prerender"},PCDN_OPEN_BUFFER:1e4,PCDN_CLOSE_BUFFER:7e3,PCDN_COOL_TIME:6e4,PLAYER_CORE_TYPE:{MSE:1,WEBCODECS:2,MMS:3},LOG_COLOR:{WARN:"background: orange"}},F=new(function(){function t(){Object(s.a)(this,t),this.audioCtx=1,this.pushGop=!1,this.jitBufLen=3e3,this.jitMaxBufLen=4e3,this.jitMinBufLen=2e3,this.resendPlayThreshold=1500,this.mutilLinkConfig=[[0,4e3],[8,4]],this.resendModeConfig=[[0,2e3],[1,2]],this.resendMode=1,this.resendWaitLimitList={500:2500,2e3:2500,4e3:2500,8e3:2500,1e4:2500,12e3:2500,2e4:2500},this.sliceListLengthMaxList={500:1e3,2e3:25e3,8e3:1e4,1e4:12500,2e4:25e3},this.noUrgentResentBuffer=2e3,this.latency=[[3e3,2e3,4e3,2e3],[1e3,500,1500,1e3]],this.jitTest=[2e3,5e3,1500],this.jitPid=[],this.hlsJitCfg=[6e3,4e3,8e3],this.hlsUseFetch=100,this.obsUseFull=0,this.obsFullRatio=1,this.obsBgRatio=0,this.obsFaceRatio=0,this.obsSrAudio=1,this.obsFrame=0,this.obsSyncTs=50,this.obsSeekTs=200,this.obsSeekJumpTs=0,this.obsRateTs=10,this.p2pQuicktime=5e3,this.baseSubs=10,this.urgentResend=1,this.urgentResendAudio=1,this.crossPunchPloy=1,this.crossClientPer="all|all:100",this.crossClientUpBwMod=1,this.crossClientClose=-1,this.crossClientCloseCfg="all|all:0",this.syncMob=1,this.noSignalNode=1,this.crossCdn=1,this.crossLineSub="all",this.punchWan="",this.p2pWssLines="all",this.connectTotalTime=6e3,this.connectTimeout=2e3,this.connectPcdnTimeout=4e3,this.flowTimeout=2e3,this.flowRetryTimes=3,this.renderTimeout=3e3,this.noDataTimeout=4e3,this.noSliceTimeout=1e4,this.noPcdnDataTimeout=2e3,this.testResender=0,this.maxResendTimes=3,this.resendDelayTs=400,this.patchSubTs=500,this.http2Channel="",this.rangeNums=1e3,this.rangeV2=1,this.deleteH264Aud=[],this.useChangeRate=[],this.changeBitrates=[],this.audioEmptyDur=100,this.p2pMediaLogCfg="all|all:0",this.p2pSignalLogCfg="all|all:0",this.p2pPunchMode=2,this.freeBufferBitrate=15e3,this.needCooling=1,this.needQueue=0,this.queueTime=500,this.punchedCoolingTime=1e4,this.delayCloseNum=200,this.punchTimeout=7e3,this.maxPunchedCnt=50,this.maxPunchedCntMore=60,this.maxNodeCnt=50,this.maxPunchedCntSdk=10,this.maxNodeCntSdk=10,this.maxPunchedCntNat4=10,this.punchCfg=[[999,40,50,10,10,40,10,10],[1,50,60,10,10,40,10,10]],this.punchBackCooling=2e4,this.punchIgnoreTime=3e4,this.coefficient=8,this.trySubNum=5,this.trySubTime=7e3,this.fastTime=5e3,this.lostSeqTime=6,this.sliceLate=1e3,this.sliceFast=1500,this.sliceConstraints=6e3,this.sliceConstraintBad=8e3,this.pubSelectorConstraint=0,this.badDelay=1e3,this.emuteDelay=2200,this.switchDelay=500,this.aliveTimeout=1e3,this.resubTime=3e4,this.sliceTimeout=1e3,this.maxPeerStreamNum=7,this.maxPeerStreamNum1=8,this.maxPeerStreamNum20M=8,this.maxUplinkBw=6e3,this.closeUids=[],this.closeSub=0,this.closeSubRooms=[],this.closeAllUids=[],this.p2pMediaCfg="all|all:100",this.p2pSignalCfg="all|all:100",this.ignoreUids=[0x12540fbce0d,0x50bfb357,0x8d28ff9e,0x65b6ce29,0x8d1de7fb,0x10001339d06,0x6cf263e7,0x5b47d154,0x6430e4df,0x84caaeab,0x8770cc67,0x15e21748,0x64035e3d,157525e4,0x5ff8dd62,0x11749cc7dc6,0x307d90fb,0x125433a24d5,0x21fc52a3,0x287ca434,0x3fa02244,0x847fdc46,0x129e90369ee,0x1174c652287,0x118fcaf0,0x1eeed8c6,0x2c6d7ea7,0x11748b1b082,0x1174bd57d13,0x11748d5366a,0x554ae837,0x50d77c8d,1724691,0xa4013c,0x1174951dc60,0x81c25bb1,0x10001331554,0x58a917c0,0x11749f01f77,0x1254193fa8f,0x108f27a,0x47063426,0x6118e677,0x771dae4,0x65a81f99,0x11749edd6e9,0x42cdd29c,0x6e6c5844,0x88387c2f,0x117495ed014,0x862b0851,0x83a4a871],this.flvEmptyAudioFrame=1,this.sendHeartBeatAlone=0,this.signalNoCdnp=[],this.switchSeamLessLine=0,this.isProduce=!0,this.coderates=[[15e3,0,8e3,5,5,230,1,20],[8e3,0,4e3,5,5,230,5,10],[6e3,0,4e3,5,5,170,5,10],[4e3,0,4e3,5,5,120,5,10],[3e3,0,4e3,5,5,80,5,10],[0,0,4e3,5,5,50,5,10]],this.seaSubNums=[],this.swapdomain={},this.iP2PType=2,this.danmuZipPids=[],this.randomPercent=1e4,this.frameBufLen=[2500,1500,1500,3500],this.bufferMode=2,this.bufferConfig=[],this.urgentResendTime=1500,this.forceSkipFrameTime=3900,this.frameTimeout=3e3,this.p2pBuffer=[3500,2500,4500],this.p2pOpenBrowsers=["opera"],this.jitAB=[],this.jitCfgFlv=[[0,1500,1e3,2e3]],this.jitCfg=[[15e3,4e3,3e3,5e3],[0,3e3,2e3,4e3]],this.jitCfgPidFlv=[],this.jitCfgPid=[],this.jitJump=[2e4,8e3],this.jitLowLatency=2e3,this.jitLow=[1500,1e3,2e3],this.safariPlayDelay=500,this.safariFirstLoad=!0,this.waitAudio=1,this._isFrameBuffer=-1,this.isSubUseHttps=1,this.usePcdn=1,this.pcdnSubsConfig=[1,1,1],this.vipUsers=[0x117502007c4,0x1174f7fc605,0x1174ff84e18,0x846fe704,0x2fb2785,0x129e8ec9765,0x59a8607a,0x3949e173,0x129eae93cba,0x1174f54d19c,0x2fb2f5a,0x1333a4f6762,0x1174fb94a61,0x1174f7319f7,0x117491780c8,0x615e6e0b,0x129e8d7ab49],this.autoViewUsers=[0x12540f61ce2,0x1174c6761fb],this.notUsePcdnBrowsers=[],this.notUsePcdnUids=[],this.notUsePcdnUsers=[],this.notUseFlvPcdnUsers=[],this.notUseFlvPcdnPids=[],this.notUseP2PPcdnUsers=[],this.notUseP2PPcdnPids=[],this.isPcdnReportErr=0,this.pcdnNoDataMod=2,this.pcdnSlowTime=2,this.pcdnSlowCoolTime=6e4,this.pcdnSowCnt=5,this.pcdnSwitchUrls=["xd"],this.pcdnPubIceCfg="all|all:100",this.pcdnPubIceOpen=!1,this.isMute=1,this.muteCfg=[1e4],this.isAutoNoPicture=0,this.notImgplusUas=["huya-pc exe"],this.playbackrateMin=.95,this.playbackrateMax=1.05,this.pcdnFlv=1,this.pcdnMseFlv=1,this.pcdnFlvSyncMob=1,this.pcdnFlvIgnore=0,this.flvToPcdnBuf=2400,this.flvToCdnBuf=1e3,this.isAiP2PTo
1Flv=0,this.randomAIP2PFlvPercent=Math.floor(1e4*Math.random()),this.aiRandomPercent=5e3,this.aiABRandomPercent=2e3,this.aiUids=[],this.aiBlackUids=[],this.aiBlackLines=[],this.aiBlack2Uids=[],this.isAutoH265=0,this.renderDelta=300,this.autoReportTime=1e3,this.autoReportUsers=[],this.h265Config=[[[2e3,4e3],[4e4,4e4]],[4e3,2e3,1300,1e3,500,6e3,8e3],75,[[500,1e3,1300,2e3,4e3,6e3,8e3],[3,3,3,3,4,4,4]],30,3,[!0,!0]],this.h265MseConfig=[1,[86],[500,1e3,1300,2e3,4e3,6e3,8e3],[],[[500,1e3,1300,2e3,4e3,6e3,8e3],[5,5,5,5,5,5,5],[],[]],1],this.h265MseChromeConfig=[107,3e4,4,0,1],this.vodH265Config=[1,0,1],this.wcs265BlackUids=[],this.mse265BlackUids=[0x49058c61,0x1174b684289,0x1174fe166f3,0x622befc5,0x1174f603b90,0x5fe86134,0x6bbc2b34,0x60da25c7,0x60da25c7,0x8cf69f40,0x12540e64853,0x6a39f9e5,0x5d4227bf,0x1254186d92a,0x11748da65db,0x5e28069c,0x1b286d59564,0x58b49e29,0x5041fe4d,0x772dfe3,0x5753a882,0x1174a14be57,0x6559f75f,0x1174b045446],this.wcsGBlackIds=[],this.hardH265UidList=[],this.h265MseWhiteBlackUids=[[],[]],this.h265BlackUids=[],this.replayH265BlackUids=[],this.whiteH265Uids=[[],1],this.h265NoPushVideoDis=1e4,this.randomH265Percent=Math.floor(1e4*Math.random()),this.h265PercentConfig=1e5,this.enableAiMosaic=1,this.limitMosaicAreas=40,this.aiMosaicUis=[],this.aiRequestInterval=5e3,this.aiBathRequestInterval=3e4,this.aiBufferEmptyRequestInterval=3e5,this.playerdata={profileP2POpt:""},this.isCommonAb=1,this.aiP2PFlvConfig=[5e3,5],this.closePcdnBitrate=8e4,this.closePcdn500=0,this.setVideoCTCfg=[-100,1500,1e4],this.jumpBufferCfg=[30,1e3,1e4,5e3,30,25],this.jumpBufferCfg2=[0,500],this.jumpBufferCfgAids=[],this.jumpBufferVer=80,this.jumpBufferWap=0,this.sliceQuantityPerSecond=1,this.useNewPloy=1,this.minPlayout=170,this.maxPlayout=500,this.playoutUids=[],this.isMuteAct=0,this.useAV1=!1,this.useAV1PidList=[],this.useAV1LinesAndBitRates=[[],0],this.isClosePlayBackRate=1,this.pcdnAbConnectData=[0,[1e3,2e3,3e3,4e3]],this.isForceUseWorker=1,this.av1Open=-1,this.av1OpenCfg="all|all:0",this.av1CloseFlvPcdn=1,this.av1FailTime=432e5,this.av1BlackBrowsers=["firefox"],this.av1BlackPids=[],this.av1BlackUids=[],this.av1BlackLines=[99,66],this.av1BlickBitrates=[],this.av1BitrateThreshold=4e3,this.av1HideFPSStreamHardwareConcurrency=16,this.platform=L.PLATFORM_TYPE_NAME.web,this.av1PercentConfig=5e3,this.isConfigSupportH265=1,this.vodCutTime=3e3,this.vodConvertIDR=0,this.isVodSupportH265=0,this.isVodTurnTo264=1,this.abUseAv1=1,this.h265GameIds=[!0,[]],this.isNoVideoReport=0,this.simdAbPercentConfig=5e3,this.vodAbSwitch=0,this.dropFrameAb=0,this.useNewParser=1,this.maxGop=3e3,this.autoCfg={close:0,closeLines:[],closePids:[],upGap:0,downGap:15e3,backGap:15e3,upPer:.8,downPer:.3,downNowPer:.2,waitPer:.8,downBitrate:2e3,slow:.85,bufCnt:10,sucPer:.9,sampleTime:200,minTime:1e4,maxTime:3e5,sysTime:1e4,evalTime:300,highRate:4e3,badBuf:2e3,badCnt:3,badS:[1e4,3],badL:[6e4,5],noRederTime:12e4,monitorTime:15e3},this.continueBufferDeltaStart=6e3,this.continueBufferDeltaEnd=3e3,this.autoBufferScore=1e3,this.autoConnectScore=500,this.autoFirstScore=500,this.autoPtsScore=500,this.force_auto_count=9999,this.force_auto_effective_time=2592e5,this.autoReportCfg=[1,3,0,1],this.autoReportSea=0,this.isWebAutoAB=0,this.maxBitRate=500,this.recSysExpiredTime=6e4,this.autoDownTimer=0,this.autoDownMaxBitrate=1,this.minFps=24,this.dropTime=0,this.perfBitrate=2e3,this.perfCnt=1,this.perfBuf=2e3,this.p2p302Config=[[[6,1,0,1]],1],this.sdkCloseAutoAi=0,this.closeP2PPids=[],this.closeP2PConfig=[1,1],this.enableAutoCloseP2P=1,this.isCloseVodPcdn=0,this.is265VideoLoadTs=1,this.isSendPlaybackLoadTime=0,this.vodPcdnOpenBuffer=1e4,this.vodPcdnCloseBuffer=7e3,this.vodPcdnCoolTime=6e4,this.vodPcdnBufferCfg=[[1e4,7e3,6e4],[],[]],this.perfBlockCfg=[2e3,3e3,6e3],this.vodPcdnStatCfg=[0],this.vodAv1Cfg="all|all:100",this.vodAv1Cd=6e4,this.vodAv1CdCnt=5,this.vodAv1CloseCfg=[[[4e3,8],[1300,2]],[4e3,4]],this.vodAv1UseFirst=1,this.vodUseBackupField=[1,1,1,1,1,1,0],this.vodDtsFixCfg=[0,0],this.vodRetryTime=5e3,this.vodBs2Delay=3e3,this.blockBadCfg=[800,1],this.perfWin7kaCfg=[2e3,3],this.openWebcodec=1,this.vodOpenWebcodecs=0,this.av1Webcodecs=0,this.webCodecBlackUids=[],this.webCodecsAnchoruids=[],this.vodWebcodecsGameIds=[],this.replayWebcodecsGameIds=[1],this.vodWebcodecsVids=[],this.vodWcsBroCfg=[0],this.wcsBlackAids=[],this.webCodecCfg=[4,8e3,2e3,1,1500,[2e3,1e4,2e4]],this.webCodecAVDeltaCfg=[5e3,2e3],this.noNextWcsTimeUids=[],this.useNextWcsTime=1,this.hardHevcConfig=[0,0,0],this.repairSameDtsCfg="",this.repairSameDts=0,this.useNewCdnp=1,this.shieldAudioCfg=[1,3e3,6e3,15e3,15e3,3e3],this.useCdnpFixed="all|all:100",this.signalClose="",this.signalExperiment=0,this.signalRangeGap="all|all:1000",this.signalSubGap="all|all:1000",this.signalBaseIndexExp=0,this.signalBaseIndexExpCfg="",this.signalBaseIndexMode=3,this.signalBaseIndexCfg="all|all:3",this.fakeHdrBlackPids=[],this.fakeHdrBitrateMap=[{4100:17200,4200:17100,20100:19200,4300:17300,14100:14200}],this.fakeHdrBlackPids=[],this.fakeHdrCfg=[{auid:[],bitrateMap:{4100:17200,4200:17100,20100:19200,4300:17300,14100:14200}}],this.fpsBitrateCfg=[100,[],{4200:17300},120],this.signalSliceCache="all|all:750",this.signalSliceDispatch="all|all:750",this.signalOpenExp="",this.signalOpen=-1,this.statLv=[1,1,0,1,0,2,0,0,1,0,2,1,1,1,1,1,0],this.statCfg="all|all:100",this.statIgnoreActsMps=["control","player_to_mps","mps_to_player","player_to_mps_err","nat_fail"],this.statHoldActsMps=[],this.statIgnoreFieldsMps=["loss_rates"],this.statHoldFieldsMps=[],this.statCoverFieldsMps=["oexp"],this.statIgnoreOpen=-1,this.statIgnoreOpenCfg="all|all:50",this.statIgnoreActsSdk=["h265_status","block_bad","fast_sample","p2p_load_video","connect_video_ts","load_p2plib_error","video_played_ts","first_video_iframe_ts","video_iframe_ts","first_video_render_ts","first_video_pkg_ts","load_m3u8_ts","first_frag_load_ts","first_frag_loaded_ts","first_frag_size","video_load_seg","h265_worker_load_ts","ai_p2p_flv_switch","pcdn_to_cdn","p2p_play_fail","pcdn_video_load_ts","recv_video_ts","cdnp_error","hls_play_succ","hls_load_succ","signal_turn_back","tcp_open_time","tcp_no_slice","p2p_cooling","cdnp_close","p2p_restart"],this.statHoldActsSdk=[],this.statIgnoreFieldsSdk=["a_render_silence_time","ai_control_data","cdnp_rtt","features_status","frame_info","link_sam","nonode_return","p_iaas_info","psub_proxy_info","sub_state_info","punch_info","punched_uuids","real_kbps_sample","recv_total_sample","signal_rtt","sub_pcdn_state","delay_node_info","svr_delay_infos","svr_last_p_delay","updown_info","h265_sam","sub_info"],this.statHoldFieldsSdk=[],this.mediaRangeGap="all|all:90",this.mediaSubGa
1p="all|all:500",this.mediaBaseIndexExp=0,this.mediaBaseIndexExpCfg="",this.mediaBaseIndexMode=1,this.mediaBaseIndexCfg="all|all:3",this.mediaSliceCache="all|all:750",this.mediaSliceDispatch="all|all:750",this.dropFrameUids=[1],this.dropFrameDts=[1e4,2e4],this.usePullPunch="all|all:100",this.closeLowBufResend="",this.renderStat=[1],this.signalRttPids="all|all:0",this.signalRttUids=[],this.pause500Cfg=[300,[]],this.closePause500=0,this.recvProcesser=-1,this.recvCfg="all|all:100",this.isQQSoft=1,this.isWin7WcsSoft=1,this.isLimitNaluType=1,this.isCloseMseDrop=0,this.isAutoWcsReport=1,this.avHeaderChangeCfg=[[],0,300,1e4],this.avHeaderChangeStatCfg=[[],3e3,1],this.enableHvcc=1,this.videoMaxGap=2e4,this.iaasCfg=[1,1,3,.3,4e3,600,200,5e3,5,.4],this.iaasCfgWhiteAuids=[0,[]],this.iaasCfgBlackAuids=[],this.iaasCloseGather=1,this.p2pSubSdkV2=0,this.p2pSubSdkCfg="all|all:0",this.h265BlackBrows=[],this.wcsSoftBrows=[],this.wcsBlackBrowVers=[],this.p2pBlackBrowVers=[],this.pcdnBlackBrowVers=[],this.pcdnFlvBlackBrowVers=[],this.pcdnFlvBlackBrowVerMax=49,this.wasm265BlackBrowVers=[],this.mse265BlackBrowVers=[],this.wcs265BlackBrowVers=[],this.wcs264BlackBrowVers=[],this.bitrateBrowHard265Cfg=[0,4e3,[]],this.wcsSoft264Uids=[],this.popSize0Brows=[],this.payRoomCfg=[0,5],this.mobVBlockCfg=1,this.wasmCloseCfg=[0,[]],this.wcs265BlackBrowNames=[],this.enhanceVCfg=[1,4e3,6,1080],this.enhanceGameIds=[1,2336,5699,1663,2168,2633,7185,5485,7,6203,393,9521,2793,3203,5937,862,4,2413,100032,1964,1997,6219,7579,2,4921,9961,802,7601,1732],this.enhanceGameIdRatioMap={2793:[720,1080],3203:[720,1080],5937:[720,1080],862:[720,1080],4:[720,1080],2413:[720,1080],100032:[720,1080],1964:[720,1080],1997:[720,1080],6219:[720,1080],7579:[720,1080],2:[720,1080],4921:[720,1080],9961:[720,1080],802:[720,1080],7601:[720,1080],1732:[720,1080]},this.eHBlackUids=[],this.eHBlackAnchoruids=[],this.eHBlackBrowVers=[],this.eHBlackBrowVerList=[],this.eHBlackRenderList=[],this.ehWhiteAnchoruids=[0,[]],this.enhanceSupportMode=1,this.enhanceVodVCfg=[0,4e3,6,1080],this.enhanceVodGameIds=[1,2336],this.eHVodBlackUids=[],this.eHVodBlackA
1nchoruids=[],this.eHVodBlackVids=[],this.eHVodBlackBrowVers=[],this.eHVodBlackRenderList=[],this.ehVodWhiteAnchoruids=[0,[]],this.ehVodWhiteVids=[0,[]],this.vodEnhanceChannelMap=[{vhuyalol:1},{9521:9521},{vhuyawzry:2336}],this.popDuration=200,this.decodeDelay=100,this.p2pRangePeerMode=1,this.rtPeerMax=1,this.rtPeerPer=0,this.rtPeerCfg=[[0,3,0]],this.rtPeerTimeout=300,this.rtPeerPRN=1,this.rtPeerSelectorCfg="all|all:100",this.rtPeerSelector=!1,this.resendUrgentCfg=[[1,[[0,700]]]],this.resendUrgentMse=[[1,[[0,700]]]],this.resendUrgentWcs=[[1,[[0,400]]]],this.rtPeerAsk=0,this.rtPeerSrc=1,this.rtPeerTopN=5,this.rtPeerUrgent=1,this.rtPeerUrgentOpt=0,this.rtPeerRTONum=2,this.rtPeerBeforeHand=0,this.rtPeerRandom=1,this.rtPeerUgMin=300,this.fastTimeCfg="all|all:0",this.urgentBuffer=201,this.resendAudioCfg="all|all:500",this.resendAudioBufCfg="all|all:1500",this.useFastTime=!1,this.logMaxLen=4e3,this.hisLogMaxLen=2e3,this.isHisLog=1,this.pcdnProTimoutTs=3e3,this.heartMode="all|all:1",this.heartQpsPids="all|all:100",this.heartQps="all|all:3",this.pcdn302FlvCfg=[1,15],this.pcdn302FlvBakCfg=[1,1],this.pcdn302BlackAids=[],this.flvPcdn302Ab=10001,this.enableBroMseCfg=[117],this.audioDtsOpen=!1,this.audioDtsCfg="all|all:0",this.dtsJumpOpen=!1,this.dtsJumpCfg="all|all:100",this.dtsJumpThreshold=2e4,this.enableEdgeBroMseCfg=[117],this.audioDropTime=1e4,this.audioDropOpen=!1,this.audioDropCfg="all|all:100",this.isAudioEmptyLimit=1,this.isFilterMsePause=1,this.isMseCheckRcRd=1,this.testRenderCfg=[5,2e4,500,[120]],this.testRenderSwitchCfg=[1,1],this.noRenderMetricTime=6e4,this.noRenderValidTime=1e3,this.noRenderDur=500,this.forbidWapShare=1,this.closePcdnOrigins=[],this.isPause5SecRetry=1,this.isFlvUrlRetry=1,this.wapP2pWhiteAids=[],this.isWapSupportP2P=0,this.wapPcdnWhiteAidsP2P=[],this.isWapSupportPcdnP2P=0,this.isWapSupportMpsP2P=0,this.wapPcdnWhiteAidsFlv=[],this.isWapSupportPcdnFlv=0,this.isCloseXiaomiPcdnP2p=1,this.wapPcoreVer="202510211403",this.mosaicGlassHardCfg=[0,["nvidia","amd"],6],this.mp4ErrorReportRandom=100,this.mosaicGlassUseFps=1,this.mosaicGrassExpired=1,this.grassModeAllowFPS=45,this.voiceTimer=50,this.wupFailCnt=20,this.wupFailPer=90,this.hlsLiveMaxFragNum=10,this.h5FirstPlay=0,this.h5WaitTime=1e4,this.mpsCrossCfg="all|all:0",this.mpsCross=-1,this.mpsCrossBlackUids=[],this.mpsCrossWhiteUids=[],this.mpsNotCrossBrowsers=["firefox","safari"],this.mpsCrossV6=1,this.mpsCfg="all|all:100",this.mpsSupportReverse=1,this.mpsWebrtcLimitTime=6e4,this.mpsWhiteUids=[],this.mpsBlackUids=[0x129eae93cba,0x1174f7fc605,0x1174f54d19c],this.mpsSub=-1,this.mpsSubCfg="all|all:100",this.mpsUseCfg=[1,1,1],this.mpsSubBlackUids=[],this.mpsSubWhiteUids=[],this.mpsLibName="Mps.js",this.mpsFailMax=1e5,this.mpsFailTime=5,this.mpsPolicy=1,this.mpsMergeReq=0,this.mpsSrcStartMode=1,this.mpsSrcWaitStartTime=6e4,this.mpsSrcWaitStopTime=2e4,this.mpsSrcConnectTimeoutPeer=4e3,this.mpsSrcDataTimeout=4e3,this.mpsSrcConnectTimeout=2e3,this.mpsBufferSendModeCfg="all|all:0",this.mpsBufferMode=0,this.mpsBufferTime=20,this.mpsBufferSize=20,this.mpsBufferSendMode=1,this.mpsBufferSendPowerFast=1.5,this.mpsBufferSendPower
1Normal=1.1,this.mpsBufferSendFastTime=8e3,this.mpsBufferSendMaxSize=64,this.mpsBufferDropLimit=3e3,this.mpsBufferDropTime=500,this.mpsBufferSendRateLimit=3,this.mpsBufferSendRatePower=.6,this.mpsBufferBlockLimit=2500,this.mpsBufferDropLimitTime=1e4,this.mpsBufferBlock=8,this.mpsBufferBlockSenders=2,this.mpsBufferBlockPer=10,this.mpsBufferBlockDelTime=15e3,this.mpsBufferBlockResumeTime=2e4,this.mpsGroupOpen=-1,this.mpsGroupOpenCfg="all|all:100",this.mpsCloseV6=1,this.useSvrNat=100,this.notUseNatSync=0,this.competeNat1=0,this.punchByNat=0,this.nat1First=0,this.punchNat1FailCnt=3,this.keepAliveNat1=0,this.keepAliveCnt=1,this.keepAliveCntNat1=6,this.cdnpIp="",this.cdnpPort=0,this.p2pPacketLifeTime=-1,this.p2pRetransmits=-1,this.mpsLossRateClose=8,this.mpsLossRateCloseTime=1e4,this.mpsLossRateOpen=5,this.mpsLossRateOpenTime=5e3,this.mpsUpUserCnt=1e4,this.mpsUpUserBw=1e6,this.pcdnUseSvrReqGap=1,this.pcdnReqGap=15e3,this.pcdnResCfg="all:https_4|wss_4,xd|huya:webrtc_8",this.autoReportNoAnwser=0,this.useMuteBiAudio=!0,this.closePunchUsers=[],this.mmsOpen=!0,this.hiddenSamples=15,this.hiddenCfg=[[120,50],[180,10],[240,2]]}return Object(r.a)(t,[{key:"getChangeBitrate",value:function(t,e){for(var i=0;i<this.changeBitrates.length;i++)if(Number(this.changeBitrates[i][0])===Number(t))return this.changeBitrates[i][1];return e}},{key:"isClosePunch",value:function(t){return this._isContainsUser(this.closePunchUsers,t)||this._isContainsUser(this.vipUsers,t)}},{key:"isAutoReport",value:function(t){return this._isContainsUser(this.autoReportUsers,t)||this._isContainsUser(this.vipUsers,t)||this._isContainsUser(this.autoViewUsers,t)}},{key:"isSignalRttOpen",value:function(t){return this._isContainsUser(this.signalRttUids,t)||this._isContainsUser(this.vipUsers,t)||this._isContainsUser(this.autoViewUsers,t)}},{key:"initRTPeerCfg",value:function(t){for(var e=this.rtPeerCfg,i=0;i<e.length;i++)if(t>=e[i][0]){this.rtPeerMax=e[i][1],this.rtPeerPer=e[i][2],I.log("Config.initRTPeerCfg bitrate=".concat(t," rtPeerMax=").concat(this.rtPeerMax," rtPeerPer=").concat(this.rtPeerPer));break}}},{key:"getAvHeaderChangeStat",value:function(t){for(var e=this.avHeaderChangeStatCfg[0],i=!1,s=0;s<e.length;s++)e[s]==t&&(i=!0);return 1==this.avHeaderChangeStatCfg[2]&&(i=!0),i}},{key:"initOpens",value:function(t,e,i){for(var s=["recvCfg","mpsSubCfg","mpsCrossCfg","crossClientCloseCfg"],r=["recvProcesser","mpsSub","mpsCross","crossClientClose"],a=["","","mpsCrossWhiteUids",""],n=["","","mpsCrossBlackUids",""],o=0;o<s.length;o++){var u=a[o],l=n[o],d=!1,c=!1;u&&(d=this._isContainsUser(this[u],i)),l&&(c=this._isContainsUser(this[l],i)),this.initOpen(t,e,s[o],r[o],d,c)}}},{key:"initOpen",value:function(t,e,i,s,r,a){-1===this[s]&&(O.isOpen(this[i],t,e,!1)?this[s]=1:this[s]=0),r?this[s]=1:a&&(this[s]=0)}},{key:"isFrameBuffer",get:function(){return 2}},{key:"initByBitrate",value:function(t){if(this.initRTPeerCfg(t),this.maxPeerStreamNum=t>=1e4?this.maxPeerStreamNum20M:this.maxPeerStreamNum1,this.resendMode=1,this.resendModeConfig&&this.resendModeConfig[0].length===this.resendModeConfig[1].length){for(var e=this.resendModeConfig[0].length-1;e>=0;e--)if(t>=this.resendModeConfig[0][e]){this.resendMode=this.resendModeConfig[1][e];break}}}},{key:"isAutoClose",value:function(t,e){if(1===this.autoCfg.close||-1!==this.autoCfg.closeLines.indexOf(Number(t)))return!0;for(var i=this.autoCfg.closePids.length,s=0;s<i;s++){var r=this.autoCfg.closePids[s];if(Number(r.pid)===Number(e))return!r.hasOwnProperty("lines")||-1!==r.lines.indexOf(t)}return!1}},{key:"initRepaireSameDtsCfg",value:function(t){"all"===this.repairSameDtsCfg||-1!==this.repairSameDtsCfg.indexOf(t)?this.repairSameDts=1:this.repairSameDts=0,I.log("Config.initRepaireSameDtsCfg=".concat(this.repairSameDts))}},{key:"setLowLatency",value:function(t){t&&t.setJitter(this.jitLow[0],this.jitLow[1],this.jitLow[2])}},{key:"setJitterCfg",value:function(t,e,i,s){if(!this.setJitterAB(t,e,i)&&!this.setJitterByPid(t,e,i,s)){var r="flv"===s?this.jitCfgFlv:this.jitCfg;this.setJitterByRate(t,i,r)}}},{key:"setJitterAB",value:function(t,e,i){if(this.jitAB.length>0){var s=this.jitAB[0],r=this.jitAB[1],a=this.jitAB[2];if("all"===s||-1!==s.indexOf(e+"")){var n=this.getGroupNum(a.length);return I.log("setJitterAB name=".concat(r," group=").concat(n)),this.setJitterByRate(t,i,a[n]),!0}}return!1}},{key:"getGroupNum",value:function(t){for(var e=1e4*Math.random(),i=t-1;i<t;i--)if(e>1e4/t*i)return i;return 0}}
1,{key:"setJitterByPid",value:function(t,e,i,s){for(var r="flv"===s?this.jitCfgPidFlv:this.jitCfgPid,a=0;a<r.length;a++){var n=r[a];if(-1!==n[0].indexOf(e+""))return I.log("setJitterByPid"),this.setJitterByRate(t,i,n[1]),!0}return!1}},{key:"setJitterByRate",value:function(t,e,i){for(var s=0;s<i.length;s++){var r=i[s];if(e>=r[0])return t&&t.setJitter(r[1],r[2],r[3]),!0}return!1}},{key:"init",value:function(t){if(t){Object.assign(this,t);var e=["p2pUpWapCfg","av1OpenCfg","mpsGroupOpenCfg","statIgnoreOpenCfg","crossClientCloseCfg","mpsBufferSendModeCfg","cdnpIp","100","p2pWssLines","http2Channel","crossLineSub","punchWan","repairSameDtsCfg","signalClose","signalRangeGap","signalSubGap","signalBaseIndexCfg","signalBaseIndexExpCfg","useCdnpFixed","signalSliceCache","signalSliceDispatch","mediaRangeGap","mediaSubGap","mediaBaseIndexCfg","mediaBaseIndexExpCfg","mediaSliceCache","mediaSliceDispatch","usePullPunch","closeLowBufResend","statCfg","signalOpenExp","recvCfg","vodAv1Cfg","platform","crossClientPer","p2pSubSdkCfg","p2pMediaCfg","p2pSignalCfg","fastTimeCfg","rtPeerTimeCfg","rtPeerSelectorCfg","heartMode","heartQpsPids","heartQps","audioDtsCfg","dtsJumpCfg","resendAudioCfg","resendAudioBufCfg","pcdnPubIceCfg","p2pMediaLogCfg","p2pSignalLogCfg","signalRttPids","mpsCfg","mpsSubCfg","mpsLibName","pcdnResCfg","mpsCrossCfg"];I.group("Configs");var i=["Configs:"];for(var s in this){var r=this[s];"string"==typeof r&&("pushGop"==s?r=!!Number(r):"coderates"==s||"testCoderates"==s||"swapdomain"==s?r=JSON.parse(r=r.replace(/[âµ\s+\n]/gm,"")):-1===e.indexOf(s)&&(r=Number(r))),this[s]=r,"object"==typeof r&&(r=JSON.stringify(r)),s=O.padStrLen(s,18,!1),i.push(" "+s+" => "+r)}I.log(i.join("\n")),I.groupEnd(),I.log("Config",this)}}},{key:"setAiP2PToFlv",value:function(t){1!==Number(t)&&(this.isAiP2PToFlv=t)}},{key:"streamSupportedAv1",value:function(t){var e=!1;return t.mMiscInfo&&t.mMiscInfo.av1_ratio_list&&-1!=t.mMiscInfo.av1_ratio_list.split(",").indexOf(t.iBitRate.toString())&&(e=!0),e}},{key:"setUseAV1",value:function(t,e){var i=this.streamSupportedAv1(t),s=this.configSupportedAv1(t,e);I.log("Config.setUseAV1 streamSupportedAv1=".concat(i," configSupportedAv1=").concat(s));var r=i&&1===s;this.useAV1=r,r&&(this.autoCfg.close=1)}},{key:"configSupportedAv1",value:function(t,e){var i=1;if(-1===this.av1Open&&(this.av1Open=+!!O.isOpen(this.av1OpenCfg,t.presenterUid,t.lineType,!1)),0===this.av1Open)i=19;else{var s=this.getAv1DecodeFailCnt();7===Number(p.osVersion)?i=10:this.av1BlackBrowsers&&-1!==this.av1BlackBrowsers.indexOf(S.name)?i=11:this.av1BlackPids&&-1!==this.av1BlackPids.indexOf(t.presenterUid)?i=12:this.av1BlackLines&&-1!==this.av1BlackLines.indexOf(t.lineType)?i=13:this.av1BlickBitrates&&-1!==this.av1BlickBitrates.indexOf(t.curBitrate)?i=14:this.av1BlackUids&&-1!==this.av1BlackUids.indexOf(Number(t.uid))?i=16:t._av1PlayFailReason?i=17:s>2&&(i=18),1===i&&t.curBitrate>this.av1BitrateThreshold&&(Number(navigator.hardwareConcurrency)>this.av1HideFPSStreamHardwareConcurrency?i=1:e&&-1!==e.indexOf("nvidia")&&(-1!==e.indexOf("rtx 30")||-1!==e.indexOf("rtx 40")||-1!==e.indexOf("rtx 50"))||(i=15))}return i}},{key:"getAv1DecodeFailCnt",value:function(){var t=Number(D.getItem(L.AV1_DECODE_FAIL_KEY))||0,e=Number(D.getItem(L.AV1_DECODE_FAIL_TIME))||0;return(0===e||Date.now()-e>this.av1FailTime)&&(D.removeItem(L.AV1_DECODE_FAIL_KEY),D.removeItem(L.AV1_DECODE_FAIL_TIME),t=0),t}},{key:"isCloseP2P",value:function(t){return t&&this.closeUids&&-1!==this.closeUids.indexOf(t)}},{key:"isClosePidMediaP2P",value:function(t,e){return!O.isOpen(this.p2pMediaCfg,t,e,!1)}},{key:"isClosePidSignalP2P",value:function(t,e){return!O.isOpen(this.p2pSignalCfg,t,e,!1)}},{key:"isCloseP2PBroVer",value:function(){var t=S.version.major;return t&&this.p2pBlackBrowVers&&-1!==this.p2pBlackBrowVers.indexOf(t)}},{key:"isClosePcdnBroVer",value:function(){var t=S.version.major;return t&&this.pcdnBlackBrowVers&&-1!==this.pcdnBlackBrowVers.indexOf(t)}},{key:"isCloseP2PAid",value:function(t){return this.platform===L.PLATFORM_TYPE_NAME.wap&&0===this.isWapSupportP2P&&-1===this.wapP2pWhiteAids.indexOf(t)}},{key:"getEnableAiMosaic",value:function(t){return!!this.enableAiMosaic}},{key:"setMute",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.isMute=t}},{key:"setUseAuto",value:function(t){t&&(this.isConfigSupportH265=0)}},{key:"getEnableJumpBuffer",value:function(){if(this.platform===L.PLATFORM_TYPE_NAME.wap)return 1===this.jumpBufferWap;var t=S.version.major>=this.jumpBufferVer;return this.platform===L.PLATFORM_TYPE_NAME.wap||S.chrome&&t||"firefox"===S.name}},{key:"isCloseAllFuncs",value:function(t){return -1!==this.ignoreUids.indexOf(Number(t))||this.closeAllUids&&-1!==this.closeAllUids.indexOf(Number(t))}},{key:"isCloseMps",value:function(t){return this._isContainsUser(this.vipUsers,t)||this._isContainsUser(this.mpsBlackUids,t)||this._isContainsUser(this.ignoreUids,t)||this._isContainsUser(this.autoViewUsers,t)}},{key:"isCloseFlvPcdnUser",value:function(t){return this._isContainsUser(this.notUseFlvPcdnUsers,t)||this._isContainsUser(this.vipUsers,t)||this._isContainsUser(this.autoViewUsers,t)}},{key:"isCloseFlvPcdnPid",value:function(t){return this._isClosePid(this.notUseFlvPcdnPids,t)}},{key:"isCloseFlvPcdnBroVer",value:function(){var t=S.version.major;return t<=this.pcdnFlvBlackBrowVerMax||-1!==this.pcdnFlvBlackBrowVers.indexOf(t)}},{key:"isCloseP2PPcdnUser",value:function(t){return this._isContainsUser(this.notUseP2PPcdnUsers,t)||this._isContainsUser(this.vipUsers,t)||this._isContainsUser(this.autoViewUsers,t)}},{key:"isCloseP2PPcdnPid",value:function(t){return this._isClosePid(this.notUseP2PPcdnPids,t)}},{key:"_isContainsUser",value:function(t,e){return t&&-1!==t.indexOf(Number(e))}},{key:"_isClosePid",value:function(t,e){return!!t&&("all"===t[0]||-1!==t.indexOf(Number(e)))}},{key:"isNotUsePcdn",value:function(t,e){var i=!1;return this.notUsePcdnUids.forEach(function(e){Number(e)===Number(t)&&(i=!0)}),this._isContainsUser(this.notUsePcdnUsers,e)&&(i=!0),this._isContainsUser(this.vipUsers,e)&&(i=!0),this._isContainsUser(this.autoViewUsers,e)&&(i=!0),i}},{key:"setVodPcdnConfig",value:function(t){var e=this,i=t.vid,s=t.anchoruid,r
1=t.useVodPcdnAbCfg;if(i||s){if(void 0!==r&&r&&this.vodPcdnBufferCfg[0].length>=3)return this.vodPcdnOpenBuffer=this.vodPcdnBufferCfg[0][0],this.vodPcdnCloseBuffer=this.vodPcdnBufferCfg[0][1],void(this.vodPcdnCoolTime=this.vodPcdnBufferCfg[0][2]);var a=function(t,i){t.some(function(t){return!(t.length<4&&t[3].length<=0)&&(t[3].indexOf(i)>=0?(e.vodPcdnOpenBuffer=t[0],e.vodPcdnCloseBuffer=t[1],e.vodPcdnCoolTime=t[2],!0):void 0)})};this.vodPcdnBufferCfg[1].length>0&&4===this.vodPcdnBufferCfg[1][0].length&&a(this.vodPcdnBufferCfg[1],Number(s)),this.vodPcdnBufferCfg[2].length>0&&4===this.vodPcdnBufferCfg[2][0].length&&a(this.vodPcdnBufferCfg[2],String(i))}}},{key:"enableWebCodec",value:function(){this.openWebcodec=1}},{key:"enableVodWebCodecs",value:function(){this.vodOpenWebcodecs=1}},{key:"getFakeHdrBitrate",value:function(t,e,i){var s=e;-1===this.fakeHdrBlackPids.indexOf(Number(t))&&(s=this.fakeHdrBitrateMap[0][e]||s);var r=this.fpsBitrateCfg[1],a=this.fpsBitrateCfg[3]||120;if(-1!=r.indexOf(t)&&i==a){var n=this.fpsBitrateCfg[2];for(var o in n)n.hasOwnProperty(o)&&o==e&&(s=n[o])}return s}},{key:"getFpsBitrate",value:function(t,e){var i=!1,s=this.fpsBitrateCfg[1],r=this.fpsBitrateCfg[0];return s.indexOf(Number(t))>=0&&e>=r&&(i=!0),i}},{key:"setClosePause500",value:function(t){var e=this.pause500Cfg[1];e.length>0&&-1!=e.indexOf(Number(t))&&(I.log("Config.closePause500Report"),this.closePause500=1)}},{key:"setEnableIaas",value:function(t,e,i){1==this.iaasCfgWhiteAuids[0]&&(this.iaasCfg[0]=0,-1!=this.iaasCfgWhiteAuids[1].indexOf(Number(e.presenterUid))&&(this.iaasCfg[0]=1)),-1!=this.iaasCfgBlackAuids.indexOf(Number(e.presenterUid))&&(this.iaasCfg[0]=0)}},{key:"setJumpCfg",value:function(t){this.jumpBufferCfgAids.length>0&&-1!=this.jumpBufferCfgAids.indexOf(Number(t.presenterUid))&&(this.jumpBufferCfg[1]=this.jumpBufferCfg2[1])}}]),t}()),M=function(){function t(){Object(s.a)(this,t),this._type=0,this.backdropFilter=new c,this.decoderDecodeP2pErrCnt=0,this.decoderDecodeFlvErrCnt=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.backdropFilter&&this.backdropFilter.destroy(),this.backdropFilter=null}},{key:"setMuted",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player&&this.player.setMuted&&this.player.setMuted(t)}},{key:"setBackDropFilter",value:function(t,e,i){this.backdropFilter.setBackDropFilter(t,e,i)}},{key:"decoderDecodeError",value:function(){0!=F.pcdn302FlvBakCfg[1]&&(this.type==t.P2P?(this.decoderDecodeP2pErrCnt++,I.log("BasePlayer.decoderDecodeError, type=".concat(this.type,", cnt=").concat(this.decoderDecodeP2pErrCnt))):this.type==t.FLV&&(this.decoderDecodeFlvErrCnt++,I.log("BasePlayer.decoderDecodeError, type=".concat(this.type,", cnt=").concat(this.decoderDecodeFlvErrCnt))))}},{key:"reportLoadP2PLib",value:function(t){var e=[this.stat.createAct(R.ACT.LOAD_P2PLIB_ERROR,{value:[100*!!t],str:[S.platform]})];this.sendMetrics(e)}},{key:"type",get:function(){return this._type}}]),t}(),N={SOURCE_READY:"SOURCE_READY",PLAY_STATUS:"PLAY_STATUS",PLAY_CARTON:"PLAY_CARTON",PLAY_TIME_STATUS:"PLAY_TIME_STATUS",VIDEO_READY:"VIDEO_READY",VIDEO_PLAY:"VIDEO_PLAY",VIDEO_PLAY_CON_SUC:"VIDEO_PLAY_CON_SUC",VIDEO_PLAYING:"VIDEO_PLAYING",VIDEO_PAUSE:"VIDEO_PAUSE",VIDEO_BAD_QUALITY:"VIDEO_BAD_QUALITY",METADATA:"METADATA",RECV_VIDEO_FRAME:"RECV_VIDEO_FRAME",VOLUME_CHANGE:"VOLUME_CHANGE",VIDEO_STOP:"VIDEO_STOP",VIDEO_SEEK:"VIDEO_SEEK",BROWSER_PAUSE:"BROWSER_PAUSE",BROWSER_AUTOPLAY_FAIL_IN:"BROWSER_AUTOPLAY_FAIL_IN",BROWSER_AUTOPLAY_FAIL:"BROWSER_AUTOPLAY_FAIL",AUDIO_PLAY:"AUDIO_PLAY",AUDIO_SOUND:"AUDIO_SOUND",ANCHOR_STOP:"ANCHOR_STOP",VIDEO_LINK_CLOSE:"VIDEO_LINK_CLOSE",NO_VIDEO:"NO_VIDEO",HLS_URL_UNAVAILABLE:"HLS_URL_UNAVAILABLE",HLS_URL_LOAD_TIMEOUT:"HLS_URL_LOAD_TIMEOUT",HLS_MAINFEST_LOAD_TIMEOUT:"HLS_MAINFEST_LOAD_TIMEOUT",FLV_URL_UNAVAILABLE:"FLV_URL_UNAVAILABLE",FLV_URL_UNAVAILABLE_IN:"FLV_URL_UNAVAILABLE_IN",HIDDEN_STOP:"HIDDEN_STOP",NO_VIDEO_CONFIG:"NO_VIDEO_CONFIG",FLV_CHANGE_LINE:"FLV_CHANGE_LINE",FLV_URL_LOAD_TIMEOUT:"FLV_URL_LOAD_TIMEOUT",H5_PLAYER_ERROR:"H5_PLAYER_ERROR",H5_PLAYER_ERROR_IN:"H5_PLAYER_ERROR_IN",H5_PLAY_FAIL:"H5_PLAY_FAIL",H5_NO_STREAM:"H5_NO_STREAM",PAUSE_5S_RETRY:"PAUSE_5S_RETRY",NO_DATA_RECEIVED:"NO_DATA_RECEIVED",NO_DATA_RECEIVED_IN:"NO_DATA_RECEIVED_IN",P2P_REPORT:"P2P_REPORT",AUTO_LOG:"AUTO_LOG",DATA_METRIC:"DATA_METRIC",DATA_METRIC2:"DATA_METRIC2",P2P_TIMEOUT:"P2P_TIMEOUT",FLV_TO_P2P:"FLV_TO_P2P",FLV_TRY_TO_P2P:"FLV_TRY_TO_P2P",FLAC_AUDIO_START:"FLAC_AUDIO_START",FLAC_AUDIO_ERROR:"FLAC_AUDIO_ERROR",FLAC_AUDIO_NEED_RETRY:"FLAC_AUDIO_NEED_RETRY",SIGNAL_PLAY:"SIGNAL_PLAY",SIGNAL_HEART:"SIGNAL_HEART",SIGNAL_DATA:"SIGNAL_DATA",SIGNAL_ER
1ROR:"SIGNAL_ERROR",H264_SEI_PLAY:"H264_SEI_PLAY",TRANS_END:"TRANS_END",NEED_UPDATE_M3U8:"NEED_UPDATE_M3U8",PLAYBACK_UPDATE:"PLAYBACK_UPDATE",PLAYBACK_M3U8_UPDATED:"PLAYBACK_M3U8_UPDATED",PLAYBACK_DIF_CDN:"PLAYBACK_DIF_CDN",UPDATE_INTERSITY:"UPDATE_INTERSITY",PLAY_DOWNLINK_INFO:"PLAY_DOWNLINK_INFO",PLAY_FRAME_BUFFER:"PLAY_FRAME_BUFFER",WEBRTC_VIDEO_ERROR:"WEBRTC_VIDEO_ERROR",SWITCH_DONE:"SWITCH_DONE",AUTO_BITRATE_CHANGED:"AUTO_BITRATE_CHANGED",AUTO_FORCE_RSP:"AUTO_FORCE_RSP",VISIBILITY_CHANGE:"VISIBILITY_CHANGE",REPLAY_VIDEO:"REPLAY_VIDEO",P2P_PLAYING_EVENT:"P2P_PLAYING_EVENT",TURN_TO_H264:"TURN_TO_H264",H265_VIDEO_RETRY:"H265_VIDEO_RETRY",H265_PLAY:"H265_PLAY",PAUSE_5SEC_ERROR:"PAUSE_5SEC_ERROR",TRY_TO_AV1:"TRY_TO_AV1",M3U8_PLAY_ENDED:"M3U8_PLAY_ENDED",SEI_INFO:"SEI_INFO",SEI_DATACHANNEL_INFO:"SEI_DATACHANNEL_INFO",VIDEO_RESOLUTION_CHANGE:"VIDEO_RESOLUTION_CHANGE",TURN_TO_MSE:"TURN_TO_MSE",TURN_TO_WEBCODECS_SOFT:"TURN_TO_WEBCODECS_SOFT",WEBCODECS_RETRY:"WEBCODECS_RETRY",TURN_TO_H265_WASM:"TURN_TO_H265_WASM",SHIELD_AUDIO_SWITCH_STATUS:"SHIELD_AUDIO_SWITCH_STATUS",RESET_PLAYER:"RESET_PLAYER",PLAY_TIMEOUT:"PLAY_TIMEOUT",SEEK_TIMEOUT:"SEEK_TIMEOUT",ON_VIDEO_ENHANCE_ERROR:"ON_VIDEO_ENHANCE_ERROR",ON_VIDEO_ENHANCE_SUCCESS:"ON_VIDEO_ENHANCE_SUCCESS",ON_VIDEO_ENHANCE_UNSUPPORT:"ON_VIDEO_ENHANCE_UNSUPPORT",VIDEO_AVCCFG_CHANGE:"VIDEO_AVCCFG_CHANGE",VIDEO_ENDED:"VIDEO_ENDED",VIDEO_LOOP_ENDED:"VIDEO_LOOP_ENDED",VIDEO_MP4_ERROR:"VIDEO_MP4_ERROR",VIDEO_TAG_ENDED:"VIDEO_TAG_ENDED",VIDEO_TAG_SEEKED:"VIDEO_TAG_SEEKED",VIDEO_TAG_PLAYING:"VIDEO_TAG_PLAYING",VIDEO_TAG_PROGRESS:"VIDEO_TAG_PROGRESS",VIDEO_TAG_CANPLAY:"VIDEO_TAG_CANPLAY",VIDEO_TAG_PAUSE:"VIDEO_TAG_PAUSE",VIDEO_TAG_LOADSTART:"VIDEO_TAG_LOADSTART",VIDEO_TAG_PLAY:"VIDEO_TAG_PLAY",VIDEO_NATIVE_PLAY:"VIDEO_NATIVE_PLAY"},B="VIDEO_INIT",V="VIDEO_LOADING",U="VIDEO_PLAYING",x="VIDEO_STOP",H="VIDEO_CACHING",G="BROWSER_PAUSE",W="BROWSER_AUTOPLAY_FAIL",j={AUTO_VIEW_REPORT:"_autoViewReport",LOAD_VIDEO_TS_V2_FAIL:"_load_video_ts_v2_fail",VIDEO_BAD_QUALITY:"_video_bad_quality",RETRY_STREAM:"_retry_stream",LOCAL_RETRY:"_localRetry",LOAD_VOD_FAIL:"_load_vod_fail",VIDEO_BAD_QUALITY_VOD:"_video_bad_quality_vod",RETRY_STREAM_VOD:"_retry_stream_vod",AUTO_VIEW_LOG:"_autoViewLog",getLocalRetry:function(t){1==D[this.LOCAL_RETRY]&&t.push(1)}},Y=new(function(){function t(){Object(s.a)(this,t),this._hlsPlayer=null,this._m3u8Status=0,this._m3u8Loader=null,this._firstTs=null,this._firstFragStatus=0,this._mp4Status=0}return Object(r.a)(t,[{key:"destroy",value:function(t){this._hlsPlayer===t&&(this._hlsPlayer=null)}},{key:"reset",value:function(){this._hlsPlayer=null,this._m3u8Status=0,this._m3u8Loader=null,this._firstTs=null,this._firstFragStatus=0,this._mp4Status=0}},{key:"setHlsPlayer",value:function(t){this._hlsPlayer=t}},{key:"setM3u8Loader",value:function(t){this._m3u8Loader=t}},{key:"setM3u8Status",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;I.log("VodNoPictureHelper.setM3u8Status status: ",t),this._m3u8Status=t}},{key:"getM3u8Status",value:function(){if(0!==this._m3u8Status||!this._m3u8Loader)return this._m3u8Status;var t=this._m3u8Loader.getLoaderHandler();return t&&(t.status>=200&&t.status<300&&4===t.readyState?this._m3u8Status=1:t.status>=200&&t.status<300&&t.readyState<4?this._m3u8Status=-4:t.status>=300?this._m3u8Status=-1:0===t.status&&4===t.readyState?this._m3u8Status=-2:this._m3u8Status=-3),this._m3u8Status}},{key:"getM3u8Reason",value:function(){var t=0;switch(this.getM3u8Status()){case -1:t=101;break;case -2:t=102;break;case -4:t=104;break;case -3:t=103}return t}},{key:"setFirstTs",value:function(t){this._firstTs=t}},{key:"setFirstFragStatus",value:function(t){I.log("VodNoPictureHelper.setFirstFragStatus status: ",t),this._firstFragStatus=t}},{key:"getFirstFragStatus",value:function(){return this._firstFragStatus}},{key:"getTsReason",value:function(){var t=0;switch(this._firstFragStatus){case 1:case -2:t=106;break;case -1:t=105;break;case 2:t=107;break;case -3:t=108;break;case 3:case 4:this._hlsPlayer&&(t=this._hlsPlayer.getBufferLen()<=200?109:110);break;case -4:t=111}
1return t}},{key:"getHlsNoPictureReason",value:function(){var t=0;return(this._firstTs||0===(t=this.getM3u8Reason()))&&(t=this.getTsReason()),0===t&&(t=112),I.log("VodNoPictureHelper.getHlsNoPictureReason reason: ",t),t}},{key:"setMP4Status",value:function(t){this._mp4Status=t}},{key:"getMP4NoPictureReason",value:function(){var t=0;switch(this._mp4Status){case 1:t=113;break;case -1:t=114}return 0===t&&(t=115),I.log("VodNoPictureHelper.getMP4NoPictureReason reason: ",t),t}}]),t}()),q=new(function(){function t(){Object(s.a)(this,t),this._tsdb=null,this._sessionId=0,this._line=0,this._sDisplayName="",this._bitrate=0,this._fails=this.readLocal(j.LOAD_VIDEO_TS_V2_FAIL),this._qualitys=this.readLocal(j.VIDEO_BAD_QUALITY),this._retrys=this.readLocal(j.RETRY_STREAM),this._vodFails=this.readLocal(j.LOAD_VOD_FAIL),this._vodQualitys=this.readLocal(j.VIDEO_BAD_QUALITY_VOD),this._vodRetrys=this.readLocal(j.RETRY_STREAM_VOD)}return Object(r.a)(t,[{key:"readLocal",value:function(t){return D.hasOwnProperty(t)?JSON.parse(D.getItem(t)):{}}},{key:"addBadQuality",value:function(t){this.isOpen()&&(this._addHis(t,this._qualitys),D.setItem(j.VIDEO_BAD_QUALITY,JSON.stringify(this._qualitys)))}},{key:"addRetryStream",value:function(t){this.isOpen()&&(this._addHis(t,this._retrys),D.setItem(j.RETRY_STREAM,JSON.stringify(this._retrys)))}},{key:"_addHis",value:function(t,e){var i=this._getKey(t);this._addHisByKey(i,e)}},{key:"_addHisByKey",value:function(t,e){e.hasOwnProperty(t)?e[t]++:e[t]=1}},{key:"delFail",value:function(t){if(this.isOpen()){var e=this._getKey(t);delete this._fails[e],D.setItem(j.LOAD_VIDEO_TS_V2_FAIL,JSON.stringify(this._fails)),delete this._retrys[e],D.setItem(j.RETRY_STREAM,JSON.stringify(this._retrys)),I.log("AutoTestHelper.delFail: ".concat(e))}}},{key:"addFail",value:function(t,e){var i=e.loadTime,s=e.connectTime,r=e.recvDataTime;if(this.isOpen()){var a=t.getComDim(R.DIM_COM.P2P),n=t.getComDim(R.DIM_COM.CDN_CIP),o=t.getComDim(R.DIM_COM.CDN_SIP),u=this._getKey(t);I.log("AutoTestHelper.addFail: ".concat(u,", loadTime=").concat(i," connectTime=").concat(s," recvDataTime=").concat(r," cdn_cip=").concat(n," cdn_sip=").concat(o));var l="";0===s?l=a===R.LIVE_TYPE.HLS?"m3u8ä¸è½½å¤±è´¥":"ææµè¿æ¥ä¸ä¸":(l=0===r?a===R.LIVE_TYPE.HLS?"tsä¸è½½å¤±è´¥":"ææµè¿æ¥æå没æ¶å°æ°æ®":a===R.LIVE_TYPE.HLS?"m3u8ä¸è½½èæ¶=".concat(s,"msãtsä¸è½½èæ¶=").concat(r):"ææµè¿æ¥èæ¶=".concat(s,"msãæ¶æ°æ®èæ¶=").concat(r,"ms"),o&&(l+=",".concat(o))),this._fails.hasOwnProperty(u)?this._fails[u].push(l):this._fails[u]=[l],D.setItem(j.LOAD_VIDEO_TS_V2_FAIL,JSON.stringify(this._fails))}}},{key:"_getKey",value:function(t){var e=t.getComDim(R.DIM_COM.P2P),i=t.getComDim(R.DIM_COM.H265);return"".concat(this._line,"_").concat(this._sDisplayName,"_").concat(this._bitrate,"_").concat(e,"_").concat(i)}},{key:"addVodFail",value:function(t){if(this.isOpen()){var e=-1!==t.indexOf(".mp4")?Y.getMP4NoPictureReason():Y.getHlsNoPictureReason(),i=this._getVodKey(t);I.log("AutoTestHelper.addVodFail: ".concat(i,", ").concat(e));var s=this._vodFails[i];s||(s=[],this._vodFails[i]=s),s.push(e),D.setItem(j.LOAD_VOD_FAIL,JSON.stringify(this._vodFails))}}},{key:"delVodFail",value:function(t){if(this.isOpen()){var e=this._getVodKey(t);I.log("AutoTestHelper.delVodFail: ".concat(e)),delete this._vodFails[e],D.removeItem(j.LOAD_VOD_FAIL)}}},{key:"addBadQualityVod",value:function(t){if(this.isOpen()){var e=this._getVodKey(t);I.log("AutoTestHelper.addBadQualityVod: ".concat(e)),this._addHisByKey(e,this._vodQualitys),D.setItem(j.VIDEO_BAD_QUALITY_VOD,JSON.stringify(this._vodQualitys))}}},{key:"addRetryStreamVod",value:function(t){if(this.isOpen()){var e=this._getVodKey(t);I.log("AutoTestHelper.addRetryStreamVod: ".concat(e)),this._addHisByKey(e,this._vodRetrys),D.setItem(j.RETRY_STREAM_VOD,JSON.stringify(this._vodRetrys))}}},{key:"_getVodKey",value:function(t){return t.split("//")[1].split("?")[0]}},{key:"isOpen",value:function(){return"1"===D.getItem(j.AUTO_VIEW_REPORT)}},{key:"bindEvent",value:function(t,e,i,s,r){var a=this;this._sessionId=e,this._line=i,this._sDisplayName=s,this._bitrate=r,this.isOpen()&&(this._tsdb=t,window._autoTestComplete=function(t){a._tsdb.sendAutoTestResult(t)}
1,window._autoTestAct=function(t,e,i){a._tsdb.sendAutoTestAct(t,e,i)})}}]),t}()),K=!1,z=!1,J=function(){function t(e){var i=e.eventEmiter,r=e.stat,a=e.statVod;Object(s.a)(this,t),this.eventEmiter=i,this.stat=r,this.statVod=a,this.isSendLoadTime=!1,this.isSendHlsLoadTime=!1,this.isSendH265=!1,this.hasP2P=0,this.restartReason=-1,this.restartTimes=0,this.turnToFlvReason=-1,this.turnToFlvTimes=0,this.httpError=!1,this.busiSource="",this.isSendM3u8LoadTime=!1,this.isSendVodLoadTime=!1,this.isSendVodM3u8LoadTime=!1,this.isClosedSendVodLoadTime=!1}return Object(r.a)(t,[{key:"destroy",value:function(){this.eventEmiter=null,this.stat=null,this.statVod=null}},{key:"closeSendVodLoadTime",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isClosedSendVodLoadTime=t}},{key:"sendCdnTime",value:function(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,o=arguments.length>7?arguments[7]:void 0;if(e){var u=Math.max(0,t.connectVideoTime-t.startTime),l=t.firstVideoPkgTime-t.connectVideoTime,d=t.firstIFrameTime1-t.connectVideoTime,c=t.firstIFrameTime2-t.firstIFrameTime1,f=t.firstRenderTime-t.firstIFrameTime2,p=t.onPlayTime-t.firstRenderTime,m=t.recvDataTime-t.startTime,_=(t.onPlayTime,t.startTime,t.firstP2POnDataTime-t.startTime);_=_<0?0:_;var y=0;t.firstP2PIframeTime>0&&(y=(y=t.firstP2PIframeTime-t.startTime)<0?0:y);var v=0;r&&(v+=1),s&&(v+=2),this.stat.setComDim(R.DIM_COM.ACT_LOAD_TYPE,v);var S=[t.hyPlayerLoadTs,m,u,s,r,i,a,n,0,_,y];j.getLocalRetry(S);var g=[this.stat.createAct(R.ACT.CONNECT_VIDEO_TS,{value:[u]}),this.stat.createAct(R.ACT.FIRST_VIDEO_PKG_TS,{value:[l]}),this.stat.createAct(R.ACT.FIRST_VIDEO_IFRAME_TS,{value:[d]}),this.stat.createAct(R.ACT.VIDEO_IFRAME_TS,{value:[c]}),this.stat.createAct(R.ACT.FIRST_VIDEO_RENDER_TS,{value:[f]}),this.stat.createAct(R.ACT.VIDEO_PLAYED_TS,{value:[p]}),this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:S,str:[o]})];if(I.log("TsdbUtils.sendCdnTime, loadTime=".concat(t.hyPlayerLoadTs,", connectTime=").concat(u,", recvDataTime=").concat(m)),this.sendMetrics([this.stat.createAct(R.ACT.VIDEO_LOAD_TS_V2,{value:S,str:[o,+!this.isSendLoadTime]})]),t.hyPlayerLoadTs>=F.autoReportTime&&this.autoReport(),this.isSendLoadTime)return;this.isSendLoadTime=!0,this.sendMetrics(g)}else{var T=t.getVPTime-t.startTime,P=Math.max(0,t.connectVideoTime-t.getVPTime),C=t.loginTime-t.connectVideoTime,E=t.firstVideoPkgTime-t.loginTime,k=t.firstIFrameTime-t.firstVideoPkgTime,A=t.firstRenderTime-t.firstIFrameTime,D=t.onPlayTime-t.firstRenderTime,O=t.onPlayTime-t.startTime,b=[this.stat.createAct(R.ACT.VIDEO_GET_VP_TS,{value:[T]}),this.stat.createAct(R.ACT.CONNECT_VIDEO_TS,{value:[P]}),this.stat.createAct(R.ACT.VIDEO_LOGIN_TS,{value:[C]}),this.stat.createAct(R.ACT.FIRST_VIDEO_PKG_TS,{value:[E]}),this.stat.createAct(R.ACT.FIRST_VIDEO_IFRAME_TS,{value:[k]}),this.stat.createAct(R.ACT.FIRST_VIDEO_RENDER_TS,{value:[A]}),this.stat.createAct(R.ACT.VIDEO_PLAYED_TS,{value:[D]}),this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:[O]})];this.sendMetrics(b)}}},{key:"sendFlvTime",value:function(t,e,i,s){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,l=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,d=arguments.length>10&&void 0!==arguments[10]?arguments[10]:0,c=arguments.length>11&&void 0!==arguments[11]?arguments[11]:0,f=arguments.length>12?arguments[12]:void 0,p=0;n&&(p+=1),a&&(p+=2),this.stat.setComDim(R.DIM_COM.ACT_LOAD_TYPE,p);var m=[t,i,e,a,n,o,d,c,0,u,l];j.getLocalRetry(m);var _=[this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:m,str:[f]}),this.stat.createAct(R.ACT.CONNECT_VIDEO_TS,{value:[e]}),this.stat.createAct(R.ACT.RECV_VIDEO_TS,{value:[i,s]})];t>1e4||e>1e4||(I.log("TsdbUtils.sendCdnTime, loadTime=".concat(t,", connectTime=").concat(e,", recvDataTime=").concat(i)),this.sendMetrics([this.stat.createAct(R.ACT.VIDEO_LOAD_TS_V2,{value:m,str:[f,+!this.isSendLoadTime]})]),t>=F.autoReportTime&&this.autoReport(),this.isSendLoadTime&&!r||(this.isSendLoadTime=!0,this.sendMetrics(_)))}}
1,{key:"sendWebRtcTime",value:function(t,e,i,s,r){this.isSendLoadTime=!0,this.stat.setActDim("p2p","3");var a=[this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:[t,0,0,0,0,e,i,s,r]})];this.sendMetrics(a)}},{key:"sendHlsTime",value:function(t,e,i,s,r,a){var n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,l=arguments.length>9?arguments[9]:void 0,d=0;o&&(d+=1),n&&(d+=2),this.stat.setComDim(R.DIM_COM.ACT_LOAD_TYPE,d);var c=[e,t,0,n,o,r,u,0,0,0,0];if(j.getLocalRetry(c),this.sendMetrics([this.stat.createAct(R.ACT.VIDEO_LOAD_TS_V2,{value:c,str:[this.busiSource]})]),!(this.isSendHlsLoadTime||(this.isSendHlsLoadTime=!0,e>1e4||i>1e4||r>1e4))){var f=[this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:c,str:[this.busiSource]}),this.stat.createAct(R.ACT.VIDEO_LOAD_SEG,{value:l}),this.stat.createAct(R.ACT.FIRST_FRAG_LOAD_TS,{value:[s,t]}),this.stat.createAct(R.ACT.FIRST_FRAG_LOADED_TS,{value:[r,t,u]}),this.stat.createAct(R.ACT.FIRST_FRAG_SIZE,{value:[a,t]})];i>0&&!this.isSendM3u8LoadTime&&(f.push(this.stat.createAct(R.ACT.LOAD_M3U8_TS,{value:[i,t]})),this.isSendM3u8LoadTime=!0),this.sendMetrics(f)}}},{key:"sendM3u8LoadedTime",value:function(t,e){if(!(this.isSendM3u8LoadTime||e>1e4)){this.isSendM3u8LoadTime=!0;var i=[this.stat.createAct(R.ACT.LOAD_M3U8_TS,{value:[e,t]})];this.sendMetrics(i)}}},{key:"sendVodHlsTime",value:function(t){var e=t.loadType,i=t.loadTime,s=t.loadM3u8Time,r=t.firstFragLoadTs,a=t.firstFragLoadedTs,n=t.firstFragSize,o=t.businessCost,u=t.UICost,l=t.firstFragParsedTs,d=void 0===l?0:l,c=t.playTs,f=t.startTs,p=t.m3u8Status,m=t.firstTsStatus,_=t.costTimes;if(!this.isClosedSendVodLoadTime&&!(this.isSendVodLoadTime||(this.isSendVodLoadTime=!0,i>1e4&&99999!=i))){var y=[i,e,p,m,s,a,d,void 0===o?0:o,void 0===u?0:u,f,c],v=[this.statVod.createAct(R.ACT.VIDEO_LOAD_TS,{value:y,str:["",+!K]}),this.statVod.createAct(R.ACT.VIDEO_LOAD_SEG,{value:_})];i<1e4&&(v=v.concat([this.statVod.createAct(R.ACT.FIRST_FRAG_LOAD_TS,{value:[r,e]}),this.statVod.createAct(R.ACT.FIRST_FRAG_LOADED_TS,{value:[a,e,d]}),this.statVod.createAct(R.ACT.FIRST_FRAG_SIZE,{value:[n,e]})])),s>0&&!this.isSendVodM3u8LoadTime&&(v.push(this.statVod.createAct(R.ACT.LOAD_M3U8_TS,{value:[s,e]})),this.isSendVodM3u8LoadTime=!0),this.sendMetrics(v),K=!0}}},{key:"sendVodM3u8LoadedTime",value:function(t,e){if(!(this.isSendVodM3u8LoadTime||e>1e4)){this.isSendVodM3u8LoadTime=!0;var i=[this.statVod.createAct(R.ACT.LOAD_M3U8_TS,{value:[e,t]})];this.sendMetrics(i)}}},{key:"sendNoPictureTime",value:function(t,e,i,s){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=g.now(),n=[t,i=i>0?i:0,e=e>0?e:0],o=a-this.stat.create_time;I.log("TsdbUtils.sendNoPictureTime, loadTime=".concat(t,", connectTime=").concat(e,", recvDataTime=").concat(i,", type=").concat(s,", now=").concat(a,", create_time=").concat(this.stat.create_time,", timeDelta=").concat(o));var u=[this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:n,str:[r,s]})];this.sendMetrics(u)}},{key:"sendNoPictureTimeAll",value:function(t,e,i,s){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5?arguments[5]:void 0,n=g.now(),o=[t,i=i>0?i:99999,e=e>0?e:99999,0,0,0,0,0,0,0,0];j.getLocalRetry(o);var u=n-this.stat.create_time;I.log("TsdbUtils.sendNoPictureTimeAll, loadTime=".concat(t,", connectTime=").concat(e,", recvDataTime=").concat(i,", type=").concat(s,", now=").concat(n,", create_time=").concat(this.stat.create_time,", timeDelta=").concat(u)),this.stat.setActDim(R.DIM_LINK_STA.name,a);var l=[this.stat.createAct(R.ACT.VIDEO_LOAD_TS_V2,{value:o,str:[r,s,a]})];D[j.AUTO_VIEW_LOG]=1,q.addFail(this.stat,{loadTime:t,connectTime:e,recvDataTime:i}),this.autoReport(),this.sendMetrics(l)}},{key:"autoReport",value:function(){(1===Number(D.getItem(j.AUTO_VIEW_REPORT))||F.isAutoReport(w.uid))&&this.eventEmiter.trigger(N.P2P_REPORT)}},{key:"sendAutoTestResult",value:function(t){I.log("TsdbUtils.sendAutoTestResult, result=".concat(t));var e=[this.stat.createAct(R.ACT.AUTO_TEST_RESULT,{str:[t]})];this.sendMetrics(e)}}
1,{key:"sendAutoTestAct",value:function(t,e,i){I.log("TsdbUtils.sendAutoTestAct, actType=".concat(t,", values=").concat(e,", strs=").concat(i));var s=[this.stat.createAct(t,{value:e,str:i})];this.sendMetrics(s)}},{key:"setBusiSource",value:function(t){this.busiSource=t}},{key:"sendMP4Time",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.loadTime;if(!(e>1e4)){var i=[this.stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:[e],str:[this.busiSource]})];this.sendMetrics(i)}}},{key:"sendVodMP4Time",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.loadTime,i=t.errorLoadTime,s=t.errorMessage,r=[this.statVod.createAct(R.ACT.VIDEO_LOAD_TS,{value:[e,0,0,i],str:[this.busiSource,+!z,s||""]})];this.sendMetrics(r),z=!0}},{key:"sendMetrics",value:function(t){this.stat.checkFilter(t),t.length>0&&this.eventEmiter.trigger(N.DATA_METRIC2,t)}},{key:"sendOldMetrics",value:function(t){this.eventEmiter.trigger(N.DATA_METRIC,t)}}]),t}();J.METRIC={VIDEO_FLOW_LINE:"video.flow.line",VIDEO_FLOW_P2P:"video.flow.p2p",VIDEO_BAD_QUALITY_RATIO:"video.video_bad_quality_ratio",WEB_HLS_PLAY_VIDEO_RATIO:"web.hls.play_video_ratio",WEB_HLS_PLAY_SUC_RATIO:"web.hls.play_suc_ratio",WEB_P2P_PLAY_RATIO:"web.p2p.play_ratio",WEB_P2P_PUNCH:"web.p2p.punch",WEB_P2P_BW_P2P_VALID:"web.p2p.bw_p2p_valid",WEB_P2P_BW_P2P_REPEAT:"web.p2p.bw_p2p_repeat",WEB_P2P_BW_P2P_TOTAL:"web.p2p.bw_p2p_total",WEB_P2P_BW_CDN_VALID:"web.p2p.bw_cdn_valid",WEB_P2P_BW_CDN_REPEAT:"web.p2p.bw_cdn_repeat",WEB_P2P_BW_CDN_TOTAL:"web.p2p.bw_cdn_total",WEB_P2P_BW_RANGE_VALID:"web.p2p.bw_range_valid",WEB_P2P_BW_RANGE_TOTAL:"web.p2p.bw_range_total",WEB_P2P_PLAY_FAIL:"web.p2p.play_fail",WEB_P2P_LOAD_RATIO:"web.p2p.load_ratio",WEB_P2P_CDN_RESTART:"web.p2p.cdn_restart",WEB_P2P_TCP_NO_SLICE:"web.p2p.tcp_no_slice",WEB_P2P_TCP_OPEN_TIME:"web.p2p.tcp_open_time",WEB_P2P_HTTP_CODE:"web.p2p.http_code_",WEB_P2P_TCP_TIMEOUT:"web.p2p.tcp_timeout",WEB_H265:"web.h265",SDK_P2P_TCP:"sdk.p2p.tcp",SDK_VIDEO_LOGIN_SUC:"sdk.video.login_suc",SDK_P2P_COOLING:"sdk.p2p.cooling",SDK_P2P_SERVER_OPEN:"sdk.p2p.server_open",SDK_P2P_USER_PROPERTY:"sdk.p2p.user_property",VIDEO_VIDEO_BAD_QUALITY_5M_RATIO:"video.video_bad_quality_5m_ratio",VIDEO_VIDEO_LOAD_ERROR:"video_load_error",RECV_DANMU_CARTON:"recv_danmu_carton",SDK_P2P_DETAILS:"sdk.p2p.details",SDK_P2P_FORCE_REASON:"sdk.p2p.force_reason",SDK_P2P_DEFAULT_REASON:"sdk.p2p.default_reason",SDK_P2P_VALID_RET:"sdk.p2p.valid_ret",SDK_P2P_GET_NODE:"sdk.p2p.get_node",WEB_USER:"web.user"},J.INTERVAL={SDK_VIDEO_QUALITY:"sdk.video.quality",SDK_VIDEO_QUALITY_5M:"sdk.video.quality_5m",SDK_CALC_FLOW:"sdk.calc.flow",SDK_P2P_TCP:"sdk.p2p.tcp",SDK_P2P_FLOW:"sdk.p2p.flow",SDK_P2P_PUNCH:"sdk.p2p.punch",SDK_P2P_SUB:"sdk.p2p.sub",SDK_P2P_RESEND:"sdk.p2p.resend",SDK_P2P_DELAY:"sdk.p2p.resend",SDK_P2P_OTHER:"sdk.p2p.other"},J.TRIGGER={SDK_HLS_PLAY:"sdk.hls.play",SDK_HLS_LOAD:"sdk.hls.load",SDK_MSE_ERROR:"sdk.mse.error",SDK_P2P_LOAD:"sdk.p2p.load",SDK_P2P_LOAD_SAMPLE:"sdk.p2p.load_sample",SDK_P2P_RESTART:"sdk.p2p.restart",SDK_WEB_H265:"sdk.web.h265"};var Q=i(11),X=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;Object(s.a)(this,t),this.maxSize=e,this.sum=0,this.list=[],this.idx=0,this.cur=0}return Object(r.a)(t,[{key:"reset",value:function(){this.sum=0,this.list=[],this.idx=0,this.cur=0}},{key:"addCur",value:function(t){this.cur+=t}},{key:"calculate",value:function(){this.add(this.cur);var t=this.cur;return this.cur=0,t}},{key:"add",value:function(t){this.sum+=t,this.list.length<this.maxSize?this.list.push(t):(this.sum-=this.list[this.idx],this.list[this.idx]=t),this.idx++,this.idx>=this.maxSize&&(this.idx=0)}},{key:"average",value:function(){return 0===this.list.length?O.UintMax:Math.round(this.sum/this.list.length)}},{key:"getSamples",value:function(){return this.list}},{key:"max",value:function(){if(0===this.list.length)return O.UintMax;var t,e=0,i=Object(Q.a)(this.list);try{for(i.s();!(t=i.n()).done;){var s=t.value;s>e&&(e=s)}}catch(t){i.e(t)}finally{i.f()}return e}},{key:"min",value:function(){var t,e=O.UintMax,i=Object(Q.a)(this.list);try{for(i.s();!(t=i.n()).done;){var s=t.value;s<e&&(e=s)}}catch(t){i.e(t)}finally{i.f()}return e}}]),t}(),$=function(){function t(){Object(s.a)(this,t),this.speed=new X(20),this.rtt=new X(20),this.p2p=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.speed&&this.speed.reset(),this.speed=null,this.rtt&&this.rtt.reset(),this.rtt=null}},{key:"addSpeed",value:function(t){var e=parseInt(t.replace("KB",""));this.speed.add(e)}},{key:"addRtt",value:function(t){this.rtt.add(t)}},{key:"setP2p",value:function(t){this.p2p=t}},{key:"getP2p",value:function(){return this.p2p}},{key:"getResult",value:function(){return{speed:this.speed.getSamples(),rtt:this.rtt.getSamples(),p2p:this.p2p}}}]),t}(),Z=function(){function t(e){Object(s.a)(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup),this.fromByte=0,this.toByte=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){this.loader&&(this.stats.aborted=!0,this.loader.abort()),this.timeoutHandle&&window.clearTimeout(this.timeoutHandle)}}
1,{key:"load",value:function(t,e,i,s,r,a,n,o){var u=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null;this.url=t,this.responseType=e,this.onSuccess=i,this.onError=s,this.onTimeout=r,this.onProgress=u,this.stats={trequest:performance.now(),retry:0},this.timeout=a,this.maxRetry=n,this.retryDelay=o,this.timeoutHandle=window.setTimeout(this.loadtimeout.bind(this),a),this.loadInternal()}},{key:"loadBuffer",value:function(t,e,i,s,r,a,n,o,u){this.onOpen=e,this.load(t,"arraybuffer",function(t){i(t.target.response,L.HLS_LOAD_TYPE.XHR),s(L.HLS_LOAD_TYPE.XHR)},r,a,n,o,u)}},{key:"loadInternal",value:function(){var t=this.loader=new XMLHttpRequest;t.onload=this.loadsuccess.bind(this),t.onerror=this.loaderror.bind(this),t.onprogress=this.loadprogress.bind(this),t.onloadend=this.loadend.bind(this),t.onloadstart=this.loadstart.bind(this),t.responseType=this.responseType,(""===this.responseType||"text"===this.responseType)&&t.overrideMimeType&&t.overrideMimeType("text/plain; charset=utf-8"),t.open("GET",this.url,!0),this.fromByte>0&&t.setRequestHeader("Range","bytes=".concat(this.fromByte,"-").concat(this.toByte>0?this.toByte:"")),this.stats.tstart=null,this.stats.loaded=0,this.xhrSetup&&this.xhrSetup(t),this.stats.tstart=performance.now(),t.send()}},{key:"loadsuccess",value:function(t){404===t.currentTarget.status?this.onError(t):(window.clearTimeout(this.timeoutHandle),this.stats.tload=performance.now(),t.requestURL=this.url,this.onSuccess(t,this.stats))}},{key:"loaderror",value:function(t){if(404===t.currentTarget.status||0===t.currentTarget.status)return window.clearTimeout(this.timeoutHandle),void this.onError(t);this.stats.retry<this.maxRetry?(I.warn("XhrLoader.loaderror url="+this.url+" retryDelay="+this.retryDelay),this.destroy(),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),this.stats.retry++):(window.clearTimeout(this.timeoutHandle),I.warn("XhrLoader.loaderror reach max retry url="+this.url),this.onError(t))}},{key:"loadtimeout",value:function(){this.stats.retry<this.maxRetry?(I.warn("XhrLoader.loadtimeout url="+this.url+" retryDelay="+this.retryDelay),this.destroy(),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),this.stats.retry++):(window.clearTimeout(this.timeoutHandle),I.warn("XhrLoader.loadtimeout max retry url="+this.url),this.onTimeout(this.loader))}},{key:"loadstart",value:function(){this.onOpen&&this.onOpen()}},{key:"loadprogress",value:function(t){var e=this.stats;null===e.tfirst&&(e.tfirst=performance.now()),e.loaded=t.loaded,this.onProgress&&this.onProgress(t,e)}},{key:"loadend",value:function(t){404===t.currentTarget.status&&this.loaderror(t)}},{key:"getResponseHeader",value:function(t){return this.loader&&this.loader.getResponseHeader&&this.loader.getResponseHeader(t)}},{key:"getLoaderHandler",value:function(){return this.loader}}]),t}(),tt=i(19),te=i.n(tt),ti=function(){function t(){Object(s.a)(this,t),this.startSeq=1e3,this.m3u8Len=0,this.preTsArr=void 0}return Object(r.a)(t,[{key:"genSnFromM3u8",value:function(t){var e=this.convertM3u8ToArray(t);if(void 0===this.preTsArr)this.preTsArr=e;else{var i=this.findSeq(this.preTsArr,e[0],this.startSeq);-1===i&&(i=this.startSeq+this.preTsArr.length),this.preTsArr=e,this.startSeq=i}return this.startSeq}},{key:"convertM3u8ToArray",value:function(t){for(var e,i=/#EXT(INF):([\d\.]+)[^\r\n]*[\r\n]+([^#|\r\n]+)?/gi,s=[];null!==(e=i.exec(t));)e.shift(),"INF"===(e=e.filter(function(t){return void 0!==t}))[0]&&s.push(e[2]),e=[];return s}},{key:"findSeq",value:function(t,e,i){for(var s=t.length-1;s>=0;s--){var r=t[s],a=r.split("?");r=a.length>1?a[0]:r;var n=e.split("?");if(r===(e=n.length>1?n[0]:e))return i+s}return -1}}]),t}(),ts={PCDN_REALTIME:1,PCDN_FREETIME:2,PCDN_NOT_OPEN:3,PCDN_CLIENT_NOT_OPEN:4,FIRST_TS:5,NOT_SEND_REQ:6,OPEN_BUFFER_NOT_REACHED:7,BUFFER_LACK_TO_CDN:8,REALTIME_NOT_REACHED:9,REALTIME_OVER_RUN:10,FREETIME_OVER_RUN:11,FREETIME_NOT_COVERD:12,ERROR_REQ:13,PCDN_REQ_OTHER:14,TAF_REQ_ERROR:15,TS_LOAD_ERROR:16},tr=function(){function t(){Object(s.a)(this,t),this.url="",this.time=0,this.duration=0,this.start=0,this.level=0,this.sn=0,this.discontinuity=!1,this.discontinuityCnt=0,this.byteRangeStartOffset=0,this.byteRangeEndOffset=0,this.decryptdata=null,this.pcdnFreetime=!1,this.isPcdn=!1,this.tryCnt=0,this.pcdnUrls=[],this.isLoadError=!1,this.statPcdn=!1,this.isFirstLoad=!1,this.pcdnStatus=ts.NOT_SEND_REQ,this.pcdnStatusBk1=ts.NOT_SEND_REQ,this.pcdnStatusBk2=ts.NOT_SEND_REQ,this.loadStartTs=0,this.loadEndTs=0,this.startDts=0,this.endDts=0}return Object(r.a)(t,[{key:"setUrl",value:function(t){this.url=t+""}},{key:"getUrl",value:function(t){var e=t.useCdn,i=t.bufferLen;return this.pcdnUrls.length>0&&i>=F.vodPcdnOpenBuffer&&!e?(this.isPcdn=!0,this.pcdnUrls.shift()):(this.isPcdn=!1,this.url)}},{key:"hasPcdn",value:function(){return this.pcdnUrls.length>0}},{key:"loadError",value:function(){this.isLoadError=!0}}]),t}(),ta={TS:1,M4S:2,getType:function(t){return -1!==t.indexOf(".m4s")?this.M4S:this.TS}},tn=function(){function t(e){Object(s.a)(this,t),this.isLive=e,this.seqGener=new ti,this.isSwitchSeamLessLine=!1}return Object(r.a)(t,[{key:"resolve",value:function(t,e){return t.indexOf("../")>=0?te.a.buildAbsolutePath(e,t):te.a.buildAbsoluteURL(e,t)}},{key:"resolveUrlQuery",value:function(t,e){return""!==e&&(-1===t.indexOf("?")?t+="?":t+="&",t+=e),t}},{key:"cloneObj",value:function(t){return JSON.parse(JSON.stringify(t))}},{key:"parseMasterPlaylist",value:function(t,e){for(var i,s,r,a=[],n={},o=/#EXT-X-STREAM-INF:([^\n\r]*(BAND)WIDTH=(\d+))?([^\n\r]*(CODECS)=\"([^\"\n\r]*)\",?)?([^\n\r]*(RES)OLUTION=(\d+)x(\d+))?([^\n\r]*(NAME)=\"(.*)\")?[^\n\r]*[\r\n]+([^\r\n]+)/gi;null!=(i=o.exec(t));){for(i.shift(),i=i.filter(function(t){return void 0!==t}),(n={}).url=this.resolve(i.pop(),e);i.length>0;)switch(i.shift()){case"RES":n.width=parseInt(i.shift()),n.height=parseInt(i.shift());break;case"BAND":n.bitrate=parseInt(i.shift());break;case"NAME":n.name=i.shift();break;case"CODECS":for(s=i.shift().split(",");s.length>0;)-1!==(r=s.shift()).indexOf("avc1")?n.videoCodec=this.avc1toavcoti(r):n.audioCodec=r}a.push(n)}return a}},{key:"avc1toavcoti",value:function(t){var e=t.split(".");return e.length>2?e.shift()+"."+parseInt(e.shift()).toString(16)+("00"+parseInt(e.shift()).toString(16)).substr(-4):t}},{key:"parseKeyParamsByRegex",value:function(t,e){var i=e.exec(t);return i&&(i.shift(),2===(i=i.filter(function(t){return void 0!==t})).length)?i[1]:null}}
1,{key:"parseLevelPlaylist",value:function(t,e,i){return this._parseByLine(t,e,i)}},{key:"_getUrlQuery",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=t.split("?");return e.length>=2&&e.shift(),e.join("")}},{key:"_getValue",value:function(t,e,i){for(var s=e+1;s<i;s++)if(!t[s].startsWith("#"))return[s,t[s]];return!1}},{key:"_getIv",value:function(t){for(var e=new Uint8Array(16),i=12;i<16;i++)e[i]=t>>8*(15-i)&255;return e}},{key:"_parseByLine",value:function(t,e,i){var s,r,a,n,o,u,l=0,d=0,c=!1,f=0,p={url:e,initUrl:"",fragments:[],fileType:-1,live:this.isLive,startSN:0},m=!1,_=0,y="";this.isLive||(p.startSN=s=this.seqGener.genSnFromM3u8(t),y=O.getQueryString("newmode",e)?this._getUrlQuery(e):"");for(var v={method:null,key:null,iv:null,uri:null},S=t.replace("\r").split("\n"),g=S.length,T=0;T<g;T++){var P=S[T];if(-1!==P.indexOf("#EXT-X-MEDIA-SEQUENCE"))this.isLive&&(d=p.startSN=parseInt(P.match(/\d+/g)[0]));else if(-1!==P.indexOf("#EXT-X-TARGETDURATION"))p.targetduration=parseFloat(P.match(/[\d\.]+/g)[0]);else if(-1!==P.indexOf("#EXT-X-ENDLIST"))p.live=!1,I.info("M3u8Parser.parseLevelPlaylist ENDLIST isLive=false");else if(-1!==P.indexOf("#EXT-X-MAP")){var C=P.match(/URI=\"(.+?)\"/);if(C[1]&&(p.initUrl=this.resolveUrlQuery(this.resolve(C[1],e),y),-1==p.initUrl.indexOf("?"))){var E=e.split("?");E.length>1&&(p.initUrl+="?".concat(E[1]))}}else if(-1!==P.indexOf("#EXT-X-DISCONTINUITY"))m=!0,_++;else if(-1!==P.indexOf("#EXT-X-BYTERANGE")){var k=P.match(/[\d@]+/g)[0].split("@");if(u=1===k.length?o:parseInt(k[1]),o=parseInt(k[0])+u,(n=p.fragments.length?p.fragments[p.fragments.length-1]:null)&&(n.byteRangeStartOffset=u,n.byteRangeEndOffset=o,(r=this._getValue(S,T,g))&&!n.url)){var A=r[1];n.setUrl(A?this.resolve(A,e):null)}}else if(-1!==P.indexOf("#EXT-ALIGN-PTS"))1===F.switchSeamLessLine&&(l=Number(P.replace("#EXT-ALIGN-PTS:","")),c=!0,this.isSwitchSeamLessLine=!0);else if(-1!==P.indexOf("#EXTINF")){var R,D=parseFloat(P.match(/[\d\.]+/g)[0]);if(!isNaN(D)&&(a=c?l:++d,this.isLive||(a=s++),v.method&&v.uri&&!v.iv?(R=this.cloneObj(v)).iv=this._getIv(this.isLive?d:a):R=v,r=this._getValue(S,T,g))){var b=r[1];(n=new tr).setUrl(b?this.resolveUrlQuery(this.resolve(b,e),y):null),n.time=b?te.a.getTimeFromUrl(b,this.isLive):0,n.duration=D,n.start=f,n.level=i,n.sn=a,n.discontinuity=m,n.discontinuityCnt=_,n.byteRangeStartOffset=u,n.byteRangeEndOffset=o,n.decryptdata=R,p.fragments.push(n),-1===p.fileType&&(p.fileType=ta.getType(b)),m&&(m=!1),f+=D,u=null}}else if(-1!==P.indexOf("#EXT-X-KEY")){var w=P.replace("#EXT-X-KEY:",""),L=this.parseKeyParamsByRegex(w,/(METHOD)=([^,]*)/),M=this.parseKeyParamsByRegex(w,/(URI)=["]([^,]*)["]/),N=this.parseKeyParamsByRegex(w,/(IV)=([^,]*)/);L&&(v={method:null,key:null,iv:null,uri:null},M&&"AES-128"===L&&(v.method=L,v.uri=this.resolve(M,e),v.key=null,N&&(v.iv=N,"0x"===v.iv.substring(0,2)&&(v.iv=v.iv.substring(2)),v.iv=v.iv.match(/.{8}/g),v.iv[0]=parseInt(v.iv[0],16),v.iv[1]=parseInt(v.iv[1],16),v.iv[2]=parseInt(v.iv[2],16),v.iv[3]=parseInt(v.iv[3],16),v.iv=new Uint32Array(v.iv))))}}if(p.totalduration=f,p.endSN=l-1,!this.isLive&&(p.endSN=s-1,p.fragments.length>1)){var B=p.fragments[0];B.duration<1&&(p.fragments.shift(),p.totalduration-=B.duration)}return p}},{key:"_parseByReg",value:function(t,e,i){var s,r,a,n,o,u=0,l=0,d={url:e,fragments:[],live:this.isLive,startSN:0},c=!1;this.isLive||(d.startSN=s=this.seqGener.genSnFromM3u8(t));for(var f={method:null,key:null,iv:null,uri:null},p=/(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.*))|(?:#EXT(INF):([\d\.]+)[^\r\n]*([\r\n]+[^#|\r\n]+)?)|(?:#EXT-X-(BYTERANGE):([\d]+[@[\d]*)]*[\r\n]+([^#|\r\n]+)?|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))/g;null!==(r=p.exec(t));)switch(r.shift(),(r=r.filter(function(t){return void 0!==t}))[0]){case"MEDIA-SEQUENCE":this.isLive&&(u=d.startSN=parseInt(r[1]));break;case"TARGETDURATION":d.targetduration=parseFloat(r[1]);break;case"ENDLIST":d.live=!1,I.info("M3u8Parser.parseLevelPlaylist ENDLIST isLive=false");break;case"DIS":c=!0;break;case"BYTERANGE":var m=r[1].split("@");o=1===m.length?n:parseInt(m[1]),n=parseInt(m[0])+o,(a=d.fragments.length?d.fragments[d.fragments.length-1]:null)&&!a.url&&(a.byteRangeStartOffset=o,a.byteRangeEndOffset=n,a.setUrl(this.resolve(r[2],e)));break;case"INF":var _=parseFloat(r[1]);if(!isNaN(_)){var y,v=u++;if(this.isLive||(v=s++),f.method&&f.uri&&!f.iv){y=this.cloneObj(f);for(var S=new Uint8Array(16),g=12;g<16;g++)S[g]=v>>8*(15-g)&255;y.iv=S}else y=f;var T=r[2];d.fragments.push({url:T?this.resolve(T,e):null,time:T?te.a.getTimeFromUrl(T,this.isLive):0,duration:_,start:l,level:i,sn:v,discontinuity:c,byteRangeStartOffset:o,byteRangeEndOffset:n,decryptdata:y}),c&&(c=!1),l+=_,o=null}break;case"KEY":var P=r[1],C=this.parseKeyParamsByRegex(P,/(METHOD)=([^,]*)/),E=this.parseKeyParamsByRegex(P,/(URI)=["]([^,]*)["]/),k=this.parseKeyParamsByRegex(P,/(IV)=([^,]*)/);C&&(f={method:null,key:null,iv:null,uri:null},E&&"AES-128"===C&&(f.method=C,f.uri=this.resolve(E,e),f.key=null,k&&(f.iv=k,"0x"===f.iv.substring(0,2)&&(f.iv=f.iv.substring(2)),f.iv=f.iv.match(/.{8}/g),f.iv[0]=parseInt(f.iv[0],16),f.iv[1]=parseInt(f.iv[1],16),f.iv[2]=parseInt(f.iv[2],16),f.iv[3]=parseInt(f.iv[3],16),f.iv=new Uint32Array(f.iv))))}return d.totalduration=l,d.endSN=u-1,this.isLive||(d.endSN=s-1),d}}]),t}(),to=i(21),th=i.n(to),tu=!1,tl=[],td=-1,tc=null,tf=!1,tp=!1;function tm(t,e){for(var i=0,s=tl.length;i<s;i++){var r=tl[i];if(r.callback==t&&r.thisObj==e)return r}return null}function t_(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if((i=0|(Number(i)||0))<10||i%10!=0||!t)return I.error("Timer.add Invalide interval value or callback function."),!1;var a=tm(t,e);return a||(a={callback:t,thisObj:e,bindCallback:e?t.bind(e):t,param:s},tl.push(a)),a.times=r,a.tickCount=0,a.interval=i/10,a.delayDel=!1,tv(),!0}function ty(t){t&&(t.callback=null,t.thisObj=null,t.bindCallback=null,t.param=null)}function tv(){tc&&1==Number(F.isForceUseWorker)?(tf=!0,tp=!1,tc.postMessage("start")):(tf=!1,tp=!0,-1===td&&(td=setInterval(tS,10)))}function tS(){!tf&&tp&&tg()}function tg(){if(0==tl.length)return tf=!1,tp=!1,void(tc?tc.postMessage("stop"):(clearInterval(td),td=-1));tu=!0;for(var t=g.now(),e=tl.length-1;e>=0;e--){var i=tl[e];if(i&&!i.delayDel){if(++i.tickCount%i.interval==0){var s=i.bindCallback,r=i.tickCount/i.interval;s(t,r,i.param),i.times>0&&i.times<=r&&i.tickCount>0&&tl.splice(e,1)}}else ty(i),tl.splice(e,1)}tu=!1}var tT,tP={initWorker:function(){!tc&&window.Worker&&(I.log("[ TimerWorker init ]"),(tc=th()(25)).addEventListener("message",function(t){1==t.data.type&&tf&&tg()}),tc.addEventListener("error",function(t){I.error("TimerWorker.error:",t.lineno+","+t.colno,t.message),tc.terminate(),tc=null,I.warn("[ TimerWorker terminate ]"),tv()}
1))},has:function(t,e){return!!tm(t,e)},add:t_,remove:function(t,e){for(var i=0,s=tl.length;i<s;i++){var r=tl[i];if(r.callback==t&&r.thisObj==e)return tu?r.delayDel=!0:(ty(r),tl.splice(i,1)),!0}return!1},once:function(t,e,i,s){t_(t,e,i+10,s,1)},getSize:function(){return tl.length}},tC=i(24).default,tE=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r){return Object(s.a)(this,i),e.call(this,t,r,R,ts,tP)}return Object(r.a)(i,[{key:"getVodPcdnProxy",value:function(t,e){var i=w.uid||w.getAnonymouUid();this._getVodPcdnProxy(t,e,{uid:i,appid:w.appid,sGuid:w.sGuid,TafLink:tC})}}]),i}(d.PcdnVodProxy),tI=function(){function t(e,i,r){Object(s.a)(this,t),this._isLive=r,this._details=null,this._fragments=null,this._totalDuration=0,this._idx=0,this._lastFrag=null,this._curFrag=null,this._seekTime=0,this._sOrigUrl="",this._initUrl="",this._fileType=1,this._pcdnIdx=-1,this._pcdnVodProxy=new tE(e,i)}return Object(r.a)(t,[{key:"destroy",value:function(){this._pcdnVodProxy&&this._pcdnVodProxy.destroy(),this._sOrigUrl=null,this._initUrl=null,this._details=null,this._fragments=null,this._lastFrag=null,this._curFrag=null}},{key:"hasFrag",value:function(){return this._fragments&&this._fragments.length>0}},{key:"rollback",value:function(){this._idx>0&&(this._idx--,this._curFrag=this._fragments[this._idx],this._lastFrag=null)}},{key:"setOrigUrl",value:function(t){this._sOrigUrl=t}},{key:"setFileType",value:function(t){this._fileType=t}},{key:"reset",value:function(){this._details=null,this._fragments=null,this._totalDuration=0,this._idx=0,this._lastFrag=null,this._curFrag=null,this._seekTime=0,this._pcdnIdx=-1,this._sOrigUrl=""}}
1,{key:"details",get:function(){return this._details},set:function(t){this._details=t,this._fragments=t.fragments,this._totalDuration=t.totalduration,this._initUrl=t.initUrl,this._fileType=t.fileType,this._seekTime>0&&(this.seek(this._seekTime),this._seekTime=0)}},{key:"isM4s",value:function(){return this._fileType===ta.M4S}},{key:"setInitUrl",value:function(t){this._initUrl=t}},{key:"getInitUrl",value:function(){return this._initUrl}},{key:"setFirst",value:function(){this._idx++}},{key:"currFragNum",get:function(){return this._fragments?this._fragments.length:0}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"lastFrag",get:function(){return this._lastFrag},set:function(t){t&&(this._lastFrag=t)}},{key:"curFrag",get:function(){return this._curFrag},set:function(t){t&&(this._lastFrag=this._curFrag,this._curFrag=t)}},{key:"isPcdnProxyOpen",get:function(){return this._pcdnVodProxy.isPcdnOpen}},{key:"isPcdnClientOpen",get:function(){return!F.isCloseVodPcdn}},{key:"getNearFragStart",value:function(t){var e=this._fragments;if(e){for(var i=null,s=0,r=e.length-1;s<r;s++)if((i=e[s]).start>t)return i.start}return Math.ceil(t+1)}},{key:"hasNextFrag",value:function(){var t=this._idx,e=this._fragments;return!!e&&(this._isLive?e.length>0:t<e.length)}},{key:"getFrag",value:function(t){var e=this._idx,i=this._fragments,s=null;return t?i.length>0&&(s=i.shift()):e<i.length&&(s=i[e],e++),s&&(this._idx=e,this._lastFrag=this._curFrag,this._curFrag=s),s}},{key:"seek",value:function(t){this._pcdnIdx=-1;var e=this._fragments;if(!e)return this._seekTime=t,!1;t=Math.min(t,this._totalDuration);for(var i=null,s=0,r=0,a=!1,n=this._fragments.length;r<n;r++)if(s=(i=e[r]).start+i.duration,i.start<=t&&t<s){s-.2<t&&r<n-1&&(i=e[r+1],r+=1),i.seeking=!0,a=!0;break}return a?(I.info("HlsPlaylist.seek suc seekTime=".concat(t," fragIdx=").concat(this._idx,", ").concat(r),i.sn),this._idx=r):I.info("HlsPlaylist.seek fail seekTime=".concat(t," fragIdx=").concat(this._idx)),a}},{key:"mergeDetails",value:function(t){var e=null;if(this._details){e=this._details;var i,s,r=0,a=0;i=(s=e.fragments.length>0?e.fragments[e.fragments.length-1]:this._curFrag).sn,a=s.start+s.duration;var n=[];t.fragments.forEach(function(t){t.sn>i&&(e.fragments.push(t),n.push(t))}),e.endSN=t.endSN,e.fragments.forEach(function(t){r+=t.duration,t.sn>i&&(t.start=a,a+=t.duration)}),e.totalduration=r,n.length>0&&q.isOpen()&&I.log("FragHelper.mergeDetails newFrags=".concat(n.length))}else e=t,this._isLive&&I.log("FragHelper.mergeDetails first frags=".concat(t.fragments.length));this.details=e}},{key:"getVodPcdnProxy",value:function(){if(1!==F.isCloseVodPcdn&&(-1===this._pcdnIdx||this._pcdnIdx-this._idx<=3)){-1===this._pcdnIdx&&(this._pcdnIdx=this._idx);for(var t=this._pcdnIdx+10,e=Math.min(this._fragments.length,t),i=[],s=[],r=this._pcdnIdx;r<e;r++){var a=this._fragments[r];i.push(a),s.push(a.sn)}i.length>0&&(I.log("FragHelper.getVodPcdnProxy firstIdx=".concat(this._pcdnIdx," sn=").concat(s.join(","))),this._pcdnVodProxy.getVodPcdnProxy(this._sOrigUrl,i),this._pcdnIdx=t)}}},{key:"getVodPcdnProxyCursor",value:function(){if(1!==F.isCloseVodPcdn&&this._pcdnVodProxy.isPcdnOpen){var t=[],e=[],i=this._idx;if(this._fragments.length-i>=3&&this._fragments[i].pcdnUrls.length>0&&this._fragments[i+1].pcdnUrls.length>0&&this._fragments[i+2].pcdnUrls.length>0)I.log("FragHelper.getVodPcdnProxy idx=".concat(this._idx-1," curFrag.sn=").concat(this._curFrag.sn," pcdn fragment is enough"));else{for(;i<this._fragments.length;){var s=this._fragments[i];if(s.pcdnUrls.length<=0&&(t.push(s),e.push(s.sn)),t.length>=10)break;i++}t.length>0&&(I.log("FragHelper.getVodPcdnProxy idx=".concat(this._idx-1," curFrag.sn=").concat(this._curFrag.sn," req sn=").concat(e.join(","))),this._pcdnVodProxy.getVodPcdnProxy(this._sOrigUrl,t))}}}}]),t}(),tk=function(){function t(e){Object(s.a)(this,t),this.hls=e,this.isLive=e.isLive,this.config=e.config,this.m3u8Parser=new tn(e.isLive),this.currLevelId=0,this.m3u8FileSize=0,this.levels=[],this.firstLevelLoaded=!1,this.m3u8Parsered=!1,this.loader=null,this.manifestLoadedTs=0,this.isMasterPlayList=!1,this.currLevel=null,this.fragHelper=new tI(e.statVod,e.stat,e.isLive),this.firstTsInfo=null,this.loadM3u8HttpCode=-1,this.m3u8ContentErrorCnt=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.m3u8Parser=null,this.currLevelId=0,this.m3u8FileSize=0,this.levels=null,this.currLevel=null,this.firstLevelLoaded=!1,this.m3u8Parsered=!1,this.loader&&this.loader.destroy(),this.loader=null,this.manifestLoadedTs=0,this.isMasterPlayList=!1,this.fragHelper&&this.fragHelper.destroy(),this.fragHelper=null,this.firstTsInfo=null,this.loadM3u8HttpCode=-1,this.config=null,this.hls=null}},{key:"currDetails",get:function(){return this.fragHelper.details}},{key:"currFragNum",get:function(){return this.fragHelper.currFragNum}},{key:"totalDuration",get:function(){return this.firstTsInfo&&this.firstTsInfo.totalDuration||this.fragHelper.totalDuration}},{key:"currFrag",get:function(){return this.fragHelper.curFrag},set:function(t){t&&(this.lastFrag=this.currFrag,this.fragHelper.curFrag=t)}},{key:"lastFrag",get:function(){return this.fragHelper.lastFrag},set:function(t){t&&(this.fragHelper.lastFrag=t)}},{key:"nextFrag",get:function(){return this.fragHelper.getFrag(this.isLive)}},{key:"hasNextFrag",value:function(){return this.fragHelper.hasNextFrag()}},{key:"getNearFragStart",value:function(t){return this.fragHelper.getNearFragStart(t)}},{key:"setOrigUrl",value:function(t){this.fragHelper.setOrigUrl(t)}},{key:"setCurrentFrag",value:function(t){t&&(this.lastFrag=this.currFrag,this.currFrag=t)}},{key:"seek",value:function(t){return!this.isLive&&this.fragHelper.seek(t)}},{key:"loadFirstFragment",value:function(t){t&&t.tsUrl&&!this.firstLevelLoaded&&(I.log("HlsPlaylist.loadFirstFragment firstTsInfo = ",t),this.fragHelper.setFileType(ta.getType(t.tsUrl)),t.initUrl&&this.fragHelper.setInitUrl(t.initUrl),this.fragHelper.setFirst(),t.tsUrl=this.addUrlParams(t.tsUrl),this.firstTsInfo=t,this.hls.loadFragment(!1,t),this.firstLevelLoaded=!0,Y.setFirstTs(t))}},{key:"loadManifest",value:function(t){this.hls.vodSecHelper.setM3u8Start(),this.m3u8Parser.isSwitchSeamLessLine=!1,this.loader&&(this.loader.destroy(),this.loader=null),t=this.addUrlParams(t),this.manifsetUrl=t,I.log("HlsPlaylist.loadManifest url=".concat(t)),this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_CNT,1),this.loader=new Z(this.config),this.loader.onOpen=this.onManiFestOpen.bind(this),this.loader.load(t,"text",this.onManifestLoaded.bind(this),this.loadManifestError.bind(this),this.loadManifestTimeout.bind(this),this.config.listLoadingTimeOut,this.config.listLoadingMaxRetry,this.config.listLoadingRetryDelay),Y.setM3u8Loader(this.loader)}},{key:"onManiFestOpen",value:function(){this.hls.vodSecHelper.setM3u8Open()}},{key:"refreshManifsetUrl",value:function(t){t=this.addUrlParams(t),this.manifsetUrl=t}},{key:"addUrlParams",value:function(t){if(-1!==t.indexOf("hyscence=vodadv")&&(t=t.replace("hyscence=vodadv","hyscence=vodbusiness")),-1!==t.indexOf("scene=vodadv")&&(t=t.replace("scene=vodadv","scene=vodbusiness")),-1===t.indexOf("&sv=")){var e=F.platform,i=L.PLATFORM_TYPE[e]||L.PLATFORM_TYPE.web;t+=-1===t.indexOf("?")?"?":"&";var s=e===L.PLATFORM_TYPE_NAME.wap?"uid=".concat(w.uid,"&uuid=").concat(w.uuid):"u=".concat(w.convertUid);t+="".concat(s,"&t=").concat(i),t=O.urlInfoParams(t,this.hls.info),this.m3u8ContentErrorCnt>0&&(t+="&mceCnt=".concat(this.m3u8ContentErrorCnt))}return O.checkDMod(t,this.hls.info._dMod,this.hls.info._sMod)}},{key:"onManifestLoaded",value:function(t,e){if(0==this.manifestLoadedTs&&(this.manifestLoadedTs=g.now()),this.loadM3u8HttpCode=t.currentTarget.status,404===this.loadM3u8HttpCode||0===this.loadM3u8HttpCode||403===this.loadM3u8HttpCode)return I.warn("HlsPlaylist.onManifestLoaded status=".concat(this.loadM3u8HttpCode)),this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_FAIL_CNT,1),void this.hls.setLoa
1dStatus(L.LoadVideoTimeoutReason.HLS_LOADMANIFEST_ERROR);if(Y.setM3u8Status(1),!this.isLive){var i=this.loader.getResponseHeader("Content-length")||0;this.m3u8FileSize=+i,this.hls.statVod.setCore(R.VOD_CORE.M3U8_FILE_BW,this.m3u8FileSize),this.hls.statVod.addCore(R.CORE.CDN_TOTAL_BW,this.m3u8FileSize),this.hls.stat.addCore(R.CORE.CDN_TOTAL_BW,this.m3u8FileSize)}var s,r=t.currentTarget.response,a=this.manifsetUrl,n=null,o=[];if(-1==r.indexOf("#EXTM3U"))return this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_WRONG_CNT,1),I.warn("HlsPlaylist.onManifestLoaded m3u8 doesn't match #EXTM3U\n",r),this.hls.setLoadStatus(L.LoadVideoTimeoutReason.HLS_LOADMANIFEST_ERROR),void(this.m3u8ContentErrorCnt<3&&(this.m3u8ContentErrorCnt++,this.hls.onM3u8ContentError()));this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_SUC_CNT,1);var u=-1==r.indexOf("#EXTINF:");u?(this.isMasterPlayList=!0,n=this.m3u8Parser.parseMasterPlaylist(r,a)):(this.isMasterPlayList=!1,n=[{url:a}]),s=(o=n)[0].bitrate,o.sort(function(t,e){return t.bitrate-e.bitrate}),this.levels=o;for(var l=0;l<o.length;l++)if(o[l].bitrate===s){this.currLevelId=l;break}this.currLevel={bitrate:s},this.hls.setLoadStatus(L.LoadVideoTimeoutReason.HLS_LOADMANIFEST_SUCCESS),u?(this.currLevel.url=o[this.currLevelId].url,this.loadLevel()):(this.currLevel.url=this.manifsetUrl,this.onLevelLoaded(t))}},{key:"loadManifestError",value:function(t){this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_FAIL_CNT,1),I.warn("HlsPlaylist.loadManifestError "+t.currentTarget.status,t.currentTarget.readyState),this.loadM3u8HttpCode=t.currentTarget.status,Y.setM3u8Status(t.currentTarget.status>0?-1:-2),404!==t.currentTarget.status&&0!==t.currentTarget.status||this.hls.onAnchorStop(),this.hls.onLoadM3u8Error(t)}},{key:"loadManifestTimeout",value:function(t){this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_TIMEOUT_CNT,1),t&&t.readyState>=2?(Y.setM3u8Status(-4),this.hls.onLoadManifestTimeout()):(Y.setM3u8Status(-3),this.hls.onConnectManifestTimeout())}},{key:"loadLevel",value:function(){if(this.currLevel){var t=this.currLevel.url;if(!this.isLive&&this.currDetails){var e=this.currDetails.fragments,i=e[e.length-1];i||(I.log("HlsPlaylist.loadLevel: fragments run out"),i=this.fragHelper.curFrag),t=e.length<=this.config.minFragBufferNum?this.currLevel.url.replace(/\?btime=\d*$/,"?btime=".concat(i.time)):null}t&&this._loadLevel(t)}}},{key:"updateLiveVodUrl",value:function(t){this.currLevel&&(t=this.addUrlParams(t),this.manifsetUrl=t,this.m3u8Updating=!0,this.currLevel.url=t,this._loadLevel(t))}},{key:"_loadLevel",value:function(t){this.isLive&&q.isOpen()&&I.log("HlsPlaylist._loadLevel url=".concat(t)),this.loader&&(this.loader.destroy(),this.loader=null),this.anticode&&(t+="?"+this.anticode),this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_CNT,1),this.loader=new Z(this.config),this.loader.load(t,"",this.onLevelLoaded.bind(this),this.loadLevelError.bind(this),this.loadLevelTimeout.bind(this),this.config.listLoadingTimeOut,this.config.listLoadingMaxRetry,this.config.listLoadingRetryDelay)}},{key:"onLevelLoaded",value:function(t,e){if(404!==t.currentTarget.status&&0!==t.currentTarget.status){var i=t.currentTarget.responseText,s=this.manifsetUrl,r=this.currLevel,a=null;if(s&&(r.url=s),this.isLive&&I.log(i),0===i.indexOf("#EXTM3U")&&i.indexOf("#EXTINF:")>0){if(this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_SUC_CNT,1),a=this.m3u8Parser.parseLevelPlaylist(i,r.url,this.currLevelId),this.fragHelper.mergeDetails(a),r.details=this.fragHelper.details,this.isLive||(I.log("HlsPlaylist.onLevelLoaded : fragments.length:".concat(r.details.fragments.length)),this.hls.eventEmitter.trigger(N.PLAYBACK_M3U8_UPDATED,{totalDuration:this.totalDuration})),this.m3u8Parsered=!0,this.isLive&&r.details.fragments.length>F.hlsLiveMaxFragNum)return I.info("HlsPlaylist.onLevelLoaded fragments.length =",r.details.fragments.length),void this.hls.reconnectLive();this.hls.setTargetDuration(this.currDetails.targetduration),this.hls.vodSecHelper.setM3u8End(),this.firstLevelLoaded||(this.hls.loadFragment(),this.firstLevelLoaded=!0)}else{this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_EMPTY_CNT,1);var n=r.details.fragments.length;I.warn("HlsPlaylist.onLevelLoaded no playlist. fragments.length=".concat(n,"\n").concat(i))}this.hls.isSwitchSeamLessLine=this.m3u8Parser.isSwitchSeamLessLine}else this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_FAIL_CNT,1)}},{key:"loadLevelError",value:function(t){this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_FAIL_CNT,1),I.warn("HlsPlaylist.loadLevelError "+t.currentTarget.status),404!==t.currentTarget.status&&0!==t.currentTarget.status||this.hls.onAnchorStop()}},{key:"loadLevelTimeout",value:function(){this.hls.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.M3U8_TIMEOUT_CNT,1),this.hls.reset()}},{key:"onCheckTimer",value:function(t){this.isLive&&this.loadLevel()}}]),t}(),tA=function(){function t(e){Object(s.a)(this,t),this.data=e,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return Object(r.a)(t,[{key:"loadWord",value:function(){var t=this.data.byteLength-this.bytesAvailable,e=new Uint8Array(4),i=Math.min(4,this.bytesAvailable);if(0===i)throw Error("no bytes available");e.set(this.data.subarray(t,t+i)),this.word=new DataView(e.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i}},{key:"skipBits",value:function(t){var e;this.bitsAvailable>t||(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord()),this.word<<=t,this.bitsAvailable-=t}},{key:"readBits",value:function(t){var e=Math.min(this.bitsAvailable,t),i=this.word>>>32-e;return t>32&&I.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),(e=t-e)>0?i<<e|this.readBits(e):i}},{key:"skipLZ",value:function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&0x80000000>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+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 t=this.skipLZ();return this.readBits(t+1)-1}},{key:"readEG",value:function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"skipScalingList",value:function(t){var e,i=8,s=8;for(e=0;e<t;e++)0!==s&&(s=(i+this.readEG()+256)%256),i=0===s?i:s}},{key:"readSPS",value:function(){var t,e,i,s,r,a,n,o=0,u=0,l=0,d=0;if(this.readUByte(),t=this.readUByte(),this.readBits(5),this.skipBits(3),this.readUByte(),this.skipUEG(),100===t||110===t||122===t||144===t||244===t||44===t||83===t||86===t||118===t||128===t||138===t){var c=this.readUEG();if(3===c&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(a=3!==c?8:12,n=0;n<a;n++)this.readBoolean()&&(n<6?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var f=this.readUEG();if(0===f)this.readUEG();else if(1===f)for(this.skipBits(1),this.skipEG(),this.skipEG(),e=this.readUEG(),n=0;n<e;n++)this.skipEG();return this.skipUEG(),this.skipBits(1),i=this.readUEG(),s=this.readUEG(),0===(r=this.readBits(1))&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(o=this.readUEG(),u=this.readUEG(),l=this.readUEG(),d=this.readUEG()),this.readBoolean()&&(this.readBoolean()&&255===this.readUByte()&&(this.readBits(16),this.readBits(16)),this.readBoolean()&&this.skipBits(1),this.readBoolean()&&(this.readBits(3),this.skipBits(1),this.readBoolean()&&(this.readUByte(),this.readUByte(),this.readUByte())),this.readBoolean()&&(this.readUEG(),this.readUEG())),{fps:0,width:16*(i+1)-2*o-2*u,height:(2-r)*(s+1)*16-(l+d)*(r?2:4)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),t}(),tR=function(){function t(){Object(s.a)(this,t),this.size=0,this.buffers=[]}return Object(r.a)(t,[{key:"destroy",value:function(){this.buffers=null}},{key:"reset",value:function(){I.log("FlvCacher.reset",this.size),this.size=0,this.buffers=[]}},{key:"append",value:function(t){0!==t.length&&(this.buffers.push(t),this.size+=t.length)}},{key:"getByte",value:function(t){for(var e=0,i=0;i<this.buffers.length;++i){var s=this.buffers[i];if(e+s.length>t)return s[t-e];e+=s.length}return I.warn("FlvCacher.getByte has no offset="+t),0}},{key:"popFrame",value:function(){if(0===this.size)return null;if(0===this.buffers.length)return I.error("FlvCacher.popFront error no buffers, size:"+this.size+" not eq 0"),this.reset(),null;if(this.size<=ei.TAG_HEADER_LEN+ei.PREV_TAG_SIZE_LEN)return null;var t=(this.getByte(1)<<16)+(this.getByte(2)<<8)+this.getByte(3),e=ei.TAG_HEADER_LEN+t+ei.PREV_TAG_SIZE_LEN;if(this.size<e)return null;if(1===this.buffers.length){if(this.buffers[0].length===e)return this.size-=e,this.buffers.shift();var i=this.buffers[0].slice(0,e);return this.buffers[0]=this.buffers[0].slice(e),this.size-=e,i}
1for(var s,r=new Uint8Array(e),a=0,n=0;a<e;){var o=e-a;if(this.buffers[0].length>o){s=this.buffers[0].slice(0,o),r.set(s,n),n+=o,a+=o,this.buffers[0]=this.buffers[0].slice(o),this.size-=o;break}s=this.buffers.shift(),r.set(s,n),n+=s.length,a+=s.length,this.size-=s.length}return r}}]),t}(),tD=(new DataView(tT=new ArrayBuffer(2)).setInt16(0,256,!0),256===new Int16Array(tT)[0]),tO=function(){function t(){Object(s.a)(this,t)}return Object(r.a)(t,null,[{key:"parseObject",value:function(e,i,s){var r=t.parseString(e,i),a=t.parseScript(e,i+r.size);return{data:{name:r.data,value:a.data},size:a.size}}},{key:"parseVariable",value:function(e,i,s){return t.parseObject(e,i,s)}},{key:"parseDate",value:function(t,e,i){if(i<10)throw Error("Data size invalid when parse Date");var s=new DataView(t,e),r=s.getFloat64(0,!tD);return{data:new Date(r+=60*s.getInt16(8,!tD)*1e3),size:10}}},{key:"parseString",value:function(t,e){var i=new DataView(t,e),s=i.getUint16(0,!tD),r="";if(s>0)for(var a=0;a<s;a++)r+=String.fromCharCode(i.getUint8(a+2));return{data:r,size:2+s}}},{key:"parseMetadata",value:function(e){var i=t.parseScript(e,0);return t.parseScript(e,i.size,e.length-i.size)}},{key:"parseScript",value:function(e,i,s){var r=i,a=new Uint8Array(e).buffer,n=new DataView(a,0,s),o=null,u=n.getUint8(r);switch(r+=1,u){case 0:o=n.getFloat64(r,!tD),r+=8;break;case 1:o=!!n.getUint8(r),r+=1;break;case 2:var l=t.parseString(a,r);o=l.data,r+=l.size;break;case 3:for(o={};r<s-3;){var d=t.parseObject(a,r,s-i);if(o[d.data.name]=d.data.value,r=d.size,0===n.getUint8(r)&&0===n.getUint8(r+1)&&9===n.getUint8(r+2)){r+=3;break}}break;case 8:for(o={},r+=4;r<s-8;){var c=t.parseVariable(a,r);o[c.data.name]=c.data.value,r=c.size}r<=s-3&&9==(0xffffff&n.getUint32(r-1,!tD))&&(r+=3);break;case 10:o=[];var f=n.getUint32(r,!tD);r+=4;for(var p=0;p<f;p++){var m=t.parseScript(a,r);o.push(m.data),r=m.size}break;case 11:var _=t.parseDate(a,r+1,s-1);o=_.data,r+=_.size;break;case 12:var y=t.parseString(a,r+1);o=y.data,r+=y.size;break;default:r=s,console.log("AMF","Unsupported AMF value type "+u)}return{data:o,size:r}}},{key:"getStr",value:function(t,e,i){for(var s="",r=0;r<i;r++)s+=String.fromCharCode(t[e++]);return s}}]),t}(),tb=new(function(){function t(){Object(s.a)(this,t),this._ntp=new d.NtpImpl(tC)}return Object(r.a)(t,[{key:"start",value:function(){this._ntp.start(w.sGuid),tP.add(this._onTimer,this,1e3)}},{key:"wsTimeSync",value:function(){this._ntp.wsTimeSync()}},{key:"_onTimer",value:function(t,e){this._ntp.onTimer(t)}},{key:"getSyncTime",value:function(){return this._ntp.getSyncTime()}},{key:"isFinishNtp",value:function(){return this._ntp.isFinishNtp()}}]),t}()),tw=function(){function t(e){Object(s.a)(this,t),this._split=e,this._str=""}return Object(r.a)(t,[{key:"isEmpty",value:function(){return""===this._str}},{key:"addStr",value:function(t){this._str.length>0&&(this._str+=this._split),this._str+=t}},{key:"getStr",value:function(){return this._str}}]),t}(),tL=[72,85,89,65,58],tF=[44,162,222,9,181,23,71,219,187,85,164,254,127,194,252,78],tM={HUMEN:"00000001",DELAY:"00000200",VOLUME:"00000400",VOLUME1:"00000401",IFRAME:"00000600",DATACHANNEL:"00000230",HY_SDK_SEI_MULTI_RENDER:"00010001"},tN=function(){function t(e){Object(s.a)(this,t),this._mse=e,this._protoHandler=new d.SeiProtoHandler,this._proto=null,this._netDelaySum=0,this._c2cDelaySum=0,this._svrDelaySum=0,this._delayCnt=0,this._curAnchorDelay=0,this._offset=0,this.initDts=0,this.initSeiDts=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._mse=null,this._proto=null,this._protoHandler&&this._protoHandler.clear(),this._protoHandler=null}},{key:"getStat",value:function(){if(0===this._delayCnt)return null;var t={fields:{},dims:{}};if(this._delayCnt>0&&(t.fields[R.CORE.DELAY_ANCHOR]=Math.floor(this._c2cDelaySum/this._delayCnt),t.fields[R.CORE.DELAY_SERVER]=Math.floor(this._svrDelaySum/this._delayCnt),t.fields[R.CORE.DELAY_NET]=Math.floor(this._netDelaySum/this._delayCnt),this._proto)){t.dims[R.CORE.UPLOADER_TYPE]=this._proto.anchorSei.uploadType+"",t.dims[R.CORE.ENCODER_SOURCE]=this._proto.anchorSei.encoderSource+"";var e=new tw(","),i=new tw(","),s=new tw(",");this._proto.serverSei.serverInfos.forEach(function(t){t.enable>0&&(e.addStr(t.getProxyIdStr()+"-"+t.proxyType),t.serverDelay>0&&t.serverDelay<1e4&&i.addStr(t.proxyType+":"+t.serverDelay),t.lastPeriodDelay>0&&t.lastPeriodDelay<1e4&&s.addStr(t.proxyType+":"+t.lastPeriodDelay))}),e.isEmpty()||(t.dims[R.CORE.DELAY_NODE_INFO]=e.getStr()),i.isEmpty()||(t.dims[R.CORE.SVR_DELAY_INFOS]=i.getStr()),s.isEmpty()||(t.dims[R.CORE.SVR_LAST_P_DELAY]=s.getStr())}return this._netDelaySum=0,this._c2cDelaySum=0,this._svrDelaySum=0,this._delayCnt=0,this._proto=null,t}},{key:"_record",value:function(t,e){this._proto=e;var i=tb.getSyncTime(),s=t-e.serverSei.dtsGapSum-e.anchorSei.frameDts,r=i-e.anchorSei.sendFrameTime-s;if(this.initSeiDts!=e.anchorSei.frameDts&&(this._mse.offsetDts=t-e.anchorSei.frameDts),this.initSeiDts=e.anchorSei.frameDts,0<r&&r<3e4){var a=i-e.anchorSei.caputureTime-s;this._netDelaySum+=r,this._c2cDelaySum+=a,this._svrDelaySum+=r-e.serverSei.delaySum,this._delayCnt++,this._curAnchorDelay=a||this._curAnchorDelay,this._curAnchorDelay>3e5&&(this._curAnchorDelay=0),this._mse.setSeiDelay(this._curAnchorDelay)}}},{key:"parseSei",value:function(e,i,s,r){if(e+=this.initDts,this._offset=0,s==t.H265_CODEC_TYPE?(i=this._nalUintExtractRbsp(i),this._offset+=2):s==t.AV1_CODEC_TYPE||(this._offset+=1),this._getValue(i),this._getValue(i),this._getH265Len(i),this._isHuya(i)){var a=i.subarray(this._offset),n=this._getType(a);if(r[n]=1,this._mse.saveSeiInfo(e,a,n),n===tM.DELAY)this._parseDelay(e,a);else if(n===tM.HUMEN)this._mse.saveH264SeiData(e,a);else if(n===tM.VOLUME){var o=this._getStr(a);this._mse.scriptVolumeInfos.addMixAudio(o,e)}else if(n===tM.VOLUME1){var u=this._getStrVolume1(a);this._mse.scriptVolumeInfos.addMixAudio(u,e)}
1else if(n===tM.DATACHANNEL)this._parseDataChannel(e,a);else if(n===tM.HY_SDK_SEI_MULTI_RENDER){var l=this._parseMutiRender(e,a);this._mse.updateMultiRenderInfo&&this._mse.updateMultiRenderInfo(l)}}}},{key:"_nalUintExtractRbsp",value:function(t){for(var e=new Uint8Array(t.length),i=t.length,s=0,r=0;s+2<i;)t[s]||t[s+1]||3!==t[s+2]?e[r++]=t[s++]:(e[r++]=t[s++],e[r++]=t[s++],s++);for(;s<i;)e[r++]=t[s++];return e.subarray(0,r)}},{key:"_getStr",value:function(t){for(var e=t.length,i=new Uint8Array(t.length),s=0;s<e;s++)i[s]=t[s];e=this._getLength(t)+8+16+2;var r=new DataView(i.buffer);return this._readVolume(r,e,26)}},{key:"_readVolume",value:function(t,e,i){for(var s=[];i+9<=e;){var r=0x100000000*t.getUint32(i,!1)+t.getUint32(i+4,!1),a=t.getUint8(i+8);s.push(r+"_"+a),i+=9}return s.join(",")}},{key:"_getStrVolume1",value:function(t){var e=this._getStrChar(t),i=this._getStrCode(e),s=new DataView(i.buffer);return this._readVolume(s,i.length,0)}},{key:"_getStrChar",value:function(t){for(var e=this._getLength(t)+8+16+2,i="",s=26;s<e;s++)i+=String.fromCharCode(t[s]);return atob(i)}},{key:"_getStrCode",value:function(t){for(var e=new Uint8Array(t.length),i=0;i<t.length;i++)e[i]=t.charCodeAt(i);return e}},{key:"_getLength",value:function(t){for(var e="",i=9;i<26;i++)e+=String.fromCharCode(t[i]);return parseInt(e)}},{key:"_getValue",value:function(t){for(var e=0,i=t.length;this._offset<i;){if(e+=t[this._offset],255!==t[this._offset]){this._offset++;break}this._offset++}return e}},{key:"_parseMutiRender",value:function(t,e){for(var i=e.length,s="",r=26;r<i-1;r++)s+=String.fromCharCode(e[r]);for(var a=atob(s),n=new Uint8Array(26),o=0;o<a.length;o++)n[o]=a.charCodeAt(o);return n}},{key:"_parseDataChannel",value:function(t,e){var i=Number(this._getDataChannelPortStr(e)),s=this._getDataChannelStr(e);this._mse.saveSeiDataChannel(t,i,s,e),I.log("getDataChannelStr",s,"portStr",i)}},{key:"_getDataChannelPortStr",value:function(t){for(var e="",i=0;i<10;i++)e+=String.fromCharCode(t[i+26]);return e}},{key:"_getDataChannelStr",value:function(t){for(var e="",i=this._getPayloadLen(t),s=0;s<i;s++)e+=String.fromCharCode(t[s+62]);return decodeURIComponent(escape(e))}},{key:"_parseDelay",value:function(t,e){if(tb.isFinishNtp())for(var i=this._decodeData(e),s=i.length,r=new DataView(i.buffer),a=0;a+10<s;){var n=r.getUint32(a,!0),o=r.getUint32(a+4,!0);if(0===n||n>s)break;if(o===d.ProtoUri.HuyaDelaySeiData){var u=new DataView(i.buffer,a,n),l=this._protoHandler.unmarshall(o,u);this._record(t,l)}a+=n}}},{key:"_decodeData",value:function(t){for(var e=this._decodeBase64(t),i=e.length,s=new Uint8Array(i),r=0;r<i;r++)s[r]=e.charCodeAt(r);return s}},{key:"_decodeBase64",value:function(t){for(var e="",i=this._getPayloadLen(t),s=0;s<i;s++)e+=String.fromCharCode(t[s+26]);return atob(e)}},{key:"_getPayloadLen",value:function(t){for(var e="",i=0;i<16;i++)e+=String.fromCharCode(t[i+9]);return parseInt(e)}},{key:"_getType",value:function(t){for(var e="",i=0;i<8;i++)e+=String.fromCharCode(t[i]);return e}},{key:"_getH265Len",value:function(t){for(var e=0,i=0;i<16&&t[this._offset]===tF[i];i++)this._offset++,e++;return e}},{key:"_isHuya",value:function(t){for(var e=0;e<5;e++){if(t[this._offset]!==tL[e])return!1;this._offset++}return!0}}]),t}();tN.H264_CODEC_TYPE=0,tN.H265_CODEC_TYPE=1,tN.AV1_CODEC_TYPE=2,tN.SEI_TYPES=tM;var tB=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){return Object(s.a)(this,i),e.apply(this,arguments)}return Object(r.a)(i)}(d.ListenerImpl),tV=function(){function t(e){Object(s.a)(this,t),this._bytes=e,this._bitIndex=0,this._bitLen=8*e.byteLength}return Object(r.a)(t,[{key:"getBits",value:function(t){var e=Math.floor(this._bitIndex/8),i=8-this._bitIndex%8,s=this._bytes[e]&(1<<i)-1;if(t<=i)return this._bitIndex+=t,s>>>i-t;var r=t-i;return this._bitIndex+=i,(s<<r|this.getBits(r))>>>0}},{key:"skipBits",value:function(t){this._bitIndex+=t}},{key:"getBytes",value:function(t){if(this._bitIndex%8!=0)throw Error("can't get bytes from mid-byte: bit index="+this._bitIndex);var e=Math.floor(this._bitIndex/8);return this._bitIndex+=8*t,this._bytes.subarray(e,e+t)}},{key:"bytePosition",get:function(){return Math.floor(this._bitIndex/8)}},{key:"bitposition",get:function(){return this._bitIndex}}]),t}(),tU=function(){function t(){Object(s.a)(this,t)}
1return Object(r.a)(t,null,[{key:"leb128",value:function(t){for(var e=0,i=0;i<8;i++){var s=t.getBits(8);if(e|=(127&s)<<7*i,!(128&s))break}return e}},{key:"parseOBUHeader",value:function(t){var e={},i=t.bits;return e.obu_forbidden_bit=i.getBits(1),e.obu_type=i.getBits(4),e.obu_extension_flag=i.getBits(1),e.obu_has_size_field=i.getBits(1),e.obu_reserved_1bit=i.getBits(1),1==e.obu_extension_flag&&(e.temporal_id=i.getBits(3),e.spatial_id=i.getBits(2),e.extension_header_reserved_3bits=i.getBits(3)),e}},{key:"uvlc",value:function(t){for(var e=0;!t.getBits(1);)++e;return e>=32?0:t.getBits(e)+(1<<e)-1}},{key:"color_config",value:function(e){var i={};return i.high_bitdepth=e.getBits(1),2==i.seq_profile&&i.high_bitdepth?(i.twelve_bit=e.getBits(1),i.BitDepth=i.twelve_bit?12:10):i.BitDepth=i.high_bitdepth?10:8,1==i.seq_profile?i.mono_chrome=0:i.mono_chrome=e.getBits(1),i.color_description_present_flag=e.getBits(1),i.color_description_present_flag?(i.color_primaries=e.getBits(8),i.transfer_characteristics=e.getBits(8),i.matrix_coefficients=e.getBits(8)):(i.color_primaries=t.CP_UNSPECIFIED,i.transfer_characteristics=t.TC_UNSPECIFIED,i.matrix_coefficients=t.MC_UNSPECIFIED),i.mono_chrome?(i.color_range=e.getBits(1),i.subsampling_x=1,i.subsampling_y=1,i.chroma_sample_position=t.CSP_UNKNOWN,i.separate_uv_delta_q=0):(i.color_primaries==t.CP_BT_709&&i.transfer_characteristics==t.TC_SRGB&&i.matrix_coefficients==t.MC_IDENTITY?(i.color_range=1,i.subsampling_x=0,i.subsampling_y=0):(i.color_range=e.getBits(1),0==i.seq_profile?(i.subsampling_x=1,i.subsampling_y=1):1==i.seq_profile?(i.subsampling_x=0,i.subsampling_y=0):12==i.BitDepth?(i.subsampling_x=e.getBits(1),i.subsampling_x?i.subsampling_y=e.getBits(1):i.subsampling_y=0):(i.subsampling_x=1,i.subsampling_y=0),i.subsampling_x&&i.subsampling_y&&(i.chroma_sample_position=e.getBits(2))),i.separate_uv_delta_q=e.getBits(1)),i}},{key:"metadata_obu",value:function(e,i){var s={},r=e.bits;if(s.metadata_type=t.leb128(r),s.metadata_type==t.METADATA_TYPE_ITUT_T35){s.itu_t_t35_country_code=r.getBits(8),255==s.itu_t_t35_country_code&&(s.itu_t_t35_country_code_extension_byte=r.getBits(8));var a=(8*i-r.bitposition)/8;s.itu_t_t35_payload_bytes=r.getBytes(a)}else if(s.metadata_type==t.METADATA_TYPE_HDR_CLL)s.max_cll=r.getBits(16),s.max_fall=r.getBits(16);else if(s.metadata_type==t.METADATA_TYPE_HDR_MDCV){s.primary_chromaticity_x=[],s.primary_chromaticity_y=[];for(var n=0;n<3;n++)s.primary_chromaticity_x[n]=r.getBits(16),s.primary_chromaticity_y[n]=r.getBits(16);s.white_point_chromaticity_x=r.getBits(16),s.white_point_chromaticity_y=r.getBits(16),s.luminance_max=r.getBits(32),s.luminance_min=r.getBits(32)}else if(s.metadata_type==t.METADATA_TYPE_SCALABILITY){if(s.scalability_mode_idc=r.getBits(8),s.scalability_mode_idc==t.SCALABILITY_SS){if(s.spatial_layers_cnt_minus_1=r.getBits(2),s.spatial_layer_dimensions_present_flag=r.getBits(1),s.spatial_layer_description_present_flag=r.getBits(1),s.temporal_group_description_present_flag=r.getBits(1),s.scalability_structure_reserved_3bits=r.getBits(3),s.spatial_layer_dimensions_present_flag)for(var o=0;o<=s.spatial_layers_cnt_minus_1;o++)s.spatial_layer_max_width[o]=r.getBits(16),s.spatial_layer_max_height[o]=r.getBits(16);if(s.spatial_layer_description_present_flag)for(var u=0;u<=s.spatial_layers_cnt_minus_1;u++)s.spatial_layer_ref_id[u]=r.getBits(8);if(s.temporal_group_description_present_flag){s.temporal_group_size=r.getBits(8);for(var l=0;l<s.temporal_group_size;l++){s.temporal_group_temporal_id[l]=r.getBits(3),s.temporal_group_temporal_switching_up_point_flag[l]=r.getBits(1),s.temporal_group_spatial_switching_up_point_flag[l]=r.getBits(1),s.temporal_group_ref_cnt[l]=r.getBits(3);for(var d=0;d<temporal_group_ref_cnt[l];d++)s.temporal_group_ref_pic_diff[l][d]=r.getBits(8)}}}}else s.metadata_type==t.METADATA_TYPE_TIMECODE&&(s.counting_type=r.getBits(5),s.full_timestamp_flag=r.getBits(1),s.discontinuity_flag=r.getBits(1),s.cnt_dropped_flag=r.getBits(1),s.n_frames=r.getBits(9),s.full_timestamp_flag?(s.seconds_value=r.getBits(6),s.minutes_value=r.getBits(6),s.hours_value=r.getBits(5)):(s.seconds_flag=r.getBits(1),s.seconds_flag&&(s.seconds_value=r.getBits(6),s.minutes_flag=r.getBits(1),s.minutes_flag&&(s.minutes_value=r.getBits(6),s.hours_flag=r.getBits(1),s.hours_flag&&(s.hours_value=r.getBits(5))))),s.time_offset_length=r.getBits(5),s.time_offset_length>0&&(s.time_offset_value=r.getBits(s.time_offset_length)));return s}},{key:"sequence_header_obu",value:function(e){var i={},s=e.bits;if(i.seq_profile=s.getBits(3),i.still_picture=s.getBits(1),i.reduced_still_picture_header=s.getBits(1),i.reduced_still_picture_header)i.timing_info_present_flag=0,i.decoder_model_info_present_flag=0,i.initial_display_delay_present_flag=0,i.operating_points_cnt_minus_1=0,i["operating_point_idc[0]"]=0,i["seq_level_idx[0]"]=s.getBits(5),i["seq_tier[0]"]=0,i["decoder_model_present_for_this_op[0]"]=0,i["initial_display_delay_present_for_this_op[0]"]=0;else if(i.timing_info_present_flag=s.getBits(1),i.timing_info_present_flag){i.num_units_in_display_tick=s.getBits(32),i.time_scale=s.getBits(32),i.equal_picture_interval=s.getBits(1),i.equal_picture_interval&&(i.num_ticks_per_picture_minus_1=t.uvlc(s)),i.decoder_model_info_present_flag=s.getBits(1),i.decoder_model_info_present_flag?(i.buffer_delay_length_minus_1=s.getBits(5),i.num_units_in_decoding_tick=s.getBits(32),i.buffer_removal_time_length_minus_1=s.getBits(5),i.frame_presentation_time_length_minus_1=s.getBits(5)):i.decoder_model_info_present_flag=0,i.initial_display_delay_present_flag=s.getBits(1),i.operating_points_cnt_minus_1=s.getBits(5);for(var r=0;r<=i.operating_points_cnt_minus_1;
1r++){if(i["operating_point_idc["+r+"]"]=s.getBits(12),i["seq_level_idx["+r+"]"]=s.getBits(5),i["seq_level_idx["+r+"]"]>7?i["seq_tier["+r+"]"]=s.getBits(1):i["seq_tier["+r+"]"]=0,i.decoder_model_info_present_flag){if(i["decoder_model_present_for_this_op["+r+"]"]=s.getBits(1),i["decoder_model_present_for_this_op["+r+"]"]){var a=i.buffer_delay_length_minus_1+1;i["decoder_buffer_delay["+r+"]"]=s.getBits(a),i["encoder_buffer_delay["+r+"]"]=s.getBits(a),i["low_delay_mode_flag["+r+"]"]=s.getBits(1)}}else i["decoder_model_present_for_this_op["+r+"]"]=0;i.initial_display_delay_present_flag&&(i["initial_display_delay_present_for_this_op["+r+"]"]=s.getBits(1)),i["initial_display_delay_present_for_this_op["+r+"]"]&&(i["initial_display_delay_minus_1["+r+"]"]=s.getBits(4))}}return i.frame_width_bits_minus_1=s.getBits(4),i.frame_height_bits_minus_1=s.getBits(4),i.max_frame_width_minus_1=s.getBits(i.frame_width_bits_minus_1+1),i.max_frame_height_minus_1=s.getBits(i.frame_height_bits_minus_1+1),i.reduced_still_picture_header?i.frame_id_numbers_present_flag=0:i.frame_id_numbers_present_flag=s.getBits(1),i.frame_id_numbers_present_flag&&(i.delta_frame_id_length_minus_2=s.getBits(4),i.additional_frame_id_length_minus_1=s.getBits(3)),i.use_128x128_superblock=s.getBits(1),i.enable_filter_intra=s.getBits(1),i.enable_intra_edge_filter=s.getBits(1),i.reduced_still_picture_header?(i.enable_interintra_compound=0,i.enable_masked_compound=0,i.enable_warped_motion=0,i.enable_dual_filter=0,i.enable_order_hint=0,i.enable_jnt_comp=0,i.enable_ref_frame_mvs=0,i.seq_force_screen_content_tools=t.SELECT_SCREEN_CONTENT_TOOLS,i.seq_force_integer_mv=1,i["#OrderHintBits"]=0):(i.enable_interintra_compound=s.getBits(1),i.enable_masked_compound=s.getBits(1),i.enable_warped_motion=s.getBits(1),i.enable_dual_filter=s.getBits(1),i.enable_order_hint=s.getBits(1),i.enable_order_hint&&(i.enable_jnt_comp=s.getBits(1),i.enable_ref_frame_mvs=s.getBits(1)),i.seq_choose_screen_content_tools=s.getBits(1),i.seq_choose_screen_content_tools?i.seq_force_screen_content_tools=t.SELECT_SCREEN_CONTENT_TOOLS:i.seq_force_screen_content_tools=s.getBits(1),i.seq_force_screen_content_tools>0&&(i.seq_choose_integer_mv=s.getBits(1),i.seq_choose_integer_mv?i.seq_force_integer_mv=1:i.seq_force_integer_mv=s.getBits(1)),i.enable_order_hint?(i.order_hint_bits_minus_1=s.getBits(3),i["#OrderHintBits"]=i.order_hint_bits_minus_1+1):i["#OrderHintBits"]=0,i.enable_superres=s.getBits(1),i.enable_cdef=s.getBits(1),i.enable_restoration=s.getBits(1),Object.assign(i,t.color_config(s)),i.film_grain_params_present=s.getBits(1)),i}},{key:"parseOBU",value:function(e,i,s,r){for(var a={bits:new tV(e)},n=0;e.length-n>1;){1==(o=t.parseOBUHeader(a)).obu_extension_flag&&n++;var o,u,l=e.length-n;if(u=o.obu_has_size_field?t.leb128(a.bits):l-1-o.obu_extension_flag,o.obu_type==t.OBU_SEQUENCE_HEADER&&s)s(t.sequence_header_obu(a));else if(o.obu_type==t.OBU_METADATA&&r){var d=t.metadata_obu(a,a.bits.bytePosition+u);d.itu_t_t35_payload_bytes&&r(i,d)}else a.bits.skipBits(8*u);n=a.bits.bytePosition}}},{key:"zeroPad",value:function(t,e,i){t||(t=0),void 0===i&&(i=10);for(var s=t.toString(i);s.length<e;)s="0"+s;return s}}]),t}();tU.OBU_SEQUENCE_HEADER=1,tU.OBU_TEMPORAL_DELIMITER=2,tU.OBU_FRAME_HEADER=3,tU.OBU_TILE_GROUP=4,tU.OBU_METADATA=5,tU.OBU_FRAME=6,tU.OBU_REDUNDANT_FRAME_HEADER=7,tU.OBU_TILE_LIST=8,tU.OBU_PADDING=15,tU.SELECT_SCREEN_CONTENT_TOOLS=2,tU.CP_BT_709=1,tU.CP_UNSPECIFIED=2,tU.TC_SRGB=13,tU.TC_UNSPECIFIED=2,tU.MC_IDENTITY=0,tU.MC_UNSPECIFIED=2,tU.CSP_UNKNOWN=0,tU.METADATA_TYPE_HDR_CLL=1,tU.METADATA_TYPE_HDR_MDCV=2,tU.METADATA_TYPE_SCALABILITY=3,tU.METADATA_TYPE_ITUT_T35=4,tU.METADATA_TYPE_TIMECODE=5,tU.SCALABILITY_SS=14;var tx=function(){function t(e){Object(s.a)(this,t),this.hasSample=!1,this.samples=new X(e)}return Object(r.a)(t,[{key:"destroy",value:function(){this.samples&&this.samples.reset(),this.samples=null}},{key:"getSamples",value:function(){return this.samples.getSamples()}},{key:"addCur",value:function(t,e){this.hasSample=!0}},{key:"getResult",value:function(){var t=[],e=this.samples.getSamples(),i=e.length;if(i>0){t.push("size:"+i);for(var s=0;s<i;s++)t.push("".concat(i-s,":").concat(e[s]))}return t.join(",")}},{key:"reset",value:function(){var t=this.samples.cur;this.samples.reset(),this.samples.addCur(t)}}]),t}(),tH=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return Object(s.a)(this,i),(t=e.call(this,r)).lastTs=0,t}return Object(r.a)(i,[{key:"addCur",value:function(t,e){Object(n.a)(Object(o.a)(i.prototype),"addCur",this).call(this,t,e);var s=parseInt(e/1e3);this.lastTs>0&&this.lastTs!==s&&this.samples.calculate(),this.lastTs=s,this.samples.addCur(t)}}]),i}(tx),tG=function(){function t(){Object(s.a)(this,t),this.aSample=ne
1w tH(20),this.vSample=new tH(20),this.aAutoSample=new tH(20),this.vAutoSample=new tH(20)}return Object(r.a)(t,[{key:"destroy",value:function(){this.aSample&&this.aSample.destroy(),this.vSample&&this.vSample.destroy(),this.aAutoSample&&this.aAutoSample.destroy(),this.vAutoSample&&this.vAutoSample.destroy(),this.aSample=null,this.vSample=null,this.aAutoSample=null,this.vAutoSample=null}},{key:"addAudioSample",value:function(t,e){this.aSample.addCur(t,e),this.aAutoSample.addCur(t,e)}},{key:"addVideoSample",value:function(t,e){this.vSample.addCur(t,e),this.vAutoSample.addCur(t,e)}},{key:"getResult",value:function(){var t=[],e=this.aSample.getSamples(),i=this.vSample.getSamples(),s=Math.min(i.length,e.length);if(s>0){t.push("size:".concat(s));for(var r=0;r<s;r++)t.push("".concat(s-r,":").concat(i[r]+e[r]))}return t.join(",")}},{key:"reset",value:function(){this.aSample.reset(),this.vSample.reset()}},{key:"getAutoSamples",value:function(){var t={aSamples:this.aAutoSample.getSamples(),vSamples:this.vAutoSample.getSamples()};return this.aAutoSample.reset(),this.vAutoSample.reset(),t}},{key:"recordStat",value:function(t){var e=this.getResult();""!==e&&(this.reset(),t.setCoreDim(R.CORE.REAL_KBPS_SAMPLE,e))}}]),t}(),tW=function(){function t(e){Object(s.a)(this,t),this.realFps=0,this.maxDropCnt=0,this.curDropCnt=0,this.startDropDts=0,this.lastDropDts=0,this.started=!1,this.discardGap=0,this.minFps=1e3,this.corePlayer=e,this.info=null,this.isRandom=!1}return Object(r.a)(t,[{key:"destroy",value:function(){this.corePlayer=null,this.info=null}},{key:"setConfig",value:function(t){this.dropTime=t.dropTime||0;var e=t.minFps||1e3;this.minFps=Math.max(e,parseInt(2*this.realFps/3))}},{key:"setInfo",value:function(t){this.info=t;var e=!0;this.info&&(e=O.getSdkAbRandom(this.info,F.dropFrameAb)),this.isRandom=e}},{key:"reset",value:function(){this.realFps=0,this.maxDropCnt=0,this.curDropCnt=0,this.startDropDts=0,this.lastDropDts=0,this.started=!1,this.isRandom=!1}},{key:"start",value:function(){I.log("DropFrameController.start"),this.started=!0}},{key:"stop",value:function(){this.started=!1}},{key:"setRealFps",value:function(t){t>0&&0===this.realFps&&(this.realFps=t,this.minFps=Math.max(this.minFps,parseInt(2*t/3)),this.maxDropCnt=Math.max(0,t-this.minFps),I.log("DropFrameController.setRealFps fps=".concat(t," minFps=").concat(this.minFps," maxDrop=").concat(this.maxDropCnt)))}},{key:"isCanDrop",value:function(t,e,i){if(this.isRandom&&this.corePlayer.webcodecType!=L.PLAYER_CORE_TYPE.WEBCODECS&&!(this.corePlayer.bitrate<F.perfBitrate||this.corePlayer.h265Proxy&&this.corePlayer.h265Proxy.isReady||this.corePlayer.getBufferLen()<=2e3)){var s=this.corePlayer.renderList;if(!(s.length<10)){var r=0;s.forEach(function(t){r+=t});var a=Math.floor(r/s.length),n=~~(1e3/this.realFps*2);return a<=~~(.5*this.realFps)?this.discardGap=n:a<=~~(.6*this.realFps)?this.discardGap=~~(1.3*n):a<=~~(.7*this.realFps)?this.discardGap=~~(1.6*n):a<=~~(.8*this.realFps)?this.discardGap=2*n:a<=~~(.9*this.realFps)&&(this.discardGap=3*n),!e&&0==(96&i)&&(0===this.lastDropDts||t-this.lastDropDts>=this.discardGap)&&(this.lastDropDts=t,!0)}}}}]),t}(),tj=Object(r.a)(function t(){Object(s.a)(this,t),this.totalTime=0,this.frameNum=0}),tY=function(){function t(){Object(s.a)(this,t),this.started=!1,this.lastCheckTs=0,this.seg=new tj,this.segList=[],this.segSize=10}return Object(r.a)(t,[{key:"destroy",value:function(){this.seg=null,this.segList=null,tP.remove(this.onCheckFrameRate,this)}},{key:"getSize",value:function(){return this.segList.length}},{key:"addFrame",value:function(){var t=g.now();this.started||(this.started=!0,this.lastCheckTs=t,tP.add(this.onCheckFrameRate,this,200)),this.seg.frameNum++,this.onCheckFrameRate(t)}},{key:"reset",value:function(){this.started=!1,this.lastCheckTs=0,this.seg=new tj,this.segList=[],tP.remove(this.onCheckFrameRate,this)}},{key:"onCheckFrameRate",value:function(t){if(this.lastCheckTs>0&&this.seg){var e=t-this.lastCheckTs;e>=1e3&&(this.seg.totalTime=e,this.segList.push(this.seg),this.segList.length>this.segSize&&this.segList.shift(),this.seg=new tj,this.lastCheckTs=t)}}},{key:"isDownEnough",value:function(t){return t>0&&this.segList.length>0&&this.getAvg()>.9*t}},{key:"getAvg",value:function(){return this.getLastRate(this.segList.length)}},{key:"getLastRate",value:function(t){var e=0,i=0,s=this.segList.length;t=Math.min(t,s);for(var r=s-1;r>=0;r--){var a=this.segList[r];if(e+=a.frameNum,i+=a.totalTime,--t<=0)break}return i>0?e/i*1e3:0}}]),t}(),tq=function(){function t(){Object(s.a)(this,t),this.m_idx=0,this.m_data=null,this.m_len=0,this.m_bits=0,this.m_byte=0,this.m_zeros=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.m_data=null}},{key:"init",value:function(t,e){this.m_data=t,this.m_len=e,this.m_idx=0,this.m_bits=0,this.m_byte=0,this.m_zeros=0}},{key:"getByte",value:function(){if(this.m_idx>=this.m_len)return 0;var t=this.m_data[this.m_idx++];return 0==t?(this.m_zeros++,this.m_idx<this.m_len&&2==this.m_zeros&&3==this.m_data[this.m_idx]&&(this.m_idx++,this.m_zeros=0)):this.m_zeros=0,t}},{key:"getBit",value:function(){return 0==this.m_bits&&(this.m_byte=this.getByte(),this.m_bits=8),this.m_bits--,this.m_byte>>this.m_bits&1}},{key:"getWord",value:function(t){for(var e=0;t>0;)e<<=1,e|=this.getBit(),t--;return e}},{key:"getUe",value:function(){for(var t=0;this.m_idx<this.m_len&&0==this.getBit();)t++;var e=(1<<t)-1;
1return 31==t?0:(t>0&&(e+=this.getWord(t)),e)}},{key:"getSe",value:function(){var t=this.getUe(),e=t+1>>1;return 1&t||(e=-e),e}},{key:"parseSequenceParameterSet",value:function(t,e,i){if(e<20)return!1;this.init(t,e),this.getWord(16);var s=this.getWord(4);i.sps_video_parameter_set_id=s;var r=this.getWord(3);i.sps_max_sub_layers_minus1=r,i.temporal_id_nesting_flag=s=this.getWord(1),this.hevc_parse_profile_tier_level(i,r),i.sps_seq_parameter_set_id=this.getUe();var a=this.getUe();i.chroma_format_idc=a;var n=0;3==a&&(n=s=this.getWord(1)),i.separate_colour_plane_flag=n;var o=this.getUe(),u=this.getUe();I.log("HevcSpsParser.parseSequenceParameterSet', ue_width=".concat(o,", ue_height=").concat(u));var l=0,d=0,c=0,f=0;this.getWord(1)&&(l=this.getUe(),d=this.getUe(),c=this.getUe(),f=this.getUe());var p=1!=a&&2!=a||0!=n?1:2,m=1==a&&0==n?2:1;return o-=p*d+p*l,u-=m*f+m*c,i.width=o,i.height=u,this.getUe()==this.getUe()}},{key:"hevc_parse_profile_tier_level",value:function(t,e){if(this.hevc_parse_profile_tier_level_common(t,1,1,1),0!=e){var i=[],s=[];i[6]={},s[6]={};for(var r=0;r<e;r++)i[r]=this.getWord(1),s[r]=this.getWord(1);if(e>0)for(var a=e;a<8;a++)this.getWord(2);t.sub_layer=[];for(var n=0;n<e;n++)t.sub_layer[n]={},this.hevc_parse_profile_tier_level_common(t.sub_layer[n],i[n],s[n],0)}}},{key:"hevc_parse_profile_tier_level_common",value:function(t,e,i,s){e&&(t.profile_space=this.getWord(2),t.tier_flag=this.getWord(1),t.profile_idc=this.getWord(5),t.profile_compatibility_flags=this.getWord(32),t.progressive_source_flag=this.getWord(1),t.interlaced_source_flag=this.getWord(1),t.non_packed_constraint_flag=this.getWord(1),t.frame_only_constraint_flag=this.getWord(1),t.reserved_zero_44bits=this.getWord(44)),i&&(t.level_idc=this.getWord(8))}}]),t}(),tK=null,tz=function(){if(null==tK)try{var t=document.createElement("canvas").getContext("experimental-webgl"),e=t.getExtension("WEBGL_debug_renderer_info");D._renderInfo=tK=t.getParameter(e.UNMASKED_RENDERER_WEBGL)}catch(t){tK="",I.log("RenderInfo.getRenderInfo",t.message)}return tK},tJ=function(){function t(e,i){Object(s.a)(this,t),this.corePlayer=e,this.parser=i,this.dropLevel=0,this.open=!1,this.started=!1,this.dropFrames=0,this.lastDropFrames=0,this.lastDropTs=0,this.realFps=0,this.discardGap=0,this.lastDropDts=0,this.dropRenderLevel=0,this.lastCheckDisCardTs=0,this.checkDiscardTimes=0,this.dropRenderLevel=!1,this.isRenderDrop=!1}return Object(r.a)(t,[{key:"destroy",value:function(){this.corePlayer=null,this.parser=null,this.isRenderDrop=!1}},{key:"setRealFps",value:function(t){t>0&&0===this.realFps&&(this.realFps=t,I.log("DropFrameByDts.setRealFps fps=".concat(t)))}},{key:"getRecrod",value:function(){var t=Math.round((g.now()-this.lastDropTs)/1e3),e=Math.round((this.dropFrames-this.lastDropFrames)/t);return this.lastDropFrames=this.dropFrames,this.lastDropTs=g.now(),e<0?0:e}},{key:"start",value:function(){var t=(p.browser+"").toLowerCase();"safari"===t?I.log("DropFrameDts.start fail browser=".concat(t)):(I.log("DropFrameDts.start"),this.started=!0,this.lastDropTs=g.now())}},{key:"stop",value:function(){this.started=!1}},{key:"reset",value:function(){this.dropLevel=0,this.dropFrames=0,this.lastDropFrames=0,this.realFps=0,this.lastDropDts=0,this.dropRenderLevel=0,this.discardGap=0,this.lastCheckDisCardTs=0,this.checkDiscardTimes=0}},{key:"isCanDrop",value:function(t,e,i){if(1!=F.isCloseMseDrop&&1==F.isLimitNaluType){if(!this.open||!this.started||this.corePlayer.webcodecType!==L.PLAYER_CORE_TYPE.MSE||this.corePlayer.isPureAudio||1==D._closeDrop)return!1;var s=this.corePlayer.renderList;if(s.length>=5&&this.getDisCardCfg(s),e)0!==this.dropLevel&&I.log("DropFrameByDts.dropFrames level=".concat(this.dropLevel," dromNum=").concat(this.dropFrames)),this.dropLevel=0;else{var r,a=this.corePlayer.getBufferLen();if(r=F.dtsJumpOpen?t-this.corePlayer.getCorrentCurrentDts():t-this.corePlayer.getCurrentRealTime(),this.dropLevel<2&&r>=F.dropFrameDts[1]&&a<.5*F.dropFrameDts[1]?(this.dropLevel=2,I.log("DropFrameByDts.dropFrame level=2 buffer=".concat(a," gap=").concat(r))):this.dropLevel<1&&r>=F.dropFrameDts[0]&&a<.7*F.dropFrameDts[0]&&(this.dropLevel=1,I.log("DropFrameByDts.dropFrame level=1 buffer=".concat(a," gap=").concat(r))),2===this.dropLevel||1===this.dropLevel&&0==(96&i))return this.dropFrames++,this.lastDropDts=t,!0;if(a<=1e3)return 2==D._printMseDropInfo&&I.log("DropFrameByDts buffer <= 1000"),!1;if(!this.corePlayer.isSupportRequestVideoFrameCallback())return!1;if(this.isRenderDrop&&0==(96&i)&&t-this.lastDropDts>=this.discardGap)return this.lastDropDts=t,this.dropFrames++,this.dropLevel=3,!0}return!1}}},{key:"getDisCardCfg",value:function(t){var e=g.now();if(!(0!=this.lastCheckDisCardTs&&e-this.lastCheckDisCardTs<1e3)){this.checkDiscardTimes++,this.lastCheckDisCardTs=e;var i,s=0,r=0,a=!1,n=0,o=0;if(0!=this.realFps){var u=this.parser.fps.getHeartReceiveFps();t.forEach(function(t){s+=t}),i=Math.floor(s/t.length),0!=u&&(o=Math.floor(i/u*100)/100),n=this.realFps,Number(D._forceDropFrame)>0&&(n=Number(D._forceDropFrame));var l=Math.floor(i/n*100)/100,d=~~(1e3/n*2),c=3*d,f=2*d,p=~~(1.6*d),m=~~(1.3*d),_=~~(.9*n),y=~~(.8*n),v=~~(.7*n),S=~~(.6*n),T=~~(.5*n);o>=.9&&1!=D._forceMseDropReal?(o>=.95&&this.checkDiscardTimes%10==0?1==this.dropRenderLevel?(a=!1,r=0):2==this.dropRenderLevel?(this.discardGap=c,r=1,a=!0):3==this.dropRenderLevel?(this.discardGap=f,r=2,a=!0):4==this.dropRenderLevel?(this.discardGap=p,r=3,a=!0):5==this.dropRenderLevel&&(this.discardGap=m,r=4,a=!0):(r=0,a=!1),1==D._printMseDropInfo&&I.log("DropFrameByDts.getDisCardCfg.realRate back,lastDropLevel=".concat(this.dropRenderLevel,",isRenderDropLevel=").concat(r,",isRenderDrop=").concat(a,",realRenderRate=").concat(o,",fpsRenderRate=").concat(l,",renderSec=").concat(i,",heartReceiveFps=").concat(u))):(i<=_&&i>y?(this.discardGap=c,r=1,a=!0):i<=y&&i>v?(this.discardGap=f,r=2,a=!0):i<=v&&i>S?(this.discardGap=p,r=3,a=!0):i<=S&&i>T?(this.discardGap=m,r=4,a=!0):i<=T?(this.discardGap=d,r=5,a=!0):(r=this.dropRenderLevel,a=this.isRenderDrop),1==D._printMseDropInfo&&I.log("DropFrameByDts.getDisCardCfg.realFps,lastDropLevel=".concat(this.dropRenderLevel,",isRenderDropLevel=").concat(r,",isRenderDrop=").concat(a,",realRenderRate=").concat(o,",fpsRenderRate=").concat(l,",renderSec=").concat(i,",heartReceiveFps=").concat(u))),this.dropRenderLevel=r,this.isRenderDrop=a}}}}]),t}(),tQ={FLV:1,P2P:2,HLS:3,HUYA:4,STREAM:5,OBS:6,VR:7,HUYAWEBRTC:8,PLAYBACK:9,P2PFLV:10,MP4:11},tX="h264",t$="h265",tZ=function(){function t(){Object(s.a)(this,t),this.size=0,this.head=null,this.freeChainSize=0,this.freeChain=null,this.travelNode=null}return Object(r.a)(t,[{key:"resetTravel",value:function(){this.travelNode=this.head}},{key:"travel",value:function(){if(null===this.travelNode&&(this.travelNode=this.head,null===this.travelNode))return null;var t=this.travelNode.data;return this.travelNode=this.travelNode.next,this.travelNode===this.head||null===this.travelNode?null:t}},{key:"reset",value:function(){this.resetTravel();var t=null,e=null;for(t=this.head;null!=t;)e=t,t=t.next,e.data=null,e.prev=null,e.next=null,t===this.head&&(t=null);for(this.head=null,t=this.freeChain;null!=t;)e=t,t=t.next,e.data=null,e.prev=null,e.next=null;this.freeChain=null,this.size=0,this.freeChainSize=0}},{key:"put",value:function(t){var e=this.getFree(t);if(this.size++,null===this.head)e.prev=e,e.next=e,this.head=e;else if(e.data.key<this.head.data.key)e.prev=this.head.prev,e.next=this.head,e.prev.next=e,e.next.prev=e,this.head=e;else{for(var i=this.head.prev;e.data.key<i.data.key;)i=i.prev;if(e.data.key===i.data.key)return this.size--,this.putFree(e),!1;e.prev=i,e.next=i.next,e.prev.next=e,e.next.prev=e}return!0}},{key:"put2",value:function(t){var e=this.getFree(t);if(this.size++,null===this.head)e.prev=e,e.next=e,this.head=e;else if(e.data.key<this.head.data.key)e.prev=this.head.prev,e.next=this.head,e.prev.next=e,e.next.prev=e,this.head=e;else{for(var i=this.head;e.data.key>
1i.data.key&&(i=i.next)!==this.head;);if(e.data.key===i.data.key)return this.size--,this.putFree(e),!1;e.prev=i.prev,e.next=i,i.prev.next=e,i.prev=e}return!0}},{key:"get",value:function(){if(null===this.head)return null;var t=this.head,e=t.data;return this.size--,0===this.size?this.head=null:(t.prev.next=t.next,t.next.prev=t.prev,this.head=this.head.next),this.putFree(t),e}},{key:"peek",value:function(){return null===this.head?null:this.head.data}},{key:"peekLast",value:function(){return null===this.head?null:this.head.prev.data}},{key:"getOrNewNode",value:function(t){var e=null;if(null===this.head)this.size++,(e=this.getFree(null)).prev=e,e.next=e,this.head=e;else if(t<this.head.data.key)this.size++,(e=this.getFree(null)).prev=this.head.prev,e.next=this.head,e.prev.next=e,e.next.prev=e,this.head=e;else{for(var i=this.head.prev;t<i.data.key;)i=i.prev;i.data.key===t?e=i:(this.size++,(e=this.getFree(null)).prev=i,e.next=i.next,e.prev.next=e,e.next.prev=e)}return e}},{key:"putFree",value:function(t){t.data=null,t.next=this.freeChain,t.prev=null,this.freeChain=t,this.freeChainSize++}},{key:"getFree",value:function(t){if(null===this.freeChain)return new t0(t);var e=this.freeChain;return e.data=t,this.freeChain=e.next,this.freeChainSize--,e}},{key:"getLast",value:function(){if(null==this.head)return null;var t=this.head.prev,e=t.data;return this.size--,0===this.size?this.head=null:(t.prev.next=t.next,t.next.prev=t.prev),this.putFree(t),e}}],[{key:"addData",value:function(t,e,i){t.put(e),t.size>i&&t.get()}}]),t}(),t0=Object(r.a)(function t(e){Object(s.a)(this,t),this.next=null,this.prev=null,this.data=e}),t1=function(){function t(){Object(s.a)(this,t),this.beforeChangeVideo=new tZ,this.beforeChangeAudio=new tZ,this.afterChangeVideo=new tZ,this.afterChangeAudio=new tZ,this.avcChangeCnt=0,this.avcChange=!1,this.duration=F.avHeaderChangeStatCfg[1]||3e3,this.avcChangeInfo=""}return Object(r.a)(t,[{key:"destroy",value:function(){this.beforeChangeVideo&&this.beforeChangeAudio.reset(),this.beforeChangeVideo=null,this.beforeChangeAudio&&this.beforeChangeAudio.reset(),this.beforeChangeAudio=null,this.afterChangeVideo&&this.afterChangeVideo.reset(),this.afterChangeVideo=null,this.afterChangeAudio&&this.afterChangeAudio.reset(),this.afterChangeAudio=null,this.avcChangeInfo=null}},{key:"setAvcChange",value:function(){this.avcChangeCnt++,this.avcChangeCnt>1&&(this.avcChange=!0,this.afterChangeVideo.reset(),this.afterChangeAudio.reset())}},{key:"addVideo",value:function(t){this.addChain(this.avcChange?this.afterChangeVideo:this.beforeChangeVideo,t)}},{key:"addAudio",value:function(t){this.addChain(this.avcChange?this.afterChangeAudio:this.beforeChangeAudio,t)}},{key:"addChain",value:function(t,e){t.put(e);var i=t.peek();i&&e.key-i.key>this.duration&&(this.avcChange?this.recordAvcChangeInfo():t.get())}},{key:"recordAvcChangeInfo",value:function(){this.avcChange=!1;var t=this.getInfo(this.beforeChangeVideo),e=this.getInfo(this.afterChangeVideo),i=this.getInfo(this.beforeChangeAudio),s=this.getInfo(this.afterChangeAudio);this.avcChangeInfo="vDts=[".concat(t.dtsArr.join("-"),"--").concat(e.dtsArr.join("-"),"]"),this.avcChangeInfo+=" vCts=[".concat(t.ctsArr.join("-"),"--").concat(e.ctsArr.join("-"),"]"),this.avcChangeInfo+=" aDts=[".concat(i.dtsArr.join("-"),"--").concat(s.dtsArr.join("-"),"]")}},{key:"getInfo",value:function(t){var e=t.get(),i=[],s=[];if(e)for(i.push(e.key),e.hasOwnProperty("cts")&&s.push(e.cts);t.size>0;){var r=t.get();i.push(r.key-e.key),r.hasOwnProperty("cts")&&s.push(r.cts),e=r,0===t.size&&i.push(r.key)}return{dtsArr:i,ctsArr:s}}},{key:"record",value:function(t,e){""!==this.avcChangeInfo&&e&&t.setComp(R.DIM_H265_SAM.name,"avcChange",this.avcChangeInfo),this.avcChangeInfo=""}}]),t}(),t2=function(){function t(e){Object(s.a)(this,t),this.type=e,this.totalDuration=0,this.referDts=0,this.firstDts=0,this.lastDts=0,this.durations=[],this.open=!1}return Object(r.a)(t,[{key:"destroy",value:function(){this.durations=null}},{key:"reset",value:function(){I.log("DtsTimeline.reset type=".concat(this.type)),this.totalDuration=0,this.referDts=0,this.firstDts=0,this.lastDts=0,this.durations=[]}},{key:"isFirstDts",value:function(t){return t===this.firstDts}},{key:"alignTimeline",value:function(t){this.firstDts=t.firstDts,this.referDts=t.firstDts,this.lastDts=t.firstDts}},{key:"correctDts",value:function(t,e){if(!this.open)return t;var i=0;if(0===this.firstDts)this.firstDts=t,this.referDts=t,this.lastDts=t,i=t;else{var s=this.lastDts;this.lastDts=t;var r=t-s;if(r<0&&(r=-r),r>F.dtsJumpThreshold){var a=s-this.referDts,n=this.totalDuration+a;this.durations.push({startTime:this.totalDuration,firstDts:this.referDts,endTime:n}),this.totalDuration=n,0===e&&(e="audio"===this.type?44:30);var o=1e3/e;this.referDts=Math.floor(t-o),I.log("DtsTimeline.setDts:dtsJump type=".concat(this.t
1ype," lastDts=").concat(s,", curDts=").concat(t))}i=this.firstDts+this.totalDuration+(t-this.referDts),1==D._printCorrectDts&&I.log("DtsTimeline.setDts:type=".concat(this.type," dts=").concat(t,", correctDts=").concat(i))}return i}},{key:"getRealDtsByCurrentTime",value:function(t){for(var e=this.durations.length-1;e>=0;e--){var i=this.durations[e],s=i.startTime,r=i.endTime,a=i.firstDts;if(t>=s&&t<r)return 0!==e&&(this.durations=this.durations.slice(e)),a+(t-s)}return this.referDts+t-this.totalDuration}},{key:"getCorrentDtsByCurrentTime",value:function(t){return this.firstDts+t}},{key:"getRealDtsByPts",value:function(t){var e=t-this.firstDts-this.totalDuration;return this.referDts+e}}]),t}(),t3=function(){function t(){Object(s.a)(this,t),this._lastVideoDts=0,this._lastAudioDts=0,this._mode=0}return Object(r.a)(t,[{key:"reset",value:function(){this._lastVideoDts=0,this._lastAudioDts=0,this._mode=0}},{key:"isSync",value:function(){return 0===this._mode}},{key:"isVideoDtsDiffLarge",value:function(t){return this._lastVideoDts=t,this._isJump()}},{key:"isAudioDtsDiffLarge",value:function(t){return this._lastAudioDts=t,this._isJump()}},{key:"_isJump",value:function(){return!!F.dtsJumpOpen&&this._lastVideoDts>0&&this._lastAudioDts>0&&(this._lastVideoDts>this._lastAudioDts?this._lastVideoDts-this._lastAudioDts:this._lastAudioDts-this._lastVideoDts)>F.dtsJumpThreshold&&(this._mode=1,!0)}}]),t}(),t5=function(){function t(e,i){Object(s.a)(this,t),this._jitterLimit=e,this._type=i,this._lastFrameId=0,this._lastDts=0,this._jitters=0,this._jitterMax=0,this._compositionTimeMax=0}return Object(r.a)(t,[{key:"reset",value:function(){this._lastFrameId=0,this._lastDts=0,this._jitters=0,this._jitterMax=0}},{key:"addCapture",value:function(t,e){if(0===this._lastFrameId)this._lastFrameId=t,this._lastDts=e;else{if(t-this._lastFrameId==1){var i=e-this._lastDts;i>this._jitterLimit&&this._jitters++,i>this._jitterMax&&(this._jitterMax=i)}this._lastFrameId=t,this._lastDts=e}}},{key:"addCompositionTime",value:function(t){t>this._compositionTimeMax&&(this._compositionTimeMax=t)}},{key:"getStats",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i={},s=this._type===t.Types.VIDEO?R.CORE.V_CAPTURE_JITTERS:R.CORE.A_CAPTURE_JITTERS,r=this._type===t.Types.VIDEO?R.CORE.V_CAPTURE_JITTER_MAX:R.CORE.A_CAPTURE_JITTER_MAX;return i[s]=this._jitters,i[r]=this._jitterMax,this._type===t.Types.VIDEO&&(i[R.CORE.V_CTS_MAX]=this._compositionTimeMax),e&&(this._jitters=0,this._jitterMax=0,this._compositionTimeMax=0),i}}]),t}();t5.Types={AUDIO:"audio",VIDEO:"video"};var t6=!!Number(D._dropAudio),t4=!!Number(D._dropVideo),t8=(D._dropGap,"Hvcc"),t9="AnnexB",t7=function(){function t(){Object(s.a)(this,t),this.lastDts=0,this.lastPts=0,this.lastCts=0,this.dtsStat=[0,0,0,0,0,0],this.ptsStat=[0,0,0,0,0,0],this.ctsStat=[0,0,0,0,0,0],this.playVideoFrameCnt=0,this.playAudioFrameCnt=0}return Object(r.a)(t,[{key:"reset",value:function(){this.lastDts=this.lastPts=this.lastCts=0,this.playVideoFrameCnt=this.playAudioFrameCnt=0,this.dtsStat=[0,0,0,0,0,0],this.ptsStat=[0,0,0,0,0,0],this.ctsStat=[0,0,0,0,0,0]}},{key:"setTimeStamp",value:function(t,e,i){this.addStat(this.dtsStat,this.lastDts,t),this.addStat(this.ptsStat,this.lastPts,e),this.addStat(this.ctsStat,this.lastCts,i),this.lastDts=t,this.lastPts=e,this.lastCts=i}},{key:"addStat",value:function(t,e,i){if(e>0&&i>e){var s=i-e;s>=1e3?t[4]++:s>=800?t[3]++:s>=600?t[2]++:s>=400?t[1]++:s>=200&&t[0]++}}}]),t}(),et=[43,138,8,0],ee=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r,n){var o;return Object(s.a)(this,i),(o=e.call(this)).audioFrameId=0,o.videoFrameId=0,o.corePlayer=t,o.remuxer=r,o.metadata={},o.flvCacher=new tR,o.fps=new er,o.downFrameRate=new tY,o.audioFps=new er,o.sei=new tN(t),o.avSample=new tG,o.hevcSpsParser=new tq,o.vCaptureJitterStat=new t5(200,t5.Types.VIDEO),o.aCaptureJitterStat=new t5(200,t5.Types.AUDIO),o.timeStampStat=new t7,o.emptyFrames=0,o.avcChangeStat=new t1,o.dropFrameCtrl=ne
1w tW(t),o.dropFrameDts=new tJ(t,Object(a.a)(o)),o.videoChain=new tZ,o.audioChain=new tZ,o.ctsMax=0,o.ctsVideoChain=new tZ,o.DEFAULT_GOP=200,o.bufLen=400,o.firstBufLen=400,o.remuxLen=o.firstBufLen,o.maxWaitTime=2e3,o.repairSameDts=!1,o.lastDtsDis=0,o.pushGop=!1,o.parseFlvHead=!1,o.lengthSizeMinusOne=0,o.recvVideoFrameTimeStamp=0,o.recvVideoFrameNums=0,o.videoFramePlayDelayTs=0,o.videoFrameCalculatePlayDelayFrames=0,o.recvAudioConfig=!1,o.audioConfig=et.slice(),o.audioSampleRate=22050,o.aacTimeLen=1024e3/o.audioSampleRate,o.validAacTime=500*o.aacTimeLen,o.audioChannelCount=1,o.audioObjectType=5,o.audioIncreaseTSMap=new Map,o.firstDemuxAudioTS=-1,o.streamFormat=t9,o.spsUnit=null,o.ppsUnit=null,o.vpsUnit=null,o.videoConfig={},o.hasCtsZero=!1,o.paused=!1,o.hasEmptyFrames=!1,o.playVideoFrameCnt=0,o.playVideoLength=0,o.playAudioFrameCnt=0,o.playAudioLength=0,o.playEmptyAudioFrameCnt=0,o.beginParseTs=0,o.hasAudioTag=!1,o.lastAacTs=0,o.hasKeyFrame=!1,o.lastAudioTs=0,o.lastAudioOriginDts=0,o.lastVideoTs=0,o.lastVideoOriginDts=0,o.lastParseDts=0,o.waitNextIFrame=!1,o.maxaudioptsList=[0,0,0,0,0,0,0,0,0,0],o.last10anduiptsList=[0,0,0,0,0,0,0,0,0,0],o.firstAudioTs=-1,o.showH265Tip=!1,o.appendHighQualityEmptyAudio=!0,o.deleteH264Aud=!1,o.incompleteFlvheaderLen=0,o.videoFrames=0,o.audioFrames=0,o.headCache=null,o.useWebCodes=!0,o.decodeNums=0,o.OBUParser=new tU,o.seiTypes={},o.av1Bytes=0,o.lastDropDts=0,o.PPS=[],o.SPS=[],o.VPS=[],o.videoCodec="",o.videoWidth=1280,o.videoHeight=720,o.reset(),o.onAV1SequenceHeaderBind=o.onAV1SequenceHeader.bind(Object(a.a)(o)),o.onAV1MetaDataBind=o.onAV1MetaData.bind(Object(a.a)(o)),o.parseType=n,o.startAudioTs=0,o.startVideoTs=0,o.audioDropTs=0,o.audioDropFrames=[],o.firstAudioDts=0,o.firstAudioFrameId=0,o.parseVideoTagCnt=0,o.parseVideoSucCnt=0,o.isFirstPrintVideoTs=!1,o.isFirstPrintAudioTs=!1,o.isSwap=!1,o.fromType=1,o.startDtsType=0,o.swapStartDts=0,o.sequenceHeader=null,o.timelineVideo=new t2("video"),o.timelineAudio=new t2("audio"),o.dtsChecker=new t3,o}return Object(r.a)(i,[{key:"destroy",value:function(){this.corePlayer=null,this.remuxer=null,this.metadata=null,this.flvCacher&&this.flvCacher.destroy(),this.flvCacher=null,this.fps&&this.fps.destroy(),this.fps=null,this.downFrameRate&&this.downFrameRate.destroy(),this.downFrameRate=null,this.audioFps&&this.audioFps.destroy(),this.audioFps=null,this.sei&&this.sei.destroy(),this.sei=null,this.avSample&&this.avSample.destroy(),this.avSample=null,this.hevcSpsParser&&this.hevcSpsParser.destroy(),this.hevcSpsParser=null,this.v
1CaptureJitterStat=null,this.aCaptureJitterStat=null,this.timeStampStat=null,this.avcChangeStat&&this.avcChangeStat.destroy(),this.avcChangeStat=null,this.dropFrameCtrl&&this.dropFrameCtrl.destroy(),this.dropFrameCtrl=null,this.dropFrameDts&&this.dropFrameDts.destroy(),this.dropFrameDts=null,this.videoChain&&this.videoChain.reset(),this.videoChain=null,this.audioChain&&this.audioChain.reset(),this.audioChain=null,this.ctsVideoChain&&this.ctsVideoChain.reset(),this.ctsVideoChain=null,this.audioConfig=null,this.audioIncreaseTSMap&&this.audioIncreaseTSMap.clear(),this.audioIncreaseTSMap=null,this.spsUnit=null,this.ppsUnit=null,this.vpsUnit=null,this.videoConfig=null,this.maxaudioptsList=null,this.last10anduiptsList=null,this.headCache=null,this.OBUParser=null,this.seiTypes=null,this.PPS=null,this.SPS=null,this.VPS=null,this.videoCodec=null,this.audioDropFrames=null,this.timelineVideo&&this.timelineVideo.destroy(),this.timelineVideo=null,this.timelineAudio&&this.timelineAudio.destroy(),this.timelineAudio=null,this.dtsChecker=null}},{key:"setCorrentDtsOpen",value:function(t){I.log("FlvParser.setCorrentDtsOpen: ".concat(t)),this.timelineVideo.open=t,this.timelineAudio.open=t}},{key:"getAudioFrameId",value:function(){return this.audioFrameId++,this.audioFrameId}},{key:"getVideoFrameId",value:function(){return this.videoFrameId++,this.videoFrameId}},{key:"printVideoInfo",value:function(){var t=this.videoChain;if(t.size>0){for(var e=t.get(),i=[e.key],s=[e.cts];t.size>0;){var r=t.get();i.push(r.key-e.key),s.push(r.cts),e=r}I.log("FlvParser video dtsListï¼".concat(i.join(","))),I.log("FlvParser video ctsListï¼".concat(s.join(",")))}}},{key:"printAudioInfo",value:function(){var t=this.audioChain;if(t.size>0){for(var e=t.get(),i=[e.key];t.size>0;){var s=t.get();i.push(s.key-e.key),e=s}I.log("FlvParser audio dtsListï¼".concat(i.join(",")))}}},{key:"getCodecType",value:function(){return 12===this.codec?t$:13===this.codec?"av1":tX}},{key:"printPlayFrameInfo",value:function(){I.log("FlvParser.playFrameInfo",this.timeStampStat.playVideoFrameCnt,this.timeStampStat.playAudioFrameCnt)}},{key:"getAudioFrames",value:function(){return this.audioFrames}},{key:"getVideoFrames",value:function(){return this.videoFrames}},{key:"getFps",value:function(){return this.fps.getFps()}},{key:"getRealFps",value:function(){return this.fps.realFps}},{key:"getRealFpsAudio",value:function(){return this.audioFps.realFps}},{key:"isDownEnough",value:function(){return this.downFrameRate.isDownEnough(this.fps.realFps)}},{key:"getAudioFps",value:function(){return this.audioFps&&this.audioFps.getFps()}},{key:"setDecoctorTimeAbnormal",value:function(){var t=D.decodeabnormal;if(t&&t.split("_").length>1){var e=parseInt(t.split("_")[1]),i=(new Date).getTime()-e;i&&i>864e5?(this.appendHighQualityEmptyAudio=!0,D.decodeabnormal=""):this.appendHighQualityEmptyAudio=!1}}},{key:"reset",value:function(t){I.log("FlvParser.reset"),this.audioFrameId=0,this.videoFrameId=0,this.printFirstVideoTs=!1,this.printFirstAudioTs=!1,this.pfvTs=!1,this.pfaTs=!1,this.fps.reset(),this.audioFps.reset(),this.flvCacher.reset(),this.timeStampStat.reset(),this.dropFrameCtrl.reset(),this.dropFrameDts.reset(),this.videoChain.reset(),this.audioChain.reset(),this.downFrameRate.reset(),this.lastParseDts=0,this.hasAudioTag=!1,this.lastAacTs=0,this.hasKeyFrame=!1,this.lastAudioTs=0,this.lastAudioOriginDts=0,this.lastVideoTs=0,this.lastVideoOriginDts=0,this.lastDropDts=0,this.showH265Tip=!1,this.bufLen=400,this.remuxLen=this.firstBufLen,this.hasCtsZero=!1,this.audioIncreaseTSMap.clear(),this.firstDemuxAudioTS=-1,this.recvVideoFrameTimeStamp=0,this.recvVideoFrameNums=0,this.videoFramePlayDelayTs=0,this.videoFrameCalculatePlayDelayFrames=0,this.incompleteFlvheaderLen=0,this.parseFlvHead=!1,this.switchingUrl=!1,this.droppingSample=null,this.disError302=null,this.decodeIFRTime=0,this.waitRemuxTime=0,this.isFirstRemux=!1,this.av1Bytes=0,this.av1Extradata=0,this.onAV1SequenceHeaderBind=null,this.onAV1MetaDataBind=null,this.startAudioTs=0,this.startVideoTs=0,this.PPS.length=0,this.SPS.length=0,this.VPS.length=0,this.videoCodec="",this.videoWidth=1280,this.videoHeight=720}},{key:"getPlayStat",value:function(){var t={videoFrameCnt:this.playVideoFrameCnt,videoLe
1ngth:this.playVideoLength,audioFrameCnt:this.playAudioFrameCnt,audioLength:this.playAudioLength,emptyAudioFrameCnt:this.playEmptyAudioFrameCnt};return this.playVideoFrameCnt=0,this.playVideoLength=0,this.playAudioFrameCnt=0,this.playAudioLength=0,this.playEmptyAudioFrameCnt=0,t}},{key:"setPaused",value:function(t){this.paused=t}},{key:"setPushGop",value:function(t){this.pushGop=t,I.log("FlvParser.setPushGop "+t)}},{key:"setDeleteH264Aud",value:function(t){this.deleteH264Aud=t,I.log("FlvParser.deleteH264Aud "+t)}},{key:"setDroppingSample",value:function(t){this.droppingSample=t}},{key:"setDisError",value:function(t){this.disError302=t}},{key:"parseFlv",value:function(t,e){var s=0;if(this.headCache){var r=new Uint8Array(t.length+this.headCache.length);r.set(this.headCache,0),r.set(t,this.headCache.length),t=r}var a,n=t.length;if(!1===this.parseFlvHead){var o=i.FLV_HEADER_LEN+i.PREV_TAG_SIZE_LEN;if(n<o)return I.log("%cFlvParser.parseFlv flv has no header len="+n,L.LOG_COLOR.WARN),void(this.headCache=t.slice());if(this.headCache=null,s+=o,!i.probe(t))return;this.parseFlvHead=!0,this.beginParseTs=Date.now()}for(0===s?this.flvCacher.append(t):this.flvCacher.append(t.slice(s));null!==(a=this.flvCacher.popFrame());)this.parseTag(a,e)}},{key:"parseTag",value:function(t,e,s){var r=t.length;if(r<i.TAG_HEADER_LEN+i.PREV_TAG_SIZE_LEN)I.log("%cFlvParser.parseTag flv has no whole tag len="+r+" data="+t,L.LOG_COLOR.WARN);else{var a=0,n=t[a++],o=(t[a++]<<16)+(t[a++]<<8)+t[a++];if(r-(i.TAG_HEADER_LEN+i.PREV_TAG_SIZE_LEN)<o)I.log("%cFlvParser.parseTag flv has no enough data dataLen="+o+" len="+r,L.LOG_COLOR.WARN);else if(0!==o){var u=(t[a++]<<16)+(t[a++]<<8)+t[a++]+parseInt(t[a++].toString(16)+"000000",16);if(a+=3,n===i.VIDEO_TYPE){if(2===this.parseType)return;1==D._jumpV1?u+=1e6:2==D._jumpV1&&(u-=1e6),this.avSample.addVideoSample(r,u),t4||(this.parseVideo(t,11,o,u,s),this.corePlayer&&this.corePlayer.setExceptionStat(R.DIM_LINK_STA.VIDEO_FRAME,1))}else if(n===i.AUDIO_TYPE){if(D._dropAudioNum>0&&(this.dropAudioNum=Number(D._dropAudioNum),D._dropAudioNum=0),this.dropAudioNum>0)return void this.dropAudioNum--;if(1==D._noAudio)return;1==D._jumpA1?u+=1e6:2==D._jumpA1&&(u-=1e6),this.avSample.addAudioSample(r,u),t6||this.corePlayer.isPureVideo||(this.parseAudio(t,11,o,u,s),this.corePlayer&&this.corePlayer.setExceptionStat(R.DIM_LINK_STA.AUDIO_FRAME,1))}else n===i.SCRIPT_TYPE?this.parseScriptTag(t,11,o,u):(I.log("%cFlvParser.parseTag discard type="+n+" len="+o,L.LOG_COLOR.WARN),this.corePlayer&&this.corePlayer.onVideoParseInvalid&&this.corePlayer.onVideoParseInvalid())}else I.log("%cFlvParser.parseTag flvtag empty type="+n,L.LOG_COLOR.WARN)}}},{key:"parseScriptTag",value:function(t,e,s,r){if(e+i.SCRIPT_AMF1_HEAD_LEN>s)I.log("script too small");else{t[e++];var a=(t[e++]<<8)+t[e++],n=tO.getStr(t,e,a);e+=a,this.corePlayer&&("onMetaData"===n?(this.metadata=tO.parseScript(t,e,t.length).data,Object.assign(this.corePlayer.metadata,this.metadata)):-1!==n.indexOf("onMixAudio")&&this.corePlayer.scriptVolumeInfos.addMixAudio(n.replace("onMixAudio:",""),r))}}},{key:"setCodec",value:function(t){this.corePlayer&&this.corePlayer.setCodec&&this.corePlayer.setCodec(t)}},{key:"parseVideo",value:function(t,e,s,r,a){var n=r;if(this.isFirstPrintTs||(I.log("FlvParser.firstVideoTs=".concat(r)),this.isFirstPrintTs=!0),this.repairSameDts&&r===this.lastVideoTs&&this.lastDtsDis>0){var o=this.fps.realFps;r+=o>0?parseInt(1e3/o):this.lastDtsDis}if(this.lastVideoTs>0&&this.lastVideoTs<r&&(this.lastDtsDis=r-this.lastVideoTs),s<5)I.log("%cFlvParser.parseVideo avc videotag not enough dataLen="+s,L.LOG_COLOR.WARN);else{var u=t[e]>>4;this.codec=15&t[e++];var l=t[e++];if(5!==s)if(0===l)this.parseVideoConfig(t,e,s,r);else if(1===l){if(n<=this.lastVideoOriginDts)return I.log("FlvParser.parseVideo originDts=".concat(n," <= lastVideoOriginDts=").concat(this.lastVideoOriginDts,", drop video frame")),void(this.waitNextIFrame=!0);if(a||(a=this.getVideoFrameId()),this.vCaptureJitterStat.addCapture(a,n),r=this.timelineVideo.correctDts(r,this.fps.realFps),this.dtsChecker.isVideoDtsDiffLarge(r)&&this.timelineVideo.isFirstDts(r)&&(this.corePlayer&&(this.corePlayer.resetAudioDts(),this.corePlayer.ctrlBuffer.avBuffer.dtsChecker.reset()),this.timelineAudio.reset()),this.waitNextIFrame&&u!==i.IFRAME)return void I.log("FlvParser.parseVideo waitNextIFrame=".concat(this.waitNextIFrame," frameType=").concat(u,", drop video frame, dts=").concat(r," lastOriDts=").concat(this.lastVideoOriginDts));if(this.waitNextIFrame&&u===i.IFRAME&&I.log("FlvParser.parseVideo got IFrame, continue parse video frames, dts=".concat(r," lastOriDts=").concat(this.lastVideoOriginDts)),this.waitNextIFrame=!1,this.parseVideoTagCnt++,u==i.IFRAME)this.corePlayer&&this.corePlayer.setExceptionStat(R.DIM_LINK_STA.VIDEO_IFRAME,1),this.hasKeyFrame||(this.decodeIFRTime=g.now()),this.hasKeyFrame=!0;else if(!this.hasKeyFrame)return void I.log("-------- drop video tag has no IFrame",r);if(0===F.pcdnFlvSyncMob&&!this.isFirstPrintVideoTs&&2==this.fromType){var d=r-this.swapStartDts;
1if(I.log("FlvParser.PCDN, firstVideoTs=".concat(r," dis=").concat(d)),this.isFirstPrintVideoTs=!0,this.getPcdnDisError(d))return}if(Number(D._printVideoTs)&&I.debug("%cFlvParser video ts","color:green"," oriDts=".concat(n," dif=").concat(n-this.lastVideoOriginDts," fixDts=").concat(r," dif=").concat(r-this.lastVideoTs," fixDts-oriDts=").concat(r-n," frameType=").concat(u)),D.gap&&(r+=Number(D.gap)),this.lastVideoTs>0&&(r-this.lastVideoTs>200||r-this.lastVideoTs<-200)){var c=r-this.lastVideoTs;if(I.log("%cFlvParser video dts jump lastDts=".concat(this.lastVideoTs," curDts=").concat(r," gap=").concat(c),"color:#FFC107"),c>=F.videoMaxGap||c<=-F.videoMaxGap)return void this.resetPlayer()}if(1==Number(D._printAudioTsSec)){var f=g.now();f-this.startVideoTs>1e3&&(I.debug("%cFlvParser shield video sec ts","color:blue",r),this.startVideoTs=f)}this.lastVideoTs=r,this.lastVideoOriginDts=n,this.parseVideoNalu(t,e,s,r,u)}else 2===l?I.info("%cFlvParser.parseVideo avc_end dataLen="+s,"color:white;background:black"):I.log("%cFlvParser.parseVideo error avc packet type="+l,"color:white;background:black");else I.log("FlvParser.parseVideo avc_empty frameType="+u+" avcPacketType="+l)}}},{key:"resetPlayer",value:function(){this.corePlayer&&this.corePlayer.resetPlayer()}},{key:"onAV1SequenceHeader",value:function(t){this.sequenceHeader=t;var e="av01."+t.seq_profile+"."+tU.zeroPad(t["seq_level_idx[0]"],2)+(t["seq_tier[0]"]?"H":"M")+"."+tU.zeroPad(t.BitDepth,2)+"."+t.mono_chrome+"."+t.subsampling_x+t.subsampling_y+(1===t.subsampling_x&&1===t.subsampling_y?t.chroma_sample_position:0);t.color_description_present_flag&&(e+="."+tU.zeroPad(t.color_primaries,2)+"."+tU.zeroPad(t.transfer_characteristics,2)+"."+tU.zeroPad(t.transfer_characteristics,2)+"."+t.color_range);var i={isHevc:!1,isAV01:!0,width:t.max_frame_width_minus_1+1,height:t.max_frame_height_minus_1+1,codec:e};this.videoCodec=i.codec,this.videoWidth=i.width,this.videoHeight=i.height,this.remuxer&&this.remuxer.switchLevel(!1,!1),this.corePlayer&&(this.corePlayer.setExceptionStat(R.DIM_LINK_STA.VIDEO_CONFIG,1),this.corePlayer.updateVideoConfig(i,!1),this.corePlayer.updateAVCConfig&&this.corePlayer.updateAVCConfig({pps:[],sps:[],vps:[],codec:i.codec,width:1280,height:720,timestamp:0}))}},{key:"onAV1MetaData",value:function(t,e){e.itu_t_t35_payload_bytes&&this.sei.parseSei(t,e.itu_t_t35_payload_bytes,tN.AV1_CODEC_TYPE,this.seiTypes)}},{key:"parseVideoConfig",value:function(t,e,s,r){var a,n,o=[],u=[],l=[],d=[],c=[],f=[],p=!1,m=null,_=(e+=3)+s-5;if(this.isAv01()){this.setCodec(i.AV1),this.av1Bytes=t.subarray(e,e+s-5),this.av1Extradata=t.subarray(e+1,e+s-5);var y=t.subarray(e+=4,e+s);tU.parseOBU(y,0,this.onAV1SequenceHeaderBind)}else{if(this.isHevc()){this.setCodec(i.HEVC),this.showH265Tip||(this.showH265Tip=!0,I.log("%cThis is a H265 video.",L.LOG_COLOR.WARN)),this.corePlayer&&this.corePlayer.setExceptionStat(R.DIM_LINK_STA.H265,1);var v=this.hevcFindNextStartCode(t,e);if(v.found){this.streamFormat=t9,this.corePlayer&&this.corePlayer.setStreamFormat(this.streamFormat),I.log("FlvParser.parseVideoConfig AnnexB");for(var S=(126&t[e+=v.startCodeSize])>>1,g=e;e<_;){if((v=this.hevcFindNextStartCode(t,e)).found||e+1===_){switch(S){case i.NAL_VPS:var T=null;T=e+1===_?{data:t.subarray(g,e+1),type:S}:{data:t.subarray(g,e),type:S},this.vpsUnit&&this.vpsUnit.data.toString(16)!==T.data.toString(16)&&(I.log("FlvParser.parseVideoConfig vps changed"),p=!0),this.vpsUnit=T,l.push(T.data),f[f.length]={length:T.data.length,nalu:T.data};break;case i.NAL_SPS:var P=null;P=e+1===_?{data:t.subarray(g,e+1),type:S}:{data:t.subarray(g,e),type:S},this.spsUnit&&this.spsUnit.data.toString(16)!==P.data.toString(16)&&(I.log("FlvParser.parseVideoConfig sps changed"),p=!0),this.spsUnit=P,o.push(P.data),d[d.length]={length:P.data.length,nalu:P.data};break;case i.NAL_PPS:var C=null;C=e+1===_?{data:t.subarray(g,e+1),type:S}:{data:t.subarray(g,e),type:S},this.ppsUnit&&this.ppsUnit.data.toString(16)!==C.data.toString(16)&&(I.log("FlvParser.parseVideoConfig pps changed"),p=!0),this.ppsUnit=C,u.push(C.data),c[c.length]={length:C.data.length,nalu:C.data}}if(e+v.startCodeSize<_){S=(126&t[e+=v.startCodeSize])>>1,g=e;continue}}e++}}else{if(!F.enableHvcc)return I.log("%chevcFindNextStartCode failed! dataLen=".concat(s),L.LOG_COLOR.WARN),void(this.corePlayer&&this.corePlayer.on265StartCodeError());this.setCodec(i.HEVC),this.streamFormat=t8,this.corePlayer&&this.corePlayer.setStreamFormat(this.streamFormat),I.log("FlvParser.parseVideoConfig Hvcc"),e+=21,this.lengthSizeMinusOne=3&t[e++];var E=t[e++];I.log("FlvParser.parseVideoConfig Hvcc nNaluArrayCount=".concat(E));for(var k=0;k<E;k++){var A=99&t[e++];if(A===i.NAL_VPS)for(var D=(t[e++]<<8)+t[e++],O=0,b=0;b<D;++b){O=(t[e++]<<8)+t[e++];var w={data:t.subarray(e,e+O),type:i.NAL_VPS};this.vpsUnit&&this.vpsUnit.data.toString(16)!==w.data.toString(16)&&(I.log("FlvParser.parseVideoConfig vps changed"),p=!0),this.vpsUnit=w,e+=O,l.push(w.data),f[f.length]={length:w.data.length,nalu:w.data}}else if(A===i.NAL_SPS)for(var M=(t[e++]<<8)+t[e++],N=0;N<M;++N){a=(t[e++]<<8)+t[e++];var B={data:t.subarray(e,e+a),type:i.NAL_SPS};this.spsUnit&&this.spsUnit.data.toString(16)!==B.data.toString(16)&&(I.log("FlvParser.parseVideoConfig sps changed"),p=!0),this.spsUnit=B,e+=a,o.push(B.data),d[d.length]={length:B.data.length,nalu:B.data}}else if(A===i.NAL_PPS)for(var V=(t[e++]<<8)+t[e++],U=0;U<V;++U){n=(t[e++]<<8)+t[e++];var x={data:t.subarray(e,e+n),type:i.NAL_PPS};this.ppsUnit&&this.ppsUnit.data.toString(16)!==x.data.toString(16)&&(I.log("FlvParser.parseVideoConfig pps changed"),p=!0),this.ppsUnit=x,e+=n,u.push(x.data),c[c.length]={length:x.data.length,nalu:x.data}}}}m=this.parseSps(this.spsUnit,l,o,u),this.hasCtsZero=!0,this.corePlayer&&this.corePlayer.setAvcCfg(m.width,m.height)}
1else{this.setCodec(i.AVC),e+=4,this.lengthSizeMinusOne=3&t[e++],this.streamFormat="Avcc",I.log("FlvParser.parseVideoConfig Avcc"),this.corePlayer&&this.corePlayer.setStreamFormat(this.streamFormat);for(var H=31&t[e++],G=0;G<H;++G){a=(t[e++]<<8)+t[e++];var W={data:t.subarray(e,e+a),type:7};this.spsUnit&&this.spsUnit.data.toString(16)!==W.data.toString(16)&&(I.log("FlvParser.parseVideoConfig sps changed",this.spsUnit.data.toString(16),W.data.toString(16)),p=!0),this.spsUnit=W,e+=a,o.push(W.data),d[G]={length:a,nalu:W.data}}for(var j=t[e++],Y=0;Y<j;++Y){n=(t[e++]<<8)+t[e++];var q={data:t.subarray(e,e+n),type:8};this.ppsUnit&&this.ppsUnit.data.toString(16)!==q.data.toString(16)&&(I.log("FlvParser.parseVideoConfig pps changed",this.ppsUnit.data.toString(16),q.data.toString(16)),p=!0),this.ppsUnit=q,e+=n,u.push(q.data),c[Y]={length:n,nalu:q.data}}m=this.parseSps(this.spsUnit,l,o,u),this.corePlayer&&this.corePlayer.setAvcCfg(m.width,m.height)}this.corePlayer&&this.corePlayer.setExceptionStat(R.DIM_LINK_STA.VIDEO_CONFIG,1),this.corePlayer&&this.corePlayer.updateAVCConfig&&this.corePlayer.updateAVCConfig({pps:c,sps:d,vps:f,codec:m.codec,width:m.width,height:m.height,timestamp:r}),this.PPS=c,this.SPS=d,this.VPS=f,this.videoCodec=m.codec,this.videoWidth=m.width,this.videoHeight=m.height,this.avcChangeStat.setAvcChange(),this.corePlayer&&this.corePlayer.updateVideoConfig(m,p),this.remuxer&&this.remuxer.switchLevel(p,!1),I.log("FlvParser.parseVideoConfig avccfg dataLen="+s+" spsLen="+a+" ppsLen="+n+" w/h="+m.width+"/"+m.height+" codec="+m.codec,"sps=".concat(JSON.stringify(d)),"pps=".concat(JSON.stringify(c)),"vps=".concat(JSON.stringify(f)))}}},{key:"parseSps",value:function(t,e,i,s){var r=null,a="",n=0,o=0;if(this.isHevc()){this.spsConfig={},this.hevcSpsParser.parseSequenceParameterSet(t.data,t.data.length,this.spsConfig);var u=this.spsConfig.profile_space,l=this.spsConfig.profile_idc,d=this.spsConfig.profile_compatibility_flags;d=(d=(d=(d=(d=d>>1&0x55555555|(0x55555555&d)<<1)>>2&0x33333333|(0x33333333&d)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&d)<<4)>>8&0xff00ff|(0xff00ff&d)<<8)>>16|d<<16;var c=this.spsConfig.tier_flag,f=this.spsConfig.level_idc;a="hvc1."+["","A","B","C"][u%4]+l.toString()+"."+d.toString(16).toLowerCase()+"."+["L","H"][c%2]+f.toString(),n=this.spsConfig.width||this.corePlayer.width,o=this.spsConfig.height||this.corePlayer.height,I.log("FlvParser.parseVideoConfig.hevcSpsConfig",this.spsConfig,a),r={isHevc:!0,isAV01:!1,vps:e,sps:i,pps:s,codec:a,width:n,height:o}}else{try{n=(r=new tA(t.data).readSPS()).width,o=r.height}catch(t){I.log("FlvParser.parseSPS error, msg=".concat(t.message)),n=this.metadata.width||1280,o=this.metadata.height||720}for(var p=t.data.subarray(1,4),m="avc1.",_=0;_<3;_++){var y=p[_].toString(16);y.length<2&&(y="0"+y),m+=y}r={isHevc:!1,isAV01:!1,sps:i,pps:s,width:n,height:o,codec:a=m}}return r}},{key:"calcCtsMax",value:function(t,e){if(e>0){this.ctsVideoChain.put({key:t,cts:e});var i=0,s=this.ctsVideoChain.head.data.key;if(this.ctsVideoChain.head.prev.data.key-s>=5e3&&(i=this.ctsVideoChain.head.data.cts,this.ctsVideoChain.get()),this.ctsMax<e)this.ctsMax=e;else if(this.ctsMax===i){for(var r=this.ctsVideoChain.head,a=0;a<r.data.cts&&(a=r.data.cts),r.next!==this.ctsVideoChain.head;)r=r.next;this.ctsMax=a}}}},{key:"parseVideoNalu",value:function(t,e,s,r,a){var n,o,u=[],l=0,d=[],c=[],f=[],p=null,m=!1,_=a===i.IFRAME,y=(t[e++]<<16)+(t[e++]<<8)+t[e++];0===y?this.hasCtsZero||(this.hasCtsZero=!0):y>=8388608?y-=0x1000000:y>2500&&y<3500?y=0:y>600&&I.log("%cFlvParser.parseVideoNalu large cts="+y+" dts="+r,L.LOG_COLOR.WARN),this.vCaptureJitterStat.addCompositionTime(y),tZ.addData(this.videoChain,{key:r,cts:y},Number(F.avHeaderChangeCfg[2])),this.avcChangeStat.addVideo({key:r,cts:y}),this.calcCtsMax(r,y);var v=e+s-5,S=!1;if(this.seiTypes={},this.isAv01()){var T=t.subarray(e,e+s-5);u.push({data:T,type:1===a?5:1}),tU.parseOBU(T,r,null,this.onAV1MetaDataBind),l+=T.length,n=1}else if(this.isHevc()){if(this.streamFormat==t9){var P=this.hevcFindNextStartCode(t,e);if(!P.found)return I.error("hevcFindNextStartCode failed! dataLen",s),void this.corePlayer.on265StartCodeError();for(var C=(126&t[e+=P.startCodeSize])>>1,E=e;e<v;)((P=this.hevcFindNextStartCode(t,e)).found||e+1===v)&&(C<10&&(S=!((98&C)>>1)),o=e+1===v?{data:t.subarray(E,e+1),type:C}:{data:t.subarray(E,e),type:C},C===i.HEVC_NAL_SEI?this.sei.parseSei(r,o.data,tN.H265_CODEC_TYPE,this.seiTypes):C===i.HEVC_NAL_AUD||(C===i.NAL_VPS?(f.push({length:o.data.length,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCVPS&&this.corePlayer.updateAVCVPS(o.data,r)):C===i.NAL_SPS?(p=o,c.push({length:o.data.length,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCSPS&&this.corePlayer.updateAVCSPS(o.data,r)):C===i.NAL_PPS?(d.push({length:o.data.length,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCPPS&&this.corePlayer.updateAVCPPS(o.data,r)):(o.discardAllow=C<10&&!(1&C),o.isUnit=!0,u.push(o),l+=o.data.length)),e+P.startCodeSize<v)?(C=(126&t[e+=P.startCodeSize])>>1,E=e):e++}else if(this.streamFormat==t8)for(var k=s-5;k;){n=0;for(var A=0;A<=this.lengthSizeMinusOne;++A)n+=t[e++]<<8*(this.lengthSizeMinusOne-A);if(k-=this.lengthSizeMinusOne+1,0!==n){if(n<0||n>s-5)break;if(n>k){e+=k;break}var O=(126&t[e])>>1;k-=n,(o={data:t.subarray(e,e+n),type:O}).naluType=O,O===i.HEVC_NAL_SEI?this.sei.parseSei(r,o.data,tN.H265_CODEC_TYPE,this.seiTypes):O===i.HEVC_NAL_AUD||(O===i.NAL_VPS?(f.push({length:o.data.length,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCVPS&&this.corePlayer.updateAVCVPS(o.data,r)):O===i.NAL_SPS?(p=o,c.push({length:o.data.length,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCSPS&&this.corePlayer.updateAVCSPS(o.data,r)):O===i.NAL_PPS?(d.push({length:o.data.length,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCPPS&&this.corePlayer.updateAVCPPS(o.data,r)):(o.discardAllow=O<10&&!(1&O),o.isUnit=!0,u.push(o),l+=o.data.length)),e+=n}}}else for(var b=s-5;b;){n=0;for(var w=t[e+4],M=0;M<=this.lengthSizeMinusOne;++M)n+=t[e++]<<8*(this.lengthSizeMinusOne-M);if(b-=this.lengthSizeMinusOne+1,0!==n){if(n<0||n>s-5)break;if(n>b){e+=b;break}b-=n;var N=31&(o={data:t.subarray(e,e+n),type:1===a?5:1}).data[0];if(o.naluType=N,this.isPartitionC(o.data))I.log("delete partitionC");else if(this.isH264Sei(o.data))this.sei.parseSei(r,o.data,tN.H264_CODEC_TYPE,this.seiTypes),1==D._pushSei&&(u.push(o),l+=o.data.length);else if(this.isH264NALUPPS(o.data))d.push({length:n,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCPPS&&this.corePlayer.updateAVCPPS(o.data,r);else if(this.isH264NALUPSPS(o.data))p=o,c.push({length:n,nalu:o.data}),u.push(o),l+=o.data.length,this.corePlayer.updateAVCSPS&&this.corePlayer.updateAVCSPS(o.data,r);else if(this.corePlayer.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS){if(N>=1&&N<=5){var B=!1;1!=a&&0==(96&w)&&(B=!0,m=!0),o.discardAllow=B,o.isUnit=!0,u.push(o),l+=o.data.length}}else 1==F.isLimitNaluType?N>
1=1&&N<=5&&!this.dropFrameDts.isCanDrop(r,_,w)&&(u.push(o),l+=o.data.length):this.isH264Aud(o.data)&&this.deleteH264Aud||(this.isH264Aud(o.data)?(u.push(o),l+=o.data.length):this.dropFrameDts.isCanDrop(r,_,w)||(u.push(o),l+=o.data.length));e+=n}}if(_&&!this.isAv01()&&(this.vpsUnit&&0==f.length&&(u.push(this.vpsUnit),l+=this.vpsUnit.data.length),this.spsUnit&&0==c.length&&(u.push(this.spsUnit),l+=this.spsUnit.data.length),this.ppsUnit&&0==d.length&&(u.push(this.ppsUnit),l+=this.ppsUnit.data.length)),l>0){var V=!1,U=[],x=[],H=[];if(_){x=c.length>0?c:this.SPS,U=f.length>0?f:this.VPS,H=d.length>0?d:this.PPS;var G=!1,W=!1,j=!1;if(this._isCfgChange(this.SPS,c)&&(V=!0,G=!0),this._isCfgChange(this.PPS,d)&&(V=!0,W=!0),this._isCfgChange(this.VPS,f)&&(V=!0,j=!0),V&&this.corePlayer.setIFrameAvcChageStat(),V){G&&this.SPS.length>0&&c.length>0&&I.log("FlvParser.parseVideoNalu IFrame header != avcHeader,avcspsLen=".concat(this.SPS.length,",spsLen=").concat(c.length,",sps=").concat(c[0].nalu.toString()," && ").concat(this.SPS[0].nalu.toString())),W&&this.PPS.length>0&&d.length>0&&I.log("FlvParser.parseVideoNalu IFrame header != avcHeader,avcPPSLen=".concat(this.PPS.length,",ppsLen=").concat(d.length,",pps=").concat(d[0].nalu.toString()," && ").concat(this.PPS[0].nalu.toString())),j&&this.VPS.length>0&&f.length>0&&I.log("FlvParser.parseVideoNalu IFrame header != avcHeader,acvVPSLen=".concat(this.VPS.length,",vpsLen=").concat(f.length,",vps=").concat(f[0].nalu.toString()," && ").concat(this.VPS[0].nalu.toString()));var Y=this.parseSps(p,U,x,H);this.corePlayer.setAvcCfg(Y.width,Y.height),this.corePlayer.setExceptionStat(R.DIM_LINK_STA.VIDEO_CONFIG,1),this.corePlayer.updateAVCConfig&&this.corePlayer.updateAVCConfig({pps:H,sps:x,vps:U,codec:Y.codec,width:Y.width,height:Y.height,timestamp:r}),this.PPS=H,this.SPS=x,this.VPS=U,this.videoCodec=Y.codec,this.videoWidth=Y.width,this.videoHeight=Y.height,this.remuxer&&this.remuxer.switchLevel(V,!1)}}var q={type:this.isAv01()?"av01":"avc",units:u,len:l,ts:r,cts:y,dts:90*r,pts:90*(r+y),key:a===i.IFRAME,origin_iframe:1===this.seiTypes[tN.SEI_TYPES.IFRAME],isBFrameType:S,av1Bytes:this.av1Bytes,av1Extradata:this.av1Extradata};if(1==D._printVideoFrameType&&I.log("FlvParser.parseVideo FrameType=".concat(a," iFrameType=").concat(i.IFRAME,", dts=").concat(r)),_&&(1==D._printIframeDetail&&I.log("FlvParser.parseVideo iFrame,avcChange=".concat(V,",dts=").concat(r,",vpslen=").concat(f.length,",vLen=").concat(U.length,",spsLen=").concat(c.length,",sLen=").concat(x.length,",ppsLen=").concat(d.length,",pLen=").concat(H.length)),q.spsUnit=x,q.ppsUnit=H,q.vpsUnit=U,q.videoCodec=this.videoCodec,q.videoWidth=this.videoWidth,q.videoHeight=this.videoHeight),this.corePlayer.isLive&&this.corePlayer.videoPlayConsuming&&this.corePlayer.videoPlayConsuming.addRecvFrameData(r,r+y,g.now()),this.droppingSample&&this.droppingSample(q))return;if(this.printFirstVideoTs||(this.printFirstVideoTs=!0,I.log("FlvParser.parseVideo dts=".concat(r," pts=").concat(q.pts/90," isIFrame=").concat(_))),this.pfvTs||(this.pfvTs=!0,I.log("FlvParser.parseVideo11 dts=".concat(r," pts=").concat(q.pts/90," isIFrame=").concat(_))),this.corePlayer.webcodecType!=L.PLAYER_CORE_TYPE.WEBCODECS||this.isAv01())this.fps.addDts(r,s);else{var K=_?i.IFRAME:m?i.NO_REFERENCE_FRAME:0;this.fps.addDts(r,s,K)}this.downFrameRate.addFrame(),this.dropFrameCtrl.setRealFps(this.fps.realFps),this.dropFrameDts.setRealFps(this.fps.realFps),this.corePlayer.setRealFps(this.fps.realFps),this.corePlayer.curVideoDts=r,this.lastParseDts=r,this.videoFrames++,this.timeStampStat.setTimeStamp(r,r+y,y),this.parseVideoSucCnt++,this.corePlayer.pushAvcSample(q),this.playVideoFrameCnt++,this.timeStampStat.playVideoFrameCnt++,this.playVideoLength+=s}}},{key:"_isCfgChange",value:function(t,e){var i=!1;return t.length>0&&e.length>0&&(t.length!==e.length?i=!0:e.forEach(function(e,s){i||e.nalu.toString()===t[s].nalu.toString(16)||(i=!0)})),i}},{key:"addVideoSPS",value:function(){}},{key:"addVideoPPS",value:function(){}},{key:"addVideoVPS",value:function(){}},{key:"parseAudio",value:function(t,e,s,r,a){var n=r;tZ.addData(this.audioChain,{key:r},Number(F.avHeaderChangeCfg[2])),this.avcChangeStat.addAudio({key:r});var o=t[e++]>>>4,u=r;10!=o&&I.log("%cFlvParser.parseAudio Unsupported audio codec, soundFormat="+o,L.LOG_COLOR.WARN),this.calcAudioFrameRate(r),null!=this.audioIncreaseTSMap.get(r)&&(r=this.audioIncreaseTSMap.get(r));var l=t[e++];if(0===l)if(s>=4){var d=t[e]>>3;this.audioObjectType=d;var c=((7&t[e])<<1)+((128&t[e+1])>>7);if(c>=i.AdtsSampleingRates.length)return void I.log("%cFlvParser.parseAudio SampleingRate out of bounds. samplingIndex="+c,L.LOG_COLOR.WARN);this.audioChannelCount=(120&t[e+1])>>3;var f=this.getAdtsConfig(d,c,this.audioChannelCount),p=!1;this.recvAudioConfig&&this.audioConfig.toString(16)===f.toString(16)||(p=!0),this.audioConfig=f,this.recvAudioConfig=!0,this.corePlayer.updateAudioConfig({audioConfig:f,codec:"mp4a.40.5",audioSampleRate:this.audioSampleRate,aacTimeLen:this.aacTimeLen,audioObjectType:this.audioObjectType,audioChannelCount:this.audioChannelCount,timeStamp:r},!1,this.parseType),p&&(this.firstAudioTs=-1,this.firstDemuxAudioTS=-1,this.lastAudioTs=0,this.firstAudioDts=0,this.firstAudioFrameId=0,this.corePlayer.resetAudioDts()),this.corePlayer.setExceptionStat(R.DIM_LINK_STA.AUDIO_CONFIG,1)}else I.log("%cFlvParser.parseAudio adts error dataLen="+s+" ts="+r,L.LOG_COLOR.WARN);else if(1===l){if(n<=this.lastAudioOriginDts)return void I.log("%cFlvParser.parseAudio aacPacketType=1, originDts(".concat(n,") <= lastAudioOriginDts(").concat(this.lastAudioOriginDts),"color:#FFC107");if(this.audioFrames++,0===F.pcdnFlvSyncMob&&!this.isFirstPrintAudioTs&&2==this.fromType){var m=r-this.swapStartDts;
1if(I.log("FlvParser.PCDN, firstAudioTs=".concat(r," dis=").concat(m)),this.isFirstPrintAudioTs=!0,this.getPcdnDisError(m))return}if(F.dtsJumpOpen&&(r=this.timelineAudio.correctDts(r,this.audioFps.realFps),this.dtsChecker.isAudioDtsDiffLarge(r)&&this.timelineAudio.isFirstDts(r)&&(this.timelineAudio.alignTimeline(this.timelineVideo),r=this.timelineAudio.correctDts(r,this.audioFps.realFps))),!this.recvAudioConfig)return;a||(a=this.getAudioFrameId()),this.aCaptureJitterStat.addCapture(a,n);var _=0;if(F.audioDtsOpen)if(0===this.firstAudioDts)this.lastAudioTs=r,this.firstAudioDts=r,this.firstAudioFrameId=a,this.corePlayer.resetAudioDts();else{var y=(_=Math.floor(this.firstAudioDts+(a-this.firstAudioFrameId)*this.aacTimeLen))-r;y<0&&(y=-y),y<100?r=_:y>300&&(I.log("FlvParser.parseAudio timeStamp diff(".concat(y,")>300 resetFirstAudioDts, frameId=").concat(a," dts=").concat(_," timeStamp=").concat(r," firstAudioDts=").concat(this.firstAudioDts," firstFrameId=").concat(this.firstAudioFrameId)),this.lastAudioTs=r,this.firstAudioDts=r,this.firstAudioFrameId=a)}if(this.last10anduiptsList.shift(),this.last10anduiptsList.push(r),-1==this.firstAudioTs&&(this.firstAudioTs=r),-1==this.firstDemuxAudioTS)this.firstDemuxAudioTS=r;else if(r==this.firstDemuxAudioTS)return void I.log("%cparseaudio audio too much audio in firstTs ts="+r,"color:#FFC107");for(var v=0;v<10;v++)this.maxaudioptsList[v]=this.last10anduiptsList[v];if(this.lastAudioTs>0&&this.lastAudioTs==r){var S=r+(0|this.aacTimeLen);this.audioIncreaseTSMap.set(u,S),r=S}if(Number(D._printAudioTs)&&1==this.parseType&&I.debug("%cFlvParser audio ts","color:red","oriDts=".concat(n," dif=").concat(n-this.lastAudioOriginDts," fixDts=").concat(r," dif=").concat(r-this.lastAudioTs," fixDts-oriDts=").concat(r-n)),1==Number(D._printAudioTs2)&&2==this.parseType&&I.debug("%cFlvParser shield audio ts","color:green","oriDts=".concat(n," dif=").concat(n-this.lastAudioOriginDts," fixDts=").concat(r," dif=").concat(r-this.lastAudioTs," fixDts-oriDts=").concat(r-n)),1==Number(D._printAudioTsSec)&&2==this.parseType){var T=g.now();T-this.startAudioTs>1e3&&(I.debug("%cFlvParser shield audio sec ts","color:green",r),this.startAudioTs=T)}if(this.lastAudioTs=r,this.lastAudioOriginDts=n,this.hasAudioTag=!0,!this.validAacSample(r))return;var P={type:"aac",unit:t.subarray(e,e+(s-2)),dts:90*r,pts:90*r,ts:r,sampleDuration:this.aacTimeLen};if(this.corePlayer.isLive&&this.corePlayer.audioPlayConsuming&&this.corePlayer.audioPlayConsuming.addRecvFrameData(r,r,g.now()),this.droppingSample&&this.droppingSample(P))return;this.printFirstAudioTs||(this.printFirstAudioTs=!0,I.log("FlvParser.parseAudio"+this.parseType,r)),this.pfaTs||(this.pfaTs=!0,I.log("FlvParser.parseAudio11"+this.parseType,r)),this.audioFps.addDts(r),this.corePlayer.curAudioDts=r,this.lastParseDts=r,this.corePlayer.pushAacSample(P,this.parseType)}else I.log("%cFlvParser.parseAudio error aac packet type="+l,L.LOG_COLOR.WARN)}},{key:"validAacSample",value:function(t){var e=[],i=(e=2==this.parseType?this.corePlayer.ctrlBuffer.avBuffer.aShieldBuffer.samples:this.corePlayer.ctrlBuffer.avBuffer.aBuffer.samples).length;if(i>0){var s=e[i-1];return 1===i&&s.ts>t&&s.ts-t>this.validAacTime?(e.shift(),!0):t-s.ts<this.validAacTime}return!0}},{key:"getAdtsConfig",value:function(t,e,s){var r=0,a=null,n=navigator.userAgent.toLowerCase();return -1!==n.indexOf("firefox")?e>=6?(t=5,a=[,,,,],r=e-3):(t=2,a=[,,],r=e):-1!==n.indexOf("android")?(-1!==n.indexOf("mqqbrowser")?(t=2,a=[,,]):(t=5,a=[,,,,]),r=e):(t=5,a=[,,,,],r=e,e>=6?r=e-3:1===s&&(t=2,a=[,,],r=e)),this.audioSampleRate=i.AdtsSampleingRates[e],this.aacTimeLen=1024e3/this.audioSampleRate,I.log("FlvParser.getAdtsConfig audioSampleRate="+this.audioSampleRate+" aacTimeLen="+this.aacTimeLen),a[0]=t<<3,a[0]|=(14&e)>>1,a[1]=(1&e)<<7,a[1]|=s<<3,5===t&&(a[1]|=(14&r)>>1,a[2]=(1&r)<<7,a[2]|=8,a[3]=0),I.log("FlvParser.getAdtsConfig type="+t+" index="+e+" channel="+s+" exIndex="+r+" config="+a),a}},{key:"parseOBUHeader",value:function(t){var e={};return e.obu_forbidden_bit=t>>7,e.obu_type=(120&t)>>3,e.obu_extension_flag=(4&t)>>2,e.obu_has_size_field=(2&t)>>1,e.obu_reserved_1bit=1&t,e}},{key:"isHevc",value:function(){return 12==this.codec}},{key:"isAv01",value:function(){return 13==this.codec}},{key:"hevcFindNextStartCode",value:function(t,e){return 0===t[e]&&0===t[e+1]?1===t[e+2]?{found:!0,startCodeSize:3}:0===t[e+2]&&1===t[e+3]?{found:!0,startCodeSize:4}:{found:!1}:{found:!1}}},{key:"isHevcNal",value:function(t,e){return 0===t[e]&&0===t[e+1]&&0===t[e+2]&&1===t[e+3]}},{key:"isPartitionC",value:function(t){return 4==(31&t[0])}},{key:"isH264Sei",value:function(t){return 6==(31&t[0])}},{key:"isH264Aud",value:function(t){return 9==(31&t[0])}},{key:"isH264NALUPPS",value:function(t){return(31&t[0])==i.NALU_TYPE_PPS}},{key:"isH264NALUPSPS",value:function(t){return(31&t[0])==i.NALU_TYPE_SPS}},{key:"getCalculateVideoFramePlayDelay",value:function(){return 0}},{key:"calcAudioFrameRate",value:function(t){this.audioFrameRateTs||(this.audioFrameRateTs=t,this.audioFrameCnt=0),t-this.audioFrameRateTs<1e3?this.audioFrameCnt++:(Number(D._printAudioFrameRate)&&I.log("@@@@@@@@ audioFrameRate="+this.audioFrameCnt),this.audioFrameRateTs=t,this.audioFrameCnt=0)}}
1,{key:"beforeSwap",value:function(t,e,i){this.startDtsType=e,this.isSwap=!0,this.fromType=t,this.isFirstPrintVideoTs=!1,this.isFirstPrintAudioTs=!1,this.swapStartDts=i}},{key:"getPcdnDisError",value:function(t){return(t<-100||t>100)&&(this.disError302(),!0)}}],[{key:"probe",value:function(t){return 70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]}}]),i}(tB);ee.EVENTS={META_DATA:"meta_data",SWITCH_URL_DONE:"switch_url_done"},ee.REMUX_TYPE_AUDIO=0,ee.REMUX_TYPE_VIDEO=1,ee.FLV_HEADER_LEN=9,ee.TAG_HEADER_LEN=11,ee.PREV_TAG_SIZE_LEN=4,ee.AUDIO_TYPE=8,ee.VIDEO_TYPE=9,ee.SCRIPT_TYPE=18,ee.SCRIPT_AMF1_HEAD_LEN=13,ee.SCRIPT_AMF2_HEAD_LEN=5,ee.IFRAME=1,ee.NO_REFERENCE_FRAME=99,ee.NAL_VPS=32,ee.NAL_SPS=33,ee.NAL_PPS=34,ee.HEVC_NAL_AUD=35,ee.HEVC_NAL_SEI=39,ee.NAL_RASL_N=8,ee.NAL_RASL_R=9,ee.NALU_TYPE_SLICE=1,ee.NALU_TYPE_DPA=2,ee.NALU_TYPE_DPB=3,ee.NALU_TYPE_DPC=4,ee.NALU_TYPE_IDR=5,ee.NALU_TYPE_SEI=6,ee.NALU_TYPE_SPS=7,ee.NALU_TYPE_PPS=8,ee.NALU_TYPE_AUD=9,ee.NALU_TYPE_EOSEQ=10,ee.NALU_TYPE_EOSTREAM=11,ee.NALU_TYPE_FILL=12,ee.AV1="AV01",ee.AVC="AVC",ee.HEVC="HEVC",ee.H265_SEI_HEAD=[44,162,222,9,181,23,71,219,187,85,164,254,127,194,252,78],ee.AdtsSampleingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];var ei=ee,es=function(){function t(){Object(s.a)(this,t),this.fpsIndex=0,this.fpsArr=[],this.fpsMap=new Map,this.started=!1,this.realFps=0,this.recvFps=new X(20),this.jumpRecvFps=new X(2),this.perSecondIndex=0,this.perSecondArr=[],this.perSecondMap=new Map,this.recvFrames=0,this.lastRecvFrames=0,this.preRecvFrames=0,this.gopSize=0,this.noReferFrameNums=0,this.preNoReferFrameNums=0,this.noReferSize=0,this.fpsList=[]}return Object(r.a)(t,[{key:"destroy",value:function(){tP.remove(this.onFrameTimer,this),this.fpsArr=null,this.fpsMap&&this.fpsMap.clear(),this.fpsMap=null,this.recvFps&&this.recvFps.reset(),this.recvFps=null,this.jumpRecvFps&&this.jumpRecvFps.reset(),this.jumpRecvFps=null,this.perSecondArr=null,this.perSecondMap&&this.perSecondMap.clear(),this.perSecondMap=null,this.fpsList=null}},{key:"getRecord",value:function(){var t=this.recvFrames-this.lastRecvFrames;return this.lastRecvFrames=this.recvFrames,t}},{key:"reset",value:function(){this.fpsArr=[],this.fpsMap.clear(),this.started=!1,this.realFps=0,this.recvFps.reset(),this.jumpRecvFps.reset(),this.recvFrames=0,this.lastRecvFrames=0,this.preRecvFrames=0,this.gopSize=0,this.noReferFrameNums=0,tP.remove(this.onFrameTimer,this),this.perSecondIndex=0,this.perSecondArr=[],this.perSecondMap.clear(),this.fpsList.length=0}},{key:"onFrameTimer",value:function(t,e){this.recvFps.calculate(),this.jumpRecvFps.calculate()}},{key:"addDts",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;this.recvFrames++,this.recvFps.addCur(1),this.jumpRecvFps.addCur(1),this.started||(this.started=!0,tP.add(this.onFrameTimer,this,1e3));var s=parseInt(t/1e3);if(this.fpsMap.has(s))this.fpsMap.set(s,this.fpsMap.get(s)+1);else{this.fpsIndex>=10&&(this.fpsIndex=0),this.calcRealFps();var r=this.fpsArr[this.fpsIndex];this.fpsList.length>=5&&this.fpsList.shift(),this.fpsMap.has(r)&&this.fpsList.push(this.fpsMap.get(r)),this.fpsMap.delete(r),this.fpsArr[this.fpsIndex]=s,this.fpsMap.set(s,1),this.fpsIndex++}e&&this.addDataSize(s,e),i===ei.IFRAME?(this.preRecvFrames>0&&(this.gopSize=this.recvFrames-this.preRecvFrames),this.preNoReferFrameNums>0&&(this.noReferSize=this.noReferFrameNums-this.preNoReferFrameNums),this.preRecvFrames=this.recvFrames,this.preNoReferFrameNums=this.noReferFrameNums):i===ei.NO_REFERENCE_FRAME&&this.noReferFrameNums++}},{key:"calcNoRefFps",value:function(){if(0===this.noRefFps){var t=this.fpsArr[1];this.noRefFps=this.noRefFpsMap.get(t)}}},{key:"calcRealFps",value:function(){if(this.fpsIndex>1){var t=this.fpsArr[this.fpsIndex-1];this.realFps=this.fpsMap.get(t)}}},{key:"getRecvFps",value:function(){var t=this.recvFps.average();return t===O.UintMax?0:t}},{key:"getJumRecvFps",value:function(){var t=this.jumpRecvFps.average();return t===O.UintMax?0:t}},{key:"getFps",value:function(){if(this.fpsArr.length>1){var e=this.fpsArr[1],i=this.fpsMap.get(e),s=0,r=i;
1return t.FIXED_FPS.forEach(function(t){var e=t>i?t-i:i-t;e<3&&(0===s||e<s)&&(s=e,r=t)}),r}return 0}},{key:"getCalculate",value:function(){this.recvFps.calculate()}},{key:"getNoReferFps",value:function(){return this.noReferSize>0&&this.gopSize>0&&this.getFps()>0?parseInt(this.noReferSize/this.gopSize*this.getFps()):0}},{key:"addDataSize",value:function(t,e){if(this.perSecondMap.has(t))this.perSecondMap.set(t,this.perSecondMap.get(t)+e);else{this.perSecondIndex>=10&&(this.perSecondIndex=0);var i=this.perSecondArr[this.perSecondIndex];this.perSecondMap.delete(i),this.perSecondArr[this.perSecondIndex]=t,this.perSecondMap.set(t,e),this.perSecondIndex++}}},{key:"getRealBitrate",value:function(){var t=0,e=this.perSecondArr.length;if(e>1){var i=this.perSecondArr[e-2];t=this.perSecondMap.get(i)}return parseInt(8*t/1e3)}},{key:"getGopSize",value:function(){return this.gopSize}},{key:"getHeartReceiveFps",value:function(){return this.fpsList.length>=5?this.fpsList.reduce(function(t,e){return t+e})/this.fpsList.length:0}}]),t}();es.FIXED_FPS=[0,15,20,24,30,40,48,60];var er=es,ea=function(){function t(){Object(s.a)(this,t)}return Object(r.a)(t,null,[{key:"init",value:function(){for(e in t.types={av01:[],av1C:[],avc1:[],avcC:[],hvc1:[],hvcC:[],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:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);t.HDLR_TYPES={video: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]),audio: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])};var e,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);t.STTS=t.STSC=t.STCO=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);
1var s=new Uint8Array([105,115,111,109]),r=new Uint8Array([97,118,99,49]),a=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,s,a,s,r),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))}},{key:"box",value:function(t){for(var e,i=Array.prototype.slice.call(arguments,1),s=8,r=i.length,a=r;r--;)s+=i[r].byteLength;for((e=new Uint8Array(s))[0]=s>>24&255,e[1]=s>>16&255,e[2]=s>>8&255,e[3]=255&s,e.set(t,4),r=0,s=8;r<a;r++)e.set(i[r],s),s+=i[r].byteLength;return e}},{key:"hdlr",value:function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])}},{key:"mdat",value:function(e){return t.box(t.types.mdat,e)}},{key:"mdhd",value:function(e,i){return t.box(t.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}},{key:"mdia",value:function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))}},{key:"mfhd",value:function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"minf",value:function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))}},{key:"moof",value:function(e,i,s){return t.box(t.types.moof,t.mfhd(e),t.traf(s,i))}},{key:"moov",value:function(e){for(var i=e.length,s=[];i--;)s[i]=t.trak(e[i]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(s).concat(t.mvex(e)))}},{key:"mvex",value:function(e){for(var i=e.length,s=[];i--;)s[i]=t.trex(e[i]);return t.box.apply(null,[t.types.mvex].concat(s))}},{key:"mvhd",value:function(e,i){var s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24&255,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,s)}},{key:"sdtp",value:function(e){var i,s,r=e.samples||[],a=new Uint8Array(4+r.length);for(s=0;s<r.length;s++)i=r[s].flags,a[s+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return t.box(t.types.sdtp,a)}},{key:"stbl",value:function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))}},{key:"av01",value:function(e){var i=e.bytes,s=e.width,r=e.height;return t.box(t.types.av01,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,s>>8&255,255&s,r>>8&255,255&r,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]),t.box(t.types.av1C,i))}},{key:"avc1",value:function(e){var i,s,r,a=[],n=[];for(i=0;i<e.sps.length;i++)r=(s=e.sps[i]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(s));for(i=0;i<e.pps.length;i++)r=(s=e.pps[i]).byteLength,n.push(r>>>8&255),n.push(255&r),n=n.concat(Array.prototype.slice.call(s));var o=t.box(t.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(n))),u=e.width,l=e.height;return t.box(t.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,u>>8&255,255&u,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]),o,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"hvc1",value:function(e){var i,s,r,a=[],n=[],o=[];for(a.push(160),a.push(e.vps.length>>>8&255),a.push(255&e.vps.length),i=0;i<e.vps.length;i++)r=(s=e.vps[i]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(s));for(n.push(161),n.push(e.sps.length>>>8&255),n.push(255&e.sps.length),i=0;i<e.sps.length;i++)r=(s=e.sps[i]).byteLength,n.push(r>>>8&255),n.push(255&r),n=n.concat(Array.prototype.slice.call(s));var u=[],l=0;for(i=0;i<n.length;)s=n[i],2!==l||3!==s?(0===s?l++:l=0,u.push(s),++i):(++i,l=0);for(o.push(162),o.push(e.pps.length>>>8&255),o.push(255&e.pps.length),i=0;i<e.pps.length;i++)r=(s=e.pps[i]).byteLength,o.push(r>>>8&255),o.push(255&r),o=o.concat(Array.prototype.slice.call(s));var d=new Uint8Array([1,u[8],u[9],u[10],u[11],u[12],u[13],u[14],u[15],u[16],u[17],u[18],u[19],240,0,252,253,248,248,0,0,15].concat([3]).concat(a).concat(n).concat(o)),c=t.box(t.types.hvcC,d),f=e.width,p=e.height;return t.box(t.types.hvc1,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,f>>8&255,255&f,p>>8&255,255&p,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]),c,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))}},{key:"mp4a",value:function(e){var i=e.audiosamplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]),t.box(t.types.esds,t.esds(e)))}},{key:"stsd",value:function(e){return"audio"===e.type?t.box(t.types.stsd,t.STSD,t.mp4a(e)):e.isHevc?t.box(t.types.stsd,t.STSD,t.hvc1(e)):e.isAV01?t.box(t.types.stsd,t.STSD,t.av01(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))}},{key:"tkhd",value:function(e){var i=e.id,s=e.duration,r=e.width,a=e.height;return t.box(t.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,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,r>>8&255,255&r,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(e,i){var s=t.sdtp(e),r=e.id;return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),t.box(t.types.tfdt,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),t.trun(e,s.length+16+16+8+16+8+8),s)}},{key:"trak",value:function(e){return e.duration=e.duration||0xffffffff,t.box(t.types.trak,t.tkhd(e),t.mdia(e))}},{key:"trex",value:function(e){var i=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(e,i){var s,r,a,n,o,u,l=e.samples||[],d=l.length,c=12+16*d,f=new Uint8Array(c);for(i+=8+c,f.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),s=0;s<d;s++)a=(r=l[s]).duration,n=r.size,o=r.flags,u=r.cts,f.set([a>>>24&255,a>>>16&255,a>>>8&255,255&a,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*s);return t.box(t.types.trun,f)}},{key:"initSegment",value:function(e){t.types||t.init();var i,s=t.moov(e);return(i=new Uint8Array(t.FTYP.byteLength+s.byteLength)).set(t.FTYP),i.set(s,t.FTYP.byteLength),i}}]),t}(),en=function(){function t(e){Object(s.a)(this,t),this.mse=e,this.audioISGenerated=!1,this.videoISGenerated=!1,this.PES2MP4SCALEFACTOR=1,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR,this._forceFirstIDR=!(!S.chrome||!(S.version.major<50||50===S.version.major&&S.version.build<2661))}return Object(r.a)(t,[{key:"timescale",get:function(){return this.MP4_TIMESCALE}},{key:"isWebglRender",get:function(){return this.mse.h265Proxy&&this.mse.h265Proxy.renderInited}},{key:"destroy",value:function(){this.reset()}},{key:"reset",value:function(){this.insertDiscontinuity(),this.switchLevel()}},{key:"resetInitDts",value:function(){this._initPTS=this._initDTS=void 0}},{key:"insertDiscontinuity",value:function(){this.nextAacPts=this.nextAvcDts=void 0}},{key:"getInitDts",value:function(){return void 0!==this._initDTS?this._initDTS/90:void 0}},{key:"switchLevel",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];I.log("mp4-remuxer.switchLevel"),t&&(this.videoISGenerated=!1),e&&(this.audioISGenerated=!1)}}
1,{key:"remux",value:function(t,e,i,s){Number(D._printMp4Remux)&&I.debug("\n### Audio",t,"\n### Video",e),this.audioISGenerated||this.generateAudioIS(t,i),this.videoISGenerated||this.isWebglRender||this.generateVideoIS(e,i),this.initTs(t,e,i),e.samples.length&&(this.isWebglRender?this.renderVideo(e,s):this.remuxVideo(e,s)),t.samples.length&&this.remuxAudio(t,s),this.mse.onFragParsed()}},{key:"initTs",value:function(t,e,i){if(null==this._initPTS){var s=t.samples,r=e.samples,a=s.length,n=r.length,o=this.PES_TIMESCALE;0===a&&0===n?I.warn("mp4-remuxer.initTs have no nbAudio&nbVideo"):0===n?(this._initPTS=s[0].pts-o*i,this._initDTS=s[0].dts-o*i):0===a?(this._initPTS=r[0].pts-o*i,this._initDTS=r[0].dts-o*i):(this._initPTS=Math.min(r[0].pts,s[0].pts)-o*i,this._initDTS=Math.min(r[0].dts,s[0].dts)-o*i),I.log("mp4-remuxer initDTS/initPTS=[".concat(this._initDTS,", ").concat(this._initPTS,"]"))}}},{key:"generateAudioIS",value:function(t,e){if(t.config){var i={audioMoov:ea.initSegment([t]),audioCodec:t.codec,audioChannelCount:t.channelCount};this.mse.onInitSegment(i),this.audioISGenerated=!0}}},{key:"generateVideoIS",value:function(t,e){if(t.isAV01||t.sps&&t.pps){var i={videoMoov:ea.initSegment([t]),videoCodec:t.codec,videoWidth:t.width,videoHeight:t.height};this.mse.onInitSegment(i),this.videoISGenerated=!0}}},{key:"remuxVideo",value:function(t,e){var i,s,r,a,n,o,u,l,d,c,f,p,m,_,y=8,v=this.PES2MP4SCALEFACTOR,S=[],T=t.isAV01?0:4*t.naluCnt;for((i=new DataView((u=new Uint8Array(t.len+T+8)).buffer)).setUint32(0,u.byteLength),u.set(ea.types.mdat,4);t.samples.length;){for(r=t.samples.shift(),n=0;r.units.length;)s=(o=r.units.shift()).data.byteLength,"av01"!=r.type&&(i.setUint32(y,s),y+=4,n+=4),u.set(o.data,y),y+=s,n+=s;if(f=r.pts-this._initDTS,((p=r.dts-this._initDTS)<0||f<0)&&Number(D._printMp4RemuxVideo)&&I.log("mp4-remuxer.remuxVideo warn dts=".concat(p,", pts=").concat(f)),void 0!==c)m=this._PTSNormalize(f,c),_=this._PTSNormalize(p,c),a.duration=(_-c)/v,a.duration<0&&(Number(D._printMp4RemuxVideo)&&I.warn("mp4-remuxer.remuxVideo invalid sample duration at pts="+r.pts/90+" dts="+r.dts/90+" duration="+a.duration/90),a.duration=0,_=c);else{var P,C=this.nextAvcDts||p;m=this._PTSNormalize(f,C),P=Math.round(((_=this._PTSNormalize(p,C))-C)/90),(e||Math.abs(P)<600)&&P&&(P>1&&Number(D._printMp4RemuxVideo)?I.warn("mp4-remuxer.remuxVideo hole="+P+" filling it"):P<-1&&Number(D._printMp4RemuxVideo)&&I.warn("mp4-remuxer.remuxVideo overlapping="+-P+" detected"),m=Math.max(m-P,_=C)),d=Math.max(0,_)}var E=r.key;a={size:n,duration:0,cts:(m-_)/v,flags:{isLeading:0,degradPrio:0,hasRedundancy:0,dependsOn:E?2:1,isDependedOn:+!!E,isNonSync:+!E}},S.push(a),c=_,this.mse.isLive&&this.mse.videoPlayConsuming.addRemuxFrameData(r.ts,r.ts+r.cts,g.now())}this._forceFirstIDR&&(S[0].flags.dependsOn=2,S[0].flags.isNonSync=0),void 0!==t.endDts?(a.duration=(90*t.endDts-this._initDTS-_)/v,a.duration<0?(a.duration=0,this.nextAvcDts=_):this.nextAvcDts=90*t.endDts-this._initDTS):(S.length>=2&&(a.duration=S[S.length-2].duration),this.nextAvcDts=_+a.duration*v),t.len=0,t.naluCnt=0,t.samples=S,l=ea.moof(t.sn,d/v,t),t.samples=[];var k={type:"video",data:this._mergeBoxes(l,u)};this.mse.onFragParsing(k)}},{key:"remuxAudio",value:function(t,e){var i,s,r,a,n,o,u,l,d,c,f,p=8,m=this.PES_TIMESCALE,_=this.PES2MP4SCALEFACTOR,y=[];for(new DataView((a=new Uint8Array(t.len+8)).buffer).setUint32(0,a.byteLength),a.set(ea.types.mdat,4);t.samples.length;){if(r=(i=t.samples.shift()).unit,a.set(r,p),p+=r.byteLength,l=i.pts-this._initDTS,d=i.dts-this._initDTS,void 0!==u)c=this._PTSNormalize(l,u),f=this._PTSNormalize(d,u),s.duration=(f-u)/_,F.popSize0Brows.map(function(t){var e=t[0],r=t[1];S.name==e&&S.version.major>=r&&i.sampleDuration&&(s.duration=90*Math.ceil(i.sampleDuration))}),s.duration<0&&(Number(D._printMp4RemuxAudio)&&I.warn("mp4-remuxer.remuxAudio invalid AAC sample duration at PTS="+i.pts+" duration="+s.duration),s.duration=0,c=f=u);else{var v,T=this.nextAacPts||l;c=this._PTSNormalize(l,T),f=this._PTSNormalize(d,T),v=Math.round(1e3*(c-T)/m),(e||Math.abs(v)<600)&&v&&(c=f=T),o=Math.max(0,f)}s={size:r.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},y.push(s),u=f,this.mse.isLive&&this.mse.audioPlayConsuming.addRemuxFrameData(i.ts,i.ts,g.now())}y.length>=2&&(s.duration=y[y.length-2].duration),this.nextAacPts=c+s.duration*_,t.len=0,t.samples=y,n=ea.moof(t.sn,o/_,t),t.samples=[];var P={type:"audio",data:this._mergeBoxes(n,a)};this.mse.onFragParsing(P)}},{key:"renderVideo",value:function(t,e){if(this.mse.isLive)for(var i=0;i<t.samples.length;i++){var s=t.samples[i];this.mse.videoPlayConsuming.addRemuxFrameData(s.ts,s.ts+s.cts,g.now())}this.mse.h265Proxy.pushVideoFrame(t,e)}},{key:"_mergeBoxes",value:function(t,e){var i=new Uint8Array(t.byteLength+e.byteLength);return i.set(t,0),i.set(e,t.byteLength),i}},{key:"_PTSNormalize",value:function(t,e){var i;if(void 0===e)return t;for(i=e<t?-0x200000000:0x200000000;Math.abs(t-e)>0x100000000;)t+=i;return t}}]),t}(),eo=function(){function t(){Object(s.a)(this,t)}
1return Object(r.a)(t,null,[{key:"getSilentFrame",value:function(t,e){if(2===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return 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])}else{if(1===e)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===e||3===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}},{key:"setWebcodeccEmptyFrame",value:function(e){t.webcodeccEmptyFrame=e.toLocaleString().split(",")}}]),t}();eo.emptyAacFrameAdts=[255,241,92,64,18,64,252,0,208,32,6,238,90,119,128,0,128,0,0,0,0,26,37,65,0,13,237,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,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,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,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,0,0,0,0,0,0,0,0,0,0,28],eo.emptyAacFrame=[0,208,32,6,238,90,119,128,0,128,0,0,0,0,26,37,65,0,13,237,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,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,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,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,0,0,0,0,0,0,0,0,0,0,28],eo.emptyAacFrame_44_1=[1,64,34,128,163,78,129,64,0,0,0,0,4,96,6,246,81,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94],eo.webcodeccEmptyFrame=null;var eh={CODE:1,PRIORITY:11},eu={CODE:13,PRIORITY:8},el={CODE:14,PRIORITY:9},ed={CODE:15,PRIORITY:10},ec={CODE:18,PRIORITY:5},ef={CODE:19,PRIORITY:3},ep={CODE:20,PRIORITY:4},em={CODE:21,PRIORITY:2},e_={CODE:22,PRIORITY:1},ey={ptsJumpTest:!1,jumpConfigs:null,initPts:0,audioTimeOffset:0,videoTimeOffset:0},ev=function(){function t(e){Object(s.a)(this,t),this.tsParser=e,this._init()}return Object(r.a)(t,[{key:"_init",value:function(){this._preAudioDts=0,this._preVideoDts=0,this._audioDtsVec=[],this._videoDtsVec=[],this.aJumpDtsVec=[],this.vJumpDtsVec=[],this.audioFixTimes=0,this.videoFixTimes=0,this._aFrameDuration=0,this._vFrameDuration=0}},{key:"reset",value:function(){this._init()}},{key:"getFrameDuration",value:function(t){var e="video"===t?this._videoDtsVec:this._audioDtsVec;if(e.length<4)return e[0]||0;var i=0,s=[];return e.forEach(function(t,e){e>0&&s.push(Math.abs(t-i)),i=t}),s.sort(function(t,e){return t-e}),s.pop(),s.shift(),Math.ceil(s.reduce(function(t,e){return e+t})/s.length)}},{key:"setPreAudioDts",value:function(t){this._preAudioDts=t}},{key:"setPreVideoDts",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._preVideoDts=t}},{key:"checkAudioDts",value:function(e){this._preAudioDts||(this._preAudioDts=e),Math.abs(e-this._preAudioDts)/90>t.ErrorDtsThreshold&&(1===Number(D._print_dts_fix)&&I.log("%cVodDtsJumpHelper.checkAudioDts audio dts jump dts=".concat(e,", preDts=").concat(this._preAudioDts),"color:#50c1d8"),this.aJumpDtsVec.push(this._preAudioDts)),this._preAudioDts=e,this._audioDtsVec.length<=11&&(this._audioDtsVec.push(e),this._aFrameDuration=this.getFrameDuration("audio")||0)}},{key:"checkVideoDts",value:function(e){this._preVideoDts||(this._preVideoDts=e),Math.abs(e-this._preVideoDts)/90>t.ErrorDtsThreshold&&(1===Number(D._print_dts_fix)&&I.log("%cVodDtsJumpHelpercheckVideoDts video dts jump dts=".concat(e,", preDts=").concat(this._preVideoDts),"color:#50c1d8"),this.vJumpDtsVec.push(this._preVideoDts)),this._preVideoDts=e,this._videoDtsVec.length<=11&&(this._videoDtsVec.push(e),this._vFrameDuration=this.getFrameDuration("video")||0)}},{key:"dtsJumpFix",value:function(e,i){var s=0,r=0;this.aJumpDtsVec.length>0&&this.vJumpDtsVec.length>0&&(s=this.aJumpDtsVec[0],r=this.vJumpDtsVec[0]);for(var a=e.samples,n=0,o=0,u=0;u<a.length;u++){var l=a[u];
1if("video"===i){if(o=this._vFrameDuration,n=this._preVideoDts,r&&n>r)break}else if(o=this._aFrameDuration,n=this._preAudioDts,s&&n>s)break;if(Math.abs(l.dts-n)/90>t.ErrorDtsThreshold){var d=parseInt(n+o),c=l.dts-d;if(l.dts=l.dts-c,l.pts=l.pts-c,1===Number(D._print_dts_fix)){var f=d-n;I.log("VodDtsJumpHelper.dtsJumpFix fixed type=".concat(i," pts=").concat(l.pts," dts=").concat(l.dts," cts=").concat(l.pts-l.dts," gap=").concat(f," delta=").concat(c))}"video"===i?this.videoFixTimes++:this.audioFixTimes++}"video"===i?this._preVideoDts=l.dts:this._preAudioDts=l.dts}}},{key:"dtsAmend",value:function(e,i){var s=t.FrameThreshold,r=this.aJumpDtsVec.length,a=this.vJumpDtsVec.length;if(r>0&&a>0)for(var n=this.aJumpDtsVec.shift(),o=this.vJumpDtsVec.shift(),u=n-this.audioDtsDelta,l=o-this.videoDtsDelta;r>0&&a>0;){var d=(u-l)/90;if(d<-s)u=(n=this.aJumpDtsVec.shift())-this.audioDtsDelta;else if(d>s)l=(o=this.vJumpDtsVec.shift())-this.videoDtsDelta;else if(d>=-s&&d<=s){this.setPreAudioDts(n),this.setPreVideoDts(o),this.dtsJumpFix(e,"audio"),this.dtsJumpFix(i,"video"),1===Number(D._print_dts_fix)&&I.log("%cTsParse._dtsJumpFix fix pts jump","color:#8d3333;background:#FFF5C2");break}r=this.aJumpDtsVec.length,a=this.vJumpDtsVec.length}else if(r>0){if(i.samples.length<=0)return!0;var c=this.aJumpDtsVec[0],f=i.samples[i.samples.length-1].dts;if(c>f)return 1===Number(D._print_dts_fix)&&I.log("TsParser._dtsJumpFix waiting avc jump dts"),!0;if(c<=f&&(f-c)/90<s)return!0}else if(a>0){if(e.samples.length<=0)return!0;var p=this.vJumpDtsVec[0],m=e.samples[e.samples.length-1].dts;if(p>m)return 1===Number(D._print_dts_fix)&&I.log("TsParser._dtsJumpFix waiting aac jump dts"),!0;if(p<=m&&(m-p)/90<s)return!0}return!1}},{key:"audioDtsDelta",get:function(){return this._aFrameDuration*this.audioFixTimes}},{key:"videoDtsDelta",get:function(){return this._vFrameDuration*this.videoFixTimes}},{key:"aFrameDuration",get:function(){return this._vFrameDuration}},{key:"vFrameDuration",get:function(){return this._aFrameDuration}},{key:"frameDuration",get:function(){return Math.max(this.aFrameDuration,this.vFrameDuration)}}]),t}();ev.ErrorDtsThreshold=1e3,ev.FrameThreshold=200;var eS=function(){function t(){Object(s.a)(this,t),this.startDts=0,this.endDts=0,this.frames=0,this.lostDuration=0}return Object(r.a)(t,[{key:"getInfo",value:function(){return"{start:".concat(this.startDts,", end:").concat(this.endDts,", frames:").concat(this.frames,", duration:").concat(this.getDurationByDts(),", lost: ").concat(this.lostDuration,"}")}},{key:"reset",value:function(){this.startDts=0,this.endDts=0,this.frames=0,this.lostDuration=0}},{key:"getDurationByDts",value:function(){return 0!==this.endDts?this.endDts-this.startDts-this.lostDuration:0}},{key:"addDts",value:function(t){if(0!==this.endDts){var e=t-this.endDts;e>500&&(this.lostDuration+=e)}0===this.startDts&&(this.startDts=t),this.endDts=t,this.frames++}}]),t}(),eg=1,eT=function(){function t(e,i){Object(s.a)(this,t),this.id=eg++,I.log("[TsParser-".concat(this.id,"] TsParser constructor")),this.mse=e,this.remuxer=i,this.width=0,this.height=0,this.lastSN=0,this.lastLevel=0,this.PES_TIMESCALE=9e4,this.lastTsData=null,this.lastPos=0,this.hasRemux=!1,this.fragStartTs=0,this.ignoreSei=!1,this.closeFetch=!1,this.dropBeforeFirstIDR=!1,this.hasIDR=!1,this.vFps=new er,this.aFps=new er,this.vInfo=new eS,this.aInfo=new eS,this._initPts=Number.MAX_SAFE_INTEGER,this._initDts=Number.MAX_SAFE_INTEGER,this.nextAudioPts=0,this.isHevc=!1,this.codec=tX,this.vod
1DtsJumpHelper=new ev(this),this.isNoAudio=!0,this.hevcSpsParser=new tq,this.hevcCodec="",this.avcCodec="",this.lastTs=0,this.timeOffset=0,this.continuousTimeStamp=!1,this.videoStartPts=Number.MAX_SAFE_INTEGER,this.videoStartDts=Number.MAX_SAFE_INTEGER,this.audioStartPts=Number.MAX_SAFE_INTEGER,this.audioStartDts=Number.MAX_SAFE_INTEGER,this.openConvertIDR=!1,this.convertToIDR=!1,this.onParseVideoDtsCallback=null}return Object(r.a)(t,[{key:"getTsInfo",value:function(){return{videoInfo:this.vInfo,audioInfo:this.aInfo}}},{key:"resetTsInfo",value:function(){this.vInfo.reset(),this.aInfo.reset()}},{key:"getCodecType",value:function(){return this.codec}},{key:"getFps",value:function(){return this.vFps&&this.vFps.getFps()}},{key:"getAudioFps",value:function(){return this.aFps&&this.aFps.getFps()}},{key:"getStartTs",value:function(){return this.fragStartTs}},{key:"destroy",value:function(){this.switchLevel(),this.duration=0,this.onParseVideoDtsCallback=null}},{key:"probe",value:function(t){return t.length>=564&&71===t[0]&&71===t[188]&&71===t[376]}},{key:"resetAVData",value:function(){this._avcTrack&&(this._avcTrack.len=0,this._avcTrack.naluCnt=0,this._avcTrack.samples=[]),this._aacTrack&&(this._aacTrack.len=0,this._aacTrack.samples=[])}},{key:"pushAllData",value:function(){this._avcTrack&&this._avcTrack.samples.length>0&&this.remuxTs(this._aacTrack,this._avcTrack,this._avcTrack.sn)}},{key:"parseAllData",value:function(){var t=!1;if(this._avcTrack){var e=this._avcTrack.pesData,i=this._aacTrack.pesData,s=this._id3Track.pesData,r=this.continuousTimeStamp?this.timeOffset:0;e&&(this._parseAVCPES(this._parsePES(e,r,0,0,1)),t=!0),i&&this._parseAACPES(this._parsePES(i,r,0,0,2)),s&&this._parseID3PES(this._parsePES(s,r,0,0,3)),this._avcTrack.pesData=void 0,this._aacTrack.pesData=void 0,this._id3Track.pesData=void 0}return t}},{key:"switchLevel",value:function(){var t=this.createTrack;this._avcTrack||(this._avcTrack=t("video")),this._aacTrack||(this._aacTrack=t("audio")),this._id3Track||(this._id3Track=t("id3")),this.pmtParsed=!1,this._pmtId=-1,this.isHevc=!1,this.hasIDR=!1,this.convertToIDR=!1,this.remuxer.switchLevel()}},{key:"createTrack",value:function(t){return{type:t,id:-1,sn:0,samples:[],len:0,naluCnt:0}}},{key:"insertDiscontinuity",value:function(t){I.log("[TsParser-".concat(this.id,"] TsParser.insertDiscontinuity timeOffset=").concat(t)),this.resetTsData(),this.switchLevel(),this.remuxer.insertDiscontinuity(),this.mse.insertDiscontinuity&&this.mse.insertDiscontinuity(t)}},{key:"reset",value:function(){I.log("[TsParser-".concat(this.id,"] TsParser.reset")),this.vFps.reset(),this.aFps.reset(),this.resetTsData(),this.hasRemux=!1,this.hasIDR=!1,this.lastTsData=null,this.convertToIDR=!1,this._initDts=Number.MAX_SAFE_INTEGER,this._initPts=Number.MAX_SAFE_INTEGER,this.nextAudioPts=0,this._avcTrack&&(this._avcTrack.sps=null,this._avcTrack.pps=null,this._avcTrack.idr=!1,this._avcTrack.len=0,this._avcTrack.naluCnt=0,this._avcTrack.samples=[]),this._aacTrack&&(this._aacTrack.len=0,this._aacTrack.naluCnt=0,this._aacTrack.samples=[]),this.vodDtsJumpHelper.reset()}},{key:"resetTsData",value:function(){var t=this._avcTrack,e=this._aacTrack,i=this._id3Track;e&&(t.pesData=null,e.pesData=null,i.pesData=null,this.lastTsData=null),this.fragStartTs=0}},{key:"appendTsData",value:function(t,e){e&&this.resetTsData(),t instanceof Uint8Array||(t=new Uint8Array(t));var i,s=this.lastTsData,r=this.lastPos;if(s){var a=s.byteLength-r;(i=new Uint8Array(a+t.byteLength)).set(s.slice(r),0),i.set(t,a)}else i=t;return this.lastPos=0,this.lastTsData=i,i}},{key:"syncOffset",value:function(t){for(var e=Math.min(188,t.length-564),i=0;i<e;){if(71===t[i]&&71===t[i+188]&&71===t[i+376])return i;i++}return -1}},{key:"parseTs",value:function(t){var e=t.loadType,i=t.data,s=t.audioCodec,r=t.videoCodec,a=t.timeOffset,n=t.duration,o=t.discontinuity,u=t._discontinuity,l=t.level,d=t.sn,c=t.seeking,f=t.hlsDT,p=t.tsDT;this.contiguous=!1,o||u?(I.log("TsParser.parseTs discontinuity detected timeOffset=".concat(a)),this.continuousTimeStamp||this.insertDiscontinuity(a)):l!==this.lastLevel?(I.log("TsParser.parseTs level switch detected"),this.switchLevel(),this.lastLevel=l):d===this.lastSN+1&&(this.contiguous=!0);var m=(i=this.appendTsData(i,c,d)).length;this.audioCodec=s,this.videoCodec=r,a!==this.timeOffset&&(this.videoStartDts=Number.MAX_SAFE_INTEGER,this.videoStartPts=Number.MAX_SAFE_INTEGER,this.audioStartDts=Number.MAX_SAFE_INTEGER,this.audioStartPts=Number.MAX_SAFE_INTEGER),this.timeOffset=a,this.duration=n,this.lastSN=d,this.contiguous||(this.aacOverFlow=null),this._avcTrack||this.insertDiscontinuity(a);var _=this.syncOffset(i);if(!(_<0)){this.lastPos=m-=(m+_)%188,m===i.length&&(this.lastTsData=null);var y,v,g,T,P,C=this._avcTrack,E=this._aacTrack,k=this._id3Track,A=this.pmtParsed,R=C.pesData,D=E.pesData,O=k.pesData,b=C.id,w=E.id,F=k.id;try{for(var M=_;M<m;M+=188)if(71===i[M]){if(y=!!(64&i[M+1]),v=((31&i[M+1])<<8)+i[M+2],(48&i[M+3])>>4>1){if((g=M+5+i[M+4])===M+188)continue}else g=M+4;if(A)if(T=(P=M+188)-g,v===b){if(this.mse.isPureAudio)continue;y&&(R&&this._parseAVCPES(this._parsePES(R,a,f,p,1)),R={data:[],size:0}),R&&(R.data.push(i.subarray(g,P)),R.size+=T)}else if(v===w){if(this.mse.isPureVideo)continue;y&&(D&&(this._parseAACPES(this._parsePES(D,a,f,p,2)),this.closeFetch||this.hasRemux||!(C.samples.length>1)||this.remuxTs(E,C,d)),D={data:[],size:0}),D&&(D.data.push(i.subarray(g,P)),D.size+=T)}else v===F&&(y&&(O&&this._parseID3PES(this._parsePES(O,a,f,p,3)),O={data:[],size:0}),O&&(O.data.push(i.subarray(g,P)),O.size+=T));else y&&(g+=i[g]+1),0===v?this._parsePAT(i,g):v===this._pmtId&&(this._parsePMT(i,g),A=this.pmtParsed=!0,b=this._avcTrack.id,w=this._aacTrack.id,F=this._id3Track.id)}else I.error("TsParser.parseTs ERROR: TS packet did not start with 0x47"),this.mse&&this.mse.onParseError(98)}catch(t){I.error("TsParser.parseTs error:",t)}if(R&&(e===L.HLS_LOAD_TYPE.FETCH?C.pesData=R:this._parseAVCPES(this._parsePES(R))),D&&(e===L.HLS_LOAD_TYPE.FETCH?E.pesData=D:this._parseAACPES(this._parsePES(D))),O&&(e===L.HLS_LOAD_TYPE.FETCH?k.pesData=O:this._parseID3PES(this._parsePES(O))),E.samples.length>1||this.maxVideo()||this.mse.isPureAudio&&E.samples.length>0||this.mse.isPureVideo&&C.samples.length>0){if(0===E.samples.length&&"firefox"===S.name&&this.mse.reloadInError&&!this.mse.isLive)return void this.mse.reloadInError();C.width=this.width,C.height=this.height,this.remuxTs(E,C,d)}}}},{key:"maxVideo",value:function(){var t=this._avcTrack;if(t.samples.length>1){var e=t.samples[0];return(t.samples[t.samples.length-1].dts-e.dts)/90>2e3}return!1}}
1,{key:"remuxTs",value:function(t,e,i){e.codec=this.isHevc?this.hevcCodec:this.avcCodec,e.width=this.width,e.height=this.height,e.isHevc=this.isHevc,t.sn=e.sn=i,this.hasRemux=!0,t.samples&&t.samples.length>0&&(this.isNoAudio=!1,this.mse.setNoAuido(!1));try{if(!this.mse.isLive&&!this.mse.isPureVideo){if(F.vodDtsFixCfg[1]&&this.vodDtsJumpHelper.dtsAmend(t,e))return void I.log("Tsparser.remuxTs found pts jump, waiting fix");this.remuxAudio(t,e.samples.length>0)}this.mse.webcodecType==L.PLAYER_CORE_TYPE.MSE?this.remuxer.remux(t,e,this.timeOffset,this.contiguous):(this.mse.initTs&&this.mse.initTs(e,t,this.timeOffset),this.mse.appendAvcTrack(e),this.mse.appendAacSample(t)),this.mse.isLive||3===Y.getFirstFragStatus()&&Y.setFirstFragStatus(4)}catch(t){I.error("remux ts error: ",t.message,t),this.mse&&this.mse.onParseError(98)}}},{key:"remuxAudio",value:function(t,e){var i=9216e4/t.audiosamplerate;0==this.nextAudioPts&&(this.nextAudioPts=this._initPts);for(var s=this.nextAudioPts,r=t.samples,a=0,n=s;a<r.length;a++){var o=r[a].pts,u=o-n,l=Math.abs(1e3*u/t.timescale);if(u<=-i&&e)0===a&&(I.warn("Audio frame @ ".concat((o/t.timescale).toFixed(3),"s \n overlaps nextAudioPts by ").concat(Math.round(1e3*u/t.timescale)," ms.")),this.nextAudioPts=s=n=o);else if(u>i&&l<1e4&&e){var d=Math.round(u/i);(n=o-d*i)<0&&(d--,n+=i),0===a&&(this.nextAudioPts=s=n),I.warn("[mp4-remuxer]: Injecting ".concat(d," audio frame nextPts=").concat(n," @ ").concat((n/t.timescale).toFixed(3),"s \n due to ").concat(Math.round(1e3*u/t.timescale)," ms gap."));for(var c=0;c<d;c++){var f=Math.max(n,0),p=eo.getSilentFrame(t.audioObjectType,t.channelCount),m={unit:p,pts:Math.round(f),dts:Math.round(f)};r.splice(a,0,m),t.len+=p.length,n+=i,a++}}n+=i,this.nextAudioPts=n}}},{key:"_updateInitPts",value:function(t,e){this._initPts===Number.MAX_SAFE_INTEGER&&(this.continuousTimeStamp?(this._initPts=t-9e4*this.timeOffset,this._initDts=e-9e4*this.timeOffset):(this._initPts=t,this._initDts=e),ey.initPts||(ey.initPts=this._initPts),I.log("Tsparser.remuxTs initPts=".concat(this._initPts," Global initPts=").concat(ey.initPts)))}},{key:"_parsePAT",value:function(t,e){var i=t[e+8]<<8|t[e+9];1==i&&(this._pmtId=(31&t[e+10])<<8|t[e+11]),I.log("TsParser._parsePAT program_number=".concat(i," pmtId=").concat(this._pmtId))}},{key:"_parsePMT",value:function(t,e){var i=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<i;){var s=t[e],r=(31&t[e+1])<<8|t[e+2];switch(s){case 15:this._aacTrack.id=r;break;case 21:this._id3Track.id=r;break;case 27:this._avcTrack.id=r;break;case 36:this._avcTrack.id=r,this.isHevc=!0,this.codec=t$;break;default:I.log("unkown stream type:"+t[e])}e+=5+((15&t[e+3])<<8|t[e+4])}I.log("TsParser._parsePMT aacTrack.id=".concat(this._aacTrack.id," avcTrack.id=").concat(this._avcTrack.id))}},{key:"_parsePES",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4?arguments[4]:void 0,a=t.data[0];if(1!=(a[0]<<16)+(a[1]<<8)+a[2])return null;var n,o,u=(a[4]<<8)+a[5],l=a[7];192&l&&(n=0x20000000*(14&a[9])+4194304*(255&a[10])+16384*(254&a[11])+128*(255&a[12])+(254&a[13])/2,o=64&l?0x20000000*(14&a[14])+4194304*(255&a[15])+16384*(254&a[16])+128*(255&a[17])+(254&a[18])/2:n),this.continuousTimeStamp&&(1===r?(this.videoStartDts===Number.MAX_SAFE_INTEGER&&(this.videoStartPts=n,this.videoStartDts=o),this._initPts!==Number.MAX_SAFE_INTEGER&&(n=this._initPts+9e4*e+(n-this.videoStartPts),o=this._initDts+9e4*e+(o-this.videoStartDts))):2===r&&(this.audioStartDts===Number.MAX_SAFE_INTEGER&&(this.audioStartPts=n,this.audioStartDts=o),this._initPts!==Number.MAX_SAFE_INTEGER&&(n=this._initPts+9e4*e+(n-this.audioStartPts),o=this._initDts+9e4*e+(o-this.audioStartDts))));var d=a[8]+9;t.data[0]=t.data[0].subarray(d),t.size-=d;for(var c=0,f=new Uint8Array(t.size);t.data.length;)a=t.data.shift(),f.set(a,c),c+=a.byteLength;return s>i&&s-i-1e3*e>0&&(n-=90*(s-i-1e3*e),o-=90*(s-i-1e3*e)),{data:f,pts:n,dts:o,len:u}}},{key:"_parseAVCPES",value:function(e){if(null==e)return I.error("TsParser._parseAVCPES pes is null."),void(this.mse&&this.mse.onParseError(98));!this.mse.isLive&&ey.ptsJumpTest&&this._dtsJumpSimulate(e,"video");var i=e.dts/this.PES_TIMESCALE;this.onParseVideoDtsCallback&&this.onParseVideoDtsCallback(i),0===this.fragStartTs&&(this.fragStartTs=e.pts/this.PES_TIMESCALE);var s,r=this._avcTrack,a=r.samples,n=this._parseAVCNALu(e.data),o=[],u=0;0===n.length&&a.length>0&&this._pushToPreUnit(e.data),e.data=null;var l=!1,d=!1,c=!1,f="";if(this.isHevc){var p,m=Object(Q.a)(n);try{for(m.s();!(p=m.n()).done;){var _=p.value;switch(_.type){case t.HEVC_NAL_VPS:d=!0,c=!0,r.vps||(r.vps=[_.data]);break;case t.HEVC_NAL_SPS:if(d=!0,c=!0,!r.sps){r.sps=[_.data],r.timescale=this.remuxer.timescale,r.duration=this.remuxer.timescale*this.duration,this.spsConfig={},this.hevcSpsParser.parseSequenceParameterSet(_.data,_.data.length,this.spsConfig);var y=this.spsConfig.profile_space,v=this.spsConfig.profile_idc,S=this.spsConfig.profile_compatibility_flags;S=(S=(S=(S=(S=S>>1&0x55555555|(0x55555555&S)<<1)>>2&0x33333333|(0x33333333&S)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&S)<<4)>>
18&0xff00ff|(0xff00ff&S)<<8)>>16|S<<16;var g=this.spsConfig.tier_flag,T=this.spsConfig.level_idc;this.hevcCodec="hvc1."+["","A","B","C"][y%4]+v.toString()+"."+S.toString(16).toLowerCase()+"."+["L","H"][g%2]+T.toString(),this.width==this.spsConfig.width&&this.height==this.spsConfig.height||this.mse.updateAVCConfig&&this.mse.updateAVCConfig({width:this.spsConfig.width,height:this.spsConfig.height}),this.width=r.width=this.spsConfig.width,this.height=r.height=this.spsConfig.height,this.mse.setAvcCfg(this.width,this.height)}break;case t.HEVC_NAL_PPS:d=!0,c=!0,r.pps||(r.pps=[_.data]);break;case 19:case 20:d=!0,c=!0,l=!0,r.idr=!0;break;case t.HEVC_NAL_AUD:d=!1,c=!0;break;case 39:case 40:d=!0,c=!0,(this.ignoreSei||1==D._noSei)&&(d=!1);break;case 0:case 1:case 12:d=!0,c=!0;break;default:d=!1,f+="unknown NAL "+_.type+" "}d&&(o.push(_),u+=_.data.byteLength)}}catch(t){m.e(t)}finally{m.f()}if(f.length,r.idr&&(this.hasIDR=!0,this.mse.setExceptionStat(R.DIM_LINK_STA.VIDEO_IFRAME,1)),r.codec&&this.mse.setExceptionStat(R.DIM_LINK_STA.VIDEO_CONFIG,1),this.dropBeforeFirstIDR&&!this.hasIDR)return void I.warn("TsParser._parseAVCPES no idr found, drop video frame!ts=".concat(e.dts/90," dts=").concat(e.dts," pts=").concat(e.pts));if(o.length&&(!0===l||r.sps)){if(s={type:"hvc",units:o,dts:e.dts,pts:e.pts,key:l,ts:e.dts/90,cts:(e.pts-e.dts)/90,videoCodec:this.hevcCodec,videoWidth:this.width,videoHeight:this.height},l&&(s.ppsUnit=[{length:r.pps[0].length,nalu:r.pps[0]}],s.spsUnit=[{length:r.sps[0].length,nalu:r.sps[0]}],s.vpsUnit=[{length:r.vps[0].length,nalu:r.vps[0]}]),a.push(s),r.len+=u,r.naluCnt+=o.length,this._updateInitPts(s.pts,s.dts),this.vod
1DtsJumpHelper.checkVideoDts(s.dts),1==D._printVideoTs){var P=parseInt(e.dts-90*this.mse.curVideoDts),C=parseInt((e.pts-ey.initPts)/90);I.debug("%cTsParser.parseAvcPes ts=".concat(e.dts/90," dts=").concat(e.dts," pts=").concat(e.pts," cts=").concat(e.pts-e.dts," gap=").concat(P," timeoffset=").concat(C),"color:green")}var E=e.dts/90;this.mse&&(this.mse.curVideoDts=E,this.mse.setExceptionStat(R.DIM_LINK_STA.VIDEO_FRAME,1)),this.vFps.addDts(E),this.vInfo.addDts(E)}}else{var k,A=Object(Q.a)(n);try{for(A.s();!(k=A.n()).done;){var O=k.value;switch(O.type){case 1:if(!this.convertToIDR&&this.openConvertIDR&&r.sps&&r.pps){this.convertToIDR=!0,l=!0,r.idr=!0;var b=O.data[0],w=129&O.data[0];O.data[0]=10|w,O.type=5,I.log("TsParser._parseAVCPES convert NDR to IDR, type=1 -> 5, data=".concat(b," -> ").concat(O.data[0]))}d=!0,c=!0;break;case 5:this.convertToIDR=!0,d=!0,c=!0,l=!0,r.idr=!0;break;case 6:d=!0,c=!0,(this.ignoreSei||1==D._noSei)&&(d=!1);break;case 7:if(d=!0,c=!0,!r.sps){r.sps=[O.data],r.timescale=this.remuxer.timescale,r.duration=this.remuxer.timescale*this.duration;var F=new tA(O.data).readSPS();this.width==F.width&&this.height==F.height||this.mse.updateAVCConfig&&this.mse.updateAVCConfig({width:F.width,height:F.height}),this.width=r.width=F.width,this.height=r.height=F.height,this.mse.setAvcCfg(this.width,this.height);for(var M=O.data.subarray(1,4),N="avc1.",B=0;B<3;B++){var V=M[B].toString(16);V.length<2&&(V="0"+V),N+=V}r.codec=N,this.avcCodec=N}break;case 8:d=!0,c=!0,r.pps||(r.pps=[O.data]);break;case 9:d=!0,c=!0,1!=D._noAud&&this.mse.getCodecType()!=L.PLAYER_CORE_TYPE.WEBCODECS||(d=!1);break;case 12:d=!0,c=!0;break;default:d=!1,f+="unknown NAL "+O.type+" "}d&&(o.push(O),u+=O.data.byteLength)}}catch(t){A.e(t)}finally{A.f()}if(f.length,r.idr&&(this.hasIDR=!0,this.mse.setExceptionStat(R.DIM_LINK_STA.VIDEO_IFRAME,1)),r.codec&&this.mse.setExceptionStat(R.DIM_LINK_STA.VIDEO_CONFIG,1),this.dropBeforeFirstIDR&&!this.hasIDR||r.sps&&r.pps&&!r.idr)return void I.warn("TsParser._parseAVCPES no idr found, drop video frame!ts=".concat(e.dts/90," dts=").concat(e.dts," pts=").concat(e.pts));if(o.length&&c){var U=e.dts/90;if(s={type:"avc",units:o,dts:e.dts,pts:e.pts,key:l,ts:U,cts:(e.pts-e.dts)/90,videoCodec:this.avcCodec,videoWidth:this.width,videoHeight:this.height},this.lastTs=U,l&&(s.ppsUnit=[{length:r.pps[0].length,nalu:r.pps[0]}],s.spsUnit=[{length:r.sps[0].length,nalu:r.sps[0]}]),a.push(s),r.len+=u,r.naluCnt+=o.length,this._updateInitPts(s.pts,s.dts),this.vod
1DtsJumpHelper.checkVideoDts(s.dts),1==D._printVideoTs){var x=parseInt(e.dts-90*this.mse.curVideoDts),H=parseInt((e.pts-ey.initPts)/90);I.debug("%cTsParser.parseAvcPes ts=".concat(e.dts/90," dts=").concat(e.dts," pts=").concat(e.pts," cts=").concat(e.pts-e.dts," gap=").concat(x," timeoffset=").concat(H),"color:green")}var G=e.dts/90;this.mse&&(this.mse.curVideoDts=G,this.mse.setExceptionStat(R.DIM_LINK_STA.VIDEO_FRAME,1)),this.vFps.addDts(G),this.vInfo.addDts(G)}}}},{key:"_parseAVCNALu",value:function(t){for(var e,i,s,r,a,n,o=0,u=t.byteLength,l=0,d=[];o<u;)switch(e=t[o++],l){case 0:0===e&&(l=1);break;case 1:l=2*(0===e);break;case 2:case 3:0===e?l=3:1===e?(r=this.isHevc?(126&t[o])>>1:31&t[o],a?d.push({data:t.subarray(a,o-l-1),type:n}):(i=o-l-1)&&this._pushToPreUnit(t.subarray(0,i)),o<u?(a=o,n=r,l=0):l=-1):l=0}return a&&d.push({data:t.subarray(a,u),type:n}),d}},{key:"_pushToPreUnit",value:function(t){var e=this._avcTrack.samples.length;if(0!=e){var i=this._avcTrack.samples[e-1],s=i.units[i.units.length-1],r=new Uint8Array(s.data.byteLength+t.byteLength);r.set(s.data,0),r.set(t,s.data.byteLength),s.data=r,this._avcTrack.len+=t.byteLength}}},{key:"_parseAACPES",value:function(t){var e=this;if(null==t)return I.error("TsParser._parseAACPES pes is null."),void(this.mse&&this.mse.onParseError(98));if(!this.dropBeforeFirstIDR||this.hasIDR){var i,s,r,a,n,o,u,l,d=this._aacTrack,c=t.data,f=c.length,p=0;if(this.aacOverFlow){var m=new Uint8Array(this.aacOverFlow.byteLength+c.byteLength);m.set(this.aacOverFlow,0),m.set(c,this.aacOverFlow.byteLength),c=m,this.aacOverFlow=null}for(s=0;s<f-1&&(255!==c[s]||240!=(240&c[s+1]));s++);if(s&&(s<f-1?(u="AAC PES did not start with ADTS header, offset:".concat(s),l=!1):(u="no ADTS header found in AAC PES",l=!0),I.error("TsParser._parseAACPES ERROR:".concat(u)),l))return void(this.mse&&this.mse.onParseError(98));var _=function(t){d.config=t.config,d.audiosamplerate=t.samplerate,d.channelCount=t.channelCount,d.audioObjectType=t.audioObjectType,d.codec=t.codec,d.timescale=e.remuxer.timescale,d.duration=e.remuxer.timescale*e.duration,e.mse&&e.mse.setExceptionStat(R.DIM_LINK_STA.AUDIO_CONFIG,1),I.log("TsParser._parseAACPES parsed codec:".concat(d.codec,",rate:").concat(t.samplerate,",nb channel:").concat(t.channelCount));var i=1024e3/t.samplerate;e.mse.updateAudioConfig({audioConfig:t,codec:"mp4a.40.5",audioSampleRate:t.samplerate,aacTimeLen:i,audioObjectType:t.adtsObjectType,audioChannelCount:t.channelCount},!1)};if(this.mse&&this.mse.isLive)d.audiosamplerate||_(this._ADTStoAudioConfig(c,s,this.audioCodec));else{var y=this._ADTStoAudioConfig(c,s,this.audioCodec);d.audiosamplerate?d.audiosamplerate!==y.samplerate&&this.mse&&this.mse.onParseError(99):_(y)}for(;s+5<f;){if(r=1&c[s+1]?7:9,(a=((3&c[s+3])<<11|c[s+4]<<3|(224&c[s+5])>>>5)-r)<0)return I.error("TsParser._parseAACPES adtsFrameSize:".concat(a,", adtsStartOffset:").concat(s,", len:").concat(f)),void(this.mse&&this.mse.onParseError(98));if(0!=a){if(!((n=s+r)+a<=f))break;for(o=Math.round(t.pts+1024*p*this.PES_TIMESCALE/d.audiosamplerate),i={unit:c.subarray(n,n+a),pts:o,dts:o,ts:o/90},!this.mse.isLive&&ey.ptsJumpTest&&this._dtsJumpSimulate(i,"audio"),d.samples.push(i),d.len+=a,s+=r+a,p++;s<f-1&&(255!==c[s]||240!=(240&c[s+1]));s++);
1if(this._updateInitPts(i.pts,i.dts),this.vodDtsJumpHelper.checkAudioDts(i.dts),1==D._printAudioTs){var v=parseInt(i.dts-90*this.mse.curAudioDts),S=parseInt((i.dts-ey.initPts)/90);I.debug("%cTsParser.parseAacPes dts=".concat(i.dts," pts=").concat(i.dts," cts=").concat(i.dts-i.dts," gap=").concat(v," timeoffset=").concat(S),"color:red")}var g=i.dts/90;this.mse&&(this.mse.curAudioDts=g,this.mse.setExceptionStat(R.DIM_LINK_STA.AUDIO_FRAME,1)),this.aFps.addDts(g),this.aInfo.addDts(g)}else s+=r}s<f&&(this.aacOverFlow=c.subarray(s,f))}else I.warn("TsParser._parseAACPES no idr found, drop audio frame!ts=".concat(t.dts/90," dts=").concat(t.dts," pts=").concat(t.pts))}},{key:"_ADTStoAudioConfig",value:function(e,i,s){var r=t.AdtsSampleingRates,a=1+((192&e[i+2])>>>6),n=a,o=(60&e[i+2])>>>2;if(o>r.length-1)return I.error("TsParser._ADTStoAudioConfig ERROR:invalid ADTS sampling index:".concat(o)),void(this.mse&&this.mse.onParseError(98));var u,l,d=(1&e[i+2])<<2|(192&e[i+3])>>>6,c=navigator.userAgent.toLowerCase();return -1!==c.indexOf("firefox")?o>=6?(a=5,l=[,,,,],u=o-3):(a=2,l=[,,],u=o):-1!==c.indexOf("android")?(-1!==c.indexOf("mqqbrowser")?(a=2,l=[,,]):(a=5,l=[,,,,]),u=o):(a=5,l=[,,,,],s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&o>=6?u=o-3:(s&&-1!==s.indexOf("mp4a.40.2")&&(o>=6||1===d)&&(a=2,l=[,,]),u=o)),l[0]=a<<3,l[0]|=(14&o)>>1,l[1]|=(1&o)<<7,l[1]|=d<<3,5===a&&(l[1]|=(14&u)>>1,l[2]=(1&u)<<7,l[2]|=8,l[3]=0),{config:l,samplerate:r[o],channelCount:d,audioObjectType:n,adtsObjectType:a,codec:"mp4a.40."+a}}},{key:"_parseID3PES",value:function(t){this._id3Track.samples.push(t)}},{key:"_dtsJumpSimulate",value:function(t,e){if(!ey.jumpConfig){try{var i=JSON.parse(D.jumpConfig);if(!i.jumpTime||!i.jumpPts)throw Error("jumpConfig jumpTime is empty or jumpPts is empty");ey.jumpConfig=i}catch(t){return ey.ptsJumpTest=!1,D.removeItem("ptsJumpTest"),void I.error("jumpConfig error",t&&t.message)}I.log("%cjump time=".concat(ey.jumpConfig.jumpTime," jumpPts=").concat(ey.jumpConfig.jumpPts),"color:#A23400;background:#FFF5C2")}if(t){var s=Math.ceil((t.dts-ey.initPts)/9e4);if("video"===e?(s<ey.videoTimeOffset&&(s=ey.videoTimeOffset),ey.videoTimeOffset=s):(s<ey.audioTimeOffset&&(s=ey.audioTimeOffset),ey.audioTimeOffset=s),s<Number(ey.jumpConfig.jumpTime))return;var r=Number(ey.jumpConfig.jumpPts);t.dts+=r,t.pts+=r}}}]),t}();eT.AdtsSampleingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],eT.HEVC_NAL_VPS=32,eT.HEVC_NAL_SPS=33,eT.HEVC_NAL_PPS=34,eT.HEVC_NAL_AUD=35;var eP=function(){function t(e,i,r){Object(s.a)(this,t),this.video=e,this.callbacks=r,this.destroyed=!1,this.isSupportRVCB=!1,this.callBackId=0,this.started=!1,this.requestVideoFrameCallbackBind=this.requestVideoFrameCallback.bind(this),"safari"!==S.name&&e&&e.requestVideoFrameCallback&&!i&&(this.isSupportRVCB=!0)}return Object(r.a)(t,[{key:"start",value:function(){this.started||(this.started=!0,this.isSupportRVCB?this.callBackId=this.video.requestVideoFrameCallback(this.requestVideoFrameCallbackBind):(this._lastPlayTime=0,tP.add(this._checkRender,this,100)))}},{key:"requestVideoFrameCallback",value:function(){!this.destroyed&&this.started&&this.video&&(this.callbacks&&this.callbacks.renderCallback(t.Types.FRAME),this.callBackId=this.video.requestVideoFrameCallback(this.requestVideoFrameCallbackBind))}},{key:"_checkRender",value:function(e){if(this.video){var i=this.video.currentTime;this._lastPlayTime!==i&&(this._lastPlayTime=i,this.callbacks&&this.callbacks.renderCallback(t.Types.TIMER))}}},{key:"stop",value:function(){I.log("VideoChecker.stop"),this.started=!1,this.callBackId=0,tP.remove(this._checkRender,this)}},{key:"destroy",value:function(){I.log("VideoChecker.destroy"),this.isSupportRVCB&&this.video&&this.video.cancelVideoFrameCallback(this.callBackId),this.destroyed=!0,this.video=null,this.callBackId=0,this.callbacks=null,tP.remove(this._checkRender,this)}}]),t}();eP.Types={FRAME:"Frame",TIMER:"Timer"};var eC=function(){function t(){Object(s.a)(this,t);var e=window.AudioContext||window.webkitAudioContext;e&&(this.audioCtx=new e),this.audioItemMap=new Map}return Object(r.a)(t,[{key:"getState",value:function(){return this.audioCtx&&this.audioCtx.state}},{key:"getAnalyser",value:function(t){if(0===F.audioCtx||!this.audioCtx)return null;var e=this.audioItemMap.get(t);if(!e){var i=this.audioCtx.createMediaElementSource(t),s=this.audioCtx.createAnalyser();i.connect(s),s.connect(this.audioCtx.destination),e=new eE(t,i,s),this.audioItemMap.set(t,e)}return e.analyser}},{key:"delAnalyser",value:function(t){var e=this.audioItemMap.get(t);e&&(e.destroy(),this.audioItemMap.delete(t))}},{key:"resume",value:function(){this.audioCtx&&"running"!==this.audioCtx.state&&this.audioCtx.resume().catch(function(t){I.log("AudioContextUtils.resume error=".concat(t.message))})}}]),t}(),eE=function(){function t(e,i,r){Object(s.a)(this,t),this.video=e,this.audioSource=i,this.analyser=r}return Object(r.a)(t,[{key:"destroy",value:function(){this.audioSource.disconnect(),this.analyser.disconnect(),this.video=null,this.audioSource=null,this.analyser=null}}]),t}(),eI=new eC,ek=1,eA=function(){function t(e,i,r){Object(s.a)(this,t),this._id=ek++,I.log("[msevideo-".concat(this._id,"] MSEVideo constructor")),this.mse=e,this.video=i,this.isOutSide=r,this.playing=!1,this.seekTime=0,this.isMuffled=!1,this.cacheVolume=1,this.seekSuc=!1,this.seeking=!1,this.triggerPlayed=!1,i.addEventListener("pause",e.onVideoPauseBind),i.addEventListener("error",e.onVideoErrorBind),i.addEventListener("play",e.onVideoPlayBind),i.addEventListener("playing",e.onVideoPlayingBind),i.addEventListener("loadeddata",e.onVideoLoadedBind),i.addEventListener("resize",e.onVideoResizeBind),i.addEventListener("timeupdate",e.onVideoTimeUpdateBind),i.addEventListener("volumechange",e.onVideoVolumeChangeBind),this.videoChecker=new eP(i,e.isPureAudio,{renderCallback:this._renderCallback.bind(this)}),this.videoChecker.start(),this._initAudioAnalyser(i)}return Object(r.a)(t,[{key:"_initAudioAnalyser",value:function(t){var e=eI.getAnalyser(t);e&&this.mse.onAudioAnalyserInit(e)}},{key:"isSupportRequestVideoFrameCallback",value:function(){return this.video&&this.video.requestVideoFrameCallback}},{key:"_renderCallback",value:function(){this.mse&&this.mse.requestVideoFrameCallback&&this.mse.requestVideoFrameCallback(),this.mse&&this.mse.handler._hyPlayer&&this.mse.handler._hyPlayer.roomRecordStat&&this.mse.handler._hyPlayer.roomRecordStat.renderCallback()}},{key:"getEndTime",value:function(){return this.video&&this.video.buffered.length>0?this.video.buffered.end(this.video.buffered.length-1):0}},{key:"seek",value:function(t){this.seekTime=t,this.seeking=!0}},{key:"realSeek",value:function(){if(this.seeking&&this.video&&this.video.buffered.length>0){for(var t=!1,e=this.video.buffered,i=this.seekTime,s=0;s<e.length;s++){var r=e.start(s),a=e.end(s);r>=i&&r-i<1?(i=r,t=!0,I.log("[msevideo-".concat(this._id,"] MseVideo._checkSeek out off buffer, reseek=").concat(i))):i>r&&i<a&&(t=!0,I.log("[msevideo-".concat(this._id,"] MseVideo._checkSeek in buffer, reseek=").concat(i)))}t&&(this.printBuffered(),this.seeking=!1,this.video.currentTime=i,I.log("[msevideo-".concat(this._id,"] MSEVideo.seek currentTime=").concat(this.video.currentTime," seekTime=").concat(i)))}}},{key:"checkCurrentTime",value:function(){this.video&&(this.video.currentTime=this.video.currentTime)}},{key:"_checkPlay",value:function(){I.log("[msevideo-".concat(this._id,"] MSEVideo.checkPlay seekTime=").concat(this.seekTime," playing=").concat(this.playing," currentTime=").concat(this.video&&this.video.currentTime)),this.video&&0===this.video.currentTime&&!this.playing?(this.seekTime>0?(this.seekTime++,this.video.currentTime=this.seekTime):this.video.currentTime+=1,this._play()):tP.remove(this._checkPlay,this)}},{key:"play",value:function(){"safari"!==S.name||this.mse.isLive?(this._play(),tP.add(this._checkPlay,this,1e3)):(tP.add(this._checkPlay,this,1e3),this.triggerPlayed&&this._play())}},{key:"triggerPlay",value:function(){this.triggerPlayed=!0,this.play()}},{key:"_play",value:function(){var t=this;if(this.video){I.log("[msevideo-".concat(this._id,"] MSEVideo._play auto
1play=").concat(this.video.autoplay," muted=").concat(this.video.muted));var e=this.video.play();e?e.then(function(){tP.remove(t._checkPlay,t),I.log("[msevideo-".concat(t._id,"] MSEVideo._play suc currentTime=").concat(t.video&&t.video.currentTime," volume=").concat(t.video.volume," audioCtxState=").concat(eI.getState())),t._renderCallback(),F.platform===L.PLATFORM_TYPE_NAME.wap&&!t.playing&&t.mse&&t.mse.triggerH5PlayVideo(),t.playing=!0,t.video.volume>0&&t.audioContextResume()}).catch(function(e){t.playing=!1;var i=e.toString();I.warn("[msevideo-".concat(t._id,"] MSEVideo.play error: ").concat(i)),t.mse&&(i.indexOf("NotAllowedError")>=0||i.indexOf("request was interrupted")>=0||t.video.paused)&&(t.mse&&t.mse.onPauseByBrowser(),F.platform===L.PLATFORM_TYPE_NAME.wap&&tP.remove(t._checkPlay,t))}):this.playing=!1}else I.log("[msevideo-".concat(this._id,"] MSEVideo._play fail no video")),tP.remove(this._checkPlay,this)}},{key:"pause",value:function(){tP.remove(this._checkPlay,this),this.video.pause()}},{key:"getBufferLen",value:function(){var t=0;if(this.video){var e=this.video.buffered;e.length>0&&(t=0===this.video.currentTime?1e3*(e.end(e.length-1)-e.start(e.length-1))|0:1e3*(e.end(e.length-1)-this.video.currentTime)|0)}return t}},{key:"printBuffered",value:function(){I.log("[msevideo-".concat(this._id,"] ").concat(O.getBufferedLog(this.video)))}},{key:"getCurrentTime",value:function(){return this.seeking&&this.seekTime>0?1e3*this.seekTime:1e3*this.video.currentTime}},{key:"setVolume",value:function(t){this.isMuffled?this.video.volume=0:(this.video.volume=t,t>0&&this.audioContextResume()),this.cacheVolume=t}},{key:"audioContextResume",value:function(){eI.resume()}},{key:"setMuffledVolume",value:function(t){this.isMuffled=t,this.isMuffled?this.video.volume=0:this.setVolume(this.cacheVolume)}},{key:"getVolume",value:function(){return this.video.volume}},{key:"setMuted",value:function(t){this.video&&(this.video.muted=t,I.log("[msevideo-".concat(this._id,"] MSEVideo.setMuted ").concat(t," hasVideo=").concat(!!this.videoSourceBuffer," hasAudio=").concat(!!this.audioSourceBuffer)))}},{key:"getMuted",value:function(){return!!this.video&&this.video.muted}},{key:"getVideoWidth",value:function(){return this.video?this.video.videoWidth:0}},{key:"getVideoHeight",value:function(){return this.video?this.video.videoHeight:0}},{key:"destroy",value:function(){this.isOutSide||eI.delAnalyser(this.video),this.video.removeEventListener("error",this.mse.onVideoErrorBind),this.video.removeEventListener("pause",this.mse.onVideoPauseBind),this.video.removeEventListener("play",this.mse.onVideoPlayBind),this.video.removeEventListener("playing",this.mse.onVideoPlayingBind),this.video.removeEventListener("loadeddata",this.mse.onVideoLoadedBind),this.video.removeEventListener("resize",this.mse.onVideoResizeBind),this.video.removeEventListener("timeupdate",this.mse.onVideoTimeUpdateBind),this.video.removeEventListener("volumechange",this.mse.onVideoVolumeChangeBind),this.videoChecker&&this.videoChecker.destroy(),this.videoChecker=null,this.video=null,this.mse=null}}]),t}(),eR=function(){function t(e,i){Object(s.a)(this,t),this._mse=e,this._callbacks=i,this._paused=!1,this._playedTime=0,this._pausedTs=0,this._lastPausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0,this._lastCheck500CurrntTime=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._mse=null,this._callbacks=null}},{key:"paused",get:function(){return this._paused}},{key:"pausedTs",get:function(){return this._pausedTs}},{key:"reset",value:function(){this._paused=!1,this._playedTime=0,this._pausedTs=0,this._lastPausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0}},{key:"check",value:function(){var t=g.now(),e=this._mse.video.video;0!=this._lastCheckTime&&1==Number(D._printPauseCheck)&&I.log("MSEPause.check",t-this._lastCheckTime,e.currentTime),!this._mse.isLive&&e.currentTime<=1||(this._mse.isLive||!this._mse.handler||this._mse.handler.started)&&(0!==this._playedTime&&(e.currentTime===this._playedTime?this._paused?this._fixedCurrentTime(t,e):this._setPaused(t,e):this._paused&&this._setResume(t,e)),this._playedTime=e.currentTime,this._lastCheckTime=t)}},{key:"_setPaused",value:function(t,e){this._paused=!0,this._pausedTs=t,this._lastPausedTs=t,this._log("_setPaused",e),this._callbacks.pause(t)}},{key:"_setResume",value:function(t,e){var i=t-this._pausedTs;this._paused=!1,this._pausedTs=0,this._lastPausedTs=0,this._log("_setResume",e),this._callbacks.resume(t,i)}},{key:"_fixedCurrentTime",value:function(t,e){t-this._lastPausedTs>500&&(this._fixedByBuffered(e)||this._fixedByDts(e))&&(this._lastPausedTs=t)}},{key:"_fixedByBuffered",value:function(t){if("flv"===this._mse.videoType){var e=t.buffered.length;if(e>0){var i=t.buffered.start(e-1),s=t.buffered.end(e-1);if(i>t.currentTime&&s-i>1)return this._log("_fixedByBuffered",t),t.currentTime=i,!0}}else if("ts"===this._mse.videoType&&!this._mse.isLive){var r=((this._mse.handler||{}).playlist||{}).currFrag,a=2;r&&(a=r.duration);for(var n=t.buffered.length,o=0;o<n;o++){var u=t.buffered.start(o),l=t.buffered.end(o);if(o>=1&&t.buffered.end(o-1)-t.currentTime<=1&&u>t.currentTime&&u<=t.currentTime+a&&l-u>1)return I.log("%cMSEPause.fixedByBuffered currentTime=".concat(t.currentTime," fixed time=").concat(u),"color:#A23400;background:#FFF5C2"),t.currentTime=u,!0}}return!1}},{key:"_fixedByDts",value:function(t){return!!(this._mse.getBufferLen()>2e3&&this._mse.isLive)&&(this._log("_fixedByDts",t),t.currentTime+=1,!0)}}
1,{key:"_log",value:function(t,e,i){this._mse.video.printBuffered();var s=this._mse.getBufferLen();"ts"===this._mse.videoType&&!this._mse.isLive&&this._mse.handler&&(s=this._mse.handler.getBufferLen()),I.log("MSEPause(".concat(this._mse._num_,").").concat(t," readyState=").concat(e.readyState," currentTime=").concat(e.currentTime," buf=").concat(s," dts=").concat(this._mse.getCurrentDts()," ").concat(i||""))}}]),t}(),eD=function(){function t(){Object(s.a)(this,t),this.emptyTs=0,this.emptyTime=0,this.emptyCnt=0,this.aiEmptyTime=0,this.aiEmptyCnt=0}return Object(r.a)(t,[{key:"reset",value:function(){this.emptyTs=0,this.emptyTime=0,this.emptyCnt=0}},{key:"getStats",value:function(){var t={emptyTime:this.emptyTime,emptyCnt:this.emptyCnt};return this.emptyTime=0,this.emptyCnt=0,t}},{key:"getAiStats",value:function(){var t={aiEmptyTime:this.aiEmptyTime,aiEmptyCnt:this.aiEmptyCnt};return this.aiEmptyTime=0,this.aiEmptyCnt=0,t}},{key:"checkBuffer",value:function(t,e){e<200&&0===this.emptyTs?this.emptyTs=t:e>500&&this.emptyTs>0&&(this.emptyTime+=t-this.emptyTs,this.aiEmptyTime+=t-this.emptyTs,this.emptyTs=0,this.emptyCnt++,this.aiEmptyCnt++)}}]),t}(),eO=function(){function t(e){Object(s.a)(this,t),this._handler=e,this._cnt=0,this._duration=0,this._pauseTs=0,this._aiCnt=0,this._aiDuration=0,this._aiAutoCnt=0,this._aiAutoDuration=0,this._videoBlockBufferList=[],this._videoBlockContinueList=[],this._blockBadDurationList=[],this._blockBadContinueBufferList=[],this._autoReportProps=null}return Object(r.a)(t,[{key:"destroy",value:function(){this._handler=null,this._videoBlockBufferList=null,this._videoBlockContinueList=null,this._blockBadDurationList=null,this._blockBadContinueBufferList=null}},{key:"reset",value:function(){this.resetStat(),this.resetAiStat(),this.resetAutoAiStat(),this._pauseTs=0,this._autoReportProps=null}},{key:"getCnt",value:function(){return this._cnt}},{key:"resetStat",value:function(){this._cnt=0,this._duration=0,this._videoBlockBufferList.length=0,this._videoBlockContinueList.length=0}},{key:"pause",value:function(){0===this._pauseTs&&(this._pauseTs=g.now()),this.getAutoReportProps(),this._handler&&(this._videoBlockBufferList.push(this._handler.getBufferLen()),this._videoBlockContinueList.push(this._handler.getVideoContinueBuffer()))}},{key:"resume",value:function(){this.calc(!0)}},{key:"calc",value:function(t){if(this._pauseTs>0){var e=g.now(),i=e-this._pauseTs;i>=200&&(this._cnt++,this._aiCnt++,this._aiAutoCnt++,this._duration+=i,this._aiDuration+=i,this._aiAutoDuration+=i,this._blockBadDurationList.push(i),this._blockBadContinueBufferList.push(this._handler.getBufferLen())),i>=F.blockBadCfg[0]&&this.setBlockBad(i),t?this._pauseTs=0:(this._pauseTs=e,this.getAutoReportProps())}}},{key:"resetAiStat",value:function(){this._aiCnt=0,this._aiDuration=0}},{key:"resetAutoAiStat",value:function(){this._aiAutoCnt=0,this._aiAutoDuration=0,this._blockBadDurationList.length=0,this._blockBadContinueBufferList.length=0}},{key:"getAiStat",value:function(){var t={aiCnt:this._aiCnt,aiDuration:this._aiDuration};return this.resetAiStat(),t}},{key:"getAiAutoStat",value:function(){var t={aiAutoCnt:this._aiAutoCnt,aiAutoDuration:this._aiAutoDuration,aiAutoBlockBadDurationList:v(this._blockBadDurationList),aiAutoBlockBadContinueBufferList:v(this._blockBadContinueBufferList)};return this.resetAutoAiStat(),t}},{key:"record",value:function(t){this.calc(!1),t.setCore(R.CORE.VIDEO_BLOCK_COUNT,this._cnt),t.setCore(R.CORE.VIDEO_BLOCK_DURATION,this._duration),this.performanceCalc(t),this.resetStat()}},{key:"performanceCalc",value:function(t){var e=this,i=F.perfBlockCfg[0],s=0,r=0;this._videoBlockBufferList.map(function(t,a){var n=e._videoBlockContinueList[a];t>i?(n>i&&r++,s++):n>F.perfBlockCfg[1]&&(s++,r++)}),I.log("PauseStat.performanceCalc, continueBufferCnt=".concat(r,",bufferCnt=").concat(s,",perfBlockCnt=").concat(this._handler.perfBlockCnt)),this._handler.perfBlockCnt>0&&(r+=this._handler.perfBlockCnt,s+=this._handler.perfBlockCnt),t.setCore(R.CORE.VIDEO_PERFPAUSE_CONTINUE_CNT,r),t.setCore(R.CORE.VIDEO_PERFPAUSE_CNT,s),this._handler.resetPerfBlockCnt()}},{key:"recordSam",value:function(t){var e=t.length,i=[];if(e>0){i.push("size:".concat(e));for(var s=0;s<e;s++)i.push("k".concat(e-s,":").concat(t[s]))}return i.join(",")}},{key:"getAutoReportProps",value:function(){this._handler.handler&&this._handler.handler.getAutoProps&&(this._autoReportProps=this._handler.handler.getAutoProps())}},{key:"setBlockBad",value:function(t){if(!(Math.floor(100*Math.random())>Math.floor(100*F.blockBadCfg[1]))){var e=this._handler.handler._hyPlayer.stat,i=this._handler.handler._hyPlayer.tsdbUtil,s=this._autoReportProps;if(s){var r=["",s.videoBuffers,"",s.blockDurationSample,s.continueBufferSample,s.realKbpsSample,"",s.recvFps],a=e.createAct(R.ACT.BLOCK_BAD,{value:[t],str:r});I.log("PauseStat.setBlockBad getAutoProps metric=",a),i.sendMetrics([a])}}}}]),t}(),eb=i(13),ew=[95,112,101,114,102],eL=function(){function t(){Object(s.a)(this,t),this.bitrate=4e3,this.blockCount=1,this.continueBuffer=2e3,this.map=new Map,this.key="",this._initKey(),this._initLocal()}return Object(r.a)(t,[{key:"destroy",value:function(){this.map&&this.map.clear(),this.map=null}},{key:"_initKey",value:function(){for(var t=0;t<ew.length;t++)this.key+=String.fromCharCode(ew[t])}},{key:"setConfig",value:function(t){this.bitrate=t.perfBitrate||4e3,this.blockCount=t.perfCnt||1,this.continueBuffer=t.perfBuf||2e3}},{key:"_initLocal",value:function(){if(D.hasOwnProperty(this.key)){for(var t=D[this.key].split(","),e="",i=!0,s=0;s<t.length;s++){if(isNaN(Number(t[s]))){i=!1;break}e+=String.fromCharCode(Number(t[s]))}i&&e.length>0&&this._parseLocal(e)}}},{key:"_parseLocal",value:function(t){for(var e=t.split("|"),i=0;i<e.length;i++){var s=e[i].split(":"),r=Number(s[0]),a=s[1].split(",");this.map.set(r,a)}}},{key:"checkLocal",value:function(t,e){if(t=Number(t),this.map.has(t)){var i=this.map.get(t);return this._hasBitrate(i,e)}return!1}}
1,{key:"checkLive",value:function(t,e,i,s){if(t=Number(t),e>=this.bitrate&&i>this.blockCount&&s>this.continueBuffer){var r=this.map.get(t);if(r||(r=[],this.map.set(t,r)),!this._hasBitrate(r,e))return r.push(e),this._saveMap(),I.log("PausePerformance.checkLive pid=".concat(t," bitrate=").concat(e)),!0}return!1}},{key:"_hasBitrate",value:function(t,e){for(var i=0;i<t.length;i++)if(Number(e)===Number(t[i]))return!0;return!1}},{key:"_saveMap",value:function(){var t,e=[],i=Object(Q.a)(this.map.entries());try{for(i.s();!(t=i.n()).done;){var s=Object(eb.a)(t.value,2),r=s[0],a=s[1];e.push(r+":"+a.join(","))}}catch(t){i.e(t)}finally{i.f()}if(e.length>0){for(var n=e.join("|"),o=[],u=0;u<n.length;u++)o.push(n.charCodeAt(u));D[this.key]=o.join(",")}}}]),t}(),eF=function(){function t(){Object(s.a)(this,t),this.startDts=0,this.endDts=0,this.endFrameId=0}return Object(r.a)(t,[{key:"isDisconnectDts",value:function(t){return this.endDts>0&&t-this.endDts>200}},{key:"isDisconnectFrame",value:function(t){return this.endFrameId>0&&t-this.endFrameId!=1}},{key:"getContinueBuffer",value:function(t){return t>=this.startDts&&t<=this.endDts?this.endDts-t:0}},{key:"addBuffer",value:function(t,e){0===this.startDts&&(this.startDts=e),this.endDts=e,this.endFrameId=t}}]),t}(),eM="record",eN="resume",eB="push",eV=function(){function t(){Object(s.a)(this,t),this._frameId=0,this._lastFrameId=0,this._startFrameId=0}return Object(r.a)(t,[{key:"reset",value:function(){this._frameId=0,this._lastFrameId=0,this._startFrameId=0}},{key:"setStartFrameId",value:function(t){this._startFrameId=t,this._lastFrameId=this._frameId}},{key:"getFrameId",value:function(t,e){return 0===t?(this._frameId++,e>0&&this._frameId++):(e>0&&this._lastFrameId++,this._frameId=this._lastFrameId+(t-this._startFrameId+1)),this._frameId}}]),t}(),eU=function(){function t(){Object(s.a)(this,t),this._mse=null,this._list=[],this._dtsList=[],this._tsList=[],this._currentBuffered=null,this._continueBuffer=-1,this._lastFrameTs=0,this._startTs=0,this._started=!1,this._lastRemoveTs=0,this._deltaStart=Number(F.continueBufferDeltaStart)||6e3,this._deltaEnd=Number(F.continueBufferDeltaEnd)||3e3,this._localFrameId=new eV,this._printContinueBuffer=1==D._printContinueBuffer}return Object(r.a)(t,[{key:"destroy",value:function(){I.log("VideoBufferedList.destroy"),tP.remove(this.onCheckFastTimer,this),this._list=null,this._dtsList=null,this._tsList=null,this._mse=null}},{key:"continueBuffer",get:function(){return this._continueBuffer},set:function(t){this._continueBuffer=t}},{key:"setMse",value:function(t){this._mse=t}},{key:"stop",value:function(){I.log("VideoBufferedList.stop"),this._startTs=0,this._list.length=0,this._dtsList.length=0,this._continueBuffer=-1,this._currentBuffered=null,this._localFrameId.reset(),tP.remove(this.onCheckFastTimer,this)}},{key:"printInfo",value:function(t){var e=[];this._list.forEach(function(t){e.push("[".concat(t.startDts,", ").concat(t.endDts,"]"))}),I.log("VideoBufferedList.print dts=".concat(t," buffered=").concat(e.join(" ")))}},{key:"record",value:function(t){this._calc(g.now(),eM),t.setCore(R.CORE.VIDEO_CONTINUE_BUFFER,this.getVideoContinueBuffer()),this._continueBuffer=-1}},{key:"start",value:function(){0===this._startTs&&(I.log("VideoBufferList.start"),this._startTs=g.now(),tP.add(this.onCheckFastTimer,this,50))}},{key:"onCheckFastTimer",value:function(t){if(0===this._lastRemoveTs)this._lastRemoveTs=t;else if(this._lastRemoveTs>0&&t-this._lastRemoveTs>5e3){this._lastRemoveTs=t;for(var e=this._mse.getCurrentDts()-2e4,i=this._dtsList.length-1;i>=0;i--)if(this._dtsList[i]<e){this._dtsList=this._dtsList.slice(i),this._tsList=this._tsList.slice(i);break}}var s=t-this._lastFrameTs;this._lastFrameTs>0&&s>100&&(this._calc(t,"timer"),this._lastFrameTs=t)}},{key:"addSample",value:function(t,e,i,s){var r=g.now();this._tsList.push(r),this._dtsList.push(e),(0===this._lastFrameTs||i)&&this._localFrameId.setStartFrameId(t),this._lastFrameTs=r;var a=this._localFrameId.getFrameId(t,s);this._currentBuffered&&!this._currentBuffered.isDisconnectFrame(a)||(this._currentBuffered=new eF,this._list.push(this._currentBuffered),this._list.length>10&&e-this._list[0].endDts>3e5&&this._list.shift()),this._currentBuffered.addBuffer(a,e)}},{key:"_calc",value:function(t,e){var i=t-this._deltaStart,s=t-this._deltaEnd;if((e===eM||e===eN)&&-1===this._continueBuffer)return this._continueBuffer=this._getContinueBuffer(this._mse.getCurrentDts()),void(this._printContinueBuffer&&this.printInfo(this._mse.getCurrentDts()+" continueBuffer=".concat(this._continueBuffer," from=").concat(e," ")));if(!(0===this._startTs||i<this._startTs)){for(var r=this._getDtsBound(i,s),a=r.startDts,n=r.endDts,o=Number.MAX_SAFE_INTEGER,u=this._dtsList.length,l=0;l<u;l++){var d=this._dtsList[l];if(d>n||(d>=a&&d<=n&&(o=Math.min(o,this._getContinueBuffer(d))),0===o))break}o===Number.MAX_SAFE_INTEGER&&(o=0),(-1===this._continueBuffer||this._continueBuffer>o)&&(this._continueBuffer=o,this._printContinueBuffer&&this.printInfo(this._mse.getCurrentDts()+" now=".concat(t," startDts=").concat(a," endDts=").concat(n," continueBuffer=").concat(o," from=").concat(e)))}}},{key:"_getDtsBound",value:function(t,e){for(var i=this._tsList.length,s=Number.MAX_SAFE_INTEGER,r=0,a=0;a<i;a++){var n=this._tsList[a];if(n>
1=t&&n<=e){var o=this._dtsList[a];o<s&&(s=o),o>r&&(r=o)}else if(n>e)break}return{startDts:s,endDts:r}}},{key:"_getContinueBuffer",value:function(t){for(var e=0,i=0;i<this._list.length&&0===(e=this._list[i].getContinueBuffer(t));i++);return e}},{key:"getVideoContinueBuffer",value:function(){var t=0;if(this._mse&&this._mse.getCurrentDts){var e=this._mse.getCurrentDts();t=this._getContinueBuffer(e)}return t}}]),t}(),ex=function(){function t(e){Object(s.a)(this,t),this.seiList=[],this.player=e,this.lastTs=-1,this.internal=10,this.timerStart=!1,this.internalId=0,this.checkDispatchSeiBind=this.checkDispatchSei.bind(this)}return Object(r.a)(t,[{key:"destroy",value:function(){this.seiList=null,this.player=null,clearTimeout(this.internalId)}},{key:"add",value:function(t,e){var i=this.seiList.length;if(this.seiList.length>0)for(i=this.seiList.length-1;i>0&&!(t>this.seiList[i].timeStamp);i--);this.seiList.splice(i+1,0,{timeStamp:t,data:e}),this.timerStart||(this.timerStart=!0,this.internalId=setTimeout(this.checkDispatchSeiBind,this.internal))}},{key:"checkDispatchSei",value:function(){if(this.timerStart){for(var t=this.player.getCurrentRealTime(),e=0,i=null;e<this.seiList.length-2;){if(t>=this.seiList[e].timeStamp&&this.seiList[e+1].timeStamp>t){i=this.seiList[e+1].data,this.player.onH264Sei(i,this.seiList[e+1].timeStamp),this.seiList.splice(0,e+1);break}e++}this.internalId=setTimeout(this.checkDispatchSeiBind,this.internal)}}},{key:"reset",value:function(){this.seiList=[],this.player=null,this.lastTs=-1,this.timerStart=!1}}]),t}(),eH=function(){function t(e){Object(s.a)(this,t),this.volumeList=[],this.player=e,this.lastTs=-1,this.internal=100,this.timerStart=!1,this.dispatchMap=new Map,this.timer=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.volumeList=null,this.player=null,clearTimeout(this.timer)}},{key:"addMixAudio",value:function(t,e){if(t.length>0)for(var i=t.split(","),s=0;s<i.length;s++)this.add(e,i[s])}},{key:"add",value:function(t,e){var i=this.volumeList.length;if(this.volumeList.length>0)for(i=this.volumeList.length-1;i>0&&!(t>this.volumeList[i].timeStamp);i--);this.volumeList.splice(i+1,0,{timeStamp:t,data:e}),this.timerStart||(this.timerStart=!0,this.timer=setTimeout(this.checkDispatchVolume.bind(this),this.internal))}},{key:"checkDispatchVolume",value:function(){var t=this;if(this.timerStart){var e=this.player.getCurrentRealTime(),i=0;for(this.dispatchMap.clear();this.volumeList[i]&&this.volumeList[i].timeStamp<e;){var s=this.volumeList[i].data.split("_");s.length>1&&this.dispatchMap.set(s[0],s[1]),i++}this.dispatchMap.forEach(function(e,i,s){t.player.onScriptVolumeInfo(i,e)}),this.dispatchMap.clear(),this.volumeList.splice(0,i),this.volumeList.length>0?this.timer=setTimeout(this.checkDispatchVolume.bind(this),this.internal):this.timerStart=!1}}},{key:"reset",value:function(){this.volumeList=[],this.player=null,this.lastTs=-1,this.timerStart=!1}}]),t}(),eG=function(){function t(){Object(s.a)(this,t),this.type=-1,this.sn=0,this.samples=[],this.playDts=-1,this.firstDts=-1e4,this.lastSampleDts=0,this.setPlayDtsCallback=null}return Object(r.a)(t,[{key:"getInfo",value:function(){return"size=".concat(this.samples.length,"=[").concat(this.samples.length>0?this.samples[0].ts:0,", ").concat(this.samples.length>0?this.samples[this.samples.length-1].ts:0,"]")}},{key:"destroy",value:function(){this.samples=[]}},{key:"clear",value:function(){this.samples.length>0&&I.log("BufferFrame.clear type=".concat(this.type," size=").concat(this.samples.length,"=[").concat(this.samples[0].ts,", ").concat(this.samples[this.samples.length-1].ts,"]")),this.samples=[],this.firstDts=-1e4,this.playDts=-1,this.lastSampleDts=0}},{key:"addSample",value:function(t,e){if(this.lastSampleDts>0){var i=t.ts-this.lastSampleDts;(i>100||i<-100)&&I.warn("BufferFrame.addSample type=".concat(this.type," isShield=").concat(e," dis=").concat(i," lastDts=").concat(this.lastSampleDts," curDts=").concat(t.ts))}return this.lastSampleDts=t.ts,this.samples.push(t),this._setFirstDts(t.ts),t.ts-this.playDts}},{key:"_setFirstDts",value:function(t){-1e4===this.firstDts&&(this.firstDts=t,this.playDts=t,this.setPlayDtsCallback&&this.setPlayDtsCallback())}},{key:"_createTrack",value:function(e){return{type:e,id:e===t.TYPES.video?1:2,sn:0,samples:[],len:0,duration:0,startDts:-1,endDts:0,naluCnt:0}}},{key:"getTrack",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this._createTrack(this.type),s=this._fillTrack(i,t,e);return s>0&&this.samples.splice(0,s),i.endDts>0&&(i.playDts=this.playDts,i.sn=this.sn,this.sn++),i}}
1,{key:"_fillTrack",value:function(t,e,i){return 0}},{key:"_addTrack",value:function(t,e){t.samples.push(e),-1===t.startDts&&(t.startDts=e.ts),t.endDts=e.ts,e.av1Bytes&&(t.bytes=e.av1Bytes)}},{key:"getBufferLen",value:function(){var t=this.samples.length;if(t>1){var e=this.samples[0];return this.samples[t-1].ts-e.ts}return 0}},{key:"getSize",value:function(){return this.samples.length}},{key:"removeExpireBuffer",value:function(t,e){var i=this;this.samples=this.samples.filter(function(s){if(s.ts>=t-i.aacTimeLen)return s;1===Number(D._printAVTrack)&&2==e&&I.log("BufferFrame.removeExpireBuffer, sample.ts=".concat(s.ts,", videoDts=").concat(t))}),this.samples.length>0&&(this.playDts=this.samples[0].ts)}},{key:"recoverBuffer",value:function(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.length<=0||(this.playDts=e[0].ts,(t=this.samples).splice.apply(t,[0,0].concat(v(e))))}}]),t}();eG.TYPES={video:"video",audio:"audio"};var eW=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).type=eG.TYPES.video,t}return Object(r.a)(i,[{key:"_setFirstDts",value:function(t){-1e4===this.firstDts&&I.log("BufferFrameVideo._setFirstDts=".concat(t)),Object(n.a)(Object(o.a)(i.prototype),"_setFirstDts",this).call(this,t)}},{key:"_fillTrack",value:function(t,e,i){for(var s=0,r=this.samples.length,a=this.playDts+e,n=0;n<r;n++){var o=this.samples[n];if(o.ts>=a){t.endDts=o.ts;break}s++,this._addTrack(t,o)}return t.endDts>0&&(this.playDts=t.endDts),s}},{key:"_addTrack",value:function(t,e){Object(n.a)(Object(o.a)(i.prototype),"_addTrack",this).call(this,t,e),t.naluCnt+=e.units.length,t.len+=e.len}}]),i}(eG),ej=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r){var a;return Object(s.a)(this,i),(a=e.call(this)).shieldType=t,a.type=eG.TYPES.audio,a.needEmptyAudioFrame=!0,a.isPureAudio=!1,a.lastAacTs=0,a.webcodecType=r,a.webcodecsEmptyFrameInited=!1,a.audioObjectType=5,a.audioChannelCount=1,a.audioSampleRate=22050,a.aacTimeLen=1024e3/a.audioSampleRate,a.aacEmptyDuration=0,a.emptyDuration=0,a}return Object(r.a)(i,[{key:"resetAudioDts",value:function(){this.clear()}},{key:"addSample",value:function(t,e){return this.webcodecType!=L.PLAYER_CORE_TYPE.WEBCODECS||this.webcodecsEmptyFrameInited||(this.webcodecsEmptyFrameInited=!0,eo.setWebcodeccEmptyFrame(t.unit)),t.empty=0,Object(n.a)(Object(o.a)(i.prototype),"addSample",this).call(this,t,e)}},{key:"_setFirstDts",value:function(t){-1e4===this.firstDts&&I.log("BufferFrameAudio._setFirstDts=".concat(t)),this.playDts>0&&-1e4===this.firstDts&&t>this.playDts&&t-this.playDts<this.aacTimeLen&&(I.log("BufferFrameAudio._setFirstDts resetPlayDts ".concat(this.playDts," to ").concat(t)),this.playDts=t),Object(n.a)(Object(o.a)(i.prototype),"_setFirstDts",this).call(this,t)}},{key:"alignPlayDts",value:function(t){if(0===this.playDts)I.log("BufferFrameAudio.alignPlayDts videoPlayDts=".concat(t)),this.playDts=t;else if(t>this.playDts){var e=this.playDts;this.playDts=t;for(var i=0;this.samples.length>0&&this.samples[0].ts<t;)i++,this.samples.shift();I.log("BufferFrameAudio.alignPlayDts audioPlayDts=".concat(e," to ").concat(t,", clear samples=").concat(i))}}},{key:"_fillTrack",value:function(t,e,i){if(-1===this.playDts)return 0;for(var s=this.playDts+this.aacTimeLen,r=s,a=0,n=0,o=0,u=0,l=this.samples.length,d=0,c={startDts:0,endDts:0};s<e;){var f=this.samples[a];if(d=Math.round(s),F.dtsJumpOpen&&f){var p=d-f.ts;if(p<0&&(p=-p),p>F.dtsJumpThreshold){s=f.ts;break}}if(f&&f.ts<=d)0===c.startDts&&(c.startDts=f.ts),c.endDts=f.ts,a++,u++,this._addTrack(t,f),this._recordEmptyDuration(o),o=0;else if(!this.isPureAudio&&this.needEmptyAudioFrame){if(n++,1==F.isAudioEmptyLimit&&n>=200)break;var m={unit:null,pts:0,dts:0,ts:0,empty:1};if(this.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS&&null!=eo.webcodeccEmptyFrame?m.unit=new Uint8Array(eo.webcodeccEmptyFrame):22050===this.audioSampleRate&&2===this.audioObjectType?m.unit=new Uint8Array(eo.emptyAacFrame):m.unit=eo.getSilentFrame(this.audioObjectType,this.audioChannelCount),this._fixDts(m,d),this.aacEmptyDuration+=this.aacTimeLen,o+=this.aacTimeLen,1==D._noEmptyFrame)continue;this._addTrack(t,m)}
1if(!i&&l>1&&a>=l||s+this.aacTimeLen>=e)break;s+=this.aacTimeLen}return this._recordEmptyDuration(o),t.emptyFrames=n,this.playDts=s,n>0&&I.log("BufferFrameAudio add empty frames ".concat(n,", objectType=").concat(this.audioObjectType," channelCount=").concat(this.audioChannelCount," shieldType=").concat(this.shieldType," playDts=").concat(this.playDts," sampleTs=").concat(this.samples[a-1]?this.samples[a-1].ts:0," pick=[").concat(c.startDts,",").concat(c.endDts,"] play=[").concat(r,", ").concat(e,"]")),u}},{key:"_recordEmptyDuration",value:function(t){t>=F.audioEmptyDur&&(this.emptyDuration+=t)}},{key:"hasPushBuffer",value:function(t){return!(t-this.playDts>F.shieldAudioCfg[4])}},{key:"_fixDts",value:function(t,e){t.pts=t.dts=90*e,t.ts=e}},{key:"_addTrack",value:function(t,e){e.unit&&(Object(n.a)(Object(o.a)(i.prototype),"_addTrack",this).call(this,t,e),t.len+=e.unit.length)}},{key:"getEmptyeDuration",value:function(){var t=this.aacEmptyDuration;return this.aacEmptyDuration=0,t}},{key:"getEmptyDurationHeart",value:function(){var t=this.emptyDuration;return this.emptyDuration=0,Math.floor(t)}}]),i}(eG),eY=function(){function t(e,i,r){Object(s.a)(this,t),this.popSize=e.bufferSize+e.popDuration,this.waitSize=e.waitSize||2e3,this.popDuration=e.popDuration,this.timescale=e.timescale,this.isPureAudio=e.isPureAudio,this.isPureVideo=e.isPureVideo,this.webcodecType=e.webcodecType,this.remuxCb=i,this.ctrlBuffer=r,this.popMode=0,this.dtsChecker=new t3,this.avcChange=!1,this.inited=!0,this.hasOriginIFrame=!1,this.hasRemux=!1,this.gop=F.maxGop,this.lastKeyFrameDts=0,this.paused=!1,this.switchedShieldAudio=!1,this.isShieldAudio=!1,this.isAShieldFirstPop=!1,this.shieldAudioWaitSize=200,this.startShieldTs=0,this.firstVideoTs=0,this.firstAudioTs=0,this.firstShieldAudioTs=0,this.isShieldFastToAlign=0,this.firstPrintVideo=!1,this.firstPrintAudio=!1,this.isSwitchShieldFailed=!1,this.videoConfig={isHevc:!1,vps:null,sps:null,pps:null,codec:"",width:0,height:0},this.audioConfig={config:null,codec:"mp4a.40.5",audioSampleRate:22050,aacTimeLen:1024e3/22050,audioObjectType:5,audioChannelCount:1},this.shieldAudioConfig={config:null,codec:"mp4a.40.5",audioSampleRate:22050,aacTimeLen:1024e3/22050,audioObjectType:5,audioChannelCount:1},this.vBuffer=new eW,this.vBuffer.setPlayDtsCallback=this.setVideoPlayDts.bind(this),this.aBuffer=new ej(1,this.webcodecType),this.aShieldBuffer=new ej(2,this.webcodecType),this.aBuffer.isPureAudio=this.isPureAudio,this.aShieldBuffer.isPureAudio=this.isPureAudio,this._switchShieldTimeoutBind=this._switchShieldTimout.bind(this)}return Object(r.a)(t,[{key:"resetAudioDts",value:function(){this.aBuffer.resetAudioDts()}},{key:"_updateGop",value:function(t){t.key&&(!this.hasOriginIFrame||t.origin_iframe)&&(this.lastKeyFrameDts>0&&(this.gop=Math.min(F.maxGop,t.ts-this.lastKeyFrameDts),1==D._printGop&&I.log("BufferAV._updateGop webcodecs",this.gop)),this.lastKeyFrameDts=t.ts)}},{key:"updateVideoConfig",value:function(t,e){I.log("BufferAV.updateVideoConfig, oldAvcChange=".concat(this.avcChange," curAvcChange=").concat(e)),this.videoConfig=t,this.avcChange||(this.avcChange=e),this.firstPrintVideo=!1,this.firstPrintAudio=!1}},{key:"updateAudioConfig",value:function(t,e,i){1==e?(I.log("BufferAV.updateAudioConfig.common, first=".concat(i),JSON.stringify(t)),this.audioConfig=t,this.aBuffer.audioSampleRate=t.audiosamplerate,this.aBuffer.aacTimeLen=t.aacTimeLen,this.aBuffer.audioObjectType=t.audioObjectType,this.aBuffer.audioChannelCount=t.audioChannelCount):2==e&&(I.log("BufferAV.updateAudioConfig.shield, first=".concat(i),JSON.stringify(t)),this.shieldAudioConfig=t,this.aShieldBuffer.audioSampleRate=t.audiosamplerate,this.aShieldBuffer.aacTimeLen=t.aacTimeLen,this.aShieldBuffer.audioObjectType=t.audioObjectType,this.aShieldBuffer.audioChannelCount=t.audioChannelCount)}
1},{key:"destroy",value:function(){this.firstVideoTs=0,this.firstAudioTs=0,this.firstShieldAudioTs=0,this.remuxCb=null,this.hasRemux=!1,this.switchedShieldAudio=!1,this.isAShieldFirstPop=!1,this.isShieldFastToAlign=!1,this.vBuffer.destroy(),this.aBuffer.destroy(),this.aShieldBuffer.destroy(),tP.remove(this._switchShieldTimeoutBind,this)}},{key:"clearShieldAudio",value:function(){this.aShieldBuffer.clear(),this.switchedShieldAudio=!1}},{key:"addSample",value:function(e){this.inited=!1,e.type===t.TYPES.avc||e.type===t.TYPES.av01?(this.dtsChecker.isVideoDtsDiffLarge(e.ts),this._addSampleVideo(e)):e.type===t.TYPES.aac&&(this.dtsChecker.isAudioDtsDiffLarge(e.ts),this._addSmapleAudio(e))}},{key:"switchShieldAudio",value:function(t){I.log("BufferAV.switchShieldAudio, yes=".concat(t)),this.isShieldAudio=t,t?(this.isStartShieldAudio=!1,this.startShieldTs=0,this.isFirstShieldAvc=!1,this.isFirstDelteShieldAac=!1,this.isAShieldFirstPop=!1,this.isShieldFastToAlign=!1,this.isSwitchShieldFailed=!1,tP.once(this._switchShieldTimeoutBind,this,F.shieldAudioCfg[2])):(tP.remove(this._switchShieldTimeoutBind,this),this.switchedShieldAudio&&this.clearShieldAudio())}},{key:"_switchShieldTimout",value:function(){this._switchShieldAudioFailed(1);var t=this.aShieldBuffer.samples.length,e=this.vBuffer.samples.length;I.warn("BufferAv._switchShieldTimout, shieldBuffelen=".concat(t,", vBufferLen=").concat(e,", firstVideoTs=").concat(this.firstVideoTs,", firstAudioTs=").concat(this.firstAudioTs,", firstShieldAudioTs=").concat(this.firstShieldAudioTs)),t>0&&I.warn("BufferAv._switchShieldTimout, aStart=".concat(this.aShieldBuffer.samples[0].ts,", aEnd=").concat(this.aShieldBuffer.samples[t-1].ts)),e>0&&I.warn("BufferAv._switchShieldTimout, vStart=".concat(this.vBuffer.samples[0].ts,", vEnd=").concat(this.vBuffer.samples[e-1].ts))}},{key:"_getFirstShieldAVDelta",value:function(){var t=this.firstVideoTs,e=this.firstShieldAudioTs,i=0;return 0!=t&&0!=this.firstAudioTs&&(i=t-e),i}},{key:"_switchShieldAudioFailed",value:function(t){I.warn("BufferAv._switchShieldAudioFailed switch shield audio failed, reason=".concat(t,", firstVideoTs=").concat(this.firstVideoTs,", firstAudioTs=").concat(this.firstAudioTs,", firstShieldAudioTs=").concat(this.firstShieldAudioTs)),this.isSwitchShieldFailed=!0,this.switchedShieldAudio&&this.clearShieldAudio();var e=Math.abs(this._getFirstShieldAVDelta());this.ctrlBuffer.onSwitchShieldAudioFail(t,e)}},{key:"_switchShieldAudioSuc",value:function(){if(!this.isSwitchShieldFailed){I.log("BufferAv._switchShieldAudioSuc switch shield audio successfully, firstVideoTs=".concat(this.firstVideoTs,", firstAudioTs=").concat(this.firstAudioTs,", firstShieldAudioTs=").concat(this.firstShieldAudioTs));var t=this._getFirstShieldAVDelta();this.ctrlBuffer.onSwitchShieldAudioSuc(t)}}},{key:"_shieldAuidoMute",value:function(t,e){this.ctrlBuffer.shieldAuidoMute(t,e)}},{key:"_setShieldBuffer",value:function(t){if(!this.isFirstShieldAvc){I.log("BufferAv.popBuffer.firstShieldBuffer.length",this.aShieldBuffer.samples&&this.aShieldBuffer.samples.length),this.isFirstShieldAvc=!0;var e=this.aShieldBuffer.samples[0].ts,i=t-e;if(I.log("BufferAv.popBuffer.shield.firstDts avcFirstTs=".concat(t," aacFirstTs=").concat(e," delta=").concat(t-e)),i<0&&i>-F.shieldAudioCfg[3])return this._switchShieldAudioSuc(),this.switchedShieldAudio=!0,!0;if(i<-F.shieldAudioCfg[3])return I.log("BufferAv.popBuffer.shield audio to fast"),this._switchShieldAudioFailed(3),!1}return!0}},{key:"_addSampleVideo",value:function(t){0==this.firstVideoTs&&(this.firstVideoTs=t.ts),this.firstPrintVideo||(this.firstPrintVideo=!0,I.log("BufferAv.addSampleVideo firstPrint dts=".concat(t.ts," isKey=").concat(t.key))),t.key&&t.origin_iframe&&!this.hasOriginIFrame&&(I.log("BufferAv.addSampleVideo find origin_iframe! isIframe=".concat(t.key)),this.hasOriginIFrame=!0),!t.key&&t.origin_iframe&&I.warn("BufferAv.addSampleVideo find origin_iframe sei not in iframe"),this._updateGop(t);var e=this.vBuffer.addSample(t,!1);if(this.isShieldAudio){var i=this.vBuffer.samples.length;
10!=this.firstAudioTs&&0!=this.firstVideoTs&&this.firstVideoTs-this.firstAudioTs>=F.shieldAudioCfg[4]&&this._switchShieldAudioFailed(4),!this.isFirstDelteShieldAac&&i>0&&this.aShieldBuffer.removeExpireBuffer(this.vBuffer.samples[0].ts,2);var s=this.aShieldBuffer.getBufferLen();!this.paused&&e>=this.popSize&&s>=this.popSize&&(this.popBuffer(this.popDuration),this.isFirstDelteShieldAac=!0)}else!this.paused&&e>this.popSize&&(0===this.popMode?this.aBuffer.getBufferLen()>this.popSize?this.popBuffer(this.popDuration):e>this.waitSize&&(this.popBuffer(this.waitSize),t.ts-this.firstVideoTs>1e4&&0===this.aBuffer.firstDts&&(this.popMode=1)):1===this.popMode&&this.popBuffer(this.popDuration))}},{key:"setVideoPlayDts",value:function(){this.aBuffer.alignPlayDts(this.vBuffer.playDts)}},{key:"_addSmapleAudio",value:function(t){0==this.firstAudioTs&&(this.firstAudioTs=t.ts),this.firstPrintAudio||(this.firstPrintAudio=!0,I.log("BufferAv._addSmapleAudio firstPrint dts=".concat(t.ts)));var e=this.aBuffer.addSample(t,!1);this.isShieldAudio||!this.isShieldAudio&&!this.paused&&this.isPureAudio&&e>this.popSize&&this.popBuffer(this.popDuration)}},{key:"addShieldAudioSample",value:function(t){0==this.firstShieldAudioTs&&(this.firstShieldAudioTs=t.ts);var e=this.aShieldBuffer.addSample(t,!0);this.isShieldAudio&&!this.paused&&this.isPureAudio&&e>this.popSize&&this.popBuffer(this.popDuration)}},{key:"getShieldWait",value:function(){if(this.isShieldAudio){var t=this.aShieldBuffer.getSize();if(t<=0)return!1;var e=this.aShieldBuffer.samples[0].ts,i=this.aShieldBuffer.samples[t-1].ts;if(!this.isAShieldFirstPop){if(i-e<F.shieldAudioCfg[5])return I.log("BufferAv.popBuffer.waitShield",i-e),!1;I.log("BufferAv.popBuffer.waitShield success",i-e),this.isAShieldFirstPop=!0}}return!0}},{key:"popBuffer",value:function(t){var e=0,i=0;if(this.isStartShieldAudio||(this.startShieldTs=g.now(),this.isStartShieldAudio=!0),this.get
1ShieldWait()){0!=this.startShieldTs&&(e=g.now()-this.startShieldTs);var s=null,r=null,a=!1;(r=this.vBuffer.getTrack(t)).timescale=this.timescale,r.duration=Math.round((r.endDts-r.startDts)*(this.timescale/1e3));var n=0==r.sn;r&&(n||this.avcChange)&&(this.avcChange=!1,Object.assign(r,this.videoConfig),I.log("BufferAV.popBuffer avcChange cur=".concat(JSON.stringify(this.videoConfig))));var o=this.dtsChecker.isSync(),u=this.isPureAudio?this.aBuffer.playDts+t:r.endDts;if(o||(u=this.aBuffer.playDts+this.aBuffer.getBufferLen()),this.isShieldAudio){var l=this._setShieldBuffer(this.vBuffer.firstDts),d=this.firstVideoTs,c=this.firstShieldAudioTs,f=d-c;if(l)if(f<0&&f>-F.shieldAudioCfg[3]&&!this.isShieldFastToAlign)if(u<=c+this.popSize)s=this.aBuffer.getTrack(u),a=!1;else{var p=this.aShieldBuffer.samples[0].ts;this.aShieldBuffer.removeExpireBuffer(r.startDts,2),this.aShieldBuffer.samples.length>0&&I.log("BufferAv.popBuffer.shield to align, aRemoveShieldFirstTs=".concat(p,", vshieldAlignTs=").concat(r.startDts,",ashieldAlignTs=").concat(this.aShieldBuffer.samples[0].ts,", removeDelta=").concat(this.aShieldBuffer.samples[0].ts-p)),s=this.aShieldBuffer.getTrack(u),a=!0,this.aBuffer.removeExpireBuffer(u,1),this.isShieldFastToAlign=!0}else this.isSwitchShieldFailed?(s=this.aBuffer.getTrack(u),a=!1):this.switchedShieldAudio?(a=!0,s=this.aShieldBuffer.getTrack(u),this.aBuffer.removeExpireBuffer(u,1)):(this.switchedShieldAudio=!0,this.aShieldBuffer.removeExpireBuffer(r.startDts,2),this.aShieldBuffer.hasPushBuffer(u)?(s=this.aShieldBuffer.getTrack(u),a=!0,this.aBuffer.removeExpireBuffer(u,1),this._switchShieldAudioSuc()):0==this.aShieldBuffer.playDts?I.log("BufferAv.popBuffer.shield audio curDts=".concat(this.aShieldBuffer.playDts,", dts = 0, switch failed")):(this._switchShieldAudioFailed(4),I.warn("BufferAv.popBuffer.shield audio curDts=".concat(this.aShieldBuffer.playDts," far less than curDts=").concat(u,", delta = ").concat(u-this.aShieldBuffer.playDts,", switch failed")),s=this.aBuffer.getTrack(u)));else s=this.aBuffer.getTrack(u),a=!1;1===Number(D._printShield)&&I.log("BufferAv.popBuffer.shield: aac startDts=".concat(s.startDts," endDts=").concat(s.endDts," avc startDts=").concat(r.startDts," endDts=").concat(r.endDts),"gap:",r.endDts-s.endDts),tP.remove(this._switchShieldTimeoutBind,this)}else a=!1,s=this.aBuffer.getTrack(u,t===Number.MAX_SAFE_INTEGER||t===this.waitSize),this.switchedShieldAudio&&this.clearShieldAudio();0!=this.startShieldTs&&(i=g.now()-this.startShieldTs,I.log("BufferAv.popBuffer.shield: waitTime1 = ".concat(e," waitTime2=").concat(i)),this.startShieldTs=0),a?(s.config=this.shieldAudioConfig.config,s.audiosamplerate=this.shieldAudioConfig.audiosamplerate,s.channelCount=this.shieldAudioConfig.channelCount,s.codec=this.shieldAudioConfig.codec):(s.config=this.audioConfig.config,s.audiosamplerate=this.audioConfig.audiosamplerate,s.channelCount=this.audioConfig.channelCount,s.codec=this.audioConfig.codec),s.isSync=o,s.timescale=this.timescale,s.duration=Math.round((s.endDts-s.startDts)*(this.timescale/1e3)),t===Number.MAX_SAFE_INTEGER&&I.log("BufferAV.popAllBuffer video=[".concat(r.startDts,", ").concat(r.endDts,"] audio=[").concat(s.startDts,", ").concat(s.endDts,"] audioNum=").concat(this.aBuffer.getSize()," audioEndDts=").concat(this.aBuffer.lastSampleDts)),1===Number(D._printAVTrack)&&I.log("BufferAV.popBuffer.shield vaStartDelta=".concat(r.startDts-s.startDts,",vaEndDelta=").concat(r.endDts-s.endDts,",avcDelta=").concat(r.endDts-r.startDts,",aacDelta=").concat(s.endDts-s.startDts,",avcStartDts= ").concat(r.startDts,",aacStartDts=").concat(s.startDts,",avcEndDts=").concat(r.endDts,",aacEndDts=").concat(s.endDts)),this.hasRemux=!0,this.remuxCb&&this.remuxCb(r,s)}}},{key:"clearBuffer",value:function(){this.vBuffer.clear(),this.aBuffer.clear(),this.aShieldBuffer.clear()}},{key:"setNeedEmptyAudioFrame",value:function(t){this.aBuffer.needEmptyAudioFrame=t}},{key:"getBufferLen",value:function(){return this.isPureAudio?this.aBuffer.getBufferLen():this.vBuffer.getBufferLen()}},{key:"getSize",value:function(){return this.vBuffer.getSize()}}]),t}();eY.TYPES={avc:"avc",av01:"av01",aac:"aac"};var eq=function(){function t(){Object(s.a)(this,t),this.list=[],this.switchIFrameDts=0,this.switchIFramePts=0,this.lastIFrameDts=0,this.lastIFRamePts=0}return Object(r.a)(t,[{key:"getDts",value:function(){return this.switchIFrameDts||this.lastIFrameDts}},{key:"getPts",value:function(){return this.switchIFramePts||this.lastIFRamePts}},{key:"setSwitchTs",value:function(t,e){this.switchIFrameDts=t,this.switchIFramePts=e}},{key:"setLastTs",value:function(t,e){this.lastIFrameDts=t,this.lastIFRamePts=e}},{key:"resetPtsSample",value:function(){this.list=[]}}
1,{key:"addPtsSample",value:function(t,e,i,s,r,a){this.list.push({dts:t,pts:e,dtsGap:i,ptsGap:s,hasOrigin:r,isOrigin:a})}},{key:"getMetric",value:function(){var t=[0,0,0],e=[0,0];if(this.list.length>0){var i=this.list[0],s=this.list[this.list.length-1];t[0]=i.dtsGap,t[1]=i.ptsGap,t[2]=this.list.length,t[3]=0,t[4]=s.ptsGap,e[0]=s.hasOrigin?1:2,e[1]=s.isOrigin?1:2,e[2]=0}return{values:t,strs:e}}}]),t}(),eK=0,ez=function(){function t(e,i,r){Object(s.a)(this,t),this.config=e,this.remuxCb=i,this.mse=r,this.hasVideoConfig=!1,this.needEmptyAudioFrame=!0,this.timescale=9e4,this.hasFrame=!1,this.state=0,this.switchTs=new eq,this.avBuffer=this._createBuffer(),this.evalBw=null,this.callbacks=null,this._buffered=null,this.id=eK++,I.log("CtrlBuffer.constructor(".concat(this.id,")")),this._curFrameId=0,this.avcChangeTime=0,this.isNoVideoConfig=!1}return Object(r.a)(t,[{key:"setCurFrameId",value:function(t){this._curFrameId=t}},{key:"setBuffered",value:function(t){this._buffered=t}},{key:"addBuffered",value:function(t,e,i){(t.type===eY.TYPES.avc||t.type===eY.TYPES.av01&&this._buffered)&&this._buffered.addSample(this._curFrameId,t.ts,e,i)}},{key:"destroy",value:function(){this.remuxCb=null,this.callbacks=null,this._destroyBuffer()}},{key:"_destroyBuffer",value:function(){this.avBuffer&&(this.avBuffer.destroy(),this.avBuffer=null)}},{key:"_createBuffer",value:function(){this._destroyBuffer();var t=new eY(this.config,this.remuxCb,this);return t.timescale=this.timescale,t.setNeedEmptyAudioFrame(this.needEmptyAudioFrame),t}},{key:"pause",value:function(){this.avBuffer.paused=!0}},{key:"play",value:function(){this.avBuffer.paused=!1}},{key:"isPaused",value:function(){return this.avBuffer.paused}},{key:"isWaitForIFrame",value:function(){return 1===this.state}},{key:"switchBitrate",value:function(t,e,i){I.log("CtrlBuffer(".concat(this.id,").switchBitrate isDown=").concat(t)),this._lastBitrate=e,this._curBitrate=i,this.state=1}},{key:"switchBack",value:function(){I.log("CtrlBuffer(".concat(this.id,").switchBack switchIFramePts=").concat(this.switchTs.getDts()," lastIFramePts=").concat(this.switchTs.getPts())),this.state=2,this.avBuffer=this._createBuffer(),this.callbacks&&this.callbacks.start(this.switchTs.getDts(),this.switchTs.getPts())}},{key:"switchShieldAudio",value:function(t){this.avBuffer&&this.avBuffer.switchShieldAudio&&this.avBuffer.switchShieldAudio(t)}},{key:"setEval",value:function(t){this.evalBw=t}},{key:"resetAudioDts",value:function(){this.avBuffer&&this.avBuffer.resetAudioDts()}},{key:"addSample",value:function(t){if(this.avBuffer){var e=t.key&&(!this.avBuffer.hasOriginIFrame||t.origin_iframe);if(e&&this.switchTs.setLastTs(t.ts,t.ts+t.cts),t.type!==eY.TYPES.avc&&t.type!==eY.TYPES.av01||this.evalBw&&this.evalBw.addSample(t),2===this.state&&(this.hasFrame||t.type!==eY.TYPES.avc&&t.type!==eY.TYPES.av01||(I.log("CtrlBuffer(".concat(this.id,").addSample first sample dts=").concat(t.ts," pts=").concat(t.ts+t.cts)),this.hasFrame=!0,this.callbacks&&this.callbacks.first())),t.type!==eY.TYPES.avc&&t.type!==eY.TYPES.av01||this.hasVideoConfig)if(2===this.state){if(t.key){var i=t.ts+t.cts,s=t.ts-this.switchTs.getDts(),r=i-this.switchTs.getPts();I.log("CtrlBuffer(".concat(this.id,").addSample find IFrame origin_iframe=").concat(t.origin_iframe," dts=").concat(t.ts," pts=").concat(i," switchDts=").concat(this.switchTs.switchIFrameDts," switchPts=").concat(this.switchTs.switchIFramePts," dtsGap=").concat(s," ptsGap=").concat(r," iFrameGap=").concat(this.avBuffer.gop)),this.switchTs.addPtsSample(t.ts,i,s,r,this.avBuffer.hasOriginIFrame,t.origin_iframe),i>=this.switchTs.switchIFramePts&&(I.log("CtrlBuffer(".concat(this.id,").addSample find new IFrame, switch done")),this.state=0,this.switchTs.setSwitchTs(0,0),this.avBuffer.addSample(t),this.addBuffered(t,!0,r),this.callbacks&&this.callbacks.done(s,t.ts,r))}}else 1===this.state?e?(this._popAllBuffer(),this.avBuffer.hasOriginIFrame=!1,this.hasVideoConfig=!1,this.hasFrame=!1,this.state=2,this.switchTs.setSwitchTs(t.ts,t.ts+t.cts),this.switchTs.resetPtsSample(),I.log("CtrlBuffer(".concat(this.id,").addSample find next IFrame origin_iframe=").concat(t.origin_iframe," dts=").concat(this.switchTs.switchIFrameDts," pts=").concat(this.switchTs.switchIFramePts," iFrameGap=").concat(this.avBuffer.gop,", switch start!")),this.callbacks&&this.callbacks.start(this.switchTs.switchIFrameDts,this.switchTs.switchIFramePts)):(t.key&&I.log("CtrlBuffer(".concat(this.id,").addSample find next IFrame fail, origin_iframe=").concat(t.origin_iframe," dts=").concat(t.ts," pts=").concat(t.ts+t.cts)),this.avBuffer.addSample(t),this.addBuffered(t,!1,0)):(1===Number(D._printIFramePts)&&t.key&&I.log("CtrlBuffer(".concat(this.id,").addSample find next IFrame fail, origin_iframe=").concat(t.origin_iframe," dts=").concat(t.ts," pts=").concat(t.ts+t.cts)),this.avBuffer.addSample(t),this.addBuffered(t,!1,0));else this.isNoVideoConfig=!0}}},{key:"addShieldAudioSample",value:function(t){this.avBuffer.addShieldAudioSample(t),this.addBuffered(t,!1,0)}},{key:"_popAllBuffer",value:function(){this.avBuffer&&(this.avBuffer.getBufferLen()>0&&this.avBuffer.popBuffer(Number.MAX_SAFE_INTEGER),this.avBuffer.clearBuffer())}},{key:"updateVideoConfig",value:function(t,e){e&&(this.avcChangeTime=g.now(),this._popAllBuffer()),this.hasVideoConfig=!0,this.avBuffer&&this.avBuffer.updateVideoConfig(t,e)}}
1,{key:"updateAudioConfig",value:function(t,e,i,s){e&&this._popAllBuffer(),this.avBuffer&&this.avBuffer.updateAudioConfig&&this.avBuffer.updateAudioConfig(t,i,s)}},{key:"setNeedEmptyAudioFrame",value:function(t){this.needEmptyAudioFrame=t,this.avBuffer.setNeedEmptyAudioFrame(t)}},{key:"isInAvcChangeTime",value:function(t){var e=g.now();return this.avcChangeTime+t<e}},{key:"getBufferLen",value:function(){return this.avBuffer.getBufferLen()}},{key:"getVideoBufferLen",value:function(){return this.mse.getBufferLen()}},{key:"getLastIFrameDts",value:function(){return this.switchTs.lastIFrameDts}},{key:"getSize",value:function(){return this.avBuffer.getSize()}},{key:"onSwitchShieldAudioFail",value:function(t,e){this.mse&&this.mse.onSwitchShieldAudioFail(t,e)}},{key:"onSwitchShieldAudioSuc",value:function(t){this.mse&&this.mse.onSwitchShieldAudioSuc(t)}},{key:"shieldAuidoMute",value:function(t,e){this.mse&&this.mse.shieldAuidoMute(t,e)}},{key:"getIframePts",value:function(){return this.switchTs.getPts()||0}}]),t}(),eJ=function(){function t(){Object(s.a)(this,t),this.avDifTotal=0,this.avDifCnt=0,this.avDifMax=0,this.emptyFrames=0}return Object(r.a)(t,[{key:"checkSync",value:function(t,e){if(t&&0!=t.samples.length)if(this.emptyFrames+=e.emptyFrames,!e.hasOwnProperty("isSync")||e.isSync)if(t.endDts>0&&e.endDts>0){var i=t.endDts-e.endDts;this.avDifTotal+=i,this.avDifCnt++,this.avDifMax<i&&(this.avDifMax=i),i>200&&0===e.emptyFrames&&I.log("%cAVSyncStat.checkSync avDif=".concat(i," video=[").concat(t.startDts,", ").concat(t.endDts,"] videoPlayDts=").concat(t.playDts," audio=[").concat(e.startDts,", ").concat(e.endDts,"] audioPlayDts=").concat(e.playDts),L.LOG_COLOR.WARN)}else I.log("AVSyncStat.checkSync video=[".concat(t.startDts,", ").concat(t.endDts,"] videoPlayDts=").concat(t.playDts," audio=[").concat(e.startDts,", ").concat(e.endDts,"] audioPlayDts=").concat(e.playDts));else e.emptyFrames>0&&I.log("AVSyncStat.checkSync isSync=".concat(e.isSync," video=[").concat(t.startDts,", ").concat(t.endDts,"] videoPlayDts=").concat(t.playDts," audio=[").concat(e.startDts,", ").concat(e.endDts,"] audioPlayDts=").concat(e.playDts))}},{key:"record",value:function(t){if(this.avDifCnt>0){var e=Math.round(this.avDifTotal/this.avDifCnt);t.setCore(R.DIM_CORE.AVSDA,e),t.setCore(R.DIM_CORE.AVSDM,this.avDifMax),t.setCore(R.DIM_CORE.AVEFS,this.emptyFrames)}this.avDifCnt=0,this.avDifTotal=0,this.avDifMax=0,this.emptyFrames=0}}]),t}(),eQ=function(){function t(e){Object(s.a)(this,t),this.mse=e,this.eventEmitter=this.mse.handler.eventEmitter,this.stat=this.mse.handler.stat,this.lastTs=0,this.renderNum=0,this.fpsTotal=0,this.fpsNum=0,this.recordTotal=0,this.recordNum=0,this.lastEachTs=0,this.renderBadQuality=0,this.isFirstRender=!0,this.prePageRenderTs=0,this.pageRecordTotal=0,this.pageRecordNum=0,this.pageRenderNum=0,this.pageFpsTotal=0,this.pageFpsNum=0,this.pageFpsMax=0,this.pageFpsMin=0,this._onVisibilityChangeBind=this._onVisibilityChange.bind(this),this.eventEmitter&&this.eventEmitter.on(N.VISIBILITY_CHANGE,this._onVisibilityChangeBind)}return Object(r.a)(t,[{key:"reset",value:function(){this.fpsNum=0,this.fpsTotal=0,this.renderNum=0,this.recordTotal=0,this.recordNum=0,this.lastEachTs=0,this.renderBadQuality=0,this.isFirstRender=!0,this.prePageRenderTs=0,this.pageRecordTotal=0,this.pageRecordNum=0,this.pageRenderNum=0,this.pageFpsTotal=0,this.pageFpsNum=0,this.pageFpsMax=0,this.pageFpsMin=0}},{key:"getRecordFps",value:function(){var t=this.fpsTotal-this.recordTotal,e=this.fpsNum-this.recordNum;return e>0?(this.recordTotal=this.fpsTotal,this.recordNum=this.fpsNum,Math.round(t/e)):0}},{key:"addRender",value:function(){var t=g.now();if(this.renderNum++,0===this.lastTs)this.lastTs=t;else{var e=t-this.lastTs;if(e>=1e3){this.lastTs=t;var i=Math.floor(this.renderNum/(e/1e3));this.fpsNum++,this.fpsTotal+=i,this.renderNum=0}}this._checkRenderQuality(t)}},{key:"getPageRecordFps",value:function(){var t=this.pageFpsTotal-this.pageRecordTotal,e=this.pageFpsNum-this.pageRecordNum,i=0,s=this.pageFpsMax,r=this.pageFpsMin;e>0&&(this.pageRecordTotal=this.pageFpsTotal,this.pageRecordNum=this.pageFpsNum,i=Math.round(t/e));var a={pfps:i,pfpsMax:s,pfpsMin:r};return this.pageFpsMax=0,this.pageFpsMin=0,a}},{key:"addPageRender",value:function(){var t=g.now();if(this.pageRenderNum++,0===this.prePageRenderTs)this.prePageRenderTs=t;else{var e=t-this.prePageRenderTs;if(e>=1e3){this.prePageRenderTs=t;var i=Math.round(this.pageRenderNum/(e/1e3));if(this.pageFpsNum++,this.pageFpsTotal+=i,this.pageRenderNum=0,this.pageFpsMax=Math.max(i,this.pageFpsMax),0!=i)return 0==this.pageFpsMin?this.pageFpsMin=i:this.pageFpsMin=Math.min(i,this.pageFpsMin),i}}return 0}},{key:"_checkRenderQuality",value:function(t){if(0===this.lastEachTs)this.lastEachTs=t;else{var e=t-this.lastEachTs;!this.isFirstRender&&e>200&&(this.renderBadQuality=100,this.stat&&(this.stat.addCore(R.DIM_CORE.VRBQC,1),this.stat.addCore(R.DIM_CORE.VRBQD,e)),I.warn("RenderFps._checkRenderQuality render bad quality time=",e)),this.isFirstRender=!1,this.lastEachTs=t}}},{key:"statRenderQuality",value:function(){var t=this.renderBadQuality;return this.renderBadQuality=0,t}},{key:"_onVisibilityChange",value:function(){(document.hidden||document.webkitHidden||document.mozHidden||document.msHidden)&&(this._checkRenderQuality(g.now()),this.lastTs=0,this.lastEachTs=0,this.renderNum=0)}}]),t}(),eX=function(){function t(e){Object(s.a)(this,t),this.mse=e,this.eventEmitter=this.mse.handler.eventEmitter,this.recvFrameDataList=[],this.remuxFrameDataList=[],this.pushedVideoDataList=[],this.frameRecvToPushConSumingMax=0,this.frameRecvToPushConSumingFrames=0,this.frameRecvToPushConSumingTotalTime=0,this.framePushToRenderedConSumingMax=0,this.framePushToRenderedConSumingFrames=0,this.framePushToRenderedConSumingTotalTime=0,this.frameRecvToRenderMax=0,this.frameRecvToRenderConSumingFrames=0,this.frameRecvToRenderConSumingTotalTime=0,this._onVisibilityChangeBind=this._onVisibilityChange.bind(this),this.eventEmitter&&this.eventEmitter.on(N.VISIBILITY_CHANGE,this._onVisibilityChangeBind)}return Object(r.a)(t,[{key:"clearConsuming",value:function(){this.recvFrameDataList=[],this.remuxFrameDataList=[],this.pushedVideoDataList=[],this.frameRecvToPushConSumingMax=0,this.frameRecvToPushConSumingFrames=0,this.frameRecvToPushConSumingTotalTime=0,this.framePushToRenderedConSumingMax=0,this.framePushToRenderedConSumingFrames=0,this.framePushToRenderedConSumingTotalTime=0,this.frameRecvToRenderMax=0,this.frameRecvToRenderConSumingFrames=0,this.frameRecvToRenderConSumingTotalTime=0}}
1,{key:"addRecvFrameData",value:function(t,e,i){F.renderStat[0]&&this.recvFrameDataList.push({ts:t,pts:e,time:i})}},{key:"addRemuxFrameData",value:function(t,e,i){F.renderStat[0]&&this.remuxFrameDataList.push({ts:t,pts:e,time:i})}},{key:"pushRemuxedVideoFrameData",value:function(t){var e=this;if(F.renderStat[0]){for(var i=function(i){var s=e.recvFrameDataList.find(function(t){return t.ts===e.remuxFrameDataList[i].ts});if(s){var r=t-s.time;e.frameRecvToPushConSumingTotalTime+=r,e.frameRecvToPushConSumingFrames++,e.frameRecvToPushConSumingMax=Math.max(r,e.frameRecvToPushConSumingMax)}e.pushedVideoDataList.push({ts:e.remuxFrameDataList[i].ts,pts:e.remuxFrameDataList[i].pts,time:t})},s=0;s<this.remuxFrameDataList.length;s++)i(s);this.remuxFrameDataList=[]}}},{key:"addRenderFrameData",value:function(t,e){if(F.renderStat[0]){for(var i=0;i<this.recvFrameDataList.length;i++)for(;this.recvFrameDataList.length>0&&this.recvFrameDataList[0].pts<t;){var s=e-this.recvFrameDataList[0].time;this.frameRecvToRenderMax=Math.max(s,this.frameRecvToRenderMax),this.frameRecvToRenderConSumingFrames++,this.frameRecvToRenderConSumingTotalTime+=s,this.recvFrameDataList.shift()}for(var r=0;r<this.pushedVideoDataList.length;r++)for(;this.pushedVideoDataList.length>0&&this.pushedVideoDataList[0].pts<t;){var a=e-this.pushedVideoDataList[0].time;this.framePushToRenderedConSumingMax=Math.max(a,this.framePushToRenderedConSumingMax),this.framePushToRenderedConSumingFrames++,this.framePushToRenderedConSumingTotalTime+=a,this.pushedVideoDataList.shift()}}}},{key:"getRecvToPushConsuming",value:function(){return{max:this.frameRecvToPushConSumingMax,avg:this.frameRecvToPushConSumingFrames>0?this.frameRecvToPushConSumingTotalTime/this.frameRecvToPushConSumingFrames:0}}},{key:"getPushToRenderedConSuming",value:function(){return{max:this.framePushToRenderedConSumingMax,avg:this.framePushToRenderedConSumingFrames>0?this.framePushToRenderedConSumingTotalTime/this.framePushToRenderedConSumingFrames:0}}},{key:"getRecvToRenderConsuming",value:function(){return{max:this.frameRecvToRenderMax,avg:this.frameRecvToRenderConSumingFrames>0?this.frameRecvToRenderConSumingTotalTime/this.frameRecvToRenderConSumingFrames:0}}},{key:"_onVisibilityChange",value:function(){this.clearConsuming()}},{key:"destroy",value:function(){this.recvFrameDataList=null,this.remuxFrameDataList=null,this.pushedVideoDataList=null,this.eventEmitter&&this.eventEmitter.off(N.VISIBILITY_CHANGE,this._onVisibilityChangeBind),this.eventEmitter=null,this.mse=null}}]),t}(),e$=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,eZ=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame||window.oCancelAnimationFrame,e0=!1,e1=[],e2=0,e3=null,e5=0,e6=0,e4=0,e8=0;function e9(){e5=e$(e9),function(){var t=g.now();if(e6++,0===e4)e4=t;else{var e=t-e4;if(e>=1e3){e4=t;var i=Math.round(e6/(e/1e3));e6=0,e8=Math.max(i,e8)}}}()}function e7(t,e){for(var i=0,s=e1.length;i<s;i++){var r=e1[i];if(r.callback==t&&r.thisObj==e)return r}return null}function it(t,e,i){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if((i=0|(Number(i)||0))<10||i%10!=0||!t)return I.error("Timer.add Invalide interval value or callback function."),!1;var a=e7(t,e);return a||(a={callback:t,thisObj:e,bindCallback:e?t.bind(e):t,param:s},e1.push(a)),a.times=r,a.tickCount=0,a.interval=i/10,a.delayDel=!1,ie(),!0}function ie(){e3?e3.postMessage("start"):!e2&&e1.length>0&&(e2=setInterval(ii,10))}function ii(){if(0!=e1.length){e0=!0;for(var t=g.now(),e=e1.length-1;e>=0;e--){var i=e1[e];if(i&&!i.delayDel){if(++i.tickCount%i.interval==0){var s=i.bindCallback,r=i.tickCount/i.interval;s(t,r,i.param),i.times>0&&i.times<=r&&i.tickCount>0&&e1.splice(e,1)}}else e1.splice(e,1)}e0=!1}else e3?e3.postMessage("stop"):(clearInterval(e2),e2=0)}var is={initWorker:function(){if(!e3){if(!(e3=th()(25)))return eZ(e5),void(e5=e$(e9));e3.addEventListener("message",function(t){1==t.data.type?ii():2==t.data.type&&(e8=t.data.data)}),e3.addEventListener("error",function(t){I.error("TimerWorker.error:",t.lineno+","+t.colno,t.message),e3.terminate(),e3=null,I.warn("[ TimerWorker terminate ]"),ie()})}},has:function(t,e){return!!e7(t,e)},add:it,remove:function(t,e){for(var i=0,s=e1.length;i<s;i++){var r=e1[i];if(r.callback==t&&r.thisObj==e)return e0?r.delayDel=!0:e1.splice(i,1),!0}return!1}
1,once:function(t,e,i,s){it(t,e,i+10,s,1)},getSize:function(){return e1.length},getPageFpsMax:function(){return e8}},ir=function(){function t(){Object(s.a)(this,t),this.buffer=null,this.view=null,this.size=0,this.pos=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.buffer=null,this.view=null,this.size=0,this.pos=0}},{key:"appendBuffer",value:function(t){t=new Uint8Array(t);var e=new Uint8Array(this.size+t.length);this.buffer&&e.set(this.buffer,0),e.set(t,this.size),this.size=e.byteLength,this.buffer=e,this.view=new DataView(e.buffer)}},{key:"peekString",value:function(t,e){for(var i=this.pos+t,s="",r=0;r<e;r++)s+=String.fromCharCode(this.view.getUint8(i+r));return s}},{key:"peekBuffer",value:function(t,e){return t=this.pos+t,new Uint8Array(this.view.buffer.slice(t,Math.min(t+e,this.size)))}},{key:"peekAnyInt",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=0;if(this.pos+e<=this.size){switch(e){case 1:s=i?this.view.getInt8(this.pos):this.view.getUint8(this.pos);break;case 2:s=i?this.view.getInt16(this.pos):this.view.getUint16(this.pos);break;case 3:if(i)throw"peekAnyInt signed 24 bits values wrong";s=this.view.getUint8(this.pos)<<16|this.view.getUint8(this.pos+1)<<8|this.view.getUint8(this.pos+2);break;case 4:s=i?this.view.getInt32(this.pos):this.view.getUint32(this.pos);break;case 8:if(i)throw"peekAnyInt signed 64 bits values wrong";s=this.view.getUint32(this.pos)*t.MAX_UINT+this.view.getUint32(this.pos+4);break;default:throw"peekAnyInt not implemented for size: "+e}return s}throw"Not enough bytes in buffer"}},{key:"readUint8",value:function(){var t=this.peekAnyInt(1);return this.pos++,t}},{key:"readUint16",value:function(){var t=this.peekAnyInt(2);return this.pos+=2,t}},{key:"readUint24",value:function(){var t=this.peekAnyInt(3);return this.pos+=3,t}},{key:"readUint32",value:function(){var t=this.peekAnyInt(4);return this.pos+=4,t}},{key:"readInt32",value:function(){var t=this.peekAnyInt(4,!0);return this.pos+=4,t}},{key:"readUint64",value:function(){var t=this.peekAnyInt(8);return this.pos+=8,t}},{key:"readStr",value:function(t){var e=this.peekString(0,t);return this.pos+=t,e}},{key:"skip",value:function(t){this.pos+=t}},{key:"getPos",value:function(){return this.pos}},{key:"isCanRead",value:function(t){return this.size-this.pos>=t}}],[{key:"writeUint64",value:function(e,i,s){var r=Math.floor(s/t.MAX_UINT);e.setUint32(i,r),e.setUint32(i+4,0|s)}}]),t}();ir.MAX_UINT=0x100000000;var ia=function(){function t(){Object(s.a)(this,t),this.startOffset=0,this.size=0,this.type=""}return Object(r.a)(t,[{key:"destroy",value:function(){}},{key:"read",value:function(t){this.startOffset=t.getPos(),this.size=t.readUint32(),this.type=t.readStr(4)}},{key:"readContainer",value:function(t){for(var e=this.size+t.getPos()-8;t.getPos()<e;){var i=t.peekString(4,4),s=iR.createBox(i);s.read(t),this.onReadBox(s)}}},{key:"onReadBox",value:function(t){}},{key:"remux",value:function(){return null}},{key:"fillHeader",value:function(t,e,i,s){e.setUint32(0,s),t.set(iR.getCharCode(i),4)}},{key:"getSize",value:function(){return 8}}]),t}(),io=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).major_brand="",t.minor_version=0,t.compatible_brands="",t}return Object(r.a)(i,[{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+4+4+this.compatible_brands.length}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.major_brand=t.readStr(4),this.minor_version=t.readUint32(),this.compatible_brands=t.readStr(this.size-16)}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),i=new DataView(e.buffer);this.fillHeader(e,i,iR.STYP,t);var s=8;return this.fillStr(e,s,this.major_brand),s+=4,i.setUint32(s,this.minor_version),s+=4,this.fillStr(e,s,this.compatible_brands),e}},{key:"fillStr",value:function(t,e,i){for(var s=0;s<i.length;s++)t[e+s]=i.charCodeAt(s)}}]),i}(ia),ih=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).version=0,t.flags=0,t}return Object(r.a)(i,[{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.version=t.readUint8(),this.flags=t.readUint24()}},{key:"fillHeader",value:function(t,e,s,r){Object(n.a)(Object(o.a)(i.prototype),"fillHeader",this).call(this,t,e,s,r),t[8]=this.version,t[9]=this.flags>>16&255,t[10]=this.flags>>8&255,t[11]=255&this.flags}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+4}}]),i}(ia),iu=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).reference_id=0,t.time_scale=0,t.earliest_presentation_time=0,t.first_offset=0,t.reserved=0,t.reference_count=0,t.reference_list=[],t.reference_data=[],t.earliest_presentation_time_offset=0,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.reference_list=[],this.reference_data=[],Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"updateReference",value:function(t){if(this.reference_count>0){var e=t.trun.getRemuxSampleCnt(),i=this.reference_list[0];i.referenced_size=t.trun.getMdatSize(),i.subsegment_duration=e*t.tfhd.default_sample_duration}}},{key:"updateEarliestPresentationTime",value:function(t){var e=t.trun.getRemuxSampleCnt();this.earliest_presentation_time_offset=e*t.tfhd.default_sample_duration}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.reference_id=t.readUint32(),this.time_scale=t.readUint32(),0===this.version?(this.earliest_presentation_time=t.readUint32(),this.first_offset=t.readUint32()):(this.earliest_presentation_time=t.readUint64(),this.first_offset=t.readUint64()),this.reserved=t.readUint16(),this.reference_count=t.readUint16();for(var e=0;e<this.reference_count;e++){var s={},r=t.readUint32();this.reference_data.push(r),s.reference_type=r>>31&1,s.referenced_size=0x7fffffff&r,s.subsegment_duration=t.readUint32(),this.reference_data.push(s.subsegment_duration),r=t.readUint32(),this.reference_data.push(r),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=0xfffffff&r,this.reference_list.push(s)}}},{key:"getSize",value:function(){var t=Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this);return t+=4,t+=4,t+=0===this.version?8:16,t+=2,(t+=2)+12*this.reference_count}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),i=new DataView(e.buffer);this.fillHeader(e,i,iR.SIDX,t);var s=12;i.setUint32(s,this.reference_id),s+=4,i.setUint32(s,this.time_scale),s+=4,0===this.version?(i.setUint32(s,this.earliest_presentation_time+this.earliest_presentation_time_offset),s+=4,i.setUint32(s,this.first_offset),s+=4):(ir.writeUint64(i,s,this.earliest_presentation_time+this.earliest_presentation_time_offset),s+=8,ir.writeUint64(i,s,this.first_offset),s+=8),i.setUint16(s,this.reserved),s+=2,i.setUint16(s,this.reference_count),s+=2;for(var r=0;r<this.reference_data.length;r++)i.setUint32(s,this.reference_data[r]),s+=4;return e}}]),i}(ih),il=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).mfhd=null,t.trafVideo=null,t.trafAudio=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.mfhd.destroy(),this.trafVideo.destroy(),this.trafAudio.destroy(),this.mfhd=null,this.trafVideo=null,this.trafAudio=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t),this.trafVideo&&this.trafAudio&&(this.trafVideo.trun.data_offset>this.trafAudio.trun.data_offset?(this.trafAudio.calcSampleMdatDataOffset(0),this.trafVideo.calcSampleMdatDataOffset(this.trafAudio.getSampleDataSize())):(this.trafVideo.calcSampleMdatDataOffset(0),this.trafAudio.calcSampleMdatDataOffset(this.trafVideo.getSampleDataSize())))}},{key:"onReadBox",value:function(t){t.type===iR.MFHD?this.mfhd=t:t.type===iR.TRAF&&(t.isVideo()?this.trafVideo=t:this.trafAudio=t)}},{key:"readMdat",value:function(t){this.trafVideo&&this.trafVideo.readMdat(t),this.trafAudio&&this.trafAudio.readMdat(t)}},{key:"getSize",value:function(){var t=Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.mfhd.getSize();return this.trafVideo&&(t+=this.trafVideo.getSize()),this.trafAudio&&(t+=this.trafAudio.getSize()),t}},{key:"remux",value:function(){var t=this.mfhd.remux(),e=null;this.trafVideo&&(e=this.trafVideo.remux());var i=null;this.trafAudio&&(i=this.trafAudio.remux());
1var s=this.getSize(),r=new Uint8Array(s),a=new DataView(r.buffer);this.fillHeader(r,a,iR.MOOF,s);var n=8;return r.set(t,n),n+=t.length,e&&(r.set(e,n),n+=e.length),i&&(r.set(i,n),n+=i.length),r}},{key:"updateMdatDataOffset",value:function(){var t=this.getSize();t+=8,this.trafVideo&&this.trafAudio?(this.trafVideo.trun.remux_data_offset=t,this.trafAudio.trun.remux_data_offset=t+this.trafVideo.trun.getMdatSize()):this.trafVideo?this.trafVideo.trun.remux_data_offset=t:this.trafAudio&&(this.trafAudio.trun.remux_data_offset=t)}},{key:"updateBaseMediaDecodeTime",value:function(){this.trafVideo&&this.trafVideo.updateBaseMediaDecodeTime(),this.trafAudio&&this.trafAudio.updateBaseMediaDecodeTime()}}]),i}(ia),id=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).sequence_number=0,t}return Object(r.a)(i,[{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.sequence_number=t.readUint32()}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+4}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),i=new DataView(e.buffer);return this.fillHeader(e,i,iR.MFHD,t),i.setUint32(12,this.sequence_number),e}}]),i}(ih),ic=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).tfhd=null,t.tfdt=null,t.trun=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.tfhd.destroy(),this.tfdt.destroy(),this.trun.destroy(),this.tfhd=null,this.tfdt=null,this.trun=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"isVideo",value:function(){return 1===this.tfhd.track_id}},{key:"getDuration",value:function(){return this.trun.sampleMdatIndex*this.tfhd.default_sample_duration}},{key:"getSampleDataSize",value:function(){return this.trun?this.trun.getSampleDataSize(this.tfhd):0}},{key:"calcSampleMdatDataOffset",value:function(t){this.trun.calcSampleMdatDataOffset(t,this.tfhd)}},{key:"readMdat",value:function(t){this.trun&&this.trun.readMdat(t,this.tfhd)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t)}},{key:"onReadBox",value:function(t){t.type===iR.TFHD?this.tfhd=t:t.type===iR.TFDT?this.tfdt=t:t.type===iR.TRUN&&(this.trun=t)}},{key:"getBound",value:function(){return{start:this.trun.remuxSampleStart,end:this.trun.remuxSampleEnd}}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.tfhd.getSize()+this.tfdt.getSize()+this.trun.getSize()}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),i=new DataView(e.buffer);this.fillHeader(e,i,iR.TRAF,t);var s=this.tfhd.remux(),r=this.tfdt.remux(),a=this.trun.remux(),n=8;return e.set(s,n),n+=s.length,e.set(r,n),n+=r.length,e.set(a,n),n+=a.length,e}},{key:"updateBaseMediaDecodeTime",value:function(){var t=this.trun.getRemuxSampleCnt();this.tfdt.base_media_decode_time_offset=t*this.tfhd.default_sample_duration}}]),i}(ia),ip=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).track_id=0,t.base_data_offset=0,t.sample_description_index=0,t.default_sample_duration=0,t.default_sample_size=0,t.default_sample_flags=0,t}return Object(r.a)(i,[{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.track_id=t.readUint32(),this.flags&i.FLAG_BASE_DATA_OFFSET&&(this.base_data_offset=t.readUint64()),this.flags&i.FLAG_SAMPLE_DESC&&(this.sample_description_index=t.readUint32()),this.flags&i.FLAG_SAMPLE_DUR&&(this.default_sample_duration=t.readUint32()),this.flags&i.FLAG_SAMPLE_SIZE&&(this.default_sample_size=t.readUint32()),this.flags&i.FLAG_SAMPLE_FLAGS&&(this.default_sample_flags=t.readUint32())}},{key:"getSize",value:function(){var t=Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this);return t+=4,this.flags&i.FLAG_BASE_DATA_OFFSET&&(t+=8),this.flags&i.FLAG_SAMPLE_DESC&&(t+=4),this.flags&i.FLAG_SAMPLE_DUR&&(t+=4),this.flags&i.FLAG_SAMPLE_SIZE&&(t+=4),this.flags&i.FLAG_SAMPLE_FLAGS&&(t+=4),t}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),s=new DataView(e.buffer);this.fillHeader(e,s,iR.TFHD,t),s.setUint32(12,this.track_id);var r=16;return this.flags&i.FLAG_BASE_DATA_OFFSET&&(ir.writeUint64(s,r,this.base_data_offset),r+=8),this.flags&i.FLAG_SAMPLE_DESC&&(s.setUint32(r,this.sample_description_index),r+=4),this.flags&i.FLAG_SAMPLE_DUR&&(s.setUint32(r,this.default_sample_duration),r+=4),this.flags&i.FLAG_SAMPLE_SIZE&&(s.setUint32(r,this.default_sample_size),r+=4),this.flags&i.FLAG_SAMPLE_FLAGS&&(s.setUint32(r,this.default_sample_flags),r+=4),e}}]),i}(ih);ip.FLAG_BASE_DATA_OFFSET=1,ip.FLAG_SAMPLE_DESC=2,ip.FLAG_SAMPLE_DUR=8,ip.FLAG_SAMPLE_SIZE=16,ip.FLAG_SAMPLE_FLAGS=32,ip.FLAG_DUR_EMPTY=65536,ip.FLAG_DEFAULT_BASE_IS_MOOF=131072;var im=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).base_media_decode_time=0,t.base_media_decode_time_offset=0,t}return Object(r.a)(i,[{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),1===this.version?this.base_media_decode_time=t.readUint64():this.base_media_decode_time=t.readUint32()}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+(1===this.version?8:4)}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),i=new DataView(e.buffer);return this.fillHeader(e,i,iR.TFDT,t),1===this.version?ir.writeUint64(i,12,this.base_media_decode_time+this.base_media_decode_time_offset):i.setUint32(12,this.base_media_decode_time+this.base_media_decode_time_offset),e}}]),i}(ih),i_=function(){function t(){Object(s.a)(this,t),this.sample_duration=0,this.sample_size=0,this.sample_flags=0,this.sample_composition_time_offset=0,this.dataOffset=0,this.units=null}return Object(r.a)(t,[{key:"destroy",value:function(){this.units=null}}]),t}(),iy=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).sample_count=0,t.data_offset=0,t.first_sample_flags=0,t.samples=[],t.sampleMdatIndex=0,t.sampleMdatSize=0,t.remuxSampleStart=0,t.remuxSampleEnd=0,t.remux_data_offset=0,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.samples.forEac
1h(function(t){t.destroy()}),this.samples=[],Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"createEmptySamples",value:function(t){this.remuxSampleEnd=t;for(var e=0;e<t;e++){var i=this.samples[e];i.units=new Uint8Array(eo.emptyAacFrame),i.sample_size=i.units.length}this.sampleMdatIndex=t}},{key:"readMdat",value:function(t,e){for(;this.sampleMdatIndex<this.sample_count;){var i=this.samples[this.sampleMdatIndex];if(!t.readSample(i,e))break;this.sampleMdatIndex++}}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.sample_count=t.readUint32(),this.flags&i.FLAGS_DATA_OFFSET&&(this.data_offset=t.readUint32()),this.flags&i.FLAGS_FIRST_FLAG&&(this.first_sample_flags=t.readUint32());for(var e=0;e<this.sample_count;e++){var s=new i_(this.flags);this.flags&i.FLAGS_DURATION&&(s.sample_duration=t.readUint32()),this.flags&i.FLAGS_SIZE&&(s.sample_size=t.readUint32()),this.flags&i.FLAGS_FLAGS&&(s.sample_flags=t.readUint32()),this.flags&i.FLAGS_CTS_OFFSET&&(0===this.version?s.sample_composition_time_offset=t.readUint32():s.sample_composition_time_offset=t.readInt32()),this.sampleMdatSize+=s.sample_size,this.samples.push(s)}}},{key:"calcSampleMdatDataOffset",value:function(t,e){for(var i=0;i<this.sample_count;i++){var s=this.samples[i];s.dataOffset=t,0===s.sample_size?t+=e.default_sample_size:t+=s.sample_size}}},{key:"getRemuxSampleCnt",value:function(){return this.remuxSampleEnd-this.remuxSampleStart}},{key:"getSize",value:function(){var t=Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this);return t+=4,this.flags&i.FLAGS_DATA_OFFSET&&(t+=4),this.flags&i.FLAGS_FIRST_FLAG&&(t+=4),t+(this.remuxSampleEnd-this.remuxSampleStart)*this.getSampleSize()}},{key:"getSampleDataSize",value:function(t){for(var e=0,i=0;i<this.sample_count;i++){var s=this.samples[i];0===s.sample_size?e+=t.default_sample_size:e+=s.sample_size}return e}},{key:"getSampleSize",value:function(){var t=0;return this.flags&i.FLAGS_DURATION&&(t+=4),this.flags&i.FLAGS_SIZE&&(t+=4),this.flags&i.FLAGS_FLAGS&&(t+=4),this.flags&i.FLAGS_CTS_OFFSET&&(t+=4),t}},{key:"getMdatSize",value:function(){for(var t=0,e=this.remuxSampleStart;e<this.remuxSampleEnd;e++)t+=this.samples[e].units.length;return t}},{key:"getMdat",value:function(){for(var t=this.getMdatSize(),e=0,i=new Uint8Array(t),s=this.remuxSampleStart;s<this.remuxSampleEnd;s++){var r=this.samples[s];i.set(r.units,e),e+=r.units.length}return i}},{key:"remux",value:function(){var t=this.getSize(),e=new Uint8Array(t),s=new DataView(e.buffer);this.fillHeader(e,s,iR.TRUN,t),s.setUint32(12,this.remuxSampleEnd-this.remuxSampleStart);var r=16;this.flags&i.FLAGS_DATA_OFFSET&&(s.setUint32(r,this.remux_data_offset),r+=4),this.flags&i.FLAGS_FIRST_FLAG&&(s.setUint32(r,this.first_sample_flags),r+=4);for(var a=this.remuxSampleStart;a<this.remuxSampleEnd;a++){var n=this.samples[a];this.flags&i.FLAGS_DURATION&&(s.setUint32(r,n.sample_duration),r+=4),this.flags&i.FLAGS_SIZE&&(s.setUint32(r,n.sample_size),r+=4),this.flags&i.FLAGS_FLAGS&&(s.setUint32(r,n.sample_flags),r+=4),this.flags&i.FLAGS_CTS_OFFSET&&(0===this.version?s.setUint32(r,n.sample_composition_time_offset):s.setInt32(r,n.sample_composition_time_offset),r+=4)}return e}}]),i}(ih);iy.FLAGS_DATA_OFFSET=1,iy.FLAGS_FIRST_FLAG=4,iy.FLAGS_DURATION=256,iy.FLAGS_SIZE=512,iy.FLAGS_FLAGS=1024,iy.FLAGS_CTS_OFFSET=2048;var iv=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this)).data_len=0,r.data_size=t-8,r.data=new Uint8Array(r.data_size),r}return Object(r.a)(i,[{key:"isRecvFull",value:function(){return this.data_len>=this.data_size}},{key:"destroy",value:function(){this.data=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),t.skip(this.data_size)}},{key:"appendData",value:function(t){var e=t.peekBuffer(8,this.data_size);this.data_len=e.length,this.data.set(e,0)}},{key:"readSample",value:function(t,e){var i=t.sample_size;return 0===i&&(i=e.default_sample_size),this.data_len-t.dataOffset>=i&&(t.units=this.data.slice(t.dataOffset,t.dataOffset+i),!0)}},{key:"remux",value:function(){var t=8+this.data_len,e=new Uint8Array(t),i=new DataView(e.buffer);return this.fillHeader(e,i,iR.MDAT,t),e.set(this.data,8),e}}]),i}(ia),iS=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){return Object(s.a)(this,i),e.call(this)}return Object(r.a)(i,[{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),t.skip(this.size-8)}}]),i}(ia),ig=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).mvhd=null,t.videoTrack=null,t.audioTrack=null,t.mvex=null,t.udta=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.mvhd.destroy(),this.mvhd=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t)}},{key:"onReadBox",value:function(t){t.type===iR.MVHD?this.mvhd=t:t.type===iR.TRAK?t.isVideo()?this.videoTrack=t:this.audioTrack=t:t.type===iR.MVEX?this.mvex=t:t.type===iR.UDTA&&(this.udta=t)}},{key:"readMdat",value:function(t){this.trafVideo&&this.trafVideo.readMdat(t),this.trafAudio&&this.trafAudio.readMdat(t)}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.mvhd.getSize()+this.videoTrack.getSize()+this.audioTrack.getSize()+this.mvex.getSize()+this.udta.getSize()}}]),i}(ia),iT=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).tkhd=null,t.edts=null,t.mdia=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.tkhd.destroy(),this.edts.destroy(),this.mdia.destroy(),this.tkhd=null,this.edts=null,this.mdia=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"isVideo",value:function(){return 1===this.tkhd.track_id}},{key:"readMdat",value:function(t){this.trun&&this.trun.readMdat(t,this.tfhd)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t)}},{key:"onReadBox",value:function(t){t.type===iR.TKHD?this.tkhd=t:t.type===iR.EDTS?this.edts=t:t.type===iR.MDIA&&(this.mdia=t)}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.tkhd.getSize()+this.edts.getSize()+this.mdia.getSize()}}]),i}(ia),iP=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).track_id=0,t}return Object(r.a)(i,[{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),t.readUint32(),t.readUint32(),this.track_id=t.readUint32(),t.skip(this.size-12-12)}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.size}}]),i}(ih),iC=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).mdhd=null,t.hdlr=null,t.minf=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.mdhd.destroy(),this.hdlr.destroy(),this.minf.destroy(),this.mdhd=null,this.hdlr=null,this.minf=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"readMdat",value:function(t){this.trun&&this.trun.readMdat(t,this.tfhd)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t)}},{key:"onReadBox",value:function(t){t.type===iR.MDHD?this.mdhd=t:t.HDLR===iR.HDLR?this.hdlr=t:t.type===iR.MINF&&(this.minf=t)}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.mdhd.getSize()+this.hdlr.getSize()+this.minf.getSize()}}]),i}(ia),iE=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).vmhd=null,t.dinf=null,t.stbl=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.vmhd.destroy(),this.dinf.destroy(),this.stbl.destroy(),this.vmhd=null,this.dinf=null,this.stbl=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"readMdat",value:function(t){this.trun&&this.trun.readMdat(t,this.tfhd)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t)}},{key:"onReadBox",value:function(t){t.type===iR.VMHD?this.vmhd=t:t.type===iR.DINF?this.dinf=t:t.type===iR.STBL&&(this.stbl=t)}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.vmhd.getSize()+this.dinf.getSize()+this.minf.getSize()}}]),i}(ia),iI=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).stsd=null,t.stts=null,t.stsc=null,t.stsz=null,t.stco=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.stsd.destroy(),this.stts.destroy(),this.stsc.destroy(),this.stsz.destroy(),this.stco.destroy(),this.stsd=null,this.stts=null,this.stsc=null,this.stsz=null,this.stco=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"readMdat",value:function(t){this.trun&&this.trun.readMdat(t,this.tfhd)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),this.readContainer(t)}},{key:"onReadBox",value:function(t){t.type===iR.STSD?this.stsd=t:t.type===iR.STTS?this.stts=t:t.type===iR.STSC?this.stsc=t:t.type===iR.STSZ?this.stsz=t:t.type===iR.STCO&&(this.stco=t)}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.stsd.getSize()+this.stts.getSize()+this.stsc.getSize()+this.stsz.getSize()}}]),i}(ia),ik=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).headerBox=null,t.headerProps=null,t}return Object(r.a)(i,[{key:"destroy",value:function(){this.headerBox.destroy(),this.headerBox=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"read",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"read",this).call(this,t),t.readUint32(),t.readUint32();var e=t.readStr(4);if("av01"==e){t.skip(6),t.skip(2),t.skip(2),t.skip(2),t.skip(12);var s=t.readUint16(),r=t.readUint16();t.readUint32(),t.readUint32(),t.skip(4),t.readUint16(),t.readStr(32),t.readUint16(),t.skip(2);var a=t.readUint32(),u=(t.readStr(4),t.readUint8()),l=(u=t.readUint8())>>5&7,d=31&u,c=(u=t.readUint8())>>7&1,f=u>>6&1,p=u>>5&1;if(0!=((u=t.readUint8())>>5&7))return void console.error("av1C reserved_1 parsing problem");if(1==(u>>4&1));else if(0!=(15&u))return;var m,_=t.buffer.slice(t.pos-4,t.pos+(a-12)),y=d;y<10&&(y="0"+y),2===l&&1===f?m=1===p?"12":"10":l<=2&&(m=1===f?"10":"08");var v=e+"."+l+"."+y+(c?"H":"M")+"."+m;this.headerProps={type:e,width:s,height:r,codec:v,configOBUs:_},t.skip(this.size-12-4-86-12)}else if("mp4a"==e){t.skip(6),t.skip(2),t.skip(8);var S=t.readUint16(),g=t.readUint16();t.skip(2),t.skip(2);var T=t.readUint32()/65536;
1t.skip(this.size-12-4-36),this.headerProps={type:e,channel_count:S,samplesize:g,samplerate:T}}}},{key:"getSize",value:function(){return Object(n.a)(Object(o.a)(i.prototype),"getSize",this).call(this)+this.size}}]),i}(ih),iA=new Map,iR={STYP:"styp",SIDX:"sidx",MOOF:"moof",MFHD:"mfhd",TRAF:"traf",TFHD:"tfhd",TFDT:"tfdt",TRUN:"trun",MDAT:"mdat",MOOV:"moov",MVHD:"mvhd",TRAK:"trak",TKHD:"tkhd",EDTS:"edts",MDIA:"mdia",MDHD:"mdhd",HDLR:"hdlr",MINF:"minf",VMHD:"vmhd",DINF:"dinf",STBL:"stbl",STSD:"stsd",STTS:"stts",STSC:"stsc",STSZ:"stsz",STCO:"stco",AV01:"av01",MVEX:"mvex",UDTA:"udta",createBox:function(t){return 0===iA.size&&(iA.set(this.STYP,io),iA.set(this.SIDX,iu),iA.set(this.MOOF,il),iA.set(this.MFHD,id),iA.set(this.TRAF,ic),iA.set(this.TFHD,ip),iA.set(this.TFDT,im),iA.set(this.TRUN,iy),iA.set(this.MDAT,iv),iA.set(this.MOOV,ig),iA.set(this.TRAK,iT),iA.set(this.TKHD,iP),iA.set(this.MDIA,iC),iA.set(this.MINF,iE),iA.set(this.STBL,iI),iA.set(this.STSD,ik)),new(iA.get(t)||iS)},getCharCode:function(t){for(var e=[],i=0;i<t.length;i++)e.push(t.charCodeAt(i));return e}},iD=function(){function t(e){Object(s.a)(this,t),this.buffer=new ir,this.styp=null,this.sidxVideo=null,this.sidxAudio=null,this.moof=null,this.mdat=null,this.moov=null,this.step=0,this.type=e}return Object(r.a)(t,[{key:"destroy",value:function(){this.buffer&&this.buffer.destroy(),this.styp&&this.styp.destroy(),this.sidxVideo&&this.sidxVideo.destroy(),this.sidxAudio&&this.sidxAudio.destroy(),this.moof&&this.moof.destroy(),this.mdat&&this.mdat.destroy()}},{key:"getVideoFps",value:function(){if(!this.hasMedia()||!this.hasVideo())return 0;var t=this.moof.trafVideo.trun.sample_count;return Math.ceil(t/(t*this.moof.trafVideo.tfhd.default_sample_duration/this.sidxVideo.time_scale))}},{key:"getBoundAV",value:function(){var t={video:{start:-1,end:-1},audio:{start:-1,end:-1}};return this.moof&&(this.moof.trafVideo&&(t.video=this.moof.trafVideo.getBound()),this.moof.trafAudio&&(t.audio=this.moof.trafAudio.getBound())),t}}
1,{key:"hasMedia",value:function(){return this.moof}},{key:"hasVideo",value:function(){return this.sidxVideo}},{key:"hasAudio",value:function(){return this.sidxAudio}},{key:"isRecvFull",value:function(){return this.mdat&&this.mdat.isRecvFull()}},{key:"setFullRemux",value:function(){this.moof&&(this.sidxVideo&&this.moof.trafVideo&&(this.moof.trafVideo.trun.remuxSampleStart=0,this.moof.trafVideo.trun.remuxSampleEnd=this.moof.trafVideo.trun.sample_count,this.sidxVideo.earliest_presentation_time_offset=0,this.moof.trafVideo.tfdt.base_media_decode_time_offset=0),this.sidxAudio&&this.moof.trafAudio&&(this.moof.trafAudio.trun.remuxSampleStart=0,this.moof.trafAudio.trun.remuxSampleEnd=this.moof.trafAudio.trun.sample_count,this.sidxAudio.earliest_presentation_time_offset=0,this.moof.trafAudio.tfdt.base_media_decode_time_offset=0))}},{key:"setRemuxAll",value:function(){this.moof&&(this.moof.trafVideo&&(this.moof.trafVideo.trun.remuxSampleStart=this.moof.trafVideo.trun.remuxSampleEnd,this.moof.trafVideo.trun.remuxSampleEnd=this.moof.trafVideo.trun.sample_count),this.moof.trafAudio&&(this.moof.trafAudio.trun.remuxSampleStart=this.moof.trafAudio.trun.remuxSampleEnd,this.moof.trafAudio.trun.remuxSampleEnd=this.moof.trafAudio.trun.sample_count))}},{key:"isCanSecOpen",value:function(t){if(this.moof&&this.sidxVideo&&this.moof.trafVideo){var e=1e3*this.moof.trafVideo.getDuration()/this.sidxVideo.time_scale;if(e>=t){if(this.moof.trafVideo.trun.remuxSampleEnd=this.moof.trafVideo.trun.sampleMdatIndex,this.sidxAudio&&this.moof.trafAudio){var i=Math.ceil(e*this.sidxAudio.time_scale/1e3/this.moof.trafAudio.tfhd.default_sample_duration);i=Math.min(i,this.moof.trafAudio.trun.sample_count),this.moof.trafAudio.trun.createEmptySamples(i)}return!0}}return!1}},{key:"appendBuffer",value:function(t){this.buffer.appendBuffer(t),this.parse()}},{key:"parse",value:function(){for(;this.buffer.isCanRead(8);){var t=this.buffer.peekAnyInt(4),e=this.buffer.peekString(4,4);if(e===iR.MDAT){if(this.mdat||(this.mdat=new iv(t)),this.mdat.appendData(this.buffer),this.moof&&this.moof.readMdat(this.mdat),!this.buffer.isCanRead(t))break;this.mdat.read(this.buffer)}else{if(!this.buffer.isCanRead(t))break;var i=iR.createBox(e);i.read(this.buffer),e===iR.STYP?this.styp=i:e===iR.SIDX?1===i.reference_id?this.sidxVideo=i:this.sidxAudio=i:e===iR.MOOF?this.moof=i:e===iR.MOOV&&(this.moov=i)}}}},{key:"remux",value:function(){this.moof.updateMdatDataOffset();var t=this.styp.remux(),e=null,i=null;this.sidxVideo&&this.moof.trafVideo&&(this.sidxVideo.updateReference(this.moof.trafVideo),e=this.sidxVideo.remux()),this.sidxAudio&&this.moof.trafAudio&&(this.sidxAudio.updateReference(this.moof.trafAudio),i=this.sidxAudio.remux());var s=this.moof.remux(),r=null;this.moof.trafVideo&&(r=this.moof.trafVideo.trun.getMdat());var a=null;this.moof.trafAudio&&(a=this.moof.trafAudio.trun.getMdat());var n=8;r&&(n+=r.length),a&&(n+=a.length);var o=t.length+n+s.length;e&&(o+=e.length),i&&(o+=i.length);var u=new Uint8Array(o),l=0;return u.set(t,l),l+=t.length,i&&(u.set(i,l),l+=i.length),e&&(u.set(e,l),l+=e.length),u.set(s,l),u[l+=s.length]=n>>24&255,u[l+1]=n>>16&255,u[l+2]=n>>8&255,u[l+3]=255&n,l+=4,u.set(iR.getCharCode(iR.MDAT),l),l+=4,r&&(u.set(r,l),l+=r.length),a&&u.set(a,l),this.sidxVideo&&this.moof.trafVideo&&this.sidxVideo.updateEarliestPresentationTime(this.moof.trafVideo),this.sidxAudio&&this.moof.trafAudio&&this.sidxAudio.updateEarliestPresentationTime(this.moof.trafAudio),this.moof.updateBaseMediaDecodeTime(),u}}]),t}(),iO=function(){function t(e){Object(s.a)(this,t),this.mse=e,this.mediaSource=null,this.buffer=null,this.segments=[],this.initSegment=null,this.initUrl="",this.config=null,this.initPhase=0,this.initLoader=null,this.onUpdateendBind=this.onUpdateend.bind(this),this.onErrorBind=this.onError.bind(this),this.loadOpenBind=this.loadOpen.bind(this),this.loadChunkBind=this.loadChunk.bind(this),this.loadSuccessBind=this.loadSuccess.bind(this),this.loadErrorBind=this.loadError.bind(this),this.loadTimeoutBind=this.loadTimeout.bind(this),this.onInitOpenCb=null,this.onInitCallback=null,this.onFirstBufCb=null,this.mp4=null,this.firstPlay=!0,this.checkCurrentTime=!1,this.initMp4=null}return Object(r.a)(t,[{key:"reset",value:function(){I.log("Av1Player.reset"),this.buffer&&(this.buffer.removeEventListener("updateend",this.onUpdateendBind),this.buffer.removeEventListener("error",this.onErrorBind),this.buffer=null),this.initLoader&&this.initLoader.abort(),this.onInitOpenCb=null,this.onInitCallback=null,this.mediaSource=null,this.segments=[]}},{key:"destroy",value:function(){I.log("Av1Player.destroy"),this.reset(),this.initSegment=null,this.initPhase=0,this.tryCnt=5,this.initUrl="",this.config=null,this.mse=null,this.onFirstBufCb=null}},{key:"isPlaying",value:function(){return null!=this.buffer}},{key:"isInitLoaded",value:function(){return 2===this.initPhase}},{key:"initError",value:function(){3!==this.initPhase&&(this.initPhase=3,this.onError({message:"load init.mp4=404"}))}}
1,{key:"loadInit",value:function(t,e,i){var s=i.initCb,r=i.openCb;if(0===this.initPhase){I.log("M4sPlayer.loadInit"),this.initPhase=1,this.initUrl=t,this.config=e,this.onInitCallback=s,this.onInitOpenCb=r;var a=new Z(e);this.initLoader=a,a.loadBuffer(t,this.loadOpenBind,this.loadChunkBind,this.loadSuccessBind,this.loadErrorBind,this.loadTimeoutBind,2e3,e.fragLoadingMaxRetry,e.fragLoadingRetryDelay)}}},{key:"loadOpen",value:function(t){this.onInitOpenCb&&(this.onInitOpenCb(),this.onInitOpenCb=null)}},{key:"loadChunk",value:function(t){}},{key:"loadSuccess",value:function(t){this.initMp4=new iD(2),I.log("M4sPlayer.loadSuccess init"),this.initPhase=2,this.initSegment=t,this._initCodecs(),this._appendInit(),this.onInitCallback&&(this.onInitCallback(),this.onInitCallback=null),this.initMp4.appendBuffer(t),console.log("initMp4",this.initMp4);var e=this.initMp4.moov.videoTrack.mdia.minf.stbl.stsd.headerProps,i=this.initMp4.moov.audioTrack.mdia.minf.stbl.stsd.headerProps;this.mse.initSegmentSuc(e,i)}},{key:"loadError",value:function(t){t.code,t.currentTarget,t.msg,this.initError()}},{key:"loadTimeout",value:function(t){this.initError()}},{key:"onMediaSourceOpen",value:function(t){this.mediaSource=t,this._initCodecs(),this._appendInit()}},{key:"createMp4",value:function(){this.mp4&&(this.mp4.destroy(),this.mp4=null),this.mp4=new iD(1)}},{key:"appendSegment",value:function(t,e){var i=this.mp4;if(i.appendBuffer(t),this.mse.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS)i.isRecvFull()&&this.mse.remuxAv1(i,e);else{var s=!1;if(this.firstPlay?i.isCanSecOpen(200)&&(i.step=1,this.firstPlay=!1,s=!0):i.isRecvFull()&&(1==i.step&&(i.step=2),s=!0,i.setFullRemux()),s){var r=i.getBoundAV();I.log("M4sPlayer.appendSegment video=[".concat(r.video.start,", ").concat(r.video.end,"] audio=[").concat(r.audio.start,", ").concat(r.audio.end,"]")),t=i.remux(),this.segments.push({segment:t,step:i.step}),this._appendBuffer()}}}},{key:"_appendInit",value:function(){this.initSegment&&this.buffer&&this.buffer.appendBuffer(this.initSegment)}},{key:"_appendBuffer",value:function(){if(this.initSegment&&this.segments.length>0&&this.buffer&&!this.buffer.updating){this.onFirstBufCb&&this.onFirstBufCb();var t=this.segments.shift(),e=t.segment;this.checkCurrentTime=2===t.step,this.buffer.appendBuffer(e)}}},{key:"_initCodecs",value:function(){!this.buffer&&this.mediaSource&&2===this.initPhase&&(I.log("M4sPlayer._initCodecs"),this.buffer=this.mediaSource.addSourceBuffer("video/mp4;codecs=".concat(A.AV01)),this.buffer.addEventListener("updateend",this.onUpdateendBind),this.buffer.addEventListener("error",this.onErrorBind))}},{key:"onUpdateend",value:function(){this.mse.checkSeek(),this.checkCurrentTime&&(I.log("M4sPlayer.onUpdateend checkCurrentTime"),this.checkCurrentTime=!1,this.mse.checkCurrentTime()),this._appendBuffer()}},{key:"onError",value:function(t){I.log("M4sPlayer.onError ".concat(t.message)),this.mse&&this.mse.onM4sError()}},{key:"hasVideo",value:function(){return!!this.buffer}}]),t}(),ib=function(){function t(e){Object(s.a)(this,t),this.seiList=[],this.player=e,this.lastTs=-1,this.internal=10,this.timerStart=!1,this.timer=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.seiList=null,this.player=null,clearTimeout(this.timer)}},{key:"add",value:function(t,e,i,s){var r=this.seiList.length;if(this.seiList.length>0)for(r=this.seiList.length-1;r>0&&!(t>this.seiList[r].timeStamp);r--);this.seiList.splice(r+1,0,{timeStamp:t,data:i,port:e}),this.timerStart||(this.timerStart=!0,clearTimeout(this.timer),this.timer=setTimeout(this.checkDispatchSei.bind(this),this.internal))}},{key:"checkDispatchSei",value:function(){if(this.timerStart){var t=this.player.getCurrentRealTime(),e=-1;if(this.seiList.length>0)for(var i=0;i<this.seiList.length&&t>this.seiList[i].timeStamp;i++)e=i;if(e>=0){var s=this.seiList[e];this.player.onSeiDataChannel(this.seiList[e].port,this.seiList[e]),this.seiList.splice(0,e+1),I.log("ts=".concat(t,",port=").concat(s.port,",content=").concat(s.content,",data=").concat(s.data,", list=").concat(this.seiList))}this.seiList.length>0?this.timer=setTimeout(this.checkDispatchSei.bind(this),this.internal):this.timerStart=!1}}},{key:"reset",value:function(){this.seiList=[],this.player=null,this.lastTs=-1,this.timerStart=!1}}]),t}(),iw=0,iL=function(){function t(e,i,r){Object(s.a)(this,t),this._num_=++iw,I.log("[mse-".concat(this._num_,"] MSEPlayer constructor"));var a=i.videoType,n=i.isLive,o=i.isPureAudio,u=i.isPureVideo,l=i.isH265Mode,d=i.videoElement;this.videoElement=void 0===d?null:d,this.isH265Mode=l,this.handler=e,this.videoType=void 0===a?"flv":a,this.isLive=void 0===n||n,this.isPureAudio=void 0!==o&&o,this.isPureVideo=void 0!==u&&u,this.parser=null,this.metadata={},this.bufStat=new eD,this.pauseStat=new eO(this),this.pausePerf=new eL,this.buffered=new eU,this.buffered.setMse(this),this.h264SeiInfos=new ex(this),this.seiDataChannelInfos=new ib(this),this.scriptVolumeInfos=new eH(this),this.onVideoResizeBind=this.onVideoResize.bind(this),this.pid=0,this.bitrate=0,this.JITTER_BUFMIN=1e3,this.JITTER_BUFLEN=4e3,this.JITTER_BUFMAX=8e3,this.webcodecType=r,this.width=1280,this.height=720,this.widthCfg=1280,this.heightCfg=720,this.realtimeWidth=0,this.realtimeHeight=0,this.pushVideoStartRenderTime=0,this.mediaElement=null,this.hasRemuxed=!1,this.m4sPlayer=new iO(this),this.remuxer=new en(this),this.avSyncStat=new eJ,this.ctrlBuffer=new ez({bufferSize:0,popDuration:Number(F.popDuration)||200,timescale:this.remuxer.timescale,isPureAudio:this.isPureAudio,isPureVideo:this.isPureVideo,webcodecType:this.webcodecType},this._remux.bind(this),this),this.renderFps=new eQ(this),this.onPageRenderCbkId=0,this.onPageRenderCbkBind=this.onPageRenderCbk.bind(this),window.requestAnimationFrame&&F.renderStat[0]&&(this.onPageRenderCbkId=window.requestAnimationFrame(this.onPageRenderCbkBind)),this.videoPlayConsuming=new eX(this),this.audioPlayConsuming=new eX(this),this.audioConfig=null,this.perfBlockCnt=0,this.remuxVideoCnt=0,this.audioEmptyDuration=0,this.audioEmptyList4Sec=[],this.lastSecNow=g.now(),this.isNoAudio=!0,is.add(this.onCheckFastWorkerTimer,this,100),this.shildAudioStartTs=0,this.isShieldAudio=!1,this.isRevFastOver=!1,this.videoCallBackLargeCnt=0,this.isOnFragParsed=!1,this.onFragParsedTime=0,this.audioSampleNums=0,this.videoSampleNums=0,this.isOnEnded=!1,this.waitEndOfStream=!1,"visible"==document.visibilityState?this.initTime=g.now():this.initTime=0,this.checkScreenTs=0,this.singleColorCnt=0,this.isSingleErr=!1,this.isSingleTest=!1,this.canvas=null,this.context=null,this.isPlayVideo=!1,this.isMuffeled=!1,this.muffleTs=0,this.muffleDuration=0,this.muffleCnt=0,this.videoFirstFrameDecodeCost=0,this.autoMutedPlay=!1,this.userPaused=!1,this.browserStatus=null}return Object(r.a)(t,[{key:"setSeiDataChannelPortListers",value:function(t){this.seiDataChannl=t}},{key:"setAutoMutedPlay",value:function(t){this.autoMutedPlay=t}},{key:"onAudioAnalyserInit",value:function(t){this.handler&&this.handler.onAudioAnalyserInit&&this.handler.onAudioAnalyserInit(t)}},{key:"endOfStream",value:function(){}},{key:"onVisibilitychange",value:function(){I.log("[mse-".concat(this._num_,"] BaseController.onVisibilitychange"),document.visibilityState),"visible"==document.visibilityState?this.initTime=g.now():(this.initTime=0,this.singleColorCnt=0)}},{key:"printAVInfos",value:function(){this.parser&&(this.parser.printVideoInfo&&this.parser.printVideoInfo(),this.parser.printAudioInfo&&this.parser.printAudioInfo())}},{key:"getTsInfo",value:function(){var t,e;return null==(t=this.parser)||null==(e=t.getTsInfo)?void 0:e.call(t)}},{key:"resetTsInfo",value:function(){var t,e;null==(t=this.parser)||null==(e=t.resetTsInfo)||e.call(t)}},{key:"resetHls",value:function(){this.parser.reset&&this.parser.reset(),this.remuxer.reset(),this.remuxer.resetInitDts&&this.remuxer.resetInitDts()}},{key:"onFastOver",value:function(){}},{key:"setParams",value:function(t,e){if(this.pid=t,this.bitrate=e,this._initPerf(),this.parser.dropFrameDts){var i=!1;(1===F.dropFrameUids[0]||-1!==F.dropFrameUids.indexOf(parseInt(t)))&&(i=!0),this.parser.dropFrameDts.open=i}this.parser.dropFrameDts.start()}},{key:"_initPerf",value:function(){"ts"!==this.videoType&&this.pausePerf.checkLocal(this.pid,this.bitrate)&&this.parser.dropFrameCtrl.start()}},{key:"getDelayStat",value:function(){return"ts"!==this.videoType?this.parser.sei.getStat():null}},{key:"onRestart",value:function(){I.log("[mse-".concat(this._num_,"] BaseController.onRestart")),this.reset()}},{key:"onVideoParseInvalid",value:function(){this.handler&&this.handler.onVideoParseInvalid&&this.handler.onVideoParseInvalid()}},{key:"onGop",value:function(t){this.handler.onGop&&this.handler.onGop(t),t>this.maxGop&&(this.maxGop=t,I.log("[mse-".concat(this._num_,"] BaseController.onGop update maxGop=")+this.maxGop))}},{key:"onCheckTimer",value:function(t,e){this.parser&&this.parser.fps&&(this.metadata.fps=this.parser.fps.getFps(),this.metadata.recvVideoFps=this.parser.fps.getRecvFps()),this.parser&&this.parser.audioFps&&(this.metadata.audioFps=this.parser.audioFps.getFps(),this.metadata.recvAudioFps=this.parser.audioFps.getRecvFps())}},{key:"onCheckFastTimer",value:function(t,e){1===Number(F.isMute)&&this.muffledVoice(),this._getEmptyAudioDuration(t)}},{key:"getCodecType",value:function(){return this.m4sPlayer.isInitLoaded()?"av1":this.getControllerCodecType()}},{key:"reset",value:function(){this.m4sPlayer.reset()}},{key:"onEnded",value:function(){this.isOnEnded=!0}},{key:"onCheckFastWorkerTimer",value:function(){this.checkSolidColor()}},{key:"destroy",value:function(){window.cancelAnimationFrame&&this.onPageRenderCbkId>0&&(window.cancelAnimationFrame(this.onPageRenderCbkId),this.onPageRenderCbkId=0),is.remove(this.onCheckFastWorkerTimer,this),this.buffered&&(this.buffered.destroy(),this.buffered=null),this.bufStat=null,this.pausePerf&&(this.pausePerf.destroy(),this.pausePerf=null),this.pauseStat&&(this.pauseStat.destroy(),this.pauseStat=null),this.metadata=null,this.remuxer&&(this.remuxer.destroy(),this.remuxer=null),this.ctrlBuffer&&(this.ctrlBuffer.destroy(),this.ctrlBuffer=null),this.m4sPlayer&&(this.m4sPlayer.destroy(),this.m4sPlayer=null),this.h264SeiInfos&&this.h264SeiInfos.destroy(),this.h264SeiInfos=null,this.seiDataChannelInfos&&this.seiDataChannelInfos.destroy(),this.seiDataChannelInfos=null,this.scriptVolumeInfos&&this.scriptVolumeInfos.destroy(),this.scriptVolumeInfos=null,this.avSyncStat=null,this.bufStat=null,this.hasRemuxed=!1,this.resetPerfBlockCnt(),this.renderFps&&(this.renderFps.reset(),this.renderFps=null),this.audioEmptyList4Sec=null,this.isNoAudio=!0,this.shildAudioStartTs=0,this.isShieldAudio=!1,this.videoPlayConsuming&&this.videoPlayConsuming.destroy(),this.videoPlayConsuming=null,this.audioPlayConsuming&&this.audioPlayConsuming.destroy(),this.audioPlayConsuming=null,this.pushVideoStartRenderTime=0,this.initTime=0,this.checkScreenTs=0,this.singleColorCnt=0,this.isSingleErr=!1,this.isSingleTest=!1,this.canvas=null,this.context=null,this.isPlayVideo=!1,this.isMuffeled=!1,this.muffleTs=0,this.muffleDuration=0,this.muffleCnt=0,this.seiDataChannl=null}},{key:"getControllerCodecType",value:function(){return this.parser.getCodecType()}},{key:"setPushGop",value:function(t){this.parser.setPushGop(t)}},{key:"saveH264SeiData",value:function(t,e){this.h264SeiInfos.add(t,e)}}
1,{key:"saveSeiDataChannel",value:function(t,e,i,s){this.seiDataChannelInfos.add(t,e,i,s)}},{key:"saveSeiInfo",value:function(t,e,i){1===Number(D._printSeiInfo)&&I.log("[mse-".concat(this._num_,"] BaseController.saveSeiInfo, timestamp=").concat(t,", type=").concat(i)),this.handler&&this.handler.eventEmitter.trigger(N.SEI_INFO,{timestamp:t,data:e})}},{key:"setPlaybackrateAccess",value:function(t){this.playbackrateChangeAccess=t}},{key:"getDelayInfo",value:function(){return I.log("[mse-".concat(this._num_,"] MSEPlayer.getDelayInfo: delay: "),this.mediaDelay),this.mediaDelay}},{key:"setSeiDelay",value:function(t){if(this.seiAnchorDelay!==t||!this.mediaDelay){var e=this.getBufferLen();this.isShieldAudio&&(e+=this.getFrameBufferLen()),this.seiAnchorDelay=t,this.mediaDelay={total_delay:this.seiAnchorDelay+e,buffer_delay:e,status:0},0===this.seiAnchorDelay&&(this.mediaDelay.status=1)}}},{key:"getRealFps",value:function(){return this.parser.getRealFps?this.parser.getRealFps():0}},{key:"getIsDownEnough",value:function(){return!this.parser.isDownEnough||this.parser.isDownEnough()}},{key:"getRealBitrate",value:function(){var t=0;return this.parser.fps&&(t=this.parser.fps.getRealBitrate()),t}},{key:"setDeleteH264Aud",value:function(t){this.parser.setDeleteH264Aud(t)}},{key:"setNeedEmptyAudioFrame",value:function(t){this.ctrlBuffer.setNeedEmptyAudioFrame(t),I.log("[mse-".concat(this._num_,"] FlvParser.setNeedEmptyAudioFrame ")+t)}},{key:"setJitter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;this.JITTER_BUFLEN=t,this.JITTER_BUFMIN=e,this.JITTER_BUFMAX=i,I.info("[mse-".concat(this._num_,"] BaseController.setJitter bufMin=").concat(e," bufLen=").concat(t," bufMax=").concat(i))}},{key:"setResolution",value:function(t,e){I.log("[mse-".concat(this._num_,"] BaseController(").concat(this._num_,").setResolution w/h=")+t+"/"+e),this.width&&this.height&&(this.width!==t||this.height!==e)&&this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.VIDEO_RESOLUTION_CHANGE),this.width=t,this.height=e}},{key:"getWidth",value:function(){return this.width}},{key:"getHeight",value:function(){return this.height}},{key:"setExceptionStat",value:function(t,e){this.handler&&this.handler.exceptionStat&&this.handler.exceptionStat.setStat(t,e)}},{key:"cacheBlockReason",value:function(t,e){this.handler&&this.handler.cacheBlockReason&&this.handler.cacheBlockReason(t,e)}},{key:"getPlayStat",value:function(){return this.parser.getPlayStat()}},{key:"getCaptureStats",value:function(t){return this.parser&&this.parser.vCaptureJitterStat?{video:this.parser.vCaptureJitterStat.getStats(t),audio:this.parser.aCaptureJitterStat.getStats(t)}:null}},{key:"getPlayVideo",value:function(){return this.video?this.video.video:null}},{key:"getFrameReadyed",value:function(){return this.ctrlBuffer.getSize()}},{key:"getFramePlayDelays",value:function(){return this.parser.getCalculateVideoFramePlayDelay?this.parser.getCalculateVideoFramePlayDelay():0}},{key:"getVideoDecodeDelaySmooth",value:function(){return 0}},{key:"getCtsMax",value:function(){var t;return(null==(t=this.parser)?void 0:t.ctsMax)||300}},{key:"getFrameBufferLen",value:function(){return this.ctrlBuffer.getBufferLen()}},{key:"getContinueBuffer",value:function(){return this.buffered.continueBuffer}},{key:"getVideoContinueBuffer",value:function(){return this.buffered.getVideoContinueBuffer()}},{key:"getParserBufLen",value:function(){return this.ctrlBuffer.getBufferLen()}},{key:"setSensitivePause",value:function(t){this.sensitivePause=t}},{key:"getInitDts",value:function(){return void 0===this.remuxer.getInitDts()?0:this.remuxer.getInitDts()}},{key:"getCurrentSeiOffsetDts",value:function(){return this.offsetDts||0}},{key:"appendFlv",value:function(t){this.parser.parseFlv(t)}},{key:"appendFlvTag",value:function(t,e){this.parser.parseTag(t,this.isPureAudio,e)}},{key:"_getTag",value:function(){var t=this.handler.constructor.name;return this._num_+" "+t}},{key:"recvDataFull",value:function(){this.handler&&this.handler.recvDataFull&&this.handler.recvDataFull()}},{key:"getVideoFrames",value:function(){return this.parser&&this.parser.getVideoFrames?this.parser.getVideoFrames():0}},{key:"getAudioFrames",value:function(){return this.parser&&this.parser.getAudioFrames?this.parser.getAudioFrames():0}},{key:"getMuted",value:function(){return!1}},{key:"getVideo",value:function(){return null}},{key:"getVolume",value:function(){return 0}},{key:"setVolume",value:function(t){this.webcodecType==L.PLAYER_CORE_TYPE.MSE?this.video.setVolume(t):this.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS&&this.startMuteRender(t)}},{key:"muffledVoice",value:function(){var t=this;if(this.handler&&this.handler.getMuffleCacheData){var e=g.now(),i=this.handler.voiceEliminationData||[],s=!1,r={play:!1,percent:0},a=this.getCurrentDts(),n=this.getBufferLen(),o=0,u=0,l=null,d=v(i),c=this.handler.getMuffleCacheData(),f=c.length;if(0!=c.length){var p=c[0].begin,m=c[f-1].end,_=a-c[0].end,y=a-c[f-1].begin;1==Number(D._printMuteInfo)&&I.log("[mse-".concat(this._num_,"] MSEPlayer.muffledVoice nowDts=").concat(a,",buffer=").concat(n,",cacheBegin=").concat(p,",cacheEnd=").concat(m,",firstBeginDetla=").concat(a-p,",firstEndDelta=").concat(_,",lastBeginDelta=").concat(y,",lastEndDelta=").concat(a-m,",cacheLen=").concat(f)),c.map(function(e,i){o=e.begin,u=e.end,l=e.muteStyle,0==e.type&&(o+=t.offsetDts,u+=t.offsetDts),a>=o&&a<=u&&(s=!0,F.useMuteBiAudio&&l&&1==l.style&&(r={play:!0,percent:l.percent?l.percent:0}),1==Number(D._printMuteInfo)&&I.log("[mse-".concat(t._num_,"] MSEPlayer.muffledVoicecache data"),JSON.stringify(e)))})}d.map(function(e,i){o=e.begin,u=e.end,0==e.type&&(o+=t.offsetDts,u+=t.offsetDts),a>u&&t.handler.voiceEliminationData.splice(i,1)}),this.setMuffledVolume(s),!this.isMuffeled&&s&&0==this.muffleTs?(this.muffleTs=e,r&&r.play&&this.handler.setMuffled(!0,r)):!s&&this.isMuffeled&&(this.muffleDuration+=e-this.muffleTs,this.muffleCnt++,this.muffleTs=0,this.handler.setMuffled(!1)),this.isMuffeled=s}}},{key:"setMuffledVolume",value:function(t){}}
1,{key:"disableHardAcc",value:function(){I.log("[mse-".concat(this._num_,"] BaseController.disableHardAcc"))}},{key:"setDisableHardAcc",value:function(){I.log("[mse-".concat(this._num_,"] BaseController.setDisableHardAcc"))}},{key:"pushAvcSample",value:function(t){this.isPureAudio||this.ctrlBuffer.addSample(t)}},{key:"pushAacSample",value:function(t,e){2==e?this.ctrlBuffer.addShieldAudioSample(t):this.ctrlBuffer.addSample(t)}},{key:"appendShieldAudioFlv",value:function(t){this.parser2.parseFlv(t,!0)}},{key:"updateAudioConfig",value:function(t,e,i){var s=t.audioConfig,r=t.codec,a=t.audioSampleRate,n=t.aacTimeLen,o=t.audioObjectType,u=t.audioChannelCount;if(e)this.ctrlBuffer.updateAudioConfig({config:s,codec:r,audiosamplerate:a,aacTimeLen:n,audioObjectType:o,audioChannelCount:u},!1,1,e);else{var l=!1;this.audioConfig&&s.toString(16)!==this.audioConfig.toString(16)&&(l=!0),I.log("[mse-".concat(this._num_,"] %cMSEPlayer.parseAudio adts changed old='").concat(this.audioConfig,", new='").concat(s,", needReplay=").concat(l),"background: orange;"),this.audioConfig=s,this.ctrlBuffer.updateAudioConfig({config:s,codec:r,audiosamplerate:a,aacTimeLen:n,audioObjectType:o,audioChannelCount:u},l,i,e),this.remuxer.switchLevel(!1,l),this.setExceptionStat(R.DIM_LINK_STA.AUDIO_CONFIG,1)}}},{key:"updateVideoConfig",value:function(t,e){this.isPureAudio||this.ctrlBuffer.updateVideoConfig(t,e)}},{key:"getLastIFrameDts",value:function(){return this.ctrlBuffer.getLastIFrameDts()}},{key:"_remux",value:function(t,e){this._setRemuxed(),this.remuxVideoCnt+=t.samples.length,this.avSyncStat.checkSync(t,e),this.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS?(this.appendAvcTrack(t),this.appendAacSample(e)):this.remuxer&&this.remuxer.remux(e,t,0,!1)}},{key:"initSegmentSuc",value:function(t,e){this.webcodecType!=L.PLAYER_CORE_TYPE.MSE&&(I.log("[mse-".concat(this._num_,"] BaseController.initSegmentSuc"),t,e),this._initSegmentSuc(t),this.updateM4sAudioConfig({codec:"mp4a.40.5",audioSampleRate:e.samplerate,audioChannelCount:e.channel_count}),this.updateAVCConfig({width:t.width,height:t.height}))}},{key:"_setRemuxed",value:function(){this.hasRemuxed||(this.hasRemuxed=!0,this.recvDataFull&&this.recvDataFull())}},{key:"setPerfCntPlus",value:function(){this.perfBlockCnt++}},{key:"resetPerfBlockCnt",value:function(){this.perfBlockCnt=0}},{key:"getRealFpsAudio",value:function(){return this.parser.getRealFpsAudio?this.parser.getRealFpsAudio():0}},{key:"onVideoResize",value:function(t){this.checkResolution()}},{key:"getVideoWidth",value:function(){return 0}},{key:"getVideoHeight",value:function(){return 0}},{key:"checkResolution",value:function(){if(!this.h265Proxy||!this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec){var t=this.getVideoWidth(),e=this.getVideoHeight();I.log("[mse-".concat(this._num_,"] MSEPlayer.checkResolution o_w/o_h=")+this.width+"/"+this.height,"n_w/nh",t,"/",e),this.width&&this.height&&(this.realtimeWidth!==t||this.realtimeHeight!==e)&&this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.VIDEO_RESOLUTION_CHANGE,{width:t,height:e}),this.realtimeWidth=t,this.realtimeHeight=e,this.width=t,this.height=e}}},{key:"setAvcCfg",value:function(t,e){t==this.widthCfg&&e==this.heightCfg||(I.log("[mse-".concat(this._num_,"] BaseController.setAvcCfg o_w/o_h=")+this.widthCfg+"/"+this.heightCfg,"n_w/nh",t,"/",e),this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.VIDEO_AVCCFG_CHANGE,{width:t,height:e})),this.widthCfg=t,this.heightCfg=e}},{key:"getMseAvcCfgWidth",value:function(){return this.widthCfg}},{key:"getMseAvcCfgHeight",value:function(){return this.heightCfg}},{key:"onPageRenderCbk",value:function(){if(this.renderFps){window.requestAnimationFrame&&(this.onPageRenderCbkId=window.requestAnimationFrame(this.onPageRenderCbkBind));var t=this.renderFps.addPageRender();t>0&&this.handler&&this.handler.updateCurrentPageRenderFps&&this.handler.updateCurrentPageRenderFps(t)}}},{key:"onScriptVolumeInfo",value:function(t,e){this.handler.onSendScriptVolumeInfo(t,e)}},{key:"onSeiDataChannel",value:function(t,e){this.seiDataChannl&&this.seiDataChannl.checkDataChannelPortListener(t)&&(this.handler&&this.handler.eventEmitter.trigger(N.SEI_DATACHANNEL_INFO,e),I.log("[mse-".concat(this._num_,"] onSeiDataChannel"),t,e))}},{key:"_getEmptyAudioDuration",value:function(t){var e=this.ctrlBuffer.avBuffer.aBuffer.getEmptyeDuration();this.audioEmptyDuration+=e,t-this.lastSecNow>=4e3&&(this.audioEmptyList4Sec.push(Math.floor(this.audioEmptyDuration>4e3?4e3:this.audioEmptyDuration)),this.audioEmptyDuration=0,this.lastSecNow=t)}},{key:"getEmptyAudioDurationHeart",value:function(){return this.ctrlBuffer.avBuffer.aBuffer.getEmptyDurationHeart()}},{key:"hasAudioCfg",value:function(){return this.parser&&this.parser.recvAudioConfig}},{key:"getEmptyAudioRecord",value:function(){var t=v(this.audioEmptyList4Sec);return this.audioEmptyList4Sec.length=0,t}},{key:"setRealFps",value:function(){}},{key:"setNoAuido",value:function(t){this.isNoAudio=t}},{key:"setStreamFormat",value:function(t){this.handler&&this.handler.setStreamFormat&&this.handler.setStreamFormat(t)}},{key:"switchShieldAudio",value:function(t){this.ctrlBuffer.switchShieldAudio(t)}},{key:"stopShieldAudio",value:function(){this.switchShieldAudio(!1),this.isShieldAudio=!1}},{key:"onSwitchShieldAudioFail",value:function(t,e){this.isShieldAudio=!1,this.handler.onSwitchShieldAudioFail&&this.handler.onSwitchShieldAudioFail(t,e)}},{key:"onSwitchShieldAudioSuc",value:function(t){this.isShieldAudio=!0,this.handler.onSwitchShieldAudioSuc&&this.handler.onSwitchShieldAudioSuc(t)}},{key:"shieldAuidoMute",value:function(t,e){I.log("[mse-".concat(this._num_,"] MSEPlayer.shieldAudioMute"),t,e),this.shildAudioStartTs=e,this.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS?this.setMuted(!0):this.video&&this.video.video&&(this.video.video.muted=!0)}},{key:"resetPlayer",value:function(){this.handler.resetPlayer()}},{key:"resetAudioDts",value:function(){I.log("[mse-".concat(this._num_,"] BaseContrller.resetAudioDts curDts=").concat(this.getCurrentDts&&this.getCurrentDts())),this.ctrlBuffer.resetAudioDts()}},{key:"getRenderElement",value:function(){}}
1,{key:"getIframePts",value:function(){return this.ctrlBuffer&&this.ctrlBuffer.getIframePts?this.ctrlBuffer.getIframePts():0}},{key:"setIFrameAvcChageStat",value:function(){this.handler.setIFrameAvcChageStat()}},{key:"onRevFastOver",value:function(){I.log("[mse-".concat(this._num_,"] BaseController.onRevFastOver mse webcodecs jump buffer!")),this.isRevFastOver=!0}},{key:"getVideoCBLargeCnt",value:function(){var t=this.videoCallBackLargeCnt;return this.videoCallBackLargeCnt=0,t}},{key:"getVideoFrameCallBackNums",value:function(){return this.frameCallBackNums||0}},{key:"isM4sInitLoaded",value:function(){return this.m4sPlayer.isInitLoaded()}},{key:"loadM4sInit",value:function(t,e,i){this.m4sPlayer.loadInit(t,e,i)}},{key:"setFragParsedTime",value:function(){this.isOnFragParsed||(this.onFragParsedTime=g.now(),I.log("[mse-".concat(this._num_,"] MSEPlayer.onFragParsed"),this.onFragParsedTime),this.isOnFragParsed=!0,this.firstFragParsed())}},{key:"firstFragParsed",value:function(){}},{key:"appendM4sSegment",value:function(t,e){this.setFragParsedTime(),this.m4sPlayer.appendSegment(t,e)}},{key:"onM4sError",value:function(){this._onErrorEvent(100),this._onPlayerError(!0)}},{key:"checkSolidColor",value:function(){if(this.isLive&&-1!=F.testRenderCfg[3].indexOf(S.version.major)&&0!=F.testRenderSwitchCfg[0]&&this.isPlayVideo&&!this.isSingleErr&&!this.isSingleTest&&(this.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS||this.getIsMseHevc())){var t=g.now();if(0!=this.initTime){if(t-this.initTime>=F.testRenderCfg[1])this.isSingleTest=!0;else if(!(0!=this.checkScreenTs&&t-this.checkScreenTs<F.testRenderCfg[2])){this.checkScreenTs=t;var e=this.getRenderElement();this.checkForScreen(e)}}}}},{key:"checkForScreen",value:function(t){var e=this;if(t){var i=null,s=null;if(this.canvas)i=this.canvas,s=this.context;else{var r=!1;try{s=(i=document.createElement("canvas")).getContext("2d",{willReadFrequently:!0})}catch(t){r=!0,I.error("[mse-".concat(this._num_,"] BaseController.checkForWhiteScreen context 2d error"),t)}if(r)return}if(i||s){this.canvas=i,this.context=s,i.width=100,i.height=50,s.drawImage(t,0,0,i.width,i.height);var a=Math.floor(i.width/2),n=Math.floor(i.height/2),o=i.width-10,u=i.height-10,l=[{x:a,y:0,w:10,h:10},{x:o,y:0,w:10,h:10},{x:0,y:n,w:10,h:10},{x:a,y:n,w:10,h:10},{x:o,y:n,w:10,h:10},{x:0,y:u,w:10,h:10},{x:a,y:u,w:10,h:10},{x:o,y:u,w:10,h:10}],d=s.getImageData(l[0].x,l[0].y,l[0].w,l[0].h).data,c=l.every(function(t,i){var r=s.getImageData(t.x,t.y,t.w,t.h).data;return e.isImageDataSame(d,r)});c?this.singleColorCnt++:this.singleColorCnt=0;for(var f=d.length,p=!0,m=0;m<f;m+=4)if(0!=d[m+3]){p=!1;break}I.log("[mse-".concat(this._num_,"] BaseController.checkForWhiteScreen,isSingleColor=").concat(c,",isTransparent=").concat(p),d.slice(0,24).toString()),(p||1!=F.testRenderSwitchCfg[1])&&this.singleColorCnt>=F.testRenderCfg[0]&&this.singleColorErrHand(d)}}}},{key:"isImageDataSame",value:function(t,e){for(var i=t.length,s=0;s<i;s+=4)if(t[s]!=e[s]||t[s+1]!=e[s+1]||t[s+2]!=e[s+2])return!1;return!0}},{key:"singleColorErrHand",value:function(t){var e=t.slice(0,24).toString();I.log("[mse-".concat(this._num_,"] BaseController.singleColorErrHand"),e),this.isSingleErr=!0,this.webcodecType==L.PLAYER_CORE_TYPE.WEBCODECS?(this.handler&&this.handler.wcsRenderErr&&this.handler.wcsRenderErr(e),D._nextWcsRenderErrTime=Date.now()+2592e5,this.onWebcodecsError(31)):this.getIsMseHevc()&&(this.handler&&this.handler.mseHevcRenderErr&&this.handler.mseHevcRenderErr(e),D._nextMseHevcRenderErrTime=Date.now()+2592e5,this.handler.onMseHevcError(5))}},{key:"getMuffleStat",value:function(){var t={muffleCnt:this.muffleCnt,muffleDuration:this.muffleDuration};return I.log("[mse-".concat(this._num_,"] BaseController.getMuffleStat,muffleCnt=").concat(this.muffleCnt,",muffleDuration=").concat(this.muffleDuration)),this.muffleCnt=0,this.muffleDuration=0,t}},{key:"updateMultiRenderInfo",value:function(t){this.handler.updateMultiRenderInfo(t)}},{key:"onPauseByBrowser",value:function(){var t=this.getVideo();if(t&&this.browserStatus!==W){if(this.handler){var e=G,i=N.BROWSER_PAUSE;this.browserStatus===G&&(e=W,i=N.BROWSER_AUTOPLAY_FAIL_IN),this.browserStatus=e,this.handler.onPauseByBrowser&&this.handler.onPauseByBrowser(),this.handler.updateStatus&&this.handler.updateStatus(e),this.handler.eventEmitter&&this.handler.eventEmitter.trigger(i,{video:t})}this.browserStatus===G&&this.checkAutoMutedPlay()}}},{key:"checkAutoMutedPlay",value:function(){}}]),t}(),iF=function(){function t(e,i){Object(s.a)(this,t),this._mse=e,this._callbacks=i,this._paused=!1,this._playedTime=0,this._pausedTs=0,this._lastPausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0,this._lastCheck500CurrntTime=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._mse=null,this._callbacks=null}},{key:"paused",get:function(){return this._paused}},{key:"pausedTs",get:function(){return this._pausedTs}},{key:"reset",value:function(){this._paused=!1,this._playedTime=0,this._pausedTs=0,this._lastPausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0}},{key:"check",value:function(){var t=g.now(),e=this._mse.video.video;
1if(!(0!=this._lastCheckTime&&t-this._lastCheckTime<50)&&(this._mse.isLive||!(e.currentTime<=1))&&(this._mse.isLive||!this._mse.handler||this._mse.handler.started)){if(0!==this._playedTime){e.currentTime===this._playedTime?this._paused||this._setPaused(t,e):this._paused&&this._setResume(t,e);var i=t-this._lastCheck500Time,s=Math.round(1e3*e.currentTime-this._lastCheck500CurrntTime);(0==this._lastCheck500Time||i>=500)&&(0!=this._lastCheck500Time&&i-s>=F.pause500Cfg[0]&&(I.log("MSEPauseWorker.check.500ms check500Delta=".concat(i,", check500CurrentTimeDelta=").concat(s,", pauseDelta=").concat(i-s)),this._mse.check500Pause()),this._lastCheck500CurrntTime=1e3*e.currentTime,this._lastCheck500Time=t)}this._playedTime=e.currentTime,this._lastCheckTime=t}}},{key:"_setPaused",value:function(t,e){this._paused=!0,this._pausedTs=t,this._lastPausedTs=t,this._log("_setPaused",e),this._callbacks.pause(t)}},{key:"_setResume",value:function(t,e){var i=t-this._pausedTs;this._paused=!1,this._pausedTs=0,this._lastPausedTs=0,this._log("_setResume",e),this._callbacks.resume(t,i)}},{key:"_log",value:function(t,e,i){this._mse.video.printBuffered(),I.log("MSEPauseWorker(".concat(this._mse._num_,").").concat(t," readyState=").concat(e.readyState," currentTime=").concat(e.currentTime," buf=").concat(this._mse.getBufferLen()," dts=").concat(this._mse.getCurrentDts()," ").concat(i||""))}}]),t}(),iM=function(){function t(){Object(s.a)(this,t)}return Object(r.a)(t,null,[{key:"create",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e||(e={}),t||((t=document.createElement("video")).id="_video_".concat(Math.floor(1e3*Math.random()))),t.autoplay="safari"!==(S.name+"").toLowerCase(),t.setAttribute("playsinline",!0),t.setAttribute("webkit-playsinline",!0),t.setAttribute("webkit-inline",!0),t.setAttribute("x-webkit-airplay","allow"),t.setAttribute("x5-video-player-type","h5"),t.setAttribute("x5-autoplay","true"),t.muted=!1,e.hasOwnProperty("autoplay")&&(t.autoplay=e.autoplay,t.setAttribute("x5-autoplay",e.autoplay?"true":"false")),t}},{key:"getErrorMessage",value:function(t){var e="message:";return t&&(e+="networkState=".concat(t.networkState),t.error&&(e+=" errorcode=".concat(t.error.code," details=").concat(t.error.message))),e}},{key:"getParentMessage",value:function(t){var e=t?t.parentElement:null;return e?"isInDom=".concat(t&&t.isConnected," parent id=").concat(e.id," class=").concat(e.className):" no parent"}}]),t}(),iN=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r){Object(s.a)(this,i),n=e.call(this,t,r,L.PLAYER_CORE_TYPE.MSE);var n,o=r.videoType,u=(r.videoElement,r.h265Proxy),l=r.ignoreSei,d=r.closeFetch,c=r.dropBeforeFirstIDR,f=r.continuousTimeStamp;return n.MediaSource=k.getMediaSource(F.mmsOpen),n.h265Proxy=u,n.requestAnimationId=-1,n.isMMS=k.isManagedMediaSource(n.MediaSource),n.video=null,"ts"===(void 0===o?"flv":o)?(n.parser=new eT(Object(a.a)(n),n.remuxer),n.parser.ignoreSei=void 0!==l&&l,n.parser.closeFetch=void 0!==d&&d,n.parser.dropBeforeFirstIDR=void 0!==c&&c,n.parser.continuousTimeStamp=void 0!==f&&f):(n.parser=new ei(Object(a.a)(n),n.remuxer,1),n.parser.setCorrentDtsOpen(!0),n.parser.repairSameDts=1==F.repairSameDts,n.ctrlBuffer.setBuffered(n.buffered),n.parser.dropFrameCtrl.setConfig({dropTime:F.dropTime,minFps:F.minFps}),n.parser2=new ei(Object(a.a)(n),n.remuxer,2)),n.tryResumeCnt=0,n.JITTER_BUFMIN=1e3,n.JITTER_BUFLEN=4e3,n.JITTER_BUFMAX=8e3,n.latencySeek=0,n._triggerPlay=!1,n.hasData=!1,n.playing=!1,n.lastPlayTime=0,n.lastCheckPlayTime=0,n.maxGop=0,n.playStartTime=0,n.delayReset=!1,n.isPlayerError=!1,n.isErrorEvent=!1,n.startPlayBackRate=.9,n.pausedByBrowser=!1,n.tryPlayAgainTimout=0,n.onUpdateErrorBind=n.onUpdateError.bind(Object(a.a)(n)),n.onAudioUpdateEndBind=n.onAudioUpdateEnd.bind(Object(a.a)(n)),n.onVideoUpdateEndBind=n.onVideoUpdateEnd.bind(Object(a.a)(n)),n.onMediaSourceOpenBind=n.onMediaSourceOpen.bind(Object(a.a)(n)),n.onMediaSourceStartStreamingBind=n._onStartStreaming.bind(Object(a.a)(n)),n.onMediaSourceEndStreamingBind=n._onEndStreaming.bind(Object(a.a)(n)),n.onVideoErrorBind=n.onVideoError.bind(Object(a.a)(n)),n.onVideoPauseBind=n.onVideoPause.bind(Object(a.a)(n)),n.onVideoPlayBind=n.onVideoPlay.bind(Object(a.a)(n)),n.onVideoLoadedBind=n.onVideoLoaded.bind(Object(a.a)(n)),n.onLoadedMetadataBind=n.onLoadedMetadata.bind(Object(a.a)(n)),n.checkVideoPlayingBind=n.checkVideoPlaying.bind(Object(a.a)(n)),n.onVideoPlayingBind=n.onVideoPlaying.bind(Object(a.a)(n)),n.onVideoTimeUpdateBind=n.onVideoTimeupdate.bind(Object(a.a)(n)),n.onVideoVolumeChangeBind=n.onVideoVolumeChange.bind(Object(a.a)(n)),n.initVideoPlayer(),n.msePause=new eR(Object(a.a)(n),{pause:n._msePaused.bind(Object(a.a)(n)),resume:n._mseResume.bind(Object(a.a)(n))}),n.msePauseWorker=new iF(Object(a.a)(n),{pause:n._msePausedWorker.bind(Object(a.a)(n)),resume:n._mseResumeWorker.bind(Object(a.a)(n))}),n.audioSourceBuffer=null,n.videoSourceBuffer=null,n.audioCodec=null,n.videoCodec=null,n.audioSegments=[],n.videoSegments=[],n.autoJitter=!0,n.autoBitrateJitter=!1,n.playbackrateChangeAccess=!0,n.enableLowLatency=!1,n.sensitivePause=!0,n.waitSwapToPcdn=!1,n.printJitter=!!Number(D._printJitter),n.isAndroid=-1!==navigator.userAgent.toLowerCase().indexOf("Android"),n.videoDataAppended=!1,n.avcchangeCheckTimer=0,n.offsetDts=0,n.curVideoDts=0,n.curAudioDts=0,n.isH265Play=!1,n.playRateIncrease=0,n.playRateDecrease=0,n.startPlayTime=0,n.isStartBuffer=!0,n.bufferCd=1e3*F.jumpBufferCfg[0],n.startCd=F.jumpBufferCfg[3],n.startCdMax=1e3*F.jumpBufferCfg[5],n.setVideoCurrentTime=0,n.startMoreBufferTime=0,n.bufferMoreContinueTime=1e4,n.maxJumpWaitNow=0,n.lastJumpBufferTs=0,n.mediaDelay=null,n.seiAnchorDelay=-1,n.discontinuityAudio=!1,n.discontinuityVideo=!1,n.isPlaybackRateNormal=!0,n.discontinuityTimeOffset=0,n.frameCallBackNums=0,n.lastFrameCallBackNums=0,n.mseRenderList=[],u&&u.initRender&&u.initRender(Object(a.a)(n)),n.renderList=[],n.renderHiddenTs=0,n.renderListFirst=!0,n.onInitSegmentCb=null,n.videoCallBackTs=0,n.onVisibilityChangedBind=n.onVisibilitychange.bind(Object(a.a)(n)),n.handler&&n.handler.eventEmitter&&n.handler.eventEmitter.on(N.VISIBILITY_CHANGE,n.onVisibilityChangedBind),n.isMseRCErrorCnt=0,n._status=null,n._isVideoReady=!1,n}return Object(r.a)(i,[{key:"onParseVideoDtsCallback",set:function(t){this.parser&&this.parser instanceof eT&&(this.parser.onParseVideoDtsCallback=t)}},{key:"endOfStream",value:function(){if(this.mediaSource){var t=!0;(this.videoSourceBuffer.updating||this.videoSegments.length>0||this.audioSourceBuffer.updating||this.audioSegments.length>0)&&(t=!1),t?this._startEndOfStream():this.waitEndOfStream=!0}}},{key:"_startEndOfStream",value:function(){I.log("[mse-".concat(this._num_,"] MSEPlayer._startEndOfStream")),tP.once(this._endOfStream,this,100)}},{key:"_endOfStream",value:function(){this.mediaSource&&"open"===this.mediaSource.readyState&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.endOfStream")),this.video.printBuffered(),this.triggerPlay(),this.mediaSource.endOfStream())}},{key:"getVideoWidth",value:function(){return this.video.getVideoWidth()}},{key:"getVideoHeight",value:function(){return this.video.getVideoHeight()}},{key:"onVisibilitychange",value:function(){Object(n.a)(Object(o.a)(i.prototype),"onVisibilitychange",this).call(this),"hidden"==document.visibilityState&&(this.videoCallBackTs=0,this.isMseRCErrorCnt=0)}},{key:"setParams",value:function(t,e){if(this.pid=t,this.bitrate=e,this._initPerf(),this.parser.dropFrameDts){var i=!1;(1===F.dropFrameUids[0]||-1!==F.dropFrameUids.indexOf(parseInt(t)))&&(i=!0),this.parser.dropFrameDts.open=i}this.parser.dropFrameDts.start()}},{key:"_initPerf",value:function(){"ts"!==this.videoType&&this.pausePerf.checkLocal(this.pid,this.bitrate)&&this.parser.dropFrameCtrl.start()}},{key:"getDelayStat",value:function(){return"ts"!==this.videoType?this.parser.sei.getStat():null}},{key:"getVideoDecodeDelaySmooth",value:function(){return 100}},{key:"getDelayInfo",value:function(){return I.log("[mse-".concat(this._num_,"] MSEPlayer.getDelayInfo: delay: "),this.mediaDelay),this.mediaDelay}},{key:"getRealFps",value:function(){return this.parser.getRealFps?this.parser.getRealFps():0}},{key:"getIsDownEnough",value:function(){return!this.parser.isDownEnough||this.parser.isDownEnough()}},{key:"getRealBitrate",value:function(){var t=0;return this.parser.fps&&(t=this.parser.fps.getRealBitrate()),t}},{key:"destroy",value:function(){Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this),I.log("[mse-".concat(this._num_,"] MSEPlayer.destroy ").concat(this.getParentMessage())),this.onMediaSourceOpenCallback=null,this.h265Proxy&&this.h265Proxy.stop(),this.playing=!1,this.lastPlayTime=0,this.playStartTime=0,this.lastCheckPlayTime=0,this.hasData=!1,this.handler&&this.handler.eventEmitter&&this.handler.eventEmitter.off(N.VISIBILITY_CHANGE,this.onVisibilityChangedBind),this.parser.destroy(),this.audioCodec=null,this.videoCodec=null,this.audioSegments=[],this.videoSegments=[],this.onInitSegmentCb=null,this.destroyVideoPlayer(),this.videoElement=null,this.pushVideoStartRenderTime=0,this.playbackrateChangeAccess=!0,-1!==this.requestAnimationId&&(cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=-1),this.onFragParsedTime=0,tP.remove(this.triggerPlayVideo,this),tP.remove(this._startEndOfStream,this)}},{key:"clearSourceBuffer",value:function(){I.log("[mse-".concat(this._num_,"] MSEPlayer.clearSourceBuffer")),this.waitEndOfStream=!1;var t="open"===this.mediaSource.readyState,e=this.video.video,i=0;if(e){var s=e.buffered.length;i=s>0?e.buffered.end(s-1):i}this.audioSourceBuffer&&i>0&&(t&&this.audioSourceBuffer.abort(),this.audioSourceBuffer.remove(0,i)),this.videoSourceBuffer&&i>0&&(t&&this.videoSourceBuffer.abort(),this.videoSourceBuffer.remove(0,i))}},{key:"destroyVideoPlayer",value:function(){this.audioSourceBuffer&&(this.audioSourceBuffer.removeEventListener("updateend",this.onAudioUpdateEndBind),this.audioSourceBuffer.removeEventListener("error",this.onUpdateErrorBind),this.audioSourceBuffer=null),this.videoSourceBuffer&&(this.videoSourceBuffer.removeEventListener("updateend",this.onVideoUpdateEndBind),this.videoSourceBuffer.removeEventListener("error",this.onUpdateErrorBind),this.videoSourceBuffer=null);var t=null,e=this.mediaSource;if(this.video&&(t=this.video.video,this.video.destroy(),this.video=null),this.videoElement=null,this.playbackrateChangeAccess=!0,-1!==this.requestAnimationId&&(cancelAnimationFrame(this.requestAnimationId),this.requestAnimationId=-1),e&&(e.removeEventListener("sourceopen",this.onMediaSourceOpenBind),e.removeEventListener("startstreaming",this.onMediaSourceStartStreamingBind),e.removeEventListener("endstreaming",this.onMediaSourceEndStreamingBind)),t){if(t.pause(),t.querySelectorAll("source").forEach(function(t){t.src.startsWith("blob:")&&URL.revokeObjectURL(t.src),t.remove()}),e)try{"open"===e.readyState&&e.endOfStream(),e.sourceBuffers&&Array.from(e.sourceBuffers).forEac
1h(function(t){t.updating&&t.abort(),e.removeSourceBuffer(t)}),"function"==typeof e.close&&e.close()}catch(t){I.warn("[mse-".concat(this._num_,"] MSEPlayer destroyVideoPlayer mediaSource cleanup error:"),t)}t.src&&t.src.startsWith("blob:")&&URL.revokeObjectURL(t.src),t.removeAttribute("src"),t.load(),t=null,e=null,I.log("[mse-".concat(this._num_,"] MSEPlayer destroyVideoPlayer done ").concat(this.getParentMessage()))}}},{key:"reset",value:function(){Object(n.a)(Object(o.a)(i.prototype),"reset",this).call(this),I.log("[mse-".concat(this._num_,"] MSEPlayer.reset")),tP.remove(this._startEndOfStream,this),this.handler.onVideoStop(this.video.video,!!this.videoSourceBuffer),this.userPaused=!1,this.pausedByBrowser=!1,this.playing=!1,this.lastPlayTime=0,this.playStartTime=0,this.lastCheckPlayTime=0,this.hasData=!1,this.waitEndOfStream=!1,this.audioCodec=null,this.videoCodec=null,this.audioSegments=[],this.videoSegments=[],this.discontinuityAudio=!1,this.discontinuityVideo=!1,this.msePause.paused&&this.handler.onPlayResume(g.now()),this.pauseStat.reset(),this.bufStat.reset(),this.msePause.reset(),this.msePauseWorker.reset(),this.maxGop=0,this.isPlaybackRateNormal=!0,clearTimeout(this.tryPlayAgainTimout),this.destroyVideoPlayer(),this.initVideoPlayer(),this.playbackrateChangeAccess=!0,this.videoDataAppended=!1,this.onFragParsedTime=0,this.startPlayTime=0,this.isStartBuffer=!0,this.setVideoCurrentTime=0,this.startMoreBufferTime=0,this.maxJumpWaitNow=0,this.frameCallBackNums=0,this.lastFrameCallBackNums=0,this.mseRenderList.length=0}},{key:"initVideoPlayer",value:function(){this.mediaSource=new this.MediaSource,this.mediaSource.addEventListener("sourceopen",this.onMediaSourceOpenBind),this.video=this.createVideo()}},{key:"resetVideo",value:function(){this.destroyVideoPlayer(),this.initVideoPlayer(),this.videoCodec=null,this.audioCodec=null,this.lastPlayTime=0}},{key:"createVideo",value:function(){var t=this;this._triggerPlay=!1,this._isVideoReady=!1;var e=this.videoElement;e||((e=document.createElement("video")).id="mse".concat(this._num_),e.autoplay="safari"!==S.name,e.setAttribute("playsinline",!0),e.setAttribute("webkit-playsinline",!0),e.muted=!1);var i=URL.createObjectURL(this.mediaSource);return k.isManagedMediaSource(this.MediaSource)?(e.disableRemotePlayback=!0,this.addSource(e,i),this.mediaSource.addEventListener("startstreaming",this._onStartStreaming.bind(this)),this.mediaSource.addEventListener("endstreaming",this._onEndStreaming.bind(this))):e.src=i,e.load(),F.platform===L.PLATFORM_TYPE_NAME.wap&&e.play().then(function(){I.log("[mse-".concat(t._num_,"] MSEPlayer.createVideo wap auto play success"))}).catch(function(e){I.log("[mse-".concat(t._num_,"] MSEPlayer.createVideo wap auto play fail: ").concat(e.message))}),new eA(this,e,!!this.videoElement)}},{key:"_onStartStreaming",value:function(){I.log("[mse-".concat(this._num_,"] event _onStartStreaming"))}},{key:"_onEndStreaming",value:function(){I.log("[mse-".concat(this._num_,"] event _onEndStreaming"))}},{key:"addSource",value:function(t,e){var i=document.createElement("source");i.type="video/mp4",i.src=e,t.appendChild(i)}},{key:"insertDiscontinuity",value:function(t){this.audioSourceBuffer&&this.videoSourceBuffer&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.insertDiscontinuity timeOffset=").concat(t)),this.discontinuityTimeOffset=t,this.discontinuityTimeOffset>0)&&this.cacheBlockReason(em,t)}},{key:"getBufferLen",value:function(){return this.video?this.video.getBufferLen():0}},{key:"getSegmentsBufferLen",value:function(){return 200*this.videoSegments.length}},{key:"getCurrentDts",value:function(){if(F.dtsJumpOpen){if(this.isPureAudio&&this.parser.timelineAudio)return this.parser.timelineAudio.getRealDtsByCurrentTime(this.getCurrentTime());if(this.parser.timelineVideo)return this.parser.timelineVideo.getRealDtsByCurrentTime(this.getCurrentTime())}return this.getCurrentTime()+this.getInitDts()}},{key:"getCorrentCurrentDts",value:function(){return this.isPureAudio&&this.parser.timelineAudio?this.parser.timelineAudio.getCorrentDtsByCurrentTime(this.getCurrentTime()):this.parser.timelineVideo?this.parser.timelineVideo.getCorrentDtsByCurrentTime(this.getCurrentTime()):this.getCurrentTime()+this.getInitDts()}},{key:"getCurrentTime",value:function(){return this.video?this.video.getCurrentTime():0}},{key:"getCurrentRealTime",value:function(){return this.getCurrentDts()}},{key:"isMediaSourceOpen",get:function(){return this.mediaSource&&"open"===this.mediaSource.readyState}},{key:"appendFlv",value:function(t){this.addPlayEvent(),this.parser.parseFlv(t,this.isPureAudio)}},{key:"addPlayEvent",value:function(){this.hasData||(this.hasData=!0,this.videoElement&&(this.videoElement.addEventListener("loadeddata",this.onVideoLoadedBind),"safari"!==S.name||this.isLive||this.videoElement.addEventListener("loadedmetadata",this.onLoadedMetadataBind),this.requestAnimationId=requestAnimationFrame(this.checkVideoPlayingBind)))}},{key:"appendTs",value:function(t){this.addPlayEvent(),this.parser.parseTs(t)}},{key:"checkBuffer",value:function(){if(!this.video.video.paused&&!this.video.seeking){var t=g.now(),e=this.video.video.buffered,i=e.length,s=this.getBufferLen();if(this.bufStat.checkBuffer(t,s),0===this.video.video.currentTime&&0!==this.lastPlayTime)return I.warn("[mse-".concat(this._num_,"] MSEPlayer.checkBuffer onPlayerError(true) lastPlayTime=")+this.lastPlayTime+" bufLen="+s),this._onPlayerError(!0),this._onErrorEvent(9),void(this.lastPlayTime=0);if(this.lastPlayTime=this.video.video.currentTime,t>this.playStartTime+3e3&&s>4e3&&0==this.video.currentTime&&(i>0&&e.start(0)<=4&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.checkBuffer buffer full but can not play")),this.video.currentTime=Math.round(e.start(0)+1)),this.video.play()),0!==this.playStartTime&&t>this.playStartTime+5e3&&(s>5e3||0===s)){if(0==this.video.video.currentTime&&s>2e3)I.log("[mse-".concat(this._num_,"] MSEPlayer ####### currentTime=0 ++ bufLen=").concat(s," paused=").concat(this.video.video.paused)),this.video.play();else if(this.playStartTime=0,0===this.video.video.currentTime&&!this.isAndroid)return I.warn("[mse-".concat(this._num_,"] MSEPlayer.checkBuffer onPlayerError(true) playT
1ime=")+this.video.video.currentTime+" bufLen="+s),this._onErrorEvent(6),void this._onPlayerError(!0)}null==this.videoElement&&i&&this.video.video.currentTime-e.start(0)>20&&(this.audioSourceBuffer&&!this.audioSourceBuffer.updating&&this.audioSourceBuffer.remove(0,this.video.video.currentTime-10),this.videoSourceBuffer&&!this.videoSourceBuffer.updating&&this.videoSourceBuffer.remove(0,this.video.video.currentTime-10))}}},{key:"_onPlayerError",value:function(t){!this.isPlayerError&&this.handler&&(this.isPlayerError=!0,this.handler.onPlayerError(t))}},{key:"_onErrorEvent",value:function(t){this.isErrorEvent||(this.isErrorEvent=!0,this.handler&&this.handler.onErrorEvent&&this.handler.onErrorEvent({type:t}))}},{key:"onParseError",value:function(t){this._onErrorEvent(t)}},{key:"onAvcCfgChange",value:function(){return I.log("[mse-".concat(this._num_,"] MSEPlayer.onAvcCfgChange")),this.getBufferLen()<500?(I.log("[mse-".concat(this._num_,"] MSEPlayer.onAvcCfgChange reset player")),this.remuxer.reset(),this.parser.setPaused(!1),!1):(this.delayReset=!0,!0)}},{key:"getMaxGop",value:function(){return this.maxGop}},{key:"setEnableLowLatency",value:function(t){this.enableLowLatency=t}},{key:"getVideo",value:function(){return this.video&&this.video.video}},{key:"getVolume",value:function(){return this.video?this.video.getVolume():-1}},{key:"setMuted",value:function(t){this.video&&(this.video.setMuted(t),I.log("[mse-".concat(this._num_,"] MSEPlayer.setMuted ").concat(t," hasVideo=").concat(this._hasVideo()," hasAudio=").concat(this._hasAudio()," ").concat(this.getParentMessage())))}},{key:"getMuted",value:function(){return!!this.video&&this.video.getMuted()}},{key:"setExceptionStat",value:function(t,e){this.handler&&this.handler.exceptionStat&&this.handler.exceptionStat.setStat(t,e)}},{key:"cacheBlockReason",value:function(t,e){this.handler&&this.handler.cacheBlockReason&&this.handler.cacheBlockReason(t,e)}},{key:"turnToH264",value:function(t){this.h265Proxy&&this.h265Proxy.stop(),this.handler&&this.handler.turnToH264(t)}},{key:"on265StartCodeError",value:function(){this.h265Proxy&&this.h265Proxy.on265StartCodeError()}},{key:"h265Retry",value:function(){this.h265Proxy&&this.h265Proxy.stop(),this.handler.h265Retry()}},{key:"onInitSegment",value:function(t){this.onInitSegmentCb&&this.onInitSegmentCb(),t.audioCodec&&(this.audioCodec&&this.audioCodec!==t.audioCodec&&(this.discontinuityAudio=!0),this.audioCodec=t.audioCodec),t.videoCodec&&(this.videoCodec&&this.videoCodec!==t.videoCodec&&(this.discontinuityVideo=!0),this.videoCodec=t.videoCodec,this.getVideoCapabilities(t),this.handler&&this.handler.onInitSegment&&this.handler.onInitSegment()),this.isMediaSourceOpen&&this.initSourceBuffer(),t.audioMoov&&this.audioSegments.push(t.audioMoov),t.videoMo
1ov&&this.videoSegments.push(t.videoMoov),this.playStartTime=0,this.triggerVideoReady()}},{key:"triggerVideoReady",value:function(){this._isVideoReady||(this._isVideoReady=!0,this.handler&&this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.VIDEO_READY,this.video.video))}},{key:"onFragParsing",value:function(t){"audio"===t.type?this.audioSegments.push(t.data):"video"===t.type&&this.videoSegments.push(t.data)}},{key:"onFragParsed",value:function(){this.audioSourceBuffer&&this.appendBuffer("audio"),this.videoSourceBuffer&&this.appendBuffer("video"),this.setFragParsedTime(),null==this.videoElement&&this.isLive&&(this.handler.isMutilVideo&&this.handler.isMutilVideo()||this.triggerPlay())}},{key:"firstFragParsed",value:function(){Object(n.a)(Object(o.a)(i.prototype),"firstFragParsed",this).call(this),F.platform!==L.PLATFORM_TYPE_NAME.wap||this.userPaused||this.video.play()}},{key:"checkVideoPlaying",value:function(){0==this.pushVideoStartRenderTime&&this.video&&this.video.video&&this.video.video.videoWidth>0&&this.video.video.videoHeight>0?this.pushVideoStartRenderTime=g.now():this.requestAnimationId=requestAnimationFrame(this.checkVideoPlayingBind)}},{key:"onLoadedMetadata",value:function(t){I.log("[mse-".concat(this._num_,"] MSEPlayer.onLoadedMetadata ").concat(this.getParentMessage())),this.onVideoLoaded()}},{key:"onVideoLoaded",value:function(){I.log("[mse-".concat(this._num_,"] check MSEPlayer.onVideoLoaded ").concat(this.getParentMessage()),S.name,this.video.video.videoWidth,this.video.video.videoHeight),this.triggerPlay()}},{key:"reloadInError",value:function(){this.handler.reloadInError&&this.handler.reloadInError()}},{key:"initSourceBuffer",value:function(){if(D._localVideoCodec&&""!=D._localVideoCodec&&(this.videoCodec=D._localVideoCodec),this.audioCodec&&!this.audioSourceBuffer){I.log("[mse-".concat(this._num_,"] MSEPlayer.initSourceBuffer audio codec=")+this.audioCodec);try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer("video/mp4;codecs=".concat(this.audioCodec)),this.audioSourceBuffer.addEventListener("updateend",this.onAudioUpdateEndBind),this.audioSourceBuffer.addEventListener("error",this.onUpdateErrorBind)}catch(t){return I.warn("[mse-".concat(this._num_,"] MSEPlayer.initSourceBuffer audio err=")+t.message),t.message&&-1!=t.message.indexOf("No additional SourceBuffer objects may be added")&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.initSourceBuffer resetMediasource in audio")),this.handler.resetMediasource)?void this.handler.resetMediasource():(this._onErrorEvent(4),void this._onPlayerError(!0))}}if(this.videoCodec&&!this.videoSourceBuffer){I.log("[mse-".concat(this._num_,"] MSEPlayer.initSourceBuffer video codec=")+this.videoCodec);try{this.videoSourceBuffer=this.mediaSource.addSourceBuffer("video/mp4;codecs=".concat(this.videoCodec)),this.videoSourceBuffer.addEventListener("updateend",this.onVideoUpdateEndBind),this.videoSourceBuffer.addEventListener("error",this.onUpdateErrorBind)}catch(t){if(t.message&&-1!=t.message.indexOf("No additional SourceBuffer objects may be added")&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.initSourceBuffer resetMediasource in video")),this.handler.resetMediasource))return void this.handler.resetMediasource();I.warn("[mse-".concat(this._num_,"] MSEPlayer.initSourceBuffer video err=")+t.message),this.getIsMseHevc()?this.handler.onMseHevcError(1):(this._onErrorEvent(5),this._onPlayerError(!0))}}}},{key:"appendBuffer",value:function(t){var e=g.now();if(0!=this.mediaSource.sourceBuffers.length&&!this.isPlayerError)if("audio"==t){if(this.audioSegments.length>0&&this.audioSourceBuffer&&!this.audioSourceBuffer.updating){var i=this.audioSegments.shift();try{this.audioSourceBuffer.appendBuffer(i),this.videoDataAppended=!0,this.audioPlayConsuming.pushRemuxedVideoFrameData(e)}catch(t){I.warn("[mse-".concat(this._num_,"] MSEPlayer.appendBuffer audio err=")+t.message),this._onErrorEvent(7),this._onPlayerError(!0)}}}else{if("video"!=t)throw Error("[mse-".concat(this._num_,"] MSEPlayer.appendBuffer type error! Valide type is audio or video."));if(this.videoSegments.length>0&&this.videoSourceBuffer&&!this.videoSourceBuffer.updating){var s=this.videoSegments.shift();try{this.videoSourceBuffer.appendBuffer(s),this.videoDataAppended=!0,this.videoPlayConsuming.pushRemuxedVideoFrameData(e)}catch(t){I.warn("[mse-".concat(this._num_,"] MSEPlayer.appendBuffer video err=")+t.message),this._onErrorEvent(8),this._onPlayerError(!0)}}}}},{key:"triggerH265Play",value:function(t,e){this.isH265Play||(I.log("[mse-".concat(this._num_,"] MSEPlayer.triggerH265Play ").concat(this.getParentMessage())),this.isH265Play=!0,this.h265Proxy&&this.h265Proxy.reportDecodeRenderTime(t,e)),!this.videoElement&&this.isLive||(I.log("[mse-".concat(this._num_,"] MSEPlayer.triggerH265Play.triggerPlay ").concat(this.getParentMessage())),this.triggerPlay())}},{key:"triggerPlay",value:function(){!this.playing&&this.isMediaSourceOpen&&
1(I.log("[mse-".concat(this._num_,"] check MSEPlayer.triggerPlay ").concat(this.getParentMessage()),S.name,this.video.video.videoWidth,this.video.video.videoHeight),this.playing=!0,this.playStartTime=g.now(),(F.platform!==L.PLATFORM_TYPE_NAME.wap||null==this.videoElement)&&("safari"===S.name?(F.safariFirstLoad?(F.safariFirstLoad=!1,this.triggerPlayVideo()):tP.once(this.triggerPlayVideo,this,F.safariPlayDelay),this.video.triggerPlay()):(this.triggerPlayVideo(),F.platform!==L.PLATFORM_TYPE_NAME.web||this.userPaused||this.video.play())))}},{key:"triggerPlayVideo",value:function(){var t=!!this.videoSourceBuffer,e=this.getCodecType(),i=this.h265Proxy&&this.h265Proxy.isH265MseCodec;I.log("[mse-".concat(this._num_,"] MSEPlayer.onPlayVideo codec: ").concat(e).concat(i?" (mse)":""," ").concat(this.getParentMessage())),0==this.parser.decodeIFRTime&&1==Number(F.isNoVideoReport)&&this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.P2P_REPORT),e===t$&&this.h265Proxy&&this.h265Proxy.isReady&&this.h265Proxy.canvas,e===t$&&this.h265Proxy&&this.h265Proxy.isReady?this.h265Proxy.isVideoTrack?this.handler.onPlayVideo(this.h265Proxy.canvas,this.widthCfg,this.heightCfg,t,null,this.onFragParsedTime,e):this.handler.onPlayVideo(this.video.video,this.widthCfg,this.heightCfg,t,this.h265Proxy.canvas,this.onFragParsedTime,e):this.handler.onPlayVideo(this.video.video,this.widthCfg,this.heightCfg,t,null,this.onFragParsedTime,e),this.startPlayTime=g.now(),this.isPlayVideo=!0}},{key:"triggerH5PlayVideo",value:function(){if(I.log("[mse-".concat(this._num_,"] trigger h5 video play userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," ").concat(this.getParentMessage())),!this.pausedByBrowser){this.startPlayTime=g.now();var t=this._hasVideo();this.handler.onPlayVideo(this.video.video,this.widthCfg,this.heightCfg,t,null,this.onFragParsedTime)}}},{key:"onH264Sei",value:function(t,e){this.handler.onSendSeiData(t,e,this.video.video.currentTime)}},{key:"onMediaSourceOpen",value:function(){this.mediaSource.removeEventListener("sourceopen",this.onMediaSourceOpenBind),I.log("[mse-".concat(this._num_,"] MSEPlayer.onMediaSourceOpen ").concat(this.getParentMessage())),this.m4sPlayer.onMediaSourceOpen(this.mediaSource),(this.audioSegments.length>0||this.videoSegments.length>0)&&(this.initSourceBuffer(),this.appendBuffer("audio"),this.appendBuffer("video"),0==this.onFragParsedTime&&(this.onFragParsedTime=g.now()),null==this.videoElement&&this.triggerPlay())}},{key:"onAudioUpdateEnd",value:function(){this.checkSeek(),this.audioCodec&&this.audioSourceBuffer&&this.discontinuityAudio?(I.log("[mse-".concat(this._num_,"] MSEPlayer.onAudioUpdateEnd reset audio codec=")+this.audioCodec),this.discontinuityAudio=!1,this.audioSourceBuffer.changeType("video/mp4;codecs=".concat(this.audioCodec))):(this.appendBuffer("audio"),this.checkAppendOver())}},{key:"onVideoUpdateEnd",value:function(){this.checkSeek(),this.videoCodec&&this.videoSourceBuffer&&this.discontinuityVideo?(I.log("[mse-".concat(this._num_,"] MSEPlayer.onVideoUpdateEnd reset video codec=")+this.videoCodec),this.discontinuityVideo=!1,this.videoSourceBuffer.changeType("video/mp4;codecs=".concat(this.videoCodec))):(this.appendBuffer("video"),this.checkAppendOver())}},{key:"checkSeek",value:function(){this.video.realSeek()}},{key:"checkCurrentTime",value:function(){this.video.checkCurrentTime()}},{key:"checkAppendOver",value:function(){0===this.videoSegments.length&&0===this.audioSegments.length&&(this.videoSourceBuffer&&this.videoSourceBuffer.updating||this.audioSourceBuffer&&this.audioSourceBuffer.updating||(this.waitEndOfStream&&(this.waitEndOfStream=!1,this._startEndOfStream()),this.handler&&this.handler.onSBUpdateEnd&&this.handler.onSBUpdateEnd()))}},{key:"onUpdateError",value:function(t){I.warn("[mse-".concat(this._num_,"] MSEPlayer.onUpdateError"),t)}},{key:"onVideoPause",value:function(t){var e=this;if(I.log("[mse-".concat(this._num_,"] MSEPlayer.onVideoPause userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," ").concat(this.getParentMessage())),this.h265Proxy&&this.h265Proxy.isReady&&this.h265Proxy.onVideoPause&&this.h265Proxy.onVideoPause(),!this.userPaused&&this.isLive){var i=this.video.video;(F.platform===L.PLATFORM_TYPE_NAME.wap||F.platform===L.PLATFORM_TYPE_NAME.web&&this.playing)&&(this.tryResumeCnt++,this.tryResumeCnt<5?i&&i.play().then(function(){I.log("[mse-".concat(e._num_,"] MSEPlayer.onVideoPause try play success"))}).catch(function(t){I.log("[mse-".concat(e._num_,"] MSEPlayer.onVideoPause try play fail: ").concat(t.message)),e.onPauseByBrowser()}):this.onPauseByBrowser())}}},{key:"onPauseByBrowser",value:function(){I.log("[mse-".concat(this._num_,"] MSEPlayer.onPauseByBrowser autoMutedPlay=").concat(this.autoMutedPlay," volume=").concat(this.getVolume()," muted=").concat(this.getMuted()," paused=").concat(this.video.video.paused," ").concat(this.getParentMessage())),Object(n.a)(Object(o.a)(i.prototype),"onPauseByBrowser",this).call(this),this.browserStatus!==G&&this.browserStatus!==W||(this.pausedByBrowser=!0,this.h265Proxy&&this.h265Proxy.isReady&&this.h265Proxy.onVideoPause&&this.h265Proxy.onVideoPause(),this.handler&&1===F.h5FirstPlay&&this.handler&&this.handler.onVideoStop&&this.handler.onVideoStop(this.getVideo(),this._hasVideo()))}},{key:"checkAutoMutedPlay",value:function(){var t=this.getVolume();I.log("[mse-".concat(this._num_,"] MSEPlayer.checkAutoMutedPlay volume=").concat(t,", muted=").concat(this.getMuted(),", paused=").concat(this.video.video.paused," ").concat(this.getParentMessage())),this.autoMutedPlay&&!this.getMuted()&&(t>0&&this.setVolume(0),this.video.play())}},{key:"onVideoTimeupdate",value:function(){this.handler&&this.handler.onVideoTimeupdate&&this.handler.onVideoTimeupdate()}},{key:"onVideoVolumeChange",value:function(){I.log("[mse-".concat(this._num_,"] MSEPlayer.onVideoVolumeChange volume: ").concat(this.getVolume(),", muted: ").concat(this.getMuted()," ").concat(this.getParentMessage())),this.handler&&this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.VOLUME_CHANGE,{volume:this.getVolume(),muted:this.getMuted()})}},{key:"onVideoPlaying",value:function(){if(this.handler&&this.handler.updateStatus){if(this.video&&this.video.video&&this.video.video.paused)return void I.log("[mse-".concat(this._num_,"] video is playing, video.paused=").concat(this.video.video.paused," userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," ").concat(this.getParentMessage()));I.log("[mse-".concat(this._num_,"] video is playing ").concat(this.getParentMessage()),this.isPureAudio);var t=this.isPureAudio?"AUDIO_PLAYING":U;this.handler.updateStatus(t)}}},{key:"onVideoPlay",value:function(t){I.log("[mse-".concat(this._num_,"] MSEPlayer.onVideoPlay userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," ").concat(this.getParentMessage())),this.h265Proxy&&this.h265Proxy.isReady&&this.h265Proxy.onVideoPlay&&this.h265Proxy.onVideoPlay()}},{key:"onVideoError",value:function(t){var e="";if(this.video.video.error){var i=this.video.video.error.code;e=" errCode="+i+" "+["Unknow","ç¨æ·ç»æ¢","ç½ç»é误","è§£ç é误","æ ¼å¼ä¸æ¯æ"][i],3!=i&&4!=i||(3==i&&this.handler.decoderDecodeError(),this.getIsMseHevc()?this.handler.onMseHevcError(2):(this._onErrorEvent(3==i?1:2),this._onPlayerError(!0)),D.decodeabnormal="abnormal_"+(new Date).getTime())}I.warn("[mse-".concat(this._num_,"] MSEPlayer.onVideoError id=").concat(t.currentTarget.id)+e,t),this.isLive||4===Y.getFirstFragStatus()&&Y.setFirstFragStatus(-4)}},{key:"pause",value:function(){I.info("[mse-".concat(this._num_,"] MSEPlayer.pause userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," ").concat(this.getParentMessage())),this.userPaused=!0,this.video&&this.video.pause()}},{key:"play",value:function(){I.info("[mse-".concat(this._num_,"] MSEPlayer.play userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," ").concat(this.getParentMessage())),this.userPaused=!1,this.pausedByBrowser=!1,this.video&&this.video.play()}},{key:"resetHls",value:function(){I.log("[mse-".concat(this._num_,"] MSEPlayer.resetHls")),Object(n.a)(Object(o.a)(i.prototype),"resetHls",this).call(this),this.audioSegments=[],this.videoSegments=[],this.clearSourceBuffer()}},{key:"seek",value:function(t){this.lastPlayTime=t,I.info("[mse-".concat(this._num_,"] MSEPlayer.seek userPause=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser," seekTime=")+t,"currentTime="+this.video.video.currentTime),this.userPaused=!1,this.pausedByBrowser=!1,this.video&&this.video.seek(t)}},{key:"onCheckTimer",value:function(t,e){if(this.playing&&this.isMediaSourceOpen){if(Object(n.a)(Object(o.a)(i.prototype),"onCheckTimer",this).call(this,t,e),0!=this.shildAudioStartTs&&this.video&&this.video.video){var s=this.getCurrentDts();this.video.video.muted&&s>=this.shildAudioStartTs&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.shieldAudioMute recover")),this.video.video.muted=!1,this.shildAudioStartTs=0)}
1var r=this.getBufferLen(),a=Number(D._printBufferLen);if(-1==a||a>0&&a==this._num_){var u=Math.max(0,r/100);I.debug("[mse-".concat(this._num_,"]"),"bufLen","-".repeat(u),r)}if(Number(D._printMseLog)&&this.audioSegments&&this.videoSegments&&I.debug("[mse-".concat(this._num_,"] MSE aSegments=").concat(this.audioSegments.length," vSegments=").concat(this.videoSegments.length," bufLen=").concat(this.getBufferLen())),!this.video.video.paused&&!this.userPaused){if(this.checkVideoRenderFrames(),null==this.videoElement&&this.isLive&&e%4==0&&r>F.jitJump[0]&&!Number(D._localFlvTest)){var l=.001*(F.jitJump[0]-F.jitJump[1]);this.video.video.currentTime+=l,I.warn("[mse-".concat(this._num_,"] MSEPlayer.onCheckTimer jumpTs=").concat(l," bufLen=").concat(this.getBufferLen()))}this.checkBuffer();var d=(this.handler?this.handler.lastEmptySliceTs:0)||0,c=d>0&&t-d<3e3,f=this._hasVideo();this.isLive&&f&&this.msePause.pausedTs>0&&t-this.msePause.pausedTs>5e3&&!c&&this.sensitivePause&&(I.warn("[mse-".concat(this._num_,"] MSEPlayer.onCheckTimer paused 5 sec. userPaused=").concat(this.userPaused," pausedByBrowser=").concat(this.pausedByBrowser)),this._onErrorEvent(3),this._onPlayerError(!0),this.handler&&this.handler.onPause5Sec&&this.handler.onPause5Sec())}}else this.parser&&this.parser.printPlayFrameInfo&&this.parser.printPlayFrameInfo()}},{key:"checkVideoRenderFrames",value:function(){var t=this.frameCallBackNums-this.lastFrameCallBackNums;this.parser&&this.parser.fps&&(this.parser.fps.getRecvFps()>=25&&0==t&&"visble"==document.visibilityState?this.isMseRCErrorCnt++:this.isMseRCErrorCnt=0,this.getIsMseHevc()&&this.video&&this.video.isSupportRVCB&&1==F.isMseCheckRcRd&&this.isMseRCErrorCnt>=10&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.checkVideoRenderFrames, close mse hevc!")),this.handler.onMseHevcError(3)));var e=g.now();this.renderList.length>=5&&this.renderList.shift(),"hidden"==document.visibilityState?(this.renderList.length=0,this.renderHiddenTs=e):(e-this.renderHiddenTs>=1e3||0==this.renderHiddenTs)&&!this.renderListFirst&&this.renderList.push(t),1==Number(D._printVideoCallBackFps)&&I.log("[mse-".concat(this._num_,"] MSEPlayer.checkVideoRenderFrames,isHevc=").concat(isHevc,",rfps=").concat(t,",vs=").concat(document.visibilityState,",rl=").concat(this.renderList.toString(),",ecECnt=").concat(this.isMseRCErrorCnt)),this.mseRenderList.push(t),this.renderListFirst=!1,this.lastFrameCallBackNums=this.frameCallBackNums}},{key:"getMseRenderList",value:function(){var t=v(this.mseRenderList);return this.mseRenderList.length=0,I.log("[mse-".concat(this._num_,"] MSEPlayer.renderList ").concat(this.getParentMessage()),t.toString()),t}},{key:"onCheckFastTimer",value:function(t,e){if(Object(n.a)(Object(o.a)(i.prototype),"onCheckFastTimer",this).call(this,t),this.playing&&this.isMediaSourceOpen&&!this.video.video.paused&&!this.userPaused){this.checkEmptyFrames(),this.checkDelayReset(),this.onJitterTimer(),this.msePause.check(t);var s=(this.handler?this.handler.lastEmptySliceTs:0)||0,r=s>0&&t-s<3e3,a=this._hasVideo();if(null==this.videoElement&&!this.pause500checked&&a&&this.msePause.pausedTs>0&&t-this.msePause.pausedTs>500&&!r){this.pause500checked=!0;var u=this.bufferedInfo(),l=u.bufferLen.toFixed(2),d=(u.nextStart-u.end).toFixed(2);if(I.info("[mse-".concat(this._num_,"] MSEPlayer.onCheckFastTimer paused"),"bufferLen="+l,"hole="+d,"nextStart="+u.nextStart.toFixed(2),"currentTime="+this.video.video.currentTime,"audioSegments=".concat(this.audioSegments.length," videoSegments=").concat(this.videoSegments.length," videoSamples=").concat(this.ctrlBuffer.avBuffer.vBuffer.getInfo()," audioSamples=").concat(this.ctrlBuffer.avBuffer.aBuffer.getInfo())),this.isLive&&"ts"!=this.videoType){this.video.printBuffered();var c=Number(u.nextStart);this.video.video&&c&&d>0&&d<3&&c-this.video.video.currentTime>.5&&(this.video.video.currentTime=c,I.log("[mse-".concat(this._num_,"] MSEPlayer.onCheckFastTimer try jump currentTime=")+this.video.video.currentTime))}}}}},{key:"onCheckFastWorkerTimer",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"onCheckFastWorkerTimer",this).call(this,t),this.playing&&this.isMediaSourceOpen&&!this.video.video.paused&&!this.userPaused&&this.msePauseWorker.check(t)}},{key:"checkEmptyFrames",value:function(){this.handler.setEmptyFrames&&this.parser.hasEmptyFrames&&this.handler.setEmptyFrames(this.parser.hasEmptyFrames)}},{key:"checkDelayReset",value:function(){this.delayReset&&this.getBufferLen()<500&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.checkDelayReset reset player")),this.remuxer.reset(),this.parser.setPaused(!1),this.delayReset=!1)}},{key:"_hasAudio",value:function(){return!!this.audioSourceBuffer||this.m4sPlayer&&this.m4sPlayer.hasVideo()}},{key:"_hasVideo",value:function(){return!!this.videoSourceBuffer||this.m4sPlayer&&this.m4sPlayer.hasVideo()}},{key:"_msePaused",value:function(t){this.pauseStat.pause(),this.handler.onPlayPause(t,this._hasVideo())}},{key:"_mseResume",value:function(t,e){this.pauseStat.resume(),this.pause500checked=!1,this.handler.onPlayResume(t,this._hasVideo())}},{key:"_msePausedWorker",value:function(t){this.handler.onPlayPauseWorker&&this.handler.onPlayPauseWorker(t,this._hasVideo())}},{key:"_mseResumeWorker",value:function(t,e){this.parser.dropFrameCtrl&&this.pausePerf.checkLive(this.pid,this.bitrate,this.pauseStat.getCnt(),this.buffered.continueBuffer)&&(this.parser.dropFrameCtrl.start(),this.parser.dropFrameDts.start()),this.handler.onPlayResumeWorker&&this.handler.onPlayResumeWorker(t,this._hasVideo())}},{key:"bufferedInfo",value:function(){var t,e,i,s,r,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:.2,n=[],o=[],u=this.video.video.buffered;for(r=0;r<u.length;r++)n.push({start:u.start(r),end:u.end(r)});for(n.sort(function(t,e){return t.start-e.start||e.end-t.end}),r=0;r<n.length;r++){var l=o.length;if(l){var d=o[l-1].end;n[r].start-d<a?n[r].end>d&&(o[l-1].end=n[r].end):o.push(n[r])}else o.push(n[r])}var c=this.video.video.currentTime;for(r=0,t=0,e=i=c;r<o.length;r++){var f=o[r].start,p=o[r].end;if(c+a>=f&&c<p)e=f,t=(i=p)-c;else if(c+a<f){s=f;break}}return s||(s=i),{bufferLen:t,start:e,end:i,nextStart:s}}},{key:"printBuffer",value:function(t){if(this.video.video){var e=this.video.video.buffered,i="buffered=["+(1e3*e.start(0)|0)+","+(1e3*e.end(0)|0)+"]",s=1e3*this.video.video.currentTime|0,r=this.getBufferLen();I.log("[mse-".concat(this._num_,"] MSEPlayer.printBuffer ").concat(t," currentTime=").concat(s," bufLen=").concat(r," ").concat(i," ").concat(this.getParentMessage()))}}},{key:"playbackRateSet",value:function(t){var e=this,i=this.getPlayVideo();if(i){var s=function(t){if(e.playRateIncrease%2==0){var s=t<1&&t+.02>1?1:t+.02;s>F.playbackrateMax&&(s=F.playbackrateMax),e.playRateDecrease=0,i.playbackRate=s}},r=function(t){if(e.playRateDecrease%2==0){var s=t>
11&&t-.02<1?1:t-.02;s<F.playbackrateMin&&(s=F.playbackrateMin),e.playRateIncrease=0,i.playbackRate=s}},a=this.getBufferLen(),n=i.playbackRate;t<0?r(n):t>0?s(n):1!==n&&(n<1&&a<this.JITTER_BUFLEN?r(n):n>1&&a>this.JITTER_BUFLEN?s(n):i.playbackRate=1),this.playRateDecrease++,this.playRateIncrease++}}},{key:"setMuffledVolume",value:function(t){this.video.setMuffledVolume(t)}},{key:"setPlaybackRate",value:function(t){if(!(this.handler&&this.handler._hyPlayer&&this.handler._hyPlayer.getSupportAuto)||this.handler._hyPlayer.getSupportAuto()){var e=this.getPlayVideo();e&&(e.playbackRate=t)}}},{key:"onJitterTimer",value:function(t,e){if(this.playing&&("ts"!=this.videoType||this.isLive)&&this.autoJitter&&!this.autoBitrateJitter){var i=this.getPlayVideo();if(i){var s=this.getBufferLen();if(F.getEnableJumpBuffer()||this.isShieldAudio){var r=g.now();if(this.latencySeek>0&&s>4e3)return void(i.currentTime+=s-this.latencySeek);if(this.enableLowLatency&&s>Number(F.jitLowLatency))i.currentTime+=s-F.jitLowLatency;else{var a=this.getFrameBufferLen();1==F.jumpBufferCfg2[0]&&(s+=a);var n=s-this.JITTER_BUFLEN;if(r-this.startPlayTime<this.startCd)return;if(this.isShieldAudio){var o=a+s,u=this.JITTER_BUFLEN+F.shieldAudioCfg[1],l=this.JITTER_BUFLEN;if(this.printJitter&&I.log("[mse-".concat(this._num_,"] MSEPlayer.onJitterTimer.shield bufLen=").concat(s,",frameBufLen=").concat(a,",minusBuffer=").concat(n,",newBuf=").concat(o-n)),(n=o-u)<=0||(s-n<l&&(n=s-l),n<0))return}if(this.isStartBuffer)n>=F.jumpBufferCfg[1]&&(this.isRevFastOver||r-this.startPlayTime>=this.startCdMax)&&this.setJumpBufferCurrentTime(n,s,1,r);else if(r-this.setVideoCurrentTime>=this.bufferCd||0==this.setVideoCurrentTime){if(r-this.startMoreBufferTime>=this.bufferMoreContinueTime&&0!=this.startMoreBufferTime)return void this.setJumpBufferCurrentTime(n,s,2,r);n>=F.jumpBufferCfg[1]?0==this.startMoreBufferTime&&(this.startMoreBufferTime=r):this.startMoreBufferTime=0}}}else if(this.latencySeek>0&&s>4e3)i.currentTime+=s-this.latencySeek;else try{var d=0;(s<this.JITTER_BUFMIN?d=s-this.JITTER_BUFLEN:s>this.JITTER_BUFMAX&&(d=s-this.JITTER_BUFMAX),this.enableLowLatency&&s>Number(F.jitLowLatency))?i.playbackRate=1.1:this.playbackrateChangeAccess?(d=Number(D.ab_adjust)||d,1!=i.playbackRate&&this.isPlaybackRateNormal&&I.log("[mse-".concat(this._num_,"] MSEPlayer.onJitterTimer.playbackRate="),i.playbackRate),1!=i.playbackRate?this.isPlaybackRateNormal=!1:this.isPlaybackRateNormal=!0,this.playbackRateSet(d)):i.playbackRate=1,-1===Number(D._print_ab_log)&&I.log("[mse-".concat(this._num_,"] BUFMIN: %d, BUFMAX: %d, BUFLEN:%d, bufLen: %d, adjust: %d, playbackRate: %f"),this.JITTER_BUFMIN,this.JITTER_BUFMAX,this.JITTER_BUFLEN,s,d,i.playbackRate)}catch(t){I.error("[mse-".concat(this._num_,"] MSEPlayer.onJitterTimer set playbackRateSet error"),t)}}}}},{key:"setJumpBufferCurrentTime",value:function(t,e,i,s){this.lastJumpBufferTs=s||g.now(),this.h265Proxy&&this.h265Proxy.isReady&&!this.h265Proxy.isH265MseCodec?(-1==D._printWasmJump&&I.log("[mse-".concat(this._num_,"] MSEPlayer.setJumpBufferCurrentTime"),t,e,i,s),this.h265Proxy.jumpBuffer(t,e,i,s)):this.setVideoCurrentTimeHand(t,e,i,s)}},{key:"setVideoCurrentTimeHand",value:function(t,e,i,s){var r=this.getPlayVideo();if(r){var a="";1===i?(this.isStartBuffer=!1,a="fiveJump"):2===i&&(a="ContinueJudgeJump",this.startMoreBufferTime=0),I.log("[mse-".concat(this._num_,"] MSEPlayer.onJitterTimer.jumpBuffer ").concat(a," video.currentTime before=").concat(r.currentTime," bufLen=").concat(e," minusBuffer=").concat(t," curDts=").concat(this.getCurrentDts())),r.currentTime+=t/1e3,this.setVideoCurrentTime=s,I.log("[mse-".concat(this._num_,"] MSEPlayer.onJitterTimer.jumpBuffer ").concat(a," video.currentTime now=").concat(r.currentTime," curDts=").concat(this.getCurrentDts()," bufLen=").concat(this.getBufferLen()," frameBufLen=").concat(this.getFrameBufferLen()))}}},{key:"onWasmRenderCallback",value:function(){this.video._renderCallback()}},{key:"requestVideoFrameCallback",value:function(){if(this.frameCallBackNums++,F.renderStat[0]){this.renderFps&&this.renderFps.addRender();var t=g.now(),e=t-this.videoCallBackTs;0!=this.videoCallBackTs&&e>=200&&(I.log("[mse-".concat(this._num_,"] MSEPlayer.requestVideoFrameCallback dis=").concat(e," ").concat(this.getParentMessage())),this.videoCallBackLargeCnt++);var i=this.getCurrentRealTime();this.audioPlayConsuming.addRenderFrameData(i,t),this.videoPlayConsuming.addRenderFrameData(i,t),this.videoCallBackTs=t}}},{key:"getOsDiscardConfig",value:function(){var t=p.os||"",e=p.osVersion||"";return"windows"==t.toLocaleLowerCase()&&7==Number(e)||1==Number(D._enableOsDiscardFrame)}},{key:"getIsMseHevc",value:function(){return this.videoCodec&&(-1!=this.videoCodec.indexOf("hev")||-1!=this.videoCodec.indexOf("hvc"))}},{key:"getVideoCapabilities",value:function(t){var e=this;navigator&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo({type:"media-source",video:{contentType:'video/mp4;codecs="'.concat(t.videoCodec,'"'),width:t.videoWidth,height:t.videoHeight,bitrate:1e4,framerate:60}}).then(function(t){t&&t.supported&&I.log("[mse-".concat(e._num_,"] MSEPlayer.getVideoCapabilities"),JSON.stringify(t))})}},{key:"switchShieldAudio",value:function(t){this.ctrlBuffer.switchShieldAudio(t)}},{key:"check500Pause",value:function(){this.handler.check500Pause&&this.handler.check500Pause()}},{key:"isSupportRequestVideoFrameCallback",value:function(){return this.video&&this.video.isSupportRequestVideoFrameCallback()}},{key:"getRenderElement",value:function(){return this.getCodecType()===t$&&this.h265Proxy&&this.h265Proxy.isReady?this.h265Proxy.getRenderElement():this.video.video}},{key:"getParentMessage",value:function(){return iM.getParentMessage(this.video&&this.video.video)}}]),i}(iL),iB=function(){function t(e){Object(s.a)(this,t),this._config=e,this._receivedLength=0,this._status=0,this.fromByte=0,this.toByte=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.fromByte=0,this.toByte=0,this.onChunk=null,this.onSuccess=null,this.onError=null,this.onTimeout=null,this._status=0,this._clearTimeout(),this.abort()}}
1,{key:"loadBuffer",value:function(t,e,i,s,r,a,n,o,u){this.url=t,this.onOpen=e,this.onChunk=i,this.onSuccess=s,this.onError=r,this.onTimeout=a,this.stats={trequest:performance.now(),retry:0},this.timeout=n,this.maxRetry=o,this.retryDelay=u,this.timeoutHandle=window.setTimeout(this.loadtimeout.bind(this),n),this.loadInternal()}},{key:"loadInternal",value:function(){var t=this;this._requestAbort=!1;var e=new self.Headers;this.fromByte>0&&e.append("Range","bytes=".concat(this.fromByte,"-").concat(this.toByte>0?this.toByte:"")),fetch(this.url,{method:"GET",headers:e,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"}).then(function(e){if(!t._requestAbort)return e.ok&&e.status>=200&&e.status<=299?(t._status=e.status,t._onopen({code:t._status}),t._pump.call(t,e.body.getReader())):(t._status=e.status,void t._onerror({code:e.status,msg:e.statusText}));t._requestAbort=!1})}},{key:"abort",value:function(){this._requestAbort=!0}},{key:"_clearTimeout",value:function(){var t=this.timeoutHandle;t&&(clearTimeout(t),this.timeoutHandle=null)}},{key:"_pump",value:function(t){var e=this;return t.read().then(function(i){if(e._clearTimeout(),i.done)e._onsuccess();else{if(!0===e._requestAbort)return e._requestAbort=!1,t.cancel();var s=i.value.buffer;e.onChunk&&e.onChunk(s,L.HLS_LOAD_TYPE.FETCH),e._pump(t)}})}},{key:"_onopen",value:function(t){this.onOpen&&this.onOpen(t)}},{key:"_onerror",value:function(t){0!==t.code&&404!==t.code?this.stats.retry<this.maxRetry?(I.warn("FetchLoader.loaderror url=".concat(this.url," retryDelay=").concat(this.retryDelay," error: "),t),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),this.stats.retry++,this.abort()):(this._clearTimeout(),I.warn("FetchLoader.loaderror reach max retry url=".concat(this.url," error: "),t),this.onError&&this.onError(t)):this.onError&&this.onError(t)}},{key:"_onsuccess",value:function(){this._clearTimeout(),this.onSuccess&&this.onSuccess(L.HLS_LOAD_TYPE.FETCH)}},{key:"loadtimeout",value:function(){this._status=-2,this.stats.retry<this.maxRetry?(I.warn("FetchLoader.loadtimeout url="+this.url+" retryDelay="+this.retryDelay),this.abort(),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),this.stats.retry++):(this._clearTimeout(),I.warn("FetchLoader.loadtimeout max retry url="+this.url),this.onTimeout&&this.onTimeout())}}],[{key:"isSupported",value:function(){if(1==D._noFetch)return!1;try{var t=S.msedge&&S.version.minor>=15048,e=!S.msedge||t;return fetch&&ReadableStream&&e}catch(t){return!1}}}]),t}(),iV=function(){function t(){Object(s.a)(this,t),this.hlsPlayer=null,this.cachedVodBlock={},this.vodBlockReasons=[]}return Object(r.a)(t,[{key:"destroy",value:function(){this.hlsPlayer=null,this.cachedVodBlock=null,this.vodBlockReasons=null}},{key:"setHlsPlayer",value:function(t){this.hlsPlayer=t}},{key:"cacheBlockReason",value:function(t,e){!t||e<=0||(I.log("VodBlockHelper.checkInBufBlock: reason=",t,e),this.cachedVodBlock[t.CODE]=e)}},{key:"checkInBufBlock",value:function(){if(this.hlsPlayer){var t=eh,e=this.hlsPlayer.getCurrentTime();for(var i in this.cachedVodBlock)if(Math.abs(this.cachedVodBlock[i]-e)<1){if(i===e_.CODE){t=e_,delete this.cachedVodBlock[i];break}if(t===em.CODE){t=em,delete this.cachedVodBlock[i];break}if(t===ef.CODE){t=ef,delete this.cachedVodBlock[i];break}}t===eh&&this.hlsPlayer.getBufferLen()>1e3&&(t=ep),I.log("VodBlockHelper.checkInBufBlock: reason code =",t.CODE),this.vodBlockReasons.push(t)}}},{key:"checkNoBufBlock",value:function(){if(this.hlsPlayer){var t=eh,e=this.hlsPlayer.playlist.currFrag;if(e){t=e.isPcdn?eu:el;var i=this.vodBlockReasons.find(function(t){return t.code===eu.CODE}),s=this.vodBlockReasons.find(function(t){return t.code===el.CODE});i&&s&&(t=ed),e.isLoadError&&(t=e.isPcdn?eu:el);var r=this.vodBlockReasons.find(function(t){return t.code===eu.CODE}),a=this.vodBlockReasons.find(function(t){return t.code===el.CODE});r&&a&&(t=ec),I.log("VodBlockHelper.checkNoBufBlock: reason code =",t.CODE),this.vodBlockReasons.push(t)}}}},{key:"checkVodBlock",value:function(){this.hlsPlayer&&(this.checkInBufBlock(),this.hlsPlayer.getBufferLen()<1e3&&this.checkNoBufBlock())}},{key:"getBlockReason",value:function(){return this.vodBlockReasons.length<=0?0:(this.vodBlockReasons=this.vodBlockReasons.sort(function(t,e){return t.PRIORITY-e.PRIORITY}),this.vodBlockReasons[0].CODE)}},{key:"resetBlockReason",value:function(){this.vodBlockReasons=[]}}]),t}(),iU=function(){function t(e){var i=e.presenterUid,r=e.lineType;Object(s.a)(this,t),this.heartMode=O.getCfgValue(F.heartMode,i,r,1),this.heartQpsOpen=O.isOpen(F.heartQpsPids,i,r,!1),this.heartQps=O.getCfgValue(F.heartQps,i,r,0),this.batch_id=0,this.heartList=[]}return Object(r.a)(t,[{key:"destroy",value:function(){this.heartList=null}}
1,{key:"sendQps",value:function(t,e,i){var s=this,r=Math.floor(Date.now()/1e3);0===this.batch_id&&(this.batch_id=r);var a=[];e.forEach(function(t){if(t.vDimension[R.DIM_CORE.REPROT_TIME]=r,2===s.heartMode&&s.heartQpsOpen)t.vDimension[R.DIM_CORE.BATCH_ID]=s.batch_id,t.vDimension[R.DIM_CORE.REPORT_TYPE]=1;else if(3===s.heartMode){var e={sMetricName:t.sMetricName,vDimension:{},vField:{},vExLog:{}};Object.assign(e.vDimension,t.vDimension),Object.assign(e.vField,t.vField),Object.assign(e.vExLog,t.vExLog),e.vDimension[R.DIM_CORE.BATCH_ID]=s.batch_id,e.vDimension[R.DIM_CORE.REPORT_TYPE]=1,a.push(e)}}),1===this.heartMode?t.sendMetrics(e):2===this.heartMode?this.heartQpsOpen?this.storeAndSend(t,e,i):t.sendMetrics(e):3===this.heartMode&&(t.sendMetrics(e,i),this.storeAndSend(t,a,i))}},{key:"storeAndSend",value:function(t,e,i){if(this.heartList.push(e),this.heartList.length>=this.heartQps||i){for(var s=[],r=0;r<this.heartList.length;r++)s=s.concat(this.heartList[r]);this.heartList=[],this.batch_id=0,t.sendMetrics(s)}}}]),t}(),ix=new(function(){function t(){Object(s.a)(this,t),this._signalRtt=new d.SignalRttImpl(tC)}return Object(r.a)(t,[{key:"getStats",value:function(){return this._signalRtt.getStats()}},{key:"start",value:function(t,e){if(!this._start){this._start=!0;var i=O.isOpen(F.signalRttPids,t,-1,!1);!i&&F.isSignalRttOpen(e)&&(i=!0),i?(I.log("SignalRtt.start","pid",t,"uid",e,"open"),tP.add(this._onTimer,this,100)):I.log("SignalRtt.start","pid",t,"uid",e,"not open")}}},{key:"_onTimer",value:function(t){this._signalRtt.onTimer(t)}}]),t}()),iH=function(){function t(e){Object(s.a)(this,t),this.handlerPlayer=e,this.stat=e.stat,this.tsdb=e.tsdb,this.statVod=e.statVod,this._statQps=null}return Object(r.a)(t,[{key:"destroy",value:function(){this.handlerPlayer=null,this.stat=null,this.tsdb=null,this.statVod=null,this._statQps&&this._statQps.destroy(),this._statQps=null}},{key:"statQps",get:function(){return this._statQps||(this._statQps=new iU({presenterUid:this.handlerPlayer.info.presenterUid,lineType:this.handlerPlayer.info.lineType})),this._statQps}},{key:"recordMpsStat",value:function(t){if(this.stat.setCore(R.CORE.MPS_SUBS,t),window.mpsApi){var e=window.mpsApi.getHeartStats();e&&(this.stat.setComDim(R.DIM_COM.MPS_STATUS,e.mps_status),this.stat.setComDim(R.DIM_COM.NAT,e.nat),this.stat.setComDim(R.DIM_COM.NAT_SYNC,e.nat_sync),this.stat.setComDim(R.DIM_COM.IP_STACK_TYPE,e.ipStackType),this.stat.setCore(R.CORE.MPS_SRC,e.mps_src),this.stat.setCore(R.CORE.MPS_UP,e.mps_up),this.stat.setCore(R.CORE.MPS_SRC_BW,e.mps_src_bw),this.stat.setCore(R.CORE.MPS_UP_BW,e.mps_up_bw))}}},{key:"recordBaseStat",value:function(){var t=null;if(this.handlerPlayer.mse&&this.handlerPlayer.mse.getWebCodecsStats&&(t=this.handlerPlayer.mse.getWebCodecsStats()),this.handlerPlayer&&this.handlerPlayer.mse){var e=this.handlerPlayer.mse.renderFps.getPageRecordFps(),i=e.pfps,s=e.pfpsMax,r=e.pfpsMin;this.stat.setCore(R.DIM_CORE.PFPS,i),this.stat.setCore(R.DIM_CORE.PFPSMAX,s),this.stat.setCore(R.DIM_CORE.PFPSMIN,r),this.handlerPlayer._hyPlayer&&this.handlerPlayer._hyPlayer.roomRecordStat&&this.handlerPlayer._hyPlayer.roomRecordStat.setPageFps({pfps:i,pfpsMax:s,pfpsMin:r}),I.log("BaseQAStat.recordBaseStat pfps=".concat(i,", pfpsMax=").concat(s,", pfpsMin=").concat(r))}if(this.handlerPlayer&&this.handlerPlayer.mse&&this.handlerPlayer.mse.getRealFps){var a=this.handlerPlayer.mse.getRealFps();a>30&&a<=33&&(a=30),a>24&&a<27&&(a=24),this.stat.setCoreDim(R.DIM_COM.FRAMERATE,a)}if(this.handlerPlayer&&!this.handlerPlayer.isLive&&this.handlerPlayer.getFps){var n=this.handlerPlayer.getFps();n>30&&n<=33&&(n=30),n>24&&n<27&&(n=24),this.stat.setCoreDim(R.DIM_COM.FRAMERATE,n),this.statVod&&this.statVod.setComDim(R.VOD_DIM_COM.FRAMERATE,n)}t&&this.recordWebCodecsStat(t),this.recordEnhanceStat(t),this.recordSignalRtt()}},{key:"recordWebCodecsStat",value:function(t){for(var e in t)"decodedList"==e?this.recordFrameInfo(t[e],R.DIM_COM.V_DECODE_FRAME):"renderList"==e?this.recordFrameInfo(t[e],R.DIM_COM.V_PLAY_FRAME):"videoToDecodeList"==e?this.recordFrameInfo(t[e],R.DIM_COM.V_TO_DECODE_FRAMES):"delayList"==e?this.recordFrameInfo(t[e],R.DIM_COM.V_TO_PLAY_FRAME):"deltaList"==e&&this.recordFrameInfo(t[e],R.DIM_COM.AV_DELTA)}},{key:"recordFrameInfo",value:function(t,e){var i=this;this.stat.setComp(e,"size",t.length),t.map(function(t,s){i.stat.setComp(e,"k"+(s+1),t),i.stat.setCompFormat(e,":",",")}),this.handlerPlayer&&!this.handlerPlayer.isLive&&this.statVod&&(this.statVod.setComp(e,"size",t.length),t.map(function(t,s){i.statVod.setComp(e,"k"+(s+1),t),i.statVod.setCompFormat(e,":",",")}))}},{key:"recordSignalRtt",value:function(){var t=ix.getStats();this.recordFrameInfo(t.rttSamples,R.DIM_COM.SIGNAL_RTT),this.stat.setCore(R.DIM_COM.SIGNAL_RTT_MAX,t.rttMax)}},{key:"recordHeart",value:function(){this.stat.setComDim(R.DIM_COM.USER_UUID,w.uuid),this.recordAudioEmpty()}},{key:"recordAudioEmpty",value:function(){var t=this,e=this.handlerPlayer.getEmptyAudioRecord(),i=R.DIM_COM.A_RENDER_SILENCE_TIME,s=e.length;e.reverse(),this.stat.setComp(i,"size",s),e.map(function(e,r){t.stat.setComp(i,"k"+4*(s-r),e),t.stat.setCompFormat(i,":",",")});var r=this.handlerPlayer.getVoiceStats();this.stat.setCore(R.CORE.A_VOL,this.handlerPlayer.getVolume()),this.stat.setCore(R.CORE.A_E_DUR,r.noVoiceDur),this.stat.setCore(R.CORE.A_E_CNT,r.noVoiceCnt),this.stat.setCoreDim(R.DIM_COM.A_CFG,+!!this.handlerPlayer.hasAudioCfg())}},{key:"sendRecordMetrics",value:function(){this.recordMosaicData(),this.recordMuffleData()}},{key:"recordMosaicData",value:function(){if(this.handlerPlayer._hyPlayer.getMosaicStat){var t=this.handlerPlayer._hyPlayer.getMosaicStat().data;if(null==t)return;var e=t.statDatas.length,i=0,s=0,r=0,a=[],n={};t.statDatas.map(function(t,o){e-o<=3&&a.push(t.pixelateKey),0==t.suc?i++:1==t.suc?s++:2==t.suc&&r++,n.dts_type=t.dtsType}),n.success_cnt=i,n.fail_cnt=s,n.partial_success_cnt=r,n.req_keys=a.join(","),n.buss="video_pixelate",n=JSON.stringify(n),I.log("BaseQaStat.recordMosaicData",n),e>0&&this.stat.setCoreDim(R.DIM_COM.MOSAIC_DATA,n),this.stat.setCore(R.CORE.MOSAIC_COUNT,t.mosaicCnt),this.stat.setCore(R.CORE.MOSAIC_DURATION,t.mosaicDuration)}if(this.handlerPlayer._hyPlayer.getMosaicGrassMode){var o=this.handlerPlayer._hyPlayer.getMosaicGrassMode();this.stat.setCore(R.CORE.USED_XP2P,o)}}},{key:"recordMuffleData",value:function(){if(this.handlerPlayer&&this.handlerPlayer.mse&&this.handlerPlayer.mse.getMuffleStat){var t=this.handlerPlayer.mse.getMuffleStat(),e=t.muffleCnt,i=t.muffleDuration;this.stat.setCore(R.CORE.MUTE_COUNT,e),this.stat.setCore(R.CORE.MUTE_DURATION,i)}}},{key:"recordEnhanceStat",value:function(t){var e={v_frames:0,v_enhance_delay:-1},i=this.handlerPlayer.getEnhanceStats(),s=this.handlerPlayer.getDpi(),r=s.width,a=s.height;if(i&&(e.v_enhance=i.vEnhanceType,e.v_support=i.vSupport,e.v_gameId=i.vGameId,e.v_errorCode=i.vErrorCode,e.v_width=r,e.v_height=a),e.v_refreshRate=this.handlerPlayer.getRefreshRate(),t){var n=[],o=[],u=0,l=0,d=0,c=0,f=0;for(var p in t){var m=t[p];
1"videoEnhanceList"==p?n=m:"videoEnhanceCostList"==p?o=m:"ehLess30Nums"==p?u=m:"ehLess150Nums"==p?l=m:"ehLess200Nums"==p?d=m:"ehLarge200Nums"==p?c=m:"ehTotal"==p&&(f=m)}this.stat.setCore(R.DIM_CORE.ENHACNE_LESS_30,u),this.stat.setCore(R.DIM_CORE.ENHACNE_LESS_150,l),this.stat.setCore(R.DIM_CORE.ENHACNE_LESS_200,d),this.stat.setCore(R.DIM_CORE.ENHACNE_LARGE_200,c),this.stat.setCore(R.DIM_CORE.ENHANCE_TOTAL,f),this.handlerPlayer&&!this.handlerPlayer.isLive&&this.statVod&&(this.statVod.setCore(R.VOD_DIM_CORE.ENHACNE_LESS_30,u),this.statVod.setCore(R.VOD_DIM_CORE.ENHACNE_LESS_150,l),this.statVod.setCore(R.VOD_DIM_CORE.ENHACNE_LESS_200,d),this.statVod.setCore(R.VOD_DIM_CORE.ENHACNE_LARGE_200,c),this.statVod.setCore(R.VOD_DIM_CORE.ENHANCE_TOTAL,f)),n.length>0&&(e.v_frames=~~(n.reduce(function(t,e){return t+e})/n.length)),o.length>0&&(e.v_enhance_delay=~~(o.reduce(function(t,e){return t+e})/o.length))}this.stat.setCoreDim(R.DIM_COM.FEATURE_STATUS,JSON.stringify(e)),this.handlerPlayer&&!this.handlerPlayer.isLive&&this.statVod&&this.statVod.setCoreDim(R.VOD_DIM_COM.FEATURE_STATUS,JSON.stringify(e))}},{key:"reportVideoBadQuality",value:function(t,e,i,s,r,a){I.log("QAStat.reportVideoBadQuality, isPaused=".concat(t,", pauseCnt=").concat(e,", pauseWorkerCnt=").concat(s,", isFramePaused=").concat(a));var n=this.handlerPlayer.getPause500Cnt();if(this.handlerPlayer.h265Proxy&&this.handlerPlayer.h265Proxy.rendering)this.reportH265(t,e,i,n,s,r);else{var o=document.visibilityState,u=t||e>0?100:0,l=this.handlerPlayer.mse&&this.handlerPlayer.mse.getVideoCBLargeCnt(),d=this.handlerPlayer.mse&&this.handlerPlayer.mse.getVideoFrameCallBackNums();1==F.isFilterMsePause&&this.handlerPlayer.isMse&&"visible"==o&&d>0?(t||e>0)&&l>0?(this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,100),this.addHiddenCheckerVideoBadQuality(100,i)):(this.addHiddenCheckerVideoBadQuality(0,i),this.stat.setCore(R.CORE.VIDEO_BLOCK_COUNT,0),this.stat.setCore(R.CORE.VIDEO_BLOCK_DURATION,0)):(this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,u),this.addHiddenCheckerVideoBadQuality(u,i)),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY_OLD,100*!!t),this.handlerPlayer.mse&&this.handlerPlayer.mse.getMseRenderList&&this.recordFrameInfo(this.handlerPlayer.mse.getMseRenderList(),R.DIM_COM.V_PLAY_FRAME),this.stat.setCoreDim(R.DIM_CORE.VIDEO_H265_BAD_QUALITY,n>0||r||s>0?100:0),this.handlerPlayer&&(this.handlerPlayer.isWebCodec?this.stat.setCoreDim(R.DIM_COM.MP_EXPERIMENT,100*!!a):this.stat.setCoreDim(R.DIM_COM.MP_EXPERIMENT,t||e>0?100:0)),100===u&&this.tsdb.autoReport()}}},{key:"addHiddenCheckerVideoBadQuality",value:function(t,e){!e&&this.handlerPlayer._hiddenStopChecker&&this.handlerPlayer._hiddenStopChecker.addVideoBadQuality(t)}},{key:"reportH265",value:function(t,e,i,s,r,a){var n=this.handlerPlayer.h265Proxy.getStats(i),o=n.h265PauseCnt,u=n.videoPauseCnt,l=n.videoPauseTime,d=n.isVideoPaused,c=n.hiddenTime,f=n.statProps,p=n.pause500CntH265,m=n.isFramePaused;I.log("QAStat.reportH265, videoPauseCnt=".concat(u,", pause500CntH265=").concat(p,", isFramePaused=").concat(m));var _=100*(o>0),y=t||e>0?100:0,v=d||u>0?100:0;for(var S in this.handlerPlayer.h265Proxy.render.isHidden&&c>=2e4?(this.stat.setCoreDim(R.DIM_CORE.VIDEO_H265_BAD_QUALITY,s>0||a||r>0?100:0),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,y),this.addHiddenCheckerVideoBadQuality(y,i)):(this.stat.setCoreDim(R.DIM_CORE.VIDEO_H265_BAD_QUALITY,p>0&&v?100:0),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,v),this.stat.setCore(R.CORE.VIDEO_BLOCK_COUNT,u),this.stat.setCore(R.CORE.VIDEO_BLOCK_DURATION,l),this.addHiddenCheckerVideoBadQuality(v,i)),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY_OLD,_),this.stat.setComDim(R.DIM_COM.MP_EXPERIMENT,100*!!m),f)"toDecode"==S?this.recordFrameInfo(f[S],R.DIM_COM.V_TO_DECODE_FRAMES):"decoded"==S?this.recordFrameInfo(f[S],R.DIM_COM.V_DECODE_FRAME):"render"==S?this.recordFrameInfo(f[S],R.DIM_COM.V_PLAY_FRAME):"rawList"==S||("frameList"==S?this.recordFrameInfo(f[S],R.DIM_COM.V_TO_PLAY_FRAME):this.stat.setComp(R.DIM_H265_SAM.name,S,f[S].join("|")));100===y&&this.tsdb.autoReport()}},{key:"rcordCaptureJitter",value:function(t){if(t)for(var e in t){var i=t[e];for(var s in i)this.stat.setCore(s,i[s])}}}]),t}(),iG=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).tsdbUtil=r.handlerPlayer.tsdb,r.isPaused=!1,r.tsOpens=[],r.tsLoadeds=[],r.tsSpeeds=[],r.tsSizes=[],r}return Object(r.a)(i,[{key:"destroy",value:function(){Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this),this.tsdbUtil=null,this.tsOpens=null,this.tsLoadeds=null,this.tsSpeeds=null,this.tsSizes=null,tP.remove(this.checkSuc,this),tP.remove(this.checkVideo,this)}},{key:"statQps",get:function(){return this._statQps||(this._statQps=new iU({presenterUid:this.handlerPlayer.info.presenterUid,lineType:this.handlerPlayer.info.lineType})),this._statQps}},{key:"setPause",value:function(){this.isPaused=!0,this.stat.setCore(R.DIM_CORE.VIDEO_BAD_QUALITY,100)}},{key:"start",value:function(){this.stop(),tP.once(this.checkSuc,this,1e4),tP.once(this.checkVideo,this,2e4)}},{key:"stop",value:function(){this.tsOpens=[],this.tsLoadeds=[],this.tsSpeeds=[],this.tsSizes=[],tP.remove(this.checkSuc,this),tP.remove(this.checkVideo,this)}},{key:"checkSuc",value:function(){var t=this.handlerPlayer,e=t._loaderType,i=t.hasVideo,s=t.url,r=t.playTs,a=[];a.push(this.stat.createAct(R.ACT.HLS_PLAY_SUCC,{value:[100*!!i,e],str:[s,"".concat(r)]})),this.tsdbUtil.sendMetrics(a)}},{key:"checkVideo",value:function(){var t=100*!!this.handlerPlayer.hasVideo,e=[];e.push(this.stat.createAct(R.ACT.HLS_LOAD_SUCC,{value:[t]})),this.tsdbUtil.sendMetrics(e)}},{key:"report",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=[];
1if(0===F.statLv[15]&&e.push({sMetricName:J.METRIC.VIDEO_BAD_QUALITY_RATIO,vField:{value:100*!!this.isPaused},vDimension:{p2p:2}}),this.handlerPlayer.mse.metadata.recvAudioFps&&this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_RATE,this.handlerPlayer.mse.metadata.recvAudioFps),this.handlerPlayer.mse.metadata.recvVideoFps&&this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_RATE,this.handlerPlayer.mse.metadata.recvVideoFps),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.SPEED,this.handlerPlayer.getSpeed()),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_DTS,this.handlerPlayer.mse.curVideoDts),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_DTS,this.handlerPlayer.mse.curAudioDts),this.stat.setCompFormat(R.DIM_LINK_SAM.name,":",","),this.stat.setCore(R.CORE.PLAY_DELAY,this.handlerPlayer.getBufferLen()),this.stat.setCore(R.CORE.FRAME_BUFFER_DELAY,this.handlerPlayer.getFrameBufferLen()),this.handlerPlayer.h265Proxy.rendering&&(this.h265PauseProps=this.handlerPlayer.h265Proxy.getStats(t)),this.recordBaseStat(),this.reportVideoBadQuality(this.isPaused,t),this.isPaused){var i=this.handlerPlayer.blockHelper;if(i){var s=i.getBlockReason();this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_REASON,s)}}this.stat.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_OPEN_AVG,this.getAvg(this.tsOpens)),this.stat.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_LOADED_AVG,this.getAvg(this.tsLoadeds)),this.stat.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_SPEED_AVG,this.getAvg(this.tsSpeeds)),this.stat.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_SIZE_AVG,this.getAvg(this.tsSizes)),this.stat.fill(e,t),this.handlerPlayer&&!this.handlerPlayer.isLive&&this.reportVod(e,t),this.statQps.sendQps(this.tsdbUtil,e,t),this.isPaused=!1,this.handlerPlayer&&(this.handlerPlayer.blockHelper&&this.handlerPlayer.blockHelper.resetBlockReason(),this.handlerPlayer.resetHeartTsTime()),this.tsOpens=[],this.tsLoadeds=[],this.tsSpeeds=[],this.tsSizes=[]}},{key:"reportVideoBadQuality",value:function(t,e){this.handlerPlayer.h265Proxy&&this.handlerPlayer.h265Proxy.rendering?this.reportH265(t,e):this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,100*!!t)}},{key:"reportH265",value:function(t,e){var i=this.h265PauseProps,s=i.videoPauseCnt,r=i.isVideoPaused,a=i.hiddenTime,n=i.statProps,o=100*!!t,u=r||s>0?100:0;for(var l in this.handlerPlayer.h265Proxy.render.isHidden&&a>=2e4?(this.stat.setCoreDim(R.DIM_CORE.VIDEO_H265_BAD_QUALITY,u),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,o)):(this.stat.setCoreDim(R.DIM_CORE.VIDEO_H265_BAD_QUALITY,o),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,u)),n)"toDecode"==l?this.recordH265Frame(n[l],R.DIM_COM.V_TO_DECODE_FRAMES):"decoded"==l?this.recordH265Frame(n[l],R.DIM_COM.V_DECODE_FRAME):"render"==l?this.recordH265Frame(n[l],R.DIM_COM.V_PLAY_FRAME):"rawList"==l?this.recordH265Frame(n[l],R.DIM_COM.V_RECV_FRAME):"frameList"==l||this.stat.setComp(R.DIM_H265_SAM.name,l,n[l].join("|"))}},{key:"recordH265Frame",value:function(t,e){var i=this;this.stat.setComp(e,"size",t.length),t.map(function(t,s){i.stat.setComp(e,"k"+(s+1),t),i.stat.setCompFormat(e,":",",")}),this.handlerPlayer&&!this.handlerPlayer.isLive&&(this.statVod.setComp(e,"size",t.length),t.map(function(t,s){i.statVod.setComp(e,"k"+(s+1),t),i.statVod.setCompFormat(e,":",",")}))}},{key:"reportVod",value:function(t,e){if(this.handlerPlayer.mse.metadata.recvAudioFps&&this.statVod.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_RATE,this.handlerPlayer.mse.metadata.recvAudioFps),this.handlerPlayer.mse.metadata.recvVideoFps&&this.statVod.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_RATE,this.handlerPlayer.mse.metadata.recvVideoFps),this.statVod.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.SPEED,this.handlerPlayer.getSpeed()),this.statVod.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_DTS,this.handlerPlayer.mse.curVideoDts),this.statVod.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_DTS,this.handlerPlayer.mse.curAudioDts),this.statVod.setCompFormat(R.DIM_LINK_SAM.name,":",","),this.statVod.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_OPEN_AVG,this.getAvg(this.tsOpens)),this.statVod.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_LOADED_AVG,this.getAvg(this.tsLoadeds)),this.statVod.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_SPEED_AVG,this.getAvg(this.tsSpeeds)),this.statVod.setComp(R.HLS_INFO.name,R.HLS_INFO.TS_SIZE_AVG,this.getAvg(this.tsSizes)),this.statVod.setCoreDim(R.VOD_DIM_CORE.TS_START_TIME,this.handlerPlayer.heartTsStartTime),this.statVod.setCoreDim(R.VOD_DIM_CORE.TS_END_TIME,this.handlerPlayer.heartTsEndTime),this.handlerPlayer.h265Proxy.rendering){var i=this.h265PauseProps,s=i.videoPauseCnt,r=i.isVideoPaused,a=i.hiddenTime,n=100*!!this.isPaused,o=r||s>0?100:0;this.handlerPlayer.h265Proxy.render.isHidden&&a>=2e4?(this.statVod.setCoreDim(R.VOD_CORE.VIDEO_H265_BAD_QUALITY,o),this.statVod.setCore(R.VOD_CORE.VOD_BAD_QUALITY,n)):(this.statVod.setCoreDim(R.VOD_CORE.VIDEO_H265_BAD_QUALITY,n),this.statVod.setCore(R.VOD_CORE.VOD_BAD_QUALITY,o))}else this.statVod.setCore(R.VOD_CORE.VOD_BAD_QUALITY,100*!!this.isPaused);if(this.isPaused){var u=this.handlerPlayer.blockHelper;if(u){var l=u.getBlockReason();this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_REASON,l)}}this.statVod.fill(t,e)}},{key:"getAvg",value:function(t){var e=t.length;if(0===e)return 0;for(var i=0,s=0;s<e;s++)i+=t[s];return Math.floor(i/e)}}]),i}(iH),iW=function(){function t(e){Object(s.a)(this,t),this._hlsPlayer=e,this._seekTime=0,this._seeking=!1,this._seekStartTs=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._hlsPlayer=null,this._seeking=!1,tP.remove(this._doSeek,this)}},{key:"seek",value:function(t){this._seekTime=t,this._seeking=!1,tP.remove(this._doSeek,this)}},{key:"check",value:function(){!this._seeking&&this._seekTime>0&&(this._seeking=!0,this._seekStartTs=g.now(),tP.add(this._doSeek,this,200))}},{key:"_doSeek",value:function(t){var e=this._seek();(e||t-this._seekStartTs>2e3)&&(this._seeking=!1,tP.remove(this._doSeek,this),e?this._seekTime=0:this._reseek())}},{key:"_seek",value:function(){var t=this._hlsPlayer.mse.video.video.currentTime,e=!1;if(this._hlsPlayer&&this._hlsPlayer.playerCoreType==L.PLAYER_CORE_TYPE.MSE){for(var i=this._hlsPlayer.mse.video.video.buffered,s=[],r=0;r<i.length;r++){var a=i.start(r),n=i.end(r);if(s.push("[".concat(a,", ").concat(n,"]")),a-.5<=t&&t<n+1){e=!0;break}if(t<a){this._seekTime=a;break}}e&&(this._hlsPlayer.onVideoSeek(t),this._hlsPlayer.userPaused||this._hlsPlayer.play()),I.log("HlsSeek.buffered",s.join(" "))}return e}},{key:"_reseek",value:function(){this._hlsPlayer&&this._hlsPlayer.playerCoreType==L.PLAYER_CORE_TYPE.MSE&&(I.log("HlsSeek._reseek"),this._hlsPlayer.seek(this._seekTime+1))}}
1,{key:"_findIdxFront",value:function(t,e,i){for(var s=e.length,r=null,a=i;a<s;a++)if((t+=(r=e[a]).duration)>=this._seekTime)return r.seeking=!0,a;return s-1}},{key:"_findIdxBack",value:function(t,e,i){for(var s=null,r=i;r>0;r--)if((t-=(s=e[r]).duration)<this._seekTime)return s.seeking=!0,r;return 0}}]),t}();function ij(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function iY(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function iq(t,e,i,s,r,a){var n;return iY((n=iY(iY(e,t),iY(s,a)))<<r|n>>>32-r,i)}function iK(t,e,i,s,r,a,n){return iq(e&i|~e&s,t,e,r,a,n)}function iz(t,e,i,s,r,a,n){return iq(e&s|i&~s,t,e,r,a,n)}function iJ(t,e,i,s,r,a,n){return iq(e^i^s,t,e,r,a,n)}function iQ(t,e,i,s,r,a,n){return iq(i^(e|~s),t,e,r,a,n)}function iX(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var i,s,r,a,n,o=0x67452301,u=-0x10325477,l=-0x67452302,d=0x10325476;for(i=0;i<t.length;i+=16)s=o,r=u,a=l,n=d,o=iK(o,u,l,d,t[i],7,-0x28955b88),d=iK(d,o,u,l,t[i+1],12,-0x173848aa),l=iK(l,d,o,u,t[i+2],17,0x242070db),u=iK(u,l,d,o,t[i+3],22,-0x3e423112),o=iK(o,u,l,d,t[i+4],7,-0xa83f051),d=iK(d,o,u,l,t[i+5],12,0x4787c62a),l=iK(l,d,o,u,t[i+6],17,-0x57cfb9ed),u=iK(u,l,d,o,t[i+7],22,-0x2b96aff),o=iK(o,u,l,d,t[i+8],7,0x698098d8),d=iK(d,o,u,l,t[i+9],12,-0x74bb0851),l=iK(l,d,o,u,t[i+10],17,-42063),u=iK(u,l,d,o,t[i+11],22,-0x76a32842),o=iK(o,u,l,d,t[i+12],7,0x6b901122),d=iK(d,o,u,l,t[i+13],12,-0x2678e6d),l=iK(l,d,o,u,t[i+14],17,-0x5986bc72),o=iz(o,u=iK(u,l,d,o,t[i+15],22,0x49b40821),l,d,t[i+1],5,-0x9e1da9e),d=iz(d,o,u,l,t[i+6],9,-0x3fbf4cc0),l=iz(l,d,o,u,t[i+11],14,0x265e5a51),u=iz(u,l,d,o,t[i],20,-0x16493856),o=iz(o,u,l,d,t[i+5],5,-0x29d0efa3),d=iz(d,o,u,l,t[i+10],9,0x2441453),l=iz(l,d,o,u,t[i+15],14,-0x275e197f),u=iz(u,l,d,o,t[i+4],20,-0x182c0438),o=iz(o,u,l,d,t[i+9],5,0x21e1cde6),d=iz(d,o,u,l,t[i+14],9,-0x3cc8f82a),l=iz(l,d,o,u,t[i+3],14,-0xb2af279),u=iz(u,l,d,o,t[i+8],20,0x455a14ed),o=iz(o,u,l,d,t[i+13],5,-0x561c16fb),d=iz(d,o,u,l,t[i+2],9,-0x3105c08),l=iz(l,d,o,u,t[i+7],14,0x676f02d9),o=iJ(o,u=iz(u,l,d,o,t[i+12],20,-0x72d5b376),l,d,t[i+5],4,-378558),d=iJ(d,o,u,l,t[i+8],11,-0x788e097f),l=iJ(l,d,o,u,t[i+11],16,0x6d9d6122),u=iJ(u,l,d,o,t[i+14],23,-0x21ac7f4),o=iJ(o,u,l,d,t[i+1],4,-0x5b4115bc),d=iJ(d,o,u,l,t[i+4],11,0x4bdecfa9),l=iJ(l,d,o,u,t[i+7],16,-0x944b4a0),u=iJ(u,l,d,o,t[i+10],23,-0x41404390),o=iJ(o,u,l,d,t[i+13],4,0x289b7ec6),d=iJ(d,o,u,l,t[i],11,-0x155ed806),l=iJ(l,d,o,u,t[i+3],16,-0x2b10cf7b),u=iJ(u,l,d,o,t[i+6],23,0x4881d05),o=iJ(o,u,l,d,t[i+9],4,-0x262b2fc7),d=iJ(d,o,u,l,t[i+12],11,-0x1924661b),l=iJ(l,d,o,u,t[i+15],16,0x1fa27cf8),o=iQ(o,u=iJ(u,l,d,o,t[i+2],23,-0x3b53a99b),l,d,t[i],6,-0xbd6ddbc),d=iQ(d,o,u,l,t[i+7],10,0x432aff97),l=iQ(l,d,o,u,t[i+14],15,-0x546bdc59),u=iQ(u,l,d,o,t[i+5],21,-0x36c5fc7),o=iQ(o,u,l,d,t[i+12],6,0x655b59c3),d=iQ(d,o,u,l,t[i+3],10,-0x70f3336e),l=iQ(l,d,o,u,t[i+10],15,-1051523),u=iQ(u,l,d,o,t[i+1],21,-0x7a7ba22f),o=iQ(o,u,l,d,t[i+8],6,0x6fa87e4f),d=iQ(d,o,u,l,t[i+15],10,-0x1d31920),l=iQ(l,d,o,u,t[i+6],15,-0x5cfebcec),u=iQ(u,l,d,o,t[i+13],21,0x4e0811a1),o=iQ(o,u,l,d,t[i+4],6,-0x8ac817e),d=iQ(d,o,u,l,t[i+11],10,-0x42c50dcb),l=iQ(l,d,o,u,t[i+2],15,0x2ad7d2bb),u=iQ(u,l,d,o,t[i+9],21,-0x14792c6f),o=iY(o,s),u=iY(u,r),l=iY(l,a),d=iY(d,n);return[o,u,l,d]}function i$(t){var e,i="",s=32*t.length;for(e=0;e<s;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function iZ(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var s=8*t.length;for(e=0;e<s;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function i0(t){var e,i,s="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),s+="0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e);return s}function i1(t){return unescape(encodeURIComponent(t))}function i2(t){var e;return i$(iX(iZ(e=i1(t)),8*e.length))}function i3(t,e){return function(t,e){var i,s,r=iZ(t),a=[],n=[];for(a[15]=n[15]=void 0,r.length>16&&(r=iX(r,8*t.length)),i=0;i<16;i+=1)a[i]=0x36363636^r[i],n[i]=0x5c5c5c5c^r[i];
1return s=iX(a.concat(iZ(e)),512+8*e.length),i$(iX(n.concat(s),640))}(i1(t),i1(e))}var i5=function(t,e,i){return e?i?i3(e,t):i0(i3(e,t)):i?i2(t):i0(i2(t))},i6=b("X2Zt"),i4=b("Zm0="),i8=(b("X3dzVGltZQ=="),b("d3NUaW1l")),i9=b("X2ludmFsaWRUaW1l"),i7=b("X25leHRSZWZyZXNoVGltZQ=="),st=(b("X2N0eXBl"),b("Y3R5cGU=")),se=b("d3NTZWNyZXQ="),si=b("X3BhcmFtcw=="),ss=(b("X3NGbHZBbnRpY29kZQ=="),b("X3NGbHZVcmw=")),sr=b("X3NTdHJlYW1OYW1l"),sa=b("X3JlcQ=="),sn=b("c2VxaWQ="),so=b("X3NlcWlk"),sh=b("X3BjZG4="),su=b("JDA="),sl=b("JDE="),sd=b("JDI="),sc=b("JDM="),sf=b("aW5pdA=="),sp=b("aXNJbnZhbGlk"),sm=b("Z2V0QW50aWNvZGU="),s_=b("cGFyc2VBbnRpY29kZQ=="),sy=b("aGFzQW50aWNvZGU="),sv=b("b25DaGVja1RpbWVy"),sS=b("X29uUmVmcmVzaA=="),sg=b("X29uUmVmcmVzaEJpbmQ="),sT=b("dmFsaWQ="),sP=b("Z2V0VG9rZW4="),sC=b("X2dldFRva2Vu"),sE=(b("bGl2ZXVp"),b("Z2V0Q2RuVG9rZW5JbmZvRXg="),b("MTAw"),b("dmVyPTE=")),sI=(b("Jg=="),b("PQ=="),b("UkVGUkVTSA==")),sk=b("cmVmcmVzaA=="),sA=(b("ZGVjb2RlVVJJ"),b("dW5lc2NhcGU="),b("Z2V0U2VxaWQ=")),sR=b("bWVkaWF1aXNlYQ=="),sD=b("Z2V0QW50aUNvZGVGb3JTdHJlYW0="),sO=b("X25pbW9UaWQ="),sb=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this))[i6]="",t[si]=null,t[ss]="",t[sr]="",t[so]="",t[i9]=Number.MAX_SAFE_INTEGER,t[i7]=Number.MAX_SAFE_INTEGER,t[sO]=null,t[sg]=t[sS].bind(Object(a.a)(t)),t}return Object(r.a)(i,[{key:sy,value:function(){return!!this[si]}},{key:sf,value:function(t,e,i,s){this[si]=new URLSearchParams("".concat(sE)),this[ss]=t,this[sr]=e,this[sO]=s,this[s_](i)}},{key:s_,value:function(t){var e=this;this[i6]="",new URLSearchParams(t||"").forEach(function(t,i){if(e[si].set(i,t),i===i4)t=atob(t=unescape(t=decodeURI(t))),e[i6]=t;else if(i===i8){var s=1e3*parseInt(t,16)+3e5;e[i9]=g.now()+(s-Date.now()),e[i7]=e[i9]-3e4}})}},{key:sp,value:function(t){return t>this[i9]}},{key:sm,value:function(t){if(""===this[i6])return this[si].toString();var e=this[si].get(st);!e&&q.isOpen()&&(e="huya_webh5",this[si].set(st,e)),D._testCtype&&(e=D._testCtype);var i=F.platform,s=L.PLATFORM_TYPE[i]||L.PLATFORM_TYPE.web;this[so]=Number(w.uid)+Date.now();var r=i5("".concat(this[so],"|").concat(e,"|").concat(s)),a=i===L.PLATFORM_TYPE_NAME.wap?w.uid:w.convertUid,n=this[i6].replace(su,a).replace(sl,this[sr]).replace(sd,r).replace(sc,this[si].get(i8));return t&&(n+=sh),this[si].set(se,i5(n)),this[si].set(sn,this[so]),this[si].toString()}},{key:sA,value:function(){return this[so]}},{key:sv,value:function(t,e){t>=this[i7]&&this[sP]().then(this[sg])}},{key:sS,value:function(){this.trigger(i.Events[sI])}},{key:sT,value:function(){var t=this;return new Promise(function(e){t[sp](g.now())?t[sP]().then(e):e()})}},{key:sP,value:function(){var t=this;return new Promise(function(e){var s=setTimeout(function(){I.log("".concat(i.name,".").concat(sP," timeout")),tC.off(tC.TAFLINK_INITED,r),e()},5e3),r=function i(){clearTimeout(s),tC.off(tC.TAFLINK_INITED,i),t[sC](e)};tC.connected?(clearTimeout(s),t[sC](e)):tC.on(tC.TAFLINK_INITED,r)})}},{key:sC,value:function(t){var e=this;this[sa]||(this[sa]=new d.HUYA.GetAntiCodeForStreamReq),this[sa].sStreamName=this._sStreamName,this[sa].tId=this[sO]?this[sO]:tC.getUserId(),I.log("".concat(i.name,".").concat(sP,".req="),this._req),this[i7]=Number.MAX_SAFE_INTEGER;var s=setTimeout(function(){I.log("".concat(i.name,".").concat(sP," timeout"))},5e3);1!=D._isTestAnticodeTimeout&&tC.sendWup(sR,sD,this._req,function(r){var a;clearTimeout(s),a=r.sAntiCode,I.log("".concat(i.name,".").concat(sP," sAntiCode=").concat(a,", rsp="),r),e[s_](a),t()},!0,tC.getRequestId())}}]),i}(tB);if(sb.Events=ij({},sI,sk),!Object.values){var sw=Function.bind.call(Function.call,Array.prototype.reduce),sL=Function.bind.call(Function.call,Object.prototype.propertyIsEnumerable),sF=Function.bind.call(Function.call,Array.prototype.concat),sM=Reflect.ownKeys;Object.values=function(t){return sw(sM(t),function(e,i){return sF(e,"string"==typeof i&&sL(t,i)?[t[i]]:[])},[])}}var sN=function(){function t(e){Object(s.a)(this,t),this.player=e,this.recordMap=new Map,this.init(),this.reset()}return Object(r.a)(t,[{key:"destroy",value:function(){this.player=null,this.recordMap&&this.recordMap.clear(),this.recordMap=null,this.exceptionStat=null,this.keys=null}},{key:"init",value:function(){this.keys=Object.values(R.DIM_LINK_STA);
1var t=this.keys.indexOf(R.DIM_LINK_STA.name);-1!==t&&this.keys.splice(t,1)}},{key:"setStat",value:function(t,e){this.recordMap.has(t)||(this.recordMap.set(t,1),this.exceptionStat[t]=e)}},{key:"getStat",value:function(){var t=this;this.player.getDurationTime&&this.player.getDurationTime()>2&&this.setStat(R.DIM_LINK_STA.DATA_ENOUGH,1);var e=[];return Object.keys(this.exceptionStat).forEach(function(i){e.push("".concat(i,":").concat(t.exceptionStat[i]))}),e.join(",")}},{key:"reset",value:function(){var t=this;this.recordMap.clear(),this.exceptionStat={},this.keys.forEach(function(e){t.exceptionStat[e]=0})}}]),t}(),sB={setCdnDomain:function(t,e,i){i=i||"";var s="cdndomain",r=(e=e||"").match(/\/\/(.+?)\//i);r&&r.length>1&&(s=r[1]),t.setComDim(R.DIM_COM.CDNDOMAIN,s),t.setComDim(R.DIM_COM.STREAM,i||"stream")},setVodCdnDomain:function(t,e){var i="cdndomain",s=(e=e||"").match(/\/\/(.+?)\//i);s&&s.length>1&&(i=s[1]),t.setComDim(R.DIM_COM.CDNDOMAIN,i)},recordComDim:function(t,e){t.setComDim(R.DIM_COM.SDK_VER,0x9b0b2ddf),t.setComDim(R.DIM_COM.UA,navigator&&navigator.userAgent),this.recordSystemInfo(t),this.recordStartInfo(t,e)},recordStartInfo:function(t,e){t.setComDim(R.DIM_COM.AD_BLOCK,+(1===Number(e.adBlock)))},recordSystemInfo:function(t){A.isMseSupportedHevc()?(t.setComDim(R.DIM_COM.DECODE_SUPPORT,"mse_hevc"),t.setComDim(R.DIM_COM.DECODE_CAPABILITY,"mse_hevc")):O.isWebCodecsSupported()?(t.setComDim(R.DIM_COM.DECODE_SUPPORT,"webcodecs"),t.setComDim(R.DIM_COM.DECODE_CAPABILITY,"webcodecs")):A.isMseSupportedH264()&&(t.setComDim(R.DIM_COM.DECODE_SUPPORT,"mse"),t.setComDim(R.DIM_COM.DECODE_CAPABILITY,"mse")),t.setComDim(R.DIM_COM.SUPPORT_AV1,A.isMseSupportedAV01()?1:2),t.setComDim("backup_field1",+!!O.isManagerMediaSourceSupported()),t.setComDim(R.DIM_COM.BROWSER_NAME,p.browser),t.setComDim(R.DIM_COM.BROWSER_VERSION,p.version.major),t.setComDim(R.DIM_COM.BROWSER_KERNEL,S.name),t.setComDim(R.DIM_COM.BROWSER_KERNEL_VERSION,S.version.major),t.setComDim(R.DIM_COM.OS_NAME,p.os),t.setComDim(R.DIM_COM.OS_VERSION,p.osVersion),t.setComDim(R.DIM_COM.HARDWARE_CONCURRENCY,Number(navigator.hardwareConcurrency)||0),t.setComDim(R.DIM_COM.I_GPU,+!!navigator.gpu),tK&&t.setComDim(R.DIM_COM.RENDER_INFO,tz())}},sV=function(){function t(){Object(s.a)(this,t),this.startTs=0,this.m3u8StartTs=0,this.m3u8OpenTs=0,this.m3u8EndTs=0,this.initStartTs=0,this.initOpenTs=0,this.initEndTs=0,this.firstStartTs=0,this.firstOpenTs=0,this.firstBufTs=0,this.playTs=0}return Object(r.a)(t,[{key:"setStart",value:function(){this.startTs=g.now(),this.m3u8StartTs=0,this.m3u8OpenTs=0,this.m3u8EndTs=0,this.initStartTs=0,this.initOpenTs=0,this.initEndTs=0,this.firstStartTs=0,this.firstOpenTs=0,this.firstBufTs=0,this.loadedDataTs=0}},{key:"setM3u8Start",value:function(){0===this.m3u8StartTs&&(this.m3u8StartTs=g.now(),I.log("VodSecHelper setM3u8Start: ".concat(this.m3u8StartTs)))}},{key:"setM3u8Open",value:function(){0===this.m3u8OpenTs&&(this.m3u8OpenTs=g.now(),I.log("VodSecHelper setM3u8Open: ".concat(this.m3u8OpenTs,", start to open cost: ").concat(this.m3u8OpenTs-this.m3u8StartTs,"ms")))}},{key:"setM3u8End",value:function(){0===this.m3u8EndTs&&(this.m3u8EndTs=g.now(),I.log("VodSecHelper setM3u8End: ".concat(this.m3u8EndTs,", open to end cost: ").concat(this.m3u8EndTs-this.m3u8OpenTs,"ms")))}},{key:"setInitStart",value:function(){0===this.initStartTs&&(this.initStartTs=g.now(),I.log("VodSecHelper setInitStart: ".concat(this.initStartTs,", m3u8 end to init start cost: ").concat(this.initStartTs-this.m3u8EndTs,"ms")))}},{key:"setInitOpen",value:function(){0===this.initOpenTs&&(this.initOpenTs=g.now(),I.log("VodSecHelper setInitOpen: ".concat(this.initOpenTs,", init start to open cost: ").concat(this.initOpenTs-this.initStartTs,"ms")))}},{key:"setInitEnd",value:function(){0===this.initEndTs&&(this.initEndTs=g.now(),I.log("VodSecHelper setInitEnd: ".concat(this.initEndTs,", init open to end cost: ").concat(this.initEndTs-this.initOpenTs,"ms")))}},{key:"setFirstStart",value:function(){0===this.firstStartTs&&(this.firstStartTs=g.now(),0===this.m3u8StartTs&&(this.m3u8StartTs=this.m3u8OpenTs=this.m3u8EndTs=this.firstStartTs),0===this.initStartTs&&(this.initStartTs=this.initOpenTs=this.initEndTs=this.firstStartTs),I.log("VodSecHelper setFirstStart: ".concat(this.firstStartTs,", m3u8 end to first start cost: ").concat(this.firstStartTs-this.m3u8EndTs,"ms")))}},{key:"setFirstOpen",value:function(){0===this.firstOpenTs&&(this.firstOpenTs=g.now(),I.log("VodSecHelper setFirstOpen: ".concat(this.firstOpenTs,", first start to open cost: ").concat(this.firstOpenTs-this.firstStartTs,"ms")))}},{key:"setFirstBuf",value:function(){0===this.firstBufTs&&(this.firstBufTs=g.now(),I.log("VodSecHelper setFirstBuf: ".concat(this.firstBufTs,", first open to buf cost: ").concat(this.firstBufTs-this.firstOpenTs,"ms")))}},{key:"setPlayTs",value:function(){0===this.playTs&&(this.playTs=g.now(),I.log("VodSecHelper setPlayTs: ".concat(this.playTs,", first buf to play cost: ").concat(this.playTs-Math.max(this.firstBufTs,this.initEndTs),"ms")))}},{key:"getCostTimes",value:function(){var t=99999,e=99999,i=99999,s=99999,r=99999,a=99999,n=99999,o=99999,u=99999,l=99999;return this.playTs>0&&(t=this.playTs-this.startTs),this.m3u8OpenTs>0&&(e=this.m3u8OpenTs-this.startTs),this.m3u8EndTs>0&&this.m3u8OpenTs>0&&(i=this.m3u8EndTs-this.m3u8OpenTs),this.initStartTs>0&&this.m3u8EndTs>0&&(s=this.initStartTs-this.m3u8EndTs),this.initOpenTs>0&&this.initStartTs>0&&(r=this.initOpenTs-this.initStartTs),this.initEndTs>0&&this.initOpenTs>0&&(a=this.initEndTs-this.initOpenTs),this.firstStartTs>0&&this.m3u8EndTs>0&&(n=this.firstStartTs-this.m3u8EndTs),this.firstOpenTs>0&&this.firstStartTs>0&&(o=this.firstOpenTs-this.firstStartTs),this.firstBufTs>0&&this.firstOpenTs>0&&(u=this.firstBufTs-this.firstOpenTs),this.playTs>0&&this.firstBufTs>0&&this.initEndTs>0&&(l=this.playTs-Math.max(this.firstBufTs,this.initEndTs)),[t,e,i,s,r,a,n,o,u,l]}}]),t}(),sU=function(){function t(e,i){var r=i.resumeFunc,a=i.pauseFunc;Object(s.a)(this,t),this._webCodecsPlayer=e,this._playResume=r,this._playPause=a,this._paused=!1,this._playedPts=0,this._pausedTs=0,this._lastCheckTime=0}return Object(r.a)(t,[{key:"paused",get:function(){return this._paused}},{key:"pausedTs",get:function(){return this._pausedTs}},{key:"reset",value:function(){this._paused=!1,this._playedPts=0,this._pausedTs=0}},{key:"check",value:function(t){if(!(0!=this._lastCheckTime&&t-this._lastCheckTime<50)){var e=this._webCodecsPlayer.isBrowserHidden?this._webCodecsPlayer.getCurrentAudioDts():this._webCodecsPlayer.getVideoPts();0!==this._playedPts&&(e===this._playedPts?this._paused||this._setPaused(t):this._paused&&this._setResume(t)),this._playedPts=e,this._lastCheckTime=t}}},{key:"_setPaused",value:function(t){this._paused=!0,this._pausedTs=t,I.log("WebCodecsPause._setPaused _pausedTs=",t),this._playPause(t)}},{key:"_setResume",value:function(t){var e=t-this._pausedTs;I.log("WebCodecsPause._setResume pausedTime=",e,this._playedPts),this._playResume(t,e),this._paused=!1,this._pausedTs=0}}]),t}(),sx=function(){function t(e,i){var r=i.resumeFunc,a=i.pauseFunc;Object(s.a)(this,t),this._webCodecsPlayer=e,this._playResume=r,this._playPause=a,this._paused=!1,this._playedPts=0,this._pausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0,this._lastCheck500CurrntTime=0}return Object(r.a)(t,[{key:"paused",get:function(){return this._paused}},{key:"pausedTs",get:function(){return this._pausedTs}},{key:"reset",value:function(){this._paused=!1,this._playedPts=0,this._pausedTs=0,this._lastCheck500Time=0,this._lastCheck500CurrntTime=0}},{key:"check",value:function(t){if(!(0!=this._lastCheckTime&&t-this._lastCheckTime<50)){var e=this._webCodecsPlayer.isBrowserHidden?this._webCodecsPlayer.getCurrentAudioDts():this._webCodecsPlayer.getVideoPts();if(0!==this._playedPts){e===this._playedPts?this._paused||this._setPaused(t):this._paused&&this._setResume(t);var i=t-this._lastCheck500Time,s=Math.round(e-this._lastCheck500CurrntTime);(0==this._lastCheck500Time||i>
1=500)&&(0!=this._lastCheck500Time&&i-s>=F.pause500Cfg[0]&&(1==Number(D._printPauseCheckWorker)&&I.log("WebCodecsPauseWorker.check.500ms check500Delta=".concat(i,", check500CurrentTimeDelta=").concat(s,", pauseDelta=").concat(i-s)),this._webCodecsPlayer.check500Pause()),this._lastCheck500CurrntTime=e,this._lastCheck500Time=t)}this._playedPts=e,this._lastCheckTime=t}}},{key:"_setPaused",value:function(t){this._paused=!0,this._pausedTs=t,I.log("WebCodecsPauseWorker._setPaused _pausedTs=",t),this._playPause(t)}},{key:"_setResume",value:function(t){var e=t-this._pausedTs;I.log("WebCodecsPauseWorker._setResume pausedTime=",e,this._playedPts),this._playResume(t,e),this._paused=!1,this._pausedTs=0}}]),t}(),sH=function(){function t(e){Object(s.a)(this,t),this._webCodecsPlayer=e,this.delayList=[],this.decodedList=[],this.renderList=[],this.deltaList=[],this.videoBufList=[],this.videoToDecodeList=[],this.audioToDecodeList=[],this.audioDecodedList=[],this.audioRenderList=[],this.videoDiscardList=[],this.videoThrowFpsList=[],this.videoRender5SecFpsList=[],this.videoEnhanceList=[],this.videoEnhanceCostList=[],this.lastEnhanceLess30Nums=0,this.lastEnhanceLess150Nums=0,this.lastEnhanceLess200Nums=0,this.lastEnhanceLarge200Nums=0,this.lastEnhanceTotal=0,this.checkTimes=0}return Object(r.a)(t,[{key:"onCheckTimer",value:function(t,e){var i=this._webCodecsPlayer.getDecodeFps(),s=i.decodedVideoFps,r=i.decodedAudioFps,a=this._webCodecsPlayer.getVideoRenderFps(),n=this._webCodecsPlayer.getAudioRenderFps(),o=this._webCodecsPlayer.getVideoThrowFps(),u=i.toDecodeAudioFps,l=i.toDecodeVideoFps,d=i.decodedVideoDelay,c=i.videoFrameLen,f=Math.floor(this._webCodecsPlayer.getCurrentAudioDts()-this._webCodecsPlayer.getCurrentDts()),p=this._webCodecsPlayer.getDecodedBuffer(),m=this._webCodecsPlayer.getDiscardVideoFrames(),_=this._webCodecsPlayer.getBufferLen(),y=this._webCodecsPlayer.getEnhanceVideoFrames();this.delayList.push(d),this.decodedList.push(s),this.renderList.push(a),this.videoEnhanceList.push(y),this.videoEnhanceCostList.push(i.videoEnhanceCost),this.videoRender5SecFpsList.length>=5&&this.videoRender5SecFpsList.shift(),this.videoRender5SecFpsList.push(a),this.deltaList.push(f),this.videoBufList.push(_),this.audioToDecodeList.push(r),this.videoToDecodeList.push(l),this.audioDecodedList.push(r),this.audioRenderList.push(n),this.videoDiscardList.push(m),this.videoThrowFpsList.push(o),this.checkTimes%5==0&&1==Number(D._printWebCodecsStat)&&I.log("WebCodecsPlayer.getWebCodecsStats,","videoDecodeDelay=".concat(d,", audioToDecodeFps=").concat(u,", audioDecodeFps=").concat(r,","),"audioRenderFps=".concat(n,", videoBufferLen=").concat(this._webCodecsPlayer.getBufferLen(),", delta=").concat(f,", videoToDecodeFps=").concat(l,","),"videoDecodeFps=".concat(s,", discardVideoFps=").concat(m,", videoRenderFps=").concat(a,", videoThrowFps=").concat(o,","),"videoDecodedBuffer=".concat(p,", videoFrameLen=").concat(c)),this.checkTimes++}},{key:"getStats",value:function(){var t=v(this.delayList),e=v(this.decodedList),i=v(this.renderList),s=v(this.deltaList),r=v(this.audioToDecodeList),a=v(this.videoToDecodeList),n=v(this.audioDecodedList),o=v(this.audioRenderList),u=v(this.videoDiscardList),l=v(this.videoThrowFpsList),d=v(this.videoEnhanceList),c=v(this.videoEnhanceCostList);this.delayList.length=0,this.decodedList.length=0,this.renderList.length=0,this.deltaList.length=0,this.audioToDecodeList.length=0,this.videoToDecodeList.length=0,this.audioDecodedList.length=0,this.audioRenderList.length=0,this.videoDiscardList.length=0,this.videoThrowFpsList.length=0,this.videoEnhanceList.length=0,this.videoEnhanceCostList.length=0;var f=this._webCodecsPlayer.getDecodeFps(),p=f.enhanceLess30Nums,m=f.enhanceLess150Nums,_=f.enhanceLess200Nums,y=f.enhanceLarge200Nums,S=f.enhanceTotal,g=p-this.lastEnhanceLess30Nums,T=m-this.lastEnhanceLess150Nums,P=_-this.lastEnhanceLess200Nums,C=y-this.lastEnhanceLarge200Nums,E=S-this.lastEnhanceTotal;this.lastEnhanceLess30Nums=p,this.lastEnhanceLess150Nums=m,this.lastEnhanceLess200Nums=_,this.lastEnhanceLarge200Nums=y,this.lastEnhanceTotal=S;var k={delayList:t,decodedList:e,renderList:i,deltaList:s,videoToDecodeList:a,videoDiscardList:u,audioToDecodeList:r,auidoDecodedList:n,audioRenderList:o,videoThrowFpsList:l,videoEnhanceList:d,videoEnhanceCostList:c,ehLess30Nums:g,ehLess150Nums:T,ehLess200Nums:P,ehLarge200Nums:C,ehTotal:E},A="WebCodecsPlayer.getStats\n";for(var R in k)A+="".concat(R,": ").concat(k[R].toString(),"\n");return A+="bufferLen:".concat(this.videoBufList.toString(),"\n"),I.log(A),this.videoBufList.length=0,k}},{key:"destroy",value:function(){this.videoRender5SecFpsList.length=0}}]),t}(),sG={};function sW(t,e){var i=Math.max(0,e-t.toString().length),s="";if(i>0)for(var r=0;r<i;r++)s+="0";return s+t}self||(self=window),function(){var t=self.navigator.userAgent.toLowerCase(),e=/(edge)\/([\w.]+)/.exec(t)||/(edg)\/([\w.]+)/.exec(t)||/(opr)[\/]([\w.]+)/.exec(t)||/(chrome)[ \/]([\w.]+)/.exec(t)||/(iemobile)[\/]([\w.]+)/.exec(t)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(t)||[],i=/(ipad)/.exec(t)||/(ipod)/.exec(t)||/(windows phone)/.exec(t)||/(iphone)/.exec(t)||/(kindle)/.exec(t)||/(android)/.exec(t)||/(windows)/.exec(t)||/(mac)/.exec(t)||/(linux)/.exec(t)||/(cros)/.exec(t)||[],s={browser:e[5]||e[3]||e[1]||"",version:e[2]||e[4]||"0",majorVersion:e[4]||e[2]||"0",platform:i[0]||""},r={};if(s.browser){r[s.browser]=!0;var a=s.majorVersion.split(".");r.version={major:parseInt(s.majorVersion,10),string:s.version,majorVersion:s.majorVersion},a.length>1&&(r.version.minor=parseInt(a[1],10)),a.length>2&&(r.version.build=parseInt(a[2],10))}for(var n in s.platform&&(r[s.platform]=!0),(r.chrome||r.opr||r.safari)&&(r.webkit=!0),(r.rv||r.iemobile)&&(r.rv&&delete r.rv,s.browser="msie",r.msie=!0),r.edge&&(delete r.edge,s.browser="msedge",r.chrome=!0),r.edg&&(delete r.edg,s.browser="msedge",r.chrome=!0),r.opr&&(s.browser="opera",r.opera=!0),r.safari&&r.android&&(s.browser="android",r.android=!0),r.name=s.browser,r.platform=s.platform,sG)sG.hasOwnProperty(n)&&delete sG[n];Object.assign(sG,r)}(),sG.version||(sG.version={major:0,minor:0,build:0,string:"0.0.0"});
1var sj=0,sY={now:function(){if(void 0!==window.performance){var t=window.performance;if(void 0!==t.now)return~~t.now();if(void 0!==t.webkitNow)return~~t.webkitNow();if(void 0!==t.mozNow)return~~t.mozNow();if(void 0!==t.msNow)return~~t.msNow()}0===sj&&(sj=Date.now()-1);var e=Date.now()-sj;return e>0xffffffff?(sj+=0xffffffff,e-0xffffffff):e},utc:function(){return Math.round(Date.now()/1e3)},getDateStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=null,i=(e=t?new Date(t):new Date).getFullYear(),s=sW(e.getMonth()+1,2),r=sW(e.getDate(),2);return"".concat(i,"-").concat(s,"-").concat(r)},getTimeStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null,s=sW((i=t?new Date(t):new Date).getHours(),2),r=sW(i.getMinutes(),2),a=sW(i.getSeconds(),2),n="".concat(s,":").concat(r,":").concat(a);return e&&(n+="."+sW(i.getMilliseconds(),3)),n},getDateTimeStr:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=null,s=(i=t?new Date(t):new Date).getFullYear(),r=sW(i.getMonth()+1,2),a=sW(i.getDate(),2),n=sW(i.getHours(),2),o=sW(i.getMinutes(),2),u=sW(i.getSeconds(),2),l="".concat(s,"-").concat(r,"-").concat(a," ").concat(n,":").concat(o,":").concat(u);return e&&(l+="."+sW(i.getMilliseconds(),3)),l}},sq=99;function sK(){return sY.getDateTimeStr()+" "}var sz=!1,sJ={_data:[],_length:0,debug:function(){var t=sK(),e=Array.apply(null,arguments);e[0]=t+e[0],sq<=-1&&console.log.apply(console,e)},log:function(t){var e=sK(),i=Array.apply(null,arguments);i[0]=e+i[0],sq<=0&&console.log.apply(console,i),sJ.record(i,"log")},info:function(t){var e=sK(),i=Array.apply(null,arguments);i[0]=e+i[0],sq<=1&&console.info.apply(console,i),sJ.record(i,"info")},warn:function(t){var e=sK(),i=Array.apply(null,arguments);i[0]=e+i[0],sq<=2&&console.warn.apply(console,i),sJ.record(i,"warn")},error:function(t){var e=sK(),i=Array.apply(null,arguments);i[0]=e+i[0],sq<=3&&console.error.apply(console,i),sJ.record(i,"error")},group:function(t){var e=sK(),i=Array.apply(null,arguments);i[0]=e+i[0],sq<=1&&(console.groupCollapsed||console.group||console.log).apply(console,i),sJ.record(i,"group")},groupEnd:function(){console.groupEnd&&console.groupEnd.apply(console)},setLevel:function(t){t!=sq&&(console.log(sK()+" set log level from "+sq+" to "+t),sq=t)},getLevel:function(){return sq},record:function(t,e){1100===sJ._length&&(sJ._data.splice(0,100),sJ._length=1e3);var i=0,s=(t.shift()||"").toString();for(s=s.replace(/\%c/gi,function(t,e){return i++,""});i--&&t.length;)t.shift();for(var r=0,a=t.length;r<a;r++)"object"==typeof t[r]&&(t[r]="");t.unshift(s);var n=t.join(" ");sJ._length++,sJ._data.push("[".concat(e,"][HYLineTrans]").concat(n))},getLog:function(){return sz||(sz=!0,sJ._data.unshift(sG.platform+" "+sG.name+" "+sG.version.string)),sJ._data},logcss:function(t,e,i){var s="font-weight:900";return t&&(s+=";color:"+t),e&&(s+=";background:"+e),i&&(s+=";border:3px solid "+i),s},padNum:function(t,e){var i=Math.max(0,e-t.toString().length);return"0".repeat(i)+t}},sQ={logger:null,TimeUtil:null,init:function(t){this.logger=t.logger||sJ,this.TimeUtil=t.TimeUtil||sY}},sX=i(5),s$=i(26),sZ=i.n(s$),s0=function(){function t(e,i,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5?arguments[5]:void 0,u=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0;Object(s.a)(this,t),this.data=r,this.timeStamp=i,this.type=e,this.startDecodeTime=0,this.decodedTime=0,this.discardAllow=a,this.isKeyFrame=n,this.compositionTime=o,this.naluType=u,this.isEmptyAudioFrame=!1,l&&l.spsUnit&&(this.sps=l.spsUnit),l&&l.vpsUnit&&(this.vps=l.vpsUnit),l&&l.ppsUnit&&(this.pps=l.ppsUnit),l&&l.videoCodec&&(this.codec=l.videoCodec),l&&l.videoWidth&&(this.width=l.videoWidth),l&&l.videoHeight&&(this.height=l.videoHeight),l&&l.av1Bytes&&(this.av1SequenceData=l.av1Bytes)}return Object(r.a)(t,[{key:"setIsEmptyAudioFrame",value:function(t){this.isEmptyAudioFrame=t}}]),t}();s0.VIDEO=0,s0.AUIDO=1;var s1=function(){var t=null;try{t=window.localStorage}catch(e){t={removeItem:function(t){},getItem:function(t){return null},setItem:function(t,e){},clear:function(){}}}return t}(),s2=function(){function t(e){Object(s.a)(this,t),this._player=e,this._worker=e.getWorker(),this._workerErrorBind=this._workerError.bind(this),this._workerMessageBind=this._workerMessage.bind(this),this._worker.addEventListener("message",this._workerMessageBind)}return Object(r.a)(t,[{key:"postInitConfig",value:function(t){this._post(sX.c.INIT_CONFIG,t)}},{key:"postAvcConfig",value:function(t){this._post(sX.c.AVCCONFIG,t)}},{key:"postAv1InitSeg",value:function(t){this._post(sX.c.AV1_INIT_SEG,t)}},{key:"postAVCPPS",value:function(t){this._post(sX.c.AVCPPS,t)}},{key:"postAVCSPS",value:function(t){this._post(sX.c.AVCSPS,t)}},{key:"postAVCVPS",value:function(t){this._post(sX.c.AVCVPS,t)}},{key:"postVideoSamples",value:function(t){this._post(sX.c.VIDEOSAMPLES,t)}},{key:"postAudioConfig",value:function(t){this._post(sX.c.AACCONFIG,t)}},{key:"postAudioSamples",value:function(t){this._post(sX.c.AUDIOSAMPLES,t)}},{key:"postFastOver",value:function(){this._post(sX.c.FAST_OVER,{})}},{key:"postClose",value:function(){this._post(sX.c.CLOSE,{})}},{key:"postLocalConfig",value:function(){this._post(sX.c.LOCAL_CONFIG,{_webcodecsNoRenderVideo:Number(s1._webcodecsNoRenderVideo),_useSoftAcceleration:Number(s1._use
1SoftAcceleration)})}},{key:"postSetUseSoftAcceleration",value:function(){this._post(sX.c.SET_USE_SOFTACCELERATION,{})}},{key:"postUpdateSoftAcceleration",value:function(){this._post(sX.c.UPDATE_SOFTACCELERATION,{})}},{key:"postEnableDiscardVideo",value:function(t){this._post(sX.c.ENABLE_DISCARD_VIDEO,t)}},{key:"postSetAudioWriter",value:function(t){this._post(sX.c.SET_AUDIO_WRITER,{writer:t},[t])}},{key:"postSetPauseVideoDecode",value:function(t){this._post(sX.c.PAUSE_VIDEO_DECODE,t)}},{key:"postSetPauseAudioDecode",value:function(t){this._post(sX.c.PAUSE_AUDIO_DECODE,t)}},{key:"postUpdateCurBitrate",value:function(t){this._post(sX.c.UPDATE_CURBITRATE,t)}},{key:"postSetJitter",value:function(t){this._post(sX.c.SET_JITTER,t)}},{key:"postFrameInfo",value:function(t){this._post(sX.c.POSTFRAME,t)}},{key:"postResize",value:function(t){this._post(sX.c.RESIZE,t)}},{key:"postVisibilityChange",value:function(t){this._post(sX.c.VISIBILITYCHANGE,t)}},{key:"postUpdateVideoFps",value:function(t){this._post(sX.c.UPDATE_VIDEOFPS,t)}},{key:"postSetPlayMinBuffer",value:function(t){this._post(sX.c.SET_PLAY_MINBUFFER,t)}},{key:"postVideoRenderStart",value:function(t,e){this._post(sX.c.START,t,e)}},{key:"postAuidoTrack",value:function(t,e){this._post(sX.c.SET_AUDIO_WRITER,t,e)}},{key:"postLogCfg",value:function(t){this._post(sX.c.LOG_CFG,t)}},{key:"setEnhance",value:function(t){this._post(sX.c.SET_ENHANCE,t)}},{key:"setSegmenttion",value:function(t){this._post(sX.c.SET_SEGMENTTION,t)}},{key:"onRevFastOver",value:function(){this._post(sX.c.RECV_FAST_OVER)}},{key:"seek",value:function(t){this._post(sX.c.SEEK_TIME,t)}},{key:"postSetVodAv1",value:function(){this._post(sX.c.SET_VOD_AV1)}},{key:"postPlayBackRate",value:function(t){this._post(sX.c.SET_PLAYBACKRATE,t)}},{key:"_post",value:function(t,e,i){t!==sX.c.VIDEOSAMPLES&&t!==sX.c.AUDIOSAMPLES&&t!==sX.c.UPDATE_VIDEOFPS&&t!==sX.c.VISIBILITYCHANGE&&t!==sX.c.AVCPPS&&t!==sX.c.AVCSPS&&t!==sX.c.AVCVPS&&sQ.logger.log("WokerHolder.post type=".concat(t)),i?this._worker&&this._worker.postMessage({type:t,data:e},i):this._worker&&this._worker.postMessage({type:t,data:e})}},{key:"_workerError",value:function(t){this._player.onWebcodecsError(sX.d.WORKERERROR,t.message)}},{key:"_workerMessage",value:function(t){var e=t.data;switch(e.type){case sX.b.WOREKR_READY:this._onWorkerReady();break;case sX.b.INTERVAL:this._player.onWorkerInterval(sY.now());break;case sX.b.TURN_TO_WEBCODECS_SOFT:this._player.turnToWebcodecsSoft();break;case sX.b.AUDIORENDERERROR:this._player.onWebcodecsError(sX.d.AUDIORENDERERROR);break;case sX.b.SOFT_TURN_TO_MSE:this._player.onWebcodecsError(sX.d.SOFT_TURN_TO_MSE);break;case sX.b.AUDIO_FRAME_DECODED:this._player.getAudioRender().appendFrame(e.data);break;case sX.b.WEBGLPLAY:this._player.triggerWebcodecsPlay();break;case sX.b.AUDIO_PLAY:this._player.triggerAudioPlay();break;case sX.b.STAT:this._player.getVideoStatData(e.data);break;case sX.b.PAUSE:case sX.b.WORKERSHAREBUFFER:break;case sX.b.RENDERERROR:this._player.onWebcodecsError(sX.d.VIDEORENDEERROR);break;case sX.b.LOG:sQ.logger.log("webCodecs worker log:\n",e.data.join("\n"));break;case sX.b.VIDEODECODEERROR:sQ.logger.log("webCodecs worker.onDecoderError, video decode error",e.data&&e.data.msg),this._player.onWebcodecsError(sX.d.VIDEODECODEERROR,e.data&&e.data.msg);break;case sX.b.AUDIODECODEERROR:sQ.logger.log("webCodecs worker.onDecoderError, audio decode error",e.data&&e.data.msg),this._player.onWebcodecsError(sX.d.AUDIODECODEERROR,e.data&e.data.msg);break;case sX.b.DECODE_COST:sQ.logger.log("webCodecs worker.onDecoderCostError, video decode_cost error"),this._player.onWebcodecsError(sX.d.DECODE_COST);break;case sX.b.DECODE_DTS:sQ.logger.log("webCodecs worker.decodeByDts, video decode error"),this._player.onWebcodecsError(sX.d.DECODE_DTS);break;case sX.b.WAIT_KEY_FRAME:this._player.onWaitKeyFrame(e.data);break;case sX.b.SET_FRAME_PAUSE:this._player.setFramePause();break;case sX.b.SET_FRMAE_RESUME:this._player.setFrameRusume();break;case sX.b.RENDER_FPS_PAUSE:this._player.renderFpsPause();break;case sX.b.AUDIO_FORMAT_ERROR:this._player.onWebcodecsError(sX.d.AUDIO_FORMAT_ERROR);break;case sX.b.VIDEO_ENHANCE_ERROR:this._player.onVideoEnhanceError(e.data);break;case sX.b.VIDEO_ENHANCE_SUCCESS:this._player.onVideoEnhanceSuccess();break;case sX.b.ON_WCS_VIDEO_SEEK:this._player.onVideoSeek(e.data)}}},{key:"_onWorkerReady",value:function(){this.postLocalConfig(),1===Number(s1._use
1SoftAcceleration)&&this._player.setUseSoftAcceleration()}}]),t}(),s3=function(){function t(){Object(s.a)(this,t),this.framelist=[]}return Object(r.a)(t,[{key:"appendFrame",value:function(t){this.framelist.push(t)}},{key:"appendFrames",value:function(t){for(;t.length>0;)this.framelist.push(t.shift())}},{key:"dropFrames",value:function(t){for(var e=0,i=0;i<this.framelist.length&&this.framelist[i].timeStamp<t;i++)e++;e>0&&this.framelist.splice(0,e)}},{key:"dropInvalidFrames",value:function(t,e){for(var i=-1,s=0,r=0;r<this.framelist.length;r++){var a=this.framelist[r];if(!(a.timeStamp<t)){if(-1==i&&a.timeStamp>t&&(i=r),!(a.timeStamp<e))break;s++}}s>0&&this.framelist.splice(i,s)}},{key:"close",value:function(){for(;this.framelist.length>0;)this.framelist.pop().frame.close();this.framelist=null}}]),t}(),s5=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this)).rafNow=0,r.renderedFrameNums=0,r.webCodecsPlayer=t,r.frameRenderFps=0,r.renderFpsList=[],r.canvas=null,r.pauseList=[],r.lastRenderNums=0,r.lastVideoThrowNums=0,r.lastFrameTimeStamp=0,r.lastToDecodeAudioNums=0,r.lastToDecodeVideoNums=0,r.lastDecodedAudioNums=0,r.lastDecodedVideoNums=0,r.lastDiscardVideoNums=0,r.lastEnhanceVideoNums=0,r.videoPlayerElement=null,r.agenerator=null,r.processedStream=null,r.isPlayVideo=!1,r.isLive=r.webCodecsPlayer.isLive,r}return Object(r.a)(i,[{key:"start",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;sQ.logger.log("VideoRender.start, videoElement=",i),this.videoPlayerElement=i||document.createElement("video"),this.agenerator=new MediaStreamTrackGenerator({kind:"video"}),this.processedStream=new MediaStream([this.agenerator]),this.videoPlayerElement.srcObject=this.processedStream,this.webCodecsPlayer.getWorkerHolder().postVideoRenderStart({agenerator:this.agenerator.writable,width:t,height:e,mainSharedArrayBuffer:this.webCodecsPlayer.getSharedArrayBufferHolder().getMainBuffer()},[this.agenerator.writable])}},{key:"appendFrame",value:function(t){this.webCodecsPlayer.getWorkerHolder().postFrameInfo({frameInfo:t}),this.lastFrameTimeStamp=t.timeStamp,t.frame.close(),t=null}},{key:"getVideoStatData",value:function(t){1==Number(s1._printVideoRenderStat)&&sQ.logger.log("VideoRender.getVideoStatData",t)}},{key:"getVideoElement",value:function(){return this.videoPlayerElement}},{key:"onAudioPauseByBrowser",value:function(){this.videoPlayerElemen&&this.videoPlayerElement.pause(),sQ.logger.log("VideoRender.onAudioPauseByBrowser")}},{key:"play",value:function(){var t=this;if((!this.isPlayVideo||!this.webCodecsPlayer.audioBrowserPaused)&&(this.isPlayVideo=!0,this.videoPlayerElement&&this.videoPlayerElement.paused)){var e=this.videoPlayerElement.play();e&&e.then(function(){sQ.logger.log("VideoRender.play success"),t.webCodecsPlayer.audioBrowserPaused&&(t.videoPlayerElement.pause(),t.webCodecsPlayer&&t.webCodecsPlayer.onPauseByBrowser())}).catch(function(e){var i=e.toString();sJ.warn("VideoRender.play error: ".concat(i)),t.webCodecsPlayer&&(i.indexOf("NotAllowedError")>=0||i.indexOf("request was interrupted")>=0)&&t.webCodecsPlayer&&t.webCodecsPlayer.onPauseByBrowser()})}}},{key:"getPauseStatList",value:function(){var t=[].slice.call(this.pauseList);return this.pauseList.length=0,t}},{key:"getRenderedFrameNums",value:function(){return this.renderedFrameNums}},{key:"getVideoPts",value:function(){return this.webCodecsPlayer.getSharedArrayBufferHolder().getVideoPts()}},{key:"getDecodedBuffer",value:function(){return this.webCodecsPlayer.getSharedArrayBufferHolder().getDecodedBuffer()}},{key:"getRenderFps",value:function(){var t=this.webCodecsPlayer.getSharedArrayBufferHolder().getRenderNums(),e=t-this.lastRenderNums;return this.lastRenderNums=t,e<0&&(e=0),e}},{key:"getVideoThrowFps",value:function(){var t=this.webCodecsPlayer.getSharedArrayBufferHolder().getVideoThrowNums(),e=t-this.lastVideoThrowNums;return this.lastVideoThrowNums=t,e<0&&(e=0),e}},{key:"containerResize",value:function(t){}},{key:"onVisibilitychange",value:function(){var t=document.visibilityState;this.webCodecsPlayer.getWorkerHolder().postVisibilityChange({state:t})}},{key:"updateVideoFPS",value:function(t,e){this.webCodecsPlayer.getWorkerHolder().postUpdateVideoFps({fps:t,no
1ReferFps:e})}},{key:"setPlayMinBuffer",value:function(t){this.webCodecsPlayer.getWorkerHolder().postSetPlayMinBuffer({bufferLen:t})}},{key:"getDecodeFps",value:function(){var t=this.webCodecsPlayer.getSharedArrayBufferHolder(),e=t.getAudioTodecodeNums(),i=t.getVideoTodecodeNums(),s=t.getAudioDecodedNums(),r=t.getVideoDecodedNums(),a=t.getDecodedVideoDelay(),n=t.getDecodedVideoDelaySmooth(),o=t.getVideoReadyToRenderListLen(),u=t.getVideoEnhanceCost(),l=e-this.lastToDecodeAudioNums,d=i-this.lastToDecodeVideoNums,c=s-this.lastDecodedAudioNums,f=r-this.lastDecodedVideoNums;return this.lastToDecodeAudioNums=e,this.lastToDecodeVideoNums=i,this.lastDecodedAudioNums=s,this.lastDecodedVideoNums=r,{toDecodeAudioFps:l,toDecodeVideoFps:d,decodedAudioFps:c,decodedVideoFps:f,decodedVideoDelay:a,decodedVideoDelaySmooth:n,videoFrameLen:o,videoEnhanceCost:u,enhanceLess30Nums:t.getEnhanceLess30Nums(),enhanceLess150Nums:t.getEnhanceLess150Nums(),enhanceLess200Nums:t.getEnhanceLess200Nums(),enhanceLarge200Nums:t.getEnhanceLarge200Nums(),enhanceTotal:t.getEnhanceTotal()}}},{key:"getDiscardVideoFrames",value:function(){var t=this.webCodecsPlayer.getSharedArrayBufferHolder().getVideoDecodeDiscardNums(),e=t-this.lastDiscardVideoNums;return this.lastDiscardVideoNums=t,e}},{key:"getEnhanceVideoFrames",value:function(){var t=this.webCodecsPlayer.getSharedArrayBufferHolder().getEnhanceVideoFrames(),e=t-this.lastEnhanceVideoNums;return this.lastEnhanceVideoNums=t,e}},{key:"setAudioDecodedBuffer",value:function(t){this.webCodecsPlayer.getSharedArrayBufferHolder().storeMainBuffer(sX.a.AUDIO_DECODED_BUFFER,t)}},{key:"getVideoBufferLen",value:function(){var t=0;if(this.videoPlayerElement){var e=this.videoPlayerElement.buffered;e.length>0&&(t=1e3*(e.end(e.length-1)-this.videoPlayerElement.currentTime)|0)}return t}},{key:"userPause",value:function(){sQ.logger.log("VideoRenderWorker.userPause"),this.webCodecsPlayer.getSharedArrayBufferHolder().storeMainBuffer(sX.a.PAUSE_STATUS,1)}},{key:"userPlay",value:function(){sQ.logger.log("VideoRenderWorker.userPlay"),this.webCodecsPlayer.getSharedArrayBufferHolder().storeMainBuffer(sX.a.PAUSE_STATUS,0)}},{key:"onVideoPause",value:function(){sQ.logger.log("VideoRenderWorker.onVideoPause"),this.isLive||this.videoPlayerElement.pause()}},{key:"onVideoPlay",value:function(){sQ.logger.log("VideoRenderWorker.onVideoPlay")}},{key:"setRealFps",value:function(t){this.webCodecsPlayer.getSharedArrayBufferHolder().storeMainBuffer(sX.a.VIDEO_REAL_FPS,t)}},{key:"getVideoWidth",value:function(){return this.videoPlayerElement?this.videoPlayerElement.videoWidth:0}},{key:"getVideoHeight",value:function(){return this.videoPlayerElement?this.videoPlayerElement.videoHeight:0}},{key:"startMuteRender",value:function(){sQ.logger.log("VideoRenderWorker.startMuteRender"),this.webCodecsPlayer.onVideoPlay(),this.videoPlayerElement.play()}},{key:"setPlaybackRate",value:function(t){this.webCodecsPlayer.getWorkerHolder().postPlayBackRate(t)}},{key:"close",value:function(){this.videoPlayerElement&&this.videoPlayerElement.pause(),Object(n.a)(Object(o.a)(i.prototype),"close",this).call(this),this.rafNow=0,this.renderedFrameNums=0,this.isBrowserHidden=!1,this.renderFpsList.length=0,this.canvas=null,this.lastRenderNums=0,this.lastVideoThrowNums=0,this.lastToDecodeAudioNums=0,this.lastToDecodeVideoNums=0,this.lastDecodedAudioNums=0,this.lastDecodedVideoNums=0,this.lastDiscardVideoNums=0,this.lastEnhanceVideoNums=0,this.videoPlayerElement&&this.videoPlayerElement.removeEventListener("resize",this.webCodecsPlayer.onVideoResizeBind),this.videoPlayerElement=null,this.agenerator=null,this.processedStream=null}}]),i}(s3),s6=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).audioDuration=0,r.ageneratorWriter=null,r.audioPlayerElement=null,r.processedStream=null,r.agenerator=null,r.renderTimer=0,r.frameTimeStamps=[],r.renderQueueLimit=5,r.audioSampleRate=44100,r.volume=1,r.paused=!1,r.renderNums=0,r.lastRenderNums=0,r.player=t,r.firstFrameRenderWriting=!1,r.firstFinshed=!1,r.isMuffled=!1,r.cacheVolume=1,r.isPlaying=!1,r.userPaused=!1,r.audioPlayerElement=document.createElement("audio"),r.audioPlayerElement.addEventListener("error",t.onVideoErrorBind),r.audioPlayerElement.addEventListener("play",t.onVideoPlayBind),r.audioPlayerElement.addEventListener("playing",t.onVideoPlayingBind),r.playing=!1,r}return Object(r.a)(i,[{key:"start",value:function(){"MediaStreamTrackProcessor"in window&&"MediaStreamTrackGenerator"in window?(this.agenerator=new MediaStreamTrackGenerator({kind:"audio"}
1),this.processedStream=new MediaStream([this.agenerator]),this.audioPlayerElement.srcObject=this.processedStream,this.player.getWorkerHolder().postAuidoTrack({ageneratorWriter:this.agenerator.writable},[this.agenerator.writable]),this.setVolume(this.volume)):this.player.onWebcodecsError(sX.d.NOT_SUPPORT_MEDIASRTREAMTRACK)}},{key:"getCurrentDts",value:function(){return this.player.getSharedArrayBufferHolder().getAudioDts()}},{key:"getCurrentTime",value:function(){return this.audioPlayerElement&&this.audioPlayerElement.currentTime?Math.round(1e3*this.audioPlayerElement.currentTime):0}},{key:"setVolume",value:function(t){this.isMuffled?this.audioPlayerElement&&(this.audioPlayerElement.volume=0):this.audioPlayerElement&&(this.audioPlayerElement.volume=t),this.volume=t,this.cacheVolume=t}},{key:"setMuffledVolume",value:function(t){this.isMuffled=t,this.isMuffled?this.audioPlayerElement&&(this.audioPlayerElement.volume=0):this.setVolume(this.cacheVolume)}},{key:"setMuted",value:function(t){this.isMute=t,t?this.audioPlayerElement&&(this.audioPlayerElement.muted=!0):this.audioPlayerElement&&(this.audioPlayerElement.muted=!1)}},{key:"getRenderFps",value:function(){var t=this.player.getSharedArrayBufferHolder().getAudioRenderNums(),e=t-this.lastRenderNums;return e<0&&(e=0),this.lastRenderNums=t,e}},{key:"pause",value:function(){this.audioPlayerElement.pause()}},{key:"play",value:function(){this._play()}},{key:"_checkPlay",value:function(){sJ.log("AudioRender.checkPlay playing=".concat(this.playing)),this.playing?Timer.remove(this._checkPlay,this):this._play()}},{key:"_play",value:function(){var t=this,e=this.audioPlayerElement.play();e?e.then(function(){t.playing=!0,sJ.log("AudioRender.play success")}).catch(function(e){t.playing=!1;var i=e.toString();sJ.warn("AudioRender.play error: ".concat(i)),t.player&&(i.indexOf("NotAllowedError")>=0||i.indexOf("request was interrupted")>=0||t.audioPlayerElement.paused)&&t.player&&t.player.onPauseByBrowser(),t.userPaused=!0}):this.playing=!1}},{key:"userPlay",value:function(){sJ.log("AudioRender.userPlay"),this.userPaused=!1,this.play()}},{key:"userPause",value:function(){sJ.log("AudioRender.userPause"),this.userPaused=!0,this.pause(),this.player.onVideoPauseBind()}},{key:"workerMessage",value:function(t){switch(t.data.type){case sX.b.WORKERSHAREBUFFER:break;case sX.b.AUDIODECODEERROR:sJ.log("webCodecs worker.onDecoderError, audio decode error"),this.player.onWebcodecsError(sX.d.AUDIODECODEERROR)}}},{key:"getAudioBufferLen",value:function(){var t=0;if(this.audioPlayerElement){var e=this.audioPlayerElement.buffered;e.length>0&&(t=1e3*(e.end(e.length-1)-this.audioPlayerElement.currentTime)|0)}return t}},{key:"initAudio",value:function(){}},{key:"onCheckFastTimer",value:function(){}},{key:"close",value:function(){Object(n.a)(Object(o.a)(i.prototype),"close",this).call(this),this.audioPlayerElement&&this.audioPlayerElement.pause(),this.audioPlayerElement.removeEventListener("pause",this.player.onVideoPauseBind),this.audioPlayerElement.removeEventListener("error",this.player.onVideoErrorBind),this.audioPlayerElement.removeEventListener("play",this.player.onVideoPlayBind),this.audioPlayerElement.removeEventListener("playing",this.player.onVideoPlayingBind),this.agenerator=null,this.ageneratorWriter=null,this.audioPlayerElement=null,this.processedStream=null,this.renderNums=0,this.lastRenderNums=0,this.firstFinshed=!1,this.frameTimeStamps.length=0,this.isPlaying=!1,this.userPaused=!1,this.playing=!1}}]),i}(s3),s4=Object(r.a)(function t(){Object(s.a)(this,t)});s4.INIT="init",s4.INITED="inited",s4.STOP="stop",s4.PAUSE="pause",s4.RESUME="resume",s4.PLAY="play",s4.AUDIO_FRAME="audio_frame",s4.UPDATE_CURRENT_TIME="update_current_time",s4.TIME_STAMP="timestamp",s4.VOLUME="volume",s4.AUDIO_DATA_NAN="AUDIO_DATA_NAN",s4.AUDIO_DATA_MUTE="AUDIO_DATA_MUTE",s4.LOG_CFG="LOG_CFG",s4.UPDATE_PLAYBACKRATE="UPDATE_PLAYBACKRATE",s4.SEEK="SEEK",s4.ON_VIDEO_SEEK="ON_VIDEO_SEEK";var s8=i(27),s9=i.n(s8),s7=window.AudioContext||window.webkitAudioContext,rt=0,re=function(){function t(e){Object(s.a)(this,t),this._id=rt++,this.player=e,this.audioCtx=null,this.outputAnalyser=null,this.oscillator=null,this.bypasser=null,this.outputChannelCount=2,this.sampleRate=44100,this.currentDts=0,this.isMuffled=!1,this.isMute=!1,this.cacheVolume=1,this.isPlaying=!1,this.userPaused=!1,this.renderNums=0,this.lastRenderNums=0,this.isFirstFrameTs=0,this.firstTimeStamp=0,this.gainNode=null,this.audioContextState="",this.isFirstPlay=!1,this.onAudioStateChangeBind=this.onAudioStateChange.bind(this),this.audioFrames=[],this._logCfg={},this._logTs=0,this.volume=1,this.playbackRate=1,this.player.isLive?this.playMode=0:this.playMode=1,this.sampleRate=44100,this.outputChannelCount=2,this.isInited=!1}return Object(r.a)(t,[{key:"isSuspended",value:function(){return"suspended"===this.audioContextState}},{key:"start",value:function(){}},{key:"initAudio",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:44100,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(44100==t||48e3==t){if(this.sampleRate=t,this.outputChannelCount=e,sQ.logger.log("AudioWorkletNodeRenderer.initAudio"),this.audioCtx=new s7({sampleRate:t}),"suspended"==this.audioCtx.state)return this.player.onAudioPauseByBrowser(),void(this.isAudioPause=!0);this.initAudioContext(e)}else this.player.onWebcodecsError(sX.d.NOT_SUPPORT_AUDIO_SAMPLERATE)}},{key:"getAudioAnalyser",value:function(){return this.outputAnalyser}},{key:"initAudioContext",value:function(t){var e=this;sQ.logger.log("AudioWorkletNodeRenderer.initAudioContext"),this.outputChannelCount=t,this.audioCtx.audioWorklet.addModule(s9.a).then(function(){e.audioCtx&&(e.outputAnalyser=e.audioCtx.createAnalyser(),e.bypasser=new AudioWorkletNode(e.audioCtx,"bypass-processor",{outputChannelCount:[t]}),e.bypasser.port.onmessage=e.onMessage.bind(e),e.bypasser.connect(e.outputAnalyser),e.outputAnalyser.connect(e.audioCtx.destination),e.player&&e.player.onAudioAnalyserInit(e.outputAnalyser))}),this.audioCtx.addEventListener("statechange",this.onAudioStateChangeBind)}},{key:"setPlaybackRate",value:function(t){sQ.logger.log("AudioWorkletNodeRenderer.setPlaybackRate",t),this.playbackRate!=t&&(this.playbackRate=t,this.postMessage(s4.UPDATE_PLAYBACKRATE,t))}},{key:"muteRecoverInit",value:function(){sQ.logger.log("AudioWorkletNodeRenderer.muteRecoverInit"),this.isAudioPause=!1,this.audioCtx=null,this.initAudio(this.sampleRate,this.outputChannelCount)}
1},{key:"onAudioStateChange",value:function(){var t=this.audioCtx.state;sQ.logger.log("AudioWorkletNodeRenderer.onAudioStateChange, state=".concat(t)),this.audioContextState=t,"suspended"==t?(this.player.onVideoPause(),this.isAudioPause=!0):"running"==t&&(this.player.onAudioPlay(),this.isAudioPause=!1)}},{key:"seek",value:function(){this.isSeek=!0,this.postMessage(s4.SEEK)}},{key:"onVideoSeek",value:function(){sQ.logger.log("AudioWorkletNodeRenderer.onVideoSeek"),this.isSeek=!1,this.postMessage(s4.ON_VIDEO_SEEK)}},{key:"appendFrame",value:function(t){-1!=t.format.indexOf("32")?this.isAudioPause?this.isSeek||this.audioFrames.push(t):this.isInited?this.postMessage(s4.AUDIO_FRAME,t):this.audioFrames.push(t):this.player.onWebcodecsError(sX.d.AUDIO_FORMAT_ERROR)}},{key:"onWorkLetReady",value:function(){var t=this;sQ.logger.log("AudioWorkletNodeRenderer.onWorkLetReady, frameLen=".concat(this.audioFrames.length)),this.audioFramesClear(),this.audioFrames.length>=0&&(this.audioFrames.map(function(e){t.postMessage(s4.AUDIO_FRAME,e)}),this.audioFrames.length)}},{key:"onCheckFastTimer",value:function(){if(this.audioFramesClear(),this.bypasser&&this.bypasser.port&&this.bypasser.port.postMessage){var t=sY.now();if(t-this._logTs>1e3){this._logTs=t;var e={printProcess:1==s1._printProcess,printAudioData:1==s1._printAudioData,printRenderSkipAudio:1==s1._printRenderSkipAudio};e.printProcess==this._logCfg.printProcess&&e.printAudioData===this._logCfg.printAudioData&&e.printRenderSkipAudio===this._logCfg.printRenderSkipAudio||(this._logCfg=e,this.postMessage(s4.LOG_CFG,e))}}}},{key:"audioFramesClear",value:function(){for(var t=this.player.getVideoPts();this.audioFrames.length>0;){var e=this.audioFrames[0];if(!(e.timeStamp<t))break;this.audioFrames.shift(),this.player.isLive||this.isAudioPause||this.player.getSharedArrayBufferHolder().storeMainBuffer(sX.e.AUDIO_DTS,e.timeStamp)}}},{key:"onMessage",value:function(t){switch(t.data.type){case s4.INITED:sQ.logger.log("AudioWorkletNodeRenderer.onMessage inited, playMode=".concat(this.playMode)),this.setVolume(this.volume),this.postMessage(s4.INIT,{outputChannelCount:this.outputChannelCount,id:this._id,playMode:this.playMode,playbackRate:this.playbackRate,mainSharedArrayBuffer:this.player.getSharedArrayBufferHolder().getMainBuffer()}),this.onWorkLetReady(),this.isSeek?this.postMessage(s4.SEEK):this.postMessage(s4.ON_VIDEO_SEEK),this.isInited=!0;break;case s4.TIME_STAMP:var e=sY.now();this.currentDts=t.data.data.timeStamp,this.renderNums=t.data.data.renderNums,this.isFirstPlay||(this.isFirstPlay=!0,this.player.triggerAudioPlay()),this.player.audioPlayConsuming&&this.player.audioPlayConsuming.addRenderFrameData&&this.player.audioPlayConsuming.addRenderFrameData(this.currentDts,e),0==this.isFirstFrameTs?(this.isFirstFrameTs=e,this.firstTimeStamp=this.currentDts):Number(1==s1._printWebcodecsWorkletDts)&&sQ.logger.log("AudioWorkLet, dts=".concat(this.currentDts,",localPast=").concat(sY.now()-this.isFirstFrameTs,",audioPast=").concat(this.currentDts-this.firstTimeStamp));break;case s4.AUDIO_DATA_NAN:this.player.onWebcodecsError(sX.d.AUDIO_DATA_NAN);case s4.AUDIO_DATA_MUTE:}}},{key:"postMessage",value:function(t,e){this.bypasser&&this.bypasser.port&&this.bypasser.port.postMessage&&this.bypasser.port.postMessage({type:t,data:e})}},{key:"workerMessage",value:function(t){switch(t.data.type){case sX.b.WORKERSHAREBUFFER:break;case sX.b.AUDIODECODEERROR:sQ.logger.log("webCodecs worker.onDecoderError, audio decode error"),this.player.onWebcodecsError(sX.d.AUDIODECODEERROR)}}},{key:"getCurrentDts",value:function(){return this.player.getSharedArrayBufferHolder().getAudioDts()||this.currentDts}},{key:"getCurrentTime",value:function(){return this.audioCtx?Math.round(this.audioCtx.currentTime):0}},{key:"setVolume",value:function(t){this.isMuffled||this.isMute?this.postMessage(s4.VOLUME,0):this.postMessage(s4.VOLUME,t),this.volume=t,this.cacheVolume=t}},{key:"setMuffledVolume",value:function(t){this.isMuffled=t,this.isMuffled?this.postMessage(s4.VOLUME,0):this.setVolume(this.cacheVolume)}},{key:"setMuted",value:function(t){this.isMute=t,t?this.postMessage(s4.VOLUME,0):this.setVolume(this.cacheVolume)}},{key:"getRenderFps",value:function(){var t=this.renderNums,e=t-this.lastRenderNums;return e<0&&(e=0),this.lastRenderNums=t,e}},{key:"pause",value:function(){sQ.logger.log("AudioWorkletNodeRenderer.pause"),this.postMessage(s4.PAUSE)}},{key:"play",value:function(){this._play(),this.postMessage(s4.PLAY)}},{key:"_play",value:function(){var t=this;if(this.audioCtx){var e=this.audioCtx.resume();e?e.then(function(){t.playing=!0,sQ.logger.log("AudioRender.play success")}
1).catch(function(e){t.playing=!1;var i=e.toString();sQ.logger.warn("AudioRender.play error: ".concat(i)),t.player&&t.player.onAudioPauseByBrowser(),t.userPaused=!0}):this.playing=!1}}},{key:"userPlay",value:function(){sQ.logger.log("AudioRender.userPlay"),this.isAudioPause&&!this.player.isLive&&this.muteRecoverInit(),this.userPaused=!1,this.play()}},{key:"userPause",value:function(){sQ.logger.log("AudioRender.userPause"),this.userPaused=!0,this.pause(),this.player.onVideoPause()}},{key:"getAudioBufferLen",value:function(){return 0}},{key:"close",value:function(){this.currentDts=0,this.audioCtx&&(this.postMessage(s4.STOP,null),sQ.logger.log("AudioWorkletNodeRenderer.close"),this.bypasser&&(this.bypasser.port.close(),this.bypasser.disconnect(this.audioCtx),this.bypasser=null),this.audioCtx.removeEventListener("statechange",this.onAudioStateChangeBind),this.audioCtx.close(),this.audioCtx=null),this.renderNums=0,this.lastRenderNums=0,this.isFirstFrameTs=0,this.firstTimeStamp=0,this.isFirstPlay=!1}}]),t}(),ri=function(){function t(){Object(s.a)(this,t);var e=new SharedArrayBuffer(1024);this._mainBuffer=new Uint32Array(e),this._workerBufferAudio=null}return Object(r.a)(t,[{key:"getMainBuffer",value:function(){return this._mainBuffer}},{key:"setWorkerBufferVideo",value:function(t){this._mainBuffer=t}},{key:"setWorkerBufferAudio",value:function(t){this._workerBufferAudio=t}},{key:"storeMainBuffer",value:function(t,e){this._mainBuffer&&Atomics.store(this._mainBuffer,t,e)}},{key:"storeMainShieldAudio",value:function(t){this.storeMainBuffer(sX.a.IS_SHIELD_AUDIO,t)}},{key:"storeFrameBuffer",value:function(t){this.storeMainBuffer(sX.a.FRAME_BUFFER_LEN,t)}},{key:"storeRecvVideoTs",value:function(t){this.storeMainBuffer(sX.a.LAST_VIDEO_RCV_TS,t)}},{key:"getBufferLen",value:function(){return this._loadWorker(sX.e.VIDEO_BUFFER_LEN,this._mainBuffer)}},{key:"getVideoPts",value:function(){return this._loadWorker(sX.e.VIDEO_PTS,this._mainBuffer)}},{key:"getDecodedBuffer",value:function(){return this._loadWorker(sX.e.VIDEO_NOT_RENDERD_BUFFER,this._mainBuffer)}},{key:"getRenderNums",value:function(){return this._loadWorker(sX.e.VIDEO_RENDER_NUMS,this._mainBuffer)}},{key:"getAudioRenderNums",value:function(){return this._loadWorker(sX.e.AUDIO_RENDER_NUMS,this._mainBuffer)}},{key:"getVideoThrowNums",value:function(){return this._loadWorker(sX.e.VIDEO_THROW_FRAME_FPS,this._mainBuffer)}},{key:"getAudioTodecodeNums",value:function(){return this._loadWorker(sX.e.AUDIO_TODECODE_NUMS,this._mainBuffer)}},{key:"getVideoTodecodeNums",value:function(){return this._loadWorker(sX.e.VIDEO_TODECODE_NUMS,this._mainBuffer)}},{key:"getAudioDecodedNums",value:function(){return this._loadWorker(sX.e.AUDIO_DECODE_NUMS,this._mainBuffer)}},{key:"getVideoDecodedNums",value:function(){return this._loadWorker(sX.e.VIDEO_DECODE_NUMS,this._mainBuffer)}},{key:"getDecodedVideoDelay",value:function(){return this._loadWorker(sX.e.VIDEO_DECODED_DELAY,this._mainBuffer)}},{key:"getDecodedVideoDelaySmooth",value:function(){return this._loadWorker(sX.e.VIDEO_DECODED_DELAY_SMOOTH,this._mainBuffer)}},{key:"getVideoReadyToRenderListLen",value:function(){return this._loadWorker(sX.e.VIDEO_READY_TO_RENDER_LIST_LEN,this._mainBuffer)}},{key:"getVideoDecodeDiscardNums",value:function(){return this._loadWorker(sX.e.VIDEO_DECODE_DISCARD_NUMS,this._mainBuffer)}},{key:"getEnhanceVideoFrames",value:function(){return this._loadWorker(sX.e.VIDEO_ENHANCE_NUMS,this._mainBuffer)}},{key:"getVideoEnhanceCost",value:function(){return this._loadWorker(sX.e.VIDEO_ENAHNCE_COST,this._mainBuffer)}},{key:"getEnhanceLess30Nums",value:function(){return this._loadWorker(sX.e.VIDEO_ENHANCE_LESS30_NUMS,this._mainBuffer)}},{key:"getEnhanceLess150Nums",value:function(){return this._loadWorker(sX.e.VIDEO_ENHANCE_LESS150_NUMS,this._mainBuffer)}},{key:"getEnhanceLess200Nums",value:function(){return this._loadWorker(sX.e.VIDEO_ENHANCE_LESS200_NUMS,this._mainBuffer)}},{key:"getEnhanceLarge200Nums",value:function(){return this._loadWorker(sX.e.VIDEO_ENHANCE_LARGE200_NUMS,this._mainBuffer)}},{key:"getEnhanceTotal",value:function(){return this._loadWorker(sX.e.VIDEO_ENHANCE_TOTAL,this._mainBuffer)}},{key:"getAudioDts",value:function(){return this._loadWorker(sX.e.AUDIO_DTS,this._mainBuffer)}},{key:"getVideoFirstFrameDecodeCost",value:function(){return this._loadWorker(sX.e.VIDEO_FIRST_FRAME_DECODEC_COST,this._mainBuffer)}},{key:"getAudioFirstFrameDecodeCost",value:function(){return this._loadWorker(sX.e.AUDIO_FIRST_FRAME_DECODEC_COST,this._mainBuffer)}},{key:"_loadWorker",value:function(t,e){return e?Atomics.load(e,t):0}}]),t}(),rs=function(){function t(e,i){Object(s.a)(this,t),this._config=e,this.isLive=e.isLive,this.videoElement=e.videoElement,this._callbacks=i,this._worker=sZ()(30),this._workerHolder=new s2(this),this._sharedArrayBufferHolder=new ri,this._videoRender=new s5(this),1==s1._enableAudioTrack?this._audioRender=new s6(this):this._audioRender=new re(this),this._isAudioPause=!1,this._isRenderStart=!1,this._logCfgCheckTs=0,this._logCfg={},this._initConfig()}
1return Object(r.a)(t,[{key:"_initConfig",value:function(){this._workerHolder.postInitConfig({config:JSON.stringify(this._config)}),this._checkLogCfg(sY.now())}},{key:"setVodAv1",value:function(){this._workerHolder.postSetVodAv1()}},{key:"getWorker",value:function(){return this._worker}},{key:"getWorkerHolder",value:function(){return this._workerHolder}},{key:"getSharedArrayBufferHolder",value:function(){return this._sharedArrayBufferHolder}},{key:"getVideoRender",value:function(){return this._videoRender}},{key:"getAudioRender",value:function(){return this._audioRender}},{key:"getVideoElement",value:function(){return this._videoRender.getVideoElement()}},{key:"getVideoPts",value:function(){return this._videoRender?this._videoRender.getVideoPts():0}},{key:"getDecodeFps",value:function(){return this._videoRender.getDecodeFps()}},{key:"getDecodedBuffer",value:function(){return this._videoRender.getDecodedBuffer()}},{key:"getVideoRenderFps",value:function(){return this._videoRender.getRenderFps()}},{key:"getAudioRenderFps",value:function(){return this._audioRender.getRenderFps()}},{key:"getVideoThrowFps",value:function(){return this._videoRender.getVideoThrowFps()}},{key:"getDiscardVideoFrames",value:function(){return this._videoRender.getDiscardVideoFrames()}},{key:"getEnhanceVideoFrames",value:function(){return this._videoRender.getEnhanceVideoFrames()}},{key:"getDecodedVideoDelaySmooth",value:function(){return this._sharedArrayBufferHolder.getDecodedVideoDelaySmooth()}},{key:"getCurrentTime",value:function(){return this._audioRender.getCurrentTime()}},{key:"getCurrentAudioDts",value:function(){return this._audioRender.getCurrentDts()}},{key:"getBufferLen",value:function(){return this._sharedArrayBufferHolder.getBufferLen()}},{key:"setRealFps",value:function(t){this._videoRender.setRealFps(t)}},{key:"updateVideoFPS",value:function(t,e){this._videoRender.updateVideoFPS(t,e)}},{key:"getAudioError",value:function(){return this._audioRender.audioPlayerElement.error}},{key:"userPause",value:function(){this._audioRender.userPause(),this._videoRender.userPause()}},{key:"userPlay",value:function(){this._audioRender.userPlay(),this._videoRender.userPlay()}},{key:"setPlayMinBuffer",value:function(t){this._workerHolder.postSetPlayMinBuffer({bufferLen:t})}},{key:"startMuteRender",value:function(t){this._audioRender.isAudioPause&&(sQ.logger.log("WebcodecsPlayer.startMuteRender.".concat(0===t?"mute":"setVolume"," val=").concat(t)),0===t?(this._isAudioPause=!0,this.audioBrowserPaused=!1,this._videoRender.startMuteRender()):this._isAudioPause&&(this.onAudioPlay(),this._audioRender.muteRecoverInit())),this._audioRender.setVolume(t)}},{key:"setMuffledVolume",value:function(t){this._audioRender.setMuffledVolume(t)}},{key:"setPauseVideoDecode",value:function(t){this._workerHolder.postSetPauseVideoDecode({isPause:t})}},{key:"setPauseAudioDecode",value:function(t){this._workerHolder.postSetPauseAudioDecode({isPause:t})}},{key:"isAudioSuspended",value:function(){return this._audioRender.isSuspended()}},{key:"onVisibilitychange",value:function(){this._videoRender.onVisibilitychange()}},{key:"onAudioPauseByBrowser",value:function(){sQ.logger.log("WebcodecsPlayer.onAudioPauseByBrowser"),this.getSharedArrayBufferHolder().storeMainBuffer(sX.a.BROWSER_PAUSE_STATUS,1),this.audioBrowserPaused=!0,this._videoRender.onAudioPauseByBrowser()}},{key:"onAudioAnalyserInit",value:function(t){this._callbacks&&this._callbacks.onAudioAnalyserInit(t)}},{key:"onPauseByBrowser",value:function(){this._callbacks&&this._callbacks.onPauseByBrowser()}},{key:"onVideoPause",value:function(){this._videoRender.onVideoPause()}},{key:"onVideoPlay",value:function(){this._videoRender.onVideoPlay(),this._callbacks.onVideoPlay&&this._callbacks.onVideoPlay()}},{key:"onAudioPlay",value:function(){sQ.logger.log("WebcodecsPlayer.onAudioPlay"),this.audioBrowserPaused=!1,this._videoRender.onVideoPlay(),this.get
1SharedArrayBufferHolder().storeMainBuffer(sX.a.BROWSER_PAUSE_STATUS,0)}},{key:"triggerAudioPlay",value:function(){if(this._audioRender){var t=this.getSharedArrayBufferHolder().getAudioFirstFrameDecodeCost();sQ.logger.log("WebcodecsPlayer.triggerPlay audio",t),this._audioRender.play(),this.triggerPlay("audio")}}},{key:"triggerPlay",value:function(t){this._videoRender.play();var e=this.getSharedArrayBufferHolder().getVideoFirstFrameDecodeCost(),i=this.getSharedArrayBufferHolder().getAudioFirstFrameDecodeCost();this._callbacks&&this._callbacks.triggerPlay(e,i,t)}},{key:"triggerWebcodecsPlay",value:function(){this.triggerPlay("video"),this._callbacks&&this._callbacks.triggerWebcodecsPlay()}},{key:"setFramePause",value:function(){this._callbacks&&this._callbacks.setFramePause&&this._callbacks.setFramePause()}},{key:"setFrameRusume",value:function(){this._callbacks&&this._callbacks.setFrameRusume&&this._callbacks.setFrameRusume()}},{key:"renderFpsPause",value:function(){this._callbacks&&this._callbacks.renderFpsPause&&this._callbacks.renderFpsPause()}},{key:"getVideoStatData",value:function(t){1==Number(s1._printVideoRenderStat)&&sQ.logger.log("VideoRender.getVideoStatData",t)}},{key:"onWorkerInterval",value:function(t){this._audioRender.onCheckFastTimer(),this._callbacks&&this._callbacks.onWorkerInterval(t),this._checkLogCfg(t)}},{key:"_checkLogCfg",value:function(t){if(0===this._logCfgCheckTs||t-this._logCfgCheckTs>1e3){this._logCfgCheckTs=t;var e={printTodecodeVideo:1==s1._printTodecodeVideo,printToDecodeAudio:1==s1._printToDecodeAudio,printDecodedVideo:1==s1._printDecodedVideo,printDecodedAudio:1==s1._printDecodedAudio,printTorenderVideo:1==s1._printTorenderVideo,printTorenderAudio:1==s1._printTorenderAudio,printAppendVideo:1==s1._printAppendVideo,printAppendAudio:1==s1._printAppendAudio,printVideoDecodeFast:1==s1._printVideoDecodeFast,printRenderSkipFrame:1==s1._printRenderSkipFrame},i=!1;for(var s in e)if(this._logCfg[s]!==e[s]){i=!0;break}this._logCfg=e,i&&this._workerHolder.postLogCfg(e)}}},{key:"onWebcodecsError",value:function(t,e){sQ.logger.log("WebcodecsPlayer.onWebcodecsError type=".concat(t),e),this._callbacks&&this._callbacks.onWebcodecsError(t,e)}},{key:"containerResize",value:function(t){this._videoRender.containerResize(t)}},{key:"setEnableDiscard",value:function(t){this._workerHolder.postEnableDiscardVideo({enableDiscard:t})}},{key:"updateCurBitrate",value:function(t){this._workerHolder.postUpdateCurBitrate({curBitrate:t})}},{key:"setJitter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5?arguments[5]:void 0;this._workerHolder.postSetJitter({bufLen:t,bufMin:e,bufMax:i,jumpBufferCfg:s,shieldAudioCfgBufLen:r,isRemuxBuf:1===a})}},{key:"updateAVCConfig",value:function(t){var e=t.width,i=t.height;sQ.logger.log("WebcodecsPlayer.updateAVCConfig width=".concat(e," height=").concat(i)),this._isRenderStart||(this._videoRender.start(e,i,this.videoElement),this._audioRender.start(),this._isRenderStart=!0),this._workerHolder.postAvcConfig(t)}},{key:"initSegmentSuc",value:function(t){this._workerHolder.postAv1InitSeg(t)}},{key:"updateAVCPPS",value:function(t,e){this._workerHolder.postAVCPPS({data:t,timestamp:e})}},{key:"updateAVCSPS",value:function(t,e){this._workerHolder.postAVCSPS({data:t,timestamp:e})}},{key:"updateAVCVPS",value:function(t,e){this._workerHolder.postAVCVPS({data:t,timestamp:e})}},{key:"appendVideoSample",value:function(t,e){var i=Math.floor(t.ts),s=t.key,r=Math.floor(t.cts),a=t.units,n=0,o=0,u=0;a.map(function(t){o+=t.data.byteLength,"AV01"!=e&&u++});var l=new Uint8Array(o+4*u),d=new DataView(l.buffer);d.setUint32(0,l.byteLength);var c=!1,f=0;a.map(function(t,i){var s=t.data.byteLength;f=t.naluType,c=t.discardAllow,"AV01"!=e&&(d.setUint32(n,s),n+=4),l.set(t.data,n),n+=s});var p=new EncodedVideoChunk({type:s?"key":"delta",timestamp:i,duration:3e3,data:d.buffer}),m=new s0(s0.VIDEO,i,p,c,s,r,f,t,t.av1Extradata);1!==Number(s1._dropVideoUnit)&&this._workerHolder.postVideoSamples({videoSamples:[m]})}},{key:"appendAv1VideoSample",value:function(t){var e=Math.floor(t.ts),i=t.key,s=new EncodedVideoChunk({type:i?"key":"delta",timestamp:e,duration:3e3,data:t.data}),r=new s0(s0.VIDEO,e,s,!1,i,0,void 0,t);1!==Number(s1._dropVideoUnit)&&this._workerHolder.postVideoSamples({videoSamples:[r]})}},{key:"updateAudioConfig",value:function(t){sQ.logger.log("WebcodecsPlayer.updateAudioConfig ".concat(JSON.stringify(t)));var e=t.codec,i=t.audioSampleRate,s=t.audioChannelCount,r=t.timeStamp;this._audioRender&&(this._audioRender.initAudio(i,s),this._workerHolder.postAudioConfig({codec:e,sampleRate:i,numberOfChannels:s,timestamp:r}))}},{key:"appendAudioSample",value:function(t){var e=t.unit,i=t.ts,s=new Uint8Array(e.byteLength+4);new DataView(s.buffer).setUint32(0,e.byteLength),s.set(e,4);var r=new EncodedAudioChunk({type:"key",timestamp:0,duration:3e3,data:e}),a=new s0(s0.AUIDO,i,r);1==t.empty&&a.setIsEmptyAudioFrame(!0),this._workerHolder.postAudioSamples({audioSamples:[a]})}},{key:"onFastOver",value:function(){this._workerHolder.postFastOver()}},{key:"turnToWebcodecsSoft",value:function(){this._callbacks&&this._callbacks.turnToWebcodecsSoft()}},{key:"setUseSoftAcceleration",value:function(){this._workerHolder.postSetUseSoftAcceleration()}},{key:"updateSoftAcceleration",value:function(){this._workerHolder.postUpdateSoftAcceleration()}},{key:"onWaitKeyFrame",value:function(t){this._callbacks&&this._callbacks.onWaitKeyFrame(t)}},{key:"storeMainShieldAudio",value:function(t){this._sharedArrayBufferHolder.storeMainShieldAudio(t)}},{key:"storeFrameBuffer",value:function(t){this._sharedArrayBufferHolder.storeFrameBuffer(t)}},{key:"storeRecvVideoTs",value:function(t){this._sharedArrayBufferHolder.storeRecvVideoTs(t)}},{key:"setMuted",value:function(t){this._audioRender&&this._audioRender.setMuted(t)}},{key:"setEnhance",value:function(t){this._workerHolder.setEnhance({data:t})}},{key:"setSegmenttion",value:function(t){this._workerHolder.setSegmenttion({data:t})}},{key:"onVideoEnhanceError",value:function(t){this._callbacks&&this._callbacks.onVideoEnhanceError&&this._callbacks.onVideoEnhanceError(t)}},{key:"onVideoEnhanceSuccess",value:function(){this._callbacks&&this._callbacks.onVideoEnhanceSuccess&&this._callbacks.onVideoEnhanceSuccess()}},{key:"onRevFastOver",value:function(){this._workerHolder.onRevFastOver()}},{key:"seek",value:function(t,e){this._workerHolder.seek({seekTime:t,initDts:e}),this._audioRender&&this._audioRender.seek(t)}},{key:"onVideoSeek",value:function(t){sQ.logger.log("WebcodecsPlayer.onVideoSeek seekTime=".concat(t)),this._audioRender&&this._audioRender.onVideoSeek(t),this._callbacks&&this._callbacks.onVideoSeekBind&&this._callbacks.onVideoSeekBind(t)}},{key:"setPlaybackRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this._audioRender&&this._audioRender.setPlaybackRate&&this._audioRender.setPlaybackRate(t),this._videoRender&&this._videoRender.setPlaybackRate&&this._videoRender.setPlaybackRate(t)}},{key:"destroy",value:function(){this._callbacks=null,this._worker&&(this._workerHolder.postClose(),this._worker.terminate(),this._worker=null),this._audioRender&&(this._audioRender.close(),this._audioRender=null),this._videoRender&&(this._videoRender.close(),this._videoRender=null)}}]),t}(),rr={setLogLevel:function(t){sJ.setLevel(t)}
1,init:function(t){sQ.init(t)},createIns:function(t,e){return new rs(t,e)},WebCodecsErrType:sX.d,MainSharedBufferType:sX.a},ra=0,rn=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Object(s.a)(this,i),(r=e.call(this,t,n,L.PLAYER_CORE_TYPE.WEBCODECS))._id=++ra;var o=n.h265Proxy;r.h265Proxy=o;var u=n.videoType,l=(n.videoElement,n.ignoreSei),d=n.closeFetch,c=n.continuousTimeStamp;r.lowlatencyCfg=n.lowlatencyCfg||{lowlatencyBuf:-1,lowlatencyMin:-1,lowlatencyMax:-1,lowlatencyJit:-1},r.lowlatency=-1!==r.lowlatencyCfg.lowlatencyBuf,r.pushAvcDts=0,rr.init({logger:I,TimeUtil:g});var f={};return r.handler&&r.handler.eventEmitter&&r.handler.eventEmitter.videoEnhance&&(f={isUseEnhance:r.handler.eventEmitter.isUseEnhance,modelRes:r.handler.eventEmitter.videoEnhance.getModelRes(),h5Root:r.handler.eventEmitter.videoEnhance.getH5Root()}),r._mediaWebcodecs=rr.createIns({lowlatencyCfg:r.lowlatencyCfg,webcodecCfg:F.webCodecCfg,aiEnhanceCfg:f,dtsJumpOpen:F.dtsJumpOpen,dtsJumpThreshold:F.dtsJumpThreshold,isLive:r.isLive,videoElement:r.videoElement},{turnToWebcodecsSoft:r.turnToWebcodecsSoft.bind(Object(a.a)(r)),onPauseByBrowser:r.onPauseByBrowser.bind(Object(a.a)(r)),setUseSoftAcceleration:r.setUseSoftAcceleration.bind(Object(a.a)(r)),onWebcodecsError:r.onWebcodecsError.bind(Object(a.a)(r)),triggerWebcodecsPlay:r.triggerWebcodecsPlay.bind(Object(a.a)(r)),triggerPlay:r.triggerPlay.bind(Object(a.a)(r)),onAudioAnalyserInit:r.onAudioAnalyserInit.bind(Object(a.a)(r)),onWorkerInterval:r.onWorkerInterval.bind(Object(a.a)(r)),setFramePause:r.setFramePause.bind(Object(a.a)(r)),setFrameRusume:r.setFrameRusume.bind(Object(a.a)(r)),renderFpsPause:r.renderFpsPause.bind(Object(a.a)(r)),onVideoEnhanceError:r.onVideoEnhanceError.bind(Object(a.a)(r)),onVideoEnhanceSuccess:r.onVideoEnhanceSuccess.bind(Object(a.a)(r)),onVideoSeekBind:r.onVideoSeek.bind(Object(a.a)(r)),onVideoPlay:r.onVideoPlay.bind(Object(a.a)(r)),onVideoPause:r.onVideoPause.bind(Object(a.a)(r))}),r.toDecodeVideoFrameNums=0,r.decodedVideoFrameNums=0,r.decodeNums=0,r.destroyed=!1,r.count=0,r.width=1280,r.height=720,r.playbackrateChangeAccess=!0,r.mediaDelay=null,r.seiAnchorDelay=-1,r.offsetDts=0,r.curVideoDts=0,r.curAudioDts=0,r.playing=!1,r.pause500checked=!1,r.lastFrameTs=0,r.lastVideoDts=0,r.lastAudioDts=0,r.videoWebcodecsPauseTs=0,r.audioWebcodecsPauseTs=0,r.isVideoWebCodecsPaused=!1,r.isAudioWebCodecsPaused=!1,"ts"===(void 0===u?"flv":u)?(r.parser=new eT(Object(a.a)(r),r.remuxer),r.parser.ignoreSei=void 0!==l&&l,r.parser.closeFetch=void 0!==d&&d,r.parser.continuousTimeStamp=void 0!==c&&c):(r.parser=new ei(Object(a.a)(r),r.remuxer,1),r.parser2=new ei(Object(a.a)(r),r.remuxer,2)),r.ctrlBuffer.setBuffered(r.buffered),r.pauseHanlder=new sU(Object(a.a)(r),{pauseFunc:r._playPause.bind(Object(a.a)(r)),resumeFunc:r._playResume.bind(Object(a.a)(r))}),r.pauseWorkerHanlder=new sx(Object(a.a)(r),{pauseFunc:r._playWorkerPause.bind(Object(a.a)(r)),resumeFunc:r._playWorkerResume.bind(Object(a.a)(r))}),r.webCodecsStat=new sH(Object(a.a)(r)),o&&o.initRender&&o.initRender(Object(a.a)(r)),r.isRenderStart=!1,r.onVisibilityChangedBind=r.onVisibilitychange.bind(Object(a.a)(r)),r.addEvents(),r.checkQuickTime=0,r.firstGetCurrentTime=0,r.firstPerformentTime=0,r.lastToDecodeAudioTs=0,r.lastToDecodeVideoTs=0,r.startAudioFastTs=0,r.startVideoFastTs=0,r.quickTime=g.now(),r.onVideoErrorBind=r.onVideoError.bind(Object(a.a)(r)),r.onVideoPauseBind=r.onVideoPause.bind(Object(a.a)(r)),r.onVideoPlayBind=r.onVideoPlay.bind(Object(a.a)(r)),r.onVideoPlayingBind=r.onVideoPlaying.bind(Object(a.a)(r)),r.onVideoResizeBind=r.onVideoResize.bind(Object(a.a)(r)),r.isWebcodecsError=!1,r.lastIFrameTs=0,r.audioBrowserPaused=!1,r.isBrowserCloseHardAcc=!1,r.isAudioMuted=!1,r.PES_TIMESCALE=9e4,r._initPTS=void 0,r._initDTS=void 0,r.seekTime=0,r.isSeek=!1,r._lastVideoTs=-1e4,r._lastAudioTs=-1e4,r.audioSampleDuration=1024e3/44100,r.videoFirstFrameDecodeCost=0,r.audioFirstFrameDecodeCost=0,r.triggerPlayType=0,r.codec=ei.AVC,r._videoEl=null,r._status=null,r}return Object(r.a)(i,[{key:"appendTs",value:function(t){this.parser.parseTs(t)}},{key:"addEvents",value:function(){this.handler&&this.handler.eventEmitter&&this.handler.eventEmitter.on(N.VISIBILITY_CHANGE,this.onVisibilityChangedBind)}},{key:"delEvents",value:function(){this.handler&&this.handler.eventEmitter&&this.handler.eventEmitter.off(N.VISIBILITY_CHANGE,this.onVisibilityChangedBind)}}
1,{key:"initTs",value:function(t,e,i){if(null==this._initPTS){var s=t.samples,r=e.samples,a=s.length,n=r.length,o=this.PES_TIMESCALE;0===n?(this._initPTS=s[0].pts-o*i,this._initDTS=s[0].dts-o*i):0===a?(this._initPTS=r[0].pts-o*i,this._initDTS=r[0].dts-o*i):(this._initPTS=Math.min(r[0].pts,s[0].pts)-o*i,this._initDTS=Math.min(r[0].dts,s[0].dts)-o*i),I.log("WebCodecsPlayer initDTS/initPTS=[".concat(this._initDTS,", ").concat(this._initPTS,"]")),this.isSeek&&this.realSeek(this.seekTime)}}},{key:"setCodec",value:function(t){this.codec=t}},{key:"getInitDts",value:function(){return this.isLive?Object(n.a)(Object(o.a)(i.prototype),"getInitDts",this).call(this):this._initDTS/90}},{key:"getCurrentTime",value:function(){var t=this.getVideoPts()-this.getInitDts();return Number.isNaN(t)?0:t}},{key:"getCurrentAudioDts",value:function(){return this._mediaWebcodecs.getCurrentAudioDts()}},{key:"setMuffledVolume",value:function(t){this._mediaWebcodecs.setMuffledVolume(t)}},{key:"onWorkerInterval",value:function(t){this.destroyed||(t-this.quickTime>=1e3&&(this.quickTime=t,this.webCodecsStat.onCheckTimer(t)),(0==this.checkQuickTime||t-this.checkQuickTime>=2e4)&&(this.checkQuickTime=t,I.log("WebCodecsPlayer(".concat(this._id,").onCheckAudioQuickTimer aduio currentTime"),this.getCurrentAudioDts())))}},{key:"setPlayMinBuffer",value:function(t){this._mediaWebcodecs.setPlayMinBuffer(t)}},{key:"getBufferLen",value:function(){return this._mediaWebcodecs.getBufferLen()}},{key:"getCurrentDts",value:function(){return this.getVideoPts()}},{key:"getCurrentRealTime",value:function(){return this.getCurrentDts()}},{key:"getCorrentCurrentDts",value:function(){return this.isPureAudio&&this.parser.timelineAudio?this.parser.timelineAudio.getCorrentDtsByCurrentTime(this.getCurrentTime()):this.parser.timelineVideo?this.parser.timelineVideo.getCorrentDtsByCurrentTime(this.getCurrentTime()):this.getCurrentTime()+this.getInitDts()}},{key:"getVideoDecodeDelaySmooth",value:function(){return this._mediaWebcodecs.getDecodedVideoDelaySmooth()}},{key:"triggerPlay",value:function(t,e,i){if(!this.playing){this.videoFirstFrameDecodeCost=t,this.audioFirstFrameDecodeCost=e,this.triggerPlayType="video"==i?1:2,I.log("WebcodecsPlayer.triggerPlay, type=".concat(i,", acost=").concat(e,", vcost=").concat(t));var s=this._mediaWebcodecs.getVideoElement();this.playing=!0,this.handler.onPlayVideo(s,this.widthCfg,this.heightCfg,!1,null,0,this.getCodecType()),this.isPlayVideo=!0}}},{key:"triggerWebcodecsPlay",value:function(){if(this.handler._hyPlayer&&this.handler._hyPlayer.roomRecordStat&&this.handler._hyPlayer.roomRecordStat.renderCallback(),this.handler.setWebCodecsSuccess(),this.isLive&&F.renderStat[0]){var t=this.getVideoPts();this.videoPlayConsuming.addRenderFrameData(t,g.now()),this.renderFps.addRender()}}},{key:"setFramePause",value:function(){this.handler.setFramePause()}},{key:"setFrameRusume",value:function(){this.handler.setFrameRusume()}},{key:"renderFpsPause",value:function(){1==F.mobVBlockCfg&&this.handler.renderFpsPause(!0)}},{key:"onFastOver",value:function(){this._mediaWebcodecs.onFastOver()}},{key:"onCheckTimer",value:function(t,e){if(this.playing){if(0!=this.shildAudioStartTs){var s=this.getCurrentAudioDts();this.isAudioMuted&&s>=this.shildAudioStartTs&&(I.log("WebCodecsPlayer.shieldAudioMute recover"),this.setMuted(!1),this.shildAudioStartTs=0)}if(Object(n.a)(Object(o.a)(i.prototype),"onCheckTimer",this).call(this,t,e),this.parser.fps&&this.parser.fps.getNoReferFps){var r=this.parser.fps.getNoReferFps();this._mediaWebcodecs.updateVideoFPS(this.metadata.recvVideoFps,r)}}else this.parser&&this.parser.printPlayFrameInfo&&this.parser.printPlayFrameInfo()}},{key:"getWebCodecsStats",value:function(){return this.webCodecsStat.getStats()}},{key:"onCheckFastTimer",value:function(t,e){if(Object(n.a)(Object(o.a)(i.prototype),"onCheckFastTimer",this).call(this,t,e),this.playing&&!this.userPaused){if(this.pauseHanlder.check(t),!this.pause500checked&&this.pauseHanlder.paused&&t-this.pauseHanlder.pausedTs>500){this.pause500checked=!0;var s=this.getBufferLen();I.log("WebCodecsPlayer(".concat(this._id,").onCheckFastTimer: play paused buf=").concat(s))}this.isLive&&this.checkPause5Sec(t)}}},{key:"onCheckFastWorkerTimer",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"onCheckFastWorkerTimer",this).call(this,t),this.playing&&!this.userPaused&&(this.pauseWorkerHanlder.check(t),this._mediaWebcodecs.storeMainShieldAudio(+!!this.isShieldAudio),this._mediaWebcodecs.storeFrameBuffer(this.getFrameBufferLen()))}},{key:"checkPause5Sec",value:function(t){var e=this.getCurrentDts(),i=this.getCurrentAudioDts(),s=!1,r=!1;0!=e&&0!=this.lastVideoDts&&e==this.lastVideoDts?this.isVideoWebCodecsPaused||(this.videoWebcodecsPauseTs=t,this.isVideoWebCodecsPaused=!0):(this.videoWebcodecsPauseTs=0,this.isVideoWebCodecsPaused=!1),0!=i&&0!=this.lastAudioDts&&i==this.lastAudioDts?this.isAudioWebCodecsPaused||(this.audioWebcodecsPauseTs=t,this.isAudioWebCodecsPaused=!0):(this.audioWebcodecsPauseTs=0,this.isAudioWebCodecsPaused=!1),0!=this.videoWebcodecsPauseTs&&t-this.videoWebcodecsPauseTs>=5e3&&(s=!0),0!=this.audioWebcodecsPauseTs&&t-this.audioWebcodecsPauseTs>=5e3&&(r=!0),s?I.warn("WebCodecsPlayer.onCheckTimer video paused 5 sec."):r&&I.warn("WebCodecsPlayer.onCheckTimer audio paused 5 sec."),(s||r)&&(this._onErrorEvent(3),this._onPlayerError(!0)),this.lastVideoDts=e,this.lastAudioDts=i}},{key:"onWebcodecsError",value:function(t,e){var i=this;if(!this.isWebcodecsError){this.isWebcodecsError=!0,I.log("WebCodecsPlayer.onWebcodecsError, type=".concat(t));var s=[t];e&&s.push(e),this.handler&&this.handler.onActWebCodecs&&this.handler.onActWebCodecs([22],s),setTimeout(function(){i.turnToMse(t)},0)}}},{key:"turnToMse",value:function(t){if(this.handler&&this.handler._hyPlayer){if(t===rr.WebCodecsErrType.VIDEODECODEERROR)this.autoReport(),this.handler._hyPlayer.webcodecsErrCount++,this.handler.decoderDecodeError();else if(t===rr.WebCodecsErrType.AUDIODECODEERROR)this.autoReport(),this.handler._hyPlayer.webcodecsErrCount++;else if(t===rr.WebCodecsErrType.VIDEOFAST)this.handler._hyPlayer.webcodecsErrCount++;else if(t===rr.WebCodecsErrType.AUDIOFAST)this.handler._hyPlayer.webcodecsErrCount++;else{if(t!==rr.WebCodecsErrType.WORKERERROR)return this.handler._hyPlayer&&(this.handler._hyPlayer.turnMseType=t),t===rr.WebCodecsErrType.DECODE_COST?D.nextWcsTime=Date.now()+2592e5:t===rr.WebCodecsErrType.DECODE_DTS&&(D.nextWcsTime=Number.MAX_SAFE_INTEGER),void this.handler.turnToMse();this.handler._hyPlayer.webcodecsErrCount++}this.handler._hyPlayer&&this.handler._hyPlayer.webcodecsErrCount>=3?(this.handler._hyPlayer.turnMseType=rr.WebCodecsErrType.RETRY_MAX_TIMES,this.handler.turnToMse()):this.handler.webcodecsRetry()}}}
1,{key:"initAv1M4sTs",value:function(t,e,i){if(null==this._initPTS){var s=this.PES_TIMESCALE;this._initPTS=Math.min(t.pts,e.pts)-s*i,this._initDTS=Math.min(t.dts,e.dts)-s*i,I.log("WebCodecsPlayer.initAv1M4sTs initDTS/initPTS=[".concat(this._initDTS,", ").concat(this._initPTS,"]")),this.isSeek&&this.realSeek(this.seekTime)}}},{key:"setVodAv1",value:function(){this._mediaWebcodecs&&this._mediaWebcodecs.setVodAv1&&this._mediaWebcodecs.setVodAv1()}},{key:"remuxAv1",value:function(t,e){var i=this,s=t.sidxAudio.time_scale,r=t.moof.trafAudio.tfdt.base_media_decode_time,a=t.moof.trafAudio.tfhd.default_sample_duration,n=t.moof.trafAudio.trun.samples,o=1e3*r/s,u=t.sidxVideo.time_scale,l=t.moof.trafVideo.tfdt.base_media_decode_time,d=t.moof.trafVideo.tfhd.default_sample_duration,c=t.moof.trafVideo.trun.samples,f=1e3*l/u,p=1024e3/s;p<this.audioSampleDuration-1&&(p=this.audioSampleDuration);var m=1e3*d/u;this.audioSampleNums=0,this.videoSampleNums=0,this.audioNewSamples=[],this.videoNewSamples=[];var _=1e3*a/s;_<20&&I.log("WebCodecsPlayer.remuxAv1 audio sampleDuration",_),n.map(function(t,e){if(t.units){var s=Math.floor(o+e*p),r=90*s,a={type:"aac",empty:0,sampleDuration:p,pts:r,dts:r,ts:s,unit:t.units};i.audioNewSamples.push(a)}}),c.map(function(t,e){if(t.units){i.videoSampleNums++;var s=Math.floor(f+e*m),r=90*s,a={pts:r,dts:r,ts:s,cts:0,key:0==e,data:t.units};i.videoNewSamples.push(a)}}),this.audioNewSamples.length>0&&this.videoNewSamples.length>0&&this.initAv1M4sTs(this.audioNewSamples[0],this.videoNewSamples[0],e.timeOffset),this.audioNewSamples.forEach(function(t){i._appendAudioSample(t)}),this.videoNewSamples.forEach(function(t){i._appendAv1VideoSample(t)})}},{key:"updateAVCConfig",value:function(t){this._mediaWebcodecs.updateAVCConfig(t),this._addResizeEvt()}},{key:"_addResizeEvt",value:function(){if(this._delResizeEvt(),this._mediaWebcodecs){var t=this._mediaWebcodecs.getVideoElement();this._videoEl!==t&&(t.addEventListener("resize",this.onVideoResizeBind),this._videoEl=t)}}},{key:"_delResizeEvt",value:function(){this._videoEl&&(this._videoEl.removeEventListener("resize",this.onVideoResizeBind),this._videoEl=null)}},{key:"getVideoWidth",value:function(){return this._videoEl?this._videoEl.videoWidth:0}},{key:"getVideoHeight",value:function(){return this._videoEl?this._videoEl.videoHeight:0}},{key:"updateAudioConfig",value:function(t,e,s){!t.audioConfig||this.audioConfig&&this.audioConfig.toString(16)===t.audioConfig.toString(16)||this._mediaWebcodecs&&this._mediaWebcodecs.updateAudioConfig(t),Object(n.a)(Object(o.a)(i.prototype),"updateAudioConfig",this).call(this,t,e,s)}},{key:"updateM4sAudioConfig",value:function(t){this._mediaWebcodecs&&this._mediaWebcodecs.updateAudioConfig(t)}},{key:"updateAVCPPS",value:function(t,e){this._mediaWebcodecs.updateAVCPPS(t,e)}},{key:"updateAVCSPS",value:function(t,e){this._mediaWebcodecs.updateAVCSPS(t,e)}},{key:"updateAVCVPS",value:function(t,e){this._mediaWebcodecs.updateAVCVPS(t,e)}},{key:"pushAvcSample",value:function(t){this._mediaWebcodecs&&this._mediaWebcodecs.storeRecvVideoTs&&this._mediaWebcodecs.storeRecvVideoTs(t.ts),this.lowlatency?(this.pushAvcDts=t.ts,this._appendVideoSample(t,this.codec)):Object(n.a)(Object(o.a)(i.prototype),"pushAvcSample",this).call(this,t,this.codec)}},{key:"pushAacSample",value:function(t,e){this.lowlatency?this._appendAudioSample(t):Object(n.a)(Object(o.a)(i.prototype),"pushAacSample",this).call(this,t,e)}},{key:"appendAvcTrack",value:function(t){var e=this;t.samples.map(function(t){t&&e._appendVideoSample(t,e.codec)}),t.samples.length=0}},{key:"_appendVideoSample",value:function(t,e){if(this.isLive){var i=g.now();this.videoPlayConsuming.pushRemuxedVideoFrameData(i),this.videoPlayConsuming.addRemuxFrameData(t.ts,t.ts+t.cts,i)}this.isWebcodecsError?I.log("WebCodecsPlayer._appendVideoSample isWebcodecsError=".concat(this.isWebcodecsError," drop video ts=").concat(t.ts)):this._mediaWebcodecs.appendVideoSample(t,e)}},{key:"_appendAv1VideoSample",value:function(t){if(-1e4!=this._lastVideoTs){var e=t.ts-this._lastVideoTs;e>=200&&I.log("WebCodecsPlayer._appendAv1VideoSample ts delta=",e,t.ts,this._lastVideoTs)}if(this.isLive){var i=g.now();this.videoPlayConsuming.pushRemuxedVideoFrameData(i),this.videoPlayConsuming.addRemuxFrameData(t.ts,t.ts+t.cts,i)}this._lastVideoTs=t.ts,this.isWebcodecsError?I.log("WebCodecsPlayer._appendAv1VideoSample isWebcodecsError=".concat(this.isWebcodecsError," drop video ts=").concat(t.ts)):this._mediaWebcodecs.appendAv1VideoSample(t)}},{key:"_initSegmentSuc",value:function(t){this._mediaWebcodecs&&this._mediaWebcodecs.initSegmentSuc(t)}},{key:"appendAacSample",value:function(t){var e=this;t.samples.map(function(t){t&&e._appendAudioSample(t)}),t.samples.length=0}},{key:"_appendAudioSample",value:function(t){if(t&&t.ts){if(-1e4!=this._lastAudioTs){var e=t.ts-this._lastAudioTs;e>=200&&I.log("WebCodecsPlayer._appendAudioSample ts delta=",e,t.ts,this._lastAudioTs)}if(this._lastAudioTs=t.ts,this.isLive){var i=g.now();this.audioPlayConsuming.addRemuxFrameData(t.ts,t.ts,i),this.audioPlayConsuming.pushRemuxedVideoFrameData(i)}this.isWebcodecsError?I.log("WebCodecsPlayer._appendAudioSample isWebcodecsError=".concat(this.isWebcodecsError," drop audio ts=").concat(t.ts)):this._mediaWebcodecs.appendAudioSample(t)}}},{key:"onVisibilitychange",value:function(){Object(n.a)(Object(o.a)(i.prototype),"onVisibilitychange",this).call(this),this._mediaWebcodecs.onVisibilitychange(),"hidden"==document.visibilityState?this.isBrowserHidden=!0:"visible"==document.visibilityState&&(this.isBrowserHidden=!1)}},{key:"containerResize",value:function(t){this._mediaWebcodecs.containerResize(t)}
1},{key:"getVideoPts",value:function(){if(F.dtsJumpOpen){if(this.isPureAudio&&this.parser.timelineAudio)return this.parser.timelineAudio.getRealDtsByPts(this._mediaWebcodecs.getVideoPts());if(this.parser.timelineVideo)return this.parser.timelineVideo.getRealDtsByPts(this._mediaWebcodecs.getVideoPts())}return this._mediaWebcodecs.getVideoPts()}},{key:"reset",value:function(){Object(n.a)(Object(o.a)(i.prototype),"reset",this).call(this)}},{key:"destroy",value:function(){Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this),this._delResizeEvt(),this._mediaWebcodecs&&this._mediaWebcodecs.destroy(),this.destroyed=!0,this.isRenderStart=!1,this.playing=!1,this.pause500checked=!1,this.parser&&this.parser.destroy(),this.pauseHanlder&&this.pauseHanlder.reset(),eZ(this.rafId),this.startAudioFastTs=0,this.startVideoFastTs=0,this.userPaused=!1,this.quickTime=0,this.delEvents(),this.lastVideoDts=0,this.lastAudioDts=0,this.videoWebcodecsPauseTs=0,this.audioWebcodecsPauseTs=0,this.isVideoWebCodecsPaused=!1,this.isAudioWebCodecsPaused=!1,this.isWebcodecsError=!1,this.lastIFrameTs=0,this.webCodecsStat&&this.webCodecsStat.destroy(),this.isBrowserCloseHardAcc=!1,this.isAudioMuted=!1}},{key:"_playPause",value:function(t){this.pauseStat.pause();var e=this.getVideoPts()>0;this.handler.onPlayPause(t,e)}},{key:"_playResume",value:function(t,e){this.pauseStat.resume(),this.pause500checked=!1;var i=this.getVideoPts()>0;this.handler.onPlayResume(t,i)}},{key:"_playWorkerPause",value:function(t){var e=this.getVideoPts()>0;this.handler.onPlayPauseWorker&&this.handler.onPlayPauseWorker(t,e)}},{key:"_playWorkerResume",value:function(t,e){var i=this.getVideoPts()>0;this.handler.onPlayResumeWorker&&this.handler.onPlayResumeWorker(t,i)}},{key:"check500Pause",value:function(){this.handler.check500Pause&&this.handler.check500Pause()}},{key:"getDecodeFps",value:function(){return this._mediaWebcodecs.getDecodeFps()}},{key:"getVideoRenderFps",value:function(){return this._mediaWebcodecs.getVideoRenderFps()}},{key:"getAudioRenderFps",value:function(){return this._mediaWebcodecs.getAudioRenderFps()}},{key:"getVideoThrowFps",value:function(){return this._mediaWebcodecs.getVideoThrowFps()}},{key:"getDecodedBuffer",value:function(){return this._mediaWebcodecs.getDecodedBuffer()}},{key:"getDiscardVideoFrames",value:function(){return this._mediaWebcodecs.getDiscardVideoFrames()}},{key:"getEnhanceVideoFrames",value:function(){return this._mediaWebcodecs.getEnhanceVideoFrames&&this._mediaWebcodecs.getEnhanceVideoFrames()}},{key:"setJitter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3e3,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3;Object(n.a)(Object(o.a)(i.prototype),"setJitter",this).call(this,t,e,s),this._mediaWebcodecs.setJitter(t,e,s,F.jumpBufferCfg,F.shieldAudioCfg[1],F.jumpBufferCfg2[0])}},{key:"onVideoPause",value:function(t){I.log("WebCodecsPlayer.onVideoPause"),this.userPaused=!0}},{key:"onVideoPlaying",value:function(){this.handler&&this.handler.updateStatus&&(this._mediaWebcodecs.isAudioSuspended()||this.handler.updateStatus("VIDEO_PLAYING"))}},{key:"turnToWebcodecsSoft",value:function(){this.handler.turnToWebcodecsSoft()}},{key:"getVideo",value:function(){return this._mediaWebcodecs&&this._mediaWebcodecs.getVideoElement()}},{key:"getVolume",value:function(){var t=this._mediaWebcodecs&&this._mediaWebcodecs.getVideoElement();return t?t.volume:0}},{key:"getMuted",value:function(){var t=this._mediaWebcodecs&&this._mediaWebcodecs.getVideoElement();return!!t&&t.muted}},{key:"onPauseByBrowser",value:function(){var t=this._mediaWebcodecs.getVideoElement();I.log("WebCodecsPlayer.onPauseByBrowser volume=".concat(this.getVolume()," muted=").concat(this.getMuted()," paused=").concat(t&&t.paused)),this.isBrowserPause=!0,this._mediaWebcodecs.onVideoPause(),Object(n.a)(Object(o.a)(i.prototype),"onPauseByBrowser",this).call(this)}},{key:"checkAutoMutedPlay",value:function(){var t=this.getVolume();if(I.log("WebCodecsPlayer.checkAutoMutedPlay volume=".concat(t,", muted=").concat(this.isAudioMuted)),this.autoMutedPlay){t>0&&this.setVolume(0);var e=this._mediaWebcodecs.getVideoRender();e&&e.play()}}},{key:"onAudioPauseByBrowser",value:function(){this.audioBrowserPaused=!0}},{key:"onVideoPlay",value:function(t){I.log("WebCodecsPlayer.onVideoPlay"),this.userPaused=!1,this.audioBrowserPaused=!1}},{key:"onVideoError",value:function(t){var e="",i=this._mediaWebcodecs.getAudioError();if(i){var s=i.code;e=" errCode="+s+" "+["Unknow","ç¨æ·ç»æ¢","ç½ç»é误","è§£ç é误","æ ¼å¼ä¸æ¯æ"][s],3!=s&&4!=s||(this._onErrorEvent(3==s?1:2),this._onPlayerError(!0))}I.warn("WebCodecsPlayer.onVideoError"+e)}},{key:"_onPlayerError",value:function(t){!this.isPlayerError&&this.handler&&(this.isPlayerError=!0,this.handler.onPlayerError(t))}},{key:"_onErrorEvent",value:function(t){this.isErrorEvent||(this.isErrorEvent=!0,this.handler&&this.handler.onErrorEvent&&this.handler.onErrorEvent({type:t}))}},{key:"pause",value:function(){I.info("WebCodecsPlayer.pause"),this.userPaused=!0,this._mediaWebcodecs.userPause()}},{key:"play",value:function(){I.info("WebCodecsPlayer.play"),this.userPaused=!1,this._mediaWebcodecs.userPlay()}},{key:"setUseSoftAcceleration",value:function(){this._mediaWebcodecs.setUseSoftAcceleration(),this.handler.setUseSoftAcceleration(!0)}},{key:"setPauseVideoDecode",value:function(t){this._mediaWebcodecs.setPauseVideoDecode(t)}},{key:"setPauseAudioDecode",value:function(t){this._mediaWebcodecs.setPauseVideoDecode(t)}},{key:"disableHardAcc",value:function(){Object(n.a)(Object(o.a)(i.prototype),"disableHardAcc",this).call(this),this.onWebcodecsError(rr.WebCodecsErrType.DISABLE_HARDWARE_ACCELERATION)}},{key:"win7PerfInsufficient",value:function(){this.onWebcodecsError(rr.WebCodecsErrType.WIN_PERF_INSUFFICIENT)}},{key:"angelNullError",value:function(){this.onWebcodecsError(rr.WebCodecsErrType.ANGLE_NULL)}},{key:"chromeH265RenderEmptyError",value:function(){this.isH265Mode&&(D.isChromeH265RenderInfoEmpty=1,this.onWebcodecsError(rr.WebCodecsErrType.CHROME_H265_RENDER_INFO_EMPTY))}},{key:"isNotSupportWebcodecsConfig",value:function(){this.onWebcodecsError(rr.WebCodecsErrType.IS_NOT_SUPPORT_CONFIGURE)}},{key:"setEnableDiscard",value:function(t){this._mediaWebcodecs.setEnableDiscard(t)}},{key:"updateCurBitrate",value:function(t){this._mediaWebcodecs.updateCurBitrate(t)}
1},{key:"setDisableHardAcc",value:function(){this.isBrowserCloseHardAcc=!0}},{key:"autoReport",value:function(){S.name.indexOf("chrome")>-1&&this.isH265Mode&&1e3*Math.random()<=100&&1==F.isAutoWcsReport&&this.handler.eventEmitter&&this.handler.eventEmitter.trigger(N.P2P_REPORT)}},{key:"setRealFps",value:function(t){this._mediaWebcodecs.setRealFps(t)}},{key:"startMuteRender",value:function(t){var e=this._mediaWebcodecs.getVideoElement();e&&(e.volume=t,e.muted=0===t),this._mediaWebcodecs.startMuteRender(t)}},{key:"setMuted",value:function(t){var e=this._mediaWebcodecs.getVideoElement();e&&(e.muted=t),this.isAudioMuted=t,this._mediaWebcodecs.setMuted(t)}},{key:"on265StartCodeError",value:function(){this.h265Proxy&&this.h265Proxy.on265StartCodeError()}},{key:"turnToH264",value:function(t){this.h265Proxy&&this.h265Proxy.stop(),this.handler&&this.handler.turnToH264(t)}},{key:"setEnhance",value:function(t){this._mediaWebcodecs.setEnhance&&this._mediaWebcodecs.setEnhance(t)}},{key:"setSegmenttion",value:function(t){this._mediaWebcodecs.setSegmenttion&&this._mediaWebcodecs.setSegmenttion(t)}},{key:"onVideoEnhanceError",value:function(t){this.handler&&this.handler&&this.handler.onVideoEnhanceError(t)}},{key:"onVideoEnhanceSuccess",value:function(){this.handler&&this.handler&&this.handler.onVideoEnhanceSuccess()}},{key:"getRenderElement",value:function(){return this._mediaWebcodecs&&this._mediaWebcodecs.getVideoElement()}},{key:"onRevFastOver",value:function(){this._mediaWebcodecs.onRevFastOver()}},{key:"onVideoSeek",value:function(t){I.log("WebcodecsPlayer.onVideoSeek",t),this.handler&&this.handler.onVideoSeek&&this.handler.onVideoSeek(t)}},{key:"seek",value:function(t){null==this._initPTS?(this.isSeek=!0,this.seekTime=t):this.realSeek(t)}},{key:"realSeek",value:function(t){var e=this.getInitDts();I.log("WebcodecsPlayer.realSeek, seekTime=".concat(t,", initDts=").concat(e)),this._mediaWebcodecs&&this._mediaWebcodecs.seek&&this._mediaWebcodecs.seek(t,e),this.isSeek=!1}},{key:"setPlaybackRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;I.log("WebcodecsPlayer.setPlaybackRate",t),this._mediaWebcodecs&&this._mediaWebcodecs.setPlaybackRate&&this._mediaWebcodecs.setPlaybackRate(t)}}]),i}(iL),ro="iAntiTime",rh="iValidTime",ru=function(){function t(){Object(s.a)(this,t),this._url="",this._anticodeMap=new Map,this._invalidTime=0,this._iValidTime=0,this._state=0,this._reqTs=0}return Object(r.a)(t,[{key:"setUrl",value:function(t){this._url=t;var e=new URL(t).searchParams;if(e.has(ro)){var i=parseInt(e.get(ro))||0;this._state=2,this._invalidTime=g.now()+i}e.has(rh)&&(this._iValidTime=parseInt(e.get(rh)))}},{key:"valid",value:function(){var t=this;return new Promise(function(e,i){0!==t._invalidTime&&g.now()>=t._invalidTime?t._reqAnticode(e):e()})}},{key:"updateAnticode",value:function(t){var e=new URL(t),i=e.searchParams;
1return this._anticodeMap.forEach(function(t,e){i.set(e,t)}),i.delete(ro),i.delete(rh),e.href}},{key:"onVodAnticodeTimer",value:function(t){1===this._state?t>this._invalidTime-3e4&&this._reqAnticode():2===this._state&&t-this._reqTs>5e3&&this._reqAnticode()}},{key:"_reqAnticode",value:function(t){var e,i=this;this._state=2,this._reqTs=g.now();var s=new d.HUYA.GetVodAntiCodeReq;s.iAppId=w.appId,s.sUrl=this._url,s.iValidTime=this._iValidTime||300,s.lClientUid=w.uid,s.sClientUa=null==(e=tC.getUserId())?void 0:e.sHuYaUA;var r=setTimeout(function(){I.log("VodAnticode._reqAnticode timeout")},5e3);1!=D._isTestAnticodeTimeout&&tC.sendWup("mediauisea","getVodAntiCode",s,function(e){clearTimeout(r),i._rspAnticode(e),null==t||t()})}},{key:"_rspAnticode",value:function(t){var e,i=this;I.log("VodAnticode._rspAnticode ".concat(t&&JSON.stringify(t))),this._state=1,this._invalidTime=g.now()+1e3*((null==t?void 0:t.iExpireTime)||300),this._anticodeMap.clear(),null==t||null==(e=t.sAntiCode)||e.split("&").forEach(function(t){var e=t.split("="),s=Object(eb.a)(e,2),r=s[0],a=s[1];i._anticodeMap.set(r,a)})}}]),t}(),rl=Object(r.a)(function t(){Object(s.a)(this,t),this.sn=0,this.originStartTime=0,this.duration=0,this.playStartTime=0,this.playEndTime=0,this.startDts=0,this.endDts=0,this.needSeek=!1,this.cutTime=0}),rd=1,rc=function(){function t(e){Object(s.a)(this,t),this._id=rd++,I.log("[HlsPlayHelper-".concat(this._id,"] HlsPlayHelper constructor")),this._hlsPlayer=e,this._timeRanges=[],this._lastTimeRange=null,this._curTimeRange=null,this._cutTime=0}return Object(r.a)(t,[{key:"reset",value:function(){I.log("[HlsPlayHelper-".concat(this._id,"] HlsPlayHelper reset")),this._cutTime=0,this._lastTimeRange=null,this._curTimeRange=null,this._timeRanges=[]}},{key:"onFragLoaded",value:function(t){if(0!==F.vodCutTime&&this._hlsPlayer){var e=0;if(this._lastTimeRange){var i=t.startDts-this._lastTimeRange.endDts;1e3*i>=F.vodCutTime&&(e=i)}this._cutTime+=e;var s=new rl;s.sn=t.sn,s.originStartTime=t.start,s.duration=t.duration,s.playStartTime=t.start+this._cutTime,s.playEndTime=t.start+t.duration+this._cutTime,s.startDts=t.startDts,s.endDts=t.endDts,s.needSeek=0!==e,s.cutTime=this._cutTime,I.log("[HlsPlayHelper-".concat(this._id,"] HlsPlayHelper onFragLoaded: sn=[").concat(t.sn,"] duration=").concat(t.duration," dts=[").concat(s.startDts,", ").concat(s.endDts,"] orginTimeRange=[").concat(t.start,", ").concat(t.start+t.duration,"] timeRange=[").concat(s.playStartTime,", ").concat(s.playEndTime,"] cutTime=").concat(e," needSeek=").concat(s.needSeek)),this._lastTimeRange=s,this._curTimeRange?this._timeRanges.push(s):this._curTimeRange=s}}},{key:"onCheckFastTimer",value:function(t){this._hlsPlayer&&this._curTimeRange&&(this._curTimeRange.needSeek?(this._curTimeRange.needSeek=!1,this._hlsPlayer.mse.seek(this._curTimeRange.playStartTime+1),this._hlsPlayer.mse.video.realSeek()):this._hlsPlayer.getCurrentTimeInner()>this._curTimeRange.playEndTime-1&&this._timeRanges.length>0&&(this._curTimeRange=this._timeRanges.shift()))}},{key:"getCurrentTime",value:function(t){return this._curTimeRange?t-this._curTimeRange.cutTime:t}}]),t}(),rf=1,rp=function(){function t(e,i){Object(s.a)(this,t),this._id=rf++;var r=i.stat,a=i.statVod,n=i.tsdb,o=i.videoElement,u=i.h265Proxy;this.playerCoreType=i.playerCoreType,this.isSoftSolution=i.isSoftSolution,this.isPureAudio=!!i.isPureAudio,this.isPureVideo=!!i.isPureVideo,this.dropBeforeFirstIDR=!!i.dropBeforeFirstIDR,this.config={autoStartLoad:!0,maxBufferLength:30,minBufferLength:15,secondBufferLength:20,fragLoadingTimeOut:5e3,fragLoadingMaxRetry:o?3:1,fragLoadingRetryDelay:1e3,listLoadingTimeOut:o?15e3:8e3,listLoadingMaxRetry:3*!o,listLoadingRetryDelay:1e3,appendErrorMaxRetry:200,minFragBufferNum:3,autoReconnect:!0,firstFragLoadTimeout:15e3},this.eventEmitter=e,this._hyPlayer=e,this.stat=r,this.statVod=a,this.tsdb=n,this.h265Proxy=u,this.statSwitch=i.statSwitch,this.isLive=!1,this.liveType=0,this.url=null,this.cdnName=null,this.seekTime=0,this.playlist=null,this.mse=null,this.m4sInitcb=this.onM4sInit.bind(this),this.m4sInitOpenCb=this.onM4sInitOpen.bind(this),this.onFirstBufCb=this.onFirstBuf.bind(this),this.onParseVideoDtsCb=this.onParseVideoDts.bind(this),this.userPaused=!1,this.targetDuration=0,this.isLoading=!1,this.fragStartTs=0,this.fragOpenTs=0,this.fragSize=0,this.startTs=0,this.pauseTs=0,this.pauseCnt=0,this.playTs=0,this.started=!1,this.isTryAgain=!1,this.fragLoader=null,this.tryTimer=null,this.hasVideo=!1,this.playStat=new iG(this),this.hlsSeek=new iW(this),this.firstPlay=!0,this.firstFragLoadTs=0,this.firstFragLoadedTs=0,this.firstFragSize=0,this.videoStatus=B,this.flvLoadTimeSended=!1,this.sOrigUrl="",this.curAppendFrag=null,this.seeking=!1,this.skipStatForSeek=!1,this.playTriggered=!1;
1var l,d,c,f,p=(l=F.hlsUseFetch>Math.floor(100*Math.random())&&iB.isSupported(),c=(d=L.HLS_LOAD_TYPE).FETCH,f=d.XHR,"safari"===S.name&&(l=!1),{clz:l?iB:Z,type:l?c:f}),m=p.clz,_=p.type;this._loaderClz=m,this._loaderType=_,this.videoElement=o,this.loadHlsStatus=L.LoadVideoTimeoutReason.HLS_DISCONNECTED,this.needReset=!1,this.resetPlayTs=0,this.lastPlayTs=0,this.pauseInBufferFullTimes=0,this.sendPauseTimeout=0,this.businessStartCost=0,this.startTimeStamp=0,this.loadStartTs=0,this.anticode=new sb,this.vodAnticode=new ru,this.isSwitchSeamLessLine=!1,this.pausedByBrowser=!1,this._nextRefreshTime=Number.MAX_SAFE_INTEGER,this._pcdnFragStartTs=0,this._cdnFragStartTs=0,this.firstTsInfo=null,this._getPcdnDataTime=0,this._getCdnDataTime=0,this.forceUseCdn=!1,this.coolLoadFragment=!1,this.vodAbSwitch=!1,this.pcdnRepeatByteLen=0,this.lastSN=-1,this.errorPcdnSN=-1,this.needStatPcdnRepeatBW=!1,this.tsFileSize=0,this.heartTsStartTime=0,this.heartTsEndTime=0,this.videoLoadTimeSent=!1,this.videoLoadTime=0,this.loadM3u8Time=0,this.firstFragLoadTime=0,this.firstFragLoadedTime=0,this.firstFragParsedTime=0,this.uiLoadTime=0,this.businessLoadTime=0,this.firstTsHttpCode=0,this.avgSpeed=new X(20),this.exceptionStat=new sN(this),this.realStartBind=this.realStart.bind(this),this._clickEventBind=this._clickEvent.bind(this),this.refreshAnticodeBind=this.refreshAnticode.bind(this),this._sendVideoLoadTimeBind=this._sendVideoLoadTime.bind(this),this._sendVideoLoadTimer=null,this.anticode.on(sb.Events.REFRESH,this.refreshAnticodeBind),this.playerType=tQ.HLS,this.seekBeforeTime=0,this.endTs=0,this.nowEndTs=0,this.blockHelper=new iV,this.blockHelper.setHlsPlayer(this),Y.setHlsPlayer(this),this.vodSecHelper=new sV,this.codecType=tX,this.isAv1State=!1,this.stopLoadFragment=!1,this.playBackRate=1,this.continuousTimeStamp=!1,this.seekNextPlayTime=0,this.seekNextFragTime=0,this.playHelper=new rc(this)}return Object(r.a)(t,[{key:"selectXhrLoader",value:function(){this._loaderClz=Z,this._loaderType=L.HLS_LOAD_TYPE.XHR}},{key:"selectFetchLoader",value:function(){this._loaderClz=iB,this._loaderType=L.HLS_LOAD_TYPE.FETCH}},{key:"getSpeed",value:function(){var t=this.avgSpeed.average();return t===O.UintMax?0:t}},{key:"destroy",value:function(){I.log("[hls-".concat(this._id,"] HlsPlayer.destroy")),this.started=!1,this.removeTimer(),this.anticode=null,this.playStat&&this.playStat.destroy(),this.playStat=null,this.hlsSeek&&this.hlsSeek.destroy(),this.hlsSeek=null,this.avgSpeed&&this.avgSpeed.reset(),this.avgSpeed=null,this.exceptionStat&&this.exceptionStat.destroy(),this.exceptionStat=null,this.blockHelper&&this.blockHelper.destroy(),this.blockHelper=null,Y.destroy(this),this.vodSecHelper=null,this.destroyMse(),this.playlist&&(this.playlist.destroy(),this.playlist=null),this.releaseLoader(),this.isSwitchSeamLessLine=!1,this.url=null,this.firstTsInfo=null,this.eventEmitter=null,this._hyPlayer=null,this.stat=null,this.statVod=null,this.tsdb=null,this.h265Proxy=null,this.statSwitch=null,this._loaderClz=null,this.videoElement=null}},{key:"reset",value:function(){I.log("[hls-".concat(this._id,"] HlsPlayer.reset")),this.exceptionStat&&this.exceptionStat.reset(),this.avgSpeed&&this.avgSpeed.reset(),this.removeTimer(),this.destroyMse(),this.playlist&&(this.playlist.destroy(),this.playlist=null),this.releaseLoader(),this.isSwitchSeamLessLine=!1,this.isLive=null,this.liveType=0,this.url=null,this.cdnName=null,this.seekNextFragTime=0,this.seekNextPlayTime=0,this.seekTime=0,this.targetDuration=0,this.isLoading=!1,this.startTs=0,this.pauseTs=0,this.pauseCnt=0,this.playTs=0,this.hasVideo=!1,this.userPaused=!1,this.isTryAgain=!1,this.playStat&&this.playStat.stop(),this.firstFragLoadTs=0,this.firstFragLoadedTs=0,this.firstFragSize=0,this.curAppendFrag=null,this.seeking=!1,this.skipStatForSeek=!1,this.firstPlay=!0,this.playTriggered=!1,this.stat&&this.stat.clearFill(),this.statVod&&this.statVod.clearFill(),this.isSwitchSeamLessLine=!1,this.pausedByBrowser=!1,this.sOrigUrl="",this._pcdnFragStartTs=0,this._cdnFragStartTs=0,this.firstTsInfo=null,this._getPcdnDataTime=0,this._getCdnDataTime=0,this.forceUseCdn=!1,this.coolLoadFragment=!1,this.vodAbSwitch=!1,this.pcdnRepeatByteLen=0,this.lastSN=-1,this.errorPcdnSN=-1,this.needStatPcdnRepeatBW=!1,this.seekBeforeTime=0,this.isSeekBefore=!1,this.tsFileSize=0,this.heartTsStartTime=0,this.heartTsEndTime=0,this.firstTsHttpCode=0,this.endTs=0,this.nowEndTs=0,this.isAv1State=!1,this.stopLoadFragment=!1}},{key:"resetMediasource",value:function(){this.resetPlayTs=0,this.needReset=!0}},{key:"reloadInError",value:function(){if(this.isLive){var t=this.playlist.currFrag;t&&(this.releaseLoader(),this.destroyMse(),this.mse=this.createMse(),this.isLoading=!1,I.log("[hls-".concat(this._id,"] HlsPlayer.reloadInError, seek")),this.seek(t.start+.5))}else if(this.info){var e=this.getCurrentTime();this.info.seekTime=e+1,this.start(this.info)}}},{key:"destroyMse",value:function(){this.mse&&(this.mse.destroy(),this.mse=null)}},{key:"createMse",value:function(){var t={isLive:this.isLive,videoType:"ts",videoElement:this.videoElement,h265Proxy:this.h265Proxy,ignoreSei:this.ignoreSei,closeFetch:this.closeFetch,continuousTimeStamp:this.continuousTimeStamp,isPureAudio:this.isPureAudio,isPureVideo:this.isPureVideo,dropBeforeFirstIDR:this.dropBeforeFirstIDR};if(1==D._isPureAudio&&(t.isPureAudio=!0),1==D._isPureVideo&&(t.isPureVideo=!0),this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS){var e=D.hasOwnProperty("_minBuffer")?Number(D._minBuffer):3e3,i=new rn(this,{videoType:"ts",isLive:this.isLive,isPureAudio:this.isPureAudio,isPureVideo:this.isPureVideo,dropBeforeFirstIDR:this.dropBeforeFirstIDR,h265Proxy:this.h265Proxy,videoElement:this.videoElement,isH265Mode:this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec,lowlatencyCfg:{lowlatencyBuf:-1,lowlatencyMin:e+500,lowlatencyMax:e+1e3,openRenderSync:1}});return i.parser.openConvertIDR=1===F.vodConvertIDR,this.isAv1State&&i.setVodAv1&&i.setVodAv1(),i}var s=new iN(this,t);return s.onParseVideoDtsCallback=this.onParseVideoDtsCb,s.onInitSegmentCb=this.onFirstBuf.bind(this),s.m4sPlayer.onFirstBufCb=this.onFirstBufCb,s.parser.openConvertIDR=1===F.vodConvertIDR,s}},{key:"releaseLoader",value:function(){this.fragLoader&&(this.fragLoader.destroy(),this.fragLoader=null)}},{key:"removeTimer",value:function(){clearTimeout(this.tryTimer),tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this),tP.remove(this.onCheckIfCanPCDN,this)}},{key:"setConfig",value:function(t,e){}},{key:"setVodPcdnConfig",value:function(t){var e=t.vid||O.getQueryString("vid",t.url),i=t.presenterUid;F.setVodPcdnConfig({vid:e,anchoruid:i,useVodPcdnAbCfg:this.vodAbSwitch}),I.log("[hls-".concat(this._id,"] vodPcdnOpenBuffer=").concat(F.vodPcdnOpenBuffer,", vodPcdnCloseBuffer=").concat(F.vodPcdnCloseBuffer,", vodPcdnCoolTime=").concat(F.vodPcdnCoolTime))}},{key:"start",value:function(t){this.stop(),1==D.continuousTimeStamp&&(t.continuousTimeStamp=!0),this.continuousTimeStamp=!!t.continuousTimeStamp;var e=this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec;this.stat.setComDim(R.DIM_COM.H265,+!!e),this.stat.setComDim(R.DIM_COM.P2P,R.LIVE_TYPE.HLS),this.stat.setComDim(R.DIM_COM.STREAM_TYPE,3),t.isLive&&(q.bindEvent(this.tsdb,t._sessionId,t.lineType,t.sDisplayName,t.iBitRate),this.statSwitch&&this.statSwitch.check(t,!1)),this.checkParams(t,this.realStartBind),tP.has(this.onCheckTimer,this)||(tP.add(this.onCheckTimer,this,1e3),tP.add(this.onCheckFastTimer,this,100))}},{key:"checkParams",value:function(t,e){if(I.log("[hls-".concat(this._id,"] HlsPlayer.checkParams"),JSON.stringify(t),t),!t.isLive){this.vodAbSwitch=O.getSdkAbRandom(t,F.vodAbSwitch);var i=this.vodAbSwitch?1:2;this.stat.setComDim(R.VOD_DIM_COM.VOD_AB_SWITCH,i),this.statVod.setComDim(R.VOD_DIM_COM.VOD_AB_SWITCH,i),I.log("[hls-".concat(this._id,"] %cVOD_AB_SWITCH = ").concat(i),"color:#A23400;background:#FFF5C2"),this.setVodPcdnConfig(t)}this.started=!0,t.isLive&&t.sHlsUrl&&t.sStreamName?(t.sHlsUrl=t.sHlsUrl.replace("http://","https://"),t.sHlsAntiCode?(this.anticode.init(t.sHlsUrl,t.sStreamName,t.sHlsAntiCode),this.anticode.valid().then(function(){e(t)})):e(t)):t.url?t.isLive?e(t):(this.vodAnticode.setUrl(t.url),this.vodAnticode.valid().then(function(){e(t)})):I.warn("[hls-".concat(this._id,"] HlsPlayer.checkParams has no params(sHlsUrl,sStreamName,url)")),this.h265Proxy&&this.h265Proxy.onStarted&&this.h265Proxy.onStarted()}},{key:"initInfo",value:function(t){var e=this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec;this.info=t;var i=t.url;1==t._av1State?i=t.av1Url:e&&(i=t.h265Url),t.sHlsUrl&&t.sStreamName&&(i=t.sHlsUrl+"/"+t.sStreamName+".m3u8"),i=this.replaceProtocl(i),this.sOrigUrl=i;var s=[];return this.anticode.hasAnticode()&&s.push(this.anticode.getAnticode()),t.iBitRate>0&&s.push("ratio=".concat(t.iBitRate)),s.length>0&&(i+=(-1!==i.indexOf("?")?"&":"?")+"".concat(s.join("&"))),this.lineType=t.lineType,this.liveType=t.liveType,i}},{key:"realStart",value:function(t){var e=this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec;if(this.isAv1State=1==t._av1State,this.isH265=e,this.started){this.url=this.initInfo(t),this.h265Proxy.isLive=!!t.isLive,this.h265Proxy.isH265Stream=!1,1==t._av1State?this.firstTsInfo=t.tsAv1Info:e?(this.firstTsInfo=t.tsH265Info,this.h265Proxy.isH265Stream=!0):this.firstTsInfo=t.tsInfo,this.firstTsInfo&&(this.firstTsInfo.sn=1e3);var i=(new Date).getTime();if(this.businessStartCost=0,this.UIStartCost=0,this.loadStartTs=0,this.startTimeStamp=Number(t.startTimeStamp)||0,t.noNeedSendVideoLoadTime?this.noNeedSendVideoLoadTime=!0:(this.businessStartCost=t.startTimeStamp?Math.floor(i-t.startTimeStamp):0,this.noNeedSendVideoLoadTime=!1),t.uistartTs&&t.uistartTs>0&&(this.UIStartCost=Math.floor(i-t.uistartTs)),I.log("[hls-${this._id}] HlsPlayer.start startTimeStamp="+t.startTimeStamp,"uistartTs="+t.uistartTs,"businessStartCost="+this.businessStartCost,"UIStartCost="+this.UIStartCost,"now="+i,"uistartTs="+t.uistartTs),this.url){this.loadHlsStatus=L.LoadVideoTimeoutReason.HLS_DISCONNECTED,this.isLive=t.isLive,this.closeFetch=!!t.closeFetch,this.ignoreSei=!!t.ignoreSei,this.cdnName=t.cdnName,this.liveType=t.liveType,this.closeFetch&&this.selectXhrLoader(),I.log("[hls-".concat(this._id,"] HlsPlayer.start isLive=").concat(this.isLive," url=").concat(this.url)),this.playlist=new tk(this),this.playlist.setOrigUrl(this.url),this.destroyMse(),this.mse=this.createMse(),this.setPlaybackRate(this.playBackRate);var s=1;this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS&&(s=this.isSoftSolution?3:2),this.stat.setComDim(R.DIM_COM.MSE_PLAYER,s),this.isLive||this.statVod.setComDim(R.VOD_DIM_COM.MSE_PLAYER,s),this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS&&this.isSoftSolution&&this.mse.setUseSoftAcceleration(),-1!==this.url.indexOf("hyscence=vodadv")&&this.mse.setMuted(!0);var r=t.seekTime||this.seekTime;if(this.firstTsInfo&&r&&(this.firstTsInfo.tsDuration?r<=this.firstTsInfo.tsDuration?this.firstTsInfo.seeking=!0:r>this.firstTsInfo.tsDuration&&(this.firstTsInfo=null):this.firstTsInfo=null),this.startTs=g.now(),this.vodSecHelper.setStart(),this.updateStatus(V),this.firstTsInfo&&this.playlist.loadFirstFragment(this.firstTsInfo),this.playlist.loadManifest(this.url),sB.setCdnDomain(this.stat,this.url,this.info.sStreamName),sB.setVodCdnDomain(this.statVod,this.url),this.seek(t.seekTime||this.seekTime),this.playStat.start(),this.stat.setComDim(R.DIM_COM.STREAM_URL,this.url),this.stat.setComDim(R.DIM_COM.HLS_TYPE,t.isLhls?2:1),this.stat.setComDim(R.DIM_COM.V_DECODEC,1==t._av1State?2:+!!e),this.statVod.setComDim(R.DIM_COM.STREAM_URL,this.url),this.statVod.setComDim(R.DIM_COM.STREAM_TYPE,3),this.statVod.setComDim(R.DIM_COM.V_DECODEC,1==t._av1State?2:+!!e),this.eventEmitter&&this.eventEmitter.roomRecordStat&&t.isLive&&this.eventEmitter.roomRecordStat.startStream(t.presenterUid,t.lineType,t.curBitrate,e?"h265":"h264","hls"),e&&this.tsdb.sendMetrics([this.stat.createAct(R.ACT.H265_STATUS,{value:[0],str:[0]})]),!this.isLive){var a=t.vid||O.getQueryString("vid",this.url);this.stat.setComDim(R.VOD_DIM_COM.VOD_VIDEOSOURCEID,a||""),this.stat.setComDim(R.DIM_COM.CODERATE_BPS,1e3*(t.curBitrate||t.coderate)),this.stat.setComDim(R.DIM_COM.ANCHOR_UID,t.presenterUid||0),this.stat.setComDim(R.VOD_DIM_COM.VOD_DURATION,t.duration||0),this.statVod.setComDim(R.VOD_DIM_COM.VOD_CODERATE,t.curBitrate||t.coderate),this.statVod.setComDim(R.VOD_DIM_COM.VOD_VIDEOSOURCEID,a||""),this.statVod.setComDim(R.VOD_DIM_COM.VODANCHORID,t.presenterUid||0),this.statVod.setComDim(R.DIM_COM.H265,+!!e),this.statVod.setComDim(R.VOD_DIM_COM.VOD_DURATION,t.duration||0)}this.isNotSupportWebcodecsConfigure()}else I.warn("[hls-".concat(this._id,"] HlsPlayer.start invalid argument, pls check the url."))}}},{key:"onInitSegment",value:function(){var t=+!!this.mse.getIsMseHevc();this.stat.setComDim(R.DIM_COM.H265,t),this.statVod.setComDim(R.DIM_COM.H265,t)}},{key:"onM3u8ContentError",value:function(){this.playlist.loadManifest(this.url)}},{key:"refreshAnticode",value:function(){this.url=this.initInfo(this.info),this.playlist.refreshManifsetUrl(this.url)}},{key:"setVideoPlayTimeSended",value:function(){this.flvLoadTimeSended=!0}}
1,{key:"setLoadStatus",value:function(t){if(this.loadHlsStatus!==t){if(t===L.LoadVideoTimeoutReason.HLS_LOADMANIFEST_SUCCESS){this.exceptionStat.setStat(R.DIM_LINK_STA.CONNECT_SUC,1);var e=this.playlist.manifestLoadedTs-this.startTs;this.tsdb.sendM3u8LoadedTime(this._loaderType,e),this.tsdb.sendVodM3u8LoadedTime(this._loaderType,e)}this.loadHlsStatus=t}}},{key:"sendLoadVideoErrorStatus",value:function(){this.tsdb.sendMetrics([this.stat.createAct(J.METRIC.VIDEO_VIDEO_LOAD_ERROR,{value:[this.loadHlsStatus]})])}},{key:"getPlayVideo",value:function(){return this.mse.getPlayVideo()}},{key:"stop",value:function(){this.started&&(I.log("[hls-".concat(this._id,"] HlsPlayer.stop")),this.playTriggered&&this.playStat.report(!0),this.reset())}},{key:"seek",value:function(t){if(!this.isLive&&null!=t){if(this.seekNextPlayTime=0,this.seekNextFragTime=0,this.playerCoreType==L.PLAYER_CORE_TYPE.MSE&&this.mse&&this.mse.getPlayVideo){var e=this.mse.getPlayVideo();if(e&&"number"==typeof t){var i=e.currentTime;this.seekBeforeTime=i,this.isSeekBefore=t<i}}this.h265Proxy&&this.h265Proxy.seek&&this.h265Proxy.seek(t);var s=!1;if(this.playerCoreType===L.PLAYER_CORE_TYPE.MSE){var r=this.mse&&this.mse.video&&this.mse.video.video;r&&r.buffered.length>0&&r.buffered.start(0)>1&&r.currentTime>0&&0==+t&&(I.log("[hls-".concat(this._id,"] %cHlsPlayer.seek first buffered fixed"),"color:#A23400;background:#FFF5C2"),this.releaseLoader(),this.destroyMse(),this.playHelper.reset(),this.mse=this.createMse(),this.isLoading=!1,s=!0)}this.pauseTs=0,this.endTs=0,this.nowEndTs=0,this.seeking=!0,this.skipStatForSeek=!0,this.seekTime=t,this.hlsSeek.seek(0);var a=this.getCurrentTime();if(I.log("[hls-".concat(this._id,"] HlsPlayer.seek curTime=").concat(a,", seekTime=").concat(t)),0==t){if(this.firstPlay=!1,!this.mse)return;if(this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS){if(a<1)return}else if(0==a&&!s)return}this.playlist&&(I.log("[hls-".concat(this._id,"] HlsPlayer.seek playlist ")+t),t=Math.max(0,Number(t)),this.playlist.seek(t)?(this.mse.resetHls(),this.releaseLoader(),this.playHelper.reset(),this.isLoading=!1,this.mse.seek(t),this.loadFragment(),this.hlsSeek.seek(this.seekTime)):this.playlist.m3u8Parsered&&this.playlist.firstLevelLoaded&&(I.warn("[hls-".concat(this._id,"] HlsPlayer.seek out of range.time=").concat(t,", duration=").concat(this.getFixedDurationTime())),this.stop(),this.onAnchorStop()))}}},{key:"pause",value:function(){this.started&&(I.info("[hls-".concat(this._id,"] HlsPlayer.pause")),this.userPaused=!0,this.mse&&this.mse.pause())}},{key:"play",value:function(){this.started&&(I.info("[hls-".concat(this._id,"] HlsPlayer.play")),this.userPaused=!1,this.mse&&this.mse.play())}},{key:"setVolume",value:function(t){this.videoElement&&(this.videoElement.volume=t),this.mse&&this.mse.setVolume(t)}},{key:"getVolume",value:function(){return this.mse?this.mse.getVolume():-1}},{key:"getBufferLen",value:function(){return this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS||this.isLive?this.mse?this.mse.getBufferLen():0:this.mse?(this.mse.getPlayVideo(),this.mse&&this.mse.isNoAudio&&this.h265Proxy.isReady?this.h265Proxy.getVideoBufferLen():this.mse.getBufferLen()):0}},{key:"getFrameBufferLen",value:function(){return this.mse.getFrameBufferLen()}},{key:"getCurrentTime",value:function(){return this.playHelper.getCurrentTime(this.getCurrentTimeInner())}},{key:"getCurrentTimeInner",value:function(){return this.mse&&this.mse.isNoAudio&&this.h265Proxy.renderInited?this.lastPlayTs=this.h265Proxy.getCurrentVideoTime()/1e3:this.mse&&(this.lastPlayTs=this.mse.getCurrentTime()/1e3),this.lastPlayTs>this.getDurationTime()?this.getDurationTime():this.lastPlayTs}},{key:"getCurrentRealTime",value:function(){return this.mse&&this.mse.video&&this.mse.video.getCurrentTime()||0}},{key:"getCurrentDts",value:function(){return this.mse?this.mse.getCurrentDts():0}},{key:"getCurrentSeiOffsetDts",value:function(){return this.mse?this.mse.getCurrentSeiOffsetDts():0}},{key:"getDurationTime",value:function(){return this.playlist&&this.playlist.totalDuration?this.playlist.totalDuration:0}},{key:"getFixedDurationTime",value:function(){return this.playlist&&this.playlist.totalDuration?this.playlist.totalDuration:0}},{key:"getAnticodeHandler",value:function(){return this.anticode}},{key:"updateFlvConfig",value:function(){this.mse&&this.mse.setJitter(F.hlsJitCfg[0],F.hlsJitCfg[1],F.hlsJitCfg[2])}}
1,{key:"updateLiveVodUrl",value:function(t,e){e!==this.cdnName?this.eventEmitter.trigger(N.PLAYBACK_DIF_CDN):this.playlist.updateLiveVodUrl(t)}},{key:"setMuted",value:function(t){this.mse&&this.mse.setMuted(t)}},{key:"getMuted",value:function(){return this.mse?this.mse.getMuted():-1}},{key:"addNoPictureReason",value:function(){var t=Y.getHlsNoPictureReason();this.stat&&this.stat.setActDim(R.VOD_DIM_COM.VOD_NO_PICTURE_REASON,t),this.statVod&&this.statVod.setActDim(R.VOD_DIM_COM.VOD_NO_PICTURE_REASON,t)}},{key:"reconnectLive",value:function(){if(I.log("[hls-".concat(this._id,"] HlsPlayer.reconnectLive")),this.isLive)q.addRetryStream(this.stat),this.destroy(),this.reset(),this.start(this.info);else{q.addRetryStreamVod(this.url),this.mse&&this.mse.parser&&this.mse.parser.resetTsData&&this.mse.parser.resetTsData();var t=this.playlist.currFrag;t.tryCnt>0?(t.tryCnt--,this.loadFragment(!0)):this.loadFragment(!1)}}},{key:"setTargetDuration",value:function(t){this.targetDuration=t*this.config.minFragBufferNum}},{key:"setStopLoadFragment",value:function(){this.stopLoadFragment=!0}},{key:"loadFragment",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1?arguments[1]:void 0;if(!(this.seekNextFragTime>0)&&(!this.userPaused||!this.playlist.firstLevelLoaded)&&(e||this.playlist.hasNextFrag())&&!this.stopLoadFragment){if(this.playlist.fragHelper.isM4s()&&!this.mse.isM4sInitLoaded()){this.vodSecHelper.setInitStart();var i=this.playlist.fragHelper.getInitUrl();i=O.checkDMod(i,this.info._dMod,this.info._sMod),i=this.replaceProtocl(i),this.mse.loadM4sInit(i,this.config,{initCb:this.m4sInitcb,openCb:this.m4sInitOpenCb})}if(this.vodSecHelper.setFirstStart(),!this.isLoading&&(null!==this.playlist.currDetails||e)&&(this.hlsSeek.check(),this.started)){var s=this.getCurrentTime(),r=void 0;if(this.mse.getPlayVideo(),r=this.mse&&this.mse.isNoAudio&&this.h265Proxy.renderInited?this.h265Proxy.getVideoBufferLen():this.mse.getBufferLen()/1e3,0==this.seekTime){var a=this.config.maxBufferLength,n=this.config.secondBufferLength;if(this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS){if(!(this.isSeekBefore&&s<this.seekBeforeTime)){if(this.coolLoadFragment){if(r>=n)return;this.coolLoadFragment=!1}if(r>=a)return void(this.coolLoadFragment=!0);this.seekBeforeTime=0,this.isSeekBefore=!1}}else if(!(this.h265Proxy.renderInited&&this.isSeekBefore&&s<this.seekBeforeTime)){if(this.coolLoadFragment){if(r>=n)return;this.coolLoadFragment=!1}if(r>=a)return void(this.coolLoadFragment=!0);this.seekBeforeTime=0,this.isSeekBefore=!1}}var o=null;if(e)(o=new tr).sn=Number(e.sn)||1e3,o.setUrl(e.tsUrl),o.start=~~e.tsStartTime,o.discontinuity=!!e.discontinuity,o.seeking=!!this.firstTsInfo.seeking,o.byteRangeStartOffset=e.byteRangeStartOffset,o.byteRangeEndOffset=e.byteRangeEndOffset,this.playlist.currFrag=o;else if(o=t?this.playlist.currFrag:this.playlist.nextFrag,!this.seeking&&o&&this.firstTsInfo){var u=O.removeUrlAllParam(this.firstTsInfo.tsUrl),l=O.removeUrlAllParam(o.url);o.byteRangeEndOffset&&u===l?o=o.byteRangeEndOffset===this.firstTsInfo.byteRangeEndOffset?this.playlist.nextFrag:o:u===l&&(o=this.playlist.nextFrag)}if(o){null==(d=this.mse)||d.resetTsInfo(),o.startDts=o.endDts=0,o.loadStartTs=g.now(),!this.isLive&&F.vodDtsFixCfg[0]&&this._ptsJumpTest(),this.isLive||this.loadVodPcdnProxy();var d,c=this.config,f=F.vodBs2Delay+this.targetDuration/3*1e3,p=o.getUrl({bufferLen:this.getBufferLen(),useCdn:this.forceUseCdn});this.playlist.fragHelper.isPcdnProxyOpen||(o.pcdnStatus=ts.PCDN_NOT_OPEN),this.playlist.fragHelper.isPcdnClientOpen||(o.pcdnStatus=ts.PCDN_CLIENT_NOT_OPEN),(F.vodPcdnStatCfg[0]?o.hasPcdn():o.pcdnStatus!==ts.PCDN_NOT_OPEN&&o.pcdnStatus!==ts.PCDN_CLIENT_NOT_OPEN)&&this.getBufferLen()<F.vodPcdnOpenBuffer&&!this.forceUseCdn?(o.pcdnStatus!==ts.OPEN_BUFFER_NOT_REACHED&&o.pcdnStatus!==ts.BUFFER_LACK_TO_CDN&&(o.pcdnStatusBk1=o.pcdnStatus),o.pcdnStatus=ts.OPEN_BUFFER_NOT_REACHED):this.forceUseCdn&&(o.pcdnStatus!==ts.OPEN_BUFFER_NOT_REACHED&&o.pcdnStatus!==ts.BUFFER_LACK_TO_CDN&&(o.pcdnStatusBk2=o.pcdnStatus),o.pcdnStatus=ts.BUFFER_LACK_TO_CDN),0==this.firstFragLoadTs&&(this.firstFragLoadTs=g.now(),o.pcdnStatus=ts.FIRST_TS,o.isFirstLoad=!0,0===Y.getFirstFragStatus()&&Y.setFirstFragStatus(1)),o.isPcdn?(this.statVod.addCore(R.CORE.GET_STREAM_CNT,1),this._pcdnFragStartTs=g.now()):this._cdnFragStartTs=g.now(),this.playlist.m3u8Parsered||(f=this.config.firstFragLoadTimeout),this.isLoading=!0,this.releaseLoader();var m=null;m=new this._loaderClz(c),this.fragLoader=m,o.byteRangeEndOffset&&(m.fromByte=o.byteRangeStartOffset,m.toByte=o.byteRangeEndOffset-1),I.log("[hls-".concat(this._id,"] HlsPlayer.loadFragment sn=")+o.sn,p),this.fragStartTs=g.now(),this.fragSize=0,this.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.TS_CNT,1),F.vodConvertIDR&&(this.mse.parser.convertToIDR=!1),p=O.checkDMod(p,this.info._dMod,this.info._sMod),p=this.replaceProtocl(p),this.info.isLive||(p=this.vodAnticode.updateAnticode(p)),m.loadBuffer(p,this.loadOpen.bind(this),this.loadChunk.bind(this),this.loadSuccess.bind(this),this.loadError.bind(this),this.loadTimeout.bind(this),f,o.isPcdn?0:c.fragLoadingMaxRetry,o.isPcdn?0:c.fragLoadingRetryDelay)}else if(null!=r&&r<=2){var _=g.now();if(0===this.endTs&&(this.endTs=_+1e3*r+300),_>=this.endTs&&!this.isLive){I.log("[hls-".concat(this._id,"] HlsPlayer.loadFragment ANCHOR_STOP bufferedLen=")+r.toFixed(2));var y=0,v=this.mse.getPlayVideo();y=this.mse&&this.mse.isNoAudio&&this.h265Proxy.renderInited?this.h265Proxy.getCurrentVideoTime()/1e3:this.mse.getCurrentTime()/1e3;var S=this.getFixedDurationTime();S-y-r<=2&&(2===Number(this.liveType)?(this.stop(),this.onAnchorStop()):(I.log("[hls-".concat(this._id,"] HlsPlayer.loadFragment.onEnded currentTime=").concat(y," duration=").concat(S," bufferedLen=").concat(r)),this.playerCoreType==L.PLAYER_CORE_TYPE.MSE&&(v.currentTime=S),this.onEnded()))}}else if(this.seekTime>0)if(I.warn("[hls-".concat(this._id,"] HlsPlayer.loadFragment out of range.")),this.isLive)this.stop(),this.onAnchorStop();else{var T=this.mse.getCurrentTime()/1e3,P=this.getFixedDurationTime();P-T<=2&&this.seek(P)}}}}},{key:"_isEnded",value:function(){if(this.started&&1!==this.liveType&&0!==this.playTs){var t=this.getFixedDurationTime();if(0!==t){var e=this.getCurrentTimeInner(),i=t-e,s=g.now();if(i<1){if(0==this.nowEndTs)this.nowEndTs=s+1e3*(t-e)+300;else if(s>=this.nowEndTs)return I.log("[hls-".concat(this._id,"] HlsPlayer._isEnded,duration=").concat(t,",currentTime=").concat(e,",delta=").concat(i)),!0}return!1}}}},{key:"loadVodPcdnProxy",value:function(){F.platform!==L.PLATFORM_TYPE_NAME.wap&&this.playlist.m3u8Parsered&&this.playTriggered&&!this.forceUseCdn&&this.playlist.fragHelper.getVodPcdnProxyCursor()}},{key:"loadOpen",value:function(t){this.vodSecHelper.setFirstOpen(),this.fragOpenTs=g.now();var e=this.fragOpenTs-this.fragStartTs;e<5e3&&this.playStat.tsOpens.push(e);var i=this.playlist&&this.playlist.currFrag;i&&i.isFirstLoad&&(t&&(this.firstTsHttpCode=t.code),1===Y.getFirstFragStatus()&&Y.setFirstFragStatus(2))}},{key:"loadChunk",value:function(t,e){this.pushData(t,e)}},{key:"loadSuccess",value:function(t){if(this.started){t===L.HLS_LOAD_TYPE.FETCH&&this.mse.parser.parseAllData()&&this.mse.parser.pushAllData();var e=this.mse.getTsInfo(),i=e.videoInfo,s=e.audioInfo,r=this.playlist.currFrag;if(r){r.loadEndTs=g.now(),I.log("[hls-".concat(this._id,"] HlsPlayer.loadSuccess sn=").concat(r.sn," loadType=").concat(t," costTime=").concat(r.loadEndTs-r.loadStartTs," durationInfo={ duration: ").concat(r.duration,", time: [").concat(r.start,", ").concat(r.start+r.duration,"] } dts=[").concat(r.startDts,", ").concat(r.endDts,"] vInfo=").concat(i.getInfo(),", aInfo=").concat(s.getInfo())),this.playHelper.onFragLoaded(r),this.mse&&this.mse.video&&this.mse.video.printBuffered();var a=this.playlist.lastFrag,n=1e3*r.duration,o=i.getDurationByDts(),u=s.getDurationByDts(),l=!1;if((n-o>2e3&&n-u>2e3||n-o>4e3)&&(l=!0),l){null==(d=this.mse.video)||d.printBuffered();var d,c=g.now();a?(this.seekNextFragTime=r.start+r.duration+.5,this.seekNextPlayTime=c+1e3*(a.start+a.duration)-this.mse.getCurrentTime(),I.warn("[hls-".concat(this._id,"] HlsPlayer.loadSuccess recvDuration less than realDuration, , try seek to next frag at time=").concat(this.seekNextPlayTime," now=").concat(c," seekTime=").concat(this.seekNextFragTime,"!cur url=").concat(r.url))):(I.warn("[hls-".concat(this._id,"] HlsPlayer.loadSuccess recvDuration less than realDuration, try seek to next frag!cur url=").concat(r.url)),this.seek(r.start+r.duration+.5))}}this.isLoading=!1;var f=g.now()-this.fragOpenTs;f<1e4&&(this.playStat.tsLoadeds.push(f),this.playStat.tsSpeeds.push(this.fragSize/f),this.playStat.tsSizes.push(this.fragSize)),this.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.TS_SUC_CNT,1),this.fragSize=0,this.playlist.hasNextFrag()||this.mse.endOfStream()}}},{key:"onParseVideoDts",value:function(t){var e=this.playlist&&this.playlist.currFrag;e&&(0===e.startDts&&(e.startDts=t),e.endDts=t)}},{key:"pushData",value:function(t,e){if(t){e===L.HLS_LOAD_TYPE.XHR&&I.log("[hls-".concat(this._id,"] HlsPlayer.pushData loadType=").concat(e," payload.length=").concat(t.byteLength));var i=this.playlist.currLevel||{},s=this.playlist.currFrag,r=this.playlist.lastFrag,a=this.playlist.totalDuration;if(this.exceptionStat.setStat(R.DIM_LINK_STA.HAS_DATA,1),this.avgSpeed.addCur(t.byteLength),this.fragSize+=t.byteLength,this.statFragData(t),t=this.discardPcdnRepeatData(t)){0==this.firstFragLoadedTs&&(this.firstFragLoadedTs=g.now(),this.firstFragSize=t.byteLength/1024|
10);var n=s.discontinuity;this.curAppendFrag&&this.curAppendFrag.sn===s.sn?n=!1:this.curAppendFrag&&this.curAppendFrag.sn!==s.sn&&(this.curAppendFrag=s),this.curAppendFrag||(this.curAppendFrag=s),this.lastSN!==s.sn&&(this.lastSN=s.sn);var o={timeOffset:s.start,duration:a,level:s.level,sn:s.sn,seeking:s.seeking};if(this.playlist.fragHelper.isM4s()?this.mse.appendM4sSegment(t,o):this.mse.appendTs({loadType:e,data:t,audioCodec:i.audioCodec,videoCodec:i.videoCodec,timeOffset:s.start,duration:a,discontinuity:n,_discontinuity:s.seeking&&r&&s.discontinuityCnt!==r.discontinuityCnt,level:s.level,sn:s.sn,seeking:s.seeking,hlsDT:s.hlsDT,tsDT:s.tsDT}),s&&s.seeking){if(s.seeking=!1,this.firstPlay){this.firstPlay=!1;var u=s.start;this.info.secUseSeekTime&&(u=this.seekTime),this.mse.seek(u),this.playerCoreType==L.PLAYER_CORE_TYPE.MSE&&(this.onVideoSeek(u),this.play())}this.seekTime=0}this.setLoadStatus(L.LoadVideoTimeoutReason.HLS_LOADFRAMENT_SUCCESS)}}}},{key:"onM4sInit",value:function(){this.vodSecHelper.setInitEnd(),this.loadFragment()}},{key:"onM4sInitOpen",value:function(){this.vodSecHelper.setInitOpen()}},{key:"onFirstBuf",value:function(){this.vodSecHelper.setFirstBuf()}},{key:"loadError",value:function(t){var e=t.code,i=t.currentTarget,s=t.msg,r=this.playlist&&this.playlist.currFrag;r&&(r.isPcdn&&(this.errorPcdnSN=this.playlist.currFrag.sn,this.needStatPcdnRepeatBW=!0,this.statVod.addCore(R.CORE.GET_STREAM_LINK_ERROR_CNT,1),this.statVod.addCore(R.CORE.GET_STREAM_ERROR_CNT,1),r.pcdnStatus=ts.TS_LOAD_ERROR),r.isFirstLoad&&1===Y.getFirstFragStatus()&&Y.setFirstFragStatus(-1),r.isFirstLoad&&(this.firstTsHttpCode=e)),this.playlist&&this.playlist.currFrag&&this.playlist.currFrag.loadError(),this.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.TS_FAIL_CNT,1),I.warn("[hls-".concat(this._id,"] HlsPlayer.loadError load fragment error:").concat(e||i&&i.status," ").concat(s||"")),this.isLoading=!1,this.config.autoReconnect&&this.reconnectLive(),this.setLoadStatus(L.LoadVideoTimeoutReason.HLS_LOADFRAMENT_ERROR)}},{key:"loadTimeout",value:function(t){var e=this.playlist&&this.playlist.currFrag;e&&(e.loadError(),e.isPcdn&&(this.statVod.addCore(R.CORE.GET_STREAM_LINK_TIMEOUT_CNT,1),this.statVod.addCore(R.CORE.GET_STREAM_ERROR_CNT,1),e.pcdnStatus=ts.TS_LOAD_ERROR),e.isFirstLoad&&1===Y.getFirstFragStatus()&&Y.setFirstFragStatus(-2)),this.stat.addComp(R.HLS_INFO.name,R.HLS_INFO.TS_TIMEOUT_CNT,1),I.warn("[hls-".concat(this._id,"] load fragment timeout"),t),this.isLoading=!1,this.config.autoReconnect&&this.reconnectLive()}},{key:"discardPcdnRepeatData",value:function(t){var e=this.playlist.currFrag;if(this.lastSN!==e.sn&&(this.pcdnRepeatByteLen=0,this.playlist.fragHelper.isM4s()&&this.mse.m4sPlayer.createMp4()),!e.isPcdn&&this.errorPcdnSN===e.sn&&this.pcdnRepeatByteLen>0){if(this.needStatPcdnRepeatBW&&(this.statVod.setCore(R.PCDN_DATA.PCDN_REPEAT_BW,this.pcdnRepeatByteLen),this.needStatPcdnRepeatBW=!1),this.pcdnRepeatByteLen>t.byteLength)return this.pcdnRepeatByteLen-=t.byteLength,null;var i=t.slice(this.pcdnRepeatByteLen,t.byteLength);this.pcdnRepeatByteLen=0,t=i}return e.isPcdn&&(this.pcdnRepeatByteLen+=t.byteLength),t}},{key:"statFragData",value:function(t){var e=this.playlist.currFrag;if(e.isFirstLoad&&2===Y.getFirstFragStatus()&&Y.setFirstFragStatus(3),this.tsFileSize+=t.byteLength,0===this.heartTsStartTime&&(this.heartTsStartTime=e.start,this.heartTsEndTime=this.heartTsStartTime),this.lastSN>0&&this.lastSN!==e.sn&&(this.heartTsEndTime+=e.duration,this.statVod.addCore(R.VOD_CORE.TS_PLAY_TIME,e.duration),this.statVod.addCore(R.VOD_CORE.TS_SIZE,this.tsFileSize),this.tsFileSize=0),this.lastSN!==e.sn&&(this._getPcdnDataTime>0&&(this.statVod.addCore(R.PCDN_DATA.GET_PCDN_DATA_TIME,this._getPcdnDataTime),this.statVod.addCore(R.PCDN_DATA.GET_PCDN_DATA_TIME_CNT,1),this._getPcdnDataTime=0),this._getCdnDataTime>0&&(this.statVod.addCore(R.PCDN_DATA.GET_CDN_DATA_TIME,this._getCdnDataTime),this.statVod.addCore(R.PCDN_DATA.GET_CDN_DATA_TIME_CNT,1),this._getCdnDataTime=0)),this.statVod.addKeyvalCoreDim(R.VOD_CORE.VOD_PCDN_STATE,"".concat(e.pcdnStatus,":").concat(t.byteLength)),this.statBackupPcdnState(t),e.isPcdn){var i=e.pcdnFreetime?R.CORE.PCDN_FREETIME_BW:R.CORE.PCDN_REALTIME_BW;this.statVod.addCore(i,t.byteLength),this.stat.addCore(R.CORE.PCDN_TOTAL_BW,t.byteLength),this._pcdnFragStartTs>0&&(this._getPcdnDataTime+=g.now()-this._pcdnFragStartTs,this._pcdnFragStartTs=g.now())}else this.statVod.addCore(R.CORE.CDN_TOTAL_BW,t.byteLength),this.stat.addCore(R.CORE.CDN_TOTAL_BW,t.byteLength),this._cdnFragStartTs>0&&(this._getCdnDataTime+=g.now()-this._cdnFragStartTs,this._cdnFragStartTs=g.now())}},{key:"statBackupPcdnState",value:function(t){var e=this.playlist.currFrag;if(e&&t){var i="";
1F.vodUseBackupField[2]&&this.statVod.setCoreDim(R.VOD_DIM_COM.BACKUP_FIELD3,String(F.vodUseBackupField[6])),e.pcdnStatus===ts.OPEN_BUFFER_NOT_REACHED?(F.vodUseBackupField[0]&&this.statVod.addKeyvalCoreDim(R.VOD_DIM_COM.BACKUP_FIELD1,"".concat(e.pcdnStatusBk1,":").concat(t.byteLength)),i=0===F.vodUseBackupField[6]&&e.pcdnStatusBk1):e.pcdnStatus===ts.BUFFER_LACK_TO_CDN&&(F.vodUseBackupField[1]&&this.statVod.addKeyvalCoreDim(R.VOD_DIM_COM.BACKUP_FIELD2,"".concat(e.pcdnStatusBk2,":").concat(t.byteLength)),i=1===F.vodUseBackupField[6]&&e.pcdnStatusBk2);var s=0===F.vodUseBackupField[6]?ts.REALTIME_OVER_RUN:ts.NOT_SEND_REQ;if(i)switch(i){case ts.PCDN_REALTIME:case ts.PCDN_FREETIME:F.vodUseBackupField[3]&&this.statVod.addCoreDim(R.VOD_DIM_COM.BACKUP_FIELD4,t.byteLength);break;case ts.REALTIME_NOT_REACHED:F.vodUseBackupField[4]&&this.statVod.addCoreDim(R.VOD_DIM_COM.BACKUP_FIELD5,t.byteLength);break;case s:F.vodUseBackupField[5]&&this.statVod.addCoreDim(R.VOD_DIM_COM.BACKUP_FIELD6,t.byteLength)}}}},{key:"bufferedInfo",value:function(t,e){var i,s,r,a,n,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.3,u=[],l=[];for(n=0;n<e.length;n++)u.push({start:e.start(n),end:e.end(n)});for(u.sort(function(t,e){return t.start-e.start||e.end-t.end}),n=0;n<u.length;n++){var d=l.length;if(d){var c=l[d-1].end;u[n].start-c<o?u[n].end>c&&(l[d-1].end=u[n].end):l.push(u[n])}else l.push(u[n])}for(n=0,i=0,s=r=t;n<l.length;n++){var f=l[n].start,p=l[n].end;if(t+o>=f&&t<p)s=f,i=(r=p)-t;else if(t+o<f){a=f;break}}return{len:i,start:s,end:r,nextStart:a}}},{key:"checkCatonError",value:function(){if(this.playerCoreType!=L.PLAYER_CORE_TYPE.WEBCODECS){var t=Math.floor(this.mse.getCurrentTime()/1e3),e=this.getBufferLen(),i=this.mse&&this.mse.video&&this.mse.video.video;if(e>8e3&&!i.paused&&t<5){if(Math.floor(this.lastPlayTs)===t&&this.pauseInBufferFullTimes++,this.playTriggered)return;if(this.pauseInBufferFullTimes>=5){var s=this.playlist.getNearFragStart(this.lastPlayTs+1);I.log("[hls-".concat(this._id,"] HlsPlayer.checkCatonError, seek")),this.seek(s),this.pauseInBufferFullTimes=0}}}}},{key:"fixedByBuffered",value:function(){if(!this.isLive||this.playerCoreType!=L.PLAYER_CORE_TYPE.MSE){var t=this.mse&&this.mse.video&&this.mse.video.video,e=this.playlist&&this.playlist.currFrag&&this.playlist.currFrag.duration;if(t&&e)for(var i=0;i<t.buffered.length;i++){var s=t.buffered.start(i);if(i>=1&&t.buffered.end(i-1)-t.currentTime<=1&&s>t.currentTime&&s<=t.currentTime+e){I.log("[hls-".concat(this._id,"] %cHlsPlayer.fixedByBuffered currentTime=").concat(t.currentTime," fixed time=").concat(s),"color:#A23400;background:#FFF5C2"),t.currentTime=s;break}}}}},{key:"onCheckTimer",value:function(t,e){if(this.anticode.onCheckTimer(t,e),this.vodAnticode.onVodAnticodeTimer(t),this.avgSpeed.calculate(),this.started&&this.mse&&!this.needReset&&!this.userPaused&&(this.anticode.onCheckTimer(t,e),this.avgSpeed.calculate(),this.playlist.currFrag)){if(this.mse&&this.mse.onCheckTimer(t,e),this.playlist&&this.playlist.onCheckTimer(e),this.playTs>0){var i=t-this.pauseTs;this.playStat&&(this.pauseTs>0&&i>200&&!this.skipStatForSeek&&0==this.pauseCnt&&(this.playStat.setPause(),q.addBadQuality(this.stat)),this.pauseCnt>0&&(this.pauseCnt=0,this.playStat.setPause()),e%20==0&&this.playStat.report()),this.pauseTs>0&&i>F.vodRetryTime&&(I.warn("[hls-".concat(this._id,"] HlsPlayer.onCheckTimer pauseTime=").concat(i,", bufferLen=").concat(this.getBufferLen())),this.isLive||(this.triggerH5PlayError(),this.pauseTs=0))}this.checkCatonError(),this.updateTime()}}},{key:"onVideoTimeupdate",value:function(){this.updateTime()}},{key:"updateTime",value:function(){var t=this.getCurrentTime(),e=this.getDurationTime();-1==D._printVodTimer&&I.log("[hls-".concat(this._id,"] HlsPlayer.PlayTimeUpdate"),t,e),this.eventEmitter.trigger(N.PLAY_TIME_STATUS,{current:t,total:e}),this.eventEmitter.trigger(N.PLAY_FRAME_BUFFER,{frameStorage:this.mse&&this.mse.getFrameReadyed(),jitterBuffer:this.mse&&this.mse.getBufferLen()})}},{key:"onCheckFastTimer",value:function(t,e){if(this.started&&!this.userPaused){if(this.seekNextFragTime>0&&this.seekNextPlayTime<=t)return I.log("HlsPlayer.onCheckFastTimer time to seekNextFrag seekTime=".concat(this.seekNextFragTime," localTime=").concat(this.seekNextPlayTime," now=").concat(t)),null==(i=this.mse.video)||i.printBuffered(),void this.seek(this.seekNextFragTime);if(this.needReset)return 0===this.resetPlayTs&&(this.resetPlayTs=t+this.mse.getBufferLen()-500),void((this.mse&&this.mse.getBufferLen()<500||t>this.resetPlayTs)&&(this.reloadInError(),this.needReset=!1,this.resetPlayTs=0));this.playHelper.onCheckFastTimer(t);var i,s=this.getBufferLen(),r=this.playlist.currFrag;r&&-1===Number(D._print_pcdn_buf)&&I.log("[hls-".concat(this._id,"] %cHlsPlayer.onCheckTimer isPcdn=").concat(r.isPcdn," sn=").concat(r.sn," bufferlen=").concat(this.getBufferLen()," forceUseCdn=").concat(this.forceUseCdn),"color:green"),r&&r.isPcdn&&s<F.vodPcdnCloseBuffer&&!this.forceUseCdn?(I.log("[hls-".concat(this._id,"] %cHlsPlayer.onCheckTimer: pcdn close"),"color:#A23400;background:#FFF5C2"),this.releaseLoader(),this.forceUseCdn=!0,this.isLoading=!1,this.errorPcdnSN=r.sn,this.needStatPcdnRepeatBW=!0,r.pcdnStatusBk2=r.pcdnStatus,r.pcdnStatus=ts.BUFFER_LACK_TO_CDN,this.loadFragment(!0),this.statVod.addCore(R.CORE.GET_STREAM_LOW_DATA_CNT,1),tP.once(this.onCheckIfCanPCDN,this,F.vodPcdnCoolTime)):this.loadFragment(),this.mse&&this.mse.onCheckFastTimer(t,e);var a=t-this.pauseTs;if(this.pauseTs>0&&a>200&&this.fixedByBuffered(),this.info&&(2===this.info.liveType||3===this.info.liveType)&&this.playerCoreType==L.PLAYER_CORE_TYPE.MSE){var n=this.getBufferLen();if(this.pauseTs>0&&a>=1e3&&n>2e3){var o=this.mse.video.video;o.currentTime+=1,I.log("[hls-".concat(this._id,"] HlsPlayer.onCheckFastTimer.playback pauseTime=").concat(a,", currentTime + 1, currentTime=").concat(o.currentTime)),this.play()}}3===Number(this.liveType)&&this._isEnded()&&(I.log("[hls-".concat(this._id,"] HlsPlayer.check onEnded, curTime=").concat(this.getCurrentTimeInner(),", duration=").concat(this.getFixedDurationTime())),this.onEnded())}}},{key:"onCheckIfCanPCDN",value:function(t,e){I.log("[hls-".concat(this._id,"] %cHlsPlayer.onCheckIfCanPCDN: pcdn open"),"color:#A23400;background:#FFF5C2"),this.forceUseCdn=!1,tP.remove(this.onCheckIfCanPCDN,this)}},{key:"sendNoPicture",value:function(t){this._sendVideoLoadTime(t),this._sendVideoNoPictureAll()}},{key:"_sendVideoNoPictureAll",value:function(){if(this.isLive&&!this.hasPicture){var t=this.getCostTimes(),e=t[0],i=t[2];this.tsdb.sendNoPictureTimeAll(99999,e,i,"hls","","")}}},{key:"_sendVideoLoadTime",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.videoLoadTimeSent&&!this.isLive){this.videoLoadTimeSent=!0,t=t||g.now()-this.startTs,this.isLive||this.statVod.setA
1ctDim(R.VOD_DIM_COM.CREATE_TIME,t);var e=this.videoLoadTime,i=this.loadM3u8Time,s=this.firstFragLoadTime,r=this.firstFragLoadedTime,a=this.firstFragParsedTime;if(!this.hasPicture){e=99999;var n=this.getCostTimes();i=n[0],s=n[1],r=n[2],a=n[3]}var o=0;this.mse&&(o=this.mse.isMediaSourceOpen?1:2);var u=O.getBrowserHidden();u&&2==o?I.log("[hls-".concat(this._id,"] HlsPlayer._sendVideoLoadTime browserHidden=").concat(u,", isMediaSourceOpen=").concat(o)):(99999===e?(q.addVodFail(this.url),this.tsdb.autoReport()):q.delVodFail(this.url),this.tsdb.sendVodHlsTime({loadType:this._loaderType,loadTime:e,loadM3u8Time:i,firstFragLoadTs:s,firstFragLoadedTs:r,firstFragParsedTs:a,firstFragSize:this.firstFragSize,businessCost:this.businessLoadTime,UICost:this.uiLoadTime,playTs:this.playTs,startTs:this.startTs,m3u8Status:this.playlist.loadM3u8HttpCode,firstTsStatus:this.firstTsHttpCode,costTimes:this.vodSecHelper.getCostTimes()}))}}},{key:"updateStatus",value:function(t){this.videoStatus!==t&&(this.videoStatus=t,this.eventEmitter.trigger(N.PLAY_STATUS,{status:t}))}},{key:"cacheBlockReason",value:function(t,e){this.blockHelper.cacheBlockReason(t,e)}},{key:"resetHeartTsTime",value:function(){this.heartTsStartTime=0,this.heartTsEndTime=0}},{key:"onStartVideo",value:function(){this.loadStartTs=g.now()}},{key:"onPlayVideo",value:function(t,e,i,s,r,a,n){this.isLive&&q.delFail(this.stat);var o=g.now();this.pauseTs=0,this.playTs=o,this.hasVideo=s,this.vodSecHelper.setPlayTs(),0!==this.startTs&&(this.videoLoadTime=o-this.startTs,this.loadM3u8Time=this.playlist.manifestLoadedTs-this.startTs,this.firstFragLoadTime=this.firstFragLoadTs-this.playlist.manifestLoadedTs,this.firstTsInfo&&(this.firstFragLoadTime=this.firstFragLoadTs-this.startTs),this.firstFragLoadedTime=this.firstFragLoadedTs-this.firstFragLoadTs,this.firstFragParsedTime=o-this.firstFragLoadedTs,this.uiLoadTime=this.UIStartCost>0?this.videoLoadTime+this.UIStartCost:0,this.businessLoadTime=0,this.startTimeStamp>1?this.businessLoadTime=this.videoLoadTime+this.businessStartCost:1===this.startTimeStamp&&(this.businessLoadTime=o-this.loadStartTs),this.tsdb.sendHlsTime(this._loaderType,this.videoLoadTime,this.loadM3u8Time,this.firstFragLoadTime,this.firstFragLoadedTime,this.firstFragSize,this.businessLoadTime,this.uiLoadTime,this.firstFragParsedTime,this.vodSecHelper.getCostTimes()),this.isLive||this.videoLoadTimeSent||!(this.videoLoadTime<=1e4)||this._sendVideoLoadTime(),I.log("[hls-".concat(this._id,"] %cHlsPlayer.onPlayVideo loadTime=")+this.videoLoadTime,"color:#A23400;background:#FFF5C2")),this.seeking=!1,this.skipStatForSeek=!1,this.playTriggered=!0,this.pausedByBrowser||this.updateStatus(U),this.codecType=n;var u={video:t,width:e,height:i,canvas:r,codec:n};this.eventEmitter.trigger(N.VIDEO_PLAY,u),I.log("[hls-".concat(this._id,"] HlsPlayer.onPlayVideo playInfo"),u),this.isLive||this.loadVodPcdnProxy(),this.playlist.fragHelper.isM4s()&&function(t){if(F.vodAv1CloseCfg[1]){var e=F.vodAv1CloseCfg[1];return t>=e[0]&&navigator.hardwareConcurrency<=e[1]}return!1}(this.info.curBitrate,tz())&&this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN,{video:t,code:1e3,msg:"é
ç½®å
³éav1"})}},{key:"onVideoStop",value:function(t,e){I.log("[hls-".concat(this._id,"] HlsPlayer.onVideoStop hasVideo=")+e),this.hasVideo=!1,e&&(this.updateStatus(x),this.eventEmitter.trigger(N.VIDEO_STOP,{video:t}))}},{key:"onAnchorStop",value:function(){var t=this.mse?this.mse.getPlayVideo():null;this.eventEmitter.trigger(N.ANCHOR_STOP,{video:t})}},{key:"onEnded",value:function(){this.started=!1,this.updateStatus(x),this.h265Proxy&&this.h265Proxy.onEnded&&this.h265Proxy.onEnded(),this.mse&&this.mse.onEnded&&this.mse.onEnded(),this.eventEmitter.trigger(N.M3U8_PLAY_ENDED)}},{key:"onLoadM3u8Error",value:function(t){var e=t&&t.currentTarget&&t.currentTarget.status;404!==e&&0!==e||this.isLive||this.videoLoadTimeSent||(!this.hasPicture&&this.addNoPictureReason&&this.addNoPictureReason(),this._sendVideoLoadTime()),this.eventEmitter.trigger(N.HLS_URL_UNAVAILABLE)}},{key:"onLoadManifestTimeout",value:function(){this.eventEmitter.trigger(N.HLS_MAINFEST_LOAD_TIMEOUT)}},{key:"onConnectManifestTimeout",value:function(){this.eventEmitter.trigger(N.HLS_URL_LOAD_TIMEOUT)}},{key:"onPlayerError",value:function(t){this.videoElement}},{key:"triggerH5PlayError",value:function(){if(this.info.type!==tQ.PLAYBACK){var t=this.getCurrentTime();I.log("[hls-".concat(this._id,"] HlsPlayer.triggerH5PlayError seekTime = ").concat(t)),this.info&&(this.eventEmitter.trigger(N.PAUSE_5S_RETRY),this.info.seekTime=t+1,this.start(this.info))}}},{key:"onErrorEvent",value:function(t){var e=this.playlist&&this.playlist.currFrag;e&&e.isFirstLoad&&3===Y.getFirstFragStatus()&&Y.setFirstFragStatus(-3);var i=this.mse?this.mse.getPlayVideo():null;this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN,{video:i,code:t.type,msg:"ææ¾é误"}),this.setLoadStatus(L.LoadVideoTimeoutReason.HLS_PLAY_ERROR)}},{key:"decoderDecodeError",value:function(){I.log("[hls-".concat(this._id,"] HlsPlayer.decoderDecodeError"))}}
1,{key:"onPlayPause",value:function(t,e,i){if(e&&(this.pauseTs=t,this.updateStatus(H),this.blockHelper.checkVodBlock(),this.playlist&&!this.isLive)){var s=1e3*this.playlist.totalDuration,r=this.mse?this.mse.getCurrentTime()/1e3:0;s>0&&r>0&&Math.abs(s-r)<1e3&&this.isLive&&(I.warn("[hls-".concat(this._id,"] HlsPlayer detect anchor stop.")),this.onAnchorStop(),this.stop()),this.startSendPauseTimer()}}},{key:"onPlayResume",value:function(t,e){if(this.pauseTs>0){var i=t-this.pauseTs,s=200;this.playBackRate<1&&this.playBackRate>0&&(s=Math.min(400,200*~~(1/this.playBackRate))),i>200&&!this.skipStatForSeek&&(D[j.AUTO_VIEW_LOG]=1,I.warn("[hls-".concat(this._id,"] HlsPlayer.onPlayResume pauseTime=").concat(i,", pauseDelta=").concat(s)),this.pauseCnt++,"hidden"!==this.stat.getComDim(R.DIM_COM.VISIBILITY_STATE)&&(this.stat.addCore(R.DIM_CORE.V_BAD_FRONT,1),this.isLive||this.statVod.addCore(R.VOD_CORE.V_BAD_FRONT,1)),this.stat.addCore(R.CORE.VIDEO_BLOCK_COUNT,1),this.stat.addCore(R.CORE.VIDEO_BLOCK_DURATION,i),this.isLive||(this.statVod.addCore(R.VOD_CORE.VOD_BLOCK_COUNT,1),this.statVod.addCore(R.VOD_CORE.VOD_BLOCK_DURATION,i),q.addBadQualityVod(this.url)),this.eventEmitter.trigger(N.VIDEO_BAD_QUALITY)),this.pauseTs=0}this.skipStatForSeek=this.seeking,e&&(this.updateStatus(U),this.eventEmitter.trigger(N.VIDEO_PLAYING,{video:this.videoElement,event:event}))}},{key:"onVideoSeek",value:function(t){if(this.started){I.log("[hls-".concat(this._id,"] HlsPlayer.onVideoSeek"),t),this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS&&(this.hlsSeek._seekTime=0),this.seeking=!1,this.seekTime=0;var e=this.mse?this.mse.getPlayVideo():null;this.eventEmitter.trigger(N.VIDEO_SEEK,{video:e,currentTime:t}),this.h265Proxy&&this.h265Proxy.onVideoSeek&&this.h265Proxy.onVideoSeek(t)}}},{key:"onPauseByBrowser",value:function(){window&&(I.warn("[hls-".concat(this._id,"] HlsPlayer.onPauseBrowser: video was paused by browser, define click listener")),window.removeEventListener("click",this._clickEventBind,!0),window.addEventListener("click",this._clickEventBind,!0),this.pausedByBrowser=!0)}},{key:"_clickEvent",value:function(){var t=this;if(document){I.log("[hls-".concat(this._id,"] HlsPlayer._clickEvent: click for play a temp video"));var e=document.createElement("video").play();e&&e.catch(function(e){I.log("[hls-".concat(t._id,"] HlsPlayer._clickEvent err=").concat(e.message))}),this.pausedByBrowser=!1,window&&window.removeEventListener("click",this._clickEventBind,!0)}}},{key:"startSendPauseTimer",value:function(){this.stopSendPauseTimer(),this.sendPauseTimeout=setTimeout(this.sendPauseEvent.bind(this),200)}},{key:"stopSendPauseTimer",value:function(){clearTimeout(this.sendPauseTimeout)}},{key:"sendPauseEvent",value:function(){this.videoStatus!==U&&this.eventEmitter&&this.eventEmitter.trigger(N.PLAY_CARTON)}},{key:"isPlaying",get:function(){return this.videoStatus!==x&&this.videoStatus!==B&&this.videoStatus!==V}},{key:"hasPicture",get:function(){return this.videoLoadTime>0}},{key:"getCostTimes",value:function(){if(!this.playlist)return[0,0,0,0,-1,0,0];var t=this.playlist.manifestLoadedTs>0?this.playlist.manifestLoadedTs-this.startTs:0,e=this.firstFragLoadedTs>0?this.firstFragLoadTs-this.playlist.manifestLoadedTs:0;return this.firstTsInfo&&(e=this.firstFragLoadedTs>0?this.firstFragLoadTs-this.startTs:0),[t,e,this.firstFragLoadedTs>0?this.firstFragLoadedTs-this.firstFragLoadTs:0,this.playTs&&this.firstFragLoadedTs>0?this.playTs-this.firstFragLoadedTs:0,this.playlist.loadM3u8HttpCode,this.firstTsHttpCode,this.startTs,this.playTs]}},{key:"switchLevel",value:function(t){var e=this.playlist.levels,i=t.curBitRate;if(e.length>0&&this.playlist.isMasterPlayList){for(var s=0;s<e.length;s++)if(e[s].bitrate===i&&this.playlist.currLevel.bitrate!=i){this.playlist.currLevel.bitrate=i,this.playlist.currLevelId=s,this.playlist.currLevel.url=e[s].url,this.mse.parser.switchLevel(),this.play();break}}else this.playlist.currLevel.url=t.url,this.playlist.currLevel.bitrate=i,this.mse.parser.switchLevel(),this.play()}},{key:"turnToH264",value:function(t){var e=this.getCurrentTime();this.stop(),this.eventEmitter.trigger(N.TURN_TO_H264,{seekTime:e,reason:t})}},{key:"h265Retry",value:function(){var t=this.getCurrentTime();this.stop(),this.eventEmitter.trigger(N.H265_VIDEO_RETRY,{seekTime:t})}},{key:"containerResize",value:function(t){this.h265Proxy&&this.h265Proxy.containerResize&&this.h265Proxy.containerResize(t)}
1},{key:"_ptsJumpTest",value:function(){1===Number(D.ptsJumpTest)&&(ey.ptsJumpTest=!0)}},{key:"getCodecType",value:function(){return this.codecType}},{key:"getVideoWidth",value:function(){return this.isAv1State?this.videoElement&&this.videoElement.videoWidth:this.mse.getMseAvcCfgWidth()}},{key:"getVideoHeight",value:function(){return this.isAv1State?this.videoElement&&this.videoElement.videoHeight:this.mse.getMseAvcCfgHeight()}},{key:"getFps",value:function(){if(this.isAv1State){if(this.mse&&this.mse.m4sPlayer&&this.mse.m4sPlayer.mp4){var t=this.mse.m4sPlayer.mp4.getVideoFps();return t>0?t:-100}return -100}return this.mse&&this.mse.parser&&this.mse.parser.getFps()}},{key:"replaceProtocl",value:function(t){return t.replace(/^https?\:/,"https:")}},{key:"setWebCodecsSuccess",value:function(){this.isWebcodecsPlaying=!0}},{key:"setFrameRusume",value:function(){}},{key:"setFramePause",value:function(){}},{key:"renderFpsPause",value:function(){}},{key:"getEnhanceStats",value:function(){return this.eventEmitter&&this.eventEmitter.getEnhanceStats&&this.eventEmitter.getEnhanceStats()}},{key:"getDpi",value:function(){var t=0,e=0;return this.mse&&this.mse.getMseAvcCfgWidth&&(t=this.mse.getMseAvcCfgWidth()),this.mse&&this.mse.getMseAvcCfgHeight&&(e=this.mse.getMseAvcCfgHeight()),{width:t,height:e}}},{key:"turnToWebcodecsSoft",value:function(){var t=this.getCurrentTime();this.stop(),O.isWebCodecsSupported()&&(I.log("[hls-".concat(this._id,"] HlsPlayer.turnToWebcodecsSoft")),this.eventEmitter.trigger(N.TURN_TO_WEBCODECS_SOFT,{seekTime:t}))}},{key:"getRefreshRate",value:function(){return this.eventEmitter&&this.eventEmitter.getRefreshRate&&this.eventEmitter.getRefreshRate()}},{key:"webcodecsRetry",value:function(){var t=this.getCurrentTime();this.stop(),this.eventEmitter.trigger(N.WEBCODECS_RETRY,{seekTime:t})}},{key:"turntoH265Wasm",value:function(){var t=this.getCurrentTime();this.stop(),this.eventEmitter.trigger(N.TURN_TO_H265_WASM,{seekTime:t})}},{key:"turnToMse",value:function(){var t=this.getCurrentTime();this.stop(),this.eventEmitter.trigger(N.TURN_TO_MSE,{seekTime:t})}},{key:"setUseSoftAcceleration",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isLive||this.statVod.setComDim(R.VOD_DIM_COM.DECODE_HARDWARE_ACCELERATION,+!!t),this.stat.setComDim(R.DIM_COM.DECODE_HARDWARE_ACCELERATION,+!!t)}},{key:"setEnhance",value:function(t){this.mse&&this.mse.setEnhance&&this.mse.setEnhance(t)}},{key:"onVideoEnhanceSuccess",value:function(){this.eventEmitter&&this.eventEmitter.trigger(N.ON_VIDEO_ENHANCE_SUCCESS)}},{key:"onVideoEnhanceError",value:function(t){this.eventEmitter&&this.eventEmitter.trigger(N.ON_VIDEO_ENHANCE_ERROR,t)}},{key:"isNotSupportWebcodecsConfigure",value:function(){var t=this,e="avc1.42E01E",i="h264";this.isAv1State?(e="av01.0.08M.08",i="av1"):this.isH265&&(e="hvc1.1.6.L93",i="h265");var s=this.mse;"h265"!=i&&"h264"!=i&&"av1"!=i||"undefined"!=typeof VideoDecoder&&VideoDecoder.isConfigSupported({codec:e}).then(function(e){I.log("[hls-".concat(t._id,"] HlsPlayer.isConfigSupported"),e,i),e.supported?"h265"==i?D.isCloseWebcodecsH265=0:"h264"==i?D.isCloseWebcodecsH264=0:"av1"==i&&(D.isCloseWebcodecsAv1=0):("h265"==i?D.isCloseWebcodecsH265=1:"h264"==i?D.isCloseWebcodecsH264=1:"av1"==i&&(D.isCloseWebcodecsAv1=1),s&&s.isNotSupportWebcodecsConfig&&s.isNotSupportWebcodecsConfig())}).catch(function(e){I.log("[hls-".concat(t._id,"] HlsPlayer.isConfigSupported.catch"),e.message)})}},{key:"setDisableHardAcc",value:function(){var t=this.mse;t&&t.setDisableHardAcc&&t.setDisableHardAcc()}},{key:"win7PerfInsufficient",value:function(){var t=this.mse;t&&t.win7PerfInsufficient&&t.win7PerfInsufficient()}},{key:"angelNullError",value:function(){var t=this.mse;t&&t.angelNullError&&t.angelNullError()}},{key:"chromeH265RenderEmptyError",value:function(){var t=this.mse;t&&t.chromeH265RenderEmptyError&&t.chromeH265RenderEmptyError()}},{key:"onMseHevcError",value:function(){this.info&&!this.info.h265Url&&(this.info.h265Url=this.info.url),I.log("[hls-".concat(this._id,"] HlsPlayer.onMseHevcError")),this.turntoH265Wasm&&this.turntoH265Wasm()}},{key:"setPlaybackRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;(this.playBackRate=t,I.log("[hls-".concat(this._id,"] HlsPlayer.setPlaybackRate"),t),this.playerCoreType==L.PLAYER_CORE_TYPE.MSE&&this.mse&&this.mse.getPlayVideo)?this.mse.getPlayVideo().playbackRate=Number(t):this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS&&this.mse.setPlaybackRate(t)}},{key:"isWebCodec",get:function(){return this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS}}]),t}(),rm=function(){function t(){Object(s.a)(this,t),this.video=null,this._startWaitingTs=0,this._badQualityCnt=0,this._badQualityTime=0,this._badQuality=!1,this._paused=!1,this.onWaitingBind=this.onWaiting.bind(this),this.onPlayingBind=this.onPlaying.bind(this),this.onPauseBind=this.onPause.bind(this),this.onCanplayThroughBind=this.onCanplayThrough.bind(this)}return Object(r.a)(t,[{key:"paused",get:function(){return this._badQualityCnt>0}},{key:"waiting",get:function(){return this._startWaitingTs>0}},{key:"reset20",value:function(){this._badQuality&&(this._startWaitingTs=g.now()),this._badQuality=!1,this.resetBadQuality()}},{key:"reset",value:function(){this.delEventListener(this.video),this.resetBadQuality(),this.resetStat(),this._paused=!1,this.video=null}},{key:"resetBadQuality",value:function(){this._badQualityCnt=0,this._badQualityTime=0}},{key:"resetStat",value:function(){this._startWaitingTs=0,this._badQuality=!1}},{key:"start",value:function(t){this.reset(),this.addEventListener(t),this.video=t,tP.add(this.onCheckStat,this,50)}},{key:"stop",value:function(){this.reset(),tP.remove(this.onCheckStat,this)}},{key:"addEventListener",value:function(t){t&&(t.addEventListener("waiting",this.onWaitingBind),t.addEventListener("playing",this.onPlayingBind),t.addEventListener("pause",this.onPauseBind),t.addEventListener("canplaythrough",this.onCanplayThroughBind))}},{key:"delEventListener",value:function(t){t&&(t.removeEventListener("waiting",this.onWaitingBind),t.removeEventListener("playing",this.onPlayingBind),t.removeEventListener("pause",this.onPauseBind),t.removeEventListener("canplaythrough",this.onCanplayThroughBind))}},{key:"onCheckStat",value:function(t,e){!this._paused&&this._startWaitingTs>0&&t-this._startWaitingTs>200&&(this._badQuality||(this._badQuality=!0,this._badQualityCnt++))}},{key:"onWaiting",value:function(t){0===this._startWaitingTs&&(this._startWaitingTs=g.now())}},{key:"onPlaying",value:function(t){this.checkBadQuality(),this.resetStat(),this._paused=!1}},{key:"onPause",value:function(t){this.checkBadQuality(),this.resetStat(),this._paused=!0}},{key:"onCanplayThrough",value:function(t){this._paused||(this.checkBadQuality(),this.resetStat())}},{key:"checkBadQuality",value:function(){if(this._badQuality&&this._startWaitingTs>0){var t=g.now()-this._startWaitingTs;I.log("PauseStat.checkBadQuality badQualityTime=".concat(t,", this.video.paused=").concat(this.video.paused)),this._badQualityTime+=t}}}]),t}(),r_=1,ry=function(){function t(e,i){Object(s.a)(this,t);var r=i.stat,a=i.statVod,n=i.tsdb,o=i.videoElement,u=i.h265Proxy;this.eventEmitter=e,this._videoElm=o,this._stat=r,this.statVod=a,this._tsdb=n,this._id=r_++,this.anticode=new sb,this._pauseStat=new rm,this.started=!1,this.startTs=0,this.videoStatus=x,this.videoLoadTimeSent=!1,this.sysPause=!1,this.pauseByUser=!1,this.waiting=!1,this.ended=!1,this.hasEvents=!1,this.videoInfo=null,this._tickTs=0,this.lineType=0,this.loadeddataTs=0,this.allowedAutoPlay=!0,this.seekTime=0,this.noPictureSent=!1,this.isLoadstart=!1,this.playTimeout=5e3,this.urlNetworkstate=0,this.startPlayTs=0,this.h265Proxy=u,this._isEnded=!1,this._videoEvts=["loadstart","pause","loadedmetadata","loadeddata","error","canplay","canplaythrough","play","playing","stalled","suspend","volumechange","waiting","progress","emptied","ended","durationchange"],this._videoEvtHandlerBind=this._videoEvtHandler.bind(this),this._startUrlBind=this._startUrl.bind(this),this._refreshAnticodeBind=this._refreshAnticode.bind(this),this.anticode.on(sb.Events.REFRESH,this._refreshAnticodeBind),this.videoChecker=new eP(this._videoElm,!1,{renderCallback:this._onVideoRender.bind(this)}
1),this.videoChecker.start(),this.videoFrameRenderTs=0,this.videoTimerRenderTs=0}return Object(r.a)(t,[{key:"_onVideoRender",value:function(t){t===eP.Types.FRAME?this.videoFrameRenderTs=g.now():this.videoTimerRenderTs=g.now()}},{key:"isPlaying",get:function(){return this.videoStatus!==x}},{key:"hasPicture",get:function(){return this.isPlaying}},{key:"notAllowedAutoplay",get:function(){return!this.allowedAutoPlay}},{key:"networkState",get:function(){return this._videoElm&&this._videoElm.networkState}},{key:"printBlackInfo",value:function(){this._videoElm&&I.log("HlsTagPlayer(".concat(this._id,").printNetworkState: ").concat(this._videoElm.networkState)),this._videoElm&&this._videoElm.error&&I.log("HlsTagPlayer(".concat(this._id,").printError: ").concat(this._videoElm.error.code,", ").concat(this._videoElm.error.message))}},{key:"networkStateCode",get:function(){return this.urlNetworkstate||0}},{key:"errorCode",get:function(){return this._videoElm&&this._videoElm.error&&this._videoElm.error.code}},{key:"start",value:function(t){t&&(this.videoInfo=t),this.videoInfo&&this.videoInfo.playTimeout&&(this.playTimeout=this.videoInfo.playTimeout),this.isLive=t.isLive,this._checkParams(this.videoInfo,this._startUrlBind),tP.once(this._playVideoFailed,this,this.playTimeout),tP.once(this._checkUrlActive,this,3e3)}},{key:"stop",value:function(){this.videoChecker.destroy(),this._videoElm.pause(),this._videoElm.src="",this._delEvents(),tP.remove(this.onPlayTimeout,this),tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this),tP.remove(this._playVideoFailed,this),tP.remove(this._checkUrlActive,this),this.reset(),I.log("HlsTagPlayer(".concat(this._id,").stop: player is stopped"))}},{key:"triggerPlayTimeStatus",value:function(){this.eventEmitter.trigger(N.PLAY_TIME_STATUS,{current:this.getCurrentTime(),total:this.getDurationTime()})}},{key:"reset",value:function(){I.log("HlsTagPlayer(".concat(this._id,").reset: player is reset")),this.started=!1,this.startTs=0,this.videoStatus=x,this.sysPause=!1,this.pauseByUser=!1,this.waiting=!1,this.ended=!1,this.hasEvents=!1,this.videoInfo=null,this._tickTs=0,this.lineType=0,this.loadeddataTs=0,this.seekTime=0}},{key:"destroy",value:function(){this._videoElm.pause(),I.log("HlsTagPlayer(".concat(this._id,").stop: player is destory")),this.isAutoplaying=!1,this.startPlayTs=0,this.seekTime=0}},{key:"getBufferLen",value:function(){var t=0;if(this._videoElm){var e=this._videoElm.buffered;e.length>0&&(t=1e3*(e.end(e.length-1)-this._videoElm.currentTime)|0)}return t}},{key:"seek",value:function(t){this.setCurrentTime(t)}},{key:"setCurrentTime",value:function(t,e){0!==this._videoElm.duration&&(t!==Math.ceil(this._videoElm.duration)?(this.seekTime=t,this._videoElm.currentTime=t,I.log("HlsTagPlayer(".concat(this._id,").setCurrentTime seekTime=").concat(t,", currentTime=").concat(this._videoElm.currentTime,", duration=").concat(this._videoElm.duration)),tP.remove(this.onPlayTimeout,this),tP.once(this.onSeekTimeout,this,e||2e4)):this._setEnded(1))}},{key:"getCurrentTime",value:function(){return this._videoElm.currentTime}},{key:"getDurationTime",value:function(){return this._videoElm.duration}},{key:"setVolume",value:function(t){this._videoElm&&(this._videoElm.volume=t)}},{key:"play",value:function(){var t=this;I.log("HlsTagPlayer(".concat(this._id,").play: call play.")),this.pauseByUser=!1,this.sysPause=!1,this._addEvents(),this.playing||(this.startTs=g.now());var e=this._videoElm.play();return e?e.then(function(){I.log("HlsTagPlayer(".concat(t._id,").play: play successfully"))}).catch(function(e){I.error("HlsTagPlayer(".concat(t._id,").play: playing error="),e.toString(),t._videoElm.paused)}):I.warn("HlsTagPlayer(".concat(this._id,").play: play result is not a promise")),e}},{key:"pause",value:function(){this.pauseByUser=!0,this._delEvents(),this._videoElm.pause()}},{key:"getAnticodeHandler",value:function(){return this.anticode}},{key:"_checkParams",value:function(t,e){t.sHlsUrl&&t.sStreamName?(t.sHlsUrl=t.sHlsUrl.replace("http://","https://"),t.sHlsAntiCode?(this.anticode.init(t.sHlsUrl,t.sStreamName,t.sHlsAntiCode),this.anticode.valid().then(function(){e(t)})):e(t)):t.url?e(t):I.error("HlsTagPlayer(".concat(this._id,").checkParams has no params(sHlsUrl, sStreamName, url)"))}},{key:"_initInfo",value:function(t){t.sHlsUrl&&t.sStreamName&&(t.url=t.sHlsUrl+"/"+t.sStreamName+".m3u8");var e=[];this.anticode.hasAnticode()&&e.push(this.anticode.getAnticode()),t.iBitRate>0&&e.push("ratio=".concat(t.iBitRate));var i=F.platform,s=L.PLATFORM_TYPE[i]||L.PLATFORM_TYPE.web,r=i===L.PLATFORM_TYPE_NAME.wap?"uid=".concat(w.uid,"&uuid=").concat(w.uuid):"u=".concat(w.convertUid),a="".concat(r,"&t=").concat(s);e.push(a=O.urlInfoParams(a,t)),e.length>0&&(t.url+=(-1!==t.url.indexOf("?")?"&":"?")+"".concat(e.join("&"))),this.lineType=t.lineType,this.url=t.url}},{key:"_startUrl",value:function(t){this._initInfo(t),I.log("HlsTagPlayer(".concat(this._id,").startUrl url="),this.url),this.startTs=g.now(),this._stat.setComDim(R.DIM_COM.STREAM_URL,t.url),this._stat.setComDim(R.DIM_COM.P2P,R.LIVE_TYPE.HLS),this._stat.setComDim(R.DIM_COM.STREAM_TYPE,3),this._stat.setComDim(R.DIM_COM.HLS_TYPE,t.isLhls?2:1);var e=t.vid||O.getQueryString("vid",t.url);this.statVod.setComDim(R.DIM_COM.STREAM_URL,t.url),this.statVod.setComDim(R.DIM_COM.STREAM_TYPE,3),this.statVod.setComDim(R.DIM_COM.P2P,R.LIVE_TYPE.HLS),this.statVod.setComDim(R.VOD_DIM_COM.VOD_DURATION,t.duration||0),this.statVod.setComDim(R.VOD_DIM_COM.VOD_VIDEOSOURCEID,e||""),this.statVod.setComDim(R.VOD_DIM_COM.VODANCHORID,t.presenterUid||0),tP.add(this.onCheckTimer,this,1e3),this._videoElm=this._createVideo(this.url),t.seekTime&&(this.seekTime=t.seekTime,this.isSeek=!0),this._addEvents()}},{key:"_checkUrlActive",value:function(){var t=this,e=new XMLHttpRequest;e.open("HEAD",this.url),e.onreadystatechange=function(){e.readyState==e.DONE&&(t.urlNetworkstate=e.status,I.log("HlsTagPlayer(".concat(t._id,").checkUrlActive current status: "),t.urlNetworkstate,t.url))},e.send()}},{key:"_createVideo",value:function(t){if(this._videoElm)return this._videoElm.src=this.url,this._videoElm.getAttribute("x5-autoplay")?this._videoElm.auto
1play=!0:this._videoElm.autoplay&&this._videoElm.setAttribute("x5-autoplay","true"),this._videoElm;var e=document.createElement("video");return e.src=t,e.autoplay=!0,e.setAttribute("playsinline",!0),e.setAttribute("webkit-playsinline",!0),e.setAttribute("webkit-inline",!0),e.setAttribute("x-webkit-airplay","allow"),e.setAttribute("x5-video-player-type","h5"),e.setAttribute("x5-autoplay","true"),e.preload="auto",e}},{key:"_refreshAnticode",value:function(){this.initInfo(this.videoInfo)}},{key:"_addEvents",value:function(){var t=this;this._videoElm&&!this.hasEvents&&(this.hasEvents=!0,this._videoEvts.forEach(function(e){t._videoElm.addEventListener(e,t._videoEvtHandlerBind)}))}},{key:"_delEvents",value:function(){var t=this;this._videoElm&&this.hasEvents&&(this.hasEvents=!1,this._videoEvts.forEach(function(e){t._videoElm.removeEventListener(e,t._videoEvtHandlerBind)}))}},{key:"_videoEvtHandler",value:function(t){switch(I.log("HlsTagPlayer(".concat(this._id,")._videoEvtHandler event: e.type="),t?t.type:t),t.type){case"loadstart":this.onLoadStart();break;case"pause":this.onVideoPause();break;case"loadedmetadata":this.onLoadedmetadata();break;case"loadeddata":this.onPlayVideo();break;case"playing":this.onPlayingVideo();break;case"error":this.onVideoError(t);break;case"ended":this.onEnded();break;case"durationchange":this.onDurationChange()}}},{key:"_updateTime",value:function(){if(!this.ended&&this._videoElm&&this._videoElm.buffered&&this._videoElm.currentTime>0){var t=this._videoElm.buffered;if("function"!=typeof t.start||"function"!=typeof t.end)return void I.warn("HlsTagPlayer(".concat(this._id,")._updateTime video.buffered start&end not a function"));for(var e=0;e<t.length;e++)if(t.start(e)<=this._videoElm.currentTime&&t.end(e)>=this._videoElm.currentTime){var i=t.end(e)-this._videoElm.currentTime;i=i<0?0:i,this._videoElm.duration>0&&this._videoElm.currentTime>=this._videoElm.duration?this._setEnded(3):this.eventEmitter.onPlayTime&&this.eventEmitter.onPlayTime(Math.floor(this._videoElm.currentTime),Math.floor(this._videoElm.duration),Math.floor(i));break}}}},{key:"_setEnded",value:function(t){this.ended||(I.log("HlsTagPlayer(".concat(this._id,")._setEnded, type=").concat(t)),this._reportVideoQuality(!0),this.ended=!0,this._videoElm.currentTime=this._videoElm.duration,this._videoElm.pause(),this.triggerPlayTimeStatus(),this.eventEmitter.onPlayEnded&&this.eventEmitter.onPlayEnded())}},{key:"_checkPause",value:function(t){this.ended||this.sysPause||this.pauseByUser||this._setWaiting(this._pauseStat.waiting)}},{key:"_updateStatus",value:function(t){this.videoStatus!==t&&(I.log("HlsTagPlayer(".concat(this._id,")._updateStatus: ").concat(this.videoStatus," -> ").concat(t)),this.videoStatus=t,this.eventEmitter.trigger(N.PLAY_STATUS,{status:t}))}},{key:"_playVideoFailed",value:function(){if(!p.matches.Wechat||this.isLoadstart){var t="HlsTagPlayer(".concat(this._id,")._playVideoFailed: ")+iM.getErrorMessage(this._videoElm);I.error(t),this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN,{code:L.H5_ERROR_CODE.PLAY_TIMEOUT,error:"play failed"}),tP.remove(this._playVideoFailed,this)}else I.log("HlsTagPlayer(".concat(this._id,")._playVideoFailed webchat not trigger loadstart"))}},{key:"onPlayTimeout",value:function(){this._videoElm&&(I.warn("HlsTagPlayer(".concat(this._id,").onPlayTimeout: userAgent=%s, paused=%s, pauseByUser=%s"),navigator.userAgent,this._videoElm.paused,this.pauseByUser),this._videoElm.paused?this.pauseByUser||this.eventEmitter.trigger(N.VIDEO_PAUSE):p.matches.XiaoMi||0!==this._videoElm.currentTime||this.eventEmitter.trigger(N.PLAY_TIMEOUT))}},{key:"onSeekTimeout",value:function(){I.log("HlsTagPlayer(".concat(this._id,").onSeekTimeout: seekTime=").concat(this.seekTime,", currentTime=").concat(this._videoElm&&this._videoElm.currentTime)),this.seekTime>0&&this.seekTime===this._videoElm.currentTime&&!this.pauseByUser&&(this.seekTime=0,this.eventEmitter.trigger(N.SEEK_TIMEOUT))}},{key:"onCheckTimer",value:function(t,e){0===this._tickTs?this._tickTs=t:t-this._tickTs>=2e4&&(this._tickTs=t,!this.started||this.pauseByUser||this.sysPause||this.ended?I.log("HlsTagPlayer(".concat(this._id,").onCheckTimer: heartbeat fail!{started=").concat(this.started,", pauseByUser=").concat(this.pauseByUser,", sysPause=").concat(this.sysPause,"}")):(I.log("HlsTagPlayer(".concat(this._id,").onCheckTimer: heartbeat suc")),this._reportVideoQuality(!1))),this.ended||this.triggerPlayTimeStatus()}},{key:"onCheckFastTimer",value:function(t,e){!this.playing||this.pauseByUser||this.sysPause||(this._checkPause(t),e%10==0&&this._updateTime())}},{key:"onLoadStart",value:function(){this.eventEmitter.onLoadStart&&this.eventEmitter.onLoadStart(),this.isLoadstart=!0}},{key:"onLoadedmetadata",value:function(){I.log("HlsTagPlayer(".concat(this._id,").onLoadedmetadata, paused="),this._videoElm.paused,this._videoElm.getAttribute("x5-autoplay"))}},{key:"onVideoPause",value:function(){this.sysPause=!0,this.eventEmitter.trigger(N.VIDEO_PAUSE),this._updateStatus(G)}},{key:"onPlayVideo",value:function(){var t=this;if(!this.started&&(this.started=!0,I.log("HlsTagPlayer(".concat(this._id,").onPlayVideo, paused="),this._videoElm.paused,this._videoElm.getAttribute("x5-autoplay"),"currentTime=".concat(this._videoElm.currentTime)),this.eventEmitter.trigger(N.VIDEO_PLAY,{video:this._videoElm}),this.eventEmitter.onPlayVideo&&this.eventEmitter.onPlayVideo({video:this._videoElm}),this.loadeddataTs=g.now()-this.startTs,tP.remove(this.onPlayTimeout,this),this._videoElm.auto
1play||this._videoElm.getAttribute("x5-autoplay"))){var e=this._videoElm.play();e?e.then(function(){I.log("HlsTagPlayer(".concat(t._id,") Auto play is ok")),t.allowedAutoPlay=!0,tP.remove(t._playVideoFailed,t),tP.remove(t._checkUrlActive,t);var e=t._videoElm.duration;t.isSeek&&0!=e&&(I.log("HlsTagPlayer(".concat(t._id,").onPlayVideo, seek, duration=").concat(e)),t.startSeek())}).catch(function(e){I.warn("HlsTagPlayer(".concat(t._id,") auto playing error: "),e.toString(),t._videoElm.paused),t.eventEmitter.trigger(N.BROWSER_PAUSE),t._videoElm.paused&&(t._updateStatus(G),t.allowedAutoPlay=!1,tP.remove(t._playVideoFailed,t),tP.remove(t._checkUrlActive,t),t.eventEmitter.trigger(N.BROWSER_PAUSE,{video:t._videoElm}))}):(I.warn("HlsPlayer(".concat(this._id,") video.play is not a promise")),p.matches.UC&&this._videoElm.paused?(I.log("HlsPlayer(".concat(this._id,") UC Browser, this._videoElm.paused ="),this._videoElm.paused),this._updateStatus(G),this.eventEmitter.trigger(N.BROWSER_PAUSE),this.allowedAutoPlay=!1,tP.remove(this._playVideoFailed,this),tP.remove(this._checkUrlActive,this),this.eventEmitter.trigger(N.BROWSER_PAUSE,{video:this._videoElm}),!this.isLive&&this._videoElm&&this._videoElm.pause()):tP.once(this.onPlayTimeout,this,this.playTimeout||2e3))}}},{key:"onPlayingVideo",value:function(){if(I.log("HlsTagPlayer(".concat(this._id,").onPlayingVideo, paused="),this._videoElm.paused,this._videoElm.getAttribute("x5-autoplay")),this.sysPause=!1,this.ended=!1,this._updateStatus(U),!this.playing){this.playing=!0,this._pauseStat.start(this._videoElm),tP.add(this.onCheckFastTimer,this,100),this.playTs=g.now();var t=this.playTs-this.startTs;t<=1e4&&(this._sendVideoLoadMetrics(t,this.loadeddataTs),this._sendVideoVodLoad(t)),tP.remove(this._playVideoFailed,this)}}},{key:"onDurationChange",value:function(){var t=this._videoElm.duration;this.isSeek&&0!=t&&this.started&&(I.log("HlsTagPlayer(".concat(this._id,").onDurationChange seek, duration=").concat(t)),this.startSeek())}},{key:"onVideoError",value:function(t){I.log("HlsTagPlayer(".concat(this._id,").onVideoError: ")+iM.getErrorMessage(this._videoElm),t),this._videoElm&&this._videoElm.error&&(this._checkUrlActive(this.url),this.isPlaying||this._sendVideoVodLoad(99999),this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN,{code:L.H5_ERROR_CODE.VIDEO_ERROR,video:this._videoElm,error:t}),this.eventEmitter.onPlayerError&&this.eventEmitter.onPlayerError())}},{key:"onEnded",value:function(t){I.log("HlsTagPlayer(".concat(this._id,").onEnded"),this.getCurrentTime()),this._setEnded(2)}},{key:"startSeek",value:function(){this.setCurrentTime(this.seekTime),this.isSeek=!1}},{key:"_sendVideoLoadMetrics",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._stat.setComDim(R.DIM_COM.ACT_LOAD_TYPE,L.HLS_LOAD_TYPE.XHR);var i=[this._stat.createAct(R.ACT.VIDEO_LOAD_TS,{value:[t,e]})];this._tsdb.sendMetrics(i)}},{key:"sendNoPicture",value:function(){I.log("HlsTagPlayer(".concat(this._id,").sendNoPicture hasPicture=").concat(this.hasPicture," isLive=").concat(this.isLive)),this.hasPicture||this.isLive||(this.statVod.setActDim(R.VOD_DIM_COM.CREATE_TIME,g.now()-this.statVod.create_time),this._tsdb.sendVodMP4Time({loadTime:99999,errorMessage:iM.getErrorMessage(this._videoElm)}))}},{key:"_sendVideoVodLoad",value:function(t){this.isLive||this.videoLoadTimeSent||(this.videoLoadTimeSent=!0,I.log("HlsTagPlayer(".concat(this._id,")._sendVideoVodLoad"),t),this.statVod.setActDim(R.VOD_DIM_COM.CREATE_TIME,g.now()-this.statVod.create_time),this.hasPicture||(t=99999),this._tsdb.sendVodMP4Time({loadTime:t}))}},{key:"_setWaiting",value:function(t){if(this.waiting!==t){this.waiting=t,this.eventEmitter.trigger(N.PLAY_CARTON,t);var e=t?H:U;this._updateStatus(e)}}},{key:"_reportVideoQuality",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=[];this._stat.setCore(R.CORE.PLAY_DELAY,this.getBufferLen()),this._stat.setCore(R.CORE.VIDEO_BLOCK_COUNT,this._pauseStat._badQualityCnt),this._stat.setCore(R.CORE.VIDEO_BLOCK_DURATION,this._pauseStat._badQualityTime),this._stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_QUALITY,100*!!this._pauseStat.paused),this.statVod.setCore(R.VOD_CORE.VOD_BAD_QUALITY,100*!!this._pauseStat.paused),this.statVod.setCore(R.VOD_CORE.VOD_BLOCK_COUNT,this._pauseStat._badQualityCnt),this.statVod.setCore(R.VOD_CORE.VOD_BLOCK_DURATION,this._pauseStat._badQualityTime),this._stat.fill(e,t),this.isLive||this.statVod.fill(e,t),this._tsdb.sendMetrics(e),this._pauseStat.checkBadQuality(),this._pauseStat.reset20()}},{key:"setMuted",value:function(t){this._videoElm&&(this._videoElm.muted=t)}},{key:"getCodecType",value:function(){return tX}},{key:"getVideoWidth",value:function(){return this._videoElm?this._videoElm.videoWidth:0}},{key:"getVideoHeight",value:function(){return this._videoElm?this._videoElm.videoHeight:0}},{key:"getFps",value:function(){return -100}},{key:"setPlaybackRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this._videoElm&&(this._videoElm.playbackRate=Number(t))}}]),t}(),rv=function(){function t(){Object(s.a)(this,t),this._ignoreMap=new Map,this._ignoreDefault=!1,this.initLv()}return Object(r.a)(t,[{key:"destroy",value:function(){this._ignoreMap&&(this._ignoreMap.clear(),this._ignoreMap=null)}},{key:"addStreamUrl",value:function(t,e){var i=F.statLv;O.isOpen(F.statCfg,t,e,!1)&&i[2]>0&&this._ignoreMap.set(R.DIM_COM.STREAM_URL,1)}},{key:"initLv",value:function(t,e){this._ignoreDefault=!1,this._ignoreMap.clear();var i=F.statLv,s=O.isOpen(F.statCfg,t,e,!1);if(I.log("StatFilter.init isOpen=".concat(s," statLv=").concat(i)),s){this._ignoreDefault=1===i[0];var r=this._ignoreMap;r.clear(),i[1]>0&&(r.set(R.DIM_CORE.VIDEO_BAD_QUALITY_OLD,1),r.set(R.DIM_COM.P2P_COOL_FLAG,1),r.set(R.DIM_COM.ACT_LOAD_TYPE,1)),i[2]>0&&(i[2]>1&&r.set(R.DIM_COM.STREAM,1),r.set(R.DIM_COM.CDP_ID,1)),i[3]>0&&(i[3]>1&&(r.set(R.DIM_COM.V_RECV_FRAMES,1),r.set(R.DIM_COM.V_RECV_FRAME,1),r.set(R.DIM_COM.V_PLAY_FRAME,1),r.set(R.DIM_COM.V_TO_PLAY_FRAME,1),r.set(R.DIM_COM.VISIBILITY_STATE,1)),r.set(R.DIM_COM.VIDEO_PAUSE_BUFFERS,1),r.set(R.DIM_COM.VIDEO_PAUSE_CONTINUE_BUFFERS,1),r.set(R.DIM_LINK_STA.
1name,1),r.set(R.DIM_LINK_SAM.name,1),r.set(R.FRAME_INFO.name,1)),i[4]>0&&r.set(R.AI_CONTROL_DATA.name,1),i[5]>0&&(i[5]>1&&(r.set(R.SUB_INFO.name,1),r.set(R.PUNCH_INFO.name,1)),r.set(R.CORE.FORWARD_REJECT_CNT,1),r.set(R.DIM_COM.SUB_CHANGE_STATE,1),r.set(R.UPDOWN_INFO.name,1),r.set(R.PUNCH_BACK_RET.name,1),r.set(R.SUBSTREAM_INFO.name,1),r.set(R.FORCESUB_REASON.name,1),r.set(R.SUB_RETURN.name,1),r.set(R.NONODE_RETURN.name,1),r.set(R.P2P_TCP_TYPE.name,1),r.set(R.P2P_TCP_STATE.name,1)),i[6]>0&&(r.set(R.DIM_COM.BROWSER_NAME,1),r.set(R.DIM_COM.BROWSER_VERSION,1),r.set(R.DIM_COM.BROWSER_KERNEL,1),r.set(R.DIM_COM.BROWSER_KERNEL_VERSION,1),r.set(R.DIM_COM.OS_NAME,1),r.set(R.DIM_COM.OS_VERSION,1),r.set(R.DIM_COM.RENDER_INFO,1)),i[7]>0&&(r.set(R.DIM_COM.STREAM_INDEX,1),r.set(R.DIM_COM.OBS_RENDER_MODE,1),r.set(R.CORE.OBS_FPS,1),r.set(R.CORE.OBS_UPLOAD_TS,1)),i[8]>0&&(r.set(R.DIM_COM.VR_ENABLE,1),r.set(R.DIM_COM.VR_MODE,1)),i[9]>0&&(r.set(R.DIM_COM.CDN_CIP,1),r.set(R.DIM_COM.CDN_SIP,1),r.set(R.DIM_COM.ALT_SVC,1),r.set(R.DIM_COM.QUIC,1)),i[10]>0&&(i[10]>3&&(r.set("pcdn_hot_degree_in",1),r.set("pcdn_hot_degree_kick",1),r.set("pcdn_hot_degree",1),r.set("get_pcdn_url_result",1),r.set(R.DIM_COM.CLI_ISP,1),r.set(R.DIM_COM.CLI_PROV,1),r.set(R.DIM_COM.PCDN_SVR_ISP,1),r.set(R.DIM_COM.PCDN_SVR_AREA,1)),i[10]>2&&(r.set(R.PCDN_DATA.GET_PCDN_URL_TOTAL_CNT,1),r.set(R.PCDN_DATA.GET_PCDN_URL_SUCCESS,1),r.set(R.PCDN_DATA.GET_PCDN_URL_SUC_FREETIME,1),r.set(R.PCDN_DATA.GET_PCDN_ERR_NOT_REACHED,1),r.set(R.PCDN_DATA.GET_PCDN_ERR_OVER_RUN,1),r.set(R.PCDN_DATA.GET_PCDN_ERR_OVER_RUN_FREETIME,1),r.set(R.PCDN_DATA.GET_PCDN_ERR_NOT_COVERD,1),r.set(R.PCDN_DATA.GET_PCDN_ERR_OTHER,1),r.set(R.PCDN_DATA.GET_PCDN_ERROR_REQ,1),r.set(R.PCDN_DATA.GET_SUBS_URL_ERROR_CNT,1),r.set(R.PCDN_DATA.GET_PCDN_DATA_TIME,1),r.set(R.PCDN_DATA.GET_PCDN_DATA_TIME_CNT,1),r.set(R.PCDN_DATA.GET_PCDN_SUBS_URL_TIME,1),r.set(R.PCDN_DATA.GET_PCDN_SUBS_URL_TIME_CNT,1),r.set(R.PCDN_DATA.GET_CDN_DATA_TIME,1),r.set(R.PCDN_DATA.GET_CDN_DATA_TIME_CNT,1)),i[10]>1&&(r.set(R.DIM_COM.SUB_PCDN_STATE,1),r.set(R.DIM_COM.FLV_PCDN_STATE,1)),r.set("pcdn_pull_stream_user_cnt",1),r.set("pcdn_get_proxy_user_cnt",1),r.set(R.PCDN_BW_DATA.name,1)),i[11]>0&&(i[11]>1&&(r.set(R.CORE.REAL_KBPS_SAMPLE,1),r.set(R.CORE.REAL_FLAC_KBPS_SAMPLE,1),r.set(R.CORE.RECV_TOTAL_SAMPLE,1),r.set(R.CORE.RECV_LAN_SAMPLE,1)),r.set(R.DIM_COM.AUTO_U_REASON,1),r.set(R.DIM_COM.AUTO_D_REASON,1),r.set(R.DIM_COM.AUTO_HEART_TYPE,1),r.set(R.DIM_COM.AUTO_CODEC_CHANGE_TYPE,1),r.set(R.DIM_COM.AUTO_BAD_REASON,1),r.set(R.DIM_COM.AUTO_BAD_MIN_REASON,1),r.set(R.CORE.AUTO_SWITCH_CNT,1),r.set(R.CORE.AUTO_SWITCH_SAME_CNT,1),r.set(R.CORE.AUTO_BAD_QUALITY,1),r.set(R.CORE.AUTO_BAD_QUALITY_UP,1),r.set(R.CORE.AUTO_BAD_DURATION,1),r.set(R.CORE.AUTO_BAD_DURATION_UP,1),r.set(R.CORE.AUTO_BAD_SWITCH,1),r.set(R.CORE.AUTO_BAD_SWITCH_SAME,1),r.set(R.CORE.AUTO_BAD_SWITCH_UP,1),r.set(R.CORE.AUTO_BAD_DONE,1),r.set(R.CORE.AUTO_BAD_BUFFER,1),r.set(R.CORE.AUTO_CONTINUE_BUFFER,1),r.set(R.AUTO_INFO.name,1)),1===i[12]&&(r.set(R.CORE.SVR_DELAY_INFOS,1),r.set(R.CORE.DELAY_NODE_INFO,1),r.set(R.CORE.SVR_LAST_P_DELAY,1)),1===i[13]&&r.set(R.HLS_INFO.name,1),i[14],1===i[16]&&(r.set(R.VIDEO_LINK.PVSSC,1),r.set(R.VIDEO_LINK.PVFSC,1),r.set(R.VIDEO_LINK.PVLSC,1),r.set(R.VIDEO_LINK.PVLFC,1),r.set(R.VIDEO_LINK.PVPFC,1),r.set(R.VIDEO_LINK.PVPTC,1),r.set(R.VIDEO_LINK.PVPAFC,1),r.set(R.VIDEO_LINK.PVRFC,1))}}},{key:"checkFilter",value:function(t){var e=this;t.forEach(function(t){e.filterObj(t.vField),e.filterObj(t.vDimension),e.filterObj(t.vExLog)})}},{key:"filterObj",value:function(t){var e=[];for(var i in t)(0===t[i]||""===t[i]&&this._ignoreDefault||this._ignoreMap.has(i))&&e.push(i);for(var s=0;s<e.length;s++)delete t[e[s]]}}],[{key:"fillterMetrics",value:function(t,e,i,s,r){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:[];if(1===F.statIgnoreOpen){var n=[];t.forEach(function(t){-1!==t.sMetricName.indexOf("heart")?(s.forEach(function(e){-1===r.indexOf(e)&&(t.vField.hasOwnProperty(e)?delete t.vField[e]:t.vDimension.hasOwnProperty(e)&&delete t.vDimension[e])}),n.push(t)):-1!==t.sMetricName.indexOf("act")&&(-1!==e.indexOf(t.vDimension.act_type)&&-1===i.indexOf(t.vDimension.act_type)||n.push(t)),a.forEach(function(e){t.vField[e]=""})}),t.splice.apply(t,[0,t.length].concat(n))}}}]),t}(),rS=function(){function t(){Object(s.a)(this,t),this.comDim=new Map,this.coreDim=new Map,this.actDim=new Map,this.extDim=new Map,this.comFormatMap=new Map,this.coreMap=new Map,this.compMap=new Map,this.keyvalCoreDimMap=new Map,this.heart_type=R.HEART_TYPE.START,this.recordTs=this.create_time=g.now(),this.filter=new rv}return Object(r.a)(t,[{key:"destroy",value:function(){this.comDim&&(this.comDim.clear(),this.coreDim.clear(),this.actDim.clear(),this.extDim.clear(),this.comFormatMap.clear(),this.coreMap.clear(),this.compMap.clear(),this.keyvalCoreDimMap.clear(),this.filter.destroy(),this.comDim=null,this.coreDim=null,this.actDim=null,this.extDim=null,this.comFormatMap=null,this.coreMap=null,this.compMap=null,this.keyvalCoreDimMap=null,this.filter=null)}},{key:"startRecord",value:function(){this.recordTs=g.now()}},{key:"checkFilter",value:function(t){this.filter.checkFilter(t),rv.fillterMetrics(t,F.statIgnoreActsSdk,F.statHoldActsSdk,F.statIgnoreFieldsSdk,F.statHoldFieldsSdk)}},{key:"setCreateTime",value:function(t){isNaN(t)||(this.create_time=t)}},{key:"reset",value:function(){this.comDim.clear(),this.coreDim.clear(),this.actDim.clear(),this.extDim.clear(),this.coreMap.clear(),this.compMap.clear(),this.keyvalCoreDimMap.clear(),this.heart_type=R.HEART_TYPE.START,this.create_time=g.now()}},{key:"clearFill",value:function(){this.coreDim.clear(),this.extDim.clear(),this.coreMap.clear(),this.compMap.clear(),this.keyvalCoreDimMap.clear()}},{key:"createAct",value:function(t,e){return this._createAct(t,e)}},{key:"createActs",value:function(t){var e=[];
1if(t)for(var i=0;i<t.length;i++){var s=t[i],r=this._createAct(s.type,s.params);e.push(r)}return e}},{key:"_createAct",value:function(t,e){var i={sMetricName:R.ACT.name,vField:{},vDimension:{}};if(i.vDimension[R.ACT.field]=t,i.vDimension[R.DIM_CORE.CREATE_TIME]=g.now()-this.create_time,this._fillFromMap(i.vDimension,this.comDim),this._fillFromMap(i.vDimension,this.actDim),e){var s=0;if(e.hasOwnProperty(R.KEY_VALUE)){var r=e[R.KEY_VALUE];for(s=0;s<r.length;s++)i.vField[R.KEY_VALUE+(s+1)]=r[s]}if(e.hasOwnProperty(R.KEY_STR)){var a=e[R.KEY_STR];for(s=0;s<a.length;s++)i.vDimension[R.KEY_STR+(s+1)]=a[s]}e.hasOwnProperty(R.KEY_DIM)&&Object.assign(i.vDimension,e[R.KEY_DIM])}return i.vDimension.appid=w.appid,this.actDim.clear(),i}},{key:"fill",value:function(t,e){e?(this.heart_type=R.HEART_TYPE.END,this._fill(t),this.heart_type=R.HEART_TYPE.START):this._fill(t)}},{key:"fillAnticode",value:function(t){this.coreMap.set(R.CORE.HTD,g.now()-this.recordTs+1),this.heart_type=R.HEART_TYPE.START,this._fill(t)}},{key:"_fill",value:function(t){if(0!=this.coreMap.size||0!=this.compMap.size){var e={sMetricName:R.CORE.name,vField:{},vDimension:{},vExLog:{}},i=g.now();this.coreMap.set(R.CORE.HTD,i-this.recordTs),this.recordTs=i,this.coreDim.set(R.DIM_CORE.HEART_TYPE,this.heart_type),this._fillFromMap(e.vDimension,this.comDim),this._fillFromMap(e.vDimension,this.coreDim),this._fillFromMap(e.vExLog,this.extDim),this._fillFromMap(e.vField,this.coreMap),this._fillComp(e.vDimension),this.coreDim.clear(),this.extDim.clear(),this.coreMap.clear(),this.compMap.clear(),this.heart_type==R.HEART_TYPE.START&&(this.heart_type=R.HEART_TYPE.CONTINUS),e.vDimension.appid=w.appid,t.push(e)}}},{key:"_fillComp",value:function(t){var e,i=Object(Q.a)(this.compMap.keys());try{for(i.s();!(e=i.n()).done;){var s,r=e.value,a=this._getCompMapFormat(r),n=a.get("ref")||",",o=a.get("split")||";",u=this.compMap.get(r),l="",d=Object(Q.a)(u.keys());try{for(d.s();!(s=d.n()).done;){var c=s.value;l.length>0&&(l+=o),l+=c+n+u.get(c)}}catch(t){d.e(t)}finally{d.f()}t[r]=l}}catch(t){i.e(t)}finally{i.f()}}},{key:"_fillFromMap",value:function(t,e){var i,s=Object(Q.a)(e.keys());try{for(s.s();!(i=s.n()).done;){var r=i.value;t[r]=e.get(r)}}catch(t){s.e(t)}finally{s.f()}}},{key:"_fillFromKeyvalMap",value:function(t,e){var i,s=Object(Q.a)(e.keys());try{for(s.s();!(i=s.n()).done;){for(var r=i.value,a=e.get(r),n=a.entries(),o="",u=0;u<a.size;u++){var l=n.next().value;o+="".concat(l[0],":").concat(l[1]),u<a.size-1&&(o+=",")}a.clear(),t[r]=o}}catch(t){s.e(t)}finally{s.f()}}},{key:"getComDim",value:function(t){return this.comDim.get(t)}},{key:"setComDim",value:function(t,e){this.comDim.set(t,e)}},{key:"setCoreDim",value:function(t,e){this.coreDim.set(t,e)}},{key:"addCoreDim",value:function(t,e){this._addValue(this.coreDim,t,e)}},{key:"addKeyvalCoreDim",value:function(t,e){this._addKeyvalValue(this.keyvalCoreDimMap,t,e)}},{key:"setActDim",value:function(t,e){this.actDim.set(t,e)}},{key:"setExtDim",value:function(t,e){this.extDim.set(t,e)}},{key:"delDim",value:function(t){this.comDim.has(t)?this.comDim.delete(t):this.coreDim.has(t)?this.coreDim.delete(t):this.actDim.has(t)&&this.actDim.delete(t)}},{key:"setCore",value:function(t,e){this.coreMap.set(t,e)}},{key:"addCore",value:function(t,e){this._addValue(this.coreMap,t,e)}},{key:"setComp",value:function(t,e,i){this._getCompMap(t).set(e,i)}},{key:"addComp",value:function(t,e,i){var s=this._getCompMap(t);this._addValue(s,e,i)}},{key:"setCompFormat",value:function(t,e,i){var s=this._getCompMapFormat(t);s.set("ref",e),s.set("split",i)}},{key:"_getCompMapFormat",value:function(t){if(this.comFormatMap.has(t))return this.comFormatMap.get(t);var e=new Map;return this.comFormatMap.set(t,e),e}},{key:"_getCompMap",value:function(t){if(this.compMap.has(t))return this.compMap.get(t);var e=new Map;return this.compMap.set(t,e),e}},{key:"_addValue",value:function(t,e,i){if(t.has(e)){var s=t.get(e);t.set(e,s+i)}else t.set(e,i)}},{key:"_addKeyvalValue",value:function(t,e,i){if(t.has(e)){var s=t.get(e),r=i.split(":");if(!(r.length<2)){var a=r[0],n=Number(r[1]);if(s.has(a)){var o=s.get(a);s.set(a,o+n)}else s.set(a,n)}}else{var u=i.split(":");if(u.length<2)return;var l=new Map,d=u[0],c=Number(u[1]);l.set(d,c),t.set(e,l)}}}]),t}(),rg=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){return Object(s.a)(this,i),e.call(this)}return Object(r.a)(i,[{key:"_createAct",value:function(t,e){var i={sMetricName:R.VOD_ACT.name,vField:{},vDimension:{}};if(i.vDimension[R.ACT.field]=t,this._fillFromMap(i.vDimension,this.comDim),this._fillFromMap(i.vDimension,this.actDim),e){var s=0;if(e.hasOwnProperty(R.KEY_VALUE)){var r=e[R.KEY_VALUE];for(s=0;s<r.length;s++)0===s?i.vField[R.KEY_VALUE]=r[s]:i.vField[R.KEY_VALUE+s]=r[s]}if(e.hasOwnProperty(R.KEY_STR)){var a=e[R.KEY_STR];for(s=0;s<a.length;s++)i.vDimension[R.KEY_STR+(s+1)]=a[s]}e.hasOwnProperty(R.KEY_DIM)&&Object.assign(i.vDimension,e[R.KEY_DIM])}return i.vDimension.appid=w.appid,this.actDim.clear(),i}},{key:"_fill",value:function(t){if(0!=this.coreMap.size||0!=this.compMap.size){var e={sMetricName:R.VOD_CORE.name,vField:{},vDimension:{},vExLog:{}};this.coreDim.set(R.DIM_CORE.HEART_TYPE,this.heart_type),this._fillFromMap(e.vDimension,this.comDim),this._fillFromMap(e.vDimension,this.coreDim),this._fillFromKeyvalMap(e.vDimension,this.keyvalCoreDimMap),this._fillFromMap(e.vExLog,this.extDim),this._fillFromMap(e.vField,this.coreMap),this._fillComp(e.vDimension),this.coreDim.clear(),this.extDim.clear(),this.coreMap.clear(),this.compMap.clear(),this.keyvalCoreDimMap.clear(),this.heart_type==R.HEART_TYPE.START&&(this.heart_type=R.HEART_TYPE.CONTINUS),e.vDimension.appid=w.appid,t.push(e)}}}]),i}(rS),rT=i(15),rP=i.n(rT);window.AudioContext=window.AudioContext||window.webkitAudioContext||window.mozAudioContext||window.msAudioContext;var rC=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).audioContext=null,t.playing=!1,t.audio=null,t.analyser=null,t.source=null,t.timer=0,t}return Object(r.a)(i,[{key:"reset",value:function(){this.playing=!1}},{key:"createAudioContext",value:function(t){if(t)try{this.audio!=t&&(this.audio=t,this.audioContext=new AudioContext,this.source=this.audioContext.createMediaElementSource(t),this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048,this.source.connect(this.analyser),this.analyser.connect(this.audioContext.destination)),this.playing=!0,this.loop(2e3)}catch(t){I.log("createAudioContext err:"+t)}}},{key:"loop",value:function(t){if(this.playing&&this.analyser&&this.analyser.fftSize){this.audio&&!this.audio.error&&this.playing&&(clearTimeout(this.timer),this.timer=setTimeout(this.loop.bind(this),t,t));var e=new Uint8Array(this.analyser.fftSize);this.analyser.getByteFrequencyData(e),e.some(function(t){return t}
1)?this.emit(i.AUDIO_FREQUENCY,{value:1}):this.emit(i.AUDIO_FREQUENCY,{value:0})}}}]),i}(rT.EventEmitter);rC.AUDIO_FREQUENCY="AUDIO_FREQUENCY";var rE=[N.H264_SEI_PLAY,N.AUDIO_SOUND,N.SIGNAL_DATA,N.UPDATE_INTERSITY,N.SIGNAL_HEART,N.METADATA,N.TRANS_END,N.PLAY_DOWNLINK_INFO,N.PLAY_FRAME_BUFFER,N.PLAY_TIME_STATUS,N.PLAYBACK_UPDATE,N.PLAYBACK_M3U8_UPDATED,N.SEI_INFO,"VIDEO_TIMEUPDATE","VIDEO_PROGRESS",N.VIDEO_TAG_SEEKED,N.VIDEO_TAG_PLAYING,N.VIDEO_TAG_PROGRESS,N.VIDEO_TAG_CANPLAY,N.VIDEO_TAG_PAUSE,N.VIDEO_TAG_LOADSTART,N.VIDEO_TAG_PLAY],rI=i(24),rk=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;return Object(s.a)(this,i),(r=e.call(this,a)).duration=t,r.lastTs=0,r}return Object(r.a)(i,[{key:"addCur",value:function(t,e){Object(n.a)(Object(o.a)(i.prototype),"addCur",this).call(this,t,e),this.samples.addCur(t),this.calculate(e)}},{key:"calculate",value:function(t){0===this.lastTs?this.lastTs=t:t-this.lastTs>=this.duration&&(this.lastTs=t,this.samples.calculate())}},{key:"onCheckFastTimer",value:function(t,e){this.calculate(t)}}]),i}(tx),rA=function(){function t(){Object(s.a)(this,t),this.recvTotalSample=new rk(1e3),this.recvLanSample=new rk(1e3),this.realFlacSample=new tH}return Object(r.a)(t,[{key:"destroy",value:function(){this.recvTotalSample.reset(),this.recvLanSample.reset(),this.realFlacSample.reset()}},{key:"start",value:function(){tP.add(this.onCheckFastTimer,this,100)}},{key:"stop",value:function(){tP.remove(this.onCheckFastTimer,this)}},{key:"onCheckFastTimer",value:function(t,e){this.recvTotalSample.onCheckFastTimer(t,e),this.recvLanSample.onCheckFastTimer(t,e)}},{key:"addTotalSample",value:function(t){this.recvTotalSample.addCur(t,g.now())}},{key:"recordStat",value:function(t,e){this._recordStat(t,R.CORE.RECV_TOTAL_SAMPLE,this.recvTotalSample,!0,e),this._recordStat(t,R.CORE.RECV_LAN_SAMPLE,this.recvLanSample,!0,e),this._recordStat(t,R.CORE.REAL_FLAC_KBPS_SAMPLE,this.realFlacSample)}},{key:"_recordStat",value:function(t,e,i,s,r){if(i.hasSample){var a=i.getResult();""!==a&&(i.reset(),s?t.setCoreDim(e,"type:".concat(r?2:t.heart_type,",").concat(a)):t.setCoreDim(e,a))}}},{key:"addLanSample",value:function(t){this.recvLanSample.addCur(t,g.now())}}]),t}(),rR=function(){function t(e){Object(s.a)(this,t),this._name=e,this._noRenderCnt=0,this._noRenderDur=0,this._noRenderDurMax=0,this._lastRenderTs=g.now(),this._noRenderDurCfg=F.noRenderDur||500}return Object(r.a)(t,[{key:"getStats",value:function(){return{noRenderCnt:this._noRenderCnt,noRenderDur:this._noRenderDur,noRenderDurMax:this._noRenderDurMax,text:"".concat(this._name,":").concat(this._noRenderCnt,"_").concat(this._noRenderDur,"_").concat(this._noRenderDurMax)}}},{key:"clearStat",value:function(){this._noRenderCnt=0,this._noRenderDur=0,this._noRenderDurMax=0}},{key:"resetRender",value:function(){this._lastRenderTs=g.now()}},{key:"checkNoRender",value:function(t){var e=g.now(),i=e-this._lastRenderTs;i>=this._noRenderDurCfg&&(this._noRenderCnt++,this._noRenderDur+=i,this._noRenderDurMax<i&&(this._noRenderDurMax=i)),t&&(this._lastRenderTs=e)}}]),t}(),rD=function(){function t(){Object(s.a)(this,t),this._hisStats=[],this._curStat=null,this._hidden=-1,this.checkHidden()}return Object(r.a)(t,[{key:"destroy",value:function(){this._hisStats=null,this._curStat=null}},{key:"isVisible",value:function(){return 0===this._hidden}},{key:"checkHidden",value:function(){var t=+(document.visibilityState===L.VISIBILITY_STATE.HIDDEN);if(this._hidden!==t){var e=this._hidden;this._hidden=t,-1!==e&&(t?this.toHiddenCallback():this.toVisibleCallback())}}},{key:"getStats",value:function(){for(var t={noRenderCnt:0,noRenderDur:0,noRenderDurMax:0,noRenderStreams:[]},e=this._hisStats.length,i=0;i<e;i++){var s=this._hisStats[i];this._getStat(s,t)}return this._hisStats=[],this._curStat&&(this._getStat(this._curStat,t),this._curStat.clearStat()),t}},{key:"_getStat",value:function(t,e){if(t){var i=t.getStats();e.noRenderCnt+=i.noRenderCnt,e.noRenderDur+=i.noRenderDur,e.noRenderDurMax<i.noRenderDurMax&&(e.noRenderDurMax=i.noRenderDurMax),e.noRenderStreams.push(i.text)}}},{key:"recordCurStat",value:function(){this._curStat&&(this.isVisible()&&this._curStat.checkNoRender(!1),this._hisStats.push(this._curStat),this._curStat=null)}},{key:"reset",value:function(){this._curStat=null,this._hisStats=[]}},{key:"start",value:function(t){this._curStat=new rR(t)}},{key:"renderCallback",value:function(){this.isVisible()&&this._curStat&&this._curStat.checkNoRender(!0)}},{key:"statCallback",value:function(){this.isVisible()&&this._curStat&&this._curStat.checkNoRender(!0)}},{key:"toHiddenCallback",value:function(){this._curStat&&this._curStat.checkNoRender(!0)}},{key:"toVisibleCallback",value:function(){this._curStat&&this._curStat.resetRender()}},{key:"exitCallback",value:function(){this.isVisible()&&this._curStat&&this._curStat.checkNoRender(!0)}}]),t}(),rO=function(){function t(e){Object(s.a)(this,t),this.handler=e,this.sessionId=this.handler.sdkInRoomTs,this.anchoruid=0,this.busi_play=!1,this.busi_stop=!1,this.bLive=!1,this.line=0,this.coderate=0,this.h265=0,this.p2p=0,this.lastStream="",this.startTs=-1,this._lastTs=-1,this.supported=!0,this.pfps=0,this.pfpsMin=0,this.pfpsMax=0,this.roomNoRenderStatV1=new rD,this._noRenderMetricTime=F.noRenderMetricTime||6e4,this._noRenderValidTime=F.noRenderValidTime||1e3,this.onBeforeUnloadBind=this.onBeforeUnload.bind(this)}return Object(r.a)(t,[{key:"destroy",value:function(){window.removeEventListener("beforeunload",this.onBeforeUnloadBind),tP.remove(this.onCheckTimer,this),this.roomNoRenderStatV1=null,this.handler=null}},{key:"setPageFps",value:function(t){var e=t.pfps,i=t.pfpsMin,s=t.pfpsMax;this.pfps=e,this.pfpsMax=s,this.pfpsMin=i}},{key:"setLive",value:function(t){this.bLive=t,this.start()}},{key:"setBusiPlay",value:function(){this.busi_play=!0,this.busi_stop=!1}},{key:"setBusiStop",value:function(){this.busi_stop=!0}}
1,{key:"startStream",value:function(t,e,i,s,r){if(this.supported){this.start();var a="".concat(e,"_").concat(i,"_").concat(s,"_").concat(r);if(this.lastStream!==a){var n=g.now();if(this._lastTs>0){var o=n-this._lastTs;o>F.noRenderDur&&(this.roomNoRenderStatV1.recordCurStat(),this.sendMetric(o))}this._lastTs=n,this.roomNoRenderStatV1.reset(),this.roomNoRenderStatV1.start("".concat(e,"_").concat(i,"_").concat(s,"_").concat(r))}this.lastStream=a,this.anchoruid=t,this.line=e,this.coderate=i,this.h265=+("h265"===s),this.p2p=+("p2p"===r)}else I.log("RoomRecord startStream fail, not supported!")}},{key:"start",value:function(){this.supported?(window.addEventListener("beforeunload",this.onBeforeUnloadBind),-1===this.startTs&&(this._lastTs=this.startTs=g.now(),this.lastStream="init",this.roomNoRenderStatV1.start("init"),tP.add(this.onCheckTimer,this,100))):I.log("RoomRecord start fail, not supported!")}},{key:"stop",value:function(){this.startTs=-1,window.removeEventListener("beforeunload",this.onBeforeUnloadBind),tP.remove(this.onCheckTimer,this)}},{key:"sendMetric",value:function(t){if(-1!==this.startTs){var e={sMetricName:R.ROOM_HEART60.name,vDimension:{},vExLog:{},vField:{}};e.vDimension[R.ROOM_HEART60.SESSION_ID]=this.sessionId,e.vDimension[R.ROOM_HEART60.ANCHORUID]=this.anchoruid,e.vDimension[R.ROOM_HEART60.LINE]=this.line,e.vDimension[R.ROOM_HEART60.CODERATE]=this.coderate,e.vDimension[R.ROOM_HEART60.H265]=this.h265,e.vDimension[R.ROOM_HEART60.P2P]=this.p2p,e.vDimension[R.ROOM_HEART60.BLIVE]=+!!this.bLive,e.vDimension[R.ROOM_HEART60.BUSI_PLAY]=+!!this.busi_play,e.vDimension[R.ROOM_HEART60.BUSI_STOP]=+!!this.busi_stop,e.vDimension[R.DIM_COM.BROWSER_KERNEL]=S.name,e.vDimension[R.DIM_COM.BROWSER_KERNEL_VERSION]=S.version.major,e.vDimension[R.DIM_COM.HARDWARE_CONCURRENCY]=navigator.hardwareConcurrency||0,e.vDimension[R.DIM_COM.RENDER_INFO]=tz(),e.vDimension[R.DIM_COM.VISIBILITY_STATE]=document.visibilityState,e.vDimension[R.DIM_CORE.PFPS]=this.pfps,e.vDimension[R.DIM_CORE.PFPSMAX]=this.pfpsMax,e.vDimension[R.DIM_CORE.PFPSMIN]=this.pfpsMin;var i=this.roomNoRenderStatV1.getStats();e.vField[R.ROOM_HEART60.DURATION]=t,e.vField[R.ROOM_HEART60.RNR_CNT]=i.noRenderCnt,e.vField[R.ROOM_HEART60.RNR_DUR]=i.noRenderDur,e.vField[R.ROOM_HEART60.RNR_DUR_MAX]=i.noRenderDurMax,e.vDimension[R.ROOM_HEART60.SNR_INFOS]=i.noRenderStreams.join(","),this.handler.sendMetrics([e])}}},{key:"onCheckTimer",value:function(t,e){if(-1!==this.startTs){this.roomNoRenderStatV1.checkHidden();var i=t-this._lastTs;i>=this._noRenderMetricTime&&(this._lastTs=t,this.roomNoRenderStatV1.statCallback(),this.sendMetric(i))}}},{key:"renderCallback",value:function(){this.roomNoRenderStatV1.renderCallback()}},{key:"onBeforeUnload",value:function(t){if(this.supported){if(this.startTs>0){var e=g.now();e-this.startTs>this._noRenderValidTime&&(this.roomNoRenderStatV1.exitCallback(),this.sendMetric(e-this._lastTs))}}else I.log("RoomRecord onBeforeUnload fail, not supported!")}}]),t}(),rb=function(){function t(e){Object(s.a)(this,t),this.samples=new X(e),this.maxSize=e,this.lastTs=0,this.isOver=!1,this.callback=null}return Object(r.a)(t,[{key:"destroy",value:function(){tP.remove(this.onCheckTime,this),this.callback=null,this.samples&&this.samples.reset(),this.samples=null}},{key:"getResult",value:function(){for(var t=this.samples.getSamples(),e=t.length,i=[],s=0;s<e;s++)i.push("".concat(s+1,":").concat(t[s]));return i.join(",")}},{key:"start",value:function(t){this.isOver=!1,this.callback=t,tP.add(this.onCheckTime,this,20)}},{key:"stop",value:function(){this.callback=null,this.samples.reset(),this.lastTs=0,tP.remove(this.onCheckTime,this)}},{key:"setOver",value:function(){if(!this.isOver){this.isOver=!0;var t=this.getResult();I.log("FastSample.over result=".concat(t)),this.callback&&this.callback(t),this.stop()}}},{key:"add",value:function(t){if(!this.isOver){this.samples.addCur(t);var e=g.now();0===this.lastTs?this.lastTs=e:this._checkSample(e)}}},{key:"onCheckTime",value:function(t){this._checkSample(t)}},{key:"_checkSample",value:function(t){this.lastTs>0&&t-this.lastTs>500&&(this.lastTs=t,this.samples.calculate(),this.samples.getSamples().length===this.maxSize&&this.setOver())}}]),t}(),rw="heart",rL="resume",rF="stop",rM=function(){function t(e){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;Object(s.a)(this,t),this.linkHandler=e,this.ws=null,this.connected=!1,this.isYY=i,this.url=null,this.avgSpeed=new X(r)}return Object(r.a)(t,[{key:"destroy",value:function(){this.linkHandler=null,this.reset(),tP.remove(this.onCheckTimer,this)}},{key:"connect",value:function(t){this.reset(),tP.add(this.onCheckTimer,this,1e3),this.url=t,this.ws=new WebSocket(t),this.ws.binaryType="arraybuffer",this.ws.onopen=this.onopen.bind(this),this.ws.onerror=this.onerror.bind(this),this.ws.onclose
1=this.onclose.bind(this),this.ws.onmessage=this.onmessage.bind(this)}},{key:"reset",value:function(){this.ws&&(this.connected=!1,this.ws.onopen=null,this.ws.onerror=null,this.ws.onclose=null,this.ws.onmessage=null,this.ws.close(),this.ws=null),this.url=null,this.avgSpeed.reset()}},{key:"send",value:function(t){this.ws&&this.connected&&this.ws.send(t)}},{key:"onopen",value:function(){this.connected=!0,this.linkHandler&&this.linkHandler.onopen()}},{key:"onerror",value:function(t){I.log("ProtoLink.onerror event="+t),this.connected=!1,this.ws=null,this.linkHandler&&(this.linkHandler.onerror(t),this.linkHandler=null)}},{key:"onclose",value:function(){this.connected=!1,this.ws=null,this.linkHandler&&(this.linkHandler.onclose(),this.linkHandler=null)}},{key:"onmessage",value:function(t){this.avgSpeed.addCur(t.data.byteLength),t.data instanceof ArrayBuffer?this.processArrayBuffer(t.data):this.processText(t.data)}},{key:"processText",value:function(t){I.log("ProtoLink.processText data="+t)}},{key:"processArrayBuffer",value:function(t){if(this.isYY)for(var e=new DataView(t),i=0,s=0,r=0;i+10<t.byteLength;){if(i+(s=e.getUint32(i,!0))>t.byteLength||s<10)return void I.error("ProtoLink.processArrayBuffer length error pktLen="+s+" bufferLen="+t.byteLength);r=e.getUint32(i+4,!0);var a=new DataView(t,i,s);this.linkHandler&&this.linkHandler.onData(r,a),i+=s}else this.linkHandler&&this.linkHandler.onData(t)}},{key:"onCheckTimer",value:function(t,e){this.connected&&this.avgSpeed.calculate()}},{key:"speed",get:function(){return this.avgSpeed.average()}}]),t}(),rN=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;Object(s.a)(this,t),this.linkHandler=e,this.connected=!1,this.url=null,this.xhr=null,this.avgSpeed=new X(i)}return Object(r.a)(t,[{key:"destroy",value:function(){this.reset(),this.linkHandler=null,tP.remove(this.onCheckTimer,this)}},{key:"reset",value:function(){this.abort(),this.url=null,this.xhr=null,this.connected=!1,this.avgSpeed.reset()}},{key:"abort",value:function(){this.xhr&&(I.log("ProtoLinkXhrFF abort"),this.xhr.abort())}},{key:"connect",value:function(t){this.reset(),this.url=t;var e=this.xhr=new XMLHttpRequest;e.responseType="moz-chunked-arraybuffer",e.open("GET",this.url,!0),e.onerror=this.onerror.bind(this),e.onprogress=this.onprogress.bind(this),e.onloadend=this.loadend.bind(this),e.onload=this.onclose.bind(this),e.send(),tP.add(this.onCheckTimer,this,1e3)}},{key:"onprogress",value:function(t){this.connected||this.onopen();var e=t.target.response;this.linkHandler.onData(e),this.avgSpeed.addCur(e.byteLength)}},{key:"onreadystatechange",value:function(t){}},{key:"onopen",value:function(){this.connected=!0,this.linkHandler&&this.linkHandler.onopen()}},{key:"onerror",value:function(t){I.log("ProtoLinkXhrFF.onerror "+t);var e=t.currentTarget.status;this.connected=!1,this.linkHandler&&(this.linkHandler.onerror(t,e),this.linkHandler=null)}},{key:"loadend",value:function(t){404===t.currentTarget.status&&this.onerror(t)}},{key:"onclose",value:function(){I.log("ProtoLinkXhrFF.onclose"),this.connected=!1,this.linkHandler&&(this.linkHandler.onclose(),this.linkHandler=null)}},{key:"onCheckTimer",value:function(t,e){this.connected&&this.avgSpeed.calculate()}},{key:"speed",get:function(){return this.avgSpeed.average()}}],[{key:"isSupported",value:function(){try{var t=new XMLHttpRequest;return t.open("GET","https://example.com",!0),t.responseType="moz-chunked-arraybuffer","moz-chunked-arraybuffer"===t.responseType}catch(t){return I.warn("MozChunkedLoader",t.message),!1}}}]),t}(),rB=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;Object(s.a)(this,t),this.linkHandler=e,this.connected=!1,this.url=null,this.requestAbort=!1,this.controller=null,this.reader=null,this.avgSpeed=new X(i),this.destroyed=!1,this.hasData=!1,this.isClosed=!1,this.waitForData=!1}return Object(r.a)(t,[{key:"destroy",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.destroyed=t,this.isClosed=!0,tP.remove(this.onCheckTimer,this),this.waitForData&&!this.hasData||(this.abort(),this.reset()),t&&(this.linkHandler=null)}},{key:"destroyForce",value:function(){I.log("ProtoLinkFetch.destroyForce",this.url),this.abort(),this.reset()}},{key:"reset",value:function(){this.connected=!1,this.avgSpeed.reset()}},{key:"pump",value:function(t){var e=this;t.read().then(function(i){if(i.done)I.log("ProtoLinkFetch result done"),e.onclose();else{e.hasData=!0;var s=i.value.buffer;
1e.avgSpeed.addCur(s.byteLength),e.destroyed?e.abort():(e.waitForData&&e.isClosed&&e.abort(),e.linkHandler&&e.linkHandler.onData(s),e.pump(t))}}).catch(function(t){I.error("ProtoLinkFetch.pump",t),e.onerror(t)})}},{key:"checkAbort",value:function(t){return!!this.requestAbort&&(t.cancel(),!0)}},{key:"connect",value:function(t){var e=this;tP.add(this.onCheckTimer,this,1e3),this.url=t;var i=null,s=null,r={};window.AbortController&&(s=(i=new AbortController).signal,this.controller=i,r.signal=s),fetch(t,r).then(function(t){1==Number(D._printFetchUrl)&&I.log("FetchUrl",t.url);var i=t.body.getReader();e.reader=i,e.destroyed?e.abort():(e.linkHandler&&e.linkHandler.onstatus&&e.linkHandler.onstatus(t.status),t.ok&&t.status>=200&&t.status<300?(e.onheader(t),t.redirected&&e.on302(t),e.onopen(),e.pump.call(e,i)):(I.log("ProtoLinkFetch http code invalid status:"+t.status),e.onerror(t.statusText,t.status)))}).catch(function(t){I.log("ProtoLinkFetch exception"),e.onerror(t.message)})}},{key:"abort",value:function(){try{this.reader&&this.reader.cancel&&(I.log("ProtoLinkFetch.abort reader"),this.reader.cancel(),this.reader=null)}catch(t){I.log("ProtoLinkFetch.abort exception",t)}this.controller&&this.controller.abort&&(I.log("ProtoLinkFetch.abort controller"),this.controller.abort(),this.controller=null)}},{key:"on302",value:function(t){I.log("ProtoLinkFetch.on302 url=".concat(t.url)),this.linkHandler.on302&&this.linkHandler.on302(t.url)}},{key:"onheader",value:function(t){var e,i={},s=[],r=Object(Q.a)(t.headers);try{for(r.s();!(e=r.n()).done;){var a=Object(eb.a)(e.value,2),n=a[0],o=a[1];i[n]=o,s.push(n+":"+o)}}catch(t){r.e(t)}finally{r.f()}I.log("ProtoLinkFetch.onheader",s.join(" | ")),this.linkHandler.onheader&&this.linkHandler.onheader(i)}},{key:"onopen",value:function(){this.connected=!0,this.linkHandler&&this.linkHandler.onopen()}},{key:"onerror",value:function(t,e){I.log("ProtoLinkFetch.onerror "+t),this.connected=!1,this.linkHandler&&(this.linkHandler.onerror(t,e),this.linkHandler=null)}},{key:"onclose",value:function(){this.connected=!1,this.linkHandler&&(this.linkHandler.onclose(),this.linkHandler=null)}},{key:"onCheckTimer",value:function(t,e){this.connected&&this.avgSpeed.calculate()}},{key:"speed",get:function(){return this.avgSpeed.average()}}]),t}(),rV={isMacChrome72:function(){return"mac"===S.platform&&"chrome"===S.name&&72===Number(S.version.major)},isNeedAud:function(){return S.chrome&&S.version.major>=73},isNotImgplus:function(){if(1==D._testNotImgplus)return!0;var t=navigator&&navigator.userAgent||"";t=t.toLocaleLowerCase();var e=!1;return F.notImgplusUas&&(e=F.notImgplusUas.some(function(e){return -1!==t.indexOf(e)})),e},isBrowserSupport:function(){var t=p.kernel.toLowerCase(),e=p.kernelVersion;if("chrome"===t&&53!=e)return!0;for(var i=(p.browser+"").toLowerCase(),s=0;s<F.p2pOpenBrowsers.length;s++){var r=F.p2pOpenBrowsers[s];if(-1!==i.indexOf(r))return!0}return!1},isP2PCooling:function(){return 1===Number(F.needCooling)&&1===Number(D.__p2p_cooling_play)},isSupportP2P:function(){return this.isBrowserSupport()&&!this.isP2PCooling()},isWebrtcSupport:function(){try{var t=navigator.userAgent,e={Trident:t.indexOf("Trident")>0||t.indexOf("NET CLR")>0,Presto:t.indexOf("Presto")>0,WebKit:t.indexOf("AppleWebKit")>0,Gecko:t.indexOf("Gecko/")>0,UC:t.indexOf("UC")>0||t.indexOf(" UBrowser")>0,BaiDu:t.indexOf("Baidu")>0||t.indexOf("BIDUBrowser")>0,Maxthon:t.indexOf("Maxthon")>0,LBBROWSER:t.indexOf("LBBROWSER")>0,SouGou:t.indexOf("MetaSr")>0||t.indexOf("Sogou")>0,IE:t.indexOf("MSIE")>0||t.indexOf("Trident")>0,Firefox:t.indexOf("Firefox")>0,Opera:t.indexOf("Opera")>0||t.indexOf("OPR")>0,Safari:t.indexOf("Safari")>0,Chrome:t.indexOf("Chrome")>0||t.indexOf("CriOS")>0,Wechat:t.indexOf("MicroMessenger")>0,Windows:t.indexOf("Windows")>0,Linux:t.indexOf("Linux")>0,Mac:t.indexOf("Macintosh")>0,Android:t.indexOf("Android")>0||t.indexOf("Adr")>0,WP:t.indexOf("IEMobile")>
10,BlackBerry:t.indexOf("BlackBerry")>0||t.indexOf("RIM")>0||t.indexOf("BB")>0,MeeGo:t.indexOf("MeeGo")>0,Symbian:t.indexOf("Symbian")>0,iOS:t.indexOf("like Mac OS X")>0,iPhone:t.indexOf("iPh")>0,iPad:t.indexOf("iPad")>0,Mobile:t.indexOf("Mobi")>0||t.indexOf("iPh")>0||t.indexOf("480")>0,Tablet:t.indexOf("Tablet")>0||t.indexOf("iPad")>0||t.indexOf("Nexus 7")>0,TheWorld:t.indexOf("TheWorld")>0};return e.Chrome&&(e.Chrome=!(e.Opera||e.BaiDu||e.Maxthon||e.SouGou||e.UC||e.LBBROWSER||e.TheWorld)),e.Chrome}catch(t){return!1}}},rU=function(){function t(e){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Object(s.a)(this,t),this.player=e,e.hyPlayer&&(this.hyPlayer=e.hyPlayer,this.stat=e.hyPlayer.stat),this._newLink(),this.needRetry=i,this.status=0,this.url=null,this.started=!1,this.lastGetProxyTime=0,this.headers=null,this.reconnectCnt=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.link&&this.link.destroy(),this.link=null,this.player=null,this.hyPlayer=null,this.stat=null}},{key:"_newLink",value:function(){S.firefox&&rN.isSupported()?this.link=new rN(this):rV.isMacChrome72()?this.link=new rM(this):this.link=new rB(this)}},{key:"abort",value:function(){this.link.destroy()}},{key:"reset",value:function(){this.lastGetProxyTime=0,this.status=0,this.url=null,this.started&&(I.log("ShieldAudioLoaderCtrl.reset"),this.link.destroy(),this._newLink())}},{key:"stop",value:function(){this.reconnectCnt=0}},{key:"connect",value:function(t){t?(this.link instanceof rM&&(t=t.replace("http","ws")),this.reset(),this.lastGetProxyTime=g.now(),I.log("ShieldAudioLoaderCtrl.connect url="+t,this.lastGetProxyTime),this.headers=null,this.url=t,this.link.connect(this.url),this.started=!0):I.warn("ShieldAudioLoaderCtrl.connect url is null")}},{key:"close",value:function(){I.log("ShieldAudioLoaderCtrl.close"),this.reset(),this.started=!1}},{key:"onstatus",value:function(t){this.status=t}},{key:"onheader",value:function(t){this.headers=t,I.log("ShieldAudioLoaderCtrl.onheader",t),this.player&&this.player.onHeader&&this.player.onHeader(t)}},{key:"onopen",value:function(){I.log("ShieldAudioLoaderCtrl.onopen"),this.player.onConnected()}},{key:"onclose",value:function(){I.log("ShieldAudioLoaderCtrl.onclose"),this.player.onClosed(),this.lastGetProxyTime=0}},{key:"onerror",value:function(t,e){I.log("ShieldAudioLoaderCtrl.onerror",e),this.lastGetProxyTime=0,this.getProxy(),this.player.onLoadError&&this.player.onLoadError(t)}},{key:"onData",value:function(t){this.player.onData(t)}},{key:"onCheckTimer",value:function(t,e){if(this.started&&e%10==0){var i=this.link.speed;
1i!=O.UintMax&&(i=O.formatByteSize(i),I.log("ShieldAudioLoaderCtrl speed ".concat(i,"/s")))}}},{key:"speed",get:function(){var t=this.link.speed;return t==O.UintMax&&(t=0),t}},{key:"connected",get:function(){return this.link&&this.link.connected}},{key:"onCheckConnect",value:function(t){this.connected||t-this.lastGetProxyTime>=2e3&&0!=this.lastGetProxyTime&&this.player&&this.player.onLoadTimeout&&(this.getProxy(),this.player.onLoadTimeout(),this.lastGetProxyTime=0)}},{key:"getProxy",value:function(){this.reconnectCnt>=3||(this.reconnectCnt++,this.reset(),this.player.restart())}}]),t}();rU.DEFAULT_GET_PROXY_PERIOD=4e3;var rx=0,rH=function(){function t(e,i){Object(s.a)(this,t),this._id=rx++,I.log("ShieldAudioPlayer(".concat(this._id,").constructor")),this.player=e,this.loader=new rU(this,!0),this.connectTime=0,this.started=!1,this.startTs=0,this.startUrlBind=this.startUrl.bind(this),this.cdncip="",this.cdnsip="",this.alt_svc="",this.x_hy_quic="",this.sShieldStreamName="",this.isOpen=!1,this.recvTime=0,this.playInfo=null,this.anticode=new sb,this.refreshAnticodeBind=this.refreshAnticode.bind(this),this.anticode.on(sb.Events.REFRESH,this.refreshAnticodeBind)}return Object(r.a)(t,[{key:"destroy",value:function(){this.loader&&this.loader.destroy(),this.loader=null,this.player=null,this.anticode&&this.anticode.off(sb.Events.REFRESH,this.refreshAnticodeBind),this.anticode=null}},{key:"connected",get:function(){return this.loader.connected}},{key:"reset",value:function(){this.started&&(I.log("ShieldAudioPlayer(".concat(this._id,").reset")),this.loader.close(),this.started=!1,this.startTs=0,this.connectTime=0,this.url="",this.sShieldStreamName="",this.recvTime=0)}},{key:"initInfo",value:function(t){var e="";t.sFlvUrl&&t.sShieldStream.sStreamName&&(1==Number(D._forceShieldStream)&&(t.sShieldStream.sStreamName=t.sStreamName),t.sShieldStream.sStreamName&&(e="".concat(t.sFlvUrl,"/").concat(t.sShieldStream.sStreamName,".flv")));var i=[],s=this.anticode.getAnticode(!1);I.log("ShieldAudioPlayer.initInfo.anticode",s),this.anticode.hasAnticode()&&i.push(s),-1===e.indexOf("va.huya.com")&&-1===e.indexOf("cdnweb.huya.com")&&-1===e.indexOf("va-cmcc.huya.com")||i.push("&https=1"),i.length>0&&(e+=(-1!==e.indexOf("?")?"&":"?")+"".concat(i.join("&"))),this.url=e}},{key:"start",value:function(t){this.stop(),this.playInfo=t,this.startShieldAudio(t)}},{key:"startShieldAudio",value:function(t){this.startTs=g.now(),this.checkParams(t,this.startUrlBind)}},{key:"onCheckTimer",value:function(t,e){if(this.anticode.onCheckTimer(t,e),this.started){if(g.now()-this.startTs>=5e3&&!this.isOpen&&this.player.onSwitchShieldAudioFail(2),this.connected&&this.recvTime>0&&t-this.recvTime>5e3)return I.warn("ShieldAudioPlayer(".concat(this._id,").onCheckTimer no data received ")+(t-this.recvTime)),void this.player.onSwitchShieldAudioAbnormal();this.loader.onCheckTimer(t,e)}}},{key:"refreshAnticode",value:function(){I.log("shieldAudioPlayer.refreshAnticode"),this.initInfo(this.playInfo)}},{key:"checkParams",value:function(t,e){t.sFlvUrl&&t.sShieldStream.sStreamName?(t.sFlvUrl=t.sFlvUrl.replace("http://","https://"),t.sShieldStream.sFlvAntiCode?(this.anticode.init(t.sFlvUrl,t.sShieldStream.sStreamName,t.sShieldStream.sFlvAntiCode,t.nimoTid),this.anticode.valid().then(function(){e&&e(t)})):e&&e(t)):I.warn("ShieldAudioPlayer(".concat(this._id,").start has no params(sFlvUrl,sStreamName,url)"))}},{key:"startUrl",value:function(t){if(this.started=!0,t.sShieldStream&&t.sShieldStream.sStreamName){this.sShieldStreamName=t.sShieldStream.sStreamName,this.initInfo(t);var e=this._getUrlParams(this.url);this.loader.connect(e)}else I.warn("ShieldAudioPlayer.startUrl error",JSON.stringify(t.sShieldStream))}},{key:"_getUrlParams",value:function(t){var e="",i=F.platform,s=L.PLATFORM_TYPE[i]||L.PLATFORM_TYPE.web,r=i===L.PLATFORM_TYPE_NAME.wap?"uid=".concat(w.uid,"&uuid=").concat(w.uuid):"u=".concat(w.convertUid);return e+="".concat(r,"&t=").concat(s),e=O.urlInfoParams(e,this.playInfo),-1===t.indexOf("?")?t+="?":t+="&",t+e}},{key:"stop",value:function(){this.started&&this.loader.close(),this.isOpen=!1,this.reset(),this.loader.stop(),this.anticode.off(sb.Events.REFRESH,this.refreshAnticodeBind)}},{key:"onConnected",value:function(){this.connectTime=g.now(),this.isOpen=!0;var t=this.connectTime-this.startTs;this.player&&this.player.onShieldAudioConnected(t),I.log("%c[TIME] ShieldPlayer(".concat(this._id,").onConnected connectTime=")+t,"color:#A23400;background:#FFF5C2")}},{key:"onClosed",value:function(){I.log("ShieldAudioPlayer(".concat(this._id,").onClosed"))}},{key:"onLoadError",value:function(t){I.log("ShieldAudioPlayer(".concat(this._id,").onLoadError"))}},{key:"onLoadTimeout",value:function(){I.log("ShieldAudioPlayer(".concat(this._id,").onLoadTimeout"))}},{key:"onData",value:function(t,e){var i=g.now(),s=new Uint8Array(t);this.player.stat.addCore(R.CORE.CDN_TOTAL_BW,s.byteLength),this.player.mse.appendShieldAudioFlv(s),this.recvTime=i}},{key:"restart",value:function(){this.startShieldAudio(this.player.info)}},{key:"onHeader",value:function(t){t.hasOwnProperty("cdncip")&&(this.cdncip=t.cdncip),t.hasOwnProperty("cdnsip")&&(this.cdnsip=t.cdnsip),t.hasOwnProperty("alt-svc")&&(this.alt_svc=t["alt-svc"]),t.hasOwnProperty("x-hy-quic")&&(this.x_hy_quic=t["x-hy-quic"])}}]),t}(),rG=function(){function t(){Object(s.a)(this,t),this._videoBadQualityHis=new X(F.hiddenSamples)}return Object(r.a)(t,[{key:"addVideoBadQuality",value:function(t){this._videoBadQualityHis.add(t)}},{key:"isCanStop",value:function(t){if(this._videoBadQualityHis.getSamples().length<
1F.hiddenSamples)return!1;t=Math.floor(t/1e3/60)||0;for(var e=this._videoBadQualityHis.average(),i=F.hiddenCfg,s=!1,r=0;r<i.length;r++){var a=i[r],n=a[0],o=a[1];if(t>=n&&e>o){s=!0,I.log("HiddenStopChecker.isCanStop return true!hiddenTime=".concat(t," badRate=").concat(e," cfgTime=").concat(n," cfgRate=").concat(o));break}}return s}},{key:"stop",value:function(){this._videoBadQualityHis.reset()}}]),t}(),rW=0,rj=[],rY=[],rq=[],rK=[],rz=-1e4,rJ=function(){function t(e,i){Object(s.a)(this,t),this._id=rW++,this.eventEmitter=e,this.stat=i.stat,this.tsdb=i.tsdb,this.statSwitch=i.statSwitch,this.sampleController=i.sampleController,this.h265Proxy=i.h265Proxy,this.autoMonitor=i.autoMonitor,this.recSysStat=i.recSysStat,this.voiceChecker=i.voiceChecker,this.info=null,this.isH265Playing=!1,this.playerType=-1,this.started=!1,this.heart20Ts=0,this.pauseCnt=0,this.pauseTime=0,this.pauseCnt5=0,this.pauseTime5=0,this.pauseCnt60Sec=0,this.pauseStartTs=0,this.pauseStartWorkerTs=0,this.pauseMobStartTs=0,this.pauseMobCnt=0,this.pauseWorkerCnt=0,this.pauseWorkerTime=0,this.pauseReason=0,this.pauseCheckLock=!1,this.videoStatus=x,this.isSwitchPause=!1,this._useAV1=!1,this.isAV1MediaSupported=A.isMseSupportedAV01(),this.resetAiProps(),this.fastSample=new rb(20),this.onFastSampleOverBind=this.onFastSampleOver.bind(this),this.p2pFlvPlayer=i.p2pFlvPlayer,this.videoFpsList=[],this.audioFpsList=[],this.startFps=!1,this._hyPlayer=i.hyPlayerIns,this.playerCoreType=i.playerCoreType,this.shieldAudioPlayer=new rH(this),this.shieldAudioConnectTime=99999,this.isShieldStart=!1,this.is_tie_stream=!1,this.pause500Cnt=0,this.pcdnIaas="",this.isFramePaused=!1,this.isRenderFpsPause=!1,this.pcdnIaasParam="",this.isPcdnIaas=!1,this.fpsSecOverNum=0,this.isRevFastOver=!1,this.phase=1,this.reqId=0,this._hiddenStopChecker=new rG,this.av1Playing=!1}return Object(r.a)(t,[{key:"destroy",value:function(){this.clearTimer(),this.fastSample.destroy(),this.shieldAudioPlayer.destroy(),this._hiddenStopChecker.stop()}},{key:"sendAnticodeHeart",value:function(){var t=[];this.stat.fillAnticode(t),this.tsdb.sendMetrics(t)}},{key:"on302",value:function(t){var e=O.getQueryString("p_iaas",t),i=O.getQueryString("p_iaas_param",t);this.pcdnIaasParam=i||"",this.pcdnIaas=e||"",this.info.pcdnIaas=e,this.info.pcdnIaasParam=i,I.log("IPlayer.on302,url=",t,e),this.isPcdnIaas=""!=this.pcdnIaas,this.stat&&(this.stat.setComDim(R.DIM_COM.IS_REDIRECT,1),e&&this.stat.setComDim(R.DIM_COM.PCDN_IAAS,e),e&&this.stat.setComDim(R.DIM_COM.STREAM_302_URL,t))}},{key:"onConnected",value:function(){this.p2pFlvPlayer.onConnected()}},{key:"onPlayVideo",value:function(t,e,i,s,r,a,n){var o=this.getMse();this.info&&this.info.isAuto&&0===Number(F.autoCfg.close)&&(this.p2pFlvPlayer.ctrlBitrate.start(this.getMse(),{sessionId:this.info._sessionId,startBitrate:this.info._startBitrate,bitrateList:this.info.bitrateList,curBitrate:this.info.curBitrate}),this.p2pFlvPlayer._triggerAutoChanged()),o&&o.setParams(this.info.presenterUid,this.info.curBitrate,this.info),this.stat.setComDim(R.DIM_COM.DPI,e+"*"+i),this.h265Proxy.needPreload;var u=tz().toLowerCase();this.stat.setComDim(R.DIM_COM.RENDER_INFO,u),-1==u.toLocaleLowerCase().indexOf("swiftshader device")&&""!=u||o&&o.setDisableHardAcc&&o.setDisableHardAcc();var l=-1!=u.toLocaleLowerCase().indexOf("angle (null"),d=""==u.toLocaleLowerCase();l?(D.isAngelNull=1,o&&o.angelNullError&&o.angelNullError()):D.isAngelNull=0,d?o&&o.chromeH265RenderEmptyError&&o.chromeH265RenderEmptyError():D.isChromeH265RenderInfoEmpty=0,1==F.hardHevcConfig[2]&&this.playerCoreType==L.PLAYER_CORE_TYPE.MSE&&this.mse&&this.mse.h265Proxy.isH265MseCodec&&S.version.major>=117&&-1!=u.indexOf("amd")&&-1!=u.indexOf("radeon")&&(I.log("IPlayer.onPlayVideo.amd.hevError"),this.p2pFlvPlayer.onMseHevcError())}},{key:"_startContinueBuffer",value:function(){var t=this.getMse();t&&t.buffered&&t.buffered.start()}},{key:"onPlayPause",value:function(t,e){this.pauseStartTs=t,this.pauseCheckLock=!1,this.isSwitchPause=!0,this.autoMonitor.setPause(t,this.getBufferLen()),e&&this.updateStatus(H)}},{key:"onPlayResume",value:function(t,e){this._checkPaused(t,rL),e&&this.updateStatus(U)}},{key:"onPlayPauseWorker",value:function(t,e){this.pauseStartWorkerTs=t}},{key:"onPlayResumeWorker",value:function(t,e){this._checkPausedWorker(t,rL)}},{key:"_checkPaused",value:function(t,e){if(e!==rw&&e!==rF||this.voiceChecker.onAudioEnergy(!0),1==D._testPaused&&(this.pauseStartTs=t-500),this.pauseStartTs>0){var i=t-this.pauseStartTs;if(i>=200){var s=this.getMse(),r=0;
1s&&(s.buffered._calc(t,eN),r=s.getContinueBuffer()),"hidden"!==this.stat.getComDim(R.DIM_COM.VISIBILITY_STATE)&&this.stat.addCore(R.DIM_CORE.V_BAD_FRONT,1),this.autoMonitor.addBadQuality(t,i,e,r),this.pauseCnt++,this.pauseTime+=i,this.pauseCnt5++,this.pauseTime5+=i,this.p2pFlvPlayer.ctrlBitrate.addBadQuality(t,i,this.getBufferLen()),this.pauseCnt60Sec++;var a=this._getBadReason(t);I.warn("IPlayer(".concat(this._id,")._checkPaused type=").concat(e," pauseTime=").concat(i," curReason=").concat(a," lastReason=").concat(this.pauseReason)),(0===this.pauseReason||a<this.pauseReason)&&(this.pauseReason=a),this.checkPerformanceBadQuality(),q.addBadQuality(this.stat)}else this.autoMonitor.resetPausedTs();this.pauseStartTs=e===rw?t:0}e===rw&&this._autoReportSea()}},{key:"checkHiddenStop",value:function(){if(document&&"hidden"===document.visibilityState&&this.eventEmitter&&this.eventEmitter.visibility){var t=this.eventEmitter.visibility.lastHiddenTime;this._hiddenStopChecker.isCanStop(t)&&tP.once(this._hiddenStop,this,50)}}},{key:"_hiddenStop",value:function(){this.eventEmitter&&this.eventEmitter.trigger(N.HIDDEN_STOP)}},{key:"_checkMobPaused",value:function(t,e){this.pauseMobStartTs>0&&(this.pauseMobStartTs=e===rw?t:0)}},{key:"_checkPausedWorker",value:function(t,e){if(this.pauseStartWorkerTs>0){var i=t-this.pauseStartWorkerTs;i>=200&&(I.warn("IPlayer(".concat(this._id,")._checkPausedWorker type=").concat(e," pauseTime=").concat(i)),this.pauseWorkerCnt++,this.pauseWorkerTime+=i),this.pauseStartWorkerTs=e===rw?t:0}}},{key:"_checkAvcChangeReport",value:function(t,e){if(e){var i=this.getMse();if(i){var s=i.parser;s&&s.avcChangeTime+F.avHeaderChangeCfg[3]<t&&(this.printAVInfos(),100*Math.random()<F.avHeaderChangeCfg[1]&&this._hyPlayer.trigger(N.P2P_REPORT))}}}},{key:"_getBadReason",value:function(t){return 0}},{key:"_autoReportSea",value:function(){}},{key:"updateStatus",value:function(t){this.videoStatus!==t&&(this.videoStatus=t,this.eventEmitter.trigger(N.PLAY_STATUS,{status:t}))}},{key:"onErrorEvent",value:function(t){3===t.type&&this.p2pFlvPlayer.ctrlBitrate._badStat.setNoIFrame()}},{key:"getMse",value:function(){return null}},{key:"printAVInfos",value:function(){var t=this.getMse();t&&t.printAVInfos&&t.printAVInfos()}},{key:"onHeader",value:function(t){t.hasOwnProperty("cdncip")&&this.stat.setComDim(R.DIM_COM.CDN_CIP,t.cdncip),t.hasOwnProperty("cdnsip")&&(this.cdnsip=t.cdnsip,this.stat.setComDim(R.DIM_COM.CDN_SIP,t.cdnsip)),t.hasOwnProperty("alt-svc")&&this.stat.setComDim(R.DIM_COM.ALT_SVC,t["alt-svc"]),t.hasOwnProperty("x-hy-quic")&&this.stat.setComDim(R.DIM_COM.QUIC,t["x-hy-quic"])}},{key:"getBufferLen",value:function(){return 0}},{key:"getSegmentsBufferLen",value:function(){return 0}},{key:"getWaitBufferLen",value:function(){return 0}},{key:"getWaitFrameTime",value:function(t){return 0}},{key:"triggerVideoBadQuality",value:function(){this.eventEmitter.trigger(N.VIDEO_BAD_QUALITY)}},{key:"trigger",value:function(t,e){this.eventEmitter.trigger(t,e)}},{key:"onFastSampleOver",value:function(t){var e=[this.stat.createAct(R.ACT.FAST_SAMPLE,{str:[t]})];this.tsdb.sendMetrics(e);var i=this.getMse();i&&i.onFastOver()}},{key:"startFastSample",value:function(){this.fastSample.start(this.onFastSampleOverBind)}},{key:"addBytes",value:function(t){this.sampleController.addTotalSample(t),this.fastSample.add(t)}},{key:"init",value:function(t){}},{key:"start",value:function(t){this.pcdnIaas="",this.pcdnIaasParam="",this.isPcdnIaas=!1,-1e4!=rz&&t.iBitRate,this.getWebCodecType(),this.is_tie_stream=!1,this.stat.setComDim(R.DIM_COM.IS_TIE_STREAM,0),this.stat.setComDim(R.DIM_COM.IS_REDIRECT,0),1==t.pullStreamFrom&&(rj.length=0),this.stop(),tP.add(this.getVideoBadQuality,this,2e4),this.sampleController.start(),this.startFps=!1,is.add(this.onIPlayerCheckTimer,this,1e3),rz=t.iBitRate,this.setEnableDiscard(t),this.startShildAudioPlayer(t)}},{key:"startPlayer",value:function(){this.isNotSupportWebcodecsConfigure()}},{key:"clearTimer",value:function(){tP.remove(this.timeoutRecSysRsp,this),tP.remove(this.getVideoBadQuality,this),tP.remove(this.pauseGetRecSysRspOnce,this),is.remove(this.onIPlayerCheckTimer,this)}},{key:"stop",value:function(){this.fpsSecOverNum=0,this.isRevFastOver=!1,this.shieldAudioPlayer.stop(),this.isH265Playing=!1,this.heart20Ts=0,this.pauseCnt60Sec=0,this.isSwitchPause=!1,this.fastSample.
1stop(),this.sampleController.stop(),this.clearTimer(),this.startFps=!1,this.videoFpsList.length=0,this.audioFpsList.length=0,this.shieldAudioConnectTime=99999,this.isShieldStart=!1,this.pause500Cnt=0,this.pauseWorkerCnt=0,this.pauseWorkerTime=0,this.pauseStartWorkerTs=0,this.pcdnIaas="",this.phase=1,this.reqId=0}},{key:"getVideoBadQuality",value:function(){}},{key:"pauseGetRecSysRsp",value:function(t){var e={info:this.info,type:"flv",metadata:null};t===tQ.P2P?(e.type="p2p",e.metadata=this.player?this.player.msePlayer.metadata:null,e.reason=L.turnToFlvReason.VIDEO_BUFFER_EMPTY):t===tQ.Flv&&(e.type="flv",e.metadata=this.mse.metadata);var i=10*~~(3e3*Math.random()/10);tP.once(this.pauseGetRecSysRspOnce,this,i,e)}},{key:"pauseGetRecSysRspOnce",value:function(t,e,i){this.getRecSysRsp(i)}},{key:"startP2PUrl",value:function(t){}},{key:"stopStream",value:function(t){}},{key:"checkPcdnMode",value:function(t,e){if(this.info){this.info.usePcdn=this._getUsePcdn(t,e),D.usePcdn&&(this.info.usePcdn=1),this.stat.setComDim(R.DIM_COM.FORCE_SUB_TYPE,this.info.usePcdn||this.info.use302Pcdn),this.playerType===tQ.P2P?1===Number(t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_P2pHttpSubstream])?this.stat.setComDim(R.DIM_COM.USE_PCDN,1):this.stat.setComDim(R.DIM_COM.USE_PCDN,0):this.playerType===tQ.FLV&&(1===Number(t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvHttpFullstream])?this.stat.setComDim(R.DIM_COM.USE_PCDN,4):1===Number(t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvOutsideSdkFullstream])?this.stat.setComDim(R.DIM_COM.USE_PCDN,3):this.stat.setComDim(R.DIM_COM.USE_PCDN,0));var i=this._getPcdnName(e);""!=i&&null!=i&&this.stat.setComDim(R.DIM_COM.PCDN_ORIGIN,i)}}},{key:"_checkUsePcdn",value:function(){return this.info.isAuto&&Number(F.closePcdn500)===this.info.curBitrate?0:this.info.usePcdn}},{key:"getAv1Playing",value:function(){return this.av1Playing}},{key:"isUseAV1",value:function(t){this._useAV1=F.useAV1;var e=F.getAv1DecodeFailCnt();return I.log("[id=".concat(this._id,"] IPlayer.isUseAV1 isAV1MediaSupported=").concat(this.isAV1MediaSupported," _useAV1=").concat(this._useAV1," _av1PlayFailReason=").concat(t._av1PlayFailReason," av1DecodeFailCnt=").concat(e)),this.av1Playing=this.isAV1MediaSupported&&this._useAV1&&!t._av1PlayFailReason&&e<3,1==D._localCloseAv1&&(this.av1Playing=!1),this.av1Playing}},{key:"_getUsePcdn",value:function(t){return 0}},{key:"_getPcdnName",value:function(){return""}},{key:"setEnableLowLatency",value:function(t){}},{key:"setPlaybackrateAccess",value:function(t){}},{key:"setVolume",value:function(t){this.mse&&this.mse.setVolume(t)}},{key:"getCurrentTime",value:function(){return 0}},{key:"getFrameData",value:function(){return null}},{key:"resetAiProps",value:function(){this.aiP2PCnt=0,this.aiFlvCnt=0,this.aiP2PTimeoutCnt=0,this.aiFlvTimeoutCnt=0,this.aiP2PErrorCnt=0,this.aiFlvErrorCnt=0,this.aiP2PSwitchCnt=0,this.aiFlvSwitchCnt=0,this.aiP2PNotSwitchCnt=0,this.aiFlvNotSwitchCnt=0,this.aiFlvErrorNotSwitchCnt=0,this.aiFlvErrorSwitchCnt=0}},{key:"recordAiP2PFlv",value:function(t){"p2p"==t?this.aiP2PCnt++:"flv"==t&&this.aiFlvCnt++}},{key:"initAiReq",value:function(t,e,i,s,r,a){var n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},o=new d.HUYA.RecSysReq;o.tId.iAppid=w.appid,o.tId.lUid=w.uid,o.tId.sGuid=w.sGuid,o.tId.sUA="webh5",o.sAnchorUid=t.presenterUid,o.sRoomId=w.roomId,o.iScene=6,o.bDebug=0,o.mAppendInfo.value={streamType:e,expVideoFps:i&&null!=i.fps?i.fps:0,expAudioFps:i&&null!=i.audioFps?i.audioFps:0,codeRate:t.curBitrate,isOriginal:+(0==t.originalBitrate),line:a,codeType:this.isH265?"265":"264",sStreamName:t.sStreamName,playType:s,isServer:0,iIsP2PSupport:t.iIsP2PSupport};var u=Object.assign({},o);return I.log("IPlayer(".concat(this._id,").getRecSysRsp.req, reason=").concat(n.reason),o,JSON.stringify(u)),o}},{key:"getRecSysRsp",value:function(t,e){t.info;var i=t.type;return t.reason,t.metadata,t.isNotAi,g.now(),this.recordAiP2PFlv(i),void this.recSysRspHandler(!1,null,t)}},{key:"getAiStat",value:function(){var t={};this._hyPlayer&&this._hyPlayer.getAiStartStat&&(t=this._hyPlayer.getAiStartStat()),this.aiP2PSwitchCnt+=t.aiStartFlvCnt;var e={aiP2PCnt:this.aiP2PCnt,aiFlvCnt:this.aiFlvCnt,aiP2PTimeoutCnt:this.aiP2PTimeoutCnt,aiFlvTimeoutCnt:this.aiFlvTimeoutCnt,aiP2PErrorCnt:this.aiP2PErrorCnt,aiFlvErrorCnt:this.aiFlvErrorCnt,aiP2PSwitchCnt:this.aiP2PSwitchCnt,aiFlvSwitchCnt:this.aiFlvSwitchCnt,aiP2PNotSwitchCnt:this.aiP2PNotSwitchCnt,aiFlvNotSwitchCnt:this.aiFlvNotSwitchCnt,aiStartP2PCnt:t.aiStartP2PCnt||0,aiStartFlvCnt:t.aiStartFlvCnt||0,aiFlvErrorSwitchCnt:this.aiFlvErrorSwitchCnt,aiFlvErrorNotSwitchCnt:this.aiFlvErrorNotSwitchCnt};return this.resetAiProps(),e}},{key:"timeoutRecSysRsp",value:function(){if(2===this.phase){this.phase=3,this.reqId=0,I.log("IPlayer(".concat(this._id,").timeoutRecSysRsp"));var t=this.aiP2PFlvProps,e=t.type;t.isNotFirstFetch||("p2p"==e?this.aiP2PTimeoutCnt++:"flv"==e&&(this.aiFlvTimeoutCnt++,t.isFlvError&&this.aiFlvErrorSwitchCnt++),this.recSysRspHandler(!1,null,t))}}},{key:"onPause5Sec",value:function(){this.eventEmitter&&(I.log("IPlayer(".concat(this._id,").onPause5Sec")),this.eventEmitter.trigger(N.PAUSE_5SEC_ERROR))}},{key:"onIPlayerCheckTimer",value:function(t,e){if(this.mse){this.checkPerfBlock(),this.startFps||(this.startFps=!0,this.mse.parser.fps.getCalculate());var i=this.mse.getBufferLen(),s=this.mse.parser.fps.getRecvFps(),r=this.mse.getRealFps();if(0!=r){var a=this.mse.parser.fps.getJumRecvFps()/r;1==D._printFpsRecvRatio&&I.log("IPlayer.onCheck mse webcodecs, ratio=".concat(a,", vBufLen=").concat(i)),0!=a&&(a<1.1?(this.fpsSecOverNum++,this.fpsSecOverNum>=2&&!this.isRevFastOver&&(this.isRevFastOver=!0,this.mse.onRevFastOver())):this.fpsSecOverNum=0)}if(this.mse&&this.mse.parser2){var n=this.mse.parser2.audioFps.getRecvFps();this.audioFpsList.push(n)}this.videoFpsList.push(s);var o=this.mse.parser.avSample.getAutoSamples();o.aSamples.map(function(t){rq.length>=60&&rq.shift(),rq.push(t)}),o.vSamples.map(function(t){rK.length>=60&&rK.shift(),rK.push(t)});var u=this.mse.pauseStat.getAiAutoStat(),l=u.aiAutoCnt,d=u.aiAutoDuration,c=u.aiAutoBlockBadDurationList,f=u.aiAutoBlockBadContinueBufferList;rY.length>=60&&rY.shift(),rY.push({aiAutoCnt:l,aiAutoDuration:d,recvFps:s,aiAutoBuffer:i,aiAutoBlockBadDurationList:c,aiAutoBlockBadContinueBufferList:f})}}},{key:"getAVSampleResult",value:function(t,e){var i=[],s=Math.min(e.length,t.length);if(s>0){i.push("size:".concat(s));for(var r=0;r<s;r++)i.push("".concat(s-r,":").concat(e[r]+t[r]))}return i.join(",")}},{key:"getAutoProps",value:function(){var t=0,e=0,i=[],s=[],r=rY.length,a=[],n=[],o=[],u=[];
1if(r>0){i.push("size:".concat(r)),s.push("size:".concat(r));for(var l=0;l<r;l++){var d=rY[l];t+=d.aiAutoCnt,e+=d.aiAutoDuration,i.push("k".concat(r-l,":").concat(d.recvFps)),s.push("k".concat(r-l,":").concat(d.aiAutoBuffer)),a=a.concat(d.aiAutoBlockBadDurationList),n=n.concat(d.aiAutoBlockBadContinueBufferList)}}var c=this.getAVSampleResult(rq,rK),f=a.length;if(f>0){o.push("size:".concat(f)),u.push("size:".concat(f));for(var p=0;p<f;p++)o.push("k".concat(f-p,":").concat(a[p])),u.push("k".concat(f-p,":").concat(n[p]))}var m={aiAutoCnt:t,aiAutoDuration:e,recvFps:i.join(","),realKbpsSample:c,videoBuffers:s.join(","),blockDurationSample:o.join(","),continueBufferSample:u.join(",")};return I.log("Iplayer.getAutoProps, props=",m),m}},{key:"recordRecvFps",value:function(t){var e=this.videoFpsList,i=e.length,s=[];if(i>0){s.push("size:".concat(i));for(var r=i;r>0;r--)s.push("k".concat(r,":").concat(e[r-1]))}if(t.setCoreDim(R.DIM_COM.V_RECV_FRAMES,s.join(",")),s.length=0,this.videoFpsList.length=0,this.mse&&this.mse.parser2){var a=this.audioFpsList,n=a.length,o=[];if(n>0){o.push("size:".concat(n));for(var u=n;u>0;u--)o.push("k".concat(u,":").concat(a[u-1]))}o.length=0,this.audioFpsList.length=0}}},{key:"getMuted",value:function(){return this.mse?this.mse.getMuted():-1}},{key:"setMuted",value:function(t){this.mse&&this.mse.setMuted(t)}},{key:"getEmptyAudioRecord",value:function(){return this.mse.getEmptyAudioRecord()}},{key:"getVoiceStats",value:function(){return this.voiceChecker.getStats()}},{key:"getEmptyAudioDurationHeart",value:function(){return this.mse.getEmptyAudioDurationHeart()}},{key:"hasAudioCfg",value:function(){return this.mse.hasAudioCfg()}},{key:"getVolume",value:function(){return this.eventEmitter.getVolume?100*this.eventEmitter.getVolume():0}},{key:"onCheckTimer",value:function(t,e){var i=this;this.shieldAudioPlayer.onCheckTimer(t,e),this.mse&&this.mse.ctrlBuffer&&this.mse.ctrlBuffer.isNoVideoConfig&&setTimeout(function(){i.eventEmitter&&i.eventEmitter.trigger(N.NO_VIDEO_CONFIG)},0)}},{key:"startShildAudioPlayer",value:function(t){if(t.isStartShield){if(this.is_tie_stream=!0,this.isShieldStart=!0,this.eventEmitter.trigger(N.SHIELD_AUDIO_SWITCH_STATUS,{status:0,commentorIdList:t.commentorIdList}),0==F.shieldAudioCfg[0])return void this.eventEmitter.trigger(N.SHIELD_AUDIO_SWITCH_STATUS,{status:2,commentorIdList:t.commentorIdList});this.shieldAudioPlayer.start(t,t.sShieldStreamName),this.mse&&this.mse.switchShieldAudio(!0)}}},{key:"stopShieldAudioPlayer",value:function(){F.setAiP2PToFlv(0),this.isShieldStart=!1,this.stat.setComDim(R.DIM_COM.IS_TIE_STREAM,0),this.is_tie_stream=!1,I.log("IPlayer.stopShieldAudioPlayer"),this.shieldAudioPlayer.stop(),this.mse.stopShieldAudio()}},{key:"onSwitchShieldAudioSuc",value:function(t){this.stat.setComDim(R.DIM_COM.IS_TIE_STREAM,1),this.reportShildAudioRes(!0,0,t),I.log("IPlayer.onSwitchShieldAudioSuc"),this.eventEmitter.trigger(N.SHIELD_AUDIO_SWITCH_STATUS,{status:1,commentorIdList:this.info.commentorIdList})}},{key:"onSwitchShieldAudioFail",value:function(t,e){this.eventEmitter.trigger(N.SHIELD_AUDIO_SWITCH_STATUS,{status:2,commentorIdList:this.info.commentorIdList}),I.log("IPlayer.onSwitchShieldAudioFail"),this.reportShildAudioRes(!1,t,e),this.stopShieldAudioPlayer()}},{key:"onSwitchShieldAudioAbnormal",value:function(){I.log("IPlayer.onSwitchShieldAudioAbnormal"),this.eventEmitter.trigger(N.SHIELD_AUDIO_SWITCH_STATUS,{status:3,commentorIdList:this.info.commentorIdList}),this.reportShildAudioRes(!1,5,0),this.stopShieldAudioPlayer()}},{key:"reportShildAudioRes",value:function(t,e,i){var s=this.info&&this.info.commentorIdList?this.info.commentorIdList.join(","):"",r={value:[t?1:2,this.shieldAudioConnectTime,e,i],str:[this.shieldAudioPlayer.loader.url,this.shieldAudioPlayer.cdncip,this.shieldAudioPlayer.cdnsip,s]},a=[this.stat.createAct(R.ACT.SWITCH_AUDIO_RES,r)];this.tsdb.sendMetrics(a)}},{key:"getWebCodecType",value:function(){this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS&&this.onActWebCodecs([21],[0])}},{key:"onActWebCodecs",value:function(t,e){var i=[this.stat.createAct(R.ACT.H265_STATUS,{value:t,str:e})];I.log("IPlayer.onActWebCodecs",i),this.tsdb.sendMetrics(i)}},{key:"checkPerformanceBadQuality",value:function(){this.mse.getBufferLen(),this.mse.getContinueBuffer(),F.perfWin7kaCfg[0]}},{key:"turnToWebcodecsSoft",value:function(){O.isWebCodecsSupported()&&(I.log("IPlayer.turnToWebcodecsSoft"),this.eventEmitter.trigger(N.TURN_TO_WEBCODECS_SOFT))}},{key:"setUseSoftAcceleration",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.stat.setComDim(R.DIM_COM.DECODE_HARDWARE_ACCELERATION,+!!t)}},{key:"setEnableDiscard",value:function(t){var e=Number(t.curBitrate)>Number(F.webCodecCfg[2]);this.mse&&this.mse.setEnableDiscard&&this.mse.setEnableDiscard(e)}},{key:"onShieldAudioConnected",value:function(t){this.shieldAudioConnectTime=t}},{key:"qaStaRecord",value:function(){I.log("IPlayer.qaStatRecord,pause500Cnt=".concat(this.pause500Cnt)),this.shieldStatRecord()}},{key:"shieldStatRecord",value:function(){}},{key:"checkPerfBlock",value:function(){if(this.mse){var t=this.mse.getVideoContinueBuffer(),e=Math.max(this.mse.getBufferLen(),0);1==Number(D._printPerfSec)&&I.log("IPlayer.performanceCalc",t,e,F.perfBlockCfg[2]),t-e>=F.perfBlockCfg[2]&&this.mse.setPerfCntPlus()}}},{key:"check500Pause",value:function(){1!=F.closePause500&&this.pause500Cnt++}},{key:"getPause500Cnt",value:function(){var t=this.pause500Cnt;return this.pause500Cnt=0,t}},{key:"isNotSupportWebcodecsConfigure",value:function(){var t=this.isH265?"h265":"h264",e=this.mse;("h265"==t||"h264"==t)&&"undefined"!=typeof VideoDecoder&&VideoDecoder.isConfigSupported({codec:"h265"==t?"hvc1.1.6.L93":"avc1.42E01E"}).then(function(i){I.log("IPlayer.isConfigSupported",i,t),i.supported?"h265"==t?D.isCloseWebcodecsH265=0:"h264"==t&&(D.isCloseWebcodecsH264=0):("h265"==t?D.isCloseWebcodecsH265=1:"h264"==t&&(D.isCloseWebcodecsH264=1),e&&e.isNotSupportWebcodecsConfig&&e.isNotSupportWebcodecsConfig())}).catch(function(t){I.log("IPlayer.isConfigSupported.catch",t.message)})}},{key:"onPlayMobPause",value:function(t,e){this.pauseMobStartTs=t,this.pauseMobCnt++,I.log("IPlayer.onPlayMobPause,pauseMobStartTs=",this.pauseMobStartTs)}},{key:"onPlayMobResume",value:function(t,e){I.log("IPlayer.onPlayMobResume"),this._checkMobPaused(t,rL)}},{key:"setFramePause",value:function(){var t=g.now();this.isFramePaused||(this.onPlayMobPause(t),this.isFramePaused=!0)}},{key:"setFrameRusume",value:function(){if(this.isFramePaused){var t=g.now();this.onPlayMobResume(t),this.isFramePaused=!1}}},{key:"renderFpsPause",value:function(t){this.isRenderFpsPause=t}},{key:"getEnhanceStats",value:function(){return this.eventEmitter&&this.eventEmitter.getEnhanceStats&&this.eventEmitter.getEnhanceStats()}},{key:"getRefreshRate",value:function(){return this._hyPlayer&&this._hyPlayer.getEnhanceStats&&this._hyPlayer.getRefreshRate()}},{key:"getDpi",value:function(){var t=0,e=0;return this.mse&&this.mse.getMseAvcCfgWidth&&(t=this.mse.getMseAvcCfgWidth()),this.mse&&this.mse.getMseAvcCfgHeight&&(e=this.mse.getMseAvcCfgHeight()),{width:t,height:e}}},{key:"getFetchCodecType",value:function(){var t="264";return this.isAv1?t="av1":this.isH265&&(t="265"),t}},{key:"hasPicture",get:function(){return!1}},{key:"isPlaying",get:function(){return!1}},{key:"isWebCodec",get:function(){return this.playerCoreType==L.PLAYER_CORE_TYPE.WEBCODECS}},{key:"isMse",get:function(){return this.playerCoreType==L.PLAYER_CORE_TYPE.MSE}}]),t}(),rQ=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r){var n;return Object(s.a)(this,i),(n=e.call(this,t,r)).playerParams=r,n.player=null,n.updating=!1,n.seeking=!1,n.waitSeekTime=0,n.onSeekBind=n.onSeek.bind(Object(a.a)(n)),n.onM3u8UpdatedBind=n.onM3u8Updated.bind(Object(a.a)(n)),n.m3u8UpdateTime=30,n}return Object(r.a)(i,[{key:"start",value:function(t){t.isLive=!1,Object(n.a)(Object(o.a)(i.prototype),"start",this).call(this,t),t.m3u8UpdateTime&&(this.m3u8UpdateTime=Number(t.m3u8UpdateTime)),this.seeking=!0,this.player=new rp(this.eventEmitter,this.playerParams),this.player.start(t),tP.add(this.onCheckTimer,this,1e3),this.eventEmitter.on(N.VIDEO_SEEK,this.onSeekBind),this.eventEmitter.on(N.PLAYBACK_M3U8_UPDATED,this.onM3u8UpdatedBind)}},{key:"pause",value:function(){this.player&&this.player.pause&&this.player.pause()}},{key:"seek",value:function(t){this.player&&this.player.playlist&&(this.seeking=!0,this.player.playlist.totalDuration-t<30?(this.waitSeekTime=t,this.eventEmitter.trigger(N.NEED_UPDATE_M3U8)):(this.waitSeekTime=0,this.player.seek(t)))}},{key:"onSeek",value:function(t,e){this.seeking=!1}},{key:"onM3u8Updated",value:function(t,e){I.log("PlaybackPlayer.onM3u8Updated totalDuration=".concat(e.totalDuration)),this.waitSeekTime&&(this.player.seek(this.waitSeekTime),this.waitSeekTime=0),this.updating=!1}},{key:"stop",value:function(){this.player&&(this.player.stop(),this.player=null),this.seeking=!1,tP.remove(this.onCheckTimer,this),this.eventEmitter.off(N.VIDEO_SEEK,this.onSeekBind),this.eventEmitter.off(N.PLAYBACK_M3U8_UPDATED,this.onM3u8UpdatedBind)}},{key:"setVolume",value:function(t){this.player&&this.player.setVolume(t)}},{key:"onCheckTimer",value:function(t,e){!this.updating&&this.needUpdate()&&(this.updating=!0,this.eventEmitter.trigger(N.NEED_UPDATE_M3U8)),!this.seeking&&this.player&&this.player.mse&&this.player.playlist&&this.eventEmitter.trigger(N.PLAYBACK_UPDATE,{currentTime:this.player.mse.getCurrentTime(),totalDuration:this.player.playlist.totalDuration})}},{key:"needUpdate",value:function(){if(this.player&&this.player.mse&&this.player.playlist){var t=this.player.mse.getCurrentTime()/1e3;if(t>0){var e=this.player.playlist.totalDuration;if(e>0)return e-t<this.m3u8UpdateTime}}return!1}}
1,{key:"updateLiveVodUrl",value:function(t){this.player&&this.player.updateLiveVodUrl(t)}},{key:"getDurationTime",value:function(){return this.player?this.player.getDurationTime():0}},{key:"setMuted",value:function(t){this.player&&this.player.setMuted(t)}}]),i}(rJ),rX=-1,r$=-1,rZ=function(){function t(e,i,r){Object(s.a)(this,t),this.tsdb=e,this.stat=i,this.autoMonitor=null,this.recSysStat=null,this.autoForce=null,this.handler=r}return Object(r.a)(t,[{key:"destroy",value:function(){this.tsdb=null,this.stat=null,this.autoMonitor=null,this.recSysStat=null,this.autoForce=null,this.handler=null}},{key:"init",value:function(t,e,i){this.autoMonitor=t,this.recSysStat=e,this.autoForce=i}},{key:"check",value:function(t,e){if(!isNaN(t.lineType)&&!isNaN(t.curBitrate)&&-1!==t.lineType){if(this.stat.setComDim(R.DIM_COM.AUTO_USER_TAGS,this.handler.autoUserTags),-1!==rX){var i=null;if(rX!==t.lineType)i=this.stat.createAct(R.ACT.SWITCH_LINE,{value:[rX,t.lineType]});else{var s=1e3*t.curBitrate,r=1e3*r$,a=+!!e,n=0;e?r$!==t.curBitrate&&(n=2):t&&(1==t.pullStreamFrom?n=1:1!=t.pullStreamFrom&&6!=t.pullStreamFrom&&7!=t.pullStreamFrom&&q.addRetryStream(this.stat));var o=[s,r,a,n,0,0,1,t.bitrateList?t.bitrateList.length:0],u=[];if(this.handler.player&&this.handler.player.player&&this.handler.player.player.getAutoProps){var l=this.handler.player.player.getAutoProps();u[0]="",u[1]=l.videoBuffers,u[2]="",u[3]=l.blockDurationSample,u[4]=l.continueBufferSample,u[5]=l.realKbpsSample,u[6]="",u[7]=l.recvFps}1===a&&(this.recSysStat.recordAct(this.stat),1===n&&(this.autoForce.addForce(),this.recSysStat.removeItem(1))),this.autoMonitor.addSwitch(g.now(),s,r,n),i=this.stat.createAct(R.ACT.SWITCH_BITRATE,{value:o,str:u}),I.log("StatSwitch.reportSwitchBitrate getAutoProps value4=".concat(n," metric="),i)}i&&this.tsdb.sendMetrics([i])}rX=t.lineType,r$=t.curBitrate,e=t.isAuto}}},{key:"sendSwitchAuto",value:function(t){1===t[0]?this.stat.addComp(R.AUTO_INFO.name,R.AUTO_INFO.UP_CNT,1):2===t[0]?this.stat.addComp(R.AUTO_INFO.name,R.AUTO_INFO.DOWN_CNT,1):3===t[0]&&this.stat.addComp(R.AUTO_INFO.name,R.AUTO_INFO.BACK_CNT,1),this.stat.setComDim(R.DIM_COM.AUTO_USER_TAGS,this.handler.autoUserTags);var e=this.stat.createAct(R.ACT.SWITCH_AUTO,{value:t});this.tsdb.sendMetrics([e])}},{key:"sendSwitchCost",value:function(t,e){this.stat.setComDim(R.DIM_COM.AUTO_USER_TAGS,this.handler.autoUserTags),this._sendMetric(R.ACT.SWITCH_COST,t,e)}},{key:"sendSwitchPts",value:function(t,e){this.stat.setComDim(R.DIM_COM.AUTO_USER_TAGS,this.handler.autoUserTags),this._sendMetric(R.ACT.SWITCH_PTS,t,e)}},{key:"_sendMetric",value:function(t,e,i){var s=this.stat.createAct(t,{value:e,str:i});this.tsdb.sendMetrics([s])}}]),t}(),r0=i(17),r1=i.n(r0),r2=function(){function t(e,i){Object(s.a)(this,t),this.stat=e,this.tsdb=i,this.isP2PUseH265=!0,this.isFlvUseH265=!0,this.isHlsUseH265=!0,this.costUs=0,this.isCodecSupport=!1,this.codecSupportReason=-1e4,this.isBrowserSupport=!1,this.isCfgSupport=!1,this.serverSupported=!1,this.lastCurBitrate=0,this.lastLine=0,this.isUseH265Mse=!0}return Object(r.a)(t,[{key:"destroy",value:function(){}},{key:"isSupported",get:function(){var t=this.isCodecSupport&&this.isBrowserSupport&&this.isCfgSupport;return 1==Number(D._localCloseHevc)&&(t=!1),1===Number(D._enableForceH265)&&(t=!0),t}},{key:"canPreload",get:function(){return this.isBrowserSupport&&this.isCfgSupport}},{key:"onTurntoH264",value:function(t){t===tQ.P2P?this.isP2PUseH265=!1:t===tQ.FLV?this.isFlvUseH265=!1:t==tQ.HLS&&(this.isHlsUseH265=!1)}},{key:"onTurntoH265Wasm",value:function(){this.isUseH265Mse=!1}},{key:"init",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.resetProps(t),this._initCodec(t),this._initBrowser(),this._initRandom(t),this._initCfg(t),this.lastCurBitrate=Number(t.curBitrate),this.lastLine=Number(t.lineType),I.log("H265Support.init isCodecSupport=".concat(this.isCodecSupport," isBrowserSupport=").concat(this.isBrowserSupport," isCfgSupport=").concat(this.isCfgSupport))}},{key:"mseHevcInit",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.resetMseHevcProps(t),this._initBrowserMseHevcSupport(t),this._initMseHevcCodec(t),this._initMseHevcCfg(t),this.lastCurBitrate=Number(t.curBitrate),this.lastLine=Number(t.lineType),I.log("H265Support.mseHevcInit isCodecSupport=".concat(this.isCodecSupport," isBrowserSupport=").concat(this.isBrowserSupport," isCfgSupp
1ort=").concat(this.isCfgSupport))}},{key:"resetProps",value:function(t){this.isCodecSupport=!1,this.codecSupportReason=-1e4,this.isBrowserSupport=!1,this.isCfgSupport=!1;var e=Number(t.lineType),i=Number(t.curBitrate);(0!=this.lastCurBitrate&&this.lastCurBitrate!=i||0!=this.lastLine&&this.lastLine!=e)&&(this.isP2PUseH265=!0,this.isFlvUseH265=!0,this.isHlsUseH265=!0)}},{key:"resetMseHevcProps",value:function(t){this.resetProps(t);var e=Number(t.lineType),i=Number(t.curBitrate);(0!=this.lastCurBitrate&&this.lastCurBitrate!=i||0!=this.lastLine&&this.lastLine!=e)&&(this.isUseH265Mse=!0)}},{key:"_initCodec",value:function(t){var e=arguments;if(1==D.open265&&(D.w265LastCost=0),this.isReport265||t.type===tQ.STREAM||(this.tsdb.sendMetrics([this.stat.createAct(R.ACT.H265_STATUS,{value:[10],str:[O.is64bitSoftware()?1:2,navigator.userAgent]})]),I.log("HYPlayer.initH265 support hardwareConcurrency hardwareConcurrency=",navigator.hardwareConcurrency),this.isReport265=!0),this._isSupported(t)&&r1.a&&r1.a.getInstance){var i={enableWebH265:1,baseCostUs:{2e3:32e3,4e3:3e4},loopCount:100,singleThreadBitKbps:[10],multiThreadBitKbps:[4e3,2e3,500],threadCount:2,degrade:0,statIntervalMs:1e3,fmt:11,share:0,wasmLoad:500,core:{2e3:3,4e3:4},x86:{4e3:1}},s={};i.x86={4e3:1},F.h265Config[0][0].forEach(function(t,e){s[t]=F.h265Config[0][1][e]}),i.baseCostUs=s,i.multiThreadBitKbps=F.h265Config[1];var r={};F.h265Config[3][0].forEach(function(t,e){r[t]=F.h265Config[3][1][e]}),i.core=r,r1.a.getInstance().parseConfigs(i);var a=t.curBitrate,n=r1.a.getInstance().isSupportH265(a);I.log("H265Support.initH265 bitRate",a,n),this.isCodecSupport=n.isSupport,0==F.vodH265Config[2]&&t.type===tQ.HLS&&(this.isCodecSupport=!1),this.costUs=n.costUs,this.codecSupportReason=n.reason,this.tsdb.sendMetrics([this.stat.createAct(R.ACT.H265_STATUS,{value:[2],str:[n.reason]})]),r1.a.getInstance().setLogCallback(function(){var t=["H265 render setLogCallback"].concat(Array.apply(null,e));I.log.apply(I,t)})}}},{key:"_initMseHevcCodec",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.isUseH265Mse){if(this._isSupported(t)){this.isCodecSupport=!1;var e=t.curBitrate;if(S.version.major>=F.h265MseChromeConfig[0])navigator.hardwareConcurrency<F.h265MseChromeConfig[2]?this.isCodecSupport=!1:this.isCodecSupport=!0;else{if(F.h265MseConfig[4].length>0){var i={},s={},r={};if(F.h265MseConfig[4][0].forEach(function(t,e){i[t]=F.h265MseConfig[4][1][e],s[t]=F.h265MseConfig[4][2][e],r[t]=F.h265MseConfig[4][3][e]}),navigator.hardwareConcurrency<=i[e]){if(!(s[e]&&navigator.hardwareConcurrency>s[e]))return void I.warn("H265Support._initMseHevcCodec Mse Config: curThread=".concat(navigator.hardwareConcurrency," isn't greater than thread=").concat(i[e]));if(this.isBrowserSupport&&r[e]){var a=tz().toLowerCase();if(!(a.indexOf(r[e])>=0))return void I.warn("H265Support._initMseHevcCodec Mse Render Config: curRender=".concat(a," isn't suppored render=").concat(r[e]));this.isCodecSupport=!0}}}this.isCodecSupport=!0}}0==F.vodH265Config[1]&&t.type===tQ.HLS&&(this.isCodecSupport=!1)}else this.isCodecSupport=!1}},{key:"_isSupported",value:function(t){var e=!1;if(t.type===tQ.HLS){if(t.h265Url&&(this.serverSupported=!0),t.h265Url&&this.isHlsUseH265)return!0}else{if(e=t.iIsHEVCSupport>0&&t.iHEVCBitRate>=0||this._isH265(t.iCodecType)&&0===t.iBitRate,this.serverSupported=e,t.type===tQ.FLV)return this.isFlvUseH265&&e||1==D._enableServer265;if(t.type===tQ.P2P)return this.isP2PUseH265&&e||1==D._enableServer265}return!1}},{key:"_isH265",value:function(t){return 1===t||4===t||6===t||8===t}},{key:"_initBrowser",value:function(){var t=S.version.major,e=!1;S.chrome&&t>=F.h265Config[2]&&(e=!0),S.chrome&&-1!==F.wasm265BlackBrowVers.indexOf(t)&&(I.log("H265Support._initBrowser wasm265BlackBrowVers",F.wasm265BlackBrowVers),e=!1),1===Number(D._enableBrowser)&&(e=!0),"undefined"==typeof SharedArrayBuffer&&(e=!1),this.isBrowserSupport=e}},{key:"_initBrowserMseHevcSupport",value:function(t){var e=A.isMseSupportedHevc();if(e){var i=F.h265MseConfig[1];if(i.length>0){var s=S.version.major;e=S.chrome&&i.indexOf(s)>=0?e&&!0:e&&!1}S.chrome&&S.version.major>=F.h265MseChromeConfig[0]&&(e=!0,e=this.getChromeHevcRenderSupport(t))}else I.warn("H265Support._initMseHevcCodec browser isn't supported mse h265");1==Number(D._closeMseHevc)&&(e=!1),1===Number(D._enableMseHevcBrowser)&&(e=!0),this.isBrowserSupport=e}},{key:"_initRandom",value:function(t){var e=this._getRandomUse(t);this.isCodecSupport&&(e||(this.isCodecSupport=!1)),t.randomH265=e}},{key:"_getRandomUse",value:function(t){var e=D.h265PresentUid,i=t.presenterUid,s=!0,r=F.h265BlackUids;if(2==t.liveType&&(r=F.replayH265BlackUids),r.forEach(function(t){i&&t.toString()==i.toString()&&(s=!1)}),!s)return!1;if(2==t.liveType||3==t.liveType){var a=F.whiteH265Uids;if(0==a[1]){var n=!1;
1return a[0].forEach(function(t){i&&t.toString()==i.toString()&&(n=!0)}),n}}D.randomH265Percent&&e==i||(D.randomH265Percent=F.randomH265Percent),1==D.open265?D.randomH265Percent=3e3:2==D.open265&&(D.randomH265Percent=6e3);var o=Number(D.randomH265Percent);return D.h265PresentUid=t.presenterUid,o<F.h265PercentConfig}},{key:"_initCfg",value:function(t){var e=1===Number(F.isConfigSupportH265);3!=t.liveType&&2!=t.liveType||(e=1===Number(F.isVodSupportH265)),(F.isCloseAllFuncs(t.uid)||-1!=F.wcsSoft264Uids.indexOf(Number(t.uid)))&&(e=!1,I.log("H265Support._initCfg closeAllFuncs!")),-1!==F.h265BlackBrows.indexOf(S.version.major)&&(e=!1),F.wasmCloseCfg.length>0&&1==F.wasmCloseCfg[0]&&(I.log("H265Support._initCfg wasm close!"),e=!1),F.wasmCloseCfg.length>0&&F.wasmCloseCfg[1].length>0&&-1!=F.wasmCloseCfg[1].indexOf(Number(t.presenterUid))&&(I.log("H265Support._getConfigUse wasm black anchoruid"),e=!1),this.isCfgSupport=e}},{key:"_initMseHevcCfg",value:function(t){var e=1===Number(F.h265MseConfig[0])&&1===Number(F.isConfigSupportH265);if(t.type==tQ.HLS&&(e=1===Number(F.isVodSupportH265)),(F.isCloseAllFuncs(t.uid)||-1!==F.wcsSoft264Uids.indexOf(Number(t.uid)))&&(e=!1,I.log("H265Support._initCfg closeAllFuncs!")),-1!==F.h265BlackBrows.indexOf(S.version.major)&&(e=!1),S.version.major>=F.h265MseChromeConfig[0]&&t.curBitrate<=F.h265MseChromeConfig[1])this.isCfgSupport=e;else{var i=F.h265MseConfig[2];i.length>0&&i.indexOf(t.curBitrate)>=0?e=e&&!0:(I.warn("H265Support._initMseHevcCodec Mse Config: bitrate ".concat(t.curBitrate," isn't supported mse h265")),e=e&&!1);var s=F.h265MseConfig[3];s.length>0&&(s.indexOf(t.lineType)>=0?e=e&&!0:(I.warn("H265Support._initMseHevcCodec Mse Config: line ".concat(t.lineType," isn't supported mse h265")),e=e&&!1))}var r=F.h265MseWhiteBlackUids[0];r.length>0&&(t.presenterUid&&r.indexOf(Number(t.presenterUid))>=0?e=e&&!0:(e=e&&!1,I.warn("H265Support._initMseHevcCodec uid ".concat(t.presenterUid," isn't in white list"))));var a=F.h265MseWhiteBlackUids[1];a.length>0&&t.presenterUid&&a.indexOf(Number(t.presenterUid))>=0&&(e=e&&!1,I.warn("H265Support._initMseHevcCodec uid ".concat(t.presenterUid," is in black list"))),this.isCfgSupport=e}},{key:"getChromeHevcRenderSupport",value:function(t){return 0!=F.h265MseChromeConfig[4]&&-1===F.wcs265BlackUids.indexOf(Number(t.uid))&&-1===F.mse265BlackUids.indexOf(Number(t.uid))&&(-1!=F.enableEdgeBroMseCfg.indexOf(S.version.major)||-1===S.name.indexOf("edg")||1!=t._isTurnTomse)}}]),t}(),r3={NO_DATA:1,NO_DECODE:2,WORKER_ERROR:3,DECODE_ERROR:4,RENDER_ERROR:5,NO_RENDER:6,YUV_OUT_LIMIT:8,WASM_TIMEOUT:9,CREATE_WEBGL_FAIL:10,CREATE_WORKER_ERROR:11,AUDIO_FAST:12,VIDEO_FAST:13,START_CODE_ERROR:14,WORKER_TIMEOUT:15,RETRY_MAX:16,dic:{1:"20sæ æ°æ®",2:"10sæ è§£ç ",3:"workerå¼å¸¸",4:"è§£ç 失败",5:"渲æå¤±è´¥",6:"10sæ æ¸²æ",7:"è§£ç åéå大äº2000",8:"yuvéå大äº300",9:"wasm timeout",10:"å建webgl失败",11:"web workerå¼å¸¸",12:"é³é¢å¿«ï¼è§é¢æ
¢ï¼å264",13:"é³é¢æ
¢ï¼è§é¢å¿«ï¼å264",14:"hevcFindNextStartCode failed",15:"workerè¶
æ¶",16:"éè¯è¶
è¿æå¤§æ¬¡æ°"}},r5=function(){function t(e,i){Object(s.a)(this,t),this._stat=e,this._tsdb=i,this._onMessageBind=this._onMessage.bind(this),this._onErrorBind=this._onError.bind(this),this._startTs=0,this._readyTs=0,this._isReady=!1,this._isTimeout=!1,this._isError=!1,this._decoder=null,this._callbacks=null,this._onMessageCb=null}return Object(r.a)(t,[{key:"onMessageCb",set:function(t){this._onMessageCb=t}},{key:"decoder",get:function(){return this._decoder}},{key:"isReady",get:function(){return this._isReady}},{key:"terminate",value:function(){I.log("H265Decoder.terminate"),this._destroyDecoder(),tP.remove(this._onTimeout,this),this._callbacks=null,this._onMessageCb=null,this._isReady=!1,this._startTs=0,this._readyTs=0}},{key:"destroy",value:function(){I.log("H265Decoder.destroy"),this._stat=null,this._tsdb=null,this._callbacks=null,this._onMessageCb=null,this.stopDecoder(),this._decoder&&this._decoder.terminate(),tP.remove(this._onTimeout,this)}},{key:"_destroyDecoder",value:function(){if(this._decoder){this._decoder.onmessage=null,this._decoder.onerror=null,this.stopDecoder();try{this._decoder.terminate()}catch(t){I.log("H265Decoder._destroyDecoder",t)}this._decoder=null}}},{key:"stopDecoder",value:function(){this._decoder&&this._decoder.postMessage({t:6})}},{key:"load",value:function(t,e){if("undefined"!=typeof SharedArrayBuffer)if(this._callbacks=e,this._decoder)this._callbacks&&this._callbacks.ready();else{var i=S.chrome&&S.version.major>=91;1==Number(D._unSupportSimd)&&(i=!1),I.log("H265Decoder.load"),this._startTs=g.now();var s=new Blob(['importScripts("'.concat(t+(i?"decoder.worker.simd-v1.0.js":"decoder.worker-v1.0.js"),'")')],{type:"application/javascript"}),r=new Worker(window.URL.createObjectURL(s));r.onmessage=this._onMessageBind,r.onerror=this._onErrorBind,this._decoder=r,tP.remove(this._onTimeout,this),tP.once(this._onTimeout,this,1e3)}}},{key:"_onMessage",value:function(e){switch(e.data.t){case 0:this._decoder.postMessage({t:1});break;case 2:I.log("H265Decoder._onMessage worker isReady!"),tP.remove(this._onTimeout,this),t.preloaded=!0,this._isReady=!0,this._readyTs=g.now();var i=this._readyTs-this._startTs;this._tsdb&&this._tsdb.sendMetrics([this._stat.createAct(R.ACT.H265_WORKER_LOAD_TS,{value:[i]})]),this._isError||this._isTimeout||this._callbacks&&this._callbacks.ready()}this._onMessageCb&&this._onMessageCb(e)}},{key:"_onError",value:function(t){I.error("H265Decoder._onError",t),this._tsdb&&this._tsdb.sendMetrics([this._stat.createAct(R.ACT.H265_STATUS,{value:[1],str:[r3.CREATE_WORKER_ERROR]})]),this._destroyDecoder(),tP.remove(this._onTimeout,this),this._readyTs=0,this._isReady=!1,this._isError=!0,D.h265WorkerError=1,this._callbacks&&this._callbacks.error()}}
1,{key:"_onTimeout",value:function(){I.log("H265Decoder._onTimeout"),this._tsdb&&this._tsdb.sendMetrics([this._stat.createAct(R.ACT.H265_STATUS,{value:[1],str:[r3.WORKER_TIMEOUT]})]),this._destroyDecoder(),this._readyTs=0,this._isTimeout=!0,this._isReady=!1,this._callbacks&&this._callbacks.timeout()}}]),t}();r5.preloaded=!1;var r6=function(){function t(){Object(s.a)(this,t),this.count=0,this.arr=[]}return Object(r.a)(t,[{key:"inc",value:function(t){this.count+=t}},{key:"dec",value:function(t){this.count-=t,this.count<0&&(this.count=0)}},{key:"collect",value:function(){this.arr.push(this.count),this.count=0}},{key:"stat",value:function(){var t=this.arr;return this.arr=[],t}},{key:"reset",value:function(){this.count=0,this.arr=[]}}]),t}(),r4={toDecode:0,decoded:1,render:2,throwFrame:3,throwRaw:4,rawList:5,frameList:6},r8=function(){function t(){Object(s.a)(this,t),this.toDecodeItem=new r6,this.decodedItem=new r6,this.renderItem=new r6,this.throwFraItem=new r6,this.throwRawItem=new r6,this.rawItem=new r6,this.frameItem=new r6,this.rafItem=new r6,this.items=[this.toDecodeItem,this.decodedItem,this.renderItem,this.throwFraItem,this.throwRawItem,this.rawItem,this.frameItem,this.rafItem],this.reset()}return Object(r.a)(t,[{key:"inc",value:function(t,e){for(var i=0;i<t.length;i++){var s=this.getItem(t[i]);s&&s.inc(e[i])}this.collect()}},{key:"dec",value:function(t,e){for(var i=0;i<t.length;i++){var s=this.getItem(t[i]);s&&s.dec(e[i])}this.collect()}},{key:"collect",value:function(){var t=Date.now();if(0==this.lastStatTime&&(this.lastStatTime=t),t-this.lastStatTime>=1e3){for(var e=0;e<this.items.length;e++)this.items[e].collect();this.lastStatTime=t}}},{key:"getStat",value:function(){return{toDecode:this.toDecodeItem.stat(),decoded:this.decodedItem.stat(),render:this.renderItem.stat(),rawList:this.rawItem.stat(),frameList:this.frameItem.stat()}}},{key:"getItem",value:function(t){return t>=this.items.length?null:this.items[t]}},{key:"reset",value:function(){this.lastStatTime=0;for(var t=0;t<this.items.length;t++)this.items[t].reset()}}],[{key:"TYPES",get:function(){return r4}}]),t}(),r9=function(){function t(e,i){var r=i.resumeFunc,a=i.pauseFunc;Object(s.a)(this,t),this._player=e,this._playResume=r,this._playPause=a,this._paused=!1,this._playedPts=0,this._pausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0,this._lastCheck500CurrntTime=0}return Object(r.a)(t,[{key:"paused",get:function(){return this._paused}},{key:"pausedTs",get:function(){return this._pausedTs}},{key:"reset",value:function(){this._paused=!1,this._playedPts=0,this._pausedTs=0,this._lastCheckTime=0,this._lastCheck500Time=0,this._lastCheck500CurrntTime=0}},{key:"check",value:function(){var t=g.now(),e=this._player.getVideoPts();if(0!==this._playedPts){e===this._playedPts?this._paused||this._setPaused(t):this._paused&&this._setResume(t);var i=t-this._lastCheck500Time,s=Math.round(e-this._lastCheck500CurrntTime);(0==this._lastCheck500Time||i>=500)&&(0!=this._lastCheck500Time&&i-s>=F.pause500Cfg[0]&&(1==Number(D._printPauseCheck)&&I.log("H265Pause.check.500ms",i,s,i-s),this._player.check500Pause()),this._lastCheck500CurrntTime=e,this._lastCheck500Time=t)}this._playedPts=e}},{key:"_setPaused",value:function(t){this._paused=!0,this._pausedTs=t,I.log("H265Pause._setPaused _pausedTs=",t),this._playPause(t)}},{key:"_setResume",value:function(t){var e=t-this._pausedTs;I.log("H265Pause._setResume pausedTime=",e),this._playResume(t,e),this._paused=!1,this._pausedTs=0}}]),t}(),r7=function(){function t(e,i){Object(s.a)(this,t),this.stat=e,this.tsdb=i,this.fpsList=[],this.frameList=[],this.renderStat=[],this.decodedStat=[],this.toDecodeStat=[],this.frameListStat=[],this.avDeltaList=[],this.rafStat=[],this.rawListStat=[],this._videoTracks=[],this.resetProps(),this.stat=new r8,this.avgFrameGap=0,this.rafTime=0,this.isHidden=!1,this.retryFlvTimes=0,this.retryP2PTimes=0,this.retryHlsTimes=0,this.currentVideoDts=0,this.isH265Error=!1,this.workerStats={now:0,lastDecodedTs:0,lastRenderTs:0,isBrowserHidden:!1,userPaused:!1},this.rafFrameBind=this.rafFrame.bind(this),this.onVisibilityChangedBind=this.onVisibilityChanged.bind(this),this.pauseHanlder=new r9(this,{pauseFunc:this._playPause.bind(this),resumeFunc:this._playResume.bind(this)}),this.workerSharedArrayBuffer=null,this.isH265Played=!1,this.videoPlayerElement=null}return Object(r.a)(t,[{key:"addEvents",value:function(){this.mse&&this.mse.handler&&this.mse.handler.eventEmitter&&this.mse.handler.eventEmitter.on(N.VISIBILITY_CHANGE,this.onVisibilityChangedBind)}},{key:"delEvents",value:function(){this.mse&&this.mse.handler&&this.mse.handler.eventEmitter&&this.mse.handler.eventEmitter.off(N.VISIBILITY_CHANGE,this.onVisibilityChangedBind)}},{key:"addTimer",value:function(){tP.add(this.timerHandler,this,1e3)}},{key:"delTimer",value:function(){tP.remove(this.timerHandler,this)}},{key:"attachMse",value:function(t){I.log("H265Player.attachMse"),this.mse=t,this.resetProps(),this.isH265Played=!1;var e=g.now();
1this.onVideoFrameTime=e,this.pushVideoTime=e,this.workerHeartTime=e,this.updteFpsTime=0,this.rafId=null,this.rafFrame(),this._initGL(t),this.addEvents(),this.addTimer()}},{key:"_initGL",value:function(t){var e=t.h265Proxy.decoder;if(e.onMessageCb=this._onMessage.bind(this),this.decoder=e.decoder,this.decoder.postMessage({t:8,d:F.h265Config}),this.isPlaying=!0,this.canvas=document.createElement("canvas"),this.canvas.width=t.getWidth(),this.canvas.height=t.getHeight(),I.log("H265Player._initGL width=".concat(t.getWidth()," height=").concat(t.getHeight())),this.isSupportVideoTrack="undefined"!=typeof MediaStreamTrackGenerator&&"undefined"!=typeof VideoFrame,1==Number(D._forceWasmWebgl)&&(this.isSupportVideoTrack=!1),this.isSupportVideoTrack)this.videoPlayerElement=document.createElement("video"),this.videoPlayerElement.muted=!0,this.agenerator=new MediaStreamTrackGenerator({kind:"video"}),this.processedStream=new MediaStream([this.agenerator]),this.videoPlayerElement.srcObject=this.processedStream,this.decoder.postMessage({t:10,agenerator:this.agenerator.writable,width:this.mse.getWidth(),height:this.mse.getHeight(),config:F.h265Config[6],isPostRenderCallback:F.renderStat[0],devicePixelRatio:window.devicePixelRatio},[this.agenerator.writable]);else{var i=this.canvas.transferControlToOffscreen();this.decoder.postMessage({t:10,canvas:i,width:this.mse.getWidth(),height:this.mse.getHeight(),config:F.h265Config[6],isPostRenderCallback:F.renderStat[0],devicePixelRatio:window.devicePixelRatio},[i])}this._initDecodeWorker()}},{key:"updateSize",value:function(){}},{key:"resetProps",value:function(){this.canvas=null,this.frameList.length=0,this.isPlaying=!1,this._audioErrorCnt=0,this.onVideoFrameTime=0,this.pushVideoTime=0,this.workerHeartTime=0,this.decodeNow=0,this.renderTime=0,this.curPic=null,this.pauseDecode=!1,this.avgFrameGap=33,this.updteFpsTime=0,this.rafTime=0,this.pauseCnt=0,this.videoPauseCnt=0,this.countHeart=0,this.rafNoRenderCount=0,this.isFirsrToDecode=!1,this.toDecodeStamp=0,this.isFirstDecoded=!1,this.decodedStamp=0,this.isFirstRender=!1,this.renderStamp=0,this.hlsStarted=!1,this.fpsList.length=0,this.frameList.length=0,this.renderStat.length=0,this.decodedStat.length=0,this.toDecodeStat.length=0,this.frameListStat.length=0,this.rafStat.length=0,this.rawListStat.length=0,this._videoTracks.length=0,this.avDeltaList.length=0,this.userPaused=!1,this.isH265Error=!1,this.pauseStartTs=0,this.pauseMobStartTs=0,this.isRenderFpsPaused=!1,this.isFramePaused=!1,this.pauseMobCnt=0,this.rafLastNow=0,this.hiddenStartTs=0,this.pause500Cnt=0,this.isWasmPlay=!1,this.currentVideoDts=0,this.isSupportVideoTrack=!1}},{key:"timerHandler",value:function(){var t=g.now();this.checkTimer(t),this.timerTime=t}},{key:"checkTimer",value:function(){var t=this;if(this.mse&&this.mse.handler&&!this.userPaused&&(this.mse.handler.playerType!=tQ.HLS||this.hlsStarted)&&!this.isH265Error){var e=g.now();0!=this.workerHeartTime&&e-this.workerHeartTime>5e3&&this.mse.h265Proxy&&(I.log("H265Player.checkTimer worker error"),this.mse.h265Proxy.terminate(),setTimeout(function(){t.handlerError(r3.WORKER_ERROR),t.turnToH264(r3.WORKER_ERROR)},200));var i=this.getPts()-this.getVideoPts();this.avDeltaList.push(Math.floor(i)),this.pushVideoTime>0&&e-this.pushVideoTime>F.h265NoPushVideoDis&&(I.log("H265Player.checkTimer pushVideoFrame timeout"),this.autoReport(),this.handlerError(r3.NO_DATA))}}},{key:"onVisibilityChanged",value:function(){document.hidden||document.webkitHidden||document.mozHidden||document.msHidden?(this.hiddenStartTs=g.now(),I.log("H265Player.onVisibilityChanged isHidden true",this.hiddenStartTs),this.isHidden=!0,this.decoder&&this.decoder.postMessage({t:12})):(I.log("H265Player.onVisibilityChanged isHidden false"),this.renderTime=0,this.isHidden=!1,this.hiddenStartTs=0,this.decoder&&this.decoder.postMessage({t:13}))}},{key:"_onMessage",value:function(t){if(this.mse&&this.mse.handler&&(this.mse.handler.playerType!=tQ.HLS||this.hlsStarted)){var e=t.data;if(!this.isH265Error){var i=g.now();switch(e.t){case 5:case 11:case 12:break;case 7:if(!this.isPlaying)return;e.d.logList&&e.d.logList.length>0&&(I.log("H265Player.onmessage.worker.log",e.d.logList.join(",")),e.d.logList=[]),this.onDecodeError(e.d.data);break;case 9:if(0==e.d.length)return;I.log("H265Player.onmessage.worker.log",e.d.join(",")),e.d=[];break;case 10:this.workerHeartTime=i,this.countHeart++,this.countHeart%20==0&&I.log("H265Player.onmessage.webWorker.heart",e.d&&JSON.stringify(e.d)),this.workerStats=e.d,this.workerStats&&this.workerStats.now>0&&(this.workerStats.lastDecodedTs>0&&this.workerStats.now-this.workerStats.lastDecodedTs>1e4?this.handlerError(r3.NO_DECODE):this.workerStats.lastRenderTs>0&&this.workerStats.now-this.workerStats.lastRenderTs>1e4&&this.handlerError(r3.NO_RENDER));break;case 13:this.onRenderError(e.d);break;case 14:var s=e.d.renderNow,r=e.d.decodedNow,a=Date.now()-s;I.log("H265Player.onmessage render play postMessage cost",a),this.isFirstDecoded||(this.decodedStamp=r,this.isFirstDecoded=!0),this.isFirstRender||(this.renderStamp=s,this.isFirstRender=!0,I.log("H265Player.onmessage é帧å°è§£ç ï¼è§£ç å°æ¸²æèæ¶",this.decodedStamp-this.toDecodeStamp,this.renderStamp-this.decodedStamp)),this.mse&&this.mse.handler&&(this.mse.handler.setWasmPlaying&&this.mse.handler.setWasmPlaying(),this.isH265Played=!0,this.mse.triggerH265Play(this.decodedStamp-this.toDecodeStamp,this.renderStamp-this.decodedStamp),this.triggerWasmPlay());break;case 15:this.pauseCnt++,I.log("H265Player.onmessage pauseCnt",this.pauseCnt);break;case 16:I.log("H265Player.onmessage worker noRender 10s",this.isHidden),this.handlerError(r3.NO_RENDER),this.autoReport();break;case 17:this.handlerError(r3.NO_DECODE);break;case 18:e.d.render.length>0&&(this.renderStat=this.renderStat.concat(e.d.render)),e.d.decoded.length>0&&(this.decodedStat=this.decodedStat.concat(e.d.decoded)),e.d.toDecode.length>0&&(this.toDecodeStat=this.decodedStat.concat(e.d.toDecode)),e.d.frameList.length>0&&(this.frameListStat=this.frameListStat.concat(e.d.frameList)),e.d.raf.length>0&&(this.rafStat=this.rafStat.concat(e.d.raf)),e.d.rawList.length>0&&(this.rawListStat=this.rawListStat.concat(e.d.rawList));break;
1case 19:this.handlerError(r3.YUV_OUT_LIMIT);break;case 20:this.reportError(r3.CREATE_WEBGL_FAIL),this.turnToH264(r3.CREATE_WEBGL_FAIL);break;case 21:if(this.reportError(r3.AUDIO_FAST),1==D._closeTurnTo264)return;this.turnToH264(r3.AUDIO_FAST);break;case 22:if(this.reportError(r3.VIDEO_FAST),1==D._closeTurnTo264)return;this.turnToH264(r3.VIDEO_FAST);break;case 23:var n=e.data.width,o=e.data.height;I.log("H265Player.onMessage 23 width=".concat(n," height = ").concat(o)),this.mse.setResolution&&this.mse.setResolution(n,o);break;case 24:if(this.mse&&e&&e.d){this.mse.setVideoCurrentTimeHand(e.d.minusBuffer,e.d.bufLen,e.d.type,e.d.timeNow);var u=this.getPts();0!=u&&this.storeAudioDts(u)}break;case 25:this.isHidden&&this.rafTimer();break;case 26:this.workerSharedArrayBuffer=e.d.workerSharedArrayBuffer;break;case 27:if(this.mse.isLive&&this.mse.onWasmRenderCallback&&this.mse.onWasmRenderCallback(),this.mse.isLive&&F.renderStat[0]){var l=this.getVideoPts();this.mse.videoPlayConsuming.addRenderFrameData(l,g.now()),this.mse.audioPlayConsuming.addRenderFrameData(l,g.now()),this.mse.renderFps.addRender()}break;case 28:this.setFramePause(i);break;case 29:this.setFrameRusume(i);break;case 30:1==F.mobVBlockCfg&&(this.isRenderFpsPaused=!0)}}}}},{key:"setFramePause",value:function(t){this.isFramePaused||(this._playMobPause(t),this.isFramePaused=!0)}},{key:"setFrameRusume",value:function(t){this.isFramePaused&&(this._playMobResume(t),this.isFramePaused=!1)}},{key:"triggerWasmPlay",value:function(){!this.isWasmPlay&&this.videoPlayerElement&&(this.videoPlayerElement.play(),this.isWasmPlay=!0)}},{key:"getRenderElement",value:function(){return this.isSupportVideoTrack?this.videoPlayerElement:null}},{key:"_initDecodeWorker",value:function(t){var e=new SharedArrayBuffer(1024);this.mainSharedArrayBuffer=new Uint32Array(e),this.decoder.postMessage({t:16,d:this.mainSharedArrayBuffer})}},{key:"rafFrame",value:function(){1==Number(D._print265RenderInterval)&&!this.isRenderInterval&&this.decoder&&(this.isRenderInterval=!0,this.isNotRenderInterval=!1,this.decoder.postMessage({t:14,d:0})),0==Number(D._print265RenderInterval)&&!this.isNotRenderInterval&&this.decoder&&(this.isNotRenderInterval=!0,this.isRenderInterval=!1,this.decoder.postMessage({t:14,d:1})),this.rafFrameBind&&(this.rafId=e$(this.rafFrameBind)),this.rafTimer()}},{key:"rafTimer",value:function(){var t=g.now();(0==this.rafLastNow||t-this.rafLastNow>=100)&&!this.userPaused&&this.isH265Played&&(this.pauseHanlder.check(t),this.rafLastNow=t),this.storeMainBuffer(),this.getFps()}},{key:"getFps",value:function(){if(this.mse.parser.fps){var t=g.now();if(t-this.updteFpsTime>=1e3){if(this.fpsList.length>=5){var e=0;this.fpsList.forEach(function(t){e+=t});var i=Math.floor(1e3/(e/5));this.avgFrameGap=i>this.avgFrameGap?this.avgFrameGap:i,this.decoder.postMessage({t:9,d:this.avgFrameGap}),this.fpsList.length=0}else this.fpsList.push(this.mse.parser.fps.getFps());this.updteFpsTime=t}}}},{key:"check500Pause",value:function(){1!=F.pause500Cfg&&this.pause500Cnt++}},{key:"getStats",value:function(t){var e=g.now();t?(this._checkPaused(e,rF),this._checkMobPaused(e,rF)):(this._checkPaused(e,rw),this._checkMobPaused(e,rw));var i=this.stat.getStat();i.decoded=[].slice.call(this.decodedStat),i.render=[].slice.call(this.renderStat),i.toDecode=[].slice.call(this.toDecodeStat),i.frameList=[].slice.call(this.rafStat),i.deltaList=v(this.avDeltaList),i.rawListWorker=[].slice.call(this.rawListStat);var s="H265Player.getStats\n";for(var r in i)s+="".concat(r,": ").concat(i[r].toString(),"\n");I.log(s),this.avDeltaList.length=0;var a={frameListLen:this.frameList.length,statProps:i,h265PauseCnt:this.pauseCnt,videoPauseCnt:this.videoPauseCnt,videoPauseTime:this.pauseTime,isVideoPaused:this.pauseStartTs>0,hiddenTime:0==this.hiddenStartTs?0:e-this.hiddenStartTs,pause500CntH265:this.pause500Cnt,isFramePaused:this.pauseMobCnt>0||this.pauseMobStartTs>0||this.isRenderFpsPaused};return this.isRenderFpsPaused=!1,this.pauseMobCnt=0,this.resetStats(),a}},{key:"resetStats",value:function(){this.pauseCnt=0,this.videoPauseCnt=0,this.pauseTime=0,this.renderStat.length=0,this.decodedStat.length=0,this.toDecodeStat.length=0,this.frameListStat.length=0,this.rafStat.length=0,this.rawListStat.length=0,this.pause500Cnt=0}},{key:"pushVideoFrame",value:function(t){if(this.isPlaying&&!this.isH265Error){var e,i=g.now();for(this.stat.inc([r8.TYPES.rawList],[t.samples.length]);t&&t.samples&&t.samples.length;){var s={units:(e=t.samples.shift()).units,dtsInMs:e.dts/90,ptsInMs:e.pts/90,key:+!!e.key};this.currentVideoDts=e.dts/90,this.isFirsrToDecode||(this.toDecodeStamp=Date.now(),this.isFirsrToDecode=!0),1==Number(D._printH265VideoFrame)&&I.log("H265Player.pushVideoFrame objData",s),this.decoder.postMessage({t:4,d:s})}this.mse.isLive&&this.mse.videoPlayConsuming.pushRemuxedVideoFrameData(i),this.pushVideoT
1ime=i}}},{key:"toHexString",value:function(t){return Array.prototype.map.call(t,function(t){return("0"+(255&t).toString(16)).slice(-2)}).join(" ")}},{key:"getPts",value:function(){if(F.dtsJumpOpen){if(this.mse&&this.mse.getCorrentCurrentDts)return this.mse.getCorrentCurrentDts()}else if(this.mse&&this.mse.getCurrentDts)return this.mse.getCurrentDts();return 0}},{key:"getCurrentTime",value:function(){return this.mse&&this.mse.getCurrentTime?this.mse.getCurrentTime():0}},{key:"getInitDts",value:function(){return this.mse&&this.mse.getInitDts?this.mse.getInitDts():0}},{key:"autoReport",value:function(){1==F.isAutoH265&&this.mse&&this.mse.handler&&this.mse.handler.eventEmitter&&(I.log("H265Player.autoReport"),this.mse.handler.eventEmitter.trigger(N.P2P_REPORT))}},{key:"destroy",value:function(){this.delTimer(),this.delEvents(),this.resetStats(),I.log("H265Player.destroy, rafid=",this.rafId),eZ(this.rafId),this.rafId=null,clearInterval(this.timerHandler),this.decoder&&this.decoder.postMessage({t:6}),this.isH265Played=!1,this.resetProps(),this.mse=null,this.pauseDecode=!1,this.stat.reset(),this.mainSharedArrayBuffer&&Atomics.store(this.mainSharedArrayBuffer,0,0)}},{key:"onDecodeError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.code,i=t.desc;I.error("H265Player.onDecodeError desc",i,e),7==e?(this.reportError(r3.WASM_TIMEOUT),this.turnToH264(r3.WASM_TIMEOUT)):(this.autoReport(),this.handlerError(r3.DECODE_ERROR,e))}},{key:"onRenderError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.code,i=t.desc;I.error("H265Player.onRenderError desc",i,e),this.handlerError(r3.RENDER_ERROR)}},{key:"turnToH264",value:function(t){this.mse&&this.mse.turnToH264(t)}},{key:"retry",value:function(){if(this.mse&&this.mse.handler){var t=this.mse.handler.playerType;t==tQ.FLV?this.retryFlvTimes++:t==tQ.P2P?this.retryP2PTimes++:t==tQ.HLS&&this.retryHlsTimes++}this.mse&&this.mse.h265Retry()}},{key:"handlerError",value:function(t,e){if(this.isPlaying&&(I.log("H265Player.handlerError",t),this.reportError(t,e),this.mse&&this.mse.handler)){var i=this.mse.handler.playerType;i==tQ.FLV?this.retryFlvTimes>=10?this.turnToH264(r3.RETRY_MAX):this.retry():i==tQ.P2P?this.retryP2PTimes>=10?this.turnToH264(r3.RETRY_MAX):this.retry():i==tQ.HLS&&(this.retryHlsTimes>=10?this.turnToH264(r3.RETRY_MAX):this.retry())}}},{key:"reportError",value:function(t,e){this.isPlaying&&(this.isH265Error=!0,I.log("H265Player.reportError",t,r3.dic[t]),this.mse&&this.mse.handler)&&this.mse.handler.tsdb.sendMetrics([this.mse.handler.stat.createAct(R.ACT.H265_STATUS,{value:[1],str:[t,null!=e?e:1e4]})])}},{key:"reportDecodeRenderTime",value:function(t,e){I.log("H265Player.reportDecodeRenderTime",t,e),this.mse&&this.mse.handler&&this.mse.handler.tsdb.sendMetrics([this.mse.handler.stat.createAct("pcdn_video_load_ts",{value:[t,e]})])}},{key:"containerResize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.canvas){var e=this.canvas.clientWidth,i=this.canvas.clientHeight;t.width=e,t.height=i,this.decoder&&this.decoder.postMessage({t:15,d:t})}}},{key:"storeMainBuffer",value:function(){var t=this.getPts(),e=this.getCurrentTime();
1this.mainSharedArrayBuffer&&this.isPlaying&&(Atomics.store(this.mainSharedArrayBuffer,0,t),this.canvas&&(Atomics.store(this.mainSharedArrayBuffer,1,this.canvas.clientWidth),Atomics.store(this.mainSharedArrayBuffer,2,this.canvas.clientHeight)),Atomics.store(this.mainSharedArrayBuffer,4,e))}},{key:"storeAudioDts",value:function(t){this.mainSharedArrayBuffer&&this.isPlaying&&Atomics.store(this.mainSharedArrayBuffer,0,t)}},{key:"jumpBuffer",value:function(t,e,i,s){this.decoder&&this.decoder.postMessage({t:17,d:{minusBuffer:t,bufLen:e,type:i,timeNow:s}})}},{key:"onVideoPause",value:function(){I.log("H265Player.onVideoPause"),this.userPaused=!0,this.mainSharedArrayBuffer&&Atomics.store(this.mainSharedArrayBuffer,3,1)}},{key:"onVideoPlay",value:function(){I.log("H265Player.onVideoPlay"),this.userPaused=!1,this.mainSharedArrayBuffer&&Atomics.store(this.mainSharedArrayBuffer,3,0)}},{key:"getVideoPts",value:function(){return this.workerSharedArrayBuffer?Atomics.load(this.workerSharedArrayBuffer,5):0}},{key:"_playPause",value:function(t){this.pauseStartTs=t}},{key:"_playResume",value:function(t,e){this._checkPaused(t,rL)}},{key:"_playMobPause",value:function(t){this.pauseMobStartTs=t,this.pauseMobCnt++,I.log("H265Player._playMobPause,pauseMobStartTs=",this.pauseMobStartTs)}},{key:"_playMobResume",value:function(t,e){I.log("H265Player._playMobResume"),this._checkMobPaused(t,rL)}},{key:"_checkMobPaused",value:function(t,e){this.pauseMobStartTs>0&&(this.pauseMobStartTs=e===rw?t:0)}},{key:"_checkPaused",value:function(t,e){if(this.pauseStartTs>0){var i=t-this.pauseStartTs;i>=200&&(I.warn("H265Player._checkPaused type=".concat(e," pauseTime=").concat(i)),this.videoPauseCnt++,this.pauseTime+=i),this.pauseStartTs=e===rw?t:0}}},{key:"onVideoSeek",value:function(t){I.log("H265Player.onVideoSeek",this.getPts())}},{key:"seek",value:function(t){var e=this.getCurrentTime();t*=1e3;var i=this.getInitDts();I.log("H265Player.seek curTime=".concat(e,", time=").concat(t,", initDts=").concat(i)),this.decoder&&this.decoder.postMessage({t:18,d:{curTime:e,time:t,initDts:i}}),this.storeAudioDts(e+i)}},{key:"onEnded",value:function(){this.hlsStarted=!1}},{key:"onStarted",value:function(){this.hlsStarted=!0}},{key:"_getPlayerType",value:function(){if(this.mse&&this.mse.handler){var t=this.mse.handler.playerType;t==tQ.FLV?this.retryFlvTimes++:t==tQ.P2P?this.retryP2PTimes++:t==tQ.HLS&&this.retryHlsTimes++}}},{key:"on265StartCodeError",value:function(){this.isH265Error||(this.isH265Error=!0,this.handlerError(r3.START_CODE_ERROR),this.turnToH264(r3.START_CODE_ERROR))}},{key:"getCurrentVideoTime",value:function(){return this.getVideoPts()-this.getInitDts()}},{key:"getVideoBufferLen",value:function(){return 0==this.currentVideoDts?0:(this.currentVideoDts-this.getVideoPts())/1e3}}],[{key:"isSupported",value:function(){return"object"==typeof WebAssembly}}]),t}(),at=function(){function t(e,i){Object(s.a)(this,t),this.stat=e.stat,this.tsdb=e.tsdb,this.vodStat=e.vodStat,this.handler=i,this.reset()}return Object(r.a)(t,[{key:"destroy",value:function(){}},{key:"addH265Support",value:function(t,e){var i=t;if(-1e4==i){var s=this.handler.h265Support,r=s.serverSupported,a=s.isCodecSupport,n=s.isBrowserSupport,o=s.isCfgSupport;r?o?n?a?o&&n&&a&&(i=0):i=6:i=5:i=4:i=1}this.stat.setComDim(R.DIM_COM.H265_SUPPORT_REASON,i),!e.isLive&&this.vodStat&&this.vodStat.setComDim(R.DIM_COM.H265_SUPPORT_REASON,i)}},{key:"addTurnTo264Support",value:function(t,e){var i=0;switch(t){case r3.WORKER_TIMEOUT:i=5;break;case r3.WORKER_ERROR:case r3.CREATE_WORKER_ERROR:i=6;break;case r3.START_CODE_ERROR:i=12;break;case r3.WASM_TIMEOUT:i=13;break;case r3.VIDEO_FAST:i=14;break;case r3.AUDIO_FAST:i=15;break;case r3.CREATE_WEBGL_FAIL:i=16;break;case r3.RETRY_MAX:i=17}this.stat.setComDim(R.DIM_COM.H265_SUPPORT_REASON,i),!e.isLive&&this.vodStat&&this.vodStat.setComDim(R.DIM_COM.H265_SUPPORT_REASON,i)}},{key:"addH265SupportNew",value:function(t){var e,i=this.handler.h265Support,s=i.serverSupported,r=i.isCodecSupport,a=i.isBrowserSupport,n=i.isCfgSupport,o=i.codecSupportReason;if(s)if(n)if(a){if(r)n&&a&&r&&(e=1);else if(-1e4!=o)switch(o){case 2:e=7;break;case 3:e=8;break;case 5:e=9;break;case 6:e=10;break;case 7:e=11}}else e=3;else e=4;else e=2;this.stat.setComDim(R.DIM_COM.H265_SUPPORT_REASON,e),!t.isLive&&this.vodStat&&this.vodStat.setComDim(R.DIM_COM.H265_SUPPORT_REASON,e)}},{key:"reset",value:function(){}}]),t}(),ae=function(){function t(e,i,r){Object(s.a)(this,t),this._stat=e,this._vodStat=r,this._tsdb=i,this._support=new r2(e,i),this._decoder=new r5(e,i),this._render=new r7(e,i),this._h265StatReport=new at({stat:e,tsdb:i,vodStat:r},this),this._renderInited=!1,this._rendering=!1,this._isH265WasmCodec=!0,this._isH265Stream=!1,this._isLive=!0,this.decodeType="wasm"}return Object(r.a)(t,[{key:"isLive",set:function(t){this._isLive=t}},{key:"isH265Stream",set:function(t){this._isH265Stream=t}},{key:"stop",value:function(){I.log("H265Proxy.stop"),this._isH265Stream=!1,this._rendering=!1,this._renderInited=!1,this._decoder&&this._decoder.stopDecoder(),this._render&&this._render.destroy&&this._render.destroy()}},{key:"destroy",value:function(){this._render&&(this._render.destroy(),this._support.destroy(),this._decoder.destroy(),this._h265StatReport.destroy(),this._stat=null,this._tsdb=null,this._vodStat=null,this._render=null,this._support=null,this._decoder=null,this._h265StatReport=null,this._isH265Stream=!1)}},{key:"initSupport",value:function(t){this._support&&(this._isH265Stream=!1,this._support.init(t))}},{key:"loadDecoder",value:function(t,e){this._decoder.load(t,e)}},{key:"initRender",value:function(t){this.isSupported&&(this._isLive||this._isH265Stream)&&(I.log("H265Proxy.initRender isSupported=".concat(this._support.isSupported," isReady=").concat(this._decoder.isReady)),this._rendering=!1,this._renderInited=!1,this._render.destroy(),this.isReady&&(this._renderInited=!0,this._render.attachMse(t)))}},{key:"terminate",value:function(){this._decoder.terminate()}},{key:"containerResize",value:function(t){this.rendering&&this._render.containerResize(t)}
1},{key:"pushVideoFrame",value:function(t,e){this._rendering=!0,this._render&&this._render.pushVideoFrame(t,e)}},{key:"onTurnToH264",value:function(t){this._rendering=!1,this._renderInited=!1,this._support.onTurntoH264(t)}},{key:"checkUrl",value:function(t){this.isReady&&-1===t.url.indexOf("codec=265")&&(t.url+="&codec=265")}},{key:"on265StartCodeError",value:function(){this._render&&this._render.on265StartCodeError()}},{key:"reportDecodeRenderTime",value:function(t,e){this._render&&this._render.reportDecodeRenderTime(t,e)}},{key:"getStats",value:function(){return this._render&&this._render.getStats()}},{key:"jumpBuffer",value:function(t,e,i,s){this._rendering&&this._render.jumpBuffer(t,e,i,s)}},{key:"seek",value:function(t){this._render&&this._render.seek&&this._render.seek(t)}},{key:"onVideoPause",value:function(){this._render.onVideoPause()}},{key:"onVideoPlay",value:function(){this._render.onVideoPlay()}},{key:"onVideoSeek",value:function(t){this._render&&this._render.onVideoSeek&&this._render.onVideoSeek(t)}},{key:"onStarted",value:function(){this._render&&this._render.onStarted()}},{key:"onEnded",value:function(){this._render&&this._render.onEnded()}},{key:"getCurrentVideoTime",value:function(){return this._render&&this._render.getCurrentVideoTime?this._render.getCurrentVideoTime():0}},{key:"getVideoBufferLen",value:function(){return this._render&&this._render.getVideoBufferLen?this._render.getVideoBufferLen():0}},{key:"getRenderElement",value:function(){return this._render&&this._render.getRenderElement?this._render.getRenderElement():null}},{key:"render",get:function(){return this._render}},{key:"canvas",get:function(){return this._render.videoPlayerElement?this._render.videoPlayerElement:this._render.canvas}},{key:"isVideoTrack",get:function(){return this._render.isSupportVideoTrack}},{key:"decoder",get:function(){return this._decoder}},{key:"isSupported",get:function(){return this._support&&this._support.isSupported}},{key:"isReady",get:function(){return this._support&&this._support.isSupported&&this._decoder.isReady}},{key:"needPreload",get:function(){return!r5.preloaded&&this._support.canPreload&&!this._decoder.isReady}},{key:"renderInited",get:function(){return this._renderInited}},{key:"rendering",get:function(){return this._rendering}},{key:"h265StatReport",get:function(){return this._h265StatReport}},{key:"h265Support",get:function(){return this._support}},{key:"isServerSupported",get:function(){return this._support&&this._support.serverSupported}}]),t}(),ai=function(){function t(e,i,r){Object(s.a)(this,t),this._stat=e,this._vodStat=r,this._tsdb=i,this._support=new r2(e,i),this._h265StatReport=new at({stat:e,tsdb:i,vodStat:r},this),this._isH265MseCodec=!0,this._mse=null,this.decodeType="mse_hevc"}return Object(r.a)(t,[{key:"stop",value:function(){I.log("H265MseProxy.stop")}},{key:"destroy",value:function(){this._support&&this._support.destroy(),this._h265StatReport&&this._h265StatReport.destroy(),this._stat=null,this._tsdb=null,this._vodStat=null,this._support=null,this._h265StatReport=null,this._mse=null}},{key:"initSupport",value:function(t){this._support.mseHevcInit(t)}},{key:"initRender",value:function(t){this._mse=t}},{key:"checkUrl",value:function(t){-1===t.url.indexOf("codec=265")&&(t.url+="&codec=265")}},{key:"turnToH264",value:function(t){this._mse&&this._mse.turnToH264(t)}},{key:"reportError",value:function(t,e){I.log("H265MseProxy.reportError",t,r3.dic[t]),this._tsdb.sendMetrics([this._stat.createAct(R.ACT.H265_STATUS,{value:[1],str:[t,null!=e?e:1e4]})])}},{key:"onTurntoH265Wasm",value:function(t){this._support.onTurntoH265Wasm(t)}},{key:"onTurnToH264",value:function(t){this._support.onTurntoH264(t)}},{key:"on265StartCodeError",value:function(){this.reportError(r3.START_CODE_ERROR),this.turnToH264(r3.START_CODE_ERROR)}},{key:"isSupported",get:function(){return this._support&&this._support.isSupported}},{key:"h265StatReport",get:function(){return this._h265StatReport}},{key:"h265Support",get:function(){return this._support}},{key:"isH265MseCodec",get:function(){return this._support&&this._support.isSupported}},{key:"isServerSupported",get:function(){return this._support&&this._support.serverSupported}}]),t}(),as=function(){function t(e){Object(s.a)(this,t),this.eventEmitter=e,this.hasEvent=!1,this.isSupported=void 0!==document.addEventListener&&void 0!==document.hidden,this.onVisibilitychangeBind=this.onVisibilitychange.bind(this),this.stat=null,this.vodStat=null,this.hiddenTs=0,this.visibleTs=g.now(),this.lastStatHiddenTs=0,this.lastHiddenTime=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.delVisibilitychange(),this.eventEmitter=null,this.stat=null,this.vodStat=null}},{key:"setStat",value:function(t,e){this.stat=t,this.vodStat=e,this.checkVisibilitychange(!1),this.addVisibilitychange()}},{key:"addVisibilitychange",value:function(){!this.hasEvent&&this.isSupported&&(this.hasEvent=!0,document.addEventListener("visibilitychange",this.onVisibilitychangeBind))}},{key:"delVisibilitychange",value:function(){this.hasEvent&&(this.hasEvent=!1,document.removeEventListener("visibilitychange",this.onVisibilitychangeBind))}},{key:"onVisibilitychange",value:function(){this.checkVisibilitychange(!0)}},{key:"checkVisibilitychange",value:function(t){this.isSupported&&(this.stat&&this.stat.setComDim(R.DIM_COM.VISIBILITY_STATE,document.visibilityState),this.vodStat&&this.vodStat.setComDim(R.DIM_COM.VISIBILITY_STATE,document.visibilityState),this.eventEmitter.trigger(N.VISIBILITY_CHANGE,document.visibilityState),document.visibilityState===L.VISIBILITY_STATE.VISIBLE?((t||0===this.visibleTs)&&(this.visibleTs=g.now()),this.eventEmitter.onVisibilitychange&&this.eventEmitter.onVisibilitychange(!0)):document.visibilityState===L.VISIBILITY_STATE.HIDDEN&&((t||0===this.hiddenTs)&&(this.hiddenTs=g.now()),this.eventEmitter.onVisibilitychange&&this.eventEmitter.onVisibilitychange(!1)),I.log("Visibility.onVisibilitychange visibilityState=".concat(document.visibilityState," isEvent=").concat(t," now=").concat(g.now()," visibleTs=").concat(this.visibleTs," hiddenTs=").concat(this.hiddenTs," lastHiddenTime=").concat(this.lastHiddenTime)))}},{key:"setHiddenTimeStat",value:function(){var t=0;if(this.isSupported){var e=g.now();0!==this.hiddenTs&&(document.visibilityState===L.VISIBILITY_STATE.HIDDEN&&this.hiddenTs>=this.visibleTs?t=e-this.hiddenTs:document.visibilityState===L.VISIBILITY_STATE.VISIBLE&&e-this.visibleTs<e-this.lastStatHiddenTs&&0!==this.lastStatHiddenTs&&(t=this.visibleTs-this.hiddenTs)),this.stat&&this.stat.setCore(R.CORE.VISIBILITY_HIDDEN_TIME,t),this.lastStatHiddenTs=e}this.lastHiddenTime=t}}]),t}(),ar=function(){function t(){Object(s.a)(this,t),this._buffer=-1}return Object(r.a)(t,[{key:"reset",value:function(){this._buffer=-1}},{key:"buffer",get:function(){return this._buffer},set:function(t){(-1===this._buffer||t<this._buffer)&&(this._buffer=t<0?0:t)}}]),t}(),aa=function(){function t(){Object(s.a)(this,t),this._badBuffer=new ar}return Object(r.a)(t,[{key:"reset",value:function(){this._badBuffer.reset()}},{key:"setItem",value:function(t){this._badBuffer.buffer=t.badBuffer}},{key:"setBuffers",value:function(t){this._badBuffer.buffer=t}}
1,{key:"badBuffer",get:function(){return this._badBuffer.buffer}}]),t}(),an=function(){function t(){Object(s.a)(this,t),this.autoBuffer=new aa,this.videoBuffer=new aa}return Object(r.a)(t,[{key:"reset",value:function(){this.autoBuffer.reset(),this.videoBuffer.reset()}}]),t}(),ao=function(){function t(){Object(s.a)(this,t),this.stat=null,this.endTs=0,this.pausedStartTs=0,this.isInTime=!1,this.switchType=0,this.switchCodecType=0,this.recordCodecType=0,this.heartType=0,this.monitorTime=Number(F.autoCfg.monitorTime),this.tempBuffer=new an,this.usefulBuffer=new an,this._continueBuffer=-1,this._badReasons=0,this._minReason=0}return Object(r.a)(t,[{key:"init",value:function(t){this.stat=t}},{key:"start",value:function(t,e){0===this.endTs&&(this._badReasons=0,this._minReason=0),this.switchType=t,this.switchCodecType=e,I.log("AutoSwitchMonitor.start"),this.endTs=g.now()+this.monitorTime,this.pausedStartTs>0&&(this.isInTime=!0,this.tempBuffer.autoBuffer.setItem(this.tempBuffer.videoBuffer)),this._checkStat(),tP.add(this.onCheckTimer,this,100)}},{key:"_checkStat",value:function(){this.endTs>g.now()?(this.heartType=this._getHeartType(),this.recordCodecType=this.switchCodecType):(this.heartType=0,this.recordCodecType=0)}},{key:"recordHeartType",value:function(){this.stat.setCoreDim(R.DIM_CORE.AUTO_HEART_TYPE,this.heartType),this.stat.setCoreDim(R.DIM_CORE.AUTO_CODEC_CHANGE_TYPE,this.recordCodecType),this.stat.setCoreDim(R.CORE.AUTO_BAD_BUFFER,this.usefulBuffer.autoBuffer.badBuffer),this.stat.setCoreDim(R.CORE.VIDEO_BAD_BUFFER,this.usefulBuffer.videoBuffer.badBuffer),this.stat.setCore(R.CORE.AUTO_CONTINUE_BUFFER,this._continueBuffer),this.usefulBuffer.reset(),this._continueBuffer=-1,this._checkStat()}},{key:"_getHeartType",value:function(){return 1===this.switchType?1:2}},{key:"destroy",value:function(){this.stat=null,tP.remove(this.onCheckTimer,this),this.tempBuffer.reset(),this.usefulBuffer.reset()}},{key:"stop",value:function(){this.endTs=0,tP.remove(this.onCheckTimer,this)}},{key:"addBadReason",value:function(t){this._badReasons|=t;var e=Math.log2(t)+1;(0===this._minReason||this._minReason>e)&&(this._minReason=e)}},{key:"addSwitch",value:function(t,e,i,s){1===s&&(I.log("AutoSwitchMonitor.addSwitch, now=".concat(t,", value1=").concat(e,", value2=").concat(i,", value4=").concat(s)),this.stat.addCore(R.CORE.AUTO_SWITCH_CNT,1),e===i&&this.stat.addCore(R.CORE.AUTO_SWITCH_SAME_CNT,1),this.endTs>t&&(e===i&&this.stat.addCore(R.CORE.AUTO_BAD_SWITCH_SAME,1),1===this.switchType&&this.stat.addCore(R.CORE.AUTO_BAD_SWITCH_UP,1),this.stat.addCore(R.CORE.AUTO_BAD_SWITCH,1)))}},{key:"addBadQuality",value:function(t,e,i,s){I.log("AutoSwitchMonitor.addBadQuality isIntime=".concat(this.isInTime," pausedStartTs=").concat(this.pausedStartTs," endTs=").concat(this.endTs," now=").concat(t)),this.usefulBuffer.videoBuffer.setItem(this.tempBuffer.videoBuffer),this.isInTime&&(this.usefulBuffer.autoBuffer.setItem(this.tempBuffer.autoBuffer),this.stat.addCore(R.CORE.AUTO_BAD_QUALITY,1),this.stat.addCore(R.CORE.AUTO_BAD_DURATION,e),this.stat.setCoreDim(R.DIM_CORE.AUTO_BAD_REASON,this._badReasons),this.stat.setCoreDim(R.DIM_CORE.AUTO_BAD_MIN_REASON,this._minReason),this._continueBuffer=s,1===this.switchType&&(this.stat.addCore(R.CORE.AUTO_BAD_QUALITY_UP,1),this.stat.addCore(R.CORE.AUTO_BAD_DURATION_UP,e))),i!==rw&&(this.pausedStartTs=0,this.isInTime=!1),this.tempBuffer.reset()}},{key:"onCheckTimer",value:function(t,e){t>=this.endTs&&(I.log("AutoSwitchMonitor.onCheckTimer stop."),this.stat.setCore(R.CORE.AUTO_BAD_DONE,1),this.stop())}},{key:"resetPausedTs",value:function(){this.tempBuffer.reset(),this.pausedStartTs=0,this.isInTime=!1}},{key:"setPause",value:function(t,e){I.log("AutoSwitchMonitor.setPause now=".concat(t," buffer=").concat(e," endTs=").concat(this.endTs)),this.pausedStartTs=t,this.tempBuffer.videoBuffer.setBuffers(e),this.endTs>t?(this.isInTime=!0,this.tempBuffer.autoBuffer.setBuffers(e)):this.isInTime=!1}},{key:"reportDimPullStreamReason",value:function(t){null==t&&(t=14),I.log("AutoSwitchMonitor.reportDimPullStreamReason, type=".concat(t)),this.stat.setComDim(R.DIM_COM.PULLSTREAM_REASOM,t)}}]),t}(),ah=function(){function t(e){Object(s.a)(this,t),this.scene=e,this.sDispat
1chId="",this.expiredTime=0}return Object(r.a)(t,[{key:"isExpired",value:function(t){return t>this.expiredTime}}]),t}(),au=function(){function t(){Object(s.a)(this,t),this._sysMap=new Map}return Object(r.a)(t,[{key:"destroy",value:function(){this._sysMap.clear()}},{key:"addItem",value:function(t,e,i){I.log("RecSysStat.addItem scene=".concat(t," now=").concat(g.now()," expiredTime=").concat(i));var s=this._sysMap.get(t);s||(s=new ah(t),this._sysMap.set(t,s)),s.sDispatchId=e,s.expiredTime=Number(i)||g.now()+6e4}},{key:"removeItem",value:function(t){this._sysMap.delete(t)}},{key:"recordAct",value:function(t){var e=this.getResult();e.length>0&&t.setActDim(R.DIM_CORE.DISPATCH_ID,e)}},{key:"recordHeart",value:function(t){var e=this.getResult();e.length>0&&t.setCoreDim(R.DIM_CORE.DISPATCH_ID,e)}},{key:"getResult",value:function(){var t=[],e=g.now();return this._sysMap.forEach(function(i){i.isExpired(e)||t.push("".concat(i.scene,":").concat(i.sDispatchId))}),t.join(",")}}]),t}(),al="force_auto_count",ad="force_auto_effective_time",ac=function(){function t(e,i){Object(s.a)(this,t),this._h5Player=e,this._abConfig=i,this._forceCnt=0,this._sysForceCnt=0,this._effectiveTime=0,this._sysEffectiveTime=0,this._isInit=!1,this._closed=!1,this.onAutoForceRspBind=this.onAutoForceRsp.bind(this),e.on(N.AUTO_FORCE_RSP,this.onAutoForceRspBind)}return Object(r.a)(t,[{key:"destroy",value:function(){this._h5Player&&this._h5Player.off(N.AUTO_FORCE_RSP,this.onAutoForceRspBind),this._h5Player=null,this._abConfig=null}},{key:"_init",value:function(){if(!this._isInit)if(this._isInit=!0,this._sysEffectiveTime>0?this._effectiveTime=this._sysEffectiveTime:this._effectiveTime=Number(F.force_auto_effective_time),this._sysForceCnt>0)this._forceCnt=this._sysForceCnt,I.log("AutoForce._init useSys");else{this._forceCnt=Number(F.force_auto_count);var t=[],e=this._abConfig.getConfig("quitAutoCount");
1null!==e&&(this._forceCnt=Number(e),t.push("_forceCnt=".concat(this._forceCnt)));var i=this._abConfig.getConfig("isWebAutoABBBB");null!==i&&(this._closed=1===i,t.push("isWebAutoAB=".concat(i))),I.log("AutoForce._init ".concat(t.join(" ")))}}},{key:"onAutoForceRsp",value:function(t,e){var i=e.force_auto_count,s=e.force_auto_effective_time;I.log("AutoForce.onAutoForceRsp force_auto_count=".concat(i," force_auto_effective_time=").concat(s)),this._forceCnt=this._sysForceCnt=i,this._effectiveTime=this._sysEffectiveTime=1e3*s,this._checkEffective()}},{key:"addForce",value:function(){var t=Number(D.getItem(al))||0;D.setItem(al,t+1),I.log("AutoForce.addForce forceCnt=".concat(t+1)),this._checkEffective()}},{key:"_checkEffective",value:function(){(Number(D.getItem(al))||0)>=this._forceCnt&&!D.hasOwnProperty(ad)&&(D.setItem(ad,Date.now()+this._effectiveTime),I.log("AutoForce._checkEffective cooling"))}},{key:"getUseAuto",value:function(){if(this._init(),this._closed)return!1;if(D.hasOwnProperty(ad)){var t=Number(D.getItem(ad));if(Date.now()<t)return I.log("AutoForce.getUseAuto cooling!"),!1;D.removeItem(al),D.removeItem(ad)}var e=Number(D.getItem(al))||0;return I.log("AutoForce.getUseAuto forceCnt=".concat(e," _forceCnt=").concat(this._forceCnt)),e<this._forceCnt}}]),t}(),af=function(){function t(){Object(s.a)(this,t),this._isInit=!1,this._mpConfig=null}return Object(r.a)(t,[{key:"destroy",value:function(){this._mpConfig=null}},{key:"_init",value:function(){if(!this._isInit){I.log("AbConfigParser._init",D.abConfig),this._isInit=!0;try{var t=JSON.parse(D.abConfig);t&&t.mpConfig&&(this._mpConfig=t.mpConfig)}catch(t){I.log("AbConfigParser._init ".concat(t.message))}}}},{key:"getConfig",value:function(t){return this._init(),this._mpConfig&&this._mpConfig.hasOwnProperty(t)?this._mpConfig[t]:null}}]),t}(),ap=function(){function t(e){Object(s.a)(this,t),this._abConfig=e,this._isInit=!1,this._pids=new Set,this._lines=new Set,this._bitrateMap=new Map}return Object(r.a)(t,[{key:"destroy",value:function(){this._abConfig=null,this._pids=null,this._lines=null,this._bitrateMap&&this._bitrateMap.clear(),this._bitrateMap=null}},{key:"_init",value:function(){var t=this;if(!this._isInit){I.log("BitrateChange._init"),this._isInit=!0;var e=this._abConfig.getConfig("pidList");null!==e&&0!==Number(e)&&e.split(",").forEach(function(e){t._pids.add(Number(e))});var i=this._abConfig.getConfig("lineList");null!==i&&0!==Number(i)&&i.split(",").forEach(function(e){t._lines.add(Number(e))});var s=this._abConfig.getConfig("bitrateList");null!==s&&0!==Number(s)&&(s=s.split(",")).forEach(function(e){var i=e.split(":");t._bitrateMap.set(Number(i[0]),Number(i[1]))})}}},{key:"getBitrate",value:function(t,e,i){return this._init(),this._pids.has(Number(t))&&this._lines.has(Number(e))&&this._bitrateMap.has(Number(i))&&(i=this._bitrateMap.get(i)),i}}]),t}(),am=i(16),a_=function(){function t(e){Object(s.a)(this,t),this.flvPlayer=e,this.eventEmitter=e.eventEmitter,this.jumpToP2PCd=1e3*(Math.floor(120*Math.random())+180),this.nextJumpToP2PTs=0,this.waitPlayEnd=!1,this.lastP2PInfo=null}return Object(r.a)(t,[{key:"reset",value:function(){this.waitPlayEnd=!1}},{key:"initJumpTs",value:function(t){0==this.nextJumpToP2PTs&&(I.log("BackToP2P.initJumpTs jumpToP2PCd=".concat(this.jumpToP2PCd/6e4,"min")),this.nextJumpToP2PTs=t+this.jumpToP2PCd)}},{key:"onCheckTimer",value:function(t,e){if(!this.waitPlayEnd&&rV.isSupportP2P()&&!(t<this.nextJumpToP2PTs)){var i=this.flvPlayer;if(this.lastP2PInfo&&!(F.platform===L.PLATFORM_TYPE_NAME.wap&&0===F.isWapSupportP2P||F.isCloseP2P(this.lastP2PInfo.uid)||F.isCloseAllFuncs(this.lastP2PInfo.uid)||this.lastP2PInfo.lineType!=i.lineType)){var s=this.lastP2PInfo.sStreamName;s&&i.url&&-1!=i.url.indexOf(s)&&(i.getBufferLen()<i.mse.JITTER_BUFLEN||(this.waitPlayEnd=!0))}}}},{key:"onCheckFastTimer",value:function(t,e){this.flvPlayer.getBufferLen(),this.waitPlayEnd&&(this.waitPlayEnd=!1,this.jumpToP2PCd<18e5&&(this.jumpToP2PCd+=12e4),this.nextJumpToP2PTs=t+this.jumpToP2PCd,this.flvPlayer.getRecSysRsp({info:this.flvPlayer.info,type:"flv",metadata:this.flvPlayer.mse.metadata,isBackToP2P:!0}))}}
1,{key:"recSysRspHandler",value:function(t,e,i){if(this.lastP2PInfo){var s=this.flvPlayer;t&&e&&e.tRecSysInfo&&0==e.tRecSysInfo.lAction||(I.warn("BackToP2P.onCheckFastTimer jumpToP2PCd=".concat(this.jumpToP2PCd/6e4,"min, BackToP2P.tryPlayP2P")),s.loader&&s.loader.close(),this.eventEmitter.trigger(N.FLV_TRY_TO_P2P),this.lastP2PInfo=null)}}}]),t}(),ay=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).img=null,r.isPaused=!1,r.isFirstReport=!0,r.lastAudioFrames=0,r}return Object(r.a)(i,[{key:"sendFlow",value:function(t){this.record(t)}},{key:"getUserProperty",value:function(){var t=this.tsdb;return F[100]?F[101]?rV.isBrowserSupport()?rV.isP2PCooling()?L.userProperty.P2P_COOLING:1==t.turnToFlvTimes&&0==t.restartTimes?t.turnToFlvReason==L.turnToFlvReason.FULL_CONNECT_TIMEOUT?L.userProperty.FIRST_FULL_CONNECT_TIMEOUT:t.turnToFlvReason==L.turnToFlvReason.FULL_NO_DATA?L.userProperty.FIRST_FULL_NO_DATA:t.turnToFlvReason==L.turnToFlvReason.FULL_PLAY_FAIL?L.userProperty.FIRST_FULL_PLAY_FAIL:t.turnToFlvReason==L.turnToFlvReason.SUB_CONNECT_TIMEOUT?L.userProperty.SUB_CONNECT_TIMEOUT:t.turnToFlvReason==L.turnToFlvReason.SUB_NO_DATA?L.userProperty.SUB_NO_DATA:t.turnToFlvReason==L.turnToFlvReason.P2P_ARGS_ERROR?L.userProperty.P2P_ARGS_ERROR:t.turnToFlvReason==L.turnToFlvReason.P2P_COOLING?L.userProperty.P2P_COOLING:t.turnToFlvReason==L.turnToFlvReason.IS_NOT_FIRST_FETCH?L.userProperty.IS_NOT_FIRST_FETCH:t.turnToFlvReason==L.turnToFlvReason.VIDEO_BUFFER_EMPTY?L.userProperty.VIDEO_BUFFER_EMPTY:L.userProperty.UNKNOW:t.turnToFlvReason==L.turnToFlvReason.FULL_CONNECT_TIMEOUT||t.turnToFlvReason==L.turnToFlvReason.FULL_NO_DATA||t.turnToFlvReason==L.turnToFlvReason.FULL_PLAY_FAIL?t.restartReason==L.restartReason.RANGE_SEQ_MAX?L.userProperty.RESTART_RANGE_MAX:t.restartReason==L.restartReason.RANGE_SEQ_LARGE?L.userProperty.RESTART_RANGE_LARGE:t.restartReason==L.restartReason.CONNECT?L.userProperty.RESTART_CONNECT:t.restartReason==L.restartReason.MULTI_CDN?L.userProperty.RESTART_MUTI_CDN:t.restartReason==L.restartReason.PLAYER_NO_DATA?L.userProperty.RESTART_PLAYER_NO_DATA:t.restartReason==L.restartReason.PLAYER_ERROR?L.userProperty.RESTART_PLAYER_ERROR:t.restartReason==L.restartReason.FLV_TO_P2P?L.userProperty.FLV_TO_P2P:t.restartReason==L.restartReason.LOST_SEQ?L.userProperty.LOST_SEQ:L.userProperty.UNKNOW:t.turnToFlvReason==L.turnToFlvReason.SUB_CONNECT_TIMEOUT?L.userProperty.SUB_CONNECT_TIMEOUT:t.turnToFlvReason==L.turnToFlvReason.SUB_NO_DATA?L.userProperty.SUB_NO_DATA:t.turnToFlvReason==L.turnToFlvReason.P2P_ARGS_ERROR?L.userProperty.P2P_ARGS_ERROR:t.turnToFlvReason==L.turnToFlvReason.P2P_COOLING?L.userProperty.P2P_COOLING:t.turnToFlvReason==L.turnToFlvReason.IS_NOT_FIRST_FETCH?L.userProperty.IS_NOT_FIRST_FETCH:t.turnToFlvReason==L.turnToFlvReason.VIDEO_BUFFER_EMPTY?L.userProperty.VIDEO_BUFFER_EMPTY:L.userProperty.UNKNOW:L.userProperty.BROWSER_UN_SUPPORT:L.userProperty.CLIENT_CLOSE:L.userProperty.SERVER_CLOSE}},{key:"record",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"sendRecordMetrics",this).call(this);var e=t.pauseCnt,s=(t.pauseTime,t.isPaused),r=t.isPausedWorker,a=(t.flowSize,t.httpErrorCode),u=t.pauseReason,l=t.volumeEnergy,d=t.isEnd,c=t.pauseWorkerCnt,f=t.isFramePaused;this.handlerPlayer.qaStaRecord&&this.handlerPlayer.qaStaRecord(),this.volumeEnergy=l,s&&(this.isPaused=!0);var p=this.getUserProperty(),m=this.handlerPlayer.getAudioFrames();this.stat.setCore(R.CORE.AUDIO_CNT,m-this.lastAudioFrames),this.lastAudioFrames=m,d&&(this.lastAudioFrames=0),this.stat.setCoreDim(R.DIM_COM.STREAM_INDEX,a),this.stat.setCoreDim(R.DIM_CORE.USER_PROPERTY,p),this.stat.setCoreDim(R.DIM_CORE.SIGNAL_USER_PROPERTY,0),this.stat.setComDim(R.DIM_COM.VIDEO_MIN_BUF,this.handlerPlayer.mse&&this.handlerPlayer.mse.JITTER_BUFLEN);var _=this.handlerPlayer.mse&&this.handlerPlayer.mse.parser.timeStampStat,y=[];_&&_.reset();var v=this.handlerPlayer.info;this.handlerPlayer.mse&&(this.handlerPlayer.mse.pauseStat.record(this.stat),this.rcordCaptureJitter(this.handlerPlayer.mse.getCaptureStats(!0))),this.reportVideoBadQuality(s,e,d,c,r,f),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_REASON,u),this.stat.setCore(R.CORE.BUFFER_LENGTH,this.handlerPlayer.getBufferLen()+this.handlerPlayer.getFrameBufferLen());var S=this.handlerPlayer.getBufferLen();if(this.handlerPlayer.isShieldStart&&(S+=this.handlerPlayer.getFrameBufferLen()),this.stat.setCore(R.CORE.PLAY_DELAY,S),this.stat.setCore(R.CORE.FRAME_BUFFER_DELAY,this.handlerPlayer.getFrameBufferLen()),this.handlerPlayer._hyPlayer&&this.handlerPlayer._hyPlayer.visibility&&this.handlerPlayer._hyPlayer.visibility.setHiddenTimeStat&&this.handlerPlayer._hyPlayer.visibility.setHiddenTimeStat(),this.recordSample(),this.recordAuto(),this.handlerPlayer.recSysStat.recordHeart(this.stat),this.handlerPlayer.mse&&this.handlerPlayer.mse.buffered.record(this.stat),this.handlerPlayer.mse&&this.handlerPlayer.mse.avSyncStat.record(this.stat),this.handlerPlayer&&this.handlerPlayer.autoMonitor.recordHeartType(),this.handlerPlayer.mse&&this.handlerPlayer.mse.metadata){var g=this.handlerPlayer.mse.metadata,T=g.recvVideoFps,P=g.recvAudioFps;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_RATE,P),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_RATE,T)}if(this.handlerPlayer.mse&&this.handlerPlayer.mse.bufStat){var C=this.handlerPlayer.mse.bufStat.getStats(),E=C.emptyTime,k=C.emptyCnt;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_BUFFER_EMPTY_COUNT,k),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_BUFFER_EMPTY_TIME,E)}this.handlerPlayer._hyPlayer&&this.handlerPlayer._hyPlayer.costUs>0&&this.stat.setComp(R.DIM_H265_SAM.name,"costUs",this.handlerPlayer._hyPlayer.costUs),this.recordBaseStat(),this.recordMpsStat(0);var A=this.handlerPlayer.loader.speed;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.SPEED,A);var D=this.handlerPlayer.mse&&this.handlerPlayer.mse.curVideoDts,O=this.handlerPlayer.mse&&this.handlerPlayer.mse.curAudioDts;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_DTS,D),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_DTS,O),this.stat.setCompFormat(R.DIM_LINK_SAM.name,":",","),this.handlerPlayer.recordRecvFps(this.stat),this.recordC2CDelay(),this.handlerPlayer.mse&&this.handlerPlayer.mse.metadata&&this.handlerPlayer.mse.metadata.codecname&&this.stat.setComDim(R.DIM_COM.SPHD_TYPE,this.handlerPlayer.mse.metadata.codecname),this.isFirstReport?this.isFirstReport=!1:0===F.statLv[15]&&y.push({sMetricName:J.METRIC.VIDEO_BAD_QUALITY_RATIO,vField:{value:100*!!this.isPaused,pausecnt:e},vDimension:{p2p:0,originalBitrate:+(0===v.originalBitrate),p2pCooling:+!!w.p2pCooling,topSid:v.sid,reason:u,quality:s||e>0?100:0},vExLog:{cdnip:this.handlerPlayer.cdnip}}),this.stat.setComDim(R.DIM_COM.CDNIP,this.handlerPlayer.cdnip),F.renderStat[0]&&this.reportAVRenderInfo(this.handlerPlayer.mse);var b=this.handlerPlayer.getPcdn302Stats(),L=b.pcdn302CoreStats,M=b.pcdn302DimStats;for(var N in L){var B=L[N];B>0&&this.stat.setCore(N,B)}for(var V in M){var U=M[V];U>0&&this.stat.setComDim(V,U)}this.recordAiData(),this.recordMuteData(),Object(n.a)(Object(o.a)(i.prototype),"recordHeart",this).call(this);var x,H=[],G=Object(Q.a)(this.stat.coreMap.keys());try{for(G.s();!(x=G.n()).done;){var W=x.value;W.indexOf("_bw")>-1&&H.push("".concat(W,":").concat(this.stat.coreMap.get(W)))}}catch(t){G.e(t)}finally{G.f()}I.log("QAStat.coreDim pcdn,",H.join()),this.stat.fill(y,d),this.statQps.sendQps(this.tsdb,y,d),this.isPaused=!1}},{key:"recordSample",value:function(t){this.handlerPlayer.sampleC
1ontroller.recordStat(this.stat,t);var e=this.handlerPlayer.mse;e&&(this.handlerPlayer.mse.parser.avSample.recordStat(this.stat),e.parser&&e.parser.avcChangeStat&&e.parser.avcChangeStat.record(this.stat,F.getAvHeaderChangeStat(this.handlerPlayer.info.presenterUid)))}},{key:"recordAuto",value:function(){var t=this.handlerPlayer.p2pFlvPlayer.ctrlBitrate;t&&(this.stat.setCoreDim(R.DIM_CORE.AUTO_U_REASON,t._switchUpReason),this.stat.setCoreDim(R.DIM_CORE.AUTO_D_REASON,t._switchDownReason))}},{key:"recordAiData",value:function(){var t=this.handlerPlayer.getAiStat(),e=t.aiP2PCnt,i=t.aiFlvCnt,s=t.aiP2PTimeoutCnt,r=t.aiFlvTimeoutCnt,a=t.aiP2PErrorCnt,n=t.aiFlvErrorCnt,o=t.aiP2PSwitchCnt,u=t.aiFlvSwitchCnt,l=t.aiP2PNotSwitchCnt,d=t.aiFlvNotSwitchCnt,c=t.aiFlvErrorSwitchCnt,f=t.aiFlvErrorNotSwitchCnt,p=t.aiStartP2PCnt,m=t.aiStartFlvCnt;this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_CNT,e),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_CNT,i),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_TIMEOUT_CNT,s),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_TIMEOUT_CNT,r),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_ERROR_CNT,a),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_ERROR_CNT,n),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_SWITCH_CNT,o),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_SWITCH_CNT,u),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_NOT_SWITCH_CNT,l),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_NOT_SWITCH_CNT,d),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_ERROR_SWITCH_CNT,c),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_ERROR_NOT_SWITCH_CNT,f),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_START_P2P_CNT,p),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_START_FLV_CNT,m),this.stat.setCompFormat(R.AI_CONTROL_DATA.name,":",",")}},{key:"recordMuteData",value:function(){if(this.handlerPlayer.eventEmitter&&this.handlerPlayer.eventEmitter.getMuteStat&&this.handlerPlayer.eventEmitter.getMuteStat){var t=this.handlerPlayer.eventEmitter.getMuteStat().muteData,e=[];t.map(function(t){var i=[];i.push(t.value),i.push(t.type),i.push(t.currentDts),i.push(t.reqKey),i.push(t.begin),i.push(t.end),e.push(i.join(":"))}),this.stat.setCoreDim(R.DIM_COM.MUTE_DATA,e.join(","))}}},{key:"recordC2CDelay",value:function(){var t=this.handlerPlayer.mse&&this.handlerPlayer.mse.getDelayStat();if(t){for(var e in t.fields)this.stat.setCore(e,t.fields[e]);for(var i in t.dims)this.stat.setCoreDim(i,t.dims[i])}}},{key:"reportAVRenderInfo",value:function(t){var e=t.videoPlayConsuming.getRecvToRenderConsuming(),i=t.videoPlayConsuming.getRecvToPushConsuming(),s=t.videoPlayConsuming.getPushToRenderedConSuming(),r=Math.round(e.max),a=Math.round(e.avg),n=Math.round(i.max),o=Math.round(i.avg),u=Math.round(s.max),l=Math.round(s.avg);r>0&&a>0&&(this.stat.setCore(R.DIM_CORE.VTDMAX,r),this.stat.setCore(R.DIM_CORE.VTDAVG,a),this.stat.setCore(R.DIM_CORE.VRTADEMAX,n),this.stat.setCore(R.DIM_CORE.VRTADE,o),this.stat.setCore(R.DIM_CORE.VATRDEMAX,u),this.stat.setCore(R.DIM_CORE.VATRDE,l));var d=t.audioPlayConsuming.getRecvToRenderConsuming(),c=t.audioPlayConsuming.getRecvToPushConsuming(),f=t.audioPlayConsuming.getPushToRenderedConSuming(),p=Math.round(d.max),m=Math.round(d.avg),_=Math.round(c.max),y=Math.round(c.avg),v=Math.round(f.max),S=Math.round(f.avg);p>0&&m>0&&(this.stat.setCore(R.DIM_CORE.ATDMAX,p),this.stat.setCore(R.DIM_CORE.ATDAVG,m),this.stat.setCore(R.DIM_CORE.ARTADEMAX,_),this.stat.setCore(R.DIM_CORE.ARTADE,y),this.stat.setCore(R.DIM_CORE.AATRDEMAX,v),this.stat.setCore(R.DIM_CORE.AATRDE,S)),t.videoPlayConsuming.clearConsuming(),t.audioPlayConsuming.clearConsuming();var g=t.renderFps.getRecordFps(),T=t.renderFps.statRenderQuality(),P=t.parser.dropFrameDts.getRecrod(),C=t.parser.fps.getRecord(),E=t.parser.fps.getFps();this.stat.setCore(R.DIM_CORE.VRDFPS,g),this.stat.setCore(R.DIM_CORE.VRCFPS,E),this.stat.setCore(R.DIM_CORE.VDF,P),this.stat.setCore(R.DIM_CORE.VRBQ,T),I.log("QAStat.reportAVRenderInfo P2P: video_total_delay_max=",r,"video_total_delay_avg=",a,"video_recv_to_append_delay_max=",n,"video_recv_to_append_delay=",o,"video_append_to_render_delay_max=",u,"video_append_to_render_delay=",l,"audio_total_delay_max=",p,"audio_total_delay_avg=",m,"audio_recv_to_append_delay_max=",_,"audio_recv_to_append_delay=",y,"audio_append_to_render_delay_max=",v,"audio_append_to_render_delay=",S,"video_render_fps=",g,"video_receive_fps=",E,"page_fps=","video_drop_frames=",P,"video_recv_frames=",C)}}]),i}(iH),av=function(){function t(e,i){Object(s.a)(this,t),this.eventEmitter=e,this.mse=i,this.tickCnt=0}return Object(r.a)(t,[{key:"reset",value:function(){this.tickCnt=0}},{key:"onCheckTimer",value:function(t,e){this.tickCnt++,4!==this.tickCnt&&this.tickCnt%10!=0||this.trigger()}},{key:"trigger",value:function(){var t={};Object.assign(t,this.mse.metadata),this.eventEmitter.trigger(N.METADATA,t)}}]),t}(),aS=function(){function t(e){Object(s.a)(this,t),this.stat=e,this.hisLinks=[]}return Object(r.a)(t,[{key:"destroy",value:function(){this.stat=null,this.hisLinks=null}},{key:"addHis",value:function(t){I.log("VideoLinkHis.addHis link=".concat(t.url));var e=new ag(this.stat,t);this.hisLinks.push(e)}}]),t}(),ag=function(){function t(e,i){Object(s.a)(this,t),this.stat=e,i.linkHandler=this,this.link=i,i.waitForData&&tP.once(this.onTimeout,this,1e4)}return Object(r.a)(t,[{key:"onTimeout",value:function(){this.link.destroyForce()}},{key:"onData",value:function(t){this.stat.addCore(R.CORE.CDN_TOTAL_BW,t.byteLength),this.stat.addCore(R.CORE.OBS_FPS,t.byteLength)}},{key:"onstatus",value:function(t){}}
1,{key:"on302",value:function(t){}},{key:"onheader",value:function(t){}},{key:"onopen",value:function(){}},{key:"onerror",value:function(){}},{key:"onclose",value:function(){}}]),t}(),aT=function(){function t(e){Object(s.a)(this,t),this.data=e,this.size=e.byteLength,this.tagType=0,this.dataSize=0,this.timestamp=0,this.packetType=-1,this.error=!1}return Object(r.a)(t,[{key:"destroy",value:function(){this.data=null}},{key:"isVideo",value:function(){return 9===this.tagType}},{key:"isAudio",value:function(){return 8===this.tagType}},{key:"parse",value:function(){this.size<15?(this.error=!0,I.warn("FlvTagParser.parse has no whole tag size=".concat(this.size))):this._parse()}},{key:"_parse",value:function(){var t=this.data;return this.tagType=t[0],this.dataSize=(t[1]<<16)+(t[2]<<8)+t[3],this.size-11-4<this.dataSize?(this.error=!0,void I.warn("FlvTagParser.parse has no enough data dataSize=".concat(this.dataSize," size=").concat(this.size))):0===this.dataSize?(this.error=!0,void I.warn("FlvTagParser.parse tag empty tagType=".concat(this.tagType))):(this.timestamp=(t[4]<<16)+(t[5]<<8)+t[6]+parseInt(t[7].toString(16)+"000000",16),void((this.isVideo()||this.isAudio())&&(this.packetType=t[12]))
1)}}]),t}(),aP=function(){function t(e){Object(s.a)(this,t),this.tag=e}return Object(r.a)(t,[{key:"destroy",value:function(){this.tag=null}},{key:"parse",value:function(){}}]),t}(),aC=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).frameType=0,r.codec=0,r.avcPacketType=0,r.compositionTime=0,r}return Object(r.a)(i,[{key:"parse",value:function(){this.frameType=this.data[11]>>4,this.codec=15&this.data[11],this.avcPacketType=this.data[12],this.compositionTime=(this.data[13]<<16)+(this.data[14]<<8)+this.data[15]}}]),i}(aP),aE=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){return Object(s.a)(this,i),e.call(this,t)}return Object(r.a)(i)}(aP),aI=function(){function t(e){Object(s.a)(this,t),this.tag=e}return Object(r.a)(t,[{key:"destroy",value:function(){this.tag=null}},{key:"parse",value:function(){}}]),t}(),ak=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).videoBody=null,r}return Object(r.a)(i,[{key:"destroy",value:function(){Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this),this.videoBody&&this.videoBody.destroy(),this.videoBody=null}},{key:"parse",value:function(){var t=this.tag.tagHeader;0===t.avcPacketType?this.videoBody=this._parseAVCSeqHeader(t.codec):1===t.avcPacketType&&(this.videoBody=this._parseAVCNalu(t.codec))}},{key:"_parseAVCSeqHeader",value:function(t){return null}},{key:"_parseAVCNalu",value:function(t){return null}}]),i}(aI),aA=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){return Object(s.a)(this,i),e.call(this,t)}return Object(r.a)(i)}(aI),aR=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){return Object(s.a)(this,i),e.call(this,t)}return Object(r.a)(i)}(aI),aD=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).tagHeader=null,r.tagData=null,r}return Object(r.a)(i,[{key:"destroy",value:function(){Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this),this.tagHeader&&this.tagHeader.destroy(),this.tagHeader=null,this.tagData&&this.tagData.destroy(),this.tagData=null}},{key:"_parse",value:function(){Object(n.a)(Object(o.a)(i.prototype),"_parse",this).call(this),this.error||(this.tagHeader=this._parseTagHeader(),this.tagData=this._parseTagData())}},{key:"_parseTagHeader",value:function(){var t=null;return 9===this.tagType?t=new aC(this):8===this.tagType&&(t=new aE(this)),t&&t.parse(),t}},{key:"_parseTagData",value:function(){var t=null;return 9===this.tagType?t=new ak(this):8===this.tagType?t=new aA(this):18===this.tagType&&(t=new aR(this)),t&&t.parse(),t}}]),i}(aT),aO=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this))._type=t,r.flvHeader=null,r.flvCacher=new tR,r.parseHeader=!1,r}return Object(r.a)(i,[{key:"destroy",value:function(){this.clear(),this.flvCacher&&this.flvCacher.destroy(),this.flvCacher=null}},{key:"parseFlv",value:function(t){if(t=new Uint8Array(t),this.flvHeader){var e=new Uint8Array(t.length+this.flvHeader.length);e.set(this.flvHeader,0),e.set(t,this.flvHeader.length),t=e}var s,r=0,a=t.length;if(!this.parseHeader){if(a<13)return I.log("FlvStreamBase.parseFlv has no enough header data len=".concat(a)),void(this.flvHeader=t.slice());if(this.flvHeader=null,r+=13,!i.probe(t))return void I.warn('FlvStreamBase.parseFlv header is not "FLV1"');this.parseHeader=!0}for(r>0?this.flvCacher.append(t.slice(r)):this.flvCacher.append(t);null!==(s=this.flvCacher.popFrame());){var n=this._type===i.Types.SIMPLE?new aT(s):new aD(s);n.parse(),this.trigger(i.Events.ON_TAG,n)}}},{key:"reset",value:function(){this.flvHeader=null,this.flvCacher.reset(),this.parseHeader=!1}}],[{key:"probe",value:function(t){return 70===t[0]&&76===t[1]&&86===t[2]&&1===t[3]}}]),i}(tB);aO.Events={ON_TAG:"ON_TAG"},aO.Types={SIMPLE:"SIMPLE",FULL:"FULL"};var ab=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this))._type=t,r._stream=new aO(aO.Types.SIMPLE),r._stream.on(aO.Events.ON_TAG,r._onFlvTag,Object(a.a)(r)),r._startDts=0,r._state=0,r._videoConfigTag=null,r._audioConfigTag=null,r._first
1VideoDts=0,r._firstAudioDts=0,r._outputVideoDts=0,r._outputAudioDts=0,r._outputVideo=!1,r._outputAudio=!1,r.lastVideoDts=0,r.lastAudioDts=0,r}return Object(r.a)(i,[{key:"destroy",value:function(){this.clear(),this._stream&&this._stream.destroy(),this._stream=null,this._videoConfigTag&&this._videoConfigTag.destroy(),this._videoConfigTag=null,this._audioConfigTag&&this._audioConfigTag.destroy(),this._audioConfigTag=null}},{key:"reset",value:function(){this._videoConfigTag=null,this._audioConfigTag=null,this._firstVideoDts=0,this._firstAudioDts=0,this._outputVideoDts=0,this._outputAudioDts=0,this._outputVideo=!1,this._outputAudio=!1,this._stream.reset()}},{key:"startLoad",value:function(t){I.log("FlvStreamProxy.startLoad type=".concat(this._type," %cstartDts=").concat(t),"color:red"),this._startDts=t,this._state=1}},{key:"parseFlv",value:function(t){this._stream.parseFlv(t)}},{key:"getOutputDts",value:function(){return{videoDts:this.lastVideoDts,audioDts:this.lastAudioDts}}},{key:"setOutputDts",value:function(t){var e=t.videoDts,i=t.audioDts;I.log("FlvStreamProxy.setOutputDts type=".concat(this._type," %cvideoDts=").concat(e," %caudioDts=").concat(i),"color:green","color:red"),this._outputVideoDts=e,this._outputVideo=!1,this._outputAudioDts=i,this._outputAudio=!1}},{key:"_onFlvTag",value:function(t){this._saveTimestamp(t),-1===this._startDts?this.trigger(i.Events.FLV_TAG,t):(0===t.packetType?(I.log("FlvStreamProxy._onFlvTag type=".concat(this._type," %cconfigTag dts=").concat(t.timestamp),"color:blue"),this._saveConfigTag(t)):this._checkState(t),this._checkOutput(t))}},{key:"_saveConfigTag",value:function(t){t.isVideo()?this._outputVideoDts>0&&!this._outputVideo&&(this._videoConfigTag=t):t.isAudio()&&this._outputAudioDts>0&&!this._outputAudio&&(this._audioConfigTag=t)}},{key:"_outputVideoConfig",value:function(){this.videoConfigTag&&(this.trigger(i.Events.FLV_TAG,this.videoConfigTag),this.videoConfigTag=null)}},{key:"_outputAudioConfig",value:function(){this.audioConfigTag&&(this.trigger(i.Events.FLV_TAG,this.audioConfigTag),this.audioConfigTag=null)}},{key:"_outputTag",value:function(t){this.trigger(i.Events.FLV_TAG,t)}},{key:"_saveTimestamp",value:function(t){1===t.packetType&&(t.isVideo()?(0===this._firstVideoDts&&(this._firstVideoDts=t.timestamp,I.log("FlvStreamProxy._saveTimestamp type=".concat(this._type," %cfirstVideoDts=").concat(this._firstVideoDts," startDts=").concat(this._startDts),"color:green")),this.lastVideoDts=t.timestamp):t.isAudio()&&(0===this._firstAudioDts&&(this._firstAudioDts=t.timestamp,I.log("FlvStreamProxy._saveTimestamp type=".concat(this._type," %cfirstAudioDts=").concat(this._firstAudioDts," startDts=").concat(this._startDts),"color:red")),this.lastAudioDts=t.timestamp))}},{key:"_checkState",value:function(t){1===this._state&&t.isVideo()&&t.timestamp>=this._startDts&&(I.log("FlvStreamProxy._checkState type=".concat(this._type," state change to CATCH_START_DTS, %cstartDts=").concat(this._startDts," videoDts=").concat(t.timestamp),"color:green"),this._state=2,this.trigger(i.Events.CATCH_START_DTS)),2===this._state&&(t.isVideo()?!this._outputVideo&&t.timestamp>this._outputVideoDts&&(I.log("FlvStreamProxy._checkState type=".concat(this._type," outputVideo=true, %ccurVideoDts=").concat(t.timestamp," outputVideoDts=").concat(this._outputVideoDts),"color:green"),this._outputVideo=!0,t.timestamp-this._outputVideoDts>100&&("cdn"!==this._type&&(this._state=4),I.warn("FlvStreamProxy._checkState type=".concat(this._type," dis=").concat(t.timestamp-this._outputVideoDts,", state change to ").concat(this._state,", %ccurVideoDts=").concat(t.timestamp," outputVideoDts=").concat(this._outputVideoDts),"color:green"))):t.isAudio()&&!this._outputAudio&&t.timestamp>this._outputAudioDts&&(I.log("FlvStreamProxy._checkState type=".concat(this._type," outputAudio=true, %ccurAudioDts=").concat(t.timestamp," outputAudioDts=").concat(this._outputAudioDts),"color:red"),this._outputAudio=!0),4===this._state?this.trigger(i.Events.DIS_ERROR):this._outputVideo&&this._outputAudio&&(I.log("FlvStreamProxy._checkState type=".concat(this._type," state change to CATCH_OUTPUT_DTS, %ccurVideoDts=").concat(this.lastVideoDts," outputVideoDts=").concat(this._outputVideoDts," %ccurAudioDts=").concat(this.lastAudioDts," outputAudioDts=").concat(this._outputAudioDts),"color:green","color:red"),this._state=3))}},{key:"_checkOutput",value:function(t){4!==this._state&&(3===this._state?(this._outputVideoConfig(),this._outputAudioConfig(),this._outputTag(t)):t.isVideo()&&this._outputVideo?(this._outputVideoConfig(),this._outputTag(t)):t.isAudio()&&this._outputAudio?(this._outputAudioConfig(),this._outputTag(t)):this.trigger(i.Events.INVALID_TAG,t))}}]),i}(tB);ab.Events={FLV_TAG:"FLV_TAG",CATCH_START_DTS:"CATCH_START_DTS",DIS_ERROR:"DIS_ERROR",INVALID_TAG:"INVALID_TAG"};var aw=function(){function t(e,i){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Object(s.a)(this,t),this.loaderCtrl=e,this.flvPlayer=i,i.hyPlayer&&(this.hyPlayer=i.hyPlayer,this.stat=i.hyPlayer.stat),this._newLink(),this.needRetry=r,this.status=0,this.url=null,this.started=!1,this.lastGetProxyTime=0,this.getProxyPeriod=t.DEFAULT_GET_PROXY_PERIOD,this.headers=null,this.flvStream=new ab("cdn"),this.hisLinks=new aS(i.stat)}return Object(r.a)(t,[{key:"destroy",value:function(){this.link&&this.link.destroy(),this.link=null,this.flvStream&&this.flvStream.destroy(),this.flvStream=null,this.hisLinks&&this.hisLinks.destroy(),this.hisLinks=null}},{key:"_newLink",value:function(){S.firefox&&rN.isSupported()?this.link=new rN(this):rV.isMacChrome72()?this.link=new rM(this):this.link=new rB(this)}},{key:"abort",value:function(){this.link.destroy()}},{key:"reset",value:function(){this.lastGetProxyTime=0,this.status=0,this.url=null,this.started&&(I.log("FlvLoader.reset"),this.link.url&&this.hisLinks.addHis(this.link),this.flvStream.reset(),this.flvStream.off(ab.Events.FLV_TAG,this._onFlvTag,this),this.link.destroy(!1),this._newLink())}},{key:"connect",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;t?(this.link instanceof rM&&(t=t.replace("http","ws")),this.reset(),1==D._testAv1FlvLinkFail&&-1!==t.indexOf("codec=av1")&&(t="abc"+t),this.lastGetProxyTime=g.now()-2e3,I.log("FlvLoader.connect url="+t,this.lastGetProxyTime),this.flvStream.startLoad(e),this.flvStream.on(ab.Events.FLV_TAG,this._onFlvTag,this),this.flvStream.on(ab.Events.INVALID_TAG,this._onInvalidTag,this),this.headers=null,this.url=t,this.link.connect(this.url),this.started=!0):I.warn("FlvLoader.connect url is null")}},{key:"close",value:function(){I.log("FlvLoader.close"),this.reset(),this.started=!1}},{key:"onstatus",value:function(t){this.status=t}},{key:"onheader",value:function(t){this.headers=t,I.log("FlvLoader.onheader",t),this.flvPlayer&&this.flvPlayer.onHeader&&this.flvPlayer.onHeader(t)}},{key:"onopen",value:function(){I.log("FlvLoader.onopen"),this.getProxyPeriod=t.DEFAULT_GET_PROXY_PERIOD,this.flvPlayer.onConnected()}},{key:"onclose",value:function(){D.hasOwnProperty("_toPcdn")||(I.log("FlvLoader.onclose"),this.started&&(this.flvPlayer.onClosed(),this.lastGetProxyTime=0,this.needRetry&&this.getProxy()))}},{key:"onerror",value:function(t,e){this.lastGetProxyTime=0,I.log("FlvLoader.onerror",e,this.needRetry),this.flvPlayer.onLoadError&&this.flvPlayer.onLoadError(t,e)}},{key:"onData",value:function(t){this.flvPlayer.onData(t,1),1===F.pcdnFlvSyncMob&&this.flvStream.parseFlv(t)}},{key:"_onFlvTag",value:function(t){this.flvPlayer.onFlvTag(t)}},{key:"_onInvalidTag",value:function(t){this.flvPlayer.onInvalidTag(t,1)}},{key:"onCheckTimer",value:function(t,e){if(this.started&&(this.onCheckConnect(t),e%10==0)){var i=this.link.speed;
1i!=O.UintMax&&(i=O.formatByteSize(i),I.log("FlvLoader speed ".concat(i,"/s")))}}},{key:"on302",value:function(t){this.flvPlayer.on302&&this.flvPlayer.on302(t)}},{key:"speed",get:function(){var t=this.link.speed;return t==O.UintMax&&(t=0),t}},{key:"connected",get:function(){return this.link&&this.link.connected}},{key:"onCheckConnect",value:function(t){this.connected||(this.needRetry?this.getProxy():t-this.lastGetProxyTime>15e3&&0!=this.lastGetProxyTime&&this.flvPlayer&&this.flvPlayer.onLoadTimeout&&(this.flvPlayer.onLoadTimeout(),this.lastGetProxyTime=0))}},{key:"getProxy",value:function(){var t=g.now();t-this.lastGetProxyTime<this.getProxyPeriod||(I.log("FlvLoader.getProxy lastGetProxyTime="+this.lastGetProxyTime+" now="+t+" period="+this.getProxyPeriod),this.reset(),this.lastGetProxyTime=t,this.getProxyPeriod=Math.min(2*this.getProxyPeriod,128e3),this.flvPlayer.requestUrl())}}]),t}();aw.DEFAULT_GET_PROXY_PERIOD=4e3;var aL="loaded",aF="error",aM="timeout",aN=new Map,aB=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this))._libName=t,r._id=t.replace(".js","_script"),r._script=document.getElementById(r._id),r._loaded=!!r._script,r._onLoadBind=r._onLoad.bind(Object(a.a)(r)),r._onErrorBind=r._onError.bind(Object(a.a)(r)),r}return Object(r.a)(i,[{key:"load",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:6e4;if(this._loaded)this.trigger(aL,2);else{var i=this._script;i||((i=document.createElement("script")).id=this._id,i.async=!0,i.onload=i.onreadystatechange=this._onLoadBind,i.onerror=this._onErrorBind,i.src=t.endsWith("/")?t+this._libName:t+"/"+this._libName,document.getElementsByTagName("head")[0].appendChild(i),I.log("ScriptLoader.load src=".concat(i.src)),this._script=i,tP.once(this._onTimeout,this,e))}}},{key:"_onLoad",value:function(){I.log("ScriptLoader._onLoad src=".concat(this._script.src));var t=this._script,e=t.readyState;e&&"loaded"!==e&&"complete"!==e||(t.onload=t.onreadystatechange=null,this._loaded=!0,tP.remove(this._onTimeout,this),this.trigger(aL,1))}},{key:"_onTimeout",value:function(){this._clear(),this.trigger(aM)}},{key:"_onError",value:function(t){I.log("ScriptLoader._onError src=".concat(this._script.src," message=").concat(t.message)),this._clear(),this.trigger(aF)}},{key:"_clear",value:function(){var t=this._script;t&&(t.onload=t.onreadystatechange=t.onerror=null,t.src="",t.parentNode&&t.parentNode.removeChild(t),this._script=null)}}]),i}(tB),aV=function(t,e,i){var s=i.onLoaded,r=void 0===s?null:s,a=i.onError,n=void 0===a?null:a,o=i.onTimeout,u=void 0===o?null:o,l=i.thisObj,d=void 0===l?null:l,c=i.timeout,f=aN.get(e);return f||(f=new aB(e),aN.set(e,f)),r&&f.on(aL,r,d),n&&f.on(aF,n,d),u&&f.on(aM,u,d),f.load(t,void 0===c?6e4:c),f},aU=function(t,e){var i=e.onLoaded,s=void 0===i?null:i,r=e.onError,a=void 0===r?null:r,n=e.onTimeout,o=void 0===n?null:n,u=e.thisObj,l=void 0===u?null:u,d=aN.get(t);d&&(s&&d.off(aL,s,l),a&&d.off(aF,a,l),o&&d.off(aM,o,l))},ax={ppio:"ppio",xy:"xy"},aH={ppio:"EcdnLive.js",xy:"XYLive.js"},aG={},aW=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this))._pcdnName="",t._loader=null,t._lastDataTs=0,t._started=!1,t._speed=new X(10),t._callbacks={onLoaded:t._onLoadLibSUc,onError:t._onLoadLibErr,thisObj:Object(a.a)(t)},t._binds={},t._binds.LOAD_FAIL=t._onLoadFail.bind(Object(a.a)(t)),t._binds.GATHER_SUC=t._onGatherSuc.bind(Object(a.a)(t)),t._binds.GATHER_FAIL=t._onGatherFail.bind(Object(a.a)(t)),t._binds.DATA=t._onData.bind(Object(a.a)(t)),t._binds.LOAD_STOP=t._onLoadStop.bind(Object(a.a)(t)),t._binds.LOAD_FINISH=t._onLoadFinish.bind(Object(a.a)(t)),t._binds.SDK_DESTROYED=t._sdkDestroy.bind(Object(a.a)(t)),t}return Object(r.a)(i,[{key:"setPcdnName",value:function(t){this._pcdnName=t}},{key:"isLibReady",value:function(){return aG[this._pcdnName]}},{key:"loadLib",value:function(t){this.isLibReady()?this.trigger(i.BaseEvents.LIB_READY,{type:i.BaseEvents.LIB_READY,isFirst:!1}):aV(t,aH[this._pcdnName],this._callbacks)}},{key:"_onLoadLibSUc",value:function(){aU(aH[this._pcdnName],this._callbacks),this._hasInterface()?(aG[this._pcdnName]=1,this.trigger(i.BaseEvents.LIB_READY,{type:i.BaseEvents.LIB_READY,isFirst:!0})):this.trigger(i.BaseEvents.LIB_ERR,{type:i.BaseEvents.LIB_ERR,msg:"".concat(this._pcdnName," has no constructor!")})}},{key:"_hasInterface",value:function(){return this._pcdnName===ax.p
1pio?!!window.EcdnLive:this._pcdnName===ax.xy&&!!window.xyvp&&!!window.xyvp.Loader}},{key:"_createLoader",value:function(){this._pcdnName===ax.ppio?this._loader=new window.EcdnLive({appId:"huya",debug:!1,logLevel:""}):this._pcdnName===ax.xy&&(this._loader=new window.xyvp.Loader),this._doPcdnEvents(!0)}},{key:"_destroyLoader",value:function(){this._loader&&(this._doPcdnEvents(!1),this._loader.stopLoad(),this._loader.stopPeerGather(),this._loader.destroy(),this._loader=null)}},{key:"_doPcdnEvents",value:function(t){if(this._loader)for(var e in this._binds)t?this._loader.on(e,this._binds[e]):this._loader.off(e,this._binds[e])}},{key:"_onLoadLibErr",value:function(){this.trigger(i.BaseEvents.LIB_ERR,{type:i.BaseEvents.LIB_ERR,msg:"".concat(this._pcdnName," load_fail")})}},{key:"_onLoadFail",value:function(){this.trigger(i.LoadEvents.LOAD_FAIL,{type:i.LoadEvents.LOAD_FAIL})}},{key:"_onData",value:function(t){0===this._lastDataTs&&(this.trigger(i.LoadEvents.LOAD_SUC,{type:i.LoadEvents.LOAD_SUC}),tP.remove(this.onConnectTimeout,this));var e="xy"===this._pcdnName?t:t.data;this._lastDataTs=g.now(),this._speed.addCur(e.byteLength),this.trigger(i.LoadEvents.DATA,{type:i.LoadEvents.DATA,data:e})}},{key:"_onGatherSuc",value:function(){this.trigger(i.BaseEvents.GATHER_SUC,{type:i.BaseEvents.GATHER_SUC})}},{key:"_onGatherFail",value:function(){this.trigger(i.BaseEvents.GATHER_FAIL,{type:i.BaseEvents.GATHER_FAIL})}},{key:"_onLoadStop",value:function(){this.trigger(i.LoadEvents.LOAD_STOP,{type:i.LoadEvents.LOAD_STOP})}},{key:"_onLoadFinish",value:function(){this.trigger(i.LoadEvents.LOAD_FINISH,{type:i.LoadEvents.LOAD_FINISH})}},{key:"_sdkDestroy",value:function(){this.trigger(i.LoadEvents.SDK_DESTROYED,{type:i.LoadEvents.SDK_DESTROYED})}},{key:"getName",value:function(){return this._pcdnName}},{key:"speed",get:function(){var t=this._speed.average();
1return t===O.UintMax&&(t=0),t}},{key:"connected",get:function(){return this._lastDataTs>0}},{key:"create",value:function(){this._destroyLoader(),this._createLoader()}},{key:"startPeerGather",value:function(t){this._callPcdn("startPeerGather",[t])}},{key:"stopPeerGather",value:function(){this._callPcdn("stopPeerGather")}},{key:"refreshUrl",value:function(t){this._callPcdn("refreshUrl",[t])}},{key:"startLoad",value:function(t,e){I.log("PcdnLoader.startLoad url="+t,JSON.stringify(e)),this._started=!0,this._lastDataTs=0,tP.once(this.onConnectTimeout,this,1e3),this._callPcdn("startLoad",[t,e])}},{key:"onConnectTimeout",value:function(){this.trigger(i.LoadEvents.CONNECT_TIMEOUT,{type:i.LoadEvents.CONNECT_TIMEOUT})}},{key:"stopLoad",value:function(t){this._started&&(this._lastDataTs=0,this._started=!1,this._speed.reset(),tP.remove(this.onConnectTimeout,this),this._callPcdn("stopLoad",{reason:t}))}},{key:"destroy",value:function(){this.clear(),this._lastDataTs=0,this._started=!1,tP.remove(this.onConnectTimeout,this),this._doPcdnEvents(!1),this._callPcdn("destroy")}},{key:"close",value:function(){this.clear(),this._doPcdnEvents(!1),this.stopLoad(),this.stopPeerGather(),this._callPcdn("destroy"),this._loader=null}},{key:"_callPcdn",value:function(t,e){this._loader&&this._loader[t]?(I.log("PcdnLoader.".concat(t," ").concat(this._pcdnName," ").concat(e?JSON.stringify(e):"")),this._loader[t].apply(this._loader,e)):I.log("PcdnLoader.".concat(t," ").concat(this._pcdnName," hasLoader=").concat(!!this._loader," hasInterface=").concat(!!this._loader&&!!this._loader[t]))}},{key:"onCheckTimer",value:function(t,e){this._speed.calculate()}},{key:"onCheckFastTimer",value:function(t,e){this._lastDataTs>0&&t-this._lastDataTs>=2e3&&(this._lastDataTs=t,this.trigger(i.LoadEvents.DATA_TIMEOUT,{type:i.LoadEvents.DATA_TIMEOUT}))}}],[{key:"hasPcdn",value:function(t){return!!ax[t]}}]),i}(tB);function aj(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function aY(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?aj(Object(i),!0).forEach(function(e){ij(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):aj(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}aW.BaseEvents={LIB_READY:"LIB_READY",LIB_ERR:"LIB_ERR",GATHER_SUC:"GATHER_SUC",GATHER_FAIL:"GATHER_FAIL"},aW.LoadEvents={CONNECT_TIMEOUT:"CONNECT_TIMEOUT",LOAD_SUC:"LOAD_SUC",DATA:"DATA",DATA_TIMEOUT:"DATA_TIMEOUT",LOAD_FAIL:"LOAD_FAIL",LOAD_STOP:"LOAD_STOP",LOAD_FINISH:"LOAD_FINISH",SDK_DESTROYED:"SDK_DESTROYED"};var aq=function(){function t(e){Object(s.a)(this,t),this.handler=e,this._newLink(),this.status=0,this.url=null,this.started=!1,this.headers=null,this.isClose=!1}return Object(r.a)(t,[{key:"_newLink",value:function(){S.firefox&&rN.isSupported()?this.link=new rN(this):rV.isMacChrome72()?this.link=new rM(this):this.link=new rB(this)}},{key:"abort",value:function(){this.link.destroy()}},{key:"reset",value:function(){this.status=0,this.url=null,this.started&&(I.log("ProtoLinkLoader.reset"),this.link.destroy(),this._newLink())}},{key:"connect",value:function(t){t?(this.reset(),I.log("ProtoLinkLoader.connect url="+t),this.headers=null,this.isClose=!1,this.url=t,this.link.connect(this.url),this.started=!0):I.warn("ProtoLinkLoader.connect url is null")}},{key:"close",value:function(){this.isClose=!0,I.log("ProtoLinkLoader pcdn 302.close"),this.reset(),this.started=!1}},{key:"onstatus",value:function(t){this.status=t}},{key:"onheader",value:function(t){this.headers=t,I.log("ProtoLinkLoader.onheader",t),this.handler&&this.handler.onheader&&this.handler.onheader(t)}},{key:"onopen",value:function(){I.log("ProtoLinkLoader.onopen"),this.handler&&this.handler.onopen&&this.handler.onopen()}},{key:"onclose",value:function(){this.started&&this.handler&&this.handler.onclose&&(I.log("ProtoLinkLoader.onclose"),this.handler.onclose())}},{key:"onerror",value:function(t,e){I.log("ProtoLinkLoader.onerror",e),this.handler&&this.handler.onerror&&this.handler.onerror(t,e)}},{key:"onData",value:function(t){this.handler&&this.handler.onData&&this.handler.onData(t)}},{key:"on302",value:function(t){this.handler&&this.handler.on302&&this.handler.on302(t)}},{key:"connected",get:function(){return this.link&&this.link.connected}}]),t}();aq.DEFAULT_GET_PROXY_PERIOD=4e3;var aK={CLOSED:1,TAF_REQ:2,TAF_RSP:3,PCDN_NAME:4,LIB_LOAD:5,LIB_FAIL:6,GATHER_START:7,GATHER_FAIL:8,GATHER_SUC:9,LOAD_START:10,LOAD_TIMEOUT:11,LOAD_DATA_TIMEOUT:12,LOAD_STOP:13,LOAD_FAIL:14,LOAD_SUC:15,LOAD_FINISH:16,SDK_DESTROYED:17,KICK_ERROR:18,WAIT_CDN_LOAD:19,DTS_ERROR:20},az=new(function(){function t(){if(Object(s.a)(this,t),this.ignoreDomains=[],D.hasOwnProperty("_p_i_domains")){var e=D.getItem("_p_i_domains");this.ignoreDomains=e.split(",,")}}return Object(r.a)(t,[{key:"addIgnoreDomain",value:function(t){var e=this._getDomain(t);I.log("PcdnDomainStore.addIgnoreDomain domain=".concat(e)),-1===this.ignoreDomains.indexOf(e)&&(this.ignoreDomains.push(e),this.ignoreDomains.length>10&&this.ignoreDomains.shift(),D.setItem("_p_i_domains",this.ignoreDomains.join(",,")))}},{key:"isIgnoreDomain",value:function(t){if(0===F.pcdnFlvIgnore)return!1;var e=this._getDomain(t);return -1!==this.ignoreDomains.indexOf(e)}},{key:"_getDomain",value:function(t){var e=t.split("//"),i="";
11===e.length?i=e[0]:e.length>1&&(i=e[1]);var s=i.split("/");return s.length>0?s[0]:""}}]),t}()),aJ={ppio:"ppio",xy:"xy",qn:"qn"},aQ=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r){var n;return Object(s.a)(this,i),(n=e.call(this)).handler=t,n._flvPlayer=r,n._pcdnName="",n._loader=null,n._lastDataTs=0,n._firstDataTs=0,n._lastCheckRecvTs=0,n._started=!1,n._loader=new aq(Object(a.a)(n)),n._speed=new X(10),n.flvVUrl=[],n.usePcdn=!1,n.resetStats(),n.isStart=!1,n.pcdnErrorCnt=0,n.flvStream=new ab("pcdn"),n}return Object(r.a)(i,[{key:"destroy",value:function(){this.clear(),this.close()}},{key:"startLoader",value:function(){this.pcdnErrorCnt=0,this.isStart=!0,this.reqPcdn()}},{key:"reqPcdn",value:function(){var t=this;if(!this.usePcdn&&this.isStart&&!(1==F.pcdn302FlvBakCfg[0]&&this.pcdnErrorCnt>3)){this.flvVUrl.length=0,this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.TAF_REQ),this.handler.setFlvPcdnState(aK.TAF_REQ);var e=new d.HUYA.ClientGetPcdnFlvHttpFullstreamInfoReq;e.lReqTs=Date.now(),e.lUid=w.uid,e.sGuid=w.sGuid,e.lAnchorUid=this._flvPlayer.info.presenterUid,e.iCdnLine=this._flvPlayer.info.lineType,e.iCliType=d.HUYA.EM_CLINET_TYPE.E_CLIENT_WEB,e.sStreamName=this._flvPlayer.info.sStreamName,e.iRatio=this._flvPlayer.info.iBitRate,e.sCodec="264",this._flvPlayer.isH265?e.sCodec="265":this._flvPlayer.isAv1&&(e.sCodec="av1"),e.lBucketPara=Number(D.randomPcdnPercent)||0,e.iBusiType=d.HUYA.EM_BUSI_TYPE.E_BusiType_Live,e.curPcdnName="",e.supportV6=0,e.sUserAgent="",I.log("PcdnLoader302.reqPcdn req, pcdnErrorCnt=".concat(this.pcdnErrorCnt),e),this.pcdn302CoreStats.get_subs_url_cnt++,tC.sendWup("hypcdngw","onClientGetPcdnFlvHttpFullstreamInfo",e,function(e){I.log("PcdnLoader302.reqPcdn res",e),t._rspPcdn302(e)},!0,tC.getRequestId()),tP.once(this.timeoutGetPcdn,this,3e3)}}},{key:"timeoutGetPcdn",value:function(){I.log("PcdnLoader302.reqPcdn timeoutGetPcdn"),this.pcdn302CoreStats.get_pcdn_url_timeout_cnt++}},{key:"_rspPcdn302",value:function(t){if(tP.remove(this.timeoutGetPcdn,this),t&&0==t.iErrCode){this.pcdn302CoreStats.get_pcdn_url_total_cnt++,this._pcdnName=t.sPcdnName,this.handler._loadPcdn302Rsp(t);var e=t.mAllPullStreamUrl.value.https;100==e.iStatusPcdn?(this.flvVUrl=e.vUrl.value,this.flvVUrl.length>0&&az.isIgnoreDomain(this.flvVUrl[0])?(this.flvVUrl.length=0,this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.PCDN_NAME),this.handler.setFlvPcdnState(aK.PCDN_NAME)):this._onGatherSuc(),this.pcdn302CoreStats.get_pcdn_url_success++):(this._onGatherFail(e.iStatusPcdn),101==e.iStatusPcdn?this.pcdn302CoreStats.get_pcdn_err_not_reached++:102==e.iStatusPcdn?this.pcdn302CoreStats.get_pcdn_err_over_run++:103==e.iStatusPcdn?this.pcdn302CoreStats.get_pcdn_err_not_coverd++:this.pcdn302CoreStats.get_pcdn_err_other++)}else this.pcdn302CoreStats.get_subs_url_error_cnt++}},{key:"_onGatherSuc",value:function(){this.trigger(i.BaseEvents.GATHER_SUC,{type:i.BaseEvents.GATHER_SUC})}},{key:"_onGatherFail",value:function(t){this.trigger(i.BaseEvents.GATHER_FAIL,{type:i.BaseEvents.GATHER_FAIL,data:t})}},{key:"getName",value:function(){return this._pcdnName}},{key:"speed",get:function(){var t=this._speed.average();
1return t===O.UintMax&&(t=0),t}},{key:"connected",get:function(){return this._lastDataTs>0}},{key:"refreshUrl",value:function(t){this.url=t}},{key:"startLoad",value:function(t){if(this.pcdn302CoreStats.get_stream_cnt++,I.log("PcdnLoader302.startLoad",JSON.stringify(t)),this._started=!0,this._lastDataTs=0,this._firstDataTs=0,this.flvVUrl.length>0){this.flvStream.on(ab.Events.FLV_TAG,this._onFlvTag,this),this.flvStream.on(ab.Events.CATCH_START_DTS,this._onCatchStartDts,this),this.flvStream.on(ab.Events.DIS_ERROR,this._onDisError,this),this.flvStream.on(ab.Events.INVALID_TAG,this._onInvalidTag,this),this.flvStream.startLoad(t.startDts);var e=this.handler.getPcdn302Params(this.flvVUrl[0]);e+="&dts=".concat(t.startDts),this._loader.connect(e),tP.once(this.onConnectTimeout,this,1e3)}else this.trigger(i.LoadEvents.CONNECT_TIMEOUT,{type:i.LoadEvents.CONNECT_TIMEOUT})}},{key:"onConnectTimeout",value:function(){F.platform===L.PLATFORM_TYPE_NAME.wap&&this.pcdnErrorCnt++,this.pcdn302CoreStats.get_stream_error_cnt++,this.pcdn302CoreStats.switch_time_out_cnt++,this.trigger(i.LoadEvents.CONNECT_TIMEOUT,{type:i.LoadEvents.CONNECT_TIMEOUT})}},{key:"onDataTimeout",value:function(){this.pcdn302CoreStats.get_stream_error_cnt++,this.pcdn302CoreStats.switch_no_data_cnt++}},{key:"stopLoad",value:function(t){this._started&&(this._lastDataTs=0,this._firstDataTs=0,this._started=!1,this._speed.reset(),tP.remove(this.onConnectTimeout,this),this._loader.close()),this.flvStream.reset(),this.flvStream.off(ab.Events.FLV_TAG,this._onFlvTag,this),this.flvStream.off(ab.Events.CATCH_START_DTS,this._onCatchStartDts,this),this.flvStream.off(ab.Events.DIS_ERROR,this._onDisError,this)}},{key:"close",value:function(){this.stopLoad(),this.flvVUrl.length}},{key:"onCheckTimer",value:function(t,e){this._started&&this._speed.calculate()}},{key:"onCheckFastTimer",value:function(t,e){this._started&&(this._lastDataTs>0&&t-this._lastDataTs>=2e3&&(this._lastDataTs=t,this.trigger(i.LoadEvents.DATA_TIMEOUT,{type:i.LoadEvents.DATA_TIMEOUT})),t-this._firstDataTs>5e3&&this.onPlayError())}},{key:"onPlayError",value:function(){var t=g.now();if(!(t-this._lastCheckRecvTs<1e3)&&(this._lastCheckRecvTs=t,this._flvPlayer&&this._flvPlayer.mse&&this._flvPlayer.mse.parser)){var e=this._flvPlayer.mse.parser;if(e.downFrameRate.getSize()>5){var s=e.getRealFps(),r=e.downFrameRate.getLastRate(5);s>0&&r>0&&r<.8*s&&(I.log("PcdnLoader302.onCheckFastTimer dataslow recvFps=".concat(r," realFps=").concat(s)),this.flvVUrl.length>0&&az.addIgnoreDomain(this.flvVUrl[0]),this.trigger(i.LoadEvents.DATA_TIMEOUT,{type:i.LoadEvents.DATA_TIMEOUT}))}}}},{key:"onData",value:function(t){var e=g.now();0===this._lastDataTs&&(this._firstDataTs=e,this.trigger(i.LoadEvents.LOAD_SUC,{type:i.LoadEvents.LOAD_SUC}),tP.remove(this.onConnectTimeout,this)),this._lastDataTs=e,this._speed.addCur(t.byteLength),this.trigger(i.LoadEvents.DATA,{type:i.LoadEvents.DATA,data:t}),1===F.pcdnFlvSyncMob&&this.flvStream.parseFlv(t)}},{key:"_onFlvTag",value:function(t){this.trigger(i.LoadEvents.FLV_TAG,{type:i.LoadEvents.FLV_TAG,tag:t})}},{key:"_onInvalidTag",value:function(t){this.trigger(i.LoadEvents.INVALID_TAG,{type:i.LoadEvents.INVALID_TAG,tag:t})}},{key:"_onCatchStartDts",value:function(){this.trigger(i.LoadEvents.SWAP_SUC,{type:i.LoadEvents.SWAP_SUC})}},{key:"_onDisError",value:function(){this.trigger(i.LoadEvents.DIS_ERROR,{type:i.LoadEvents.DIS_ERROR})}},{key:"onclose",value:function(){if(!this._loader.isClose){var t=g.now();0!=this._firstDataTs&&t-this._firstDataTs>=5e3?this.pcdn302CoreStats.switch_cmerr_cnt++:(this.pcdn302CoreStats.get_stream_error_cnt++,this.pcdn302CoreStats.switch_cdn_err_cnt++,this.pcdnErrorCnt++),this.trigger(i.LoadEvents.LOAD_FAIL,{type:i.LoadEvents.LOAD_FAIL})}}},{key:"onerror",value:function(t,e){if(!this._loader.isClose){"number"==typeof e&&(this.httpCode=e);var s=g.now();0!=this._firstDataTs&&s-this._firstDataTs>5e3?this.pcdn302CoreStats.switch_cmerr_cnt++:(this.pcdn302CoreStats.get_stream_error_cnt++,this.pcdn302CoreStats.switch_cdn_err_cnt++,this.pcdnErrorCnt++),this.trigger(i.LoadEvents.LOAD_FAIL,{type:i.LoadEvents.LOAD_FAIL})}}},{key:"dtsError302",value:function(){this.pcdn302CoreStats.switch_cdn_dts_err_cnt++}},{key:"getPcdn302Stats",value:function(){var t=aY({},this.pcdn302CoreStats),e=aY({},this.pcdn302DimStats);return this.resetStats(),{pcdn302CoreStats:t,pcdn302DimStats:e}}},{key:"resetStats",value:function(){this.httpCode=0,this.pcdn302CoreStats={get_subs_url_cnt:0,get_subs_url_error_cnt:0,get_pcdn_url_timeout_cnt:0,get_pcdn_url_total_cnt:0,get_pcdn_url_success:0,get_pcdn_err_not_reached:0,get_pcdn_err_over_run:0,get_pcdn_err_not_coverd:0,get_pcdn_err_other:0,get_stream_cnt:0,get_stream_error_cnt:0,switch_time_out_cnt:0,switch_no_data_cnt:0,switch_cdn_err_cnt:0,switch_cdn_dts_err_cnt:0,pcdn_kick_out_cnt:0,switch_cmerr_cnt:0}}}],[{key:"hasPcdn",value:function(t){return!!aJ[t]}
1}]),i}(tB);aQ.BaseEvents={LIB_READY:"LIB_READY",GATHER_SUC:"GATHER_SUC",GATHER_FAIL:"GATHER_FAIL"},aQ.LoadEvents={CONNECT_TIMEOUT:"CONNECT_TIMEOUT",LOAD_SUC:"LOAD_SUC",DATA:"DATA",SWAP_SUC:"SWAP_SUC",DIS_ERROR:"DIS_ERROR",FLV_TAG:"FLV_TAG",INVALID_TAG:"INVALID_TAG",DATA_TIMEOUT:"DATA_TIMEOUT",LOAD_FAIL:"LOAD_FAIL",KICK_ERROR:"KICK_ERROR"};var aX=function(){function t(e){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Object(s.a)(this,t),this._flvPlayer=e,this._flvLoader=new aw(this,e,i),this._pcdnLoader=new aW,this._pcdn302Loader=new aQ(this,e),this._sPcdnName="",this._requesting=!1,this._loader=null,this._swapTs=0,this._gatherSuc=!1,this._failCnt=0,this._cdnCnt=0,this._pullNum=0,this.url="",this._checkSampleBind=this._checkSample.bind(this),this._disError302Bind=this._disError302.bind(this),this._reqPcdn302Ts=0,this._startDtsType=0,this.startDts=0,this.isOnPlayVideo=!1}return Object(r.a)(t,[{key:"getPullNum",value:function(){if(0===this._pullNum)return 0;var t=this._pullNum;return this._pullNum++,t}},{key:"connected",get:function(){return this._loader&&this._loader.connected}},{key:"speed",get:function(){return this._loader&&this._loader.speed}},{key:"destroy",value:function(){this._doPcdn302EventHandler(aQ.LoadEvents,!1),this._doPcdn302EventHandler(aQ.BaseEvents,!1),this._flvLoader&&this._flvLoader.destroy(),this._flvLoader=null,this._pcdnLoader&&this._pcdnLoader.destroy(),this._pcdnLoader=null,this._pcdn302Loader&&this._pcdn302Loader.destroy(),this._pcdn302Loader=null}},{key:"close",value:function(){I.log("LoaderCtrl.close"),this._flvPlayer.anticode.off(sb.Events.REFRESH,this._onAnticodeRefresh,this),this._flvLoader.close(),this._pcdnLoader.close(),this._pcdn302Loader.close(),this._requesting=!1,this._loader=null,this._failCnt=0,this._gatherSuc=!1,this._swapTs=0,this._sPcdnName="",this._reqPcdn302Ts=0}},{key:"checkPcdnMode",value:function(t){this._reqPcdn(t),this.isOnPlayVideo&&this._flvPlayer.info.use302Pcdn&&!this._isClosePcdn()&&(this._reqPcdn302Ts=g.now(),this._pcdn302Loader.startLoader())}},{key:"onPlayError",value:function(){this._pcdn302Loader&&this._pcdn302Loader.onPlayError()}},{key:"onPlayVideo",value:function(){this._flvPlayer.info.use302Pcdn&&!this._isClosePcdn()?(this._reqPcdn302Ts=g.now(),this._pcdn302Loader.startLoader()):this.isOnPlayVideo=!0}},{key:"connect",value:function(t){this.close(),this.url=t,this._connect(t,"firstCdn"),this._flvPlayer.info.use302Pcdn||this._reqPcdn()}},{key:"_connect",value:function(t,e){this._cdnCnt++,t=this._getUrlParams(t,!1,e),I.log("LoaderCtrl._connect",t),this._flvPlayer.anticode.off(sb.Events.REFRESH,this._onAnticodeRefresh,this),this._stopPcdn(e);var i=t,s=this._flvPlayer.mse.getIframePts();s>0&&(-1!==i.indexOf("?")?i+="&startPts=".concat(s):i+="?startPts=".concat(s)),this._flvLoader.connect(i,s>0?s:-1),this._loader=this._flvLoader,this.url=this._flvLoader.url?this._flvLoader.url:t,this._flvPlayer.stat.setComDim(R.DIM_COM.STREAM_URL,this.url)}},{key:"_stopPcdn",value:function(t){this._doPcdnEventHandler(aW.LoadEvents,!1),this._pcdnLoader.stopLoad(t),this._pcdn302Loader.stopLoad(t)}},{key:"_isClosePcdn",value:function(){var t=this._flvPlayer.info;return!((!t||!t.isPureAudio)&&(1===F.av1CloseFlvPcdn&&this._flvPlayer.isAv1?(I.log("LoaderCtrl._isClosePcdn config close av1!"),0):F.isNotUsePcdn(t.presenterUid,t.uid)||F.isCloseFlvPcdnUser(t.uid)?(I.log("LoaderCtrl._isClosePcdn config close uid!"),0):F.isCloseFlvPcdnPid(t.presenterUid)?(I.log("LoaderCtrl._isClosePcdn config close pid!"),0):F.isCloseFlvPcdnBroVer()?(I.log("LoaderCtrl._isClosePcdn config close broVer!"),0):0===F.pcdnMseFlv&&this._flvPlayer.isMse?(I.log("LoaderCtrl._isClosePcdn config close pcdnMseFlv!"),0):1==D._closePcdn?(I.log("LoaderCtrl._isClosePcdn host close"),0):!t.isAuto||Number(F.closePcdn500)!==t.curBitrate||(I.log("LoaderCtrl._isClosePcdn closePcdn500"),0)))}},{key:"_reqPcdn",value:function(t){var e=this;
1if(!this._isClosePcdn()){if(D._pcdnName&&(this._flvPlayer.info.usePcdn=1),1!==this._flvPlayer.info.usePcdn&&1!=this._flvPlayer.info.use302Pcdn&&(this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.CLOSED),this.setFlvPcdnState(aK.CLOSED)),1===this._flvPlayer.info.use302Pcdn)this.setFlvPcdnState(aK.WAIT_CDN_LOAD),this._doPcdn302EventHandler(aQ.BaseEvents,!0),this._doPcdn302EventHandler(aQ.LoadEvents,!0),this._pcdn302Loader._pcdnName=this._flvPlayer._getPcdn302Name(t);else if(1===this._flvPlayer.info.usePcdn&&!this._requesting&&""===this._sPcdnName){this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.TAF_REQ),this.setFlvPcdnState(aK.TAF_REQ),this._requesting=!0;var i=new d.HUYA.ClientGetPcdnFlvOutsideSdkFullstreamInfoReq;i.lReqTs=Date.now(),i.lUid=w.uid,i.sGuid=w.sGuid,i.lAnchorUid=this._flvPlayer.info.presenterUid,i.iCdnLine=this._flvPlayer.info.lineType,i.iCliType=d.HUYA.EM_CLINET_TYPE.E_CLIENT_WEB,i.lBucketPara=Number(D.randomPcdnPercent)||0,i.iBusiType=d.HUYA.EM_BUSI_TYPE.E_BusiType_Live,i.vCliSupportPcdns.value=["ppio","xy"],i.sStreamName=this._flvPlayer.info.sStreamName,this._flvPlayer.isH265?i.sCodec="265":this._flvPlayer.isAv1?i.sCodec="av1":i.sCodec="264",I.log("LoaderCtrl.reqPcdn req",i),tC.sendWup("hypcdngw","onClientGetPcdnFlvOutsideSdkFullstreamInfo",i,function(t){I.log("HYPlayer.reqPcdn res",t),t&&(0==t.iErrCode||7==t.iErrCode)&&e._rspPcdn(t)},!0,tC.getRequestId())}}}},{key:"_rspPcdn",value:function(t){this._requesting=!1,D._pcdnName&&(t.sPcdnName=D._pcdnName),this._sPcdnName!==t.sPcdnName&&(this._sPcdnName=t.sPcdnName,this._flvPlayer.stat.setComDim(R.DIM_COM.PCDN_ORIGIN,t.sPcdnName),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.TAF_RSP),this.setFlvPcdnState(aK.TAF_RSP),this._loadPcdn())}},{key:"onCheckTimer",value:function(t,e){if(this._loader&&this._loader.onCheckTimer(t,e),this._checkSwapToPcdn(t),this._flvPlayer&&this._flvPlayer.info&&this._flvPlayer.info.use302Pcdn){var i=g.now();0!=this._reqPcdn302Ts&&i-this._reqPcdn302Ts>=1e3*F.pcdn302FlvCfg[1]&&(this._pcdn302Loader.reqPcdn(),this._reqPcdn302Ts=i)}}},{key:"_checkSwapToPcdn",value:function(t){if(this._flvPlayer&&this._flvPlayer.info&&1===this._flvPlayer.info.use302Pcdn){if(t>this._swapTs&&this._gatherSuc&&this._flvPlayer.getBufferLen()>F.flvToPcdnBuf&&this._loader!==this._pcdn302Loader)return this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_START),this.setFlvPcdnState(aK.LOAD_START),0===F.pcdnFlvSyncMob&&this._flvLoader.close(),this._swapToPcdn(),!0}else if(t>this._swapTs&&this._gatherSuc&&this._flvPlayer.getBufferLen()>F.flvToPcdnBuf&&this._loader!==this._pcdnLoader)return this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_START),this.setFlvPcdnState(aK.LOAD_START),this._swapToPcdn(),!0;return!1}},{key:"onCheckFastTimer",value:function(t,e){this._loader&&this._loader.onCheckFastTimer&&this._loader.onCheckFastTimer(t,e),this._loader!==this._flvLoader&&this._flvPlayer.getBufferLen()<=F.flvToCdnBuf&&this._swapToCdn(11)}},{key:"_loadPcdn",value:function(){aW.hasPcdn(this._sPcdnName)?(this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LIB_LOAD),this.setFlvPcdnState(aK.LIB_LOAD),this._doPcdnEventHandler(aW.BaseEvents,!0),this._pcdnLoader.setPcdnName(this._sPcdnName),this._pcdnLoader.loadLib(this._flvPlayer.info.h5Root)):(this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.PCDN_NAME),this.setFlvPcdnState(aK.PCDN_NAME))}},{key:"_loadPcdn302Rsp",value:function(t){this._sPcdnName=t.sPcdnName,this._flvPlayer.stat.setComDim(R.DIM_COM.PCDN_ORIGIN,t.sPcdnName),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.TAF_RSP),this.setFlvPcdnState(aK.TAF_RSP)}},{key:"_doPcdnEventHandler",value:function(t,e){for(var i in t){var s=t[i];e?this._pcdnLoader.on(s,this._onPcdnEventHandler,this):this._pcdnLoader.off(s,this._onPcdnEventHandler,this)}}},{key:"_doPcdn302EventHandler",value:function(t,e){for(var i in I.log("LoaderCtrl._doPcdn302EventHandler",e),t){var s=t[i];e?this._pcdn302Loader.on(s,this._onPcdn302EventHandler,this):this._pcdn302Loader.off(s,this._onPcdn302EventHandler,this)}}},{key:"_onPcdnEventHandler",value:function(t){if(!(this._flvPlayer&&this._flvPlayer.info&&this._flvPlayer.info.use302Pcdn))switch(t.type!==aW.LoadEvents.DATA&&I.log("LoaderCtrl._onPcdnEventHandler",t.type,t.msg),t.type){case aW.BaseEvents.LIB_READY:t.isFirst&&this._reportPcdnLibAct([0],[this._pcdnLoader.getName()]),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.GATHER_START),this.setFlvPcdnState(aK.GATHER_START),this._pcdnLoader.create(),this._pcdnLoader.startPeerGather(this._getUrl(!0));break;case aW.BaseEvents.LIB_ERR:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LIB_FAIL),this._reportPcdnLibAct([100],[this._pcdnLoader.getName()]),this.setFlvPcdnState(aK.LIB_FAIL);break;case aW.LoadEvents.CONNECT_TIMEOUT:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_TIMEOUT),this.setFlvPcdnState(aK.LOAD_TIMEOUT),this._swapToCdn(t.type);break;case aW.LoadEvents.DATA_TIMEOUT:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_DATA_TIMEOUT),this.setFlvPcdnState(aK.LOAD_DATA_TIMEOUT),this._swapToCdn(t.type);break;case aW.LoadEvents.LOAD_SUC:this._failCnt=0,this._flvLoader.close(),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_SUC),this.setFlvPcdnState(aK.LOAD_SUC),this._beforeSwap(2);break;case aW.LoadEvents.LOAD_FAIL:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_FAIL),this.setFlvPcdnState(aK.LOAD_FAIL),this._swapToCdn(t.type);break;case aW.BaseEvents.GATHER_SUC:this._gatherSuc=!0,I.log("LoaderCtrl gather_suc",this._loader!==this._pcdnLoader),this._checkSwapToPcdn(g.now())||this._loader===this._pcdnLoader||(this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.GATHER_SUC),this.setFlvPcdnState(aK.GATHER_SUC));break;case aW.BaseEvents.GATHER_FAIL:this._gatherSuc=!1,this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.GATHER_FAIL),this.setFlvPcdnState(aK.GATHER_FAIL),this._swapToCdn(t.type);break;case aW.LoadEvents.DATA:this._flvPlayer.onData(t.data,2);break;case aW.LoadEvents.LOAD_STOP:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_STOP),this.setFlvPcdnState(aK.LOAD_STOP),this._swapToCdn(t.type);break;case aW.LoadEvents.LOAD_FINISH:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_FINISH),this.setFlvPcdnState(aK.LOAD_FINISH),this._swapToCdn(t.type);break;case aW.LoadEvents.SDK_DESTROYED:this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.SDK_DESTROYED),this.setFlvPcdnState(aK.SDK_DESTROYED),this._swapToCdn(t.type)}}},{key:"_onPcdn302EventHandler",value:function(t){if(!this._flvPlayer||!this._flvPlayer.info||this._flvPlayer.info.use302Pcdn)switch(t.type){case aQ.BaseEvents.GATHER_SUC:this._gatherSuc=!0,I.log("LoaderCtrl._onPcdn302EventHandler, GATHER_SUC",this._loader!==this._pcdn302Loader),this._checkSwapToPcdn(g.now())||this._loader===this._pcdn302Loader||(this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.GATHER_SUC),this.setFlvPcdnState(aK.GATHER_SUC));break;case aQ.BaseEvents.GATHER_FAIL:I.log("LoaderCtrl._onPcdn302EventHandler, GATHER_FAIL",t.data),this._gatherSuc=!1,this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.GATHER_FAIL),this.setFlvPcdnState(aK.GATHER_FAIL);break;case aQ.LoadEvents.LOAD_SUC:I.log("LoaderCtrl._onPcdn302EventHandler, LOAD_SUC"),this._failCnt=0,this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_SUC),this.setFlvPcdnState(aK.LOAD_SUC),this._beforeSwap(2);break;case aQ.LoadEvents.DATA:this._flvPlayer.onData(t.data,2);break;case aQ.LoadEvents.SWAP_SUC:this._pcdn302Loader.flvStream.setOutputDts(this._flvLoader.flvStream.getOutputDts()),this._flvLoader.close();break;case aQ.LoadEvents.DIS_ERROR:this._disError302();break;case aQ.LoadEvents.FLV_TAG:this._flvPlayer.onFlvTag(t.tag);break;case aQ.LoadEvents.INVALID_TAG:this._flvPlayer.onInvalidTag(t.tag,2);break;case aQ.LoadEvents.CONNECT_TIMEOUT:I.log("LoaderCtrl._onPcdn302EventHandler, CONNECT_TIMEOUT"),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.CONNECT_TIMEOUT),this.setFlvPcdnState(aK.CONNECT_TIMEOUT),this._swapToCdn(t.type);break;case aQ.LoadEvents.DATA_TIMEOUT:var e=this._flvPlayer.getBufferLen();I.log("LoaderCtrl._onPcdn302EventHandler, DATA_TIMEOUT, bufLen=".concat(e)),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_DATA_TIMEOUT),this._pcdn302Loader.onDataTimeout(),this.setFlvPcdnState(aK.LOAD_DATA_TIMEOUT),this._swapToCdn(t.type);break;case aW.LoadEvents.LOAD_FAIL:I.log("LoaderCtrl._onPcdn302EventHandler, LOAD_FAIL"),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.LOAD_FAIL),this.setFlvPcdnState(aK.LOAD_FAIL),this._swapToCdn(t.type);break;case aQ.LoadEvents.KICK_ERROR:I.log("LoaderCtrl._onPcdn302EventHandler, KICK_ERROR"),this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.KICK_ERROR),this.setFlvPcdnState(aK.KICK_ERROR),this._swapToCdn(t.type)}}},{key:"_reportPcdnLibAct",value:function(t,e){this._flvPlayer.tsdb.sendMetrics([this._flvPlayer.stat.createAct(R.ACT.LOAD_PCDNLIB_ERROR,{value:t,str:e})])}},{key:"_onAnticodeRefresh",value:function(){I.log("LoaderCtrl._onAnticodeRefresh"),this._flvPlayer.initInfo(this._flvPlayer.info,!0),1===this._flvPlayer.info.usePcdn&&this._pcdnLoader.refreshUrl(this._flvPlayer.info.url)}},{key:"_checkSample",value:function(t){var e=this._flvPlayer.mse.parser;return e.lastParseDts>0&&t.ts<=e.lastParseDts||(e.setDroppingSample(null),!1)}},{key:"_swapToPcdn",value:function(){this._pullNum=1,this._flvPlayer.anticode.on(sb.Events.REFRESH,this._onAnticodeRefresh,this),this._flvPlayer&&this._flvPlayer.info&&1===this._flvPlayer.info.usePcdn&&this._doPcdnEventHandler(aW.Loa
1dEvents,!0);var t=this._flvPlayer.getBufferLen(),e=this._flvPlayer.mse,i=e.parser||{},s=0,r=0,a=0;0===F.pcdnFlvSyncMob?(s=e.curVideoDts,r=e.curAudioDts,a=i.lastParseDts):(s=this._flvLoader.flvStream.lastVideoDts,r=this._flvLoader.flvStream.lastAudioDts,a=s),I.log("LoaderCtrl.swapToPcdn vDts=".concat(s," aDts=").concat(r," startDts=").concat(a,", bufLen=").concat(t)),this._flvPlayer&&this._flvPlayer.info&&this._flvPlayer.info.use302Pcdn?(s===a?this._startDtsType=0:r===a&&(this._startDtsType=1),this._pcdn302Loader.usePcdn=!0,this.startDts=a,this._pcdn302Loader.startLoad({startDts:a}),this._loader=this._pcdn302Loader,this._flvPlayer.stat.setComDim(R.DIM_COM.IS_MOSAIC,1)):(this._pcdnLoader.startLoad(this._getUrl(!0),{startDts:a}),this._loader=this._pcdnLoader),this._flvPlayer.stat.addCore(R.CORE.GET_STREAM_CNT,1),this._flvPlayer.swapToPcdn()}},{key:"_swapToCdn",value:function(t){this._pullNum=1;var e=this._loader!==this._flvLoader,i=this._flvPlayer.getBufferLen();if(I.log("LoaderCtrl.swapToCdn reason=".concat(t," swap=").concat(e,", bufLen=").concat(i)),e){if(this._flvPlayer.tsdb.sendMetrics([this._flvPlayer.stat.createAct(R.ACT.PCDN_TO_CDN,{str:[t]})]),this._failCnt++,this._flvPlayer&&this._flvPlayer.info&&this._flvPlayer.info.use302Pcdn){if(1==D._testPaid)return;this._swapTs=g.now()+1e4*Math.min(F.pcdn302FlvCfg[0]||6,this._failCnt)}else this._swapTs=g.now()+1e4*Math.min(6,this._failCnt);this._flvPlayer.stat.addCore(R.CORE.SWITCH_CDN_CNT,1),this._beforeSwap(1),this._flvPlayer.initInfo(this._flvPlayer.info,!1),this._connect(this._flvPlayer.info.url,t),1===F.pcdnFlvSyncMob&&this._flvLoader.flvStream.setOutputDts(this.getCdnOutputDts()),this._flvPlayer&&this._flvPlayer.info&&1==this._flvPlayer.info.use302Pcdn&&(this._gatherSuc=!1),this._pcdn302Loader.usePcdn=!1,this._flvPlayer.swapToCdn()}}},{key:"getCdnOutputDts",value:function(){var t=this._pcdn302Loader.flvStream.getOutputDts(),e=this._flvLoader.flvStream.getOutputDts();return{videoDts:Math.max(t.videoDts,e.videoDts),audioDts:Math.max(t.audioDts,e.audioDts)}}},{key:"_getUrl",value:function(t){return this._flvPlayer.initInfo(this._flvPlayer.info,t),this._getUrlParams(this._flvPlayer.info.url,t)}},{key:"_getSdkPcdnReason",value:function(t){if(this._flvPlayer.info.use302Pcdn){if(t===aQ.LoadEvents.CONNECT_TIMEOUT)return 2;if(t===aQ.LoadEvents.DATA_TIMEOUT)return 3;if(t===aQ.LoadEvents.LOAD_FAIL)return 4;if(t===aQ.LoadEvents.KICK_ERROR)return 10}else{if(t===aW.LoadEvents.CONNECT_TIMEOUT)return 2;if(t===aW.LoadEvents.DATA_TIMEOUT)return 3;if(t===aW.LoadEvents.LOAD_FAIL||t===aW.LoadEvents.LOAD_STOP||t===aW.LoadEvents.LOAD_FINISH||t===aW.LoadEvents.SDK_DESTROYED)return 4;if(t===aW.BaseEvents.GATHER_FAIL)return 5}return 1}},{key:"_getUrlParams",value:function(t,e,i){var s="";s+=e?"pulltype=pcdn&":"sdkPcdn=".concat(this._cdnCnt,"_").concat(this._getSdkPcdnReason(i),"&");var r=F.platform,a=L.PLATFORM_TYPE[r]||L.PLATFORM_TYPE.web,n=r===L.PLATFORM_TYPE_NAME.wap?"uid=".concat(w.uid,"&uuid=").concat(w.uuid):"u=".concat(w.convertUid);return s+="".concat(n,"&t=").concat(a),s=O.urlInfoParams(s,this._flvPlayer.info),-1===t.indexOf("?")?t+="?":t+="&",t+s}},{key:"getPcdn302Params",value:function(t){var e="",i=F.platform,s=L.PLATFORM_TYPE[i]||L.PLATFORM_TYPE.web,r=i===L.PLATFORM_TYPE_NAME.wap?"uid=".concat(w.uid,"&uuid=").concat(w.uuid):"u=".concat(w.convertUid);return e+="".concat(r,"&t=").concat(s),e=O.urlInfoParams(e,this._flvPlayer.info),-1===t.indexOf("?")?t+="?":t+="&",t+e}},{key:"_beforeSwap",value:function(t){if(0===F.pcdnFlvSyncMob){var e=this._flvPlayer.mse.parser;e.parseFlvHead=!1,e.flvCacher.reset(),this._flvPlayer.info.use302Pcdn&&e.beforeSwap&&e.beforeSwap(t,this._startDtsType,this.startDts),e.printFirstVideoTs=!1,e.printFirstAudioTs=!1,e.pfvTs=!1,e.pfaTs=!1,e.setDroppingSample(this._checkSampleBind)}}},{key:"setFlvPcdnState",value:function(t){I.log("LoaderCtrl.setFlvPcdnState, type=".concat(t)),this._flvPlayer.flvPcdnState=t}},{key:"getPcdn302Stats",value:function(){return this._pcdn302Loader.getPcdn302Stats()}},{key:"_disError302",value:function(){1!=D._testPaid&&this._flvPlayer.info.use302Pcdn&&(this._flvPlayer.stat.setComDim(R.DIM_COM.FLV_PCDN_STATE,aK.DTS_ER
1ROR),this.setFlvPcdnState(aK.DTS_ERROR),this._swapToCdn(aK.DTS_ERROR),this._pcdn302Loader.dtsError302(),I.log("LoaderCtrl._disError302"))}}]),t}();function a$(){a$=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,s=Object.defineProperty||function(t,e,i){t[e]=i.value},r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",n=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,i){return t[e]=i}}function l(t,e,i,r){var a,n,o,u,l=Object.create((e&&e.prototype instanceof f?e:f).prototype);return s(l,"_invoke",{value:(a=t,n=i,o=new E(r||[]),u="suspendedStart",function(t,e){if("executing"===u)throw Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return{value:void 0,done:!0}}for(o.method=t,o.arg=e;;){var i=o.delegate;if(i){var s=function t(e,i){var s=i.method,r=e.iterator[s];if(void 0===r)return i.delegate=null,"throw"===s&&e.iterator.return&&(i.method="return",i.arg=void 0,t(e,i),"throw"===i.method)||"return"!==s&&(i.method="throw",i.arg=TypeError("The iterator does not provide a '"+s+"' method")),c;var a=d(r,e.iterator,i.arg);if("throw"===a.type)return i.method="throw",i.arg=a.arg,i.delegate=null,c;var n=a.arg;return n?n.done?(i[e.resultName]=n.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,c):n:(i.method="throw",i.arg=TypeError("iterator result is not an object"),i.delegate=null,c)}(i,o);if(s){if(s===c)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===u)throw u="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);u="executing";var r=d(a,n,o);if("normal"===r.type){if(u=o.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(u="completed",o.method="throw",o.arg=r.arg)}})}),l}function d(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function f(){}function p(){}function m(){}var _={};u(_,a,function(){return this});var y=Object.getPrototypeOf,v=y&&y(y(I([])));v&&v!==e&&i.call(v,a)&&(_=v);var S=m.prototype=f.prototype=Object.create(_);function g(t){["next","throw","return"].forEach(function(e){u(t,e,function(t){return this._invoke(e,t)})})}function T(t,e){var r;s(this,"_invoke",{value:function(s,a){function n(){return new e(function(r,n){!function s(r,a,n,o){var u=d(t[r],t,a);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==typeof c&&i.call(c,"__await")?e.resolve(c.__await).then(function(t){s("next",t,n,o)},function(t){s("throw",t,n,o)}):e.resolve(c).then(function(t){l.value=t,n(l)},function(t){return s("throw",t,n,o)})}o(u.arg)}(s,a,r,n)})}return r=r?r.then(n,n):n()}})}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var s=-1,r=function e(){for(;++s<t.length;)if(i.call(t,s))return e.value=t[s],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=m,s(S,"constructor",{value:m,configurable:!0}),s(m,"constructor",{value:p,configurable:!0}),p.displayName=u(m,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,o,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},g(T.prototype),u(T.prototype,n,function(){return this}),t.AsyncIterator=T,t.async=function(e,i,s,r,a){void 0===a&&(a=Promise);var n=new T(l(e,i,s,r),a);return t.isGeneratorFunction(i)?n:n.next().then(function(t){return t.done?t.value:n.next()})},g(S),u(S,o,"Generator"),u(S,a,function(){return this}),u(S,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),i=[];for(var s in e)i.push(s);return i.reverse(),function t(){for(;i.length;){var s=i.pop();if(s in e)return t.value=s,t.done=!1,t}return t.done=!0,t}},t.values=I,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEac
1h(C),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function s(i,s){return n.type="throw",n.arg=t,e.next=i,s&&(e.method="next",e.arg=void 0),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],n=a.completion;if("root"===a.tryLoc)return s("end");if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return s(a.catchLoc,!0);if(this.prev<a.finallyLoc)return s(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return s(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return s(a.finallyLoc)}}}},abrupt:function(t,e){for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var n=a?a.completion:{};return n.type=t,n.arg=e,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(n)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),C(i),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var s=i.completion;if("throw"===s.type){var r=s.arg;C(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:I(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),c}},t}var aZ=function(t){Object(u.a)(c,t);var e,i=Object(l.a)(c);function c(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;Object(s.a)(this,c),r=i.call(this,t,e),I.log("FlvPlayer(".concat(r._id,").constructor"));var o=e.isPureAudio,u=e.isPureVideo;return r.startTs=0,r.startTime=0,r.lineType=0,r.loader=new aX(Object(a.a)(r),!0),r.recvTime=0,r.firstPkgTime=0,r.connectTime=0,r.loadFlvStatus=0,r.isPureAudio=o,r.isPureVideo=u,r.videoElement=n,r.flvLoadTimeSended=!1,r.enableLowLatency=!1,r._flvUnavailibleTimeout=0,r.anticode=e.anticode,r.mse=e.mse,r.pauseStartTs=0,r.metadataTick=new av(t,r.mse),r.pauseReason=0,r.loadTime=0,r.connectTime=0,r.recvDataTime=0,r.loadStartTs=0,r.cdnip="",r.cdnsip="",r.sendPauseTimeout=0,r.videoStatus=x,void 0!==ay&&(r.qaStat=new ay(Object(a.a)(r))),r.playedStat=null,r.flowSize=0,r.flvDataSize=0,r.backToP2P=new a_(Object(a.a)(r)),r.volumeCount=0,r.sendMetricTimer=0,r.sendMetricTimes=0,r.businessStartCost=0,r.startTimeStamp=0,r.noNeedSendVideoLoadTime=!1,r.exceptionStat=e.exceptionStat,r.startUrlBind=r.startUrl.bind(Object(a.a)(r)),r.playerType=tQ.FLV,r.flvPcdnState=aK.CLOSED,r.isH265=!1,r.isAv1=!1,r.isUsePcnd302=!1,r.httpErrorCode=0,r.isUsingPcdn=!1,r}return Object(r.a)(c,[{key:"destroy",value:function(){Object(n.a)(Object(o.a)(c.prototype),"destroy",this).call(this),tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this),this.loader&&this.loader.destroy(),this.loader=null}},{key:"getFrameData",value:function(){return{pts:this.mse.getCurrentRealTime()}}},{key:"reset",value:function(){this.started&&(I.log("FlvPlayer(".concat(this._id,").reset")),this.loader.close(),this.pauseStartTs=0,this.qaStat.isFirstReport=!0,this.metadataTick.reset(),this.metadataTick.mse=this.mse,this.startTs=0,this.recvTime=0,this.startTime=0,this.enableLowLatency=!1,this.pauseCheckLock=!1,this.loadTime=0,this.connectTime=0,this.recvDataTime=0,this.flowSize=0,this.flvDataSize=0,this.recvDataEnough=!1,this.recvFlvData=!1,this.cdnip="",this.cdnsip="",this.backToP2P.reset(),this.stopPlayer(),this.audiouitil&&(this.audiouitil.reset(),this.audiouitil=null),this.videoStatus=x,this.flvPcdnState=aK.CLOSED,this.isUsingPcdn=!1)}},{key:"connected",get:function(){return this.loader.connected}},{key:"hasPicture",get:function(){var t=this.p2pFlvPlayer.isPlaying;return this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS?t=t&&this.p2pFlvPlayer.webcodecsPlaying:this.h265Proxy.rendering&&(t=t&&this.p2pFlvPlayer.isWasmH265Playing),t}},{key:"getCostTimes",value:function(){return[this.connectTime>0?this.connectTime-this.startTs:0,this.recvDataTime>0?this.recvDataTime-this.connectTime:0,this.mse.pushVideoStartRenderTime>0?this.mse.pushVideoStartRenderTime-this.startTs:0]}},{key:"getRecvInfo",value:function(){return[this.connectTime>0?this.connectTime-this.startTs:0,this.recvDataTime>0?this.recvDataTime-this.connectTime:0,this.mse.pushVideoStartRenderTime>0?this.mse.pushVideoStartRenderTime-this.startTs:0,this.mse.getVideoFrames(),this.mse.getAudioFrames(),this.flowSize]}},{key:"checkPcdnMode",value:function(t,e){this.info.use302Pcdn=this._get302UsePcdn(t),Object(n.a)(Object(o.a)(c.prototype),"checkPcdnMode",this).call(this,t,e),this.loader.checkPcdnMode(e)}},{key:"_getUsePcdn",value:function(t){return+(1===Number(t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvOutsideSdkFullstream]))}},{key:"_get302UsePcdn",value:function(t){var e=+(1===Number(t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvHttpFullstream]));return this.isUsePcnd302=e,e}},{key:"_getPcdnName",value:function(t){var e="";return t&&(e=this.isUsePcnd302?t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvHttpFullstream]:t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvOutsideSdkFullstream]),e}},{key:"_getPcdn302Name",value:function(t){var e="";return t&&(e=t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_FlvHttpFullstream]),e}},{key:"start",value:function(t){I.log("FlvPlayer(".concat(this._id,").start"),JSON.stringify(t)),this.firstPkgTime=0,Object(n.a)(Object(o.a)(c.prototype),"start",this).call(this,t),this.reset(),this.started=!0,this.isUsingPcdn=!1,this.checkParams(t,this.startUrlBind)}},{key:"checkParams",value:(e=Object(am.a)(a$().mark(function t(e,i){return a$().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.info=e,!e.sFlvUrl||!e.sStreamName){t.next=13;break}if(e.sFlvUrl=e.sFlvUrl.replace("http://","https://"),!e.sFlvAntiCode){t.next=10;break}return this.anticode.init(e.sFlvUrl,e.sStreamName,e.sFlvAntiCode,e.nimoTid),t.next=7,this.anticode.valid();case 7:i&&i(e),t.next=11;break;case 10:i&&i(e);case 11:t.next=14;break;case 13:e.url?i&&i(e):I.warn("FlvPlayer(".concat(this._id,").start has no params(sFlvUrl,sStreamName,url)"));case 14:case"end":return t.stop()}},t,this)})),function(t,i){return e.apply(this,arguments)})},{key:"startUrl",value:function(t){if(this.isUsePcnd302=!1,this.initDomain(t),this.started){this.initInfo(t);var e=g.now();if(this.businessStartCost=0,this.UIStartCost=0,this.loadStartTs=0,this.startTimeStamp=Number(t.startTimeStamp)||0,t.noNeedSendVideoLoadTime?this.noNeedSendVideoLoadTime=!0:(this.businessStartCost=Math.floor(t.startTimeStamp>1?(new Date).getTime()-t.startTimeStamp:0),this.noNeedSendVideoLoadTime=!1),t.uistartTs&&t.uistartTs>0&&(this.UIStartCost=Math.floor((new Date).getTime()-t.uistartTs)),this.startTs=e,I.log("FlvPlayer(".concat(this._id,").startNow"),Date.now(),e),this.startTime=e,this.backToP2P.initJumpTs(e),this.loadFlvStatus=0,this.mse.setPushGop(F.pushGop),rV.isNeedAud()?this.mse.setDeleteH264Aud(+(-1!==F.deleteH264Aud.indexOf(t.presenterUid))):this.mse.setDeleteH264Aud(0),t.latencyLevel){var i=F.latency[t.latencyLevel];i||(i=[3e3,2e3,4e3,2e3]),this.mse.latencySeek=i[3],this.mse.setJitter(i[0],i[1],i[2])}else this.enableLowLatency?F.setLowLatency(this.mse):F.setJitterCfg(this.mse,t.presenterUid,t.curBitrate,"flv");var s=this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec;this.isH265=s;var r=this.isUseAV1(t);this.isAv1=r,this.stat.setComDim(R.DIM_COM.ORIGINAL_BITRATE,+(0===t.originalBitrate)),this.stat.setComDim(R.DIM_COM.H265,r?9:+!!s),this.stat.setComDim(R.DIM_COM.V_DECODEC,r?2:+!!s),this.stat.setComDim(R.DIM_COM.P2P,R.LIVE_TYPE.FLV),this.stat.setComDim(R.DIM_COM.STREAM_TYPE,1),this.eventEmitter&&this.eventEmitter.roomRecordStat&&this.eventEmitter.roomRecordStat.startStream(t.presenterUid,t.lineType,t.curBitrate,s?"h265":"h264","flv"),s&&this._hyPlayer.tsdbUtil.sendMetrics([this.stat.createAct(R.ACT.H265_STATUS,{value:[0],str:[0]})]),this.statSwitch.check(t,!1),delete t.pullStreamFrom,this.startFastSample(),this._startContinueBuffer(),this.httpErrorCode=0,this.loader.connect(t.url,null==this.videoElement),sB.setCdnDomain(this.stat,this.info.url,this.info.sStreamName),this.startPlayer()}}},{key:"startPlayer",value:function(){this.started=!0,tP.add(this.onCheckTimer,this,1e3),tP.add(this.onCheckFastTimer,this,100),null!=this.videoElement&&this.startMetricTimer(2e4),Object(n.a)(Object(o.a)(c.prototype),"startPlayer",this).call(this)}},{key:"stopPlayer",value:function(){tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this),this.stopMetricTimer(),this.started=!1}},{key:"_switchStart",value:function(t,e){this.initInfo(this.info),-1!==this.info.url.indexOf("?")?this.info.url+="&startPts=".concat(e):this.info.url+="?startPts=".concat(e),this.mse.parser.reset(),this.loader.close(),1==D._testBack?D._testBack=0:(this.startTs=g.now(),this.loader.connect(this.info.url)),this.updateFlvConfig()}},{key:"initInfo",value:function(t,e){this.info=t,t.sFlvUrl&&t.sStreamName&&(t.url="".concat(t.sFlvUrl,"/").concat(t.sStreamName,".flv"));var i=[];this.anticode.hasAnticode()&&(i.push(this.anticode.getAnticode(e)),I.log("FlvPlayer.initInfo, anticode=".concat(this.anticode.getAnticode(e)))),-1!==F.useChangeRate.indexOf(Number(t.presenterUid))?i.push("ratio=".concat(F.getChangeBitrate(t.presenterUid,t.curBitrate))):t.iBitRate>0?i.push("ratio=".concat(t.iBitRate)):D._ratio&&i.push("&ratio=".concat(D._ratio)),t.httpDomainOnly||-1===t.url.indexOf("va.huya.com")&&-1===t.url.indexOf("cdnweb.huya.com")&&-1===t.url.indexOf("va-cmcc.huya.com")||i.push("&https=1"),i.length>0&&(t.url+=(-1!==t.url.indexOf("?")?"&":"?")+"".concat(i.join("&"))),this.isUseAV1(t)?t.url+="&codec=av1":(this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec)&&this.h265Proxy.checkUrl(t),t.url+="&dMod=".concat(O.getDMod(t._dMod,t._sMod)),this.url=t.url,this.lineType=t.lineType}}
1,{key:"recSysRspHandler",value:function(t,e,i){i&&i.isBackToP2P?this.backToP2P.recSysRspHandler(t,e,i):!t||e&&e.tRecSysInfo&&1==e.tRecSysInfo.lAction?(I.warn("FlvPlayer(".concat(this._id,").recSysRspHandler FLV_TRY_TO_P2P")),this.eventEmitter.trigger(N.FLV_TRY_TO_P2P)):(I.warn("FlvPlayer(".concat(this._id,").recSysRspHandler jumpToP2PCd=").concat(this.jumpToP2PCd/6e4,"min fail")),this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN,{code:1,msg:"jumpToP2PCd fail"}))}},{key:"setVideoPlayTimeSended",value:function(){this.flvLoadTimeSended=!0}},{key:"getPlayVideo",value:function(){return this.mse.getPlayVideo()}},{key:"setJitter",value:function(t,e,i){this.mse&&this.mse.setJitter(t,e,i)}},{key:"stop",value:function(){this.started&&(I.log("FlvPlayer(".concat(this._id,").stopFlv")),this._reportFlvFlow(),this.reset(),this.started=!1),this.audiouitil&&(this.audiouitil.reset(),this.audiouitil=null),this.recvDataEnough=!1,this.recvFlvData=!1,Object(n.a)(Object(o.a)(c.prototype),"stop",this).call(this),this.loader.close(),clearTimeout(this._flvUnavailibleTimeout)}},{key:"recvDataFull",value:function(){this.recvDataTime=g.now(),this.eventEmitter.trigger(N.RECV_VIDEO_FRAME),I.log("FlvPlayer(".concat(this._id,").recvDataFull"))}},{key:"initDomain",value:function(t){if(!t.inited){t.inited=!0;var e=t.domainList;if(e&&e.length){var i=t.sFlvUrl.match(/\/\/(.+?)\//i);t._domain=i?i[1]:"",I.log("FlvPlayer(".concat(this._id,").initDomain:\n ")+e.join("\n "));var s=e.shift();this.cdnip=s,this.stat.setComDim(R.DIM_COM.CDNIP,s),t.sFlvUrl=t.sFlvUrl.replace(/\/\/(.+?)\//,"//"+s+"/"+t._domain+"/")}}}},{key:"retryVideo",value:function(){this.eventEmitter.trigger(N.REPLAY_VIDEO)}},{key:"setEnableLowLatency",value:function(t){this.enableLowLatency=t,t&&F.setLowLatency(this.mse)}},{key:"updateFlvConfig",value:function(){this.enableLowLatency?F.setLowLatency(this.mse):F.setJitterCfg(this.mse,this.info.presenterUid,this.info.curBitrate,"flv"),this.mse&&(this.mse.setNeedEmptyAudioFrame(F.flvEmptyAudioFrame>0),I.log("FlvPlayer(".concat(this._id,").updateFlvConfig flvEmptyAudioFrame=")+this.getConfig("flvEmptyAudioFrame")))}},{key:"requestUrl",value:function(){var t=this.info,e=t.domainList;if(e&&t._domain){var i=RegExp("//(.*?)"+t._domain+"/"),s=e.shift();return s?(this.cdnip=s,this.stat.setExtDim(R.DIM_EXT.CDN_IP,s),I.warn("FlvPlayer(".concat(this._id,").requestUrl change domain to ").concat(s)),t.sFlvUrl=t.sFlvUrl.replace(i,"//"+s+"/"+t._domain+"/")):(this.cdnip="",this.stat.delDim(R.DIM_EXT.CDN_IP),I.warn("FlvPlayer(".concat(this._id,").requestUrl change domain to ").concat(t._domain)),t.sFlvUrl=t.sFlvUrl.replace(i,"//"+t._domain+"/"),delete t.domainList),this._reportFlvFlow(),void this.startUrl(t)}this._hyPlayer.isPaidRoom&&this._hyPlayer.payCount403>=F.payRoomCfg[1]||(I.log("FlvPlayer.requestUrl"),this.triggerUnAvailible())}},{key:"setConfig",value:function(t,e){F.setConfig(t,e)}},{key:"getConfig",value:function(t){return F[t]}},{key:"getBufferLen",value:function(){return this.mse&&this.mse.getBufferLen?this.mse.getBufferLen():0}},{key:"getSegmentsBufferLen",value:function(){return this.mse&&this.mse.getSegmentsBufferLen?this.mse.getSegmentsBufferLen():0}},{key:"getFrameBufferLen",value:function(){return this.mse&&this.mse.getFrameBufferLen?this.mse.getFrameBufferLen():0}},{key:"getCurrentTime",value:function(){return this.mse.getCurrentRealTime()}},{key:"getCurrentDts",value:function(){return this.mse.getCurrentDts()}},{key:"getCurrentSeiOffsetDts",value:function(){return this.mse.getCurrentSeiOffsetDts()}},{key:"getDurationTime",value:function(){var t=(this.mse.video||{}).video,e=0;return t&&(e=Math.floor(t.duration||0)),e}},{key:"getVolumeEnergy",value:function(){var t=+(this.volumeCount>5);return this.volumeCount=0,t}},{key:"getAnticodeHandler",value:function(){return this.anticode}},{key:"play",value:function(){this.mse.play()}},{key:"pause",value:function(){this.loader.close(),this.mse&&this.mse.pause(),tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this),this.stopMetricTimer()}},{key:"setPlaybackrateAccess",value:function(t){this.mse&&this.mse.setPlaybackrateAccess(t)}},{key:"setAutoJitter",value:function(t){this.mse.autoJitter=t}}
1,{key:"setLoadFlvStatus",value:function(t){t>this.loadFlvStatus&&(this.loadFlvStatus=t)}},{key:"sendLoadVideoErrorStatus",value:function(){this._hyPlayer.tsdbUtil.sendMetrics([this.stat.createAct(J.METRIC.VIDEO_VIDEO_LOAD_ERROR,{value:[this.loadFlvStatus]})])}},{key:"getCdnSip",value:function(){return this.cdnsip}},{key:"turnToH264",value:function(t){this.stop(),this.eventEmitter.trigger(N.TURN_TO_H264,{reason:t})}},{key:"turntoH265Wasm",value:function(){this.stop(),this.eventEmitter.trigger(N.TURN_TO_H265_WASM)}},{key:"h265Retry",value:function(){this.stop(),this.eventEmitter.trigger(N.H265_VIDEO_RETRY)}},{key:"turnToMse",value:function(){this.stop()}},{key:"onConnected",value:function(){Object(n.a)(Object(o.a)(c.prototype),"onConnected",this).call(this),this.connectTime=g.now(),I.log("%c[TIME] FlvPlayer(".concat(this._id,").onConnected connectTime=")+(this.connectTime-this.startTs),"color:#A23400;background:#FFF5C2"),this.setLoadFlvStatus(L.LoadVideoTimeoutReason.FLV_CONNECTED),this.exceptionStat.setStat(R.DIM_LINK_STA.CONNECT_SUC,1)}},{key:"onClosed",value:function(){this.tsdb.sendMetrics([this.stat.createAct(R.ACT.HTTP_CLOSE,{})]),this.eventEmitter.trigger(N.VIDEO_LINK_CLOSE,{video:this.mse.getPlayVideo()})}},{key:"onError",value:function(){this.eventEmitter.trigger(N.ANCHOR_STOP,{video:this.mse.getPlayVideo()})}},{key:"onData",value:function(t,e){0==this.firstPkgTime&&(this.firstPkgTime=g.now()),this.exceptionStat.setStat(R.DIM_LINK_STA.HAS_DATA,1);var i=new Uint8Array(t);this.flowSize+=i.byteLength,this.addBytes(i.byteLength),this.recvDataEnough||(this.flvDataSize+=i.byteLength,this.flvDataSize>1e6&&(this.setLoadFlvStatus(L.LoadVideoTimeoutReason.FLV_DATA_INVALID),this.recvDataEnough=!0)),1===e?(this.stat.addCore(R.CORE.CDN_TOTAL_BW,i.byteLength),this.statCPDetalBw(i.byteLength)):this.stat.addCore(R.CORE.PCDN_TOTAL_BW,i.byteLength),0===F.pcdnFlvSyncMob&&this.mse.appendFlv(i);var s=g.now();0==this.recvTime&&(I.log("%c[TIME] FlvPlayer(".concat(this._id,").onData firstPkgTime=")+(s-this.connectTime),"color:#A23400;background:#FFF5C2"),this.setLoadFlvStatus(L.LoadVideoTimeoutReason.FLV_RECV_DATA)),this.recvTime=s}},{key:"onFlvTag",value:function(t){this.mse.appendFlvTag(t.data)}},{key:"onInvalidTag",value:function(t,e){1===e?this.stat.addCore(R.CORE.CDN_REPEAT_BW,t.data.length):this.stat.addCore(R.PCDN_DATA.PCDN_REPEAT_BW,t.data.length)}},{key:"getMse",value:function(){return this.mse}},{key:"onPlayVideo",value:function(t,e,i,s,r,a,u,l,d){Object(n.a)(Object(o.a)(c.prototype),"onPlayVideo",this).call(this,t,e,i,s,r,a,u),q.delFail(this.stat),this.updateStatus(U),this.stat.setComDim(R.DIM_COM.DPI,e+"*"+i);var f=g.now();I.log("FlvPlayer(".concat(this._id,").onStartVideo loadeddata=").concat(f)),this.loadTime=f-this.startTs,this.newLoadTime=f-this._hyPlayer.startTs,this.waitRemuxTime=0,this.mse&&this.mse.parser&&0!=this.mse.parser.waitRemuxTime&&(this.waitRemuxTime=this.mse.parser.waitRemuxTime);var p=this.connectTime-this.startTs,m=this.recvDataTime-this.startTs,_=this.mse.pushVideoStartRenderTime-this.startTs,y=this.UIStartCost>0?this.loadTime+this.UIStartCost:0,v=0;this.startTimeStamp>1?v=this.loadTime+this.businessStartCost:1===this.startTimeStamp&&(v=this.loadTime);var S=this.firstPkgTime-this.startTs,T=0;0!=this.mse.parser.decodeIFRTime&&(T=this.mse.parser.decodeIFRTime-this.startTs),I.log("%cFlvPlayer(".concat(this._id,").onPlayVideo loadTime=")+this.loadTime+" businessStartCost="+this.businessStartCost+" UIStartCost="+this.UIStartCost,"color:#A23400;background:#FFF5C2"),I.log("%cFlvPlayer(".concat(this._id,").onPlayVideo newLoadTime=")+this.newLoadTime,"color:#A23400;background:#FFF5C2"),this.tsdb.sendFlvTime(this.newLoadTime,p,m,_,null!=this.videoElement,v,y,this.waitRemuxTime,S,T,this.mse.videoFirstFrameDecodeCost,this.mse.audioFirstFrameDecodeCost,this.mse.triggerPlayType);var P={video:t,width:e,height:i,loadTime:this.loadTime,connectTime:p,recvDataTime:m,pushVideoTime:_,canvas:r,videoCodec:u,delayRemove:this.info._delayRemove,canvas1:l,canvas2:d};this.info._delayRemove=!1,this.setLoadFlvStatus(L.LoadVideoTimeoutReason.FLV_STARTPLAY),this.eventEmitter.trigger(N.VIDEO_PLAY,P),this._hyPlayer.onPlayVideo&&this._hyPlayer._type==tQ.VR&&this._hyPlayer.onPlayVideo(t),this.loader.onPlayVideo()}},{key:"onAudioFrequency",value:function(t){t.value&&this.volumeCount++}},{key:"onVideoStop",value:function(t,e){I.log("FlvPlayer(".concat(this._id,").onVideoStop hasVideo=")+e),e&&this.updateStatus(x),this.eventEmitter.trigger(N.VIDEO_STOP,{video:t,hasVideo:e})}}
1,{key:"onSendSeiData",value:function(t,e,i){this.eventEmitter.trigger(N.H264_SEI_PLAY,{data:t,ts:e,now:(new Date).getTime(),vt:i})}},{key:"onSendScriptVolumeInfo",value:function(t,e){Number(D._printAudioIntensity)&&I.log("FlvPlayer(".concat(this._id,").onSendScriptVolumeInfo uid:")+t+" intensity:"+e),this.eventEmitter.trigger(N.UPDATE_INTERSITY,{uid:t,intensity:e})}},{key:"onLoadError",value:function(t,e){if(I.log("FlvPlayer.onLoadError"),this.httpErrorCode=e,403===Number(e)&&this.tsdb.sendMetrics([this.stat.createAct(R.ACT.HTTP_CODE_+e,{value:[this.type]})]),this.setLoadFlvStatus(L.LoadVideoTimeoutReason.FLV_CONNECT_ERROR),this._hyPlayer.isPaidRoom&&"403"==e&&null!=this._hyPlayer.payCount403&&(this._hyPlayer.payCount403++,I.log("FlvPlayer.onLoadError ".concat(this._hyPlayer.payCount403)),this._hyPlayer.payCount403>=F.payRoomCfg[1])){if(1==D._testPaid)return;return this.loader&&this.loader._flvLoader&&(this.loader._flvLoader.close(),this.loader._flvLoader.needRetry=!1),I.log("FlvLoader.stop ".concat(this._hyPlayer.payCount403),this.loader._flvLoader.needRetry),this._hyPlayer.stop(),!0}this.stop(),this._hyPlayer.netFlvErrorCnt+=1,this.triggerUnAvailible({msg:t}),this.triggerChangeLine()}},{key:"onLoadPcdnError",value:function(t,e){I.log("FlvPlayer.onLoadPcdnError"),this._hyPlayer.isPaidRoom&&"403"==e&&null!=this._hyPlayer.payCount403&&(this._hyPlayer.payCount403++,I.log("FlvPlayer.onLoadPcdnError ".concat(this._hyPlayer.payCount403)),this._hyPlayer.payCount403>=F.payRoomCfg[1]&&(I.log("FlvLoader.onLoadPcdnError ".concat(this._hyPlayer.payCount403)),this._hyPlayer.stop()))}},{key:"onVideoParseInvalid",value:function(){this.setLoadFlvStatus(L.LoadVideoTimeoutReason.FLV_DATA_INVALID)}},{key:"onLoadTimeout",value:function(){this.eventEmitter.trigger(N.FLV_URL_LOAD_TIMEOUT),this._hyPlayer.netFlvErrorCnt+=1,this.triggerChangeLine()}},{key:"onPlayerError",value:function(t){this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN)}},{key:"onErrorEvent",value:function(t){Object(n.a)(Object(o.a)(c.prototype),"onErrorEvent",this).call(this,t),t&&3===t.type&&this.loader.onPlayError();var e=[];e.push(this.stat.createAct(R.ACT.P2P_PLAY_FAIL,{value:[t.type,this.getBufferLen()]})),this.tsdb.sendMetrics(e),this._hyPlayer&&this._hyPlayer.lastP2PInfo&&this.getRecSysRsp({info:this.info,type:"flv",metadata:this.mse.metadata,isFlvError:!0})}},{key:"onPlayPause",value:function(t,e){this.startSendPauseTimer(),Object(n.a)(Object(o.a)(c.prototype),"onPlayPause",this).call(this,t,e)}},{key:"onPlayResume",value:function(t,e){this.stopSendPauseTimer(),Object(n.a)(Object(o.a)(c.prototype),"onPlayResume",this).call(this,t,e)}},{key:"_getBadReason",value:function(t){return this.mse.getIsDownEnough()?this.mse.lastJumpBufferTs>0&&t-this.mse.lastJumpBufferTs<5e3?L.BAD_REASONS.BUFFER_JUMP:this.getBufferLen()>2e3?L.BAD_REASONS.PERFORMANCE:L.BAD_REASONS.UNKNOW:L.BAD_REASONS.DOWN_LINK}},{key:"sendPauseEvent",value:function(){this.eventEmitter.trigger(N.PLAY_CARTON)}},{key:"startMetricTimer",value:function(t){clearTimeout(this.sendMetricTimer),this.sendMetricTimer=setTimeout(this.heartBeat20sMetric.bind(this),t)}},{key:"stopMetricTimer",value:function(){this.sendMetricTimes=0,clearTimeout(this.sendMetricTimer)}},{key:"setAudioUtil",value:function(t){this.audiouitil=t,this.audiouitil.removeAllListeners([rC.AUDIO_FREQUENCY]),this.mse&&this.mse.video&&this.mse.video.video&&(this.audiouitil.createAudioContext(this.mse.video.video),this.audiouitil.on(rC.AUDIO_FREQUENCY,this.onAudioFrequency.bind(this)))}},{key:"startSendPauseTimer",value:function(){this.stopSendPauseTimer(),this.sendPauseTimeout=setTimeout(this.sendPauseEvent.bind(this),200)}},{key:"stopSendPauseTimer",value:function(){clearTimeout(this.sendPauseTimeout)}},{key:"getAudioFrames",value:function(){return this.mse.getAudioFrames()}},{key:"heartBeat20sMetric",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:2e4,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=g.now();if(I.log("FlvPlayer(".concat(this._id,").heartBeat20sMetric ")),this.sendMetricTimes++,this._checkPaused(i,e?rF:rw),this._checkPausedWorker(i,e?rF:rw),this._checkMobPaused(i,e?rF:rw),this._checkAvcChangeReport(i,e?rF:rw),this.qaStat){0==this.pauseTime&&(this.pauseReason=0);var s=this.pauseStartTs>0;this.qaStat.record({isEnd:e,pauseCnt:this.pauseCnt,pauseTime:this.pauseTime,isPau
1sed:s,flowSize:this.flowSize,httpErrorCode:this.httpErrorCode,pauseReason:this.pauseReason,volumeEnergy:this.getVolumeEnergy(),isPausedWorker:this.pauseStartWorkerTs>0,pauseWorkerCnt:this.pauseWorkerCnt,pauseWorkerTime:this.pauseWorkerTime,isFramePaused:this.pauseMobCnt>0||this.pauseMobStartTs>0||this.isRenderFpsPause})}this.pauseStartTs>0&&this.autoMonitor.setPause(this.pauseStartTs,this.getBufferLen()),this.pauseCnt=0,this.pauseTime=0,this.pauseWorkerCnt=0,this.pauseWorkerTime=0,this.pauseReason=0,this.flowSize=0,this.isRenderFpsPause=!1,this.pauseMobCnt=0,this.sendMetricTimes%15==0&&(this.tsdb.sendMetrics([{sMetricName:J.METRIC.VIDEO_VIDEO_BAD_QUALITY_5M_RATIO,vField:{value:100*(this.pauseCnt5>0)}}]),this.pauseCnt5=0,this.pauseTime5=0),t>0&&this.startMetricTimer(t)}},{key:"onCheckTimer",value:function(t,e){if(Object(n.a)(Object(o.a)(c.prototype),"onCheckTimer",this).call(this,t,e),this.started){if(this.connected&&this.recvTime>0&&t-this.recvTime>8e3){var i=this.getBufferLen();return I.warn("FlvPlayer(".concat(this._id,").onCheckTimer no data received ")+(t-this.recvTime)+" buffLen="+i),void this.eventEmitter.trigger(N.NO_DATA_RECEIVED_IN)}if(this.anticode.onCheckTimer(t),this.loader.onCheckTimer(t,e),this.mse&&this.mse.onCheckTimer(t,e),this.metadataTick.onCheckTimer(t,e),this.connected){null==this.videoElement&&(0===this.heart20Ts?this.heart20Ts=t:t-this.heart20Ts>=2e4&&(this.heartBeat20sMetric(0,!1),this.heart20Ts=t,this.checkHiddenStop()));try{this.mse.video&&this.eventEmitter.trigger(N.PLAY_DOWNLINK_INFO,{buffer:this.getBufferLen()/1e3,downLinkSpeed:0|this.loader.speed,videoBufferEnd:this.mse.video.video.buffered.end(this.mse.video.video.buffered.length-1)})}catch(t){I.log("FlvPlayer(".concat(this._id,").onCheckTimer cannot get down link info"))}this.backToP2P.onCheckTimer(t,e),this.eventEmitter.trigger(N.PLAY_FRAME_BUFFER,{frameStorage:this.mse.getFrameReadyed(),jitterBuffer:this.mse.getBufferLen(),playdelay:this.mse.getFramePlayDelays()})}}}},{key:"onCheckFastTimer",value:function(t,e){this.started&&(this.mse.onCheckFastTimer(t,e),this.backToP2P.onCheckFastTimer(t,e),this.loader.onCheckFastTimer(t,e))}},{key:"_reportFlvFlow",value:function(){this.qaStat&&this.heartBeat20sMetric(0,!0)}},{key:"pauseCheck",value:function(t){if(this.started){var e=0,i=this.info.curBitrate/8-10,s=this.loader.speed/1024|0;e=s>0&&s<i?L.pauseReason.FLV_NET_SLOW:L.pauseReason.FLV_NO_BUFF,this.recvTime>0&&t-this.recvTime>2e3&&(e=L.pauseReason.FLV_NO_DATA);var r=this.getBufferLen();r>1e3&&(e=L.pauseReason.FLV_UNKNOW_PAUSE),e>this.pauseReason&&(this.pauseReason=e),I.warn("FlvPlayer(".concat(this._id,").pauseCheck curReason=").concat(e," reportReason=").concat(this.pauseReason," buffLen=").concat(r))}}},{key:"statCPDetalBw",value:function(t){var e=this.flvPcdnState;e==aK.CLOSED?this.stat.addCore(R.DIM_CORE.UNOPEND_CPFLV_BW,t):e==aK.TAF_REQ?this.stat.addCore(R.DIM_CORE.NORETURN_CPFLV_BW,t):e==aK.TAF_RSP||e==aK.PCDN_NAME?this.stat.addCore(R.DIM_CORE.UNSUPPORT_CPFLV_BW,t):e==aK.LIB_LOAD||e==aK.LIB_FAIL?this.stat.addCore(R.DIM_CORE.LOAD_LIB_CPFLV_BW,t):e==aK.GATHER_START?this.stat.addCore(R.DIM_CORE.GATHER_CPFLV_BW,t):e==aK.GATHER_FAIL?this.stat.addCore(R.DIM_CORE.GATHER_FAIL_CPFLV_BW,t):e==aK.GATHER_SUC||e==aK.LOAD_START||e==aK.LOAD_SUC?this.stat.addCore(R.DIM_CORE.LOAD_SUC_CPFLV_BW,t):e==aK.LOAD_TIMEOUT||e==aK.LOAD_DATA_TIMEOUT||e==aK.LOAD_STOP||e==aK.LOAD_FAIL||e==aK.LOAD_FINISH||e==aK.SDK_DESTROYED?this.stat.addCore(R.DIM_CORE.ERROR_CPFLV_BW,t):e==aK.KICK_ERROR?this.stat.addCore(R.DIM_CORE.KICK_CPFLV_BW,t):e==aK.WAIT_CDN_LOAD?this.stat.addCore(R.DIM_CORE.WAIT_CDN_LOAD_CPFLV_BW,t):e==aK.DTS_ERROR?this.stat.addCore(R.DIM_CORE.DTS_ERROR_CPFLV_BW,t):this.stat.addCore(R.DIM_CORE.OTHER_CPFLV_BW,t)}},{key:"getPcdn302Stats",value:function(){return this.loader.getPcdn302Stats()}},{key:"sendNoPicture",value:function(){this._sendVideoNoPicture(),this._sendVideoNoPictureAll()}},{key:"_sendVideoNoPicture",value:function(){}},{key:"_sendVideoNoPictureAll",value:function(){var t=this.connectTime-this.startTs,e=this.recvDataTime-this.startTs;if(this.videoLoadTimeSent=!0,!this.hasPicture){var i=0;this.isMse&&(i=this.mse.isMediaSourceOpen?1:2);var s=O.getBrowserHidden();this.isMse&&s&&2==i?I.log("FLvPlayer._sendVideoLoadTimeAll browserHidden=".concat(s,", isMediaSourceOpen=").concat(i)):this.tsdb.sendNoPictureTimeAll(99999,t,e,"flv","",this.exceptionStat.getStat())}}},{key:"triggerChangeLine",value:function(){this._hyPlayer&&(I.log("FlvPlayer.triggerChangeLine",this._hyPlayer.netFlvErrorCnt),this._hyPlayer.netFlvErrorCnt>3&&this.eventEmitter.trigger(N.FLV_CHANGE_LINE))}},{key:"swapToPcdn",value:function(){this.isUsingPcdn=!0}},{key:"swapToCdn",value:function(){this.isUsingPcdn=!1}},{key:"triggerUnAvailible",value:function(t){if(this._hyPlayer&&this._hyPlayer.flvUnAvailibleRetry&&this._hyPlayer.hasOwnProperty("flvUnavailableCnt")&&(this._hyPlayer.flvUnavailableCnt++,I.log("FlvPlayer.triggerUnAvailible, cnt=".concat(this._hyPlayer.flvUnavailableCnt)),1==F.isFlvUrlRetry&&this._hyPlayer.flvUnavailableCnt>2))this._hyPlayer.flvUnAvailibleRetry&&this._hyPlayer.flvUnAvailibleRetry();else{this.startTs>0&&g.now()-this.startTs<5e3&&this._sendVideoNoPictureAll(),I.log("FlvPlayer.triggerUnAvailible after 2s");var e=this._hyPlayer.netFlvErrorCnt||1;clearTimeout(this._flvUnavailibleTimeout),this._flvUnavailibleTimeout=setTimeout(this._triggerUnAvailible.bind(this),Math.min(1e3*e,1e4),t)}}},{key:"_triggerUnAvailible",value:function(t){I.log("FlvPlayer._triggerUnAvailible"),t?this.eventEmitter.trigger(N.FLV_URL_UNAVAILABLE_IN,t):this.eventEmitter.trigger(N.FLV_URL_UNAVAILABLE_IN)}}]),c}
1(rJ),a0=function(){function t(){Object(s.a)(this,t),this.osTime=0,this.syncLocalTime=0,this.rttList=[]}return Object(r.a)(t,[{key:"convertToSrvTime",value:function(t){if(0===this.osTime)return 0;var e=t-this.osTime;return this.syncLocalTime+e}},{key:"isFinishNtp",value:function(){return 0!==this.osTime}},{key:"ntpProcess",value:function(t,e){var i=g.now(),s=i-t,r=Math.round(e+s/2);if(0===this.osTime&&0===this.syncLocalTime)this.osTime=i,this.syncLocalTime=r,this.rttList.push(s);else if(this.rttList.length<10)this.osTime=i,this.syncLocalTime=r,this.rttList.push(s);else{for(var a=[],n=0;n<this.rttList.length;++n)a.push(this.rttList[n]);a.sort(function(t,e){return t-e});for(var o=0,u=0;u<4;++u)o+=a[u];var l=o>>2;(4*s>3*l&&4*s<5*l||s>6e4)&&(this.osTime=i,this.syncLocalTime=r),this.rttList.shift(),this.rttList.push(s),a=null}}}]),t}();function a1(t,e){for(var i=0;i<t.length;i++){var s=t[i];s.length<e&&(s+=" ".repeat(e-s.length),t[i]=s)}return t.join("\n")}var a2=function(){function t(){Object(s.a)(this,t),this.version=1019,this.BASE_SUBS=10,this.presenterUid=0,this.uid=0,this.uuid=0,this.convertUid=0,this.appId=66,this.appid=66;var e=Number(D.appid);e&&(this.appid=e,I.warn("--- test appid "+e+" ---",this)),this.sid=0,this.subSid=0,this.lineType=-1,this.bitrate=0,this.curBitrate=0,this.originalBitrate=0,this.userAbility=null,this.isStartFromUrl=!1,this.streamId=null,this.streamSeqSN=0,this.quickAccessBeginIndex=0,this.quickAccessEndIndex=0,this.exip=0,this.sslUrl="",this.myIp="",this.quickTime=0,this.urlTokenTime=0,this.urlToken="",this.wsTime="",this.videoNtp=new a0,this.stampcSvr=0,this.stampcNow=0,this.wanIp="",this.wanPort=0,this.cdnpConnected=0,this.proxyIp="",this.cdnpIp=0,this.stunPorts=[],this.enableFeatures=0,this.cdnpip=0,this.firstLogin=!0,this.loaderMgr=null,this.p2pMgr=null,this.globalSpeedCalc=new X(20),this.initTafTime=0,this.req
1VpTime=0,this.getVPTime=0,this.startTime=0,this.connectVideoTime=0,this.firstVideoPkgTime=0,this.firstIFrameTime1=0,this.firstIFrameTime2=0,this.firstRenderTime=0,this.recvDataTime=0,this.onPlayTime=0,this.loadedDataTs=0,this.hyPlayerLoadTs=0,this.firstP2POnDataTime=0,this.firstP2PIframeTime=0}return Object(r.a)(t,[{key:"initUid",value:function(t){this.uuid=t,this.convertUid=O.rotUid(this.uid,this.presenterUid),I.log("Global.initUid uid=".concat(this.uid," uuid=").concat(this.uuid," convertUid=").concat(this.convertUid))}},{key:"getServTime",value:function(t){if(0==this.stampcSvr)return 0;var e=t||g.now();return this.stampcSvr+(e-this.stampcNow)}},{key:"initUseTime",value:function(t){I.log("initUseTime",t),this.startTime=t,this.getLivingInfoTime=0,this.connectVideoTime=0,this.firstVideoPkgTime=0,this.firstAudioPkgTime=0,this.firstIFrameTime1=0,this.firstIFrameTime2=0,this.firstRenderTime=0,this.recvDataTime=0,this.onPlayTime=0,this.loadedDataTs=0,this.hyPlayerLoadTs=0,this.firstP2POnDataTime=0,this.firstP2PIframeTime=0}},{key:"printUseTime",value:function(){var t=["\n%c"+".".repeat(28)," getLivingInfoTime = "+Math.max(0,this.getLivingInfoTime-this.startTime)," connectVideoTime = "+(this.connectVideoTime-this.startTime)];this.firstVideoPkgTime>0?t.push(" firstVideoPkgTime = "+(this.firstVideoPkgTime-this.connectVideoTime)," firstIFrameTime1 = "+(this.firstIFrameTime1-this.connectVideoTime)," firstIFrameTime2 = "+(this.firstIFrameTime2-this.firstIFrameTime1)," firstRenderTime = "+(this.firstRenderTime-this.firstIFrameTime2)):t.push(" firstAudioPkgTime = "+(this.firstAudioPkgTime-this.connectVideoTime)," firstRenderTime = "+(this.firstRenderTime-this.firstAudioPkgTime)),t.push(" onPlayTime = "+(this.onPlayTime-this.firstRenderTime)," totalTime = "+(this.onPlayTime-this.startTime),".".repeat(28));var e=a1(t,28);I.log(e,"color:#007500;background:#FFF5C2")}},{key:"printVpTime",value:function(){if(!this.printVpTime.done){this.printVpTime.done=!0;var t=a1(["\n%c"+".".repeat(28)," initTafTime = "+(this.initTafTime-0)," getVPTime = "+(this.getVPTime-this.reqVpTime)," connectVpTime = "+(this.connectVpTime-this.getVPTime)," loginTime = "+(this.loginTime-this.connectVpTime)," totalTime = "+(this.loginTime-this.reqVpTime),".".repeat(28)],28);I.log(t,"color:#007500;background:#FFF5C2")}}}]),t}(),a3=function(){function t(e){Object(s.a)(this,t),this.loaderHandler=e,this._destroy=!1,this.reset()}return Object(r.a)(t,[{key:"reset",value:function(){this.u8arr=new Uint8Array(0)}},{key:"destroy",value:function(){I.log("SliceHandler.destroy"),this.u8arr=null,this._destroy=!0,this.loaderHandler=null}},{key:"onData",value:function(t){var e=this.u8arr,i=new Uint8Array(t);0===e.length?this.u8arr=i:(this.u8arr=new Uint8Array(e.length+i.length),this.u8arr.set(e,0),this.u8arr.set(i,e.length));var s=this.onProto(this.u8arr);s>0&&!this._destroy&&(this.u8arr=this.u8arr.slice(s))}},{key:"onProto",value:function(t){for(var e,i,s,r,a,n=new DataView(t.buffer),o=0,u=0;o+10<t.byteLength&&!this._destroy;){if((u=n.getUint16(o+8,!0))<10)return this.loaderHandler.onProtoError(u),o;if(o+u>t.byteLength)break;s=n.getUint32(o,!0),r=0x100000000*n.getUint32(o+4,!0)+s,a=n.getUint32(o+14,!0),i=t.slice(o+10,o+u),(e=new d.PP2pSliceData).seq=r,e.uri=a,e.payload=i,this.loaderHandler&&this.loaderHandler.onSlice(d.ProtoUri.PP2pSliceData,e),o+=u}return o}}]),t}(),a5=function(){function t(e){Object(s.a)(this,t),this.loaderMgr=e,this.p2pPlayer=e.p2pPlayer,this.tsdbUtil=e.p2pPlayer.tsdb,this.stat=e.p2pPlayer.stat,this.type=t.TYPE_FULL,this.sliceHandler=new a3(this),this.url=null,this.lineType=-1,this.started=!1,this.status=0,this.connecting=!1,this.connectTotalTs=0,this.flowRetryTimes=0,this.lastSeq=0,this.connectTs=0,this.connectedTs=0,this.firstPkgTs=0,this.reportUrl=null,this.sliceTs=0,this.sliceStamp=0,this.tcpStamp=0,this.logMark="FullStream",this.logMarkCss="color:#01814A;background:#FFF5C2;font-weight:bold;",this._testNodata=1==D._testNodata,this._testRenderTimeout=1==D._testRenderTimeout,this.ConnectTotalTime=Number(F.c
1onnectTotalTime),this.ConnectTimeout=Number(F.connectTimeout),this.FlowTimeout=Number(F.flowTimeout),this.FlowRetryTimes=Number(F.flowRetryTimes),this.RenderTimeout=Number(F.renderTimeout),this.NoDataTimeout=Number(F.noDataTimeout),this.hisLinks=new aS(this.stat)}return Object(r.a)(t,[{key:"destroy",value:function(){this.clearTimer(),this.loaderMgr=null,this.p2pPlayer=null,this.tsdbUtil=null,this.stat=null,this.url=null,this.link&&this.link.destroy(),this.link=null,this.sliceHandler&&this.sliceHandler.destroy(),this.sliceHandler=null,this.hisLinks&&this.hisLinks.destroy(),this.hisLinks=null}},{key:"onSlice",value:function(t,e){var i=e.seq;0===this.lastSeq&&I.log("VideoLoader.onFirstSeq",this.getLoaderInfo(),"seq",i),this.lastSeq>0&&Math.abs(i-this.lastSeq)>1&&I.warn("VideoLoader seq discontinuous, lastSeq="+this.lastSeq+" curSeq="+i+" jump="+(i-this.lastSeq)),this.lastSeq=i,e.from=this.type,this.p2pPlayer.sliceProtoHandler.onSlice(e)}},{key:"onProtoError",value:function(t){I.warn("SliceHandler.onProto length error pktLen="+t+", smaller than 10 bytes.",this.getLoaderInfo())}},{key:"getLoaderInfo",value:function(){var t="bufLen="+this.p2pPlayer.bufferLen;return"type=".concat(this.type," line=").concat(this.lineType," ").concat(t)}},{key:"resetReport",value:function(){this.sliceStamp=0,this.tcpStamp=0}},{key:"clearTimer",value:function(){tP.remove(this.onCheckTimer,this),tP.remove(this.onConnectTimeout,this),tP.remove(this.onFirstDataTimeout,this),tP.remove(this.onRenderTimeout,this)}},{key:"reset",value:function(){this.sliceHandler&&(this.sliceHandler.destroy(),this.sliceHandler=null),this.sliceHandler=new a3(this),this.status=0,this.lastSeq=0,this.connecting=!1,this.connectTs=0,this.connectedTs=0,this.firstPkgTs=0,this.sliceTs=0,this.resetReport(),this.clearTimer(),this.link&&(this.link.url&&this.hisLinks.addHis(this.link),this.link.destroy(!1)),this.url&&this.url.startsWith("http")?S.firefox&&rN.isSupported()?this.link=new rN(this):this.link=new rB(this):this.link=new rM(this,!1)}},{key:"connect",value:function(t,e){this.url=t,this.lineType=e,this.reset();var i=g.now();this.connectTs=i,this.tcpStamp=i;var s=t,r=this.p2pPlayer.G;if(!r.isStartFromUrl){var a=F.platform,n=L.PLATFORM_TYPE[a]||L.PLATFORM_TYPE.web,o=a===L.PLATFORM_TYPE_NAME.wap?"uid=".concat(w.uid,"&uuid=").concat(w.uuid):"u=".concat(w.convertUid);s+="&timeStamp="+g.getDateTimeStr().replace(" ","_"),s+="&".concat(o,"&t=").concat(n),s=O.urlInfoParams(s,this.p2pPlayer.info),r.myIp&&(s+="&myIp="+r.myIp)}I.log("%c".concat(this.logMark),this.logMarkCss,"".concat(s," ").concat(this.getLoaderInfo())),this.connecting=!0,this.link.connect(s),this.stat.setComDim(R.DIM_COM.STREAM_URL,s),this.started=!0,tP.add(this.onCheckTimer,this,1e3),this.p2pPlayer.beforeTurnToFlv(L.turnToFlvReason.FULL_CONNECT_TIMEOUT),tP.once(this.onConnectTimeout,this,this.ConnectTimeout)}},{key:"reconnect",value:function(){if(null!=this.url&&-1!==this.lineType){var t=this.loaderMgr.antiCode;t&&-1===this.url.indexOf(t)&&(this.url=this.url.replace(/(wsSecret=.+?&wsTime=.+?)(\&|$)/,t+"$2"));var e=this.p2pPlayer.info;if(e){var i=RegExp("//(.*?)"+e._domain+"/"),s=this.p2pPlayer.changeDomain();this.url=s?this.url.replace(i,"//"+s+"/"+e._domain+"/"):this.url.replace(i,"//"+e._domain+"/")}I.log("VideoLoader.reconnect"),this.close(),this.connect(this.url,this.lineType)}else I.warn("VideoLoader.reconnect url=".concat(this.url," line=").concat(this.lineType))}},{key:"close",value:function(){this.reset(),this.started=!1}},{key:"on302",value:function(t){this.loaderMgr.on302(t)}},{key:"onheader",value:function(t){this.p2pPlayer.onHeader(t)}},{key:"onopen",value:function(){var t=g.now();this.connectedTs=t;var e=this.connectedTs-this.connectTs;I.log("VideoLoader.onopen ".concat(this.getLoaderInfo()," cost time=").concat(e));var i=this.p2pPlayer.G;0===i.connectVideoTime&&(i.connectVideoTime=t,I.log("%c[TIME] connect
1VideoTime="+(i.connectVideoTime-i.startTime)+" totalTime="+(t-i.startTime),"color:#A23400;background:#FFF5C2")),this.connecting=!1,this._reportTcp(),this.p2pPlayer.exceptionStat.setStat(R.DIM_LINK_STA.CONNECT_SUC,1),this.p2pPlayer.beforeTurnToFlv(L.turnToFlvReason.FULL_NO_DATA),tP.remove(this.onConnectTimeout,this),tP.once(this.onFirstDataTimeout,this,this.FlowTimeout),this.loaderMgr.onConnected()}},{key:"_onclose",value:function(){this.connecting=!1,this.resetReport(),this.sliceTs>0?this.getProxy("onclose"):this.connectedTs>0?this.onFirstDataTimeout():tP.once(this.onConnectTimeout,this,1e3),this.p2pPlayer.exceptionStat.setStat(R.DIM_LINK_STA.CONNECT_SUC,0)}},{key:"onclose",value:function(){I.log("VideoLoader.onclose ".concat(this.getLoaderInfo())),this._onclose()}},{key:"onerror",value:function(t,e){I.log("VideoLoader.onerror ".concat(this.getLoaderInfo())),404!==e&&403!==e||(this.tsdbUtil.httpError=!0,this.tsdbUtil.sendMetrics([this.stat.createAct(R.ACT.HTTP_CODE_+e,{value:[this.type]})])),this._onclose(),403===e&&this.p2pPlayer&&this.p2pPlayer.subError403&&this.p2pPlayer.subError403()}},{key:"onstatus",value:function(t){this.status=t}},{key:"onConnectTimeout",value:function(){this.connectedTs>0||(this._reportStat(1),this.connectTotalTs+=g.now()-this.connectTs,I.warn("VideoLoader.onConnectTimeout connectTotalTs=".concat(this.connectTotalTs,"/").concat(this.ConnectTotalTime," ").concat(this.getLoaderInfo())),this.connectTotalTs<this.ConnectTotalTime&&this.reconnect(),this.p2pPlayer.loaderErrorTimes++)}},{key:"onFirstDataTimeout",value:function(){if(!(this.sliceTs>0)){var t=g.now();I.warn("VideoLoader.onFirstDataTimeout",t-this.connectedTs),this.flowRetryTimes++<this.FlowRetryTimes&&this.reconnect(),this.p2pPlayer.loaderErrorTimes++}}},{key:"onRenderTimeout",value:function(){this.sliceTs>0&&this.p2pPlayer.onRenderTimeout()}},{key:"connected",get:function(){return this.link&&this.link.connected}},{key:"speed",get:function(){var t=this.link.speed;
1return t==O.UintMax&&(t=0),t}},{key:"_reportStat",value:function(t){this.stat.addComp(R.P2P_TCP_TYPE.name,R.K+this.type,1),this.stat.addComp(R.P2P_TCP_STATE.name,R.K+t,1)}},{key:"_reportNoSlice",value:function(t){if(0!==this.sliceStamp&&t-this.sliceStamp>2500&&this.url){this.p2pPlayer.exceptionStat.setStat(R.DIM_LINK_STA.NO_SLICE_DATA,1);var e=this.p2pPlayer.G;this.tsdbUtil.sendMetrics([this.stat.createAct(R.ACT.TCP_NO_SLICE,{value:[this.type],str:[e.wanIp]})]),this.sliceStamp=0}}},{key:"_reportNoHeader",value:function(){this.url&&this.reportUrl!==this.url&&(this.reportUrl=this.url)}},{key:"_reportTcp",value:function(){var t=this.p2pPlayer.G,e=g.now()-this.tcpStamp;this.tcpStamp>0&&e>1e3&&this.url&&e<1e4&&this.tsdbUtil.sendMetrics([this.stat.createAct(R.ACT.TCP_OPEN_TIME,{value:[this.type,e],str:[t.wanIp]})]),this.tcpStamp=0}},{key:"onData",value:function(t){if(!this._testNodata&&this.p2pPlayer){this.p2pPlayer.G.globalSpeedCalc.addCur(t.byteLength),this.p2pPlayer.addBytes(t.byteLength);var e=g.now();if(this.sliceTs=e,this.sliceStamp=e,0===this.firstPkgTs){this.firstPkgTs=e;var i=this.firstPkgTs-this.connectedTs,s=O.formatByteSize(t.byteLength);if(I.log("VideoLoader.onData ".concat(this.getLoaderInfo()," firstPkgTs=").concat(i," size=").concat(s)),this.p2pPlayer.beforeTurnToFlv(L.turnToFlvReason.FULL_PLAY_FAIL),tP.remove(this.onFirstDataTimeout,this),this.p2pPlayer.isShieldStart){var r=F.shieldAudioCfg[2]+1e3;I.log("VideoLoader.onData.bufferAV shieldStart,timeout=".concat(r)),tP.once(this.onRenderTimeout,this,F.shieldAudioCfg[2]+1e3)}else tP.once(this.onRenderTimeout,this,this.RenderTimeout);this.connectTotalTs=0,this.flowRetryTimes=0}this._testRenderTimeout||(this.link instanceof rM?this.sliceHandler.onProto(new Uint8Array(t)):this.sliceHandler.onData(t),this.p2pPlayer.exceptionStat.setStat(R.DIM_LINK_STA.HAS_DATA,1))}}},{key:"onCheckTimer",value:function(t,e){this.started&&(this._reportNoSlice(t),this.sliceTs>0&&t-this.sliceTs>=this.NoDataTimeout&&this.getProxy("noDataTime="+(t-this.sliceTs)))}},{key:"getProxy",value:function(t){I.log("VideoLoader.getProxy ".concat(t," ").concat(this.getLoaderInfo())),this._reportNoHeader(),this.reset(),this.p2pPlayer.loaderErrorTimes++,this.p2pPlayer.onRestart(L.restartReason.CONNECT)}}]),t}();a5.TYPE_FULL=1,a5.TYPE_SUB=2,a5.TYPE_RANGE=3,a5.TYPE_PATCH=4;var a6=function(){function t(e){Object(s.a)(this,t),this.p2pPlayer=e,this.resetProperty(),this.fullLoader=new a5(this)}return Object(r.a)(t,[{key:"destroy",value:function(){this.p2pUrl=null,this.antiCode=null,this.streamName=null,this.p2pPlayer=null,this.fullLoader&&this.fullLoader.destroy(),this.fullLoader=null}},{key:"init",value:function(t,e){this.p2pUrl=t,this.antiCode=e;var i=this.p2pPlayer.G;if(!i.isStartFromUrl){"/"===this.p2pUrl.substr(-1)&&(this.p2pUrl=this.p2pUrl.substr(0,this.p2pUrl.length-1)),this.p2pUrl=this.p2pUrl.replace(/^(http|ws)s?\:/i,""),this.streamName=i.streamId.text()+"_"+w.appid;var s=!0;if(-1===self.location.protocol.indexOf("https")){var r=F.p2pWssLines;"string"==typeof r&&(s="all"==(r=r.toLowerCase())||-1!=r.split(",").indexOf(i.lineType.toString()))}else s=!0;void 0===D._testSSL?this.openWss=s:this.openWss=Number(D._testSSL)>0}}},{key:"stop",value:function(){I.log("LoaderMgr.stop"),this.stopFullStream(),this.resetProperty()}},{key:"resetProperty",value:function(){this.p2pUrl=null,this.antiCode="",this.streamName="",this.openWss=!0}},{key:"getUrl",value:function(t){var e=t!==a5.TYPE_RANGE&&(t!==a5.TYPE_FULL||rV.isMacChrome72())?"ws":"http";this.openWss&&(e+="s");var i="",s=this.p2pPlayer.G;return this.p2pUrl.match(/al\.p2p\.huya\.com/)&&t!=a5.TYPE_RANGE&&t!=a5.TYPE_FULL&&(i="/websocket"),this.url="".concat(e,":").concat(this.p2pUrl).concat(i,"/").concat(this.streamName,".slice?").concat(this.antiCode,"&ex1=").concat(s.exip,"&dMod=").concat(O.getDMod(this.p2pPlayer.info._dMod,this.p2pPlayer.info._sMod),"&baseIndex="),this.url}},{key:"loadFullStream",value:function(t,e,i){var s=this.p2pPlayer.G;isNaN(t)&&(I.warn("LoaderMgr.loadSubStream baseIndex isNaN ["+t+"] change to 0."),t=0);var r=this.getUrl(a5.TYPE_FULL)+t;i?r+="&startPts=".concat(i):0===t&&s.quickTime>0&&(r+="&quickTime=".concat(s.quickTime)),1==D._testAv1P2PLinkFail&&this.p2pPlayer.isAv1&&(r="abc"+r),this.url=r,this.fullLoader.connect(r,s.lineType)}},{key:"stopFullStream",value:function(){this.fullLoader.close()}},{key:"onConnected",value:function(){this.p2pPlayer.onConnected()}},{key:"on302",value:function(t){this.p2pPlayer.on302(t)}}]),t}(),a4=function(){function t(){Object(s.a)(this,t)}
1return Object(r.a)(t,null,[{key:"getFlvHeader",value:function(){var t=new Uint8Array(13),e=0;return t[e++]=70,t[e++]=76,t[e++]=86,t[e++]=1,t[e++]=5,t[e++]=0,t[e++]=0,t[e++]=0,t[e++]=9,t[e++]=0,t[e++]=0,t[e++]=0,t[e++]=0,t}},{key:"packAudioFlvTag",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,s=e.length+2,r=new Uint8Array(11+s+4),a=0;return r[a++]=8,r[a++]=s>>16&255,r[a++]=s>>8&255,r[a++]=255&s,r[a++]=t>>16&255,r[a++]=t>>8&255,r[a++]=255&t,r[a++]=t>>24&255,r[a++]=0,r[a++]=0,r[a++]=0,-1!=i&&(r[a++]=175,r[a++]=i),r.set(e,a),a+=e.length,s+=11,r[a++]=s>>24&255,r[a++]=s>>16&255,r[a++]=s>>8&255,r[a++]=255&s,r}},{key:"packAvcFlvTag",value:function(t,e,i){var s=e.length+5,r=new Uint8Array(11+s+4),a=0;r[a++]=9,r[a++]=s>>16&255,r[a++]=s>>8&255,r[a++]=255&s,r[a++]=t>>16&255,r[a++]=t>>8&255,r[a++]=255&t,r[a++]=t>>24&255,r[a++]=0,r[a++]=0,r[a++]=0,r[a++]=i||23,r[a++]=0,r[a++]=0,r[a++]=0,r[a++]=0,r.set(e,a),a+=e.length;var n=11+s;return r[a++]=n>>24&255,r[a++]=n>>16&255,r[a++]=n>>8&255,r[a++]=255&n,r}},{key:"adtsToConfig",value:function(t){var e=new Uint8Array(2),i=1+((192&t[2])>>6),s=(60&t[2])>>2,r=(1&t[2])<<2|(192&t[3])>>6;return e[0]=i<<3|(14&s)>>1,e[1]=(1&s)<<7|r<<3,e}},{key:"setFrameTimestamp",value:function(t,e){e[4]=t>>16&255,e[5]=t>>8&255,e[6]=255&t,e[7]=t>>24&255}},{key:"getAvc",value:function(t){var e=t.streamData[0];return e+=t.streamData[1]<<8,e+=t.streamData[2]<<16,e+=t.streamData[3]<<24>>>0,t.streamData.slice(4,4+e)}},{key:"trimIFrame",value:function(t,e){t.streamData=t.streamData.slice(4+e)}}]),t}(),a8=function(){function t(e){Object(s.a)(this,t),this.videoPlayer=e,this.firstFrameDts=0,this.isCanPlay=!1,this.lastPlaySeq=0,this.lastPlayDts=0,this.lastPlayFrameId=0,this.lastDtsJumpTs=0,this.lastFrameIdJumpTs=0,this.frameDuration=0,this.chain=new tZ,this.recvChain=new tZ,this.fullChain=new tZ,this.lateChain=new tZ,this.type=""}return Object(r.a)(t,[{key:"printChainInfos",value:function(){I.log("Recver.printChainInfos ".concat(this.type," lastPlayFrameId=").concat(this.lastPlayFrameId," lastPlayDts=").concat(this.lastPlayDts)),this.printChainInfo(this.chain,"chain"),this.printChainInfo(this.recvChain,"recvChain"),this.printChainInfo(this.fullChain,"fullChain"),this.printChainInfo(this.lateChain,"lateChain")}},{key:"printChainInfo",value:function(t,e){if(t.size>0){var i=[],s=[];t.resetTravel();for(var r=0,a=0,n=t.travel();n;)i.push(n.key-r),r=n.key,n.dts&&(s.push(n.dts-a),a=n.dts),n=t.travel();I.log("".concat(this.type," ").concat(e," frameIdList=").concat(i.join(","))),s.length>0&&I.log("".concat(this.type," ").concat(e," dtsArr=").concat(s.join(",")))}}},{key:"getLastData",value:function(){return{firstFrameDts:this.firstFrameDts,lastPlaySeq:this.lastPlaySeq,lastPlayDts:this.lastPlayDts,lastPlayFrameId:this.lastPlayFrameId}}},{key:"setLastData",value:function(t){this.firstFrameDts=t.firstFrameDts,this.lastPlaySeq=t.lastPlaySeq,this.lastPlayDts=t.lastPlayDts,this.lastPlayFrameId=t.lastPlayFrameId}},{key:"getSize",value:function(){return this.chain.size}},{key:"getWaitFrames",value:function(){return this.chain.size<=0?0:this.chain.peekLast().key-this.lastPlayFrameId}},{key:"getReason",value:function(){var t=this.chain.peek();return t&&this.lastPlayFrameId>0?t.isFull?t.key-this.lastPlayFrameId>1?1:2:3:0}},{key:"getFrameGap",value:function(){var t=this.chain.peek();return t&&this.lastPlayFrameId>0?t.key-this.lastPlayFrameId:0}},{key:"checkPlay",value:function(t,e){0===this.firstFrameDts&&(this.firstFrameDts=t,this.lastPlayDts=t-1),this.isCanPlay||(this.isCanPlay=t-this.firstFrameDts>=e)}},{key:"trimBeforeDts",value:function(t){for(var e=this.chain.peek();e&&e.dts<t;)this.chain.get(),e=this.chain.peek();return e&&I.log("Recver.trimBeforeDts "+this.type+", firstFrame="+e.key+" firstDts="+e.dts),e}},{key:"trimBeforeFrameId",value:function(t){for(var e=this.chain.peek();e&&e.key<t;)this.chain.get(),e=this.chain.peek();e&&I.log("Recver.trimBeforeFrameId "+this.type+", firstFrame="+e.key+" firstDts="+e.dts)}},{key:"checkDropFrames",value:function(t){}},{key:"startDropFrames",value:function(t){return 0}},{key:"_getFrameAble",value:function(t,e){if(0===this.lastPlayFrameId||e.key-this.lastPlayFrameId==1)return!0;var i=this.videoPlayer.getBufferLen();if(1===F.frameAblePloy){if(t-this.lastPushTs>i&&t-e.createTs>F.frameTimeout)return!0}else{var s=this.videoPlayer.getJitterBufferLen(),r=t-this.lastPushTs;if(0!=s){if(r>s)return"video"==e.type&&I.log("Recver._getFrameAble.push jitBuf, pushDelta=".concat(r,", bufLen=").concat(i)),!0}else if(r>i)return"video"==e.type&&I.log("Recver._getFrameAble.push bufLen, pushDelta=".concat(r,", bufLen=").concat(i)),!0;if(t-e.createTs>F.frameTimeout)return"video"==e.type&&I.log("Recver._getFrameAble.create, createDelta=".concat(t-e.createTs,", bufLen=").concat(i)),!0}return i<1e3&&t-e.recvTs>F.frameTimeout}},{key:"getFrame",value:function(t){var e=this.chain.peek();if(e&&e.isFull&&this._getFrameAble(t,e)){var i=!1;return this.lastPlayFrameId>0&&e.key-this.lastPlayFrameId>1&&(this.lastFrameIdJumpTs=t,i=!0,I.warn("Recver.getFrame isAudio=".concat(e.isAudio," frameId disconnect, lastId=").concat(this.lastPlayFrameId," curId=").concat(e.key," gap=").concat(e.key-this.lastPlayFrameId," cache=").concat(this.chain.size," disLastPushTs=").concat(t-this.lastPushTs))),this.lastPlayFrameId=e.key,this.lastPlayDts>0&&(e.dts-this.lastPlayDts>1e3||this.lastPlayDts-e.dts>1e3)&&(this.lastDtsJumpTs=t),!i&&this.lastPlayDts>0&&(this.frameDuration=e.dts-this.lastPlayDts),this.lastPlayDts=e.dts,this.lastPushTs=t,this.chain.get(),e}return null}},{key:"getMaxSeq",value:function(t){for(var e=this.chain.head,i=0;e;){var s=e.data;if(!(t-s.createTs>1100)||(i=s.getMaxSeq(),e.next===this.chain.head))break;e=e.next}return i}},{key:"hasNextFrame",value:function(t){var e=this.chain.peek();return!(!e||!e.isFull)&&(0===this.lastPlayFrameId||e.key-this.lastPlayFrameId==1||e.isTimeout(t))}},{key:"hasFrame",value:function(){return this.chain.size>0}},{key:"peekFrame",value:function(){return this.chain.peek()}},{key:"peekLastFrame",value:function(){return this.chain.peekLast()}},{key:"playFrame",value:function(t,e){this.lastPlayDts>0&&(t.dts-this.lastPlayDts>1e3||this.lastPlayDts-t.dts>1e3)&&(this.lastDtsJumpTs=e);var i=!1;this.lastPlayFrameId>0&&t.key-this.lastPlayFrameId>1&&(i=!0,I.warn("Recver.getFrame isAudio=".concat(t.isAudio," frameId disconnect, lastId=").concat(this.lastPlayFrameId," curId=").concat(t.key," gap=").concat(t.key-this.lastPlayFrameId," cache=").concat(this.chain.size," disLastPushTs=").concat(e-this.lastPushTs))),!i&&this.lastPlayDts>0&&(this.frameDuration=t.dts-this.lastPlayDts),this.lastPlayFrameId=t.key,this.lastPlayDts=t.dts,this.lastPlaySeq=t.getMaxSeq(),this.lastPushTs=e,this.chain.get()}},{key:"isFrameIdContinued",value:function(t){return 0===this.lastPlayFrameId||t.key-this.lastPlayFrameId==1}},{key:"isDtsContinued",value:function(t){return this.lastPlayDts-t.dts<200}},{key:"getBuffers",value:function(t){var e=0,i=0,s=0,r=0;if(this.chain.size>1)for(var a=this.chain.head.next;a.next!==this.chain.head;){var n=a.data;n.isFull&&(0===e&&(e=n.dts),i=n.dts,0!==r&&n.key-r!=1||(s=i,r=n.key)),a=a.next}return 0===s&&i>0&&(s=i),{recvBuffer:i-e,continueBuffer:s-e,fpsBuffer:t>0?this.chain.size/t*1e3:0}}},{key:"printNextFrameInfo",value:function(){}}
1,{key:"getNeedRangeSeqs",value:function(t,e,i){}},{key:"reset",value:function(){this.lastPlayFrameId=0,this.lastPlayDts=0,this.chain.reset(),this.isCanPlay=!1,this.firstFrameDts=0,this.lastPushTs=0}},{key:"getDtsByLostSeq",value:function(t){if(t<this.lastPlaySeq)return this.lastPlayDts;var e=0;for(this.chain.resetTravel();;){var i=this.chain.travel();if(!i)break;if(t<i.getMinSeq()){e=i.key-1;break}if(t<i.getMaxSeq()){e=i.key;break}}return e>0?this.lastPlayDts+this.frameDuration*(e-this.lastPlayFrameId+1):-1}}]),t}(),a9=function(){function t(){Object(s.a)(this,t),this.type=null,this.createTs=0,this.recvTs=0,this.key=null,this.size=0,this.pktNum=0,this.packets=[],this.dts=0,this.streamData=null,this.aacConfig=null,this.firstPktSeq=0,this.lastPktSeq=0}return Object(r.a)(t,[{key:"setData",value:function(t,e,i){}},{key:"addData",value:function(t){}},{key:"reset",value:function(){this.key=null,this.pktNum=null,this.size=0,this.packets=[],this.streamData=null,this.firstPktSeq=0,this.lastPktSeq=0,this.dts=O.UintMax,this.recvTs=null}},{key:"isAudio",get:function(){return this.type===t.Types.Audio}},{key:"isVideo",get:function(){return this.type===t.Types.Video}},{key:"isFull",get:function(){return this.packets.length===this.pktNum}},{key:"isEmpty",get:function(){return 0===this.packets.length}},{key:"isTimeout",value:function(t){return this.createTs>0&&t-this.createTs>F.frameTimeout}},{key:"getPos",value:function(){return 0}},{key:"getDts",value:function(){var e=this.getPos(),i=((255&this.streamData[e+7])<<24>>>0)+((255&this.streamData[e+4])<<16)+((255&this.streamData[e+5])<<8)+(255&this.streamData[e+6]),s=i;return this.type===t.Types.Video?1==D._jumpV?s+=1e6:2==D._jumpV&&(s-=1e6):1==D._jumpA?s+=1e6:2==D._jumpA&&(s-=1e6),s!==i&&(this.streamData[e+7]=s>>>24&255,this.streamData[e+4]=s>>>16&255,this.streamData[e+5]=s>>>8&255,this.streamData[e+6]=255&s),s}},{key:"getMaxSeq",value:function(){return this.packets[this.packets.length-1].seq}},{key:"getMinSeq",value:function(){return this.packets[0].seq}},{key:"getSeqs",value:function(){var t=[];return this.packets.forEach(function(e){t.push(e.seq)}),t}},{key:"getLostSeqs",value:function(){var t=[],e=this.packets.length;if(e<this.pktNum){for(var i=this.packets[0].seq,s=this.packets[e-1].seq,r=i,a=1;a<e;a++)for(var n=this.packets[a].seq;r<n;)t.push(r),r++;for(var o=this.pktNum-e;o-- >0;)t.unshift(--i),t.push(++s)}return t}}]),t}();a9.Types={Video:"video",Audio:"audio"};var a7=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){return Object(s.a)(this,i),e.call(this)}return Object(r.a)(i,[{key:"addData",value:function(t){if(0===this.packets.length)this.createTs=g.now(),this.key=t.frameId,this.frameType=3&t.seqNum,this.pktNum=t.frameNum,this.packets.push(t),this.size+=t.streamData.length;else{if(1==D._autoDropVideo&&this.isVideo?(D._autoDropVideo=0,this._autoDrop=!0):1==D._autoDropAudio&&this.isAudio&&(D._autoDropAudio=0,this._autoDrop=!0),this._autoDrop)return!1;if(this.isFull)return!0;for(var e=!0,i=this.packets.length-1;i>=0;i--){if(this.packets[i].seqNum===t.seqNum)return!0;if(this.packets[i].seqNum<t.seqNum){this.packets.splice(i+1,0,t),this.size+=t.streamData.length,e=!1;break}}e&&(this.packets.splice(0,0,t),this.size+=t.streamData.length)}if(this.isFull){this.streamData=new Uint8Array(this.size);for(var s=0,r=this.packets.length,a=0;a<r;a++)this.streamData.set(this.packets[a].streamData,s),s+=this.packets[a].streamData.length;if(this.firstPktSeq=this.packets[0].seq,this.lastPktSeq=this.packets[r-1].seq,this.dts=this.getDts(),this.recvTs=g.now(),Number(D._printVideoFrame)){var n=this.dts-I.lastDts;I.debug("%cVideo frameType="+this.frameType+" seq="+t.seq+" frameId="+this.key+" dts="+this.dts+" %c^dts="+n,"color:#F00",n>100?"background:#FF9797":"",n>100?"-_-":""),I.lastDts=this.dts}}return!0}}]),i}(a9),nt=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).type=a9.Types.Video,t}return Object(r.a)(i,[{key:"isKeyFrame",get:function(){return 0===this.frameType}},{key:"isPFrame",get:function(){return 1===this.frameType}},{key:"isBFrame",get:function(){return 2===this.frameType}},{key:"getPos",value:function(){var t=0;return this.isKeyFrame&&(t=this.streamData[0]+(this.streamData[1]<<8)+(this.streamData[2]<<16)+(this.streamData[3]<<24>>>0)+4),t}}]),i}(a7),ne=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).type="VideoRecver",r.codecname="",r.avcConfig=null,r.lastRecvTs=0,r.lateSeqs=0,r.dropFrames=0,r.playedFrames=0,r.dtsJumpPauseTimes=0,r.ski
1pFramePauseTimes=0,r.forceSkipFrameNums=0,r.waitNextIFrame=!1,r.frameSeqLostTs=0,r.frameDropTs=0,r.firstIFrameId=0,r.recvSeqCnt=0,r.fullSeqCnt=0,r.lateSeqCnt=0,r.lateFrames=new Map,r}return Object(r.a)(i,[{key:"resetSeqCnt",value:function(){this.recvSeqCnt=0,this.fullSeqCnt=0,this.lateSeqCnt=0,this.lateFrames.clear()}},{key:"getLastData",value:function(){var t=Object(n.a)(Object(o.a)(i.prototype),"getLastData",this).call(this);return t.avcConfig=this.avcConfig,t}},{key:"setLastData",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"setLastData",this).call(this,t),this.avcConfig=t.avcConfig}},{key:"recvData",value:function(t){if(this.recvSeqCnt++,t.frameId<=this.lastPlayFrameId)return this.lateSeqCnt++,this.lateFrames.set(t.frameId,1),tZ.addData(this.lateChain,{key:t.frameId},Number(F.avHeaderChangeCfg[2])),3;if(t.frameId<this.firstIFrameId)return I.log("VideoRecver.recvData RECV_LATE_FRAMEID frameId=".concat(t.frameId," firstIFrameId=").concat(this.firstIFrameId)),6;this.lastRecvTs=g.now(),t.config.has(12)&&(this.codecname=t.config.get(12));var e=this.chain.getOrNewNode(t.frameId);if(!e)return 4;var i=e.data;i||(e.data=i=new nt,tZ.addData(this.recvChain,{key:t.frameId},Number(F.avHeaderChangeCfg[2]))),i.addData(t),i.isKeyFrame&&0===this.firstIFrameId&&(this.firstIFrameId=i.key,this.trimBeforeFrameId(this.firstIFrameId));var s=g.now(),r=this.videoPlayer.p2pPlayer.G;0===r.firstVideoPkgTime&&(r.firstVideoPkgTime=s,I.log("%c[TIME] firstVideoPkgTime="+(s-r.connectVideoTime)+" totalTime="+(s-r.startTime)+" seq="+t.seq+" frameType="+i.frameType,"color:#A23400;background:#FFF5C2"," frameId="+i.key)),0===r.firstIFrameTime1&&0===i.frameType&&(r.firstIFrameTime1=s,I.log("%c[TIME] firstIFrameTime1="+(s-r.connectVideoTime)+" totalTime="+(s-r.startTime)+" seq="+t.seq+" sliceNum="+i.pktNum,"color:#A23400;background:#FFF5C2"," frameId="+i.key));var a=i.isFull;return this.videoPlayer.firstTsStatus<2&&a&&i.isKeyFrame&&(this.videoPlayer.setFirstDTs(2,i.dts),r.firstIFrameTime2=s,I.log("%c[TIME] firstIFrameTime2="+(s-r.firstIFrameTime1)+" totalTime="+(s-r.startTime)+" seq="+t.seq+" sliceNum="+i.pktNum,"color:#A23400;background:#FFF5C2"," frameId="+i.key)),a?(this.videoPlayer.dtsChecker.isVideoDtsDiffLarge(i.dts),tZ.addData(this.fullChain,{key:t.frameId,dts:i.dts},Number(F.avHeaderChangeCfg[2])),this.fullSeqCnt+=i.pktNum,this.checkPlay(i.dts,230),2):0}},{key:"needUrgendResend",value:function(t){var e=this.chain.peek();return e&&t-e.createTs>F.urgentResendTime}},{key:"getWaitFrameTime",value:function(t){var e=this.chain.peek();return e?t-e.createTs:0}},{key:"checkDropFrames",value:function(t){var e=this.chain.peek();e&&t-e.createTs<F.forceSkipFrameTime||this.startDropFrames(t)}},{key:"getFramesDisNextIFrame",value:function(){this.chain.resetTravel();for(var t=0,e=!1;;){var i=this.chain.travel();if(!i)break;if(i.isKeyFrame){e=!0;break}t++}return e?t:-1}},{key:"startDropFrames",value:function(t){var e=this.lastPlayFrameId,i=0,s=this.chain.get();I.log("VideoRecver.startDropFrames",s);var r=this.chain.peek(),a="VideoRecver.startDropFrames",n=[],o=this.videoPlayer.p2pPlayer.p2pMgr.getLastContinueSeq(),u=0;for(s&&(o-(u=s.getMaxSeq())>200&&(this.frameSeqLostTs=t),i++,n.push(s.key),a+=" resendTimes:"+s.urgentResendTimes+" frameId:"+s.key+" pktNum:"+s.pktNum+" hasNum:"+s.packets.length+" seqs:"+(s.pktNum>0?"".concat(s.packets[0].seq,"-").concat(s.packets[s.packets.length-1].seq):""),a+=" lastContinueSeq=".concat(o));r;){if(r.isKeyFrame){this.setNextIFrame(r);break}this.waitNextIFrame=!0,n.push(r.key),r.isFull&&(this.lastPlayDts=r.dts,this.lastPlaySeq=r.firstPktSeq),u=r.getMaxSeq(),this.chain.get(),r=this.chain.peek(),i++}return u>0&&u>o&&this.videoPlayer.p2pPlayer.p2pMgr.setLastContinueSeq(u),i>0&&(this.frameDropTs=t,this.forceSkipFrameNums+=i,a+=" dropNum:"+i+" cache:"+this.chain.size+" lastPlayFrameID:"+e,I.log(a,n)),i}},{key:"checkNextIframe",value:function(){if(this.waitNextIFrame)for(var t=this.chain.peek();t;){if(t.isKeyFrame){this.setNextIFrame(t);break}this.lastPlayFrameId=t.key,t.isFull&&(this.lastPlayDts=t.dts,this.lastPlaySeq=t.firstPktSeq),this.chain.get(),t=this.chain.peek()}}},{key:"setNextIFrame",value:function(t){I.log("VideoRecver.setNextIFrame",this.lastPlayFrameId,this.lastPlayDts,t.key,t.dts),this.lastPlayFrameId=t.key-1,t.isFull&&(this.lastPlayDts=t.dts,this.lastPlaySeq=t.firstPktSeq),this.waitNextIFrame=!1}},{key:"getNeedRangeSeqs",value:function(t,e){var i=this;if(this.lastPlayFrameId>0&&this.chain.size>0)for(var s=this.chain.head;;){var r=s.data;if(r.isFull&&r.dts>=t||(r.isFull||0!==r.urgentResendTimes||(r.urgentResendTimes=1,r.getLostSeqs().forEac
1h(function(t){i.videoPlayer.hasSeq(t)||e.add(t)})),e.size>640)||(s=s.next)===this.chain.head)break}}},{key:"getFrame",value:function(t){var e=Object(n.a)(Object(o.a)(i.prototype),"getFrame",this).call(this,t);return e&&(this.lastPlaySeq=e.firstPktSeq),e}},{key:"getFullSeqMax",value:function(){var t=0;for(this.chain.resetTravel();;){var e=this.chain.travel();if(!e||!e.isFull)break;t=e.lastPktSeq}return t}},{key:"printInfo",value:function(t){var e=this.chain.head,i=0,s=0,r=0,a=0;e&&(i=e.data.key,s=e.data.getMaxSeq());for(var n=0,o=0,u=0;e;){var l=e.data;if(n++,o+=l.pktNum,u+=l.size,e.next===this.chain.head){r=l.key,a=l.getMaxSeq();break}e=e.next}I.log("VideoInfo ".concat(t," frameCnt=").concat(n," pktCnt=").concat(o," hasCnt=").concat(u," firstId=").concat(i," firstSeq=").concat(s," endId=").concat(r," endSeq=").concat(a))}},{key:"printNextFrameInfo",value:function(){this.chain.resetTravel();for(var t=0,e=this.lastPlayDts,i=this.lastPlayFrameId,s=!1;;){var r=this.chain.travel();if(!r)break;if(s||(s=!0,I.log("VideoRecver.printNextFrameInfo nextFrameId=".concat(r.key," firstDts=").concat(r.isFull&&r.getDts()," firstPktNum=").concat(r.pktNum," firstPackets=").concat(r.packets.length," firstLostSeqs=").concat(r.getLostSeqs().toString()))),!r.isFull){I.log("VideoRecver.printNextFrameInfo totalCnt=".concat(this.chain.size," fullCnt=").concat(t," fullDts=").concat(e," fullFrameId=").concat(i," frameDuration=").concat(this.frameDuration),r.key,r.pktNum,r.packets.length,r.getLostSeqs().toString());break}e=r.getDts(),i=r.key,t++}}},{key:"reset",value:function(){Object(n.a)(Object(o.a)(i.prototype),"reset",this).call(this),this.waitNextIFrame=!1,this.codecname="",this.avcConfig=null,this.lastRecvTs=0,this.resetSeqCnt()}}]),i}(a8),ni={MUSIC_MID:1,MUSIC_MID_TIME_LEN:2048e3/44100,MUSIC_MID_128:35,MUSIC_MID_128_TIME_LEN:1024e3/44100,MUSIC_MID_160:36,MUSIC_MID_160_TIME_LEN:1024e3/44100,MUSIC_MID_192:37,MUSIC_MID_192_TIME_LEN:1024e3/44100,MUSIC_MID_48K_MONO:100,MUSIC_MID_48K_STEREO:101,MUSIC_MID_48K_TIME_LEN:1024e3/48e3,VOICE_HIGHER:2,VOICE_HIGHER_TIME_LEN:20,VOICE_HIGHER_FRAME_LEN:882,VOICE_HIGHER_QUALITY1:22,VOICE_HIGHER_QUALITY1_TIME_LEN:20,VOICE_HIGHER_QUALITY1_FRAME_LEN:882,getAudioTimeLen:function(t){switch(t){case this.MUSIC_MID:return this.MUSIC_MID_TIME_LEN;case this.MUSIC_MID_128:return this.MUSIC_MID_128_TIME_LEN;case this.MUSIC_MID_160:return this.MUSIC_MID_160_TIME_LEN;case this.MUSIC_MID_192:return this.MUSIC_MID_192_TIME_LEN;case this.MUSIC_MID_48K_MONO:case this.MUSIC_MID_48K_STEREO:return this.MUSIC_MID_48K_TIME_LEN;case this.VOICE_HIGHER:return this.VOICE_HIGHER_TIME_LEN;default:return this.MUSIC_MID_TIME_LEN}}},ns=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).type=a9.Types.Audio,t}return Object(r.a)(i)}(function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){return Object(s.a)(this,i),e.call(this)}return Object(r.a)(i,[{key:"setData",value:function(t,e,i){this.key=t,this.streamData=e,this.packets.push(i),this.dts=this.getDts(),this.recvTs=this.createTs=g.now(),this.firstPktSeq=this.lastPktSeq=i.seq}},{key:"isFull",get:function(){return!0}}]),i}(a9)),nr=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).type=a9.Types.Audio,t}return Object(r.a)(i,[{key:"getAacConfig",value:function(){return this.isFull?this.packets[0].audioHeader:null}}]),i}(a7),na=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).type="AudioRecver",r.isAudioFrameTimeLenInited=!1,r.audioFrameTimeLen=ni.MUSIC_MID_TIME_LEN,r.isAacCfgChange=!1,r.offset=0,r.lastRecvFrameDts=0,r.lastResendSeq=0,r.lastResendFrameId=0,r.audioCnt=0,r.bigAudioCnt=0,r.aacConfig=null,r}return Object(r.a)(i,[{key:"getLastData",value:function(){var t=Object(n.a)(Object(o.a)(i.prototype),"getLastData",this).call(this);return t.aacConfig=this.aacConfig,t}},{key:"setLastData",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"setLastData",this).call(this,t),this.aacConfig=t.aacConfig}},{key:"resetAudioNum",value:function(){this.audioCnt=0,this.bigAudioCnt=0}},{key:"reset",value:function(){Object(n.a)(Object(o.a)(i.prototype),"reset",this).call(this),this.isAudioFrameTimeLenInited=!1,this.audioFrameTimeLen=ni.MUSIC_MID_TIME_LEN,this.lastRecvFrameDts=0,this.lastPlaySeq=0,this.aacConfig=null,this.lastResendSeq=0,this.lastResendFrameId=0,this.resetAudioNum()}},{key:"recvData",value:function(t){if(t.seq<=this.lastPlaySeq)return 3;var e=g.now(),i=this.videoPlayer.p2pPlayer.G;return 0===i.firstAudioPkgTime&&(i.firstAudioPkgTime=e,I.log("%c[TIME] firstAudioPkgTime="+(e-i.connectVideoTime)+" totalTime="+(e-i.startTime),"color:#A23400;background:#FFF5C2")),this.isAudioFrameTimeLenInited||(this.isAudioFrameTimeLenInited=!0,this.audioFrameTimeLen=ni.getAudioTimeLen(t.codecType),I.log("AudioRecver.recvData codecType="+t.codecType+" aacTimeLen="+this.audioFrameTimeLen)),this.offset=0,this.readAacConfig(t),this.readAacTag(t),2}},{key:"recvDataV2",value:function(t){if(1!=F.closeBigAudio){if(t.frameId<=this.lastPlayFrameId)return tZ.addD
1ata(this.lateChain,{key:t.frameId},Number(F.avHeaderChangeCfg[2])),3;var e=this.chain.getOrNewNode(t.frameId);if(!e)return 4;var i=e.data;if(i||(e.data=i=new nr,tZ.addData(this.recvChain,{key:t.frameId},Number(F.avHeaderChangeCfg[2])),this.bigAudioCnt++),i.addData(t),i.isFull){tZ.addData(this.fullChain,{key:t.frameId,dts:i.dts},Number(F.avHeaderChangeCfg[2]));var s=i.getAacConfig();return this._printAudioFrame(i),this._updateAacConfig(s),this.isAacCfgChange&&(i.aacConfig=s),this.videoPlayer.dtsChecker.isAudioDtsDiffLarge(i.dts),this.checkPlay(i.dts,500),2}return 0}}},{key:"readAacConfig",value:function(t){var e=t.streamData,i=(e[1]<<16)+(e[2]<<8)+e[3];this.offset=11+i+4;var s=e.slice(0,this.offset);this._updateAacConfig(s)}},{key:"_updateAacConfig",value:function(t){this.isAacCfgChange=!1,null===this.aacConfig?(this.aacConfig=t,this.videoPlayer.initAacConfig(t),I.log("AudioRecver.decodeAacConfig aacConfig="+t.slice(-8,-4).toString())):this.aacConfig.toString()!==t.toString()&&(I.warn("AudioRecver.decodeAacConfig aacConfig change, "+this.aacConfig.slice(-8,-4).toString()+" -> "+t.slice(-8,-4).toString()),this.isAacCfgChange=!0,this.aacConfig=t)}},{key:"readAacTag",value:function(t){for(var e,i,s,r=t.streamData,a=this.videoPlayer.isFirstAudio(),n=new DataView(r.buffer),o=r.length,u=this.offset;u<o;)if(e=n.getUint32(u,!0),(i=n.getUint32(u+4,!0))<=this.lastPlayFrameId)u+=e;else{s=r.slice(u+8,u+e),u+=e;var l=new ns;l.setData(i,s,t),tZ.addData(this.fullChain,{key:i,dts:l.dts},Number(F.avHeaderChangeCfg[2])),this.isAacCfgChange&&(l.aacConfig=this.aacConfig),this.audioCnt++,this.chain.put(l),a&&(a=!1,this.videoPlayer.setFirstDTs(0,l.dts)),this.videoPlayer.dtsChecker.isAudioDtsDiffLarge(l.dts),this.checkPlay(l.dts,500),this._printAudioFrame(l),this.lastRecvFrameDts=l.dts}}},{key:"_printAudioFrame",value:function(t){if(1===Number(D._printAudioFrame)){var e=t.dts-this.lastRecvFrameDts;I.debug("%cAudio firstSeq="+t.firstPktSeq+(t.firstPktSeq!==t.lastPktSeq?" lastSeq="+t.lastPktSeq:"")+" frameId="+t.key+" dts="+t.dts+" %c^dts="+e,"color:#090",e>100?"background:#FF9797":"",e>100?"-.-":"")}}},{key:"checkDropFrames",value:function(t){var e=this.chain.peek();if(e&&!e.isFull){var i=this.videoPlayer.getCurrentDts();(this.lastPlayDts<i||this.lastPlayDts-i<800)&&this.startDropFrames(t)}}},{key:"startDropFrames",value:function(t){for(var e=[],i=0,s=this.chain.peek();s&&!s.isFull;)0===i&&(i=s.getMinSeq()),e.push(s.key),this.lastPlaySeq=s.getMaxSeq(),this.lastPlayFrameId=s.key,this.chain.get(),s=this.chain.peek();if(e.length>0){var r=this.getBuffers(this.videoPlayer.msePlayer.getRealFpsAudio()),a=r.recvBuffer,n=r.continueBuffer;I.log("AudioRecver.startDropFrames videoBuffer=".concat(this.videoPlayer.getBufferLen()," recvBuffer=").concat(a," continuedBuffer=").concat(n," frames=").concat(e.join(",")," curDts=").concat(this.videoPlayer.getCurrentDts()," lastPushDts=").concat(this.lastPlayDts," hasFrames=").concat(this.chain.size))}return e.length}},{key:"hasNextFrame",value:function(t){var e=Object(n.a)(Object(o.a)(i.prototype),"hasNextFrame",this).call(this,t);return e||this.videoPlayer.fastOver||1!=F.closeBigAudio||(e=!0),e}},{key:"_getFrameAble",value:function(t,e){var s=Object(n.a)(Object(o.a)(i.prototype),"_getFrameAble",this).call(this,t,e);return s||this.videoPlayer.fastOver||1!=F.closeBigAudio||(s=!0),s}},{key:"getFrame",value:function(t){var e=Object(n.a)(Object(o.a)(i.prototype),"getFrame",this).call(this,t);return e&&(this.lastPlaySeq=e.firstPktSeq),e}},{key:"getNeedRangeSeqs",value:function(t,e,i){if(this.lastPlayFrameId>0&&this.chain.size>0){for(var s=Math.max(this.lastResendFrameId,this.lastPlayFrameId),r=this.chain.head;;){var a=r.data;if(a.key-1>s&&(this.getLostSeqs(a,e,i),s=a.key),e.size>=640||(r=r.next)===this.chain.head)break}this.lastResendFrameId=s}}},{key:"getLostSeqs",value:function(t,e,i){for(var s=Math.max(this.lastResendSeq,this.lastPlaySeq),r=t.getMaxSeq(),a=s;a<r&&(a>this.lastResendSeq&&(i(a)||e.add(a),this.lastResendSeq=a),!(e.size>=640));a++);}},{key:"printNextFrameInfo",value:function(){var t=this.chain.peek(),e="AudioRecver.printNextFrameInfo totalCnt=".concat(this.chain.size," lastPushDts=").concat(this.lastPlayDts," lastFrameId=").concat(this.lastPlayFrameId," lastSeq=").concat(this.lastPlaySeq);t&&(e+=" nextDts=".concat(t.isFull&&t.getDts()," frameId=").concat(t.key," ").concat(t.getSeqs().toString())),I.log(e)}}]),i}(a8),nn=function(){function t(e){Object(s.a)(this,t),this.videoPlayer=e,this.videoRecver=e.videoRecver,this.audioRecver=e.audioRecver,this.urgentBuffer=F.urgentBuffer,this.waitDropVideoFrameId=0,this.waitDropVideoFrameTs=0,this.resendAudioTime=300,this.resendAudioBufTime=1500,this._initConfig()}
1return Object(r.a)(t,[{key:"_initConfig",value:function(){var t=this.videoPlayer.p2pPlayer.info;this.resendAudioTime=Number(O.getCfgValue(F.resendAudioCfg,t.presenterUid,t.linetype,500)),this.resendAudioBufTime=Number(O.getCfgValue(F.resendAudioBufCfg,t.presenterUid,t.linetype,1500)),I.log("RecvProcesser._initConfig resendAudioTime=".concat(this.resendAudioTime,", resendAudioBufTime=").concat(this.resendAudioBufTime))}},{key:"onTimer",value:function(t){var e=this.videoPlayer.msePlayer.getRealFps();0===e&&(e=30);var i=this.videoRecver.getBuffers(e);this.rangeAudio(i,e);var s=this.videoPlayer.dtsChecker.isSync();this.checkAudio(t,s,i),this.checkVideo(t,s)}},{key:"rangeAudio",value:function(t,e){if(t.continueBuffer>=this.resendAudioTime&&this.videoPlayer.getBufferLen()<=this.resendAudioBufTime){var i=this.videoRecver.getFullSeqMax();this.videoPlayer.p2pPlayer.p2pMgr.resendAudio(i)}}},{key:"checkVideo",value:function(t,e){var i=this.videoPlayer.msePlayer.getRealFps()||30;for(this.videoRecver.checkNextIframe(),this.videoPlayer.p2pPlayer.p2pMgr.getLastContinueSeq();;){var s=this.videoPlayer.getBufferLen();if(!this.videoRecver.hasFrame())break;var r=this.videoRecver.getBuffers(i),a=r.recvBuffer,n=r.continueBuffer,o=r.fpsBuffer;if(e&&(this.audioRecver.hasFrame()&&this.videoRecver.lastPlayDts>=this.audioRecver.lastPlayDts||this.audioRecver.lastPlayDts>0&&!this.audioRecver.hasFrame()&&this.videoRecver.lastPlayDts>=this.audioRecver.lastPlayDts&&n<2e3))break;var u=this.videoRecver.peekFrame();if(u.isFull){if(this.videoRecver.isFrameIdContinued(u)){this.pushVideoFrame(u,t);continue}if(this.checkVideoDrop(t,u,s,a,n,o,i))continue}else if(this.checkVideoDrop(t,u,s,a,n,o,i))continue;break}}},{key:"pushVideoFrame",value:function(t,e){this.waitDropVideoFrameTs=0,this.waitDropVideoFrameId=0,this.videoRecver.playFrame(t,e),this.videoPlayer.pushVideoFrame(t)}},{key:"checkVideoDrop",value:function(t,e,i,s,r,a,n){if(i<=this.urgentBuffer&&a>this.videoPlayer.msePlayer.JITTER_BUFLEN)if(0===this.waitDropVideoFrameId)this.waitDropVideoFrameId=e.key,this.waitDropVideoFrameTs=t;else{var o=this.videoRecver.getFramesDisNextIFrame();if(-1!==o&&t-this.waitDropVideoFrameTs>1e3*o/n)return this.waitDropVideoFrameTs=0,this.waitDropVideoFrameId=0,I.log("RecvProcesser.checkVideoDrop urgrent videoBuffer=".concat(i," recvBuffer=").concat(s," continueBuffer=").concat(r," lastFrameId=").concat(this.videoRecver.lastPlayFrameId," lastPushDts=").concat(this.videoRecver.lastPlayDts)),this.videoPlayer.p2pPlayer.p2pMgr.printRangeInfo(),this.videoRecver.startDropFrames(t),!0}return!1}},{key:"checkAudio",value:function(t,e,i){for(var s=this.videoPlayer.msePlayer.getRealFpsAudio(),r=this.videoRecver.getFullSeqMax(),a=this.videoPlayer.getBufferLen(),n=this.videoPlayer.p2pPlayer.p2pMgr.getLastContinueSeq(),o=this.videoPlayer.msePlayer.JITTER_BUFLEN/2;this.audioRecver.hasFrame();){var u=this.audioRecver.peekFrame();if(u.isFull){if(this.audioRecver.isFrameIdContinued(u)||0===s){this.pushAudioFrame(u,t);continue}if(u.lastPktSeq<n-100){I.log("RecvProcesser.checkAudio lastContinuedSeq=".concat(n," dts=").concat(u.dts," lastDts=").concat(this.audioRecver.lastPlayDts," frame.lastPktSeq=").concat(u.lastPktSeq," frameId=").concat(u.key," lastFrameId=").concat(this.audioRecver.lastPlayFrameId)),this.pushAudioFrame(u,t);continue}if(e&&u.lastPktSeq<r&&a<this.urgentBuffer&&this.audioRecver.lastPlayDts-this.videoRecver.lastPlayDts<this.urgentBuffer&&i.continueBuffer>o){I.log("RecvProcesser.checkAudio videoBuffer=".concat(a," videoFullSeqMax=").concat(r," vLastFrameId=").concat(this.videoRecver.lastPlayFrameId," vLastSeq=").concat(this.videoRecver.lastPlaySeq," lastContinuedSeq=").concat(n," dts=").concat(u.dts," lastDts=").concat(this.audioRecver.lastPlayDts," frame.lastPktSeq=").concat(u.lastPktSeq," frameId=").concat(u.key," lastFrameId=").concat(this.audioRecver.lastPlayFrameId," ").concat(JSON.stringify(i)," vLastPushDts=").concat(this.videoRecver.lastPlayDts)),this.pushAudioFrame(u,t),this.videoPlayer.p2pPlayer.p2pMgr.printRangeInfo();continue}if(!e&&u.lastPktSeq<r&&a<this.urgentBuffer){I.log("RecvProcesser.checkAudio not sync videoBuffer=".concat(a," videoFullSeqMax=").concat(r," vLastFrameId=").concat(this.videoRecver.lastPlayFrameId," vLastSeq=").concat(this.videoRecver.lastPlaySeq," lastContinuedSeq=").concat(n," dts=").concat(u.dts," lastDts=").concat(this.audioRecver.lastPlayDts," frame.lastPktSeq=").concat(u.lastPktSeq," frameId=").concat(u.key," lastFrameId=").concat(this.audioRecver.lastPlayFrameId," ").concat(JSON.stringify(i)," vLastPushDts=").concat(this.videoRecver.lastPlayDts)),this.pushAudioFrame(u,t);continue}var l=this.audioRecver.getBuffers(s),d=l.recvBuffer,c=l.continueBuffer,f=l.fpsBuffer;(0===s||a<=this.urgentBuffer)&&(a<=this.urgentBuffer&&I.log("RecvProcesser.checkAudio urgrent videoBuffer=".concat(a," recvBuffer=").concat(d," continueBuffer=").concat(c," fpsBuffer=").concat(f," lastFrameId=").concat(this.audioRecver.lastPlayFrameId," curFrameId=").concat(u.key," seq=").concat(u.lastPktSeq," lastContinuedSeq=").concat(n," lastPushDts=").concat(this.audioRecver.lastPlayDts," curPushDts=").concat(u.dts," videoSeqMax=").concat(this.videoRecver.getFullSeqMax()," ").concat(JSON.stringify(i)," vLastPushDts=").concat(this.videoRecver.lastPlayDts)),this.videoPlayer.p2pPlayer.p2pMgr.printRangeInfo())}else if(this.checkAudioDrop(t,a,s))continue;break}}},{key:"pushAudioFrame",value:function(t,e){this.audioRecver.playFrame(t,e),this.videoPlayer.pushAudioFrame(t)}}
1,{key:"checkAudioDrop",value:function(t,e,i){var s=this.audioRecver.getBuffers(i),r=s.recvBuffer,a=s.continueBuffer,n=s.fpsBuffer;return(e<=this.urgentBuffer&&n>2e3||n>6e3)&&(I.log("RecvProcesser.checkAudioDrop urgrent videoBuffer=".concat(e," recvBuffer=").concat(r," continueBuffer=").concat(a," fpsBuffer=").concat(n," lastFrameId=").concat(this.audioRecver.lastPlayFrameId," lastPushDts=").concat(this.audioRecver.lastPlayDts)),this.audioRecver.startDropFrames(t),!0)}}]),t}(),no=function(){function t(e){Object(s.a)(this,t),this.p2pPlayer=e,this.sliceSpeed=(e.info.curBitrate||500)/1e3*125,this.firstDts=0,this.firstTsStatus=-1,this.fastOver=!1,this.startDts=0,this.startTs=0,this.startSeq=0,this.pushFrames=0,this.lastResendSeq=0,this.lastPlayVideoSeq=0,this.lastPushFrameTimerTs=0,this.frameMaxSeqs=[],this.playSeq=0,this.playedTime=0,this.playtimeDiff=100,this.dtsChecker=new t3,this.videoRecver=new ne(this),this.audioRecver=new na(this),this.downFrameRate=new tY,this.msePlayer=e.mse,this.createMse(),this.metadataTick=new av(e.eventEmitter,this.msePlayer),this.pushVideoFrameBind=this.pushVideoFrame.bind(this),this.pushAudioFrameBind=this.pushAudioFrame.bind(this),this.hasSeqBind=this.hasSeq.bind(this),this.processer=new nn(this)}return Object(r.a)(t,[{key:"dispose",value:function(){I.log("VideoPlayer.dispose"),this.startDts=0,this.startTs=0,this.lastResendSeq=0,this.lastPushFrameTimerTs=0,this.videoRecver.reset(),this.audioRecver.reset(),tP.remove(this.onPushFrameTimer,this)}},{key:"createMse",value:function(){this.videoRecver.reset(),this.audioRecver.reset()}},{key:"resetMse",value:function(){this.startDts=0,this.startTs=0,this.lastResendSeq=0,this.audioRecver.aacConfig=null,this.videoRecver.avcConfig=null,this.lastPushFrameTimerTs=0,tP.remove(this.onPushFrameTimer,this),this.metadataTick.reset(),this.metadataTick.mse=this.msePlayer}},{key:"onVideoStreamData",value:function(t){this.lastRecvSeq=t.seq,2===this.videoRecver.recvData(t)&&(this.downFrameRate.addFrame(),this._onFrameData())}},{key:"onAudioStreamData",value:function(t){this.lastRecvSeq=t.seq,2===this.audioRecver.recvData(t)&&this._onFrameData()}},{key:"onAudioStreamDataV2",value:function(t){this.lastRecvSeq=t.seq,2===this.audioRecver.recvDataV2(t)&&this._onFrameData()}},{key:"_onFrameData",value:function(){if(this.fastOver)this.onPushFrameTimer(g.now());else{this.pushFastFrame();var t=this.getBufferLen();F.useFastTime&&t>=this.msePlayer.JITTER_BUFLEN&&this.p2pPlayer.onFastTimeOver("buffer enough")}}},{key:"onPushFrameTimer",value:function(t,e){0===this.lastPushFrameTimerTs?this.lastPushFrameTimerTs=t:t-this.lastPushFrameTimerTs>=50&&(this.lastPushFrameTimerTs=t,this._onPushFrameTimer(t))}},{key:"_onPushFrameTimer",value:function(t){1==F.recvProcesser?(this.processer.onTimer(t),this.msePlayer.buffered._calc(t,eB),this.p2pPlayer.p2pMgr.setLastPushedFrame(this.videoRecver.lastPlayDts,this.videoRecver.lastPlayFrameId,this.getBufferLen())):(this.videoRecver.checkNextIframe(),this.pushFrame(this.startDts+(t-this.startTs),t),this.msePlayer.buffered._calc(t,eB),this.p2pPlayer.p2pMgr.setLastPushedFrame(this.videoRecver.lastPlayDts,this.videoRecver.lastPlayFrameId,this.getBufferLen()),this.checkRangeSeqs(t))}},{key:"onUpdateLastPlayedFrameId",value:function(t,e){this.setLastPlayVideoSeq(e)}},{key:"hasSeq",value:function(t){return this.p2pPlayer.p2pMgr.hasSeq(t)}},{key:"setLastPlayVideoSeq",value:function(t){this.lastPlayVideoSeq=t,this.p2pPlayer.p2pMgr.setLastPlaySeq(t)}},{key:"checkRangeSeqs",value:function(t){var e=this.startDts+(t-this.startTs),i=e-this.videoRecver.lastPlayDts;if(i>6e3&&this.getBufferLen()<600&&this.videoRecver.checkDropFrames(t),this.audioRecver.checkDropFrames(),this.msePlayer.getBufferLen()<2e3&&this.p2pPlayer.p2pMgr.hasPub()&&this.videoRecver.needUrgendResend(t)&&2!=F.resendMode){var s=new Set;if(this.videoRecver.getNeedRangeSeqs(e,s,this.hasSeqBind),this.audioRecver.getNeedRangeSeqs(e,s,this.hasSeqBind),s.size<640)for(var r=Math.max(this.lastResendSeq,this.videoRecver.lastPlaySeq),a=this.videoRecver.lastPlaySeq+Math.ceil(this.sliceSpeed*i/1e3*.6),n=r;n<a&&(n>this.lastResendSeq&&(this.hasSeq(n)||s.add(n),this.lastResendSeq=n),!(s.size>=640));n++);var o=Array.from(s);o.length>0&&(1===Number(D._printRange)&&I.log("VideoPlayer.checkRangeSeqs time=".concat(i," bufferLen=").concat(this.msePlayer.getBufferLen()," seqCnt=").concat(o.length," firstSeq=").concat(o[0]," endSeq=").concat(o[o.length-1]," size=").concat(this.videoRecver.chain.size," lastRecvSeq=").concat(this.lastRecvSeq," lastPlayDts=").concat(this.videoRecver.lastPlayDts," lastPlayFrameId=").concat(this.videoRecver.lastPlayFrameId)),this.p2pPlayer.p2pMgr.urgentResend(o))}}},{key:"pausedTooLong",value:function(){}},{key:"pushFastFrame",value:function(){!this.fastOver&&(0!==this.firstTsStatus||this.audioRecver.isCanPlay)&&(2!==this.firstTsStatus||this.videoRecver.isCanPlay)&&(1==F.recvProcesser?this.processer.onTimer(g.now()):this.pushFrame(this.firstDts+36e5,g.now()))}},{key:"pushFrame",value:function(t,e){for(;;)if(this.audioRecver.hasNextFrame(e)&&this.audioRecver.lastPlayDts<this.videoRecver.lastPlayDts){if(!this.checkPushFrame(e,this.audioRecver,this.pushAudioFrameBind))break}else if(!this.checkPushFrame(e,this.videoRecver,this.pushVideoFrameBind))break}},{key:"getDtsGap",value:function(){return this.videoRecver.lastPlayDts-this.audioRecver.lastPlayDts}},{key:"isDownEnough",value:function(){return this.downFrameRate.isDownEnough(this.msePlayer.getRealFps())}},{key:"getReasons",value:function(t){var e=this.getReason(this.audioRecver),i=this.getReason(this.videoRecver);return 2===i&&this.audioRecver.hasNextFrame(t)&&this.audioRecver.lastPlayDts<this.videoRecver.lastPlayDts&&this.msePlayer.getBufferLen()>1e3&&(i=4),2===e&&this.audioRecver.lastPlayDts>this.videoRecver.lastPlayDts&&(e=3),{audioReason:e,videoReason:i}}},{key:"getReason",value:function(t){var e=t.chain.peek();return e&&t.lastPlayFrameId>0?e.isFull?e.key-t.lastPlayFrameId>1?1:2:3:0}}
1,{key:"checkPushFrame",value:function(t,e,i){var s=e.getFrame(t);return!!s&&(i(s,t),!0)}},{key:"pushVideoFrame",value:function(t,e){if(t){if(this.addFullFrame(t),t.isKeyFrame){var i=a4.getAvc(t);if(!this.videoRecver.avcConfig||this.videoRecver.avcConfig.toString()!==i.toString()){var s=i.length+4+11,r=31&t.streamData[s];this.videoRecver.avcConfig=i;var a=a4.packAvcFlvTag(t.dts,i,r);this.msePlayer&&this.msePlayer.appendFlv(a)}a4.trimIFrame(t,i.length)}this.videoRecver.avcConfig&&(this.pushFrames++,this.msePlayer&&(this.msePlayer.ctrlBuffer.setCurFrameId(t.key),this.msePlayer.appendFlvTag(t.streamData,t.key)),t.streamData=null,this.onUpdateLastPlayedFrameId(t.id,t.lastPktSeq-1)),t.played=!0}}},{key:"addFullFrame",value:function(t){this.frameMaxSeqs.push({ts:t.dts,seq:t.getMaxSeq()})}},{key:"getPlayingSeq",value:function(){for(var t=this.getCurrentRealTime()+this.playtimeDiff,e=0;e<this.frameMaxSeqs.length&&!(t-this.playedTime<this.playtimeDiff);e++)if(t<this.frameMaxSeqs[e].ts)return this.playSeq=this.frameMaxSeqs[e].seq,this.frameMaxSeqs.splice(0,e),this.playedTime=t,this.playSeq;return this.playSeq}},{key:"pushAudioFrame",value:function(t,e){t&&(this.dtsChecker.isSync()&&t.dts<this.firstDts-this.audioRecver.audioFrameTimeLen||(t.aacConfig&&(I.log("VideoPlayer.playAudio aacConfig change"),this.msePlayer&&this.msePlayer.appendFlv(t.aacConfig),t.aacConfig=null),this.msePlayer.appendFlvTag(t.streamData,t.key),t.streamData=null))}},{key:"getLastData",value:function(){return{firstDts:this.firstDts,firstTsStatus:this.firstTsStatus,videoData:this.videoRecver.getLastData(),audioData:this.audioRecver.getLastData()}}},{key:"setLastData",value:function(t){this.firstDts=t.firstDts,this.firstTsStatus=t.firstTsStatus,this.videoRecver.setLastData(t.videoData),this.audioRecver.setLastData(t.audioData)}},{key:"initAacConfig",value:function(t){this.msePlayer&&this.msePlayer.appendFlv(t)}},{key:"setFirstDTs",value:function(t,e){var i=this.firstTsStatus;i>=t||(I.log("VideoPlayer.setFirstTs status="+i+"->"+t+" firstTs="+e+" jitBufLen="+F.jitBufLen),this.firstDts=e,this.firstTsStatus=t,0===i&&2===t&&(I.info("VideoPlayer.setFirstDTs resetMse"),this.resetMse()),2===t?(this.videoRecver.trimBeforeDts(this.firstDts),this.audioRecver.trimBeforeDts(this.firstDts),this.msePlayer&&this.audioRecver.aacConfig&&this.msePlayer.appendFlv(this.audioRecver.aacConfig)):0===t&&this.audioRecver.trimBeforeDts(this.firstDts))}},{key:"isFirstAudio",value:function(){return this.firstTsStatus<=0}},{key:"onCheckFastTimer",value:function(t,e){this.msePlayer&&e%10==0&&this.msePlayer.onCheckFastTimer(t,e)}},{key:"onCheckTimer",value:function(t,e){this.msePlayer&&this.msePlayer.onCheckTimer(t,e),this.metadataTick.onCheckTimer(t,e)}},{key:"setFastOver",value:function(){I.log("VideoPlayer.setFastOver firstDts",this.firstDts,"videoDts",this.videoRecver.firstFrameDts,this.videoRecver.lastPlayDts,"autioDts",this.audioRecver.firstFrameDts,this.audioRecver.lastPlayDts),this.fastOver=!0,0===this.videoRecver.lastPlayFrameId||0===this.audioRecver.lastPlayFrameId?I.warn("VideoPlayer.setFastOver video||audio lastPlayFrameId=0"):(this.startDts=this.videoRecver.lastPlayDts,this.startTs=g.now(),this.startSeq=this.videoRecver.lastPlaySeq,tP.add(this.onPushFrameTimer,this,20))}},{key:"getCurrentTime",value:function(){return this.msePlayer?this.msePlayer.getCurrentTime():0}},{key:"getCurrentDts",value:function(){return this.msePlayer?this.msePlayer.getCurrentDts():0}},{key:"getCurrentSeiOffsetDts",value:function(){return this.msePlayer?this.msePlayer.getCurrentSeiOffsetDts():0}},{key:"getCurrentRealTime",value:function(){return this.msePlayer.getCurrentRealTime()}},{key:"getBufferLen",value:function(){return this.msePlayer&&this.msePlayer.getBufferLen?this.msePlayer.getBufferLen():0}},{key:"getSegmentsBufferLen",value:function(){return this.msePlayer&&this.msePlayer.getSegmentsBufferLen?this.msePlayer.getSegmentsBufferLen():0}},{key:"getFrameBufferLen",value:function(){return this.msePlayer?this.msePlayer.getFrameBufferLen():0}},{key:"getWaitBufferLen",value:function(){var t=this.videoRecver.getWaitFrames();return t>0&&this.msePlayer.metadata&&this.msePlayer.metadata.fps>0?t/this.msePlayer.metadata.fps*1e3:0}},{key:"getWaitFrameTime",value:function(t){return this.videoRecver.getWaitFrameTime(t)}},{key:"setQuickVideoLen",value:function(t){}}
1,{key:"setPlaybackrateAccess",value:function(t){this.msePlayer&&this.msePlayer.setPlaybackrateAccess(t)}},{key:"getStat",value:function(){var t={recvSeqCnt:this.videoRecver.recvSeqCnt,fullSeqCnt:this.videoRecver.fullSeqCnt,lateSeqCnt:this.videoRecver.lateSeqCnt,lateFrames:this.videoRecver.lateFrames.size,pushFrames:this.pushFrames,parseVideoTagCnt:this.msePlayer.parser.parseVideoTagCnt,parseVideoSucCnt:this.msePlayer.parser.parseVideoSucCnt,remuxVideoCnt:this.msePlayer.remuxVideoCnt,dropFrames:this.videoRecver.dropFrames,playedFrames:this.videoRecver.playedFrames,dtsJumpPauseTimes:this.videoRecver.dtsJumpPauseTimes,skipFramePauseTimes:this.videoRecver.skipFramePauseTimes,forceSkipFrameNums:this.videoRecver.forceSkipFrameNums,playDelayAvg:0,hasFrames:this.videoRecver.chain.size,emptyFrames:this.msePlayer.parser.emptyFrames||0};return this.videoRecver.resetSeqCnt(),this.pushFrames=0,this.msePlayer.parser.parseVideoTagCnt=0,this.msePlayer.parser.parseVideoSucCnt=0,this.msePlayer.remuxVideoCnt=0,this.videoRecver.dropFrames=0,this.videoRecver.playedFrames=0,this.videoRecver.dtsJumpPauseTimes=0,this.videoRecver.skipFramePauseTimes=0,this.videoRecver.forceSkipFrameNums=0,this.msePlayer.parser.emptyFrames=0,t}},{key:"printAVInfos",value:function(){this.videoRecver.printChainInfos(),this.audioRecver.printChainInfos()}},{key:"switchStart",value:function(){I.log("VideoPlayer.switchStart lastPlayFrameId(video=".concat(this.videoRecver.lastPlayFrameId," audio=").concat(this.audioRecver.lastPlayFrameId,") lastPlayDts=(video=").concat(this.videoRecver.lastPlayDts," audio=").concat(this.audioRecver.lastPlayDts,")")),this.videoRecver.reset(),this.audioRecver.reset()}},{key:"getJitterBufferLen",value:function(){return this.msePlayer&&this.msePlayer.JITTER_BUFLEN?this.msePlayer.JITTER_BUFLEN:0}},{key:"getDtsByLostSeq",value:function(t){return this.videoRecver.getDtsByLostSeq(t)}},{key:"printNextFrameInfo",value:function(){this.audioRecver.printNextFrameInfo(),this.videoRecver.printNextFrameInfo()}}]),t}(),nh=new(function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(){var t;return Object(s.a)(this,i),(t=e.call(this)).libName="pcore.js",t.loaded=!1,t.p2pLib=null,t.ON_LOAD="on_load",t.callbacks={onLoaded:t.onLoaded,onError:t.onLoadedError,thisObj:Object(a.a)(t)},t}return Object(r.a)(i,[{key:"isSupport",value:function(){return window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection||window.PeerConnection||window.webkitPeerConnection||window.mozPeerConnection}},{key:"hasLib",value:function(){return null!==window.P2PLib}},{key:"loadLib",value:function(t,e,i){this.hyPlyer=e,t?(i||(i=this.libName,F.platform==L.PLATFORM_TYPE_NAME.wap&&(i="pcore-".concat(F.wapPcoreVer,".js"))),this.loaded?this.trigger(this.ON_LOAD):aV(t,i,this.callbacks)):I.warn("P2PLibProxy.loadLib root none")}},{key:"onLoaded",value:function(){aU(this.libName,this.callbacks),window.P2PLib?(this.loaded=!0,this.p2pLib=new P2PLib({ntp:tb,userInfo:w,roomInfo:null,config:F,TafLink:tC,Timer:is,TimeUtil:g,logger:I,HUYA:d.HUYA,Taf:d.TafBase}),this.trigger(this.ON_LOAD),this.hyPlyer.reportLoadP2PLib(!1)):this.loadP2PLibError()}},{key:"onLoadedError",value:function(){this.loadP2PLibError()}},{key:"loadP2PLibError",value:function(){this.hyPlyer.reportLoadP2PLib(!0)}},{key:"playStream",value:function(t){return this.p2pLib?this.p2pLib.playStream(t):null}},{key:"removeStream",value:function(t){t&&this.p2pLib.removeStream(t)}},{key:"clearPunch",value:function(){this.p2pLib&&this.p2pLib.clearPunch()}},{key:"clearVideo",value:function(){this.p2pLib&&this.p2pLib.clearVideo()}},{key:"inflate",value:function(t,e){if(this.p2pLib)return this.p2pLib.inflate(t,e)}},{key:"hasPcdnSubs",value:function(){return!!this.p2pLib&&this.p2pLib.hasPcdnSubs()}}]),i}(tB)),nu=function(){function t(e){Object(s.a)(this,t),this.p2pPlayer=e}return Object(r.a)(t,[{key:"destroy",value:function(){this.p2pPlayer=null}},{key:"addBytes",value:function(t){this.p2pPlayer.addBytes(t)}},{key:"onNoVideo",value:function(){var t,e;null==(t=this.p2pPlayer)||null==(e=t.eventEmitter)||e.trigger(N.NO_VIDEO)}},{key:"onRestart",value:function(t){var e;null==(e=this.p2pPlayer)||e.onRestart(t)}},{key:"turnToFlv",value:function(t){var e;null==(e=this.p2pPlayer)||e.turnToFlv(t)}},{key:"subError403",value:function(){var t;null==(t=this.p2pPlayer)||t.subError403()}},{key:"setPcdnName",value:function(t,e){var i;null==(i=this.p2pPlayer)||i.setPcdnName(t,e)}},{key:"onSliceData",value:function(t){var e;null==(e=this.p2pPlayer)||e.onSliceData(t)}},{key:"onGetToken",value:function(t){}}
1,{key:"autoReport",value:function(){var t,e;null==(t=this.p2pPlayer)||null==(e=t.eventEmitter)||e.trigger(N.P2P_REPORT)}},{key:"getBufferLen",value:function(){var t;return null==(t=this.p2pPlayer)?void 0:t.bufferLen}},{key:"getCts",value:function(){var t;return Math.min(null==(t=this.p2pPlayer)?void 0:t.ctsMax,500)}},{key:"getDtsByLostSeq",value:function(t){var e;return null==(e=this.p2pPlayer)?void 0:e.getDtsByLostSeq(t)}},{key:"getCurrentDts",value:function(){var t;return null==(t=this.p2pPlayer)?void 0:t.getCurrentDts()}},{key:"printNextFrameInfo",value:function(){var t;null==(t=this.p2pPlayer)||t.printNextFrameInfo()}},{key:"setPcdnIaas",value:function(t){var e,i;null==(e=this.p2pPlayer)||null==(i=e.setPcdnIaas)||i.call(e,t)}}]),t}(),nl=function(){function t(e){Object(s.a)(this,t),this.p2pPlayer=e,this.handler=new nu(e),this.stream=null,this.started=!1,this.fast_bw=0,this.lastPlaySeq=0,this.lastRenderSeq=0,this.fastNum=0,this.fastBuffer=0}return Object(r.a)(t,[{key:"onFastSliceData",value:function(t){this.stream?(this.fast_bw>0&&(this.stream.stat.bw.cdn_total_bw+=this.fast_bw,this.stream.stat.bw.cdn_valid_bw+=this.fast_bw,this.stream.stat.bw.fast_bw+=this.fast_bw,this.fast_bw=0),this.stream.onFastSliceData(t),this.fastNum<100&&(this.fastNum++,100===this.fastNum&&this.checkStart())):this.fast_bw+=t.parent.payload.length+10}},{key:"hasSeq",value:function(t){return!(!this.stream||!this.stream.hasSeq)&&this.stream.hasSeq(t)}},{key:"isSubsReady",value:function(){return!this.stream||!this.stream.isSubsReady||this.stream.isSubsReady()}},{key:"getLastFullSubTs",value:function(){return this.stream&&this.stream.getLastFullSubTs?this.stream.getLastFullSubTs():0}},{key:"setLastContinueSeq",value:function(t){this.stream&&this.stream.setLastContinueSeq&&this.stream.setLastContinueSeq(t)}},{key:"getLastContinueSeq",value:function(){return this.stream&&this.stream.getLastContinueSeq?this.stream.getLastContinueSeq():0}},{key:"getMaxRecvSeq",value:function(){return this.stream&&this.stream.getMaxRecvSeq?this.stream.getMaxRecvSeq():0}},{key:"printRangeInfo",value:function(){this.stream&&this.stream.resender.printResendInfo&&(this.stream.resender.printResendInfo(),this.stream.loaderMgr.printInfo())}},{key:"resendAudio",value:function(t){this.stream&&this.stream.resender.resendAudio&&this.stream.resender.resendAudio(t)}},{key:"hasPub",value:function(){return!this.stream||!this.stream.hasPub||this.stream.hasPub}},{key:"urgentResend",value:function(t){this.stream&&this.stream.urgentResend(t)}},{key:"setLastPushedFrame",value:function(t,e,i,s,r){this.stream&&this.stream.setLastPushedFrame(t,e,i,s,r)}},{key:"setLastPlaySeq",value:function(t){this.lastPlaySeq=t,this.stream&&this.stream.setLastPlaySeq(t)}},{key:"setLastRenderSeq",value:function(t){this.stream&&this.stream.setLastRenderSeq&&this.stream.setLastRenderSeq(t)}},{key:"setDecodeDelay",value:function(t){this.stream&&this.stream.setDecodeDelay&&this.stream.setDecodeDelay(t)}},{key:"loadLib",value:function(){1!=D._closeSub&&(I.log("P2pMgr.loadLib"),nh.on(nh.ON_LOAD,this.onLoadLib,this),nh.loadLib(this.p2pPlayer.info.h5Root,this.p2pPlayer._hyPlayer,this.p2pPlayer.info.p2pLibName))}},{key:"onLoadLib",value:function(){I.log("P2pMgr.onLoadLib"),nh.off(nh.ON_LOAD,this.onLoadLib,this),this.stream||(this.stream=nh.playStream(this.p2pPlayer.info),this.stream&&(this.stream.setLastPlaySeq(this.lastPlaySeq),this.stream.streamHandler=this.handler,this.stream.tsdbUtil=this.p2pPlayer.tsdb,this.stream.tsdbStat=this.p2pPlayer.stat,this.checkUsePcdn()))}},{key:"checkUsePcdn",value:function(){var t=this.p2pPlayer.info;t&&(F.isCloseP2PPcdnUser(t.uid)?I.log("P2pMgr.checkUsePcdn close by uid"):F.isCloseP2PPcdnPid(t.presenterUid)?I.log("P2pMgr.checkUsePcdn close by pid"):this.stream&&this.p2pPlayer.info.hasOwnProperty("usePcdn")&&(this.stream.usePcdn=this.p2pPlayer._checkUsePcdn()))}},{key:"updateConfig",value:function(){this.stream&&this.stream.updateConfig&&this.stream.updateConfig()}},{key:"checkStart",value:function(){this.stream&&this.started&&this.fastNum>=100&&!this._isCloseSub()&&(this.fastBuffer=this.p2pPlayer.getBufferLen(),this.p2pPlayer.onStartP2P(),this.p2pPlayer&&this.p2pPlayer.mse&&(this.p2pPlayer.info.JITTER_BUFLEN=this.p2pPlayer.mse.JITTER_BUFLEN),this.stream.start(this.p2pPlayer.info),this.stream.startSubStream())}},{key:"_isCloseSub",value:function(){if(1==F.closeSub)return!0;
1if(F.closeSubRooms){for(var t=0;t<F.closeSubRooms.length;t++)if(F.closeSubRooms[t]==this.p2pPlayer.info.roomId)return!0}return!1}},{key:"start",value:function(){this.started=!0,this.checkStart()}},{key:"stop",value:function(){I.log("P2PMgr.stop"),this.started=!1,this.fast_bw=0,this.lastPlaySeq=0,this.lastRenderSeq=0,this.fastNum=0,this.fastBuffer=0,this.stopStream()}},{key:"stopStream",value:function(){this.stream&&(nh.removeStream(this.stream),this.stream.streamHandler=null,this.stream=null)}},{key:"onRestart",value:function(){this.fast_bw=0,this.fastNum=0,this.started=!1,this.stream&&this.stream.onRestart()}},{key:"destroy",value:function(){this.stop(),this.p2pPlayer=null,this.handler&&this.handler.destroy(),this.handler=null}},{key:"switchStart",value:function(){this.stop()}},{key:"hasPcdnSubs",value:function(){return!!this.stream&&nh.hasPcdnSubs()}}]),t}(),nd=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).data={act:"webhuyah5qa",uid:0,sid:0,subsid:0,linetype:-1,sendcnt:0,paucount:0,paulength:0,bflength:0,vr:0,httphead:"",rel:"jsscene",ref:location.href,isp2p:1},r.img=null,r.isPaused=!1,r.hasEmptyFrames=!1,r.isFirstReport=!0,r}return Object(r.a)(i,[{key:"send",value:function(){}},{key:"record",value:function(t){this.handlerPlayer.qaStaRecord&&this.handlerPlayer.qaStaRecord(),t.isPaused&&(this.isPaused=!0),this.sendNewMetrics(t)}},{key:"sendFlow",value:function(t){this.record(t)}},{key:"sendNewMetrics",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"sendRecordMetrics",this).call(this);var e=t.pauseCnt,s=(t.pauseTime,t.isPaused),r=t.isPausedWorker,a=t.pauseReason,u=t.forceSkipFrameNums,l=t.isEnd,d=t.pauseWorkerCnt,c=t.isFramePaused,f=this.handlerPlayer.G,p=this.handlerPlayer.p2pStat.getMetrics(),m=this.handlerPlayer.mse;this.handlerPlayer.player&&(m.pauseStat.record(this.stat),m.buffered.record(this.stat),this.rcordCaptureJitter(m.getCaptureStats(!0))),this.stat.setCoreDim(R.DIM_CORE.USER_PROPERTY,L.userProperty.P2P),this.recordPlayStat(),this.reportVideoBadQuality(s,e,l,d,r,c),this.stat.setCoreDim(R.DIM_CORE.VIDEO_BAD_REASON,a),this.stat.setCoreDim(R.DIM_CORE.SIGNAL_USER_PROPERTY,0),this.stat.setComDim(R.DIM_COM.VIDEO_MIN_BUF,m.JITTER_BUFLEN),this.handlerPlayer._hyPlayer&&this.handlerPlayer._hyPlayer.visibility&&this.handlerPlayer._hyPlayer.visibility.setHiddenTimeStat&&this.handlerPlayer._hyPlayer.visibility.setHiddenTimeStat(),this.handlerPlayer.recSysStat.recordHeart(this.stat),this.handlerPlayer.autoMonitor.recordHeartType(),m.avSyncStat.record(this.stat),this.recordC2CDelay(),this.recordAuto(),this.isFirstReport?this.isFirstReport=!1:0===F.statLv[15]&&p.push({sMetricName:J.METRIC.VIDEO_BAD_QUALITY_RATIO,vField:{value:100*!!this.isPaused,pausecnt:e,forceskipframe:u},vDimension:{success:this.tsdb.hasP2P,originalBitrate:+(0===this.handlerPlayer.info.originalBitrate),p2pCooling:+!!w.p2pCooling,topSid:f.sid,reason:a,quality:s||e>0?100:0},vExLog:{cdnip:this.handlerPlayer.getCdnip()}}),this.isPaused=!1,this.hasEmptyFrames=!1;var _={f_params:this.handlerPlayer.pcdnIaasParam,switchInfo:[]};if(this.handlerPlayer.p2pMgr.stream){var y=this.handlerPlayer.p2pMgr.stream,v=y.stat;if(v.record&&v.record(),this.recordMpsStat(y&&y.getMpsSubs?y.getMpsSubs():0),v.subStreamStat){var S=v.subStreamStat.substream_type,T=v.subStreamStat.substream_state;if(S&&T&&S.length===T.length){for(var P=S.length,C="",E=0;E<P;E++)E>0&&(C+=","),C+=S[E]+":"+T[E];this.stat.setCoreDim(R.DIM_COM.SUB_PCDN_STATE,C)}}for(var k in v.bw){var A=v.bw[k];A>0&&this.stat.addCore(k,A)}var D=v.bw.cdn_total_bw,O=v.bw.fast_bw,b=v.bw.patch_bw,M=v.bw.unopend_cp_bw,N=v.bw.noreq_cp_bw,B=v.bw.noreturn_cp_bw,V=v.bw.error_cp_bw,U=v.bw.kicked_cp_bw,x=v.bw.range_total_bw,H=M+N+B+V+U+x+O+b,G=v.bw.taf_gather_bw,W=v.bw.taf_cover_bw,j=v.bw.taf_load_bw,Y=v.bw.taf_unknown_bw,q=G+W+j+Y;for(var K in I.log("QAStat.recordCdnBw, cdnBw=".concat(D,", tafGBw=").concat(G,", tafCBw=").concat(W,", tafLBw=").concat(j,", tafUBw=").concat(Y,", uocBw=").concat(M,", ncbBw=").concat(N,", nrcpBw=").concat(B,", tafPTotalBw=").concat(q," ecBw=").concat(V,", kcBw=").concat(U,", rangeBw=").concat(x,", fastBw=").concat(O,", patchBw=").concat(b,", totalBw=").concat(H)),this._recordSetCore(v.pResend_info),1===F.rtPeerPRN&&this._recordSetCore(v.peer_range_nonode),this._recordSetCore(v.pcdn_data),v.mps_data&&this._recordSetCore(v.mps_data),this._recordSetCore(v.cdn_pull_data),this._recordPcdnWebrtc(v),v.pcdn_rsp){var z=v.pcdn_rsp[K];switch(typeof z){case"string":""!==z&&this.stat.setCoreDim(K,z);break;case"object":var Q=this._getPcdnRspValue(z);""!==Q&&this.stat.setCoreDim(K,Q)}}if(v.sub_change_state){var X=this.getSubChangeState(v.sub_change_state);X.length>
10&&this.stat.setCoreDim(R.DIM_COM.SUB_CHANGE_STATE,X)}for(var $ in v.core)$===R.DIM_COM.STREAM_URL&&sB.setCdnDomain(this.stat,v.core[$],this.handlerPlayer.info.sStreamName),this.stat.setComDim($,v.core[$]);if(v.cdn_sip&&""!=v.cdn_sip&&this.stat.setComDim(R.DIM_COM.CDN_SIP,v.cdn_sip),v.psub_proxy_info){var Z=[];for(var tt in v.psub_proxy_info){var te="";if(v.psub_proxy_info.hasOwnProperty(tt)){var ti=v.psub_proxy_info[tt];te="".concat(tt,":").concat(ti.total_cnt,":").concat(ti.suc_cnt),Z.push(te)}}var ts=Z.join(",");I.log("QAStat.PcdnProxyList.psubProxyInfo: ".concat(ts)),this.stat.setComDim(R.DIM_COM.PSUB_PROXY_INFO,ts)}if(v.sub_state_info&&""!=v.sub_state_info&&(I.log("QAStat.PcdnProxyList.subStateInfo: ".concat(v.sub_state_info)),this.stat.setComDim(R.DIM_COM.SUB_STATA_INFO,v.sub_state_info)),v.qps_info&&(v.qps_info.full_cdn_cnt>0&&this.stat.addCore(R.CORE.FULL_CDN_CNT,v.qps_info.full_cdn_cnt),v.qps_info.sub_cdn_cnt>0&&this.stat.addCore(R.CORE.SUB_CDN_CNT,v.qps_info.sub_cdn_cnt),v.qps_info.patch_cdn_cnt>0&&this.stat.addCore(R.CORE.PATCH_CDN_CNT,v.qps_info.patch_cdn_cnt)),v.cdnpRtts){var tr=0;v.cdnpRtts.forEach(function(t){t>tr&&(tr=t)}),this.recordFrameInfo(v.cdnpRtts,R.DIM_COM.CDNP_RTT),this.stat.setCore(R.DIM_COM.CDNP_RTT_MAX,tr)}for(var ta in v.pcdn_data_state)this.stat.setComDim(ta,v.pcdn_data_state[ta]);v.notReachedPcdnSubs&&v.notReachedPcdnSubs.length>0&&this.stat.setCoreDim("experiment",v.notReachedPcdnSubs.join(",")),v.hasOwnProperty("range_sip_suc_cnt")&&(v.range_sip_suc_cnt>0&&this.stat.setCore(R.CORE.RANGE_SIP_SUC_CNT,v.range_sip_suc_cnt),v.range_sip_dif_cnt>0&&this.stat.setCore(R.CORE.RANGE_SIP_DIF_CNT,v.range_sip_dif_cnt),v.range_req_cnt>0&&this.stat.setCore(R.CORE.RANGE_REQ_CNT,v.range_req_cnt),v.range_rsp_cnt>0&&this.stat.setCore(R.CORE.RANGE_RSP_CNT,v.range_rsp_cnt),v.range_info.connectCnt>0&&this.stat.setCore(R.CORE.RANGE_CONNECT_TIME,parseInt(v.range_info.connectTime/v.range_info.connectCnt)),v.range_info.rspCnt>0&&this.stat.setCore(R.CORE.RANGE_RSP_TIME,parseInt(v.range_info.rspTime/v.range_info.rspCnt))),this.recordSample(!1);var tn=y.getPunchedCnt();window.mpsApi&&window.mpsApi.saveSdkMaxPunchedCnt&&window.mpsApi.saveSdkMaxPunchedCnt(tn),this.stat.setCore(R.CORE.BUFFER_LENGTH,this.handlerPlayer.bufferLen+this.handlerPlayer.frameBufferLen),this.stat.setCore(R.CORE.HAS_PUNCH_NODES,tn),this.stat.setCore(R.CORE.HAS_PUNCH_NODES_SDKV2,y.getPunchedCntSdk?y.getPunchedCntSdk():0),this.stat.setCore(R.CORE.HAS_PUNCH_NODES_WEBV2,y.getPunchedCntWeb?y.getPunchedCntWeb():0),this.stat.setCore(R.CORE.HAS_PUNCH_NODES_MEDIA,y.getPunchedCntMedia?y.getPunchedCntMedia():0),this.stat.setCore(R.CORE.HAS_PUNCH_NODES_SIGNAL,y.getPunchedCntSignal?y.getPunchedCntSignal():0),this.stat.setCore(R.CORE.FORWARD_REJECT_CNT,v.forward_reject_cnt),this.stat.setCoreDim(R.CORE.PUNCHED_UUIDS,y.getPunchedUids?y.getPunchedUids():""),this.setComp(v,R.UPDOWN_INFO.name),this.setComp(v,R.SUB_INFO.name),this.setComp(v,R.PUNCH_INFO.name),this.setComp(v,R.PUNCH_BACK_RET.name),this.setComp(v,R.RESEND_INFO.name),this.setComp(v,R.SUB_RETURN.sub_name),this.setComp(v,R.SUB_RETURN.switch_name),this.setComp(v,R.SUB_RETURN.last_name),this.setComp(v,R.FORCESUB_REASON.name),this.setComp(v,R.NONODE_RETURN.name),this.setComp(v,R.P2P_TCP_TYPE.name),this.setComp(v,R.P2P_TCP_STATE.name),this.setComp(v,R.PCDN_BW_DATA.name);var to=(this.handlerPlayer.p2pMgr.stream.stat.updown_info||{}).downlink_bw||0;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.SPEED,to);var th=[];for(var tu in v.iaas_total_info){var tl="";if(v.iaas_total_info.hasOwnProperty(tu)){var td=v.iaas_total_info[tu];if(tu==this.handlerPlayer.pcdnIaas&&(td+=O),tl+="".concat(tu,":").concat(td),v.iaas_repeat_info.hasOwnProperty(tu)?tl+=":".concat(v.iaas_repeat_info[tu]):tl+=":0",v.iaas_valid_info.hasOwnProperty(tu)){var tc=v.iaas_valid_info[tu];tu==this.handlerPlayer.pcdnIaas&&(tc+=O),tl+=":".concat(tc)}else tl+=":0"}th.push(tl)}0==th.length&&this.handlerPlayer.isPcdnIaas&&th.push("".concat(this.handlerPlayer.pcdnIaas,":").concat(O,":0:").concat(O));var tf=th.join(",");(th.length>0||this.handlerPlayer.isPcdnIaas)&&I.log("QAStat.iaasBwInfo: fullIaasBw:".concat(O)),this.stat.setComDim(R.DIM_COM.IAAS_BW_INFO,tf),_.switchInfo=v.p_iaas_info,this.stat.setComDim(R.DIM_COM.P_IAAS_INFO,JSON.stringify(_)),v.reset()}else{this.stat.addCore(R.CORE.CDN_TOTAL_BW,this.handlerPlayer.p2pMgr.fast_bw),this.stat.addCore(R.CORE.FAST_BW,this.handlerPlayer.p2pMgr.fast_bw);var tp=this.handlerPlayer.p2pMgr.fast_bw;this.handlerPlayer.isPcdnIaas&&(I.log("QAStat.iaasBwInfo: fullIaasBw:".concat(tp)),this.stat.setComDim(R.DIM_COM.IAAS_BW_INFO,"".concat(this.handlerPlayer.pcdnIa
1as,":").concat(tp,":0:").concat(tp))),this.stat.setComDim(R.DIM_COM.P_IAAS_INFO,JSON.stringify(_)),this.handlerPlayer.p2pMgr.fast_bw=0}var tm=this.handlerPlayer.player,t_=m.metadata,ty=t_.recvVideoFps,tv=t_.recvAudioFps;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_RATE,tv),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_RATE,ty);var tS=m.bufStat.getStats(),tg=tS.emptyTime,tT=tS.emptyCnt;if(this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_BUFFER_EMPTY_COUNT,tT),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_BUFFER_EMPTY_TIME,tg),this.recordBaseStat(),this.handlerPlayer.eventEmitter&&this.handlerPlayer.eventEmitter.costUs>0&&this.stat.setComp(R.DIM_H265_SAM.name,"costUs",this.handlerPlayer.eventEmitter.costUs),tm){tm.videoRecver&&(tm.videoRecver.chain&&this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_WAIT_PUSH,tm.videoRecver.chain.size),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_WAIT_GAP,tm.videoRecver.getFrameGap()),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_WAIT_PUSH,tm.videoRecver.getSize())),tm.audioRecver&&(this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_WAIT_GAP,tm.audioRecver.getFrameGap()),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_WAIT_PUSH,tm.audioRecver.getSize())),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_AUDIO_GAP,tm.getDtsGap());var tP=tm.getReasons(g.now());this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_WAIT_REASON,tP.audioReason),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_WAIT_REASON,tP.videoReason)}var tC=m.curVideoDts,tE=m.curAudioDts;this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_DTS,tC),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.AUDIO_DTS,tE),this.handlerPlayer.recordRecvFps(this.stat),m.metadata&&m.metadata.codecname&&this.stat.setComDim(R.DIM_COM.SPHD_TYPE,m.metadata.codecname),F.renderStat[0]&&this.reportAVRenderInfo(m),this.stat.setCompFormat(R.DIM_LINK_SAM.name,":",","),this.stat.setComDim(R.DIM_COM.CDNIP,this.handlerPlayer.getCdnip()),this.stat.setCore(R.DIM_CORE.F_BUF,this.handlerPlayer.p2pMgr.fastBuffer),this.recordAiData(),this.recordMuteData(),Object(n.a)(Object(o.a)(i.prototype),"recordHeart",this).call(this),this.stat.fill(p,l),this.statQps.sendQps(this.tsdb,p,l)}},{key:"_recordPcdnWebrtc",value:function(t){for(var e in this._recordSetCore(t.wr_info),t.wr_cost){var i=t.wr_cost[e];if(i>0){var s=t.wr_cost_cnt["".concat(e,"_cnt")];s>0&&this.stat.setCore(e,Math.floor(i/s))}}}},{key:"_recordSetCore",value:function(t){for(var e in t){var i=t[e];i>0&&this.stat.setCore(e,i)}}},{key:"recordPlayStat",value:function(){var t=null;if(this.handlerPlayer.player&&(t=this.handlerPlayer.player.getStat()),t){this.handlerPlayer.p2pStat.record.dropFrames=t.dropFrames,this.handlerPlayer.p2pStat.record.playedFrames=t.playedFrames,this.handlerPlayer.p2pStat.record.dtsJumpPauseTimes=t.dtsJumpPauseTimes,this.handlerPlayer.p2pStat.record.skipFramePauseTimes=t.skipFramePauseTimes;var e=t.dropFrames;this.handlerPlayer.p2pStat.record.fullFrameRatio=100*(0==e),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.LATE_SEQS,t.lateSeqs),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.LOSS_FRAMES,t.dropFrames),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.PLAY_FRAMES,t.playedFrames),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.DTS_JUMPPAUSE_CNT,t.dtsJumpPauseTimes),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.SKIP_PAUSE_CNT,t.skipFramePauseTimes),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.FULL_RATIO,100*(0==e)),this.stat.setComp(R.FRAME_INFO.name,R.FRAME_INFO.EMPTY_FRAMES,t.emptyFrames),this.stat.setCore(R.VIDEO_LINK.PVSSC,t.recvSeqCnt),this.stat.setCore(R.VIDEO_LINK.PVFSC,t.fullSeqCnt),this.stat.setCore(R.VIDEO_LINK.PVLSC,t.lateSeqCnt),this.stat.setCore(R.VIDEO_LINK.PVLFC,t.lateFrames),this.stat.setCore(R.VIDEO_LINK.PVPFC,t.pushFrames),this.stat.setCore(R.VIDEO_LINK.PVPTC,t.parseVideoTagCnt),this.stat.setCore(R.VIDEO_LINK.PVPAFC,t.parseVideoSucCnt),this.stat.setCore(R.VIDEO_LINK.PVRFC,t.remuxVideoCnt),this.stat.setComp(R.DIM_LINK_SAM.name,R.DIM_LINK_SAM.VIDEO_DROP_FRAMES,t.forceSkipFrameNums)}}},{key:"_getPcdnRspValue",value:function(t){var e=[];for(var i in t)e.push("".concat(i,":").concat(t[i]));return e.join(",")}},{key:"recordSample",value:function(t){this.handlerPlayer.sampleC
1ontroller.recordStat(this.stat,t),this.handlerPlayer.mse.parser.avSample.recordStat(this.stat);var e=this.handlerPlayer.mse;e.parser&&e.parser.avcChangeStat&&e.parser.avcChangeStat.record(this.stat,F.getAvHeaderChangeStat(this.handlerPlayer.info.presenterUid))}},{key:"recordAiData",value:function(){var t=this.handlerPlayer.getAiStat(),e=t.aiP2PCnt,i=t.aiFlvCnt,s=t.aiP2PTimeoutCnt,r=t.aiFlvTimeoutCnt,a=t.aiP2PErrorCnt,n=t.aiFlvErrorCnt,o=t.aiP2PSwitchCnt,u=t.aiFlvSwitchCnt,l=t.aiP2PNotSwitchCnt,d=t.aiFlvNotSwitchCnt,c=t.aiFlvErrorSwitchCnt,f=t.aiFlvErrorNotSwitchCnt,p=t.aiStartP2PCnt,m=t.aiStartFlvCnt;this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_CNT,e),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_CNT,i),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_TIMEOUT_CNT,s),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_TIMEOUT_CNT,r),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_ERROR_CNT,a),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_ERROR_CNT,n),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_SWITCH_CNT,o),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_SWITCH_CNT,u),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_P2P_NOT_SWITCH_CNT,l),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_NOT_SWITCH_CNT,d),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_ERROR_SWITCH_CNT,c),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_FLV_ERROR_NOT_SWITCH_CNT,f),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_START_P2P_CNT,p),this.stat.setComp(R.AI_CONTROL_DATA.name,R.AI_CONTROL_DATA.AI_START_FLV_CNT,m),this.stat.setCompFormat(R.AI_CONTROL_DATA.name,":",",")}},{key:"recordMuteData",value:function(){if(this.handlerPlayer._hyPlayer.getMuteStat){var t=this.handlerPlayer._hyPlayer.getMuteStat().muteData,e=[];t.map(function(t){var i=[];i.push(t.value),i.push(t.type),i.push(t.currentDts),i.push(t.reqKey),i.push(t.begin),i.push(t.end),e.push(i.join(":"))}),this.stat.setCoreDim(R.DIM_COM.MUTE_DATA,e.join(","))}}},{key:"recordC2CDelay",value:function(){var t=this.handlerPlayer.mse.getDelayStat();if(t){for(var e in t.fields)this.stat.setCore(e,t.fields[e]);for(var i in t.dims)this.stat.setCoreDim(i,t.dims[i])}}},{key:"recordAuto",value:function(){var t=this.handlerPlayer.p2pFlvPlayer.ctrlBitrate;t&&(this.stat.setCoreDim(R.DIM_CORE.AUTO_U_REASON,t._switchUpReason),this.stat.setCoreDim(R.DIM_CORE.AUTO_D_REASON,t._switchDownReason))}},{key:"recordH265Frame",value:function(t,e){var i=this;this.stat.setComp(e,"size",t.length),t.map(function(t,s){i.stat.setComp(e,"k"+(s+1),t),i.stat.setCompFormat(e,":",",")})}},{key:"reportAVRenderInfo",value:function(t){var e=t.videoPlayConsuming.getRecvToRenderConsuming(),i=t.videoPlayConsuming.getRecvToPushConsuming(),s=t.videoPlayConsuming.getPushToRenderedConSuming(),r=Math.round(e.max),a=Math.round(e.avg),n=Math.round(i.max),o=Math.round(i.avg),u=Math.round(s.max),l=Math.round(s.avg);r>0&&a>0&&(this.stat.setCore(R.DIM_CORE.VTDMAX,r),this.stat.setCore(R.DIM_CORE.VTDAVG,a),this.stat.setCore(R.DIM_CORE.VRTADEMAX,n),this.stat.setCore(R.DIM_CORE.VRTADE,o),this.stat.setCore(R.DIM_CORE.VATRDEMAX,u),this.stat.setCore(R.DIM_CORE.VATRDE,l));var d=t.audioPlayConsuming.getRecvToRenderConsuming(),c=t.audioPlayConsuming.getRecvToPushConsuming(),f=t.audioPlayConsuming.getPushToRenderedConSuming(),p=Math.round(d.max),m=Math.round(d.avg),_=Math.round(c.max),y=Math.round(c.avg),v=Math.round(f.max),S=Math.round(f.avg);p>0&&m>0&&(this.stat.setCore(R.DIM_CORE.ATDMAX,p),this.stat.setCore(R.DIM_CORE.ATDAVG,m),this.stat.setCore(R.DIM_CORE.ARTADEMAX,_),this.stat.setCore(R.DIM_CORE.ARTADE,y),this.stat.setCore(R.DIM_CORE.AATRDEMAX,v),this.stat.setCore(R.DIM_CORE.AATRDE,S)),t.videoPlayConsuming.clearConsuming(),t.audioPlayConsuming.clearConsuming();var g=t.renderFps.getRecordFps(),T=t.renderFps.statRenderQuality(),P=t.parser.dropFrameDts.getRecrod(),C=t.parser.fps.getRecord(),E=t.parser.fps.getFps();this.stat.setCore(R.DIM_CORE.VRDFPS,g),this.stat.setCore(R.DIM_CORE.VRCFPS,E),this.stat.setCore(R.DIM_CORE.VDF,P),this.stat.setCore(R.DIM_CORE.VRBQ,T),I.log("QAStat.reportAVRenderInfo P2P: video_total_delay_max=",r,"video_total_delay_avg=",a,"video_recv_to_append_delay_max=",n,"video_recv_to_append_delay=",o,"video_append_to_render_delay_max=",u,"video_append_to_render_delay=",l,"audio_total_delay_max=",p,"audio_total_delay_avg=",m,"audio_recv_to_append_delay_max=",_,"audio_recv_to_append_delay=",y,"audio_append_to_render_delay_max=",v,"audio_append_to_render_delay=",S,"video_render_fps=",g,"video_receive_fps=",E,"video_drop_frames=",P,"video_recv_frames=",C)}},{key:"getSubChangeState",value:function(t){var e=[];for(var i in t){var s=t[i],r=[];for(var a in s)r.push("".concat(a,":").concat(s[a]));e.push(i+";"+r.join("|"))}return e.join(",")}},{key:"setComp",value:function(t,e){var i=t[e];for(var s in i){var r=i[s];"number"==typeof r?r>0&&this.stat.setComp(e,s,r):this.stat.setComp(e,s,r)}}}]),i}(iH),nc=function(){function t(e){Object(s.a)(this,t),this.p2pPlayer=e,this.tsdbUtil=e.tsdb,this.stat=e.stat,this.p2pState=-1,this.hasFlow=!1,this.metric=new Map,this.total=new Map,this.metric20=new Map,this.subNodes=new Map,this.playBufLength=0,this.record={resendTimes:0,resendTimeoutCnt:0,resendErrorTimes:0,resendSliceCnt:0,resendRespondCnt:0,resendLateCnt:0,resendMissCnt:0,repeatResendCnt:0,repeatResendSucc:0,repeatResendFail:0,dropFrames:0,playedFrames:0,dtsJumpPauseTimes:0,skipFramePauseTimes:0,fullFrameRatio:0}}return Object(r.a)(t,[{key:"addSubNodes",value:function(t){this.subNodes.set(t,0)}},{key:"add",value:function(t,e){this.hasFlow=!0,this.addValue(this.metric,t,e),this.addValue(this.total,t,e),this.addValue(this.metric20,t,e)}
1},{key:"reset",value:function(){this.hasFlow=!1,this.total.clear(),this.metric.clear(),this.subNodes.clear()}},{key:"reportFlow",value:function(){if(this.hasFlow){this.hasFlow=!1;var t=[];this.fillFlow(t),this.metric.clear(),this.stat.setCoreDim(R.DIM_CORE.USER_PROPERTY,L.userProperty.P2P),this.stat.fill(t,!0),this.tsdbUtil.sendMetrics(t)}}},{key:"getMetrics",value:function(){var t=[];return this.fillLogin(t),1==!Number(D._noP2p)&&(this.fillPunch(t),this.fillPlayRatio(t),this.fillFlow(t),this.fillDetails(t),this.stat.setCore(R.CORE.HAS_PUNCH_NODES,0)),this.metric.clear(),t}},{key:"onCheckTimer",value:function(t,e){e%20==0&&this.p2pPlayer.p2pMgr.stream&&this.p2pPlayer.p2pMgr.stream.printInfo()}},{key:"getOldMetrics",value:function(){return[]}},{key:"fillPlayRatio",value:function(t){}},{key:"fillLogin",value:function(t){}},{key:"fillPunch",value:function(t){}},{key:"fillDetails",value:function(t){}},{key:"fillFlow",value:function(t){}},{key:"addValue",value:function(t,e,i){var s=0;t.has(e)&&(s=t.get(e)),t.set(e,s+i)}},{key:"recordPlayBuf",value:function(){this.playBufLength=this.getMetricValue(t.keys.SERVER_TOTAL_STREAM_FLOW)}},{key:"printLoadFail",value:function(e){if(1==Number(D._printP2PInfo)){var i=this.getMetricValue(t.keys.SERVER_TOTAL_STREAM_FLOW);e?I.warn("åºè§é¢å¤±è´¥ï¼å½åæ¶å°æ°æ®ï¼bufferLength",i):I.warn("åºè§é¢æåï¼å½åæ¶å°æ°æ®ï¼bufferLength",i,"åºè§é¢æ¶BufferLength",this.playBufLength)}}},{key:"getValueFromMap",value:function(t,e){return t.has(e)?t.get(e):0}},{key:"getMetricValue",value:function(t){return this.metric.has(t)?this.metric.get(t):0}}]),t}(),nf=5e3;function np(){return nf++}nc.keys={P2P_TOTAL_STREAM_FLOW:1,P2P_VALID_STREAM_FLOW:2,SERVER_TOTAL_STREAM_FLOW:3,SERVER_VALID_STREAM_FLOW:4,RESEND_SEQ_NUM:7,REAL_UPLINK_STREAM_SUM:8,SUBSCRIBE_TIMEOUT_TIMES:10,SUBSCRIBE_FAILED_TIMES:11,SUBSCRIBE_SUCCESS_TIMES:12,SUBSCRIBE_TOTAL_TIMES:14,INVALID_PACKET_NUM:13,TOTAL_PEER_NODES:22,ACTIVE_PUNCH_NODES:23,PASSIVE_PUNCH_NODES:24,TRY_PUNCH_NUM:29,PUNCH_FAIL_NUM:30,PUNCH_SUC_NUM:31,FORWARD_REJECT_NUM:32,GET_NODES_VALID:np(),GET_NODES_TOTAL:np(),SUB_NODES:np(),CDN_SLICE_SEND_COUNT:85,CDN_SLICE_RECV_COUNT:86,PUNCH_FAIL_HAS_ICE:500,PUNCH_FAIL_NO_ICE:501,RANGE_TOTAL_STREAM_FLOW:502,RANGE_VALID_STREAM_FLOW:503,SLICE_REPEAT_CDN:504,SLICE_REPEAT_P2P:505,PATCH_FLOW:np(),SUB_TIMEOUT_TIMES:np(),SUB_SUC_TIMES:np(),SUB_FAIL_TIMES:np(),SUB_TOTAL_TIMES:np(),SUB_TRY_TIMES:np(),SUB_KICK_TIMES:np(),COMPETE_TIMEOUT_TIMES:np(),COMPETE_SUC_TIMES:np(),COMPETE_FAIL_TIMES:np(),COMPETE_TOTAL_TIMES:np(),DIF_PEER_NUM:np(),FORCE_NO_PEER:np(),FORCE_SUB_END:np(),FORCE_SUB_TIMEOUT:np(),FORCE_SUB_FAIL:np(),FORCE_DEPTH_LARGE:np(),FORCE_SUB_FAIL_SWITCH:np(),FLOW_COMPETE:np(),FLOW_FORCE:np(),FLOW_FIXED:np(),FLOW_SINGLLING:np(),FLOW_DEFAULT:np(),FLOW_FAST:np(),FLOW_SINGLLING_DOWN:np(),FORCE_TIMES:np(),REMOVE_SUB_TIMES:np(),SUB_RES_TOTAL:np(),SUB_FAIL_SUC:np(),SUB_FAIL_STREAM_LIMIT:np(),SUB_FAIL_SLICE_LATE:np(),SUB_FAIL_SLICE_FAST:np(),SUB_FAIL_SLICE_LARGE:np(),SUB_FAIL_EMPTY_PEER_INFO:np(),SUB_FAIL_STREAM_LATE:np(),SUB_FAIL_SUBSCRIBE_UPLINK_NOT_ENOUGHE:np(),SUB_FAIL_SUBSCRIBE_CYCLE:np(),SUB_FAIL_OTHER:np(),SUB_FAIL_KICK_OUT:np(),SUB_FAIL_SELF_WORST:np(),SWITCH_LAST_PUB:np(),SWITCH_STREAM_LIMIT:np(),SWITCH_SLICE_LARGE:np(),SWITCH_SLICE_LATE:np(),SWITCH_SLICE_FAST:np(),SWITCH_EMPTY_PEER_INFO:np(),SWITCH_STREAM_LATE:np(),SWITCH_SUBSCRIBE_UPLINK_NOT_ENOUGH:np(),SWITCH_SUBSCRIBE_CYCLE:np(),SWITCH_KICK_OUT:np(),SWITCH_SELF_WORST:np(),SWITCH_SUC:np(),SWITCH_OTHER:np(),LAST_STREAM_LIMIT:np(),LAST_SLICE_LARGE:np(),LAST_SLICE_LATE:np(),LAST_SLICE_FAST:np(),LAST_STREAM_LATE:np(),LAST_UPLINK:np(),LAST_CYCLE:np(),LAST_KICK:np(),LAST_SELF_WORST:np(),LAST_SUC:np(),LAST_OTHER:np(),DEFAULT_REASON:np(),LEAVE_PING_DIF:np(),LEAVE_RESET:np(),PUNCH_BACK_TIMES:np(),PUNCH_BACK_SUC:np(),PUNCH_BACK_TRY:np(),PUNCH_BACK_RET_SUC:np(),PUNCH_BACK_RET_DIF_STREAM:np(),PUNCH_BACK_RET_CLOSING:np(),PUNCH_BACK_RET_COOLING:np(),PUNCH_BACK_RET_REQUEST:np(),PUNCH_BACK_REJECT:np(),RESEND_FETCH_ERROR:np(),VALID_RET_PRESENTER:np(),VALID_RET_UPLINK:np(),VALID_RET_PULL:np(),VALID_RET_SUBED:np(),VALID_RET_COOLING:np(),VALID_RET_DELAY:np(),VALID_RET_RTT:np(),VALID_RET_BW:np(),VALID_RET_LATE:np(),VALID_RET_FAST:np(),VALID_RET_NONE:np(),CLIENT_TYPE:160,RATE:120};var nm=function(){function t(e,i,r){Object(s.a)(this,t),this.eventEmiter=e,this.stat=i,this.tsdb=r,this.lastTickTime=0,this.catonCheckStart=!0,this.lastCheckerTimeStamp=0,this.visibilityChanged=!1,this.lostVisibility=!1,this.hidden="",this.visibilityChange="",this.handleVisibilityChangeBind=this.handleVisibilityChange.bind(this),this.addVisibilityChange()}return Object(r.a)(t,[{key:"destroy",value:function(){document.removeEventListener(this.visibilityChange,this.handleVisibilityChangeBind,!1),this.eventEmiter=null,this.stat=null,this.tadb=null}},{key:"reset",value:function(){this.lastTickTime=0,this.onRemoveWakeTimeoutChecker()}},{key:"addVisibilityChange",value:function(){void 0!==document.hidden?(this.hidden="hidden",this.visibilityChange="visibilitychange"):void 0!==document.msHidden?(this.hidden="msHidden",this.visibilityChange="msvisibilitychange"):void 0!==document.webkitHidden&&(this.hidden="webkitHidden",this.visibilityChange="webkitvisibilitychange"),document.addEventListener(this.visibilityChange,this.handleVisibilityChangeBind,!1)}},{key:"handleVisibilityChange",value:function(){document[this.hidden]?this.lostVisibility=!0:this.lostVisibility=!1,this.visibilityChange=!0}},{key:"onCheckFastTimer",value:function(t,e){if(0!=this.lastCheckerTimeStamp&&this.catonCheckStart){var i=t-this.lastCheckerTimeStamp;this.onWakeTimeoutTimeout(i)}this.lastCheckerTimeStamp=t}},{key:"startWakeTimeoutChecker",value:function(){this.catonCheckStart=!0}},{key:"onWakeTimeoutTimeout",value:function(t){if(this.lostVisibility||this.visibilityChange)this.visibilityChange=!1;else if(!(t<3e3||t>15e3)){w.p2pCooling=!0,D.p2p_cooling_date=(new Date).getTime();var e=[this.stat.createAct(R.ACT.P2P_COOLING,{str:[S.name,S.version.major]})];this.tsdb.sendMetrics(e),I.log("WakeChecker onWakeTimeoutTimeout large than 3000 cost = "+t),100*Math.random()>99&&this.eventEmiter.trigger(Event.P2P_REPORT)}}},{key:"onWakeTimeoutError",value:function(t){this.onRemoveWakeTimeoutChecker(),I.log("MAIN: ","ERROR",t),I.log("filename:"+t.filename+"-message:"+t.message+"-lineno:"+t.lineno)}},{key:"onRemoveWakeTimeoutChecker",value:function(){this.catonCheckStart=!1,this.lastCheckerTimeStamp=0}}]),t}(),n_=function(){function t(e){Object(s.a)(this,t),this.p2pPlayer=e,this.onBeforeUnloadBind=this.onBeforeUnload.bind(this)}return Object(r.a)(t,[{key:"destroy",value:function(){window.removeEventListener("beforeunload",this.onBeforeUnloadBind),this.p2pPlayer=null}},{key:"start",value:function(){window.addEventListener("beforeunload",this.onBeforeUnloadBind)}},{key:"stop",value:function(){window.removeEventListener("beforeunload",this.onBeforeUnloadBind)}},{key:"onBeforeUnload",value:function(t){this.p2pPlayer&&this.p2pPlayer.stop(1)}}]),t}(),ny=function(){function t(){Object(s.a)(this,t),this.sP2pUrl="",this.domainList=[],this.cdnip="",this.domain="",this.cdnDomain=""}return Object(r.a)(t,[{key:"initDomain",value:function(t,e){this.sP2pUrl=t,this.domainList=e;var i=this.sP2pUrl.match(/\/\/(.+?)\//i);if(this.cdnDomain=i?i[1]:"",this.domainList&&this.domainList.length){I.log("P2PPlayer.initDomain:\n "+this.domainList.join("\n ")),this.domain=this.cdnDomain;var s=this.domainList.shift();s!==this.domain&&(this.cdnip=s,this.sP2pUrl=this.sP2pUrl.replace(/\/\/(.+?)\//,"//"+s+"/"+this.domain+"/"))}return this.sP2pUrl}},{key:"changeDomain",value:function(){if(this.domainList&&""!==this.domain){var t=this.domainList.shift();if(t===this.domain)return this.changeDomain();var e=RegExp("//(.*?)"+this.domain+"/");return t?(this.cdnip=t,I.warn("P2PPlayer change domain to ".concat(t)),this.sP2pUrl=this.sP2pUrl.replace(e,"//"+t+"/"+this.domain+"/")):(I.warn("P2PPlayer change domain to ".concat(this.domain)),this.cdnip="",this.sP2pUrl=this.sP2pUrl.replace(e,"//"+this.domain+"/"),this.domainList=null),t}return null}}]),t}(),nv=function(){function t(e){Object(s.a)(this,t),this.streamName=e,this.lastTokenTime=0,this.antiCode="",this.getTokenInterval=24e4,this.onGetTokenCb=null}return Object(r.a)(t,[{key:"start",value:function(){this.lastTokenTime=g.now(),tP.add(this.onCheckTimer,this,1e4)}},{key:"stop",value:function(){tP.remove(this.onCheckTimer,this)}},{key:"onCheckTimer",value:function(t,e){this.lastTokenTime>0&&t-this.lastTokenTime>=this.getTokenInterval&&this.getToken(t)}},{key:"getToken",value:function(t){this.lastTokenTime=t;var e=new d.HUYA.GetCdnTokenExReq;e.sStreamName=this.streamName,tC.sendWup("liveui","getCdnTokenInfoEx",e,this.onGetToken.bind(this),!0,tC.getRequestId())}},{key:"onGetToken",value:function(t){this.antiCode=t.sFlvToken,this.onGetTokenCb&&this.onGetTokenCb();var e="GetCdnToken.onGetToken",i=t.sFlvToken.match(/wsTime=(.+?)($|\&)/);if(i){var s=1e3*parseInt(i[1],16),r=g.getDateTimeStr(s,!1);e+="\nãwsTimeã"+i[1]+" => "+r}e+="\n"+t.sFlvToken+"\nstreamName"+this.streamName,I.log(e)}}],[{key:"getToken",value:function(t,e){return new Promise(function(i,s){var r=tC.getRequestId(),a=null;(a=new d.HUYA.GetAntiCodeForStreamReq).sStreamName=t,a.tId=e||tC.getUserId();var n=setTimeout(function(){I.log("GetCdnToken.getToken timeout")},5e3);1!=D._isTestAnticodeTimeout&&tC.sendWup("mediauisea","getAntiCodeForStream",a,function(t){clearTimeout(n),i(t)},!0,r)})}}]),t}(),nS=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t,r){var n;return Object(s.a)(this,i),n=e.call(this,t,r),I.log("P2PPlayer(".concat(n._id,") version ").concat(w.version)),n.videoElement=r.videoElement,n.flvHeader=a4.getFlvHeader(),n.G=new a2,n.fastTimerInterval=10,n.restartTimes=0,n.resetProperty(),n.p2pStat=new nc(Object(a.a)(n)),n.qaStat=new nd(Object(a.a)(n)),n.wakeChecker=new nm(t,r.stat,r.tsdb),n.url=null,n.player=null,n.sliceProtoHandler=new d.SliceProtoHandler,n.streamDomain=new ny,n.p2pMgr=new nl(Object(a.a)(n)),n.loaderMgr=new a6(Object(a.a)(n)),n.userClose=new n_(Object(a.a)(n)),n.firstRecvFullStreamFrameTs=0,n.lastRecvFullStreamFrameTs=0,n.fullStreamLoa
1ding=!1,n.startFullStreamTs=0,n.stopFullStreamTs=0,n.isH265=!1,n.turnToFlvParams=null,n.lastSliceTs=0,n.exceptionStat=r.exceptionStat,n.playerType=tQ.P2P,n.askAITimeout=null,n.mse=r.mse,n.anticode=r.anticode,n.p2pDomain="",n.p2p302Domain="",n.isFastOver=!1,n}return Object(r.a)(i,[{key:"getCdnip",value:function(){return this.p2pMgr.stream?this.p2pMgr.stream.stat.core.cdnip:this.streamDomain.cdnip}},{key:"addHandler",value:function(){this.sliceProtoHandler.on(d.ProtoUri.PP2pSliceData,this.onFastSliceData,this)}},{key:"delHandler",value:function(){this.sliceProtoHandler.off(d.ProtoUri.PP2pSliceData,this.onFastSliceData,this)}},{key:"addTimer",value:function(){tP.add(this.onCheckTimer,this,1e3),tP.add(this.onCheckFastTimer,this,this.fastTimerInterval)}},{key:"delTimer",value:function(){tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this)}},{key:"delTimerOnce",value:function(){is.remove(this.playTimeout,this),is.remove(this.onFastTimeOver,this),is.remove(this.onP2PPlayTimeout,this),is.remove(this.reportP2PSwitchFlvReport,this)}},{key:"resetProperty",value:function(){this.loadStream=!1,this.started=!1,this.startTs=0,this.loadTime=0,this.pauseStartTs=0,this.hasEmptyFrames=!1,this.videoStatus=x,this.firstSlicePrinted=!1,this.pauseCnt=0,this.pauseTime=0,this.pauseCnt5=0,this.pauseTime5=0,this.pauseCheckLock=!1,this.loaderErrorTimes=0}},{key:"stop",value:function(){if(I.log("P2PPlayer(".concat(this._id,").stop")),this.turnToFlvParams=null,this.started){var t=g.now();this._sendHeartbeat(t,!0),this._checkMobPaused(t,rF),this.stopPlayer(),this.resetProperty()}this.isEverSuccessPlayed=!1;var e=this.G;e.firstP2POnDataTime=0,e.firstP2PIframeTime=0,this.pauseWorkerCnt=0,this.pauseWorkerTime=0,this.isRenderFpsPause=!1,this.pauseMobCnt=0,this.p2pDomain="",this.p2p302Domain="",Object(n.a)(Object(o.a)(i.prototype),"stop",this).call(this),this.isFastOver=!1}},{key:"destroy",value:function(){this.delHandler(),this.delTimer(),this.delTimerOnce(),this.disposePlayer(),this.wakeChecker&&this.wakeChecker.destroy(),this.wakeChecker=null,this.userClose&&this.userClose.destroy(),this.userClose=null,this.p2pMgr&&this.p2pMgr.destroy(),this.p2pMgr=null,this.loaderMgr&&this.loaderMgr.destroy(),this.loaderMgr=null,this.askAITimeout=null,Object(n.a)(Object(o.a)(i.prototype),"destroy",this).call(this)}},{key:"disposePlayer",value:function(){this.player&&(this.player.dispose(),this.player=null)}},{key:"resetRestart",value:function(){this.loaderMgr&&this.loaderMgr.reset&&this.loaderMgr.reset(),this.disposePlayer(),this.loadStream=!1,this.startTs=0,this.loadTime=0,this.pauseCnt=0,this.pauseTime=0,this.pauseCnt5=0,this.pauseTime5=0,this.pauseStartTs=0,this.firstRecvFullStreamFrameTs=0,this.lastRecvFullStreamFrameTs=0,this.startFullStreamTs=0,this.stopFullStreamTs=0,this.fullStreamLoading=!1,this.pauseCheckLock=!1,this.hasEmptyFrames=!1,this.firstSlicePrinted=!1,this.videoStatus=x,this.loaderErrorTimes=0,this.qaStat.isFirstReport=!0}},{key:"removeTimer",value:function(){tP.remove(this.onCheckTimer,this),tP.remove(this.onCheckFastTimer,this),is.remove(this.playTimeout,this),is.remove(this.onFastTimeOver,this)}},{key:"resetGlobal",value:function(){var t=this.G;t.streamSeqSN=0,t.quickAccessBeginIndex=0,t.quickAccessEndIndex=0,t.quickTime=0,t.exip=0,t.sslUrl="",t.myIp="",t.wanIp="",t.wanPort=0,t.cdnpConnected=0}},{key:"reset",value:function(t){I.group("P2PPlayer(".concat(this._id,").reset")),this.resetRestart(),this.wakeChecker.reset(),this.removeTimer(),this.resetGlobal(),this.p2pMgr.stop(t),this.p2pStat.reset(),I.groupEnd()}},{key:"streamName",get:function(){return this.info?this.info.sStreamName:""}},{key:"hasPicture",get:function(){var t=this.p2pFlvPlayer.isPlaying;return this.h265Proxy.rendering?t=t&&this.p2pFlvPlayer.isWasmH265Playing:this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS&&(t=t&&this.p2pFlvPlayer.webcodecsPlaying),t}},{key:"bufferLen",get:function(){return this.player?this.player.getBufferLen():0}},{key:"frameBufferLen",get:function(){return this.mse&&this.mse.getFrameBufferLen?this.mse.getFrameBufferLen():0}},{key:"ctsMax",get:function(){var t;return(null==(t=this.mse)?void 0:t.getCtsMax())||300}},{key:"getDtsByLostSeq",value:function(t){var e;return null==(e=this.player)?void 0:e.getDtsByLostSeq(t)}},{key:"printNextFrameInfo",value:function(){var t;null==(t=this.player)||t.printNextFrameInfo()}},{key:"start",value:function(t){var e=this;Object(n.a)(Object(o.a)(i.prototype),"start",this).call(this,t),D._sP2PUrl&&(t.sP2pUrl=D._sP2PUrl),this.isH265=this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec,t.isH265=this.isH265,this.stat.filter.addStreamUrl(t.presenterUid,t.lineType),this.stat.setComDim(R.DIM_COM.P2P,R.LIVE_TYPE.P2P),this.stat.setComDim(R.DIM_COM.STREAM_TYPE,2);var s=JSON.stringify(t).replace(/\,/g,"\n").replace(/[\"\{\}]/g,"");if(!(t.sP2pUrl&&t.sStreamName&&t.sFlvUrl&&t.sFlvAntiCode&&void 0!==t.curBitrate&&void 0!==t.lineType))return I.warn("P2PPlayer(".concat(this._id,").start P2Påæ°ä¸å®æ´ï¼è·³è½¬è³FLVï¼\n")+s),void this.turnToFlv(L.turnToFlvReason.P2P_ARGS_ERROR,!0,!0);this.started=!0,this.mse.appendFlv(this.flvHeader),this.info=t,I.log("P2PPlayer(".concat(this._id,").start \n")+s),this.validAntiCode(t.sFlvAntiCode)?this.realStart(t):nv.getToken(t.sStreamName,t.nimoTid).then(function(i){if(i){var s=i.sAntiCode,r=t.sFlvAntiCode,a=new URLSearchParams(t.sFlvAntiCode);
1new URLSearchParams(s).forEach(function(t,e){a.set(e,t)});var n=a.toString();I.log("P2PPlayer(".concat(e._id,").start getToken old=").concat(r," new=").concat(n,", rsp="),i),t.sFlvAntiCode=n}e.realStart(t)})}},{key:"notSdkPlay",value:function(){this._hyPlayer.isBusiStop||0!==Number(F.isAiP2PToFlv)&&(this.getRecSysRsp({info:this.info,type:"p2p",metadata:this.mse?this.mse.metadata:null,reason:L.turnToFlvReason.IS_NOT_FIRST_FETCH,isNotFirstFetch:!0}),this.aiP2PFlvStatus=1,is.once(this.reportP2PSwitchFlvReport,this,2e3))}},{key:"checkPcdnMode",value:function(t,e){Object(n.a)(Object(o.a)(i.prototype),"checkPcdnMode",this).call(this,t,e),this.p2pMgr.checkUsePcdn()}},{key:"_getUsePcdn",value:function(t,e){var i="";e&&(i=e[d.HUYA.EM_PCDN_MODE.E_PcdnMode_P2pHttpSubstream]);var s=+(1===Number(t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_P2pHttpSubstream]));return -1!=F.closePcdnOrigins.indexOf(i)&&(s=0,I.log("P2PPlayer._getUsePcdn not support pcdn_origin!")),s}},{key:"_getPcdnName",value:function(t){var e="";return t&&(e=t[d.HUYA.EM_PCDN_MODE.E_PcdnMode_P2pHttpSubstream]),e}},{key:"realStart",value:function(t){if(this.started){this.businessStartCost=0,this.UIStartCost=0,this.startTimeStamp=Number(t.startTimeStamp)||0,t.noNeedSendVideoLoadTime?this.noNeedSendVideoLoadTime=!0:(this.businessStartCost=Math.floor(t.startTimeStamp>1?(new Date).getTime()-t.startTimeStamp:0),this.noNeedSendVideoLoadTime=!1),t.uistartTs&&t.uistartTs>0&&(this.UIStartCost=Math.floor((new Date).getTime()-t.uistartTs));var e=this.isUseAV1(t);this.isAv1=e,this.startTs=g.now(),I.log("P2PPlayer(".concat(this._id,").startNow"),Date.now(),this.startTs),this.stat.setComDim(R.DIM_COM.ORIGINAL_BITRATE,+(0===t.originalBitrate)),this.stat.setComDim(R.DIM_COM.H265,e?9:+!!this.isH265),this.stat.setComDim(R.DIM_COM.V_DECODEC,e?2:+!!this.isH265),this.eventEmitter&&this.eventEmitter.roomRecordStat&&this.eventEmitter.roomRecordStat.startStream(t.presenterUid,t.lineType,t.curBitrate,this.isH265?"h265":"h264","p2p"),t.isAv1=e,F.initOpens(t.presenterUid,t.lineType,t.uid),this.stat.setComDim(R.DIM_COM.MPS_CROSS,1===F.mpsCross?1:2);var i=this.G;i.isStartFromUrl=!1,Object.assign(i,t),this.isH265&&this.tsdb.sendMetrics([this.stat.createAct(R.ACT.H265_STATUS,{value:[0],str:[0]})]),this.startPlayer(t,e),this.quickAccessVideoOnly(!0),this.userClose.start()}}},{key:"startPlayer",value:function(t,e){I.log("P2PPlayer(".concat(this._id,").startPlayer")),this.updateStatus(x),this.isReportNoPicture=!0,this.lastSliceTs=0,this.p2pDomain="",this.p2p302Domain="",this.info=t,this.started=!0;var s=this.G;s.lineType=t.lineType,s.streamId=this.createStreamId(Number(t.iIsP2PSupport),this.isH265,e),this.streamDomain.initDomain(t.sP2pUrl,t.p2pDomainList?t.p2pDomainList.slice():[]),this.statDomain(),this.loaderMgr.init(this.streamDomain.sP2pUrl,t.sFlvAntiCode,this.isH265),this.player=this.createPlayer(),this.player.needFreeBuffer=t.curBitrate<=F.freeBufferBitrate,this.checkAud(),this.addHandler(),this.addTimer(),is.once(this.playTimeout,this,4e3),is.once(this.onP2PPlayTimeout,this,5500),this.statSwitch.check(t,!1),delete t.pullStreamFrom,this.wakeChecker.startWakeTimeoutChecker(),F.setJitterCfg(this.mse,t.presenterUid,t.curBitrate);var r=t.sP2pUrl.match(/\/\/(.+?)\//i);r.length>=2&&(this.p2pDomain=r[1].split(":")[0],I.log("P2PPlayer.startPlayer.p2pDomain",this.p2pDomain)),Object(n.a)(Object(o.a)(i.prototype),"startPlayer",this).call(this)}},{key:"stopPlayer",value:function(){this.delHandler(),this.delTimer(),this.delTimerOnce(),this.loaderMgr.stop(),this.p2pMgr.stop(),this.disposePlayer(),this.started=!1,clearTimeout(this.askAITimeout)}},{key:"createPlayer",value:function(){return new no(this)}},{key:"validAntiCode",value:function(t){for(var e=t.split("&"),i=e.length,s=0;s<i;s++){var r=e[s].split("="),a=r[0],n=r[1];if("wsTime"===a)return new Date(1e3*parseInt(n,16)).getTime()+24e4>Date.now()}return!1}},{key:"checkAud",value:function(){rV.isNeedAud()?this.mse.setDeleteH264Aud(+(-1!==F.deleteH264Aud.indexOf(this.G.presenterUid))):this.mse.setDeleteH264Aud(0)}},{key:"changeDomain",value:function(){var t=this.streamDomain.changeDomain();return this.statDomain(),t}},{key:"setEnableLowLatency",value:function(t){this.enableLowLatency=t,t&&this.mse&&F.setLowLatency(this.mse)}},{key:"statDomain",value:function(){""===this.streamDomain.cdnip?this.stat.delDim(R.DIM_EXT.CDN_IP):this.stat.setExtDim(R.DIM_EXT.CDN_IP,this.streamDomain.cdnip)}},{key:"recvDataFull",value:function(){this.G.recvDataTime=g.now(),this.eventEmitter.trigger(N.RECV_VIDEO_FRAME),I.log("P2PPlayer(".concat(this._id,").recvDataFull"))}},{key:"getRecvInfo",value:function(){var t=this.G;
1return[t.connectVideoTime>0?t.connectVideoTime-t.startTime:0,t.recvDataTime>0?t.recvDataTime-t.connectVideoTime:0,this.mse.pushVideoStartRenderTime>0?this.mse.pushVideoStartRenderTime-t.startTime:0,this.mse.getVideoFrames(),this.mse.getAudioFrames()]}},{key:"getCurrentTime",value:function(){return this.player?this.player.getCurrentRealTime():0}},{key:"getCurrentDts",value:function(){return this.player?this.player.getCurrentDts():0}},{key:"getCurrentSeiOffsetDts",value:function(){return this.player?this.player.getCurrentSeiOffsetDts():0}},{key:"getFrameData",value:function(){return{pts:this.player?this.player.getCurrentRealTime():0}}},{key:"getBufferLen",value:function(){return this.player?this.player.getBufferLen():0}},{key:"getSegmentsBufferLen",value:function(){return this.player?this.player.getSegmentsBufferLen():0}},{key:"getFrameBufferLen",value:function(){return this.player?this.player.getFrameBufferLen():0}},{key:"getWaitBufferLen",value:function(){return this.player?this.player.getWaitBufferLen():0}},{key:"getWaitFrameTime",value:function(t){return this.player?this.player.getWaitFrameTime(t):0}},{key:"playTimeout",value:function(){var t=0,e=0;this.p2pFlvPlayer.isPlaying?(this.p2pStat.printLoadFail(!1),t=100):(this.p2pStat.printLoadFail(!0),this.p2pStat.p2pState=0,e=this.tsdb.httpError?1:2);var i=[];i.push(this.stat.createAct(R.ACT.P2P_LOAD_VIDEO,{value:[t,e]})),this.tsdb.sendMetrics(i)}},{key:"onRenderTimeout",value:function(){this.started&&!this.p2pFlvPlayer.isPlaying&&(this.printAVInfos(),I.warn("P2PPlayer(".concat(this._id,").onRenderTimeout")),this.loaderErrorTimes++)}},{key:"onP2PPlayTimeout",value:function(t,e){this.p2pFlvPlayer.isPlaying||(this.turnToFlvParams||(this.turnToFlvParams={reason:L.turnToFlvReason.PLAY_TIMEOUT,force:!1,isNotAi:!1}),I.log("P2PPlayer.onP2PPlayTimeout isPlaying=".concat(this.p2pFlvPlayer.isPlaying,", reason=").concat(this.turnToFlvParams.reason)),this.turnToFlv(this.turnToFlvParams.reason,this.turnToFlvParams.force,this.turnToFlvParams.isNotAi))}},{key:"beforeTurnToFlv",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;this.turnToFlvParams={reason:t,force:e,isNotAi:i}}},{key:"turnToFlv",value:function(t){var e=arguments.length>2?arguments[2]:void 0;I.warn("P2PPlayer(".concat(this._id,").turnToFlv reason=").concat(t)),this.getRecSysRsp({info:this.info,type:"p2p",metadata:this.player?this.player.msePlayer.metadata:null,reason:t,isNotAi:e})}},{key:"recSysRspHandler",value:function(t,e,i){if(this.started){var s=i.reason,r=this.p2p302Domain?this.p2p302Domain:this.p2pDomain;if(I.warn("P2PPlayer(".concat(this._id,").recSysRspHandler reason=").concat(s)),!t||e&&e.tRecSysInfo&&1==e.tRecSysInfo.lAction){if(e&&e.tRecSysInfo){var a=e.tRecSysInfo.sActValue;if(i.isNotFirstFetch&&""!=a)try{var n=JSON.parse(O.unescapeHTML(a)).sAiPidsP2PDes.split("|"),o=n[n.length-1];if(I.log("P2PPlayer(".concat(this._id,").recSysRspHandler isTurnToFlv"),o),0==o)return void(this.aiP2PFlvStatus=3);this.aiP2PFlvStatus=2}catch(t){I.warn("P2PPlayer(".concat(this._id,").recSysRspHandler isNotFirstFetch"),t)}}I.warn("P2PPlayer(".concat(this._id,").recSysRspHandler.turnToFlv reason=").concat(s)),this.tsdb.turnToFlvReason=s,this.tsdb.turnToFlvTimes++,-1===[L.turnToFlvReason.IS_NOT_FIRST_FETCH,L.turnToFlvReason.VIDEO_BUFFER_EMPTY,L.turnToFlvReason.NOT_SUPPORT_P2P,L.turnToFlvReason.P2P_ARGS_ERROR,L.turnToFlvReason.NO_DATA_TIMEOUT].indexOf(s)&&this.isReportNoPicture&&this.videoStatus!=U&&(this.sendNoPicture(s),this.isReportNoPicture=!1),this.eventEmitter.trigger(N.P2P_TIMEOUT,{reason:s,domain:r,pcdnIaas:this.pcdnIaas}),this.stop()}else{if(i&&i.isNotFirstFetch)return;I.warn("P2PPlayer(".concat(this._id,").recSysRspHandler fail reason=").concat(s)),this.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN)}}}},{key:"reportP2PSwitchFlvReport",value:function(){var t=1;2===this.aiP2PFlvStatus?t=1:3===this.aiP2PFlvStatus?t=2:1===this.aiP2PFlvStatus&&(t=3),this.tsdb.sendMetrics([this.stat.createAct(R.ACT.AI_P2P_FLV_SWITCH,{value:[t],str:[1]})])}},{key:"setPcdnName",value:function(t,e){null!=t&&this.stat.setComDim(R.DIM_COM.PCDN_ORIGIN,t)}}
1,{key:"quickAccessVideoOnly",value:function(t,e,i){var s=this.G,r=g.now();s.initUseTime(r),this.fullStreamLoading=!0,this.firstRecvFullStreamFrameTs=0,this.lastRecvFullStreamFrameTs=0,this.lastSliceTs=r,s.quickTime=F.p2pQuicktime,s.quickAccessBeginIndex=s.exip=0,t&&this.startFastSample(),this.loadFullStream("quickTime",e,i),this._startContinueBuffer(),sB.setCdnDomain(this.stat,this.loaderMgr.url,this.info.sStreamName)}},{key:"startFastTimer",value:function(){this.isFastOver||(is.once(this.onFastTimeOver,this,Number(F.fastTime)),I.log("P2PPlayer(".concat(this._id,").startFastTimer fastTime=").concat(F.fastTime)))}},{key:"onFastTimeOver",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"timer";this.isFastOver=!0,I.log("P2PPlayer(".concat(this._id,").onFastTimeOver reason=").concat(t," buffer=").concat(this.getBufferLen())),is.remove(this.onFastTimeOver,this),this.player&&this.player.setFastOver&&this.player.setFastOver(),this.p2pMgr.start()}},{key:"updateP2PConfig",value:function(){this.enableLowLatency?F.setLowLatency(this.mse):F.setJitterCfg(this.mse,this.info.presenterUid,this.info.curBitrate),this.p2pMgr.updateConfig(),this.p2pMgr.checkStart()}},{key:"onPausedTooLong",value:function(){this.player&&this.player.pausedTooLong&&this.player.pausedTooLong()}},{key:"onStartP2P",value:function(){if(I.log("P2PPlayer(".concat(this._id,").onStartP2P buffer=").concat(this.getBufferLen())),this.fastSample.setOver(),this.loaderMgr.stopFullStream(),this.fullStreamLoading=!1,this.stopFullStreamTs=g.now(),this.startFullStreamTs&&this.firstRecvFullStreamFrameTs>0){var t=this.lastRecvFullStreamFrameTs-this.firstRecvFullStreamFrameTs-(this.stopFullStreamTs-this.startFullStreamTs);this.player&&this.player.setQuickVideoLen(t)}}},{key:"startP2PUrl",value:function(t){this.info=t;var e=t.p2purl;I.log("P2PPlayer(".concat(this._id,").startP2PUrl ")+e),this.reset(0),this.addHandler(),this.addTimer(),this.info={};var i=this.G;i.isStartFromUrl=!0,this.url=e,this.started=!0,this.startTs=g.now(),i.initUseTime(this.startTs),i.getVPTime=this.startTs,i.connectVpTime=this.startTs,i.connectVideoTime=this.startTs,i.loginTime=this.startTs,this.player=this.createPlayer(),this.loaderMgr.fullLoader.connect(e)}},{key:"onRestart",value:function(t){I.log("%cP2PPlayer(".concat(this._id,").onRestart"),"background:#FFBFFF",t),this.checkSendRestart(t);var e=this.G;if(t===L.restartReason.FLV_TO_P2P||e.isStartFromUrl)e.isStartFromUrl?this.startP2PUrl(this.url):this.start(this.info);else{if(this.restartTimes>=5)return void this.turnToFlv(L.turnToFlvReason.RESTART_TIMES);this.restartTimes++,this.fullStreamLoading=!1,this.firstRecvFullStreamFrameTs=0,this.lastRecvFullStreamFrameTs=0,this.startFullStreamTs=0,this.stopFullStreamTs=0,this.loaderMgr.stopFullStream();var i=null;this.player&&(i=this.player.getLastData()),this.disposePlayer(),this.loadStream=!1,this.p2pMgr.onRestart(),this.started=!0,this.player=this.createPlayer(),i&&this.player.setLastData(i),this.quickAccessVideoOnly(!1),this.startFastTimer()}}},{key:"checkSendRestart",value:function(t){if(t){this.tsdb.restartReason=t,this.tsdb.restartTimes++;var e=!0;if(t===L.restartReason.LOST_SEQ_JUMP||t===L.restartReason.CONNECT){var i=g.now();this.restartStamp>0&&i-this.restartStamp<2e4&&(e=!1),this.restartStamp=i}if(e){var s=[];s.push(this.stat.createAct(R.ACT.P2P_RESTART,{value:[t]})),this.tsdb.sendMetrics(s)}}}},{key:"setPlaybackrateAccess",value:function(t){this.player&&this.player.setPlaybackrateAccess(t)}},{key:"setAutoJitter",value:function(t){this.mse.autoJitter=t}},{key:"setJitter",value:function(t,e,i){this.mse&&this.mse.setJitter(t,e,i)}},{key:"play",value:function(){this.mse.play()}},{key:"pause",value:function(){this.mse.pause()}},{key:"_getCodec",value:function(t,e){var i=e;return 0===e?3===t?i=0:2===t?i=2:1===t&&(i=4):e%100==0?3===t?i=e>8e3?1e3+(e/100|0):400+(e/100|0):2===t?i=e>8e3?4e3+(e/100|0):500+(e/100|0):1===t&&(i=9e3+(e/100|0)):e%10==0&&(3===t?e>0&&(i=2e4+(e/10|0)):2===t?e>0&&(i=3e4+(e/10|0)):1===t&&(i=4e4+(e/10|0))),i}},{key:"createStreamId",value:function(t,e,i){t=t>1?t:0;var s=this.info.sStreamName,r=Number(this.info.iBitRate);-1!==F.useChangeRate.indexOf(Number(this.info.presenterUid))&&(r=F.getChangeBitrate(this.info.presenterUid,this.info.curBitrate)),r=i?this._getCodec(1,r):e?this._getCodec(2,r):this._getCodec(3,r);var a=new d.CdnGroupID;return a.streamName=s,a.codecType=r,a.cdnBrand=t,a}}
1,{key:"loadFullStream",value:function(t,e,i){this.loadStream||(I.log("%cQuickAccess from "+t,"background:#FFBFFF"),this.loadStream=!0,this.startFullStreamTs=0,this.stat.addCore(R.CORE.FULL_CDN_CNT,1),this.loaderMgr.loadFullStream(this.G.quickAccessBeginIndex,e,i))}},{key:"on302",value:function(t){Object(n.a)(Object(o.a)(i.prototype),"on302",this).call(this,t);var e=t.match(/\/\/(.+?)\//i),s=F.p2p302Config;s&&Array.isArray(s)&&0===s[1]||(e&&e.length>1&&(this.info._domain302=e[1]),this.p2p302Domain=e[1].split(":")[0],I.log("P2PPlayer.on302, url=".concat(t,", info.domain302=").concat(this.info._domain302,", p2p302Domain=").concat(this.p2p302Domain)))}},{key:"getDurationTime",value:function(){var t=((this.mse||{}).video||{}).video,e=0;return t&&(e=Math.floor(t.duration||0)),e}},{key:"turnToH264",value:function(t){this.stop(),this.eventEmitter.trigger(N.TURN_TO_H264,{reason:t})}},{key:"turntoH265Wasm",value:function(){this.stop(),this.eventEmitter.trigger(N.TURN_TO_H265_WASM)}},{key:"h265Retry",value:function(){this.stop(),this.eventEmitter.trigger(N.H265_VIDEO_RETRY)}},{key:"turnToMse",value:function(){this.stop()}},{key:"onFastSliceData",value:function(t){var e=this.G;0==e.firstP2POnDataTime&&(e.firstP2POnDataTime=g.now()),this.onSliceData(t),this.p2pMgr.onFastSliceData(t)}},{key:"onSliceData",value:function(t){if(this.started){var e=t.parent.uri===d.ProtoUri.PP2pSliceVideoData,i=t.parent.uri===d.ProtoUri.PP2pSliceAudioData,s=t.parent.uri===d.ProtoUri.PP2pSliceAudioDataV2,r=t.parent.uri===d.ProtoUri.PP2pSliceAudioDataV3;if(i||e||s||r){if(this.lastSliceTs=g.now(),!this.firstSlicePrinted){this.firstSlicePrinted=!0;var a="%cFirst Slice isVideo=".concat(e," seq=").concat(t.parent.seq);I.log(a,"background:#FFBFFF")}this.player&&(e?this.player.onVideoStreamData(t.child):i?this.player.onAudioStreamData(t.child):(s||r)&&this.player.onAudioStreamDataV2(t.child))}}}},{key:"onCheckTimer",value:function(t,e){if(Object(n.a)(Object(o.a)(i.prototype),"onCheckTimer",this).call(this,t,e),e%10==0&&(this.restartTimes=0),this.player&&this.player.onCheckTimer(t,e),this.player){this.p2pStat.onCheckTimer(t,e);var s=this.G;if(s.globalSpeedCalc.calculate(),e%(Number(D._speedPrintRate)||20)==0){var r=s.curBitrate/8,a=this.getGlobalSpeed();I.log("P2PPlayer(".concat(this._id,").onCheckTimer avgSpeed=").concat(a,"KB/s expectSpeed=").concat(r,"KB/s"))}this.lastSliceTs>0&&t-this.lastSliceTs>F.noSliceTimeout?this.turnToFlv(L.turnToFlvReason.NO_DATA_TIMEOUT):(0===this.heart20Ts?this.heart20Ts=t:t-this.heart20Ts>2e4&&(this.heart20Ts=t,this._sendHeartbeat(t,!1),this.checkHiddenStop()),e%300==0&&(this.tsdb.sendMetrics([{sMetricName:J.METRIC.VIDEO_VIDEO_BAD_QUALITY_5M_RATIO,vField:{value:100*(this.pauseCnt5>0)}}]),this.pauseCnt5=0,this.pauseTime5=0))}}},{key:"_sendHeartbeat",value:function(t,e){if(this.player){this._checkPaused(t,e?rF:rw),this._checkPausedWorker(t,e?rF:rw),this._checkMobPaused(t,e?rF:rw),this.loaderErrorTimes,this.loaderErrorTimes=0,this._checkAvcChangeReport(t,this.pauseStartTs>0);var i=this.getBufferLen();this.isShieldStart&&(i+=this.getFrameBufferLen()),this.stat.setCore(R.CORE.PLAY_DELAY,i),this.stat.setCore(R.CORE.FRAME_BUFFER_DELAY,this.getFrameBufferLen()),this.stat.setCore(R.CORE.AUDIO_CNT,this.player.audioRecver.audioCnt),this.stat.setCore(R.CORE.BIG_AUDIO_CNT,this.player.audioRecver.bigAudioCnt),this.player.audioRecver.resetAudioNum();var s=this.pauseStartTs>0;this.qaStat.record({pauseCnt:this.pauseCnt,pauseTime:this.pauseTime,isPaused:s,pauseReason:this.pauseReason,forceSkipFrameNums:0,isEnd:e,isPausedWorker:this.pauseStartWorkerTs>0,pauseWorkerCnt:this.pauseWorkerCnt,pauseWorkerTime:this.pauseWorkerTime,isFramePaused:this.pauseMobCnt>0||this.pauseMobStartTs>0||this.isRenderFpsPause}),this.qaStat.hasEmptyFrames=this.hasEmptyFrames,this.pauseStartTs>0&&this.autoMonitor.setPause(this.pauseStartTs,this.getBufferLen()),this.pauseCnt=0,this.pauseTime=0,this.pauseReason=0,this.pauseWorkerCnt=0,this.pauseWorkerTime=0,this.isRenderFpsPause=!1,this.pauseMobCnt=0}}},{key:"_getBadReason",value:function(t){if(!this.player)return L.BAD_REASONS.UNKNOW;if(!this.p2pMgr.isSubsReady())return L.BAD_REASONS.SUB_LINK;var e=this.p2pMgr.getLastFullSubTs();if(e>0&&t-e>5e3&&!this.player.isDownEnough())return L.BAD_REASONS.DOWN_LINK;var i=this.p2pMgr.stream;if(i){var s=i.stat;if(s.range_miss_ts>0&&t-s.range_miss_ts<1e4)return L.BAD_REASONS.RANGE_MISS;if(s.range_recv_timeout_ts>0&&t-s.range_recv_timeout_ts<1e4)return L.BAD_REASONS.RANGE_RECV_TIMEOUT}return this.player.isDownEnough()?this.player.videoRecver.frameSeqLostTs>0&&t-this.player.videoRecver.frameSeqLostTs<1e4?L.BAD_REASONS.FRAME_SEQ_LOST:this.player.msePlayer.lastJumpBufferTs>0&&t-this.player.msePlayer.lastJumpBufferTs<1e4?L.BAD_REASONS.BUFFER_JUMP:this.player.videoRecver.lastDtsJumpTs>0&&t-this.player.videoRecver.lastDtsJumpTs<1e4?L.BAD_REASONS.TIMESTAMP_JUMP:this.player.videoRecver.lastFrameIdJumpTs>0&&t-this.player.videoRecver.lastFrameIdJumpTs<1e4?L.BAD_REASONS.FRAME_VIDEO_JUMP:this.player.audioRecver.lastFrameIdJumpTs>0&&t-this.player.audioRecver.lastFrameIdJumpTs<1e4?L.BAD_REASONS.FRAME_AUDIO_JUMP:this.player.videoRecver.frameDropTs>0&&t-this.player.videoRecver.frameDropTs<1e4?L.BAD_REASONS.FRAME_DROP:this.getBufferLen()>2e3?L.BAD_REASONS.PERFORMANCE:L.BAD_REASONS.UNKNOW:L.BAD_REASONS.DOWN_LINK}},{key:"onCheckFastTimer",value:function(t,e){this.started&&(this.wakeChecker.onCheckFastTimer(t,e),this.player&&(this.player.onCheckFastTimer(t,e),this.p2pMgr.setLastRenderSeq(this.player.getPlayingSeq())),this.p2pMgr.setDecodeDelay(this.mse.getVideoDecodeDelaySmooth()),!this.pauseCheckLock&&this.pauseStartTs>0&&t-this.pauseStartTs>200&&(this.pauseCheckLock=!0))}},{key:"_autoReportSea",value:function(){1==F.autoReportSea&&this.pauseCnt>0&&this.eventEmitter&&this.eventEmitter.trigger(N.P2P_REPORT,"bad"+this.pauseReason)}},{key:"getGlobalSpeed",value:function(){return Math.round(this.G.globalSpeedCalc.average()/1024)}},{key:"isLowNet",value:function(){var t=this.G.curBitrate/8;return this.getGlobalSpeed()<t-20}},{key:"getMse",value:function(){return this.mse}},{key:"onPlayVideo",value:function(t,e,s,r,a,u,l,d,c){Object(n.a)(Object(o.a)(i.prototype),"onPlayVideo",this).call(this,t,e,s,r,a,u,l),q.delFail(this.stat),this.updateStatus(U),this.stat.setComDim(R.DIM_COM.DPI,e+"*"+s),this.p2pStat.recordPlayBuf(),this.p2pMgr.loadLib(),this.startFastTimer();var f=this.G,p=g.now();0!==this.startTs&&(f.onPlayTime=u,I.log("%c[TIME] P2PPlayer(".concat(this._id,").onPlayVideo onPlayTime=")+(p-f.firstRen
1derTime)+" totalTime="+(p-f.startTime),"color:#A23400;background:#FFF5C2"));var m={video:t,width:e,height:s,hasVideo:r,connectTime:f.connectVideoTime-this.startTs,recvDataTime:f.recvDataTime-this.startTs,canvas:a,delayRemove:this.info._delayRemove,canvas1:d,canvas2:c};if(this.info._delayRemove=!1,m.videoCodec=l,this.eventEmitter.trigger(N.VIDEO_PLAY,m),this.waitRemuxTime=0,this.mse&&this.mse.parser&&0!=this.mse.parser.waitRemuxTime&&(this.waitRemuxTime=this.mse.parser.waitRemuxTime),0!==this.startTs){this.loadTime=p-this.startTs,f.loadedDataTs=p-this._hyPlayer.startTs,f.hyPlayerLoadTs=p-this._hyPlayer.startTs,this.mse&&(f.firstP2PIframeTime=this.mse.parser.decodeIFRTime),I.log("%cP2PPlayer(".concat(this._id,").onPlayVideo w/h=")+e+"/"+s+" loadTime="+this.loadTime,"color:#A23400;background:#FFF5C2"),I.log("%cP2PPlayer(".concat(this._id,").onPlayVideo G.loadedDataTs=")+f.loadedDataTs+" G.hyPlayerLoadTs="+f.hyPlayerLoadTs,"color:#A23400;background:#FFF5C2");var _=this.UIStartCost>0?this.loadTime+this.UIStartCost:0,y=0;this.startTimeStamp>1?y=this.loadTime+this.businessStartCost:1===this.startTimeStamp&&(y=this.loadTime),this.tsdb.sendCdnTime(f,!0,this.waitRemuxTime,y,_,this.mse.videoFirstFrameDecodeCost,this.mse.audioFirstFrameDecodeCost,this.mse.triggerPlayType),this.startTs=0,f.printUseTime()}else I.log("P2PPlayer(".concat(this._id,").onPlayVideo w/h=")+e+"/"+s);this.isEverSuccessPlayed=!0}},{key:"onVideoStop",value:function(t,e){I.log("P2PPlayer(".concat(this._id,").onVideoStop hasVideo=")+e),e&&(this.updateStatus(x),this.eventEmitter.trigger(N.VIDEO_STOP,{video:t,haveVideo:!0}))}},{key:"onSendSeiData",value:function(t){this.eventEmitter.trigger(N.H264_SEI_PLAY,{data:t})}},{key:"onSendScriptVolumeInfo",value:function(t,e){this.eventEmitter.trigger(N.UPDATE_INTERSITY,{uid:t,intensity:e})}},{key:"onPlayerError",value:function(t){var e=this;I.log("P2PPlayer(".concat(this._id,").onPlayerError, needNotify="),t),setTimeout(function(){e._hyPlayer.isBusiStop||t&&(e.tsdb.restartReason=L.restartReason.PLAYER_ERROR,e.eventEmitter.trigger(N.H5_PLAYER_ERROR_IN))},1e3)}},{key:"onErrorEvent",value:function(t){if(Object(n.a)(Object(o.a)(i.prototype),"onErrorEvent",this).call(this,t),3===t.type){var e=this.player&&this.player.getStat(),s=e.dropFrames,r=e.playedFrames;I.log("P2PPlayer(".concat(this._id,") onErrorEvent dropFrames"),s,"playedFrames",r)}var a=[];a.push(this.stat.createAct(R.ACT.P2P_PLAY_FAIL,{value:[t.type,this.bufferLen]})),this.tsdb.sendMetrics(a)}},{key:"updateFrameTs",value:function(t){this.fullStreamLoading&&(0==this.firstRecvFullStreamFrameTs?(this.startFullStreamTs=g.now(),this.firstRecvFullStreamFrameTs=t):t>this.lastRecvFullStreamFrameTs&&(this.lastRecvFullStreamFrameTs=t))}},{key:"printAVInfos",value:function(){this.player&&this.player.printAVInfos(),Object(n.a)(Object(o.a)(i.prototype),"printAVInfos",this).call(this)}},{key:"_switchStart",value:function(t,e){this.loadStream=!1,this.mse.parser.reset(),this.mse.setPushGop(F.pushGop),this.mse.appendFlv(this.flvHeader),this.p2pMgr&&this.p2pMgr.switchStart(),this.player&&this.player.switchStart(),I.groupEnd();var i=this.info;i.isH265=this.isH265=this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec,this.G.streamId=this.createStreamId(Number(i.iIsP2PSupport),this.isH265),this.loaderMgr.init(this.streamDomain.sP2pUrl,this.loaderMgr.antiCode),this.quickAccessVideoOnly(!1,t,e),F.setJitterCfg(this.mse,i.presenterUid,i.curBitrate)}},{key:"_switchDone",value:function(t,e,i){this.p2pMgr.loadLib()}},{key:"subError403",value:function(){this._hyPlayer.isPaidRoom&&null!=this._hyPlayer.payCount403&&(this._hyPlayer.payCount403++,I.log("P2PPlayer(".concat(this._id,".subError403, payCount403=").concat(this._hyPlayer.payCount403)),this._hyPlayer.payCount403>=F.payRoomCfg[1])&&1!=D._testPaid&&this._hyPlayer.stop()}},{key:"setPcdnIaas",value:function(t){I.log("P2PPlayer.setPcdnIaas,pcdnIaas=",t),this.stat&&this.stat.setComDim(R.DIM_COM.PCDN_IAAS,t)}},{key:"sendNoPicture",value:function(t){this._sendVideoNoPicture(t),this._sendVideoNoPictureAll(t)}},{key:"_sendVideoNoPicture",value:function(t){}}
1,{key:"_sendVideoNoPictureAll",value:function(t){var e=this.G,i=e.connectVideoTime-this.startTs,s=e.recvDataTime-this.startTs;if(this.videoLoadTimeSent=!0,!this.hasPicture){var r=0;this.isMse&&(r=this.mse.isMediaSourceOpen?1:2);var a=O.getBrowserHidden();this.isMse&&a&&2==r?I.log("P2PPlayer._sendVideoNoPictureAll browserHidden=".concat(a,", isMediaSourceOpen=").concat(r)):this.tsdb.sendNoPictureTimeAll(99999,i,s,"p2p",t,this.exceptionStat.getStat())}}},{key:"isUsingPcdn",get:function(){return!!this.p2pMgr&&this.p2pMgr.hasPcdnSubs()}}]),i}(rJ),ng=Object(r.a)(function t(e){Object(s.a)(this,t),this.iHEVCBitRate=e.iHEVCBitRate,this.iCodecType=e.iCodecType,this.iBitRate=e.iBitRate,this.bitrate=e.bitrate}),nT=0,nP=function(){function t(e){Object(s.a)(this,t),this._id=nT++,this._callbacks=e,this._timeout=!1,this._destroy=!1,this._timeoutTime=1e3,this._onRspBind=this._onRsp.bind(this)}return Object(r.a)(t,[{key:"destroy",value:function(){this._destroy=!0,this._callbacks=null,tP.remove(this._onTimeout,this)}},{key:"sendP2PFlv",value:function(t){var e=t.info,i=this._getReq(t);i.mAppendInfo.value={streamType:t.type,expVideoFps:t.metadata&&t.metadata.fps||0,expAudioFps:t.metadata&&t.metadata.audioFps||0,codeRate:e.curBitrate,isOriginal:Number(0===e.originalBitrate),line:t.lineType,codeType:t.isH265?"265":"264",sStreamName:e.sStreamName,playType:t.playType,isServer:0,iIsP2PSupport:e.iIsP2PSupport},this._sendReq(i)}},{key:"sendAuto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;this._timeoutTime=e;var i=this._getReq(t);i.mAppendInfo.value=t.appendInfo,this._sendReq(i)}},{key:"_getReq",value:function(t){var e=new d.HUYA.RecSysReq;return e.tId.iAppid=w.appid,e.tId.lUid=w.uid,e.tId.sGuid=w.sGuid,e.tId.sUA="webh5",e.sAnc
1horUid=t.presenterUid,e.sRoomId=t.roomId,e.iScene=t.scene,e.bDebug=0,e}},{key:"_sendReq",value:function(t){var e=Object.assign({},t);I.log("RecSysProxy(".concat(this._id,").sendReq"),t,JSON.stringify(e)),tC.sendWup("mediaui","getMediaRec",t,this._onRspBind,!0,tC.getRequestId(),!0),tP.once(this._onTimeout,this,this._timeoutTime)}},{key:"_onRsp",value:function(t){if(1!=D._testTimeout){tP.remove(this._onTimeout,this);var e=Object.assign({},t);I.log("RecSysProxy(".concat(this._id,").onRsp"),t,JSON.stringify(e)),this._destroy||this._callbacks&&this._callbacks.onRsp(t)}else I.log("RecSysProxy._onRsp _testTimeout=".concat(D._testTimeout))}},{key:"_onTimeout",value:function(){this._callbacks&&this._callbacks.onTimeout&&this._callbacks.onTimeout()}}]),t}(),nC=function(){function t(e){Object(s.a)(this,t),this.ctrlBitrate=e,this.timeLineTs=0,this.sampleTs=0,this.sampleCheckTs=0,this.sampleDts=0,this.sampleCheckDts=0,this.printTs=0,this.printSampleTs=0,this.printSampleDts=0,this.startTs=0,this.startDts=0,this.cnt12=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.ctrlBitrate=null}},{key:"start",value:function(t,e){I.log("EvalBw.start now=".concat(t," dts=").concat(e)),this.startTs=this.timeLineTs=this.sampleTs=this.sampleCheckTs=this.printTs=this.printSampleTs=t,this.startDts=this.printSampleDts=this.sampleCheckDts=this.sampleDts=e,this.cnt12=0}},{key:"stop",value:function(){this.reset()}},{key:"reset",value:function(){I.log("EvalBw.reset"),this.startTs=this.timeLineTs=this.sampleTs=this.sampleCheckTs=this.printTs=this.printSampleTs=0,this.startDts=this.printSampleDts=this.sampleCheckDts=this.sampleDts=0,this.cnt12=0}},{key:"onCheckFastTimer",value:function(t,e){if(this.startTs>0){var i=t-this.timeLineTs;if(i>300){var s=this.sampleTs-this.sampleCheckTs,r=this.sampleDts-this.sampleCheckDts,a=r>0?s/r:2;I.log("EvalBw.onCheckFastTimer eval timeline=".concat(i," costtime=").concat(s," duration=").concat(r," costtime/duration=").concat(a," dts=").concat(this.sampleDts)),a>1.4&&!this._downBwCheck()?this._evalFail():a>1.2&&!this._downBwCheck()?(this.cnt12++,this.cnt12>=2&&this._evalFail()):this.cnt12=0,this.timeLineTs=t,this.sampleCheckTs=t,this.sampleCheckDts=this.sampleDts}}if(Number(D._printEval)>0&&t-this.printTs>Number(D._printEval)&&this.sampleDts>0){var n=t-this.printTs,o=this.sampleTs-this.printSampleTs,u=this.sampleDts-this.printSampleDts;I.log("EvalBw.onCheckFastTimer print timeline=".concat(n," duration=").concat(u," costtime=").concat(o," costtime/duration=").concat(o/u," dts=").concat(this.sampleDts)),this.printTs=t,this.printSampleTs=this.sampleTs,this.printSampleDts=this.sampleDts}}},{key:"_evalFail",value:function(){this.stop(),this.ctrlBitrate.evalFail()}},{key:"_downBwCheck",value:function(){var t=this.sampleTs-this.startTs,e=this.sampleDts-this.startDts;return I.log("EvalBw._downBwCheck costtime=".concat(t," duration=").concat(e," costtime/duration=").concat(t/e," dts=").concat(this.sampleDts)),e>0&&t/e<1.2}},{key:"addSample",value:function(t){var e=g.now();if(0===this.printSampleDts&&(this.printSampleDts=t.ts,this.printTs=this.printSampleTs=e),this.sampleTs=e,this.sampleDts=t.ts,this.startTs>0&&t.key){var i=this._downBwCheck();this.stop(),i?this.ctrlBitrate.evalSuc():this.ctrlBitrate.evalFail()}}}]),t}(),nE=function(){function t(e){Object(s.a)(this,t),this.statSwitch=e,this.type=0,this.startTs=0,this.nextIFrameTs=0,this.connectedTs=0,this.firstVideoPkgTs=0,this.ptsIFrameTs=0,this.endTs=0,this.lastPlayerType=0}return Object(r.a)(t,[{key:"destroy",value:function(){this.statSwitch=null}},{key:"start",value:function(t){var e=t.type,i=t.reason,s=t.playerType;I.log("AutoSeg.start, type=".concat(e,", reason=").concat(i,", playerType=").concat(s)),this.lastPlayerType=s||0,this.statSwitch.sendSwitchAuto([e,i||0]),this.type=e,this.reset(),this.startTs=g.now()}},{key:"nextIFrame",value:function(){this.startTs>0&&(this.nextIFrameTs=g.now())}},{key:"connected",value:function(){this.startTs>0&&(this.connectedTs=g.now())}},{key:"firstVideo",value:function(){this.startTs>0&&(this.firstVideoPkgTs=g.now())}},{key:"ptsIFrame",value:function(){this.startTs>
10&&(this.ptsIFrameTs=g.now())}},{key:"end",value:function(t){var e=t.full,i=t.playerType;if(this.startTs>0){this.endTs=g.now();var s=[this.endTs-this.startTs,this.nextIFrameTs>0?this.nextIFrameTs-this.startTs:-1,this.connectedTs>0&&this.nextIFrameTs>0?this.connectedTs-this.nextIFrameTs:-1,this.firstVideoPkgTs>0&&this.connectedTs>0?this.firstVideoPkgTs-this.connectedTs:-1,this.ptsIFrameTs>0&&this.firstVideoPkgTs>0?this.ptsIFrameTs-this.firstVideoPkgTs:-1,this.ptsIFrameTs>0?this.endTs-this.ptsIFrameTs:-1,i||0,this.lastPlayerType];I.log("AutoSeg.end, result=".concat(s.toString(),", full=").concat(e,", playerType=").concat(i)),this.statSwitch.sendSwitchCost(s,[this.type,e])}this.reset()}},{key:"reset",value:function(){this.startTs=0,this.nextIFrameTs=0,this.connectedTs=0,this.firstVideoPkgTs=0,this.ptsIFrameTs=0,this.endTs=0}}]),t}(),nI=function(){function t(){Object(s.a)(this,t),this._size=0,this._cnt=0,this._index=0,this._map=new Map,this._bufCnt=Number(F.autoCfg.bufCnt),this._sucPer=Number(F.autoCfg.sucPer),this._sucCnt=0,this._contiCnt=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._map&&(this._map.clear(),this._map=null)}},{key:"reset",value:function(){this._cnt=0,this._index=0,this._map.clear(),this._sucCnt=0,this._contiCnt=0}},{key:"setSwitchTime",value:function(t){this.reset(),this._size=t/Number(F.autoCfg.sampleTime)}},{key:"addSample",value:function(t){if(this._cnt++,t?(this._contiCnt++,this._sucCnt++,this._map.set(this._index,1)):(this._contiCnt=0,this._map.set(this._index,0)),this._cnt>this._size){this._cnt--;var e=this._index-this._size,i=this._map.get(e);this._map.delete(e),1===i&&this._sucCnt--}return this._index++,this.isFullSize()&&this.isLastReach()&&this.isPercentReach()}},{key:"isFullSize",value:function(){return this._cnt>=this._size}},{key:"isLastReach",value:function(){return this._contiCnt>=this._bufCnt}},{key:"isPercentReach",value:function(){return this._sucCnt/this._cnt>=this._sucPer}}]),t}(),nk=function(){function t(){Object(s.a)(this,t),this._minTime=Number(F.autoCfg.minTime),this._maxTime=Number(F.autoCfg.maxTime),this._map=new Map}return Object(r.a)(t,[{key:"destroy",value:function(){this._map&&(this._map.clear(),this._map=null)}},{key:"reset",value:function(){I.log("AutoUpGap.reset"),this._map.clear()}},{key:"getMin",value:function(){return this._minTime}},{key:"getGap",value:function(t){return this._map.has(t)||this._map.set(t,this._minTime),this._map.get(t)}},{key:"addFail",value:function(t,e){I.log("AutoUpGap.addFail bitrate=".concat(t," isMin=").concat(e));var i=this.getGap(t);if(!e){var s=Math.min(2*i,this._maxTime);this._map.set(t,s)}}}]),t}(),nA=new Set,nR=new Map,nD=function(){function t(){Object(s.a)(this,t),this._highRate=Number(F.autoCfg.highRate),this._badBuf=Number(F.autoCfg.badBuf),this._badCnt=Number(F.autoCfg.badCnt),this._sList=[],this._sTime=F.autoCfg.badS[0],this._sCnt=F.autoCfg.badS[1],this._lList=[],this._lTime=F.autoCfg.badL[0],this._lCnt=F.autoCfg.badL[1]}return Object(r.a)(t,[{key:"destroy",value:function(){this._sList=null,this._lList=null}},{key:"reset",value:function(){this._sList=[],this._lList=[]}},{key:"getBitrates",value:function(){return Array.from(nA).join(",")}},{key:"hasBitrate",value:function(t){return nA.has(t)}},{key:"addBadQuality",value:function(t,e,i,s){return this._addBadQuality(t,e,i,s,this._sList,this._sTime,this._sCnt)||this._addBadQuality(t,e,i,s,this._lList,this._lTime,this._lCnt)}},{key:"_addBadQuality",value:function(t,e,i,s,r,a,n){if(r.push({now:e,pauseTime:i,bufferLen:s}),r.length>n&&r.shift(),r.length>=n){var o=e-r[0].now;if(o<=a)return I.log("AutoBadQuality._addBadQuality disTime=".concat(o," time=").concat(a," cnt=").concat(n)),this._checkPerformance(t,r),!0}return!1}},{key:"_checkPerformance",value:function(t,e){var i=this;if(t>this._highRate)if(e.some(function(t){return t.bufferLen<i._badBuf})){nR.has(t)||nR.set(t,0);var s=nR.get(t)+1;nR.set(t,s),s>=this._badCnt&&nA.add(t)}else nA.add(t)}}]),t}(),nO={UP_PTS:1,UP_WAIT_IFRAME:2,UP_CONNECT_FAIL:4,UP_CONNECT_SLOW:8,UP_FIRST_FRAME:16,UP_PTS_FRAME:32,BACK_CONNECT_FAIL:64,BACK_PTS:128,EVAL_BEFORE:256,EVAL_AFTER:512,BACK_CONNECT_SLOW:1024,BACK_FIRST_FRAME:2048,BACK_PTS_FRAME:4096,DOWN_NO_IFRAME:8192,DOWN_CONNECT_FAIL:16384,DOWN_PTS:32768,DOWN_CONNECT_SLOW:65536,DOWN_FIRST_FRAME:131072,DOWN_PTS_FRAME:262144,UP_NO_IFRAME:524288},nb=function(){function t(e,i){Object(s.a)(this,t),this._ctrlBitrate=e,this._autoMonitor=i,this._buffer=null,this._startTs=0,this._connectedTs=0,this._firstFrameTs=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._ctrlBitrate=null,this._autoMonitor=null,this._buffer=null}},{key:"buffer",set:function(t){this._buffer=t}},{key:"setStart",value:function(t){this._startTs=g.now(),this._connectedTs=0,this._firstFrameTs=0,t<F.autoBufferScore&&this._ctrlBitrate.isSwitchUp()&&this._autoMonitor.addBadReason(nO.UP_WAIT_IFRAME)}},{key:"setConnected",value:function(){this._connectedTs=g.now(),this._connectedTs-this._startTs>F.autoConnectScore&&(this._ctrlBitrate.isSwitchUp()?this._autoMonitor.addBadReason(nO.UP_CONNECT_SLOW):this._ctrlBitrate.isSwitchDown()?this._autoMonitor.addBadReason(nO.DOWN_CONNECT_SLOW):this._ctrlBitrate.isSwitchBack()&&this._autoMonitor.addBadReason(nO.BACK_CONNECT_SLOW))}},{key:"setFirstFrame",value:function(){this._firstFrameTs=g.now(),this._checkFirstFrame()}},{key:"setFirstVideoTimeout",value:function(){this._connectedTs>0?this._checkFirstFrame():this._ctrlBitrate.isSwitchUp()?this._autoMonitor.addBadReason(nO.UP_CONNECT_FAIL):this._ctrlBitrate.isSwitchDown()?this._autoMonitor.addBadReason(nO.DOWN_CONNECT_FAIL):this._ctrlBitrate.isSwitchBack()&&this._autoMonitor.addBadReason(nO.BACK_CONNECT_FAIL)}},{key:"_checkFirstFrame",value:function(){g.now()-this._connectedTs>F.autoFirstScore&&(this._ctrlBitrate.isSwitchUp()?this._autoMonitor.addBadReason(nO.UP_FIRST_FRAME):this._ctrlBitrate.isSwitchDown()?this._autoMonitor.addBadReason(nO.DOWN_FIRST_FRAME):this._ctrlBitrate.isSwitchBack()&&this._autoMonitor.addBadReason(nO.BACK_FIRST_FRAME))}},{key:"setPtsFrame",value:function(t){this._checkPtsFrame(),t>0&&(this._ctrlBitrate.isSwitchUp()?this._autoMonitor.addBadReason(nO.UP_PTS):this._ctrlBitrate.isSwitchDown()?this._autoMonitor.addBadReason(nO.DOWN_PTS):this._ctrlBitrate.isSwitchBack()&&this._autoMonitor.addBadReason(nO.BACK_PTS))}},{key:"setPtsFrameTimeout",value:function(){this._checkPtsFrame()}},{key:"_checkPtsFrame",value:function(){g.now()-this._firstFrameTs>F.autoPtsScore&&(this._ctrlBitrate.isSwitchUp()?this._autoMonitor.addBadReason(nO.UP_PTS_FRAME):this._ctrlBitrate.isSwitchDown()?this._autoMonitor.addBadReason(nO.DOWN_PTS_FRAME):this._ctrlBitrate.isSwitchBack()&&this._autoMonitor.addBadReason(nO.BACK_PTS_FRAME))}},{key:"setEvalBefore",value:function(t){t<F.autoBufferScore&&this._autoMonitor.addBadReason(nO.EVAL_BEFORE)}},{key:"setEvalAfter",value:function(t){t<F.autoBufferScore&&this._autoMonitor.addBadReason(nO.EVAL_AFTER)}},{key:"setNoIFrame",value:function(){this._buffer&&this._buffer.isWaitForIFrame()&&
1(this._ctrlBitrate.isSwitchUp()?this._autoMonitor.addBadReason(nO.UP_NO_IFRAME):this._ctrlBitrate.isSwitchDown()&&this._autoMonitor.addBadReason(nO.DOWN_NO_IFRAME))}},{key:"reset",value:function(){this._startTs=0,this._connectedTs=0,this._firstFrameTs=0}}]),t}(),nw={NONE:0,H264ToH264:1,H264ToH265:2,H265ToH264:3,H265ToH265:4},nL=function(){function t(e,i){var r=e.player,a=e.statSwitch,n=e.autoMonitor,o=e.recSysStat;Object(s.a)(this,t),this._player=r,this._statSwitch=a,this._autoMonitor=n,this._recSysStat=o,this._callbacks=i,this._seg=new nE(a),this._badStat=new nb(this,n),this._buffer=null,this._curBitrate=0,this._lastBitrate=0,this._startBitrate=0,this._sessionId=0,this._maxBitrate=0,this._originalMaxBitrate=0,this._minBitrate=0,this._bitrateList=[],this._allBitratebps="",this._switchSampleTime=Number(F.autoCfg.sampleTime),this._switchUpGap=Number(F.autoCfg.upGap),this._switchDownGap=Number(F.autoCfg.downGap),this._switchBackGap=Number(F.autoCfg.backGap),this._nextReqInterval=Number(F.recSysExpiredTime),this._firstRecSysTime=Number(F.autoCfg.sysTime),this._switchUpPer=Number(F.autoCfg.upPer),this._switchDownPer=Number(F.autoCfg.downPer),this._switchDownNowPer=Number(F.autoCfg.downNowPer),this._switchWaitPer=Number(F.autoCfg.waitPer),this._switchDownBitrate=Number(F.autoCfg.downBitrate),this._beforeSwitchCb=null,this._mse=null,this._evalBw=new nC(this),this._switchNextTime=0,this._switchSampleTs=0,this._upGap=new nk,this._switchUpSample=new nI,this._badRate=new nD,this._switchUpReason=0,this._switchDownReason=0,this._switchType=nw.NONE,this._switchOver=!1,this._evalOver=!1,this._started=!1,this._nextRecSysTs=0,this._switchState=0,this._recSysProxy=null,this._badQualityCoderatebps=[],this._recSysExpiredTime=0,this._visibilityState=L.VISIBILITY_STATE.VISIBLE,this._onRecSysBind=this._onRecSys.bind(this),this._onRecSysDownTimeoutBind=this._onRecSysDownTimeout.bind(this),this._onRecSysIntervalTimeoutBind=this._onRecSysIntervalTimeout.bind(this),this._onVisibilityChangeBind=this._onVisibilityChange.bind(this),this._switchUpSample.setSwitchTime(this._upGap.getMin()),this.closeAuto=2===Number(D.openAuto),this.switchStartTime=0}return Object(r.a)(t,[{key:"destroy",value:function(){this._player=null,this._statSwitch=null,this._autoMonitor=null,this._recSysStat=null,this._callbacks=null,this._seg&&this._seg.destroy(),this._seg=null,this._badStat&&this._badStat.destroy(),this._badStat=null,this._bitrateList=null,this._evalBw&&this._evalBw.destroy(),this._evalBw=null,this._upGap&&this._upGap.destroy(),this._upGap=null,this._switchUpSample&&this._switchUpSample.destroy(),this._switchUpSample=null,this._badRate&&this._badRate.destroy(),this._badRate=null,this._badQualityCoderatebps=null}},{key:"switchType",get:function(){return this._switchType},set:function(t){this._switchType=t}},{key:"beforeSwitchCb",set:function(t){this._beforeSwitchCb=t}},{key:"lastBitrate",get:function(){return this._lastBitrate}},{key:"curBitrate",get:function(){return this._curBitrate}},{key:"isSwitchUp",value:function(){return 1===this._switchState}},{key:"isSwitchDown",value:function(){return 3===this._switchState}},{key:"isSwitchBack",value:function(){return 4===this._switchState}},{key:"start",value:function(t,e){var i=this;if(!this._started)if(t){I.log("CtrlBitrate.start",JSON.stringify(e)),this._mse=t;var s=t.ctrlBuffer;s.setEval(this._evalBw),s.callbacks=this._callbacks,this._buffer=s,this._badStat.buffer=s,this._sessionId=e.sessionId,this._curBitrate=e.curBitrate,this._maxBitrate=e.startBitrate,3===Number(F.isWebAutoAB)&&(this._maxBitrate=F.maxBitRate),this._originalMaxBitrate=this._maxBitrate,this._startBitrate=e.startBitrate,this._bitrateList=[],this._minBitrate=Number.MAX_SAFE_INTEGER;var r=[];e.bitrateList.forEach(function(t){i._bitrateList.push(new ng(t)),r.push(1e3*t.bitrate),i._minBitrate=Math.min(i._minBitrate,t.bitrate)}),this._allBitratebps=r.join(","),this._bitrateList.sort(function(t,e){return t.bitrate>e.bitrate?-1:1}),this._start()}else I.warn("CtrlBitrate.start waring mse")}},{key:"_start",value:function(){I.log("CtrlBitrate._start started=".concat(this._started," bitrates=").concat(this._bitrateList.length," mse=").concat(!!this._mse)),this._mse&&this._bitrateList.length>0&&!this._started&&(this._started=!0,this._player.eventEmitter.on(N.VISIBILITY_CHANGE,this._onVisibilityChangeBind),this._switchNextTime=g.now()+5e3,tP.add(this._onCheckFastTimer,this,100),tP.once(this._firstReqAuto,this,1e3+10*Math.floor(Math.random()*this._firstRecSysTime/10)),this._onVisibilityChange())}},{key:"_onVisibilityChange",value:function(){I.log("CtrlBitrate._onVisibilityChange old=".concat(this._visibilityState," new=").concat(document.visibilityState)),this._visibilityState!==L.VISIBILITY_STATE.VISIBLE&&document.visibilityState===L.VISIBILITY_STATE.VISIBLE&&(this._switchSampleTs=0,this._switchUpSample.reset()),this._visibilityState=document.visibilityState}},{key:"_firstReqAuto",value:function(){I.log("CtrlBitrate._firstReqAuto"),this._reqAutoRecSys(1,this._onRecSysIntervalTimeoutBind)}},{key:"stop",value:function(){I.log("CtrlBitrate.stop"),this._mse=null,this._buffer=null,this._started=!1,this._switchState=0,this._switchType=nw.NONE,this._switchUpReason=0,this._switchDownReason=0,this._badQualityCoderatebps=[],this._recSysExpiredTime=0,this._switchNextTime=0,this._switchTarget=null,this._curBitrate=0,this._lastBitrate=0,this._nextRecSysTs=0,this._bitrateList=[],this._evalBw.stop(),this._switchUpSample.reset(),this._upGap.reset(),this._badRate.reset(),this._destroyRecSys(),this._player.eventEmitter.off(N.VISIBILITY_CHANGE,this._onVisibilityChangeBind),tP.remove(this._onCheckFastTimer,this),tP.remove(this._firstReqAuto,this),this.switchStartTime=0}},{key:"pause",value:function(){this._buffer.pause()}},{key:"_sendSwitchStat",value:function(t){var e=this._buffer.switchTs.getMetric(),i=e.values,s=e.strs;this._buffer.switchTs.resetPtsSample(),i[3]=this._seg.type,s[2]=t,this._statSwitch.sendSwitchPts(i,s),this._seg.end({full:t,playerType:this._player._type})}},{key:"switchBitrate",value:function(t){this._curBitrate!==t&&(0!==this._curBitrate&&I.log("CtrlBitrate.switchBitrate from=".concat(this._curBitrate," to=").concat(t," buffer=").concat(this._mse.getBufferLen())),this._switchOver=!1,this._lastBitrate=this._curBitrate,this._curBitrate=t,this._buffer.switchBitrate(3===this._switchState,this._lastBitrate,this._curBitrate))}},{key:"switchBack",value:function(t){if(this.switchStartTime=0,0!==this._switchState&&this._lastBitrate<this._curBitrate){this._upGap.addFail(this._lastBitrate,this._curBitrate===this._minBitrate),this._evalBw.stop(),this._sendSwitchStat(3===t?1:2),this._seg.start({type:3,reason:t,playerType:this._player._type}),this._switchState=4,I.log("CtrlBitrate.switchBack from=".concat(this._curBitrate," lastBitrate=").concat(this._lastBitrate," reason=").concat(t," buffer=").concat(this._mse.getBufferLen()));for(var e=this._bitrateList.length,i=0;i<e;i++){var s=this._bitrateList[i];if(s.bitrate===this._lastBitrate){var r=this._getDownInfo(i+1,e);r&&r.bitrate>=this._switchDownBitrate&&(s=r),I.log("CtrlBitrate.switchBack to=".concat(s.bitrate)),this._beforeSwitchCb&&this._beforeSwitchCb(s),this._buffer.switchBack();break}}}}},{key:"startEval",value:function(t){if(1===this._switchState){var e=this._mse.getBufferLen();I.log("CtrlBitrate.switchDone start eval buffer=".concat(e)),this._badStat.setEvalBefore(e),this._switchState=6,this._switchUpReason=9,this._evalOver=!1,this._evalBw.start(g.now(),t)}}},{key:"evalSuc",value:function(){var t=this._mse.getBufferLen();I.log("CtrlBirate.evalSuc buffer=".concat(t)),this._badStat.setEvalAfter(t);var e=g.now();this._switchNextTime>e?this._switchNextTime+=this._switchUpGap:this._switchNextTime=e+this._switchUpGap,this._evalOver=!0,this._resetProperties(),this._sendSwitchStat(1),this._setPlaybackrate(!1),this._switchUpSample.setSwitchTime(this._upGap.getGap(this._curBitrate))}},{key:"evalFail",value:function(){var t=this._mse.getBufferLen();I.log("CtrlBirate.evalFail buffer=".concat(t)),this._badStat.setEvalAfter(t),this._switchUpReason=10,this._evalOver=!0,this.switchBack(3)}},{key:"_resetProperties",value:function(){this._evalOver&&this._switchOver&&(this._switchState=0,this._switchType=nw.NONE,this._switchUpReason=0,this._switchDownReason=0)}},{key:"switchDone",value:function(t){this._switchOver=!0;var e=this._mse.getBufferLen();I.log("CtrlBitrate.switchDone buffer=".concat(e," switchType=").concat(this._switchType," switchNextGap=").concat(t));var i=g.now();if(this._switchNextTime=i+t,6===this._switchState&&(this.switchStartTime=i),3===this._switchState||4===this._switchState){this._evalBw.reset(),this._sendSwitchStat(1),3===this._switchState?(this._switchUpReason=0,this._switchDownReason=0,this._switchNextTime+=this._switchDownGap,this._switchState=0,this._switchType=nw.NONE,this._setPlaybackrate(!1)):(this._switchState=5,this._switchNextTime+=this._switchBackGap);var s=this._upGap.getGap(this._curBitrate);I.log("CtrlBitrate.switchDone switchTime=".concat(s)),this._switchUpSample.setSwitchTime(s)}else this._resetProperties();this._buffer.play()}},{key:"_setPlaybackrate",value:function(t){var e=this._mse.getBufferLen(),i=Number(F.autoCfg.slow);i=e>3e3?.95:e>2e3?.9:.85,this._mse.setPlaybackRate(t?i:1),this._mse.autoBitrateJitter=t}},{key:"_switchUp",value:function(t){if(t||(t=this._curBitrate),this._curBitrate<this.maxBitrate){if(0===this._switchState){for(var e=null,i=this._bitrateList.length-1;i>=0;i--){var s=this._bitrateList[i];if(s.bitrate>t&&!this._badRate.hasBitrate(s.bitrate)&&s.bitrate<=this.maxBitrate&&!this._isBadBitrate(s.bitrate)){e=s;break}}if(e){if(this._player&&this._player.getIsEnableAuto&&!this._player.getIsEnableAuto(e))return void(this._switchUpReason=11);I.log("CtrlBitrate._switchUp suc"),this._setPlaybackrate(!0),this._seg.start({type:1,playerType:this._player._type}),this._switchState=1,this._beforeSwitchCb&&this._beforeSwitchCb(e),this._autoMonitor.start(1,this.switchType)}else this._bitrateList[0].bitrate>this.maxBitrate?this._switchUpReason=7:this._switchUpReason=6}}else this._switchUpReason=5}}
1,{key:"addBadQuality",value:function(t,e,i){t=t||g.now(),I.log("CtrlBitrate.addBadQuality started=".concat(this._started," switchState=").concat(this._switchState)),this._started&&0===this._switchState&&this._badRate.addBadQuality(this._curBitrate,t,e,i)&&(this._badRate.reset(),I.log("CtrlBitrate pause down!"),this._switchDownBefore())}},{key:"_switchDownBefore",value:function(){if(0!==Number(F.autoDownTimer)){var t=this._bitrateList[this._bitrateList.length-1].bitrate;this._curBitrate>t&&(this._switchState=2,1===Number(F.sdkCloseAutoAi)||2===Number(F.isWebAutoAB)||3===Number(F.isWebAutoAB)?this._switchDown():this._reqAutoRecSys(2,this._onRecSysDownTimeoutBind))}}},{key:"_switchDown",value:function(t){var e=g.now();F.autoCfg&&0!=this.switchStartTime&&e-this.switchStartTime<F.autoCfg.noRederTime&&this._upGap.addFail(this._lastBitrate,this._curBitrate===this._minBitrate),t||(t=this._curBitrate),this.switchStartTime=0;for(var i=this.badQualityCoderatebps,s=this._bitrateList.length,r=null,a=0;a<s;a++){var n=this._bitrateList[a];if(n.bitrate<t&&!this._isBadBitrate(n.bitrate)){if(n.bitrate===this._minBitrate||n.bitrate<=this._switchDownBitrate)r=n;else{var o=this._getDownInfo(a+1,s);r=!o||o.bitrate<this._switchDownBitrate?n:o}break}}if(r){if(this._player&&this._player.getIsEnableAuto&&!this._player.getIsEnableAuto(r))return void(this._switchDownReason=5);I.log("CtrlBitrate._switchDown suc"),this._setPlaybackrate(!0),this._seg.start({type:2,playerType:this._player._type}),this._switchState=3,this._beforeSwitchCb&&this._beforeSwitchCb(r),this._autoMonitor.start(2,this.switchType)}else{I.log("CtrlBitrate._switchDown fail bad_host=".concat(this._badRate.getBitrates()," bad_svr=").concat(i.join(",")));var u=this._bitrateList[s-1];-1!==i.indexOf(1e3*u.bitrate)?this._switchDownReason=3:this._badRate.hasBitrate(u.bitrate)&&(this._switchDownReason=4)}}},{key:"_isBadBitrate",value:function(t){return -1!==this.badQualityCoderatebps.indexOf(1e3*t)||this._badRate.hasBitrate(t)}},{key:"_getDownInfo",value:function(t,e){return null}},{key:"_onRecSysDownTimeout",value:function(){I.log("CtrlBitrate._onRecSysTimeout"),this._nextRecSysTs=g.now()+this.nextReqInterval,this._destroyRecSys(),this._switchDown()}},{key:"_onCheckFastTimer",value:function(t,e){if(this._evalBw.onCheckFastTimer(t,e),5===this._switchState)this._fillBuf();else if(this._visibilityState!==L.VISIBILITY_STATE.VISIBLE||0!==this._switchState||!(t>this._switchNextTime)||this._buffer.isPaused()||this.closeAuto)t<this._switchNextTime&&(this._switchUpReason=1,this._switchDownReason=1);else if(0===this._switchSampleTs)this._switchSampleTs=t;else if(t-this._switchSampleTs>=this._switchSampleTime){this._switchSampleTs=t;var i=this._mse.getBufferLen(),s=this._player.getWaitBufferLen(),r=this._player.getWaitFrameTime(t);this._needSwitchDown(t,i,s,r)?(I.log("CtrlBitrate buffer down! buffer=".concat(i," waitBuffer=").concat(s," waitFrameTime=").concat(r)),this._switchDownBefore()):(this._switchDownReason=2,this._switchUpSample.addSample(i>=this._mse.JITTER_BUFLEN*this._switchUpPer)?this._switchUp():this._switchUpSample.isFullSize()?this._switchUpSample.isLastReach()?this._switchUpSample.isPercentReach()||(this._switchUpReason=4):this._switchUpReason=3:this._switchUpReason=2)}this._nextRecSysTs>0&&t>=this._nextRecSysTs&&this._reqAutoRecSys(0,this._onRecSysIntervalTimeoutBind)}},{key:"_needSwitchDown",value:function(t,e,i,s){return e+i<this._mse.JITTER_BUFLEN*this._switchDownPer}},{key:"_fillBuf",value:function(){var t=this._mse.getBufferLen();t>=this._mse.JITTER_BUFLEN*this._switchUpPer&&(I.log("CtrlBitrate.fillBuf suc bufferLen=".concat(t)),this._switchState=0,this._switchType=nw.NONE,this._setPlaybackrate(!1))}},{key:"_reqAutoRecSys",value:function(t,e){if(1!==Number(F.sdkCloseAutoAi)&&2!==Number(F.isWebAutoAB)&&3!==Number(F.isWebAutoAB)){this._nextRecSysTs=Number.MAX_SAFE_INTEGER,this._destroyRecSys();var i=this._player.info,s=new nP({onRsp:this._onRecSysBind,onTimeout:e}),r=this._player.getAutoProps();s.sendAuto({presenterUid:i.presenterUid,roomId:i.roomId,scene:1,appendInfo:{platform:"webh5&".concat(0x9b0b2ddf),p2p:this._player._type,h265:this._player.h265Proxy&&this._player.h265Proxy.isReady?1:0,line:i.lineType,coderatebps:1e3*i.curBitrate,gameid:i.gameId,all_coderatebps:this._allBitratebps,req_type:t,start_coderatebps:1e3*this._startBitrate,session_id:this._sessionId,video_play_buf:r.videoBuffers,audio_play_buf:"",video_block_count:r.aiAutoCnt,video_block_duration:r.aiAutoDuration,real_kbps_sample:r.realKbpsSample,v_loss_frames:"",v_recv_frames:r.recvFps}},1e3),this._recSysProxy=s}}},{key:"_onRecSysIntervalTimeout",value:function(){this._nextRecSysTs=g.now()+this.nextReqInterval,this._destroyRecSys()}},{key:"_onRecSys",value:function(t){var e=!1,i=!1,s=g.now();
1if(t){if(this._recSysStat.addItem(1,t.tRecSysInfo.sDispatchId,s+F.recSysExpiredTime),Number(D._testAction)>0&&(I.log("CtrlBitrate._onRecSys _testAction=".concat(D._testAction)),t.tRecSysInfo.lAction=Number(D._testAction)),0===t.tRecSysInfo.lAction)e=!0;else if(t.tRecSysInfo.lAction>=100&&t.tRecSysInfo.lAction<200){if(""!==t.tRecSysInfo.sActValue){var r=JSON.parse(O.unescapeHTML(t.tRecSysInfo.sActValue));I.log("CtrlBitrate._onRecSys",JSON.stringify(r)),i=r.force_switch&&1==Number(r.force_switch),this._maxBitrate=Number(r.auto_max_coderatebps)/1e3||this._maxBitrate,this._nextReqInterval=1e3*Number(r.next_req_interval)||this._nextReqInterval,this._badQualityCoderatebps=r.bad_quality_coderatebps||[],this._recSysExpiredTime=g.now();var a=r.auto_user_tags||"";this._player.eventEmitter.autoUserTags=a,this._statSwitch.stat.setComDim(R.DIM_COM.AUTO_USER_TAGS,a);var n=Number(r.force_auto_count),o=Number(r.force_auto_effective_time);n>0&&o>0&&this._player.trigger(N.AUTO_FORCE_RSP,{force_auto_count:n,force_auto_effective_time:o})}e=!0}}else e=!0;Number(D._testBadQuality)>0&&(I.log("CtrlBitrate._onRecSys _testBadQuality=".concat(D._testBadQuality)),this._badQualityCoderatebps=[1e3*Number(D._testBadQuality)]),Number(D._testMaxBitrate)>0&&(this._recSysExpiredTime=g.now(),I.log("CtrlBitrate._onRecSys _testMaxBitrate=".concat(D._testMaxBitrate)),this._maxBitrate=Number(D._testMaxBitrate)),1===D._testActAble&&(I.log("CtrlBitrate._onRecSys _testMaxBitrate=".concat(D._testActAble)),e=!0),Number(D._testForceSwitch)>0&&(I.log("CtrlBitrate._onRecSys _testForceSwitch=".concat(D._testForceSwitch)),i=1==D._testForceSwitch),i?this._maxBitrate<this._curBitrate?this._switchDown(this._maxBitrate+1):this._switchUp(this._maxBitrate-1):2===this._switchState?(this._switchState=0,e?this._switchDown():this._switchNextTime=this._nextRecSysTs):1===Number(F.autoDownMaxBitrate)&&this._maxBitrate<this._curBitrate&&this._switchDown(this._maxBitrate+1),this._nextRecSysTs=s+this.nextReqInterval-1e4}},{key:"_destroyRecSys",value:function(){this._recSysProxy&&this._recSysProxy.destroy(),this._recSysProxy=null}},{key:"maxBitrate",get:function(){return this._recSysExpired()&&(this._maxBitrate=this._originalMaxBitrate),this._maxBitrate}},{key:"nextReqInterval",get:function(){return this._recSysExpired()&&(this._nextReqInterval=Number(F.recSysExpiredTime)),this._nextReqInterval}},{key:"badQualityCoderatebps",get:function(){return this._recSysExpired()&&(this._badQualityCoderatebps=[]),this._badQualityCoderatebps}},{key:"_recSysExpired",value:function(){var t=g.now()-this._recSysExpiredTime;return 0!=this._recSysExpiredTime&&t>F.recSysExpiredTime}}]),t}();nL.SwitchType=nw;var nF=function(){function t(){Object(s.a)(this,t),this.mse=null,this.dtsGap=0,this.lastBufferLen=0,this.pauseCnt=0,this.callbacks=null}return Object(r.a)(t,[{key:"stop",value:function(){this.mse=null,this.dtsGap=0,this.callbacks=null,tP.remove(this._onTimer,this)}},{key:"start",value:function(t,e,i){I.log("SwitchDoneBefore.start bufferLen=".concat(t.getBufferLen()," dtsGap=").concat(e)),this.mse=t,this.dtsGap=e,this.lastBufferLen=0,this.pauseCnt=0,this.callbacks=i,tP.add(this._onTimer,this,100),this._onTimer(0)}},{key:"_onTimer",value:function(t){if(this.mse){var e=200;Number(D._localBuffer)>0&&(e=Number(D._localBuffer));var i=this.mse.getBufferLen();i<=e||this.dtsGap+i<=0||this.pauseCnt>2?(I.log("SwitchDoneBefore.done bufferLen=".concat(i," dtsGap=").concat(this.dtsGap," pauseCnt=").concat(this.pauseCnt)),tP.remove(this._onTimer,this),this.callbacks&&this.callbacks.done()):i===this.lastBufferLen&&this.pauseCnt++,this.lastBufferLen=i}else this.stop()}}]),t}(),nM=function(){function t(){Object(s.a)(this,t),this.analyser=null,this.audioEnergy=null,this.lastVoiceTs=0,this.noVoiceDur=0,this.noVoiceCnt=0,this.muted=!1,this.volume=1}return Object(r.a)(t,[{key:"setAnalyser",value:function(t){I.log("VoiceChecker.setAnalyser analyser=".concat(!!t)),t&&(this.analyser=t,t.fftSize=64,t.smoothingTimeConstant=0,this.audioEnergy=new Uint8Array(this.analyser.frequencyBinCount))}},{key:"start",value:function(){this.lastVoiceTs=g.now(),tP.add(this.onCheckFastTimer,this,F.voiceTimer)}},{key:"stop",value:function(){this.analyser=null,this.audioEnergy=null,this.lastVoiceTs=0,tP.remove(this.onCheckFastTimer,this)}},{key:"onCheckFastTimer",value:function(t){if(this.analyser){this.analyser.getByteFrequencyData(this.audioEnergy);for(var e=!1,i=0;i<this.audioEnergy.length;i++)if(this.audioEnergy[i]>0){e=!0;break}this.onAudioEnergy(e)}}},{key:"onAudioEnergy",value:function(t){if(!this.muted&&0!==this.volume&&t){var e=g.now();if(0===this.lastVoiceTs)this.lastVoiceTs=e;else{var i=e-this.lastVoiceTs;i>200&&(this.noVoiceDur+=i,this.noVoiceCnt++),this.lastVoiceTs=e}}}},{key:"setMuted",value:function(t){!this.muted&&t?this.onAudioEnergy(!0):this.muted&&!t&&(this.lastVoiceTs=g.now()),this.muted=t}},{key:"setVolume",value:function(t){0===this.volume&&t>0?this.lastVoiceTs=g.now():this.volume>0&&0===t&&this.onAudioEnergy(!0),this.volume=t}},{key:"getStats",value:function(){var t={noVoiceDur:this.noVoiceDur,noVoiceCnt:this.noVoiceCnt};return this.noVoiceDur=this.noVoiceCnt=0,t}},{key:"getEmptyAudioDurationHeart",value:function(){var t=this.noVoiceDur;return this.noVoiceDur=0,this.noVoiceCnt=0,t}}]),t}(),nN=function(){function t(){Object(s.a)(this,t),this.renderInfo=null,this._stop=!1,this.mutilVideoNums=2,this.originVideoWidth=0,this.originVideoHeight=0,this.video1X=0,this.video1Y=0,this.video1Width=0,this.video1Height=0,this.video2X=0,this.video2Y=0,this.video2Width=0,this.video2Height=0,this.videoScale=1,this._start=!1,this.animationFrameId=null,this.canvasImgWidth=0,this.canvasImgHeight=0,this.canvasImgX=0,this.canvasImgY=0,this.canvas2ImgX=0,this.canvas2ImgY=0,this.canvas2ImgWi
1dth=0,this.canvas2ImgHeight=0,this.containerWidth=1280,this.containerHeight=720,this._canvas2ContainerWidth=288,this._canvas2ContainerHeight=161,this._canvas2Container=null,this.containerSizes=null,this._isMultiVideo=!1,this.h265Proxy={},this.avccWidth=1280,this.avccHeight=720,this._multiVideoRenderRects=[]}return Object(r.a)(t,[{key:"updateRenderInfo",value:function(t){this._isMultiVideo=!0,this.renderInfo||(this.renderInfo=t,this._canvas1=document.createElement("canvas"),this._canvas2=document.createElement("canvas"),this._ctx1=this._canvas1.getContext("2d"),this._ctx2=this._canvas2.getContext("2d"),this.h265Proxy.canvas=this._canvas1,this.h265Proxy.isReady=!0,this.parseRenderInfo(t))}},{key:"parseRenderInfo",value:function(t){this.originVideoWidth=t[2]+(t[3]<<8),this.originVideoHeight=t[4]+(t[5]<<8),this.video1X=t[8]+(t[9]<<8),this.video1Y=t[10]+(t[11]<<8),this.video1Width=t[12]+(t[13]<<8),this.video1Height=t[14]+(t[15]<<8),console.log("parseRenderInfo",this.video1Width,this.video1Height),this.video2X=t[18]+(t[19]<<8),this.video2Y=t[20]+(t[21]<<8),this.video2Width=t[22]+(t[23]<<8),this.video2Height=t[24]+(t[25]<<8),this.video1WidthScale=this.video1Width/this.originVideoWidth,this.video2WidthScale=this.video2Width/this.originVideoWidth,this.video1HeightScale=this.video1Height/this.originVideoHeight,this.video2WidthScale=this.video2Height/this.originVideoHeight}},{key:"getVideoScale",value:function(){return{scale1:{ws:this.video1WidthScale,hs:this.video1HeightScale},scale2:{ws:this.video2WidthScale,hs:this.video2HeightScale}}}},{key:"playStart",value:function(t,e,i){this.renderInfo&&(this.avccWidth=e,this.avccHeight=i,this.video=t,this.videoScale=e/this.originVideoWidth,this._initializeCanvas(this.videoScale),this.startCapture(),this._start=!0,this.containerSizes&&this.containerResize(this.containerSizes),this.addTimer())}},{key:"addTimer",value:function(){this.removeTimer(),tP.add(this.onCheckTimer,this,50)}},{key:"removeTimer",value:function(){tP.remove(this.onCheckTimer,this,50)}},{key:"onCheckTimer",value:function(){this.getReady()&&(!this._canvas2Container&&this._canvas2.parentElement&&(this._canvas2Container=this._canvas2.parentElement),this._canvas2Container&&this._canvas2Container.offsetWidth>0&&this._canvas2Container.offsetHeight>0&&(this._canvas2Container.offsetWidth!=this._canvas2ContainerWidth||this._canvas2ContainerHeight!=this._canvas2Container.offsetHeight)&&this.canvas2ContainerResize({width:this._canvas2Container.offsetWidth,height:this._canvas2Container.offsetHeight}))}},{key:"_initializeCanvas",value:function(){var t=this,e=function(){if(t.video){var e=t.video.videoWidth,i=t.video.videoHeight;0!=e&&0!=i||(e=t.avccWidth,i=t.avccHeight),t.videoScale=e/t.originVideoWidth,t._canvas1.width=t.video1Width*t.videoScale,t._canvas1.height=t.video1Height*t.videoScale,t._canvas2.width=t.video2Width*t.videoScale,t._canvas2.height=t.video2Height*t.videoScale,t.updateCanvas1Sizes()}};e(),this.video.addEventListener("loadedmetadata",e)}},{key:"canvas2ContainerResize",value:function(t){this.getReady()&&(this._canvas2ContainerWidth=t.width,this._canvas2ContainerHeight=t.height,this.updateCanvas2Sizes(),this._initializeCanvas())}},{key:"containerResize",value:function(t){console.log("MutilVideo.containerResize",t.width,t.height),this.containerSizes=t,this.containerWidth=t.width,this.containerHeight=t.height,this.getReady()&&this._initializeCanvas()}},{key:"updateCanvas1Sizes",value:function(){var t=this.updateRenderRect(this.video1Width,this.video1Height,this.containerWidth,this.containerHeight,this.videoScale);this.canvasImgX=t.canvasImgX,this.canvasImgY=t.canvasImgY,this.canvasImgWidth=t.canvasImgWidth,this.canvasImgHeight=t.canvasImgHeight,this._multiVideoRenderRects=[{videoX:this.canvasImgX,videoY:this.canvasImgY,width:this.canvasImgWidth,height:this.canvasImgHeight}]}},{key:"updateCanvas2Sizes",value:function(){var t=this.updateRenderRect(this.video2Width,this.video2Height,this._canvas2ContainerWidth,this._canvas2ContainerHeight,this.videoScale);this.canvas2ImgX=t.canvasImgX,this.canvas2ImgY=t.canvasImgY,this.canvas2ImgWi
1dth=t.canvasImgWidth,this.canvas2ImgHeight=t.canvasImgHeight}},{key:"updateRenderRect",value:function(t,e,i,s,r){var a,n,o,u;if(e&&t&&i&&s){var l=t/e,d=i/s;if(d>l){var c=(1-l/d)*t*r;a=c/2,n=0,u=e*r,o=t*r-c}else{var f=(1-d/l)*e*r;a=0,o=t*r,n=f/2,u=e*r-f}return{canvasImgX:a,canvasImgY:n,canvasImgWidth:o,canvasImgHeight:u}}return{canvasImgX:0,canvasImgY:0,canvasImgWidth:0,canvasImgHeight:0}}},{key:"getMultiVideoRenderRects",value:function(){return this._multiVideoRenderRects}},{key:"startCapture",value:function(){var t=this;!function e(){t._stop?cancelAnimationFrame(t.animationFrameId):(t.getReady()&&(t._ctx1.clearRect(0,0,t._canvas1.width,t._canvas1.height),t._ctx2.clearRect(0,0,t._canvas2.width,t._canvas2.height),t._ctx1.drawImage(t.video,0,0,Math.floor(t.video1Width*t.videoScale),Math.floor(t.video1Height*t.videoScale),t.canvasImgX,t.canvasImgY,t.canvasImgWidth,t.canvasImgHeight),t._ctx2.drawImage(t.video,t.video2X*t.videoScale,t.video2Y*t.videoScale,t.video2Width*t.videoScale,t.video2Height*t.videoScale,t.canvas2ImgX,t.canvas2ImgY,t.canvas2ImgWidth,t.canvas2ImgHeight)),t.animationFrameId=requestAnimationFrame(e))}()}},{key:"getCanvas1",value:function(){return{canvas:this._canvas1,width:this._canvas1.width,height:this._canvas1.height}}},{key:"getCanvas2",value:function(){return{canvas:this._canvas2,width:this._canvas2.width,height:this._canvas2.height}}},{key:"stop",value:function(){this._stop=!0,this.removeTimer()}},{key:"getIsMultiVideo",value:function(){return this._isMultiVideo}},{key:"getReady",value:function(){return this._start}},{key:"getMse1AvcCfgWidth",value:function(){return this.video1Width*this.videoScale}},{key:"getMse1AvcCfgHeight",value:function(){return this.video1Height*this.videoScale}},{key:"getRender1Element",value:function(){return this._canvas1}},{key:"getMse2AvcCfgWidth",value:function(){return this.video2Width*this.videoScale}},{key:"getMse2AvcCfgHeight",value:function(){return this.video2Height*this.videoScale}},{key:"getRender2Element",value:function(){return this._canvas2}},{key:"getCanvas1Info",value:function(){var t={};return t.getRenderElement=this.getRender1Element.bind(this),t.getMseAvcCfgWidth=this.getMse1AvcCfgWidth.bind(this),t.getMseAvcCfgHeight=this.getMse1AvcCfgHeight.bind(this),t.h265Proxy=this.h265Proxy,t}},{key:"getCanvas2Info",value:function(){var t={};return t.getRenderElement=this.getRender2Element.bind(this),t.getMseAvcCfgWidth=this.getMse2AvcCfgWidth.bind(this),t.getMseAvcCfgHeight=this.getMse2AvcCfgHeight.bind(this),t.h265Proxy=this.h265Proxy,t}},{key:"getVideo2Rect",value:function(){return{x:this.video2X,y:this.video2Y,width:this.video2Width,height:this.video2Height,originVideoWidth:this.originVideoWidth,originVideoHeight:this.originVideoHeight}}}]),t}(),nB=0,nV=function(){function t(e,i,r){Object(s.a)(this,t),this._id=nB++,I.log("P2PFlvPlayer(".concat(this._id,").constructor")),this._isP2pPlayIng=!1,this._type=tQ.FLV,this.eventEmitter=e,this._hyPlayer=i.hyPlayerIns,this.player=null,this.p2pPlayer=null,this.flvPlayer=null,this.exceptionStat=new sN(this),this.info=null,this.isPureAudio=i.isPureAudio,this.isPureVideo=i.isPureVideo,this.h265Proxy=i.h265Proxy,this.statSwitch=i.statSwitch,this.autoMonitor=i.autoMonitor,this.recSysStat=i.recSysStat,this.isSoftSolution=i.isSoftSolution,this.seiDataChannl=i.seiDataChannl,this._switch265FailBind=this._switch265Fail.bind(this),this.ctrlBitrate=new nL({player:this,statSwitch:this.statSwitch,autoMonitor:this.autoMonitor,recSysStat:this.recSysStat},{start:this._switchStart.bind(this),first:this._switchFirstSample.bind(this),done:this._switchDone.bind(this)}),this.videoElement=i.videoElement,this.tsdb=i.tsdb,this.stat=i.stat,this.mse=null,this.ctrlBitrate.beforeSwitchCb=this._beforeSwitch.bind(this),this.switchDoneBefore=new nF,this.anticode=new sb,this.videoStatus=B,this.closeP2pCoderates=[],this.onP2PTimeoutBind=this.onP2pTimeout.bind(this),this.flvTryToP2PBind=this.flvTryToP2P.bind(this),this.eventEmitter.on(N.P2P_TIMEOUT,this.onP2PTimeoutBind),this.eventEmitter.on(N.FLV_TRY_TO_P2P,this.flvTryToP2PBind),this.handlerType=0,this.playerCoreType="",this.isWebcodecsPlaying=!1,this.isWasmH265Playing=!1,this.useMultiVideo=!0,this.autoMutedPlay=!0,this.mutilVideo=new nN,this.voiceChecker=new nM,this.checkAV1Support()}return Object(r.a)(t,[{key:"checkAV1Support",value:function(){var t=this;try{if(!("mediaCapabilities"in navigator))return this.stat.setComDim(R.VOD_DIM_COM.BACKUP_FIELD2,2),void I.log("P2PFlvPlayer.checkAV1Support",2);navigator.mediaCapabilities.decodingInfo({type:"file",video:{contentType:'video/mp4; codecs="av01.0.05M.08"',width:1920,height:1080,bitrate:8e6,framerate:30}}).then(function(e){I.log("result",JSON.stringify(e));var i=10;e.supported&&(i=11,e.powerEfficient&&(i=12)),t.stat.setComDim(R.VOD_DIM_COM.BACKUP_FIELD2,i),I.log("P2PFlvPlayer.checkAV1Support",1)}).catch(function(e){t.stat.setComDim(R.VOD_DIM_COM.BACKUP_FIELD2,3),I.log("P2PFlvPlayer.checkAV1Support",3)})}catch(t){this.stat.setComDim(R.VOD_DIM_COM.BACKUP_FIELD2,4),I.log("P2PFlvPlayer.checkAV1Support",4)}}},{key:"getAnticodeHandler",value:function(){return this.anticode}},{key:"initPlayer",value:function(t,e){this.info=t,t.hasOwnProperty("autoMutedPlay")&&(this.autoMutedPlay=t.autoMutedPlay),"safari"==S.name?this.useMultiVideo=!1:t.hasOwnProperty("useMultiVideo")&&(this.useMultiVideo=t.useMultiVideo),t.mpExtArgs&&t.mpExtArgs.closep2pcoderate&&(this.closeP2pCoderates=t.mpExtArgs.closep2pcoderate.split(","));var i=t.iIsP2PSupport,s=this.getIsCloseP2P();
1i&&s&&(t.type===HYPlayer.VR?t.vr.playerType=0:t.type=HYPlayer.FLV),this.handlerType=e.handlerType,I.log("P2PFlvPlayer(".concat(this._id,").initPlayer, closeP2pCoderates"),this.closeP2pCoderates),tP.add(this.onCheckTimer,this,1e3);var r=e.playerCoreType;return this.playerCoreType=r,this.mse=r===L.PLAYER_CORE_TYPE.WEBCODECS?this.createWebCodecsPlayer():this.createMse(),this.mse.setSeiDataChannelPortListers(this.seiDataChannl),r===L.PLAYER_CORE_TYPE.WEBCODECS?this.isSoftSolution?this.stat.setComDim(R.DIM_COM.MSE_PLAYER,3):this.stat.setComDim(R.DIM_COM.MSE_PLAYER,2):this.stat.setComDim(R.DIM_COM.MSE_PLAYER,this.mse.isMMS?4:1),t.team_port&&this.stat.setComDim(R.DIM_COM.TEAM_PORT,t.team_port),e.mse=this.mse,e.exceptionStat=this.exceptionStat,e.p2pFlvPlayer=this,e.anticode=this.anticode,e.voiceChecker=this.voiceChecker,this.flvPlayer=new aZ(this.eventEmitter,e,this.videoElement),this.p2pPlayer=new nS(this.eventEmitter,e,this.videoElement),this.startPlayer(t)}},{key:"sendAnticodeHeart",value:function(){this.player&&this.player.sendAnticodeHeart&&this.player.sendAnticodeHeart()}},{key:"updateCurrentPageRenderFps",value:function(t){this.eventEmitter.updateCurrentPageRenderFps&&this.eventEmitter.updateCurrentPageRenderFps(t)}},{key:"createMse",value:function(){var t=new iN(this,{videoType:"flv",isPureAudio:this.isPureAudio,isPureVideo:this.isPureVideo,h265Proxy:this.h265Proxy,videoElement:this.videoElement});return t.setAutoMutedPlay(this.autoMutedPlay),t.setPushGop(F.pushGop),t}},{key:"createWebCodecsPlayer",value:function(){var t=D.hasOwnProperty("_minBuffer")?Number(D._minBuffer):3e3,e=new rn(this,{videoType:"flv",isPureAudio:this.isPureAudio,isPureVideo:this.isPureVideo,h265Proxy:this.h265Proxy,videoElement:this.videoElement,isH265Mode:this.h265Proxy.isReady||this.h265Proxy.isH265MseCodec,lowlatencyCfg:{lowlatencyBuf:-1,lowlatencyMin:t+500,lowlatencyMax:t+1e3,openRenderSync:1}});return e.setAutoMutedPlay(this.autoMutedPlay),e.setPushGop(F.pushGop),e}},{key:"startPlayer",value:function(t){this.resetStartProps(),this.stat.setComDim(R.DIM_COM.UA,navigator.userAgent);var e=O.isXiaomi(navigator.userAgent)&&1==F.isCloseXiaomiPcdnP2p;switch(t.type){case tQ.FLV:this._hyPlayer.lastFlvInfo=t,this._hyPlayer.lastP2PInfo&&(this.flvPlayer.backToP2P.lastP2PInfo=this._hyPlayer.lastP2PInfo),this.player=this.flvPlayer,this._type=tQ.FLV;break;case tQ.P2P:if(!rV.isSupportP2P()||e||F.isCloseP2PAid(t.presenterUid)||F.isCloseP2P(t.uid)||F.isCloseAllFuncs(t.uid)||F.isCloseP2PBroVer()||F.isClosePidMediaP2P(t.presenterUid,t.lineType))return this._hyPlayer.lastP2PInfo=t,this.onP2pTimeout(N.P2P_TIMEOUT,{reason:L.turnToFlvReason.NOT_SUPPORT_P2P}),void I.warn("xxxxxxx "+S.name+" "+S.version.major+" unsupport p2p !");this._hyPlayer.lastP2PInfo=t,this._isP2pPlayIng=!0,this.p2pPlayingEvent(this._isP2pPlayIng),this._hyPlayer.isForceFlv=!1,this.player=this.p2pPlayer,this._type=tQ.P2P}return this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS&&this.isSoftSolution&&this.mse.setUseSoftAcceleration(),this.mse&&this.mse.updateCurBitrate&&this.mse.updateCurBitrate(t.curBitrate),!0}},{key:"resetStartProps",value:function(){this.videoStatus=B,this.isWasmH265Playing=!1,this.isWebcodecsPlaying=!1,this.h265Proxy.isLive=!0}},{key:"start",value:function(t){q.bindEvent(this.tsdb,t._sessionId,t.lineType,t.sDisplayName,t.iBitRate),t.type==tQ.P2P&&this.flvPlayer.checkParams(t),t.hasOwnProperty("autoMutedPlay")&&(this.autoMutedPlay=t.autoMutedPlay),"safari"==S.name?this.useMultiVideo=!1:t.hasOwnProperty("useMultiVideo")&&(this.useMultiVideo=t.useMultiVideo),this.videoStatus=V,this.mse&&t.muted&&this.mse.setMuted(!0),t.type==tQ.P2P&&t.p2purl?this.player.startP2PUrl(t):this.player.start(t)}},{key:"startP2PUrl",value:function(t){t.type==tQ.P2P&&t.p2purl&&this.player.startP2PUrl(t)}},{key:"onCheckTimer",value:function(t,e){this.anticode.onCheckTimer(t,e)}},{key:"setMuffled",value:function(t,e){this.eventEmitter.setMuffled(t,e)}},{key:"flvTryToP2P",value:function(){I.log("P2PFlvPlayer(".concat(this._id,").flvTryToP2P")),this._hyPlayer.lastP2PInfo&&(this._hyPlayer.flvTryToP2P&&this._hyPlayer.flvTryToP2P(),this._hyPlayer.metrics.setP2p(1),w.flvTryToP2P=1,this._hyPlayer.lastP2PInfo.type===HYPlayer.VR?this._hyPlayer.lastP2PInfo.vr.playerType=1:this._hyPlayer.lastP2PInfo.type=HYPlayer.P2P,this.trigger(N.FLV_TO_P2P),this._hyPlayer.isForceFlv=!1,this._hyPlayer.sdkTurnToP2P=!0,this._hyPlayer.start(this._hyPlayer.lastP2PInfo)),this._hyPlayer.flacMgr&&(this._hyPlayer.stopFlac(),this._hyPlayer.startFlac())}},{key:"onP2pTimeout",value:function(t,e){this._hyPlayer.onP2pTimeout&&this._hyPlayer.onP2pTimeout(),this._isP2pPlayIng=!1,this.p2pPlayingEvent(this._isP2pPlayIng),this._hyPlayer.isForceFlv=!0,this._hyPlayer.lastP2PInfo.type===HYPlayer.VR?this._hyPlayer.lastP2PInfo.vr.playerType=0:this._hyPlayer.lastP2PInfo.type=HYPlayer.FLV,this.p2pPlayer&&this.p2pPlayer.isAv1&&(this._hyPlayer.lastP2PInfo._av1PlayFailReason="p2p_timeout"),this._hyPlayer.start(this._hyPlayer.lastP2PInfo);
1var i=e.reason,s=e.domain,r=e.pcdnIaas;i!=L.turnToFlvReason.P2P_ARGS_ERROR&&i!=L.turnToFlvReason.P2P_COOLING&&i!=L.turnToFlvReason.IS_NOT_FIRST_FETCH&&i!=L.turnToFlvReason.VIDEO_BUFFER_EMPTY&&i!=L.turnToFlvReason.NOT_SUPPORT_P2P&&(I.log("P2PFlvPlayer.onP2pTimeout, domain=".concat(s,", reason=").concat(i)),this.stat&&this.stat.setComDim(R.DIM_COM.P2P_TO_FLV_DOMAIN,s),this.stat.setComDim(R.DIM_COM.PCDN_IAAS,r))}},{key:"p2pPlayingEvent",value:function(t){this.trigger(N.P2P_PLAYING_EVENT,{isP2pPlayIng:t})}},{key:"trigger",value:function(t,e){this.eventEmitter.trigger(t,e)}},{key:"setVolume",value:function(t){this.player.setVolume(t),this.voiceChecker.setVolume(t)}},{key:"setEnableLowLatency",value:function(t){this.player&&this.player.setEnableLowLatency&&this.player.setEnableLowLatency(t)}},{key:"setPlaybackrateAccess",value:function(t){this.player&&this.player.setPlaybackrateAccess&&this.player.setPlaybackrateAccess(t)}},{key:"updateFlvConfig",value:function(){this.player&&this.player.updateFlvConfig&&this.player.updateFlvConfig()}},{key:"updateP2PConfig",value:function(){this.player&&this.player.updateP2PConfig&&this.player.updateP2PConfig()}},{key:"getFrameData",value:function(){return this.player&&this.player.getFrameData()}},{key:"getExceptionStat",value:function(){return this.player.exceptionStat?this.player.exceptionStat.getStat():""}},{key:"seek",value:function(t){this.player&&this.player.seek&&this.player.seek(t)}},{key:"getBufferLen",value:function(){return this.mse&&this.mse.getBufferLen?this.mse.getBufferLen():0}},{key:"setMuted",value:function(t){this.player&&this.player.setMuted(t),this.voiceChecker.setMuted(t)}},{key:"getMuted",value:function(){return this.player&&this.player.getMuted()}},{key:"getCurrentTime",value:function(){return this.player&&this.player.getCurrentTime()}},{key:"getCurrentDts",value:function(){return this.player?this.player.getCurrentDts():0}},{key:"getCurrentSeiOffsetDts",value:function(){return this.player?this.player.getCurrentSeiOffsetDts():0}},{key:"play",value:function(){this.player&&this.player.play()}},{key:"pause",value:function(){this.player&&this.player.pause()}},{key:"stop",value:function(){I.log("P2PFlvPlayer(".concat(this._id,").stop")),this._isP2pPlayIng=!1,this.videoStatus=B,this.p2pPlayingEvent(this._isP2pPlayIng),this.flvPlayer&&(this.flvPlayer.stop(),this.flvPlayer=null),this.p2pPlayer&&(this.p2pPlayer.stop(),this.p2pPlayer=null),this.mse&&(this.mse.destroy(),this.mse=null),this.mutilVideo&&this.mutilVideo.stop(),this.voiceChecker.stop(),this.eventEmitter.off(N.P2P_TIMEOUT,this.onP2PTimeoutBind),this.eventEmitter.off(N.FLV_TRY_TO_P2P,this.flvTryToP2PBind),this.ctrlBitrate.stop(),this.switchDoneBefore.stop(),tP.remove(this._switchFirstVideoTimeout,this),tP.remove(this._switchPtsIFrameTimeout,this),tP.remove(this.onCheckTimer,this),this.info=null,this.handlerType=0,this.isWebcodecsPlaying=!1,this.isWasmH265Playing=!1}},{key:"destroy",value:function(){this.videoElement=null,this.flvPlayer&&(this.flvPlayer.destroy(),this.flvPlayer=null),this.p2pPlayer&&(this.p2pPlayer.destroy(),this.p2pPlayer=null),this.mse&&(this.mse.destroy(),this.mse=null),this.ctrlBitrate&&(this.ctrlBitrate.destroy(),this.ctrlBitrate=null),this.voiceChecker&&this.voiceChecker.stop(),this.voiceChecker=null,this.exceptionStat&&this.exceptionStat.destroy(),this.exceptionStat=null,this.eventEmitter.off(N.P2P_TIMEOUT,this.onP2PTimeoutBind),this.eventEmitter.off(N.FLV_TRY_TO_P2P,this.flvTryToP2PBind),this.switchDoneBefore&&this.switchDoneBefore.stop(),this.switchDoneBefore=null,tP.remove(this._switchFirstVideoTimeout,this),tP.remove(this._switchPtsIFrameTimeout,this),tP.remove(this.onCheckTimer,this),this.info=null,this.eventEmitter=null}},{key:"stopStream",value:function(t){this.player&&this.player.stopStream&&this.player.stopStream(t)}},{key:"checkPcdnMode",value:function(t){this.player&&this.player.checkPcdnMode&&this.player.checkPcdnMode(t.mPcdnModeSwitch.value,t.mPcdnModePcdnName.value)}},{key:"containerResize",value:function(t){this.player&&this.player.h265Proxy&&this.player.h265Proxy.containerResize&&this.player.h265Proxy.containerResize(t)}
1},{key:"containerResizeNew",value:function(t){if(this.mutilVideo&&this.mutilVideo.getReady()&&this.mutilVideo.containerResize){this.mutilVideo.containerResize(t);var e=this.mutilVideo.getMultiVideoRenderRects();this.updateMultivideoRenderRects(e)}}},{key:"updateMultivideoRenderRects",value:function(t){var e=Object(eb.a)(t,1)[0],i=e.videoX,s=e.videoY,r=e.width,a=e.height;this.eventEmitter.updateMultivideoRenderRects([{videoX:i,videoY:s,width:r,height:a}])}},{key:"getCdnSip",value:function(){return this.player&&this.player.getCdnSip&&this.player.getCdnSip()}},{key:"getDelayInfo",value:function(){return this.player&&this.player.mse.getDelayInfo()}},{key:"getRealBitrate",value:function(){return this.player&&this.player.mse.getRealBitrate()}},{key:"setVideoPlayTimeSended",value:function(){this.player&&this.player.setVideoPlayTimeSended&&this.player.setVideoPlayTimeSended()}},{key:"onVideoStop",value:function(t,e){this.player&&this.player.onVideoStop&&this.player.onVideoStop(t,e)}},{key:"onPlayResume",value:function(t){this.player&&this.player.onPlayResume&&this.player.onPlayResume(t)}},{key:"onPlayResumeWorker",value:function(t){this.player&&this.player.onPlayResumeWorker&&this.player.onPlayResumeWorker(t)}},{key:"onPlayerError",value:function(t){this.player&&this.player.onPlayerError&&this.player.onPlayerError(t)}},{key:"onErrorEvent",value:function(t){I.log("P2PFlvPlayer(".concat(this._id,").onErrorEvent"),t),this.player&&this.player.onErrorEvent&&this.player.onErrorEvent(t)}},{key:"onMseHevcError",value:function(t){I.log("P2PFlvPlayer(".concat(this._id,").onMseHevcError"));var e=0;1==t?e=3e3:2==t?e=3001:3==t?e=3002:4==t?e=3003:5==t&&(e=3004),this.stat.setComDim("backup_field1",e),this.player&&this.player.turntoH265Wasm&&this.player.turntoH265Wasm()}},{key:"wcsRenderError",value:function(t){I.log("P2PFlvPlayer(".concat(this._id,").wcsRenderErr"),t)}},{key:"mseHevcRenderErr",value:function(t){I.log("P2PFlvPlayer(".concat(this._id,").mseHevcRenderErr"),t)}},{key:"onVideoParseInvalid",value:function(){this.player&&this.player.onVideoParseInvalid&&this.player.onVideoParseInvalid()}},{key:"onGop",value:function(t){this.player&&this.player.onGop&&this.player.onGop(t)}},{key:"turnToH264",value:function(t){this.player&&this.player.turnToH264&&this.player.turnToH264(t)}},{key:"h265Retry",value:function(){this.player&&this.player.h265Retry&&this.player.h265Retry()}},{key:"reloadInError",value:function(){this.player&&this.player.reloadInError&&this.player.reloadInError()}},{key:"resetMediasource",value:function(){this.player&&this.player.resetMediasource&&this.player.resetMediasource()}},{key:"recvDataFull",value:function(){this.player&&this.player.recvDataFull&&this.player.recvDataFull()}},{key:"onAudioAnalyserInit",value:function(t){this.voiceChecker.setAnalyser(t)}},{key:"onMultiStart",value:function(t,e,i,s,r){this.mutilVideo.playStart(t||r,e,i)}},{key:"onPlayVideo",value:function(t,e,i,s,r,a,n){this.voiceChecker.start(),this.updateStatus(U),this.mutilVideo.playStart(t||r,e,i);var o=void 0,u=void 0;this.mutilVideo&&this.mutilVideo.getReady()&&(o=this.mutilVideo.getCanvas1(),u=this.mutilVideo.getCanvas2()),this.player&&this.player.onPlayVideo&&this.player.onPlayVideo(t,e,i,s,r,a,n,o,u)}},{key:"isMutilVideo",value:function(){return this.useMultiVideo&&this.mutilVideo.getIsMultiVideo()}},{key:"getVideoScale",value:function(){return this.mutilVideo.getVideoScale()}},{key:"onSendSeiData",value:function(t,e,i){this.player&&this.player.onSendSeiData&&this.player.onSendSeiData(t,e,i)}},{key:"onSendScriptVolumeInfo",value:function(t,e){this.player&&this.player.onSendScriptVolumeInfo&&this.player.onSendScriptVolumeInfo(t,e)}},{key:"onSBUpdateEnd",value:function(){this.player&&this.player.onSBUpdateEnd&&this.player.onSBUpdateEnd()}},{key:"onPauseByBrowser",value:function(){this.player&&this.player.onPauseByBrowser&&this.player.onPauseByBrowser()}},{key:"updateStatus",value:function(t){this.player&&this.player.updateStatus&&this.player.updateStatus(t),this.videoStatus=t}},{key:"onPause5Sec",value:function(){this.player&&this.player.onPause5Sec&&this.player.onPause5Sec()}},{key:"setEmptyFrames",value:function(t){this.player&&this.player.hasEmptyFrames&&(this.player.hasEmptyFrames=t)}},{key:"onPlayPause",value:function(t,e){this.player&&this.player.onPlayPause&&this.player.onPlayPause(t,e)}},{key:"onPlayPauseWorker",value:function(t,e){this.player&&this.player.onPlayPauseWorker&&this.player.onPlayPauseWorker(t,e)}},{key:"getWaitBufferLen",value:function(){return this.player?this.player.getWaitBufferLen():0}},{key:"getWaitFrameTime",value:function(t){return this.player?this.player.getWaitFrameTime(t):0}},{key:"getRecvInfo",value:function(){return this.player&&this.player.getRecvInfo&&this.player.getRecvInfo()}},{key:"setAudioUtil",value:function(t){return this.player&&this.player.setAudioUtil&&this.player.setAudioUtil(t)}},{key:"turnToMse",value:function(){this.stop(),this.eventEmitter.trigger(N.TURN_TO_MSE)}},{key:"webcodecsRetry",value:function(){this.stop(),this.eventEmitter.trigger(N.WEBCODECS_RETRY)}},{key:"turnToWebcodecsSoft",value:function(){O.isWebCodecsSupported()&&(I.log("P2PFlvPlayer.turnToWebcodecsSoft"),this.stop(),this.eventEmitter.trigger(N.TURN_TO_WEBCODECS_SOFT))}},{key:"_beforeSwitch",value:function(t){this.switchDoneBefore.stop();var e=this.info;e._delayRemove=!1,e.iBitRate=t.iBitRate,e.curBitrate=t.bitrate,e.originalBitrate=0===t.iBitRate,e.iCodecType=t.iCodecType,e.iHEVCBitRate=t.iHEVCBitRate;var i=this.h265Proxy.renderInited;this.h265Proxy.initSupport(e);var s=this.h265Proxy.isSupported;!i&&s?(this.ctrlBitrate.switchType=nL.SwitchType.H264ToH265,this.h265Proxy.loadDecoder(e.h5Root,{ready:this._onH265DecoderReady.bind(this),error:this._switch265FailBind,timeout:this._switch265FailBind})):(i||s?i&&s?this.ctrlBitrate.switchType=nL.SwitchType.H265ToH265:i&&!s&&(this.ctrlBitrate.switchType=nL.SwitchType.H265ToH264,e._delayRemove=!0):this.ctrlBitrate.switchType=nL.SwitchType.H264ToH264,this.switchLevel(e))}},{key:"_onH265DecoderReady",value:function(){I.log("IPlayer._onH265DecoderReady"),this.info._delayRemove=!0,this.switchLevel(this.info)}},{key:"_switch265Fail",value:function(){this.ctrlBitrate.switchType=nL.SwitchType.H264ToH264,this.switchLevel(this.info)}},{key:"setAutoInfo",value:function(t){this.ctrlBitrate.setAutoInfo(t)}},{key:"switchLevel",value:function(t){F.initByBitrate(t.curBitrate),this.player.started&&(this.info=t,this.statSwitch.check(t,!0),this.ctrlBitrate.switchBitrate(t.curBitrate),this._triggerAutoChanged())}},{key:"getIsCloseP2P",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(F.closeP2PPids.length>0){var i=!1;if(F.closeP2PPids.forEach(function(e){Number(e)===Number(t.info.presenterUid)&&(i=!0)}),i)return!0}if(0===F.closeP2PConfig[0])return!1;var s=e.iBitRate||this.info.iBitRate,r=!1;return this.closeP2pCoderates.map(function(t){Number(t)===Number(s)&&(r=!0)}),r}},{key:"getIsEnableAuto",value:function(t){var e=this;if(0==F.closeP2PConfig[0]||0==F.closeP2PConfig[1])return!0;
1if(this.info.iIsP2PSupport&&1==F.closeP2PConfig[1]){var i=this.info.bitrateList,s=0;if(i.map(function(t){-1!=e.closeP2pCoderates.indexOf(String(t.iBitRate))&&s++}),0!=i.length){if(0===s)return!0;if(0!=s&&s!=i.length)return!1;0!=s&&i.length}}return!0}},{key:"getDurationTime",value:function(){return this.player?this.player.getDurationTime&&this.player.getDurationTime():0}},{key:"setUseSoftAcceleration",value:function(t){this.player&&this.player.setUseSoftAcceleration&&this.player.setUseSoftAcceleration(t)}},{key:"onActWebCodecs",value:function(t,e){this.player&&this.player.onActWebCodecs&&this.player.onActWebCodecs(t,e)}},{key:"_switchStart",value:function(t,e){var i=this.info.iBitRate,s=this.info.iIsP2PSupport,r=this.getIsCloseP2P(),a=this.getBufferLen();I.log("IPlayer(".concat(this._id,")._switchStart bufferLen=").concat(a," dts=").concat(t," pts=").concat(e," isCloseP2P=").concat(r," iIsP2PSupport=").concat(s," iBitRate=").concat(i)),s?r&&this._type==tQ.P2P?(this.info.type=tQ.FLV,this._type=tQ.FLV,this.flvPlayer.info=this.info,this.p2pPlayer.stopPlayer(),this.flvPlayer.startPlayer(this.info),this._switchStartFlv(t,e),this.player=this.flvPlayer):r&&this._type==tQ.FLV?this._switchStartFlv():r||this._type!=tQ.P2P?r||this._type!=tQ.FLV||(this.info.type=tQ.P2P,this.flvPlayer.stopPlayer(),this.flvPlayer.loader.close(),this._type=tQ.P2P,this.p2pPlayer.startPlayer(this.info),this._hyPlayer.lastP2PInfo=this.info,this._switchStartP2P(t,e),this.player=this.p2pPlayer):this._switchStartP2P(t,e):this._switchStartFlv(t,e),this.ctrlBitrate._badStat.setStart(a),this.ctrlBitrate._seg.nextIFrame(),tP.once(this._switchFirstVideoTimeout,this,1e3),this.isSwitchPause=!1}},{key:"_switchStartP2P",value:function(t,e){this.p2pPlayer.loaderMgr.stopFullStream(),this.p2pPlayer._switchStart(t,e),this.p2pFlvPlayerSetType(tQ.P2P)}},{key:"_switchStartFlv",value:function(t,e){this.flvPlayer.loader.close(),this.flvPlayer._switchStart(t,e),this.p2pFlvPlayerSetType(tQ.FLV)}},{key:"p2pFlvPlayerSetType",value:function(t){1==this.handlerType&&this._hyPlayer.p2pFlvPlayerSetType(t)}},{key:"onConnected",value:function(){I.log("IPlayer(".concat(this._id,").onConnected")),this.ctrlBitrate._badStat.setConnected(),this.ctrlBitrate._seg.connected()}},{key:"_switchFirstSample",value:function(){I.log("IPlayer(".concat(this._id,")._switchFirstSample")),this.ctrlBitrate._badStat.setFirstFrame(),this.ctrlBitrate._seg.firstVideo(),tP.remove(this._switchFirstVideoTimeout,this),tP.once(this._switchPtsIFrameTimeout,this,1e3)}},{key:"_switchFirstVideoTimeout",value:function(){I.log("IPlayer(".concat(this._id,")._switchFirstVideoTimeout")),this.ctrlBitrate._badStat.setFirstVideoTimeout(),this.switchDoneBefore.stop(),this.ctrlBitrate.switchBack(1)}},{key:"_switchPtsIFrameTimeout",value:function(){I.log("IPlayer(".concat(this._id,")._switchPtsIFrameTimeout")),this.ctrlBitrate._badStat.setPtsFrameTimeout(),this.switchDoneBefore.stop(),this.ctrlBitrate.switchBack(2)}},{key:"_switchDone",value:function(t,e,i){this.ctrlBitrate._badStat.setPtsFrame(i),this.ctrlBitrate._seg.ptsIFrame(),tP.remove(this._switchPtsIFrameTimeout,this),this.ctrlBitrate.startEval(e),this.ctrlBitrate.switchType===nL.SwitchType.H264ToH265||this.ctrlBitrate.switchType===nL.SwitchType.H265ToH264?(this.ctrlBitrate.pause(),this.switchDoneBefore.start(this.mse,t,{done:this._onSwitchDoneBefore.bind(this)})):this._switchDoneReal(0),I.log("P2PFlvPlayer._switchDone _type=".concat(this._type)),this._type===tQ.P2P&&this.p2pPlayer._switchDone(t,e,i)}},{key:"_onSwitchDoneBefore",value:function(){var t=this.mse;I.log("IPlayer(".concat(this._id,")._onSwitchDoneBefore mse=").concat(!!t," switchType=").concat(this.ctrlBitrate.switchType)),t&&(t.resetVideo(),t.playing=!1,t.parser.remuxer.reset(),this.ctrlBitrate.switchType===nL.SwitchType.H265ToH264?this.h265Proxy.stop():this.ctrlBitrate.switchType===nL.SwitchType.H264ToH265&&this.h265Proxy.initRender(t)),this._switchDoneReal(3e3)}},{key:"_switchDoneReal",value:function(t){I.log("IPlayer(".concat(this._id,")._switchDoneReal")),this.ctrlBitrate.switchDone(t)}},{key:"_triggerAutoChanged",value:function(){this.eventEmitter.trigger(N.AUTO_BITRATE_CHANGED,{lastBitrate:this.ctrlBitrate.lastBitrate,curBitrate:this.ctrlBitrate.curBitrate})}},{key:"getAutoProps",value:function(){return this.player&&this.player.getAutoProps&&this.player.getAutoProps()}},{key:"setWebCodecsSuccess",value:function(){this.isWebcodecsPlaying=!0}},{key:"startShildAudioPlayer",value:function(t){this.player.startShildAudioPlayer(t)}},{key:"stopShieldAudioPlayer",value:function(){this.player.stopShieldAudioPlayer()}},{key:"onSwitchShieldAudioFail",value:function(t,e){this.player.onSwitchShieldAudioFail(t,e)}},{key:"onSwitchShieldAudioSuc",value:function(t){this.player.onSwitchShieldAudioSuc(t)}},{key:"check500Pause",value:function(){this.player.check500Pause&&this.player.check500Pause()}},{key:"getMuffleCacheData",value:function(){var t=[];return this._hyPlayer&&this._hyPlayer.muffleAudio&&(t=this._hyPlayer.muffleAudio.getCacheData()),t}},{key:"setStreamFormat",value:function(t){var e={Avcc:1,Hvcc:1,AnnexB:2};t&&e[t]&&this.stat&&this.stat.setComDim(R.DIM_COM.STREAM_FORMAT,e[t])}},{key:"resetPlayer",value:function(){this.eventEmitter&&this.eventEmitter.trigger(N.RESET_PLAYER)}},{key:"setEnhance",value:function(t){this.mse&&this.mse.setEnhance&&this.mse.setEnhance(t)}},{key:"setSegmenttion",value:function(t){this.mse&&this.mse.setSegmenttion&&this.mse.setSegmenttion(t)}},{key:"setFramePause",value:function(){this.player&&this.player.setFramePause&&this.player.setFramePause()}},{key:"setFrameRusume",value:function(){this.player&&this.player.setFrameRusume&&this.player.setFrameRusume()}},{key:"renderFpsPause",value:function(t){this.player&&this.player.renderFpsPause&&this.player.renderFpsPause(t)}},{key:"onVideoEnhanceError",value:function(t){this.eventEmitter&&this.eventEmitter.trigger(N.ON_VIDEO_ENHANCE_ERROR,t)}},{key:"onVideoEnhanceSuccess",value:function(){this.eventEmitter&&this.eventEmitter.trigger(N.ON_VIDEO_ENHANCE_SUCCESS)}},{key:"setIFrameAvcChageStat",value:function(){this.stat.setComDim(R.DIM_COM.I_AVC_CHANGE,1
1)}},{key:"getFetchCodecType",value:function(){return this.player&&this.player.getFetchCodecType?this.player.getFetchCodecType():"264"}},{key:"sendNoPicture",value:function(){this.player&&this.player.sendNoPicture&&this.player.sendNoPicture()}},{key:"setWasmPlaying",value:function(){this.isWasmH265Playing=!0}},{key:"decoderDecodeError",value:function(){if(I.log("P2PFlvPlayer.decoderDecodeError, _type=".concat(this._type)),this.player&&this.player.isAv1){var t=Number(D.getItem(L.AV1_DECODE_FAIL_KEY))||0;D.setItem(L.AV1_DECODE_FAIL_KEY,t+1),D.setItem(L.AV1_DECODE_FAIL_TIME,Date.now())}}},{key:"updateMultiRenderInfo",value:function(t){this.useMultiVideo&&this.mutilVideo.updateRenderInfo(t)}},{key:"wasmH265Playing",get:function(){return this.isWasmH265Playing}},{key:"webcodecsPlaying",get:function(){return this.isWebcodecsPlaying}},{key:"isP2P",get:function(){return this._type==tQ.P2P}},{key:"type",get:function(){return this._type}},{key:"isFlv",get:function(){return this._type==tQ.FLV}},{key:"isPlaying",get:function(){return this.videoStatus!==x&&this.videoStatus!==B&&this.videoStatus!==V}},{key:"hasPicture",get:function(){if(!this.player)return!1;var t=this.isPlaying;return this.playerCoreType===L.PLAYER_CORE_TYPE.MSE?t=t&&0!==this.mse.getCurrentTime():this.playerCoreType===L.PLAYER_CORE_TYPE.WEBCODECS&&(t=t&&this.isWebcodecsPlaying),this.player&&this.player.h265Proxy&&this.player.h265Proxy.rendering&&(t=t&&this.player.h265Proxy.rendering),t}},{key:"voiceEliminationData",get:function(){return this.player.voiceEliminationData},set:function(t){this.player.voiceEliminationData=t}},{key:"connected",get:function(){return!!this.player&&this.player.connected}},{key:"playerType",get:function(){return this._type}},{key:"isTieStream",get:function(){return this.player&&this.player.is_tie_stream}}]),t}(),nU=g.now(),nx=!1,nH=0,nG=function(t){Object(u.a)(i,t);var e=Object(l.a)(i);function i(t){Object(s.a)(this,i),n=e.call(this,t),g.now();var r,n,o=Number(D.sdkLogLevel);isNaN(o)||n.setLogLevel(o),Object(d.setLogger)(I),w.initUUId(),n.uuid=w.uuid,n.VideoPlayTimeSended=!1;var u=S.platform+" "+S.name+" "+S.version.string;I.warn("SDK ".concat(0x9b0b2ddf," | ").concat("2026-01-20 11:19:21"," | ").concat("RELEASE"," | ").concat(u," | ").concat(n.uuid)),F.jumpBufferCfg=[120,1500,1e4,5e3,120,25],F.rtPeerMax=0,F.rtPeerSelectorCfg="all|all:0",n.config=F,n.config.init(t),n.config.jitBufLen=6e3,n.config.jitMaxBufLen=16e3,n.config.jitMinBufLen=3e3;var l=((r=new rP.a).setMaxListeners(0),r.trigger=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];var a=i;"Array"===i.constructor.name&&(a=i[0]),t===N.PLAY_STATUS?I.log("%c"+t+" %c"+a.status,"color:#F9F900;background:gray","color:#53FF53;background:gray"):-1===rE.indexOf(t)&&I.log("%c"+t,"color:#F9F900;background:gray",a),r.emit.apply(r,[t,t].concat(i))},r.off=function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];r.removeListener.apply(r,[t].concat(i))},r);return n.on=l.on.bind(l),n.off=l.off.bind(l),n.trigger=l.trigger.bind(l),n.volume=1,n._type=0,n.player=null,n.lastFlvInfo=null,n.lastP2PInfo=null,n.noPictureSended=!1,n.playingMgr=null,n.videoPlaybackrateAccess=!S.firefox,n.stat=new rS,n.statVod=new rg,n.metrics=new $,n.abConfig=new af,n.tsdbUtil=new J({stat:n.stat,statVod:n.statVod,eventEmiter:Object(a.a)(n)}),n.statSwitch=new rZ(n.tsdbUtil,n.stat,Object(a.a)(n)),n.sampleController=new rA,n.h265WasmProxy=new ae(n.stat,n.tsdbUtil,n.statVod),n.h265MseProxy=new ai(n.stat,n.tsdbUtil,n.statVod),n.autoMonitor=new ao,n.recSysStat=new au,n.visibility=new as(Object(a.a)(n)),n.autoForce=new ac(Object(a.a)(n),n.abConfig),n.bitrateChange=new ap(n.abConfig),n.statSwitch.init(n.autoMonitor,n.recSysStat,n.autoForce),n.autoMonitor.init(n.stat),n.enableLowLatency=!1,n.nimoPlayConfig=null,n.audiouitil=null,n.startTs=0,n.isTurnToMse=!1,n.isTurnToWebcodecsSoft=!1,n.webcodecsErrCount=0,n.on(N.VIDEO_PLAY,n.onPlayVideo.bind(Object(a.a)(n))),n.on(N.AUTO_BITRATE_CHANGED,n.onAutoBitrateChanged.bind(Object(a.a)(n))),n.on(N.TURN_TO_H264,n.onTurntoH264.bind(Object(a.a)(n))),n.on(N.H265_VIDEO_RETRY,n.onH265Retry.bind(Object(a.a)(n))),n.on(N.TURN_TO_MSE,n.onTurnToMse.bind(Object(a.a)(n))),n.on(N.TURN_TO_WEBCODECS_SOFT,n.onTurnToWebcodecsSoft.bind(Object(a.a)(n))),n.on(N.WEBCODECS_RETRY,n.onWebcodecsRetry.bind(Object(a.a)(n))),n.on(N.TURN_TO_H265_WASM,n.onTurntoH265Wasm.bind(Object(a.a)(n))),n.on(N.FLV_URL_UNAVAILABLE_IN,n.onFlvUrlUnavailableIn.bind(Object(a.a)(n))),n.on(N.H5_PLAYER_ERROR_IN,n.onH5PlayerError.bind(Object(a.a)(n))),n.on(N.NO_DATA_RECEIVED_IN,n.onNoDataReceived.bind(Object(a.a)(n))),n.sdkInRoomTs=Date.now(),n.roomRecordStat=new rO(Object(a.a)(n)),n.roomRecordStat.supported=!1,n.autoStartBitrate=0,n.inRo
1omTimeNow=nU,n.autoUserTags="",n._onStartPlayBind=n._onStartPlay.bind(Object(a.a)(n)),n._onTurntoH264Bind=n.onTurntoH264.bind(Object(a.a)(n)),n._onWorkerTimeoutBind=n._onWorkerTimeout.bind(Object(a.a)(n)),n._onTurntoH264Bind=n.onTurntoH264.bind(Object(a.a)(n)),n.isP2PUseH265=!0,n.isFlvUseH265=!0,n.isTurnTo264=!1,n.turnTo264Reason=-1e4,n.turnMseType=0,n.h264StreamInfo=null,n.h265StreamInfo=null,n}return Object(r.a)(i,[{key:"onFlvUrlUnavailableIn",value:function(t,e){this.trigger(N.FLV_URL_UNAVAILABLE,e)}},{key:"onH5PlayerError",value:function(t,e){this.trigger(N.H5_PLAYER_ERROR,e)}},{key:"onNoDataReceived",value:function(t,e){this.trigger(N.NO_DATA_RECEIVED,e)}},{key:"initWorker",value:function(){F.isForceUseWorker=1,tP.initWorker()}},{key:"isSupportP2P",get:function(){return!1}},{key:"isBrowserSupport",value:function(){return S.firefox||S.opera||S.chrome&&53!=S.version.major}},{key:"isNeedAud",value:function(){return S.chrome&&S.version.major>=73}},{key:"isP2PCooling",value:function(){return!1}},{key:"setOexp",value:function(t){this.stat.setComDim(R.DIM_COM.OEXP,t)}},{key:"setExtendConfig",value:function(t){if(1!=D._forbidConfig){var e={};t.p2pConfig&&(Object.assign(e,t.p2pConfig),delete t.p2pConfig),t.sdk&&(t.sdk.p2pConfig&&(Object.assign(e,t.sdk.p2pConfig),delete t.sdk.p2pConfig),Object.assign(e,t.sdk),delete t.sdk),Object.assign(e,t),this.config.init(e)}}},{key:"setConfig",value:function(t,e){this.config[t]!=e&&(this.config[t]=e,I.log("HYPlayer.setConfig ".concat(t,"=").concat(e)))}},{key:"setNimoConfig",value:function(t){try{t.nimoConfig&&(this.nimoPlayConfig=JSON.parse(t.nimoConfig)),this.setExtendConfig(this.nimoPlayConfig),this.player&&this.player.updateFlvConfig&&this.player.updateFlvConfig(),this.player&&this.player.updateP2PConfig&&this.player.updateP2PConfig(),this.checkH265Close()}catch(t){I.log("config err",t)}}},{key:"getConfig",value:function(t){return this.config[t]}},{key:"getVolume",value:function(){return this.volume}},{key:"setVolume",value:function(t){var e=Math.max(0,Number(t));e=Math.min(1,e),this.volume=e,this.player&&this.player.setVolume(e)}},{key:"getRecvInfo",value:function(){return this.player&&this.player.getRecvInfo?this.player.getRecvInfo():null}},{key:"pause",value:function(){this.player&&(this.player.pause?this.player.pause():this.player.stop())}},{key:"play",value:function(){this.player&&this.player.play&&this.player.play()}},{key:"setLogLevel",value:function(t){I.setLevel(t)}},{key:"updateLiveVodUrl",value:function(t){this.player&&this.player.updateLiveVodUrl&&this.player.updateLiveVodUrl(t)}},{key:"getExceptionStat",value:function(){return this.player.exceptionStat?this.player.exceptionStat.getStat():""}},{key:"seek",value:function(t){this.player&&this.player.seek&&this.player.seek(t)}},{key:"getLog",value:function(){return I.getLog()}},{key:"getMetrics",value:function(){return this.metrics.getResult()}},{key:"getBufferLen",value:function(){return this.player&&this.player.getBufferLen&&this.player.getBufferLen()||0}},{key:"getCurrentTime",value:function(){return this.player?this.player.getCurrentTime():0}},{key:"getCurrentDts",value:function(){return this.player&&this.player.getCurrentDts?this.player.getCurrentDts():0}},{key:"getCurrentSeiOffsetDts",value:function(){return this.player&&this.player.getCurrentSeiOffsetDts?this.player.getCurrentSeiOffsetDts():0}},{key:"getCurrentSeiDts",value:function(){return this.getCurrentDts()-this.getCurrentSeiOffsetDts()}},{key:"getDurationTime",value:function(){return this.player?this.player.getDurationTime&&this.player.getDurationTime():0}},{key:"sendMetrics",value:function(t){this.trigger(N.DATA_METRIC2,t)}},{key:"sendDanmuCarton",value:function(t,e,i){this.tsdbUtil.sendMetrics([this.stat.createAct(J.METRIC.RECV_DANMU_CARTON,{str:[t,e,i]})])}},{key:"start",value:function(t){ix.start(t.presenterUid,t.uid),t.appid&&(w.appId=t.appid,w.appid=t.appid),1==Number(F.closeNimoAuto)&&(F.autoCfg.close=1),F.isAiP2PToFlv=0,F.sdkCloseAutoAi=1,F.isCloseVodPcdn=1,F.mmsOpen=!1,F.rtPeerCfg=[[0,0,0]],t.iBitRate=this.bitrateChange.getBitrate(t.presenterUid,t.lineType,t.iBitRate),t.isAuto&&(0===this.autoStartBitrate||1==t.pullStreamFrom)&&(this.autoStartBitrate=t.curBitrate),t._startBitrate=this.autoStartBitrate,t._sessionId=this.sdkInRoomTs,F.setUseAuto(t.hasAutoBitrate||t.isAuto),F.closeP2PConfig=[0,0],t=Object.assign({uuid:this.uuid,type:0,lineType:-1,curBitrate:0,originalBitrate:0,enableLowLatency:0},t),this._stop(),this.enableLowLatency=t.enableLowLatency,I.log("HYPlayer.start t
1ype=".concat(t.type),t),t.type===i.P2PFLV&&(t.iIsP2PSupport?(this.lastP2PInfo=t,t.type=i.P2P):t.type=i.FLV),t.type===i.FLV&&(this.lastFlvInfo=t),sB.recordComDim(this.stat,t),this.stat.setComDim(R.DIM_COM.AUTO_OPEN,+!!t.hasAutoBitrate),this.stat.setComDim(R.DIM_COM.START_CODERATEBPS,1e3*this.autoStartBitrate),this.stat.setComDim(R.DIM_COM.DEFAULT_BITRATEBPS,t.defaultBitrate>-1?1e3*t.defaultBitrate:0xffffffff),this.stat.setComDim(R.DIM_COM.MEMORY_BITRATEBPS,t.memoryBitrate>-1?1e3*t.memoryBitrate:0xffffffff),this.stat.setComDim(R.DIM_COM.RECOMMEND_BITRATEBPS,t.recommendBitRate>-1?1e3*t.recommendBitRate:0xffffffff),this.stat.setComDim(R.DIM_COM.AUTO_VERSION,1),this.stat.setComDim(R.DIM_COM.PLAYER_TYPE,t.type),this.stat.setComDim(R.DIM_COM.LIVE_TYPE,t.liveType||0),this.stat.setComDim(R.DIM_COM.START_TYPE,t.startType||1),this.stat.setComDim(R.DIM_COM.AUTO_BITRATE,+!!t.isAuto),t.hasOwnProperty("isLive")&&!t.isLive&&(this.statVod.setComDim(R.DIM_COM.PLAYER_TYPE,t.type),this.statVod.setComDim(R.DIM_COM.LIVE_TYPE,t.liveType||0
1),this.statVod.setComDim(R.DIM_COM.VR_ENABLE,+(t.type===i.VR)),sB.recordComDim(this.statVod,t),this.statVod.setComDim(R.DIM_COM.SESSION_ID,this.sdkInRoomTs)),this.visibility.setStat(this.stat),this._type=t.type,w.uid=t.uid||w.uid,w.sGuid=t.sGuid||w.sGuid,0===w.convertUid&&w.uid>0&&(w.convertUid=O.rotUid(w.uid,t.presenterUid)),tP.once(this.onNoPicture,this,1e4),t.url&&(t.url=t.url.replace("http://","https://")),this.startTs=g.now(),I.log("HYPlayer.startNow",Date.now(),this.startTs),this.startInfo=t,this.startByCodec(t),this.nimoPlayConfig&&this.setNimoConfig(this.nimoPlayConfig)}},{key:"startByCodec",value:function(t){this.startTs=g.now(),this.h265Info=t,this.h265WasmProxy.initSupport(t);var e=this.getMseHevcSupport(t);if(1==F.hardHevcConfig[0]&&e&&F.useNextWcsTime&&localStorage.hasOwnProperty("nextWcsTime")){var i=Number(localStorage.nextWcsTime)||0,s=Date.now();-1===F.noNextWcsTimeUids.indexOf(Number(t.uid))&&i>s&&-1!==S.name.indexOf("edg")&&(e=!1)}this.h265Proxy=e?this.h265MseProxy:this.h265WasmProxy,e||1==t._av1State&&this.av1StreamInfo?(I.log("HYPlayer.startByCodec Play MSE H265"),this.stat.setComDim(R.DIM_COM.HARDDECODE,1),this.startPlayer(this.h265Info)):this.h265Proxy.isSupported?this.h265Proxy.loadDecoder(t.h5Root,{ready:this._onStartPlayBind,error:this._onTurntoH264Bind,timeout:this._onWorkerTimeoutBind}):this.startPlayer(t)}},{key:"getMseHevcSupport",value:function(t){return this.h265MseProxy.initSupport(t),1==Number(localStorage._forceMseHevc)?(I.warn("HYPlayer.getMseHevcSupport force mse h265"),!0):!!this.h265MseProxy.isSupported}},{key:"_onStartPlay",value:function(){this.h265Proxy.isSupported&&this.startPlayer(this.h265Info)}},{key:"_onWorkerTimeout",value:function(){this.startPlayer(this.h265Info,!0)}},{key:"startPlayer",value:function(t,e){var s=O.checkWebCodec(t,this.stat,!1)&&this.checkWebCodecOS()&&t.isLive;this.checkWebCodecSoft(t);var r=Date.now();if(this.isTurnToMse?(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,this.turnMseType),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,this.turnMseType)):t.isPureAudio?(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,16),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,16)):1==localStorage.isAngelNull?(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,17),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,17)):O.isWebcodecsBrowserSupported()?1==localStorage.isChromeH265RenderInfoEmpty?(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,19),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,19)):this.h265Proxy.isSupported&&1==localStorage.isCloseWebcodecsH265||1==localStorage.isCloseWebcodecsH264||1==t._av1State&&1==localStorage.isCloseWebcodecsAv1?(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,20),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,20)):-1!=p.os.toLowerCase().indexOf("mac")?(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,21),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,21)):localStorage.hasOwnProperty("_nextWcsRenderErrTime")&&localStorage._nextWcsRenderErrTime>r&&(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,31),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,31)):(s=!1,this.stat.setComDim(R.DIM_COM.WEBCODECS_BACK_REASON,15),t.hasOwnProperty("isLive")&&!t.isLive&&this.statVod.setComDim(R.VOD_DIM_COM.WEBCODECS_BACK_REASON,15)),this.h265Proxy&&this.h265Proxy.h265StatReport&&this.h265Proxy.h265StatReport.addH265Support){var a=-1e4;this.isTurnTo264?a=2:e&&(a=3),this.h265Proxy.h265StatReport.addH265Support(a,t)}t._dMod=O.getDecodeMod(s,this.h265Proxy.isReady,this.h265Proxy.isH265MseCodec);var n=s?L.PLAYER_CORE_TYPE.WEBCODECS:L.PLAYER_CORE_TYPE.MSE;n===L.PLAYER_CORE_TYPE.WEBCODECS?F.resendUrgentCfg=F.resendUrgentWcs:F.resendUrgentCfg=F.resendUrgentMse,this.h265Proxy.isSupported&&(this.isTurnToWebcodecsSoft=!1);var o={stat:this.stat,tsdb:this.tsdbUtil,statSwitch:this.statSwitch,sampleController:this.sampleController,playerCoreType:n,h265Proxy:this.h265Proxy,autoMonitor:this.autoMonitor,recSysStat:this.recSysStat,videoElement:this.videoElement,isPureVideo:!!t.isPureVideo,isPureAudio:!!t.isPureAudio,hyPlayerIns:this,isSoftSolution:this.isTurnToWebcodecsSoft,statVod:this.statVod};switch(I.log("HYPlayer.startNow",Date.now(),this.startTs),t.type){case i.P2P:case i.FLV:o.handlerType=1,this.player=new nV(this,o),this.player.initPlayer(t,o);break;case i.HLS:var u=i.isSupported()?rp:ry;this.player=new u(this,o);break;case i.PLAYBACK:this.player=new rQ(this,o)}this.player&&this.player.setVideoPlayTimeSended&&this.VideoPlayTimeSended&&this.player.setVideoPlayTimeSended(),this.player.start(t),this.enableLowLatency&&this.player&&this.player.setEnableLowLatency&&this.player.setEnableLowLatency(!0),nx&&(nH==t.presenterUid||0==nH)&&this.setMuted(!0),nH=t.presenterUid,nx&&this.setMuted(!0),this.player.setPlaybackrateAccess&&this.player.setPlaybackrateAccess(this.videoPlaybackrateAccess),this.playingMgr=this.player}},{key:"checkWebCodecOS",value:function(){return 1==Number(localStorage._testAllOS)||"7"==p.osVersion||109==S.version.major&&!O.isMseSupportedHevc()&&-1!==S.name.indexOf("chrome")}},{key:"onTurnToMse",value:function(t,e){I.log("HYPlayer.onTurnToMse, turn to MSE"),this.isTurnToMse=!0,this.isTurnToWebcodecsSoft=!1,this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?(this.lastFlvInfo._isTurnTomse=1,this.start(this.lastFlvInfo)):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P?(this.lastP2PInfo._isTurnTomse=1,this.start(this.lastP2PInfo)):this.lastHlsInfo&&this.lastHlsInfo.type===i.HLS?(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastHlsInfo.seekTime=e.seekTime),this.start(this.lastHlsInfo)):this.lastPlayBackInfo&&this.lastPlayBackInfo.type===i.PLAYBACK&&(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastPlayBackInfo.seekTime=e.seekTime),this.start(this.lastPlayBackInfo))}},{key:"onWebcodecsRetry",value:function(t,e){I.log("HYPlayer.onWebcodecsRetry"),this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?this.start(this.lastFlvInfo):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P?this.start(this.lastP2PInfo):this.lastHlsInfo&&this.lastHlsInfo.type===i.HLS?(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastHlsInfo.seekTime=e.seekTime),this.start(this.lastHlsInfo)):this.lastPlayBackInfo&&this.lastPlayBackInfo.type===i.PLAYBACK&&(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastPlayBackInfo.seekTime=e.seekTime),this.start(this.lastPlayBackInfo))}},{key:"onResetPlayer",value:function(){this.stop(),I.log("HYPlayer.onResetPlayer"),this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?this.start(this.lastFlvInfo):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P&&this.start(this.lastP2PInfo)}},{key:"onTurnToWebcodecsSoft",value:function(t,e){localStorage._webcodecSoftNums||(localStorage._webcodecSoftNums=0,localStorage._webcodecSoftDate=Date.now());var s=Number(localStorage._webcodecSoftNums)+1;localStorage._webcodecSoftNums=s,this.isTurnToMse=!1,this.isTurnToWebcodecsSoft=!0,this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?this.start(this.lastFlvInfo):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P?this.start(this.lastP2PInfo):this.lastHlsInfo&&this.lastHlsInfo.type===i.HLS?(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastHlsInfo.seekTime=e.seekTime),this.start(this.lastHlsInfo)):this.lastPlayBackInfo&&this.lastPlayBackInfo.type===i.PLAYBACK&&(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastPlayBackInfo.seekTime=e.seekTime),this.start(this.lastPlayBackInfo))}},{key:"checkWebCodecSoft",value:function(t){localStorage._webcodecSoftDate&&(Date.now()-Number(localStorage._webcodecSoftDate)>=864e5?(delete localStorage._webcodecSoftDate,delete localStorage._webcodecSoftNums):Number(localStorage._webcodecSoftNums)>=3&&(this.isTurnToWebcodecsSoft=!0)),1==F.isQQSoft&&94==S.version.major&&-1!=navigator.userAgent.toLowerCase().indexOf("qq")&&"7"==p.osVersion&&(this.isTurnToWebcodecsSoft=!0),1!=F.isWin7WcsSoft||"7"!=p.osVersion&&(109!=S.version.major||O.isMseSupportedHevc()||-1===S.name.indexOf("chrome"))||(this.isTurnToWebcodecsSoft=!0),-1!=F.wcsSoftBrows.indexOf(S.version.major)&&-1!==S.name.indexOf("chrome")&&(this.isTurnToWebcodecsSoft=!0),-1!=F.wcsSoft264Uids.indexOf(Number(t.uid))&&
1(this.isTurnToWebcodecsSoft=!0),1==localStorage._forceWebcodecsSoft&&(this.isTurnToWebcodecsSoft=!0)}},{key:"attachMediaElement",value:function(t){this.videoElement=t}},{key:"sendVideoLoadError",value:function(){this.player&&this.player.sendLoadVideoErrorStatus()}},{key:"getPlayStats",value:function(){return{create_time:this.stat.create_time,isSendLoadTime:this.tsdbUtil.isSendLoadTime,noPictureP2PSended:this.noPictureP2PSended,noPictureFlvSended:this.noPictureFlvSended}}},{key:"setPlayStats",value:function(t){t.hasOwnProperty("create_time")&&this.stat.setCreateTime(t.create_time),this.tsdbUtil.isSendLoadTime=t.isSendLoadTime,this.noPictureP2PSended=t.noPictureP2PSended,this.noPictureFlvSended=t.noPictureFlvSended}},{key:"onNoPicture",value:function(){if(tP.remove(this.onNoPicture,this),!this.noPictureSended&&this.player){this.noPictureSended=!0;var t=this.player.getRecvInfo?this.player.getRecvInfo():[],e=[100*!this.player.isPlaying,100*!this.player.hasPicture].concat(t),i=g.now()-this.stat.create_time,s=R.ACT.NO_PICTURE;i<1e4&&this.isP2P&&!this.player.isPlaying&&(s=R.ACT.NO_PICTURE_P2P);var r=0;this.player&&this.player.mse&&(r=this.player.mse.isMediaSourceOpen?1:2);var a=[],n=this.getExceptionStat(),o=O.getBrowserHidden();o&&2==r?I.log("HYPlayer.onNoPicture browserHidden=".concat(o,", isMediaSourceOpen=").concat(r)):a.push(this.stat.createAct(s,{value:e,str:[S.platform,r,n,100===e[0]?this.startInfo&&JSON.stringify(this.startInfo):""]})),this.stat.setActDim(R.DIM_LINK_STA.name,n),a.push(this.stat.createAct(R.ACT.LINK_STA,{value:[100*!this.player.hasPicture,100*!this.player.isPlaying],str:[S.platform,s,r]})),this.trigger(N.DATA_METRIC2,a)}}},{key:"reportNoPictureProps",value:function(){if(this.player){I.log("HYNimoPlayer.reportNoPictureProps");var t=this.player&&this.player.getCostTimes?this.player.getCostTimes():[],e=[100*!this.player.isPlaying,100*!this.player.hasPicture].concat(t),i=[this.stat.createAct(R.ACT.NO_PICTURE2,{value:e})];this.trigger(N.DATA_METRIC2,i)}}},{key:"onPlayVideo",value:function(t){this.audiouitil||(this.audiouitil=new rC),this.player&&this.player.setAudioUtil&&this.player.setAudioUtil(this.audiouitil),this.VideoPlayTimeSended=!0}},{key:"_stop",value:function(){I.log("HYPlayer._stop"),tP.remove(this.onNoPicture,this),this.player&&(this.player.stop(),this.player.destroy&&this.player.destroy(),this.player=null),this.visibility.delVisibilitychange(),I.groupEnd(),this.stat.reset(),this.startTs=0}},{key:"stop",value:function(){I.group("HYPlayer.stop"),this._stop(),this.h265Proxy&&this.h265Proxy.stop()}},{key:"stopRoomRecord",value:function(){I.log("HYPlayer.stopRoomRecord"),this.roomRecordStat.stop()}},{key:"setAppHandler",value:function(t){t.onHySDKPlayerInited(this)}},{key:"setTafHandler",value:function(t){rI.default.setTafHandler(t),tb.start()}},{key:"flvTryToP2P",value:function(){this.lastP2PInfo&&(this.noPictureSended=!1)}},{key:"onP2pTimeout",value:function(){this.onNoPicture(),this.noPictureSended=!1}},{key:"tryPlayP2PTimeout",value:function(){!this.player||this.isP2P&&this.player.isPlaying||this.trigger(N.P2P_TIMEOUT)}},{key:"reportLoadP2PLib",value:function(t){var e=[this.stat.createAct(R.ACT.LOAD_P2PLIB_ERROR,{value:[100*!!t],str:[S.platform]})];this.trigger(N.DATA_METRIC2,e)}},{key:"switchLevel",value:function(t){t&&t.url&&(t.url=t.url.replace("http://","https://")),this.player&&this.player.switchLevel(t)}},{key:"getCdnSip",value:function(){return this.player&&this.player.getCdnSip&&this.player.getCdnSip()}},{key:"setAbTestConfig",value:function(t){if(I.log("HYPlayer.setAbTestConfig abConfig",t),!t)return null;""!=t.mpExperiment&&this.stat.setComDim(R.DIM_COM.OEXP,t.mpExperiment)}},{key:"getUseAuto",value:function(){return this.autoForce.getUseAuto()}},{key:"getSupportAuto",value:function(){return!F.getEnableJumpBuffer()}},{key:"p2pFlvPlayerSetType",value:function(t){switch(this._type=t,t){case i.FLV:this.roomRecordStat.liveType=R.LIVE_TYPE.FLV;break;case i.P2P:this.roomRecordStat.liveType=R.LIVE_TYPE.P2P}}},{key:"onTurntoH264",value:function(){I.log("HYPlayer.onTurntoH264, turn to h264"),this.h265Proxy.onTurnToH264(this._type),this.isTurnTo264=!0,this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?this.start(this.lastFlvInfo):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P&&this.start(this.lastP2PInfo)}},{key:"onTurntoH265Wasm",value:function(t,e){I.log("HYPlayer.onTurntoH265Wasm, turn to h265 wasm",t),this.stop("sdk"),1===Number(localStorage._forceMseHevc)&&localStorage.setItem&&localStorage.setItem("_forceMseHevc",0),this.h265MseProxy.onTurntoH265Wasm(this.type),this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?this.start(this.lastFlvInfo):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P?this.start(this.lastP2PInfo):this.lastHlsInfo&&this.lastHlsInfo.type===i.HLS?(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastHlsInfo.seekTime=e.seekTime),this.start(this.lastHlsInfo)):this.lastPlayBackInfo&&this.lastPlayBackInfo.type===i.PLAYBACK&&(e&&"number"==typeof e.seekTime&&e.seekTime>0&&(this.lastPlayBackInfo.seekTime=e.seekTime),this.start(this.lastPlayBackInfo))}},{key:"onH265Retry",value:function(){I.log("HYPlayer.onH265Retry, H265 retry!"),this.lastFlvInfo&&this.lastFlvInfo.type===i.FLV?this.start(this.lastFlvInfo):this.lastP2PInfo&&this.lastP2PInfo.type===i.P2P&&this.start(this.lastP2PInfo)}},{key:"containerResize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.videoPixelateMgr&&this.videoPixelateMgr.containerResize(t),this.player&&this.player.containerResize&&this.player.containerResize(t)}
1},{key:"onAutoBitrateChanged",value:function(){if(this.player){var t=this.player.info;if(t){var e={curBitrate:t.curBitrate,originalBitrate:t.originalBitrate,iBitRate:t.iBitRate,iCodecType:t.iCodecType,iHEVCBitRate:t.iHEVCBitRate};this.lastP2PInfo&&Object.assign(this.lastP2PInfo,e),this.lastFlvInfo&&Object.assign(this.lastFlvInfo,e)}}}},{key:"checkH265Close",value:function(){var t=F.h265BlackUids,e=F.isConfigSupportH265;if((this._type==i.FLV||this._type==i.P2P)&&this.h265Proxy.isSupported){I.log("HYNimoPlayer.checkH265Close,isConfigSupportH265=".concat(e,", h265BlackUids="),t);var s=this.h265Info,r=F.h265Config,a=s.presenterUid,n=!0,o=s.curBitrate;0==e&&this.onTurntoH264(),t.forEach(function(t){a&&t.toString()==a.toString()&&(n=!1)}),n||this.onTurntoH264(),r[1].length>0&&-1==r[1].indexOf(o)&&this.onTurntoH264()}}},{key:"setMuted",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];Object(n.a)(Object(o.a)(i.prototype),"setMuted",this).call(this,t),nx=t,this.stat.setComDim(R.DIM_COM.IS_MUTE,+!!t)}},{key:"setBackDropFilter",value:function(t,e,s){Object(n.a)(Object(o.a)(i.prototype),"setBackDropFilter",this).call(this,t,e,s),this.stat.setComDim(R.DIM_COM.IS_MOSAIC,+!!t)}},{key:"type",get:function(){return this._type}},{key:"isFlv",get:function(){return this._type==i.FLV}},{key:"isP2P",get:function(){return this._type==i.P2P}},{key:"isHls",get:function(){return this._type==i.HLS}}],[{key:"isSupported",value:function(){return A.isMseSupportedH264()&&!S.msie}},{key:"Events",get:function(){return N}},{key:"getLog",value:function(){return I.getLog()}}]),i}(M);nG.FLV=1,nG.P2P=2,nG.HLS=3,nG.HUYA=4,nG.STREAM=5,nG.PLAYBACK=9,nG.P2PFLV=10,e.default=nG,window.HYPlayer=nG,window.H5Player=nG},function(t,e,i){"use strict";i.r(e);var s=i(0),r=i(1),a=i(3),n=i(2),o=i(7),u=i(6),l=function(){function t(e){Object(s.a)(this,t),this.data=new Uint8Array(e),this.idx=0,this.size=e}return Object(r.a)(t,[{key:"getData",value:function(){if(this.idx!=this.size)throw"Mismatch between size reserved and sized used";return this.data.slice(0,this.idx)}},{key:"writeUint8",value:function(t){this.data.set([t],this.idx),this.idx++}},{key:"writeUint16",value:function(t){var e=new Uint16Array(1);e[0]=t;var i=new Uint8Array(e.buffer);this.data.set([i[1],i[0]],this.idx),this.idx+=2}},{key:"writeUint8Array",value:function(t){this.data.set(t,this.idx),this.idx+=t.length}}]),t}(),d=i(22),c=i(20),f=i(14),p=i(23);function m(t){return Object(d.a)(t)||Object(c.a)(t)||Object(f.a)(t)||Object(p.a)()}var _=i(13),y=i(11),v=function(){function t(e,i,r){Object(s.a)(this,t),this.timeStamp=i,this.frame=r,this.type=e,this.isEmptyAudioFrame=!1}return Object(r.a)(t,[{key:"setIsEmptyAudioFrame",value:function(t){this.isEmptyAudioFrame=t}}]),t}();v.VIDEO=0,v.AUIDO=1;var S=i(4),g=Object(r.a)(function t(e,i,r){var a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];Object(s.a)(this,t),this.data=r,this.timeStamp=i,this.type=e,this.startDecodeTime=0,this.decodedTime=0,this.discardAllow=a,this.isKeyFrame=n});g.VIDEO=0,g.AUIDO=1;var T=i(9),P=i(12),C=function(){function t(e){Object(s.a)(this,t),this.samples=[],this.decodedFrames=[],this.decoder=null,this.decodingTimeStamp=0,this.decodingType=0,this.decodeState=t.DECODE_STATE_PENDDING,this.decodeNums=0,this.toDecodeNums=0,this.lastToDecodeNums=0,this.lastDecodedNums=0,this.player=e,this.decodeDatas=[],this.decodIngAudioFrameTimeStamps=[],this.decodIngAudioFrameIsEmptyTypes=[],this.count=0,this.closed=!1,this.toDecodeFrameLocalTimeMap=new Map,this.frameDecodeDelays=[],this.smoothFrameDecodeDelay=0,this.decodedFrameStamp=0,this.printTodecodeCnt=0,this.printDecodedCnt=0,this.findTimestampCnt=0,this.lastToDecodePts=0,this.lastDecodedPts=0,this.lastTodecodeDts=0}return Object(r.a)(t,[{key:"configured",get:function(){return this.decoder&&"configured"==this.decoder.state}},{key:"close",value:function(){this.closed=!0,this.decodeDatas.length=0,this.decodeNums=0,this.toDecodeNums=0,this.lastToDecodeNums=0,this.lastDecodedNums=0,"closed"!=this.decoder.state&&(this.decoder.reset(),this.decoder.close()),this.decoder=null,this.player=null,this.decodedFrameStamp=0}},{key:"appendSamples",value:function(e,i){for(;e.length>0;)this.samples.push(e.shift());this.decodeState==t.DECODE_STATE_PENDDING&&this.decodeChunk(i)}},{key:"getUnDecodeBuffer",value:function(){return this.lastToDecodePts>0&&this.lastDecodedPts>0?this.lastToDecodePts-this.lastDecodedPts:0}},{key:"decodeFrame",value:function(t){if(this.toDecodeNums++,this.lastToDecodePts=t.timeStamp+(t.compositionTime||0),t.type==g.AUIDO?this.player.storeWorkerShared(T.StoreWorkerType.AUDIO_TODECODE_NUMS,this.toDecodeNums):t.type==g.VIDEO&&this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_TODECODE_NUMS,this.toDecodeNums),this.toDecodeFrameLocalTimeMap.set(t.timeStamp,S.default.getNow()),this.toDecodeFrameLocalTimeMap.size>300){var e,i=Object(y.a)(this.toDecodeFrameLocalTimeMap);try{for(i.s();!(e=i.n()).done;){var s=Object(_.a)(e.value,1)[0];if(this.toDecodeFrameLocalTimeMap.delete(s),this.toDecodeFrameLocalTimeMap.size<=200)break}}catch(t){i.e(t)}finally{i.f()}}P.a.printTodecodeVideo&&t.type===g.VIDEO&&S.default.log("WebCodecsDecoder.decodeFrame isKey=".concat(t.isKeyFrame," dts=").concat(t.timeStamp," cts=").concat(t.compositionTime," pts=").concat(t.timeStamp+t.compositionTime," gap=").concat(t.timeStamp-this.lastTodecodeDts," lastDecodedPts=").concat(this.lastDecodedPts," samples=").concat(this.player.decodeJitter.videoSamples.length," decodedNum=").concat(this.player.videoRender.framelist.length," queueSize=").concat(this.decoder.decodeQueueSize," toDecodeTotal=").concat(this.toDecodeNums," decodedTotal=").concat(this.decodeNums)),P.a.printToDecodeAudio&&t.type===g.AUIDO&&S.default.log("WebCodecsDecoder.decodeFrame dts=".concat(t.timeStamp," gap=").concat(t.timeStamp-this.lastTodecodeDts," lastDecodedPts=").concat(this.lastDecodedPts," samples=").concat(this.player.decodeJitter.audioSamples.length," decodedNum=").concat(this.player.audioRender.framelist.length," queueSize=").concat(this.decoder.decodeQueueSize)),this.lastTodecodeDts=t.timeStamp;try{this.decoder.decode(t.data)}catch(e){console.error(e,t,t.naluType,t.isKeyFrame,t.timeStamp,this.toDecodeNums,"webCodecsDecoder"),this.onDecoderError(e)}}},{key:"onFrame",value:function(t){var e=S.default.getNow();if(this.decodedFrameStamp=e,this.lastDecodedPts=t.timestamp,this.closed)t.close();else{this.decodeNums++;var i=0,s=!1;if(this.decodingType==g.AUIDO?(i=this.decodIngAudioFrameTimeStamps.shift(),s=this.decodIngAudioFrameIsEmptyTypes.shift(),this.player.storeWorkerShared(T.StoreWorkerType.AUDIO_DECODE_NUMS,this.decodeNums)):this.decodingType==g.VIDEO&&(this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_DECODE_NUMS,this.decodeNums),i=t.timestamp),this.toDecodeFrameLocalTimeMap.has(i)){this.findTimestampCnt++;var r=Math.floor(100*(S.default.getNow()-this.toDecodeFrameLocalTimeMap.get(i)))/100;P.a.printDecodedVideo&&this.decodingType===g.VIDEO&&S.default.log("WebcodecsDecoder.decode timeStamp=".concat(i," delay=").concat(r," samples=").concat(this.player.decodeJitter.videoSamples.length," frames=").concat(this.player.videoRender.framelist.length)),P.a.printDecodedAudio&&this.decodingType===g.AUIDO&&S.default.log("WebcodecsDecoder.decode timeStamp=".concat(i," delay=").concat(r," samples=").concat(this.player.decodeJitter.audioSamples.length," frames=").concat(this.player.audioRender.framelist.length)),this.frameDecodeDelays.push(r),this.toDecodeFrameLocalTimeMap.delete(i),0===this.smoothFrameDecodeDelay?this.smoothFrameDecodeDelay=r:this.smoothFrameDecodeDelay=(7*this.smoothFrameDecodeDelay+r)/8}var a=i,n=new v(this.decodingType,a,t);n.setIsEmptyAudioFrame(s),this.player.onFrameDecoded(n)}}},{key:"getDecodeDelay",value:function(){var t=m(this.frameDecodeDelays).slice(0);return this.frameDecodeDelays.length=0,t}},{key:"onDecoderError",value:function(t){S.default.log("WebCodecsDecoder.onDecoderError, decodingType=".concat(this.decodingType));var e=T.ToMainMessageType.VIDEODECODEERROR;this.decodingType==g.VIDEO?e=T.ToMainMessageType.VIDEODECODEERROR:this.decodingType==g.AUIDO&&(e=T.ToMainMessageType.AUDIODECODEERROR),this.player.handlerError(e,{msg:t&&t.message})}},{key:"getDecodeFps",value:function(){var t={toDecodeFps:this.toDecodeNums-this.lastToDecodeNums,decodeFps:this.decodeNums-this.lastDecodedNums};return this.lastDecodedNums=this.decodeNums,this.lastToDecodeNums=this.toDecodeNums,t}},{key:"resetDecoder",value:function(){}}]),t}();C.DECODE_STATE_PENDDING=0,C.DECODE_STATE_DECODEDING=1,C.DECODE_STATE_DECODEFINISH=2,C.DECODER_ERROR="video_deocde_error",C.DECODER_TYPE_VIDEO=0,C.DECODER_TYPE_AUDIO=1;var E=function(t){Object(o.a)(i,t);var e=Object(u.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).decodingType=g.VIDEO,r.avcHeader=null,r.avcHeaderChanged=!1,r.lastToDecodeFrameTimeStamp=0,r.createDecoder(),r._isUseSoftAcceleration=!1,r.checkDecodedOutputFrameTypeTimes=0,r.lastDecodedFrameTimeStamp=0,r.outputFrameByPts=!1,r.outputFrameMode=-1,r.checkFrameCnt=0,r.hasCts=!1,r.codecType="",r._lastDecodedTs=-1e4,r.decodedNum=0,r.firstToDecodeTs=0,r.f
1irstDecodedTs=0,r}return Object(r.a)(i,[{key:"resetDecoder",value:function(){this.decodeDatas.length=0,this.decodeNums=0,this.toDecodeNums=0,this.lastToDecodeNums=0,this.lastDecodedNums=0,"closed"!=this.decoder.state&&(this.decoder.reset(),this.decoder.close()),this.decoder=null,this.decodedFrameStamp=0,this.lastToDecodePts=0,this.lastDecodedPts=0,this.createDecoder(),this.setAVCConfig()}},{key:"createDecoder",value:function(){this.decoder=new VideoDecoder({output:this.onFrame.bind(this),error:this.onDecoderError.bind(this)})}},{key:"close",value:function(){Object(a.a)(Object(n.a)(i.prototype),"close",this).call(this),this.codecType=""}},{key:"decodeFrame",value:function(t){t.isKeyFrame&&this.updateAVCConfig(t.sps,t.pps,t.vps,t.codec,t.width,t.height,t.av1SequenceData),this.lastToDecodeFrameTimeStamp=t.timeStamp,t.compositionTime>0&&(this.hasCts=!0),0==this.firstToDecodeTs&&(this.firstToDecodeTs=S.default.getNow()),Object(a.a)(Object(n.a)(i.prototype),"decodeFrame",this).call(this,t)}},{key:"onFrame",value:function(t){var e=S.default.getNow();this.decodedNum+=1,-1e4!=this._lastDecodedTs&&e-this._lastDecodedTs>=200&&S.default.log("WebCodecsVideoDecoder.onFrame ts delta=".concat(e-this._lastDecodedTs,", toDecodeNum=").concat(this.toDecodeNums,", decodedNum=").concat(this.decodedNum,", findTimestampCnt=").concat(this.findTimestampCnt,", frames=").concat(this.player.videoRender.getDecodedFrames()));var s=0;0==this.firstDecodedTs&&0!=this.firstToDecodeTs&&(this.firstDecodedTs=e,s=this.firstDecodedTs-this.firstToDecodeTs,this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_FIRST_FRAME_DECODEC_COST,s)),this._lastDecodedTs=e,this.checkOutputMode(t.timestamp),this.checkFrameOutputByPts(t.timestamp),this.lastDecodedFrameTimeStamp=t.timestamp,Object(a.a)(Object(n.a)(i.prototype),"onFrame",this).call(this,t)}},{key:"checkFrameOutputByPts",value:function(t){!this.outputFrameByPts&&this.checkDecodedOutputFrameTypeTimes<100&&t<this.lastDecodedFrameTimeStamp&&(this.checkDecodedOutputFrameTypeTimes++,this.outputFrameByPts=!0,this.player.setVideoOutputByPts(this.outputFrameByPts))}},{key:"checkOutputMode",value:function(t){-1===this.outputFrameMode&&this.checkFrameCnt<100&&(this.checkFrameCnt++,t<this.lastDecodedFrameTimeStamp?this.outputFrameMode=2:100===this.checkFrameCnt&&-1===this.outputFrameMode&&(this.hasCts?this.outputFrameMode=1:this.outputFrameMode=2))}},{key:"isOutputFrameByDts",value:function(){return 1===this.outputFrameMode}},{key:"updateAVCConfig",value:function(t,e,i,s,r,a,n){this.avcHeaderChanged=this.checkVideoConfigChanged(e,t,i,n),this.av1SequenceData=n,this.avcHeader={sps:t,pps:e,vps:i,codec:s,width:r,height:a},this.avcHeaderChanged&&(S.default.log("WebCodecsDecoder.updateVideoConfig codec=".concat(s," width=").concat(r," height=").concat(a)),this.setAVCConfig())}},{key:"checkVideoConfigChanged",value:function(t,e,i,s){if(s)return!this.av1SequenceData||this.av1SequenceData.toLocaleString()!==s.toLocaleString();if(!this.avcHeader)return!0;if(this.avcHeader&&-1!==this.avcHeader.codec.indexOf("hvc")){if(this.avcHeader.pps[0].nalu.toLocaleString()==t[0].nalu.toLocaleString()&&this.avcHeader.sps[0].nalu.toLocaleString()==e[0].nalu.toLocaleString()&&this.avcHeader.vps[0].nalu.toLocaleString()==i[0].nalu.toLocaleString())return!1}else if(this.avcHeader&&-1!==this.avcHeader.codec.indexOf("avc")&&this.avcHeader.pps[0].nalu.toLocaleString()==t[0].nalu.toLocaleString()&&this.avcHeader.sps[0].nalu.toLocaleString()==e[0].nalu.toLocaleString())return!1;return!0}},{key:"setAVCConfig",value:function(){S.default.log("WebCodecsDecoder.setAVCConfig"),this.setDecoderConfig(),this.avcHeaderChanged=!1}},{key:"setDecoderConfig",value:function(){var t=this.getExtradata();if(t){var e={codec:this.avcHeader.codec,codedWidth:this.avcHeader.width,codedHeight:this.avcHeader.height,description:t,optimizeForLatency:!1};this._isUseSoftAcceleration&&(e.hardwareAcceleration="prefer-software"),this.videoConfig=e,S.default.log("WebCodecsDecoder.setDecoderConfig",e.hardwareAcceleration,this._isUseSoftAcceleration),this.decoder.configure(e)}else S.default.log("WebCodecsDecoder.setDecoderConfig extradata is null!")}}
1,{key:"initAv1Seg",value:function(t){this.codecType="av01",this.setAv1DecoderConfig(t)}},{key:"setAv1DecoderConfig",value:function(t){var e={codec:t.codec,codedWidth:t.width,codedHeight:t.height,description:t.configOBUs};this._isUseSoftAcceleration&&(e.hardwareAcceleration="prefer-software"),this.videoConfig&&this.videoConfig.codec===t.codec&&(this.videoConfig.description,t.description),this.videoConfig=e,S.default.log("WebCodecsDecoder.setAv1DecoderConfig,codec=".concat(t.codec)),this.decoder.configure(e),this.isConfig=!0}},{key:"seek",value:function(){this.decoder.reset(),this.decoder.configure(this.videoConfig)}},{key:"getExtradata",value:function(){return -1!==this.avcHeader.codec.indexOf("hvc")?(this.codecType="265",this.getExtradata265()):-1!==this.avcHeader.codec.indexOf("avc")?this.getExtradata264():-1!==this.avcHeader.codec.indexOf("av01")?this.av1SequenceData:null}},{key:"getExtradata265",value:function(){var t=this._getNumOfArrays(this.avcHeader.vps,32),e=this._getNumOfArrays(this.avcHeader.sps,33),i=this._getNumOfArrays(this.avcHeader.pps,34),s=this._getSPSOri(e),r=[1,s[8],s[9],s[10],s[11],s[12],s[13],s[14],s[15],s[16],s[17],s[18],s[19],240,0,252,253,248,248,0,0,15];return r.push(3),new Uint8Array(r=r.concat(t).concat(e).concat(i))}},{key:"_getNumOfArrays",value:function(t,e){var i=[];i.push(128|e),i.push((65280&t.length)>>8),i.push(255&t.length);for(var s=0;s<t.length;s++){var r=t[s].nalu;i.push((65280&r.length)>>8),i.push(255&r.length),i=i.concat(Array.prototype.slice.call(r))}return i}},{key:"_getSPSOri",value:function(t){for(var e=[],i=0,s=0;s<t.length;){var r=t[s];2!==i||3!==r?(0===r?i++:i=0,e.push(r),++s):(++s,i=0)}return e}},{key:"getExtradata264",value:function(){var t,e=7;for(t=0;t<this.avcHeader.sps.length;t++)e+=2+this.avcHeader.sps[t].length;for(t=0;t<this.avcHeader.pps.length;t++)e+=2+this.avcHeader.pps[t].length;var i=new l(e),s=this.avcHeader.sps[0].nalu[1],r=this.avcHeader.sps[0].nalu[2],a=this.avcHeader.sps[0].nalu[3];for(i.writeUint8(1),i.writeUint8(s),i.writeUint8(r),i.writeUint8(a),i.writeUint8(255),i.writeUint8(this.avcHeader.sps.length+224),t=0;t<this.avcHeader.sps.length;t++)i.writeUint16(this.avcHeader.sps[t].length),i.writeUint8Array(this.avcHeader.sps[t].nalu);for(i.writeUint8(this.avcHeader.pps.length),t=0;t<this.avcHeader.pps.length;t++)i.writeUint16(this.avcHeader.pps[t].length),i.writeUint8Array(this.avcHeader.pps[t].nalu);return i.getData()}},{key:"setUseSoftAcceleration",value:function(){this._isUseSoftAcceleration=!0}},{key:"getDecodingBuffer",value:function(){return this.lastToDecodeFrameTimeStamp-this.lastDecodedFrameTimeStamp}}]),i}(C),I=i(8),k=function(t){Object(o.a)(i,t);var e=Object(u.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t)).decodingType=g.AUIDO,r.aacConfig=null,r.aacConfigChanged=!1,r.aacConfigInited=!1,r.decoder=new AudioDecoder({output:r.onFrame.bind(Object(I.a)(r)),error:r.onDecoderError.bind(Object(I.a)(r))}),r._lastDecodedTs=-1e4,r.decodedNum=-1,r.aacTimeLen=1024e3/44100,r.firstToDecodeTs=0,r.firstDecodedTs=0,r}return Object(r.a)(i,[{key:"updateAudioConfig",value:function(t,e,i,s){this.aacConfig&&this.aacConfig.codec==t&&this.aacConfig.sampleRate==e&&this.aacConfig.numberOfChannels==i||(this.aacConfig={codec:t,sampleRate:e,numberOfChannels:i,timestamp:s},this.aacConfigChanged=!0),this.aacConfigInited||this.setAACConfig(this.aacConfig.codec,this.aacConfig.sampleRate,this.aacConfig.numberOfChannels)}},{key:"setAACConfig",value:function(t,e,i){var s={codec:t,sampleRate:e,numberOfChannels:i};this.aacTimeLen=1024e3/e,this.audioConfig=s,S.default.log("WebCodecsAudioDecoder.setAACConfig,c=".concat(t,",sr=").concat(e,",nc=").concat(i,",aacT=").concat(this.aacTimeLen)),this.decoder.configure(s),this.aacConfigInited=!0}},{key:"seek",value:function(){this.decoder.reset(),this.decoder.configure(this.audioConfig)}},{key:"decodeFrame",value:function(t){this.aacConfigChanged&&this.aacConfig.timestamp<=t.timeStamp&&(this.setAACConfig(this.aacConfig.codec,this.aacConfig.sampleRate,this.aacConfig.numberOfChannels),this.aacConfigChanged=!1),0==this.firstToDecodeTs&&(this.firstToDecodeTs=S.default.getNow()),Object(a.a)(Object(n.a)(i.prototype),"decodeFrame",this).call(this,t),this.decodIngAudioFrameTimeStamps.push(t.timeStamp),this.decodIngAudioFrameIsEmptyTypes.push(t.isEmptyAudioFrame)}},{key:"onFrame",value:function(t){this.decodedNum+=1;var e=S.default.getNow();-1e4!=this._lastDecodedTs&&e-this._lastDecodedTs>=200&&S.default.log("WebCodecsVideoDecoder.onFrame ts delta=".concat(e-this._lastDecodedTs,", num=").concat(this.decodedNum));var s=0;0==this.firstDecodedTs&&0!=this.firstToDecodeTs&&(this.firstDecodedTs=e,s=this.firstDecodedTs-this.firstToDecodeTs,this.player.storeWorkerShared(T.StoreWorkerType.AUDIO_FIRST_FRAME_DECODEC_COST,s)),Object(a.a)(Object(n.a)(i.prototype),"onFrame",this).call(this,t)}},{key:"getAacTimeLen",value:function(){return this.aacTimeLen}}]),i}(C),A=i(16),R=function(){function t(e){Object(s.a)(this,t),this._name=e,this._startTs=0,this._startDts=0,this._lastDts=0,this._jumpTime=0,this._lastDts=0,this._lastTs=0}return Object(r.a)(t,[{key:"setLast",value:function(t,e){this._lastDts=t,this._lastTs=e}},{key:"getDtsSlowTime",value:function(t,e){if(this._lastDts>0){var i=t-this._lastDts;return e-this._lastTs-i}return 0}},{key:"lastDts",get:function(){return this._lastDts}},{key:"setJumpTime",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._jumpTime+=t,e&&S.default.log("Timeline.setJumpTime name=".concat(this._name," jumpTime=").concat(t," totalJumpTime=").concat(this._jumpTime))}},{key:"reset",value:function(){this._startTs=0,this._startDts=0,this._lastDts=0}},{key:"start",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];0===this._startTs&&(i&&S.default.log("Timeline.start name=".concat(this._name," dts=").concat(e)),this._startTs=t,this._startDts=e)}},{key:"getTsTime",value:function(t){return Math.floor(t-this._startTs+this._jumpTime)}
1},{key:"getDtsNow",value:function(t){return this._startDts+this.getTsTime(t)}},{key:"isDtsLess",value:function(t,e){return e<this.getDtsNow(t)}}]),t}(),D=i(5);function O(){O=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,s=Object.defineProperty||function(t,e,i){t[e]=i.value},r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",n=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,i){return t[e]=i}}function l(t,e,i,r){var a,n,o,u,l=Object.create((e&&e.prototype instanceof f?e:f).prototype);return s(l,"_invoke",{value:(a=t,n=i,o=new E(r||[]),u="suspendedStart",function(t,e){if("executing"===u)throw Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return{value:void 0,done:!0}}for(o.method=t,o.arg=e;;){var i=o.delegate;if(i){var s=function t(e,i){var s=i.method,r=e.iterator[s];if(void 0===r)return i.delegate=null,"throw"===s&&e.iterator.return&&(i.method="return",i.arg=void 0,t(e,i),"throw"===i.method)||"return"!==s&&(i.method="throw",i.arg=TypeError("The iterator does not provide a '"+s+"' method")),c;var a=d(r,e.iterator,i.arg);if("throw"===a.type)return i.method="throw",i.arg=a.arg,i.delegate=null,c;var n=a.arg;return n?n.done?(i[e.resultName]=n.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,c):n:(i.method="throw",i.arg=TypeError("iterator result is not an object"),i.delegate=null,c)}(i,o);if(s){if(s===c)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===u)throw u="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);u="executing";var r=d(a,n,o);if("normal"===r.type){if(u=o.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(u="completed",o.method="throw",o.arg=r.arg)}})}),l}function d(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function f(){}function p(){}function m(){}var _={};u(_,a,function(){return this});var y=Object.getPrototypeOf,v=y&&y(y(I([])));v&&v!==e&&i.call(v,a)&&(_=v);var S=m.prototype=f.prototype=Object.create(_);function g(t){["next","throw","return"].forEach(function(e){u(t,e,function(t){return this._invoke(e,t)})})}function T(t,e){var r;s(this,"_invoke",{value:function(s,a){function n(){return new e(function(r,n){!function s(r,a,n,o){var u=d(t[r],t,a);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==typeof c&&i.call(c,"__await")?e.resolve(c.__await).then(function(t){s("next",t,n,o)},function(t){s("throw",t,n,o)}):e.resolve(c).then(function(t){l.value=t,n(l)},function(t){return s("throw",t,n,o)})}o(u.arg)}(s,a,r,n)})}return r=r?r.then(n,n):n()}})}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var s=-1,r=function e(){for(;++s<t.length;)if(i.call(t,s))return e.value=t[s],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=m,s(S,"constructor",{value:m,configurable:!0}),s(m,"constructor",{value:p,configurable:!0}),p.displayName=u(m,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,o,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},g(T.prototype),u(T.prototype,n,function(){return this}),t.AsyncIterator=T,t.async=function(e,i,s,r,a){void 0===a&&(a=Promise);var n=new T(l(e,i,s,r),a);return t.isGeneratorFunction(i)?n:n.next().then(function(t){return t.done?t.value:n.next()})},g(S),u(S,o,"Generator"),u(S,a,function(){return this}),u(S,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),i=[];for(var s in e)i.push(s);return i.reverse(),function t(){for(;i.length;){var s=i.pop();if(s in e)return t.value=s,t.done=!1,t}return t.done=!0,t}},t.values=I,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEac
1h(C),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function s(i,s){return n.type="throw",n.arg=t,e.next=i,s&&(e.method="next",e.arg=void 0),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],n=a.completion;if("root"===a.tryLoc)return s("end");if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return s(a.catchLoc,!0);if(this.prev<a.finallyLoc)return s(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return s(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return s(a.finallyLoc)}}}},abrupt:function(t,e){for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var n=a?a.completion:{};return n.type=t,n.arg=e,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(n)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),C(i),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var s=i.completion;if("throw"===s.type){var r=s.arg;C(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:I(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),c}},t}var b=eval,w=function(){var t;function e(t){Object(s.a)(this,e),this.isUseEnhance=!1,this.aiEnhanceCfg=null,this.modelRes=null,this.isError=!1,this.isSuccess=!1,this.isInitSuccess=!1,this.segmentation=0,this.width=0,this.height=0,this.enhanceNums=0,this.lastEnhanceSecNums=0,this.videoRender=t,this.enhanceState=0,this.isUpdateVideoCfg=!1,this.costLargeCnt=0,this.enhanceCostList=[],this.enhanceLess30Nums=0,this.enhanceLess150Nums=0,this.enhanceLess200Nums=0,this.enhanceLarge200Nums=0,this.enhanceTotal=0,this.realFps=24,this.enhanceSecTs=0,this.modelHeight=0,this.playbackRate=1}return Object(r.a)(e,[{key:"resetState",value:function(){this.modelHeight=0,this.enhanceState=2,this.m_cEnhance&&this.m_cEnhance.release(),this.m_cEnhance=null}},{key:"setRealFps",value:function(t){}},{key:"initConfig",value:function(t){t&&(this.aiEnhanceCfg=t)}},{key:"loadHatSdk",value:function(){var t=this;if(this.aiEnhanceCfg&&(5==this.enhanceState||0==this.enhanceState)){var e=this.aiEnhanceCfg,i=e.modelRes,s=e.h5Root;this.modelRes=i;var r=s+"hatsdk.min.js";S.default.log("VideoEnhance.initConfig",JSON.stringify(e),r),this.enhanceState=1,fetch(r).then(function(t){return t.text()}).then(function(e){t.enhanceState=2,b(e),S.default.log("VideoEnhance.loadSuccess"),t.isUpdateVideoCfg&&t.init(t.width,t.height),self.hatsdk.setLogLevel(self.hatsdk.LoggerLevel.info),self.hatsdk.setLogCallback(function(t){S.default.log("hatSDKMsg",t)})}).catch(function(e){console.error("VideoEnhance.loadError",e),t.handError(1)})}}},{key:"setEnhance",value:function(t){S.default.log("VideoEnhance.setEnhance",JSON.stringify(t));var e=t.data;this.isUseEnhance=!!e,this.isUseEnhance||(this.enhanceSecTs=0,this.isSuccess=!1,this.isError=!1),this.isUseEnhance&&(this.loadHatSdk(),4==this.enhanceState?this.handSuccess():5==this.enhanceState&&this.handError(3))}},{key:"setSegmenttion",value:function(t){S.default.log("VideoEnhance.setSegmenttion",JSON.stringify(t));var e=t.data;this.segmentation=e}},{key:"setPlaybackRate",value:function(t){S.default.log("VideoEnhance.setPlaybackRate,rate=".concat(t)),this.playbackRate=t}},{key:"initCfg",value:function(t,e){this.width=t,this.height=e,this.isUpdateVideoCfg=!0,2==this.enhanceState&&this.init(this.width,this.height)}},{key:"init",value:function(t,e){this.isUpdateVideoCfg&&2==this.enhanceState&&this.initMEnhance(e)}},{key:"initMEnhance",value:function(t){if(this.modelRes){var e=this.modelRes[t+"p"];e?(this.modelHeight=t,S.default.log("VideoEnhance.initMEnhance,modelHeight=".concat(this.modelHeight)),3!=this.enhanceState&&(self.hatsdk&&self.hatsdk.CEnhance?(this.enhanceState=3,this.m_cEnhance=new hatsdk.CEnhance,this.m_cEnhance.setEventCallback(this.enhanceEventHandle.bind(this)),this.m_cEnhance.init({modelUrl:e,isEncrypt:!0})):this.handError(3))):this.handError(2)}}},{key:"enhanceEventHandle",value:function(t,e){var i=e.status;switch(t){case 1:S.default.log("VideoEnhance callback MODEL_INIT_STATUS: "+i),0==i?this.enhanceState=4:1==i?(this.enhanceState=5,this.isUseEnhance&&this.handError(3)):2==i?this.isUseEnhance&&this.handError(13):3==i&&this.isUseEnhance&&this.handError(14);break;case 2:S.default.log("VideoEnhance callback WARMUP_STATUS: "+e.status);break;case 3:S.default.log("VideoEnhance callback UNKNOWN_ERROR: "+e.status);var s=9;0==i?s=9:1==i?s=10:2==i?s=11:3==i&&(s=12),this.isUseEnhance&&this.handError(s)}}},{key:"enhance",value:(t=Object(A.a)(O().mark(function t(e){var i,s,r,a;return O().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.enhanceTotal++,this.videoRender.setEnhanceTotal(this.enhanceTotal),!(this.playbackRate>1)){t.next=4;break}return t.abrupt("return",e);case 4:if(this.m_cEnhance){t.next=6;break}return t.abrupt("return",e);case 6:if(this.isUseEnhance&&4===this.enhanceState){t.next=8;break}return t.abrupt("return",e);case 8:if(!this.videoRender.isBrowserHidden||!this.isUseEnhance){t.next=14;break}return this.enhanceCostList.push(0),this.enhanceLess30Nums++,this.videoRender.setEnhanceLess30Nums(this.enhanceLess30Nums),this.enhanceFrame(),t.abrupt("return",e);case 14:if(i=S.default.getNow(),s=e.displayHeight,0==this.modelHeight||s==this.modelHeight){t.next=21;break}return S.default.log("VideoEnhance.displayHeightChange, displayHeight=".concat(s,", modelHeight=").concat(this.modelHeight)),this.resetState(),this.initMEnhance(s),t.abrupt("return",e);case 21:return t.next=23,this.m_cEnhance.run({videoFrame:e,segMode:2,segmentation:this.segmentation});case 23:if(r=t.sent,(a=S.default.getNow()-i)>=50&&this.costLargeCnt++,this.costLargeCnt>=3&&this.handError(5),0!=r.result){t.next=35;break}return this.enhanceCostList.push(a),a<=30?(this.enhanceLess30Nums++,this.videoRender.setEnhanceLess30Nums(this.enhanceLess30Nums)):a<=150?(this.enhanceLess150Nums++,this.videoRender.setEnhanceLess150Nums(this.enhanceLess150Nums)):a<=200?(this.enhanceLess200Nums++,this.videoRender.setEnhanceLess200Nums(this.enhanceLess200Nums)):(this.enhanceLarge200Nums++,this.videoRender.setEnhanceLarge200Nums(this.enhanceLarge200Nums)),this.enhanceFrame(),e.close(),t.abrupt("return",r.videoFrame);case 35:return this.handError(4),t.abrupt("return",e);case 37:case"end":return t.stop()}},t,this)})),function(e){return t.apply(this,arguments)})},{key:"handError",value:function(t){this.isSuccess=!1,!this.isError&&(this.isError=!0,S.default.log("VideoEnhance enhance fail"),S.default.postMessage(T.ToMainMessageType.VIDEO_ENHANCE_ERROR,{type:t}),this.m_cEnhance&&(this.m_cEnhance&&this.m_cEnhance.release(),this.m_cEnhance=null))}},{key:"enhanceFrame",value:function(){0==this.enhanceSecTs&&(this.enhanceSecTs=S.default.getNow()),this.enhanceNums++,this.videoRender.setEnhanceNums(this.enhanceNums),this.handSuccess()}},{key:"handSuccess",value:function(){this.isSuccess||(this.isSuccess=!0,S.default.log("VideoEnhance enhance success",this.isUseEnhance),S.default.postMessage(T.ToMainMessageType.VIDEO_ENHANCE_SUCCESS))}},{key:"onCheckTimer",value:function(t){if(!this.isError&&this.videoRender&&this.videoRender.player&&this.isSuccess){var e=this.videoRender.player.pageFps;0!=e&&(e<40?this.lowFpsCnt++:e>=55&&(this.lowFpsCnt=0),this.lowFpsCnt>=5&&(this.handError(6),this.lowFpsCnt=0))}}},{key:"rafHandler",value:function(t){this.isError}},{key:"handleEnhanceError",value:function(){this.handError(8)}},{key:"getEnhanceCostList",value:function(){var t=m(this.enhanceCostList).slice(0);return this.enhanceCostList.length=0,t}},{key:"getEnhanceSuccess",value:function(){return this.isSuccess}},{key:"close",value:function(){this.isError=!1,this.isSuccess=!1,this.enhanceNums=0,this.isUpdateVideoCfg=!1,this.costLargeCnt=0,this.enhanceCostList.length=0,this.lowFpsCnt=0,this.enhanceLess30Nums=0,this.enhanceLess150Nums=0,this.enhanceLess200Nums=0,this.enhanceLarge200Nums=0,this.enhanceTotal=0,this.m_cEnhance&&(this.m_cEnhance.release(),this.m_cEnhance=null)}}]),e}();function L(){L=function(){return t};var t={},e=Object.prototype,i=e.hasOwnProperty,s=Object.defineProperty||function(t,e,
1i){t[e]=i.value},r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",n=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,i){return t[e]=i}}function l(t,e,i,r){var a,n,o,u,l=Object.create((e&&e.prototype instanceof f?e:f).prototype);return s(l,"_invoke",{value:(a=t,n=i,o=new E(r||[]),u="suspendedStart",function(t,e){if("executing"===u)throw Error("Generator is already running");if("completed"===u){if("throw"===t)throw e;return{value:void 0,done:!0}}for(o.method=t,o.arg=e;;){var i=o.delegate;if(i){var s=function t(e,i){var s=i.method,r=e.iterator[s];if(void 0===r)return i.delegate=null,"throw"===s&&e.iterator.return&&(i.method="return",i.arg=void 0,t(e,i),"throw"===i.method)||"return"!==s&&(i.method="throw",i.arg=TypeError("The iterator does not provide a '"+s+"' method")),c;var a=d(r,e.iterator,i.arg);if("throw"===a.type)return i.method="throw",i.arg=a.arg,i.delegate=null,c;var n=a.arg;return n?n.done?(i[e.resultName]=n.value,i.next=e.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,c):n:(i.method="throw",i.arg=TypeError("iterator result is not an object"),i.delegate=null,c)}(i,o);if(s){if(s===c)continue;return s}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===u)throw u="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);u="executing";var r=d(a,n,o);if("normal"===r.type){if(u=o.done?"completed":"suspendedYield",r.arg===c)continue;return{value:r.arg,done:o.done}}"throw"===r.type&&(u="completed",o.method="throw",o.arg=r.arg)}})}),l}function d(t,e,i){try{return{type:"normal",arg:t.call(e,i)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var c={};function f(){}function p(){}function m(){}var _={};u(_,a,function(){return this});var y=Object.getPrototypeOf,v=y&&y(y(I([])));v&&v!==e&&i.call(v,a)&&(_=v);var S=m.prototype=f.prototype=Object.create(_);function g(t){["next","throw","return"].forEach(function(e){u(t,e,function(t){return this._invoke(e,t)})})}function T(t,e){var r;s(this,"_invoke",{value:function(s,a){function n(){return new e(function(r,n){!function s(r,a,n,o){var u=d(t[r],t,a);if("throw"!==u.type){var l=u.arg,c=l.value;return c&&"object"==typeof c&&i.call(c,"__await")?e.resolve(c.__await).then(function(t){s("next",t,n,o)},function(t){s("throw",t,n,o)}):e.resolve(c).then(function(t){l.value=t,n(l)},function(t){return s("throw",t,n,o)})}o(u.arg)}(s,a,r,n)})}return r=r?r.then(n,n):n()}})}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function I(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var s=-1,r=function e(){for(;++s<t.length;)if(i.call(t,s))return e.value=t[s],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:k}}function k(){return{value:void 0,done:!0}}return p.prototype=m,s(S,"constructor",{value:m,configurable:!0}),s(m,"constructor",{value:p,configurable:!0}),p.displayName=u(m,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,o,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},g(T.prototype),u(T.prototype,n,function(){return this}),t.AsyncIterator=T,t.async=function(e,i,s,r,a){void 0===a&&(a=Promise);var n=new T(l(e,i,s,r),a);return t.isGeneratorFunction(i)?n:n.next().then(function(t){return t.done?t.value:n.next()})},g(S),u(S,o,"Generator"),u(S,a,function(){return this}),u(S,"toString",function(){return"[object Generator]"}),t.keys=function(t){var e=Object(t),i=[];for(var s in e)i.push(s);return i.reverse(),function t(){for(;i.length;){var s=i.pop();if(s in e)return t.value=s,t.done=!1,t}return t.done=!0,t}},t.values=I,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEac
1h(C),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function s(i,s){return n.type="throw",n.arg=t,e.next=i,s&&(e.method="next",e.arg=void 0),!!s}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],n=a.completion;if("root"===a.tryLoc)return s("end");if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(o&&u){if(this.prev<a.catchLoc)return s(a.catchLoc,!0);if(this.prev<a.finallyLoc)return s(a.finallyLoc)}else if(o){if(this.prev<a.catchLoc)return s(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return s(a.finallyLoc)}}}},abrupt:function(t,e){for(var s=this.tryEntries.length-1;s>=0;--s){var r=this.tryEntries[s];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var a=r;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var n=a?a.completion:{};return n.type=t,n.arg=e,a?(this.method="next",this.next=a.finallyLoc,c):this.complete(n)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),c},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.finallyLoc===t)return this.complete(i.completion,i.afterLoc),C(i),c}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var i=this.tryEntries[e];if(i.tryLoc===t){var s=i.completion;if("throw"===s.type){var r=s.arg;C(i)}return r}}throw Error("illegal catch attempt")},delegateYield:function(t,e,i){return this.delegate={iterator:I(t),resultName:e,nextLoc:i},"next"===this.method&&(this.arg=void 0),c}},t}var F=function(){var t;function e(t){Object(s.a)(this,e),this.player=t,this.videoGlWrap=null,this.framelist=[],this.currentDts=0,this.lastCurrentAudioDts=0,this.lastPic=null,this.lastRenderRafTime=0,this.lastRafNow=0,this.renderFps=0,this.videoCurrentDts=0,this.noVideoRender=!1,this.throwFps=0,this.curBitrate=0,this.ageneratorWriter=null,this.isTriggerPlay=!1,this.renderedFrameTs=0,this.printCnt=0,this.fastPlayEndDts=0,this.fastPlay=!1,this.checkLatencyTs=0,this.latencyRenderCnt=0,this.lastRenderTs=0,this.lastRenderPts=0,this.renderSecFps=0,this.videoRender5SecFpsList=[],this.timeline=new R("video_render"),this.isBrowserHidden=!1,this.isPaused=!1,this.videoEnhance=new w(this),this.isSync=!0}return Object(r.a)(e,[{key:"setNotSync",value:function(){this.isSync=!1,this.lastPic&&(this.startRenderTs=S.default.getNow()-30,this.firstTimeStamp=this.lastPic.timeStamp-30)}},{key:"start",value:function(t,e,i,s){this.ageneratorWriter=i.getWriter()}},{key:"seek",value:function(t){var e=this;this.renderedFrameTs=0,this.framelist.map(function(t){e.closeVideoFrameInfo(t),e.setVieoCurrentDts(t.timeStamp)}),this.setVieoCurrentDts(t),this.framelist.length=0,this.isSeek=!0}},{key:"setPlaybackRate",value:function(t){this.videoEnhance.setPlaybackRate(t)}},{key:"onVideoSeek",value:function(){this.isSeek=!1}},{key:"updateAVCConfig",value:function(t,e){this.videoEnhance.initCfg(t,e)}},{key:"setEnhance",value:function(t){this.videoEnhance.setEnhance(t)}},{key:"setSegmenttion",value:function(t){this.videoEnhance.setSegmenttion(t)}},{key:"setRealFps",value:function(t){this.videoEnhance.setRealFps(t)}},{key:"renderVideo",value:(t=Object(A.a)(L().mark(function t(e,i){var s,r,a,n;return L().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(this.checkSkipFrame(i),0!=this.framelist.length){t.next=3;break}return t.abrupt("return");case 3:if(s=this.framelist[0],r=this.getAudioDts(e),!this.getIsRender(r,s)){t.next=33;break}if(this.lastPic=s,this.renderFps++,this.setVieoCurrentDts(s.timeStamp),a=s.timeStamp-this.renderedFrameTs,0!=this.renderedFrameTs&&a>500&&S.default.log("VideoRender.renderVideo dis large, dis=".concat(a)),this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_RENDER_NUMS,this.renderFps),this.lastRenderRafTime=i,this.framelist.shift(),n=s.frame,this.renderedFrameTs=s.timeStamp,this.player.avRenderSync.setRenderVideoTs(i),this.timeline.setLast(s.timeStamp,i),this.noVideoRender){t.next=31;break}return P.a.printTorenderVideo&&S.default.log("VideoRender.renderVideo timeStamp=".concat(s.timeStamp," ptsNow=").concat(this.timeline.getDtsNow(i)," frames=").concat(this.framelist.length)),t.next=23,this.videoEnhance.enhance(n);case 23:n=t.sent,this.latencyRenderCnt++,this.ageneratorWriter.write(n).then(function(){n.close()}).catch(function(t){S.default.postMessage(T.ToMainMessageType.VIDEORENDERERROR),n.close()}),S.default.postMessage(T.ToMainMessageType.WebGLPLAY),this.checkPause(),this.isTriggerPlay||(this.startRenderTs=i,this.firstTimeStamp=s.timeStamp,this.isTriggerPlay=!0),t.next=32;break;case 31:n.close();case 32:this.renderedFrameTs=s.timeStamp;case 33:case"end":return t.stop()}},t,this)})),function(e,i){return t.apply(this,arguments)})},{key:"onCheckTimer",value:function(t){if(0!=this.renderSecFps){var e=this.renderFps-this.renderSecFps;this.videoRender5SecFpsList.length>=5&&this.videoRender5SecFpsList.shift(),this.videoRender5SecFpsList.push(e)}this.renderSecFps=this.renderFps,this.videoEnhance.onCheckTimer(t)}},{key:"checkPause",value:function(){if(!this.player.userPaused){var t=this.getCurrentDts(),e=S.default.getNow();if(this.isBrowserHidden)this.isPaused&&(S.default.postMessage(T.ToMainMessageType.SET_FRMAE_RESUME),this.isPaused=!1);else if(0!=this.lastRenderPts&&0!=this.lastRenderTs){var i=t-this.lastRenderPts,s=e-this.lastRenderTs,r=this.videoRender5SecFpsList.length,a=!1;r>=5&&(a=this.videoRender5SecFpsList.reduce(function(t,e){return t+e},0)/r<=10),s-i>200||i>300&&s>200?(S.default.log("VideoRender.mobPaused tsDelta:".concat(s," ptsDelta:").concat(i," delta:").concat(s-i)),S.default.postMessage(T.ToMainMessageType.SET_FRAME_PAUSE),this.isPaused=!0):this.isPaused&&(S.default.postMessage(T.ToMainMessageType.SET_FRMAE_RESUME),this.isPaused=!1),a&&S.default.postMessage(T.ToMainMessageType.RENDER_FPS_PAUSE)}this.lastRenderTs=e,this.lastRenderPts=t}}},{key:"getBufferLen",value:function(){return this.player.getBufferLen()}},{key:"checkSkipFrame",value:function(t){var e=this.player.latencyCfg;if(e.latencyMode){var i=this.player.getBufferLen(),s=this.framelist.length;if(i>=e.latencyBuf&&s>0){if(0===this.checkLatencyTs)this.checkLatencyTs=t;else if(t-this.checkLatencyTs>
12e3&&this.latencyRenderCnt%e.skipFrameGap==0){var r=this.framelist[0];this.timeline.isDtsLess(t,r.timeStamp)&&(P.a.printRenderSkipFrame&&S.default.log("VideoRender.checkLatencySkip skipFrameGap=".concat(e.skipFrameGap," renderCnt=").concat(this.latencyRenderCnt," frames=").concat(s," skipDts=").concat(r.timeStamp)),this.framelist.shift(),this.timeline.setJumpTime(r.timeStamp-this.timeline.lastDts+1,!1),r.frame.close())}}else this.checkLatencyTs=0}}},{key:"setVieoCurrentDts",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_PTS,t),this.videoCurrentDts=t,this.player.decodeJitter.onRenderVideo(t)}},{key:"getAudioCurrentDts",value:function(){return self.mainSharedArrayBuffer?Atomics.load(self.mainSharedArrayBuffer,D.e.AUDIO_DTS):0}},{key:"rafHandler",value:function(t){var e=this.getAudioCurrentDts();this.curBitrate>=4e3&&this.throwFrame(e),this.renderVideo(e,t),this.lastRafNow=t,this.videoEnhance.rafHandler(t)}},{key:"getRealFps",value:function(){return self.mainSharedArrayBuffer?Atomics.load(self.mainSharedArrayBuffer,D.a.VIDEO_REAL_FPS):0}},{key:"getDecodedBuffer",value:function(){var t=this.getRenderBuffer();return this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_NOT_RENDERD_BUFFER,t),t}},{key:"getRenderBuffer",value:function(){var t=0;return this.framelist.length>0&&(t=null==this.lastPic?0:this.framelist[this.framelist.length-1].timeStamp-this.lastPic.timeStamp),t}},{key:"getDecodedFrames",value:function(){return this.framelist.length}},{key:"throwFrame",value:function(t,e){var i=!1;if(0!=this.framelist.length)for(;!i&&this.framelist.length>=2;){if(!(t-this.framelist[0].timeStamp>=200)){i=!0;break}var s=this.framelist.shift();this.throwFps++,this.setVieoCurrentDts(s),this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_THROW_FRAME_FPS,this.throwFps),s.frame.close()}}},{key:"getAudioDts",value:function(t){if(!this.isSync)return 0;var e=S.default.getNow(),i=0;return 0!=this.lastRafNow&&(i=e-this.lastRafNow),0==t?this.currentDts=0:t!=this.lastCurrentAudioDts?this.currentDts=t:this.currentDts+=i,this.lastCurrentAudioDts=t,this.currentDts}},{key:"setJump",value:function(t){this.timeline.setJumpTime(t)}},{key:"getIsRender",value:function(t,e){var i=S.default.getNow(),s=!1;if(null==this.lastPic)s=!0,this.timeline.start(i,e.timeStamp);else if(this.player.latencyCfg.latencyMode)this.timeline.isDtsLess(i,e.timeStamp)&&(s=!0);else if(null!=this.lastPic&&0==t){var r=this.lastPic.timeStamp,a=e.timeStamp,n=i-this.startRenderTs,o=e.timeStamp-this.firstTimeStamp;n>=o?(s=!0,n-o>100&&(this.startRenderTs=i,this.firstTimeStamp=e.timeStamp)):a-r>100&&(s=!0,this.startRenderTs=i,this.firstTimeStamp=e.timeStamp)}else 0!=t&&t>=e.timeStamp?s=!0:0!=t&&e.timeStamp;return s}},{key:"appendFrame",value:function(t){return this.isSeek?(this.closeVideoFrameInfo(t),this.setVieoCurrentDts(t.timeStamp),void(this.lastPic=null)):t.timeStamp<this.renderedFrameTs?(S.default.log("VideoRender.appendFrame, frame timeStamp too small and drop frame,rendered frame ts="+this.renderedFrameTs+",now ts="+t.timeStamp),void this.closeVideoFrameInfo(t)):(this.framelist.push(t),void this.framelist.sort(function(t,e){return t.timeStamp>e.timeStamp?1:-1}))}},{key:"updateCanvasRect",value:function(t,e){this.videoGlWrap.updateCanvasRect(t,e)}},{key:"updateRect",value:function(t,e){this.videoGlWrap.updateRect(t,e)}},{key:"getCurrentDts",value:function(){return this.videoCurrentDts}},{key:"setNoRender",value:function(){S.default.log("VideoRender.setNoRender"),this.noVideoRender=!0}},{key:"updateCurBitrate",value:function(t){this.curBitrate=t}},{key:"closeVideoFrameInfo",value:function(t){t.frame.close(),t=null}},{key:"setBrowserHidden",value:function(t){this.isBrowserHidden=t}},{key:"initConfig",value:function(t){this.videoEnhance.initConfig(t)}},{key:"setEnhanceNums",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_ENHANCE_NUMS,t)}},{key:"setEnhanceLess30Nums",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_ENHANCE_LESS30_NUMS,t)}},{key:"setEnhanceLess150Nums",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_ENHANCE_
1LESS150_NUMS,t)}},{key:"setEnhanceLess200Nums",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_ENHANCE_LESS200_NUMS,t)}},{key:"setEnhanceLarge200Nums",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_ENHANCE_LARGE200_NUMS,t)}},{key:"setEnhanceTotal",value:function(t){this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_ENHANCE_TOTAL,t)}},{key:"getEnhanceCostList",value:function(){return this.videoEnhance.getEnhanceCostList()}},{key:"getEnhanceSuccess",value:function(){return this.videoEnhance.getEnhanceSuccess()}},{key:"handleEnhanceError",value:function(){this.videoEnhance.handleEnhanceError()}},{key:"getVideoRenderPts",value:function(){return this.renderedFrameTs}},{key:"setLastPic",value:function(t){this.lastPic=t}},{key:"close",value:function(){var t=this;this.currentDts=0,this.lastCurrentAudioDts=0,this.framelist.map(function(e){t.closeVideoFrameInfo(e)}),this.lastPic=null,this.lastRafNow=0,this.renderFps=0,this.throwFps=0,this.videoCurrentDts=0,this.noVideoRender=!1,this.curBitrate=0,this.isTriggerPlay=!1,this.isBrowserHidden=!1,this.isPaused=!1,this.videoEnhance.close()}}]),e}(),M=function(){function t(e){Object(s.a)(this,t),this.player=e,this.audioDuration=0,this.framelist=[],this.ageneratorWriter=null,this.frameDuration=23,this.audioSampleRate=44100,this.isTriggerPlay=!1,this.lastRenderStamp=0,this.lastRenderNow=0,this.audioCurrentDts=0,this.renderNums=0,this.lastFrame=null,this.firstFrameRenderWriting=!1,this.firstFinshed=!1,this.startRenderTs=0,this.firstTimeStamp=0,this.totalLocalTime=0,this.decodeTotolTime=0,this.decodeTimeStamp=0,this.timeline=new R("audio_render")}return Object(r.a)(t,[{key:"setJump",value:function(t){this.timeline.setJumpTime(t)}},{key:"start",value:function(t){this.ageneratorWriter=t.getWriter()}},{key:"updateAACSampleRate",value:function(t){this.audioSampleRate=t,this.frameDuration=Math.floor(1024e3/t),S.default.log("AudioRender.updateAACSampleRate, frameDuration=",this.frameDuration)}},{key:"onQuickCheckTimer",value:function(t){if(this.player.latencyCfg.latencyMode&&this.player.latencyCfg.latencyMode.latencyBuf>0&&this.framelist.length>0){var e=this.framelist[0];this.timeline.start(t,e.timeStamp),this.player.setRenderAudioTs(t,this.timeline),P.a.printTorenderAudio&&S.default.log("AudioRender.toRender timeline dts=".concat(e.timeStamp," dtsNow=").concat(this.timeline.getDtsNow(t))),this.timeline.isDtsLess(t,e.timeStamp)&&(this.timeline.setLast(e.timeStamp,t),this.framelist.shift(),S.default.postMessage(T.ToMainMessageType.AUDIO_FRAME_DECODED,e))}if(this.ageneratorWriter&&this.framelist.length>0){var i=this.framelist[0],s=i.frame;this.getIsRender(i,t)&&(this.render(s,t,i),this.framelist.shift(),this.renderNums++,this.setAudioRenderNums(),this.lastRenderStamp=i.timeStamp,this.lastRenderNow=t,this.lastFrame=i,this.setAudioCurrentDts(i.timeStamp))}}},{key:"getIsRender",value:function(t){var e=S.default.getNow();if(null==this.lastFrame)return!0;var i=e-this.lastRenderNow,s=t.timeStamp-this.lastFrame.timeStamp;return e-this.startRenderTs>=t.timeStamp-this.firstTimeStamp||(i>2*this.frameDuration&&s>2*this.frameDuration?(this.startRenderTs=e,this.firstTimeStamp=t.timeStamp,!0):void 0)}},{key:"render",value:function(t,e,i){var s=this;return this.audioDuration+=t.duration/1e3,this.ageneratorWriter.ready.then(function(){return s.ageneratorWriter.write(t)}).then(function(){t.close(),s.isTriggerPlay||(s.isTriggerPlay=!0,S.default.postMessage(T.ToMainMessageType.AUDIO_PLAY),s.startRenderTs=e,s.firstTimeStamp=i.timeStamp)}).catch(function(e){console.error(e),t.close(),S.default.postMessage(T.ToMainMessageType.AUDIORENDERERROR)}),!0}},{key:"setAudioCurrentDts",value:function(t){this.audioCurrentDts=t,this.player.storeWorkerShared(T.StoreWorkerType.AUDIO_DTS,this.audioCurrentDts)}},{key:"getDecodedBuffer",value:function(){return 0!=this.decodeTimeStamp&&0!=this.audioCurrentDts?this.decodeTimeStamp-this.audioCurrentDts:0}},{key:"setAudioRenderNums",value:function(){this.player.storeWorkerShared(T.StoreWorkerType.AUDIO_RENDER_NUMS,this.renderNums)}},{key:"getAudioCurrentDts",value:function(){var t=self.mainSharedArrayBuffer?Atomics.load(self.mainSharedArrayBuffer,T.StoreWorkerType.AUDIO_DTS):0;return this.audioCurrentDts=t,this.audioCurrentDts}},{key:"setLastAudioData",value:function(t){this.setAudioCurrentDts(t.timeStamp)}},{key:"onFrameDecoded",value:function(t){this.decodeTimeStamp=t.timeStamp,this.ageneratorWriter?this.appendFrame(t):this.sentAudioFrameData(t)}},{key:"sentAudioFrameData",value:function(t){if(-1!=t.frame.format.indexOf("32")){for(var e=t.frame.numberOfChannels,i=[],s=0;s<e;s++){var r=new ArrayBuffer(t.frame.allocationSize({planeIndex:s}));t.frame.copyTo(r,{planeIndex:s}),i.push(r)}var a=new ArrayBuffer(t.frame.allocationSize({planeIndex:0}));t.frame.copyTo(a,{planeIndex:0});var n={timeStamp:t.timeStamp,frameBuffer:a,frameBuffers:i,isEmptyAudioFrame:t.isEmptyAudioFrame,format:t.frame.format};this.player.latencyCfg.latencyMode&&this.player.latencyCfg.latencyMode.latencyBuf>0?this.framelist.push(n):(P.a.printTorenderAudio&&S.default.log("AudioRender.toRender rightnow dts=".concat(n.timeStamp)),S.default.postMessage(T.ToMainMessageType.AUDIO_FRAME_DECODED,n))}else S.default.postMessage(T.ToMainMessageType.AUDIO_FORMAT_ERROR)}},{key:"appendFrame",value:function(t){this.framelist.push(t)}},{key:"appendFrames",value:function(t){for(;t.length>0;)this.framelist.push(t.shift())}},{key:"seek",value:function(t){this.audioCurrentDts=0,this.decodeTimeStamp=0,this.setAudioCurrentDts(t)}},{key:"close",value:function(){this.framelist.length=0,this.isTriggerPlay=!1,this.audioCurrentDts=0,this.renderNums=0,this.lastFrame=null,this.firstFrameRenderWriting=!1,this.firstFinshed=!1,this.startRenderTs=0,this.firstTimeStamp=0,this.decodeTimeStamp=0}}]),t}(),N=function(){function t(e){Object(s.a)(this,t),this._decodeHelper=e,this._decodeJitter=e.getDecodeJitter(),this._type="",this._initType(),this._timeline=new R("".concat(this._type,"_decode")),this._timelineSlow=new R("".concat(this._type,"_decode_slow")),this._state=B.FAST_DOING,this._fastBuf=0,this._waitKeyFrameTs=0,this._waitKeyFramePostTs=0}return Object(r.a)(t,[{key:"jitBuf",get:function(){return this._decodeJitter.player.latencyCfg.latencyBuf}},{key:"jitMin",get:function(){return this._decodeJitter.player.latencyCfg.latencyMin}},{key:"jitMax",get:function(){return this._decodeJitter.player.latencyCfg.latencyMax}},{key:"isNoGop",get:function(){return this._decodeJitter.player.latencyCfg.isNoGop}},{key:"_initType",value:function(){}},{key:"setFastEnding",value:function(){S.default.log("MediaDecodeHelper.setFastEnding type=".concat(this._type)),this._state=B.FAST_ENDING}},{key:"setNormal",value:function(){S.default.log("MediaDecodeHelper.setNormal type=".concat(this._type)),this._timelineSlow.reset(),this._state=B.NORMAL}},{key:"setSlow",value:function(){S.default.log("MediaDecodeHelper.setSlow type=".concat(this._type)),this._state=B.SLOW}},{key:"setWaitKeyFrame",value:function(){S.default.log("MediaDecodeHelper.setWaitKeyFrame type=".concat(this._type)),this._state=B.WAIT_KEY_FRAME,this._waitKeyFrameTs=S.default.getNow()}},{key:"isWaitForKeyFrame",value:function(){return this._state===B.WAIT_KEY_FRAME}},{key:"checkDecode",value:function(t){var e=this._getSamples();if(e.length>0){var i=e[0];this._timeline.start(t,i.timeStamp),this._state===B.FAST_DOING?this._decodeInFastDoing(t,i):this._state===B.FAST_ENDING?this._decodeInFastEnding(t,i):this._state===B.NORMAL?this._decodeInNormal(t,i):this._state===B.SLOW?this._decodeInSlow(t,i):this._state===B.WAIT_KEY_FRAME&&this._decodeInWaitKeyFrame(t,i)}}},{key:"_decodeInFastDoing",value:function(t,e){this._todecode(t,e)}},{key:"_decodeInFastEnding",value:function(t,e){}},{key:"_getWillDecodeBuffer",value:function(){var t=this._getSamples(),e=t.length,i=0,s=0;return e>0&&(i=t[e-1].timeStamp,s=this._timeline.lastDts),i-s}},{key:"_decodeInNormal",value:function(t,e){if(0===this.jitBuf)this._decode(t,e);else{var i=this._timeline.getDtsSlowTime(e.timeStamp,t);i>=500?(S.default.log("MediaDecodeHelper._decodeInNormal type=".concat(this._type," sample slow dtsSlowTime=").concat(i," dts=").concat(e.timeStamp," samples=").concat(this._getSamples().length)),this.setSlow(),this._timelineSlow.start(t,e.timeStamp),this._todecodeSlow(t,e)):0===this.jitBuf?this._decode(t,e):this._todecode(t,e)}}},{key:"_decodeInSlow",value:function(t,e){var i=this._getSamples(),s=this._findNextSample(t,i);if(-1!==s){var r=i[s],a=i[0],n=i[i.length-1];r.timeStamp-a.timeStamp<1e3&&this._decodeAllSlowSamples(t,i,s),S.default.log("MedisDecodeHelper._decodeInSlow type=".concat(this._type," done cur=").concat(r.timeStamp," first=").concat(a.timeStamp," last=").concat(n.timeStamp," lateBuf=").concat(r.timeStamp-a.timeStamp," buffer=").concat(n.timeStamp-r.timeStamp)),this._setSamples(i.slice(s)),this.setNormal()}else this._todecodeSlow(t,e)}}
1,{key:"_decodeAllSlowSamples",value:function(t,e,i){}},{key:"_findNextSample",value:function(e,i){var s=i.length;if(s>0)for(var r=0;r<s;r++){var a=i[r];if((this._type!==t.Types.VIDEO||a.isKeyFrame)&&!this._timeline.isDtsLess(e,a.timeStamp))return r}return -1}},{key:"_findLastSample",value:function(e,i,s,r){var a=i.length;if(a>0)for(var n=i[a-1],o=a-1;o>=0;o--){var u=i[o];if(this._type!==t.Types.VIDEO||u.isKeyFrame){var l=n.timeStamp-u.timeStamp;if(s<=l&&l<=r&&!this._timeline.isDtsLess(e,u.timeStamp))return o}}return -1}},{key:"_decodeInWaitKeyFrame",value:function(t,e){(0===this._waitKeyFramePostTs||t-this._waitKeyFramePostTs>500)&&(this._waitKeyFramePostTs=t,S.default.postMessage(T.ToMainMessageType.WAIT_KEY_FRAME,t-this._waitKeyFrameTs))}},{key:"_todecode",value:function(t,e){this._timeline.isDtsLess(t,e.timeStamp)&&this._decode(t,e)}},{key:"_todecodeSlow",value:function(t,e){this._timelineSlow.isDtsLess(t,e.timeStamp)&&this._decode(t,e)}},{key:"_decode",value:function(t,e){}},{key:"_getSamples",value:function(){return[]}},{key:"_setSamples",value:function(t){}}]),t}(),B={FAST_DOING:1,FAST_ENDING:2,NORMAL:3,SLOW:4,WAIT_KEY_FRAME:5};N.Types={VIDEO:"video",AUDIO:"audio"};var V=function(t){Object(o.a)(i,t);var e=Object(u.a)(i);function i(t){return Object(s.a)(this,i),e.call(this,t)}return Object(r.a)(i,[{key:"_initType",value:function(){this._type=N.Types.VIDEO}},{key:"_getSamples",value:function(){return this._decodeJitter.videoSamples}},{key:"_setSamples",value:function(t){this._decodeJitter.videoSamples=t}},{key:"_decodeInFastEnding",value:function(t,e){var i=this._getWillDecodeBuffer();i<=this.jitBuf?(this._todecode(t,e),this.setNormal(),S.default.log("MediaDecodeHelper._decodeInFastEnding type=".concat(this._type," fastEnding to normal buffer=").concat(i))):this._lookupBuffer(t,e,i)}},{key:"_lookupBuffer",value:function(t,e,i){var s=this._getSamples(),r=this._findLastSample(t,s,this.jitMin,this.jitMax,!0);if(-1!==r){var a=s[r],n=s[s.length-1].timeStamp-a.timeStamp;if(n===this.jitBuf){var o=s[0];S.default.log("VideoDecodeHelper._lookupBuffer done firstDts=".concat(o.timeStamp," buffer=").concat(n)),this._setSamples(s.slice(r)),this._updateJump(t,o.timeStamp,a.timeStamp,i),this._decode(t,a)}else this._fixToJitBuf(t,s,r,i);this.setNormal()}else this._todecode(t,e)}},{key:"_fixToJitBuf",value:function(t,e,i,s){for(var r=e.length,a=e[0],n=e[i],o=e[r-1],u=o.timeStamp,l=r-1,d=i;d<r;d++){var c=e[d];if(0===this.jitBuf)this._decodeJitter._decodeVideoSample(c,t);else{if(o.timeStamp-c.timeStamp<=this.jitBuf){u=c.timeStamp,l=d;break}this._decodeJitter._decodeVideoSample(c,t)}}S.default.log("VideoDecoderHelper._fixToJitBuf fitBuf=".concat(u-n.timeStamp)),this._setSamples(0===this.jitBuf?[]:e.slice(l)),this._updateJump(t,a.timeStamp,u,s)}},{key:"_updateJump",value:function(t,e,i,s){var r=i-e;this._timeline.setJumpTime(r),this._timeline.setLast(i,t),this._decodeHelper.onVideoJump(t,{jumpTime:r}),this._fastBuf=this._getWillDecodeBuffer(),S.default.log("VideoDecodeHelper._updateJump jumpTime=".concat(r," jumpStartDts=").concat(e," endDts=").concat(i," before=").concat(s," after=").concat(this._fastBuf))}},{key:"_decodeAllSlowSamples",value:function(t,e,i){for(var s=0;s<i;s++){var r=e[s];this._decodeJitter._decodeVideoSample(r,t)}}},{key:"_decodeInWaitKeyFrame",value:function(t,e){Object(a.a)(Object(n.a)(i.prototype),"_decodeInWaitKeyFrame",this).call(this,t,e);var s=this._getSamples();if(e.isKeyFrame)this.setNormal();else{for(var r=s.length,o=-1,u=0;u<r;u++){var l=s[u];if(l.isKeyFrame){e=l,o=u;break}}-1!==o?(s=s.slice(o),this.setNormal()):(e=null,s=[]),this._setSamples(s)}}},{key:"_decode",value:function(t,e){this._timeline.setLast(e.timeStamp,t),this._decodeJitter._decodeVideoSample(e,t),this._decodeJitter.videoSamples.shift()}}]),i}(N),U=function(t){Object(o.a)(i,t);var e=Object(u.a)(i);function i(t){var r;return Object(s.a)(this,i),(r=e.call(this,t))._jumpEndDts=0,r}return Object(r.a)(i,[{key:"_initType",value:function(){this._type=N.Types.AUDIO}},{key:"_getSamples",value:function(){return this._decodeJitter.audioSamples}},{key:"_setSamples",value:function(t){this._decodeJitter.audioSamples=t}},{key:"setJump",value:function(t){this._timeline.setJumpTime(t),this._jumpEndDts=this._timeline.lastDts+t}},{key:"_decodeInFastEnding",value:function(t,e){if(this._jumpEndDts>0){var i=this._getSamples(),s=i.length;if(s>0){for(var r=i[0],a=i[s-1],n=-1,o=null,u=0;u<s;u++){var l=i[u];if(l.timeStamp>=this._jumpEndDts){n=u,o=l;break}}-1!==n&&(this._jumpEndDts=0,i=i.slice(n),S.default.log("AudioDecodeHelper._decodeInFastEnding done firstDts=".concat(r.timeStamp," endDts=").concat(o.timeStamp," lastDts=").concat(a.timeStamp," before=").concat(a.timeStamp-r.timeStamp," after=").concat(a.timeStamp-o.timeStamp," dropBuffer=").concat(o.timeStamp-r.timeStamp)),this._setSamples(i),this.setNormal())}}else this._todecode(t,e)}}
1,{key:"_decodeAllSlowSamples",value:function(t,e,i){for(var s=0;s<i;s++){var r=e[s];this._decodeJitter._decodeAudioSample(r,t)}}},{key:"_decode",value:function(t,e){this._timeline.setLast(e.timeStamp,t),this._decodeJitter._decodeAudioSample(e,t),this._decodeJitter.audioSamples.shift()}}]),i}(N),x=function(){function t(e){Object(s.a)(this,t),this._decodeJitter=e,this._lastTodecodeDts=0,this._lastTodecodeTs=0,this._waitKeyFrameTs=0,this._waitKeyFramePostTs=0}return Object(r.a)(t,[{key:"checkDecode",value:function(t,e,i){var s=this._decodeJitter.videoSamples;if(this._waitKeyFrameTs>0)this._waitForKeyFrame(t,s);else if(s.length>0){var r=s[0];(i<2||t-this._lastTodecodeTs>=r.timeStamp-this._lastTodecodeDts)&&(s.shift(),this._lastTodecodeDts=r.timeStamp,this._lastTodecodeTs=t,P.a.printVideoDecodeFast&&S.default.log("VideoDecodeFastHelper.checkDecode dts=".concat(r.timeStamp," samples=").concat(s.length," videoDecodedFrames=").concat(e," queueSize=").concat(i)),this._decodeJitter._decodeVideoSample(r,S.default.getNow()))}}},{key:"_waitForKeyFrame",value:function(t,e){if((0===this._waitKeyFramePostTs||t-this._waitKeyFramePostTs>500)&&(this._waitKeyFramePostTs=t,S.default.postMessage(T.ToMainMessageType.WAIT_KEY_FRAME,t-this._waitKeyFrameTs)),e.length>0){for(var i=e.length,s=-1,r=0;r<i;r++)if(e[r].isKeyFrame){s=r;break}-1!==s?(e=e.slice(s),this._waitKeyFrameTs=0):e=[],this._decodeJitter.videoSamples=e}}},{key:"setWaitKeyFrame",value:function(){S.default.log("VideoDecodeFastHelper.setWaitKeyFrame"),this._waitKeyFrameTs=S.default.getNow()}},{key:"isWaitForKeyFrame",value:function(){return this._waitKeyFrameTs>0}}]),t}(),H=function(){function t(e){Object(s.a)(this,t),this._decodeJitter=e}return Object(r.a)(t,[{key:"checkDecode",value:function(t){var e=this._decodeJitter.audioSamples;if(e.length>0){var i=e.shift();this._decodeJitter._decodeAudioSample(i)}}}]),t}(),G=function(){function t(e){Object(s.a)(this,t),this._decodeJitter=e,this._videoHelper=new V(this),this._audioHelper=new U(this),this._videoFastHelper=new x(e),this._audioFastHelper=new H(e)}return Object(r.a)(t,[{key:"getDecodeJitter",value:function(){return this._decodeJitter}},{key:"decodeLowlatency",value:function(t,e){var i=S.default.getNow();this._decodeJitter.player.latencyCfg.fastMode?(this._videoFastHelper.checkDecode(i,t,e),this._audioFastHelper.checkDecode(i)):(this._videoHelper.checkDecode(i),this._audioHelper.checkDecode(i))}},{key:"onVideoJump",value:function(t,e){var i=e.jumpTime;this._audioHelper.setJump(i),this._decodeJitter.player.audioRender.setJump(i),this._decodeJitter.player.videoRender.setJump(i)}},{key:"fastAccessOver",value:function(){S.default.log("DecodeHelper.fastAccessOver"),this._videoHelper.setFastEnding(),this._audioHelper.setFastEnding()}},{key:"setNormal",value:function(){this._videoHelper.setNormal(),this._audioHelper.setNormal()}},{key:"updateSoftAcceleration",value:function(){this._videoHelper.setWaitKeyFrame(),this._videoFastHelper.setWaitKeyFrame()}},{key:"isWaitForKeyFrame",value:function(){return this._decodeJitter.player.latencyCfg.fastMode?this._videoFastHelper.isWaitForKeyFrame():this._videoHelper.isWaitForKeyFrame()}}]),t}(),W=function(){function t(e){Object(s.a)(this,t),this.player=e,this.videoSamples=[],this.audioSamples=[],this.audioFrameDecodedQueueLimit=10,this.lastDecodedVideoTimeStamp=0,this.lastToDecodAudioTimeStamp=0,this.lastJumpBufferAudioTimeStamp=0,this.videoFPS=0,this.noReferFps=0,this.discardVideoTSGap=60,this.decodeAudioQueueTime=1e3,this.decodeVideoQueueTime=100,this.discardFrameDecodeDelay=200,this.lastToDecodeTimeStamp=0,this.minBuffer=2e3,this.videoToDecodedLocalTime=0,this.firstVideoTs=0,this.videoToDecodedTime=0,this.isFirstAudioStamp=0,this.discardNums=0,this.lastVideoDiscardNums=0,this.JITTER_BUFLEN=0,this.JITTER_BUFMIN=0,this.JITTER_BUFMAX=0,this.jumpBufferCfg=[120,1e3,1e4,5e3,120,25],this.JUMP_BUFFER=0,this.startPlayTime=0,this.isStartBuffer=!0,this.setVideoCurrentTime=0,this.startMoreBufferTime=0,this.bufferMoreContinueTime=1e3,this.isPauseVideoDecode=!1,this.isPauseAudioDecode=!1,this.isEnableDiscard=!1,this.isSoftWebcodecs=!1,this.decode10SecCostList=[],this.videoMaxCts=0,this.decodeVideoQueueTimeToCtsMaxGap=100,this.decodeVideoQueueTimeMax=350,this.outputFrameByPts=!1,this.decodeVideoQueueTimeDefault=100,this.lastVideoStamp=0,this.lastAudioStamp=0,this.recvMap=new Map,this.lastAppendVideoPts=0,this.first
1VideoDts=0,this.fastDecodeTime=500,this.realFps=0,this.shieldAudioCfgBufLen=3e3,this.isRemuxBuf=!1,this.isRevFastOver=!1,this._helper=new G(this),this.isLive=!0,this.seekVideoDts=0,this.isVideoSeek=!1,this.isAudioSeek=!1}return Object(r.a)(t,[{key:"fastOver",value:function(){this.player.latencyCfg.latencyMode&&this._helper.fastAccessOver()}},{key:"onRevFastOver",value:function(){this.isRevFastOver=!0}},{key:"seek",value:function(t,e){S.default.log("DecodeJitter.seek",t),this.isVideoSeek=!0,this.isAudioSeek=!0,this.seekVideoDts=e,this.audioSamples.length=0,this.videoSamples.length=0,this.firstVideoDts=0,this.isFirstAudioStamp=0,this.lastAppendVideoPts=0}},{key:"onVideoSeek",value:function(){}},{key:"onAudioSeek",value:function(){}},{key:"setJitter",value:function(t){this.JITTER_BUFLEN=t.bufLen,this.JITTER_BUFMIN=t.bufMin,this.JITTER_BUFMAX=t.bufMax,this.jumpBufferCfg=t.jumpBufferCfg,this.shieldAudioCfgBufLen=t.shieldAudioCfgBufLen,this.isRemuxBuf=t.isRemuxBuf,S.default.log("WebCodecsWorkerPlayer.setJitter bufMin=".concat(t.bufMin," bufLen=").concat(t.bufLen," bufMax=").concat(t.bufMax," jumpBufferCfg=").concat(this.jumpBufferCfg.toString()," shieldAudioCfgBufLen=").concat(this.shieldAudioCfgBufLen," isRemuxBuf=").concat(this.isRemuxBuf))}},{key:"setLive",value:function(t){this.isLive=t}},{key:"setVideoOutputByPts",value:function(t){this.outputFrameByPts=t,this.outputFrameByPts&&(this.decodeVideoQueueTime=this.decodeVideoQueueTimeDefault)}},{key:"updateVideoCts",value:function(t){!this.outputFrameByPts&&t>this.videoMaxCts&&(this.videoMaxCts=t,this.decodeVideoQueueTime=Math.max(this.decodeVideoQueueTime,this.videoMaxCts+this.decodeVideoQueueTimeToCtsMaxGap),this.decodeVideoQueueTime=Math.min(this.decodeVideoQueueTime,this.decodeVideoQueueTimeMax),S.default.log("WebCodecsWorkerPlayer.updateVideoCts videoMaxCts=".concat(this.videoMaxCts," decodeAudioQueueTime=").concat(this.decodeVideoQueueTime," ")))}},{key:"setStartPlayTime",value:function(t){this.startPlayTime=t}},{key:"setPlayMinBuffer",value:function(t){this.minBuffer=t}},{key:"decodeThread",value:function(t,e,i,s){if(this.player.latencyCfg.latencyMode)this._helper.decodeLowlatency(this.player.videoRender.framelist.length,s);else{var r=S.default.getNow(),a=this.player.audioDecoderReadyed&&!this.isAudioSeek,n=this.audioSamples.length>0,o=!this.isPauseAudioDecode,u=t<this.decodeAudioQueueTime,l=Atomics.load(self.mainSharedArrayBuffer,T.StoreWorkerType.AUDIO_RENDER_NUMS),d=~~(Atomics.load(self.mainSharedArrayBuffer,T.StoreWorkerType.AUDIO_WORKER_UN_RENDER_AUDIO_FRAMES)*this.player.getAacTimeLen());l>0&&!this.isLive&&(u=u||d<this.decodeAudioQueueTime),this.player.getAudioCurrentDts(),a&&u&&n&&o&&this.decodeAudioSamples(),this.isVideoSeek||(this.newDiscardVideoFrame(),this.player.videoDecoderReadyed&&this.videoSamples.length>0&&!this.isPauseVideoDecode&&(this.decodeVideoSamples(e,r,i,s),this.jumpBuffers(r)))}}},{key:"onCheckTimer",value:function(){this.checkTurnToSoft()}},{key:"checkTurnToSoft",value:function(){if(!this._helper.isWaitForKeyFrame()){var t=5;this.isLive||(t=20);var e=this.player.delayDecode;if(this.decode10SecCostList.length>=t&&this.decode10SecCostList.shift(),this.decode10SecCostList.push(e),!(this.decode10SecCostList.length<t)){var i=!0;this.decode10SecCostList.forEach(function(t){t<2e3&&(i=!1)}),this.player.getEnhanceSuccess()?i&&(this.player.handleEnhanceError(),this.decode10SecCostList.length=0):this.isSoftWebcodecs?i&&this.player.turnToMse():i&&this.player.turnToWebcodecsSoft()}}}},{key:"decodeAudioSamples",value:function(){var t=this.audioSamples.shift();t.timeStamp&&(this.lastToDecodAudioTimeStamp=t.timeStamp,this._decodeAudioSample(t))}},{key:"_decodeAudioSample",value:function(t){this.player.toDecodeFrame(t)}},{key:"decodeVideoSamples",value:function(t,e,i,s){var r=this.decodeVideoQueueTime,a=(this.lastToDecodAudioTimeStamp,this.player.getVideoCurrentDts(),this.player.getAudioCurrentDts(),0);if(this.realFps>0&&(a=Math.floor(1e3/this.realFps)),t<r&&(s<2||(0!=a&&e-this.videoToDecodedTime)>=a)){var n=this.videoSamples.shift();this._decodeVideoSample(n,e)}}},{key:"_decodeVideoSample",value:function(t,e){this.lastToDecodeTimeStamp=t.timeStamp,this.player.toDecodeFrame(t),0==this.videoToDecodedLocalTime&&(this.videoToDecodedLocalTime=e),this.videoToDecodedTime=e}},{key:"updateAACSampleRate",value:function(t){this.audioSampleRate=t,this.frameDuration=1024e3/t,this.audioFrameDecodedQueueLimit=Math.ceil(this.decodeAudioQueueTime/this.frameDuration)}},{key:"getBufferLength",value:function(t){if(this.isRemuxBuf&&self.mainSharedArrayBuffer)return Atomics.load(self.mainSharedArrayBuffer,T.MainSharedBufferType.LAST_VIDEO_RCV_TS)-t;if(this.isLive){if(this.lastAppendVideoPts>0&&t>0)return this.lastAppendVideoPts-t}else if(this.lastAppendVideoPts>0)return this.lastAppendVideoPts-t;return 0}},{key:"getWillDecodeVBuf",value:function(){return 0==this.videoSamples.length?0:1==this.videoSamples.length?33:this.videoSamples.length>1?this.videoSamples[this.videoSamples.length-1].timeStamp-this.videoSamples[0].timeStamp:0}},{key:"getAudioBufferLength",value:function(t){return 0==t?this.audioSamples.length>1?this.videoSamples[this.audioSamples.length-1].timeStamp-this.audioSamples[0].timeStamp:0:this.audioSamples.length>0?this.audioSamples[this.audioSamples.length-1].timeStamp-t:0}},{key:"jumpBuffers",value:function(t){if(this.isLive){var e=this.player.getVideoCurrentDts(),i=this.getBufferLength(e),s=i-this.JITTER_BUFLEN,r=!1;self.mainSharedArrayBuffer&&(r=1==Atomics.load(self.mainSharedArrayBuffer,T.MainSharedBufferType.IS_SHIELD_AUDIO));var a=this.jumpBufferCfg[1],n=this.jumpBufferCfg[3],o=1e3*this.jumpBufferCfg[4],u=1e3*this.jumpBufferCfg[5];if(r){var l=(self.mainSharedArrayBuffer?Atomics.load(self.mainSharedArrayBuffer,T.MainSharedBufferType.FRAME_BUFFER_LEN):0)+i,d=this.JITTER_BUFLEN+this.shieldAudioCfgBufLen,c=this.JITTER_BUFLEN;if((s=l-d)<=0||(i-s<c&&(s=i-c),s<0))return}
1if(!(t-this.startPlayTime<n)){if(this.isStartBuffer)s>=a&&(this.isRevFastOver||t-this.startPlayTime>=u)&&this.setJumpBuffer(s,i,1,e,t,r)&&(this.isStartBuffer=!1);else if(t-this.setVideoCurrentTime>=o||0==this.setVideoCurrentTime){if(t-this.startMoreBufferTime>=this.bufferMoreContinueTime&&0!=this.startMoreBufferTime&&this.setJumpBuffer(s,i,2,e,t,r))return void(this.startMoreBufferTime=0);s>=a?0==this.startMoreBufferTime&&(this.startMoreBufferTime=t):this.startMoreBufferTime=0}}}}},{key:"setJumpBuffer",value:function(t,e,i,s,r,a){var n=!1;if(self.mainSharedArrayBuffer&&(n=1==Atomics.load(self.mainSharedArrayBuffer,T.MainSharedBufferType.BROWSER_PAUSE_STATUS)),0==this.videoSamples.length)return!1;if(0!=this.audioSamples.length||n){var o=this.videoSamples.length,u=this.player.getVideoDecodedBuffer(),l=this.player.getVideoDecodingBuffer(),d=0,c=0,f=0,p=0,m=this.videoSamples[0].timeStamp;if(n)f=0;else if(this.videoSamples[0].timeStamp<this.audioSamples[0].timeStamp){for(var _=0;_<o;_++)if(this.videoSamples[_].timeStamp>=this.audioSamples[0].timeStamp){m=this.videoSamples[_].timeStamp,f=_;break}}else f=0;for(var y=m+t,v=0,g=0,P=o-1;P>=0;P--){var C=this.videoSamples[P].timeStamp;if(this.videoSamples[P].isKeyFrame){var E=C-m;if(E-t<100&&E-t>=-100){p=P;break}}}if(-1!=f){if(f>=0&&p>f&&(m=this.videoSamples[f].timeStamp,y=this.videoSamples[p].timeStamp),n){if(p-f<1)return!1;this.videoSamples.splice(f,p-f)}else{for(var I=0;I<this.audioSamples.length;I++)if(-1==d&&this.audioSamples[I].timeStamp>=m&&(0==I||this.audioSamples[I-1].timeStamp<m)&&(d=I),this.audioSamples[I].timeStamp>y){c=I;break}if(d>=0&&c>d&&(v=this.audioSamples[d].timeStamp,g=this.audioSamples[c].timeStamp),c-d<1||p-f<1)return!1;this.videoSamples.splice(f,p-f),this.audioSamples.splice(d,c-d)}var k="WebCodecs.DecodeJitter.setJumpBuffer,type=".concat(i,",isRemuxBuf=").concat(this.isRemuxBuf,",");return k+="bufLen=".concat(e,",decodedBuf=").concat(u,",decodingBuf=").concat(l,","),k+="aStartI=".concat(d,",aEndI=").concat(c,",vStartI=").concat(f,",vEndI=").concat(p,","),k+="currentTime=".concat(s,",aDrop=").concat(c-d,",vDrop=").concat(p-f,",'jumpABuflen'=").concat(g-v,",'jumpVbufLen'=").concat(y-m,",isShieldAudio=").concat(a),S.default.log(k),this.setVideoCurrentTime=S.default.getNow(),!0}}}},{key:"discardDeltaVideoFrame",value:function(){if(this.isEnableDiscard&&0!=this.videoSamples.length){var t=this.player.getVideoCurrentDts(),e=this.player.getAudioCurrentDts(),i=this.getBufferLength(t),s=e-t;if(i<=1e3)return!1;var r=this.videoSamples[0],a=this.player.toDecodeVideoFps>=60?60:this.player.toDecodeVideoFps;if(0==a)return!1;var n=~~(1e3/a*3);n<=50&&(n=50);var o=0;return!(s<=100||(s<=200?(o=1,this.discardVideoTSGap=6*n):s<=500?(o=2,this.discardVideoTSGap=4*n):s<=1e3?(o=3,this.discardVideoTSGap=2*n):(o=4,this.discardVideoTSGap=n),!r.discardAllow||r.timeStamp-this.lastDiscardFrameTimeStamp<this.discardVideoTSGap||(this.lastDiscardFrameTimeStamp=r.timeStamp,this.videoSamples.shift(),this.discardNums++,this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_DECODE_DISCARD_NUMS,this.discardNums),S.default.log("WebCodecs.DecodeJitter.discardDeltaVideoFrame discardNums=".concat(this.discardNums," dropLevel=").concat(o,", bufLen=").concat(i,", delta=").concat(s)),0)))}}},{key:"newDiscardVideoFrame",value:function(){return!!this.isEnableDiscard&&0!=this.videoSamples.length&&void(this.discardFrameByPending()||this.discardDeltaVideoFrame()||this.discardFrameByDecodeRate())}},{key:"discardFrameByPending",value:function(){var t=S.default.getNow();if(0!=this.setVideoCurrentTime&&t-this.setVideoCurrentTime<1e3*this.jumpBufferCfg[0])return!1;var e=this.player.toDecodeVideoFps>=60?60:this.player.toDecodeVideoFps,i=this.player.delayDecode,s=Number(e)*Number(i);if(0===e||0===i)return!1;var r=this.videoSamples[0],a=this.player.getVideoCurrentDts(),n=this.getWillDecodeVBuf(a),o=this.player.webcodecCfg,u=2e3,l=1e4,d=2e4;o&&o[5]&&o[5].length>=3&&(u=o[5][0],l=o[5][1],d=o[5][2]);var c=this.player.getAudioCurrentDts()-a;
1if(!(c<100)){var f=this.player.webcodecCfg[4]||1500,p=!1,m=0;if(n>=u&&n<=l)n-u>=Math.random()*u&&r.discardAllow&&s>=f&&(p=!0,m=1);else if(n>l&&n<=d)s>=f&&r.discardAllow&&(p=!0,m=2);else if(n>d&&s>=f)return m=3,this.discardPendingIframe(m,n,c),!0;var _=~~(1e3/e*3);return _<=50&&(_=50),!(r.timeStamp-this.lastDiscardFrameTimeStamp<_)&&(p&&(this.lastDiscardFrameTimeStamp=r.timeStamp,this.videoSamples.shift(),this.discardNums++,this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_DECODE_DISCARD_NUMS,this.discardNums),S.default.log("WebCodecs.DecodeJitter.discardFrameByPending discardNums=".concat(this.discardNums," dropLevel=").concat(m,", bufLen=").concat(n))),p)}}},{key:"discardFrameByDecodeRate",value:function(){var t=this.player.getVideoCurrentDts(),e=!1;if(!(this.player.getAudioCurrentDts()-t<100)){var i=this.videoSamples[0];if(!i.discardAllow)return e;var s=this.player.toDecodeVideoFps>=60?60:this.player.toDecodeVideoFps,r=this.player.delayDecode;if(this.noReferFps<=0||s<=0||r<=0)return e;var a=Number(s)*Number(r),n=Number(this.noReferFps)*Number(r),o=(this.videoFPS-1e3/r)/this.noReferFps,u=this.player.webcodecCfg[4]||
11500,l=0;a>=u&&(a<n+u?100*o>=100*Math.random()&&(e=!0,l=1):(e=!0,l=2));var d=~~(1e3/s*3);return d<=50&&(d=50),!(i.timeStamp-this.lastDiscardFrameTimeStamp<d)&&(e&&(this.lastDiscardFrameTimeStamp=i.timeStamp,this.videoSamples.shift(),this.discardNums++,this.player.storeWorkerShared(T.StoreWorkerType.VIDEO_DECODE_DISCARD_NUMS,this.discardNums),S.default.log("WebCodecs.DecodeJitter.discardFrameByDecodeRate discardNums=".concat(this.discardNums," dropLevel=").concat(l))),e)}}},{key:"discardPendingIframe",value:function(t,e,i){if(!(i<3e3)){var s=this.videoSamples,r=s.length;if(!(r<=0)){for(var a=-1,n=-1,o=0;o<r;o++){var u=s[o];if(-1!=a&&u.isKeyFrame){n=o-1;break}u.isKeyFrame&&(a=o+1)}a>=0&&n>=0&&a<n&&(this.videoSamples.splice(a,n-a),this.discardNums+=n-a,S.default.log("WebCodecs.DecodeJitter.discardFrameByPending discard=".concat(n-a,",start=").concat(a,",end=").concat(n,",dropLevel=").concat(t,",bufLen=").concat(e,"}")))}}}},{key:"addRecv",value:function(t,e){var i=t+e;i>this.lastAppendVideoPts&&(this.lastAppendVideoPts=i)}},{key:"onRenderVideo",value:function(t){}},{key:"appendAudioFrame",value:function(t){for(;t.length>0;){var e=t.shift();0==this.isFirstAudioStamp&&(this.isFirstAudioStamp=e.timeStamp),this.isAudioSeek&&e.timeStamp>=this.seekVideoDts&&(S.default.log("DecodeJitter.audioSeek recover!"),this.isAudioSeek=!1),this.checkAvDiff(this.lastVideoStamp,e.timeStamp),P.a.printAppendAudio&&S.default.log("DecodeJitter.appendAudioFrame dts=".concat(e.timeStamp," samples=").concat(this.audioSamples.length)),this.audioSamples.push(e),this.player.latencyCfg.latencyMode||this.player.audioDecoderReadyed&&(0!=this.isFirstAudioStamp&&e.timeStamp-this.isFirstAudioStamp<=500||this.isAudioSeek)&&this.decodeAudioSamples()}}},{key:"appendVideoFrame",value:function(t){for(;t.length>0;){var e=t.shift();0===this.firstVideoDts&&(this.firstVideoDts=e.timeStamp),this.checkAvDiff(e.timeStamp,this.lastAudioStamp),this.addRecv(e.timeStamp,e.compositionTime),P.a.printAppendVideo&&S.default.log("DecodeJitter.appendVideoFrame dts=".concat(e.timeStamp," samples=").concat(this.videoSamples.length)),this.isVideoSeek&&e.timeStamp>=this.seekVideoDts&&(S.default.log("DecodeJitter.videoSeek recover!"),this.isVideoSeek=!1),this.videoSamples.push(e),this.player.latencyCfg.latencyMode||(this.player.isVodAv1?this.player.videoDecoderReadyed&&(e.timeStamp-this.firstVideoDts<this.fastDecodeTime||this.isVideoSeek)&&this.decodeVideoSamples(0,S.default.getNow(),0,0):(e.timeStamp-this.firstVideoDts<this.fastDecodeTime||this.isVideoSeek)&&this.decodeVideoSamples(0,S.default.getNow(),0,0))}}},{key:"checkAvDiff",value:function(t,e){if(this.isLive&&this.player.dtsJumpOpen){if(this.player.videoRender.isSync&&t>0&&e>0){var i=t>e?t-e:e-t;i>this.player.dtsJumpThreshold&&(this.player.videoRender.setNotSync(),S.default.log("DecodeJitter.checkAvDiff diff=".concat(i)))}this.lastVideoStamp=t,this.lastAudioStamp=e}}},{key:"updateVideoDecodedTimeStamp",value:function(t){this.lastDecodedVideoTimeStamp=t}},{key:"updateVideoFPS",value:function(t,e){this.videoFPS=t,this.noReferFps=e}},{key:"close",value:function(){this.player=null,this.videoSamples.length=0,this.videoSamples=null,this.audioSamples.length=0,this.lastAppendVideoPts=0,this.recvMap.clear(),this.videoToDecodedTime=0,this.isFirstAudioStamp=0,this.firstVideoDts=0,this.discardNums=0,this.startPlayTime=0,this.isStartBuffer=!0,this.setVideoCurrentTime=0,this.startMoreBufferTime=0,this.isPauseVideoDecode=!1,this.isPauseAudioDecode=!1,this.isEnableDiscard=!1,this.isSoftWebcodecs=!1,this.decode10SecCostList.length=0,this.isRevFastOver=!1}},{key:"checkAVSync",value:function(){if(!(S.default.getNow()-this.startPlayTime<startCD)){var t=this.player.getVideoCurrentDts(),e=this.player.getAudioCurrentDts();if(!(t<=0||e<=0)){var i=e-t;i>=1e3&&i>=0||i<0&&i<=-1e3&&this.checkDiscardAudio(e,t)}}}},{key:"checkDiscardAudio",value:function(t,e){var i=this.getAudioBufferLength(t),s=i-this.JITTER_BUFLEN;if(S.default.log("DecodeJitter.checkDiscardAudio, bufLen=".concat(i,", audioCurrentDts=").concat(t,", videoCurrentDts=").concat(e,", minusBuffer=").concat(s,", delta=").concat(t-e)),!(i<=this.JITTER_BUFLEN)&&!(this.audioSamples.length<=1)){var r=this.audioSamples[0].timeStamp;if(!(0==e||e<r)){for(var a=0;this.audioSamples.length>0;){var n=this.audioSamples[0];if(!(n.timeStamp<e&&n.timeStamp-r<=s))break;this.audioSamples.shift(),a=n.timeStamp}a>0&&S.default.log("DecodeJitter.checkDiscardAudio, startTs=".concat(r,", endTs=").concat(a,", discardBuffer=").concat(a-r))}}}},{key:"checkDiscardVideo",value:function(t,e){var i=this.getBufferLength(e),s=i-this.JITTER_BUFLEN;if(S.default.log("DecodeJitter.checkDiscardVideo, bufLen=".concat(i,", audioCurrentDts=").concat(t,", videoCurrentDts=").concat(e,", minusBuffer=").concat(s,", delta=").concat(t-e)),!(i<=this.JITTER_BUFLEN)){var r=this.videoSamples.length;if(!(r<=1)){var a=this.videoSamples[0].timeStamp;if(!(0==t||t<a)){for(var n=0,o=0;o<r;o++){var u=this.videoSamples[o];if(!(u.timeStamp<t&&u.timeStamp-a<=s))break;u.discardAllow&&(this.videoSamples.shift(),n=u.timeStamp,r--)}n>0&&S.default.log("DecodeJitter.checkDiscardVideo, startTs=".concat(a,", endTs=").concat(n,", discardBuffer=").concat(n-a))}}}}},{key:"setPauseVideoDecode",value:function(t){this.isPauseVideoDecode=t.isPause}},{key:"setPauseAudioDecode",value:function(t){this.isPauseAudioDecode=t.isPause}},{key:"setEnableDiscard",value:function(t){this.isEnableDiscard=t.enableDiscard}},{key:"setUseSoftAcceleration",value:function(){this.isSoftWebcodecs=!0}},{key:"updateSoftAcceleration",value:function(){this.decode10SecCostList=[],this._helper.updateSoftAcceleration()}},{key:"getVideoDiscardNums",value:function(){var t=this.discardNums-this.lastVideoDiscardNums;return this.lastVideoDiscardNums=this.discardNums,t}},{key:"setRealFps",value:function(t){this.realFps=t}}]),t}(),j=function(){function t(){Object(s.a)(this,t),this._firstVideoRenderTs=0,this._firstVideoPts=0,this._firstAudioRenderTs=0,this._firstAudioPts=0,this._syncDone=!1,this._openSync=!1}return Object(r.a)(t,[{key:"reset",value:function(){this._firstVideoRenderTs=0,this._firstVideoPts=0,this._firstAudioRenderTs=0,this._firstAudioPts=0,this._syncDone=!1}},{key:"openSync",set:function(t){this._openSync=t}},{key:"setRenderVideoTs",value:function(t){0===this._firstVideoRenderTs&&(this._firstVideoRenderTs=t)}}
1,{key:"setRenderAudioTs",value:function(t,e,i){if(0===this._firstAudioRenderTs&&(this._firstAudioRenderTs=t),this._openSync&&!this._syncDone&&this._firstAudioRenderTs>0&&this._firstVideoRenderTs>0&&this._firstVideoPts>0&&this._firstAudioPts>0){this._syncDone=!0;var s=this._firstVideoPts-this._firstAudioPts;S.default.log("AVRenderSync.syncAudio render done delta=".concat(s)),e.setJumpTime(s),i.setJumpTime(s)}}},{key:"setVideoPts",value:function(t){0===this._firstVideoPts&&(this._firstVideoPts=t)}},{key:"setAudioPts",value:function(t){0===this._firstAudioPts&&(this._firstAudioPts=t)}}]),t}(),Y=function(){function t(){Object(s.a)(this,t),this.openRenderSync=!1,this.latencyBuf=2500,this.latencyMin=3e3,this.latencyMax=3500,this.skipFrameGap=5,this.isNoGop=!1,this.fastMode=!1,this.latencyMode=!1}return Object(r.a)(t,[{key:"initConfig",value:function(t){this.latencyMode=!1,t&&(t.hasOwnProperty("openRenderSync")&&(this.openRenderSync=t.openRenderSync),t.hasOwnProperty("lowlatencyBuf")&&(this.latencyBuf=t.lowlatencyBuf,this.latencyMode=-1!==this.latencyBuf),t.hasOwnProperty("lowlatencyMin")&&(this.latencyMin=t.lowlatencyMin),t.hasOwnProperty("lowlatencyMax")&&(this.latencyMax=t.lowlatencyMax),t.hasOwnProperty("isNoGop")&&(this.isNoGop=t.isNoGop),t.hasOwnProperty("fastMode")&&(this.fastMode=t.fastMode),t.hasOwnProperty("skipFrameGap")&&(this.skipFrameGap=t.skipFrameGap))}}]),t}();e.default=function(){function t(){Object(s.a)(this,t),this.videoDecoder=new E(this),this.audioDecoder=new k(this),this.videoRender=new F(this),this.audioRender=new M(this),this.decodeJitter=new W(this),this.audioDecodedFrames=[],this.audioRenderStarted=!1,this.audioStartRenderFrameTimeLen=500,this.oneSecNow=0,this.fastCheckNow=0,this.frameDuration=0,this.startAppendAudioTime=0,this.isFirstPostAudio=!1,this.quickTimerInterval=null,this.onQuickCheckTimerBind=this.onQuickCheckTimer.bind(this),this.videoFrameStampMap=new Map,this.delayDecode=0,this.toDecodeVideoFps=0,this.userPaused=!1,this.webcodecCfg={},this.latencyCfg=new Y,this.videoDecodeCostErrCnt=0,this.printCnt=0,this.avRenderSync=new j,this.isBrowserHidden=!1,this.renderNum=0,this.lastTs=0,this.pageFps=0,this.lowFpsCnt=0,this.dtsJumpOpen=!1,this.dtsJumpThreshold=1e4,this.seekTime=0,this.seekVideoDts=0,this.isSeek=!1,this.isAudioSeek=!1,this.firstVideoTs=-1e4,this.firstAudioTs=-1e4,this.seekAudioSamples=[],this.isVodAv1=!1}return Object(r.a)(t,[{key:"audioDecoderReadyed",get:function(){return this.audioDecoder&&this.audioDecoder.configured}},{key:"videoDecoderReadyed",get:function(){return this.videoDecoder&&this.videoDecoder.configured}},{key:"setVideoOutputByPts",value:function(t){this.decodeJitter.setVideoOutputByPts(t)}},{key:"initWebcodecCfg",value:function(t){var e=t.webcodecCfg,i=t.lowlatencyCfg,s=t.aiEnhanceCfg,r=t.isLive;e&&(this.webcodecCfg=e),this.decodeJitter.setLive(r),this.latencyCfg.initConfig(i),this.avRenderSync.openSync=this.latencyCfg.openRenderSync,0===this.latencyCfg.latencyBuf&&this.decodeJitter._helper.setNormal(),this.dtsJumpOpen=!!t.dtsJumpOpen,this.dtsJumpThreshold=t.dtsJumpThreshold||1e4,this.videoRender.initConfig(s)}},{key:"startVideoRender",value:function(t,e){var i=t.width,s=t.height,r=t.agenerator,a=S.default.getNow();this.videoRender.start(i,s,r,e),clearInterval(this.quickTimerInterval),this.quickTimerInterval=setInterval(this.onQuickCheckTimerBind,4),this.decodeJitter.setStartPlayTime(a)}},{key:"startAudioRender",value:function(t){this.audioRender.start(t)}},{key:"onQuickCheckTimer",value:function(){S.default.postMessage(T.ToMainMessageType.INTERVAL);var t=!1;self.mainSharedArrayBuffer&&(t=1==Atomics.load(self.mainSharedArrayBuffer,D.a.PAUSE_STATUS),this.userPaused=t);var e=S.default.getNow();if(!this.userPaused){var i=this.getAudioDecodedBuffer(),s=this.videoRender.getDecodedBuffer(),r=this.getVideoCurrentDts();this.decodeJitter.decodeThread(i,s,r,this.videoDecoder.decoder.decodeQueueSize),this.audioRender.onQuickCheckTimer(e),this.videoRender.rafHandler(e)}0===this.oneSecNow?this.oneSecNow=e:e-this.oneSecNow>=1e3&&(this.onCheckTimer(e),this.oneSecNow=e),0===this.fastCheckNow?this.fastCheckNow=e:e-this.fastCheckNow>=100&&(this.onCheckFastTimer(e),this.fastCheckNow=e),this.storeWorkerShared(T.StoreWorkerType.VIDEO_BUFFER_LEN,this.getBufferLen())}},{key:"rafHandler",value:function(t){if(this.renderNum++,0===this.lastTs)this.lastTs=t;else{var e=t-this.lastTs;if(e>=1e3){this.lastTs=t;var i=Math.floor(this.renderNum/(e/1e3));this.pageFps=i,this.renderNum=0}}}},{key:"onCheckTimer",value:function(t){if(this.decodeJitter.onCheckTimer(t),S.default.logArr.length>
10&&(S.default.postMessage(T.ToMainMessageType.LOG,S.default.logArr),S.default.logArr.length=0),this.statEverySec(t),self.mainSharedArrayBuffer){var e=Atomics.load(self.mainSharedArrayBuffer,D.a.VIDEO_REAL_FPS);this.decodeJitter.setRealFps(e),Atomics.store(self.mainSharedArrayBuffer,D.e.VIDEO_DECODED_DELAY_SMOOTH,this.videoDecoder.smoothFrameDecodeDelay)}this.videoRender.onCheckTimer(t)}},{key:"onCheckFastTimer",value:function(t){this.decodeJitter&&this.decodeJitter.onCheckFastTimer&&this.decodeJitter.onCheckFastTimer(t)}},{key:"getAudioDecodedBuffer",value:function(){return this.audioRender.getDecodedBuffer()}},{key:"getVideoDecodedBuffer",value:function(){return this.videoRender.getDecodedBuffer()}},{key:"getVideoDecodingBuffer",value:function(){return this.videoDecoder.getDecodingBuffer()}},{key:"statEverySec",value:function(){var t=this.videoDecoder.getDecodeDelay(),e=0,i=0,s=-1;t.map(function(t){e+=t}),e>0&&(s=i=~~(e/t.length)),this.delayDecode=i,s>-1&&s<15?this.videoDecodeCostErrCnt++:this.videoDecodeCostErrCnt=0;var r=this.videoDecoder.getDecodeFps();this.toDecodeVideoFps=r.toDecodeFps,this.storeWorkerShared(T.StoreWorkerType.VIDEO_DECODED_DELAY,i),this.storeWorkerShared(T.StoreWorkerType.VIDEO_READY_TO_RENDER_LIST_LEN,this.videoRender.framelist.length),this.videoDecodeCostErrCnt,this.videoDecoder.isOutputFrameByDts()&&"265"==this.videoDecoder.codecType&&this.handlerError(T.ToMainMessageType.DECODE_DTS);var a=this.videoRender.getEnhanceCostList(),n=0,o=0;a.map(function(t){n+=t}),n>0&&(o=~~(n/a.length)),this.storeWorkerShared(T.StoreWorkerType.VIDEO_ENAHNCE_COST,o)}},{key:"storeWorkerShared",value:function(t,e){self.mainSharedArrayBuffer&&Atomics.store(self.mainSharedArrayBuffer,t,e)}},{key:"updateRect",value:function(t,e){this.videoRender.updateRect(t,e)}},{key:"updateAVCConfig",value:function(t){this.videoRender.updateAVCConfig(t.width,t.height)}},{key:"updateAudioConfig",value:function(t,e,i,s){this.audioDecoder.updateAudioConfig(t,e,i,s),this.decodeJitter.updateAACSampleRate(e),this.audioRender.updateAACSampleRate(e),this.updateAACSampleRate(e)}},{key:"updateAVCPPS",value:function(t,e){}},{key:"updateAVCSPS",value:function(t,e){}},{key:"updateAVCVPS",value:function(t,e){}},{key:"toDecodeFrame",value:function(t){t.type==g.AUIDO?(this.avRenderSync.setAudioPts(t.timeStamp),this.lastToDecodeAudioTs=t.timeStamp,this.audioDecoder.decodeFrame(t)):t.type==g.VIDEO&&(this.avRenderSync.setVideoPts(t.timeStamp+t.compositionTime||0),this.lastToDecodeVideoTs=t.timeStamp,this.toDecodeVideoFrameNums++,this.videoDecoder.decodeFrame(t))}},{key:"onFrameDecoded",value:function(t){var e=this.seekVideoDts;if(t.type==v.VIDEO){this.decodedVideoFrameNums++,this.decodeJitter.updateVideoDecodedTimeStamp(t.frame.timestamp),0==this.firstPerformentTime&&(this.firstPerformentTime=S.default.getNow()),t.noRenderCount=0;var i=t.timeStamp,s=this.videoFrameStampMap.get(i);void 0!==s&&(t.timeStamp+=s,this.videoFrameStampMap.delete(i)),this.isSeek?t.timeStamp-e>=0?(this.onVideoSeek(),this.videoRender.appendFrame(t)):(this.videoRender.setLastPic(t),t.frame.close()):this.videoRender.appendFrame(t)}else t.type==v.AUIDO&&(this.isAudioSeek?t.timeStamp-e>=0?(this.onAudioSeek(),this.seekAudioSamples.push(t)):(t.frame.close(),this.audioRender.setLastAudioData(t),t=null):this.isSeek?this.seekAudioSamples.push(t):this.audioRender.onFrameDecoded(t))}},{key:"setRenderAudioTs",value:function(t,e){this.avRenderSync.setRenderAudioTs(t,e,this.decodeJitter._helper._audioHelper._timeline)}},{key:"appendAudioFrame",value:function(t){0==this.startAppendAudioTime&&(this.startAppendAudioTime=S.default.getNow()),-1e4==this.firstAudioTs&&t.length>0&&(this.firstAudioTs=t[0].timeStamp),this.decodeJitter.appendAudioFrame(t)}},{key:"appendVideoFrame",value:function(t){var e=this;-1e4==this.firstVideoTs&&t.length>0&&(this.firstVideoTs=t[0].timeStamp),t.map(function(t){e.videoFrameStampMap.set(t.timeStamp,t.compositionTime),e.decodeJitter.updateVideoCts(t.compositionTime)}),this.decodeJitter.appendVideoFrame(t)}},{key:"fastOver",value:function(){this.decodeJitter.fastOver()}},{key:"updateAACSampleRate",value:function(t){this.frameDuration=1024e3/t}},{key:"updateVideoFPS",value:function(t,e){this.decodeJitter.updateVideoFPS(t,e)}},{key:"setPlayMinBuffer",value:function(t){this.decodeJitter.updateVideoFPS(t)}},{key:"setJitter",value:function(t){this.decodeJitter.setJitter(t)}},{key:"handlerError",value:function(t,e){S.default.postMessage(t,e)}},{key:"getBufferLen",value:function(){return this.decodeJitter?this.decodeJitter.getBufferLength(this.videoRender.getCurrentDts()):0}},{key:"getAudioCurrentDts",value:function(){return this.audioRender.getAudioCurrentDts()}},{key:"getVideoCurrentDts",value:function(){return this.videoRender.getCurrentDts()}},{key:"setUseSoftAcceleration",value:function(){S.default.log("WebCodecsWorkerPlayer.setUseSoftAcceleration"),this.videoDecoder.setUseSoftAcceleration(),this.decodeJitter.setUseSoftAcceleration()}},{key:"updateSoftAcceleration",value:function(){S.default.log("WebCodecsWorkerPlayer.updateSoftAcceleration"),this.setUseSoftAcceleration(),this.videoDecoder.resetDecoder(),this.decodeJitter.updateSoftAcceleration()}},{key:"setLocalConfig",value:function(t){1==t._webcodecsNoRenderVideo&&this.videoRender.setN
1oRender(),1==t._useSoftAcceleration&&this.setUseSoftAcceleration()}},{key:"setPauseVideoDecode",value:function(t){this.decodeJitter.setPauseVideoDecode(t)}},{key:"setPauseAudioDecode",value:function(t){this.decodeJitter.setPauseAudioDecode(t)}},{key:"setEnableDiscard",value:function(t){this.decodeJitter.setEnableDiscard(t)}},{key:"turnToWebcodecsSoft",value:function(){this.videoRender&&this.videoRender.videoEnhance.isSuccess||("265"==this.videoDecoder.codecType?S.default.postMessage(T.ToMainMessageType.SOFT_TURN_TO_MSE):S.default.postMessage(T.ToMainMessageType.TURN_TO_WEBCODECS_SOFT))}},{key:"turnToMse",value:function(){this.videoRender&&this.videoRender.videoEnhance.isSuccess||S.default.postMessage(T.ToMainMessageType.SOFT_TURN_TO_MSE)}},{key:"updateCurBitrate",value:function(t){this.videoRender.updateCurBitrate(t)}},{key:"setRealFps",value:function(t){this.decodeJitter.setRealFps(t),this.videoRender.setRealFps(t)}},{key:"setBrowserHidden",value:function(t){this.isBrowserHidden=t,this.videoRender.setBrowserHidden(t)}},{key:"setEnhance",value:function(t){this.videoRender.setEnhance(t)}},{key:"setSegmenttion",value:function(t){this.videoRender.setSegmenttion(t)}},{key:"getEnhanceSuccess",value:function(){return this.videoRender.getEnhanceSuccess()}},{key:"handleEnhanceError",value:function(){this.videoRender.handleEnhanceError()}},{key:"onRevFastOver",value:function(){this.decodeJitter.onRevFastOver()}},{key:"initAv1Seg",value:function(t){this.videoDecoder.initAv1Seg(t)}},{key:"seek",value:function(t){this.isSeek=!0,this.isAudioSeek=!0,this.seekTime=t.seekTime,this.seekVideoDts=1e3*t.seekTime+t.initDts;var e=this.videoRender.getVideoRenderPts();e>this.seekVideoDts&&(this.isSeekBack=!0),0!=e&&(this.videoDecoder.seek(),this.audioDecoder.seek()),S.default.log("WebCodecsWorkerPlayer.seek",this.seekTime,this.seekVideoDts,this.isSeekBack),this.decodeJitter.seek(this.seekTime,this.seekVideoDts),this.videoRender.seek(this.seekVideoDts),this.audioRender.seek(this.seekVideoDts)}},{key:"setPlaybackRate",value:function(t){this.videoRender.setPlaybackRate(t)}},{key:"setVodAv1",value:function(){this.isVodAv1=!0}},{key:"onVideoSeek",value:function(){var t=this;S.default.log("WebCodecsWorkerPlayer.onVideoSeek, aLen=".concat(this.seekAudioSamples.length)),S.default.postMessage(T.ToMainMessageType.ON_WCS_VIDEO_SEEK,this.seekTime),this.seekTime=0,this.seekAudioSamples.forEach(function(e){t.audioRender.onFrameDecoded(e)}),this.seekAudioSamples.length=0,this.decodeJitter.onVideoSeek(),this.videoRender.onVideoSeek(),this.isSeek=!1,this.seekVideoDts=0,this.isSeekBack=!1,this.seekTime=0}},{key:"onAudioSeek",value:function(){S.default.log("WebCodecsWorkerPlayer.onAudioSeek"),this.isAudioSeek=!1,this.decodeJitter.onAudioSeek()}},{key:"getAacTimeLen",value:function(){return this.audioDecoder.getAacTimeLen()}},{key:"destroy",value:function(){S.default.log("WebCodecsWorkerPlayer.destroy"),this.destroyed=!0,this.videoDecoder.close(),this.videoDecoder=null,this.audioDecoder.close(),this.audioDecoder=null,this.decodeJitter.close(),this.decodeJitter=null,this.videoRender.close(),this.videoRender=null,this.startAudioFastTs=0,this.startVideoFastTs=0,this.oneSecNow=0,this.startAppendAudioTime=0,this.isFirstPostAudio=!1,clearInterval(this.quickTimerInterval),this.quickTimerInterval=null,this.videoFrameStampMap=null,this.delayDecode=0,this.toDecodeVideoFps=0,this.userPaused=!1,this.isBrowserHidden=!1,this.pageFps=0,this.renderNum=0,this.lastTs=0}}]),t}()}],s={};function r(t){if(s[t])return s[t].exports;var e=s[t]={i:t,l:!1,exports:{}};return i[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}r.m=i,r.c=s,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(i,s,(function(e){return t[e]}).bind(null,s));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=31)}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(103)),r=u(i(36)),a=u(i(18)),n=u(i(34)),o=u(i(151));function u(t){return t&&t.__esModule?t:{default:t}}a.default.PlayerClass=o.default,e.default={Events:s.default,PlayerEvents:r.default,setAppId:a.default.setAppId.bind(a.default),setSignalSdk:n.default.init.bind(n.default),loginMedia:a.default.loginMedia.bind(a.default),setProperties:a.default.setProperties.bind(a.default),createPlayer:a.default.createPlayer.bind(a.default),isSupported:a.default.isSupported.bind(a.default)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(1),r=s&&s.__esModule?s:{default:s},a=function t(){(0,r.default)(this,t)};a.WEBSOCKET_CONNECTED="WEBSOCKET_CONNECTED",a.WEBSOCKET_CLOSED="WEBSOCKET_CLOSED",a.WEBSOCKET_ERROR="WEBSOCKET_ERROR",a.SERVER_OPEN="SERVER_OPEN",a.SERVER_CLOSE="SERVER_CLOSE",a.SERVER_ERROR="SERVER_ERROR",a.SERVER_PROTO="SERVER_PROTO",a.SERVER_INITED="SERVER_INITED",a.SERVER_LOGIN="SERVER_LOGIN",a.SERVER_CFG_INITED="SERVER_CFG_INITED",a.UPDATE_STREAM_INFO="UPDATE_STREAM_INFO",a.UPDATE_STREAM_INFO_FAIL="UPDATE_STREAM_INFO_FAIL",a.ROOM_LIVE_END="ROOM_LIVE_END",a.MEDIA_STOPSTREAM_NOTICE="MEDIA_STOPSTREAM_NOTICE",a.MEDIA_STREAMCHANGED_NOTICE="MEDIA_STREAMCHANGED_NOTICE",e.default=a},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,i){i(106),t.exports=i(0).Object.setPrototypeOf},function(t,e,i){var s=i(2);s(s.S,"Object",{setPrototypeOf:i(107).set})},function(t,e,i){var s=i(6),r=i(9),a=function(t,e){if(r(t),!s(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,s){try{(s=i(12)(Function.call,i(50).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,i){return a(t,i),e?t.__proto__=i:s(t,i),t}}({},!1):void 0),check:a}},function(t,e,i){t.exports={default:i(109),__esModule:!0}},function(t,e,i){i(110),t.exports=i(0).Object.preventExtensions},function(t,e,i){var s=i(6),r=i(39).onFreeze;i(19)("preventExtensions",function(t){return function(e){return t&&s(e)?t(r(e)):e}})},function(t,e,i){t.exports={default:i(112),__esModule:!0}},function(t,e,i){i(113),t.exports=i(0).Object.isExtensible},function(t,e,i){var s=i(6);i(19)("isExtensible",function(t){return function(e){return!!s(e)&&(!t||t(e))}})},function(t,e,i){t.exports={default:i(115),__esModule:!0}},function(t,e,i){i(116);var s=i(0).Object;t.exports=function(t,e){return s.defineProperties(t,e)}},function(t,e,i){var s=i(2);s(s.S+!i(7)*s.F,"Object",{defineProperties:i(72)})},function(t,e,i){var s=i(17),r=i(53),a=i(118);t.exports=function(t){return function(e,i,n){var o,u=s(e),l=r(u.length),d=a(n,l);if(t&&i!=i){for(;l>d;)if((o=u[d++])!=o)return!0}else for(;l>d;d++)if((t||d in u)&&u[d]===i)return t||d||0;return!t&&-1}}},function(t,e,i){var s=i(54),r=Math.max,a=Math.min;t.exports=function(t,e){return(t=s(t))<0?r(t+e,0):a(t,e)}},function(t,e,i){var s=i(0),r=s.JSON||(s.JSON={stringify:JSON.stringify});t.exports=function(t){return r.stringify.apply(r,arguments)}},function(t,e,i){i(121);var s=i(0).Object;t.exports=function(t,e){return s.getOwnPropertyDescriptor(t,e)}},function(t,e,i){var s=i(17),r=i(50).f;i(19)("getOwnPropertyDescriptor",function(){return function(t,e){return r(s(t),e)}})},function(t,e,i){t.exports={default:i(123),__esModule:!0}},function(t,e,i){i(124);var s=i(0).Object;t.exports=function(t){return s.getOwnPropertyNames(t)}},function(t,e,i){i(19)("getOwnPropertyNames",function(){return i(75).f})},function(t,e,i){t.exports={default:i(126),__esModule:!0}},function(t,e,i){i(77),t.exports=i(0).Object.getOwnPropertySymbols},function(t,e,i){var s=i(27),r=i(59),a=i(38);t.exports=function(t){var e=s(t),i=r.f;if(i)for(var n,o=i(t),u=a.f,l=0;o.length>l;)u.call(t,n=o[l++])&&e.push(n);return e}}
1,function(t,e,i){i(129),t.exports=i(0).Object.getPrototypeOf},function(t,e,i){var s=i(20),r=i(81);i(19)("getPrototypeOf",function(){return function(t){return r(s(t))}})},function(t,e,i){t.exports={default:i(131),__esModule:!0}},function(t,e,i){i(132),t.exports=i(0).Object.keys},function(t,e,i){var s=i(20),r=i(27);i(19)("keys",function(){return function(t){return r(s(t))}})},function(t,e,i){i(134);var s=i(0).Object;t.exports=function(t,e){return s.create(t,e)}},function(t,e,i){var s=i(2);s(s.S,"Object",{create:i(42)})},function(t,e,i){t.exports={default:i(136),__esModule:!0}},function(t,e,i){i(43),t.exports=i(41).f("toStringTag")},function(t,e,i){i(77),i(43),i(138),i(139),t.exports=i(0).Symbol},function(t,e,i){i(58)("asyncIterator")},function(t,e,i){i(58)("observable")},function(t,e,i){i(141);var s=i(0).Object;t.exports=function(t,e,i){return s.defineProperty(t,e,i)}},function(t,e,i){var s=i(2);s(s.S+!i(7)*s.F,"Object",{defineProperty:i(8).f})},function(t,e,i){t.exports={default:i(143),__esModule:!0}},function(t,e,i){i(31),i(32),t.exports=i(41).f("iterator")},function(t,e,i){var s=i(54),r=i(52);t.exports=function(t){return function(e,i){var a,n,o=String(r(e)),u=s(i),l=o.length;return u<0||u>=l?t?"":void 0:(a=o.charCodeAt(u))<55296||a>56319||u+1===l||(n=o.charCodeAt(u+1))<56320||n>57343?t?o.charAt(u):a:t?o.slice(u,u+2):n-56320+(a-55296<<10)+65536}}},function(t,e,i){"use strict";var s=i(42),r=i(37),a=i(30),n={};i(13)(n,i(5)("iterator"),function(){return this}),t.exports=function(t,e,i){t.prototype=s(n,{next:r(1,i)}),a(t,e+" Iterator")}},function(t,e,i){"use strict";var s=i(147),r=i(85),a=i(21),n=i(17);t.exports=i(60)(Array,"Array",function(t,e){this._t=n(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,i=this._i++;return!t||i>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?i:"values"==e?t[i]:[i,t[i]])},"values"),a.Arguments=a.Array,s("keys"),s("values"),s("entries")},function(t,e){t.exports=function(){}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(11).TafMx},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={kMediaPackTypeStreamChangeNotice:1e5,kMediaPackTypeMediaStopStream:100102,kMediaPackTypeMediaChgUpStream:100200,kMediaPackTypeRoomStreamChangeNotice:100300}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={WEBSOCKET_CONNECTED:"WEBSOCKET_CONNECTED",WEBSOCKET_DOLAUNCH:"WEBSOCKET_DOLAUNCH",VERIFYCOOKIE_PASS:"VERIFYCOOKIE_PASS",WS_REGISTER_GROUP_RSP:"WS_REGISTER_GROUP_RSP",WS_UNREGISTER_GROUP_RSP:"WS_UNREGISTER_GROUP_RSP",WS_CONNET_STATE:"WS_CONNET_STATE"}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=R(i(29)),r=R(i(14)),a=R(i(1)),n=R(i(3)),o=R(i(23)),u=R(i(87)),l=R(i(24)),d=R(i(152)),c=R(i(182)),f=R(i(10)),p=R(i(36)),m=R(i(183)),_=R(i(95)),y=R(i(18)),v=R(i(184)),S=R(i(94)),g=R(i(185)),T=R(i(47)),P=R(i(68)),C=R(i(45)),E=R(i(93)),I=R(i(22)),k=R(i(204)),A=R(i(67));function R(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){function e(t){return(0,a.default)(this,e),(0,o.default)(this,(e.__proto__||(0,r.default)(e)).call(this,t))}return(0,l.default)(e,t),(0,n.default)(e,[{key:"initIns",value:function(){(0,u.default)(e.prototype.__proto__||(0,r.default)(e.prototype),"initIns",this).call(this),this.antiCode=new g.default}},{key:"backToBusi",value:function(t){f.default.log("WebPlayer("+this.id+").backToSusi type="+t);var e=[this.stat.createAct(P.default.STREAM_ERROR,{value:[t]})];T.default.onNimoDataMetric2(e,this.startPlayInfo.pid,0,"",0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,"",this.stream_from),this.trigger(p.default.MEDIA_STREAM_INFO_ERROR)}},{key:"reportBusiStream",value:function(t,e){var i=[this.stat.createAct(P.default.BUSI_STREAM,{value:[+!t,+!!e]})];f.default.log("WebPlayer("+this.id+").reportBusiStream hasStream",t,i),T.default.onNimoDataMetric2(i,this.startPlayInfo.pid,0,"",0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,"",this.stream_from)}},{key:"_hasP2p",value:function(){var t=this._getStream(this.streamList);if(t){var e=this._getLineInfo(t),i=E.default.getMediaStreamFormat(e.mMediaStreamFormatInfo.value,
1null,!0);return i&&i.sFormatName===_.default.f_p2p}return!1}},{key:"reportDifStream",value:function(t){f.default.log("WebPlayer("+this.id+").reportDifStream isDif",t);var e=[this.stat.createAct(P.default.DIF_STREAM,{value:[+!!t]})];T.default.onNimoDataMetric2(e,this.startPlayInfo.pid,0,"",0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,"",this.stream_from)}},{key:"_checkP2PConfig",value:function(t){try{t=JSON.parse(t),this.nimoConfig=t,this.currentRoomStream&&this.currentRoomStream.stream&&(k.default.isCanUse(t,this.currentRoomStream.roomId,this.currentRoomStream.line,this.currentRoomStream.iBitRate)||this.currentRoomStream.mediaFormat!=_.default.f_p2p||this._playStreamInfo(this.currentRoomStream.stream,this.currentRoomStream.iBitRate))}catch(t){f.default.log("WebPlayer.checkConfig err")}}},{key:"switchLevel",value:function(t){f.default.log("WebPlayer("+this.id+").switchLevel",t?JSON.parse(t):""),this.room.needSeek=!!t.needSeek,"hls"===t.type&&this.player&&this.player.hyPlayer&&this.player.hyPlayer.player&&this.player.hyPlayer.player.isSwitchSeamLessLine||"flv"===t.type&&c.default.isOpen(this.room.roomId,c.default.CTRL_KEY.SWITCH_PLAY)?this.player.switchLevel(t):this.startPlay(t,this.vjsOptions)}},{key:"needPlay",value:function(t){var e=this;if(t&&t.length>0){var i=t[0];if(i.streamName!==this.currentRoomStream.sStreamName)return f.default.log("WebPlayer("+this.id+").needPlay dif streamname",i.streamName,this.currentRoomStream.sStreamName),!0;var s=!1;if(i.vMediaStreamInfo.forEach(function(t){t.iLineIndex===e.currentRoomStream.line&&(s=!0)}),!s)return f.default.log("WebPlayer("+this.id+").needPlay no line"),!0;var r=!1,a="",n="";if(i.vStreamGearInfo.forEach(function(t){if(t.iBitRate===e.currentRoomStream.iBitRate){var s=e.getStreamGearInfo(i,t.iBitRate),o=A.default.getURIParam(s.sAdditionalParam,"needwm"),u=A.default.getURIParam(t.sAdditionalParam,"needwm");Number(t.tResolution.iWidth)===Number(e.currentRoomStream.iWidth)&&Number(t.tResolution.iHeight)===Number(e.currentRoomStream.iHeight)&&o===u&&(r=!0,a=t.sDisplayName,n=t.sBusiGearIndex)}}),!r)return f.default.log("WebPlayer("+this.id+").needPlay no gear"),!0;this.currentRoomStream.sDisplayName=a,this.currentRoomStream.sBusiGearIndex=n}return!1}},{key:"_getStream",value:function(t){return t&&t.length>0?t[0]:null}},{key:"playStreamInfo",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!0,r=this._getStream(t);r&&(s=this._playStreamInfo(r,e,i)),s&&(f.default.log("WebPlayer("+this.id+").playStreamInfo ROOM_NO_STREAM"),this.trigger(p.default.ROOM_NO_STREAM))}},{key:"_playStreamInfo",value:function(t,e,i){var s=this._getLineInfo(t),r=this._getGearInfo(t,e),a=t.playFormat,n=!0;if(s&&r&&a){if(this.nimoConfig){var o=k.default.isCanUse(this.nimoConfig,this.startPlayInfo.roomId,s.iLineIndex,r.iBitRate);if((a.sFormatName===_.default.f_p2p&&!o||a.sFormatName===_.default.f_flv&&o)&&(E.default.reSelectFormat(t,o),!(a=t.playFormat)))return}if(this._stop(),this.createVideo()){var u=r.tResolution||{},l=u.iWidth>0&&u.iHeight>0&&0===r.iBitRate?this.broadcastBitrate:r.iBitRate,d=r.iBitRate,c=this.getParams(t,s,0);""!==r.sAdditionalParam&&c.push(r.sAdditionalParam),""!==a.sAdditionalParam&&c.push(a.sAdditionalParam);var p=t.sAntiCode+"&"+c.join("&");p=this._dealSphd(p);var m={sdkver:0x9b0b2de5,video:this.playerVideo,playFormat:a.sFormatName,bLive:this.startPlayInfo.bLive,pid:this.startPlayInfo.pid,myid:this.startPlayInfo.myid,place:this.startPlayInfo.place,anonymousuid:this.startPlayInfo.anonymousuid,appid:y.default.appId,roomId:this.startPlayInfo.roomId,lineType:s.iLineIndex,liveType:this.startPlayInfo.bLive?1:3,startType:this.start_type,stream_from:this.stream_from,sGuid:y.default.deviceId,bitrate:l,curBitrate:l,iBitRate:d,sFlvUrl:s.sFlvUrl,sFlvSuffix:s.sFlvSuffix,sFlvAntiCode:p,sHlsUrl:s.sHlsUrl,sHlsSuffix:s.sHlsSuffix,sHlsAntiCode:p,sP2pUrl:s.sP2pUrl,sP2pSuffix:s.sP2pSuffix,enableLowLatency:this.startPlayInfo.enableLowLatency,startTimeStamp:this.startPlayInfo.startTimeStamp,uistartTs:this.uistartTs,isPureAudio:!!this.startPlayInfo.isPureAudio,isPureVideo:!!this.startPlayInfo.isPureVideo,cdnName:s.sCdnName,h5Root:this.startPlayInfo.h5Root,sStreamName:s.sStreamName,sAdditionalParam:c.join("&"),mediaType:_.default[this.startPlayInfo.busiType||a.sFormatName],iIsHEVCSupport:s.iIsHEVCSupport,iHEVCBitRate:r.iHEVCBitRate,iCodecType:r.iCodecType};switch(y.default.isSupported()||(a.sFormatName=_.default.f_hls,m.mediaType=_.default[a.sFormatName]),a.sFormatName){case _.default.f_p2p:m.sUrl=s.sP2pUrl,m.isP2PSupport=1;break;case _.default.f_flv:m.sUrl=s.sFlvUrl;break;case _.default.f_hls:m.sUrl=s.sHlsUrl;break;default:m.sUrl=""}this.currentRoomStream.mediaFormat=a.sFormatName,this.currentRoomStream.stream=t,this.currentRoomStream.roomId=this.startPlayInfo.roomId,this.setCurrentRoomStreamGearInfo(t,d,c),this.saveCurrentStream(m.sUrl,s.sStreamName,d,s.iLineIndex),m.originalBitrate=+!this.currentRoomStream.isSrc,I.default.once(this.onBlackScreen,this,1e4),this.player=new v.default(this,this.config),this.player.roomId=this.startPlayInfo.roomId||0,this.player.gameid=this.startPlayInfo.gameid,this.lastPlayRoomId!==this.startPlayInfo.roomId&&(this.lastPlayRoomId=this.startPlayInfo.roomId,this.tryCnt=3),this.player.startPlay(m,i),n=!1,this.mediaStreamUpdate(t.vMediaStreamInfo,t.vStreamGearInfo,this.currentRoomStream)}else f.default.warn("WebPlayer("+this.id+").playStreamInfo create video error")}return n}},{key:"_getLineInfo",value:function(t){for(var e=0;e<t.vMediaStreamInfo.length;e++){var i=t.vMediaStreamInfo[e];if(t.chooseLine==i.iLineIndex)return i}return null}},{key:"_getGearInfo",value:function(t,e){for(var i=-1===e?t.defaultBitRate:e,s=0;s<t.vStreamGearInfo.length;s++){var r=t.vStreamGearInfo[s];if(i==r.iBitRate)return r}return null}},{key:"_dealSphd",value:function(t){return this.sphd>0&&-1!=t.indexOf("sphd=1")&&(t=t.replace(/sphd=1|sphd=0|&sphd=1|&sphd=0/g,""),1==this.sphd&&(t+="&sphd=1")),t}},{key:"realPlayStream",value:function(t){var e=t.isTest,i=t.mediaFormat,s=t.url,r=t.params,a=t.stream,n=t.isSwitch,o=t.bitrate;if(e&&"flv"===i?0===o&&(s+="?needwm=0"):r.length>0&&(s+="?"+r.join("&")),s=this._dealSphd(s),f.default.log("WebPlayer.realPlayStream",this.bUserStoped,s),!this.bUserStoped){var u=new m.default;u.id=this.startPlayInfo.id,u.url=s,u.type=i,u.bLive=!0,u.pid=this.startPlayInfo.pid,u.myid=this.startPlayInfo.myid,u.needSeek=this.room.needSeek,u.videoquality=Number(this.currentRoomStream.sBusiGearIndex),u.enableLowLatency=this.startPlayInfo.enableLowLatency,u.vjsOptions=this.vjsOptions,u.line=a.chooseLine,u.clickroomts=this.clickroomts,u.curBitRate=o,u.isPureAudio=this.startPlayInfo.isPureAudio,u.stream_from=this.stream_from,n&&"hls"===i&&this.player&&this.player.hyPlayer&&this.player.hyPlayer.player&&this.player.hyPlayer.player.isSwitchSeamLessLine||n&&"flv"===i&&c.default.isOpen(this.room.roomId,c.default.CTRL_KEY.SWITCH_PLAY)?this.player.switchLevel(u):this.startPlayUrl(s)}f.default.log("WebPlayer.realPlayStream UPDATE_STREAM_INFO",this.bUserStoped),this.mediaStreamUpdate(a.vMediaStreamInfo,a.vStreamGearInfo,this.currentRoomStream)}},{key:"realStartPlay",value:function(t){var e=_.default[this.startPlayInfo.type]||_.default.flv;e===_.default.mp4?this.playMp4(t):this.playSdk(t,e)}},{key:"playSdk",value:function(t,e){y.default.isSupported()?(this.player=new v.default(this,this.config),this.player.roomId=this.startPlayInfo.roomId||0,this.player.gameid=this.startPlayInfo.gameid,this.player.startPlay({video:this.playerVideo,pid:this.startPlayInfo.pid,myid:this.startPlayInfo.myid,bLive:this.startPlayInfo.bLive,lineType:this.currentRoomStream.line,place:this.startPlayInfo.place,url:t,bitrate:this.currentRoomStream.iBitRate,isPureAudio:this.startPlayInfo.isPureAudio||
1!1,needSeek:this.room.needSeek,oexp:this.startPlayInfo.oexp,originalBitrate:+!this.currentRoomStream.isSrc,enableLowLatency:this.startPlayInfo.enableLowLatency,mediaType:e,startTimeStamp:this.startPlayInfo.startTimeStamp,uistartTs:this.uistartTs,startType:this.start_type,stream_from:this.stream_from,seekTime:this.startPlayInfo.seekTime||0})):f.default.warn("WebPlayer("+this.id+").playSdk not supported!",null!==window.HYPlayer)}},{key:"autoFeedback",value:function(t){var e=(t||"")+"\n\n"+this.getLog();1===C.default.web&&this.fbCtrl.feedback(S.default.BLACK_SCREEN,e),this.player&&this.player.hyPlayer&&(f.default.log("WebPlayer.autoFeedback reportNoPictureProps"),this.player.hyPlayer.reportNoPictureProps())}},{key:"getLog",value:function(){var t=f.default.getLog();return HYPlayer&&HYPlayer.getLog&&(t=t.concat(HYPlayer.getLog())),(0,s.default)(t)}},{key:"onStopVideo",value:function(){this.trigger(p.default.VIDEO_STOP,{})}},{key:"onNoDataReceived",value:function(){f.default.log("WebPlayer.onNoDataReceived"),this.onLinkUnAvailable()}},{key:"onLinkTimeout",value:function(){this.trigger(p.default.LINK_TIMEOUT,{})}},{key:"onVideoFrameLoaded",value:function(){this.trigger(p.default.VIDEO_FRAME_LOADED,{})}},{key:"onLoadDataTimeout",value:function(){this.trigger(p.default.LOAD_DATA_TIMEOUT,{})}},{key:"onLinkUnAvailable",value:function(){f.default.log("WebPlayer.onLinkUnAvailable"),this.isCanTry()?this.trigger(p.default.LINK_UNAVAILABLE,{}):(f.default.log("WebPlayer("+this.id+").onLinkUnAvailable isCanTry=false, stopVideo"),this.stop(),this.onStopVideo(),this.trigger(p.default.ROOM_NO_STREAM))}},{key:"onPlayDownLinkInfo",value:function(t){this.trigger(p.default.PLAY_DOWNLINK_INFO,t)}},{key:"onClose",value:function(){this.trigger(p.default.VIDEO_CLOSE)}},{key:"onPlayFrameBuffer",value:function(t){this.trigger(p.default.VIDEO_FRAME_JITTERBUFFER,{frameStorage:t.frameStorage,jitterBuffer:t.jitterBuffer,playdelay:t.playdelay})}},{key:"onMetaData",value:function(t){this.trigger(p.default.METADATA,t)}},{key:"onSwitchDone",value:function(){this.trigger(p.default.SWITCH_DONE)}},{key:"onUpdateIntersity",value:function(t){this.trigger(p.default.UPDATE_INTERSITY,t)}},{key:"onPlayStatus",value:function(){}},{key:"onP2PReport",value:function(t,e){e&&-1!==e.toString().indexOf("bad")&&this.fbCtrl.feedback(e,this.getLog())}}]),e}(d.default)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=E(i(29)),r=E(i(14)),a=E(i(1)),n=E(i(3)),o=E(i(23)),u=E(i(24)),l=E(i(62)),d=E(i(88)),c=E(i(36)),f=E(i(10)),p=E(i(174)),m=E(i(93)),_=E(i(175)),y=E(i(176)),v=E(i(61)),S=E(i(47)),g=E(i(68)),T=E(i(22)),P=E(i(94)),C=E(i(18));function E(t){return t&&t.__esModule?t:{default:t}}var I=0;e.default=function(t){function e(t){(0,a.default)(this,e);var i=(0,o.default)(this,(e.__proto__||(0,r.default)(e)).call(this));return i.id=I++,f.default.log("BasePlayer.constructor("+i.id+")",0x9b0b2de5,navigator&&navigator.userAgent),i.params=t,i.abTestConfig=null,i.fbCtrl=new P.default,i.stat=new d.default,i.room=new p.default(i),i.liveInfo=new m.default,i.Events=c.default,i.initIns(),i.config=null,i.nimoConfig=null,i.player=null,i.playerVideo=null,i.startPlayInfo=null,i.vjsOptions=null,i.streamList=null,i.broadcastBitrate=0,i.currentRoomStream={},i.stream_from=0,i.start_type=0,i.bUserStoped=!1,i.uistartTs=performance?performance.timing.fetchStart:0,i.clickroomts=0,i.startTimeStamp=0,i.tryCnt=3,i.qualityBitrate={0:0,6:6e3,2:2500,3:1e3,4:500,5:250},i.emitVideoPlayerEventBind=i.emitVideoPlayerEvent.bind(i),i.VideoEvents=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],i.streamGearInfo=[],i.hasAutoBitrate=!1,i.isAutoBitrate=!1,i.setFetchTime(),i.room._checkConfig(),1==Number(l.default._showH5Player)&&(window.openNimoPlayer=i),i.isMosaic=!1,i.volume=1,i.isMuted=!1,i.perMosaic=0,i.isPlayBack=!1,i}return(0,u.default)(e,t),(0,n.default)(e,[{key:"isCanTry",value:function(){return this.tryCnt--,this.tryCnt>=0}},{key:"initIns",value:function(){}}
1,{key:"reset",value:function(){this.player&&this.player.dispose(),this.player=null}},{key:"autoFeedback",value:function(t){}},{key:"clearVideoChildnote",value:function(){if(f.default.log("BasePlayer("+this.id+").clearVideoChildnote has playerVideo",null!==this.playerVideo),this.playerVideo&&(this.delH5EventListeners(this.playerVideo),this.playerVideo=null),this.startPlayInfo&&this.startPlayInfo.id){var t=document.getElementById(this.startPlayInfo.id);if(f.default.log("BasePlayer("+this.id+").clearVideoChildnote has playerContainer",null!==t,t&&t.childNodes.length),t)for(var e=t.childNodes,i=0;i<e.length;i++)t.removeChild(e[i])}}},{key:"createVideo",value:function(){this.clearVideoChildnote();var t=document.getElementById(this.startPlayInfo.id);return!!t&&(f.default.log("BasePlayer("+this.id+").createVideo createVideo",t.childNodes.length),this.startPlayInfo.clickroomts>0&&f.default.log("BasePlayer("+this.id+").createVideo createVideo ts",performance.now()-this.startPlayInfo.clickroomts),this.clickroomts=this.startPlayInfo.clickroomts>0?(new Date).getTime()-(performance.now()-this.startPlayInfo.clickroomts):this.uistartTs,this.uistartTs=this.clickroomts,this.playerVideo=document.createElement("video"),this.addH5EventListeners(this.playerVideo),_.default.setVideoAttributeOptions(this.playerVideo,this.vjsOptions||{}),this.checkAutoPlay(),!0)}},{key:"checkAutoPlay",value:function(){var t=this;if(this.playerVideo&&this.vjsOptions&&this.vjsOptions.autoplay){f.default.log("BasePlayer("+this.id+").checkAutoPlay");var e=this.playerVideo.play();void 0!==e&&e.then(function(e){f.default.log("BasePlayer("+t.id+").checkAutoPlay auto play")}).catch(function(e){f.default.log("BasePlayer("+t.id+").checkAutoPlay play err "+e),t.trigger(c.default.AUTO_PLAY_ERR)})}}},{key:"addH5EventListeners",value:function(t){for(var e=0;e<this.VideoEvents.length;e++)t.addEventListener(this.VideoEvents[e],this.emitVideoPlayerEventBind)}},{key:"delH5EventListeners",value:function(t){for(var e=0;e<this.VideoEvents.length;e++)t.removeEventListener(this.VideoEvents[e],this.emitVideoPlayerEventBind)}},{key:"emitVideoPlayerEvent",value:function(t){t&&t.type?("timeupdate"!=t.type&&"progress"!=t.type&&"durationchange"!=t.type&&f.default.log("BasePlayer("+this.id+").emitVideoPlayerEvent type="+t.type),this.trigger(t.type,t)):f.default.log("BasePlayer("+this.id+").emitVideoPlayerEvent error"),"loadedmetadata"==t.type&&this.isMuted&&this.player&&this.player.setMuted&&this.player.setMuted(this.isMuted),"loadstart"==t.type&&-1!=navigator.userAgent.toLocaleLowerCase().indexOf("mac")&&this.play()}},{key:"setFetchTime",value:function(){l.default&&performance&&(l.default.uifetch&&l.default.uifetch>=performance.timing.fetchStart?this.uistartTs=0:this.setLocalVideoStarted(!1),l.default.uifetch=performance.timing.fetchStart)}},{key:"setLocalVideoStarted",value:function(t){l.default&&(l.default.videoStarted=+!!t)}},{key:"setHYPlayerConfig",value:function(t){this.player&&this.player.setPlayerConfig(t)}},{key:"updateInfo",value:function(t){this.startPlayInfo.gameid=t.gameid||0,this.room.gameid=t.gameid||0,this.room.pid=t.pid||0,this.room.myid=t.myid||0}},{key:"setConfig",value:function(t){f.default.log("BasePlayer("+this.id+").setConfig config=",t),this.config=t,this.fbCtrl.setConfig(t.nimoConfig),this.config&&this.player&&this.setHYPlayerConfig(this.config),t.nimoConfig&&this._checkP2PConfig(t.nimoConfig)}},{key:"_checkP2PConfig",value:function(t){}},{key:"reportBusiStream",value:function(t,e){}},{key:"_hasP2p",value:function(){return!1}},{key:"reportNoStream",value:function(t){f.default.log("BasePlayer("+this.id+").reportNoStream from="+t);var e=[this.stat.createAct(g.default.STREAM_ERROR,{value:[t]})];S.default.onNimoDataMetric2(e,this.startPlayInfo.pid,0,"",0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,this.startPlayInfo.oexp,this.stream_from)}},{key:"reportSdkStream",value:function(t,e){f.default.log("WebPlayer("+this.id+").reportSdkStream",t,e);var i=1===t&&this._hasP2p(),s=[this.stat.createAct(g.default.ROOM_SDK_STREAM,{value:[t,+!!i],str:[e]})];f.default.log("WebPlayer("+this.id+").reportSdkStream.DATA_METRIC2",s),S.default.onNimoDataMetric2(s,this.startPlayInfo.pid,0,"",0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,"",this.stream_from)}},{key:"quitRoom",value:function(t){this.room.quit(t)}},{key:"fleshVideo",value:function(t){if(f.default.log("HyOpenPlayer.fleshVideo bUserStoped="+this.bUserStoped),this.bUserStoped=!1,t&&"playback"==t.type&&!t.bLive)return f.default.log("HyOpenPlayer.fleshVideo info.type="+t.type+", info.time="+t.time+", info.bLive="+t.bLive),t.time&&(this.startPlayInfo.seekTime=t.time),void this.startPlay(this.startPlayInfo,this.vjsOptions);this.room.roomId&&this.streamList&&this.streamList.length>0?this.playStreamInfo(this.streamList,this.currentRoomStream.hasOwnProperty("iBitRate")?this.currentRoomStream.iBitRate:-1):this.startPlayInfo&&this.startPlay(this.startPlayInfo,this.vjsOptions)}},{key:"switchLine",value:function(t){if(f.default.log("BasePlaer.switchLine",t),this.streamList&&this.streamList.length>0){var e=this.streamList[0];if(e.vMediaStreamInfo&&e.vMediaStreamInfo.length>0){for(var i=0;i<e.vMediaStreamInfo.length;i++)if(e.vMediaStreamInfo[i].iLineIndex===t)return e.chooseLine=t,this.currentRoomStream.isSwitchLine=!0,this.playStreamInfo(this.streamList,this.currentRoomStream?this.currentRoomStream.iBitRate:-1),this.currentRoomStream.isSwitchLine=!1,!0}}return!1}},{key:"switchBitRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];"auto"!=t?this.isAutoBitrate=!1:(t=this.currentRoomStream.sDisplayName,e=this.currentRoomStream.iBitRate,this.isAutoBitrate=!0,this.currentRoomStream.sBusiGearIndex="auto"),f.default.log("BasePlaer.switchBitrate",t,e,i),this.room.needSeek=!!i,this.bUserStoped=!1;var s=-1,r="";if(this.streamList&&this.streamList.length>0&&this.streamList[0].vStreamGearInfo&&this.streamList[0].vStreamGearInfo.length>0){for(var a=0;a<this.streamList[0].vStreamGearInfo.length;a++)if(t==this.streamList[0].vStreamGearInfo[a].sDisplayName){s=this.streamList[0].vStreamGearInfo[a].i
1BitRate,this.streamList[0].vStreamGearInfo[a].sDisplayName,r=this.streamList[0].vStreamGearInfo[a].sBusiGearIndex;break}if(-1==s&&-1!=e){f.default.log("HyOpenPlayer.switchBitRate no videoquality:"+t);for(var n=0;n<this.streamList[0].vStreamGearInfo.length;n++)if(e==this.streamList[0].vStreamGearInfo[n].iBitRate){s=this.streamList[0].vStreamGearInfo[n].iBitRate,this.streamList[0].vStreamGearInfo[n].sDisplayName,r=this.streamList[0].vStreamGearInfo[n].sBusiGearIndex;break}}}return -1==s?(f.default.log("HyOpenPlayer.switchBitRate switchBitRateError no stream videoquality="+t+" targetBitrate="+e),!1):(this.tryCnt=3,this.startPlayInfo&&(this.startPlayInfo.sBusiGearIndex=r),this.playStreamInfo(this.streamList,s,!0),!0)}},{key:"startPlay",value:function(t,e){this.isPlayBack=!1,t&&(S.default.anonymousuid=t.anonymousuid||0,S.default.myid=t.myid||0,C.default.anonymousuid=t.anonymousuid||0),f.default.log("BasePlayer("+this.id+").startPlay",(0,s.default)(t),e?(0,s.default)(e):""),this.startPlayInfo=t,this.vjsOptions=e,this.fbCtrl.setRoomid(t.pid,t.roomId),this.sphd=0,t.sphd&&(this.sphd=t.sphd),this.liveInfo.setParams(t.pid,t.gearIndexList||[]),this.bUserStoped=!1,t.bLive&&Number(t.roomId)>0?("auto"==t.sBusiGearIndex&&(this.isAutoBitrate=!0),this.resetPlay(),this.start_type=2,this.playRoomInfo(t)):(this.start_type=1,this.startPlayVideo(t));var i=0;t.bLive?i=1:"playback"==t.type?(i=2,this.isPlayBack=!0):i=3,this.stat.setComDim("live_type",i)}},{key:"onLoginMedia",value:function(){f.default.log("BasePlayer("+this.id+").onLoginMedia cookie="+C.default.sCookie);var t=[this.stat.createAct(g.default.LOGIN_MEDIA,{value:[],str:[C.default.sCookie]})];S.default.onNimoDataMetric2(t,this.startPlayInfo.pid,this.currentRoomStream.iBitRate||0,"",this.currentRoomStream.line||0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,this.startPlayInfo.oexp,this.stream_from)}},{key:"onBlackScreen",value:function(){var t=!this.player||!this.player.playing,e=null;this.player&&this.player.getRecvInfo&&(e=this.player.getRecvInfo());var i=[+!!t,+!!this.room.hasStream];e&&(i=i.concat(e));var s=[this.stat.createAct(g.default.BLACK_SCREEN,{value:i,str:[this.room.busiState,this.room.httpState,this.room.signalState]})];f.default.log("BasePlayer("+this.id+").onBlackScreen "+t,s),S.default.onNimoDataMetric2(s,this.startPlayInfo.pid,this.currentRoomStream.iBitRate||0,"",this.currentRoomStream.line||0,this.startPlayInfo.place,this.startPlayInfo.roomId,this.startPlayInfo.gameid,this.startPlayInfo.oexp,this.stream_from)}},{key:"resetPlay",value:function(){f.default.log("BasePlayer("+this.id+").resetPlay"),this.currentRoomStream={},this.reset()}},{key:"playRoomInfo",value:function(t){l.default._use_stream&&(t.useStream=1===Number(l.default._use_stream)),this.room.update(t);var e=t.yspwlStreamPkg,i=t.useStream||!1;if(e){var s=this.liveInfo.setLiveRoomBinData(e);s?(this.room.onGetStreamByBusi(s),this.room.join(-1,!1),this.reportBusiStream(!0,this._hasP2p())):(this.reportBusiStream(!1,this._hasP2p()),this.room.join(-1,!0))}else this.reportBusiStream(!1,this._hasP2p()),i?this.room.join(-1,!0):this.backToBusi&&this.backToBusi(1)}},{key:"onUpdateStreamInfoFail",value:function(){f.default.warn("BasePlayer("+this.id+").onUpdateStreamInfoFail "+c.default.ROOM_NO_STREAM),this.trigger(c.default.ROOM_NO_STREAM)}},{key:"onUpdateStreamInfo",value:function(t){if(!this.isPlayBack){var e=this.liveInfo.setLivingInfo(t.liveStreams,-1,Number(this.startPlayInfo.sBusiGearIndex)||-1,this.currentRoomStream);if(this.streamList=e,this.broadcastBitrate=t.broadcastBitrate,e.length>0){var i=e[0];this.streamGearInfo=i.vStreamGearInfo,this.needPlay(e)?(this.room.setStreamState(5,t.from),this.currentRoomStream.needPlay=!0,this.tryCnt=3,1===this.stream_from&&this.reportDifStream&&this.reportDifStream(1!==t.from),this.stream_from=t.from,this.playStreamInfo(e)):(this.room.setStreamState(4,t.from),f.default.log("BasePlayer.onUpdateStreamInfo"),this.mediaStreamUpdate(i.vMediaStreamInfo,i.vStreamGearInfo,this.currentRoomStream))}else f.default.warn("BasePlayer.onUpdateStreamInfo has no streams"),this.room.setStreamState(5,t.from),this.reportNoStream&&this.reportNoStream(t.from),this.trigger(c.default.ROOM_NO_STREAM)}}}
1,{key:"mediaStreamUpdate",value:function(t,e,i){this.hasAutoBitrate&&this.isAutoBitrate&&(this.currentRoomStream.sBusiGearIndex="auto");var s={streamInfo:t,streamGearInfo:e,currentRoomStream:i};f.default.log("BasePlayer.mediaStreamUpdate, data",s),this.trigger(c.default.MEDIA_STREAM_UPDATE,s)}},{key:"needPlay",value:function(t){return!this.player}},{key:"playStream",value:function(t){}},{key:"playStreamInfo",value:function(t){}},{key:"saveCurrentStream",value:function(t,e,i,r){this.currentRoomStream.backsrc=this.getBacksrc(t),this.currentRoomStream.sStreamName=e,this.currentRoomStream.iBitRate=i,this.currentRoomStream.isSrc=this.currentRoomStream.iWidth>0&&this.currentRoomStream.iHeight>0&&0===i,this.currentRoomStream.line=r,f.default.log("BasePlayer("+this.id+").saveCurrentStream",(0,s.default)(this.currentRoomStream),this.currentRoomStream)}},{key:"getParams",value:function(t,e,i){var s=[];return t.sAdditionalParam&&s.push(t.sAdditionalParam),e.sAdditionalParam&&s.push(e.sAdditionalParam),i>0&&s.push("ratio="+i),s}},{key:"setCurrentRoomStreamGearInfo",value:function(t,e,i){var s=this.getStreamGearInfo(t,e);s?(this.currentRoomStream.sDisplayName=s.sDisplayName,this.currentRoomStream.sBusiGearIndex=s.sBusiGearIndex,this.currentRoomStream.iWidth=s.tResolution.iWidth,this.currentRoomStream.iHeight=s.tResolution.iHeight):(this.currentRoomStream.sDisplayName="",this.currentRoomStream.sBusiGearIndex="")}},{key:"getStreamGearInfo",value:function(t,e){for(var i=0;i<t.vStreamGearInfo.length;i++)if(Number(e)===Number(t.vStreamGearInfo[i].iBitRate))return t.vStreamGearInfo[i];return null}},{key:"getBacksrc",value:function(t){var e=(t=t.replace("//","")).split("/");return t.endsWith("/")&&e.pop(),e.length>1?e.pop():""}},{key:"validUrl",value:function(t){return t+(t.endsWith("/")?"":"/")}},{key:"startPlayVideo",value:function(t){this.currentRoomStream.iBitRate=this.qualityBitrate[t.videoquality]||0,this.currentRoomStream.line=t.line,this.startPlayUrl(t.url)}},{key:"startPlayUrl",value:function(t){t&&(this.stat.setComDim("stream_url",t),T.default.once(this.onBlackScreen,this,1e4),t=window&&window.location&&-1!==window.location.protocol.indexOf("https")?t.replace("http://","https://"):t.replace("https://","http://"),this._stop(),this.createVideo()&&this.realStartPlay(t))}},{key:"realStartPlay",value:function(t){}},{key:"playMp4",value:function(t){this.stat.setComDim("stream_url",t),this.player=new y.default(this,this.playerVideo),this.player.roomId=this.startPlayInfo.roomId,this.player.gameid=this.startPlayInfo.gameid,this.player.startPlay({url:t,uistartTs:this.uistartTs,startTimeStamp:this.startPlayInfo.startTimeStamp,pid:this.startPlayInfo.pid,oexp:this.startPlayInfo.oexp,bitrate:this.currentRoomStream.iBitRate,lineType:this.currentRoomStream.line,stream_from:this.stream_from,place:this.startPlayInfo.place})}},{key:"onPlayVideo",value:function(t){f.default.log("BasePlayer.onPlayVideo",(0,s.default)(t)),this.tryCnt=3,this.startPlayInfo.startTimeStamp=0,this.setLocalVideoStarted(!0),this.trigger(c.default.VIDEO_PLAY,{video:t.video,loadTime:t&&t.loadTime?t.loadTime:0,connectTime:t&&t.connectTime?t.connectTime:0,recvDataTime:t&&t.recvDataTime?t.recvDataTime:0,canvas:t.canvas,videoCodec:t.videoCodec});var e=document.getElementById(this.startPlayInfo.id);e&&(e.innerHTML="","h265"==t.videoCodec&&t.canvas?e.appendChild(t.canvas):e.appendChild(this.playerVideo)),t&&t.loadTime&&t.loadTime>1e3&&this.fbCtrl.feedback(P.default.PLAY_VIDEO,this.getLog()),this.isMosaic&&this.perMosaic>0&&this.player&&this.player.setBackDropFilter&&this.player.setBackDropFilter(!0,this.perMosaic,this.startPlayInfo.id)}},{key:"onPlayerError",value:function(t){this.trigger(c.default.VIDEO_ERROR,{type:t})}},{key:"onPlayEnded",value:function(){f.default.log("BasePlayer.onPlayEnded"),this.trigger(c.default.VIDEO_ENDED),this.trigger(c.default.VIDEO_STOP)}},{key:"onPlayTime",value:function(t,e,i){this.trigger(c.default.PLAY_TIME,{currentTime:t,buffered:i,duration:e})}},{key:"onP2PReport",value:function(t,e){}},{key:"onSeiInfo",value:function(t,e){this.trigger(c.default.SEI_INFO,e)}},{key:"autoBitrateChanged",value:function(t,e){var i=e.curBitrate;i===this.broadcastBitrate?this.currentRoomStream.iBitRate=0:this.currentRoomStream.iBitRate=i,this.trigger(c.default.AUTO_BITRATE_CHANGED,e)}},{key:"onBrowserPause",value:function(){f.default.log("BasePlayer.onBrowserPause",this.startPlayInfo&&this.startPlayInfo.bLive),this.playerVideo&&this.startPlayInfo&&this.startPlayInfo.bLive&&this.delH5EventListeners(this.playerVideo),this.trigger(c.default.BROWSER_PAUSE,{})}},{key:"seek",value:function(t,e){f.default.log("BasePlayer.seek time="+t,"waitTime",e),this.player&&this.player.setCurrentTime(t,e)}}
1,{key:"updateLiveVodUrl",value:function(t){f.default.log("BasePlayer.updateLiveVodUrl url="+t),this.player&&this.player.updateLiveVodUrl(t)}},{key:"setVolume",value:function(t){f.default.log("BasePlayer.setVolume volume="+t),this.volume=t,this.player&&this.player.setVolume(t)}},{key:"getVolume",value:function(){return this.volume}},{key:"replayVideo",value:function(){this.startPlay(this.startPlayInfo,this.vjsOptions)}},{key:"play",value:function(){f.default.log("BasePlayer.play"),this.player&&this.player.play()}},{key:"pause",value:function(){f.default.log("BasePlayer.pause"),this.player&&this.player.pause()}},{key:"setMuted",value:function(t){f.default.log("BasePlayer.setMuted",t),this.isMuted=t,this.player&&this.player.setMuted&&this.player.setMuted(t)}},{key:"getMuted",value:function(){return this.isMuted}},{key:"setBackDropFilter",value:function(t,e,i){this.isMosaic=t,this.perMosaic=e,f.default.log("BasePlayer.setBackDropFilter",t,e,i),this.player&&this.player.setBackDropFilter&&this.player.setBackDropFilter(t,e,i)}},{key:"getCdnSip",value:function(){return this.player&&this.player.getCdnSip&&this.player.getCdnSip()}},{key:"getDurationTime",value:function(){return this.player&&this.player.getDurationTime()}},{key:"stop",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];f.default.log("BasePlayer("+this.id+").stop",t),this.bUserStoped=t,this.isAutoBitrate=!1,this._stop()}},{key:"_stop",value:function(){f.default.log("BasePlayer("+this.id+")._stop"),T.default.remove(this.onBlackScreen,this),this.playerVideo&&this.delH5EventListeners(this.playerVideo),this.player&&(this.player.stop(),this.player=null)}},{key:"resume",value:function(){this.bUserStoped=!1,this.playStreamInfo(this.streamList,this.currentRoomStream.iBitRate||-1)}},{key:"getEl",value:function(){return this.playerVideo}},{key:"getLog",value:function(){return""}},{key:"destroy",value:function(){f.default.log("HyOpenPlayer.destroy"),this.destroyed=!0,T.default.remove(this.onBlackScreen,this),this.player&&(this.player.dispose(),this.player=null),this.currentRoomStream={},this.room.quit(),this.room.destroy(),this.clear(),this.clearVideoChildnote()}},{key:"setAbTestConfig",value:function(t){f.default.log("HyOpenPlayer.setAbTestConfig abConfig",t),this.abTestConfig=t}},{key:"onNeedUpdateM3u8Bind",value:function(t,e){this.trigger(c.default.NEED_UPDATE_M3U8,e)}},{key:"onPlaybackM3u8Updated",value:function(t,e){this.trigger(c.default.PLAYBACK_M3U8_UPDATED,e)}},{key:"getCurrentDts",value:function(){return this.player&&this.player.getCurrentDts?this.player.getCurrentDts():0}}]),e}(v.default)},function(t,e,i){i(32),i(31),t.exports=i(154)},function(t,e,i){var s=i(9),r=i(89);t.exports=i(0).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return s(e.call(t))}},function(t,e,i){i(156),t.exports=i(0).Object.assign},function(t,e,i){var s=i(2);s(s.S+s.F,"Object",{assign:i(157)})},function(t,e,i){"use strict";var s=i(7),r=i(27),a=i(59),n=i(38),o=i(20),u=i(51),l=Object.assign;t.exports=!l||i(15)(function(){var t={},e={},i=Symbol(),s="abcdefghijklmnopqrst";return t[i]=7,s.split("").forEach(function(t){e[t]=t}),7!=l({},t)[i]||Object.keys(l({},e)).join("")!=s})?function(t,e){for(var i=o(t),l=arguments.length,d=1,c=a.f,f=n.f;l>d;)for(var p,m=u(arguments[d++]),_=c?r(m).concat(c(m)):r(m),y=_.length,v=0;y>v;)p=_[v++],s&&!f.call(m,p)||(i[p]=m[p]);return i}:l},function(t,e,i){i(43),i(31),i(32),i(159),i(167),i(170),i(172),t.exports=i(0).Map},function(t,e,i){"use strict";var s=i(160),r=i(92);t.exports=i(163)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var e=s.getEntry(r(this,"Map"),t);return e&&e.v},set:function(t,e){return s.def(r(this,"Map"),0===t?0:t,e)}},s,!0)},function(t,e,i){"use strict";var s=i(8).f,r=i(42),a=i(65),n=i(12),o=i(66),u=i(35),l=i(60),d=i(85),c=i(91),f=i(7),p=i(39).fastKey,m=i(92),_=f?"_s":"size",y=function(t,e){var i,s=p(e);if("F"!==s)return t._i[s];for(i=t._f;i;i=i.n)if(i.k==e)return i};t.exports={getConstructor:function(t,e,i,l){var d=t(function(t,s){o(t,d,e,"_i"),t._t=e,t._i=r(null),t._f=void 0,t._l=void 0,t[_]=0,null!=s&&u(s,i,t[l],t)});return a(d.prototype,{clear:function(){for(var t=m(this,e),i=t._i,s=t._f;s;s=s.n)s.r=!0,s.p&&(s.p=s.p.n=void 0),delete i[s.i];t._f=t._l=void 0,t[_]=0},delete:function(t){var i=m(this,e),s=y(i,t);if(s){var r=s.n,a=s.p;delete i._i[s.i],s.r=!0,a&&(a.n=r),r&&(r.p=a),i._f==s&&(i._f=r),i._l==s&&(i._l=a),i[_]--}return!!s}
1,forEach:function(t){m(this,e);for(var i,s=n(t,arguments.length>1?arguments[1]:void 0,3);i=i?i.n:this._f;)for(s(i.v,i.k,this);i&&i.r;)i=i.p},has:function(t){return!!y(m(this,e),t)}}),f&&s(d.prototype,"size",{get:function(){return m(this,e)[_]}}),d},def:function(t,e,i){var s,r,a=y(t,e);return a?a.v=i:(t._l=a={i:r=p(e,!0),k:e,v:i,p:s=t._l,n:void 0,r:!1},t._f||(t._f=a),s&&(s.n=a),t[_]++,"F"!==r&&(t._i[r]=a)),t},getEntry:y,setStrong:function(t,e,i){l(t,e,function(t,i){this._t=m(t,e),this._k=i,this._l=void 0},function(){for(var t=this._k,e=this._l;e&&e.r;)e=e.p;return this._t&&(this._l=e=e?e.n:this._t._f)?d(0,"keys"==t?e.k:"values"==t?e.v:[e.k,e.v]):(this._t=void 0,d(1))},i?"entries":"values",!i,!0),c(e)}}},function(t,e,i){var s=i(9);t.exports=function(t,e,i,r){try{return r?e(s(i)[0],i[1]):e(i)}catch(e){var a=t.return;throw void 0!==a&&s(a.call(t)),e}}},function(t,e,i){var s=i(21),r=i(5)("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(s.Array===t||a[r]===t)}},function(t,e,i){"use strict";var s=i(4),r=i(2),a=i(39),n=i(15),o=i(13),u=i(65),l=i(35),d=i(66),c=i(6),f=i(30),p=i(8).f,m=i(164)(0),_=i(7);t.exports=function(t,e,i,y,v,S){var g=s[t],T=g,P=v?"set":"add",C=T&&T.prototype,E={};return _&&"function"==typeof T&&(S||C.forEach&&!n(function(){(new T).entries().next()}))?(T=e(function(e,i){d(e,T,t,"_c"),e._c=new g,null!=i&&l(i,v,e[P],e)}),m("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(t){var e="add"==t||"set"==t;t in C&&(!S||"clear"!=t)&&o(T.prototype,t,function(i,s){if(d(this,T,t),!e&&S&&!c(i))return"get"==t&&void 0;var r=this._c[t](0===i?0:i,s);return e?this:r})}),S||p(T.prototype,"size",{get:function(){return this._c.size}})):(u((T=y.getConstructor(e,t,v,P)).prototype,i),a.NEED=!0),f(T,t),E[t]=T,r(r.G+r.W+r.F,E),S||y.setStrong(T,t,v),T}},function(t,e,i){var s=i(12),r=i(51),a=i(20),n=i(53),o=i(165);t.exports=function(t,e){var i=1==t,u=2==t,l=3==t,d=4==t,c=6==t,f=5==t||c,p=e||o;return function(e,o,m){for(var _,y,v=a(e),S=r(v),g=s(o,m,3),T=n(S.length),P=0,C=i?p(e,T):u?p(e,0):void 0;T>P;P++)if((f||P in S)&&(y=g(_=S[P],P,v),t)){if(i)C[P]=y;else if(y)switch(t){case 3:return!0;case 5:return _;case 6:return P;case 2:C.push(_)}else if(d)return!1}return c?-1:l||d?d:C}}},function(t,e,i){var s=i(166);t.exports=function(t,e){return new(s(t))(e)}},function(t,e,i){var s=i(6),r=i(79),a=i(5)("species");t.exports=function(t){var e;return r(t)&&("function"==typeof(e=t.constructor)&&(e===Array||r(e.prototype))&&(e=void 0),s(e)&&null===(e=e[a])&&(e=void 0)),void 0===e?Array:e}},function(t,e,i){var s=i(2);s(s.P+s.R,"Map",{toJSON:i(168)("Map")})},function(t,e,i){var s=i(46),r=i(169);t.exports=function(t){return function(){if(s(this)!=t)throw TypeError(t+"#toJSON isn't generic");return r(this)}}},function(t,e,i){var s=i(35);t.exports=function(t,e){var i=[];return s(t,!1,i.push,i,e),i}},function(t,e,i){i(171)("Map")},function(t,e,i){"use strict";var s=i(2);t.exports=function(t){s(s.S,t,{of:function(){for(var t=arguments.length,e=Array(t);t--;)e[t]=arguments[t];return new this(e)}})}},function(t,e,i){i(173)("Map")},function(t,e,i){"use strict";var s=i(2),r=i(25),a=i(12),n=i(35);t.exports=function(t){s(s.S,t,{from:function(t){var e,i,s,o,u=arguments[1];return r(this),(e=void 0!==u)&&r(u),null==t?new this:(i=[],e?(s=0,o=a(u,arguments[2],2),n(t,!1,function(t){i.push(o(t,s++))})):n(t,!1,i.push,i),new this(i))}})}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=f(i(14)),r=f(i(1)),a=f(i(3)),n=f(i(23)),o=f(i(87)),u=f(i(24)),l=i(11),d=f(i(18)),c=f(i(10));function f(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){function e(){return(0,r.default)(this,e),(0,n.default)(this,(e.__proto__||(0,s.default)(e)).apply(this,arguments))}return(0,u.default)(e,t),(0,a.default)(e,[{key:"_onLoginSuc",value:function(){this._player&&this._player.onLoginMedia&&this._player.onLoginMedia(),(0,o.default)(e.prototype.__proto__||(0,s.default)(e.prototype),"_onLoginSuc",this).call(this)}},{key:"quit",value:function(t){c.default.log("RoomA.quit "+t+" sCookie="+d.default.sCookie+" login="+d.default.isLogin),(0,o.default)(e.prototype.__proto__||(0,s.default)(e.prototype),"quit",this).call(this,t)}}]),e}(l.Room)}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(1),r=s&&s.__esModule?s:{default:s},a=function t(){(0,r.default)(this,t)};a.setVideoAttributeOptions=function(t,e){for(var i in void 0!==e.preload&&a.setAttribute(t,"preload",e.preload),e){var s=e[i];a.setAttribute(t,i,s)}for(var r=["loop","muted","playsinline","autoplay","controls"],n=0;n<r.length;n++){var o=r[n],u=e[o];void 0!==u&&(u||a.removeAttribute(t,o),t[o]=u)}},a.setAttribute=function(t,e,i){t.setAttribute(e,i)},a.removeAttribute=function(t,e){t.removeAttribute(e)},e.default=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(14)),r=u(i(1)),a=u(i(3)),n=u(i(23)),o=u(i(24));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){function e(){return(0,r.default)(this,e),(0,n.default)(this,(e.__proto__||(0,s.default)(e)).apply(this,arguments))}return(0,o.default)(e,t),(0,a.default)(e,[{key:"_initStat",value:function(){this._stat.setComDim("p2p",3),this._stat.setComDim("stream_type",6)}}]),e}(u(i(177)).default)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=T(i(29)),r=T(i(14)),a=T(i(1)),n=T(i(3)),o=T(i(23)),u=T(i(24)),l=T(i(33)),d=T(i(88)),c=T(i(22)),f=T(i(47)),p=T(i(10)),m=T(i(61)),_=T(i(68)),y=T(i(36)),v=T(i(178)),S=T(i(179)),g=T(i(180));function T(t){return t&&t.__esModule?t:{default:t}}e.default=function(t){function e(t,i){(0,a.default)(this,e);var s=(0,o.default)(this,(e.__proto__||(0,r.default)(e)).call(this));return s._handler=t,s._el=i,s.pauseByUser=!1,s.clickroomts=0,s.startPlayTs=0,s.businessStartCost=0,s.UIStartCost=0,s.pid=0,s.bitrate=0,s.videoSrc="",s.lineType=0,s.seekTime=0,s.roomId=0,s._tickCnt=0,s.videoInfo=null,s.waiting=!1,s.ended=!1,s.sysPause=!1,s._stat=new d.default,s._pauseStat=new S.default,s._tsSeg=new v.default,s._initStat(),s._videoEvts=["loadstart","pause","loadedmetadata","loadeddata","error","playing","ended"],s._videoEvtHandlerBind=s._videoEvtHandler.bind(s),s}return(0,u.default)(e,t),(0,n.default)(e,[{key:"_videoEvtHandler",value:function(t){switch(t.type){case"loadstart":this.onLoadStart();break;case"pause":this.onVideoPause();break;case"loadedmetadata":this.onLoadedmetadata();break;case"loadeddata":this.onVideoPlay();break;case"error":this.onVideoError(t);break;case"playing":this.onVideoRealPlay();break;case"ended":this.setEnded()}}},{key:"addEvents",value:function(){var t=this;this._el&&!this.hasEvents&&(this.hasEvents=!0,this._videoEvts.forEach(function(e){t._el.addEventListener(e,t._videoEvtHandlerBind)}))}},{key:"delEvents",value:function(){var t=this;this._el&&this.hasEvents&&(this.hasEvents=!1,this._videoEvts.forEach(function(e){t._el.removeEventListener(e,t._videoEvtHandlerBind)}))}},{key:"_initStat",value:function(){}},{key:"startPlay",value:function(t){p.default.log("TagPlayer.startPlay",(0,s.default)(t)),this.videoInfo=t;var e=t.url,i=t.uistartTs,r=t.startTimeStamp,a=t.pid,n=t.bitrate,o=t.bLive,u=t.lineType,d=t.place,f=t.playTimeout;this._tsSeg.reset(),this._stat.setComDim("live_type",o?1:2),this._stat.setComDim("stream_url",e);var m=l.default.now();this._tsSeg.srcTs=m,this.startPlayTs=m,this.uistartTs=i,this.pid=a,this.bitrate=n,this.videoSrc=e,this.lineType=u,this.place=d,this.UIStartCost=0,this.businessStartCost=r?m-r:0,this.uistartTs&&this.uistartTs>0&&(this.UIStartCost=m-this.uistartTs),this.waiting=!1,this.ended=!1,this.playing=!1,this.realPlaying=!1,this.sysPause=!1,this.addEvents(),this._el.src=e,this._tickCnt=0,c.default.add(this.onCheckTimer,this,1e3),c.default.remove(this.onPlayTimeout,this),this._el.autoplay&&(c.default.once(this.onPlayTimeout,this,f||2e4),this._play("startPlay"))}},{key:"onPlayTimeout",value:function(){this._el&&(p.default.log("TagPlayer.onPlayTimeout----------",navigator.userAgent,this._el.paused,this.pauseByUser),this._el.paused?(p.default.log("PlayerEvents.VIDEO_PAUSE"),!this.pauseByUser&&this._handler&&this._handler.trigger(y.default.VIDEO_PAUSE)):g.default.isXiaomi(navigator.userAgent)||0!==this._el.currentTime||(p.default.log("PlayerEvents.PLAY_TIMEOUT"),this._handler&&this._handler.trigger(y.default.PLAY_TIMEOUT)))}},{key:"setCurrentTime",value:function(t,e){0!==this._el.duration&&(t!==Math.ceil(this._el.duration)?(this.seekTime=t,this._el.currentTime=t,c.default.remove(this.onPlayTimeout,this),c.default.once(this.onSeekTimeout,this,e||2e4)):this.setEnded())}},{key:"onSeekTimeout",value:function(){this.seekTime>0&&this.seekTime===this._el.currentTime&&!this.pauseByUser&&(this.seekTime=0,this._handler&&this._handler.trigger(y.default.SEEK_TIMEOUT))}},{key:"getCurrentTime",value:function(){return this._el.currentTime}},{key:"getDurationTime",value:function(){return this._el.duration}},{key:"setVolume",value:function(t){this._el&&(this._el.volume=t)}},{key:"play",value:function(){this.pauseByUser=!1,this.addEvents(),this._play("play")}},{key:"_play",value:function(t){var e=this,i=this._el.play();i&&i.then(function(e){p.default.log("TagPlayer."+t+" suc")}).catch(function(i){p.default.log("TagPlayer."+t+i.toString()),e.trigger(y.default.AUTO_PLAY_ERR)})}},{key:"pause",value:function(){this.pauseByUser=!0,this.delEvents(),this._el.pause()}},{key:"stop",value:function(){this._el.pause(),this._el.src="",this.delEvents(),c.default.remove(this.onPlayTimeout,this),c.default.remove(this.onCheckTimer,this),c.default.remove(this.onCheckFastTimer,this)}},{key:"setPlayerConfig",value:function(t){}}
1,{key:"dispose",value:function(){this.stop()}},{key:"reset",value:function(){this.stop()}},{key:"onCheckTimer",value:function(t,e){this._tickCnt++,!this.playing||this.pauseByUser||this.sysPause||this._tickCnt%20!=0||this.reportVideoQuality()}},{key:"onCheckFastTimer",value:function(t,e){!this.playing||this.pauseByUser||this.sysPause||(this.checkPause(t),e%10==0&&this.updateTime())}},{key:"updateTime",value:function(){if(this._handler&&!this.ended){var t=0;if(this._el&&this._el.buffered&&this._el.currentTime>0){var e=this._el.buffered;if("function"!=typeof e.start||"function"!=typeof e.end)return void p.default.warn("video.buffered start&end not a function");for(var i=0;i<e.length;i++)if(e.start(i)<=this._el.currentTime&&e.end(i)>=this._el.currentTime){t=(t=e.end(i)-this._el.currentTime)<0?0:t,this._el.duration>0&&this._el.currentTime>=this._el.duration?this.setEnded():this._handler.onPlayTime(Math.floor(this._el.currentTime),Math.floor(this._el.duration),Math.floor(t));break}}}}},{key:"setEnded",value:function(){this.ended=!0,this._el.currentTime=this._el.duration,this._el.pause();var t=Math.ceil(this._el.duration);this._handler.onPlayTime(t,t,0),this._handler.onPlayEnded()}},{key:"checkPause",value:function(t){this.ended||this.sysPause||this.pauseByUser||this.setWaiting(this._pauseStat.paused)}},{key:"onLoadStart",value:function(){this._tsSeg.loadstartTs=l.default.now()}},{key:"onLoadedmetadata",value:function(){this._tsSeg.loadedmetadataTs=l.default.now()}},{key:"onVideoPause",value:function(){p.default.log("onVideoPause--------"),this.sysPause=!0}},{key:"onVideoPlay",value:function(){if(!this.playing){p.default.log("TagPlayer.onVideoPlay",this._el.paused);var t=l.default.now();this._pauseStat.start(this._el),this._tsSeg.loadeddataTs=t,this.playing=!0,this._handler.onPlayVideo({video:this._el});var e=t-this.startPlayTs,i=this.UIStartCost>0?e+this.UIStartCost:0,s=this.businessStartCost>0?e+this.businessStartCost:0;this.reportVideoLoadTs(e,i,s),c.default.add(this.onCheckFastTimer,this,100)}}},{key:"onVideoRealPlay",value:function(){this.sysPause=!1,this.realPlaying||(this.realPlaying=!0,this._handler.trigger(y.default.VIDEO_REAL_PLAY,{video:this._el}))}},{key:"onVideoError",value:function(t){this._handler&&(p.default.log("tag play error"),this._handler.onPlayerError())}},{key:"setWaiting",value:function(t){this.waiting!==t&&(this.waiting=t,this._handler.trigger(y.default.VIDEO_WAITING,t))}},{key:"reportVideoQuality",value:function(){this._pauseStat.checkBadQuality();var t=[];this._stat.setCoreDim("video_bad_quality",100*!!this._pauseStat.paused),this._stat.fill(t,!1),this._pauseStat.reset20(),this.sendMetrics(t)}},{key:"reportVideoLoadTs",value:function(t,e,i){var s=[],r=0;e&&(r+=1),i&&(r+=2),this._stat.setComDim("act_load_type",r);var a=[t,0,0,e,i];this._tsSeg.srcTs>0&&(a.push(this._tsSeg.loadstartTs-this._tsSeg.srcTs),a.push(this._tsSeg.loadedmetadataTs-this._tsSeg.loadstartTs),a.push(this._tsSeg.loadeddataTs-this._tsSeg.loadedmetadataTs)),s.push(this._stat.createAct(_.default.VIDEO_LOAD_TS,{value:a})),this.sendMetrics(s)}},{key:"sendMetrics",value:function(t){f.default.onNimoDataMetric2(t,this.pid,this.bitrate,this.videoSrc,this.lineType,this.place,this.roomId,this.gameid,this.videoInfo.oexp,this.videoInfo.stream_from)}}]),e}(m.default)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=a(i(1)),r=a(i(3));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.srcTs=0,this.loadstartTs=0,this.loadedmetadataTs=0,this.loadeddataTs=0}return(0,r.default)(t,[{key:"reset",value:function(){this.srcTs=0,this.loadstartTs=0,this.loadedmetadataTs=0,this.loadeddataTs=0}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=u(i(1)),r=u(i(3)),a=u(i(33)),n=u(i(22)),o=u(i(10));function u(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t),this.video=null,this._startWaitingTs=0,this._badQualityCnt=0,this._badQualityTime=0,this._badQuality=!1,this._paused=!1,this.onWaitingBind=this.onWaiting.bind(this),this.onPlayingBind=this.onPlaying.bind(this),this.onPauseBind=this.onPause.bind(this)}return(0,r.default)(t,[{key:"reset20",value:function(){this._badQuality&&(this._startWaitingTs=a.default.now()),this._badQuality=!1,this.resetBadQuality()}},{key:"reset",value:function(){this.delEventListener(this.video),this.resetBadQuality(),this.resetStat(),this._paused=!1,this.video=null}},{key:"resetBadQuality",value:function(){this._badQualityCnt=0,this._badQualityTime=0}},{key:"resetStat",value:function(){this._startWaitingTs=0,this._badQuality=!1}},{key:"start",value:function(t){this.reset(),this.addEventListener(t),this.video=t,n.default.add(this.onCheckStat,this,50)}},{key:"stop",value:function(){this.reset(),n.default.remove(this.onCheckStat,this)}},{key:"addEventListener",value:function(t){t&&(t.addEventListener("waiting",this.onWaitingBind),t.addEventListener("playing",this.onPlayingBind),t.addEventListener("pause",this.onPauseBind))}},{key:"delEventListener",value:function(t){t&&(t.removeEventListener("waiting",this.onWaitingBind),t.removeEventListener("playing",this.onPlayingBind),t.removeEventListener("onPause",this.onPauseBind))}},{key:"onCheckStat",value:function(t,e){!this._paused&&this._startWaitingTs>0&&t-this._startWaitingTs>200&&(this._badQuality||(this._badQuality=!0,this._badQualityCnt++))}},{key:"onWaiting",value:function(t){0===this._startWaitingTs&&(this._startWaitingTs=a.default.now())}},{key:"onPlaying",value:function(t){this.checkBadQuality(),this.resetStat(),this._paused=!1}},{key:"onPause",value:function(t){this.checkBadQuality(),this.resetStat(),this._paused=!0}},{key:"checkBadQuality",value:function(){if(this._badQuality&&this._startWaitingTs>0){var t=a.default.now()-this._startWaitingTs;o.default.log("PauseStat.onPlaying badQualityTime="+t),this._badQualityTime+=t}}},{key:"paused",get:function(){return this._badQualityCnt>0}}]),t}()}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={getBrand:function(t){return this.isIphone(t)?"iphone":this.isHuawei(t)?"huawei":this.isOppo(t)?"oppo":this.isVivo(t)?"vivo":this.isXiaomi(t)?"xiaomi":this.isSamsung(t)?"samsung":this.isUc(t)?"uc":"default"},isIphone:function(t){return t&&(t=t.toLowerCase()),t&&"iphone"==t.match(/iphone/i)},isHuawei:function(t){return t&&(t=t.toLowerCase()),t&&("huawei"==t.match(/huawei/i)||"honor"==t.match(/honor/i))},isOppo:function(t){return t&&(t=t.toLowerCase()),t&&("oppo"==t.match(/oppo/i)||"pacm00"==t.match(/pacm00/i))},isVivo:function(t){return t&&(t=t.toLowerCase()),t&&"vivo"==t.match(/vivo/i)},isXiaomi:function(t){return t&&(t=t.toLowerCase()),t&&("mi "==t.match(/mi\s/i)||"mix "==t.match(/mix\s/i)||"redmi"==t.match(/redmi/i))},isSamsung:function(t){return t&&(t=t.toLowerCase()),t&&"sm-"==t.match(/sm-/i)},isUc:function(t){return t&&(t=t.toLowerCase()),t&&"ucbrowser"==t.match(/ucbrowser/i)},isWeChat:function(t){return t&&(t=t.toLowerCase()),/micromessenger/.test(t)},getPlatform:function(t){var e="ipad"==t.match(/ipad/i),i="iphone os"==t.match(/iphone os/i),s="midp"==t.match(/midp/i),r="rv:1.2.3.4"==t.match(/rv:1.2.3.4/i),a="ucweb"==t.match(/ucweb/i),n="android"==t.match(/android/i),o="windows ce"==t.match(/windows ce/i),u="windows mobile"==t.match(/windows mobile/i);return i||s||r||a||n||o||u||e?e?"pad":"phone":"pc"}}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=n(i(1)),r=n(i(3)),a=n(i(45));function n(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,s.default)(this,t)}return(0,r.default)(t,[{key:"detectOS",value:function(){var t=navigator.userAgent,e="Win32"==navigator.platform||"Windows"==navigator.platform,i="Mac68K"==navigator.platform||"MacPPC"==navigator.platform||"Macintosh"==navigator.platform||"MacIntel"==navigator.platform;if(i)return"Mac";if("X11"==navigator.platform&&!e&&!i)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Win2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"WinXP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Win2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"WinVista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Win7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Win10"}return"other"}},{key:"feedBack",value:function(t,e,i){this.getFbId(t,e,a.default[1],i,this.postLog.bind(this))}},{key:"getFbId",value:function(t,e,i,s,r){var a=18e11+parseInt(1e11*Math.random());if(window.XMLHttpRequest){var n=new XMLHttpRequest,o=new FormData;o.append("fbType",i),o.append("fbDetails",s||i),o.append("uid",a),o.append("gid",this.getCookie("guid")),o.append("device",this.detectOS()),o.append("appVersion",0x9b0b2de5),o.append("deviceType",1),o.append("anchorId",t),o.append("ssid",0),o.append("appId",4e3),n.open("post","//ffilelogapp.nimo.tv/addFeedBack",!1),n.onload=function(t){var i=JSON.parse(t.target.responseText),s=i.fbId;1==i.result?(r(s,e),console.info("è·åfbidæå")):console.info("è·åfbid失败")},n.send(o)}}},{key:"getCookie",value:function(t){for(var e=t+"=",i=document.cookie.split(";"),s=0,r=i.length;s<r;s++){var a=i[s].trim();if(0==a.indexOf(e))return a.substr(e.length)}return""}},{key:"gblen",value:function(t){for(var e=0,i=t.length,s=0;s<i;s++){var r=t.charCodeAt(s);r>=1&&r<=126||65376<=r&&r<=65439?e++:e+=2}return e}},{key:"postLog",value:function(t,e){var i=this.gblen(e);if(window.XMLHttpRequest){var s=new XMLHttpRequest,r=new FormData;r.append("feedbackId",t),r.append("log",e),r.append("fileSize",i),s.open("post","//ffilelogupload.nimo.tv/uploadStringLog",!1),s.onreadystatechange=function(){console.log(s.readyState),4==s.readyState&&200==s.status&&console.log(s.responseText)},s.onload=function(t){},s.send(r)}}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=i(11).ConfigCtrl}
1,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(1),r=s&&s.__esModule?s:{default:s};e.default=function t(){(0,r.default)(this,t),this.id="",this.line=0,this.url="",this.type="",this.bLive=!1,this.pid=0,this.myid=0,this.videoquality=0,this.enableLowLatency=!1,this.vjsOptions=null,this.clickroomts=0,this.curBitRate=-1,this.stream_from=0}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=p(i(29)),r=p(i(1)),a=p(i(3)),n=p(i(47)),o=p(i(34)),u=p(i(18)),l=p(i(10)),d=p(i(95)),c=p(i(67)),f=(p(i(33)),p(i(62)));function p(t){return t&&t.__esModule?t:{default:t}}var m=0;e.default=function(){function t(e,i){(0,r.default)(this,t),this.id=m++,l.default.log("HysdkPlayer.constructor"),this.handler=e,this.playerConfig=i,this.playing=!1,this.onPlayVideoBind=this.onPlayVideo.bind(this),this.onStopVideoBind=this.onStopVideo.bind(this),this.onM3u8PlayEndedBind=this.onM3u8PlayEnded.bind(this),this.onSeekVideoBind=this.onSeekVideo.bind(this),this.onAnchorStopBind=this.onAnchorStop.bind(this),this.onPlayStatusBind=this.onPlayStatus.bind(this),this.onPlayTimeStatusBind=this.onPlayTimeStatus.bind(this),this.onPlayDataMeteric2Bind=this.onPlayDataMeteric2.bind(this),this.onPlayDownLinkInfoBind=this.onPlayDownLinkInfo.bind(this),this.onLinkUavailableBind=this.onLinkUavailable.bind(this),this.onLinkTimeoutBind=this.onLinkTimeout.bind(this),this.onLoadTimeoutBind=this.onLoadTimeout.bind(this),this.onPlayerErrorBind=this.onPlayerError.bind(this),this.onNoDataReceivedBind=this.onNoDataReceived.bind(this),this.onCloseBind=this.onClose.bind(this),this.onReplayVideoBind=this.onReplayVideo.bind(this),this.onRecvVideoFramesBind=this.onRecvVideoFrames.bind(this),this.onUpdateFrameBufferBind=this.onUpdateFrameBuffer.bind(this),this.onMetaDataBind=this.onMetaData.bind(this),this.onSwitchDoneBind=this.onSwitchDone.bind(this),this.onUpdateIntersityBind=this.onUpdateIntersity.bind(this),this.onVideoPauseBind=this.onVideoPause.bind(this),this.onVideoStartBind=this.onVideoStart.bind(this),this.onVideoStartLoadBind=this.onVideoStartLoad.bind(this),this.onSetSignalBind=this.onSetSignal.bind(this),this.onPause5SecBind=this.onPause5SecError.bind(this),this.onNeedUpdateM3u8Bind=this.onNeedUpdateM3u8.bind(this),this.onPlaybackM3u8UpdatedBind=this.onPlaybackM3u8Updated.bind(this),this.onP2PReportBind=this.onP2PReport.bind(this),this.onSeiInfoBind=this.onSeiInfo.bind(this),this.autoBitrateChangedBind=this.autoBitrateChanged.bind(this),this.onBrowserPauseBind=this.onBrowserPause.bind(this),this.roomId=0,this.gameid=0,this.videoInfo=null,this.pause5SecRetryTime=0,this.lastRoomId=0}return(0,a.default)(t,[{key:"setTafHandler",value:function(){var t=o.default.getSignalSdk();t?this.hyPlayer.setTafHandler&&this.hyPlayer.setTafHandler(t):o.default.on(o.default.SIGNAL_INIT,this.onSetSignalBind)}},{key:"getMeidaType",value:function(t){var e="";switch(t){case d.default.flv:e=HYPlayer.FLV;break;case d.default.hls:e=HYPlayer.HLS;break;case d.default.playback:e=HYPlayer.PLAYBACK;break;case d.default.p2p:e=HYPlayer.P2PFLV;break;default:e=HYPlayer.FLV}return e}},{key:"startPlay",value:function(t,e){this.videoInfo=t,this.sdkver=t.sdkver,this.lineType=t.lineType,this.videoSrc=t.url,this.bitrate=t.bitrate,this.originalBitrate=t.originalBitrate||0,this.iBitRate=t.iBitRate||0,this.curBitrate=t.curBitrate||0,this.enableLowLatency=t.enableLowLatency,this.mediaType=t.mediaType,this.pidpresenterUid=t.pid,this.myid=t.myid,this.anonymousuid=this.myid?0:t.anonymousuid||c.default.getAnonymousUid(),this.roomId=t.roomId,this.needSeek=t.needSeek,this.el_=t.video,this.startTimeStamp=t.startTimeStamp,this.isPureAudio=!!t.isPureAudio,this.isPureVideo=!!t.isPureVideo,this.uistartTs=t.uistartTs,this.bLive=t.bLive,this.startType=t.startType,this.place=t.place,this.noNeedSendVideoLoadTime=t.noNeedSendVideoLoadTime,this.seekTime=t.seekTime,this.cdnName=t.cdnName,this.h5Root=t.h5Root,this.sStreamName=t.sStreamName,this.sAdditionalParam=t.sAdditionalParam,this.lastRoomId!==this.roomId&&(this.lastRoomId=this.roomId,this.tryHist=[]),f.default._forceWasmWebgl=1,this.hyPlayer||(this.hyPlayer=new HYPlayer,this.hyPlayer.attachMediaElement(this.el_),this.hyPlayer.on(HYPlayer.Events.VIDEO_PLAY,this.onPlayVideoBind),this.hyPlayer.on(HYPlayer.Events.VIDEO_STOP,this.onStopVideoBind),this.hyPlayer.on(HYPlayer.Events.VIDEO_SEEK,this.onSeekVideoBind),this.hyPlayer.on(HYPlayer.Events.ANCHOR_STOP,this.onAnchorStopBind),this.hyPlayer.on(HYPlayer.Events.PLAY_STATUS,this.onPlayStatusBind),this.hyPlayer.on(HYPlayer.Events.PLAY_TIME_STATUS,this.onPlayTimeStatusBind),this.hyPlayer.on(HYPlayer.Events.DATA_METRIC2,this.onPlayDataMeter
1ic2Bind),this.hyPlayer.on(HYPlayer.Events.PLAY_DOWNLINK_INFO,this.onPlayDownLinkInfoBind),this.hyPlayer.on(HYPlayer.Events.FLV_URL_UNAVAILABLE,this.onLinkUavailableBind),this.hyPlayer.on(HYPlayer.Events.FLV_URL_LOAD_TIMEOUT,this.onLinkTimeoutBind),this.hyPlayer.on(HYPlayer.Events.HLS_URL_UNAVAILABLE,this.onLinkUavailableBind),this.hyPlayer.on(HYPlayer.Events.HLS_URL_LOAD_TIMEOUT,this.onLinkTimeoutBind),this.hyPlayer.on(HYPlayer.Events.HLS_MAINFEST_LOAD_TIMEOUT,this.onLoadTimeoutBind),this.hyPlayer.on(HYPlayer.Events.H5_PLAYER_ERROR,this.onPlayerErrorBind),this.hyPlayer.on(HYPlayer.Events.NO_DATA_RECEIVED,this.onNoDataReceivedBind),this.hyPlayer.on(HYPlayer.Events.VIDEO_LINK_CLOSE,this.onCloseBind),this.hyPlayer.on(HYPlayer.Events.REPLAY_VIDEO,this.onReplayVideoBind),this.hyPlayer.on(HYPlayer.Events.RECV_VIDEO_FRAME,this.onRecvVideoFramesBind),this.hyPlayer.on(HYPlayer.Events.PLAY_FRAME_BUFFER,this.onUpdateFrameBufferBind),this.hyPlayer.on(HYPlayer.Events.METADATA,this.onMetaDataBind),this.hyPlayer.on(HYPlayer.Events.SWITCH_DONE,this.onSwitchDoneBind),this.hyPlayer.on(HYPlayer.Events.UPDATE_INTERSITY,this.onUpdateIntersityBind),this.hyPlayer.on(HYPlayer.Events.PAUSE_5SEC_ERROR,this.onPause5SecBind),this.hyPlayer.on(HYPlayer.Events.NEED_UPDATE_M3U8,this.onNeedUpdateM3u8Bind),this.hyPlayer.on(HYPlayer.Events.PLAYBACK_M3U8_UPDATED,this.onPlaybackM3u8UpdatedBind),this.hyPlayer.on("M3U8_PLAY_ENDED",this.onM3u8PlayEndedBind),this.hyPlayer.on(HYPlayer.Events.VIDEO_ENDED,this.onM3u8PlayEndedBind),this.hyPlayer.on(HYPlayer.Events.P2P_REPORT,this.onP2PReportBind),this.hyPlayer.on(HYPlayer.Events.SEI_INFO,this.onSeiInfoBind),this.hyPlayer.on(HYPlayer.Events.AUTO_BITRATE_CHANGED,this.autoBitrateChangedBind),this.hyPlayer.on(HYPlayer.Events.BROWSER_PAUSE,this.onBrowserPauseBind),this.el_.addEventListener("waiting",this.onVideoPauseBind),this.el_.addEventListener("playing",this.onVideoStartBind),this.el_.addEventListener("loadstart",this.onVideoStartLoadBind),this.hyPlayer.setConfig("rtPeerSrc",0),this.hyPlayer.setConfig("crossClientPer","all|all:0"),this.hyPlayer.setConfig("rtPeerMax",0),this.hyPlayer.setConfig("rtPeerUgMin",1e3),this.playerConfig&&this.hyPlayer.setNimoConfig(this.playerConfig)),this.handler.abTestConfig&&(l.default.log("HysdkPlayer.startPlay setAbTestConfig"),this.hyPlayer.setAbTestConfig(this.handler.abTestConfig)),t.isP2PSupport&&this.hyPlayer.initWorker&&this.hyPlayer.initWorker(),this.sdkPlay(this.videoSrc,this.mediaType,{isSwitchBitrate:e})}},{key:"sdkPlay",value:function(t,e){var i=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.playing=!1;var a=this.getMeidaType(e),n=this.h5Root;n||(n=location.origin+location.pathname);var o=[];this.handler.streamGearInfo.forEach(function(t){var e=t.tResolution||{},s=e.iWidth>0&&e.iHeight>0&&0===t.iBitRate;"auto"!==t.sDisplayName&&o.push({bitrate:s?i.handler.broadcastBitrate:t.iBitRate,iBitRate:t.iBitRate,iCodecType:t.iCodecType,iHEVCBitRate:t.iHEVCBitRate,iIsHEVCSupport:t.iIsHEVCSupport})});var d=this.handler.hasAutoBitrate&&this.handler.isAutoBitrate,f={sdkver:this.sdkver,type:a,isLive:this.bLive,appid:u.default.appId,uid:Number(this.myid||this.anonymousuid),presenterUid:this.pidpresenterUid,roomId:this.roomId,lineType:this.lineType,liveType:this.bLive?1:3,startType:this.startType,url:t,sGuid:u.default.deviceId,iBitRate:this.iBitRate,curBitrate:this.curBitrate,originalBitrate:this.originalBitrate,enableLowLatency:this.enableLowLatency,startTimeStamp:this.startTimeStamp,uistartTs:this.uistartTs,isPureAudio:this.isPureAudio,isPureVideo:this.isPureVideo,cdnName:this.cdnName,h5Root:n,p2pLibName:"pcore-v30.js",sStreamName:this.sStreamName,sAdditionalParam:this.sAdditionalParam,isAuto:d,bitrateList:o,hasAutoBitrate:this.handler.hasAutoBitrate,nimoTid:u.default.getMediaUserId()};if(r.isSwitchBitrate&&(f.pullStreamFrom=1),this.bLive){f.iIsP2PSupport=this.videoInfo.isP2PSupport||0,f.sFlvAntiCode=this.videoInfo.sFlvAntiCode||"",f.sFlvUrl=c.default.removeUrlEndSlash(this.videoInfo.sFlvUrl||""),f.sFlvUrlSuffix=this.videoInfo.sFlvSuffix||"",f.sHlsAntiCode=this.videoInfo.sHlsAntiCode||"",f.sHlsUrl=c.default.removeUrlEndSlash(this.videoInfo.sHlsUrl||""),f.sHlsUrlSuffix=this.videoInfo.sHlsSuffix||"",f.sP2pAntiCode=this.videoInfo.sP2pAntiCode||"",f.sP2pUrl=c.default.removeUrlEndSlash(this.videoInfo.sP2pUrl||""),f.sP2pUrlSuffix=this.videoInfo.sP2pSuffix||"",f.iIsHEVCSupport=this.videoInfo.iIsHEVCSupport,f.iHEVCBitRate=this.videoInfo.iHEVCBitRate,f.iCodecType=this.videoInfo.iCodecType;var p=this.handler._hasP2p();this.hyPlayer.setConfig(100,p),this.hyPlayer.setConfig(101,p&&!!f.iIsP2PSupport)}this.bLive||(f.seekTime=this.seekTime),l.default.log("HysdkPlayer("+this.id+").sdkPlay type="+f.type+", info=",(0,s.default)(f)),this.setTafHandler(),this.videoSrc=t,this.videoInfo&&this.videoInfo.oexp&&this.hyPlayer.setOexp&&this.hyPlayer.setOexp(this.videoInfo.oexp),this.hyPlayer.start(f)}},{key:"onSetSignal",value:function(){this.hyPlayer&&this.hyPlayer.setTafHandler(o.default.getSignalSdk())}},{key:"onP2PReport",value:function(t,e){this.handler&&this.handler.onP2PReport(t,e)}},{key:"onSeiInfo",value:function(t,e){this.handler&&this.handler.onSeiInfo(t,e)}},{key:"autoBitrateChanged",value:function(t,e){this.handler&&this.handler.autoBitrateChanged(t,e),e&&e.curBitrate&&(this.bitrate=e.curBitrate)}},{key:"onPlayVideo",value:function(t,e){this.playing=!0,this.tryHist=[],this.handler&&this.handler.onPlayVideo(e)}},{key:"onStopVideo",value:function(t,e){this.handler&&this.handler.onStopVideo(e)}},{key:"onM3u8PlayEnded",value:function(t){this.handler&&this.handler.onPlayEnded&&this.handler.onPlayEnded(t)}},{key:"onSeekVideo",value:function(){}},{key:"onAnchorStop",value:function(){}},{key:"onPlayerError",value:function(t,e){this.handler&&this.handler.onPlayerError(e?e.code:"unknow")}},{key:"onPause5SecError",value:function(t,e){this.retryStart()}},{key:"onNoDataReceived",value:function(t){this.handler&&this.handler.onNoDataReceived&&this.handler.onNoDataReceived()}},{key:"onNeedUpdateM3u8",value:function(t,e){this.handler&&this.handler.onNeedUpdateM3u8Bind&&this.handler.onNeedUpdateM3u8Bind(t,e)}},{key:"onPlaybackM3u8Updated",value:function(t,e){this.handler&&this.handler.onPlaybackM3u8Updated&&this.handler.onPlaybackM3u8Updated(t,e)}},{key:"onPlayStatus",value:function(){}},{key:"onPlayDownLinkInfo",value:function(t,e){this.handler&&this.handler.onPlayDownLinkInfo(e)}},{key:"retryStart",value:function(){var t=Date.now();t-this.pause5SecRetryTime<2e3||(l.default.log("HysdkPlayer.retryStart videoSrc = "+this.videoSrc+" , type="+this.mediaType),this.sdkPlay(this.videoSrc,this.mediaType),this.pause5SecRetryTime=t)}},{key:"getRecvInfo",value:function(){return this.hyPlayer&&this.hyPlayer.getRecvInfo?this.hyPlayer.getRecvInfo():null}},{key:"getCurrentDts",value:function(){return this.hyPlayer&&this.hyPlayer.getCurrentDts?this.hyPlayer.getCurrentDts():0}}
1,{key:"onPlayDataMeteric2",value:function(t,e){n.default.onNimoDataMetric2(e,this.pidpresenterUid,this.bitrate,this.videoSrc,this.lineType,this.place,this.roomId,this.gameid,"",this.videoInfo.stream_from)}},{key:"onPlayTimeStatus",value:function(t,e){this.handler&&this.handler.onPlayTime(Math.floor(e.current),Math.floor(e.total),0)}},{key:"onLinkUavailable",value:function(){this.handler&&this.handler.onLinkUnAvailable()}},{key:"onLoadTimeout",value:function(){this.handler&&this.handler.onLoadDataTimeout()}},{key:"onLinkTimeout",value:function(){this.handler&&this.handler.onLinkTimeout()}},{key:"onClose",value:function(){this.handler&&this.handler.onClose()}},{key:"onReplayVideo",value:function(){this.handler&&this.handler.replayVideo()}},{key:"onUpdateFrameBuffer",value:function(t,e){this.handler&&this.handler.onPlayFrameBuffer(e)}},{key:"onMetaData",value:function(t,e){this.handler&&this.handler.onMetaData&&this.handler.onMetaData(e)}},{key:"onSwitchDone",value:function(t,e){this.handler&&this.handler.onSwitchDone&&this.handler.onSwitchDone()}},{key:"onUpdateIntersity",value:function(t,e){this.handler&&this.handler.onUpdateIntersity&&this.handler.onUpdateIntersity(e)}},{key:"onRecvVideoFrames",value:function(){this.handler&&this.handler.onVideoFrameLoaded()}},{key:"onVideoPause",value:function(t){}},{key:"onVideoStart",value:function(t){}},{key:"onVideoStartLoad",value:function(){}},{key:"onBrowserPause",value:function(){this.bLive?this.hyPlayer.stop():this.hyPlayer.pause(),this.handler&&this.handler.onBrowserPause&&this.handler.onBrowserPause()}},{key:"removeHyPlayerEventListeners",value:function(){this.hyPlayer&&(this.hyPlayer.off(HYPlayer.Events.VIDEO_PLAY,this.onPlayVideoBind),this.hyPlayer.off(HYPlayer.Events.VIDEO_STOP,this.onStopVideoBind),this.hyPlayer.off(HYPlayer.Events.VIDEO_SEEK,this.onSeekVideoBind),this.hyPlayer.off(HYPlayer.Events.ANCHOR_STOP,this.onAnchorStopBind),this.hyPlayer.off(HYPlayer.Events.PLAY_STATUS,this.onPlayStatusBind),this.hyPlayer.off(HYPlayer.Events.PLAY_TIME_STATUS,this.onPlayTimeStatusBind),this.hyPlayer.off(HYPlayer.Events.DATA_METRIC2,this.onPlayDataMeteric2Bind),this.hyPlayer.off(HYPlayer.Events.PLAY_DOWNLINK_INFO,this.onPlayDownLinkInfoBind),this.hyPlayer.off(HYPlayer.Events.FLV_URL_UNAVAILABLE,this.onLinkUavailableBind),this.hyPlayer.off(HYPlayer.Events.FLV_URL_LOAD_TIMEOUT,this.onLinkTimeoutBind),this.hyPlayer.off(HYPlayer.Events.HLS_URL_UNAVAILABLE,this.onLinkUavailableBind),this.hyPlayer.off(HYPlayer.Events.HLS_URL_LOAD_TIMEOUT,this.onLinkTimeoutBind),this.hyPlayer.off(HYPlayer.Events.HLS_MAINFEST_LOAD_TIMEOUT,this.onLoadTimeoutBind),this.hyPlayer.off(HYPlayer.Events.H5_PLAYER_ERROR,this.onPlayerErrorBind),this.hyPlayer.off(HYPlayer.Events.NO_DATA_RECEIVED,this.onNoDataReceivedBind),this.hyPlayer.off(HYPlayer.Events.VIDEO_LINK_CLOSE,this.onCloseBind),this.hyPlayer.off(HYPlayer.Events.REPLAY_VIDEO,this.onReplayVideoBind),this.hyPlayer.off(HYPlayer.Events.RECV_VIDEO_FRAME,this.onRecvVideoFramesBind),this.hyPlayer.off(HYPlayer.Events.PLAY_FRAME_BUFFER,this.onUpdateFrameBufferBind),this.hyPlayer.off(HYPlayer.Events.METADATA,this.onMetaDataBind),this.hyPlayer.off(HYPlayer.Events.SWITCH_DONE,this.onSwitchDoneBind),this.hyPlayer.off(HYPlayer.Events.UPDATE_INTERSITY,this.onUpdateIntersityBind),this.hyPlayer.off(HYPlayer.Events.PAUSE_5SEC_ERROR,this.onPause5SecBind),this.hyPlayer.off(HYPlayer.Events.NEED_UPDATE_M3U8,this.onNeedUpdateM3u8Bind),this.hyPlayer.off(HYPlayer.Events.PLAYBACK_M3U8_UPDATED,this.onPlaybackM3u8UpdatedBind),this.hyPlayer.off(HYPlayer.Events.M3U8_PLAY_ENDED,this.onM3u8PlayEndedBind),this.hyPlayer.off(HYPlayer.Events.VIDEO_ENDED,this.onM3u8PlayEndedBind),this.hyPlayer.off(HYPlayer.Events.SEI_INFO,this.onSeiInfoBind),this.hyPlayer.off(HYPlayer.Events.BROWSER_PAUSE,this.onBrowserPauseBind),this.hyPlayer.stop(),this.hyPlayer=null)}},{key:"removeElEventListeners",value:function(){this.el_&&(this.el_.removeEventListener("waiting",this.onVideoPauseBind),this.el_.removeEventListener("playing",this.onVideoStartBind),this.el_.removeEventListener("loadstart",this.onVideoStartLoadBind))}},{key:"reset",value:function(){this.handler=null,this.removeHyPlayerEventListeners(),this.removeElEventListeners()}},{key:"play",value:function(){this.hyPlayer&&this.hyPlayer.play()}},{key:"pause",value:function(){this.hyPlayer&&this.hyPlayer.pause()}},{key:"setMuted",value:function(t){this.hyPlayer&&this.hyPlayer.setMuted&&this.hyPlayer.setMuted(t)}}
1,{key:"setBackDropFilter",value:function(t,e,i){this.hyPlayer&&this.hyPlayer.setBackDropFilter&&this.hyPlayer.setBackDropFilter(t,e,i)}},{key:"stop",value:function(){this.reset()}},{key:"setCurrentTime",value:function(t){this.hyPlayer&&this.hyPlayer.seek(t)}},{key:"updateLiveVodUrl",value:function(t){this.hyPlayer&&this.hyPlayer.updateLiveVodUrl(t)}},{key:"getPlayStats",value:function(){return this.hyPlayer&&this.hyPlayer.getPlayStats?this.hyPlayer.getPlayStats():null}},{key:"getCurrentTime",value:function(){return this.hyPlayer?this.hyPlayer.getCurrentTime():this.el_?this.el_.currentTime:0}},{key:"getDurationTime",value:function(){return this.hyPlayer?this.hyPlayer.getDurationTime():this.el_?this.el_.duration:0}},{key:"setVolume",value:function(t){this.hyPlayer&&this.hyPlayer.setVolume(t)}},{key:"getLog",value:function(){return this.hyPlayer?this.hyPlayer.getLog():""}},{key:"setPlayerConfig",value:function(t){this.playerConfig=t,this.hyPlayer&&this.hyPlayer.setNimoConfig(this.playerConfig,!0)}},{key:"sendDanmuMetric",value:function(t,e,i){}},{key:"dispose",value:function(){this.stop()}},{key:"switchLevel",value:function(t){this.hyPlayer&&this.hyPlayer.switchLevel(t)}},{key:"getCdnSip",value:function(){if(this.hyPlayer&&this.hyPlayer.getCdnSip)return this.hyPlayer.getCdnSip()}},{key:"isPlaying",get:function(){return this.hyPlayer&&this.hyPlayer.player&&this.hyPlayer.player.isPlaying}}]),t}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=_(i(186)),r=_(i(195)),a=_(i(199)),n=_(i(1)),o=_(i(3)),u=_(i(202)),l=_(i(33)),d=_(i(86)),c=_(i(18)),f=_(i(34)),p=_(i(22)),m=_(i(203));function _(t){return t&&t.__esModule?t:{default:t}}e.default=function(){function t(){(0,n.default)(this,t),this.uid=Number((Date.now()%1e10*1e3+(1e3*Math.random()|0))%0xffffffff),this._wsTime="",this._fm="",this._params=[],this._sAnticode="",this._sStreamName="",this._invalidTime=a.default,this._nextRefreshTime=a.default,this._req=new d.default.GetAntiCodeForStreamReq}return(0,o.default)(t,[{key:"stop",value:function(){p.default.remove(this.onCheckTimer,this)}},{key:"init",value:function(t,e){this._sStreamName!==t&&(this._sStreamName=t,this._req&&(this._req.sStreamName=t),this.parseAnticode(e)),p.default.add(this.onCheckTimer,this,1e3)}},{key:"parseAnticode",value:function(t){var e=this;this._fm="",this._wsTime="",this._params=[],this._sAnticode=t,t.split("&").forEach(function(t){var i=t.split("="),s=(0,r.default)(i,2),a=s[0],n=s[1];if("fm"===a)e._fm=n=atob(n=unescape(n=decodeURI(n)));else if("wsTime"===a){e._wsTime=n;var o=1e3*parseInt(n,16)+3e5;e._invalidTime=l.default.now()+(o-Date.now()),e._nextRefreshTime=e._invalidTime-3e4}else"wsSecret"!==a&&e._params.push(t)})}},{key:"isInvalid",value:function(t){return t>this._invalidTime}},{key:"getAnticode",value:function(){if(""===this._fm)return this._sAnticode;var t=this.uid+Date.now(),e=this._fm.replace("$0",this.uid).replace("$1",this._sStreamName).replace("$2",t+"").replace("$3",this._wsTime),i="wsSecret="+(0,u.default)(e)+"&wsTime="+this._wsTime+"&seqid="+t;return this._params.length>0&&(i+="&"+this._params.join("&")),i+="&u="+this.uid+"&t=110&sv=2601201125"}},{key:"onCheckTimer",value:function(t,e){t>=this._nextRefreshTime&&this.getToken()}},{key:"valid",value:function(){var t=this;return new s.default(function(e){t.isInvalid(l.default.now())?t.getToken().then(e):e()})}},{key:"getToken",value:function(){var t=this;return new s.default(function(e){t._nextRefreshTime=a.default,t._req.tId=c.default.getMediaUserId(),f.default.sendWup(m.default.MEDIAUISEA,"getAntiCodeForStream",t._req,function(i){i.sStreamName===t._sStreamName&&t.parseAnticode(i.sAntiCode),e()})})}}]),t}()},function(t,e,i){t.exports={default:i(187),__esModule:!0}},function(t,e,i){i(43),i(31),i(32),i(188),i(193),i(194),t.exports=i(0).Promise},function(t,e,i){"use strict";var s,r,a,n,o=i(28),u=i(4),l=i(12),d=i(46),c=i(2),f=i(6),p=i(25),m=i(66),_=i(35),y=i(96),v=i(97).set,S=i(190)(),g=i(69),T=i(98),P=i(191),C=i(99),E=u.TypeError,I=u.process,k=I&&I.versions,A=k&&k.v8||"",R=u.Promise,D="process"==d(I),O=function(){},b=r=g.f,w=!!function(){try{var t=R.resolve(1),e=(t.constructor={})[i(5)("species")]=function(t){t(O,O)};return(D||"function"==typeof PromiseRejectionEvent)&&t.then(O)instanceof e&&0!==A.indexOf("6.6")&&-1===P.indexOf("Chrome/66")}catch(t){}}(),L=function(t){var e;return!(!f(t)||"function"!=typeof(e=t.then))&&e},F=function(t,e){if(!t._n){t._n=!0;var i=t._c;S(function(){for(var s=t._v,r=1==t._s,a=0;i.length>a;)!function(e){var i,a,n,o=r?e.ok:e.fail,u=e.resolve,l=e.reject,d=e.domain;try{o?(r||(2==t._h&&B(t),t._h=1),!0===o?i=s:(d&&d.enter(),i=o(s),d&&(d.exit(
vendor: 4,187 bytes, line 1
1),n=!0)),i===e.promise?l(E("Promise-chain cycle")):(a=L(i))?a.call(i,u,l):u(i)):l(s)}catch(t){d&&!n&&d.exit(),l(t)}}(i[a++]);t._c=[],t._n=!1,e&&!t._h&&M(t)})}},M=function(t){v.call(u,function(){var e,i,s,r=t._v,a=N(t);if(a&&(e=T(function(){D?I.emit("unhandledRejection",r,t):(i=u.onunhandledrejection)?i({promise:t,reason:r}):(s=u.console)&&s.error&&s.error("Unhandled promise rejection",r)}),t._h=D||N(t)?2:1),t._a=void 0,a&&e.e)throw e.v})},N=function(t){return 1!==t._h&&0===(t._a||t._c).length},B=function(t){v.call(u,function(){var e;D?I.emit("rejectionHandled",t):(e=u.onrejectionhandled)&&e({promise:t,reason:t._v})})},V=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),F(e,!0))},U=function(t){var e,i=this;if(!i._d){i._d=!0,i=i._w||i;try{if(i===t)throw E("Promise can't be resolved itself");(e=L(t))?S(function(){var s={_w:i,_d:!1};try{e.call(t,l(U,s,1),l(V,s,1))}catch(t){V.call(s,t)}}):(i._v=t,i._s=1,F(i,!1))}catch(t){V.call({_w:i,_d:!1},t)}}};w||(R=function(t){m(this,R,"Promise","_h"),p(t),s.call(this);try{t(l(U,this,1),l(V,this,1))}catch(t){V.call(this,t)}},(s=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=i(65)(R.prototype,{then:function(t,e){var i=b(y(this,R));return i.ok="function"!=typeof t||t,i.fail="function"==typeof e&&e,i.domain=D?I.domain:void 0,this._c.push(i),this._a&&this._a.push(i),this._s&&F(this,!1),i.promise},catch:function(t){return this.then(void 0,t)}}),a=function(){var t=new s;this.promise=t,this.resolve=l(U,t,1),this.reject=l(V,t,1)},g.f=b=function(t){return t===R||t===n?new a(t):r(t)}),c(c.G+c.W+!w*c.F,{Promise:R}),i(30)(R,"Promise"),i(91)("Promise"),n=i(0).Promise,c(c.S+!w*c.F,"Promise",{reject:function(t){var e=b(this);return(0,e.reject)(t),e.promise}}),c(c.S+c.F*(o||!w),"Promise",{resolve:function(t){return C(o&&this===n?R:this,t)}}),c(c.S+!(w&&i(192)(function(t){R.all(t).catch(O)}))*c.F,"Promise",{all:function(t){var e=this,i=b(e),s=i.resolve,r=i.reject,a=T(function(){var i=[],a=0,n=1;_(t,!1,function(t){var o=a++,u=!1;i.push(void 0),n++,e.resolve(t).then(function(t){u||(u=!0,i[o]=t,--n||s(i))},r)}),--n||s(i)});return a.e&&r(a.v),i.promise},race:function(t){var e=this,i=b(e),s=i.reject,r=T(function(){_(t,!1,function(t){e.resolve(t).then(i.resolve,s)})});return r.e&&s(r.v),i.promise}})},function(t,e){t.exports=function(t,e,i){var s=void 0===i;switch(e.length){case 0:return s?t():t.call(i);case 1:return s?t(e[0]):t.call(i,e[0]);case 2:return s?t(e[0],e[1]):t.call(i,e[0],e[1]);case 3:return s?t(e[0],e[1],e[2]):t.call(i,e[0],e[1],e[2]);case 4:return s?t(e[0],e[1],e[2],e[3]):t.call(i,e[0],e[1],e[2],e[3])}return t.apply(i,e)}},function(t,e,i){var s=i(4),r=i(97).set,a=s.MutationObserver||s.WebKitMutationObserver,n=s.process,o=s.Promise,u="process"==i(26)(n);t.exports=function(){var t,e,i,l=function(){var s,r;for(u&&(s=n.domain)&&s.exit();t;){r=t.fn,t=t.next;try{r()}catch(s){throw t?i():e=void 0,s}}e=void 0,s&&s.enter()};if(u)i=function(){n.nextTick(l)};else if(!a||s.navigator&&s.navigator.standalone)if(o&&o.resolve){var d=o.resolve(void 0);i=function(){d.then(l)}}else i=function(){r.call(s,l)};else{var c=!0,f=document.createTextNode("");new a(l).observe(f,{characterData:!0}),i=function(){f.data=c=!c}}return function(s){var r={fn:s,next:void 0};e&&(e.next=r),t||(t=r,i()),e=r}}},function(t,e,i){var s=i(4).navigator;t.exports=s&&s.userAgent||""},function(t,e,i){var s=i(5)("iterator"),r=!1;try{var a=[7][s]();a.return=function(){r=!0},Array.from(a,function(){throw 2})}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var i=!1;try{var a=[7],n=a[s]();n.next=function(){return{done:i=!0}},a[s]=function(){return n},t(a)}catch(t){}return i}},function(t,e,i){"use strict";var s=i(2),r=i(0),a=i(4),n=i(96),o=i(99);s(s.P+s.R,"Promise",{finally:function(t){var e=n(this,r.Promise||a.Promise),i="function"==typeof t;return this.then(i?function(i){return o(e,t()).then(function(){return i})}:t,i?function(i){return o(e,t()).then(function(){throw i})}:t)}})},function(t,e,i){"use strict";var s=i(2),r=i(69),a=i(98);s(s.S,"Promise",{try:function(t){var e=r.f(this),i=a(t);return(i.e?e.reject:e.resolve)(i.v),e.promise}})}
1,function(t,e,i){"use strict";e.__esModule=!0;var s=a(i(196)),r=a(i(63));function a(t){return t&&t.__esModule?t:{default:t}}e.default=function(t,e){if(Array.isArray(t))return t;if((0,s.default)(Object(t)))return function(t,e){var i=[],s=!0,a=!1,n=void 0;try{for(var o,u=(0,r.default)(t);!(s=(o=u.next()).done)&&(i.push(o.value),!e||i.length!==e);s=!0);}catch(t){a=!0,n=t}finally{try{!s&&u.return&&u.return()}finally{if(a)throw n}}return i}(t,e);throw TypeError("Invalid attempt to destructure non-iterable instance")}},function(t,e,i){t.exports={default:i(197),__esModule:!0}},function(t,e,i){i(32),i(31),t.exports=i(198)},function(t,e,i){var s=i(46),r=i(5)("iterator"),a=i(21);t.exports=i(0).isIterable=function(t){var e=Object(t);return void 0!==e[r]||"@@iterator"in e||a.hasOwnProperty(s(e))}},function(t,e,i){t.exports={default:i(200),__esModule:!0}},function(t,e,i){i(201),t.exports=0x1fffffffffffff},function(t,e,i){var s=i(2);s(s.S,"Number",{MAX_SAFE_INTEGER:0x1fffffffffffff})},function(t,e,i){"use strict";function s(t,e){var i=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(i>>16)<<16|65535&i}function r(t,e,i,r,a,n){var o;return s((o=s(s(e,t),s(r,n)))<<a|o>>>32-a,i)}function a(t,e,i,s,a,n,o){return r(e&i|~e&s,t,e,a,n,o)}function n(t,e,i,s,a,n,o){return r(e&s|i&~s,t,e,a,n,o)}function o(t,e,i,s,a,n,o){return r(e^i^s,t,e,a,n,o)}function u(t,e,i,s,a,n,o){return r(i^(e|~s),t,e,a,n,o)}function l(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var i,r,l,d,c,f=0x67452301,p=-0x10325477,m=-0x67452302,_=0x10325476;for(i=0;i<t.length;i+=16)r=f,l=p,d=m,c=_,f=a(f,p,m,_,t[i],7,-0x28955b88),_=a(_,f,p,m,t[i+1],12,-0x173848aa),m=a(m,_,f,p,t[i+2],17,0x242070db),p=a(p,m,_,f,t[i+3],22,-0x3e423112),f=a(f,p,m,_,t[i+4],7,-0xa83f051),_=a(_,f,p,m,t[i+5],12,0x4787c62a),m=a(m,_,f,p,t[i+6],17,-0x57cfb9ed),p=a(p,m,_,f,t[i+7],22,-0x2b96aff),f=a(f,p,m,_,t[i+8],7,0x698098d8),_=a(_,f,p,m,t[i+9],12,-0x74bb0851),m=a(m,_,f,p,t[i+10],17,-42063),p=a(p,m,_,f,t[i+11],22,-0x76a32842),f=a(f,p,m,_,t[i+12],7,0x6b901122),_=a(_,f,p,m,t[i+13],12,-0x2678e6d),m=a(m,_,f,p,t[i+14],17,-0x5986bc72),f=n(f,p=a(p,m,_,f,t[i+15],22,0x49b40821),m,_,t[i+1],5,-0x9e1da9e),_=n(_,f,p,m,t[i+6],9,-0x3fbf4cc0),m=n(m,_,f,p,t[i+11],14,0x265e5a51),p=n(p,m,_,f,t[i],20,-0x16493856),f=n(f,p,m,_,t[i+5],5,-0x29d0efa3),_=n(_,f,p,m,t[i+10],9,0x2441453),m=n(m,_,f,p,t[i+15],14,-0x275e197f),p=n(p,m,_,f,t[i+4],20,-0x182c0438),f=n(f,p,m,_,t[i+9],5,0x21e1cde6),_=n(_,f,p,m,t[i+14],9,-0x3cc8f82a),m=n(m,_,f,p,t[i+3],14,-0xb2af279),p=n(p,m,_,f,t[i+8],20,0x455a14ed),f=n(f,p,m,_,t[i+13],5,-0x561c16fb),_=n(_,f,p,m,t[i+2],9,-0x3105c08),m=n(m,_,f,p,t[i+7],14,0x676f02d9),f=o(f,p=n(p,m,_,f,t[i+12],20,-0x72d5b376),m,_,t[i+5],4,-378558),_=o(_,f,p,m,t[i+8],11,-0x788e097f),m=o(m,_,f,p,t[i+11],16,0x6d9d6122),p=o(p,m,_,f,t[i+14],23,-0x21ac7f4),f=o(f,p,m,_,t[i+1],4,-0x5b4115bc),_=o(_,f,p,m,t[i+4],11,0x4bdecfa9),m=o(m,_,f,p,t[i+7],16,-0x944b4a0),p=o(p,m,_,f,t[i+10],23,-0x41404390),f=o(f,p,m,_,t[i+13],4,0x289b7ec6),_=o(_,f,p,m,t[i],11,-0x155ed806),m=o(m,_,f,p,t[i+3],16,-0x2b10cf7b),p=o(p,m,_,f,t[i+6],23,0x4881d05),f=o(f,p,m,_,t[i+9],4,-0x262b2fc7),_=o(_,f,p,m,t[i+12],11,-0x1924661b),m=o(m,_,f,p,t[i+15],16,0x1fa27cf8),f=u(f,p=o(p,m,_,f,t[i+2],23,-0x3b53a99b),m,_,t[i],6,-0xbd6ddbc),_=u(_,f,p,m,t[i+7],10,0x432aff97),m=u(m,_,f,p,t[i+14],15,-0x546bdc59),p=u(p,m,_,f,t[i+5],21,-0x36c5fc7),f=u(f,p,m,_,t[i+12],6,0x655b59c3),_=u(_,f,p,m,t[i+3],10,-0x70f3336e),m=u(m,_,f,p,t[i+10],15,-1051523),p=u(p,m,_,f,t[i+1],21,-0x7a7ba22f),f=u(f,p,m,_,t[i+8],6,0x6fa87e4f),_=u(_,f,p,m,t[i+15],10,-0x1d31920),m=u(m,_,f,p,t[i+6],15,-0x5cfebcec),p=u(p,m,_,f,t[i+13],21,0x4e0811a1),f=u(f,p,m,_,t[i+4],6,-0x8ac817e),_=u(_,f,p,m,t[i+11],10,-0x42c50dcb),m=u(m,_,f,p,t[i+2],15,0x2ad7d2bb),p=u(p,m,_,f,t[i+9],21,-0x14792c6f),f=s(f,r),p=s(p,l),m=s(m,d),_=s(_,c);return[f,p,m,_]}function d(t){var e,i="",s=32*t.length;for(e=0;e<s;e+=8)i+=String.fromCharCode(t[e>>5]>>>e%32&255);return i}function c(t){var e,i=[];for(i[(t.length>>2)-1]=void 0,e=0;e<i.length;e+=1)i[e]=0;var s=8*t.length;for(e=0;e<s;e+=8)i[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return i}function f(t){var e,i,s="";for(i=0;i<t.length;i+=1)e=t.charCodeAt(i),s+="0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(15&e);return s}function p(t){return unescape(encodeURIComponent(t))}function m(t){var e;return d(l(c(e=p(t)),8*e.length))}function _(t,e){return function(t,e){var i,s,r=c(t),a=[],n=[];for(a[15]=n[15]=void 0,r.length>16&&(r=l(r,8*t.length)),i=0;i<16;i+=1)a[i]=0x36363636^r[i],n[i]=0x5c5c5c5c^r[i];return s=l(a.concat(c(e)),512+8*e.length),d(l(n.concat(s),640))}(p(t),p(e))}
1Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,i){return e?i?_(e,t):f(_(e,t)):i?m(t):f(m(t))}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(1),r=s&&s.__esModule?s:{default:s},a=function t(){(0,r.default)(this,t)};a.MEDIAUISEA="mediauisea",a.GET_MEDIA_CONFIG="getMediaConfig",a.GET_INFO_FROM_VGM="getInfoFromVGM",a.CHECK_ID_BY_STR="checkIdByStr",a.LOGIN_VERIFY="loginVerify",a.REFRESH_COOKIE="refreshCookie",a.JOIN_GROUP="joinGroup",a.QUIT_GROUP="quitGroup",a.GET_STREAM_INFO_BY_ROOM="getStreamInfoByRoom",a.GET_STREAM_INFO_BY_STREAMNAME="getStreamInfoByStreamName",a.GET_STREAM_INFO_BY_ROOM_FAKE="getStreamInfoByRoomFake",e.default=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={isCanUse:function(t,e,i,s){var r=this.isCanUseAll(t,i,s);return this.isCanUseRoom(r,t,e,i,s)},isCanUseAll:function(t,e,i){var s=1==t.use_p2p;return s=this.isCanUseProperty(s,t.p2pLines,e),s=this.isCanUseProperty(s,t.p2pRates,i)},isCanUseRoom:function(t,e,i,s,r){var a=e.p2pRoomIds;if(a)for(var n=a.length,o=0;o<n;o++){var u=a[o];if(u[0]==i){t=1==u[1];var l=u[2];l&&(t=this.isCanUseProperty(t,l.lines,s),t=this.isCanUseProperty(t,l.rates,r))}}return t},isCanUseProperty:function(t,e,i){if(e)for(var s=e.length,r=0;r<s;r++){var a=e[r];if(a[0]==i){t=1==a[1];break}}return t}}}]).default}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.