{"version":3,"file":"index.min.js","sources":["../../xgplayer-streaming-shared/src/buffer.js","../../xgplayer-streaming-shared/src/env.js","../../xgplayer-streaming-shared/src/error.js","../../xgplayer-streaming-shared/src/logger.js","../../xgplayer-streaming-shared/src/utils.js","../../xgplayer-streaming-shared/src/mse.js","../../xgplayer-streaming-shared/src/net/types.js","../../xgplayer-streaming-shared/src/net/error.js","../../xgplayer-streaming-shared/src/is.js","../../xgplayer-streaming-shared/src/net/helper.js","../../xgplayer-streaming-shared/src/event.js","../../../node_modules/eventemitter3/index.js","../../xgplayer-streaming-shared/src/net/fetch.js","../../xgplayer-streaming-shared/src/net/xhr.js","../../xgplayer-streaming-shared/src/net/task.js","../../xgplayer-streaming-shared/src/streaming-helper.js","../../xgplayer-streaming-shared/src/net/index.js","../../xgplayer-streaming-shared/src/net/config.js","../../xgplayer-streaming-shared/src/services/gap.js","../../xgplayer-streaming-shared/src/services/sei.js","../../xgplayer-streaming-shared/src/services/bandwidth.js","../../xgplayer-streaming-shared/src/services/stats.js","../../xgplayer-transmuxer/src/model/types.js","../../xgplayer-transmuxer/src/model/video-track.js","../../xgplayer-transmuxer/src/model/audio-track.js","../../xgplayer-transmuxer/src/model/video-sample.js","../../xgplayer-transmuxer/src/model/audio-sample.js","../../xgplayer-transmuxer/src/model/metadata-track.js","../../xgplayer-transmuxer/src/utils/exp-golomb.js","../../xgplayer-transmuxer/src/utils/logger.js","../../xgplayer-transmuxer/src/utils/utf8.js","../../xgplayer-transmuxer/src/utils/env.js","../../xgplayer-transmuxer/src/utils/index.js","../../xgplayer-transmuxer/src/codec/aac.js","../../xgplayer-transmuxer/src/codec/nalu.js","../../xgplayer-transmuxer/src/codec/avc.js","../../xgplayer-transmuxer/src/codec/hevc.js","../../xgplayer-transmuxer/src/codec/opus.js","../../xgplayer-transmuxer/src/flv/fixer.js","../../xgplayer-transmuxer/src/flv/amf.js","../../xgplayer-transmuxer/src/flv/soundFormat.js","../../xgplayer-transmuxer/src/flv/index.js","../../xgplayer-transmuxer/src/mp4/buffer.js","../../xgplayer-transmuxer/src/mpeg-ts/index.js","../../xgplayer-transmuxer/src/mp4/mp4.js","../../xgplayer-transmuxer/src/mp4/logger.js","../../../node_modules/crypto-es/lib/md5.js","../../xgplayer-transmuxer/src/mp4/fmp4-remuxer.js","../../../node_modules/crypto-es/lib/core.js","../../../node_modules/crypto-es/lib/enc-base64.js","../../../node_modules/crypto-es/lib/evpkdf.js","../../../node_modules/crypto-es/lib/cipher-core.js","../../../node_modules/crypto-es/lib/aes.js","../../../node_modules/crypto-es/lib/mode-ctr.js","../src/flv/services/transfer-cost.js","../src/flv/services/buffer-service.js","../src/flv/utils.js","../src/flv/index.js","../src/flv/options.js","../src/plugin-extension.js","../src/plugin.js"],"sourcesContent":["export class Buffer {\n /**\n * @param {TimeRanges} buf\n * @returns {number}\n */\n static start (buf) {\n if (!buf || !buf.length) return 0\n\n // Safari bug: https://bit.ly/2trx6O8\n if (buf.length === 1 && buf.end(0) - buf.start(0) < 1e-6) return 0\n // Edge bug: https://bit.ly/2JYLPeB\n if (buf.length === 1 && buf.start(0) < 0) return 0\n\n return buf.start(0)\n }\n\n /**\n * @param {TimeRanges} buf\n * @returns {number}\n */\n static end (buf) {\n if (!buf || !buf.length) return 0\n\n // Safari bug: https://bit.ly/2trx6O8\n if (buf.length === 1 && buf.end(0) - buf.start(0) < 1e-6) return 0\n\n return buf.end(buf.length - 1)\n }\n\n /**\n * @param {{buffered?: TimeRanges}} b\n * @returns {TimeRanges | void}\n */\n static get (b) {\n if (!b) return\n try {\n return b.buffered\n } catch (error) {\n // ignore\n }\n }\n\n /**\n * @param {TimeRanges} buf\n * @param {number} [maxHole]\n * @returns {[number,number][]}\n */\n static buffers (buf, maxHole) {\n if (!buf || !buf.length) return []\n\n const buffers = []\n for (let i = 0, l = buf.length; i < l; i++) {\n const bufLen = buffers.length\n if (!bufLen || !maxHole) {\n buffers.push([buf.start(i), buf.end(i)])\n } else {\n const last = buffers[bufLen - 1]\n const lastEnd = last[1]\n const start = buf.start(i)\n if (start - lastEnd <= maxHole) {\n const end = buf.end(i)\n if (end > lastEnd) {\n last[1] = end\n }\n } else {\n buffers.push([buf.start(i), buf.end(i)])\n }\n }\n }\n return buffers\n }\n\n /**\n * @param {TimeRanges} buf\n * @param {number} [maxHole]\n * @returns {{buffers:[number,number][],length:number}}\n */\n static totalLength (buffers) {\n if (!buffers || !buffers.length) return 0\n return buffers.reduce((a, c) => (a += (c[1] - c[0])), 0)\n }\n\n /**\n *\n * @param {TimeRanges} buf\n * @param {number} [pos=0]\n * @param {number} [maxHole=0]\n * @returns {{start:number,end:number,buffers:[number,number][],remaining:number,index?:number,nextStart?:number,nextEnd?:number,prevStart?:number,prevEnd?:number}}\n */\n static info (buf, pos = 0, maxHole = 0) {\n if (!buf || !buf.length) return { start: 0, end: 0, buffers: [] }\n\n let start = 0\n let end = 0\n let index = 0\n let nextStart = 0\n let nextEnd = 0\n let prevStart = 0\n let prevEnd = 0\n const buffers = Buffer.buffers(buf, maxHole)\n\n for (let i = 0, l = buffers.length; i < l; i++) {\n const item = buffers[i]\n if (pos + maxHole >= item[0] && pos <= item[1]) {\n start = item[0]\n end = item[1]\n index = i\n } else if (pos + maxHole < item[0]) {\n nextStart = item[0]\n nextEnd = item[1]\n break\n } else if (pos + maxHole > item[1]) {\n prevStart = item[0]\n prevEnd = item[1]\n }\n }\n\n return {\n start,\n end,\n index,\n buffers,\n nextStart,\n nextEnd,\n prevStart,\n prevEnd,\n currentTime: pos,\n behind: pos - start,\n remaining: end ? end - pos : 0,\n length: Buffer.totalLength && Buffer.totalLength(buffers)\n }\n }\n\n /**\n *\n * @param {HTMLMediaElement} media\n * @param {number} pos\n * @returns {Boolean}\n */\n static isBuffered (media, pos) {\n if (media) {\n const buffered = Buffer.get(media)\n\n if (buffered?.length) {\n for (let i = 0; i < buffered.length; i++) {\n if (pos >= buffered.start(i) && pos <= buffered.end(i)) {\n return true\n }\n }\n }\n }\n return false\n }\n}\n","export const isBrowser = typeof window !== 'undefined'\n","export const ERR = {\n MANIFEST: 'manifest',\n NETWORK: 'network',\n NETWORK_TIMEOUT: 'network_timeout',\n NETWORK_FORBIDDEN: 'network_forbidden',\n NETWORK_NOTFOUND: 'network_notfound',\n NETWROK_RANGE_NOT_SATISFIABLE: 'network_range_not_satisfiable',\n DEMUX: 'demux',\n REMUX: 'remux',\n MEDIA: 'media',\n DRM: 'drm',\n OTHER: 'other',\n RUNTIME: 'runtime',\n\n SUB_TYPES: {\n FLV: 'FLV',\n HLS: 'HLS',\n MP4: 'MP4',\n FMP4: 'FMP4',\n MSE_ADD_SB: 'MSE_ADD_SB',\n MSE_APPEND_BUFFER: 'MSE_APPEND_BUFFER',\n MSE_OTHER: 'MSE_OTHER',\n MSE_FULL: 'MSE_FULL',\n MSE_CHANGE_TYPE: 'MSE_CHANGE_TYPE',\n OPTION: 'OPTION',\n DASH: 'DASH',\n LICENSE: 'LICENSE',\n CUSTOM_LICENSE: 'CUSTOM_LICENSE',\n MSE_HIJACK: 'MSE_HIJACK',\n EME_HIJACK: 'EME_HIJACK',\n SIDX: 'SIDX',\n NO_CANPLAY_ERROR: 'NO_CANPLAY_ERROR',\n BUFFERBREAK_ERROR: 'BUFFERBREAK_ERROR',\n WAITING_TIMEOUT_ERROR: 'WAITING_TIMEOUT_ERROR',\n MEDIA_ERR_ABORTED: 'MEDIA_ERR_ABORTED',\n MEDIA_ERR_NETWORK: 'MEDIA_ERR_NETWORK',\n MEDIA_ERR_DECODE: 'MEDIA_ERR_DECODE',\n MEDIA_ERR_SRC_NOT_SUPPORTED: 'MEDIA_ERR_SRC_NOT_SUPPORTED',\n MEDIA_ERR_CODEC_NOT_SUPPORTED: 'MEDIA_ERR_CODEC_NOT_SUPPORTED',\n MEDIA_ERR_URL_EMPTY: 'MEDIA_ERR_URL_EMPTY'\n }\n}\n\nexport const ERR_CODE = {\n [ERR.MANIFEST]: {\n HLS: 1100,\n DASH: 1200\n },\n [ERR.NETWORK]: 2100,\n [ERR.NETWORK_TIMEOUT]: 2101,\n [ERR.NETWORK_FORBIDDEN]: 2103,\n [ERR.NETWORK_NOTFOUND]: 2104,\n [ERR.NETWROK_RANGE_NOT_SATISFIABLE]: 2116,\n [ERR.DEMUX]: {\n FLV: 3100,\n HLS: 3200,\n MP4: 3300,\n FMP4: 3400,\n SIDX: 3410\n },\n [ERR.REMUX]: {\n FMP4: 4100,\n MP4: 4200\n },\n [ERR.MEDIA]: {\n MEDIA_ERR_ABORTED: 5101,\n MEDIA_ERR_NETWORK: 5102,\n MEDIA_ERR_DECODE: 5103,\n MEDIA_ERR_SRC_NOT_SUPPORTED: 5104,\n MEDIA_ERR_CODEC_NOT_SUPPORTED: 5105,\n MEDIA_ERR_URL_EMPTY: 5106,\n MSE_ADD_SB: 5200,\n MSE_APPEND_BUFFER: 5201,\n MSE_OTHER: 5202,\n MSE_FULL: 5203,\n MSE_HIJACK: 5204,\n MSE_CHANGE_TYPE: 5205,\n EME_HIJACK: 5301\n },\n [ERR.DRM]: {\n LICENSE: 7100,\n CUSTOM_LICENSE: 7200\n },\n [ERR.OTHER]: 8000,\n [ERR.RUNTIME]: {\n NO_CANPLAY_ERROR: 9001,\n BUFFERBREAK_ERROR: 9002,\n WAITING_TIMEOUT_ERROR: 9003\n }\n}\n\nexport class StreamingError extends Error {\n constructor (type, subType, origin, payload, msg) {\n super(msg || origin?.message)\n this.errorType = type === ERR.NETWORK_TIMEOUT ? ERR.NETWORK : type\n this.originError = origin\n this.ext = payload\n this.errorCode = ERR_CODE[type][subType] || ERR_CODE[type]\n this.errorMessage = this.message\n if (!this.errorCode) {\n this.errorType = ERR.OTHER\n this.errorCode = ERR_CODE[this.errorType]\n }\n }\n\n static create (type, subType, origin, payload, msg) {\n if (type instanceof StreamingError) {\n return type\n } else if (type instanceof Error) {\n origin = type\n type = ''\n }\n\n if (!type) type = ERR.OTHER\n\n return new StreamingError(type, subType, origin, payload, msg)\n }\n\n static network (error) {\n return new StreamingError(\n error?.isTimeout ? ERR.NETWORK_TIMEOUT : ERR.NETWORK,\n null,\n error instanceof Error ? error : null,\n {\n url: error?.url,\n response: error?.response,\n httpCode: error?.response?.status\n }\n )\n }\n}\n","\nexport const LogCacheLevel = {\n 'DEBUG': 1,\n 'LOG': 2,\n 'WARN': 3,\n 'ERROR': 4\n}\nconst LOG_MAX_SIZE = 200 * 1024\nconst SIMPLE_TYPE = ['Boolean', 'Number' ,'String', 'Undefined','Null', 'Date','Object']\nexport class Logger {\n constructor (name,config) {\n this.name = name || ''\n this._prefix = `[${this.name}]`\n this.logCacheLevel = config?.logCacheLevel || 3\n this.logMaxSize = config?.logMaxSize || LOG_MAX_SIZE\n this.logSize = 0\n this.logTextArray = []\n }\n\n debug (...args) {\n this.logCache(LogCacheLevel.DEBUG,...args)\n if (Logger.disabled) return\n console.debug(`[${nowTime()}]`, this._prefix, ...args)\n }\n\n log (...args) {\n this.logCache(LogCacheLevel.LOG,...args)\n if (Logger.disabled) return\n console.log(`[${nowTime()}]`, this._prefix, ...args)\n }\n\n warn (...args) {\n this.logCache(LogCacheLevel.WARN,...args)\n if (Logger.disabled) return\n console.warn(`[${nowTime()}]`, this._prefix, ...args)\n }\n\n error (...args) {\n this.logCache(LogCacheLevel.ERROR,...args)\n if (Logger.disabled) return\n console.error(`[${nowTime()}]`, this._prefix, ...args)\n }\n\n logCache (logCacheLevel, ...logText) {\n if (logCacheLevel < this.logCacheLevel) return\n let text = ''\n try {\n const finLogText = logText.map( item => logable(item))\n text = `[${nowTime()}]` + this._prefix + (JSON.stringify(finLogText))\n } catch (e) {\n return\n }\n if (logCacheLevel >= this.logCacheLevel) {\n this.logSize += text.length\n this.logTextArray.push(text)\n }\n if (this.logSize > this.logMaxSize) {\n const delLog = this.logTextArray.shift()\n this.logSize -= delLog.length\n }\n }\n\n getLogCache () {\n const logText = this.logTextArray.join('\\n')\n this.reset()\n return logText\n }\n\n reset () {\n this.logTextArray = []\n this.logSize = 0\n }\n\n table (...args) {\n if (Logger.disabled) return\n console.group(this._prefix)\n console.table(...args)\n console.groupEnd()\n }\n\n static disabled = true\n\n static enable () {\n Logger.disabled = false\n }\n\n static disable () {\n Logger.disabled = true\n }\n\n setLogLevel (val) {\n this.logCacheLevel = val\n }\n}\nfunction nowTime () {\n return new Date().toLocaleString()\n}\n\nfunction reduceDepth (val) {\n if (typeof val !== 'object') {\n return val\n }\n const objType = Object.prototype.toString.call(val).slice(8, -1)\n switch (objType) {\n case 'Array':\n case 'Uint8Array':\n case 'ArrayBuffer':\n\n return objType + '[' + val.length + ']'\n case 'Object':\n return '{}'\n default:\n return objType\n }\n}\n\nfunction logable (obj, maxDepth, depth) {\n if (!depth) depth = 1\n if (!maxDepth) maxDepth = 2\n const result = {}\n\n if (!obj || typeof obj !== 'object') {\n return obj\n }\n\n const objType = Object.prototype.toString.call(obj).slice(8, -1)\n if (!SIMPLE_TYPE.includes(objType)) {\n return objType\n }\n\n if (depth > maxDepth) {\n return undefined\n }\n\n\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n if (depth === maxDepth) {\n result[key] = reduceDepth(obj[key])\n } else if (typeof obj[key] === 'object') {\n result[key] = logable(obj[key], maxDepth, depth + 1)\n } else {\n result[key] = obj[key]\n }\n }\n }\n return result\n}\n\n","export function createPublicPromise () {\n let res, rej\n const promise = new Promise((resolve, reject) => {\n res = resolve\n rej = reject\n })\n promise.used = false\n promise.resolve = (...args) => {\n promise.used = true\n return res(...args)\n }\n promise.reject = (...args) => {\n promise.used = true\n return rej(...args)\n }\n return promise\n}\n\nexport function nowTime () {\n try {\n return parseInt(performance.now(), 10)\n } catch (e) {\n return new Date().getTime()\n }\n}\n\n\nexport const SafeJSON = {\n stringify (obj) {\n try {\n return JSON.stringify(obj)\n } catch (e) {\n return ''\n }\n },\n parse (obj) {\n try {\n return JSON.parse(obj)\n } catch (e) {\n return undefined\n }\n }\n}\n","/* eslint-disable no-undef */\nimport { Buffer } from './buffer'\nimport { isBrowser } from './env'\nimport { ERR, StreamingError } from './error'\nimport { Logger } from './logger'\nimport { createPublicPromise, nowTime, SafeJSON } from './utils'\n\nfunction getMediaSource (preferMMS = true) {\n try {\n if (!isBrowser) return null\n\n if (preferMMS && typeof ManagedMediaSource !== 'undefined') return ManagedMediaSource\n\n return window.MediaSource\n } catch (e) {}\n}\n\nfunction isMMS (mediaSource) {\n return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource))\n}\n\n/**\n * @param {TimeRanges} buffered\n */\nfunction getTimeRanges (buffered) {\n const ranges = []\n\n if (buffered instanceof TimeRanges) {\n for (let i = 0; i < buffered.length; i++) {\n ranges.push({\n start: buffered.start(i),\n end: buffered.end(i)\n })\n }\n }\n return ranges\n}\n\n/** @enum {string} */\nexport const MSEErrorType = {\n UPDATE_ERROR: 'updateError'\n}\n\nconst OP_NAME = {\n APPEND: 'appendBuffer',\n REMOVE: 'removeBuffer',\n UPDATE_DURATION:'updateDuration'\n}\n\nexport class MSEError extends Error {\n /**\n * @param {MSEErrorType} type\n * @param {any} [msg]\n */\n constructor (type, msg) {\n super(msg || type)\n this.type = type\n this.msg = msg\n }\n}\n\nexport class MSE {\n static VIDEO = 'video'\n\n static AUDIO = 'audio'\n\n /**\n * @param {string} [mime='video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"']\n * @param { boolean} preferMMS\n * @returns {boolean}\n */\n static isSupported (mime = 'video/mp4; codecs=\"avc1.42E01E,mp4a.40.2\"') {\n const MediaSource = getMediaSource()\n if (!MediaSource) return false\n try {\n return MediaSource.isTypeSupported(mime)\n } catch (error) {\n this._logger.error(mime, error)\n return false\n }\n }\n\n static isMMSOnly () {\n return typeof ManagedMediaSource !== 'undefined' && typeof MediaSource === 'undefined'\n }\n\n /** @type { HTMLMediaElement | null } */\n media = null\n\n /** @type { MediaSource | null } */\n mediaSource = null\n\n _openPromise = createPublicPromise()\n\n _queue = Object.create(null)\n\n _sourceBuffer = Object.create(null)\n\n _mseFullFlag = {}\n\n _st = 0\n\n _opst = 0\n\n _logger = null\n\n _config = null\n _url = null\n\n\n static getDefaultConfig () {\n return {\n openLog: false,\n preferMMS: false\n }\n }\n\n /**\n * @param {HTMLMediaElement} [media]\n */\n constructor (media, config) {\n this._config = Object.assign(MSE.getDefaultConfig(), config)\n if (media) this.bindMedia(media)\n this._logger = new Logger('MSE')\n if (this._config.openLog) {\n Logger.enable()\n }\n }\n\n get isOpened () {\n return this.mediaSource?.readyState === 'open'\n }\n\n get hasOpTasks () {\n let flag = false\n Object.keys(this._queue).forEach(k => {\n const queue = this._queue[k]\n if (Array.isArray(queue)) {\n flag ||= queue.length > 0\n }\n })\n return flag\n }\n\n get url () {\n return this._url\n }\n\n get duration () {\n return this.mediaSource?.duration || -1\n }\n\n get isEnded () {\n return this.mediaSource ? this.mediaSource.readyState === 'ended' : false\n }\n\n get streaming () {\n return isMMS(this.mediaSource) ? this.mediaSource.streaming : true\n }\n\n isFull (type) {\n return type ? this._mseFullFlag[type] : this._mseFullFlag[MSE.VIDEO]\n }\n\n /**\n * @param { number } duration\n * @return { Promise }\n */\n updateDuration (duration) {\n const isReduceDuration = this.mediaSource && this.mediaSource.duration > duration\n if (this.mediaSource && this.mediaSource.duration > duration) {\n let bufferEnd = 0\n Object.keys(this._sourceBuffer).forEach(k => {\n try {\n bufferEnd = Math.max(this.bufferEnd(k) || 0, bufferEnd)\n } catch (error) {\n // ignore\n }\n })\n if (duration < bufferEnd) {\n // 设置值比bufferEnd值小,会导致异常\n return Promise.resolve()\n }\n }\n\n return this._enqueueBlockingOp(() => {\n if (this.isEnded) {\n this._logger.debug('setDuration but ended')\n return\n }\n if (this.mediaSource) {\n this.mediaSource.duration = duration\n this._logger.debug('setDuration', duration)\n }\n }, OP_NAME.UPDATE_DURATION, {isReduceDuration})\n }\n\n /** @return { Promise } */\n open () {\n if (this._openPromise.used && !this.isOpened && this.mediaSource) {\n const ms = this.mediaSource\n const onOpen = () => {\n const costTime = nowTime() - this._st\n this._logger.debug('sourceopen', costTime)\n ms.removeEventListener('sourceopen', onOpen)\n this._openPromise.resolve({costtime: costTime})\n }\n ms.addEventListener('sourceopen', onOpen)\n this._openPromise = createPublicPromise()\n }\n\n return this._openPromise\n }\n\n /**\n * @private\n */\n _onStartStreaming = () => {\n this._logger.debug('startstreaming')\n }\n\n /**\n * @private\n */\n _onEndStreaming = () => {\n this._logger.debug('endstreaming')\n }\n\n /**\n * @param { HTMLMediaElement } media\n * @return { Promise }\n */\n async bindMedia (media) {\n if (this.mediaSource || this.media) await this.unbindMedia()\n\n const MediaSource = getMediaSource(this._config.preferMMS)\n\n if (!media || !MediaSource) throw new Error('Param media or MediaSource does not exist')\n this.media = media\n const ms = this.mediaSource = new MediaSource()\n const useMMS = isMMS(ms)\n this._st = nowTime()\n\n const onOpen = () => {\n const costTime = nowTime() - this._st\n this._logger.debug('sourceopen')\n ms.removeEventListener('sourceopen', onOpen)\n URL.revokeObjectURL(media.src)\n this._openPromise.resolve({costtime: costTime})\n }\n ms.addEventListener('sourceopen', onOpen)\n if (useMMS) {\n ms.addEventListener('startstreaming', this._onStartStreaming)\n ms.addEventListener('endstreaming', this._onEndStreaming)\n }\n\n this._url = URL.createObjectURL(ms)\n media.src = this._url\n media.disableRemotePlayback = useMMS\n\n return this._openPromise\n }\n\n /** @return { Promise } */\n async unbindMedia () {\n if (!this._openPromise.used) this._openPromise.resolve()\n const ms = this.mediaSource\n\n if (ms) {\n Object.keys(this._queue).forEach((t) => {\n const queue = this._queue[t]\n if (queue) {\n queue.forEach(x => x.promise?.resolve?.())\n }\n })\n\n const hasMetadata = !!this.media && this.media.readyState >= 1\n const mseOpen = ms.readyState === 'open'\n\n if (hasMetadata && mseOpen) {\n try {\n ms.endOfStream()\n } catch (error) {\n // ignore\n }\n }\n\n Object.keys(this._sourceBuffer).forEach(k => {\n try {\n ms.removeSourceBuffer(this._sourceBuffer[k])\n } catch (error) {\n // ignore\n }\n })\n\n if (isMMS(ms)) {\n ms.removeEventListener('startstreaming', this._onStartStreaming)\n ms.removeEventListener('endstreaming', this._onEndStreaming)\n }\n }\n\n if (this.media) {\n this.media.disableRemotePlayback = false\n this.media.removeAttribute('src')\n try {\n this.media.load()\n } catch (error) {\n // ignore\n }\n this.media = null\n }\n\n this.mediaSource = null\n this._openPromise = createPublicPromise()\n this._queue = Object.create(null)\n this._sourceBuffer = Object.create(null)\n }\n\n /**\n * @param { string } type\n * @param { string } mimeType\n */\n createSource (type, mimeType) {\n if (this._sourceBuffer[type] || !this.mediaSource) return\n let sb\n try {\n sb = this._sourceBuffer[type] = this.mediaSource.addSourceBuffer(mimeType)\n } catch (error) {\n throw new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_ADD_SB, error)\n }\n sb.mimeType = mimeType\n sb.addEventListener('updateend', this._onSBUpdateEnd.bind(this, type))\n sb.addEventListener('error', this._onSBUpdateError.bind(this, type))\n }\n\n /**\n * @param { string } type\n * @param { string } mimeType\n * @return { Promise }\n */\n changeType (type, mimeType) {\n const sb = this._sourceBuffer[type]\n if (!this.mediaSource || !sb || sb.mimeType === mimeType) return Promise.resolve()\n\n if (typeof sb.changeType !== 'function') {\n return Promise.reject(\n new StreamingError(\n ERR.MEDIA,\n ERR.SUB_TYPES.MSE_CHANGE_TYPE,\n new Error('changeType is not a function')\n )\n )\n }\n\n return this._enqueueOp(type, () => {\n try {\n sb.changeType(mimeType)\n } catch (e) {\n throw new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_CHANGE_TYPE, e)\n }\n\n sb.mimeType = mimeType\n this._onSBUpdateEnd(type)\n }, 'changeType', {mimeType})\n }\n\n /**\n * @param { string } type\n * @param { string } mimeType\n * @return { Promise }\n */\n createOrChangeSource (type, mimeType) {\n this.createSource(type, mimeType)\n return this.changeType(type, mimeType)\n }\n\n /**\n * @param { string } type\n * @param { BufferSource } buffer\n * @return { Promise }\n */\n append (type, buffer, context) {\n if (!buffer || !buffer.byteLength) {\n return Promise.resolve()\n }\n\n if (!this._sourceBuffer[type]) return Promise.resolve()\n\n return this._enqueueOp(type, () => {\n if (!this.mediaSource || this.media.error) return\n this._logger.debug('MSE APPEND START', context)\n this._opst = nowTime()\n this._sourceBuffer[type]?.appendBuffer(buffer)\n }, OP_NAME.APPEND, context)\n\n }\n\n /**\n * @param { string } type\n * @param { number } startTime\n * @param { number } endTime\n * @return { Promise }\n */\n remove (type, startTime, endTime, context) {\n // if (Object.keys(this._sourceBuffer).length === 1) return Promise.resolve()\n let isInsertHead = false\n if (this._mseFullFlag[type]) {\n isInsertHead = true\n }\n return this._enqueueOp(type, () => {\n if (!this.mediaSource || this.media.error) return\n const sb = this._sourceBuffer[type]\n if (startTime >= endTime || !sb) {\n this._onSBUpdateEnd(type)\n return\n }\n this._opst = nowTime()\n this._logger.debug('MSE REMOVE START', type, startTime, endTime, context)\n sb.remove(startTime, endTime)\n }, OP_NAME.REMOVE, context, isInsertHead)\n }\n\n clearBuffer (startTime, endTime) {\n let p\n Object.keys(this._sourceBuffer).forEach(k => {\n p = this.remove(k, startTime, endTime)\n })\n return p || Promise.resolve()\n }\n\n clearAllBuffer () {\n let p\n Object.keys(this._sourceBuffer).forEach(k => {\n const sb = this._sourceBuffer[k]\n p = this.remove(k, 0, Buffer.end(Buffer.get(sb)))\n })\n return p\n }\n\n clearOpQueues (type, allClear) {\n this._logger.debug('MSE clearOpQueue START')\n const queue = this._queue[type]\n if (allClear && queue) {\n this._queue[type] = []\n return\n }\n if (!queue || !queue[type] || queue.length < 5) return\n const initQueue = []\n queue.forEach(op => {\n if (op.context && op.context.isinit) {\n initQueue.push(op)\n }\n })\n this._queue[type] = queue.slice(0, 2)\n initQueue.length > 0 && this._queue[type].push(...initQueue)\n }\n\n /**\n * @param {EndOfStreamError} [reason]\n * @returns {Promise}\n */\n endOfStream (reason) {\n if (!this.mediaSource || this.mediaSource.readyState !== 'open') return Promise.resolve()\n return this._enqueueBlockingOp(() => {\n const ms = this.mediaSource\n if (!ms || ms.readyState !== 'open') return\n this._logger.debug('MSE endOfStream START')\n if (reason) {\n ms.endOfStream(reason)\n } else {\n ms.endOfStream()\n }\n }, 'endOfStream')\n }\n\n setLiveSeekableRange (start, end) {\n const ms = this.mediaSource\n if (start < 0 || end < start || !ms?.setLiveSeekableRange || ms.readyState !== 'open') return\n ms.setLiveSeekableRange(start, end)\n }\n\n /**\n * @param {string} type\n * @returns {?SourceBuffer}\n */\n getSourceBuffer (type) {\n return this._sourceBuffer[type]\n }\n\n /**\n * @param { string } type\n * @return { TimeRanges | void }\n */\n buffered (type) {\n return Buffer.get(this._sourceBuffer[type])\n }\n\n /**\n * @param { string } type\n * @return { number }\n */\n bufferStart (type) {\n return Buffer.start(this.buffered(type))\n }\n\n /**\n * @param { string } type\n * @return { number }\n */\n bufferEnd (type) {\n return Buffer.end(this.buffered(type))\n }\n\n _enqueueOp (type, exec, opName, context, isInsertHead) {\n if (!this.mediaSource) return Promise.resolve()\n const queue = this._queue[type] = this._queue[type] || []\n const op = {\n exec,\n promise: createPublicPromise(),\n opName,\n context\n }\n\n if (isInsertHead) {\n queue.splice(0, 0, op)\n this._mseFullFlag[type] = false\n this._startQueue(type)\n } else {\n queue.push(op)\n }\n\n if (this.isOpened || this.isEnded) {\n if (queue.length === 1) {\n this._startQueue(type)\n }\n } else {\n this._openPromise.then(() => {\n if (queue.length === 1) {\n this._startQueue(type)\n }\n })\n }\n\n\n return op.promise\n }\n\n async _enqueueBlockingOp (exec, opName, context) {\n if (!this.mediaSource) return Promise.resolve()\n const types = Object.keys(this._sourceBuffer)\n if (!types.length) {\n return exec()\n }\n\n const waiters = []\n types.forEach(t => {\n const queue = this._queue[t]\n const prom = createPublicPromise()\n waiters.push(prom)\n queue.push({exec: () => {\n prom.resolve()}, promise: prom, opName, context})\n if (queue.length === 1) {\n this._startQueue(t)\n }\n })\n\n return Promise.all(waiters).then(() => {\n try {\n return exec()\n } finally {\n types.forEach(t => {\n const queue = this._queue[t]\n const sb = this._sourceBuffer[t]\n queue?.shift()\n if (!sb || !sb.updating) {\n this._startQueue(t)\n }\n })\n }\n })\n }\n\n _startQueue (type) {\n const queue = this._queue[type]\n if (queue) {\n const op = queue[0]\n if (op && !this._mseFullFlag[type]) {\n try {\n op.exec()\n } catch (error) {\n if (error && error.message && error.message.indexOf('SourceBuffer is full') >= 0) {\n this._mseFullFlag[type] = true\n if (op.context && typeof op.context === 'object'){\n op.context.isFull = true\n }\n this._logger.error('[MSE error], context,', op.context, ' ,name,', op.opName, ',err,SourceBuffer is full')\n op.promise.reject(new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_FULL, error))\n } else {\n this._logger.error(error)\n op.promise.reject(\n error.constructor === StreamingError\n ? error\n : new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_OTHER, error)\n )\n queue.shift()\n this._startQueue(type)\n }\n }\n }\n }\n }\n\n _onSBUpdateEnd = (type) => {\n const queue = this._queue[type]\n if (queue) {\n const op = queue[0]\n if (!(op?.opName === OP_NAME.UPDATE_DURATION)) {\n queue.shift()\n }\n if (op) {\n const costtime = nowTime() - this._opst\n this._logger.debug(`UpdateEnd(${type}/${op.opName})`, SafeJSON.stringify(getTimeRanges(this._sourceBuffer[type]?.buffered)), costtime, op.context)\n op.promise.resolve({name: op.opName, context: op.context, costtime})\n const callback = op.context?.callback\n if (callback && typeof callback === 'function'){\n callback(op.context)\n }\n this._startQueue(type)\n }\n }\n }\n\n _onSBUpdateError = (type, event) => {\n const queue = this._queue[type]\n if (queue) {\n const op = queue[0]\n if (op) {\n this._logger.error('UpdateError', type, op.opName, op.context)\n op.promise.reject(new StreamingError(ERR.MEDIA, ERR.SUB_TYPES.MSE_APPEND_BUFFER, event))\n // Do not shift from queue, 'updateend' event will fire next\n }\n }\n }\n\n setTimeoffset (type, timestampOffset, context) {\n return this._enqueueOp(type, () => {\n if (timestampOffset < 0) {\n timestampOffset += 0.001\n }\n this._sourceBuffer[type].timestampOffset = timestampOffset\n this._onSBUpdateEnd(type)\n }, 'setTimeoffset', context)\n }\n\n /** *重置decode时间戳 */\n abort (type, context) {\n if (!this.isOpened) {\n return Promise.resolve()\n }\n return this._enqueueOp(type, () => {\n this._sourceBuffer[type].abort()\n this._onSBUpdateEnd(type)\n }, 'abort', context)\n }\n}\n","export const LoaderType = {\n FETCH: 'fetch',\n XHR: 'xhr'\n}\n\nexport const ResponseType = {\n ARRAY_BUFFER: 'arraybuffer',\n TEXT: 'text',\n JSON: 'json'\n}\n","import { LoaderType } from './types'\n\nexport class NetError extends Error {\n retryCount = 0\n isTimeout = false\n loaderType = LoaderType.FETCH\n startTime = 0\n endTime = 0\n options = {}\n\n constructor (url, request, response, msg) {\n super(msg)\n this.url = url\n this.request = request\n this.response = response\n }\n}\n","const toString = Object.prototype.toString\n\nexport function isObject (a) {\n return a !== null && typeof a === 'object'\n}\n\nexport function isPlainObject (val) {\n if (toString.call(val) !== '[object Object]') {\n return false\n }\n\n const prototype = Object.getPrototypeOf(val)\n return prototype === null || prototype === Object.prototype\n}\n\nexport function isDate (a) {\n return toString.call(a) === '[object Date]'\n}\n\nexport function isNumber (n) {\n return typeof n === 'number' && !Number.isNaN(n)\n}\n","import { isDate, isObject } from '../is'\n\nexport function getRangeValue (value) {\n if (!value || value[0] === null || value[0] === undefined || (value[0] === 0 && (value[1] === null || value[1] === undefined))) {\n return\n }\n let ret = 'bytes=' + value[0] + '-'\n if (value[1]) ret += value[1]\n return ret\n}\n\nfunction encode (val) {\n return encodeURIComponent(val)\n .replace(/%3A/gi, ':')\n .replace(/%24/g, '$')\n .replace(/%2C/gi, ',')\n .replace(/%20/g, '+')\n .replace(/%5B/gi, '[')\n .replace(/%5D/gi, ']')\n}\n\nexport function setUrlParams (url, params) {\n if (!url) return\n if (!params) return url\n let v\n const str = Object.keys(params).map(k => {\n v = params[k]\n if (v === null || v === undefined) return\n if (Array.isArray(v)) {\n k = k + '[]'\n } else {\n v = [v]\n }\n\n return v.map(x => {\n if (isDate(x)) {\n x = x.toISOString()\n } else if (isObject(x)) {\n x = JSON.stringify(x)\n }\n return `${encode(k)}=${encode(x)}`\n }).join('&')\n }).filter(Boolean).join('&')\n\n if (str) {\n const hashIndex = url.indexOf('#')\n if (hashIndex !== -1) {\n url = url.slice(0, hashIndex)\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + str\n }\n\n return url\n}\n\nexport function createResponse (\n data,\n done,\n response,\n contentLength,\n age,\n startTime,\n firstByteTime,\n index,\n range,\n vid,\n priOptions\n) {\n age = (age !== null && age !== undefined) ? parseFloat(age) : null\n contentLength = parseInt(contentLength || '0', 10)\n if (Number.isNaN(contentLength)) contentLength = 0\n const options = { range, vid, index, contentLength, age, startTime, firstByteTime, endTime: Date.now(), priOptions }\n return { data, done, options, response }\n}\n\nexport function calculateSpeed (byteLen, milliSecond) {\n return Math.round(byteLen * 8 * 1000 / milliSecond / 1024) // Kb/s\n}\n","export const EVENT = {\n ERROR: 'error',\n\n TTFB: 'core.ttfb',\n LOAD_START: 'core.loadstart',\n LOAD_RESPONSE_HEADERS: 'core.loadresponseheaders',\n LOAD_COMPLETE: 'core.loadcomplete',\n LOAD_RETRY: 'core.loadretry',\n SOURCEBUFFER_CREATED: 'core.sourcebuffercreated',\n MEDIASOURCE_OPENED: 'core.mediasourceopened',\n ANALYZE_DURATION_EXCEEDED: 'core.analyzedurationexceeded',\n APPEND_BUFFER: 'core.appendbuffer',\n REMOVE_BUFFER: 'core.removebuffer',\n BUFFEREOS: 'core.buffereos',\n KEYFRAME: 'core.keyframe',\n CHASEFRAME: 'core.chaseframe',\n METADATA_PARSED: 'core.metadataparsed',\n SEI: 'core.sei',\n SEI_IN_TIME: 'core.seiintime',\n FLV_SCRIPT_DATA: 'core.flvscriptdata',\n LOWDECODE: 'core.lowdecode',\n SWITCH_URL_SUCCESS: 'core.switchurlsuccess',\n SWITCH_URL_FAILED: 'core.switchurlfailed',\n SPEED: 'core.speed',\n HLS_MANIFEST_LOADED: 'core.hlsmanifestloaded',\n HLS_LEVEL_LOADED: 'core.hlslevelloaded',\n DEMUXED_TRACK:'core.demuxedtrack',\n\n STREAM_EXCEPTION: 'core.streamexception',\n LARGE_AV_FIRST_FRAME_GAP_DETECT: 'LARGE_AV_FIRST_FRAME_GAP_DETECT',\n LARGE_VIDEO_DTS_GAP_DETECT: 'LARGE_VIDEO_DTS_GAP_DETECT',\n LARGE_AUDIO_DTS_GAP_DETECT: 'LARGE_AUDIO_DTS_GAP_DETECT',\n AUDIO_GAP_DETECT: 'AUDIO_GAP_DETECT',\n AUDIO_OVERLAP_DETECT: 'AUDIO_OVERLAP_DETECT',\n MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT: 'MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT',\n REAL_TIME_SPEED: 'real_time_speed'\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","import { NetError } from './error'\nimport { createResponse, getRangeValue, setUrlParams, calculateSpeed } from './helper'\nimport { ResponseType } from './types'\nimport { EVENT } from '../event'\nimport EventEmitter from 'eventemitter3'\nconst CACHESIZE = 2 * 1024 * 1024\nexport class FetchLoader extends EventEmitter {\n _abortController = null\n _timeoutTimer = null\n _reader = null\n _response = null\n _aborted = false\n _index = -1\n _range = null\n _receivedLength = 0\n _running = false\n _logger = null\n _vid = ''\n _onProcessMinLen = 0\n _onCancel = null\n _priOptions = null // 比较私有化的参数传递,回调时候透传\n\n constructor () {\n super()\n }\n\n load ({\n url,\n vid,\n timeout, // ms\n responseType,\n onProgress,\n index,\n onTimeout,\n onCancel,\n range,\n transformResponse,\n request,\n params,\n logger,\n\n method,\n headers,\n body,\n mode,\n credentials,\n cache,\n redirect,\n referrer,\n referrerPolicy,\n onProcessMinLen,\n priOptions\n }) {\n this._logger = logger\n this._aborted = false\n this._onProcessMinLen = onProcessMinLen\n this._onCancel = onCancel\n this._abortController = typeof AbortController !== 'undefined' && new AbortController()\n this._running = true\n this._index = index\n this._range = range || [0, 0]\n this._vid = vid || url\n this._priOptions = priOptions || {}\n const init = {\n method,\n headers,\n body,\n mode,\n credentials,\n cache,\n redirect,\n referrer,\n referrerPolicy,\n signal: this._abortController?.signal\n }\n\n let isTimeout = false\n clearTimeout(this._timeoutTimer)\n\n url = setUrlParams(url, params)\n\n const rangeValue = getRangeValue(range)\n if (rangeValue) {\n if (request) {\n headers = request.headers\n } else {\n headers = init.headers = init.headers || (Headers ? new Headers() : {})\n }\n if (Headers && headers instanceof Headers) {\n headers.append('Range', rangeValue)\n } else {\n headers.Range = rangeValue\n }\n }\n\n if (timeout) {\n this._timeoutTimer = setTimeout(() => {\n isTimeout = true\n this.cancel()\n if (onTimeout) {\n const error = new NetError(url, init, null, 'timeout')\n error.isTimeout = true\n onTimeout(error, {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions})\n }\n }, timeout)\n }\n\n const startTime = Date.now()\n this._logger.debug('[fetch load start], index,', index, ',range,', range)\n return new Promise((resolve, reject) => {\n fetch(request || url, request ? undefined : init).then(async (response) => {\n clearTimeout(this._timeoutTimer)\n this._response = response\n if (this._aborted || !this._running) return\n if (transformResponse) {\n response = transformResponse(response, url) || response\n }\n if (!response.ok) {\n throw new NetError(url, init, response, 'bad network response')\n }\n\n const firstByteTime = Date.now()\n let data\n if (responseType === ResponseType.TEXT) {\n data = await response.text()\n this._running = false\n } else if (responseType === ResponseType.JSON) {\n data = await response.json()\n this._running = false\n } else {\n if (onProgress) {\n this.resolve = resolve\n this.reject = reject\n this._loadChunk(response, onProgress, startTime, firstByteTime)\n return\n } else {\n data = await response.arrayBuffer()\n data = new Uint8Array(data)\n this._running = false\n const costTime = Date.now() - startTime\n const speed = calculateSpeed(data.byteLength, costTime)\n this.emit(EVENT.REAL_TIME_SPEED, {speed,len: data.byteLength, time: costTime, vid: this._vid, index: this._index, range: this._range, priOptions: this._priOptions})\n }\n }\n this._logger.debug('[fetch load end], index,', index, ',range,', range)\n resolve(createResponse(\n data,\n true,\n response,\n response.headers.get('Content-Length'),\n response.headers.get('age'),\n startTime,\n firstByteTime,\n index,\n range,\n this._vid,\n this._priOptions\n ))\n }).catch((error) => {\n clearTimeout(this._timeoutTimer)\n this._running = false\n if (this._aborted && !isTimeout) return\n error = error instanceof NetError ? error : new NetError(url, init, null, error?.message)\n error.startTime = startTime\n error.endTime = Date.now()\n error.isTimeout = isTimeout\n error.options = {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions}\n reject(error)\n })\n })\n }\n\n async cancel () {\n if (this._aborted) return\n this._aborted = true\n this._running = false\n if (this._response) {\n try {\n // await this._response.body.cancel()\n if (this._reader) {\n await this._reader.cancel()\n }\n } catch (error) {\n // ignore\n }\n this._response = this._reader = null\n }\n\n if (this._abortController) {\n try {\n this._abortController.abort()\n } catch (error) {\n // ignore\n }\n this._abortController = null\n }\n if (this._onCancel) {\n this._onCancel({index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions})\n }\n }\n\n _loadChunk (response, onProgress, st, firstByteTime) {\n if (!response.body || !response.body.getReader) {\n this._running = false\n const err = new NetError(response.url, '', response, 'onProgress of bad response.body.getReader')\n err.options = {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions}\n this.reject(err)\n return\n }\n if (this._onProcessMinLen > 0) {\n this._cache = new Uint8Array(CACHESIZE)\n this._writeIdx = 0\n }\n const reader = this._reader = response.body.getReader()\n let data\n\n let startTime\n let endTime\n const pump = async () => {\n startTime = Date.now()\n try {\n data = await reader.read()\n endTime = Date.now()\n } catch (e) {\n // request aborted\n endTime = Date.now()\n if (!this._aborted) {\n this._running = false\n e.options = {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions}\n this.reject(e)\n }\n return\n }\n const startRange = this._range?.length > 0 ? this._range[0] : 0\n const startByte = startRange + this._receivedLength\n if (this._aborted) {\n this._running = false\n onProgress(undefined, false, { range: [startByte, startByte], vid: this._vid, index: this._index, startTime, endTime, st, firstByteTime, priOptions:this._priOptions }, response)\n return\n }\n const curLen = data.value ? data.value.byteLength : 0\n this._receivedLength += curLen\n this._logger.debug('【fetchLoader,onProgress call】,task,', this._range, ', start,', startByte, ', end,', startRange + this._receivedLength, ', done,', data.done)\n let retData\n if (this._onProcessMinLen > 0) {\n if (this._writeIdx + curLen >= this._onProcessMinLen || data.done) {\n retData = new Uint8Array(this._writeIdx + curLen)\n retData.set(this._cache.slice(0, this._writeIdx), 0)\n curLen > 0 && retData.set(data.value, this._writeIdx)\n this._writeIdx = 0\n this._logger.debug('【fetchLoader,onProgress enough】,done,', data.done, ',len,', retData.byteLength, ', writeIdx,', this._writeIdx)\n } else {\n if (curLen > 0 && this._writeIdx + curLen < CACHESIZE) {\n this._cache.set(data.value, this._writeIdx)\n this._writeIdx += curLen\n this._logger.debug('【fetchLoader,onProgress cache】,len,', curLen, ', writeIdx,', this._writeIdx)\n } else if (curLen > 0) {\n const temp = new Uint8Array(this._writeIdx + curLen + 2048)\n this._logger.debug('【fetchLoader,onProgress extra start】,size,', this._writeIdx + curLen + 2048, ', datalen,', curLen, ', writeIdx,', this._writeIdx)\n temp.set(this._cache.slice(0, this._writeIdx), 0)\n curLen > 0 && temp.set(data.value, this._writeIdx)\n this._writeIdx += curLen\n delete this._cache\n this._cache = temp\n this._logger.debug('【fetchLoader,onProgress extra end】,len,', curLen, ', writeIdx,', this._writeIdx)\n }\n }\n } else {\n retData = data.value\n }\n if (retData && retData.byteLength > 0 || data.done) {\n onProgress(retData, data.done, {\n range: [this._range[0] + this._receivedLength - (retData ? retData.byteLength : 0), this._range[0] + this._receivedLength],\n vid: this._vid,\n index: this._index,\n startTime,\n endTime,\n st,\n firstByteTime,\n priOptions:this._priOptions\n }, response)\n }\n if (!data.done) {\n pump()\n } else {\n const costTime = Date.now() - st\n const speed = calculateSpeed(this._receivedLength, costTime)\n this.emit(EVENT.REAL_TIME_SPEED, {speed,len: this._receivedLength, time: costTime, vid: this._vid, index: this._index, range: this._range, priOptions: this._priOptions})\n this._running = false\n this._logger.debug('[fetchLoader onProgress end],task,', this._range, ',done,', data.done)\n this.resolve(createResponse(\n data,\n true,\n response,\n response.headers.get('Content-Length'),\n response.headers.get('age'),\n st,\n firstByteTime,\n this._index,\n this._range,\n this._vid,\n this._priOptions\n ))\n }\n }\n pump()\n }\n\n get receiveLen () {\n return this._receivedLength\n }\n\n get running () {\n return this._running\n }\n\n set running (status) {\n this._running = status\n }\n\n static isSupported () {\n return !!(typeof fetch !== 'undefined')\n }\n}\n","import { NetError } from './error'\nimport { createResponse, getRangeValue, setUrlParams, calculateSpeed } from './helper'\nimport { ResponseType } from './types'\nimport { EVENT } from '../event'\nimport EventEmitter from 'eventemitter3'\nexport class XhrLoader extends EventEmitter {\n\n _xhr = null\n _aborted = false\n _timeoutTimer = null\n _range = null\n _receivedLength = 0\n _url = null\n _onProgress = null\n _index = -1\n _headers = null\n // _chunkSizeKBList = [\n // 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 5120, 6144, 7168, 8192\n // ]\n\n _currentChunkSizeKB = 384\n _timeout = null\n _xhr = null\n _withCredentials = null\n _startTime = -1\n // _speedSampler = new SpeedSampler()\n _loadCompleteResolve = null\n _loadCompleteReject = null\n _runing = false\n _logger = false\n _vid = ''\n _responseType\n _credentials\n _method\n _transformResponse\n _firstRtt\n _onCancel = null\n _priOptions = null // 比较私有化的参数传递,回调时候透传\n\n\n constructor () {\n super()\n }\n\n load (req) {\n clearTimeout(this._timeoutTimer)\n this._logger = req.logger\n this._range = req.range\n this._onProgress = req.onProgress\n this._index = req.index\n this._headers = req.headers\n this._withCredentials = req.credentials === 'include' || req.credentials === 'same-origin'\n this._body = req.body || null\n req.method && (this._method = req.method)\n this._timeout = req.timeout || null\n this._runing = true\n this._vid = req.vid || req.url\n this._responseType = req.responseType\n this._firstRtt = -1\n this._onTimeout = req.onTimeout\n this._onCancel = req.onCancel\n this._request = req.request\n this._priOptions = req.priOptions || {}\n this._logger.debug('【xhrLoader task】, range', this._range)\n\n this._url = setUrlParams(req.url, req.params)\n\n const startTime = Date.now()\n return new Promise((resolve, reject) => {\n this._loadCompleteResolve = resolve\n this._loadCompleteReject = reject\n this._startLoad()\n }).catch((error) => {\n clearTimeout(this._timeoutTimer)\n this._runing = false\n if (this._aborted) return\n error = error instanceof NetError ? error : new NetError(this._url, this._request)\n error.startTime = startTime\n error.endTime = Date.now()\n error.options = {index: this._index, vid: this._vid, priOptions: this._priOptions}\n throw error\n })\n }\n\n _startLoad () {\n let range = null\n if (this._responseType === ResponseType.ARRAY_BUFFER && this._range && this._range.length > 1) {\n if (this._onProgress) {\n this._firstRtt = -1\n const chunkSize = this._currentChunkSizeKB * 1024\n const from = this._range[0] + this._receivedLength\n let to = this._range[1]\n if (chunkSize < this._range[1] - from) {\n to = from + chunkSize\n }\n range = [from, to]\n this._logger.debug('[xhr_loader->],tast :', this._range, ', SubRange, ', range)\n } else {\n range = this._range\n this._logger.debug('[xhr_loader->],tast :', this._range, ', allRange, ', range)\n }\n }\n this._internalOpen(range)\n }\n\n _internalOpen (range) {\n try {\n this._startTime = Date.now()\n const xhr = this._xhr = new XMLHttpRequest()\n xhr.open(this._method || 'GET', this._url, true)\n xhr.responseType = this._responseType\n this._timeout && (xhr.timeout = this._timeout)\n xhr.withCredentials = this._withCredentials\n xhr.onload = this._onLoad.bind(this)\n xhr.onreadystatechange = this._onReadyStatechange.bind(this)\n xhr.onerror = (errorEvent) => {\n this._running = false\n const error = new NetError(this._url, this._request, errorEvent?.currentTarget?.response, ('xhr.onerror.status:' + errorEvent?.currentTarget?.status + ',statusText,' + errorEvent?.currentTarget?.statusText))\n error.options = {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions}\n this._loadCompleteReject(error)\n }\n xhr.ontimeout = (event) => {\n this.cancel()\n const error = new NetError(this._url, this._request, {status:408}, 'timeout')\n if (this._onTimeout) {\n error.isTimeout = true\n this._onTimeout(error,{index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions})\n }\n error.options = {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions}\n this._loadCompleteReject(error)\n }\n const headers = this._headers || {}\n const rangeValue = getRangeValue(range)\n if (rangeValue) {\n headers.Range = rangeValue\n }\n if (headers) {\n Object.keys(headers).forEach(k => {\n xhr.setRequestHeader(k, headers[k])\n })\n }\n this._logger.debug('[xhr.send->] tast,', this._range, ',load sub range, ', range)\n xhr.send(this._body)\n } catch (e) {\n e.options = {index: this._index, range, vid: this._vid, priOptions: this._priOptions}\n this._loadCompleteReject(e)\n }\n }\n\n _onReadyStatechange (e) {\n const xhr = e.target\n if (xhr.readyState === 2) {\n this._firstRtt < 0 && (this._firstRtt = Date.now())\n }\n }\n\n _onLoad (e) {\n const status = e.target.status\n if (status < 200 || status > 299) {\n const error = new NetError(this._url, null, { ...e.target.response, status }, 'bad response,status:' + status)\n error.options = {index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions}\n return this._loadCompleteReject(error)\n }\n let data = null\n let done = false\n let byteStart\n const startRange = (this._range?.length > 0 ? this._range [0] : 0 )\n if (this._responseType === ResponseType.ARRAY_BUFFER) {\n const chunk = new Uint8Array(e.target.response)\n byteStart = startRange + this._receivedLength\n if (chunk && chunk.byteLength > 0) {\n this._receivedLength += chunk.byteLength\n const costTime = Date.now() - this._startTime\n const speed = calculateSpeed(this._receivedLength, costTime)\n this.emit(EVENT.REAL_TIME_SPEED, {speed, len: this._receivedLength, time: costTime, vid: this._vid, index: this._index, range: [byteStart, startRange + this._receivedLength], priOptions: this._priOptions})\n }\n data = chunk\n if (this._range?.length > 1 && this._range[1] && this._receivedLength < this._range[1] - this._range[0]) {\n done = false\n } else {\n done = true\n }\n this._logger.debug('[xhr load done->], tast :', this._range, ', start', byteStart, 'end ', startRange + this._receivedLength, ',dataLen,', (chunk ? chunk.byteLength : 0), ',receivedLength', this._receivedLength, ',index,', this._index, ', done,', done)\n } else {\n done = true\n data = e.target.response\n }\n let response = {\n ok: status >= 200 && status < 300,\n status,\n statusText: this._xhr.statusText,\n url: this._xhr.responseURL,\n headers: this._getHeaders(this._xhr),\n body: this._xhr.response\n }\n if (this._transformResponse) {\n response = this._transformResponse(response, this._url) || response\n }\n if (this._onProgress) {\n this._onProgress(data, done, { index: this._index, vid: this._vid, range: [byteStart, startRange + this._receivedLength], startTime: this._startTime, endTime: Date.now(), priOptions: this._priOptions }, response)\n }\n\n if (!done) {\n this._startLoad()\n } else {\n this._runing = false\n this._loadCompleteResolve && this._loadCompleteResolve(createResponse(\n this._onProgress ? null : data,\n done,\n response,\n response.headers['content-length'],\n response.headers.age,\n this._startTime,\n this._firstRtt,\n this._index,\n this._range,\n this._vid,\n this._priOptions\n ))\n }\n }\n\n cancel () {\n if (this._aborted) return\n this._aborted = true\n this._runing = false\n super.removeAllListeners()\n if (this._onCancel) {\n this._onCancel({index: this._index, range: this._range, vid: this._vid, priOptions: this._priOptions})\n }\n if (this._xhr) {\n return this._xhr.abort()\n }\n }\n\n static isSupported () {\n return typeof XMLHttpRequest !== 'undefined'\n }\n\n get receiveLen () {\n return this._receivedLength\n }\n\n get running () {\n return this._running\n }\n\n set running (status) {\n this._running = status\n }\n\n _getHeaders (xhr) {\n const headerLines = xhr.getAllResponseHeaders().trim().split('\\r\\n')\n const headers = {}\n for (const header of headerLines) {\n const parts = header.split(': ')\n headers[parts[0].toLowerCase()] = parts.slice(1).join(': ')\n }\n return headers\n }\n}\n","import { FetchLoader } from './fetch'\nimport { XhrLoader } from './xhr'\nimport { LoaderType } from './types'\nimport { createPublicPromise } from '../utils'\nimport { Logger } from '../logger'\n\nexport class Task {\n constructor (type, config) {\n this.promise = createPublicPromise()\n this.alive = !!config.onProgress\n !config.logger && (config.logger = new Logger('Loader'))\n this._loaderType = type\n this._loader = type === LoaderType.FETCH && typeof fetch !== 'undefined' ? new FetchLoader() : new XhrLoader()\n this._config = config\n this._retryCount = 0\n this._retryTimer = null\n this._canceled = false\n this._retryCheckFunc = config.retryCheckFunc\n this._logger = config.logger\n }\n\n exec () {\n const {\n retry,\n retryDelay,\n onRetryError,\n transformError,\n ...rest\n } = this._config\n\n const request = async () => {\n try {\n const response = await this._loader.load(rest)\n this.promise.resolve(response)\n } catch (e) {\n this._loader.running = false\n this._logger.debug('[task request catch err]', e)\n if (this._canceled) return\n\n e.loaderType = this._loaderType\n e.retryCount = this._retryCount\n\n let error = e\n if (transformError) {\n error = transformError(error) || error\n }\n\n if (onRetryError && this._retryCount > 0) onRetryError(error, this._retryCount, {index: rest.index, vid: rest.vid, range: rest.range, priOptions: rest.priOptions})\n\n this._retryCount++\n let isRetry = true\n if (this._retryCheckFunc) {\n isRetry = this._retryCheckFunc(e)\n }\n if (isRetry && this._retryCount <= retry) {\n clearTimeout(this._retryTimer)\n this._logger.debug('[task request setTimeout],retry', this._retryCount, ',retry range,', rest.range)\n this._retryTimer = setTimeout(request, retryDelay)\n return\n }\n this.promise.reject(error)\n }\n }\n\n request()\n return this.promise\n }\n\n async cancel () {\n clearTimeout(this._retryTimer)\n this._canceled = true\n this._loader.running = false\n return this._loader.cancel()\n }\n\n get running () {\n return this._loader && this._loader.running\n }\n\n get loader () {\n return this._loader\n }\n}\n","export function isMediaPlaying (media) {\n return media && !media.paused && !media.ended && media.playbackRate !== 0 && media.readyState !== 0\n}\n\nexport function getVideoPlaybackQuality (video) {\n if (!video) return {}\n if (typeof video.getVideoPlaybackQuality === 'function') {\n const info = video.getVideoPlaybackQuality()\n return {\n droppedVideoFrames: info.droppedVideoFrames || info.corruptedVideoFrames,\n totalVideoFrames: info.totalVideoFrames,\n creationTime: info.creationTime\n }\n }\n\n return {\n droppedVideoFrames: video.webkitDroppedFrameCount,\n totalVideoFrames: video.webkitDecodedFrameCount,\n creationTime: performance.now()\n }\n}\n\n/**\n * @param {Array.} arr\n * @returns\n */\nexport function concatUint8Array (...arr) {\n arr = arr.filter(Boolean)\n if (arr.length < 2) return arr[0]\n const data = new Uint8Array(arr.reduce((p, c) => p + c.byteLength, 0))\n let prevLen = 0\n arr.forEach((d) => {\n data.set(d, prevLen)\n prevLen += d.byteLength\n })\n return data\n}\n\nexport function sleep (t = 0) {\n return new Promise((resolve) => setTimeout(resolve, t))\n}\n","import { FetchLoader } from './fetch'\nimport { LoaderType, ResponseType } from './types'\nimport { getConfig } from './config'\nimport { Task } from './task'\nimport { isPlainObject } from '../is'\nimport { sleep } from '../streaming-helper'\nimport { EVENT } from '../event'\nimport EventEmitter from 'eventemitter3'\n\nexport {\n LoaderType,\n ResponseType\n}\n\nexport class NetLoader extends EventEmitter {\n type = LoaderType.FETCH\n\n _queue = []\n\n _alive = []\n\n _currentTask = null\n\n _finnalUrl = ''\n\n _config\n\n constructor (cfg) {\n super(cfg)\n this._config = getConfig(cfg)\n if (\n this._config.loaderType === LoaderType.XHR ||\n !FetchLoader.isSupported()\n ) {\n this.type = LoaderType.XHR\n }\n this.log = cfg.logger\n }\n\n isFetch () {\n return this.type === LoaderType.FETCH\n }\n\n static isFetchSupport () {\n return FetchLoader.isSupported()\n }\n\n load (url, config = {}) {\n if (typeof url === 'string' || !url) {\n config.url = url || config.url || this._config.url\n } else {\n config = url\n }\n\n config = Object.assign({}, this._config, config)\n\n if (config.params) config.params = Object.assign({}, config.params)\n if (config.headers && isPlainObject(config.headers)) config.headers = Object.assign({}, config.headers)\n if (config.body && isPlainObject(config.body)) config.body = Object.assign({}, config.body)\n\n if (config.transformRequest) {\n config = config.transformRequest(config) || config\n }\n config.logger = this.log\n\n const task = new Task(this.type, config)\n task.loader.on(EVENT.REAL_TIME_SPEED, (data) => {\n this.emit(EVENT.REAL_TIME_SPEED, data)\n })\n this._queue.push(task)\n if (this._queue.length === 1 && (!this._currentTask || !this._currentTask.running)) {\n this._processTask()\n }\n\n return task.promise\n }\n\n async cancel () {\n const cancels = this._queue.map(t => t.cancel()).concat(this._alive.map(t => t.cancel()))\n if (this._currentTask) {\n cancels.push(this._currentTask.cancel())\n }\n this._queue = []\n this._alive = []\n await Promise.all(cancels)\n await sleep()\n }\n\n _processTask () {\n this._currentTask = this._queue.shift()\n if (!this._currentTask) return\n\n if (this._currentTask.alive) {\n this._alive.push(this._currentTask)\n }\n const req = this._currentTask.exec().catch(e => {})\n\n if (!(req && typeof req.finally === 'function')) return\n\n req.finally(() => {\n if (this._currentTask?.alive && this._alive?.length > 0) {\n this._alive = this._alive.filter(task => task && task !== this._currentTask)\n }\n this._processTask()\n })\n\n }\n}\n","import { LoaderType, ResponseType } from './types'\n\nexport function getConfig (cfg) {\n return {\n loaderType: LoaderType.FETCH,\n retry: 0,\n retryDelay: 0, // ms\n timeout: 0,\n request: null, // Request\n onTimeout: undefined,\n onProgress: undefined,\n onRetryError: undefined,\n transformRequest: undefined,\n transformResponse: undefined,\n transformError: undefined,\n responseType: ResponseType.TEXT,\n range: undefined,\n url: '',\n params: undefined,\n method: 'GET',\n headers: {},\n body: undefined,\n mode: undefined,\n credentials: undefined,\n cache: undefined,\n redirect: undefined,\n referrer: undefined,\n referrerPolicy: undefined,\n integrity: undefined,\n onProcessMinLen: 0,\n ...cfg\n }\n}\n","import { Buffer } from '../buffer'\n\nexport class GapService {\n _prevCurrentTime = 0\n\n do (media, maxJumpDistance = 3, isLive, seekThreshold = 1) {\n if (!media) return\n\n const currentTime = media.currentTime\n let jumpTo = 0\n\n if (this._prevCurrentTime === currentTime) {\n const info = Buffer.info(Buffer.get(media), currentTime)\n if (!info.buffers.length) return\n if (\n (isLive && info.nextStart) ||\n (info.nextStart && info.nextStart - currentTime < maxJumpDistance)\n ) {\n jumpTo = info.nextStart + 0.1\n } else if (info.end && info.end - currentTime > seekThreshold && !media.seeking) {\n jumpTo = currentTime + 0.1\n }\n }\n\n this._prevCurrentTime = currentTime\n\n if (jumpTo && currentTime !== jumpTo) {\n media.currentTime = jumpTo\n }\n }\n}\n","import { EVENT } from '../event'\n\nexport class SeiService {\n _seiSet = new Set()\n\n constructor (emitter) {\n this.emitter = emitter\n\n emitter.on(EVENT.SEI, sei => {\n if (sei) this._seiSet.add(sei)\n })\n }\n\n throw (currentTime, isLive) {\n if (currentTime === null || currentTime === undefined || !this._seiSet.size) return\n const min = currentTime - 0.2\n const max = currentTime + 0.2\n const toThrow = []\n this._seiSet.forEach(sei => {\n if (sei.time >= min && sei.time <= max) {\n toThrow.push(sei)\n }\n })\n\n toThrow.forEach(sei => {\n this._seiSet.delete(sei)\n this.emitter.emit(EVENT.SEI_IN_TIME, sei)\n })\n\n if (!isLive) return\n\n this._seiSet.forEach(s => {\n if (s.time < currentTime - 5) {\n this._seiSet.delete(s)\n }\n })\n }\n\n reset () {\n this._seiSet.clear()\n }\n}\n","\n\nconst SKIP_SMALL_CHUNK = 1000\nconst MAX_CHUNK_SAVE_SIZE = 50\nconst MAX_SEGMENT_SAVE_SIZE = 3\nconst LONGTIME_NO_RECEIVE = 3000\n\nexport class BandwidthService {\n _chunkSpeed = 0 // bps\n _chunkCache = []\n _speeds = [] // bps\n _totalSize = 0\n _totalCost = 0\n\n /**\n * @typedef {{\n * chunkCountForSpeed?: number,\n * skipChunkSize?: number,\n * longtimeNoReceived?: number\n * }} Opts\n *\n * @param {Opts} opts\n */\n constructor (opts) {\n this._opts = opts || {}\n }\n\n addRecord (totalByte, ms) {\n if (!totalByte || !ms) return\n this._speeds.push(8000 * totalByte / ms)\n this._speeds = this._speeds.slice(-MAX_SEGMENT_SAVE_SIZE)\n }\n\n addChunkRecord (totalByte, ms) {\n if (!totalByte || !ms || totalByte < (this._opts?.skipChunkSize || SKIP_SMALL_CHUNK)) return\n\n this._totalSize += totalByte\n this._totalCost += ms\n\n this._chunkSpeed = 8000 * totalByte / ms\n this._chunkCache.push({\n size: totalByte,\n duration: ms,\n timestamp: performance.now()\n })\n\n const size = this._opts?.chunkCountForSpeed || MAX_CHUNK_SAVE_SIZE\n\n if (this._chunkCache.length > size) {\n this._chunkCache = this._chunkCache.slice(-size)\n }\n }\n\n /**\n *\n * @returns { number }\n */\n getAvgSpeed () {\n if (!this._chunkCache.length && !this._speeds.length) return 0\n if (this._speeds.length) {\n return this._speeds.reduce((a, c) => (a += c)) / this._speeds.length\n }\n\n // for long time no chunk received, append 0 size chunk\n const lastSample = this._chunkCache[this._chunkCache.length - 1]\n const cost = performance.now() - lastSample.timestamp\n if ( cost > (this._opts?.longtimeNoReceived || LONGTIME_NO_RECEIVE)) {\n this._chunkCache.push({\n size: 0,\n duration: cost,\n timestamp: performance.now()\n })\n }\n\n const totalSize = this._chunkCache.reduce((a, c) => a += c.size, 0)\n const totalDuration = this._chunkCache.reduce((a, c) => a += c.duration, 0)\n return 8000 * totalSize / totalDuration\n }\n\n /**\n *\n * @returns { number }\n */\n getLatestSpeed () {\n if (!this._chunkCache.length && !this._speeds.length) return 0\n if (this._speeds.length) {\n return this._speeds[this._speeds.length - 1]\n }\n return this._chunkSpeed\n }\n\n /**\n *\n * @returns { number }\n */\n getTotalSize () {\n return this._totalSize\n }\n\n /**\n *\n * @returns { number }\n */\n getTotalCost () {\n return this._totalCost\n }\n\n reset () {\n this._chunkCache = []\n this._speeds = []\n this._totalSize = 0\n this._totalCost = 0\n }\n}\n\n","import { EVENT } from 'xgplayer-streaming-shared'\n\nclass Stats {\n encodeType = '' // hevc | avc\n audioCodec = ''\n videoCodec = ''\n domain = '' // stream url domain\n fps = 0\n bitrate = 0 // 最新1s下载数据的码率\n width = 0\n height = 0\n samplerate = 0\n channelCount = 0\n gop = 0 // 第一个gop帧数\n\n _bitsAccumulateSize = 0\n _bitsAccumulateDuration = 0\n _startGopId = -1\n\n constructor (timescale) {\n this._timescale = timescale\n }\n\n getStats () {\n return {\n encodeType: this.encodeType,\n audioCodec: this.audioCodec,\n videoCodec: this.videoCodec,\n domain: this.domain,\n fps: this.fps,\n bitrate: this.bitrate,\n width: this.width,\n height: this.height,\n samplerate: this.samplerate,\n channelCount: this.channelCount,\n gop: this.gop\n }\n }\n\n setEncodeType (encode) {\n this.encodeType = encode\n }\n\n setFpsFromScriptData ({data}) {\n const fps = data?.onMetaData?.framerate\n if (fps && fps > 0 && fps < 100) {\n this.fps = fps\n }\n }\n\n setVideoMeta (track) {\n this.width = track.width\n this.height = track.height\n this.videoCodec = track.codec\n this.encodeType = track.codecType\n if (track.fpsNum && track.fpsDen) {\n const fps = track.fpsNum / track.fpsDen\n if (fps > 0 && fps < 100) {\n this.fps = fps\n }\n }\n }\n\n setAudioMeta (track) {\n this.audioCodec = track.codec\n this.samplerate = track.sampleRate\n this.channelCount = track.channelCount\n }\n\n setDomain (responseUrl) {\n this.domain = responseUrl.split('/').slice(2, 3)[0]\n }\n\n updateBitrate (samples) {\n if (!this.fps || this.fps >= 100) {\n if (samples.length) {\n const duration = samples.reduce((a,b) => a += b.duration, 0) / samples.length\n this.fps = Math.round(this._timescale / duration)\n }\n }\n samples.forEach(sample => {\n if (this._startGopId === -1) {\n this._startGopId = sample.gopId\n }\n if (sample.gopId === this._startGopId) {\n this.gop++\n }\n this._bitsAccumulateDuration += sample.duration / (this._timescale / 1000)\n this._bitsAccumulateSize += sample.units.reduce((a, c) => (a += c.length), 0)\n if (this._bitsAccumulateDuration >= 1000) {\n this.bitrate = this._bitsAccumulateSize * 8\n this._bitsAccumulateDuration = 0\n this._bitsAccumulateSize = 0\n }\n })\n }\n}\n\n\n/**\n * @typedef {Object} StatsInfo\n * @property {number} downloadSpeed\n * @property {number} avgSpeed\n * @property {number} currentTime\n * @property {number} bufferEnd\n * @property {number} decodeFps\n * @property {string} encodeType\n * @property {string} audioCodec\n * @property {string} videoCodec\n * @property {string} domain\n * @property {number} fps\n * @property {number} bitrate\n * @property {number} width\n * @property {number} height\n * @property {number} samplerate\n * @property {number} channelCount\n * @property {number} gop\n */\nclass MediaStatsService {\n\n _core = null\n\n _samples = []\n\n constructor (core, timescale = 1000) {\n this._core = core\n this._timescale = timescale\n this._stats = new Stats(timescale)\n this._bindEvents()\n }\n\n\n /** @returns {StatsInfo} */\n getStats () {\n const { currentTime = 0, decodeFps = 0 } = this._core?.media || {}\n return {\n ...this._stats.getStats(),\n downloadSpeed: this._core?.speedInfo?.().speed || 0,\n avgSpeed: this._core?.speedInfo?.().avgSpeed || 0,\n totalReceivedByte: this._core?.speedInfo?.().totalSize || 0,\n totalReceivedCost: this._core?.speedInfo?.().totalCost || 0,\n currentTime,\n bufferEnd: this._core?.bufferInfo()?.remaining || 0,\n decodeFps\n }\n }\n\n _bindEvents () {\n this._core.on(EVENT.DEMUXED_TRACK, ({videoTrack}) => this._stats.updateBitrate(videoTrack.samples))\n\n this._core.on(EVENT.FLV_SCRIPT_DATA, data => {\n this._stats.setFpsFromScriptData(data)\n })\n\n this._core.on(EVENT.METADATA_PARSED, e => {\n if (e.type === 'video') {\n this._stats.setVideoMeta(e.track)\n } else {\n this._stats.setAudioMeta(e.track)\n }\n })\n\n this._core.on(EVENT.TTFB, e => {\n this._stats.setDomain(e.responseUrl)\n })\n\n }\n\n reset () {\n this._samples = []\n this._stats = new Stats(this._timescale)\n }\n\n}\n\nexport { MediaStatsService }\n","/** @enum {string} */\nexport const TrackType = {\n VIDEO: 'video',\n AUDIO: 'audio',\n METADATA: 'metadata'\n}\n\n/** @enum {string} */\nexport const VideoCodecType = {\n AV1: 'av1',\n AVC: 'avc',\n HEVC: 'hevc'\n}\n\n/** @enum {string} */\nexport const AudioCodecType = {\n AAC: 'aac',\n G711PCMA: 'g7110a',\n G711PCMU: 'g7110m',\n OPUS: 'opus'\n}\n\n/** @enum {string} */\nexport const WarningType = {\n LARGE_AV_SHIFT: 'LARGE_AV_SHIFT',\n LARGE_VIDEO_GAP: 'LARGE_VIDEO_GAP',\n LARGE_VIDEO_GAP_BETWEEN_CHUNK: 'LARGE_VIDEO_GAP_BETWEEN_CHUNK',\n LARGE_AUDIO_GAP: 'LARGE_AUDIO_GAP',\n AUDIO_FILLED: 'AUDIO_FILLED',\n AUDIO_DROPPED: 'AUDIO_DROPPED'\n}\n","import { TrackType, VideoCodecType } from './types'\n\nexport class VideoTrack {\n id = 1\n\n /** @readonly */\n type = TrackType.VIDEO\n\n codecType = VideoCodecType.AVC\n\n pid = -1 // ts use\n\n /** @type {Uint8Array | Object} */\n hvcC = undefined\n\n codec = ''\n\n timescale = 0\n\n formatTimescale = 0\n\n sequenceNumber = 0\n\n baseMediaDecodeTime = 0\n\n baseDts = 0\n\n duration = 0\n\n warnings = []\n\n /** @type {import('./video-sample').VideoSample[]} */\n samples = []\n\n /** @type {Uint8Array[]} */\n pps = []\n\n /** @type {Uint8Array[]} */\n sps = []\n\n /** @type {Uint8Array[]} */\n vps = []\n\n fpsNum = 0\n\n fpsDen = 0\n\n /** @type {[number, number]} */\n sarRatio = [] // [hSpacing, vSpacing]\n\n width = 0\n\n height = 0\n\n nalUnitSize = 4\n\n present = false\n\n isVideoEncryption = false\n\n isAudioEncryption = false\n\n isVideo = true\n\n lastKeyFrameDts = 0\n\n kid = null\n\n pssh = null\n\n /** @type {any} */\n ext\n\n reset () {\n this.sequenceNumber =\n this.width =\n this.height =\n this.fpsDen =\n this.fpsNum =\n this.duration =\n this.baseMediaDecodeTime =\n this.timescale = 0\n this.codec = ''\n this.present = false\n this.pid = -1\n this.pps = []\n this.sps = []\n this.vps = []\n this.sarRatio = []\n this.samples = []\n this.warnings = []\n this.hvcC = null\n }\n\n get firstDts () {\n return this.samples.length ? this.samples[0].dts : null\n }\n\n get firstPts () {\n return this.samples.length ? this.samples[0].pts : null\n }\n\n get samplesDuration () {\n if (this.samples.length > 0) {\n const first = this.samples[0]\n const last = this.samples[this.samples.length - 1]\n return last.dts - first.dts + last.duration\n }\n return 0\n }\n\n /**\n * @returns {boolean}\n */\n exist () {\n if (/av01/.test(this.codec)) {\n return true\n }\n return !!(this.pps.length && this.sps.length && this.codec)\n }\n\n /**\n * @returns {boolean}\n */\n hasSample () {\n return !!this.samples.length\n }\n\n get isEncryption (){\n return this.isVideoEncryption\n }\n}\n","import { TrackType, AudioCodecType } from './types'\n\nexport class AudioTrack {\n id = 2\n\n /** @readonly */\n type = TrackType.AUDIO\n\n codecType = AudioCodecType.AAC\n\n pid = -1\n\n codec = ''\n\n sequenceNumber = 0\n\n sampleDuration = 0\n\n timescale = 0\n\n formatTimescale = 0\n\n baseMediaDecodeTime = 0\n\n duration = 0\n\n warnings = []\n\n /** @type {import('./audio-sample').AudioSample[]} */\n samples = []\n\n baseDts = 0\n\n sampleSize = 16\n\n sampleRate = 0\n\n channelCount = 0\n\n objectType = 0\n\n sampleRateIndex = 0\n\n /** @type {number[]} */\n config = []\n\n present = false\n\n isVideoEncryption = false\n\n isAudioEncryption = false\n\n kid = null\n\n /** @type {any} */\n ext\n\n reset () {\n this.sequenceNumber = 0\n this.timescale = 0\n this.sampleDuration = 0\n this.sampleRate = 0\n this.channelCount = 0\n this.baseMediaDecodeTime = 0\n this.present = false\n this.pid = -1\n this.codec = ''\n this.samples = []\n this.config = []\n this.warnings = []\n }\n\n /**\n * @returns {boolean}\n */\n exist () {\n return !!(\n this.sampleRate &&\n this.channelCount &&\n this.codec &&\n (this.codecType === AudioCodecType.AAC ||\n this.codecType === AudioCodecType.G711PCMA ||\n this.codecType === AudioCodecType.G711PCMU ||\n this.codecType === AudioCodecType.OPUS)\n )\n }\n\n /**\n * @returns {boolean}\n */\n hasSample () {\n return !!this.samples.length\n }\n\n get isEncryption () {\n return this.isAudioEncryption\n }\n\n get firstDts () {\n return this.samples.length ? this.samples[0].dts : null\n }\n\n get firstPts () {\n return this.samples.length ? this.samples[0].pts : null\n }\n\n get samplesDuration () {\n if (this.samples.length > 0) {\n const first = this.samples[0]\n const last = this.samples[this.samples.length - 1]\n return last.dts - first.dts + last.duration\n }\n return 0\n }\n}\n","/**\n * @typedef {Object} VideoFlag\n * @property {number} [isLeading=0]\n * @property {number} [dependsOn=1]\n * @property {number} [isDependedOn=0]\n * @property {number} [hasRedundancy=0]\n * @property {number} [paddingValue=0]\n * @property {number} [degradationPriority=0]\n * @property {number} [isNonSyncSample=1]\n */\n\nexport class VideoSample {\n /** @type {VideoFlag} */\n flag = {}\n\n keyframe = false\n\n gopId = 0\n\n duration = 0\n\n size = 0\n\n units = []\n\n chromaFormat = 420\n\n // sampleOffset = 0\n\n /**\n * @param {number} pts\n * @param {number} dts\n * @param {Uint8Array[]} [units]\n */\n constructor (pts, dts, units) {\n this.originPts = this.pts = pts\n this.originDts = this.dts = dts\n if (units) this.units = units\n }\n\n /**\n * @returns {number}\n */\n get cts () {\n return this.pts - this.dts\n }\n\n setToKeyframe () {\n this.keyframe = true\n this.flag.dependsOn = 2\n this.flag.isNonSyncSample = 0\n }\n}\n","export class AudioSample {\n duration = 1024\n\n flag = { dependsOn: 2, isNonSyncSample: 0 }\n keyframe = true\n\n /**\n * @param {number} pts\n * @param {Uint8Array} data\n * @param {number} [duration=1024]\n */\n constructor (pts, data, duration, sampleOffset) {\n this.originPts = this.pts = this.dts = pts\n this.data = data\n this.size = data.byteLength\n this.sampleOffset = sampleOffset\n if (duration) this.duration = duration\n }\n}\n","import { TrackType } from './types'\n\nclass Sample {\n time = 0 // second\n\n /**\n * @param {Object} data\n * @param {number} pts\n */\n constructor (data, pts) {\n this.data = data\n this.originPts = this.pts = pts\n }\n}\n\nexport class FlvScriptSample extends Sample {}\n\nexport class SeiSample extends Sample {}\n\nexport class MetadataTrack {\n /** @readonly */\n id = 3\n\n /** @readonly */\n type = TrackType.METADATA\n\n timescale = 0\n\n /** @type {FlvScriptSample[]} */\n flvScriptSamples = []\n\n /** @type {SeiSample[]} */\n seiSamples = []\n\n /**\n * @returns {boolean}\n */\n exist () {\n return !!((this.flvScriptSamples.length || this.seiSamples.length) && this.timescale)\n }\n\n reset () {\n this.timescale = 0\n this.flvScriptSamples = []\n this.seiSamples = []\n }\n\n /**\n * @returns {boolean}\n */\n hasSample () {\n return !!(this.flvScriptSamples.length || this.seiSamples.length)\n }\n}\n","export class ExpGolomb {\n _bytesAvailable\n\n _bitsAvailable = 0\n\n _word = 0\n\n constructor (data) {\n if (!data) throw new Error('ExpGolomb data params is required')\n this._data = data\n this._bytesAvailable = data.byteLength\n if (this._bytesAvailable) this._loadWord()\n }\n\n get bitsAvailable () {\n return this._bitsAvailable\n }\n\n _loadWord () {\n const position = this._data.byteLength - this._bytesAvailable\n const availableBytes = Math.min(4, this._bytesAvailable)\n if (availableBytes === 0) throw new Error('No bytes available')\n\n const workingBytes = new Uint8Array(4)\n workingBytes.set(this._data.subarray(position, position + availableBytes))\n\n this._word = new DataView(workingBytes.buffer).getUint32(0)\n this._bitsAvailable = availableBytes * 8\n this._bytesAvailable -= availableBytes\n }\n\n skipBits (count) {\n if (this._bitsAvailable > count) {\n this._word <<= count\n this._bitsAvailable -= count\n } else {\n count -= this._bitsAvailable\n const skipBytes = Math.floor(count / 8)\n count -= (skipBytes * 8)\n this._bytesAvailable -= skipBytes\n this._loadWord()\n this._word <<= count\n this._bitsAvailable -= count\n }\n }\n\n readBits (size) {\n if (size > 32) {\n throw new Error('Cannot read more than 32 bits')\n }\n\n let bits = Math.min(this._bitsAvailable, size)\n const val = this._word >>> (32 - bits)\n\n this._bitsAvailable -= bits\n if (this._bitsAvailable > 0) {\n this._word <<= bits\n } else if (this._bytesAvailable > 0) {\n this._loadWord()\n }\n\n bits = size - bits\n if (bits > 0 && this._bitsAvailable) {\n return (val << bits) | this.readBits(bits)\n }\n return val\n }\n\n skipLZ () {\n let leadingZeroCount\n for (\n leadingZeroCount = 0;\n leadingZeroCount < this._bitsAvailable;\n ++leadingZeroCount\n ) {\n if ((this._word & (0x80000000 >>> leadingZeroCount)) !== 0) {\n this._word <<= leadingZeroCount\n this._bitsAvailable -= leadingZeroCount\n return leadingZeroCount\n }\n }\n this._loadWord()\n return leadingZeroCount + this.skipLZ()\n }\n\n skipUEG () {\n this.skipBits(1 + this.skipLZ())\n }\n\n readUEG () {\n const clz = this.skipLZ()\n return this.readBits(clz + 1) - 1\n }\n\n readEG () {\n const val = this.readUEG()\n if (1 & val) {\n return (1 + val) >>> 1\n }\n return -1 * (val >>> 1)\n }\n\n readBool () {\n return this.readBits(1) === 1\n }\n\n readUByte () {\n return this.readBits(8)\n }\n\n skipScalingList (count) {\n let lastScale = 8\n let nextScale = 8\n let deltaScale\n for (let j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = this.readEG()\n nextScale = (lastScale + deltaScale + 256) % 256\n }\n lastScale = nextScale === 0 ? lastScale : nextScale\n }\n }\n}\n","export class Logger {\n constructor (name) {\n this.name = name || ''\n this._prefix = `[${this.name}]`\n }\n\n warn (...args) {\n if (Logger.disabled) return\n console.warn(this._prefix, ...args)\n }\n\n static disabled = true\n\n static enable () {\n Logger.disabled = false\n }\n\n static disable () {\n Logger.disabled = true\n }\n}\n","export class UTF8 {\n /**\n *\n * @param {Uint8Array} uint8array\n * @return {string}\n */\n static decode (uint8array) {\n const out = []\n const input = uint8array\n let i = 0\n const length = uint8array.length\n\n while (i < length) {\n if (input[i] < 0x80) {\n out.push(String.fromCharCode(input[i]))\n ++i\n continue\n } else if (input[i] < 0xC0) {\n // fallthrough\n } else if (input[i] < 0xE0) {\n if (UTF8._checkContinuation(input, i, 1)) {\n const ucs4 = (input[i] & 0x1F) << 6 | (input[i + 1] & 0x3F)\n if (ucs4 >= 0x80) {\n out.push(String.fromCharCode(ucs4 & 0xFFFF))\n i += 2\n continue\n }\n }\n } else if (input[i] < 0xF0) {\n if (UTF8._checkContinuation(input, i, 2)) {\n const ucs4 = (input[i] & 0xF) << 12 | (input[i + 1] & 0x3F) << 6 | input[i + 2] & 0x3F\n if (ucs4 >= 0x800 && (ucs4 & 0xF800) !== 0xD800) {\n out.push(String.fromCharCode(ucs4 & 0xFFFF))\n i += 3\n continue\n }\n }\n } else if (input[i] < 0xF8) {\n if (UTF8._checkContinuation(input, i, 3)) {\n let ucs4 = (input[i] & 0x7) << 18 | (input[i + 1] & 0x3F) << 12 |\n (input[i + 2] & 0x3F) << 6 | (input[i + 3] & 0x3F)\n if (ucs4 > 0x10000 && ucs4 < 0x110000) {\n ucs4 -= 0x10000\n out.push(String.fromCharCode((ucs4 >>> 10) | 0xD800))\n out.push(String.fromCharCode((ucs4 & 0x3FF) | 0xDC00))\n i += 4\n continue\n }\n }\n }\n out.push(String.fromCharCode(0xFFFD))\n ++i\n }\n\n return out.join('')\n }\n\n static _checkContinuation (uint8array, start, checkLength) {\n const array = uint8array\n if (start + checkLength < array.length) {\n while (checkLength--) {\n if ((array[++start] & 0xC0) !== 0x80) {\n return false\n }\n }\n return true\n } else {\n return false\n }\n }\n}\n","export const isBrowser = typeof window !== 'undefined'\n\nconst ua = isBrowser && navigator.userAgent.toLocaleLowerCase()\n\n// eslint-disable-next-line no-lookahead-lookbehind-regexp/no-lookahead-lookbehind-regexp\nexport const isSafari = isBrowser && /^((?!chrome|android).)*safari/.test(ua)\nexport const isFirefox = isBrowser && ua.includes('firefox')\nexport const isAndroid = isBrowser && ua.includes('android')\n","/* c8 ignore next 4 */\nexport { ExpGolomb } from './exp-golomb'\nexport { Logger } from './logger'\nexport { UTF8 } from './utf8'\nexport * from './env'\n\nexport function concatUint8Array (...arr) {\n arr = arr.filter(Boolean)\n const data = new Uint8Array(arr.reduce((p, c) => p + c.byteLength, 0))\n let prevLen = 0\n arr.forEach((d) => {\n data.set(d, prevLen)\n prevLen += d.byteLength\n })\n return data\n}\n\nexport const MAX_SIZE = Math.pow(2, 32)\n\nexport function readBig16 (data, i = 0) {\n return (data[i] << 8) + (data[i + 1] || 0)\n}\n\nexport function readBig24 (data, i = 0) {\n return (data[i] << 16) + (data[i + 1] << 8) + (data[i + 2] || 0)\n}\n\nexport function readBig32 (data, i = 0) {\n return (data[i] << 24 >>> 0) + (data[i + 1] << 16) + (data[i + 2] << 8) + (data[i + 3] || 0)\n}\n\nexport function readBig64 (data, i = 0) {\n return readBig32(data, i) * MAX_SIZE + readBig32(data, i + 4)\n}\n\nexport function getAvcCodec (codecs) {\n let codec = 'avc1.'\n let h\n for (let i = 0; i < 3; i++) {\n h = codecs[i].toString(16)\n if (h.length < 2) h = `0${h}`\n codec += h\n }\n return codec\n}\n\nexport function formatIV (arr) {\n let iv = ''\n arr.forEach(value => {\n iv += bufferToString(value)\n })\n if (iv.length <= 32) {\n const len = 32 - iv.length\n for (let i = 0; i < len; i++) {\n iv += '0'\n }\n }\n return iv\n}\n\nexport function parse (a) {\n if (!Array.isArray(a)) {\n const arr = []\n let value = ''\n for (let i = 0; i < a.length; i++) {\n if (i % 2) {\n value = a[i - 1] + a[i]\n arr.push(parseInt(value, 16))\n value = ''\n }\n }\n return arr\n }\n return a.map(item => { return parseInt(item, 16) })\n}\nfunction bufferToString (value) {\n return ('0' + (Number(value).toString(16))).slice(-2).toUpperCase()\n}\n\nexport function hashVal (str) {\n let hash = 0; let i; let chr\n if (str.length === 0) return hash\n for (i = 0; i < str.length; i++) {\n chr = str.charCodeAt(i)\n hash = ((hash << 5) - hash) + chr\n hash |= 0\n }\n return hash\n}\n\nexport function combineToFloat (integer, decimal) {\n return Number(integer + '.' + decimal)\n}\n\nexport function toDegree (matrix) {\n if (matrix.length < 5)\n return 0\n const scaled0 = Math.hypot(matrix[0], matrix[3]), scaled1 = Math.hypot(matrix[1], matrix[4])\n return 0 === scaled0 || 0 === scaled1 ? 0 : 180 * Math.atan2(matrix[1] / scaled1, matrix[0] / scaled0) / Math.PI\n}\n","import { isFirefox, isAndroid } from '../utils'\n\nexport class AAC {\n static FREQ = [\n 96000,\n 88200,\n 64000,\n 48000,\n 44100,\n 32000,\n 24000,\n 22050,\n 16000,\n 12000,\n 11025,\n 8000,\n 7350\n ];\n\n static getRateIndexByRate (rate) {\n return AAC.FREQ.indexOf(rate)\n }\n\n static parseADTS (data, pts) {\n const len = data.length\n let i = 0\n\n while ((i + 2) < len) {\n if (data[i] === 0xff && (data[i + 1] & 0xf6) === 0xf0) {\n break\n }\n i++\n }\n\n if (i >= len) return\n\n const skip = i\n const frames = []\n const samplingFrequencyIndex = (data[i + 2] & 0x3c) >>> 2\n const sampleRate = AAC.FREQ[samplingFrequencyIndex]\n if (!sampleRate) throw new Error(`Invalid sampling index: ${samplingFrequencyIndex}`)\n const objectType = ((data[i + 2] & 0xc0) >>> 6) + 1\n const channelCount = ((data[i + 2] & 1) << 2) | ((data[i + 3] & 0xc0) >>> 6)\n const { config, codec } = AAC._getConfig(samplingFrequencyIndex, channelCount, objectType)\n\n let protectionSkipBytes\n let frameLength\n let frameIndex = 0\n const duration = AAC.getFrameDuration(sampleRate)\n\n while ((i + 7) < len) {\n if ((data[i] !== 0xff) || (data[i + 1] & 0xF6) !== 0xf0) {\n i++\n continue\n }\n\n frameLength = ((data[i + 3] & 0x03) << 11) | (data[i + 4] << 3) | ((data[i + 5] & 0xe0) >> 5)\n if (!frameLength || (len - i) < frameLength) break\n\n protectionSkipBytes = (~data[i + 1] & 0x01) * 2\n frames.push({\n pts: pts + frameIndex * duration,\n data: data.subarray(i + 7 + protectionSkipBytes, i + frameLength)\n })\n\n frameIndex++\n i += frameLength\n }\n\n return {\n skip,\n remaining: i >= len ? undefined : data.subarray(i),\n frames,\n samplingFrequencyIndex,\n sampleRate,\n objectType,\n channelCount,\n codec,\n config,\n originCodec: `mp4a.40.${objectType}`\n }\n }\n\n static parseAudioSpecificConfig (data) {\n if (!data.length) return\n const objectType = data[0] >>> 3\n const samplingFrequencyIndex = ((data[0] & 0x07) << 1) | (data[1] >>> 7)\n const channelCount = (data[1] & 0x78) >>> 3\n const sampleRate = AAC.FREQ[samplingFrequencyIndex]\n // play as no audio track stream\n if (!sampleRate) return\n const { config, codec } = AAC._getConfig(samplingFrequencyIndex, channelCount, objectType)\n\n return {\n samplingFrequencyIndex,\n sampleRate,\n objectType,\n channelCount,\n config,\n codec,\n originCodec: `mp4a.40.${objectType}`\n }\n }\n\n static getFrameDuration (rate, timescale = 90000) {\n return 1024 * timescale / rate\n }\n\n static _getConfig (samplingIndex, channelCount, originObjectType) {\n const config = []\n let objectType\n let extensionSamplingIndex\n if (isFirefox) {\n if (samplingIndex >= 6) { // use SBR (HE-AAC)\n objectType = 5\n extensionSamplingIndex = samplingIndex - 3\n } else { // use LC-AAC\n objectType = 2\n extensionSamplingIndex = samplingIndex\n }\n } else if (isAndroid) { // use LC-AAC\n objectType = 2\n extensionSamplingIndex = samplingIndex\n } else { // use HE-AAC\n objectType = (originObjectType === 2 || originObjectType === 5) ? originObjectType : 5\n extensionSamplingIndex = samplingIndex\n\n if (samplingIndex >= 6) {\n extensionSamplingIndex = samplingIndex - 3\n } else if (channelCount === 1) { // Mono channel, use LC-AAC\n objectType = 2\n extensionSamplingIndex = samplingIndex\n }\n }\n\n config[0] = objectType << 3\n config[0] |= (samplingIndex & 0x0e) >> 1\n config[1] = (samplingIndex & 0x01) << 7\n config[1] |= channelCount << 3\n if (objectType === 5) {\n config[1] |= ((extensionSamplingIndex & 0x0e) >> 1)\n config[2] = (extensionSamplingIndex & 0x01) << 7\n config[2] |= (2 << 2)\n config[3] = 0\n }\n\n return {\n config,\n codec: `mp4a.40.${objectType}`\n }\n }\n\n /* c8 ignore next 65 */\n static getSilentFrame (codec, channelCount) {\n switch (codec) {\n case 'mp4a.40.2':\n if (channelCount === 1) {\n return new Uint8Array([0x00, 0xc8, 0x00, 0x80, 0x23, 0x80])\n } if (channelCount === 2) {\n return new Uint8Array([\n 0x21, 0x00, 0x49, 0x90, 0x02, 0x19, 0x00, 0x23, 0x80\n ])\n } if (channelCount === 3) {\n return new Uint8Array([\n 0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64,\n 0x00, 0x8e\n ])\n } if (channelCount === 4) {\n return new Uint8Array([\n 0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64,\n 0x00, 0x80, 0x2c, 0x80, 0x08, 0x02, 0x38\n ])\n } if (channelCount === 5) {\n return new Uint8Array([\n 0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64,\n 0x00, 0x82, 0x30, 0x04, 0x99, 0x00, 0x21, 0x90, 0x02, 0x38\n ])\n } if (channelCount === 6) {\n return new Uint8Array([\n 0x00, 0xc8, 0x00, 0x80, 0x20, 0x84, 0x01, 0x26, 0x40, 0x08, 0x64,\n 0x00, 0x82, 0x30, 0x04, 0x99, 0x00, 0x21, 0x90, 0x02, 0x00, 0xb2,\n 0x00, 0x20, 0x08, 0xe0\n ])\n }\n break\n default:\n if (channelCount === 1) {\n return new Uint8Array([\n 0x1, 0x40, 0x22, 0x80, 0xa3, 0x4e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0,\n 0x0, 0x1c, 0x6, 0xf1, 0xc1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5e\n ])\n } if (channelCount === 2) {\n return new Uint8Array([\n 0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0,\n 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5e\n ])\n } if (channelCount === 3) {\n return new Uint8Array([\n 0x1, 0x40, 0x22, 0x80, 0xa3, 0x5e, 0xe6, 0x80, 0xba, 0x8, 0x0, 0x0,\n 0x0, 0x0, 0x95, 0x0, 0x6, 0xf1, 0xa1, 0xa, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a, 0x5a,\n 0x5a, 0x5e\n ])\n }\n break\n }\n }\n}\n","import { readBig32 } from '../utils'\n\nexport class NALu {\n static parseAnnexB (data) {\n const len = data.length\n let start = 2\n let end = 0\n while (data[start] !== null && data[start] !== undefined && data[start] !== 1) {\n start++\n }\n start++\n end = start + 2\n\n if (end >= len) return []\n\n const units = []\n\n while (end < len) {\n switch (data[end]) {\n case 0:\n if (data[end - 1] !== 0) {\n end += 2\n break\n } else if (data[end - 2] !== 0) {\n end++\n break\n }\n\n if (start !== end - 2) units.push(data.subarray(start, end - 2))\n\n do {\n end++\n } while (data[end] !== 1 && end < len)\n start = end + 1\n end = start + 2\n break\n case 1:\n if (data[end - 1] !== 0 || data[end - 2] !== 0) {\n end += 3\n break\n }\n if (start !== end - 2) units.push(data.subarray(start, end - 2))\n start = end + 1\n end = start + 2\n break\n default:\n end += 3\n break\n }\n }\n\n if (start < len) units.push(data.subarray(start))\n\n return units\n }\n\n static parseAvcC (data, size = 4) {\n if (data.length < 4) return\n const dataLen = data.length\n const units = []\n\n let offset = 0\n let length\n while ((offset + size) < dataLen) {\n length = readBig32(data, offset)\n if (size === 3) length >>>= 8\n offset += size\n\n if (!length) continue\n if (offset + length > dataLen) {\n break\n }\n\n units.push(data.subarray(offset, offset + length))\n offset += length\n }\n\n return units\n }\n\n static parseSEI (unit, isHevc) {\n const len = unit.length\n let i = isHevc ? 2 : 1\n let type = 0\n let size = 0\n let uuid = ''\n\n while (unit[i] === 255) {\n type += 255\n i++\n }\n\n type += unit[i++]\n\n while (unit[i] === 255) {\n size += 255\n i++\n }\n size += unit[i++]\n\n if (type === 5 && len > i + 16) {\n for (let j = 0; j < 16; j++) {\n uuid += unit[i].toString(16)\n i++\n }\n }\n\n return {\n payload: unit.subarray(i, i + size), type, size, uuid\n }\n }\n\n static removeEPB (uint) {\n const length = uint.byteLength\n const emulationPreventionBytesPositions = []\n let i = 1\n\n while (i < length - 2) {\n if (uint[i] === 0 && uint[i + 1] === 0 && uint[i + 2] === 0x03) {\n emulationPreventionBytesPositions.push(i + 2)\n i += 2\n } else {\n i++\n }\n }\n\n if (!emulationPreventionBytesPositions.length) return uint\n\n const newLength = length - emulationPreventionBytesPositions.length\n const newData = new Uint8Array(newLength)\n\n let sourceIndex = 0\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === emulationPreventionBytesPositions[0]) {\n sourceIndex++\n emulationPreventionBytesPositions.shift()\n }\n newData[i] = uint[sourceIndex]\n }\n\n return newData\n }\n}\n","import { NALu } from './nalu'\nimport { ExpGolomb, getAvcCodec } from '../utils'\n\nexport class AVC {\n static parseAVCDecoderConfigurationRecord (data) {\n if (data.length < 7) return\n const nalUnitSize = (data[4] & 3) + 1\n\n let spsParsed\n const spsArr = []\n const ppsArr = []\n\n let offset = 6\n const spsCount = data[5] & 0x1f\n let spsSize\n for (let i = 0; i < spsCount; i++) {\n spsSize = (data[offset] << 8) | data[offset + 1]\n offset += 2\n if (!spsSize) continue\n\n const sps = data.subarray(offset, offset + spsSize)\n offset += spsSize\n spsArr.push(sps)\n\n if (!spsParsed) {\n spsParsed = AVC.parseSPS(NALu.removeEPB(sps))\n }\n }\n\n const ppsCount = data[offset]\n offset++\n let ppsSize\n for (let i = 0; i < ppsCount; i++) {\n ppsSize = (data[offset] << 8) | data[offset + 1]\n offset += 2\n if (!ppsSize) continue\n ppsArr.push(data.subarray(offset, offset + ppsSize))\n offset += ppsSize\n }\n\n return {\n sps: spsParsed,\n spsArr,\n ppsArr,\n nalUnitSize\n }\n }\n\n static parseSPS (unit) {\n const eg = new ExpGolomb(unit)\n eg.readUByte()\n\n const profileIdc = eg.readUByte()\n const profileCompatibility = eg.readUByte()\n const levelIdc = eg.readUByte()\n eg.skipUEG()\n\n let chromaFormat = 420\n if (\n profileIdc === 100 ||\n profileIdc === 110 ||\n profileIdc === 122 ||\n profileIdc === 244 ||\n profileIdc === 44 ||\n profileIdc === 83 ||\n profileIdc === 86 ||\n profileIdc === 118 ||\n profileIdc === 128 ||\n profileIdc === 138 ||\n profileIdc === 144\n ) {\n const chromaFormatIdc = eg.readUEG()\n if (chromaFormatIdc <= 3) chromaFormat = [0, 420, 422, 444][chromaFormatIdc]\n if (chromaFormatIdc === 3) eg.skipBits(1)\n eg.skipUEG()\n eg.skipUEG()\n eg.skipBits(1)\n if (eg.readBool()) {\n const scalingListCount = chromaFormatIdc !== 3 ? 8 : 12\n for (let i = 0; i < scalingListCount; i++) {\n if (eg.readBool()) {\n if (i < 6) {\n eg.skipScalingList(16)\n } else {\n eg.skipScalingList(64)\n }\n }\n }\n }\n }\n\n eg.skipUEG()\n const picOrderCntType = eg.readUEG()\n if (picOrderCntType === 0) {\n eg.readUEG()\n } else if (picOrderCntType === 1) {\n eg.skipBits(1)\n eg.skipUEG()\n eg.skipUEG()\n const numRefFramesInPicOrderCntCycle = eg.readUEG()\n for (let i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n eg.skipUEG()\n }\n }\n\n eg.skipUEG()\n eg.skipBits(1)\n const picWidthInMbsMinus1 = eg.readUEG()\n const picHeightInMapUnitsMinus1 = eg.readUEG()\n const frameMbsOnlyFlag = eg.readBits(1)\n if (frameMbsOnlyFlag === 0) eg.skipBits(1)\n eg.skipBits(1)\n\n let frameCropLeftOffset = 0\n let frameCropRightOffset = 0\n let frameCropTopOffset = 0\n let frameCropBottomOffset = 0\n\n if (eg.readBool()) {\n frameCropLeftOffset = eg.readUEG()\n frameCropRightOffset = eg.readUEG()\n frameCropTopOffset = eg.readUEG()\n frameCropBottomOffset = eg.readUEG()\n }\n\n let sarRatio\n let fixedFrame\n let fpsNum\n let fpsDen\n let fps\n if (eg.readBool()) {\n if (eg.readBool()) {\n const aspectRatioIdc = eg.readUByte()\n switch (aspectRatioIdc) {\n case 1: sarRatio = [1, 1]; break\n case 2: sarRatio = [12, 11]; break\n case 3: sarRatio = [10, 11]; break\n case 4: sarRatio = [16, 11]; break\n case 5: sarRatio = [40, 33]; break\n case 6: sarRatio = [24, 11]; break\n case 7: sarRatio = [20, 11]; break\n case 8: sarRatio = [32, 11]; break\n case 9: sarRatio = [80, 33]; break\n case 10: sarRatio = [18, 11]; break\n case 11: sarRatio = [15, 11]; break\n case 12: sarRatio = [64, 33]; break\n case 13: sarRatio = [160, 99]; break\n case 14: sarRatio = [4, 3]; break\n case 15: sarRatio = [3, 2]; break\n case 16: sarRatio = [2, 1]; break\n case 255: {\n sarRatio = [\n (eg.readUByte() << 8) | eg.readUByte(),\n (eg.readUByte() << 8) | eg.readUByte()\n ]\n break\n }\n default:\n }\n }\n\n if (eg.readBool()) eg.readBool()\n\n if (eg.readBool()) {\n eg.readBits(4)\n if (eg.readBool()) eg.readBits(24)\n }\n\n if (eg.readBool()) {\n eg.readUEG()\n eg.readUEG()\n }\n\n if (eg.readBool()) {\n const numUnitsInTick = eg.readBits(32)\n const timeScale = eg.readBits(32)\n fixedFrame = eg.readBool()\n\n fpsNum = timeScale\n fpsDen = numUnitsInTick * 2\n fps = fpsNum / fpsDen\n }\n }\n\n return {\n codec: getAvcCodec(unit.subarray(1, 4)),\n profileIdc,\n profileCompatibility,\n levelIdc,\n chromaFormat,\n width: Math.ceil(\n (picWidthInMbsMinus1 + 1) * 16 -\n 2 * (frameCropLeftOffset + frameCropRightOffset)\n ),\n height:\n (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 -\n (frameMbsOnlyFlag ? 2 : 4) *\n (frameCropTopOffset + frameCropBottomOffset),\n sarRatio,\n fpsNum,\n fpsDen,\n fps,\n fixedFrame\n }\n }\n}\n","import { NALu } from './nalu'\nimport { ExpGolomb } from '../utils'\n\nexport class HEVC {\n static parseHEVCDecoderConfigurationRecord (data, hvcC = {}) {\n if (data.length < 23) return\n hvcC = hvcC || {}\n const nalUnitSize = (data[21] & 3) + 1\n\n let vpsParsed\n let spsParsed\n const spsArr = []\n const ppsArr = []\n const vpsArr = []\n\n let offset = 23\n const numOfArrays = data[22]\n\n let nalUnitType\n let numNalus\n let nalSize\n for (let i = 0; i < numOfArrays; i++) {\n nalUnitType = data[offset] & 0x3f\n numNalus = (data[offset + 1] << 8) | data[offset + 2]\n\n offset += 3\n\n for (let j = 0; j < numNalus; j++) {\n nalSize = (data[offset] << 8) | data[offset + 1]\n offset += 2\n if (!nalSize) continue\n switch (nalUnitType) {\n case 32: {\n const vps = data.subarray(offset, offset + nalSize)\n if (!vpsParsed) vpsParsed = HEVC.parseVPS(NALu.removeEPB(vps), hvcC)\n vpsArr.push(vps)\n }\n break\n case 33: {\n const sps = data.subarray(offset, offset + nalSize)\n if (!spsParsed) spsParsed = HEVC.parseSPS(NALu.removeEPB(sps), hvcC)\n spsArr.push(sps)\n }\n break\n case 34:\n ppsArr.push(data.subarray(offset, offset + nalSize))\n break\n default:\n }\n\n offset += nalSize\n }\n }\n\n return {\n hvcC,\n sps: spsParsed,\n spsArr,\n ppsArr,\n vpsArr,\n nalUnitSize\n }\n }\n\n static parseVPS (unit, hvcC) {\n hvcC = hvcC || {}\n const eg = new ExpGolomb(unit)\n eg.readUByte()\n eg.readUByte()\n\n eg.readBits(12)\n const vpsMaxSubLayersMinus1 = eg.readBits(3)\n hvcC.numTemporalLayers = Math.max(hvcC.numTemporalLayers || 0, vpsMaxSubLayersMinus1 + 1)\n eg.readBits(17)\n HEVC._parseProfileTierLevel(eg, vpsMaxSubLayersMinus1, hvcC)\n\n return hvcC\n }\n\n static parseSPS (unit, hvcC = {}) {\n hvcC = hvcC || {}\n const eg = new ExpGolomb(unit)\n eg.readUByte()\n eg.readUByte()\n\n eg.readBits(4)\n const spsMaxSubLayersMinus1 = eg.readBits(3)\n hvcC.numTemporalLayers = Math.max(spsMaxSubLayersMinus1 + 1, hvcC.numTemporalLayers || 0)\n hvcC.temporalIdNested = eg.readBits(1)\n HEVC._parseProfileTierLevel(eg, spsMaxSubLayersMinus1, hvcC)\n\n eg.readUEG() // sps_seq_parameter_set_id\n\n const chromaFormatIdc = hvcC.chromaFormatIdc = eg.readUEG()\n let chromaFormat = 420\n if (chromaFormatIdc <= 3) chromaFormat = [0, 420, 422, 444][chromaFormatIdc]\n\n let separateColourPlaneFlag = 0\n if (chromaFormatIdc === 3) {\n separateColourPlaneFlag = eg.readBits(1)\n }\n\n let width = eg.readUEG() // pic_width_in_luma_samples\n let height = eg.readUEG() // pic_height_in_luma_samples\n\n const conformanceWindowFlag = eg.readBits(1)\n\n let confWinLeftOffset\n let confWinRightOffset\n let confWinTopOffset\n let confWinBottomOffset\n if (conformanceWindowFlag === 1) {\n confWinLeftOffset = eg.readUEG() // conf_win_left_offset\n confWinRightOffset = eg.readUEG() // conf_win_right_offset\n confWinTopOffset = eg.readUEG() // conf_win_top_offset\n confWinBottomOffset = eg.readUEG() // conf_win_bottom_offset\n }\n\n hvcC.bitDepthLumaMinus8 = eg.readUEG() // bit_depth_luma_minus8\n hvcC.bitDepthChromaMinus8 = eg.readUEG() // bit_depth_chroma_minus8\n\n if (conformanceWindowFlag === 1) {\n const subWidthC = (((chromaFormatIdc === 1) || (chromaFormatIdc === 2)) && (separateColourPlaneFlag === 0)) ? 2 : 1\n const subHeightC = ((chromaFormatIdc === 1) && (separateColourPlaneFlag === 0)) ? 2 : 1\n width -= (subWidthC * (confWinRightOffset + confWinLeftOffset))\n height -= (subHeightC * (confWinBottomOffset + confWinTopOffset))\n }\n\n return {\n codec: 'hev1.1.6.L93.B0',\n width,\n height,\n chromaFormat,\n hvcC\n }\n }\n\n static _parseProfileTierLevel (eg, maxSubLayersMinus1, hvcC) {\n const generalTierFlag = hvcC.generalTierFlag || 0\n hvcC.generalProfileSpace = eg.readBits(2)\n hvcC.generalTierFlag = Math.max(eg.readBits(1), generalTierFlag)\n hvcC.generalProfileIdc = Math.max(eg.readBits(5), hvcC.generalProfileIdc || 0)\n hvcC.generalProfileCompatibilityFlags = eg.readBits(32)\n hvcC.generalConstraintIndicatorFlags = [eg.readBits(8), eg.readBits(8), eg.readBits(8), eg.readBits(8), eg.readBits(8), eg.readBits(8)]\n const generalLevelIdc = eg.readBits(8)\n if (generalTierFlag < hvcC.generalTierFlag) {\n hvcC.generalLevelIdc = generalLevelIdc\n } else {\n hvcC.generalLevelIdc = Math.max(generalLevelIdc, hvcC.generalLevelIdc || 0)\n }\n\n const subLayerProfilePresentFlag = []\n const subLayerLevelPresentFlag = []\n\n if (maxSubLayersMinus1 > eg.bitsAvailable) {\n throw new Error(`maxSubLayersMinus inavlid size ${maxSubLayersMinus1}`)\n }\n\n for (let j = 0; j < maxSubLayersMinus1; j++) {\n subLayerProfilePresentFlag[j] = eg.readBits(1)\n subLayerLevelPresentFlag[j] = eg.readBits(1)\n }\n\n if (maxSubLayersMinus1 > 0) {\n eg.readBits((8 - maxSubLayersMinus1) * 2)\n }\n\n for (let i = 0; i < maxSubLayersMinus1; i++) {\n if (subLayerProfilePresentFlag[i] !== 0) {\n eg.readBits(2)\n eg.readBits(1)\n eg.readBits(5)\n\n eg.readBits(16)\n eg.readBits(16)\n\n eg.readBits(4)\n\n eg.readBits(16)\n eg.readBits(16)\n eg.readBits(12)\n }\n if (subLayerLevelPresentFlag[i] !== 0) {\n eg.readBits(8)\n }\n }\n }\n}\n","/**\n * Opus documentation, https://opus-codec.org/docs/\n * Ogg Encapsulation for the Opus Audio Codec, https://datatracker.ietf.org/doc/html/rfc7845.html\n *\n * Packet Organization:\n *\n * Page 0 Pages 1 ... n Pages (n+1) ...\n * +------------+ +---+ +---+ ... +---+ +-----------+ +---------+ +--\n * | | | | | | | | | | | | |\n * |+----------+| |+-----------------+| |+-------------------+ +-----\n * |||ID Header|| || Comment Header || ||Audio Data Packet 1| | ...\n * |+----------+| |+-----------------+| |+-------------------+ +-----\n * | | | | | | | | | | | | |\n * +------------+ +---+ +---+ ... +---+ +-----------+ +---------+ +--\n * ^ ^ ^\n * | | |\n * | | Mandatory Page Break\n * | |\n * | ID header is contained on a single page\n * |\n * 'Beginning Of Stream'\n */\nexport class OPUS {\n static getFrameDuration (samples, timescale = 1000) {\n return 20\n }\n\n /**\n * Identification Header + Comment Header\n * @param {Uint8Array} data\n */\n static parseHeaderPackets (data) {\n if (!data.length) return\n\n const dv = new DataView(data.buffer, data.byteOffset, data.byteLength)\n\n // Identification Header\n let magicSignature = ''\n for (let i = 0; i < 8; i++) {\n magicSignature += String.fromCodePoint(data[i])\n }\n if (magicSignature !== 'OpusHead') {\n throw new Error('Invalid Opus MagicSignature')\n }\n\n // skip version\n // data[8]\n // console.log('Pre-skip', data[8])\n\n const channelCount = data[9]\n\n // skip Pre-skip\n // data[10] & data[11]\n console.log('Pre-skip', data[10], data[11])\n\n const sampleRate = dv.getUint32(12, true)\n const outputGain = dv.getInt16(16, true)\n\n // const mappingFamily = dv.getUint8(18)\n\n // play as no audio track stream\n if (!sampleRate) return\n\n const codec = 'opus'\n const originCodec = 'opus'\n const config = new Uint8Array(data.buffer, data.byteOffset + 8, data.byteLength - 8)\n\n return {\n outputGain,\n sampleRate,\n channelCount,\n config,\n codec,\n originCodec\n }\n }\n}\n","import { AudioCodecType, AudioSample, WarningType } from '../model'\nimport { AAC, OPUS } from '../codec'\nimport { isSafari } from '../utils'\n\nconst LARGE_AV_FIRST_FRAME_GAP = 500 // ms\nconst AUDIO_GAP_OVERLAP_THRESHOLD_COUNT = 3\nconst MAX_SILENT_FRAME_DURATION = 1000 // ms\nconst AUDIO_EXCEPTION_LOG_EMIT_DURATION = 5000 // 5s\nconst MAX_VIDEO_FRAME_DURATION = 1000 // ms\nconst MAX_DTS_DELTA_WITH_NEXT_CHUNK = 200 // ms\nconst VIDEO_EXCEPTION_LOG_EMIT_DURATION = 5000 // 5s\nconst TRACK_BROKEN_CHECK_TIME = 5\n\nexport class FlvFixer {\n constructor (videoTrack, audioTrack, metadataTrack) {\n this.videoTrack = videoTrack\n this.audioTrack = audioTrack\n this.metadataTrack = metadataTrack\n\n this._baseDts = -1\n this._baseDtsInited = false\n\n this._audioNextPts = undefined\n this._videoNextDts = undefined\n\n this._audioTimestampBreak = 0\n this._videoTimestampBreak = 0\n this._lastVideoDuration = 0\n\n // 在视频帧遇到下一个关键帧之前,如果音频时间戳发生了跳变,不能确定是否音视频都发生跳变还是单纯音频发生跳变.\n // 这里记录关键帧标识, 从下一个关键帧开始,如果视频没有跳变,才能判断是只有音频发生了跳变\n this._keyFrameInNextChunk = false\n\n this._lastAudioExceptionGapDot = -Infinity\n this._lastAudioExceptionOverlapDot = -Infinity\n this._lastAudioExceptionLargeGapDot = -Infinity\n\n this._lastVideoExceptionLargeGapDot = -Infinity\n this._lastVideoExceptionChunkFirstDtsDot = -Infinity\n }\n\n /**\n * @param {number} startTime 点播seek到的时间点\n * @param {boolean} discontinuity 是否换流\n * @param {boolean} contiguous 前后chunk时间戳是否连续\n */\n fix (startTime = 0, discontinuity = false, contiguous = true) {\n startTime = Math.round(startTime * 1000)\n const videoTrack = this.videoTrack\n const audioTrack = this.audioTrack\n\n if (discontinuity || !contiguous) {\n this._videoLastSample = null\n this._audioNextPts = undefined\n this._videoNextDts = undefined\n this._audioTimestampBreak = 0\n this._videoTimestampBreak = 0\n this._lastAudioExceptionGapDot = -Infinity\n this._lastAudioExceptionOverlapDot = -Infinity\n this._lastAudioExceptionLargeGapDot = -Infinity\n this._lastVideoExceptionLargeGapDot = -Infinity\n this._lastVideoExceptionChunkFirstDtsDot = -Infinity\n }\n\n if (discontinuity && !contiguous) {\n this._baseDtsInited = false\n }\n\n if (!this._baseDtsInited) {\n this._calculateBaseDts(audioTrack, videoTrack)\n }\n\n if (!contiguous && startTime) {\n this._audioNextPts = this._videoNextDts = startTime\n }\n\n const resetBaseDts = this._baseDtsInited &&\n (this._videoTimestampBreak || !this.videoTrack.exist()) &&\n (this._audioTimestampBreak || !this.audioTrack.exist())\n\n if (resetBaseDts) {\n this._resetBaseDtsWhenStreamBreaked()\n }\n\n this._fixAudio(audioTrack)\n\n this._keyFrameInNextChunk = false\n\n this._fixVideo(videoTrack)\n\n if (this.metadataTrack.exist()) {\n const timescale = this.metadataTrack.timescale\n this.metadataTrack.seiSamples.forEach(s => {\n s.pts = s.originPts - this._baseDts\n s.time = Math.max(0, s.pts) / timescale\n })\n this.metadataTrack.flvScriptSamples.forEach(s => {\n s.pts = s.originPts - this._baseDts\n s.time = Math.max(0, s.pts) / timescale\n })\n }\n\n if (videoTrack.samples.length) {\n videoTrack.baseMediaDecodeTime = videoTrack.samples[0].dts\n }\n if (audioTrack.samples.length) {\n audioTrack.baseMediaDecodeTime = audioTrack.samples[0].pts * audioTrack.timescale / 1000\n }\n }\n\n _fixVideo (videoTrack) {\n const samples = videoTrack.samples\n\n if (!samples.length) return\n\n samples.forEach(x => {\n x.dts -= this._baseDts\n x.pts -= this._baseDts\n if (x.keyframe) this._keyFrameInNextChunk = true\n })\n\n let refSampleDurationInt\n if (videoTrack.fpsNum && videoTrack.fpsDen) {\n refSampleDurationInt = videoTrack.timescale * (videoTrack.fpsDen / videoTrack.fpsNum)\n } else if (videoTrack.length > 1) {\n const first = videoTrack.samples[0]\n const last = videoTrack.samples[samples.length - 1]\n refSampleDurationInt = Math.floor((last.dts - first.dts) / (samples.length - 1))\n } else {\n refSampleDurationInt = this._lastVideoDuration || 40\n }\n\n const lastSample = samples.pop()\n\n if (this._videoLastSample) {\n samples.unshift(this._videoLastSample)\n }\n\n this._videoLastSample = lastSample\n\n if (!samples.length) return\n\n if (this._videoNextDts === undefined) {\n const samp0 = samples[0]\n this._videoNextDts = samp0.dts\n }\n\n const len = samples.length\n let sampleDuration = 0\n const firstSample = samples[0]\n const vDelta = this._videoNextDts - firstSample.dts\n\n if (Math.abs(vDelta) > MAX_DTS_DELTA_WITH_NEXT_CHUNK) {\n // emit large delta of first sample with expect\n if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {\n this._lastVideoExceptionChunkFirstDtsDot = firstSample.dts\n\n videoTrack.warnings.push({\n type: WarningType.LARGE_VIDEO_GAP_BETWEEN_CHUNK,\n nextDts: this._videoNextDts,\n firstSampleDts: firstSample.dts,\n nextSampleDts: samples[1]?.dts,\n sampleDuration: vDelta\n })\n }\n\n // only video break\n if (this._videoTimestampBreak >= TRACK_BROKEN_CHECK_TIME) {\n this._videoNextDts = firstSample.dts\n this._videoTimestampBreak = 0\n } else {\n // resolve first frame only\n firstSample.dts += vDelta\n firstSample.pts += vDelta\n if (!this.audioTrack.exist()) {\n this._videoTimestampBreak = 1\n }\n }\n }\n\n for (let i = 0; i < len; i++) {\n const dts = samples[i].dts\n const nextSample = samples[i + 1]\n\n if (i < len - 1) {\n sampleDuration = nextSample.dts - dts\n } else if (lastSample) {\n sampleDuration = lastSample.dts - dts\n } else {\n sampleDuration = refSampleDurationInt\n }\n\n if (sampleDuration > MAX_VIDEO_FRAME_DURATION || sampleDuration < 0) {\n this._videoTimestampBreak++\n // emit stream break\n if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {\n this._lastVideoExceptionLargeGapDot = dts\n videoTrack.warnings.push({\n type: WarningType.LARGE_VIDEO_GAP,\n time: dts / videoTrack.timescale,\n dts,\n originDts: samples[i].originDts,\n nextDts: this._videoNextDts,\n sampleDuration,\n refSampleDuration: refSampleDurationInt\n })\n }\n\n sampleDuration = refSampleDurationInt\n }\n\n samples[i].duration = sampleDuration\n this._videoNextDts += sampleDuration\n this._lastVideoDuration = sampleDuration\n }\n }\n\n _fixAudio (audioTrack) {\n const samples = audioTrack.samples\n if (!samples.length) return\n\n // offset origin timestamp\n samples.forEach(x => {\n x.dts = x.pts -= this._baseDts\n })\n\n this._doFixAudioInternal(audioTrack, samples, 1000)\n }\n\n _calculateBaseDts (audioTrack, videoTrack) {\n const audioSamps = audioTrack.samples\n const videoSamps = videoTrack.samples\n\n if (!audioSamps.length && !videoSamps.length) {\n return false\n }\n\n let audioBasePts = Infinity\n let videoBaseDts = Infinity\n\n if (audioSamps.length) {\n audioTrack.baseDts = audioBasePts = audioSamps[0].pts\n }\n\n if (videoSamps.length) {\n videoTrack.baseDts = videoBaseDts = videoSamps[0].dts\n }\n\n this._baseDts = Math.min(audioBasePts, videoBaseDts)\n\n const delta = videoBaseDts - audioBasePts\n\n if (Number.isFinite(delta) && Math.abs(delta) > LARGE_AV_FIRST_FRAME_GAP) {\n videoTrack.warnings.push({\n type: WarningType.LARGE_AV_SHIFT,\n videoBaseDts,\n audioBasePts,\n baseDts: this._baseDts,\n delta\n })\n }\n\n this._baseDtsInited = true\n return true\n }\n\n _resetBaseDtsWhenStreamBreaked () {\n /**\n * timestamp break\n * _audioNextDts\n * ---------------------|\n * (_baseDts) _videoNextDts\n * ----------------------|\n * <----------------\n * nextVideo.dts\n * ----------------------------------------|\n * nextAudio.dts\n * ---------------------------------------|\n */\n\n // calc baseDts base on new samples\n const calc = this._calculateBaseDts(this.audioTrack, this.videoTrack)\n\n if (!calc) return\n\n // consider the expect dts for next frame\n if (!this.audioTrack.exist()){\n this._baseDts -= this._videoNextDts\n } else if (!this.videoTrack.exist()){\n this._baseDts -= this._audioNextPts\n } else {\n this._baseDts -= Math.min(this._audioNextPts, this._videoNextDts)\n }\n this._videoTimestampBreak = 0\n this._audioTimestampBreak = 0\n }\n\n _doFixAudioInternal (audioTrack, samples, timescale) {\n if (!audioTrack.sampleDuration) {\n switch (audioTrack.codecType) {\n case AudioCodecType.AAC: {\n audioTrack.sampleDuration = AAC.getFrameDuration(audioTrack.timescale, timescale)\n break\n }\n case AudioCodecType.OPUS: {\n audioTrack.sampleDuration = OPUS.getFrameDuration(audioTrack.samples, timescale)\n break\n }\n case AudioCodecType.G711PCMA:\n case AudioCodecType.G711PCMU: {\n audioTrack.sampleDuration = this._getG711Duration(audioTrack)\n break\n }\n default:\n console.error('can\\'t fix audio codecType:', audioTrack.codecType)\n break\n }\n }\n const refSampleDuration = audioTrack.sampleDuration\n\n const sampleDurationInSampleRate =\n audioTrack.codecType === AudioCodecType.OPUS\n ? 20\n : audioTrack.codecType === AudioCodecType.AAC\n ? 1024\n : (refSampleDuration * audioTrack.timescale) / 1000\n\n if (this._audioNextPts === undefined) {\n const samp0 = samples[0]\n this._audioNextPts = samp0.pts\n }\n\n for (let i = 0; i < samples.length; i++) {\n let nextPts = this._audioNextPts\n const sample = samples[i]\n let delta = sample.pts - nextPts\n\n // only audio break\n if (i === 0 && this._audioTimestampBreak >= TRACK_BROKEN_CHECK_TIME && this._keyFrameInNextChunk) {\n nextPts = this._audioNextPts = sample.dts\n delta = 0\n this._audioTimestampBreak = 0\n }\n\n // fill frames\n // delta >= 3 * refSampleDurationInt\n // delta <= 500s\n if (!this._audioTimestampBreak && delta >= AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta <= MAX_SILENT_FRAME_DURATION && !isSafari) {\n const silentFrame = this._getSilentFrame(audioTrack) || samples[0].data.subarray()\n const count = Math.floor(delta / refSampleDuration)\n\n if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {\n this._lastAudioExceptionGapDot = sample.pts\n audioTrack.warnings.push({\n type: WarningType.AUDIO_FILLED,\n pts: sample.pts,\n originPts: sample.originPts,\n count,\n nextPts,\n refSampleDuration\n })\n }\n\n for (let j = 0; j < count; j++) {\n const silentSample = new AudioSample(Math.floor(this._audioNextPts + refSampleDuration) - Math.floor(this._audioNextPts), silentFrame, sampleDurationInSampleRate)\n silentSample.originPts = Math.floor(this._baseDts + nextPts)\n samples.splice(i, 0, silentSample)\n this._audioNextPts += refSampleDuration\n i++\n }\n\n i--\n // delta <= -3 * refSampleDurationInt\n // delta >= -500ms\n } else if (delta <= -AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta >= -1 * MAX_SILENT_FRAME_DURATION) {\n // need discard frames\n if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {\n this._lastAudioExceptionOverlapDot = sample.pts\n\n audioTrack.warnings.push({\n type: WarningType.AUDIO_DROPPED,\n pts: sample.pts,\n originPts: sample.originPts,\n nextPts,\n refSampleDuration\n })\n }\n samples.splice(i, 1)\n i--\n } else {\n if (Math.abs(delta) > MAX_SILENT_FRAME_DURATION) {\n this._audioTimestampBreak++\n\n if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {\n this._lastAudioExceptionLargeGapDot = sample.pts\n audioTrack.warnings.push({\n type: WarningType.LARGE_AUDIO_GAP,\n time: sample.pts / 1000,\n pts: sample.pts,\n originPts: sample.originPts,\n nextPts,\n sampleDuration: delta,\n refSampleDuration\n })\n }\n }\n\n if (audioTrack.codecType === AudioCodecType.OPUS) {\n const lastSample = samples[samples.length - 1]\n if (lastSample) {\n lastSample.duration = sample.pts - lastSample.pts\n }\n } else {\n sample.dts = sample.pts = nextPts\n sample.duration = sampleDurationInSampleRate\n }\n this._audioNextPts += refSampleDuration\n }\n }\n }\n\n _getG711Duration (track) {\n const { sampleSize, channelCount, sampleRate } = track\n const samp0 = track.samples[0]\n if (!samp0) return\n return samp0.data.byteLength * 2 / channelCount / (sampleSize / 8) / sampleRate * 1000\n }\n\n _getSilentFrame (track) {\n if (track.codecType === AudioCodecType.AAC) return AAC.getSilentFrame(track.codec, track.channelCount)\n return new Uint8Array(8 * track.sampleDuration * track.channelCount)\n }\n}\n","import { UTF8 } from '../utils'\n\nexport class AMF {\n static parse (data) {\n if (data.length < 3) return\n\n const ret = {}\n const name = AMF._parseValue(new DataView(data.buffer, data.byteOffset, data.byteLength))\n const value = AMF._parseValue(new DataView(data.buffer, data.byteOffset + name.size, data.byteLength - name.size))\n ret[name.data] = value.data\n\n return ret\n }\n\n static _parseValue (view) {\n const dataLen = view.byteLength\n const type = view.getUint8(0)\n let offset = 1\n let isEnd = false\n let value\n\n switch (type) {\n case 0: // Number(Double) type\n value = view.getFloat64(1)\n offset += 8\n break\n case 1: { // Boolean type\n value = !!view.getUint8(1)\n offset += 1\n break\n }\n case 2: { // String type\n const { data, size } = AMF._parseString(new DataView(view.buffer, view.byteOffset + offset, view.byteLength - offset))\n value = data\n offset += size\n }\n break\n case 3: { // Object(s) type\n value = {}\n let terminal = 0\n if ((view.getUint32(dataLen - 4) & 0x00FFFFFF) === 9) {\n terminal = 3\n }\n while (offset < dataLen - 4) { // 4 === type(UI8) + ScriptDataObjectEnd(UI24)\n const { size, data, isEnd } = AMF._parseObject(new DataView(view.buffer, view.byteOffset + offset, view.byteLength - offset - terminal))\n if (isEnd) break\n value[data.name] = data.value\n offset += size\n }\n if (offset <= dataLen - 3) {\n const marker = view.getUint32(offset - 1) & 0x00FFFFFF\n if (marker === 9) offset += 3\n }\n }\n break\n case 8: { // ECMA array type (Mixed array)\n value = {}\n offset += 4 // ECMAArrayLength(UI32)\n let terminal = 0 // workaround for malformed MixedArrays which has missing ScriptDataObjectEnd\n if ((view.getUint32(dataLen - 4) & 0x00FFFFFF) === 9) {\n terminal = 3\n }\n while (offset < dataLen - 8) { // 8 === type(UI8) + ECMAArrayLength(UI32) + ScriptDataVariableEnd(UI24)\n const { size, data, isEnd } = AMF._parseObject(new DataView(view.buffer, view.byteOffset + offset, view.byteLength - offset - terminal))\n if (isEnd) break\n value[data.name] = data.value\n offset += size\n }\n if (offset <= dataLen - 3) {\n const marker = view.getUint32(offset - 1) & 0x00FFFFFF\n if (marker === 9) {\n offset += 3\n }\n }\n }\n break\n case 9: // ScriptDataObjectEnd\n value = undefined\n offset = 1\n isEnd = true\n break\n case 10: { // Strict array type\n value = []\n const strictArrayLength = view.getUint32(1)\n offset += 4\n for (let i = 0; i < strictArrayLength; i++) {\n const { data, size } = AMF._parseValue(new DataView(view.buffer, view.byteOffset + offset, view.byteLength - offset))\n value.push(data)\n offset += size\n }\n }\n break\n case 11: { // Date type\n const timestamp = view.getFloat64(offset) + view.getInt16(offset + 8) * 60000\n value = new Date(timestamp)\n offset += 10\n }\n break\n case 12: { // Long string type\n const length = view.getUint32(1)\n offset += 4\n value = ''\n if (length > 0) {\n value = UTF8.decode(new Uint8Array(view.buffer, view.byteOffset + offset, length))\n }\n offset += length\n }\n break\n default:\n offset = dataLen\n break\n }\n\n return {\n data: value,\n size: offset,\n isEnd\n }\n }\n\n static _parseString (view) {\n const length = view.getUint16(0)\n let data = ''\n if (length > 0) {\n data = UTF8.decode(new Uint8Array(view.buffer, view.byteOffset + 2, length))\n }\n\n return {\n data,\n size: 2 + length\n }\n }\n\n static _parseObject (view) {\n if (view.byteLength < 3) return\n\n const name = AMF._parseString(view)\n const value = AMF._parseValue(new DataView(view.buffer, view.byteOffset + name.size, view.byteLength - name.size))\n\n return {\n data: {\n name: name.data,\n value: value.data\n },\n size: name.size + value.size,\n isEnd: value.isEnd\n }\n }\n}\n","/**\n * AudioData\n * @property {number} FlvSoundFormat\n */\nexport const FlvSoundFormat = {\n MP3: 2,\n G711A: 7, // G.711 A-law logarithmic PCM\n G711M: 8, // G.711 mu-law logarithmic PCM\n AAC: 10, // AAC\n OPUS: 13\n}\n\n","import { VideoTrack, AudioTrack, MetadataTrack, AudioSample, VideoSample, VideoCodecType, AudioCodecType, FlvScriptSample, SeiSample } from '../model'\nimport { FlvFixer } from './fixer'\nimport { concatUint8Array, Logger, readBig32 } from '../utils'\nimport { AAC, AVC, HEVC, NALu } from '../codec'\nimport { AMF } from './amf'\nimport { FlvSoundFormat } from './soundFormat'\nimport { OPUS } from '../codec/opus'\n\nconst logger = new Logger('FlvDemuxer')\n\n/**\n * @typedef {Object} DemuxResult\n * @property {VideoTrack} videoTrack\n * @property {AudioTrack} audioTrack\n * @property {MetadataTrack} metadataTrack\n */\n\nexport class FlvDemuxer {\n _headerParsed = false\n _remainingData = null\n _gopId = 0\n _needAddMetaBeforeKeyFrameNal = true // 标识H265流中关键帧Nal之前是否需要插入vps、sps、pps Nal\n\n static AUDIO_RATE = [5500, 11000, 22000, 44000]\n\n /**\n * @param {VideoTrack} [videoTrack]\n * @param {AudioTrack} [audioTrack]\n * @param {MetadataTrack} [metadataTrack]\n */\n constructor (videoTrack, audioTrack, metadataTrack) {\n this.videoTrack = videoTrack || new VideoTrack()\n this.audioTrack = audioTrack || new AudioTrack()\n this.metadataTrack = metadataTrack || new MetadataTrack()\n this._fixer = new FlvFixer(this.videoTrack, this.audioTrack, this.metadataTrack)\n }\n\n /**\n * @param {Uint8Array} data\n * @param {boolean} [discontinuity=false] 切流\n * @param {boolean} [contiguous=true]\n * @returns {DemuxResult}\n */\n demux (data, discontinuity = false, contiguous = true, seamlessLoadingSwitching) {\n const { audioTrack, videoTrack, metadataTrack } = this\n\n if (discontinuity || !contiguous) {\n this._remainingData = null\n }\n\n if (discontinuity) {\n this._headerParsed = false\n }\n\n if (discontinuity) {\n videoTrack.reset()\n audioTrack.reset()\n metadataTrack.reset()\n } else {\n videoTrack.samples = []\n audioTrack.samples = []\n metadataTrack.seiSamples = []\n metadataTrack.flvScriptSamples = []\n videoTrack.warnings = []\n audioTrack.warnings = []\n\n if (this._remainingData) {\n data = concatUint8Array(this._remainingData, data)\n this._remainingData = null\n }\n }\n\n if (!data.length) {\n return {\n videoTrack,\n audioTrack,\n metadataTrack\n }\n }\n\n let offset = 0\n if (!this._headerParsed) {\n if (!FlvDemuxer.probe(data)) {\n throw new Error('Invalid flv file')\n }\n audioTrack.present = ((data[4] & 4) >>> 2) !== 0\n videoTrack.present = (data[4] & 1) !== 0\n this._headerParsed = true\n offset = readBig32(data, 5) + 4 // skip prev tag size\n }\n\n const dataLen = data.length\n\n let tagType\n let dataSize\n let timestamp\n let bodyData\n let prevTagSize\n while ((offset + 15) < dataLen) { // header and prev tag size\n tagType = data[offset]\n dataSize = (data[offset + 1] << 16) | (data[offset + 2] << 8) | data[offset + 3]\n if (offset + 15 + dataSize > dataLen) break\n timestamp = (\n (data[offset + 7] << 24 >>> 0) +\n (data[offset + 4] << 16) +\n (data[offset + 5] << 8) +\n data[offset + 6]\n )\n\n offset += 11\n bodyData = data.subarray(offset, offset + dataSize)\n if (tagType === 8) {\n this._parseAudio(bodyData, timestamp)\n } else if (tagType === 9) {\n if (seamlessLoadingSwitching) this.seamlessLoadingSwitching = true\n this._parseVideo(bodyData, timestamp)\n } else if (tagType === 18) {\n this._parseScript(bodyData, timestamp)\n } else {\n logger.warn(`Invalid tag type: ${tagType}`)\n }\n\n offset += dataSize\n prevTagSize = readBig32(data, offset)\n if (prevTagSize !== 11 + dataSize) {\n logger.warn(`Invalid PrevTagSize ${prevTagSize} (${11 + dataSize})`)\n }\n\n offset += 4\n }\n\n if (offset < dataLen) {\n this._remainingData = data.subarray(offset)\n }\n\n audioTrack.formatTimescale = videoTrack.formatTimescale = videoTrack.timescale = metadataTrack.timescale = 1000\n audioTrack.timescale = audioTrack.codecType === AudioCodecType.OPUS ? 1000 : audioTrack.sampleRate || 0\n\n if (!audioTrack.exist() && audioTrack.hasSample()) {\n audioTrack.reset()\n }\n if (!videoTrack.exist() && videoTrack.hasSample()) {\n videoTrack.reset()\n }\n\n const scriptDataObject = metadataTrack.flvScriptSamples[metadataTrack.flvScriptSamples.length - 1]\n const metaData = scriptDataObject?.data?.onMetaData\n\n if (metaData) {\n if (videoTrack?.exist()) {\n if (metaData.hasOwnProperty('duration')) {\n videoTrack.duration = metaData.duration * 1000\n }\n\n if (metaData.hasOwnProperty('width') && metaData.hasOwnProperty('height')) {\n videoTrack.width = metaData.width\n videoTrack.height = metaData.height\n }\n }\n\n if (audioTrack?.exist()) {\n if (metaData.hasOwnProperty('duration')) {\n audioTrack.duration = metaData.duration * 1000\n }\n }\n }\n\n\n return {\n videoTrack,\n audioTrack,\n metadataTrack\n }\n }\n\n /**\n * @param {number} [startTime=0]\n * @param {boolean} [discontinuity=false]\n * @param {boolean} [contiguous=true]\n * @returns {DemuxResult}\n */\n fix (startTime, discontinuity, contiguous) {\n this._fixer.fix(startTime, discontinuity, contiguous)\n return {\n videoTrack: this.videoTrack,\n audioTrack: this.audioTrack,\n metadataTrack: this.metadataTrack\n }\n }\n\n /**\n * @param {Uint8Array} data\n * @param {boolean} [discontinuity=false]\n * @param {boolean} [contiguous=true]\n * @param {number} [startTime=0]\n * @returns {DemuxResult}\n */\n demuxAndFix (data, discontinuity, contiguous, startTime, seamlessLoadingSwitching) {\n this.demux(data, discontinuity, contiguous, seamlessLoadingSwitching)\n return this.fix(startTime, discontinuity, contiguous)\n }\n\n /**\n * @param { Uint8Array } data\n * @returns {boolean}\n */\n static probe (data) {\n if (data[0] !== 0x46 || data[1] !== 0x4C || data[2] !== 0x56 || data[3] !== 0x01) {\n return false\n }\n return readBig32(data, 5) >= 9\n }\n\n /**\n * @param {Uint8Array} data\n * @param {number} pts\n * @private\n */\n _parseAudio (data, pts) {\n if (!data.length) return\n\n const format = (data[0] & 0xf0) >>> 4\n const track = this.audioTrack\n\n if (\n format !== FlvSoundFormat.AAC &&\n format !== FlvSoundFormat.G711A &&\n format !== FlvSoundFormat.G711M &&\n format !== FlvSoundFormat.OPUS\n ) {\n logger.warn(`Unsupported sound format: ${format}`)\n track.reset()\n return\n }\n\n if (format !== FlvSoundFormat.AAC && format !== FlvSoundFormat.OPUS) {\n const soundRate = (data[0] & 0x0c) >> 2\n const soundSize = (data[0] & 0x02) >> 1\n const soundType = (data[0] & 0x01)\n track.sampleRate = FlvDemuxer.AUDIO_RATE[soundRate]\n track.sampleSize = soundSize ? 16 : 8\n track.channelCount = soundType + 1\n }\n\n switch (format) {\n case FlvSoundFormat.G711A:\n case FlvSoundFormat.G711M:\n this._parseG711(data, pts, format)\n break\n case FlvSoundFormat.AAC:\n this._parseAac(data, pts)\n break\n case FlvSoundFormat.OPUS:\n this._parseOpus(data, pts)\n break\n default:\n break\n }\n }\n\n /**\n * @param {Uint8Array} data\n * @param {number} pts\n * @private\n */\n _parseOpus (data, pts) {\n const track = this.audioTrack\n const packetType = data[1]\n\n track.codecType = AudioCodecType.OPUS\n\n switch (packetType) {\n case 0 /* Header Packets */: {\n const ret = OPUS.parseHeaderPackets(data.subarray(2))\n if (ret) {\n track.codec = ret.codec\n track.channelCount = ret.channelCount\n track.sampleRate = ret.sampleRate\n track.config = ret.config\n track.sampleDuration = OPUS.getFrameDuration([], track.timescale)\n } else {\n track.reset()\n logger.warn('Cannot parse AudioSpecificConfig', data)\n }\n break\n }\n case 1 /* Raw OPUS frame data */: {\n if (pts === undefined || pts === null) return\n\n const newSample = new AudioSample(pts, data.subarray(2), track.sampleDuration)\n track.samples.push(newSample)\n break\n }\n default:\n logger.warn(`Unknown OpusPacketType: ${packetType}`)\n }\n }\n\n _parseG711 (data, pts, format) {\n const track = this.audioTrack\n track.codecType = format === 7 ? AudioCodecType.G711PCMA : AudioCodecType.G711PCMU\n track.sampleRate = 8000\n track.codec = track.codecType\n track.samples.push(new AudioSample(pts, data.subarray(1)))\n }\n\n _parseAac (data, pts) {\n const track = this.audioTrack\n track.codecType = AudioCodecType.AAC\n\n if (data[1] === 0) { // AACPacketType\n const ret = AAC.parseAudioSpecificConfig(data.subarray(2))\n if (ret) {\n track.codec = ret.codec\n track.channelCount = ret.channelCount\n track.sampleRate = ret.sampleRate\n track.config = ret.config\n track.objectType = ret.objectType\n track.sampleRateIndex = ret.samplingFrequencyIndex\n } else {\n track.reset()\n logger.warn('Cannot parse AudioSpecificConfig', data)\n }\n } else if (data[1] === 1) { // Raw AAC frame data\n if (pts === undefined || pts === null) return\n track.samples.push(new AudioSample(pts, data.subarray(2)))\n } else {\n logger.warn(`Unknown AACPacketType: ${data[1]}`)\n }\n }\n\n _parseVideo (data, dts) {\n if (data.length < 6) return\n\n const frameType = (data[0] & 0xf0) >>> 4\n const codecId = data[0] & 0x0f\n\n const track = this.videoTrack\n\n if (\n codecId !== 7 && // AVC\n codecId !== 12 // HEVC\n ) {\n track.reset()\n logger.warn(`Unsupported codecId: ${codecId}`)\n return\n }\n\n const isHevc = codecId === 12\n track.codecType = isHevc ? VideoCodecType.HEVC : VideoCodecType.AVC\n\n const packetType = data[1]\n const cts = (((data[2] << 16) | (data[3] << 8) | (data[4])) << 8) >> 8\n\n if (packetType === 0) { // DecoderConfigurationRecord\n const configData = data.subarray(5)\n const ret = isHevc\n ? HEVC.parseHEVCDecoderConfigurationRecord(configData)\n : AVC.parseAVCDecoderConfigurationRecord(configData)\n if (ret) {\n const { hvcC, sps, ppsArr, spsArr, vpsArr, nalUnitSize } = ret\n if (hvcC) {\n track.hvcC = track.hvcC || hvcC\n }\n if (sps) {\n track.codec = sps.codec\n track.width = sps.width\n track.height = sps.height\n track.sarRatio = sps.sarRatio\n track.fpsNum = sps.fpsNum\n track.fpsDen = sps.fpsDen\n }\n if (spsArr.length) track.sps = spsArr\n if (ppsArr.length) track.pps = ppsArr\n if (vpsArr && vpsArr.length) track.vps = vpsArr\n if (nalUnitSize) track.nalUnitSize = nalUnitSize\n } else {\n logger.warn(`Cannot parse ${isHevc ? 'HEVC' : 'AVC'}DecoderConfigurationRecord`, data)\n }\n } else if (packetType === 1) { // One or more NALUs\n let units = NALu.parseAvcC(data.subarray(5), track.nalUnitSize)\n\n units = this._checkAddMetaNalToUnits(isHevc, units, track)\n\n if (units && units.length) {\n const sample = new VideoSample(dts + cts, dts, units)\n if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {\n return\n }\n this.seamlessLoadingSwitching = false\n if (frameType === 1) {\n sample.setToKeyframe()\n track.lastKeyFrameDts = dts\n }\n track.samples.push(sample)\n\n units.forEach(unit => {\n const type = isHevc ? (unit[0] >>> 1) & 0x3f : unit[0] & 0x1f\n switch (type) {\n case 5: // IDR\n case 16: // HEVC BLA_W_LP\n case 17: // HEVC BLA_W_RADL\n case 18: // HEVC BLA_N_LP\n case 19: // HEVC IDR_W_RADL\n case 20: // HEVC IDR_N_LP\n case 21: // HEVC CRA_NUT\n case 22: // HEVC RSV_IRAP_VCL22\n case 23: // HEVC RSV_IRAP_VCL23\n if ((!isHevc && type !== 5) || (isHevc && type === 5)) break\n sample.setToKeyframe()\n break\n case 6: // SEI\n case 39: // HEVC PREFIX_SEI\n case 40: // HEVC SUFFIX_SEI\n if ((!isHevc && type !== 6) || (isHevc && type === 6)) break\n this.metadataTrack.seiSamples.push(new SeiSample(\n NALu.parseSEI(NALu.removeEPB(unit), isHevc),\n dts + cts\n ))\n break\n default:\n }\n })\n\n if (sample.keyframe) {\n this._gopId++\n }\n sample.gopId = this._gopId\n } else {\n logger.warn('Cannot parse NALUs', data)\n }\n } else if (packetType === 2) {\n // AVC end of sequence, Empty\n } else {\n logger.warn(`Unknown AVCPacketType: ${packetType}`)\n }\n }\n\n _checkAddMetaNalToUnits (hevc, units, track) {\n if (!hevc || !this._needAddMetaBeforeKeyFrameNal) {\n this._needAddMetaBeforeKeyFrameNal = false\n return units\n }\n\n const nalTypes = units.map(x => (x[0] >>> 1) & 0x3f)\n\n if (nalTypes.includes(32)) {\n this._needAddMetaBeforeKeyFrameNal = false\n return units\n }\n\n units.unshift(track.pps[0])\n units.unshift(track.sps[0])\n units.unshift(track.vps[0])\n\n return units.filter(Boolean)\n }\n\n _parseScript (data, pts) {\n this.metadataTrack.flvScriptSamples.push(new FlvScriptSample(AMF.parse(data), pts))\n }\n}\n","\n// 改造为兼容IE11\nfunction Concat (ResultConstructor, ...arrays){\n let totalLength = 0\n arrays.forEach(function (arr){\n totalLength += arr.length\n })\n const result = new ResultConstructor(totalLength)\n let offset = 0\n arrays.forEach(function (arr){\n result.set(arr, offset)\n offset += arr.length\n })\n return result\n}\n\nclass Buffer {\n constructor () {\n this.buffer = new Uint8Array(0)\n }\n\n write (...buffer) {\n const self = this\n buffer.forEach(item => {\n if (item) {\n self.buffer = Concat(Uint8Array, self.buffer, item)\n } else {\n window.console.warn(item)\n }\n })\n }\n\n static writeUint16 (value) {\n return new Uint8Array([\n (value >> 8) & 0xff,\n value & 0xff\n ])\n }\n\n static writeUint32 (value) {\n return new Uint8Array([\n value >> 24,\n (value >> 16) & 0xff,\n (value >> 8) & 0xff,\n value & 0xff\n ])\n }\n}\n\nexport default Buffer\n","import { TsFixer } from './fixer'\nimport { AVC, AAC, HEVC, NALu } from '../codec'\nimport { VideoSample, AudioSample, VideoCodecType, VideoTrack, AudioTrack, MetadataTrack, SeiSample } from '../model'\nimport { Logger, concatUint8Array } from '../utils'\n\nconst logger = new Logger('TsDemuxer')\n\nexport class TsDemuxer {\n _pmtId = -1\n _remainingPacketData = null\n _videoPesData = []\n _audioPesData = []\n _gopId = 0\n\n /**\n * @param {VideoTrack} [videoTrack]\n * @param {AudioTrack} [audioTrack]\n * @param {MetadataTrack} [metadataTrack]\n */\n constructor (videoTrack, audioTrack, metadataTrack, fixerConfig = {}) {\n this.videoTrack = videoTrack || new VideoTrack()\n this.audioTrack = audioTrack || new AudioTrack()\n this.metadataTrack = metadataTrack || new MetadataTrack()\n this._fixer = new TsFixer(this.videoTrack, this.audioTrack, this.metadataTrack, fixerConfig)\n }\n\n /**\n * @param {Uint8Array} data\n * @param {boolean} [discontinuity=false]\n * @param {boolean} [contiguous=true]\n * @returns {import('../flv').DemuxResult}\n */\n demux (data, discontinuity = false, contiguous = true) {\n const { audioTrack, videoTrack, metadataTrack } = this\n\n if (discontinuity) {\n this._pmtId = -1\n videoTrack.reset()\n audioTrack.reset()\n metadataTrack.reset()\n }\n\n if (!contiguous || discontinuity) {\n this._remainingPacketData = null\n this._videoPesData = []\n this._audioPesData = []\n } else {\n videoTrack.samples = []\n audioTrack.samples = []\n metadataTrack.seiSamples = []\n videoTrack.warnings = []\n audioTrack.warnings = []\n\n if (this._remainingPacketData) {\n data = concatUint8Array(this._remainingPacketData, data)\n this._remainingPacketData = null\n }\n }\n\n let dataLen = data.length\n const remainingLength = dataLen % 188\n if (remainingLength) {\n this._remainingPacketData = data.subarray(dataLen - remainingLength)\n dataLen -= remainingLength\n }\n\n let videoPid = videoTrack.pid\n let audioPid = audioTrack.pid\n\n for (let start = 0; start < dataLen; start += 188) {\n if (data[start] !== 0x47) throw new Error('TS packet did not start with 0x47')\n const payloadUnitStartIndicator = !!(data[start + 1] & 0x40)\n const pid = ((data[start + 1] & 0x1f) << 8) + data[start + 2]\n const adaptationFiledControl = (data[start + 3] & 0x30) >> 4\n\n let offset\n if (adaptationFiledControl > 1) {\n offset = start + 5 + data[start + 4]\n if (offset === start + 188) continue\n } else {\n offset = start + 4\n }\n\n switch (pid) {\n case 0: // PAT\n if (payloadUnitStartIndicator) offset += data[offset] + 1\n this._pmtId = ((data[offset + 10] & 0x1f) << 8) | data[offset + 11]\n break\n case this._pmtId: {\n if (payloadUnitStartIndicator) offset += data[offset] + 1\n const tableEnd = offset + 3 + (((data[offset + 1] & 0x0f) << 8) | data[offset + 2]) - 4\n const programInfoLength = ((data[offset + 10] & 0x0f) << 8) | data[offset + 11]\n offset += 12 + programInfoLength\n\n while (offset < tableEnd) {\n const esPid = ((data[offset + 1] & 0x1f) << 8) | data[offset + 2]\n switch (data[offset]) {\n case 0x0f: // AAC ADTS\n audioTrack.pid = audioPid = esPid\n break\n case 0x1b: // AVC\n if (videoPid !== -1) break\n videoTrack.codecType = VideoCodecType.AVC\n videoTrack.pid = videoPid = esPid\n break\n case 0x24: // HEVC\n if (videoPid !== -1) break\n videoTrack.codecType = VideoCodecType.HEVC\n videoTrack.pid = videoPid = esPid\n break\n default:\n logger.warn(`Unsupported stream. type: ${data[offset]}, pid: ${esPid}`)\n }\n\n offset += (((data[offset + 3] & 0x0f) << 8) | data[offset + 4]) + 5\n }\n }\n break\n case videoPid:\n if (payloadUnitStartIndicator && this._videoPesData.length) {\n this._parseVideoData()\n }\n this._videoPesData.push(data.subarray(offset, start + 188))\n break\n case audioPid:\n if (payloadUnitStartIndicator && this._audioPesData.length) {\n this._parseAudioData()\n }\n this._audioPesData.push(data.subarray(offset, start + 188))\n break\n case 17:\n case 0x1fff:\n break\n default:\n logger.warn(`Unknown pid: ${pid}`)\n }\n }\n\n this._parseVideoData()\n this._parseAudioData()\n\n audioTrack.formatTimescale = videoTrack.formatTimescale = videoTrack.timescale = metadataTrack.timescale = 90000\n\n audioTrack.timescale = audioTrack.sampleRate || 0\n\n return {\n videoTrack,\n audioTrack,\n metadataTrack\n }\n }\n\n /**\n * @param {number} [startTime=0]\n * @param {boolean} [discontinuity=false]\n * @param {boolean} [contiguous=true]\n */\n fix (startTime, discontinuity, contiguous) {\n this._fixer.fix(startTime, discontinuity, contiguous)\n return {\n videoTrack: this.videoTrack,\n audioTrack: this.audioTrack,\n metadataTrack: this.metadataTrack\n }\n }\n\n /**\n * @param {Uint8Array} data\n * @param {boolean} [discontinuity=false]\n * @param {boolean} [contiguous=true]\n * @param {number} [startTime=0]\n */\n demuxAndFix (data, discontinuity, contiguous, startTime) {\n this.demux(data, discontinuity, contiguous)\n return this.fix(startTime, discontinuity, contiguous)\n }\n\n /**\n * @param { Uint8Array } data\n * @returns {boolean}\n */\n static probe (data) {\n if (!data.length) return false\n return data[0] === 0x47 && data[188] === 0x47 && data[376] === 0x47\n }\n\n _parseVideoData () {\n if (!this._videoPesData.length) return\n const pes = TsDemuxer._parsePES(concatUint8Array(...this._videoPesData))\n if (!pes) {\n logger.warn('Cannot parse video pes', this._videoPesData)\n return\n }\n\n const units = NALu.parseAnnexB(pes.data)\n if (units) {\n this._createVideoSample(units, pes.pts, pes.dts)\n } else {\n logger.warn('Cannot parse avc units', pes)\n }\n\n this._videoPesData = []\n }\n\n _createVideoSample (units, pts, dts) {\n if (!units.length) return\n const track = this.videoTrack\n const isHevc = track.codecType === VideoCodecType.HEVC\n\n const sample = new VideoSample(pts, dts)\n units.forEach((unit) => {\n const type = isHevc ? (unit[0] >>> 1) & 0x3f : unit[0] & 0x1f\n switch (type) {\n case 5: // IDR\n case 16: // HEVC BLA_W_LP\n case 17: // HEVC BLA_W_RADL\n case 18: // HEVC BLA_N_LP\n case 19: // HEVC IDR_W_RADL\n case 20: // HEVC IDR_N_LP\n case 21: // HEVC CRA_NUT\n case 22: // HEVC RSV_IRAP_VCL22\n case 23: // HEVC RSV_IRAP_VCL23\n if ((!isHevc && type !== 5) || (isHevc && type === 5)) break\n sample.setToKeyframe()\n this._gopId++\n break\n case 6: // SEI\n case 39: // HEVC PREFIX_SEI\n case 40: // HEVC SUFFIX_SEI\n if ((!isHevc && type !== 6) || (isHevc && type === 6)) break\n this.metadataTrack.seiSamples.push(new SeiSample(\n NALu.parseSEI(NALu.removeEPB(unit), isHevc),\n pts\n ))\n // fix 分割nal之前只要sei信息被当做单独一个sample\n return\n case 32: // HEVC VPS\n if (!isHevc) break\n if (!track.vps.length) {\n const hvcC = HEVC.parseVPS(NALu.removeEPB(unit), track.hvcC)\n track.hvcC = track.hvcC || hvcC\n track.vps = [unit]\n }\n break\n case 7: // SPS\n case 33: // HEVC SPS\n if ((!isHevc && type !== 7) || (isHevc && type === 7)) break\n if (!track.sps.length) {\n const data = NALu.removeEPB(unit)\n const spsInfo = isHevc ? HEVC.parseSPS(data, track.hvcC) : AVC.parseSPS(data)\n track.sps = [unit]\n track.hvcC = track.hvcC || spsInfo.hvcC\n track.codec = spsInfo.codec\n track.width = spsInfo.width\n track.height = spsInfo.height\n track.sarRatio = spsInfo.sarRatio\n track.fpsNum = spsInfo.fpsNum\n track.fpsDen = spsInfo.fpsDen\n }\n break\n case 8: // PPS\n case 34: // HEVC PPS\n if ((!isHevc && type !== 8) || (isHevc && type === 8)) break\n if (!track.pps.length) track.pps = [unit]\n break\n case 9: // AUD\n case 35: // HEVC AUD\n // if ((!isHevc && type !== 9) || (isHevc && type === 9)) break\n // sample.gopId = this._gopId\n // if (sample.units.length && !keyFrame) {\n // this._pushVideoSample(track, sample)\n // sample = this.prevAvcSample = new VideoSample(pts, dts)\n // }\n break\n case 38: // HEVC FD_NUT\n if (isHevc) {\n let ffByteFound = false\n for (let i = 2; i < unit.byteLength; i++) {\n if (unit[i] === 0xff) {\n ffByteFound = true\n break\n }\n }\n if (!ffByteFound) {\n return\n }\n }\n break\n default:\n }\n sample.units.push(unit)\n })\n sample.gopId = this._gopId\n this._pushVideoSample(track, sample)\n }\n\n _pushVideoSample (track, sample) {\n if (sample.units.length) {\n if (sample.pts === null || sample.pts === undefined) {\n logger.warn('Video sample no pts', sample)\n const lastSample = track.samples[track.samples.length - 1]\n if (lastSample) {\n sample.pts = lastSample.pts\n sample.dts = lastSample.dts\n } else {\n logger.warn('Drop video sample', sample)\n }\n } else {\n track.samples.push(sample)\n }\n }\n }\n\n _parseAudioData () {\n if (!this._audioPesData.length) return\n const pes = TsDemuxer._parsePES(concatUint8Array(...this._audioPesData))\n if (!pes) {\n logger.warn('Cannot parse audio pes', this._audioPesData)\n return\n }\n\n this._parseAacData(pes)\n\n this._audioPesData = []\n }\n\n _parseAacData (pes) {\n const track = this.audioTrack\n let pts = pes.pts\n if (pts === null || pts === undefined) {\n logger.warn('AAC pes not pts', track)\n if (!track.samples.length || !track.sampleRate) {\n return\n }\n pts = track.samples[track.samples.length - 1].pts + AAC.getFrameDuration(track.sampleRate)\n }\n\n const ret = AAC.parseADTS(pes.data, pts)\n if (ret) {\n track.codec = ret.codec\n track.channelCount = ret.channelCount\n track.sampleRate = ret.sampleRate\n track.objectType = ret.objectType\n track.sampleRateIndex = ret.samplingFrequencyIndex\n track.config = ret.config\n track.samples.push(...ret.frames.map((s) => new AudioSample(s.pts, s.data)))\n\n if (ret.skip) {\n logger.warn(`Skip aac adts ${ret.skip} bits`)\n }\n if (ret.remaining) {\n logger.warn(`Remaining aac adts ${ret.remaining} bits`)\n }\n } else {\n logger.warn('Cannot parse aac adts', pes)\n }\n }\n\n static _parsePES (data) {\n const headerDataLen = data[8]\n if (headerDataLen === null || headerDataLen === undefined || data.length < (headerDataLen + 9)) return\n const startPrefix = data[0] << 16 | data[1] << 8 | data[2]\n if (startPrefix !== 1) return\n const pesLen = (data[4] << 8) + data[5]\n if (pesLen && pesLen > data.length - 6) return\n\n let pts\n let dts\n const ptsDtsFlags = data[7]\n if (ptsDtsFlags & 0xc0) {\n pts = (data[9] & 0x0e) * 536870912 +\n (data[10] & 0xff) * 4194304 +\n (data[11] & 0xfe) * 16384 +\n (data[12] & 0xff) * 128 +\n (data[13] & 0xfe) / 2\n\n if (ptsDtsFlags & 0x40) {\n dts = (data[14] & 0x0e) * 536870912 +\n (data[15] & 0xff) * 4194304 +\n (data[16] & 0xfe) * 16384 +\n (data[17] & 0xff) * 128 +\n (data[18] & 0xfe) / 2\n if (pts - dts > 60 * 90000) pts = dts\n } else {\n dts = pts\n }\n }\n\n return { data: data.subarray(9 + headerDataLen), pts, dts }\n }\n}\n","import { AudioCodecType, TrackType, VideoCodecType } from '../model'\nimport { concatUint8Array, parse } from '../utils'\nimport Buffer from './buffer'\n\nconst UINT32_MAX = 2 ** 32 - 1\n\nexport class MP4 {\n static types = [\n 'Opus',\n 'dOps',\n 'av01',\n 'av1C',\n 'avc1',\n 'avcC',\n 'hvc1',\n 'hvcC',\n 'dinf',\n 'dref',\n 'esds',\n 'ftyp',\n 'hdlr',\n 'mdat',\n 'mdhd',\n 'mdia',\n 'mfhd',\n 'minf',\n 'moof',\n 'moov',\n 'mp4a',\n 'mvex',\n 'mvhd',\n 'pasp',\n 'stbl',\n 'stco',\n 'stsc',\n 'stsd',\n 'stsz',\n 'stts',\n 'tfdt',\n 'tfhd',\n 'traf',\n 'trak',\n 'trex',\n 'tkhd',\n 'vmhd',\n 'smhd',\n 'ctts',\n 'stss',\n 'styp',\n 'pssh',\n 'sidx',\n 'sbgp',\n 'saiz',\n 'saio',\n 'senc',\n 'trun',\n 'encv',\n 'enca',\n 'sinf',\n 'btrt',\n 'frma',\n 'tenc',\n 'schm',\n 'schi',\n 'mehd',\n 'fiel',\n 'sdtp'\n ].reduce((p, c) => {\n p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)]\n return p\n }, Object.create(null));\n\n static HDLR_TYPES = {\n video: new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61,\n 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]),\n audio: new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61,\n 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ])\n }\n\n static FTYPAVC1 = MP4.box(MP4.types.ftyp, new Uint8Array([\n 105, 115, 111, 109, // isom\n 0, 0, 0, 1,\n 105, 115, 111, 109,\n 97, 118, 99, 49 // avc1\n ]))\n\n static FTYPHEV1 = MP4.box(MP4.types.ftyp, new Uint8Array([\n 105, 115, 111, 109, // isom\n 0, 0, 0, 1,\n 105, 115, 111, 109,\n 104, 101, 118, 49 // hev1\n ]))\n\n static DINF = MP4.box(MP4.types.dinf, MP4.box(MP4.types.dref, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version\n 0x00, 0x00, 0x01 // entry_flags\n ])))\n\n static VMHD = MP4.box(MP4.types.vmhd, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphics mode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // op color\n ]))\n\n static SMHD = MP4.box(MP4.types.smhd, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance\n 0x00, 0x00 // reserved\n ]))\n\n static StblTable = new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ])\n\n static STTS = MP4.box(MP4.types.stts, MP4.StblTable)\n\n static STSC = MP4.box(MP4.types.stsc, MP4.StblTable)\n\n static STSZ = MP4.box(MP4.types.stsz, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]))\n\n static STCO = MP4.box(MP4.types.stco, MP4.StblTable)\n\n static box (type, ...payload) {\n payload = payload.filter(Boolean)\n const size = 8 + payload.reduce((p, c) => (p + c.byteLength), 0)\n const ret = new Uint8Array(size)\n ret[0] = (size >> 24) & 0xff\n ret[1] = (size >> 16) & 0xff\n ret[2] = (size >> 8) & 0xff\n ret[3] = size & 0xff\n ret.set(type, 4)\n let offset = 8\n payload.forEach((data) => {\n ret.set(data, offset)\n offset += data.byteLength\n })\n return ret\n }\n\n static ftyp (tracks) {\n const isHevc = tracks.find(t => t.type === TrackType.VIDEO && t.codecType === VideoCodecType.HEVC)\n return isHevc ? MP4.FTYPHEV1 : MP4.FTYPAVC1\n }\n\n static initSegment (tracks) {\n const ftyp = MP4.ftyp(tracks)\n // console.log('[remux],ftyp ,len ', ftyp.byteLength, hashVal(ftyp.toString()))\n const init = concatUint8Array(ftyp, MP4.moov(tracks))\n // console.log('[remux],init ,len ', init.byteLength, hashVal(init.toString()))\n return init\n }\n\n static pssh (data) {\n // const buffer = new Buffer()\n const content = new Uint8Array(\n [\n 0x01, 0x00, 0x00, 0x00 // version\n ].concat(\n [\n 0x10, 0x77, 0xef, 0xec,\n 0xc0, 0xb2, 0x4d, 0x02,\n 0xac, 0xe3, 0x3c, 0x1e,\n 0x52, 0xe2, 0xfb, 0x4b\n ],\n [0x00, 0x00, 0x00, 0x01],\n parse(data.kid),\n [0x00, 0x00, 0x00, 0x00]\n )\n )\n return MP4.box(MP4.types.pssh, content)\n }\n\n static moov (tracks) {\n if (tracks[0].useEME && (tracks[0].encv || tracks[0].enca)) {\n if (!tracks[0].pssh) {\n tracks[0].pssh = {\n kid: tracks[0].kid\n }\n }\n const pssh = this.pssh(tracks[0].pssh)\n // console.log('[remux],pssh,', hashVal(pssh.toString()))\n return MP4.box(MP4.types.moov,\n MP4.mvhd(tracks[0].mvhdDurtion || tracks[0].duration, tracks[0].mvhdTimecale || tracks[0].timescale),\n MP4.mvex(tracks),\n ...tracks.map((t) => MP4.trak(t)),\n pssh)\n } else {\n return MP4.box(MP4.types.moov,\n MP4.mvhd(tracks[0].mvhdDurtion || tracks[0].duration, tracks[0].mvhdTimecale || tracks[0].timescale),\n ...tracks.map((t) => MP4.trak(t)),\n MP4.mvex(tracks)\n )\n }\n }\n\n static mvhd (duration, timescale = 90000) {\n const mvhd = MP4.box(MP4.types.mvhd, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (timescale >> 24) & 0xff, (timescale >> 16) & 0xff, (timescale >> 8) & 0xff, timescale & 0xff,\n (duration >> 24) & 0xff, (duration >> 16) & 0xff, (duration >> 8) & 0xff, duration & 0xff,\n 0x00, 0x01, 0x00, 0x00, // rate\n 0x01, 0x00, // volume\n 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // matrix\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0xff, 0xff, 0xff, 0xff // todo 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]))\n // console.log('[remux],mvhd, len,', mvhd.byteLength, hashVal(mvhd.toString()))\n return mvhd\n }\n\n static trak (track) {\n const trak = MP4.box(\n MP4.types.trak,\n MP4.tkhd(track.id, track.tkhdDuration || 0, track.width, track.height),\n MP4.mdia(track)\n )\n // console.log('[remux],trak, len,', trak.byteLength, track.id, hashVal(trak.toString()))\n return trak\n }\n\n static tkhd (id, duration, width = 0, height = 0) {\n const tkhd = MP4.box(MP4.types.tkhd, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x07, // flags、todo 0x07\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time todo\n (id >> 24) & 0xff, (id >> 16) & 0xff, (id >> 8) & 0xff, id & 0xff,\n 0x00, 0x00, 0x00, 0x00,\n (duration >> 24) & 0xff, (duration >> 16) & 0xff, (duration >> 8) & 0xff, duration & 0xff, // todo (duration >> 24) & 0xff, (duration >> 16) & 0xff, (duration >> 8) & 0xff, duration & 0xff,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // /*0x00*/ alternate_group //todo type === 'video' ? 0x01 : 0x00(第二个位置)\n 0x01, 0x00, // /* 0x01 */, 0x00, // non-audio track volume //todo type === 'audio' ? 0x01 : 0x00(第一个位置)\n 0x00, 0x00, // reserved\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x01, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x40, 0x00, 0x00, 0x00, // matrix\n (width >> 8) & 0xff, width & 0xff, 0x00, 0x00,\n (height >> 8) & 0xff, height & 0xff, 0x00, 0x00\n ]))\n // console.log('[remux],tkhd, len,', tkhd.byteLength, hashVal(tkhd.toString()))\n return tkhd\n }\n\n static mdia (track) {\n const mdia = MP4.box(MP4.types.mdia, MP4.mdhd(track.duration, track.timescale), MP4.hdlr(track.type), MP4.minf(track))\n // console.log('[remux],mdia, len,', mdia.byteLength, hashVal(mdia.toString()))\n return mdia\n }\n\n static mdhd (duration, timescale = 90000) {\n const mdhd = MP4.box(MP4.types.mdhd, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // todo 0x00, 0x00, 0x00, 0x00, // modification_time\n (timescale >> 24) & 0xff, (timescale >> 16) & 0xff, (timescale >> 8) & 0xff, timescale & 0xff,\n (duration >> 24) & 0xff, (duration >> 16) & 0xff, (duration >> 8) & 0xff, duration & 0xff, // (duration >> 24) & 0xff, (duration >> 16) & 0xff, (duration >> 8) & 0xff, duration & 0xff,//todo\n 0x55, 0xc4, // 'und' language (undetermined) //todo 0x15, 0xC7\n 0x00, 0x00 // pre_defined\n ]))\n // console.log('[remux],mdhd, len,', mdhd.byteLength, hashVal(mdhd.toString()))\n return mdhd\n }\n\n static hdlr (type) {\n const hdlr = MP4.box(MP4.types.hdlr, MP4.HDLR_TYPES[type])\n // console.log('[remux],hdlr, len,', hdlr.byteLength, hashVal(hdlr.toString()))\n return hdlr\n }\n\n static minf (track) {\n const minf = MP4.box(MP4.types.minf, track.type === TrackType.VIDEO ? MP4.VMHD : MP4.SMHD, MP4.DINF, MP4.stbl(track))\n // console.log('[remux],minf, len,', minf.byteLength, hashVal(minf.toString()))\n return minf\n }\n\n static stbl (track) {\n const extBox = []\n if (track && track.ext) {\n track.ext.stss && extBox.push(MP4.stss(track.ext.stss.entries))\n // track.ext.stss && extBox.push(MP4.ctts(track.ext.stss.entries))\n }\n const stbl = MP4.box(MP4.types.stbl, MP4.stsd(track), MP4.STTS, extBox[0], MP4.STSC, MP4.STSZ, MP4.STCO)\n // console.log('[remux],stbl, len,', stbl.byteLength, hashVal(stbl.toString()))\n return stbl\n }\n\n static stsd (track) {\n let content\n\n if (track.type === 'audio') {\n if (track.useEME && track.enca) {\n content = MP4.enca(track)\n // console.log('[remux],enca, len,', content.byteLength, track.type, hashVal(content.toString()))\n } else {\n if (track.codecType === AudioCodecType.OPUS) {\n content = MP4.opus(track)\n } else {\n content = MP4.mp4a(track)\n }\n }\n } else if (track.useEME && track.encv) {\n content = MP4.encv(track)\n // console.log('[remux],encv, len,', content.byteLength, track.type, hashVal(content.toString()))\n } else if (track.av1C) {\n content = MP4.av01(track)\n } else {\n content = MP4.avc1hev1(track)\n // console.log('[remux],avc1hev1, len,', content.byteLength, track.type, hashVal(content.toString()))\n }\n const stsd = MP4.box(MP4.types.stsd, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01 // entry_count\n ]), content)\n // console.log('[remux],stsd, len,', stsd.byteLength, hashVal(stsd.toString()))\n return stsd\n }\n\n static enca (data) {\n const channelCount = data.enca.channelCount\n const sampleRate = data.enca.sampleRate\n const content = new Uint8Array([\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, channelCount, // channelcount\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, 0x00, 0x00, // reserved2\n (sampleRate >> 8) & 0xff,\n sampleRate & 0xff, //\n 0x00, 0x00\n ])\n const esds = MP4.esds(data.config)\n // console.log('[remux],esds, len,', esds.byteLength, hashVal(esds.toString()))\n const sinf = MP4.sinf(data.enca)\n // console.log('[remux],sinf, len,', sinf.byteLength, hashVal(sinf.toString()))\n return MP4.box(MP4.types.enca, content, esds, sinf)\n }\n\n static encv (track) {\n const sps = track.sps.length > 0 ? track.sps[0] : []\n const pps = track.pps.length > 0 ? track.pps[0] : []\n const width = track.width\n const height = track.height\n const hSpacing = track.sarRatio[0]\n const vSpacing = track.sarRatio[1]\n\n const content = new Uint8Array([\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n (width >> 8) & 0xff,\n width & 0xff, // width\n (height >> 8) & 0xff,\n height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n\n 0x12,\n 0x64, 0x61, 0x69, 0x6C, // dailymotion/hls.js\n 0x79, 0x6D, 0x6F, 0x74,\n 0x69, 0x6F, 0x6E, 0x2F,\n 0x68, 0x6C, 0x73, 0x2E,\n 0x6A, 0x73, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11]) // pre_defined = -1;\n const avcc = new Uint8Array([\n 0x01, // version\n sps[1], // profile\n sps[2], // profile compatible\n sps[3], // level\n 0xfc | 3,\n 0xE0 | 1, // 目前只处理一个sps\n sps.length >>> 8 & 0xff,\n sps.length & 0xff\n ].concat(...sps).concat([\n 0x01,\n pps.length >>> 8 & 0xff,\n pps.length & 0xff\n ]).concat(...pps))\n const btrt = new Uint8Array([\n 0x00, 0x00, 0x58, 0x39,\n 0x00, 0x0F, 0xC8, 0xC0,\n 0x00, 0x04, 0x56, 0x48\n ])\n const sinf = MP4.sinf(track.encv)\n const pasp = new Uint8Array([\n (hSpacing >> 24), // hSpacing\n (hSpacing >> 16) & 0xff,\n (hSpacing >> 8) & 0xff,\n hSpacing & 0xff,\n (vSpacing >> 24), // vSpacing\n (vSpacing >> 16) & 0xff,\n (vSpacing >> 8) & 0xff,\n vSpacing & 0xff\n ])\n return MP4.box(MP4.types.encv, content, MP4.box(MP4.types.avcC, avcc), MP4.box(MP4.types.btrt, btrt), sinf, MP4.box(MP4.types.pasp, pasp))\n }\n\n static schi (data) {\n const content = new Uint8Array([])\n const tenc = MP4.tenc(data)\n return MP4.box(MP4.types.schi, content, tenc)\n }\n\n static tenc (data) {\n // 用于每个track的加密参数(包括KID、初始化向量、加密标志位),包含在TrackEncryptionBox(‘tenc’)中。\n const content = new Uint8Array(\n [\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // skip\n data.default_IsEncrypted & 0xff, // default_isProtected\n data.default_IV_size & 0xff // default_Per_Sample_IV_Size\n ].concat(parse(data.default_KID)))\n return MP4.box(MP4.types.tenc, content)\n }\n\n static sinf (data) {\n const content = new Uint8Array([])\n const frma = new Uint8Array([\n data.data_format.charCodeAt(0),\n data.data_format.charCodeAt(1),\n data.data_format.charCodeAt(2),\n data.data_format.charCodeAt(3)\n ])\n const schm = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00,\n 0x63, 0x65, 0x6E, 0x63, // cenc\n 0x00, 0x01, 0x00, 0x00 // version\n ])\n const schi = MP4.schi(data)\n return MP4.box(MP4.types.sinf, content, MP4.box(MP4.types.frma, frma), MP4.box(MP4.types.schm, schm), schi)\n }\n static av01 (track) {\n return MP4.box(MP4.types.av01, new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n (track.width >> 8) & 0xff, track.width & 0xff, // width\n (track.height >> 8) & 0xff, track.height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // compressor name\n 0x00, 0x18, // depth\n 0x11, 0x11 // pre_defined = -1 //todo\n ]), track.av1C, track.colr)\n }\n static avc1hev1 (track) {\n const isHevc = track.codecType === VideoCodecType.HEVC\n const typ = isHevc ? MP4.types.hvc1 : MP4.types.avc1\n const config = isHevc ? MP4.hvcC(track) : MP4.avcC(track)\n const boxes = [\n new Uint8Array([\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n (track.width >> 8) & 0xff, track.width & 0xff, // width\n (track.height >> 8) & 0xff, track.height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, // compressor name\n 0x00, 0x18, // depth\n 0x11, 0x11 // pre_defined = -1 //todo\n ]), config\n ]\n // console.log('[remux],avc1hev1_0, len,', boxes[0].byteLength, hashVal(boxes[0].toString()))\n // console.log('[remux],avc1hev1_1, len,', boxes[1].byteLength, hashVal(boxes[1].toString()))\n if (isHevc) {\n boxes.push(MP4.box(MP4.types.fiel, new Uint8Array([0x01, 0x00])))\n // console.log('[remux],fiel, len,', boxes[2].byteLength, hashVal(boxes[2].toString()))\n } else if (track.sarRatio && track.sarRatio.length > 1) {\n boxes.push(MP4.pasp(track.sarRatio))\n // console.log('[remux],pasp, len,', boxes[2].byteLength, hashVal(boxes[2].toString()))\n }\n return MP4.box(typ, ...boxes)\n }\n\n static avcC (track) {\n const sps = []\n const pps = []\n\n let len\n track.sps.forEach((s) => {\n len = s.byteLength\n sps.push((len >>> 8) & 0xff)\n sps.push(len & 0xff)\n sps.push(...s)\n })\n\n track.pps.forEach((p) => {\n len = p.byteLength\n pps.push((len >>> 8) & 0xff)\n pps.push(len & 0xff)\n pps.push(...p)\n })\n\n return MP4.box(MP4.types.avcC, new Uint8Array([\n 0x01, // configurationVersion\n sps[3], // AVCProfileIndication\n sps[4], // profile_compatibility\n sps[5], // AVCLevelIndication\n 0xfc | 3, // lengthSizeMinusOne\n 0xe0 | track.sps.length // 3bit reserved (111) + numOfSequenceParameterSets\n ].concat(...sps)\n .concat([track.pps.length]) // numOfPictureParameterSets\n .concat(...pps)))\n }\n\n static hvcC (track) {\n const hvcC = track.hvcC\n if (hvcC instanceof ArrayBuffer || hvcC instanceof Uint8Array) return hvcC\n const { vps, sps, pps } = track\n let data\n if (hvcC) {\n const pcf = hvcC.generalProfileCompatibilityFlags\n const cif = hvcC.generalConstraintIndicatorFlags\n const numOfArrays = (vps.length && 1) + (sps.length && 1) + (pps.length && 1)\n data = [\n 0x01, // configurationVersion\n hvcC.generalProfileSpace << 6 | hvcC.generalTierFlag << 5 | hvcC.generalProfileIdc,\n pcf >>> 24, pcf >>> 16, pcf >>> 8, pcf,\n cif[0], cif[1], cif[2], cif[3], cif[4], cif[5],\n hvcC.generalLevelIdc,\n 0xF0, 0x00, // min_spatial_segmentation_idc\n 0xFC, // parallelismType\n hvcC.chromaFormatIdc | 0xFC,\n hvcC.bitDepthLumaMinus8 | 0xF8,\n hvcC.bitDepthChromaMinus8 | 0xF8,\n 0x00, 0x00, // avgFrameRate\n hvcC.numTemporalLayers << 3 | hvcC.temporalIdNested << 2 | 3,\n numOfArrays\n ]\n const write = (x) => {\n data.push(x.length >> 8, x.length)\n data.push(...x)\n }\n if (vps.length) {\n data.push(0xA0, 0x00, vps.length)\n vps.forEach(write)\n }\n if (sps.length) {\n data.push(0xA1, 0x00, sps.length)\n sps.forEach(write)\n }\n if (pps.length) {\n data.push(0xA2, 0x00, pps.length)\n pps.forEach(write)\n }\n } else {\n data = [\n 0x01, // configurationVersion\n 0x01, // profile_space + tier_flag + profile_idc\n 0x60, 0x00, 0x00, 0x00, // general_profile_compatibility\n 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, // constraint_indicator_flags\n 0x5D, // level_idc=90\n 0xF0, 0x00, 0xFC, 0xFD, // profile_compatibility_indications\n 0xF8, // ‘11111’b + bitDepthLumaMinus8\n 0xF8, // ‘11111’b + bitDepthChromaMinus8\n 0x00, 0x00, // avgFrameRate\n 0x0F, // constantFrameRate + numTemporalLayers + ‘1’b + lengthSizeMinusOne\n 0x03, // numOfArrays\n\n // vps\n 0xA0, 0x00, 0x01, // array_completeness + ‘0’b + NAL_unit_type + numNalus\n 0x00, 0x18, // nalUnitLength\n 0x40, 0x01, 0x0C, 0x01, 0xFF, 0xFF, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x5D, 0x99, 0x98, 0x09,\n\n // sps\n 0xA1, 0x00, 0x01, // array_completeness + ‘0’b + NAL_unit_type + numNalus\n 0x00, 0x2D, // nalUnitLength\n 0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x90, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x5D, 0xA0, 0x02,\n 0x80, 0x80, 0x2D, 0x16, 0x59, 0x99, 0xA4, 0x93, 0x2B, 0x9A, 0x80, 0x80, 0x80, 0x82, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00,\n 0x00, 0x03, 0x00, 0x32, 0x10,\n\n // pps\n 0xA2, 0x00, 0x01, // array_completeness + ‘0’b + NAL_unit_type + numNalus\n 0x00, 0x07, // nalUnitLength\n 0x44, 0x01, 0xC1, 0x72, 0xB4, 0x62, 0x40\n ]\n }\n return MP4.box(MP4.types.hvcC, new Uint8Array(data))\n }\n\n static pasp ([hSpacing, vSpacing]) {\n return MP4.box(MP4.types.pasp, new Uint8Array([\n hSpacing >> 24, (hSpacing >> 16) & 0xff, (hSpacing >> 8) & 0xff, hSpacing & 0xff,\n vSpacing >> 24, (vSpacing >> 16) & 0xff, (vSpacing >> 8) & 0xff, vSpacing & 0xff\n ]))\n }\n\n static mp4a (track) {\n return MP4.box(MP4.types.mp4a, new Uint8Array([\n 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, track.channelCount,\n 0x00, 0x10, // sampleSize:16bits\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n (track.sampleRate >> 8) & 0xff, track.sampleRate & 0xff,\n 0x00, 0x00\n ]), track.config.length ? MP4.esds(track.config) : undefined)\n }\n\n static esds (config) {\n const len = config.length\n const esds = MP4.box(MP4.types.esds, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x03, // tag\n 0x17 + len, // length\n 0x00, 0x00, // ES_ID\n 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority\n 0x04, // tag\n 0x0f + len, // length\n 0x40, // object type\n 0x15, // streamType\n 0x00, 0x06, 0x00, // bufferSizeDB\n 0x00, 0x00, 0xda, 0xc0, // maxBitrate\n 0x00, 0x00, 0xda, 0xc0, // avgBitrate\n 0x05 // tag, DecoderSpecificInfoTag\n ].concat([len])\n .concat(config)\n .concat(\n [0x06, 0x01, 0x02]// GASpecificConfig\n )\n ))\n // console.log('[remux],esds ,len ', esds.byteLength, hashVal(esds.toString()))\n return esds\n }\n\n /**\n * https://opus-codec.org/docs/opus_in_isobmff.html\n */\n static opus (track) {\n const opusAudioDescription = new Uint8Array([\n 0x00, 0x00, 0x00, // version\n 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n track.channelCount,\n 0x00, 0x10, // sampleSize\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n (track.sampleRate >> 8) & 0xff,\n track.sampleRate & 0xff, // sampleRate\n 0x00, 0x00\n ])\n\n const opusSpecificConfig = track.config.length ? MP4.dOps(track) : []\n return MP4.box(MP4.types.Opus, opusAudioDescription, opusSpecificConfig)\n }\n\n static dOps (track) {\n if (track.config) {\n track.config[4] = (track.sampleRate >>> 24) & 0xFF\n track.config[5] = (track.sampleRate >>> 16) & 0xFF\n track.config[6] = (track.sampleRate >>> 8) & 0xFF\n track.config[7] = (track.sampleRate) & 0xFF\n\n return MP4.box(MP4.types.dOps, track.config)\n }\n\n // const {channelCount, channelConfigCode, sampleRate } = track\n\n // const mapping = channelConfigCode?.map((c) => {\n // return [\n // (c >>> 4) & 0xFF, // Channel mapping family\n // c & 0xFF // Channel mapping index\n // ]\n // }).flat() || []\n\n // const data = new Uint8Array([\n // 0x00, // version\n // channelCount, // channelCount\n // 0x00, 0x00, // preSkip\n // (sampleRate >>> 24) & 0xFF,\n // (sampleRate >>> 17) & 0xFF,\n // (sampleRate >>> 8) & 0xFF,\n // (sampleRate >>> 0) & 0xFF,\n // 0x00, 0x00, // Global Gain\n // ... mapping\n // ])\n\n // return data\n }\n\n static mvex (tracks) {\n // const mehd = MP4.box(MP4.types.mehd, this.extension(0, 0), Buffer.writeUint32(tracks[0].tkhdDuration))\n // const mvex = MP4.box(MP4.types.mvex, mehd, MP4.trex1(1), MP4.trex2(2))\n // // console.log('[remux],mvex, len,', mvex.byteLength, hashVal(mvex.toString()))\n // const mvex = MP4.box(MP4.types.mvex, MP4.trex1(1), MP4.trex2(2))\n const mvex = MP4.box(MP4.types.mvex, ...tracks.map((t) => MP4.trex(t.id)))\n // console.log('[remux],mvex, len,', mvex.byteLength, hashVal(mvex.toString()))\n return mvex\n }\n\n static trex (id) {\n const trex = MP4.box(MP4.types.trex, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n id >> 24, (id >> 16) & 0xff, (id >> 8) & 0xff, id & 0xff, // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]))\n // console.log('[remux],trex, len,', trex.byteLength, hashVal(trex.toString()))\n return trex\n }\n\n static trex1 (id) {\n const trex = MP4.box(MP4.types.trex, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n (id >> 24),\n (id >> 16) & 0xff,\n (id >> 8) & 0xff,\n (id & 0xff), // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x02, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x00 // default_sample_flags\n ]))\n // console.log('[remux],trex, len,', trex.byteLength, hashVal(trex.toString()))\n return trex\n }\n\n static trex2 (id) {\n const trex = MP4.box(MP4.types.trex, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n (id >> 24),\n (id >> 16) & 0xff,\n (id >> 8) & 0xff,\n (id & 0xff), // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x04, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x02, 0x00, 0x00, 0x00 // default_sample_flags\n ]))\n // console.log('[remux],trex, len,', trex.byteLength, hashVal(trex.toString()))\n return trex\n }\n\n static moof (tracks) {\n const moof = MP4.box(MP4.types.moof, MP4.mfhd(tracks[0].samples ? tracks[0].samples[0].gopId : 0), ...tracks.map((t) => MP4.traf(t)))\n // console.log('[remux],moof, len', moof.byteLength)\n return moof\n // return MP4.box(MP4.types.moof, MP4.mfhd(tracks[0].gopId), ...tracks.map((t) => MP4.traf(t)))\n }\n\n static mfhd (sequenceNumber) {\n // sequenceNumber += 1\n const mfhd = MP4.box(MP4.types.mfhd, new Uint8Array([\n 0x00, // version\n 0x00, 0x00, 0x00, // flags\n sequenceNumber >> 24, (sequenceNumber >> 16) & 0xff, (sequenceNumber >> 8) & 0xff, sequenceNumber & 0xff\n ]))\n // console.log('[remux],mfhd, len,', mfhd.byteLength, hashVal(mfhd.toString()))\n return mfhd\n }\n\n static traf (track) {\n const tfhd = MP4.tfhd(track.id)\n // console.log('[remux],tfhd, len,', tfhd.byteLength, hashVal(tfhd.toString()), ', trackid = ', track.id)\n // console.log('[remux],tfdt,baseMediaDecodeTime,', track.baseMediaDecodeTime)\n const tfdt = MP4.tfdt(track, track.baseMediaDecodeTime)\n let sencLength = 0\n let samples\n if (track.isVideo && track.videoSenc) {\n samples = track.videoSenc\n samples.forEach(function (item) {\n sencLength = sencLength + 8\n if (item.subsamples && item.subsamples.length) {\n sencLength = sencLength + 2\n sencLength = sencLength + item.subsamples.length * 6\n }\n })\n }\n track.videoSencLength = sencLength\n // console.log('[remux],tfdt, len,', tfdt.toString().length)\n // console.log('[remux],tfdt, len,', tfdt.byteLength, hashVal(tfdt.toString()))\n if (!track.useEME || (!track.isVideoEncryption && !track.isAudioEncryption)) {\n const sdtp = MP4.sdtp(track)\n // console.log('[remux],sdtp, len,', sdtp.byteLength, hashVal(sdtp.toString()))\n const offset = 16 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8 // mdat header\n return MP4.box(MP4.types.traf, tfhd, tfdt, sdtp, MP4.trun(track.samples, sdtp.byteLength + offset))\n } else if (track.isVideoEncryption) {\n if (track.isVideo) {\n // 加密视频\n const saiz = MP4.saiz(track)\n const saio = MP4.saio(track)\n const trun = MP4.trun1(track)\n const senc = MP4.senc(track)\n const traf = MP4.box(MP4.types.traf, tfhd, tfdt, saiz, saio, trun, senc)\n // console.log('[remux],trex_video, len,', traf.byteLength, hashVal(traf.toString()))\n return traf\n } else {\n // 视频加密,音频加密和未加密处理\n if (!track.isAudioEncryption) {\n // 音频未加密\n const sbgp = MP4.sbgp()\n const trun = MP4.trun1(track)\n return MP4.box(MP4.types.traf, tfhd, tfdt, sbgp, trun)\n } else {\n // 音频加密\n const sbgp = MP4.sbgp()\n const saiz = MP4.saiz(track)\n const saio = MP4.saio(track)\n const senc = MP4.senc(track)\n const trun = MP4.trun1(track)\n const traf = MP4.box(MP4.types.traf, tfhd, tfdt, sbgp, saiz, saio, senc, trun)\n // console.log('[remux],trex_audio, len,', traf.byteLength, hashVal(traf.toString()))\n return traf\n }\n }\n } else {\n // 视频未加密,音频加密\n if (track.isVideo) {\n const trun = MP4.trun1(track)\n return MP4.box(MP4.types.traf, tfhd, tfdt, trun)\n } else {\n const sbgp = MP4.sbgp()\n const saiz = MP4.saiz(track)\n const saio = MP4.saio(track)\n const senc = MP4.senc(track)\n const trun = MP4.trun1(track)\n const traf = MP4.box(MP4.types.traf, tfhd, tfdt, sbgp, saiz, saio, senc, trun)\n // console.log('[remux],trex, len,', traf.byteLength, hashVal(traf.toString()))\n return traf\n }\n }\n }\n\n static sdtp (data) {\n const buffer = new Buffer()\n data.samples.forEach(item => {\n buffer.write(new Uint8Array(data.isVideo ? [item.keyframe ? 32 : 16] : [16]))\n })\n return MP4.box(MP4.types.sdtp, this.extension(0, 0), buffer.buffer)\n }\n\n static trun1 (data) {\n // const id = data.id\n // const ceil = id === 1 ? 12 : 4\n const buffer = new Buffer()\n const sampleCount = Buffer.writeUint32(data.samples.length)\n let offset = null\n if (data.isVideo) {\n const sencLength = data.videoSencLength\n /*\n 16 + // mfhd\n 16 + // tfhd\n 20 + // tfdt\n 17 + //saiz\n 24 + //saio\n data.samples.length*16\n 4(offset) + 4(sampleCount) + 12(header) //trun\n 12(header) + sencLength //senc\n 8 + // traf header\n 8 + // moof header\n 8 // mdat header\n = 149+data.samples.length * 16 + sencLength\n */\n offset = Buffer.writeUint32(data.samples.length * 16 + sencLength + 149)\n if (!data.isVideoEncryption && data.isAudioEncryption) {\n offset = Buffer.writeUint32(data.samples.length * 16 + 92)\n }\n } else {\n /*\n 16 + // mfhd\n 16 + // tfhd\n 20 + // tfdt\n 28 + //sbgp\n 4(offset) + 4(sampleCount) + 12(header) //trun\n 8 + // traf header\n 8 + // moof header\n 8 // mdat header\n */\n let len = data.samples.length * 12 + 124\n if (data.isAudioEncryption) {\n len = data.samples.length * 12 + 8 * data.audioSenc.length + 177\n }\n offset = Buffer.writeUint32(len)\n }\n\n data.samples.forEach(item => {\n buffer.write(Buffer.writeUint32(item.duration))\n buffer.write(Buffer.writeUint32(item.size))\n buffer.write(Buffer.writeUint32(item.keyframe ? 0x02000000 : 0x00010000))\n if (data.isVideo) {\n buffer.write(Buffer.writeUint32(item.cts ? item.cts : 0))\n }\n })\n\n return MP4.box(MP4.types.trun, this.extension(0, data.flags), sampleCount, offset, buffer.buffer)\n }\n\n static senc (data) {\n const buffer = new Buffer()\n const len = data.samples.length\n const ceil = data.isVideo ? 16 : 8\n const flag = data.isVideo ? 2 : 0\n let samples = []\n let samplesLength = 0\n if (data.isVideo) {\n samples = data.videoSenc\n samplesLength = data.videoSencLength\n } else {\n samples = data.audioSenc\n }\n samplesLength = samplesLength || ceil * len\n buffer.write(\n Buffer.writeUint32(16 + samplesLength), MP4.types.senc, this.extension(0, flag)\n )\n buffer.write(Buffer.writeUint32(len))\n samples.forEach(item => {\n for (let i = 0; i < item.InitializationVector.length; i++) {\n buffer.write(new Uint8Array([item.InitializationVector[i]]))\n }\n if (item.subsamples && item.subsamples.length) {\n buffer.write(Buffer.writeUint16(item.subsamples.length))\n item.subsamples.forEach(value => {\n buffer.write(Buffer.writeUint16(value.BytesOfClearData))\n buffer.write(Buffer.writeUint32(value.BytesOfProtectedData))\n })\n }\n })\n return buffer.buffer\n // return MP4.box(MP4.types.senc, this.extension(0, flag), buffer.buffer)\n }\n\n static saio (data) {\n let length = data.samples.length * 12 + 141\n if (!data.isVideo && data.isAudioEncryption) {\n length = 149\n }\n const content = new Uint8Array([\n 0x01, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x01,\n 0x00, 0x00, 0x00, 0x00,\n (length >> 24) & 0xff,\n (length >> 16) & 0xff,\n (length >> 8) & 0xff,\n length & 0xff\n ])\n return MP4.box(MP4.types.saio, content)\n }\n\n static saiz (data) {\n const samplesLength = data.samples.length\n const content = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00,\n 0x10, // default sample info size\n (samplesLength >> 24) & 0xff,\n (samplesLength >> 16) & 0xff,\n (samplesLength >> 8) & 0xff,\n samplesLength & 0xff\n ])\n return MP4.box(MP4.types.saiz, content)\n }\n\n static sbgp () {\n const content = new Uint8Array([\n 0x72, 0x6F, 0x6C, 0x6C, // sgpd, grouping_type\n 0x00, 0x00, 0x00, 0x01,\n 0x00, 0x00, 0x01, 0x19,\n 0x00, 0x00, 0x00, 0x01\n ])\n return MP4.box(MP4.types.sbgp, this.extension(0, 0), content)\n }\n\n static extension (version, flag) {\n return new Uint8Array([\n version,\n (flag >> 16) & 0xff,\n (flag >> 8) & 0xff,\n flag & 0xff\n ])\n }\n\n static tfhd (id) {\n return MP4.box(MP4.types.tfhd, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags todo 0x00\n id >> 24, (id >> 16) & 0xff, (id >> 8) & 0xff, id & 0xff // track_ID\n ]))\n }\n\n static tfdt (data, baseMediaDecodeTime) {\n const upperWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime / (UINT32_MAX + 1))\n const lowerWordBaseMediaDecodeTime = Math.floor(baseMediaDecodeTime % (UINT32_MAX + 1))\n if (data.useEME && (data.isVideoEncryption || data.isAudioEncryption)) {\n return MP4.box(MP4.types.tfdt, new Uint8Array([\n 0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n lowerWordBaseMediaDecodeTime >> 24,\n (lowerWordBaseMediaDecodeTime >> 16) & 0xff,\n (lowerWordBaseMediaDecodeTime >> 8) & 0xff,\n lowerWordBaseMediaDecodeTime & 0xff\n ]))\n } else {\n return MP4.box(MP4.types.tfdt, new Uint8Array([\n 0x01, // version 1\n 0x00, 0x00, 0x00, // flags\n upperWordBaseMediaDecodeTime >> 24,\n (upperWordBaseMediaDecodeTime >> 16) & 0xff,\n (upperWordBaseMediaDecodeTime >> 8) & 0xff,\n upperWordBaseMediaDecodeTime & 0xff,\n lowerWordBaseMediaDecodeTime >> 24,\n (lowerWordBaseMediaDecodeTime >> 16) & 0xff,\n (lowerWordBaseMediaDecodeTime >> 8) & 0xff,\n lowerWordBaseMediaDecodeTime & 0xff\n ]))\n }\n }\n\n static trun (samples, offset) {\n const sampleLen = samples.length\n const dataLen = 12 + (16 * sampleLen)\n offset += 8 + dataLen\n const data = new Uint8Array(dataLen)\n data.set([\n 0x00, // version\n 0x00, 0x0f, 0x01, // flags\n (sampleLen >>> 24) & 0xff, (sampleLen >>> 16) & 0xff, (sampleLen >>> 8) & 0xff, sampleLen & 0xff,\n (offset >>> 24) & 0xff, (offset >>> 16) & 0xff, (offset >>> 8) & 0xff, offset & 0xff // data_offset\n ], 0)\n for (let i = 0; i < sampleLen; i++) {\n const {\n duration, size, flag = {}, cts = 0\n } = samples[i]\n data.set([\n (duration >>> 24) & 0xff, (duration >>> 16) & 0xff, (duration >>> 8) & 0xff, duration & 0xff,\n (size >>> 24) & 0xff, (size >>> 16) & 0xff, (size >>> 8) & 0xff, size & 0xff,\n (flag.isLeading << 2) | (flag.dependsOn === null || flag.dependsOn === undefined ? 1 : flag.dependsOn),\n (flag.isDependedOn << 6) | (flag.hasRedundancy << 4) | (flag.paddingValue << 1) | (flag.isNonSyncSample === null || flag.isNonSyncSample === undefined ? 1 : flag.isNonSyncSample),\n flag.degradationPriority & (0xf0 << 8), flag.degradationPriority & 0x0f, // sample_flags\n (cts >>> 24) & 0xff, (cts >>> 16) & 0xff, (cts >>> 8) & 0xff, cts & 0xff // sample_composition_time_offset\n ], 12 + 16 * i)\n }\n\n return MP4.box(MP4.types.trun, data)\n }\n\n static moovMP4 (tracks) {\n return MP4.box(MP4.types.moov,\n MP4.mvhd(tracks[0].duration, tracks[0].timescale),\n ...tracks.map((t) => MP4.trackMP4(t)))\n }\n\n static trackMP4 (track) {\n return MP4.box(\n MP4.types.trak,\n MP4.tkhd(track.id, track.duration, track.width, track.height),\n MP4.mdiaMP4(track)\n )\n }\n\n static mdiaMP4 (track) {\n return MP4.box(MP4.types.mdia, MP4.mdhd(track.duration, track.timescale), MP4.hdlr(track.type), MP4.minfMP4(track))\n }\n\n static minfMP4 (track) {\n return MP4.box(MP4.types.minf, track.type === TrackType.VIDEO ? MP4.VMHD : MP4.SMHD, MP4.DINF, MP4.stblMP4(track))\n }\n\n static stblMP4 (track) {\n const { ext } = track\n const boxes = [\n MP4.stsd(track),\n MP4.stts(ext.stts),\n MP4.stsc(ext.stsc),\n MP4.stsz(ext.stsz),\n MP4.stco(ext.stco)\n ]\n\n if (ext.stss.length) {\n boxes.push(MP4.stss(ext.stss))\n }\n\n if (ext.ctts.length) {\n boxes.push(MP4.ctts(ext.ctts))\n }\n\n return MP4.box(MP4.types.stbl, ...boxes)\n }\n\n static stts (samples) {\n const len = samples.length\n const data = new Uint8Array(8 * len)\n let offset = 0\n samples.forEach(({ value, count }) => {\n data.set([\n count >> 24, (count >> 16) & 0xff, (count >> 8) & 0xff, count & 0xff,\n value >> 24, (value >> 16) & 0xff, (value >> 8) & 0xff, value & 0xff\n ], offset)\n offset += 8\n })\n\n return MP4.box(MP4.types.stts, concatUint8Array(new Uint8Array([\n 0, 0, 0, 0,\n (len >> 24), (len >> 16) & 0xff, (len >> 8) & 0xff, len & 0xff\n ]), data))\n }\n\n static stsc (entries) {\n const len = entries.length\n const data = new Uint8Array(12 * len)\n let offset = 0\n entries.forEach(({ firstChunk, samplesPerChunk, sampleDescIndex }) => {\n data.set([\n firstChunk >> 24, (firstChunk >> 16) & 0xff, (firstChunk >> 8) & 0xff, firstChunk & 0xff,\n samplesPerChunk >> 24, (samplesPerChunk >> 16) & 0xff, (samplesPerChunk >> 8) & 0xff, samplesPerChunk & 0xff,\n sampleDescIndex >> 24, (sampleDescIndex >> 16) & 0xff, (sampleDescIndex >> 8) & 0xff, sampleDescIndex & 0xff\n ], offset)\n offset += 12\n })\n return MP4.box(MP4.types.stsc, concatUint8Array(new Uint8Array([\n 0, 0, 0, 0,\n (len >> 24), (len >> 16) & 0xff, (len >> 8) & 0xff, len & 0xff\n ]), data))\n }\n\n static stsz (samplesSizes) {\n const len = samplesSizes.length\n const data = new Uint8Array(4 * len)\n let offset = 0\n samplesSizes.forEach((x) => {\n data.set([\n x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff\n ], offset)\n offset += 4\n })\n return MP4.box(MP4.types.stsz, concatUint8Array(\n new Uint8Array([\n 0, 0, 0, 0,\n 0, 0, 0, 0,\n len >> 24, (len >> 16) & 0xff, (len >> 8) & 0xff, len & 0xff\n ]),\n data\n ))\n }\n\n static stco (offsets) {\n const len = offsets.length\n const data = new Uint8Array(4 * len)\n let offset = 0\n offsets.forEach((x) => {\n data.set([\n x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff\n ], offset)\n offset += 4\n })\n return MP4.box(MP4.types.stco, concatUint8Array(\n new Uint8Array([\n 0, 0, 0, 0,\n len >> 24, (len >> 16) & 0xff, (len >> 8) & 0xff, len & 0xff\n ]),\n data\n ))\n }\n\n static stss (keyframeIndexes) {\n const len = keyframeIndexes.length\n const data = new Uint8Array(4 * len)\n let offset = 0\n keyframeIndexes.forEach((x) => {\n data.set([\n x >> 24, (x >> 16) & 0xff, (x >> 8) & 0xff, x & 0xff\n ], offset)\n offset += 4\n })\n return MP4.box(MP4.types.stss, concatUint8Array(\n new Uint8Array([\n 0, 0, 0, 0,\n len >> 24, (len >> 16) & 0xff, (len >> 8) & 0xff, len & 0xff\n ]),\n data\n ))\n }\n\n static ctts (samples) {\n const len = samples.length\n const data = new Uint8Array(8 * len)\n let offset = 0\n samples.forEach(({ value, count }) => {\n data.set([\n count >> 24, (count >> 16) & 0xff, (count >> 8) & 0xff, count & 0xff,\n value >> 24, (value >> 16) & 0xff, (value >> 8) & 0xff, value & 0xff\n ], offset)\n offset += 8\n })\n return MP4.box(MP4.types.ctts, concatUint8Array(new Uint8Array([\n 0, 0, 0, 0,\n len >> 24, (len >> 16) & 0xff, (len >> 8) & 0xff, len & 0xff\n ]), data))\n }\n\n static styp () {\n return MP4.box(MP4.types.styp, new Uint8Array([\n 0x6D, 0x73, 0x64, 0x68,\n 0x00, 0x00, 0x00, 0x00,\n 0x6D, 0x73, 0x64, 0x68,\n 0x6D, 0x73, 0x69, 0x78\n ]))\n }\n\n // data.sampleOffset 指的是samples的序列号。_samples[0].idx\n static sidx (data) {\n // const buffer = new Buffer()\n const timescale = data.timescale\n const duration = data.samples[0].duration\n const durationCount = duration * data.samples.length\n const earliestTime = data.samples[0].sampleOffset * duration\n let mdatSize = 8\n data.samples.forEach(item => {\n mdatSize += item.size\n })\n let length = 0\n if (data.isVideo) {\n let sencLength = 0\n let samples\n if (data.videoSenc) {\n samples = data.videoSenc\n }\n if (data.isVideo) {\n samples.forEach(item => {\n sencLength = sencLength + 8\n if (item.subsamples && item.subsamples.length) {\n sencLength = sencLength + 2\n sencLength = sencLength + item.subsamples.length * 6\n }\n })\n }\n data.videoSencLength = sencLength\n length = mdatSize + 141 + data.samples.length * 16 + sencLength\n if (data.useEME && data.isAudioEncryption && !data.isVideoEncryption) {\n length = mdatSize + (data.samples.length * 16) + 84\n }\n } else {\n length = mdatSize + 116 + data.samples.length * 12\n if (data.useEME && data.isAudioEncryption) {\n length = mdatSize + 169 + data.samples.length * 12 + 8 * data.audioSenc.length\n }\n }\n\n const content = new Uint8Array([\n 0x00, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, data.id & 0xff, // ref_id\n (timescale >> 24) & 0xff,\n (timescale >> 16) & 0xff,\n (timescale >> 8) & 0xff,\n timescale & 0xff, // timescale\n (earliestTime >> 24) & 0xff,\n (earliestTime >> 16) & 0xff,\n (earliestTime >> 8) & 0xff,\n earliestTime & 0xff, // earliest_presentation_time\n 0x00, 0x00, 0x00, 0x00, // first_offset\n 0x00, 0x00, // reserved\n 0x00, 0x01, // ref_count\n // 0x00, 0x04, 0x11, 0xCF, // ref_size + ref_type\n // 0x00, 0x01, 0x0A, 0xA6, // ref_size + ref_type\n 0x00, // ref_size + ref_type ref_size = moof.size + mdat.size\n (length >> 16) & 0xff,\n (length >> 8) & 0xff,\n length & 0xff,\n (durationCount >> 24) & 0xff,\n (durationCount >> 16) & 0xff,\n (durationCount >> 8) & 0xff,\n durationCount & 0xff,\n 0x90, 0x00, 0x00, 0x00\n ])\n return MP4.box(MP4.types.sidx, content)\n }\n\n static mdat (data) {\n const mdat = MP4.box(MP4.types.mdat, data)\n // console.log('[remux],mdat ,len ', mdat.byteLength, hashVal(mdat.toString()))\n return mdat\n }\n}\n","\nexport class Logger {\n constructor (name, enable) {\n this.name = name || ''\n this._prefix = `[${this.name}]`\n Logger.disabled = enable\n }\n\n debug (...args) {\n if (Logger.disabled) return\n console.debug(this._prefix, ...args)\n }\n\n log (...args) {\n if (Logger.disabled) return\n console.log(this._prefix, ...args)\n }\n\n warn (...args) {\n if (Logger.disabled) return\n console.warn(this._prefix, ...args)\n }\n\n error (...args) {\n if (Logger.disabled) return\n console.error(this._prefix, ...args)\n }\n\n table (...args) {\n if (Logger.disabled) return\n console.group(this._prefix)\n console.table(...args)\n console.groupEnd()\n }\n\n static disabled = true\n\n static enable () {\n Logger.disabled = false\n }\n\n static disable () {\n Logger.disabled = true\n }\n}\n","import {\n WordArray,\n Hasher,\n} from './core.js';\n\n// Constants table\nconst T = [];\n\n// Compute constants\nfor (let i = 0; i < 64; i += 1) {\n T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;\n}\n\nconst FF = (a, b, c, d, x, s, t) => {\n const n = a + ((b & c) | (~b & d)) + x + t;\n return ((n << s) | (n >>> (32 - s))) + b;\n};\n\nconst GG = (a, b, c, d, x, s, t) => {\n const n = a + ((b & d) | (c & ~d)) + x + t;\n return ((n << s) | (n >>> (32 - s))) + b;\n};\n\nconst HH = (a, b, c, d, x, s, t) => {\n const n = a + (b ^ c ^ d) + x + t;\n return ((n << s) | (n >>> (32 - s))) + b;\n};\n\nconst II = (a, b, c, d, x, s, t) => {\n const n = a + (c ^ (b | ~d)) + x + t;\n return ((n << s) | (n >>> (32 - s))) + b;\n};\n\n/**\n * MD5 hash algorithm.\n */\nexport class MD5Algo extends Hasher {\n _doReset() {\n this._hash = new WordArray([\n 0x67452301,\n 0xefcdab89,\n 0x98badcfe,\n 0x10325476,\n ]);\n }\n\n _doProcessBlock(M, offset) {\n const _M = M;\n\n // Swap endian\n for (let i = 0; i < 16; i += 1) {\n // Shortcuts\n const offset_i = offset + i;\n const M_offset_i = M[offset_i];\n\n _M[offset_i] = (\n (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff)\n | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n );\n }\n\n // Shortcuts\n const H = this._hash.words;\n\n const M_offset_0 = _M[offset + 0];\n const M_offset_1 = _M[offset + 1];\n const M_offset_2 = _M[offset + 2];\n const M_offset_3 = _M[offset + 3];\n const M_offset_4 = _M[offset + 4];\n const M_offset_5 = _M[offset + 5];\n const M_offset_6 = _M[offset + 6];\n const M_offset_7 = _M[offset + 7];\n const M_offset_8 = _M[offset + 8];\n const M_offset_9 = _M[offset + 9];\n const M_offset_10 = _M[offset + 10];\n const M_offset_11 = _M[offset + 11];\n const M_offset_12 = _M[offset + 12];\n const M_offset_13 = _M[offset + 13];\n const M_offset_14 = _M[offset + 14];\n const M_offset_15 = _M[offset + 15];\n\n // Working varialbes\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n\n // Computation\n a = FF(a, b, c, d, M_offset_0, 7, T[0]);\n d = FF(d, a, b, c, M_offset_1, 12, T[1]);\n c = FF(c, d, a, b, M_offset_2, 17, T[2]);\n b = FF(b, c, d, a, M_offset_3, 22, T[3]);\n a = FF(a, b, c, d, M_offset_4, 7, T[4]);\n d = FF(d, a, b, c, M_offset_5, 12, T[5]);\n c = FF(c, d, a, b, M_offset_6, 17, T[6]);\n b = FF(b, c, d, a, M_offset_7, 22, T[7]);\n a = FF(a, b, c, d, M_offset_8, 7, T[8]);\n d = FF(d, a, b, c, M_offset_9, 12, T[9]);\n c = FF(c, d, a, b, M_offset_10, 17, T[10]);\n b = FF(b, c, d, a, M_offset_11, 22, T[11]);\n a = FF(a, b, c, d, M_offset_12, 7, T[12]);\n d = FF(d, a, b, c, M_offset_13, 12, T[13]);\n c = FF(c, d, a, b, M_offset_14, 17, T[14]);\n b = FF(b, c, d, a, M_offset_15, 22, T[15]);\n\n a = GG(a, b, c, d, M_offset_1, 5, T[16]);\n d = GG(d, a, b, c, M_offset_6, 9, T[17]);\n c = GG(c, d, a, b, M_offset_11, 14, T[18]);\n b = GG(b, c, d, a, M_offset_0, 20, T[19]);\n a = GG(a, b, c, d, M_offset_5, 5, T[20]);\n d = GG(d, a, b, c, M_offset_10, 9, T[21]);\n c = GG(c, d, a, b, M_offset_15, 14, T[22]);\n b = GG(b, c, d, a, M_offset_4, 20, T[23]);\n a = GG(a, b, c, d, M_offset_9, 5, T[24]);\n d = GG(d, a, b, c, M_offset_14, 9, T[25]);\n c = GG(c, d, a, b, M_offset_3, 14, T[26]);\n b = GG(b, c, d, a, M_offset_8, 20, T[27]);\n a = GG(a, b, c, d, M_offset_13, 5, T[28]);\n d = GG(d, a, b, c, M_offset_2, 9, T[29]);\n c = GG(c, d, a, b, M_offset_7, 14, T[30]);\n b = GG(b, c, d, a, M_offset_12, 20, T[31]);\n\n a = HH(a, b, c, d, M_offset_5, 4, T[32]);\n d = HH(d, a, b, c, M_offset_8, 11, T[33]);\n c = HH(c, d, a, b, M_offset_11, 16, T[34]);\n b = HH(b, c, d, a, M_offset_14, 23, T[35]);\n a = HH(a, b, c, d, M_offset_1, 4, T[36]);\n d = HH(d, a, b, c, M_offset_4, 11, T[37]);\n c = HH(c, d, a, b, M_offset_7, 16, T[38]);\n b = HH(b, c, d, a, M_offset_10, 23, T[39]);\n a = HH(a, b, c, d, M_offset_13, 4, T[40]);\n d = HH(d, a, b, c, M_offset_0, 11, T[41]);\n c = HH(c, d, a, b, M_offset_3, 16, T[42]);\n b = HH(b, c, d, a, M_offset_6, 23, T[43]);\n a = HH(a, b, c, d, M_offset_9, 4, T[44]);\n d = HH(d, a, b, c, M_offset_12, 11, T[45]);\n c = HH(c, d, a, b, M_offset_15, 16, T[46]);\n b = HH(b, c, d, a, M_offset_2, 23, T[47]);\n\n a = II(a, b, c, d, M_offset_0, 6, T[48]);\n d = II(d, a, b, c, M_offset_7, 10, T[49]);\n c = II(c, d, a, b, M_offset_14, 15, T[50]);\n b = II(b, c, d, a, M_offset_5, 21, T[51]);\n a = II(a, b, c, d, M_offset_12, 6, T[52]);\n d = II(d, a, b, c, M_offset_3, 10, T[53]);\n c = II(c, d, a, b, M_offset_10, 15, T[54]);\n b = II(b, c, d, a, M_offset_1, 21, T[55]);\n a = II(a, b, c, d, M_offset_8, 6, T[56]);\n d = II(d, a, b, c, M_offset_15, 10, T[57]);\n c = II(c, d, a, b, M_offset_6, 15, T[58]);\n b = II(b, c, d, a, M_offset_13, 21, T[59]);\n a = II(a, b, c, d, M_offset_4, 6, T[60]);\n d = II(d, a, b, c, M_offset_11, 10, T[61]);\n c = II(c, d, a, b, M_offset_2, 15, T[62]);\n b = II(b, c, d, a, M_offset_9, 21, T[63]);\n\n // Intermediate hash value\n H[0] = (H[0] + a) | 0;\n H[1] = (H[1] + b) | 0;\n H[2] = (H[2] + c) | 0;\n H[3] = (H[3] + d) | 0;\n }\n /* eslint-ensable no-param-reassign */\n\n _doFinalize() {\n // Shortcuts\n const data = this._data;\n const dataWords = data.words;\n\n const nBitsTotal = this._nDataBytes * 8;\n const nBitsLeft = data.sigBytes * 8;\n\n // Add padding\n dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - (nBitsLeft % 32));\n\n const nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);\n const nBitsTotalL = nBitsTotal;\n dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (\n (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff)\n | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)\n );\n dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff)\n | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)\n );\n\n data.sigBytes = (dataWords.length + 1) * 4;\n\n // Hash final blocks\n this._process();\n\n // Shortcuts\n const hash = this._hash;\n const H = hash.words;\n\n // Swap endian\n for (let i = 0; i < 4; i += 1) {\n // Shortcut\n const H_i = H[i];\n\n H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff)\n | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);\n }\n\n // Return final computed hash\n return hash;\n }\n\n clone() {\n const clone = super.clone.call(this);\n clone._hash = this._hash.clone();\n\n return clone;\n }\n}\n\n/**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n * var hash = CryptoJS.MD5('message');\n * var hash = CryptoJS.MD5(wordArray);\n */\nexport const MD5 = Hasher._createHelper(MD5Algo);\n\n/**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n * var hmac = CryptoJS.HmacMD5(message, key);\n */\nexport const HmacMD5 = Hasher._createHmacHelper(MD5Algo);\n","import { MP4 } from './mp4'\nimport { concatUint8Array } from '../utils'\nimport { Logger } from './logger'\n\n/**\n * @typedef {Object} RemuxResult\n * @property {Uint8Array} [videoInitSegment]\n * @property {Uint8Array} [audioInitSegment]\n * @property {Uint8Array} [videoSegment]\n * @property {Uint8Array} [audioSegment]\n */\n\nexport class FMP4Remuxer {\n /**\n * @param {import('../model').VideoTrack} videoTrack\n * @param {import('../model').AudioTrack} audioTrack\n */\n constructor (videoTrack, audioTrack, options) {\n this.videoTrack = videoTrack\n this.audioTrack = audioTrack\n const browserVersions = /Chrome\\/([^.]+)/.exec(navigator.userAgent)\n this.forceFirstIDR = browserVersions && Number(browserVersions[1]) < 50\n this.log = new Logger('FMP4Remuxer', options && options.openLog ? !options.openLog : true)\n }\n\n /**\n * @param {boolean} [createInit=false]\n * @returns {RemuxResult}\n */\n remux (createInit = false, options = {}) {\n const videoTrack = this.videoTrack\n const audioTrack = this.audioTrack\n const hasVideo = videoTrack.exist()\n const hasAudio = audioTrack.exist()\n\n let videoInitSegment\n let audioInitSegment\n\n let initSegment\n const tracks = []\n\n if (createInit) {\n if (options && options.initMerge) {\n if (hasVideo) {\n tracks.push(this.videoTrack)\n }\n if (hasAudio) {\n tracks.push(this.audioTrack)\n }\n initSegment = MP4.initSegment(tracks)\n } else {\n if (hasVideo) videoInitSegment = MP4.initSegment([this.videoTrack])\n if (hasAudio) audioInitSegment = MP4.initSegment([this.audioTrack])\n }\n }\n\n let videoSegment\n let audioSegment\n if (hasVideo && videoTrack.hasSample()) {\n videoSegment = this._remuxVideo()\n }\n\n if (hasAudio && audioTrack.hasSample()) {\n audioSegment = this._remuxAudio()\n }\n\n videoTrack.samples = []\n audioTrack.samples = []\n\n return {\n initSegment,\n videoInitSegment,\n audioInitSegment,\n videoSegment,\n audioSegment\n }\n }\n\n _remuxVideo () {\n const track = this.videoTrack\n if (this.forceFirstIDR) {\n track.samples[0].flag = { dependsOn: 2, isNonSyncSample: 0 }\n }\n const samples = track.samples\n const isAV01 = /av01/.test(track.codec)\n\n let mdatSize = 0\n\n if (isAV01) {\n samples.forEach((s) => {\n mdatSize += s.data.byteLength\n })\n } else {\n samples.forEach((s) => {\n mdatSize += s.units.reduce((t, c) => (t + c.byteLength), 0)\n mdatSize += (s.units.length * 4)\n })\n }\n\n const mdata = new Uint8Array(mdatSize)\n\n // av1没有uints,直接写入data即可\n // todo: H.265/H.264为什么要拼接nals/uints而不直接用data?\n if (isAV01) {\n for (let i = 0, l = samples.length, offset = 0, sample; i < l; i++) {\n sample = samples[i]\n mdata.set(sample.data, offset)\n sample.size = sample.data.byteLength\n offset += sample.size\n }\n } else {\n const mdatView = new DataView(mdata.buffer)\n for (let i = 0, l = samples.length, offset = 0, sample; i < l; i++) {\n sample = samples[i]\n\n let sampleSize = 0\n sample.units.forEach((u) => {\n mdatView.setUint32(offset, u.byteLength)\n offset += 4\n mdata.set(u, offset)\n offset += u.byteLength\n sampleSize += (4 + u.byteLength)\n })\n sample.size = sampleSize\n }\n }\n const mdat = MP4.mdat(mdata)\n\n const moof = MP4.moof([track])\n return concatUint8Array(moof, mdat)\n\n }\n\n _remuxAudio () {\n const track = this.audioTrack\n const mdata = new Uint8Array(track.samples.reduce((t, c) => (t + c.size), 0))\n track.samples.reduce((offset, s) => {\n mdata.set(s.data, offset)\n return offset + s.size\n }, 0)\n const mdat = MP4.mdat(mdata)\n const moof = MP4.moof([track])\n return concatUint8Array(moof, mdat)\n }\n\n reset () {\n this.videoTrack.reset()\n this.audioTrack.reset()\n }\n}\n","/* eslint-disable no-use-before-define */\n\n/**\n * Base class for inheritance.\n */\nexport class Base {\n /**\n * Extends this object and runs the init method.\n * Arguments to create() will be passed to init().\n *\n * @return {Object} The new object.\n *\n * @static\n *\n * @example\n *\n * var instance = MyType.create();\n */\n static create(...args) {\n return new this(...args);\n }\n\n /**\n * Copies properties into this object.\n *\n * @param {Object} properties The properties to mix in.\n *\n * @example\n *\n * MyType.mixIn({\n * field: 'value'\n * });\n */\n mixIn(properties) {\n return Object.assign(this, properties);\n }\n\n /**\n * Creates a copy of this object.\n *\n * @return {Object} The clone.\n *\n * @example\n *\n * var clone = instance.clone();\n */\n clone() {\n const clone = new this.constructor();\n Object.assign(clone, this);\n return clone;\n }\n}\n\n/**\n * An array of 32-bit words.\n *\n * @property {Array} words The array of 32-bit words.\n * @property {number} sigBytes The number of significant bytes in this word array.\n */\nexport class WordArray extends Base {\n /**\n * Initializes a newly created word array.\n *\n * @param {Array} words (Optional) An array of 32-bit words.\n * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n *\n * @example\n *\n * var wordArray = CryptoJS.lib.WordArray.create();\n * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n */\n constructor(words = [], sigBytes = words.length * 4) {\n super();\n\n let typedArray = words;\n // Convert buffers to uint8\n if (typedArray instanceof ArrayBuffer) {\n typedArray = new Uint8Array(typedArray);\n }\n\n // Convert other array views to uint8\n if (\n typedArray instanceof Int8Array\n || typedArray instanceof Uint8ClampedArray\n || typedArray instanceof Int16Array\n || typedArray instanceof Uint16Array\n || typedArray instanceof Int32Array\n || typedArray instanceof Uint32Array\n || typedArray instanceof Float32Array\n || typedArray instanceof Float64Array\n ) {\n typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n }\n\n // Handle Uint8Array\n if (typedArray instanceof Uint8Array) {\n // Shortcut\n const typedArrayByteLength = typedArray.byteLength;\n\n // Extract bytes\n const _words = [];\n for (let i = 0; i < typedArrayByteLength; i += 1) {\n _words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);\n }\n\n // Initialize this word array\n this.words = _words;\n this.sigBytes = typedArrayByteLength;\n } else {\n // Else call normal init\n this.words = words;\n this.sigBytes = sigBytes;\n }\n }\n\n /**\n * Creates a word array filled with random bytes.\n *\n * @param {number} nBytes The number of random bytes to generate.\n *\n * @return {WordArray} The random word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.lib.WordArray.random(16);\n */\n static random(nBytes) {\n const words = [];\n\n const r = (m_w) => {\n let _m_w = m_w;\n let _m_z = 0x3ade68b1;\n const mask = 0xffffffff;\n\n return () => {\n _m_z = (0x9069 * (_m_z & 0xFFFF) + (_m_z >> 0x10)) & mask;\n _m_w = (0x4650 * (_m_w & 0xFFFF) + (_m_w >> 0x10)) & mask;\n let result = ((_m_z << 0x10) + _m_w) & mask;\n result /= 0x100000000;\n result += 0.5;\n return result * (Math.random() > 0.5 ? 1 : -1);\n };\n };\n\n for (let i = 0, rcache; i < nBytes; i += 4) {\n const _r = r((rcache || Math.random()) * 0x100000000);\n\n rcache = _r() * 0x3ade67b7;\n words.push((_r() * 0x100000000) | 0);\n }\n\n return new WordArray(words, nBytes);\n }\n\n /**\n * Converts this word array to a string.\n *\n * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n *\n * @return {string} The stringified word array.\n *\n * @example\n *\n * var string = wordArray + '';\n * var string = wordArray.toString();\n * var string = wordArray.toString(CryptoJS.enc.Utf8);\n */\n toString(encoder = Hex) {\n return encoder.stringify(this);\n }\n\n /**\n * Concatenates a word array to this word array.\n *\n * @param {WordArray} wordArray The word array to append.\n *\n * @return {WordArray} This word array.\n *\n * @example\n *\n * wordArray1.concat(wordArray2);\n */\n concat(wordArray) {\n // Shortcuts\n const thisWords = this.words;\n const thatWords = wordArray.words;\n const thisSigBytes = this.sigBytes;\n const thatSigBytes = wordArray.sigBytes;\n\n // Clamp excess bits\n this.clamp();\n\n // Concat\n if (thisSigBytes % 4) {\n // Copy one byte at a time\n for (let i = 0; i < thatSigBytes; i += 1) {\n const thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n }\n } else {\n // Copy one word at a time\n for (let i = 0; i < thatSigBytes; i += 4) {\n thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n }\n }\n this.sigBytes += thatSigBytes;\n\n // Chainable\n return this;\n }\n\n /**\n * Removes insignificant bits.\n *\n * @example\n *\n * wordArray.clamp();\n */\n clamp() {\n // Shortcuts\n const { words, sigBytes } = this;\n\n // Clamp\n words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n words.length = Math.ceil(sigBytes / 4);\n }\n\n /**\n * Creates a copy of this word array.\n *\n * @return {WordArray} The clone.\n *\n * @example\n *\n * var clone = wordArray.clone();\n */\n clone() {\n const clone = super.clone.call(this);\n clone.words = this.words.slice(0);\n\n return clone;\n }\n}\n\n/**\n * Hex encoding strategy.\n */\nexport const Hex = {\n /**\n * Converts a word array to a hex string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The hex string.\n *\n * @static\n *\n * @example\n *\n * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n */\n stringify(wordArray) {\n // Shortcuts\n const { words, sigBytes } = wordArray;\n\n // Convert\n const hexChars = [];\n for (let i = 0; i < sigBytes; i += 1) {\n const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n hexChars.push((bite >>> 4).toString(16));\n hexChars.push((bite & 0x0f).toString(16));\n }\n\n return hexChars.join('');\n },\n\n /**\n * Converts a hex string to a word array.\n *\n * @param {string} hexStr The hex string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n */\n parse(hexStr) {\n // Shortcut\n const hexStrLength = hexStr.length;\n\n // Convert\n const words = [];\n for (let i = 0; i < hexStrLength; i += 2) {\n words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n }\n\n return new WordArray(words, hexStrLength / 2);\n },\n};\n\n/**\n * Latin1 encoding strategy.\n */\nexport const Latin1 = {\n /**\n * Converts a word array to a Latin1 string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The Latin1 string.\n *\n * @static\n *\n * @example\n *\n * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n */\n stringify(wordArray) {\n // Shortcuts\n const { words, sigBytes } = wordArray;\n\n // Convert\n const latin1Chars = [];\n for (let i = 0; i < sigBytes; i += 1) {\n const bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n latin1Chars.push(String.fromCharCode(bite));\n }\n\n return latin1Chars.join('');\n },\n\n /**\n * Converts a Latin1 string to a word array.\n *\n * @param {string} latin1Str The Latin1 string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n */\n parse(latin1Str) {\n // Shortcut\n const latin1StrLength = latin1Str.length;\n\n // Convert\n const words = [];\n for (let i = 0; i < latin1StrLength; i += 1) {\n words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n }\n\n return new WordArray(words, latin1StrLength);\n },\n};\n\n/**\n * UTF-8 encoding strategy.\n */\nexport const Utf8 = {\n /**\n * Converts a word array to a UTF-8 string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The UTF-8 string.\n *\n * @static\n *\n * @example\n *\n * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n */\n stringify(wordArray) {\n try {\n return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n } catch (e) {\n throw new Error('Malformed UTF-8 data');\n }\n },\n\n /**\n * Converts a UTF-8 string to a word array.\n *\n * @param {string} utf8Str The UTF-8 string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n */\n parse(utf8Str) {\n return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n },\n};\n\n/**\n * Abstract buffered block algorithm template.\n *\n * The property blockSize must be implemented in a concrete subtype.\n *\n * @property {number} _minBufferSize\n *\n * The number of blocks that should be kept unprocessed in the buffer. Default: 0\n */\nexport class BufferedBlockAlgorithm extends Base {\n constructor() {\n super();\n this._minBufferSize = 0;\n }\n\n /**\n * Resets this block algorithm's data buffer to its initial state.\n *\n * @example\n *\n * bufferedBlockAlgorithm.reset();\n */\n reset() {\n // Initial values\n this._data = new WordArray();\n this._nDataBytes = 0;\n }\n\n /**\n * Adds new data to this block algorithm's buffer.\n *\n * @param {WordArray|string} data\n *\n * The data to append. Strings are converted to a WordArray using UTF-8.\n *\n * @example\n *\n * bufferedBlockAlgorithm._append('data');\n * bufferedBlockAlgorithm._append(wordArray);\n */\n _append(data) {\n let m_data = data;\n\n // Convert string to WordArray, else assume WordArray already\n if (typeof m_data === 'string') {\n m_data = Utf8.parse(m_data);\n }\n\n // Append\n this._data.concat(m_data);\n this._nDataBytes += m_data.sigBytes;\n }\n\n /**\n * Processes available data blocks.\n *\n * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n *\n * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n *\n * @return {WordArray} The processed data.\n *\n * @example\n *\n * var processedData = bufferedBlockAlgorithm._process();\n * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n */\n _process(doFlush) {\n let processedWords;\n\n // Shortcuts\n const { _data: data, blockSize } = this;\n const dataWords = data.words;\n const dataSigBytes = data.sigBytes;\n const blockSizeBytes = blockSize * 4;\n\n // Count blocks ready\n let nBlocksReady = dataSigBytes / blockSizeBytes;\n if (doFlush) {\n // Round up to include partial blocks\n nBlocksReady = Math.ceil(nBlocksReady);\n } else {\n // Round down to include only full blocks,\n // less the number of blocks that must remain in the buffer\n nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n }\n\n // Count words ready\n const nWordsReady = nBlocksReady * blockSize;\n\n // Count bytes ready\n const nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n // Process blocks\n if (nWordsReady) {\n for (let offset = 0; offset < nWordsReady; offset += blockSize) {\n // Perform concrete-algorithm logic\n this._doProcessBlock(dataWords, offset);\n }\n\n // Remove processed words\n processedWords = dataWords.splice(0, nWordsReady);\n data.sigBytes -= nBytesReady;\n }\n\n // Return processed words\n return new WordArray(processedWords, nBytesReady);\n }\n\n /**\n * Creates a copy of this object.\n *\n * @return {Object} The clone.\n *\n * @example\n *\n * var clone = bufferedBlockAlgorithm.clone();\n */\n clone() {\n const clone = super.clone.call(this);\n clone._data = this._data.clone();\n\n return clone;\n }\n}\n\n/**\n * Abstract hasher template.\n *\n * @property {number} blockSize\n *\n * The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n */\nexport class Hasher extends BufferedBlockAlgorithm {\n constructor(cfg) {\n super();\n\n this.blockSize = 512 / 32;\n\n /**\n * Configuration options.\n */\n this.cfg = Object.assign(new Base(), cfg);\n\n // Set initial values\n this.reset();\n }\n\n /**\n * Creates a shortcut function to a hasher's object interface.\n *\n * @param {Hasher} SubHasher The hasher to create a helper for.\n *\n * @return {Function} The shortcut function.\n *\n * @static\n *\n * @example\n *\n * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n */\n static _createHelper(SubHasher) {\n return (message, cfg) => new SubHasher(cfg).finalize(message);\n }\n\n /**\n * Creates a shortcut function to the HMAC's object interface.\n *\n * @param {Hasher} SubHasher The hasher to use in this HMAC helper.\n *\n * @return {Function} The shortcut function.\n *\n * @static\n *\n * @example\n *\n * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n */\n static _createHmacHelper(SubHasher) {\n return (message, key) => new HMAC(SubHasher, key).finalize(message);\n }\n\n /**\n * Resets this hasher to its initial state.\n *\n * @example\n *\n * hasher.reset();\n */\n reset() {\n // Reset data buffer\n super.reset.call(this);\n\n // Perform concrete-hasher logic\n this._doReset();\n }\n\n /**\n * Updates this hasher with a message.\n *\n * @param {WordArray|string} messageUpdate The message to append.\n *\n * @return {Hasher} This hasher.\n *\n * @example\n *\n * hasher.update('message');\n * hasher.update(wordArray);\n */\n update(messageUpdate) {\n // Append\n this._append(messageUpdate);\n\n // Update the hash\n this._process();\n\n // Chainable\n return this;\n }\n\n /**\n * Finalizes the hash computation.\n * Note that the finalize operation is effectively a destructive, read-once operation.\n *\n * @param {WordArray|string} messageUpdate (Optional) A final message update.\n *\n * @return {WordArray} The hash.\n *\n * @example\n *\n * var hash = hasher.finalize();\n * var hash = hasher.finalize('message');\n * var hash = hasher.finalize(wordArray);\n */\n finalize(messageUpdate) {\n // Final message update\n if (messageUpdate) {\n this._append(messageUpdate);\n }\n\n // Perform concrete-hasher logic\n const hash = this._doFinalize();\n\n return hash;\n }\n}\n\n/**\n * HMAC algorithm.\n */\nexport class HMAC extends Base {\n /**\n * Initializes a newly created HMAC.\n *\n * @param {Hasher} SubHasher The hash algorithm to use.\n * @param {WordArray|string} key The secret key.\n *\n * @example\n *\n * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n */\n constructor(SubHasher, key) {\n super();\n\n const hasher = new SubHasher();\n this._hasher = hasher;\n\n // Convert string to WordArray, else assume WordArray already\n let _key = key;\n if (typeof _key === 'string') {\n _key = Utf8.parse(_key);\n }\n\n // Shortcuts\n const hasherBlockSize = hasher.blockSize;\n const hasherBlockSizeBytes = hasherBlockSize * 4;\n\n // Allow arbitrary length keys\n if (_key.sigBytes > hasherBlockSizeBytes) {\n _key = hasher.finalize(key);\n }\n\n // Clamp excess bits\n _key.clamp();\n\n // Clone key for inner and outer pads\n const oKey = _key.clone();\n this._oKey = oKey;\n const iKey = _key.clone();\n this._iKey = iKey;\n\n // Shortcuts\n const oKeyWords = oKey.words;\n const iKeyWords = iKey.words;\n\n // XOR keys with pad constants\n for (let i = 0; i < hasherBlockSize; i += 1) {\n oKeyWords[i] ^= 0x5c5c5c5c;\n iKeyWords[i] ^= 0x36363636;\n }\n oKey.sigBytes = hasherBlockSizeBytes;\n iKey.sigBytes = hasherBlockSizeBytes;\n\n // Set initial values\n this.reset();\n }\n\n /**\n * Resets this HMAC to its initial state.\n *\n * @example\n *\n * hmacHasher.reset();\n */\n reset() {\n // Shortcut\n const hasher = this._hasher;\n\n // Reset\n hasher.reset();\n hasher.update(this._iKey);\n }\n\n /**\n * Updates this HMAC with a message.\n *\n * @param {WordArray|string} messageUpdate The message to append.\n *\n * @return {HMAC} This HMAC instance.\n *\n * @example\n *\n * hmacHasher.update('message');\n * hmacHasher.update(wordArray);\n */\n update(messageUpdate) {\n this._hasher.update(messageUpdate);\n\n // Chainable\n return this;\n }\n\n /**\n * Finalizes the HMAC computation.\n * Note that the finalize operation is effectively a destructive, read-once operation.\n *\n * @param {WordArray|string} messageUpdate (Optional) A final message update.\n *\n * @return {WordArray} The HMAC.\n *\n * @example\n *\n * var hmac = hmacHasher.finalize();\n * var hmac = hmacHasher.finalize('message');\n * var hmac = hmacHasher.finalize(wordArray);\n */\n finalize(messageUpdate) {\n // Shortcut\n const hasher = this._hasher;\n\n // Compute HMAC\n const innerHash = hasher.finalize(messageUpdate);\n hasher.reset();\n const hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n return hmac;\n }\n}\n","import {\n WordArray,\n} from './core.js';\n\nconst parseLoop = (base64Str, base64StrLength, reverseMap) => {\n const words = [];\n let nBytes = 0;\n for (let i = 0; i < base64StrLength; i += 1) {\n if (i % 4) {\n const bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n const bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n const bitsCombined = bits1 | bits2;\n words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);\n nBytes += 1;\n }\n }\n return WordArray.create(words, nBytes);\n};\n\n/**\n * Base64 encoding strategy.\n */\nexport const Base64 = {\n /**\n * Converts a word array to a Base64 string.\n *\n * @param {WordArray} wordArray The word array.\n *\n * @return {string} The Base64 string.\n *\n * @static\n *\n * @example\n *\n * const base64String = CryptoJS.enc.Base64.stringify(wordArray);\n */\n stringify(wordArray) {\n // Shortcuts\n const { words, sigBytes } = wordArray;\n const map = this._map;\n\n // Clamp excess bits\n wordArray.clamp();\n\n // Convert\n const base64Chars = [];\n for (let i = 0; i < sigBytes; i += 3) {\n const byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n const byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n const byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n\n const triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n\n for (let j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j += 1) {\n base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n }\n }\n\n // Add padding\n const paddingChar = map.charAt(64);\n if (paddingChar) {\n while (base64Chars.length % 4) {\n base64Chars.push(paddingChar);\n }\n }\n\n return base64Chars.join('');\n },\n\n /**\n * Converts a Base64 string to a word array.\n *\n * @param {string} base64Str The Base64 string.\n *\n * @return {WordArray} The word array.\n *\n * @static\n *\n * @example\n *\n * const wordArray = CryptoJS.enc.Base64.parse(base64String);\n */\n parse(base64Str) {\n // Shortcuts\n let base64StrLength = base64Str.length;\n const map = this._map;\n let reverseMap = this._reverseMap;\n\n if (!reverseMap) {\n this._reverseMap = [];\n reverseMap = this._reverseMap;\n for (let j = 0; j < map.length; j += 1) {\n reverseMap[map.charCodeAt(j)] = j;\n }\n }\n\n // Ignore padding\n const paddingChar = map.charAt(64);\n if (paddingChar) {\n const paddingIndex = base64Str.indexOf(paddingChar);\n if (paddingIndex !== -1) {\n base64StrLength = paddingIndex;\n }\n }\n\n // Convert\n return parseLoop(base64Str, base64StrLength, reverseMap);\n },\n\n _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n};\n","import {\n Base,\n WordArray,\n} from './core.js';\nimport { MD5Algo } from './md5.js';\n\n/**\n * This key derivation function is meant to conform with EVP_BytesToKey.\n * www.openssl.org/docs/crypto/EVP_BytesToKey.html\n */\nexport class EvpKDFAlgo extends Base {\n /**\n * Initializes a newly created key derivation function.\n *\n * @param {Object} cfg (Optional) The configuration options to use for the derivation.\n *\n * @example\n *\n * const kdf = CryptoJS.algo.EvpKDF.create();\n * const kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });\n * const kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });\n */\n constructor(cfg) {\n super();\n\n /**\n * Configuration options.\n *\n * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)\n * @property {Hasher} hasher The hash algorithm to use. Default: MD5\n * @property {number} iterations The number of iterations to perform. Default: 1\n */\n this.cfg = Object.assign(\n new Base(),\n {\n keySize: 128 / 32,\n hasher: MD5Algo,\n iterations: 1,\n },\n cfg,\n );\n }\n\n /**\n * Derives a key from a password.\n *\n * @param {WordArray|string} password The password.\n * @param {WordArray|string} salt A salt.\n *\n * @return {WordArray} The derived key.\n *\n * @example\n *\n * const key = kdf.compute(password, salt);\n */\n compute(password, salt) {\n let block;\n\n // Shortcut\n const { cfg } = this;\n\n // Init hasher\n const hasher = cfg.hasher.create();\n\n // Initial values\n const derivedKey = WordArray.create();\n\n // Shortcuts\n const derivedKeyWords = derivedKey.words;\n const { keySize, iterations } = cfg;\n\n // Generate key\n while (derivedKeyWords.length < keySize) {\n if (block) {\n hasher.update(block);\n }\n block = hasher.update(password).finalize(salt);\n hasher.reset();\n\n // Iterations\n for (let i = 1; i < iterations; i += 1) {\n block = hasher.finalize(block);\n hasher.reset();\n }\n\n derivedKey.concat(block);\n }\n derivedKey.sigBytes = keySize * 4;\n\n return derivedKey;\n }\n}\n\n/**\n * Derives a key from a password.\n *\n * @param {WordArray|string} password The password.\n * @param {WordArray|string} salt A salt.\n * @param {Object} cfg (Optional) The configuration options to use for this computation.\n *\n * @return {WordArray} The derived key.\n *\n * @static\n *\n * @example\n *\n * var key = CryptoJS.EvpKDF(password, salt);\n * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });\n * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });\n */\nexport const EvpKDF = (password, salt, cfg) => EvpKDFAlgo.create(cfg).compute(password, salt);\n","/* eslint-disable no-use-before-define */\n\nimport {\n Base,\n WordArray,\n BufferedBlockAlgorithm,\n} from './core.js';\nimport { Base64 } from './enc-base64.js';\nimport { EvpKDFAlgo } from './evpkdf.js';\n\n/**\n * Abstract base cipher template.\n *\n * @property {number} keySize This cipher's key size. Default: 4 (128 bits)\n * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)\n * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.\n * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.\n */\nexport class Cipher extends BufferedBlockAlgorithm {\n /**\n * Initializes a newly created cipher.\n *\n * @param {number} xformMode Either the encryption or decryption transormation mode constant.\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @example\n *\n * const cipher = CryptoJS.algo.AES.create(\n * CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }\n * );\n */\n constructor(xformMode, key, cfg) {\n super();\n\n /**\n * Configuration options.\n *\n * @property {WordArray} iv The IV to use for this operation.\n */\n this.cfg = Object.assign(new Base(), cfg);\n\n // Store transform mode and key\n this._xformMode = xformMode;\n this._key = key;\n\n // Set initial values\n this.reset();\n }\n\n /**\n * Creates this cipher in encryption mode.\n *\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {Cipher} A cipher instance.\n *\n * @static\n *\n * @example\n *\n * const cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });\n */\n static createEncryptor(key, cfg) {\n return this.create(this._ENC_XFORM_MODE, key, cfg);\n }\n\n /**\n * Creates this cipher in decryption mode.\n *\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {Cipher} A cipher instance.\n *\n * @static\n *\n * @example\n *\n * const cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });\n */\n static createDecryptor(key, cfg) {\n return this.create(this._DEC_XFORM_MODE, key, cfg);\n }\n\n /**\n * Creates shortcut functions to a cipher's object interface.\n *\n * @param {Cipher} cipher The cipher to create a helper for.\n *\n * @return {Object} An object with encrypt and decrypt shortcut functions.\n *\n * @static\n *\n * @example\n *\n * const AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);\n */\n static _createHelper(SubCipher) {\n const selectCipherStrategy = (key) => {\n if (typeof key === 'string') {\n return PasswordBasedCipher;\n }\n return SerializableCipher;\n };\n\n return {\n encrypt(message, key, cfg) {\n return selectCipherStrategy(key).encrypt(SubCipher, message, key, cfg);\n },\n\n decrypt(ciphertext, key, cfg) {\n return selectCipherStrategy(key).decrypt(SubCipher, ciphertext, key, cfg);\n },\n };\n }\n\n /**\n * Resets this cipher to its initial state.\n *\n * @example\n *\n * cipher.reset();\n */\n reset() {\n // Reset data buffer\n super.reset.call(this);\n\n // Perform concrete-cipher logic\n this._doReset();\n }\n\n /**\n * Adds data to be encrypted or decrypted.\n *\n * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.\n *\n * @return {WordArray} The data after processing.\n *\n * @example\n *\n * const encrypted = cipher.process('data');\n * const encrypted = cipher.process(wordArray);\n */\n process(dataUpdate) {\n // Append\n this._append(dataUpdate);\n\n // Process available blocks\n return this._process();\n }\n\n /**\n * Finalizes the encryption or decryption process.\n * Note that the finalize operation is effectively a destructive, read-once operation.\n *\n * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.\n *\n * @return {WordArray} The data after final processing.\n *\n * @example\n *\n * const encrypted = cipher.finalize();\n * const encrypted = cipher.finalize('data');\n * const encrypted = cipher.finalize(wordArray);\n */\n finalize(dataUpdate) {\n // Final data update\n if (dataUpdate) {\n this._append(dataUpdate);\n }\n\n // Perform concrete-cipher logic\n const finalProcessedData = this._doFinalize();\n\n return finalProcessedData;\n }\n}\nCipher._ENC_XFORM_MODE = 1;\nCipher._DEC_XFORM_MODE = 2;\nCipher.keySize = 128 / 32;\nCipher.ivSize = 128 / 32;\n\n/**\n * Abstract base stream cipher template.\n *\n * @property {number} blockSize\n *\n * The number of 32-bit words this cipher operates on. Default: 1 (32 bits)\n */\nexport class StreamCipher extends Cipher {\n constructor(...args) {\n super(...args);\n\n this.blockSize = 1;\n }\n\n _doFinalize() {\n // Process partial blocks\n const finalProcessedBlocks = this._process(!!'flush');\n\n return finalProcessedBlocks;\n }\n}\n\n/**\n * Abstract base block cipher mode template.\n */\nexport class BlockCipherMode extends Base {\n /**\n * Initializes a newly created mode.\n *\n * @param {Cipher} cipher A block cipher instance.\n * @param {Array} iv The IV words.\n *\n * @example\n *\n * const mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);\n */\n constructor(cipher, iv) {\n super();\n\n this._cipher = cipher;\n this._iv = iv;\n }\n\n /**\n * Creates this mode for encryption.\n *\n * @param {Cipher} cipher A block cipher instance.\n * @param {Array} iv The IV words.\n *\n * @static\n *\n * @example\n *\n * const mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);\n */\n static createEncryptor(cipher, iv) {\n return this.Encryptor.create(cipher, iv);\n }\n\n /**\n * Creates this mode for decryption.\n *\n * @param {Cipher} cipher A block cipher instance.\n * @param {Array} iv The IV words.\n *\n * @static\n *\n * @example\n *\n * const mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);\n */\n static createDecryptor(cipher, iv) {\n return this.Decryptor.create(cipher, iv);\n }\n}\n\nfunction xorBlock(words, offset, blockSize) {\n const _words = words;\n let block;\n\n // Shortcut\n const iv = this._iv;\n\n // Choose mixing block\n if (iv) {\n block = iv;\n\n // Remove IV for subsequent blocks\n this._iv = undefined;\n } else {\n block = this._prevBlock;\n }\n\n // XOR blocks\n for (let i = 0; i < blockSize; i += 1) {\n _words[offset + i] ^= block[i];\n }\n}\n\n/**\n * Cipher Block Chaining mode.\n */\n\n/**\n * Abstract base CBC mode.\n */\nexport class CBC extends BlockCipherMode {\n}\n/**\n * CBC encryptor.\n */\nCBC.Encryptor = class extends CBC {\n /**\n * Processes the data block at offset.\n *\n * @param {Array} words The data words to operate on.\n * @param {number} offset The offset where the block starts.\n *\n * @example\n *\n * mode.processBlock(data.words, offset);\n */\n processBlock(words, offset) {\n // Shortcuts\n const cipher = this._cipher;\n const { blockSize } = cipher;\n\n // XOR and encrypt\n xorBlock.call(this, words, offset, blockSize);\n cipher.encryptBlock(words, offset);\n\n // Remember this block to use with next block\n this._prevBlock = words.slice(offset, offset + blockSize);\n }\n};\n/**\n * CBC decryptor.\n */\nCBC.Decryptor = class extends CBC {\n /**\n * Processes the data block at offset.\n *\n * @param {Array} words The data words to operate on.\n * @param {number} offset The offset where the block starts.\n *\n * @example\n *\n * mode.processBlock(data.words, offset);\n */\n processBlock(words, offset) {\n // Shortcuts\n const cipher = this._cipher;\n const { blockSize } = cipher;\n\n // Remember this block to use with next block\n const thisBlock = words.slice(offset, offset + blockSize);\n\n // Decrypt and XOR\n cipher.decryptBlock(words, offset);\n xorBlock.call(this, words, offset, blockSize);\n\n // This block becomes the previous block\n this._prevBlock = thisBlock;\n }\n};\n\n/**\n * PKCS #5/7 padding strategy.\n */\nexport const Pkcs7 = {\n /**\n * Pads data using the algorithm defined in PKCS #5/7.\n *\n * @param {WordArray} data The data to pad.\n * @param {number} blockSize The multiple that the data should be padded to.\n *\n * @static\n *\n * @example\n *\n * CryptoJS.pad.Pkcs7.pad(wordArray, 4);\n */\n pad(data, blockSize) {\n // Shortcut\n const blockSizeBytes = blockSize * 4;\n\n // Count padding bytes\n const nPaddingBytes = blockSizeBytes - (data.sigBytes % blockSizeBytes);\n\n // Create padding word\n const paddingWord = (nPaddingBytes << 24)\n | (nPaddingBytes << 16)\n | (nPaddingBytes << 8)\n | nPaddingBytes;\n\n // Create padding\n const paddingWords = [];\n for (let i = 0; i < nPaddingBytes; i += 4) {\n paddingWords.push(paddingWord);\n }\n const padding = WordArray.create(paddingWords, nPaddingBytes);\n\n // Add padding\n data.concat(padding);\n },\n\n /**\n * Unpads data that had been padded using the algorithm defined in PKCS #5/7.\n *\n * @param {WordArray} data The data to unpad.\n *\n * @static\n *\n * @example\n *\n * CryptoJS.pad.Pkcs7.unpad(wordArray);\n */\n unpad(data) {\n const _data = data;\n\n // Get number of padding bytes from last byte\n const nPaddingBytes = _data.words[(_data.sigBytes - 1) >>> 2] & 0xff;\n\n // Remove padding\n _data.sigBytes -= nPaddingBytes;\n },\n};\n\n/**\n * Abstract base block cipher template.\n *\n * @property {number} blockSize\n *\n * The number of 32-bit words this cipher operates on. Default: 4 (128 bits)\n */\nexport class BlockCipher extends Cipher {\n constructor(xformMode, key, cfg) {\n /**\n * Configuration options.\n *\n * @property {Mode} mode The block mode to use. Default: CBC\n * @property {Padding} padding The padding strategy to use. Default: Pkcs7\n */\n super(xformMode, key, Object.assign(\n {\n mode: CBC,\n padding: Pkcs7,\n },\n cfg,\n ));\n\n this.blockSize = 128 / 32;\n }\n\n reset() {\n let modeCreator;\n\n // Reset cipher\n super.reset.call(this);\n\n // Shortcuts\n const { cfg } = this;\n const { iv, mode } = cfg;\n\n // Reset block mode\n if (this._xformMode === this.constructor._ENC_XFORM_MODE) {\n modeCreator = mode.createEncryptor;\n } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n modeCreator = mode.createDecryptor;\n // Keep at least one block in the buffer for unpadding\n this._minBufferSize = 1;\n }\n\n this._mode = modeCreator.call(mode, this, iv && iv.words);\n this._mode.__creator = modeCreator;\n }\n\n _doProcessBlock(words, offset) {\n this._mode.processBlock(words, offset);\n }\n\n _doFinalize() {\n let finalProcessedBlocks;\n\n // Shortcut\n const { padding } = this.cfg;\n\n // Finalize\n if (this._xformMode === this.constructor._ENC_XFORM_MODE) {\n // Pad data\n padding.pad(this._data, this.blockSize);\n\n // Process final blocks\n finalProcessedBlocks = this._process(!!'flush');\n } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n // Process final blocks\n finalProcessedBlocks = this._process(!!'flush');\n\n // Unpad data\n padding.unpad(finalProcessedBlocks);\n }\n\n return finalProcessedBlocks;\n }\n}\n\n/**\n * A collection of cipher parameters.\n *\n * @property {WordArray} ciphertext The raw ciphertext.\n * @property {WordArray} key The key to this ciphertext.\n * @property {WordArray} iv The IV used in the ciphering operation.\n * @property {WordArray} salt The salt used with a key derivation function.\n * @property {Cipher} algorithm The cipher algorithm.\n * @property {Mode} mode The block mode used in the ciphering operation.\n * @property {Padding} padding The padding scheme used in the ciphering operation.\n * @property {number} blockSize The block size of the cipher.\n * @property {Format} formatter\n * The default formatting strategy to convert this cipher params object to a string.\n */\nexport class CipherParams extends Base {\n /**\n * Initializes a newly created cipher params object.\n *\n * @param {Object} cipherParams An object with any of the possible cipher parameters.\n *\n * @example\n *\n * var cipherParams = CryptoJS.lib.CipherParams.create({\n * ciphertext: ciphertextWordArray,\n * key: keyWordArray,\n * iv: ivWordArray,\n * salt: saltWordArray,\n * algorithm: CryptoJS.algo.AES,\n * mode: CryptoJS.mode.CBC,\n * padding: CryptoJS.pad.PKCS7,\n * blockSize: 4,\n * formatter: CryptoJS.format.OpenSSL\n * });\n */\n constructor(cipherParams) {\n super();\n\n this.mixIn(cipherParams);\n }\n\n /**\n * Converts this cipher params object to a string.\n *\n * @param {Format} formatter (Optional) The formatting strategy to use.\n *\n * @return {string} The stringified cipher params.\n *\n * @throws Error If neither the formatter nor the default formatter is set.\n *\n * @example\n *\n * var string = cipherParams + '';\n * var string = cipherParams.toString();\n * var string = cipherParams.toString(CryptoJS.format.OpenSSL);\n */\n toString(formatter) {\n return (formatter || this.formatter).stringify(this);\n }\n}\n\n/**\n * OpenSSL formatting strategy.\n */\nexport const OpenSSLFormatter = {\n /**\n * Converts a cipher params object to an OpenSSL-compatible string.\n *\n * @param {CipherParams} cipherParams The cipher params object.\n *\n * @return {string} The OpenSSL-compatible string.\n *\n * @static\n *\n * @example\n *\n * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);\n */\n stringify(cipherParams) {\n let wordArray;\n\n // Shortcuts\n const { ciphertext, salt } = cipherParams;\n\n // Format\n if (salt) {\n wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);\n } else {\n wordArray = ciphertext;\n }\n\n return wordArray.toString(Base64);\n },\n\n /**\n * Converts an OpenSSL-compatible string to a cipher params object.\n *\n * @param {string} openSSLStr The OpenSSL-compatible string.\n *\n * @return {CipherParams} The cipher params object.\n *\n * @static\n *\n * @example\n *\n * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);\n */\n parse(openSSLStr) {\n let salt;\n\n // Parse base64\n const ciphertext = Base64.parse(openSSLStr);\n\n // Shortcut\n const ciphertextWords = ciphertext.words;\n\n // Test for salt\n if (ciphertextWords[0] === 0x53616c74 && ciphertextWords[1] === 0x65645f5f) {\n // Extract salt\n salt = WordArray.create(ciphertextWords.slice(2, 4));\n\n // Remove salt from ciphertext\n ciphertextWords.splice(0, 4);\n ciphertext.sigBytes -= 16;\n }\n\n return CipherParams.create({ ciphertext, salt });\n },\n};\n\n/**\n * A cipher wrapper that returns ciphertext as a serializable cipher params object.\n */\nexport class SerializableCipher extends Base {\n /**\n * Encrypts a message.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {WordArray|string} message The message to encrypt.\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {CipherParams} A cipher params object.\n *\n * @static\n *\n * @example\n *\n * var ciphertextParams = CryptoJS.lib.SerializableCipher\n * .encrypt(CryptoJS.algo.AES, message, key);\n * var ciphertextParams = CryptoJS.lib.SerializableCipher\n * .encrypt(CryptoJS.algo.AES, message, key, { iv: iv });\n * var ciphertextParams = CryptoJS.lib.SerializableCipher\n * .encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n */\n static encrypt(cipher, message, key, cfg) {\n // Apply config defaults\n const _cfg = Object.assign(new Base(), this.cfg, cfg);\n\n // Encrypt\n const encryptor = cipher.createEncryptor(key, _cfg);\n const ciphertext = encryptor.finalize(message);\n\n // Shortcut\n const cipherCfg = encryptor.cfg;\n\n // Create and return serializable cipher params\n return CipherParams.create({\n ciphertext,\n key,\n iv: cipherCfg.iv,\n algorithm: cipher,\n mode: cipherCfg.mode,\n padding: cipherCfg.padding,\n blockSize: encryptor.blockSize,\n formatter: _cfg.format,\n });\n }\n\n /**\n * Decrypts serialized ciphertext.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {WordArray} The plaintext.\n *\n * @static\n *\n * @example\n *\n * var plaintext = CryptoJS.lib.SerializableCipher\n * .decrypt(CryptoJS.algo.AES, formattedCiphertext, key,\n * { iv: iv, format: CryptoJS.format.OpenSSL });\n * var plaintext = CryptoJS.lib.SerializableCipher\n * .decrypt(CryptoJS.algo.AES, ciphertextParams, key,\n * { iv: iv, format: CryptoJS.format.OpenSSL });\n */\n static decrypt(cipher, ciphertext, key, cfg) {\n let _ciphertext = ciphertext;\n\n // Apply config defaults\n const _cfg = Object.assign(new Base(), this.cfg, cfg);\n\n // Convert string to CipherParams\n _ciphertext = this._parse(_ciphertext, _cfg.format);\n\n // Decrypt\n const plaintext = cipher.createDecryptor(key, _cfg).finalize(_ciphertext.ciphertext);\n\n return plaintext;\n }\n\n /**\n * Converts serialized ciphertext to CipherParams,\n * else assumed CipherParams already and returns ciphertext unchanged.\n *\n * @param {CipherParams|string} ciphertext The ciphertext.\n * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.\n *\n * @return {CipherParams} The unserialized ciphertext.\n *\n * @static\n *\n * @example\n *\n * var ciphertextParams = CryptoJS.lib.SerializableCipher\n * ._parse(ciphertextStringOrParams, format);\n */\n static _parse(ciphertext, format) {\n if (typeof ciphertext === 'string') {\n return format.parse(ciphertext, this);\n }\n return ciphertext;\n }\n}\n/**\n * Configuration options.\n *\n * @property {Formatter} format\n *\n * The formatting strategy to convert cipher param objects to and from a string.\n * Default: OpenSSL\n */\nSerializableCipher.cfg = Object.assign(\n new Base(),\n { format: OpenSSLFormatter },\n);\n\n/**\n * OpenSSL key derivation function.\n */\nexport const OpenSSLKdf = {\n /**\n * Derives a key and IV from a password.\n *\n * @param {string} password The password to derive from.\n * @param {number} keySize The size in words of the key to generate.\n * @param {number} ivSize The size in words of the IV to generate.\n * @param {WordArray|string} salt\n * (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.\n *\n * @return {CipherParams} A cipher params object with the key, IV, and salt.\n *\n * @static\n *\n * @example\n *\n * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);\n * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');\n */\n execute(password, keySize, ivSize, salt) {\n let _salt = salt;\n\n // Generate random salt\n if (!_salt) {\n _salt = WordArray.random(64 / 8);\n }\n\n // Derive key and IV\n const key = EvpKDFAlgo.create({ keySize: keySize + ivSize }).compute(password, _salt);\n\n // Separate key and IV\n const iv = WordArray.create(key.words.slice(keySize), ivSize * 4);\n key.sigBytes = keySize * 4;\n\n // Return params\n return CipherParams.create({ key, iv, salt: _salt });\n },\n};\n\n/**\n * A serializable cipher wrapper that derives the key from a password,\n * and returns ciphertext as a serializable cipher params object.\n */\nexport class PasswordBasedCipher extends SerializableCipher {\n /**\n * Encrypts a message using a password.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {WordArray|string} message The message to encrypt.\n * @param {string} password The password.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {CipherParams} A cipher params object.\n *\n * @static\n *\n * @example\n *\n * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher\n * .encrypt(CryptoJS.algo.AES, message, 'password');\n * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher\n * .encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });\n */\n static encrypt(cipher, message, password, cfg) {\n // Apply config defaults\n const _cfg = Object.assign(new Base(), this.cfg, cfg);\n\n // Derive key and other params\n const derivedParams = _cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);\n\n // Add IV to config\n _cfg.iv = derivedParams.iv;\n\n // Encrypt\n const ciphertext = SerializableCipher.encrypt\n .call(this, cipher, message, derivedParams.key, _cfg);\n\n // Mix in derived params\n ciphertext.mixIn(derivedParams);\n\n return ciphertext;\n }\n\n /**\n * Decrypts serialized ciphertext using a password.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n * @param {string} password The password.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {WordArray} The plaintext.\n *\n * @static\n *\n * @example\n *\n * var plaintext = CryptoJS.lib.PasswordBasedCipher\n * .decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password',\n * { format: CryptoJS.format.OpenSSL });\n * var plaintext = CryptoJS.lib.PasswordBasedCipher\n * .decrypt(CryptoJS.algo.AES, ciphertextParams, 'password',\n * { format: CryptoJS.format.OpenSSL });\n */\n static decrypt(cipher, ciphertext, password, cfg) {\n let _ciphertext = ciphertext;\n\n // Apply config defaults\n const _cfg = Object.assign(new Base(), this.cfg, cfg);\n\n // Convert string to CipherParams\n _ciphertext = this._parse(_ciphertext, _cfg.format);\n\n // Derive key and other params\n const derivedParams = _cfg.kdf\n .execute(password, cipher.keySize, cipher.ivSize, _ciphertext.salt);\n\n // Add IV to config\n _cfg.iv = derivedParams.iv;\n\n // Decrypt\n const plaintext = SerializableCipher.decrypt\n .call(this, cipher, _ciphertext, derivedParams.key, _cfg);\n\n return plaintext;\n }\n}\n/**\n * Configuration options.\n *\n * @property {KDF} kdf\n * The key derivation function to use to generate a key and IV from a password.\n * Default: OpenSSL\n */\nPasswordBasedCipher.cfg = Object.assign(SerializableCipher.cfg, { kdf: OpenSSLKdf });\n","import {\n BlockCipher,\n} from './cipher-core.js';\n\n// Lookup tables\nconst _SBOX = [];\nconst INV_SBOX = [];\nconst _SUB_MIX_0 = [];\nconst _SUB_MIX_1 = [];\nconst _SUB_MIX_2 = [];\nconst _SUB_MIX_3 = [];\nconst INV_SUB_MIX_0 = [];\nconst INV_SUB_MIX_1 = [];\nconst INV_SUB_MIX_2 = [];\nconst INV_SUB_MIX_3 = [];\n\n// Compute lookup tables\n\n// Compute double table\nconst d = [];\nfor (let i = 0; i < 256; i += 1) {\n if (i < 128) {\n d[i] = i << 1;\n } else {\n d[i] = (i << 1) ^ 0x11b;\n }\n}\n\n// Walk GF(2^8)\nlet x = 0;\nlet xi = 0;\nfor (let i = 0; i < 256; i += 1) {\n // Compute sbox\n let sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n _SBOX[x] = sx;\n INV_SBOX[sx] = x;\n\n // Compute multiplication\n const x2 = d[x];\n const x4 = d[x2];\n const x8 = d[x4];\n\n // Compute sub bytes, mix columns tables\n let t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n _SUB_MIX_0[x] = (t << 24) | (t >>> 8);\n _SUB_MIX_1[x] = (t << 16) | (t >>> 16);\n _SUB_MIX_2[x] = (t << 8) | (t >>> 24);\n _SUB_MIX_3[x] = t;\n\n // Compute inv sub bytes, inv mix columns tables\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);\n INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);\n INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);\n INV_SUB_MIX_3[sx] = t;\n\n // Compute next counter\n if (!x) {\n xi = 1;\n x = xi;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n}\n\n// Precomputed Rcon lookup\nconst RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n\n/**\n * AES block cipher algorithm.\n */\nexport class AESAlgo extends BlockCipher {\n _doReset() {\n let t;\n\n // Skip reset of nRounds has been set before and key did not change\n if (this._nRounds && this._keyPriorReset === this._key) {\n return;\n }\n\n // Shortcuts\n this._keyPriorReset = this._key;\n const key = this._keyPriorReset;\n const keyWords = key.words;\n const keySize = key.sigBytes / 4;\n\n // Compute number of rounds\n this._nRounds = keySize + 6;\n const nRounds = this._nRounds;\n\n // Compute number of key schedule rows\n const ksRows = (nRounds + 1) * 4;\n\n // Compute key schedule\n this._keySchedule = [];\n const keySchedule = this._keySchedule;\n for (let ksRow = 0; ksRow < ksRows; ksRow += 1) {\n if (ksRow < keySize) {\n keySchedule[ksRow] = keyWords[ksRow];\n } else {\n t = keySchedule[ksRow - 1];\n\n if (!(ksRow % keySize)) {\n // Rot word\n t = (t << 8) | (t >>> 24);\n\n // Sub word\n t = (_SBOX[t >>> 24] << 24)\n | (_SBOX[(t >>> 16) & 0xff] << 16)\n | (_SBOX[(t >>> 8) & 0xff] << 8)\n | _SBOX[t & 0xff];\n\n // Mix Rcon\n t ^= RCON[(ksRow / keySize) | 0] << 24;\n } else if (keySize > 6 && ksRow % keySize === 4) {\n // Sub word\n t = (_SBOX[t >>> 24] << 24)\n | (_SBOX[(t >>> 16) & 0xff] << 16)\n | (_SBOX[(t >>> 8) & 0xff] << 8)\n | _SBOX[t & 0xff];\n }\n\n keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;\n }\n }\n\n // Compute inv key schedule\n this._invKeySchedule = [];\n const invKeySchedule = this._invKeySchedule;\n for (let invKsRow = 0; invKsRow < ksRows; invKsRow += 1) {\n const ksRow = ksRows - invKsRow;\n\n if (invKsRow % 4) {\n t = keySchedule[ksRow];\n } else {\n t = keySchedule[ksRow - 4];\n }\n\n if (invKsRow < 4 || ksRow <= 4) {\n invKeySchedule[invKsRow] = t;\n } else {\n invKeySchedule[invKsRow] = INV_SUB_MIX_0[_SBOX[t >>> 24]]\n ^ INV_SUB_MIX_1[_SBOX[(t >>> 16) & 0xff]]\n ^ INV_SUB_MIX_2[_SBOX[(t >>> 8) & 0xff]]\n ^ INV_SUB_MIX_3[_SBOX[t & 0xff]];\n }\n }\n }\n\n encryptBlock(M, offset) {\n this._doCryptBlock(\n M, offset, this._keySchedule, _SUB_MIX_0, _SUB_MIX_1, _SUB_MIX_2, _SUB_MIX_3, _SBOX,\n );\n }\n\n decryptBlock(M, offset) {\n const _M = M;\n\n // Swap 2nd and 4th rows\n let t = _M[offset + 1];\n _M[offset + 1] = _M[offset + 3];\n _M[offset + 3] = t;\n\n this._doCryptBlock(\n _M,\n offset,\n this._invKeySchedule,\n INV_SUB_MIX_0,\n INV_SUB_MIX_1,\n INV_SUB_MIX_2,\n INV_SUB_MIX_3,\n INV_SBOX,\n );\n\n // Inv swap 2nd and 4th rows\n t = _M[offset + 1];\n _M[offset + 1] = _M[offset + 3];\n _M[offset + 3] = t;\n }\n\n _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {\n const _M = M;\n\n // Shortcut\n const nRounds = this._nRounds;\n\n // Get input, add round key\n let s0 = _M[offset] ^ keySchedule[0];\n let s1 = _M[offset + 1] ^ keySchedule[1];\n let s2 = _M[offset + 2] ^ keySchedule[2];\n let s3 = _M[offset + 3] ^ keySchedule[3];\n\n // Key schedule row counter\n let ksRow = 4;\n\n // Rounds\n for (let round = 1; round < nRounds; round += 1) {\n // Shift rows, sub bytes, mix columns, add round key\n const t0 = SUB_MIX_0[s0 >>> 24]\n ^ SUB_MIX_1[(s1 >>> 16) & 0xff]\n ^ SUB_MIX_2[(s2 >>> 8) & 0xff]\n ^ SUB_MIX_3[s3 & 0xff]\n ^ keySchedule[ksRow];\n ksRow += 1;\n const t1 = SUB_MIX_0[s1 >>> 24]\n ^ SUB_MIX_1[(s2 >>> 16) & 0xff]\n ^ SUB_MIX_2[(s3 >>> 8) & 0xff]\n ^ SUB_MIX_3[s0 & 0xff]\n ^ keySchedule[ksRow];\n ksRow += 1;\n const t2 = SUB_MIX_0[s2 >>> 24]\n ^ SUB_MIX_1[(s3 >>> 16) & 0xff]\n ^ SUB_MIX_2[(s0 >>> 8) & 0xff]\n ^ SUB_MIX_3[s1 & 0xff]\n ^ keySchedule[ksRow];\n ksRow += 1;\n const t3 = SUB_MIX_0[s3 >>> 24]\n ^ SUB_MIX_1[(s0 >>> 16) & 0xff]\n ^ SUB_MIX_2[(s1 >>> 8) & 0xff]\n ^ SUB_MIX_3[s2 & 0xff]\n ^ keySchedule[ksRow];\n ksRow += 1;\n\n // Update state\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n }\n\n // Shift rows, sub bytes, add round key\n const t0 = (\n (SBOX[s0 >>> 24] << 24)\n | (SBOX[(s1 >>> 16) & 0xff] << 16)\n | (SBOX[(s2 >>> 8) & 0xff] << 8)\n | SBOX[s3 & 0xff]\n ) ^ keySchedule[ksRow];\n ksRow += 1;\n const t1 = (\n (SBOX[s1 >>> 24] << 24)\n | (SBOX[(s2 >>> 16) & 0xff] << 16)\n | (SBOX[(s3 >>> 8) & 0xff] << 8)\n | SBOX[s0 & 0xff]\n ) ^ keySchedule[ksRow];\n ksRow += 1;\n const t2 = (\n (SBOX[s2 >>> 24] << 24)\n | (SBOX[(s3 >>> 16) & 0xff] << 16)\n | (SBOX[(s0 >>> 8) & 0xff] << 8)\n | SBOX[s1 & 0xff]\n ) ^ keySchedule[ksRow];\n ksRow += 1;\n const t3 = (\n (SBOX[s3 >>> 24] << 24)\n | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]\n ) ^ keySchedule[ksRow];\n ksRow += 1;\n\n // Set output\n _M[offset] = t0;\n _M[offset + 1] = t1;\n _M[offset + 2] = t2;\n _M[offset + 3] = t3;\n }\n}\nAESAlgo.keySize = 256 / 32;\n\n/**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);\n * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);\n */\nexport const AES = BlockCipher._createHelper(AESAlgo);\n","/**\n * Counter block mode.\n */\nimport {\n BlockCipherMode,\n} from './cipher-core.js';\n\nexport class CTR extends BlockCipherMode {\n}\nCTR.Encryptor = class extends CTR {\n processBlock(words, offset) {\n const _words = words;\n\n // Shortcuts\n const cipher = this._cipher;\n const { blockSize } = cipher;\n const iv = this._iv;\n let counter = this._counter;\n\n // Generate keystream\n if (iv) {\n this._counter = iv.slice(0);\n counter = this._counter;\n\n // Remove IV for subsequent blocks\n this._iv = undefined;\n }\n const keystream = counter.slice(0);\n cipher.encryptBlock(keystream, 0);\n\n // Increment counter\n counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0;\n\n // Encrypt\n for (let i = 0; i < blockSize; i += 1) {\n _words[offset + i] ^= keystream[i];\n }\n }\n};\nCTR.Decryptor = CTR.Encryptor;\n","export class TransferCost {\n _ttfb = 0\n\n _demuxStart = 0\n _demuxEnd = 0\n _demuxCost = 0\n\n _remuxStart = 0\n _remuxEnd = 0\n _remuxCost = 0\n\n _appendStart = 0\n _appendEnd = 0\n _appendCost = 0\n\n set (event, value) {\n this[`_${event}`] = value\n }\n\n start (event){\n this[`_${event}Start`] = Date.now()\n }\n\n end (event){\n this[`_${event}End`] = Date.now()\n this[`_${event}Cost`] = this[`_${event}Cost`] + (this[`_${event}End`] - this[`_${event}Start`])\n }\n\n get transferCost (){\n return {\n ttfbCost: this._ttfb,\n demuxCost: this._demuxCost,\n remuxCost: this._remuxCost,\n appendCost: this._appendCost\n }\n }\n}\n\nexport const TRANSFER_EVENT = {\n TTFB: 'ttfb',\n DEMUX: 'demux',\n REMUX: 'remux',\n APPEND: 'append'\n}\n","import { FlvDemuxer, FMP4Remuxer, WarningType } from 'xgplayer-transmuxer'\nimport { MSE, Buffer, EVENT, ERR, StreamingError, Logger, concatUint8Array } from 'xgplayer-streaming-shared'\nimport { TRANSFER_EVENT } from './transfer-cost'\n\nconst logger = new Logger('BufferService')\n\nexport class BufferService {\n /** @type {import('../index').Flv | null} */\n flv = null\n\n _demuxer = new FlvDemuxer()\n _remuxer = null\n _mse = null\n _softVideo = null\n\n _sourceCreated = false\n\n _needInitSegment = true\n _discontinuity = true\n _contiguous = false\n\n _initSegmentId = ''\n\n _cachedBuffer = null\n\n _demuxStartTime = 0\n\n _opts = null\n\n get baseDts () {\n return this._demuxer?._fixer?._baseDts\n }\n\n get blobUrl () {\n return this._mse?.url\n }\n\n /**\n * @param {import('../index').Flv} flv\n * @param {Object} [softVideo]\n */\n constructor (flv, softVideo, opts = {}) {\n this.flv = flv\n this._opts = opts\n\n if (softVideo) { // soft decode\n this._softVideo = softVideo\n } else {\n this._remuxer = new FMP4Remuxer(this._demuxer.videoTrack, this._demuxer.audioTrack)\n this._mse = new MSE(null, {\n preferMMS:\n typeof opts.preferMMS === 'boolean' ? opts.preferMMS : !!opts.perferMMS /* perferMMS is typo, deprecated */\n })\n this._mse.bindMedia(flv.media)\n }\n }\n\n isFull (mediaType = MSE.VIDEO){\n return this._mse.isFull(mediaType)\n }\n\n seamlessSwitch () {\n this._needInitSegment = true\n this._discontinuity = true\n this._contiguous = true\n this._initSegmentId = ''\n }\n\n unContiguous (startTime) {\n this._contiguous = false\n this._demuxStartTime = startTime\n }\n\n async reset (reuseMse = false) {\n if (this._mse && !reuseMse) {\n await this._mse.unbindMedia()\n await this._mse.bindMedia(this.flv.media)\n }\n this._needInitSegment = true\n this._discontinuity = true\n this._contiguous = false\n this._sourceCreated = false\n this._initSegmentId = ''\n this.resetSeamlessSwitchStats()\n }\n\n resetSeamlessSwitchStats () {\n this.seamlessLoadingSwitch = null\n this.seamlessLoadingSwitching = false\n if (this._demuxer) {\n this._demuxer.seamlessLoadingSwitching = false\n }\n }\n\n async endOfStream () {\n if (this._mse) {\n if (this._sourceCreated) {\n await this._mse.endOfStream()\n this.flv.emit(EVENT.BUFFEREOS)\n }\n } else if (this._softVideo) {\n this._softVideo.endOfStream()\n }\n }\n\n async updateDuration (duration) {\n if (this._mse) {\n if (!this._mse.isOpened) {\n await this._mse.open()\n }\n logger.debug('update duration', duration)\n await this._mse.updateDuration(duration)\n }\n }\n\n async destroy () {\n if (this._mse) {\n await this._mse.unbindMedia()\n }\n\n this._mse = null\n this._softVideo = null\n this._demuxer = null\n this._remuxer = null\n }\n\n async appendBuffer (chunk) {\n let switchingNoReset = false\n if (this._cachedBuffer) {\n chunk = concatUint8Array(this._cachedBuffer, chunk)\n this._cachedBuffer = null\n }\n\n const demuxer = this._demuxer\n if (!chunk || !chunk.length || !demuxer) return\n\n try {\n this.flv._transferCost.start(TRANSFER_EVENT.DEMUX)\n demuxer.demuxAndFix(chunk, this.seamlessLoadingSwitching || this._discontinuity, this._contiguous, this._demuxStartTime, this.seamlessLoadingSwitching)\n this.seamlessLoadingSwitching = false\n this.flv._transferCost.end(TRANSFER_EVENT.DEMUX)\n } catch (error) {\n throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, error)\n }\n const { videoTrack, audioTrack, metadataTrack } = demuxer\n\n if (this.seamlessLoadingSwitch) {\n const idx = videoTrack.samples.findIndex(sample => (sample.originDts === videoTrack.lastKeyFrameDts))\n if (idx >= 0) {\n videoTrack.samples.splice(idx)\n await this.seamlessLoadingSwitch()\n // 切换清晰度后,删除原清晰度数据\n this.seamlessLoadingSwitch = null\n chunk = null\n switchingNoReset = true\n }\n }\n\n let videoExist = videoTrack.exist()\n let audioExist = audioTrack.exist()\n\n if (this._opts.onlyAudio) {\n videoExist = false\n videoTrack.present = false\n }\n\n if (this._opts.onlyVideo) {\n audioExist = false\n audioTrack.present = false\n }\n\n if (\n (!videoExist && videoTrack.present) ||\n (!audioExist && audioTrack.present)\n ) {\n let duration = 0\n const track = videoExist ? videoTrack : audioExist ? audioTrack : undefined\n if (track && track.samples.length) {\n duration = ((track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale) * 1000\n }\n if (duration > this._opts.analyzeDuration) {\n logger.warn(`analyze duration exceeded, ${duration}ms`, track)\n videoTrack.present = videoExist\n audioTrack.present = audioExist\n this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, { duration })\n } else {\n this._cachedBuffer = chunk\n return\n }\n }\n\n const videoType = videoTrack.type\n const audioType = audioTrack.type\n this._fireEvents(videoTrack, audioTrack, metadataTrack)\n if (!switchingNoReset) {\n this._discontinuity = false\n this._contiguous = true\n this._demuxStartTime = 0\n }\n\n const mse = this._mse\n const afterAppend = () => {\n if (this.flv?.emit) {\n this.flv?.emit(EVENT.APPEND_BUFFER, {})\n }\n }\n\n // emit demuxed track\n this.flv.emit(EVENT.DEMUXED_TRACK, {videoTrack})\n\n const newId = `${videoTrack.codec}/${videoTrack.width}/${videoTrack.height}/${audioTrack.codec}/${audioTrack.config}`\n if (newId !== this._initSegmentId) {\n this._needInitSegment = true\n this._initSegmentId = newId\n this._emitMetaParsedEvent(videoTrack, audioTrack)\n }\n\n if (mse) {\n if (!this._sourceCreated) {\n await mse.open()\n if (videoExist) {\n logger.log(`codec: video/mp4;codecs=${videoTrack.codec}`)\n mse.createSource(videoType, `video/mp4;codecs=${videoTrack.codec}`)\n }\n if (audioExist) {\n logger.log(`codec: audio/mp4;codecs=${audioTrack.codec}`)\n mse.createSource(audioType, `audio/mp4;codecs=${audioTrack.codec}`)\n }\n this._sourceCreated = true\n this.flv.emit(EVENT.SOURCEBUFFER_CREATED)\n }\n\n let remuxResult\n try {\n // LG webos5.4系统上发现, 直播流开启low latency mode渲染的话,出首帧后需要等一段时间才触发loadeddata、canplay事件,影响首帧统计\n // low latency mode通过解析封装的fmp4中对媒体播放时长的描述判断 https://issues.chromium.org/issues/41161663\n if (this._needInitSegment && !this._opts.mseLowLatency) {\n videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale\n audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale\n }\n this.flv._transferCost.start(TRANSFER_EVENT.REMUX)\n remuxResult = this._remuxer.remux(this._needInitSegment)\n this.flv._transferCost.end(TRANSFER_EVENT.REMUX)\n\n } catch (error) {\n throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, error)\n }\n\n if (this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment) {\n return\n }\n\n this._needInitSegment = false\n\n const p = []\n if (remuxResult.videoInitSegment) p.push(mse.append(videoType, remuxResult.videoInitSegment))\n if (remuxResult.audioInitSegment) p.push(mse.append(audioType, remuxResult.audioInitSegment))\n if (remuxResult.videoSegment) p.push(mse.append(videoType, remuxResult.videoSegment))\n if (remuxResult.audioSegment) p.push(mse.append(audioType, remuxResult.audioSegment))\n\n this.flv._transferCost.start(TRANSFER_EVENT.APPEND)\n return Promise.all(p).then(afterAppend).then(() => {\n this.flv._transferCost.end(TRANSFER_EVENT.APPEND)\n afterAppend()\n })\n } else if (this._softVideo) {\n this._softVideo.appendBuffer(videoTrack, audioTrack)\n afterAppend()\n }\n }\n\n async evictBuffer (bufferBehind) {\n const media = this.flv.media\n if (!this._mse || !this._demuxer || !media || !bufferBehind || bufferBehind < 0) return\n const currentTime = media.currentTime\n const removeEnd = currentTime - bufferBehind\n if (removeEnd <= 0) return\n const start = Buffer.start(Buffer.get(media))\n if (start + 1 >= removeEnd) return\n return this._mse.clearBuffer(0, removeEnd).then(() => this.flv.emit(EVENT.REMOVE_BUFFER, { removeEnd }))\n }\n\n _emitMetaParsedEvent (videoTrack, audioTrack) {\n if (videoTrack.exist()) {\n this.flv.emit(EVENT.METADATA_PARSED, {\n type: 'video',\n track: videoTrack,\n meta: {\n codec: videoTrack.codec,\n timescale: videoTrack.timescale,\n width: videoTrack.width,\n height: videoTrack.height,\n sarRatio: videoTrack.sarRatio,\n baseDts: videoTrack.baseDts\n }\n })\n }\n if (audioTrack.exist()) {\n this.flv.emit(EVENT.METADATA_PARSED, {\n type: 'audio',\n track: audioTrack,\n meta: {\n codec: audioTrack.codec,\n channelCount: audioTrack.channelCount,\n sampleRate: audioTrack.sampleRate,\n timescale: audioTrack.timescale,\n baseDts: audioTrack.baseDts\n }\n })\n }\n\n logger.debug('track parsed', videoTrack, audioTrack)\n }\n\n _fireEvents (videoTrack, audioTrack, metadataTrack) {\n logger.debug(`videoTrack samples count: ${videoTrack.samples.length}, audioTrack samples count: ${audioTrack.samples.length}`)\n\n metadataTrack.flvScriptSamples.forEach(sample => {\n this.flv.emit(EVENT.FLV_SCRIPT_DATA, sample)\n logger.debug('flvScriptData', sample)\n })\n\n videoTrack.samples.forEach((sample) => {\n if (sample.keyframe) {\n this.flv.emit(EVENT.KEYFRAME, { pts: sample.originPts })\n }\n })\n\n videoTrack.warnings.forEach(warn => {\n let type\n switch (warn.type) {\n case WarningType.LARGE_AV_SHIFT:\n type = EVENT.LARGE_AV_FIRST_FRAME_GAP_DETECT\n break\n case WarningType.LARGE_VIDEO_GAP:\n type = EVENT.LARGE_VIDEO_DTS_GAP_DETECT\n break\n case WarningType.LARGE_VIDEO_GAP_BETWEEN_CHUNK:\n type = EVENT.MAX_DTS_DELTA_WITH_NEXT_SEGMENT_DETECT\n break\n default:\n }\n\n if (type) this.flv.emit(EVENT.STREAM_EXCEPTION, { ...warn, type })\n logger.warn('video exception', warn)\n })\n audioTrack.warnings.forEach(warn => {\n let type\n switch (warn.type) {\n case WarningType.LARGE_AUDIO_GAP:\n type = EVENT.LARGE_AUDIO_DTS_GAP_DETECT\n break\n case WarningType.AUDIO_FILLED:\n type = EVENT.AUDIO_GAP_DETECT\n break\n case WarningType.AUDIO_DROPPED:\n type = EVENT.AUDIO_OVERLAP_DETECT\n break\n default:\n }\n\n if (type) this.flv.emit(EVENT.STREAM_EXCEPTION, { ...warn, type })\n logger.warn('audio exception', warn)\n })\n\n metadataTrack.seiSamples.forEach(sei => {\n this.flv.emit(EVENT.SEI, {\n ...sei,\n sei: {\n code: sei.data.type,\n content: sei.data.payload,\n dts: sei.pts\n }\n })\n })\n }\n}\n","export function searchKeyframeIndex (list, value) {\n let idx = 0\n\n const last = list.length - 1\n let mid = 0\n let lbound = 0\n let ubound = last\n\n if (value < list[0]) {\n idx = 0\n lbound = ubound + 1 // skip search\n }\n\n while (lbound <= ubound) {\n mid = lbound + Math.floor((ubound - lbound) / 2)\n if (mid === last || (value >= list[mid] && value < list[mid + 1])) {\n idx = mid\n break\n } else if (list[mid] < value) {\n lbound = mid + 1\n } else {\n ubound = mid - 1\n }\n }\n\n return idx\n}\n","import EventEmitter from 'eventemitter3'\nimport {\n NetLoader,\n Buffer,\n MSE,\n EVENT,\n StreamingError,\n BandwidthService,\n SeiService,\n GapService,\n MediaStatsService,\n isMediaPlaying,\n Logger,\n getVideoPlaybackQuality\n} from 'xgplayer-streaming-shared'\nimport { Logger as TransmuxerLogger } from 'xgplayer-transmuxer'\nimport { BufferService } from './services'\nimport { getOption } from './options'\nimport { searchKeyframeIndex } from './utils'\nimport { TransferCost, TRANSFER_EVENT } from './services/transfer-cost'\n\nexport const logger = new Logger('flv')\n\nconst MAX_HOLE = 0.1\nconst MAX_START_GAP = 0.3\n\n/**\n * @typedef {import(\"../../../xgplayer-streaming-shared/es/services/stats\").StatsInfo} Stats\n */\nexport class Flv extends EventEmitter {\n /** @type {HTMLMediaElement | null} */\n media = null\n\n _loading = false\n\n /** @type {import('./options').FlvOption} */\n _opts = null\n\n /** @type {BufferService} */\n _bufferService = null\n\n /** @type {GapService} */\n _gapService = null\n\n /** @type {MediaStatsService} */\n _stats = null\n\n /** @type {NetLoader} */\n _mediaLoader = null\n\n _maxChunkWaitTimer = null\n\n _tickTimer = null\n _tickInterval = 500\n\n _urlSwitching = false\n _seamlessSwitching = false\n _disconnectRetryCount = 0\n _preLoadEndPoint = 0\n\n _keyframes = null\n _acceptRanges = true\n\n /**\n * @param {import('./options').FlvOption} opts\n */\n constructor (opts) {\n super()\n this._opts = getOption(opts)\n this.media = this._opts.media || document.createElement('video')\n this._opts.media = null\n this._firstProgressEmit = false\n this._mediaLoader = new NetLoader({\n ...this._opts.fetchOptions,\n retry: this._opts.retryCount,\n retryDelay: this._opts.retryDelay,\n timeout: this._opts.loadTimeout,\n onRetryError: this._onRetryError,\n onProgress: this._onProgress,\n responseType: 'arraybuffer'\n })\n\n this._disconnectRetryCount = this._opts.disconnectRetryCount\n this._transferCost = new TransferCost()\n\n this._bufferService = new BufferService(\n this,\n this._opts.softDecode ? this.media : undefined,\n this._opts\n )\n this._seiService = new SeiService(this)\n this._bandwidthService = new BandwidthService({\n chunkCountForSpeed: this._opts.chunkCountForSpeed,\n skipChunkSize: this._opts.skipChunkSize,\n longtimeNoReceived: this._opts.longtimeNoReceived\n })\n this._stats = new MediaStatsService(this)\n\n if (!this._opts.softDecode) {\n this._gapService = new GapService()\n }\n\n this.media.addEventListener('play', this._onPlay)\n this.media.addEventListener('loadeddata', this._onLoadeddata)\n this.media.addEventListener('seeking', this._onSeeking)\n this.media.addEventListener('timeupdate', this._onTimeupdate)\n this.media.addEventListener('progress', this._onBufferUpdate)\n this.media.addEventListener('waiting', this._onWaiting)\n\n this.on(EVENT.FLV_SCRIPT_DATA, this._onFlvScriptData)\n }\n\n get version () {\n return __VERSION__\n }\n\n get isLive () {\n return this._opts.isLive\n }\n\n get baseDts () {\n return this._bufferService?.baseDts\n }\n\n get seekable () {\n return !!this._keyframes && this._acceptRanges\n }\n\n get loader () {\n return this._mediaLoader\n }\n\n get blobUrl () {\n return this._bufferService?.blobUrl\n }\n\n speedInfo () {\n return {\n speed: this._bandwidthService.getLatestSpeed(),\n avgSpeed: this._bandwidthService.getAvgSpeed(),\n totalSize: this._bandwidthService.getTotalSize(),\n totalCost: this._bandwidthService.getTotalCost()\n }\n }\n\n /**\n * @returns {Stats}\n */\n getStats () {\n return this._stats.getStats()\n }\n\n bufferInfo (maxHole = MAX_HOLE) {\n return Buffer.info(Buffer.get(this.media), this.media?.currentTime, maxHole)\n }\n\n playbackQuality () {\n return getVideoPlaybackQuality(this.media)\n }\n\n /**\n * load or reload source\n * @param {string} [url]\n * @return {Promise}\n */\n async load (url, reuseMse = false) {\n if (!this._bufferService) return\n await this._reset(reuseMse)\n\n this._loadData(url, this._opts.isLive ? [] : [0, this._opts.defaultVodLoadSize])\n\n clearTimeout(this._tickTimer)\n this._tickTimer = setTimeout(this._tick, this._tickInterval)\n }\n\n /** @return {Promise} */\n async replay (seamlesslyReload = this._opts.seamlesslyReload, isPlayEmit) {\n if (!this.media) return\n\n this._resetDisconnectCount()\n\n if (seamlesslyReload) {\n await this._clear()\n\n setTimeout(() => {\n this._seamlessSwitching = true\n this._loadData(this._opts.url)\n this._bufferService.seamlessSwitch()\n })\n } else {\n await this.load()\n }\n return this.media.play(!isPlayEmit).catch(() => {})\n }\n\n disconnect () {\n logger.debug('disconnect!')\n this._bufferService?.resetSeamlessSwitchStats()\n return this._clear()\n }\n\n /**\n * @param {string} url\n * @param {boolean} [seamless=false]\n */\n async switchURL (url, seamless) {\n if (!this._bufferService) return\n\n this._resetDisconnectCount()\n\n if (this._loading && seamless) {\n this._bufferService.seamlessLoadingSwitch = async (pts) => {\n await this._clear()\n this._bufferService.seamlessLoadingSwitching = true\n this._urlSwitching = true\n this._seamlessSwitching = true\n this._bufferService.seamlessSwitch()\n this._loadData(url)\n }\n return\n }\n\n if (!seamless || !this._opts.isLive) {\n await this.load(url)\n this._urlSwitching = true\n return this.media.play(true).catch(() => {})\n }\n\n await this._clear()\n\n setTimeout(() => {\n this._urlSwitching = true\n this._seamlessSwitching = true\n this._loadData(url)\n this._bufferService.seamlessSwitch()\n })\n }\n\n /** @return {Promise} */\n async destroy () {\n if (!this.media) return\n this.removeAllListeners()\n this._seiService.reset()\n this.media.removeEventListener('play', this._onPlay)\n this.media.removeEventListener('loadeddata', this._onLoadeddata)\n this.media.removeEventListener('seeking', this._onSeeking)\n this.media.removeEventListener('timeupdate', this._onTimeupdate)\n this.media.removeEventListener('waiting', this._onWaiting)\n this.media.removeEventListener('progress', this._onBufferUpdate)\n await Promise.all([this._clear(), this._bufferService.destroy()])\n this.media = null\n this._bufferService = null\n }\n\n /**\n * @param {('video'|'audio')?} mediaType\n * @returns {Boolean}\n */\n static isSupported (mediaType) {\n if (!mediaType || mediaType === 'video' || mediaType === 'audio') {\n return MSE.isSupported()\n }\n\n return typeof WebAssembly !== 'undefined'\n }\n\n static enableLogger () {\n Logger.enable()\n TransmuxerLogger.enable()\n }\n\n static disableLogger () {\n Logger.disable()\n TransmuxerLogger.disable()\n }\n\n _emitError (error, endOfStream = true) {\n logger.table(error)\n logger.error(error)\n logger.error(this.media?.error)\n if (this._urlSwitching) {\n this._urlSwitching = false\n this._seamlessSwitching = false\n this.emit(EVENT.SWITCH_URL_FAILED, error)\n }\n this.emit(EVENT.ERROR, error)\n if (endOfStream) {\n this._seiService.reset()\n this._end()\n }\n }\n\n async _reset (reuseMse = false) {\n this._seiService.reset()\n this._bandwidthService.reset()\n this._stats.reset()\n await this._clear()\n await this._bufferService.reset(reuseMse)\n }\n\n async _loadData (url, range) {\n if (url) this._opts.url = url\n let finnalUrl = (url = this._opts.url)\n if (!url) throw new Error('Source url is missing')\n\n if (this._opts.preProcessUrl) {\n finnalUrl = this._opts.preProcessUrl(url).url\n }\n\n this._mediaLoader.finnalUrl = finnalUrl\n\n this.emit(EVENT.LOAD_START, {\n url: finnalUrl,\n seamlessSwitching: this._seamlessSwitching\n })\n\n logger.debug('load data, loading:', this._loading, finnalUrl)\n\n if (this._loading) {\n await this._mediaLoader.cancel()\n }\n\n this._loading = true\n try {\n await this._mediaLoader.load({ url: finnalUrl, range })\n } catch (error) {\n this._loading = false\n return this._emitError(StreamingError.network(error), false)\n }\n }\n\n /**\n *\n * @param {ArrayBuffer} chunk\n * @param {boolean} done\n * @param { {startTime: number, endTime: number, st: number, firstByteTime: number}}\n * startTime: 当前流式分段开始read时间\n * endTime: 当前流式分段结束read时间\n * st: 拉流开始时间\n * firstByteTime: 首字节响应时间\n * @param {Response} response\n */\n _onProgress = async (\n chunk,\n done,\n { startTime, endTime, st, firstByteTime },\n response\n ) => {\n this._loading = !done\n if (!this._firstProgressEmit) {\n if (!this.media) {\n this._mediaLoader?.cancel()\n return\n }\n const headers = response.headers\n const elapsed = st ? firstByteTime - st : endTime - startTime\n this.emit(EVENT.TTFB, {\n url: this._opts.url,\n responseUrl: response.url,\n elapsed\n })\n this.emit(EVENT.LOAD_RESPONSE_HEADERS, { headers })\n this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed)\n this._acceptRanges =\n !!headers?.get('Accept-Ranges') || !!headers?.get('Content-Range')\n this._firstProgressEmit = true\n }\n\n if (!this._bufferService) return\n clearTimeout(this._maxChunkWaitTimer)\n\n this._bandwidthService.addChunkRecord(chunk?.byteLength, endTime - startTime)\n\n try {\n await this._bufferService.appendBuffer(chunk)\n this._bufferService?.evictBuffer(this._opts.bufferBehind)\n } catch (error) {\n if (!this.isLive && this._bufferService.isFull()) {\n await this._mediaLoader.cancel()\n this._loading = false\n // detect the large buffer size can appended\n const remaining = this.bufferInfo().remaining\n this._opts.preloadTime = parseInt(remaining) / 2\n return\n }\n return this._emitError(StreamingError.create(error))\n }\n\n if (this._urlSwitching) {\n this._urlSwitching = false\n this.emit(EVENT.SWITCH_URL_SUCCESS, { url: this._opts.url })\n }\n\n // !!\n if (this._seamlessSwitching) {\n this._seamlessSwitching = false\n this._tick()\n }\n\n if (done && !this.media.seeking) {\n this.emit(EVENT.LOAD_COMPLETE)\n logger.debug('load done')\n\n if (this.isLive && this._disconnectRetryCount <= 0) {\n this._end()\n }\n return\n }\n\n if (!this.isLive) return\n\n const { maxReaderInterval } = this._opts\n if (maxReaderInterval && this._firstProgressEmit) {\n clearTimeout(this._maxChunkWaitTimer)\n this._maxChunkWaitTimer = setTimeout(() => {\n if (this._disconnectRetryCount) {\n this._disconnectRetryCount--\n this.load()\n return\n }\n logger.debug('onMaxChunkWait', maxReaderInterval)\n this._end()\n }, maxReaderInterval)\n }\n }\n\n _onRetryError = (error, retryTime) => {\n logger.debug('load retry', error, retryTime)\n\n this.emit(EVENT.LOAD_RETRY, {\n error: StreamingError.network(error),\n retryTime\n })\n }\n\n async _clear () {\n if (this._mediaLoader) await this._mediaLoader.cancel()\n clearTimeout(this._maxChunkWaitTimer)\n clearTimeout(this._tickTimer)\n this._loading = false\n this._firstProgressEmit = false\n }\n\n _end = () => {\n this._clear()\n if (this._bufferService) {\n this._bufferService.endOfStream()\n }\n\n logger.debug('end stream')\n }\n\n _resetDisconnectCount = () => {\n this._disconnectRetryCount = this._opts.disconnectRetryCount\n }\n\n _tick = () => {\n clearTimeout(this._tickTimer)\n const { media } = this\n if (!media) return\n this._tickTimer = setTimeout(this._tick, this._tickInterval)\n\n const bufferEnd = Buffer.end(Buffer.get(media))\n\n if (bufferEnd < MAX_HOLE || !media.readyState) return\n\n const opts = this._opts\n if (isMediaPlaying(media) && media.currentTime) {\n if (this._gapService) {\n this._gapService.do(media, opts.maxJumpDistance, this.isLive, 3)\n }\n } else {\n if (!media.currentTime && this._gapService && opts.enableStartGapJump) {\n // 起播跳洞检测\n const gapJump =\n this._opts.mseLowLatency ||\n (this._opts.mseLowLatency === false && this.bufferInfo(MAX_START_GAP).nextStart)\n if (gapJump) {\n this._gapService.do(media, opts.maxJumpDistance, this.isLive, 3)\n }\n return\n }\n if (opts.isLive && media.readyState === 4 && (bufferEnd - media.currentTime) > opts.disconnectTime) {\n this.disconnect()\n }\n }\n }\n\n _onPlay = () => {\n const canReplay = this._opts.softDecode || this.media?.buffered?.length\n if (this.isLive) {\n if (!this._loading && canReplay) {\n this.replay(undefined, true)\n }\n return\n }\n\n const info = this.bufferInfo()\n if ((info.start || info.nextStart) > MAX_HOLE) {\n this._tick()\n }\n }\n\n _onLoadeddata = () => {\n if (this.isLive && !this._opts.mseLowLatency) {\n // update duration to Infinity\n if (this.media.duration !== Infinity) {\n this._bufferService.updateDuration(Infinity).catch(e => {})\n }\n }\n }\n\n _onSeeking = async () => {\n if (!this.isLive && this.seekable) {\n this._preLoadEndPoint = -1\n this._checkPreload()\n }\n }\n\n _onTimeupdate = () => {\n if (!this.media) return\n\n const opts = this._opts\n const currentTime = this.media.currentTime\n\n if (opts.isLive && opts.maxLatency && opts.targetLatency) {\n const bufferEnd = Buffer.end(Buffer.get(this.media))\n const latency = bufferEnd - currentTime\n if (latency >= opts.maxLatency) {\n this.media.currentTime = bufferEnd - opts.targetLatency\n this.emit(EVENT.CHASEFRAME, {\n currentTime: this.media.currentTime,\n latency: opts.targetLatency\n })\n }\n }\n this._seiService.throw(currentTime, true)\n\n if (opts.isLive || !this.seekable || this._loading) return\n\n this._checkPreload()\n }\n\n _onWaiting = () => {\n // retry for stream disconnect\n if (this.isLive && !this._loading && this._disconnectRetryCount) {\n this._disconnectRetryCount--\n this.load()\n }\n }\n\n _onBufferUpdate = () => {\n if (this._opts.isLive) return\n const { end, nextEnd } = this.bufferInfo()\n if (Math.abs((end || nextEnd) - this.media.duration) < 1) {\n this._end()\n // start with gap and buffer append finished untimely\n if (this.media.readyState <= 2) {\n this._tick()\n }\n }\n }\n\n _checkPreload = async () => {\n const { remaining: remainingBuffer = 0 } = this.bufferInfo()\n const opts = this._opts\n const filepositions = this._keyframes.filepositions\n const times = this._keyframes.times\n const currentTime = this.media.currentTime\n\n if (remainingBuffer < opts.preloadTime) {\n const i = searchKeyframeIndex(\n this._keyframes.times,\n currentTime + remainingBuffer + MAX_HOLE\n )\n let end = searchKeyframeIndex(\n this._keyframes.times,\n currentTime + remainingBuffer + this._opts.preloadTime\n )\n if (end === i) {\n end = i + 1\n }\n\n if (this._preLoadEndPoint === end) return\n\n const startByte = filepositions[i]\n if (startByte === null || startByte === undefined) return\n await this._mediaLoader.cancel()\n this._loadData(null, [startByte, filepositions[end]])\n this._preLoadEndPoint = end\n this._bufferService.unContiguous(times[i])\n }\n }\n\n _onFlvScriptData = sample => {\n const keyframes = sample.data?.onMetaData?.keyframes\n const duration = sample.data?.onMetaData?.duration\n if (keyframes) {\n this._keyframes = keyframes\n }\n\n if (!this._opts.isLive && duration) {\n this._bufferService.updateDuration(duration)\n }\n }\n}\n\ntry {\n if (localStorage.getItem('xgd')) {\n Flv.enableLogger()\n } else {\n Flv.disableLogger()\n }\n} catch (error) {\n // ignore\n}\n","/**\n * @typedef {{\n * media: HTMLMediaElement,\n * url?: string,\n * isLive?: boolean,\n * softDecode?: boolean,\n * analyzeDuration?: number,\n * maxJumpDistance?: number,\n * maxLatency?: number,\n * targetLatency?: number,\n * bufferBehind?: number,\n * retryCount?: number,\n * retryDelay?: number,\n * disconnectRetryCount?: number\n * loadTimeout?: number,\n * maxReaderInterval?: number,\n * preloadTime?: number,\n * defaultVodLoadSize?: number,\n * disconnectTime?: number,\n * fetchOptions?: RequestInit,\n * seamlesslyReload: boolean,\n* keepStatusAfterSwitch?: boolean,\n* onlyVideo?: boolean,\n* onlyAudio?: boolean,\n* preferMMS?: boolean,\n* mseLowLatency?: boolean,\n* durationForLowLatency?: number, // s\n* chunkCountForSpeed?: number,\n* skipChunkSize?: number, // Byte\n* longtimeNoReceived?: number,\n* preProcessUrl?: (url: string, ext?: { [propName: string]: any }) => { url: string, [propName: string]: any }\n* enableStartGapJump?: boolean\n * }} FlvOption\n */\n\n/**\n * @param {FlvOption} opts\n * @returns {FlvOption}\n */\nexport function getOption (opts) {\n const ret = {\n retryCount: 3,\n retryDelay: 1000,\n disconnectRetryCount: 0,\n loadTimeout: 10000,\n maxReaderInterval: 5000,\n preloadTime: 5,\n defaultVodLoadSize: 10000000,\n isLive: false,\n softDecode: false,\n bufferBehind: 10,\n maxJumpDistance: 3,\n analyzeDuration: 20000,\n seamlesslyReload: false,\n keepStatusAfterSwitch: true,\n onlyVideo: false,\n onlyAudio: false,\n preferMMS: false,\n mseLowLatency: true, // mse 低延迟模式渲染 https://issues.chromium.org/issues/41161663\n durationForMSELowLatencyOff: 6, // s\n chunkCountForSpeed: 50,\n skipChunkSize: 1000,\n longtimeNoReceived: 3000,\n // currentTime 为 0 时,是否允许跳洞。兼容 tizen 首帧跳洞导致帧回退问题。\n enableStartGapJump: true,\n ...opts\n }\n\n if (ret.isLive) {\n if (ret.preloadTime) {\n // compat old\n\n if (!ret.maxLatency) {\n ret.maxLatency = ret.preloadTime * 2\n }\n if (!ret.targetLatency) {\n ret.targetLatency = ret.preloadTime\n }\n\n if (ret.disconnectTime === null || ret.disconnectTime === undefined) {\n ret.disconnectTime = ret.maxLatency\n }\n }\n }\n\n return ret\n}\n","import { EVENT } from 'xgplayer-streaming-shared'\n\nexport default class PluginExtension {\n constructor (opts, plugin) {\n this._opts = opts\n this._plugin = plugin\n this._init()\n }\n\n _init () {\n const { media, isLive, preloadTime, innerDegrade, decodeMode } = this._opts\n\n if (!media) return\n\n if (!isLive && media.setPlayMode) {\n media.setPlayMode('VOD')\n return\n }\n\n if (innerDegrade) {\n media.setAttribute('innerdegrade', innerDegrade)\n }\n if (preloadTime) {\n media.setAttribute('preloadtime', preloadTime)\n }\n\n if (media.setDecodeMode) {\n media.setDecodeMode(decodeMode)\n }\n\n this._bindEvents()\n }\n\n _bindEvents () {\n const { media } = this._opts\n\n media.addEventListener('lowdecode', this._onLowDecode)\n }\n\n _onLowDecode = () => {\n const { media, innerDegrade, backupURL } = this._opts\n\n this._plugin?.player?.emit('lowdecode', media.degradeInfo)\n this._plugin?.player?.emit('core_event', {\n ...media.degradeInfo,\n eventName: EVENT.LOWDECODE\n })\n\n if ((innerDegrade === 1 || innerDegrade === 3) && backupURL) {\n this._degrade(backupURL)\n }\n }\n\n /**\n * @param {string | undefined} url\n */\n _degrade = (url) => {\n const { player } = this._plugin\n const originVideo = player.video\n\n if (originVideo?.TAG !== 'MVideo') return\n\n const newVideo = player.video.degradeVideo\n\n player.video = newVideo\n\n originVideo.degrade(url)\n\n if (url) {\n player.config.url = url\n }\n\n // replace live-video to video element\n const firstChild = player.root.firstChild\n\n if (firstChild.TAG === 'MVideo') {\n player.root.replaceChild(newVideo, firstChild)\n }\n const flvPlugin = this._plugin.constructor.pluginName.toLowerCase()\n player.unRegisterPlugin(flvPlugin)\n\n // play\n player.once('canplay', () => {\n player.play()\n })\n }\n\n forceDegradeToVideo = (url) => {\n const { innerDegrade } = this._opts\n\n // 降级to video+m3u8\n if (innerDegrade === 1 || innerDegrade === 3) {\n this._degrade(url)\n }\n }\n\n destroy () {\n this._opts?.media?.removeEventListener('lowdecode', this._onLowDecode)\n this._plugin = null\n }\n}\n","import { BasePlugin, Events, Errors } from 'xgplayer'\nimport { EVENT } from 'xgplayer-streaming-shared'\nimport { Flv, logger } from './flv'\nimport PluginExtension from './plugin-extension'\n\nexport class FlvPlugin extends BasePlugin {\n static Flv = Flv\n\n static get pluginName () {\n return 'flv'\n }\n\n logger = logger\n\n /** @type {Flv} */\n flv = null;\n\n /** @type {PluginExtension} */\n pluginExtension = null\n\n\n /** @type {Flv} */\n get core () {\n return this.flv\n }\n\n /** @type {string} */\n get version () {\n return this.flv?.version\n }\n\n /** @type {boolean} */\n get softDecode () {\n const mediaType = this.player?.config?.mediaType\n return !!mediaType && mediaType !== 'video' && mediaType !== 'audio'\n }\n\n get loader () {\n return this.flv?.loader\n }\n\n get transferCost () {\n return this.flv._transferCost.transferCost\n }\n\n beforePlayerInit () {\n const config = this.player.config\n const mediaElem = this.player.media || this.player.video\n\n if (!config.url) return\n\n if (this.flv) this.flv.destroy()\n\n this.player.switchURL = this._onSwitchURL\n\n const flvOpts = config.flv || {}\n if (flvOpts.disconnectTime === null || flvOpts.disconnectTime === undefined) {\n flvOpts.disconnectTime = 0\n }\n\n this.flv = new Flv({\n softDecode: this.softDecode,\n isLive: config.isLive,\n media: mediaElem,\n preProcessUrl: (url, ext) => this.player?.preProcessUrl?.(url, ext) || {url, ext},\n ...flvOpts\n })\n\n if (!this.softDecode) {\n BasePlugin.defineGetterOrSetter(this.player, {\n url: {\n get: () => {\n return this.flv?.blobUrl\n },\n configurable: true\n }\n })\n }\n\n if (this.softDecode) {\n this.pluginExtension = new PluginExtension({\n media: this.player.video,\n isLive: config.isLive,\n ...config.flv\n }, this)\n this.player.forceDegradeToVideo = (...args) => this.pluginExtension?.forceDegradeToVideo(...args)\n }\n\n if (config.isLive) {\n this.player?.useHooks('replay', () => this.flv?.replay())\n }\n\n this.on(Events.URL_CHANGE, this._onSwitchURL)\n this.on(Events.DESTROY, this.destroy)\n\n this._transError()\n this._transCoreEvent(EVENT.TTFB)\n this._transCoreEvent(EVENT.LOAD_START)\n this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS)\n this._transCoreEvent(EVENT.LOAD_COMPLETE)\n this._transCoreEvent(EVENT.LOAD_RETRY)\n this._transCoreEvent(EVENT.SOURCEBUFFER_CREATED)\n this._transCoreEvent(EVENT.ANALYZE_DURATION_EXCEEDED)\n this._transCoreEvent(EVENT.APPEND_BUFFER)\n this._transCoreEvent(EVENT.REMOVE_BUFFER)\n this._transCoreEvent(EVENT.BUFFEREOS)\n this._transCoreEvent(EVENT.KEYFRAME)\n this._transCoreEvent(EVENT.CHASEFRAME)\n this._transCoreEvent(EVENT.METADATA_PARSED)\n this._transCoreEvent(EVENT.SEI)\n this._transCoreEvent(EVENT.SEI_IN_TIME)\n this._transCoreEvent(EVENT.FLV_SCRIPT_DATA)\n this._transCoreEvent(EVENT.STREAM_EXCEPTION)\n this._transCoreEvent(EVENT.SWITCH_URL_SUCCESS)\n this._transCoreEvent(EVENT.SWITCH_URL_FAILED)\n\n this.flv.load(config.url, true)\n }\n\n /**\n * @return {import('./flv').Stats | undefined}\n */\n getStats = () => {\n return this.flv?.getStats()\n }\n\n destroy = () => {\n if (this.flv) {\n this.flv.destroy()\n this.flv = null\n }\n this.pluginExtension?.destroy()\n this.pluginExtension = null\n }\n\n /**\n * @param {string | boolean} [mediaType]\n * @param {string} [codec]\n * @returns {boolean}\n * - mediaType: 默认检测 MSE 对 H264 codec是否支持,传入 true 或者配置参数的mediaType的取值检测 WebAssembly是否支持\n * - codec: 暂无使用\n */\n static isSupported (mediaType, codec) {\n return Flv.isSupported(mediaType, codec)\n }\n\n static isSupportedMMS () {\n return typeof ManagedMediaSource !== 'undefined'\n }\n\n /**\n *\n * @param {string} url\n * @param {boolean | {seamless: boolean}} seamless\n */\n _onSwitchURL = (url, seamless) => {\n if (this.flv) {\n this.player.config.url = url\n\n if (typeof seamless === 'object') {\n seamless = seamless.seamless\n }\n\n this.flv.switchURL(url, seamless)\n\n if (!seamless && this.player.config?.flv?.keepStatusAfterSwitch) {\n this._keepPauseStatus()\n }\n }\n }\n\n _keepPauseStatus = () => {\n const paused = this.player.paused\n if (!paused) return\n this.player.once('canplay', () => {\n this.player.pause()\n })\n }\n\n _onDefinitionChange = ({ to }) => {\n if (this.flv) this.flv.switchURL(to)\n }\n\n _transError () {\n this.flv.on(EVENT.ERROR, (err) => {\n if (this.player) {\n this.player.emit(Events.ERROR, new Errors(this.player, err))\n }\n })\n }\n\n _transCoreEvent (eventName) {\n this.flv.on(eventName, (e) => {\n if (this.player) {\n this.player.emit('core_event', {\n ...e,\n eventName\n })\n }\n })\n }\n}\n"],"names":["Buffer","_classCallCheck","key","value","buf","length","end","start","b","buffered","error","maxHole","buffers","i","l","bufLen","last","lastEnd","push","reduce","a","c","pos","arguments","undefined","index","nextStart","nextEnd","prevStart","prevEnd","item","currentTime","behind","remaining","totalLength","media","get","isBrowser","window","ERR","FLV","HLS","MP4","FMP4","MSE_ADD_SB","MSE_APPEND_BUFFER","MSE_OTHER","MSE_FULL","MSE_CHANGE_TYPE","OPTION","DASH","LICENSE","CUSTOM_LICENSE","MSE_HIJACK","EME_HIJACK","SIDX","NO_CANPLAY_ERROR","BUFFERBREAK_ERROR","WAITING_TIMEOUT_ERROR","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_CODEC_NOT_SUPPORTED","MEDIA_ERR_URL_EMPTY","ERR_CODE","_defineProperty","_ERR_CODE","StreamingError","_Error","_inherits","_super","_createSuper","type","subType","origin","payload","msg","_this","call","message","errorType","originError","ext","errorCode","errorMessage","Error","_error$response","isTimeout","url","response","httpCode","status","LogCacheLevel","DEBUG","LOG","WARN","ERROR","SIMPLE_TYPE","Logger","name","config","this","_prefix","concat","logCacheLevel","logMaxSize","logSize","logTextArray","_createClass","_console","_len","args","Array","_key","logCache","apply","disabled","console","debug","nowTime","_console2","_len2","_key2","log","_console3","_len3","_key3","warn","_console4","_len4","_key4","text","_len5","logText","_key5","finLogText","map","logable","JSON","stringify","e","delLog","shift","join","reset","_console5","group","table","groupEnd","val","Date","toLocaleString","reduceDepth","_typeof","objType","Object","prototype","toString","slice","obj","maxDepth","depth","result","includes","hasOwnProperty","createPublicPromise","res","rej","promise","Promise","resolve","reject","used","parseInt","performance","now","getTime","SafeJSON","getMediaSource","preferMMS","ManagedMediaSource","MediaSource","isMMS","mediaSource","test","OP_NAME","MSE","_this2","create","_logger","queue","_queue","op","opName","_this2$_sourceBuffer$","_op$context","costtime","_opst","ranges","TimeRanges","getTimeRanges","_sourceBuffer","context","callback","_startQueue","event","_config","assign","getDefaultConfig","bindMedia","openLog","enable","_enqueueBlockingOp2","_unbindMedia","_bindMedia","_this$mediaSource","readyState","_this3","flag","keys","forEach","k","isArray","_url","_this$mediaSource2","duration","streaming","_mseFullFlag","VIDEO","_this4","isReduceDuration","bufferEnd","Math","max","_enqueueBlockingOp","isEnded","_this5","_openPromise","isOpened","ms","addEventListener","onOpen","costTime","_st","removeEventListener","_asyncToGenerator","_regeneratorRuntime","mark","_callee","useMMS","_this6","wrap","_context","prev","next","unbindMedia","revokeObjectURL","src","_onStartStreaming","_onEndStreaming","URL","createObjectURL","disableRemotePlayback","abrupt","stop","_x","_callee2","hasMetadata","mseOpen","_this7","_context2","t","x","_x$promise","_x$promise$resolve","endOfStream","removeSourceBuffer","removeAttribute","load","mimeType","sb","addSourceBuffer","_onSBUpdateEnd","bind","_onSBUpdateError","_this8","changeType","_enqueueOp","createSource","buffer","_this9","byteLength","_this9$_sourceBuffer$","appendBuffer","startTime","endTime","_this10","isInsertHead","remove","p","_this11","_this12","allClear","_this$_queue$type","initQueue","isinit","reason","_this13","setLiveSeekableRange","exec","_this14","splice","then","_callee3","types","waiters","_this15","_context3","prom","all","updating","_x2","_x3","_x4","indexOf","isFull","constructor","timestampOffset","_this16","_this17","abort","mime","isTypeSupported","LoaderType","ResponseType","NetError","request","_assertThisInitialized","isPlainObject","getPrototypeOf","getRangeValue","ret","encode","encodeURIComponent","replace","setUrlParams","params","v","str","toISOString","isObject","filter","Boolean","hashIndex","createResponse","data","done","contentLength","age","firstByteTime","range","vid","priOptions","parseFloat","Number","isNaN","options","calculateSpeed","byteLen","milliSecond","round","EVENT","has","prefix","Events","EE","fn","once","addListener","emitter","TypeError","listener","evt","_events","_eventsCount","clearEvent","EventEmitter","__proto__","eventNames","names","events","getOwnPropertySymbols","listeners","handlers","ee","listenerCount","emit","a1","a2","a3","a4","a5","len","removeListener","j","on","removeAllListeners","off","prefixed","module","exports","CACHESIZE","FetchLoader","_EventEmitter","_cancel","_ref","_this$_abortControlle","timeout","responseType","onProgress","onTimeout","onCancel","transformResponse","logger","method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","onProcessMinLen","_aborted","_onProcessMinLen","_onCancel","_abortController","AbortController","_running","_index","_range","_vid","_priOptions","init","signal","clearTimeout","_timeoutTimer","rangeValue","Headers","append","Range","setTimeout","cancel","fetch","_ref2","speed","_response","ok","sent","json","_loadChunk","arrayBuffer","Uint8Array","time","catch","_error","_reader","t0","st","getReader","err","_cache","_writeIdx","reader","pump","_ref3","_this3$_range","startRange","startByte","curLen","retData","temp","read","_receivedLength","set","XhrLoader","req","_onProgress","_headers","_withCredentials","_body","_method","_timeout","_runing","_responseType","_firstRtt","_onTimeout","_request","_loadCompleteResolve","_loadCompleteReject","_startLoad","chunkSize","_currentChunkSizeKB","from","to","_internalOpen","_startTime","xhr","_xhr","XMLHttpRequest","open","withCredentials","onload","_onLoad","onreadystatechange","_onReadyStatechange","onerror","errorEvent","_errorEvent$currentTa","_errorEvent$currentTa2","_errorEvent$currentTa3","currentTarget","statusText","ontimeout","setRequestHeader","send","target","_this$_range","_objectSpread","byteStart","_this$_range2","chunk","responseURL","_getHeaders","_transformResponse","_getPrototypeOf","_step","_iterator","_createForOfIteratorHelper","getAllResponseHeaders","trim","split","s","n","parts","toLowerCase","f","Task","alive","_loaderType","_loader","_retryCount","_retryTimer","_canceled","_retryCheckFunc","retryCheckFunc","_this$_config","retry","retryDelay","onRetryError","transformError","rest","_objectWithoutProperties","_excluded","isRetry","running","loaderType","retryCount","concatUint8Array","arr","prevLen","d","sleep","NetLoader","cfg","transformRequest","integrity","getConfig","isSupported","task","loader","_currentTask","_processTask","cancels","_alive","finally","_this3$_currentTask","_this3$_alive","GapService","maxJumpDistance","isLive","seekThreshold","jumpTo","_prevCurrentTime","info","seeking","SeiService","Set","sei","_seiSet","add","size","min","toThrow","delete","clear","BandwidthService","opts","_opts","totalByte","_speeds","_this$_opts","_this$_opts2","skipChunkSize","_totalSize","_totalCost","_chunkSpeed","_chunkCache","timestamp","chunkCountForSpeed","_this$_opts3","lastSample","cost","longtimeNoReceived","Stats","timescale","_timescale","encodeType","audioCodec","videoCodec","domain","fps","bitrate","width","height","samplerate","channelCount","gop","_data$onMetaData","onMetaData","framerate","track","codec","codecType","fpsNum","fpsDen","sampleRate","responseUrl","samples","sample","_startGopId","gopId","_bitsAccumulateDuration","_bitsAccumulateSize","units","MediaStatsService","core","_core","_stats","_bindEvents","_this$_core","_this$_core2","_this$_core2$speedInf","_this$_core3","_this$_core3$speedInf","_this$_core4","_this$_core4$speedInf","_this$_core5","_this$_core5$speedInf","_this$_core6","_this$_core6$bufferIn","_ref2$currentTime","_ref2$decodeFps","decodeFps","getStats","downloadSpeed","speedInfo","avgSpeed","totalReceivedByte","totalSize","totalReceivedCost","totalCost","bufferInfo","videoTrack","updateBitrate","setFpsFromScriptData","setVideoMeta","setAudioMeta","setDomain","_samples","TrackType","VideoCodecType","AudioCodecType","WarningType","VideoTrack","sequenceNumber","baseMediaDecodeTime","present","pid","pps","sps","vps","sarRatio","warnings","hvcC","dts","pts","first","isVideoEncryption","AudioTrack","sampleDuration","isAudioEncryption","VideoSample","originPts","originDts","keyframe","dependsOn","isNonSyncSample","AudioSample","sampleOffset","Sample","FlvScriptSample","_Sample","SeiSample","_Sample2","_super2","MetadataTrack","flvScriptSamples","seiSamples","ExpGolomb","_data","_bytesAvailable","_loadWord","_bitsAvailable","position","availableBytes","workingBytes","subarray","_word","DataView","getUint32","count","skipBytes","floor","bits","readBits","leadingZeroCount","skipLZ","skipBits","clz","readUEG","lastScale","nextScale","readEG","UTF8","uint8array","out","input","String","fromCharCode","_checkContinuation","ucs4","_ucs2","checkLength","array","ua","navigator","userAgent","toLocaleLowerCase","isSafari","isFirefox","isAndroid","readBig32","getAvcCodec","codecs","h","parse","AAC","rate","FREQ","skip","frames","samplingFrequencyIndex","protectionSkipBytes","frameLength","objectType","_AAC$_getConfig","_getConfig","frameIndex","getFrameDuration","originCodec","_AAC$_getConfig2","samplingIndex","originObjectType","extensionSamplingIndex","NALu","offset","dataLen","unit","isHevc","uuid","uint","emulationPreventionBytesPositions","newLength","newData","sourceIndex","AVC","nalUnitSize","spsParsed","spsSize","spsArr","ppsArr","spsCount","parseSPS","removeEPB","ppsSize","ppsCount","eg","readUByte","profileIdc","profileCompatibility","levelIdc","skipUEG","chromaFormat","chromaFormatIdc","readBool","scalingListCount","skipScalingList","picOrderCntType","numRefFramesInPicOrderCntCycle","picWidthInMbsMinus1","picHeightInMapUnitsMinus1","frameMbsOnlyFlag","fixedFrame","frameCropLeftOffset","frameCropRightOffset","frameCropTopOffset","frameCropBottomOffset","aspectRatioIdc","numUnitsInTick","timeScale","ceil","HEVC","vpsParsed","nalUnitType","numNalus","nalSize","vpsArr","numOfArrays","parseVPS","vpsMaxSubLayersMinus1","numTemporalLayers","_parseProfileTierLevel","spsMaxSubLayersMinus1","temporalIdNested","separateColourPlaneFlag","confWinLeftOffset","confWinRightOffset","confWinTopOffset","confWinBottomOffset","conformanceWindowFlag","bitDepthLumaMinus8","bitDepthChromaMinus8","subWidthC","subHeightC","maxSubLayersMinus1","generalTierFlag","generalProfileSpace","generalProfileIdc","generalProfileCompatibilityFlags","generalConstraintIndicatorFlags","generalLevelIdc","subLayerProfilePresentFlag","subLayerLevelPresentFlag","bitsAvailable","OPUS","dv","byteOffset","magicSignature","fromCodePoint","outputGain","getInt16","MAX_SILENT_FRAME_DURATION","AUDIO_EXCEPTION_LOG_EMIT_DURATION","FlvFixer","audioTrack","metadataTrack","_baseDts","_baseDtsInited","_audioNextPts","_videoNextDts","_audioTimestampBreak","_videoTimestampBreak","_lastVideoDuration","_keyFrameInNextChunk","_lastAudioExceptionGapDot","Infinity","_lastAudioExceptionOverlapDot","_lastAudioExceptionLargeGapDot","_lastVideoExceptionLargeGapDot","_lastVideoExceptionChunkFirstDtsDot","discontinuity","contiguous","_videoLastSample","_calculateBaseDts","resetBaseDts","exist","_resetBaseDtsWhenStreamBreaked","_fixAudio","_fixVideo","refSampleDurationInt","pop","unshift","samp0","firstSample","vDelta","abs","_samples$","nextDts","firstSampleDts","nextSampleDts","nextSample","refSampleDuration","_doFixAudioInternal","audioSamps","videoSamps","audioBasePts","videoBaseDts","baseDts","delta","isFinite","G711PCMA","_getG711Duration","sampleDurationInSampleRate","nextPts","silentFrame","_getSilentFrame","silentSample","sampleSize","getSilentFrame","AMF","_parseValue","view","isEnd","getUint8","getFloat64","_AMF$_parseString","_parseString","terminal","_AMF$_parseObject","_parseObject","_terminal","_AMF$_parseObject2","strictArrayLength","_AMF$_parseValue","decode","getUint16","FlvSoundFormat","FlvDemuxer","_fixer","_scriptDataObject$dat","seamlessLoadingSwitching","_remainingData","_headerParsed","probe","tagType","dataSize","bodyData","prevTagSize","_parseAudio","_parseVideo","_parseScript","formatTimescale","hasSample","scriptDataObject","metaData","fix","demux","format","soundRate","soundSize","soundType","AUDIO_RATE","G711A","_parseG711","_parseAac","_parseOpus","packetType","parseHeaderPackets","newSample","parseAudioSpecificConfig","sampleRateIndex","frameType","codecId","cts","configData","parseHEVCDecoderConfigurationRecord","parseAVCDecoderConfigurationRecord","parseAvcC","_checkAddMetaNalToUnits","lastKeyFrameDts","setToKeyframe","parseSEI","_gopId","hevc","_needAddMetaBeforeKeyFrameNal","Concat","ResultConstructor","arrays","self","UINT32_MAX","pow","tracks","find","FTYPHEV1","FTYPAVC1","ftyp","moov","content","kid","box","pssh","useEME","encv","enca","mvhd","mvhdDurtion","mvhdTimecale","mvex","_toConsumableArray","trak","tkhd","id","tkhdDuration","mdia","mdhd","hdlr","minf","HDLR_TYPES","VMHD","SMHD","DINF","stbl","extBox","stss","entries","stsd","STTS","STSC","STSZ","STCO","opus","mp4a","av1C","av01","avc1hev1","esds","sinf","_concat$concat","hSpacing","vSpacing","avcc","btrt","pasp","avcC","tenc","schi","default_IsEncrypted","default_IV_size","default_KID","frma","data_format","charCodeAt","schm","colr","typ","hvc1","avc1","boxes","fiel","_concat$concat2","ArrayBuffer","pcf","cif","write","_ref4","_slicedToArray","opusAudioDescription","opusSpecificConfig","dOps","Opus","trex","moof","mfhd","traf","tfhd","tfdt","sencLength","isVideo","videoSenc","subsamples","videoSencLength","saiz","saio","trun","trun1","senc","sbgp","sdtp","extension","sampleCount","writeUint32","audioSenc","flags","samplesLength","InitializationVector","writeUint16","BytesOfClearData","BytesOfProtectedData","version","upperWordBaseMediaDecodeTime","lowerWordBaseMediaDecodeTime","sampleLen","_samples$i","_samples$i$flag","_samples$i$cts","isLeading","isDependedOn","hasRedundancy","paddingValue","degradationPriority","trackMP4","mdiaMP4","minfMP4","stblMP4","stts","stsc","stsz","stco","ctts","_ref5","_ref6","firstChunk","samplesPerChunk","sampleDescIndex","samplesSizes","offsets","keyframeIndexes","_ref7","styp","durationCount","earliestTime","mdatSize","sidx","mdat","video","audio","dinf","dref","vmhd","smhd","StblTable","FMP4Remuxer","browserVersions","forceFirstIDR","createInit","videoInitSegment","audioInitSegment","initSegment","videoSegment","audioSegment","hasVideo","hasAudio","initMerge","_remuxVideo","_remuxAudio","isAV01","mdata","mdatView","_loop","_offset2","_sample2","u","setUint32","_offset","_sample","Base","properties","clone","_construct","WordArray","_Base","words","sigBytes","typedArray","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","typedArrayByteLength","_words","encoder","Hex","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","thatByte","_get","nBytes","rcache","r","m_w","_m_w","_m_z","mask","random","_r","hexChars","bite","hexStr","hexStrLength","substr","Latin1","latin1Str","latin1StrLength","Utf8","utf8Str","unescape","BufferedBlockAlgorithm","_Base2","_minBufferSize","_nDataBytes","m_data","doFlush","processedWords","blockSize","dataWords","dataSigBytes","nBlocksReady","nWordsReady","nBytesReady","_doProcessBlock","Hasher","_BufferedBlockAlgorit","_super3","_doReset","messageUpdate","_append","_process","hash","_doFinalize","SubHasher","finalize","HMAC","_Base3","_super4","hasher","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","update","innerHash","hmac","Base64","_map","base64Chars","triplet","charAt","paddingChar","base64Str","base64StrLength","reverseMap","_reverseMap","paddingIndex","parseLoop","bits1","bitsCombined","T","sin","FF","GG","HH","II","MD5Algo","_Hasher","_hash","M","_M","offset_i","M_offset_i","H","M_offset_0","M_offset_1","M_offset_2","M_offset_3","M_offset_4","M_offset_5","M_offset_6","M_offset_7","M_offset_8","M_offset_9","M_offset_10","M_offset_11","M_offset_12","M_offset_13","M_offset_14","M_offset_15","nBitsTotal","nBitsLeft","nBitsTotalH","nBitsTotalL","H_i","_createHelper","_createHmacHelper","EvpKDFAlgo","keySize","iterations","password","salt","derivedKeyWords","block","derivedKey","Cipher","xformMode","_xformMode","dataUpdate","finalProcessedData","_ENC_XFORM_MODE","_DEC_XFORM_MODE","SubCipher","selectCipherStrategy","PasswordBasedCipher","SerializableCipher","encrypt","decrypt","ciphertext","ivSize","BlockCipherMode","cipher","iv","_cipher","_iv","Encryptor","Decryptor","xorBlock","_prevBlock","CBC","_BlockCipherMode","_CBC","_class","_super5","encryptBlock","_CBC2","_class2","_super6","thisBlock","decryptBlock","Pkcs7","pad","blockSizeBytes","nPaddingBytes","paddingWord","paddingWords","padding","unpad","BlockCipher","_Cipher2","_super7","modeCreator","createEncryptor","createDecryptor","_mode","__creator","processBlock","finalProcessedBlocks","CipherParams","_super8","cipherParams","mixIn","formatter","OpenSSLFormatter","openSSLStr","ciphertextWords","_super9","_cfg","encryptor","cipherCfg","algorithm","_ciphertext","plaintext","_parse","OpenSSLKdf","execute","_salt","compute","_SerializableCipher","_super10","derivedParams","kdf","_SBOX","INV_SBOX","_SUB_MIX_0","_SUB_MIX_1","_SUB_MIX_2","_SUB_MIX_3","INV_SUB_MIX_0","INV_SUB_MIX_1","INV_SUB_MIX_2","INV_SUB_MIX_3","xi","sx","x2","x4","x8","RCON","AESAlgo","_BlockCipher","_nRounds","_keyPriorReset","keyWords","ksRows","_keySchedule","keySchedule","ksRow","_invKeySchedule","invKeySchedule","invKsRow","_doCryptBlock","SUB_MIX_0","SUB_MIX_1","SUB_MIX_2","SUB_MIX_3","SBOX","nRounds","s0","s1","s2","s3","t1","t2","t3","CTR","_CTR","counter","_counter","keystream","TransferCost","ttfbCost","_ttfb","demuxCost","_demuxCost","remuxCost","_remuxCost","appendCost","_appendCost","TRANSFER_EVENT","BufferService","flv","softVideo","_softVideo","_remuxer","_demuxer","_mse","perferMMS","_evictBuffer","_appendBuffer","_destroy","_updateDuration","_endOfStream","_reset","_this$_demuxer","_this$_demuxer$_fixer","_this$_mse","mediaType","_needInitSegment","_discontinuity","_contiguous","_initSegmentId","_demuxStartTime","reuseMse","_args","_sourceCreated","resetSeamlessSwitchStats","seamlessLoadingSwitch","updateDuration","_callee4","_context4","_callee5","switchingNoReset","demuxer","idx","videoExist","audioExist","videoType","audioType","mse","afterAppend","newId","remuxResult","_context5","_cachedBuffer","_transferCost","demuxAndFix","findIndex","onlyAudio","onlyVideo","analyzeDuration","_fireEvents","_this$flv","_this$flv2","_emitMetaParsedEvent","mseLowLatency","durationForMSELowLatencyOff","remux","_callee6","bufferBehind","removeEnd","_context6","clearBuffer","meta","code","searchKeyframeIndex","list","mid","lbound","ubound","MAX_HOLE","Flv","_clear2","_loadData2","_reset2","_switchURL","_replay","_load","_this$_mediaLoader","elapsed","_this$_bufferService","maxReaderInterval","_loading","_firstProgressEmit","_mediaLoader","_acceptRanges","_bufferService","_maxChunkWaitTimer","_bandwidthService","addChunkRecord","evictBuffer","preloadTime","_emitError","_urlSwitching","_seamlessSwitching","_tick","_disconnectRetryCount","_end","retryTime","network","_clear","disconnectRetryCount","_tickTimer","_tickInterval","paused","ended","playbackRate","isMediaPlaying","_gapService","do","enableStartGapJump","disconnectTime","disconnect","_this$media","_this$media$buffered","canReplay","softDecode","replay","seekable","_preLoadEndPoint","_checkPreload","maxLatency","targetLatency","latency","_seiService","throw","_this$bufferInfo","_this$bufferInfo2","_this$bufferInfo2$rem","remainingBuffer","filepositions","times","_keyframes","_loadData","unContiguous","_sample$data","_sample$data$onMetaDa","_sample$data2","_sample$data2$onMetaD","keyframes","loadTimeout","defaultVodLoadSize","seamlesslyReload","keepStatusAfterSwitch","document","createElement","fetchOptions","_onRetryError","_onPlay","_onLoadeddata","_onSeeking","_onTimeupdate","_onBufferUpdate","_onWaiting","_onFlvScriptData","_this$_bufferService2","_this$_bufferService3","blobUrl","getLatestSpeed","getAvgSpeed","getTotalSize","getTotalCost","_this$media2","getVideoPlaybackQuality","droppedVideoFrames","corruptedVideoFrames","totalVideoFrames","creationTime","webkitDroppedFrameCount","webkitDecodedFrameCount","_args4","_x5","isPlayEmit","_args5","_resetDisconnectCount","seamlessSwitch","play","_this$_bufferService4","_callee7","seamless","_context7","_x8","switchURL","_x6","_x7","_callee8","_context8","destroy","_this$media3","_callee9","_args9","_context9","_callee10","finnalUrl","_context10","preProcessUrl","seamlessSwitching","_x9","_x10","_callee11","_context11","WebAssembly","TransmuxerLogger","disable","localStorage","getItem","enableLogger","disableLogger","PluginExtension","plugin","_this$_plugin","_this$_plugin$player","_this$_plugin2","_this$_plugin2$player","innerDegrade","backupURL","_plugin","player","degradeInfo","eventName","_degrade","originVideo","TAG","newVideo","degradeVideo","degrade","firstChild","root","replaceChild","flvPlugin","pluginName","unRegisterPlugin","_init","decodeMode","setPlayMode","setAttribute","setDecodeMode","_onLowDecode","_this$_opts3$media","FlvPlugin","_BasePlugin","_this$pluginExtension","pluginExtension","_this$player$config","_this$player$config$f","_keepPauseStatus","pause","_this$player","_this$player$config2","_this$flv3","transferCost","mediaElem","_onSwitchURL","flvOpts","_this$player2","_this2$player","_this2$player$preProc","defineGetterOrSetter","_this2$flv","configurable","forceDegradeToVideo","_this2$pluginExtensio","useHooks","_this2$flv2","URL_CHANGE","DESTROY","_transError","_transCoreEvent","Errors","BasePlugin"],"mappings":"sgnBAAA,MAAaA,EAAM,WAAA,SAAAA,IAAAC,OAAAD,GAwJhBA,OAxJgBA,EAAAA,EAAA,KAAA,CAAA,CAAAE,IAAA,QAAAC,MAKjB,SAAcC,GACR,OAACA,GAAQA,EAAIC,OAGE,IAAfD,EAAIC,QAAgBD,EAAIE,IAAI,GAAKF,EAAIG,MAAM,GAAK,MAEjC,IAAfH,EAAIC,QAAgBD,EAAIG,MAAM,GAAK,EAF0B,EAI1DH,EAAIG,MAAM,GAPe,IAUlC,CAAAL,IAAA,MAAAC,MAIA,SAAYC,GACN,OAACA,GAAQA,EAAIC,OAGE,IAAfD,EAAIC,QAAgBD,EAAIE,IAAI,GAAKF,EAAIG,MAAM,GAAK,KAAa,EAE1DH,EAAIE,IAAIF,EAAIC,OAAS,GALI,IAQlC,CAAAH,IAAA,MAAAC,MAIA,SAAYK,GACV,GAAKA,EACD,IACF,OAAOA,EAAEC,eACFC,OAKX,CAAAR,IAAA,UAAAC,MAKA,SAAgBC,EAAKO,GACf,IAACP,IAAQA,EAAIC,OAAQ,MAAO,GAGhC,IADA,IAAMO,EAAU,GACPC,EAAI,EAAGC,EAAIV,EAAIC,OAAQQ,EAAIC,EAAGD,IAAK,CAC1C,IAAME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