filesbox/web/dist/design/designstatic/chatroom/video/flv.min.1.6.2.js

10 lines
141 KiB
JavaScript
Raw Normal View History

2024-07-26 06:10:54 +00:00
(function(me,pe){typeof exports=="object"&&typeof module=="object"?module.exports=pe():typeof define=="function"&&define.amd?define([],pe):typeof exports=="object"?exports.flvjs=pe():me.flvjs=pe()})(self,function(){return function(){var me={264:function(W,K,T){/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.8+1e68dce6
*/W.exports=function(){"use strict";function N(b){var R=typeof b;return b!==null&&(R==="object"||R==="function")}function Z(b){return typeof b=="function"}var f=Array.isArray?Array.isArray:function(b){return Object.prototype.toString.call(b)==="[object Array]"},p=0,g=void 0,m=void 0,E=function(b,R){u[p]=b,u[p+1]=R,(p+=2)===2&&(m?m(d):k())};function M(b){m=b}function L(b){E=b}var D=typeof window!="undefined"?window:void 0,I=D||{},H=I.MutationObserver||I.WebKitMutationObserver,ee=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",A=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function O(){return function(){return process.nextTick(d)}}function S(){return g!==void 0?function(){g(d)}:o()}function P(){var b=0,R=new H(d),B=document.createTextNode("");return R.observe(B,{characterData:!0}),function(){B.data=b=++b%2}}function y(){var b=new MessageChannel;return b.port1.onmessage=d,function(){return b.port2.postMessage(0)}}function o(){var b=setTimeout;return function(){return b(d,1)}}var u=new Array(1e3);function d(){for(var b=0;b<p;b+=2)(0,u[b])(u[b+1]),u[b]=void 0,u[b+1]=void 0;p=0}function l(){try{var b=Function("return this")().require("vertx");return g=b.runOnLoop||b.runOnContext,S()}catch(R){return o()}}var k=void 0;function i(b,R){var B=this,j=new this.constructor(n);j[r]===void 0&&re(j);var z=B._state;if(z){var q=arguments[z-1];E(function(){return X(z,j,q,B._result)})}else Q(B,j,b,R);return j}function e(b){var R=this;if(b&&typeof b=="object"&&b.constructor===R)return b;var B=new R(n);return x(B,b),B}k=ee?O():H?P():A?y():D===void 0?l():o();var r=Math.random().toString(36).substring(2);function n(){}var a=void 0,_=1,s=2;function t(){return new TypeError("You cannot resolve a promise with itself")}function h(){return new TypeError("A promises callback cannot return that same promise.")}function c(b,R,B,j){try{b.call(R,B,j)}catch(z){return z}}function v(b,R,B){E(function(j){var z=!1,q=c(B,R,function(te){z||(z=!0,R!==te?x(j,te):F(j,te))},function(te){z||(z=!0,U(j,te))},"Settle: "+(j._label||" unknown promise"));!z&&q&&(z=!0,U(j,q))},b)}function w(b,R){R._state===_?F(b,R._result):R._state===s?U(b,R._result):Q(R,void 0,function(B){return x(b,B)},function(B){return U(b,B)})}function C(b,R,B){R.constructor===b.constructor&&B===i&&R.constructor.resolve===e?w(b,R):B===void 0?F(b,R):Z(B)?v(b,R,B):F(b,R)}function x(b,R){if(b===R)U(b,t());else if(N(R)){var B=void 0;try{B=R.then}catch(j){return void U(b,j)}C(b,R,B)}else F(b,R)}function G(b){b._onerror&&b._onerror(b._result),Y(b)}function F(b,R){b._state===a&&(b._result=R,b._state=_,b._subscribers.length!==0&&E(Y,b))}function U(b,R){b._state===a&&(b._state=s,b._result=R,E(G,b))}function Q(b,R,B,j){var z=b._subscribers,q=z.length;b._onerror=null,z[q]=R,z[q+_]=B,z[q+s]=j,q===0&&b._state&&E(Y,b)}function Y(b){var R=b._subscribers,B=b._state;if(R.length!==0){for(var j=void 0,z=void 0,q=b._result,te=0;te<R.length;te+=3)j=R[te],z=R[te+B],j?X(B,j,z,q):z(q);b._subscribers.length=0}}function X(b,R,B,j){var z=Z(B),q=void 0,te=void 0,_e=!0;if(z){try{q=B(j)}catch(fe){_e=!1,te=fe}if(R===q)return void U(R,h())}else q=j;R._state!==a||(z&&_e?x(R,q):_e===!1?U(R,te):b===_?F(R,q):b===s&&U(R,q))}function ie(b,R){try{R(function(B){x(b,B)},function(B){U(b,B)})}catch(B){U(b,B)}}var se=0;function V(){return se++}function re(b){b[r]=se++,b._state=void 0,b._result=void 0,b._subscribers=[]}function $(){return new Error("Array Methods must be provided an Array")}var oe=function(){function b(R,B){this._instanceConstructor=R,this.promise=new R(n),this.promise[r]||re(this.promise),f(B)?(this.length=B.length,this._remaining=B.length,this._result=new Array(this.length),this.length===0?F(this.promise,this._result):(this.length=this.length||0,this._enumerate(B),this._remaining===0&&F(this.promise,this._result))):U(this.promise,$())}return b.prototype._enumerate=function(R){for(var B=0;this._state===a&&B<R.length;B++)this._eachEntry(R[B],B)},b.prototype._eachEntry=function(R,B){var j=this._instanceConstructo
`}),I=I+"new (("+N.toString().replace("ENTRY_MODULE",JSON.stringify(E))+")({"+D.main.map(function(O){return JSON.stringify(O)+": "+L.main[O].toString()}).join(",")+"}))(self);";var H=new window.Blob([I],{type:"text/javascript"});if(M.bare)return H;var ee=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(H),A=new window.Worker(ee);return A.objectURL=ee,A}},118:function(W,K){"use strict";var T=function(){function N(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}return N.prototype.isComplete=function(){var Z=this.hasAudio===!1||this.hasAudio===!0&&this.audioCodec!=null&&this.audioSampleRate!=null&&this.audioChannelCount!=null,f=this.hasVideo===!1||this.hasVideo===!0&&this.videoCodec!=null&&this.width!=null&&this.height!=null&&this.fps!=null&&this.profile!=null&&this.level!=null&&this.refFrames!=null&&this.chromaFormat!=null&&this.sarNum!=null&&this.sarDen!=null;return this.mimeType!=null&&this.duration!=null&&this.metadata!=null&&this.hasKeyframesIndex!=null&&Z&&f},N.prototype.isSeekable=function(){return this.hasKeyframesIndex===!0},N.prototype.getNearestKeyframe=function(Z){if(this.keyframesIndex==null)return null;var f=this.keyframesIndex,p=this._search(f.times,Z);return{index:p,milliseconds:f.times[p],fileposition:f.filepositions[p]}},N.prototype._search=function(Z,f){var p=0,g=Z.length-1,m=0,E=0,M=g;for(f<Z[0]&&(p=0,E=M+1);E<=M;){if((m=E+Math.floor((M-E)/2))===g||f>=Z[m]&&f<Z[m+1]){p=m;break}Z[m]<f?E=m+1:M=m-1}return p},N}();K.Z=T},51:function(W,K,T){"use strict";T.d(K,{Wk:function(){return N},Yy:function(){return Z},Vn:function(){return f},J1:function(){return p}});var N=function(g,m,E,M,L){this.dts=g,this.pts=m,this.duration=E,this.originalDts=M,this.isSyncPoint=L,this.fileposition=null},Z=function(){function g(){this.beginDts=0,this.endDts=0,this.beginPts=0,this.endPts=0,this.originalBeginDts=0,this.originalEndDts=0,this.syncPoints=[],this.firstSample=null,this.lastSample=null}return g.prototype.appendSyncPoint=function(m){m.isSyncPoint=!0,this.syncPoints.push(m)},g}(),f=function(){function g(){this._list=[]}return g.prototype.clear=function(){this._list=[]},g.prototype.appendArray=function(m){var E=this._list;m.length!==0&&(E.length>0&&m[0].originalDts<E[E.length-1].originalDts&&this.clear(),Array.prototype.push.apply(E,m))},g.prototype.getLastSyncPointBeforeDts=function(m){if(this._list.length==0)return null;var E=this._list,M=0,L=E.length-1,D=0,I=0,H=L;for(m<E[0].dts&&(M=0,I=H+1);I<=H;){if((D=I+Math.floor((H-I)/2))===L||m>=E[D].dts&&m<E[D+1].dts){M=D;break}E[D].dts<m?I=D+1:H=D-1}return this._list[M]},g}(),p=function(){function g(m){this._type=m,this._list=[],this._lastAppendLocation=-1}return Object.defineProperty(g.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"length",{get:function(){return this._list.length},enumerable:!1,configurable:!0}),g.prototype.isEmpty=function(){return this._list.length===0},g.prototype.clear=function(){this._list=[],this._lastAppendLocation=-1},g.prototype._searchNearestSegmentBefore=function(m){var E=this._list;if(E.length===0)return-2;var M=E.length-1,L=0,D=0,I=M,H=0;if(m<E[0].originalBeginDts)return H=-1;for(;D<=I;){if((L=D+Math.floor((I-D)/2))===M||m>E[L].lastSample.originalDts&&m<E[L+1].originalBeginDts){H=L;break}E[L].originalBeginDts<m?D=L+1:I=L-1}return H},g.prototype._searchNearestSegmentAfter=function(m){return this._searchNearestSegmentBefore(m)+1},g.prototype.append=function(m){var E=this._list,M=m,L=this._lastAppendLocation,D=0;L!==-1&&L<E.length&&M.originalBeginDts>=E[L].lastSample.originalDts&&(L===E.length-1||L<E.length-1&&M.original
originalDts: `+ae+" ms, curRefDts: "+J+" ms, dtsCorrection: "+Math.round(s)+" ms, generate: "+b+" frames"),V=Math.floor(J),ne=Math.floor(J+h)-V,(de=y.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount))==null&&(f.Z.w(this.TAG,"Unable to generate silent frame for "+this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame"),de=he),ue=[];for(var R=0;R<b;R++){J+=h;var B=Math.floor(J),j=Math.floor(J+h)-B,z={dts:B,pts:B,cts:0,unit:de,size:de.byteLength,duration:j,originalDts:ae,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}};ue.push(z),G+=z.size}this._audioNextDts=J+h}else V=Math.floor(J),ne=Math.floor(J+h)-V,this._audioNextDts=J+h}else V=ae-s,oe!==_.length-1?ne=_[oe+1].dts-this._dtsBase-s-V:F!=null?ne=F.dts-this._dtsBase-s-V:ne=$.length>=1?$[$.length-1].duration:Math.floor(h),this._audioNextDts=V+ne;t===-1&&(t=V),$.push({dts:V,pts:V,cts:0,unit:U.unit,size:U.unit.byteLength,duration:ne,originalDts:ae,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),ce&&$.push.apply($,ue)}}if($.length===0)return a.samples=[],void(a.length=0);for(c?x=new Uint8Array(G):((x=new Uint8Array(G))[0]=G>>>24&255,x[1]=G>>>16&255,x[2]=G>>>8&255,x[3]=255&G,x.set(P.types.mdat,4)),oe=0;oe<$.length;oe++)he=$[oe].unit,x.set(he,C),C+=he.byteLength;var q=$[$.length-1];n=q.dts+q.duration;var te=new o.Yy;te.beginDts=t,te.endDts=n,te.beginPts=t,te.endPts=n,te.originalBeginDts=$[0].originalDts,te.originalEndDts=q.originalDts+q.duration,te.firstSample=new o.Wk($[0].dts,$[0].pts,$[0].duration,$[0].originalDts,!1),te.lastSample=new o.Wk(q.dts,q.pts,q.duration,q.originalDts,!1),this._isLive||this._audioSegmentInfoList.append(te),a.samples=$,a.sequenceNumber++;var _e=null;_e=c?new Uint8Array:P.moof(a,t),a.samples=[],a.length=0;var fe={type:"audio",data:this._mergeBoxes(_e,x).buffer,sampleCount:$.length,info:te};c&&v&&(fe.timestampOffset=t),this._onMediaSegment("audio",fe)}}},i.prototype._remuxVideo=function(e,r){if(this._videoMeta!=null){var n,a,_=e,s=_.samples,t=void 0,h=-1,c=-1;if(s&&s.length!==0&&(s.length!==1||r)){var v=8,w=null,C=8+e.length,x=null;if(s.length>1&&(C-=(x=s.pop()).length),this._videoStashedLastSample!=null){var G=this._videoStashedLastSample;this._videoStashedLastSample=null,s.unshift(G),C+=G.length}x!=null&&(this._videoStashedLastSample=x);var F=s[0].dts-this._dtsBase;if(this._videoNextDts)t=F-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())t=0;else{var U=this._videoSegmentInfoList.getLastSampleBefore(F);if(U!=null){var Q=F-(U.originalDts+U.duration);Q<=3&&(Q=0),t=F-(U.dts+U.duration+Q)}else t=0}for(var Y=new o.Yy,X=[],ie=0;ie<s.length;ie++){var se=(G=s[ie]).dts-this._dtsBase,V=G.isKeyframe,re=se-t,$=G.cts,oe=re+$;h===-1&&(h=re,c=oe);var he=0;if(ie!==s.length-1?he=s[ie+1].dts-this._dtsBase-t-re:x!=null?he=x.dts-this._dtsBase-t-re:he=X.length>=1?X[X.length-1].duration:Math.floor(this._videoMeta.refSampleDuration),V){var ae=new o.Wk(re,oe,he,G.dts,!0);ae.fileposition=G.fileposition,Y.appendSyncPoint(ae)}X.push({dts:re,pts:oe,cts:$,units:G.units,size:G.length,isKeyframe:V,duration:he,originalDts:se,flags:{isLeading:0,dependsOn:V?2:1,isDependedOn:V?1:0,hasRedundancy:0,isNonSync:V?0:1}})}for((w=new Uint8Array(C))[0]=C>>>24&255,w[1]=C>>>16&255,w[2]=C>>>8&255,w[3]=255&C,w.set(P.types.mdat,4),ie=0;ie<X.length;ie++)for(var ce=X[ie].units;ce.length;){var ue=ce.shift().data;w.set(ue,v),v+=ue.byteLength}var ne=X[X.length-1];if(n=ne.dts+ne.duration,a=ne.pts+ne.duration,this._videoNextDts=n,Y.beginDts=h,Y.endDts=n,Y.beginPts=c,Y.endPts=a,Y.originalBeginDts=X[0].originalDts,Y.originalEndDts=ne.originalDts+ne.duration,Y.firstSample=new o.Wk(X[0].dts,X[0].pts,X[0].duration,X[0].originalDts,X[0].isKeyframe),Y.lastSample=new o.Wk(ne.dts,ne.pts,ne.duration,ne.originalDts,ne.isKeyframe),this._isLive||this._videoSegmentInfoList.append(Y),_.samples=X,_.sequenceNumber++,this._forceFirstIDR){var J=X[0].flags;J.dependsOn=2,J.isNonSync=0}var de=P.moof(_,h);_.samples=[],_.length=0,this._onMediaSegment("video",{type:"video",data:this._mergeBoxes(de,w).buffer,sampleCoun