@volcengine/veplayer-plugin 2.5.0-rc.0 → 2.5.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.d.ts +0 -1
- package/esm/index.development.css +0 -7
- package/esm/index.development.js +47274 -53342
- package/esm/index.production.css +1 -1
- package/esm/index.production.js +4 -13
- package/esm/veplayer.plugin.abr.development.js +12 -0
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.drm.development.js +12 -0
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +675 -194
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +1159 -369
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +13 -1
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +167 -51
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.plugin.shaka.development.js +12 -0
- package/esm/veplayer.plugin.shaka.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +0 -1
- package/umd/veplayer.plugin.abr.development.js +12 -0
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +12 -0
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +675 -194
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +1126 -336
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +13 -1
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +167 -51
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +12 -0
- package/umd/veplayer.plugin.shaka.production.js +1 -1
- package/esm/veplayer.plugin.ad.development.css +0 -7
- package/esm/veplayer.plugin.ad.development.js +0 -9042
- package/esm/veplayer.plugin.ad.production.css +0 -1
- package/esm/veplayer.plugin.ad.production.js +0 -4
- package/umd/veplayer.plugin.ad.development.css +0 -7
- package/umd/veplayer.plugin.ad.development.js +0 -9045
- package/umd/veplayer.plugin.ad.production.css +0 -1
- package/umd/veplayer.plugin.ad.production.js +0 -1
|
@@ -1542,7 +1542,7 @@
|
|
|
1542
1542
|
}
|
|
1543
1543
|
return offsetTime;
|
|
1544
1544
|
};
|
|
1545
|
-
var version = "3.0.
|
|
1545
|
+
var version = "3.0.21-rc.5";
|
|
1546
1546
|
var ERROR_MAP = {
|
|
1547
1547
|
1: 5101,
|
|
1548
1548
|
2: 5102,
|
|
@@ -2009,6 +2009,18 @@
|
|
|
2009
2009
|
}
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
|
+
}, {
|
|
2013
|
+
key: "defineMethod",
|
|
2014
|
+
value: function defineMethod(Obj, map) {
|
|
2015
|
+
for (var key in map) {
|
|
2016
|
+
if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
|
|
2017
|
+
Object.defineProperty(Obj, key, {
|
|
2018
|
+
configurable: true,
|
|
2019
|
+
value: map[key]
|
|
2020
|
+
});
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2012
2024
|
}, {
|
|
2013
2025
|
key: "defaultConfig",
|
|
2014
2026
|
get: function get() {
|
|
@@ -2819,6 +2831,21 @@
|
|
|
2819
2831
|
length: Buffer2.totalLength && Buffer2.totalLength(buffers)
|
|
2820
2832
|
};
|
|
2821
2833
|
}
|
|
2834
|
+
}, {
|
|
2835
|
+
key: "isBuffered",
|
|
2836
|
+
value: function isBuffered(media, pos) {
|
|
2837
|
+
if (media) {
|
|
2838
|
+
var buffered = Buffer2.get(media);
|
|
2839
|
+
if (buffered !== null && buffered !== void 0 && buffered.length) {
|
|
2840
|
+
for (var i = 0; i < buffered.length; i++) {
|
|
2841
|
+
if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
|
|
2842
|
+
return true;
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
return false;
|
|
2848
|
+
}
|
|
2822
2849
|
}]);
|
|
2823
2850
|
return Buffer2;
|
|
2824
2851
|
}();
|
|
@@ -2971,7 +2998,7 @@
|
|
|
2971
2998
|
this.logCache.apply(this, [LogCacheLevel.DEBUG].concat(args));
|
|
2972
2999
|
if (Logger2.disabled)
|
|
2973
3000
|
return;
|
|
2974
|
-
(_console = console).debug.apply(_console, [
|
|
3001
|
+
(_console = console).debug.apply(_console, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
2975
3002
|
}
|
|
2976
3003
|
}, {
|
|
2977
3004
|
key: "log",
|
|
@@ -2983,7 +3010,7 @@
|
|
|
2983
3010
|
this.logCache.apply(this, [LogCacheLevel.LOG].concat(args));
|
|
2984
3011
|
if (Logger2.disabled)
|
|
2985
3012
|
return;
|
|
2986
|
-
(_console2 = console).log.apply(_console2, [
|
|
3013
|
+
(_console2 = console).log.apply(_console2, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
2987
3014
|
}
|
|
2988
3015
|
}, {
|
|
2989
3016
|
key: "warn",
|
|
@@ -2995,7 +3022,7 @@
|
|
|
2995
3022
|
this.logCache.apply(this, [LogCacheLevel.WARN].concat(args));
|
|
2996
3023
|
if (Logger2.disabled)
|
|
2997
3024
|
return;
|
|
2998
|
-
(_console3 = console).warn.apply(_console3, [
|
|
3025
|
+
(_console3 = console).warn.apply(_console3, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
2999
3026
|
}
|
|
3000
3027
|
}, {
|
|
3001
3028
|
key: "error",
|
|
@@ -3007,7 +3034,7 @@
|
|
|
3007
3034
|
this.logCache.apply(this, [LogCacheLevel.ERROR].concat(args));
|
|
3008
3035
|
if (Logger2.disabled)
|
|
3009
3036
|
return;
|
|
3010
|
-
(_console4 = console).error.apply(_console4, [
|
|
3037
|
+
(_console4 = console).error.apply(_console4, ["[".concat(nowTime$1(), "]"), this._prefix].concat(args));
|
|
3011
3038
|
}
|
|
3012
3039
|
}, {
|
|
3013
3040
|
key: "logCache",
|
|
@@ -3022,7 +3049,7 @@
|
|
|
3022
3049
|
var finLogText = logText.map(function(item) {
|
|
3023
3050
|
return logable(item);
|
|
3024
3051
|
});
|
|
3025
|
-
text =
|
|
3052
|
+
text = "[".concat(nowTime$1(), "]") + this._prefix + JSON.stringify(finLogText);
|
|
3026
3053
|
} catch (e) {
|
|
3027
3054
|
return;
|
|
3028
3055
|
}
|
|
@@ -3938,8 +3965,8 @@
|
|
|
3938
3965
|
response
|
|
3939
3966
|
};
|
|
3940
3967
|
}
|
|
3941
|
-
function calculateSpeed(byteLen,
|
|
3942
|
-
return Math.round(byteLen * 8 * 1e3 /
|
|
3968
|
+
function calculateSpeed(byteLen, milliSecond) {
|
|
3969
|
+
return Math.round(byteLen * 8 * 1e3 / milliSecond / 1024);
|
|
3943
3970
|
}
|
|
3944
3971
|
var EVENT = {
|
|
3945
3972
|
ERROR: "error",
|
|
@@ -3951,6 +3978,7 @@
|
|
|
3951
3978
|
SOURCEBUFFER_CREATED: "core.sourcebuffercreated",
|
|
3952
3979
|
MEDIASOURCE_OPENED: "core.mediasourceopened",
|
|
3953
3980
|
ANALYZE_DURATION_EXCEEDED: "core.analyzedurationexceeded",
|
|
3981
|
+
APPEND_BUFFER: "core.appendbuffer",
|
|
3954
3982
|
REMOVE_BUFFER: "core.removebuffer",
|
|
3955
3983
|
BUFFEREOS: "core.buffereos",
|
|
3956
3984
|
KEYFRAME: "core.keyframe",
|
|
@@ -5583,13 +5611,16 @@
|
|
|
5583
5611
|
METADATA: "metadata"
|
|
5584
5612
|
};
|
|
5585
5613
|
var VideoCodecType = {
|
|
5614
|
+
AV1: "av1",
|
|
5586
5615
|
AVC: "avc",
|
|
5587
5616
|
HEVC: "hevc"
|
|
5588
5617
|
};
|
|
5589
5618
|
var AudioCodecType = {
|
|
5590
5619
|
AAC: "aac",
|
|
5591
5620
|
G711PCMA: "g7110a",
|
|
5592
|
-
G711PCMU: "g7110m"
|
|
5621
|
+
G711PCMU: "g7110m",
|
|
5622
|
+
OPUS: "opus",
|
|
5623
|
+
MP3: "mp3"
|
|
5593
5624
|
};
|
|
5594
5625
|
var WarningType = {
|
|
5595
5626
|
LARGE_AV_SHIFT: "LARGE_AV_SHIFT",
|
|
@@ -5629,6 +5660,7 @@
|
|
|
5629
5660
|
_defineProperty(this, "isVideoEncryption", false);
|
|
5630
5661
|
_defineProperty(this, "isAudioEncryption", false);
|
|
5631
5662
|
_defineProperty(this, "isVideo", true);
|
|
5663
|
+
_defineProperty(this, "lastKeyFrameDts", 0);
|
|
5632
5664
|
_defineProperty(this, "kid", null);
|
|
5633
5665
|
_defineProperty(this, "pssh", null);
|
|
5634
5666
|
_defineProperty(this, "ext", void 0);
|
|
@@ -5671,6 +5703,9 @@
|
|
|
5671
5703
|
}, {
|
|
5672
5704
|
key: "exist",
|
|
5673
5705
|
value: function exist() {
|
|
5706
|
+
if (/av01/.test(this.codec)) {
|
|
5707
|
+
return true;
|
|
5708
|
+
}
|
|
5674
5709
|
return !!(this.pps.length && this.sps.length && this.codec);
|
|
5675
5710
|
}
|
|
5676
5711
|
}, {
|
|
@@ -5694,6 +5729,7 @@
|
|
|
5694
5729
|
_defineProperty(this, "codecType", AudioCodecType.AAC);
|
|
5695
5730
|
_defineProperty(this, "pid", -1);
|
|
5696
5731
|
_defineProperty(this, "codec", "");
|
|
5732
|
+
_defineProperty(this, "container", "");
|
|
5697
5733
|
_defineProperty(this, "sequenceNumber", 0);
|
|
5698
5734
|
_defineProperty(this, "sampleDuration", 0);
|
|
5699
5735
|
_defineProperty(this, "timescale", 0);
|
|
@@ -5734,7 +5770,7 @@
|
|
|
5734
5770
|
}, {
|
|
5735
5771
|
key: "exist",
|
|
5736
5772
|
value: function exist() {
|
|
5737
|
-
return !!(this.sampleRate && this.channelCount && this.codec && this.codecType === AudioCodecType.AAC);
|
|
5773
|
+
return !!(this.sampleRate && this.channelCount && (this.codec || this.container) && (this.codecType === AudioCodecType.AAC || this.codecType === AudioCodecType.G711PCMA || this.codecType === AudioCodecType.G711PCMU || this.codecType === AudioCodecType.OPUS || this.codecType === AudioCodecType.MP3));
|
|
5738
5774
|
}
|
|
5739
5775
|
}, {
|
|
5740
5776
|
key: "hasSample",
|
|
@@ -5948,7 +5984,7 @@
|
|
|
5948
5984
|
continue;
|
|
5949
5985
|
}
|
|
5950
5986
|
frameLength = (data[i + 3] & 3) << 11 | data[i + 4] << 3 | (data[i + 5] & 224) >> 5;
|
|
5951
|
-
if (len - i < frameLength)
|
|
5987
|
+
if (!frameLength || len - i < frameLength)
|
|
5952
5988
|
break;
|
|
5953
5989
|
protectionSkipBytes = (~data[i + 1] & 1) * 2;
|
|
5954
5990
|
frames.push({
|
|
@@ -6082,14 +6118,57 @@
|
|
|
6082
6118
|
return AAC2;
|
|
6083
6119
|
}();
|
|
6084
6120
|
_defineProperty(AAC, "FREQ", [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350]);
|
|
6121
|
+
var OPUS = /* @__PURE__ */ function() {
|
|
6122
|
+
function OPUS2() {
|
|
6123
|
+
_classCallCheck$1(this, OPUS2);
|
|
6124
|
+
}
|
|
6125
|
+
_createClass$1(OPUS2, null, [{
|
|
6126
|
+
key: "getFrameDuration",
|
|
6127
|
+
value: function getFrameDuration(samples) {
|
|
6128
|
+
return 20;
|
|
6129
|
+
}
|
|
6130
|
+
}, {
|
|
6131
|
+
key: "parseHeaderPackets",
|
|
6132
|
+
value: function parseHeaderPackets(data) {
|
|
6133
|
+
if (!data.length)
|
|
6134
|
+
return;
|
|
6135
|
+
var dv = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
6136
|
+
var magicSignature = "";
|
|
6137
|
+
for (var i = 0; i < 8; i++) {
|
|
6138
|
+
magicSignature += String.fromCodePoint(data[i]);
|
|
6139
|
+
}
|
|
6140
|
+
if (magicSignature !== "OpusHead") {
|
|
6141
|
+
throw new Error("Invalid Opus MagicSignature");
|
|
6142
|
+
}
|
|
6143
|
+
var channelCount = data[9];
|
|
6144
|
+
console.log("Pre-skip", data[10], data[11]);
|
|
6145
|
+
var sampleRate = dv.getUint32(12, true);
|
|
6146
|
+
var outputGain = dv.getInt16(16, true);
|
|
6147
|
+
if (!sampleRate)
|
|
6148
|
+
return;
|
|
6149
|
+
var codec = "opus";
|
|
6150
|
+
var originCodec = "opus";
|
|
6151
|
+
var config = new Uint8Array(data.buffer, data.byteOffset + 8, data.byteLength - 8);
|
|
6152
|
+
return {
|
|
6153
|
+
outputGain,
|
|
6154
|
+
sampleRate,
|
|
6155
|
+
channelCount,
|
|
6156
|
+
config,
|
|
6157
|
+
codec,
|
|
6158
|
+
originCodec
|
|
6159
|
+
};
|
|
6160
|
+
}
|
|
6161
|
+
}]);
|
|
6162
|
+
return OPUS2;
|
|
6163
|
+
}();
|
|
6085
6164
|
var LARGE_AV_FIRST_FRAME_GAP = 500;
|
|
6086
6165
|
var AUDIO_GAP_OVERLAP_THRESHOLD_COUNT = 3;
|
|
6087
6166
|
var MAX_SILENT_FRAME_DURATION = 1e3;
|
|
6088
|
-
var
|
|
6167
|
+
var AUDIO_EXCEPTION_LOG_EMIT_DURATION = 5e3;
|
|
6089
6168
|
var MAX_VIDEO_FRAME_DURATION = 1e3;
|
|
6090
6169
|
var MAX_DTS_DELTA_WITH_NEXT_CHUNK = 200;
|
|
6091
|
-
var
|
|
6092
|
-
var
|
|
6170
|
+
var VIDEO_EXCEPTION_LOG_EMIT_DURATION = 5e3;
|
|
6171
|
+
var TRACK_BROKEN_CHECK_TIME = 5;
|
|
6093
6172
|
var FlvFixer = /* @__PURE__ */ function() {
|
|
6094
6173
|
function FlvFixer2(videoTrack, audioTrack, metadataTrack) {
|
|
6095
6174
|
_classCallCheck$1(this, FlvFixer2);
|
|
@@ -6205,7 +6284,7 @@
|
|
|
6205
6284
|
var firstSample = samples[0];
|
|
6206
6285
|
var vDelta = this._videoNextDts - firstSample.dts;
|
|
6207
6286
|
if (Math.abs(vDelta) > MAX_DTS_DELTA_WITH_NEXT_CHUNK) {
|
|
6208
|
-
if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) >
|
|
6287
|
+
if (Math.abs(firstSample.dts - this._lastVideoExceptionChunkFirstDtsDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {
|
|
6209
6288
|
var _samples$;
|
|
6210
6289
|
this._lastVideoExceptionChunkFirstDtsDot = firstSample.dts;
|
|
6211
6290
|
videoTrack.warnings.push({
|
|
@@ -6216,7 +6295,7 @@
|
|
|
6216
6295
|
sampleDuration: vDelta
|
|
6217
6296
|
});
|
|
6218
6297
|
}
|
|
6219
|
-
if (this._videoTimestampBreak >=
|
|
6298
|
+
if (this._videoTimestampBreak >= TRACK_BROKEN_CHECK_TIME) {
|
|
6220
6299
|
this._videoNextDts = firstSample.dts;
|
|
6221
6300
|
this._videoTimestampBreak = 0;
|
|
6222
6301
|
} else {
|
|
@@ -6239,7 +6318,7 @@
|
|
|
6239
6318
|
}
|
|
6240
6319
|
if (sampleDuration > MAX_VIDEO_FRAME_DURATION || sampleDuration < 0) {
|
|
6241
6320
|
this._videoTimestampBreak++;
|
|
6242
|
-
if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) >
|
|
6321
|
+
if (Math.abs(dts - this._lastVideoExceptionLargeGapDot) > VIDEO_EXCEPTION_LOG_EMIT_DURATION) {
|
|
6243
6322
|
this._lastVideoExceptionLargeGapDot = dts;
|
|
6244
6323
|
videoTrack.warnings.push({
|
|
6245
6324
|
type: WarningType.LARGE_VIDEO_GAP,
|
|
@@ -6320,10 +6399,27 @@
|
|
|
6320
6399
|
key: "_doFixAudioInternal",
|
|
6321
6400
|
value: function _doFixAudioInternal(audioTrack, samples, timescale) {
|
|
6322
6401
|
if (!audioTrack.sampleDuration) {
|
|
6323
|
-
|
|
6402
|
+
switch (audioTrack.codecType) {
|
|
6403
|
+
case AudioCodecType.AAC: {
|
|
6404
|
+
audioTrack.sampleDuration = AAC.getFrameDuration(audioTrack.timescale, timescale);
|
|
6405
|
+
break;
|
|
6406
|
+
}
|
|
6407
|
+
case AudioCodecType.OPUS: {
|
|
6408
|
+
audioTrack.sampleDuration = OPUS.getFrameDuration(audioTrack.samples, timescale);
|
|
6409
|
+
break;
|
|
6410
|
+
}
|
|
6411
|
+
case AudioCodecType.G711PCMA:
|
|
6412
|
+
case AudioCodecType.G711PCMU: {
|
|
6413
|
+
audioTrack.sampleDuration = this._getG711Duration(audioTrack);
|
|
6414
|
+
break;
|
|
6415
|
+
}
|
|
6416
|
+
default:
|
|
6417
|
+
console.error("can't fix audio codecType:", audioTrack.codecType);
|
|
6418
|
+
break;
|
|
6419
|
+
}
|
|
6324
6420
|
}
|
|
6325
6421
|
var refSampleDuration = audioTrack.sampleDuration;
|
|
6326
|
-
var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1e3;
|
|
6422
|
+
var sampleDurationInSampleRate = audioTrack.codecType === AudioCodecType.OPUS ? 20 : audioTrack.codecType === AudioCodecType.AAC ? 1024 : refSampleDuration * audioTrack.timescale / 1e3;
|
|
6327
6423
|
if (this._audioNextPts === void 0) {
|
|
6328
6424
|
var samp0 = samples[0];
|
|
6329
6425
|
this._audioNextPts = samp0.pts;
|
|
@@ -6332,7 +6428,7 @@
|
|
|
6332
6428
|
var nextPts = this._audioNextPts;
|
|
6333
6429
|
var sample = samples[i];
|
|
6334
6430
|
var delta = sample.pts - nextPts;
|
|
6335
|
-
if (i === 0 && this._audioTimestampBreak >=
|
|
6431
|
+
if (i === 0 && this._audioTimestampBreak >= TRACK_BROKEN_CHECK_TIME && this._keyFrameInNextChunk) {
|
|
6336
6432
|
nextPts = this._audioNextPts = sample.dts;
|
|
6337
6433
|
delta = 0;
|
|
6338
6434
|
this._audioTimestampBreak = 0;
|
|
@@ -6340,7 +6436,7 @@
|
|
|
6340
6436
|
if (!this._audioTimestampBreak && delta >= AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta <= MAX_SILENT_FRAME_DURATION && !isSafari) {
|
|
6341
6437
|
var silentFrame = this._getSilentFrame(audioTrack) || samples[0].data.subarray();
|
|
6342
6438
|
var count = Math.floor(delta / refSampleDuration);
|
|
6343
|
-
if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) >
|
|
6439
|
+
if (Math.abs(sample.pts - this._lastAudioExceptionGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
|
|
6344
6440
|
this._lastAudioExceptionGapDot = sample.pts;
|
|
6345
6441
|
audioTrack.warnings.push({
|
|
6346
6442
|
type: WarningType.AUDIO_FILLED,
|
|
@@ -6360,7 +6456,7 @@
|
|
|
6360
6456
|
}
|
|
6361
6457
|
i--;
|
|
6362
6458
|
} else if (delta <= -AUDIO_GAP_OVERLAP_THRESHOLD_COUNT * refSampleDuration && delta >= -1 * MAX_SILENT_FRAME_DURATION) {
|
|
6363
|
-
if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) >
|
|
6459
|
+
if (Math.abs(sample.pts - this._lastAudioExceptionOverlapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
|
|
6364
6460
|
this._lastAudioExceptionOverlapDot = sample.pts;
|
|
6365
6461
|
audioTrack.warnings.push({
|
|
6366
6462
|
type: WarningType.AUDIO_DROPPED,
|
|
@@ -6375,7 +6471,7 @@
|
|
|
6375
6471
|
} else {
|
|
6376
6472
|
if (Math.abs(delta) > MAX_SILENT_FRAME_DURATION) {
|
|
6377
6473
|
this._audioTimestampBreak++;
|
|
6378
|
-
if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) >
|
|
6474
|
+
if (Math.abs(sample.pts - this._lastAudioExceptionLargeGapDot) > AUDIO_EXCEPTION_LOG_EMIT_DURATION) {
|
|
6379
6475
|
this._lastAudioExceptionLargeGapDot = sample.pts;
|
|
6380
6476
|
audioTrack.warnings.push({
|
|
6381
6477
|
type: WarningType.LARGE_AUDIO_GAP,
|
|
@@ -6388,8 +6484,15 @@
|
|
|
6388
6484
|
});
|
|
6389
6485
|
}
|
|
6390
6486
|
}
|
|
6391
|
-
|
|
6392
|
-
|
|
6487
|
+
if (audioTrack.codecType === AudioCodecType.OPUS) {
|
|
6488
|
+
var lastSample = samples[samples.length - 1];
|
|
6489
|
+
if (lastSample) {
|
|
6490
|
+
lastSample.duration = sample.pts - lastSample.pts;
|
|
6491
|
+
}
|
|
6492
|
+
} else {
|
|
6493
|
+
sample.dts = sample.pts = nextPts;
|
|
6494
|
+
sample.duration = sampleDurationInSampleRate;
|
|
6495
|
+
}
|
|
6393
6496
|
this._audioNextPts += refSampleDuration;
|
|
6394
6497
|
}
|
|
6395
6498
|
}
|
|
@@ -7348,6 +7451,13 @@
|
|
|
7348
7451
|
}]);
|
|
7349
7452
|
return AMF2;
|
|
7350
7453
|
}();
|
|
7454
|
+
var FlvSoundFormat = {
|
|
7455
|
+
MP3: 2,
|
|
7456
|
+
G711A: 7,
|
|
7457
|
+
G711M: 8,
|
|
7458
|
+
AAC: 10,
|
|
7459
|
+
OPUS: 13
|
|
7460
|
+
};
|
|
7351
7461
|
var logger$2 = new Logger$1("FlvDemuxer");
|
|
7352
7462
|
var FlvDemuxer = /* @__PURE__ */ function() {
|
|
7353
7463
|
function FlvDemuxer2(videoTrack, audioTrack, metadataTrack) {
|
|
@@ -7364,8 +7474,10 @@
|
|
|
7364
7474
|
_createClass$1(FlvDemuxer2, [{
|
|
7365
7475
|
key: "demux",
|
|
7366
7476
|
value: function demux(data) {
|
|
7477
|
+
var _scriptDataObject$dat;
|
|
7367
7478
|
var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
7368
7479
|
var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
7480
|
+
var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
|
|
7369
7481
|
var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
|
|
7370
7482
|
if (discontinuity || !contiguous) {
|
|
7371
7483
|
this._remainingData = null;
|
|
@@ -7423,6 +7535,8 @@
|
|
|
7423
7535
|
if (tagType === 8) {
|
|
7424
7536
|
this._parseAudio(bodyData, timestamp);
|
|
7425
7537
|
} else if (tagType === 9) {
|
|
7538
|
+
if (seamlessLoadingSwitching)
|
|
7539
|
+
this.seamlessLoadingSwitching = true;
|
|
7426
7540
|
this._parseVideo(bodyData, timestamp);
|
|
7427
7541
|
} else if (tagType === 18) {
|
|
7428
7542
|
this._parseScript(bodyData, timestamp);
|
|
@@ -7440,13 +7554,31 @@
|
|
|
7440
7554
|
this._remainingData = data.subarray(offset);
|
|
7441
7555
|
}
|
|
7442
7556
|
audioTrack.formatTimescale = videoTrack.formatTimescale = videoTrack.timescale = metadataTrack.timescale = 1e3;
|
|
7443
|
-
audioTrack.timescale = audioTrack.sampleRate || 0;
|
|
7557
|
+
audioTrack.timescale = audioTrack.codecType === AudioCodecType.OPUS ? 1e3 : audioTrack.sampleRate || 0;
|
|
7444
7558
|
if (!audioTrack.exist() && audioTrack.hasSample()) {
|
|
7445
7559
|
audioTrack.reset();
|
|
7446
7560
|
}
|
|
7447
7561
|
if (!videoTrack.exist() && videoTrack.hasSample()) {
|
|
7448
7562
|
videoTrack.reset();
|
|
7449
7563
|
}
|
|
7564
|
+
var scriptDataObject = metadataTrack.flvScriptSamples[metadataTrack.flvScriptSamples.length - 1];
|
|
7565
|
+
var metaData = scriptDataObject === null || scriptDataObject === void 0 ? void 0 : (_scriptDataObject$dat = scriptDataObject.data) === null || _scriptDataObject$dat === void 0 ? void 0 : _scriptDataObject$dat.onMetaData;
|
|
7566
|
+
if (metaData) {
|
|
7567
|
+
if (videoTrack !== null && videoTrack !== void 0 && videoTrack.exist()) {
|
|
7568
|
+
if (metaData.hasOwnProperty("duration")) {
|
|
7569
|
+
videoTrack.duration = metaData.duration * 1e3;
|
|
7570
|
+
}
|
|
7571
|
+
if (metaData.hasOwnProperty("width") && metaData.hasOwnProperty("height")) {
|
|
7572
|
+
videoTrack.width = metaData.width;
|
|
7573
|
+
videoTrack.height = metaData.height;
|
|
7574
|
+
}
|
|
7575
|
+
}
|
|
7576
|
+
if (audioTrack !== null && audioTrack !== void 0 && audioTrack.exist()) {
|
|
7577
|
+
if (metaData.hasOwnProperty("duration")) {
|
|
7578
|
+
audioTrack.duration = metaData.duration * 1e3;
|
|
7579
|
+
}
|
|
7580
|
+
}
|
|
7581
|
+
}
|
|
7450
7582
|
return {
|
|
7451
7583
|
videoTrack,
|
|
7452
7584
|
audioTrack,
|
|
@@ -7465,8 +7597,8 @@
|
|
|
7465
7597
|
}
|
|
7466
7598
|
}, {
|
|
7467
7599
|
key: "demuxAndFix",
|
|
7468
|
-
value: function demuxAndFix(data, discontinuity, contiguous, startTime) {
|
|
7469
|
-
this.demux(data, discontinuity, contiguous);
|
|
7600
|
+
value: function demuxAndFix(data, discontinuity, contiguous, startTime, seamlessLoadingSwitching) {
|
|
7601
|
+
this.demux(data, discontinuity, contiguous, seamlessLoadingSwitching);
|
|
7470
7602
|
return this.fix(startTime, discontinuity, contiguous);
|
|
7471
7603
|
}
|
|
7472
7604
|
}, {
|
|
@@ -7476,12 +7608,12 @@
|
|
|
7476
7608
|
return;
|
|
7477
7609
|
var format = (data[0] & 240) >>> 4;
|
|
7478
7610
|
var track = this.audioTrack;
|
|
7479
|
-
if (format !==
|
|
7611
|
+
if (format !== FlvSoundFormat.AAC && format !== FlvSoundFormat.G711A && format !== FlvSoundFormat.G711M && format !== FlvSoundFormat.OPUS) {
|
|
7480
7612
|
logger$2.warn("Unsupported sound format: ".concat(format));
|
|
7481
7613
|
track.reset();
|
|
7482
7614
|
return;
|
|
7483
7615
|
}
|
|
7484
|
-
if (format !==
|
|
7616
|
+
if (format !== FlvSoundFormat.AAC && format !== FlvSoundFormat.OPUS) {
|
|
7485
7617
|
var soundRate = (data[0] & 12) >> 2;
|
|
7486
7618
|
var soundSize = (data[0] & 2) >> 1;
|
|
7487
7619
|
var soundType = data[0] & 1;
|
|
@@ -7489,20 +7621,63 @@
|
|
|
7489
7621
|
track.sampleSize = soundSize ? 16 : 8;
|
|
7490
7622
|
track.channelCount = soundType + 1;
|
|
7491
7623
|
}
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7624
|
+
switch (format) {
|
|
7625
|
+
case FlvSoundFormat.G711A:
|
|
7626
|
+
case FlvSoundFormat.G711M:
|
|
7627
|
+
this._parseG711(data, pts, format);
|
|
7628
|
+
break;
|
|
7629
|
+
case FlvSoundFormat.AAC:
|
|
7630
|
+
this._parseAac(data, pts);
|
|
7631
|
+
break;
|
|
7632
|
+
case FlvSoundFormat.OPUS:
|
|
7633
|
+
this._parseOpus(data, pts);
|
|
7634
|
+
break;
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
}, {
|
|
7638
|
+
key: "_parseOpus",
|
|
7639
|
+
value: function _parseOpus(data, pts) {
|
|
7640
|
+
var track = this.audioTrack;
|
|
7641
|
+
var packetType = data[1];
|
|
7642
|
+
track.codecType = AudioCodecType.OPUS;
|
|
7643
|
+
switch (packetType) {
|
|
7644
|
+
case 0: {
|
|
7645
|
+
var ret = OPUS.parseHeaderPackets(data.subarray(2));
|
|
7646
|
+
if (ret) {
|
|
7647
|
+
track.codec = ret.codec;
|
|
7648
|
+
track.channelCount = ret.channelCount;
|
|
7649
|
+
track.sampleRate = ret.sampleRate;
|
|
7650
|
+
track.config = ret.config;
|
|
7651
|
+
track.sampleDuration = OPUS.getFrameDuration([], track.timescale);
|
|
7652
|
+
} else {
|
|
7653
|
+
track.reset();
|
|
7654
|
+
logger$2.warn("Cannot parse AudioSpecificConfig", data);
|
|
7655
|
+
}
|
|
7656
|
+
break;
|
|
7657
|
+
}
|
|
7658
|
+
case 1: {
|
|
7659
|
+
if (pts === void 0 || pts === null)
|
|
7660
|
+
return;
|
|
7661
|
+
var newSample = new AudioSample(pts, data.subarray(2), track.sampleDuration);
|
|
7662
|
+
track.samples.push(newSample);
|
|
7663
|
+
break;
|
|
7664
|
+
}
|
|
7665
|
+
default:
|
|
7666
|
+
logger$2.warn("Unknown OpusPacketType: ".concat(packetType));
|
|
7496
7667
|
}
|
|
7497
7668
|
}
|
|
7498
7669
|
}, {
|
|
7499
7670
|
key: "_parseG711",
|
|
7500
7671
|
value: function _parseG711(data, pts, format) {
|
|
7501
7672
|
var track = this.audioTrack;
|
|
7673
|
+
var audioData = data.subarray(1);
|
|
7674
|
+
if (audioData.byteLength < 1)
|
|
7675
|
+
return;
|
|
7676
|
+
var sample = new AudioSample(pts, audioData);
|
|
7502
7677
|
track.codecType = format === 7 ? AudioCodecType.G711PCMA : AudioCodecType.G711PCMU;
|
|
7503
7678
|
track.sampleRate = 8e3;
|
|
7504
7679
|
track.codec = track.codecType;
|
|
7505
|
-
track.samples.push(
|
|
7680
|
+
track.samples.push(sample);
|
|
7506
7681
|
}
|
|
7507
7682
|
}, {
|
|
7508
7683
|
key: "_parseAac",
|
|
@@ -7580,8 +7755,13 @@
|
|
|
7580
7755
|
units = this._checkAddMetaNalToUnits(isHevc, units, track);
|
|
7581
7756
|
if (units && units.length) {
|
|
7582
7757
|
var sample = new VideoSample(dts + cts, dts, units);
|
|
7758
|
+
if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
|
|
7759
|
+
return;
|
|
7760
|
+
}
|
|
7761
|
+
this.seamlessLoadingSwitching = false;
|
|
7583
7762
|
if (frameType === 1) {
|
|
7584
7763
|
sample.setToKeyframe();
|
|
7764
|
+
track.lastKeyFrameDts = dts;
|
|
7585
7765
|
}
|
|
7586
7766
|
track.samples.push(sample);
|
|
7587
7767
|
units.forEach(function(unit) {
|
|
@@ -8055,10 +8235,16 @@
|
|
|
8055
8235
|
if (track.useEME && track.enca) {
|
|
8056
8236
|
content = MP42.enca(track);
|
|
8057
8237
|
} else {
|
|
8058
|
-
|
|
8238
|
+
if (track.codecType === AudioCodecType.OPUS) {
|
|
8239
|
+
content = MP42.opus(track);
|
|
8240
|
+
} else {
|
|
8241
|
+
content = MP42.mp4a(track);
|
|
8242
|
+
}
|
|
8059
8243
|
}
|
|
8060
8244
|
} else if (track.useEME && track.encv) {
|
|
8061
8245
|
content = MP42.encv(track);
|
|
8246
|
+
} else if (track.av1C) {
|
|
8247
|
+
content = MP42.av01(track);
|
|
8062
8248
|
} else {
|
|
8063
8249
|
content = MP42.avc1hev1(track);
|
|
8064
8250
|
}
|
|
@@ -8271,6 +8457,90 @@
|
|
|
8271
8457
|
var schi = MP42.schi(data);
|
|
8272
8458
|
return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
|
|
8273
8459
|
}
|
|
8460
|
+
}, {
|
|
8461
|
+
key: "av01",
|
|
8462
|
+
value: function av01(track) {
|
|
8463
|
+
return MP42.box(MP42.types.av01, new Uint8Array([
|
|
8464
|
+
0,
|
|
8465
|
+
0,
|
|
8466
|
+
0,
|
|
8467
|
+
0,
|
|
8468
|
+
0,
|
|
8469
|
+
0,
|
|
8470
|
+
0,
|
|
8471
|
+
1,
|
|
8472
|
+
0,
|
|
8473
|
+
0,
|
|
8474
|
+
0,
|
|
8475
|
+
0,
|
|
8476
|
+
0,
|
|
8477
|
+
0,
|
|
8478
|
+
0,
|
|
8479
|
+
0,
|
|
8480
|
+
0,
|
|
8481
|
+
0,
|
|
8482
|
+
0,
|
|
8483
|
+
0,
|
|
8484
|
+
0,
|
|
8485
|
+
0,
|
|
8486
|
+
0,
|
|
8487
|
+
0,
|
|
8488
|
+
track.width >> 8 & 255,
|
|
8489
|
+
track.width & 255,
|
|
8490
|
+
track.height >> 8 & 255,
|
|
8491
|
+
track.height & 255,
|
|
8492
|
+
0,
|
|
8493
|
+
72,
|
|
8494
|
+
0,
|
|
8495
|
+
0,
|
|
8496
|
+
0,
|
|
8497
|
+
72,
|
|
8498
|
+
0,
|
|
8499
|
+
0,
|
|
8500
|
+
0,
|
|
8501
|
+
0,
|
|
8502
|
+
0,
|
|
8503
|
+
0,
|
|
8504
|
+
0,
|
|
8505
|
+
1,
|
|
8506
|
+
0,
|
|
8507
|
+
0,
|
|
8508
|
+
0,
|
|
8509
|
+
0,
|
|
8510
|
+
0,
|
|
8511
|
+
0,
|
|
8512
|
+
0,
|
|
8513
|
+
0,
|
|
8514
|
+
0,
|
|
8515
|
+
0,
|
|
8516
|
+
0,
|
|
8517
|
+
0,
|
|
8518
|
+
0,
|
|
8519
|
+
0,
|
|
8520
|
+
0,
|
|
8521
|
+
0,
|
|
8522
|
+
0,
|
|
8523
|
+
0,
|
|
8524
|
+
0,
|
|
8525
|
+
0,
|
|
8526
|
+
0,
|
|
8527
|
+
0,
|
|
8528
|
+
0,
|
|
8529
|
+
0,
|
|
8530
|
+
0,
|
|
8531
|
+
0,
|
|
8532
|
+
0,
|
|
8533
|
+
0,
|
|
8534
|
+
0,
|
|
8535
|
+
0,
|
|
8536
|
+
0,
|
|
8537
|
+
0,
|
|
8538
|
+
0,
|
|
8539
|
+
24,
|
|
8540
|
+
17,
|
|
8541
|
+
17
|
|
8542
|
+
]), track.av1C, track.colr);
|
|
8543
|
+
}
|
|
8274
8544
|
}, {
|
|
8275
8545
|
key: "avc1hev1",
|
|
8276
8546
|
value: function avc1hev1(track) {
|
|
@@ -8641,6 +8911,53 @@
|
|
|
8641
8911
|
)));
|
|
8642
8912
|
return esds2;
|
|
8643
8913
|
}
|
|
8914
|
+
}, {
|
|
8915
|
+
key: "opus",
|
|
8916
|
+
value: function opus(track) {
|
|
8917
|
+
var opusAudioDescription = new Uint8Array([
|
|
8918
|
+
0,
|
|
8919
|
+
0,
|
|
8920
|
+
0,
|
|
8921
|
+
0,
|
|
8922
|
+
0,
|
|
8923
|
+
0,
|
|
8924
|
+
0,
|
|
8925
|
+
1,
|
|
8926
|
+
0,
|
|
8927
|
+
0,
|
|
8928
|
+
0,
|
|
8929
|
+
0,
|
|
8930
|
+
0,
|
|
8931
|
+
0,
|
|
8932
|
+
0,
|
|
8933
|
+
0,
|
|
8934
|
+
0,
|
|
8935
|
+
track.channelCount,
|
|
8936
|
+
0,
|
|
8937
|
+
16,
|
|
8938
|
+
0,
|
|
8939
|
+
0,
|
|
8940
|
+
0,
|
|
8941
|
+
0,
|
|
8942
|
+
track.sampleRate >> 8 & 255,
|
|
8943
|
+
track.sampleRate & 255,
|
|
8944
|
+
0,
|
|
8945
|
+
0
|
|
8946
|
+
]);
|
|
8947
|
+
var opusSpecificConfig = track.config.length ? MP42.dOps(track) : [];
|
|
8948
|
+
return MP42.box(MP42.types.Opus, opusAudioDescription, opusSpecificConfig);
|
|
8949
|
+
}
|
|
8950
|
+
}, {
|
|
8951
|
+
key: "dOps",
|
|
8952
|
+
value: function dOps(track) {
|
|
8953
|
+
if (track.config) {
|
|
8954
|
+
track.config[4] = track.sampleRate >>> 24 & 255;
|
|
8955
|
+
track.config[5] = track.sampleRate >>> 16 & 255;
|
|
8956
|
+
track.config[6] = track.sampleRate >>> 8 & 255;
|
|
8957
|
+
track.config[7] = track.sampleRate & 255;
|
|
8958
|
+
return MP42.box(MP42.types.dOps, track.config);
|
|
8959
|
+
}
|
|
8960
|
+
}
|
|
8644
8961
|
}, {
|
|
8645
8962
|
key: "mvex",
|
|
8646
8963
|
value: function mvex(tracks) {
|
|
@@ -9243,7 +9560,7 @@
|
|
|
9243
9560
|
}]);
|
|
9244
9561
|
return MP42;
|
|
9245
9562
|
}();
|
|
9246
|
-
_defineProperty(MP4, "types", ["avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
|
|
9563
|
+
_defineProperty(MP4, "types", ["Opus", "dOps", "av01", "av1C", "avc1", "avcC", "hvc1", "hvcC", "dinf", "dref", "esds", "ftyp", "hdlr", "mdat", "mdhd", "mdia", "mfhd", "minf", "moof", "moov", "mp4a", "mvex", "mvhd", "pasp", "stbl", "stco", "stsc", "stsd", "stsz", "stts", "tfdt", "tfhd", "traf", "trak", "trex", "tkhd", "vmhd", "smhd", "ctts", "stss", "styp", "pssh", "sidx", "sbgp", "saiz", "saio", "senc", "trun", "encv", "enca", "sinf", "btrt", "frma", "tenc", "schm", "schi", "mehd", "fiel", "sdtp"].reduce(function(p, c) {
|
|
9247
9564
|
p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
|
|
9248
9565
|
return p;
|
|
9249
9566
|
}, /* @__PURE__ */ Object.create(null)));
|
|
@@ -9578,30 +9895,46 @@
|
|
|
9578
9895
|
};
|
|
9579
9896
|
}
|
|
9580
9897
|
var samples = track.samples;
|
|
9898
|
+
var isAV01 = /av01/.test(track.codec);
|
|
9581
9899
|
var mdatSize = 0;
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
}
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
var sampleSize = 0;
|
|
9593
|
-
_sample.units.forEach(function(u) {
|
|
9594
|
-
mdatView.setUint32(_offset, u.byteLength);
|
|
9595
|
-
_offset += 4;
|
|
9596
|
-
mdata.set(u, _offset);
|
|
9597
|
-
_offset += u.byteLength;
|
|
9598
|
-
sampleSize += 4 + u.byteLength;
|
|
9900
|
+
if (isAV01) {
|
|
9901
|
+
samples.forEach(function(s) {
|
|
9902
|
+
mdatSize += s.data.byteLength;
|
|
9903
|
+
});
|
|
9904
|
+
} else {
|
|
9905
|
+
samples.forEach(function(s) {
|
|
9906
|
+
mdatSize += s.units.reduce(function(t, c) {
|
|
9907
|
+
return t + c.byteLength;
|
|
9908
|
+
}, 0);
|
|
9909
|
+
mdatSize += s.units.length * 4;
|
|
9599
9910
|
});
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9911
|
+
}
|
|
9912
|
+
var mdata = new Uint8Array(mdatSize);
|
|
9913
|
+
if (isAV01) {
|
|
9914
|
+
for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
|
|
9915
|
+
sample = samples[i];
|
|
9916
|
+
mdata.set(sample.data, offset);
|
|
9917
|
+
sample.size = sample.data.byteLength;
|
|
9918
|
+
offset += sample.size;
|
|
9919
|
+
}
|
|
9920
|
+
} else {
|
|
9921
|
+
var mdatView = new DataView(mdata.buffer);
|
|
9922
|
+
var _loop = function _loop2(_offset2, _sample2) {
|
|
9923
|
+
_sample2 = samples[_i];
|
|
9924
|
+
var sampleSize = 0;
|
|
9925
|
+
_sample2.units.forEach(function(u) {
|
|
9926
|
+
mdatView.setUint32(_offset2, u.byteLength);
|
|
9927
|
+
_offset2 += 4;
|
|
9928
|
+
mdata.set(u, _offset2);
|
|
9929
|
+
_offset2 += u.byteLength;
|
|
9930
|
+
sampleSize += 4 + u.byteLength;
|
|
9931
|
+
});
|
|
9932
|
+
_sample2.size = sampleSize;
|
|
9933
|
+
_offset = _offset2, _sample = _sample2;
|
|
9934
|
+
};
|
|
9935
|
+
for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
|
|
9936
|
+
_loop(_offset, _sample);
|
|
9937
|
+
}
|
|
9605
9938
|
}
|
|
9606
9939
|
var mdat = MP4.mdat(mdata);
|
|
9607
9940
|
var moof = MP4.moof([track]);
|
|
@@ -9631,6 +9964,55 @@
|
|
|
9631
9964
|
}]);
|
|
9632
9965
|
return FMP4Remuxer2;
|
|
9633
9966
|
}();
|
|
9967
|
+
var TransferCost = /* @__PURE__ */ function() {
|
|
9968
|
+
function TransferCost2() {
|
|
9969
|
+
_classCallCheck$4(this, TransferCost2);
|
|
9970
|
+
_defineProperty$3(this, "_ttfb", 0);
|
|
9971
|
+
_defineProperty$3(this, "_demuxStart", 0);
|
|
9972
|
+
_defineProperty$3(this, "_demuxEnd", 0);
|
|
9973
|
+
_defineProperty$3(this, "_demuxCost", 0);
|
|
9974
|
+
_defineProperty$3(this, "_remuxStart", 0);
|
|
9975
|
+
_defineProperty$3(this, "_remuxEnd", 0);
|
|
9976
|
+
_defineProperty$3(this, "_remuxCost", 0);
|
|
9977
|
+
_defineProperty$3(this, "_appendStart", 0);
|
|
9978
|
+
_defineProperty$3(this, "_appendEnd", 0);
|
|
9979
|
+
_defineProperty$3(this, "_appendCost", 0);
|
|
9980
|
+
}
|
|
9981
|
+
_createClass$4(TransferCost2, [{
|
|
9982
|
+
key: "set",
|
|
9983
|
+
value: function set(event, value) {
|
|
9984
|
+
this["_".concat(event)] = value;
|
|
9985
|
+
}
|
|
9986
|
+
}, {
|
|
9987
|
+
key: "start",
|
|
9988
|
+
value: function start(event) {
|
|
9989
|
+
this["_".concat(event, "Start")] = Date.now();
|
|
9990
|
+
}
|
|
9991
|
+
}, {
|
|
9992
|
+
key: "end",
|
|
9993
|
+
value: function end(event) {
|
|
9994
|
+
this["_".concat(event, "End")] = Date.now();
|
|
9995
|
+
this["_".concat(event, "Cost")] = this["_".concat(event, "Cost")] + (this["_".concat(event, "End")] - this["_".concat(event, "Start")]);
|
|
9996
|
+
}
|
|
9997
|
+
}, {
|
|
9998
|
+
key: "transferCost",
|
|
9999
|
+
get: function get() {
|
|
10000
|
+
return {
|
|
10001
|
+
ttfbCost: this._ttfb,
|
|
10002
|
+
demuxCost: this._demuxCost,
|
|
10003
|
+
remuxCost: this._remuxCost,
|
|
10004
|
+
appendCost: this._appendCost
|
|
10005
|
+
};
|
|
10006
|
+
}
|
|
10007
|
+
}]);
|
|
10008
|
+
return TransferCost2;
|
|
10009
|
+
}();
|
|
10010
|
+
var TRANSFER_EVENT = {
|
|
10011
|
+
TTFB: "ttfb",
|
|
10012
|
+
DEMUX: "demux",
|
|
10013
|
+
REMUX: "remux",
|
|
10014
|
+
APPEND: "append"
|
|
10015
|
+
};
|
|
9634
10016
|
var logger$1 = new Logger$2("BufferService");
|
|
9635
10017
|
var BufferService = /* @__PURE__ */ function() {
|
|
9636
10018
|
function BufferService2(flv, softVideo) {
|
|
@@ -9718,7 +10100,8 @@
|
|
|
9718
10100
|
this._contiguous = false;
|
|
9719
10101
|
this._sourceCreated = false;
|
|
9720
10102
|
this._initSegmentId = "";
|
|
9721
|
-
|
|
10103
|
+
this.resetSeamlessSwitchStats();
|
|
10104
|
+
case 12:
|
|
9722
10105
|
case "end":
|
|
9723
10106
|
return _context.stop();
|
|
9724
10107
|
}
|
|
@@ -9729,6 +10112,15 @@
|
|
|
9729
10112
|
}
|
|
9730
10113
|
return reset;
|
|
9731
10114
|
}()
|
|
10115
|
+
}, {
|
|
10116
|
+
key: "resetSeamlessSwitchStats",
|
|
10117
|
+
value: function resetSeamlessSwitchStats() {
|
|
10118
|
+
this.seamlessLoadingSwitch = null;
|
|
10119
|
+
this.seamlessLoadingSwitching = false;
|
|
10120
|
+
if (this._demuxer) {
|
|
10121
|
+
this._demuxer.seamlessLoadingSwitching = false;
|
|
10122
|
+
}
|
|
10123
|
+
}
|
|
9732
10124
|
}, {
|
|
9733
10125
|
key: "endOfStream",
|
|
9734
10126
|
value: function() {
|
|
@@ -9834,32 +10226,56 @@
|
|
|
9834
10226
|
key: "appendBuffer",
|
|
9835
10227
|
value: function() {
|
|
9836
10228
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(chunk) {
|
|
9837
|
-
var
|
|
10229
|
+
var _this = this;
|
|
10230
|
+
var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, afterAppend, newId, remuxResult, p;
|
|
9838
10231
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
9839
10232
|
while (1)
|
|
9840
10233
|
switch (_context5.prev = _context5.next) {
|
|
9841
10234
|
case 0:
|
|
10235
|
+
switchingNoReset = false;
|
|
9842
10236
|
if (this._cachedBuffer) {
|
|
9843
10237
|
chunk = concatUint8Array$1(this._cachedBuffer, chunk);
|
|
9844
10238
|
this._cachedBuffer = null;
|
|
9845
10239
|
}
|
|
9846
10240
|
demuxer = this._demuxer;
|
|
9847
10241
|
if (!(!chunk || !chunk.length || !demuxer)) {
|
|
9848
|
-
_context5.next =
|
|
10242
|
+
_context5.next = 5;
|
|
9849
10243
|
break;
|
|
9850
10244
|
}
|
|
9851
10245
|
return _context5.abrupt("return");
|
|
9852
|
-
case
|
|
9853
|
-
_context5.prev =
|
|
9854
|
-
|
|
9855
|
-
|
|
10246
|
+
case 5:
|
|
10247
|
+
_context5.prev = 5;
|
|
10248
|
+
this.flv._transferCost.start(TRANSFER_EVENT.DEMUX);
|
|
10249
|
+
demuxer.demuxAndFix(chunk, this.seamlessLoadingSwitching || this._discontinuity, this._contiguous, this._demuxStartTime, this.seamlessLoadingSwitching);
|
|
10250
|
+
this.seamlessLoadingSwitching = false;
|
|
10251
|
+
this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
|
|
10252
|
+
_context5.next = 15;
|
|
9856
10253
|
break;
|
|
9857
|
-
case
|
|
9858
|
-
_context5.prev =
|
|
9859
|
-
_context5.t0 = _context5["catch"](
|
|
10254
|
+
case 12:
|
|
10255
|
+
_context5.prev = 12;
|
|
10256
|
+
_context5.t0 = _context5["catch"](5);
|
|
9860
10257
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, _context5.t0);
|
|
9861
|
-
case
|
|
10258
|
+
case 15:
|
|
9862
10259
|
videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
|
|
10260
|
+
if (!this.seamlessLoadingSwitch) {
|
|
10261
|
+
_context5.next = 25;
|
|
10262
|
+
break;
|
|
10263
|
+
}
|
|
10264
|
+
idx = videoTrack.samples.findIndex(function(sample) {
|
|
10265
|
+
return sample.originDts === videoTrack.lastKeyFrameDts;
|
|
10266
|
+
});
|
|
10267
|
+
if (!(idx >= 0)) {
|
|
10268
|
+
_context5.next = 25;
|
|
10269
|
+
break;
|
|
10270
|
+
}
|
|
10271
|
+
videoTrack.samples.splice(idx);
|
|
10272
|
+
_context5.next = 22;
|
|
10273
|
+
return this.seamlessLoadingSwitch();
|
|
10274
|
+
case 22:
|
|
10275
|
+
this.seamlessLoadingSwitch = null;
|
|
10276
|
+
chunk = null;
|
|
10277
|
+
switchingNoReset = true;
|
|
10278
|
+
case 25:
|
|
9863
10279
|
videoExist = videoTrack.exist();
|
|
9864
10280
|
audioExist = audioTrack.exist();
|
|
9865
10281
|
if (this._opts.onlyAudio) {
|
|
@@ -9871,7 +10287,7 @@
|
|
|
9871
10287
|
audioTrack.present = false;
|
|
9872
10288
|
}
|
|
9873
10289
|
if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
|
|
9874
|
-
_context5.next =
|
|
10290
|
+
_context5.next = 42;
|
|
9875
10291
|
break;
|
|
9876
10292
|
}
|
|
9877
10293
|
duration = 0;
|
|
@@ -9880,7 +10296,7 @@
|
|
|
9880
10296
|
duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
|
|
9881
10297
|
}
|
|
9882
10298
|
if (!(duration > this._opts.analyzeDuration)) {
|
|
9883
|
-
_context5.next =
|
|
10299
|
+
_context5.next = 40;
|
|
9884
10300
|
break;
|
|
9885
10301
|
}
|
|
9886
10302
|
logger$1.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
|
|
@@ -9889,19 +10305,28 @@
|
|
|
9889
10305
|
this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, {
|
|
9890
10306
|
duration
|
|
9891
10307
|
});
|
|
9892
|
-
_context5.next =
|
|
10308
|
+
_context5.next = 42;
|
|
9893
10309
|
break;
|
|
9894
|
-
case
|
|
10310
|
+
case 40:
|
|
9895
10311
|
this._cachedBuffer = chunk;
|
|
9896
10312
|
return _context5.abrupt("return");
|
|
9897
|
-
case
|
|
10313
|
+
case 42:
|
|
9898
10314
|
videoType = videoTrack.type;
|
|
9899
10315
|
audioType = audioTrack.type;
|
|
9900
10316
|
this._fireEvents(videoTrack, audioTrack, metadataTrack);
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
10317
|
+
if (!switchingNoReset) {
|
|
10318
|
+
this._discontinuity = false;
|
|
10319
|
+
this._contiguous = true;
|
|
10320
|
+
this._demuxStartTime = 0;
|
|
10321
|
+
}
|
|
9904
10322
|
mse = this._mse;
|
|
10323
|
+
afterAppend = function afterAppend2() {
|
|
10324
|
+
var _this$flv;
|
|
10325
|
+
if ((_this$flv = _this.flv) !== null && _this$flv !== void 0 && _this$flv.emit) {
|
|
10326
|
+
var _this$flv2;
|
|
10327
|
+
(_this$flv2 = _this.flv) === null || _this$flv2 === void 0 ? void 0 : _this$flv2.emit(EVENT.APPEND_BUFFER, {});
|
|
10328
|
+
}
|
|
10329
|
+
};
|
|
9905
10330
|
this.flv.emit(EVENT.DEMUXED_TRACK, {
|
|
9906
10331
|
videoTrack
|
|
9907
10332
|
});
|
|
@@ -9912,16 +10337,16 @@
|
|
|
9912
10337
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
9913
10338
|
}
|
|
9914
10339
|
if (!mse) {
|
|
9915
|
-
_context5.next =
|
|
10340
|
+
_context5.next = 81;
|
|
9916
10341
|
break;
|
|
9917
10342
|
}
|
|
9918
10343
|
if (this._sourceCreated) {
|
|
9919
|
-
_context5.next =
|
|
10344
|
+
_context5.next = 59;
|
|
9920
10345
|
break;
|
|
9921
10346
|
}
|
|
9922
|
-
_context5.next =
|
|
10347
|
+
_context5.next = 55;
|
|
9923
10348
|
return mse.open();
|
|
9924
|
-
case
|
|
10349
|
+
case 55:
|
|
9925
10350
|
if (videoExist) {
|
|
9926
10351
|
logger$1.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
|
|
9927
10352
|
mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
|
|
@@ -9932,26 +10357,28 @@
|
|
|
9932
10357
|
}
|
|
9933
10358
|
this._sourceCreated = true;
|
|
9934
10359
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
9935
|
-
case
|
|
9936
|
-
_context5.prev =
|
|
10360
|
+
case 59:
|
|
10361
|
+
_context5.prev = 59;
|
|
9937
10362
|
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
9938
10363
|
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
9939
10364
|
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
9940
10365
|
}
|
|
10366
|
+
this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
|
|
9941
10367
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
9942
|
-
|
|
10368
|
+
this.flv._transferCost.end(TRANSFER_EVENT.REMUX);
|
|
10369
|
+
_context5.next = 69;
|
|
9943
10370
|
break;
|
|
9944
|
-
case
|
|
9945
|
-
_context5.prev =
|
|
9946
|
-
_context5.t1 = _context5["catch"](
|
|
10371
|
+
case 66:
|
|
10372
|
+
_context5.prev = 66;
|
|
10373
|
+
_context5.t1 = _context5["catch"](59);
|
|
9947
10374
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
9948
|
-
case
|
|
10375
|
+
case 69:
|
|
9949
10376
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
9950
|
-
_context5.next =
|
|
10377
|
+
_context5.next = 71;
|
|
9951
10378
|
break;
|
|
9952
10379
|
}
|
|
9953
10380
|
return _context5.abrupt("return");
|
|
9954
|
-
case
|
|
10381
|
+
case 71:
|
|
9955
10382
|
this._needInitSegment = false;
|
|
9956
10383
|
p = [];
|
|
9957
10384
|
if (remuxResult.videoInitSegment)
|
|
@@ -9962,16 +10389,21 @@
|
|
|
9962
10389
|
p.push(mse.append(videoType, remuxResult.videoSegment));
|
|
9963
10390
|
if (remuxResult.audioSegment)
|
|
9964
10391
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
9965
|
-
|
|
9966
|
-
|
|
10392
|
+
this.flv._transferCost.start(TRANSFER_EVENT.APPEND);
|
|
10393
|
+
return _context5.abrupt("return", Promise.all(p).then(afterAppend).then(function() {
|
|
10394
|
+
_this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
|
|
10395
|
+
afterAppend();
|
|
10396
|
+
}));
|
|
10397
|
+
case 81:
|
|
9967
10398
|
if (this._softVideo) {
|
|
9968
10399
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
10400
|
+
afterAppend();
|
|
9969
10401
|
}
|
|
9970
|
-
case
|
|
10402
|
+
case 82:
|
|
9971
10403
|
case "end":
|
|
9972
10404
|
return _context5.stop();
|
|
9973
10405
|
}
|
|
9974
|
-
}, _callee5, this, [[
|
|
10406
|
+
}, _callee5, this, [[5, 12], [59, 66]]);
|
|
9975
10407
|
}));
|
|
9976
10408
|
function appendBuffer(_x2) {
|
|
9977
10409
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -9982,7 +10414,7 @@
|
|
|
9982
10414
|
key: "evictBuffer",
|
|
9983
10415
|
value: function() {
|
|
9984
10416
|
var _evictBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(bufferBehind) {
|
|
9985
|
-
var
|
|
10417
|
+
var _this2 = this;
|
|
9986
10418
|
var media, currentTime, removeEnd, start;
|
|
9987
10419
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
9988
10420
|
while (1)
|
|
@@ -10011,7 +10443,7 @@
|
|
|
10011
10443
|
return _context6.abrupt("return");
|
|
10012
10444
|
case 10:
|
|
10013
10445
|
return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
|
|
10014
|
-
return
|
|
10446
|
+
return _this2.flv.emit(EVENT.REMOVE_BUFFER, {
|
|
10015
10447
|
removeEnd
|
|
10016
10448
|
});
|
|
10017
10449
|
}));
|
|
@@ -10061,16 +10493,16 @@
|
|
|
10061
10493
|
}, {
|
|
10062
10494
|
key: "_fireEvents",
|
|
10063
10495
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
|
|
10064
|
-
var
|
|
10065
|
-
logger$1.debug(videoTrack.samples, audioTrack.samples);
|
|
10496
|
+
var _this3 = this;
|
|
10497
|
+
logger$1.debug("videoTrack samples count: ".concat(videoTrack.samples.length, ", audioTrack samples count: ").concat(audioTrack.samples.length));
|
|
10066
10498
|
metadataTrack.flvScriptSamples.forEach(function(sample) {
|
|
10067
|
-
|
|
10499
|
+
_this3.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
|
|
10068
10500
|
logger$1.debug("flvScriptData", sample);
|
|
10069
10501
|
});
|
|
10070
10502
|
videoTrack.samples.forEach(function(sample) {
|
|
10071
10503
|
if (sample.keyframe) {
|
|
10072
|
-
|
|
10073
|
-
pts: sample.
|
|
10504
|
+
_this3.flv.emit(EVENT.KEYFRAME, {
|
|
10505
|
+
pts: sample.originPts
|
|
10074
10506
|
});
|
|
10075
10507
|
}
|
|
10076
10508
|
});
|
|
@@ -10088,7 +10520,7 @@
|
|
|
10088
10520
|
break;
|
|
10089
10521
|
}
|
|
10090
10522
|
if (type)
|
|
10091
|
-
|
|
10523
|
+
_this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10092
10524
|
type
|
|
10093
10525
|
}));
|
|
10094
10526
|
logger$1.warn("video exception", warn);
|
|
@@ -10107,13 +10539,13 @@
|
|
|
10107
10539
|
break;
|
|
10108
10540
|
}
|
|
10109
10541
|
if (type)
|
|
10110
|
-
|
|
10542
|
+
_this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10111
10543
|
type
|
|
10112
10544
|
}));
|
|
10113
10545
|
logger$1.warn("audio exception", warn);
|
|
10114
10546
|
});
|
|
10115
10547
|
metadataTrack.seiSamples.forEach(function(sei) {
|
|
10116
|
-
|
|
10548
|
+
_this3.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
|
|
10117
10549
|
sei: {
|
|
10118
10550
|
code: sei.data.type,
|
|
10119
10551
|
content: sei.data.payload,
|
|
@@ -10148,7 +10580,8 @@
|
|
|
10148
10580
|
durationForMSELowLatencyOff: 6,
|
|
10149
10581
|
chunkCountForSpeed: 50,
|
|
10150
10582
|
skipChunkSize: 1e3,
|
|
10151
|
-
longtimeNoReceived: 3e3
|
|
10583
|
+
longtimeNoReceived: 3e3,
|
|
10584
|
+
enableStartGapJump: true
|
|
10152
10585
|
}, opts);
|
|
10153
10586
|
if (ret.isLive) {
|
|
10154
10587
|
if (ret.preloadTime) {
|
|
@@ -10216,7 +10649,7 @@
|
|
|
10216
10649
|
_defineProperty$3(_assertThisInitialized$3(_this), "_acceptRanges", true);
|
|
10217
10650
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onProgress", /* @__PURE__ */ function() {
|
|
10218
10651
|
var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee(chunk, done, _ref, response) {
|
|
10219
|
-
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
|
|
10652
|
+
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, elapsed, _this$_bufferService, remaining, maxReaderInterval;
|
|
10220
10653
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10221
10654
|
while (1)
|
|
10222
10655
|
switch (_context.prev = _context.next) {
|
|
@@ -10224,7 +10657,7 @@
|
|
|
10224
10657
|
startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
|
|
10225
10658
|
_this._loading = !done;
|
|
10226
10659
|
if (_this._firstProgressEmit) {
|
|
10227
|
-
_context.next =
|
|
10660
|
+
_context.next = 13;
|
|
10228
10661
|
break;
|
|
10229
10662
|
}
|
|
10230
10663
|
if (_this.media) {
|
|
@@ -10235,49 +10668,51 @@
|
|
|
10235
10668
|
return _context.abrupt("return");
|
|
10236
10669
|
case 6:
|
|
10237
10670
|
headers = response.headers;
|
|
10671
|
+
elapsed = st ? firstByteTime - st : endTime - startTime;
|
|
10238
10672
|
_this.emit(EVENT.TTFB, {
|
|
10239
10673
|
url: _this._opts.url,
|
|
10240
10674
|
responseUrl: response.url,
|
|
10241
|
-
elapsed
|
|
10675
|
+
elapsed
|
|
10242
10676
|
});
|
|
10243
10677
|
_this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
10244
10678
|
headers
|
|
10245
10679
|
});
|
|
10680
|
+
_this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
|
|
10246
10681
|
_this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
|
|
10247
10682
|
_this._firstProgressEmit = true;
|
|
10248
|
-
case
|
|
10683
|
+
case 13:
|
|
10249
10684
|
if (_this._bufferService) {
|
|
10250
|
-
_context.next =
|
|
10685
|
+
_context.next = 15;
|
|
10251
10686
|
break;
|
|
10252
10687
|
}
|
|
10253
10688
|
return _context.abrupt("return");
|
|
10254
|
-
case
|
|
10689
|
+
case 15:
|
|
10255
10690
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
10256
10691
|
_this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
|
|
10257
|
-
_context.prev =
|
|
10258
|
-
_context.next =
|
|
10692
|
+
_context.prev = 17;
|
|
10693
|
+
_context.next = 20;
|
|
10259
10694
|
return _this._bufferService.appendBuffer(chunk);
|
|
10260
|
-
case
|
|
10695
|
+
case 20:
|
|
10261
10696
|
(_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
|
|
10262
|
-
_context.next =
|
|
10697
|
+
_context.next = 33;
|
|
10263
10698
|
break;
|
|
10264
|
-
case
|
|
10265
|
-
_context.prev =
|
|
10266
|
-
_context.t0 = _context["catch"](
|
|
10699
|
+
case 23:
|
|
10700
|
+
_context.prev = 23;
|
|
10701
|
+
_context.t0 = _context["catch"](17);
|
|
10267
10702
|
if (!(!_this.isLive && _this._bufferService.isFull())) {
|
|
10268
|
-
_context.next =
|
|
10703
|
+
_context.next = 32;
|
|
10269
10704
|
break;
|
|
10270
10705
|
}
|
|
10271
|
-
_context.next =
|
|
10706
|
+
_context.next = 28;
|
|
10272
10707
|
return _this._mediaLoader.cancel();
|
|
10273
|
-
case
|
|
10708
|
+
case 28:
|
|
10274
10709
|
_this._loading = false;
|
|
10275
10710
|
remaining = _this.bufferInfo().remaining;
|
|
10276
10711
|
_this._opts.preloadTime = parseInt(remaining) / 2;
|
|
10277
10712
|
return _context.abrupt("return");
|
|
10278
|
-
case
|
|
10713
|
+
case 32:
|
|
10279
10714
|
return _context.abrupt("return", _this._emitError(StreamingError.create(_context.t0)));
|
|
10280
|
-
case
|
|
10715
|
+
case 33:
|
|
10281
10716
|
if (_this._urlSwitching) {
|
|
10282
10717
|
_this._urlSwitching = false;
|
|
10283
10718
|
_this.emit(EVENT.SWITCH_URL_SUCCESS, {
|
|
@@ -10289,7 +10724,7 @@
|
|
|
10289
10724
|
_this._tick();
|
|
10290
10725
|
}
|
|
10291
10726
|
if (!(done && !_this.media.seeking)) {
|
|
10292
|
-
_context.next =
|
|
10727
|
+
_context.next = 40;
|
|
10293
10728
|
break;
|
|
10294
10729
|
}
|
|
10295
10730
|
_this.emit(EVENT.LOAD_COMPLETE);
|
|
@@ -10298,13 +10733,13 @@
|
|
|
10298
10733
|
_this._end();
|
|
10299
10734
|
}
|
|
10300
10735
|
return _context.abrupt("return");
|
|
10301
|
-
case
|
|
10736
|
+
case 40:
|
|
10302
10737
|
if (_this.isLive) {
|
|
10303
|
-
_context.next =
|
|
10738
|
+
_context.next = 42;
|
|
10304
10739
|
break;
|
|
10305
10740
|
}
|
|
10306
10741
|
return _context.abrupt("return");
|
|
10307
|
-
case
|
|
10742
|
+
case 42:
|
|
10308
10743
|
maxReaderInterval = _this._opts.maxReaderInterval;
|
|
10309
10744
|
if (maxReaderInterval && _this._firstProgressEmit) {
|
|
10310
10745
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
@@ -10318,11 +10753,11 @@
|
|
|
10318
10753
|
_this._end();
|
|
10319
10754
|
}, maxReaderInterval);
|
|
10320
10755
|
}
|
|
10321
|
-
case
|
|
10756
|
+
case 44:
|
|
10322
10757
|
case "end":
|
|
10323
10758
|
return _context.stop();
|
|
10324
10759
|
}
|
|
10325
|
-
}, _callee, null, [[
|
|
10760
|
+
}, _callee, null, [[17, 23]]);
|
|
10326
10761
|
}));
|
|
10327
10762
|
return function(_x, _x2, _x3, _x4) {
|
|
10328
10763
|
return _ref2.apply(this, arguments);
|
|
@@ -10355,19 +10790,19 @@
|
|
|
10355
10790
|
if (bufferEnd < MAX_HOLE || !media.readyState)
|
|
10356
10791
|
return;
|
|
10357
10792
|
var opts = _this._opts;
|
|
10358
|
-
if (isMediaPlaying(media)) {
|
|
10793
|
+
if (isMediaPlaying(media) && media.currentTime) {
|
|
10359
10794
|
if (_this._gapService) {
|
|
10360
10795
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10361
10796
|
}
|
|
10362
10797
|
} else {
|
|
10363
|
-
if (!media.currentTime && _this._gapService) {
|
|
10798
|
+
if (!media.currentTime && _this._gapService && opts.enableStartGapJump) {
|
|
10364
10799
|
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10365
10800
|
if (gapJump) {
|
|
10366
10801
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10367
10802
|
}
|
|
10368
10803
|
return;
|
|
10369
10804
|
}
|
|
10370
|
-
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
10805
|
+
if (opts.isLive && media.readyState === 4 && bufferEnd - media.currentTime > opts.disconnectTime) {
|
|
10371
10806
|
_this.disconnect();
|
|
10372
10807
|
}
|
|
10373
10808
|
}
|
|
@@ -10516,6 +10951,7 @@
|
|
|
10516
10951
|
responseType: "arraybuffer"
|
|
10517
10952
|
}));
|
|
10518
10953
|
_this._disconnectRetryCount = _this._opts.disconnectRetryCount;
|
|
10954
|
+
_this._transferCost = new TransferCost();
|
|
10519
10955
|
_this._bufferService = new BufferService(_assertThisInitialized$3(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
|
|
10520
10956
|
_this._seiService = new SeiService(_assertThisInitialized$3(_this));
|
|
10521
10957
|
_this._bandwidthService = new BandwidthService({
|
|
@@ -10539,7 +10975,7 @@
|
|
|
10539
10975
|
_createClass$4(Flv2, [{
|
|
10540
10976
|
key: "version",
|
|
10541
10977
|
get: function get() {
|
|
10542
|
-
return "3.0.
|
|
10978
|
+
return "3.0.21-rc.5";
|
|
10543
10979
|
}
|
|
10544
10980
|
}, {
|
|
10545
10981
|
key: "isLive",
|
|
@@ -10655,9 +11091,9 @@
|
|
|
10655
11091
|
return this._clear();
|
|
10656
11092
|
case 8:
|
|
10657
11093
|
setTimeout(function() {
|
|
11094
|
+
_this2._seamlessSwitching = true;
|
|
10658
11095
|
_this2._loadData(_this2._opts.url);
|
|
10659
11096
|
_this2._bufferService.seamlessSwitch();
|
|
10660
|
-
_this2._seamlessSwitching = true;
|
|
10661
11097
|
});
|
|
10662
11098
|
_context5.next = 13;
|
|
10663
11099
|
break;
|
|
@@ -10681,50 +11117,82 @@
|
|
|
10681
11117
|
}, {
|
|
10682
11118
|
key: "disconnect",
|
|
10683
11119
|
value: function disconnect() {
|
|
11120
|
+
var _this$_bufferService4;
|
|
10684
11121
|
logger.debug("disconnect!");
|
|
11122
|
+
(_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
|
|
10685
11123
|
return this._clear();
|
|
10686
11124
|
}
|
|
10687
11125
|
}, {
|
|
10688
11126
|
key: "switchURL",
|
|
10689
11127
|
value: function() {
|
|
10690
|
-
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
11128
|
+
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(url, seamless) {
|
|
10691
11129
|
var _this3 = this;
|
|
10692
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11130
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
10693
11131
|
while (1)
|
|
10694
|
-
switch (
|
|
11132
|
+
switch (_context7.prev = _context7.next) {
|
|
10695
11133
|
case 0:
|
|
10696
11134
|
if (this._bufferService) {
|
|
10697
|
-
|
|
11135
|
+
_context7.next = 2;
|
|
10698
11136
|
break;
|
|
10699
11137
|
}
|
|
10700
|
-
return
|
|
11138
|
+
return _context7.abrupt("return");
|
|
10701
11139
|
case 2:
|
|
10702
11140
|
this._resetDisconnectCount();
|
|
11141
|
+
if (!(this._loading && seamless)) {
|
|
11142
|
+
_context7.next = 6;
|
|
11143
|
+
break;
|
|
11144
|
+
}
|
|
11145
|
+
this._bufferService.seamlessLoadingSwitch = /* @__PURE__ */ function() {
|
|
11146
|
+
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(pts) {
|
|
11147
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
11148
|
+
while (1)
|
|
11149
|
+
switch (_context6.prev = _context6.next) {
|
|
11150
|
+
case 0:
|
|
11151
|
+
_context6.next = 2;
|
|
11152
|
+
return _this3._clear();
|
|
11153
|
+
case 2:
|
|
11154
|
+
_this3._bufferService.seamlessLoadingSwitching = true;
|
|
11155
|
+
_this3._urlSwitching = true;
|
|
11156
|
+
_this3._seamlessSwitching = true;
|
|
11157
|
+
_this3._bufferService.seamlessSwitch();
|
|
11158
|
+
_this3._loadData(url);
|
|
11159
|
+
case 7:
|
|
11160
|
+
case "end":
|
|
11161
|
+
return _context6.stop();
|
|
11162
|
+
}
|
|
11163
|
+
}, _callee6);
|
|
11164
|
+
}));
|
|
11165
|
+
return function(_x8) {
|
|
11166
|
+
return _ref5.apply(this, arguments);
|
|
11167
|
+
};
|
|
11168
|
+
}();
|
|
11169
|
+
return _context7.abrupt("return");
|
|
11170
|
+
case 6:
|
|
10703
11171
|
if (!(!seamless || !this._opts.isLive)) {
|
|
10704
|
-
|
|
11172
|
+
_context7.next = 11;
|
|
10705
11173
|
break;
|
|
10706
11174
|
}
|
|
10707
|
-
|
|
11175
|
+
_context7.next = 9;
|
|
10708
11176
|
return this.load(url);
|
|
10709
|
-
case
|
|
11177
|
+
case 9:
|
|
10710
11178
|
this._urlSwitching = true;
|
|
10711
|
-
return
|
|
11179
|
+
return _context7.abrupt("return", this.media.play(true).catch(function() {
|
|
10712
11180
|
}));
|
|
10713
|
-
case
|
|
10714
|
-
|
|
11181
|
+
case 11:
|
|
11182
|
+
_context7.next = 13;
|
|
10715
11183
|
return this._clear();
|
|
10716
|
-
case
|
|
11184
|
+
case 13:
|
|
10717
11185
|
setTimeout(function() {
|
|
10718
11186
|
_this3._urlSwitching = true;
|
|
10719
11187
|
_this3._seamlessSwitching = true;
|
|
10720
11188
|
_this3._loadData(url);
|
|
10721
11189
|
_this3._bufferService.seamlessSwitch();
|
|
10722
11190
|
});
|
|
10723
|
-
case
|
|
11191
|
+
case 14:
|
|
10724
11192
|
case "end":
|
|
10725
|
-
return
|
|
11193
|
+
return _context7.stop();
|
|
10726
11194
|
}
|
|
10727
|
-
},
|
|
11195
|
+
}, _callee7, this);
|
|
10728
11196
|
}));
|
|
10729
11197
|
function switchURL(_x6, _x7) {
|
|
10730
11198
|
return _switchURL.apply(this, arguments);
|
|
@@ -10734,16 +11202,16 @@
|
|
|
10734
11202
|
}, {
|
|
10735
11203
|
key: "destroy",
|
|
10736
11204
|
value: function() {
|
|
10737
|
-
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10738
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11205
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
|
|
11206
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
10739
11207
|
while (1)
|
|
10740
|
-
switch (
|
|
11208
|
+
switch (_context8.prev = _context8.next) {
|
|
10741
11209
|
case 0:
|
|
10742
11210
|
if (this.media) {
|
|
10743
|
-
|
|
11211
|
+
_context8.next = 2;
|
|
10744
11212
|
break;
|
|
10745
11213
|
}
|
|
10746
|
-
return
|
|
11214
|
+
return _context8.abrupt("return");
|
|
10747
11215
|
case 2:
|
|
10748
11216
|
this.removeAllListeners();
|
|
10749
11217
|
this._seiService.reset();
|
|
@@ -10753,16 +11221,16 @@
|
|
|
10753
11221
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10754
11222
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10755
11223
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10756
|
-
|
|
11224
|
+
_context8.next = 12;
|
|
10757
11225
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10758
11226
|
case 12:
|
|
10759
11227
|
this.media = null;
|
|
10760
11228
|
this._bufferService = null;
|
|
10761
11229
|
case 14:
|
|
10762
11230
|
case "end":
|
|
10763
|
-
return
|
|
11231
|
+
return _context8.stop();
|
|
10764
11232
|
}
|
|
10765
|
-
},
|
|
11233
|
+
}, _callee8, this);
|
|
10766
11234
|
}));
|
|
10767
11235
|
function destroy() {
|
|
10768
11236
|
return _destroy.apply(this, arguments);
|
|
@@ -10791,26 +11259,26 @@
|
|
|
10791
11259
|
}, {
|
|
10792
11260
|
key: "_reset",
|
|
10793
11261
|
value: function() {
|
|
10794
|
-
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10795
|
-
var reuseMse,
|
|
10796
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11262
|
+
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
|
|
11263
|
+
var reuseMse, _args9 = arguments;
|
|
11264
|
+
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
10797
11265
|
while (1)
|
|
10798
|
-
switch (
|
|
11266
|
+
switch (_context9.prev = _context9.next) {
|
|
10799
11267
|
case 0:
|
|
10800
|
-
reuseMse =
|
|
11268
|
+
reuseMse = _args9.length > 0 && _args9[0] !== void 0 ? _args9[0] : false;
|
|
10801
11269
|
this._seiService.reset();
|
|
10802
11270
|
this._bandwidthService.reset();
|
|
10803
11271
|
this._stats.reset();
|
|
10804
|
-
|
|
11272
|
+
_context9.next = 6;
|
|
10805
11273
|
return this._clear();
|
|
10806
11274
|
case 6:
|
|
10807
|
-
|
|
11275
|
+
_context9.next = 8;
|
|
10808
11276
|
return this._bufferService.reset(reuseMse);
|
|
10809
11277
|
case 8:
|
|
10810
11278
|
case "end":
|
|
10811
|
-
return
|
|
11279
|
+
return _context9.stop();
|
|
10812
11280
|
}
|
|
10813
|
-
},
|
|
11281
|
+
}, _callee9, this);
|
|
10814
11282
|
}));
|
|
10815
11283
|
function _reset() {
|
|
10816
11284
|
return _reset2.apply(this, arguments);
|
|
@@ -10820,17 +11288,17 @@
|
|
|
10820
11288
|
}, {
|
|
10821
11289
|
key: "_loadData",
|
|
10822
11290
|
value: function() {
|
|
10823
|
-
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
11291
|
+
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10(url, range) {
|
|
10824
11292
|
var finnalUrl;
|
|
10825
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11293
|
+
return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
|
|
10826
11294
|
while (1)
|
|
10827
|
-
switch (
|
|
11295
|
+
switch (_context10.prev = _context10.next) {
|
|
10828
11296
|
case 0:
|
|
10829
11297
|
if (url)
|
|
10830
11298
|
this._opts.url = url;
|
|
10831
11299
|
finnalUrl = url = this._opts.url;
|
|
10832
11300
|
if (url) {
|
|
10833
|
-
|
|
11301
|
+
_context10.next = 4;
|
|
10834
11302
|
break;
|
|
10835
11303
|
}
|
|
10836
11304
|
throw new Error("Source url is missing");
|
|
@@ -10845,34 +11313,34 @@
|
|
|
10845
11313
|
});
|
|
10846
11314
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
10847
11315
|
if (!this._loading) {
|
|
10848
|
-
|
|
11316
|
+
_context10.next = 11;
|
|
10849
11317
|
break;
|
|
10850
11318
|
}
|
|
10851
|
-
|
|
11319
|
+
_context10.next = 11;
|
|
10852
11320
|
return this._mediaLoader.cancel();
|
|
10853
11321
|
case 11:
|
|
10854
11322
|
this._loading = true;
|
|
10855
|
-
|
|
10856
|
-
|
|
11323
|
+
_context10.prev = 12;
|
|
11324
|
+
_context10.next = 15;
|
|
10857
11325
|
return this._mediaLoader.load({
|
|
10858
11326
|
url: finnalUrl,
|
|
10859
11327
|
range
|
|
10860
11328
|
});
|
|
10861
11329
|
case 15:
|
|
10862
|
-
|
|
11330
|
+
_context10.next = 21;
|
|
10863
11331
|
break;
|
|
10864
11332
|
case 17:
|
|
10865
|
-
|
|
10866
|
-
|
|
11333
|
+
_context10.prev = 17;
|
|
11334
|
+
_context10.t0 = _context10["catch"](12);
|
|
10867
11335
|
this._loading = false;
|
|
10868
|
-
return
|
|
11336
|
+
return _context10.abrupt("return", this._emitError(StreamingError.network(_context10.t0), false));
|
|
10869
11337
|
case 21:
|
|
10870
11338
|
case "end":
|
|
10871
|
-
return
|
|
11339
|
+
return _context10.stop();
|
|
10872
11340
|
}
|
|
10873
|
-
},
|
|
11341
|
+
}, _callee10, this, [[12, 17]]);
|
|
10874
11342
|
}));
|
|
10875
|
-
function _loadData(
|
|
11343
|
+
function _loadData(_x9, _x10) {
|
|
10876
11344
|
return _loadData2.apply(this, arguments);
|
|
10877
11345
|
}
|
|
10878
11346
|
return _loadData;
|
|
@@ -10880,16 +11348,16 @@
|
|
|
10880
11348
|
}, {
|
|
10881
11349
|
key: "_clear",
|
|
10882
11350
|
value: function() {
|
|
10883
|
-
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10884
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11351
|
+
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee11() {
|
|
11352
|
+
return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
|
|
10885
11353
|
while (1)
|
|
10886
|
-
switch (
|
|
11354
|
+
switch (_context11.prev = _context11.next) {
|
|
10887
11355
|
case 0:
|
|
10888
11356
|
if (!this._mediaLoader) {
|
|
10889
|
-
|
|
11357
|
+
_context11.next = 3;
|
|
10890
11358
|
break;
|
|
10891
11359
|
}
|
|
10892
|
-
|
|
11360
|
+
_context11.next = 3;
|
|
10893
11361
|
return this._mediaLoader.cancel();
|
|
10894
11362
|
case 3:
|
|
10895
11363
|
clearTimeout(this._maxChunkWaitTimer);
|
|
@@ -10898,9 +11366,9 @@
|
|
|
10898
11366
|
this._firstProgressEmit = false;
|
|
10899
11367
|
case 7:
|
|
10900
11368
|
case "end":
|
|
10901
|
-
return
|
|
11369
|
+
return _context11.stop();
|
|
10902
11370
|
}
|
|
10903
|
-
},
|
|
11371
|
+
}, _callee11, this);
|
|
10904
11372
|
}));
|
|
10905
11373
|
function _clear() {
|
|
10906
11374
|
return _clear2.apply(this, arguments);
|
|
@@ -10987,9 +11455,13 @@
|
|
|
10987
11455
|
_createClass$4(PluginExtension2, [{
|
|
10988
11456
|
key: "_init",
|
|
10989
11457
|
value: function _init() {
|
|
10990
|
-
var _this$_opts2 = this._opts, media = _this$_opts2.media, preloadTime = _this$_opts2.preloadTime, innerDegrade = _this$_opts2.innerDegrade, decodeMode = _this$_opts2.decodeMode;
|
|
11458
|
+
var _this$_opts2 = this._opts, media = _this$_opts2.media, isLive = _this$_opts2.isLive, preloadTime = _this$_opts2.preloadTime, innerDegrade = _this$_opts2.innerDegrade, decodeMode = _this$_opts2.decodeMode;
|
|
10991
11459
|
if (!media)
|
|
10992
11460
|
return;
|
|
11461
|
+
if (!isLive && media.setPlayMode) {
|
|
11462
|
+
media.setPlayMode("VOD");
|
|
11463
|
+
return;
|
|
11464
|
+
}
|
|
10993
11465
|
if (innerDegrade) {
|
|
10994
11466
|
media.setAttribute("innerdegrade", innerDegrade);
|
|
10995
11467
|
}
|
|
@@ -11027,6 +11499,7 @@
|
|
|
11027
11499
|
args[_key] = arguments[_key];
|
|
11028
11500
|
}
|
|
11029
11501
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
11502
|
+
_defineProperty$3(_assertThisInitialized$3(_this), "logger", logger);
|
|
11030
11503
|
_defineProperty$3(_assertThisInitialized$3(_this), "flv", null);
|
|
11031
11504
|
_defineProperty$3(_assertThisInitialized$3(_this), "pluginExtension", null);
|
|
11032
11505
|
_defineProperty$3(_assertThisInitialized$3(_this), "getStats", function() {
|
|
@@ -11094,11 +11567,17 @@
|
|
|
11094
11567
|
var _this$flv3;
|
|
11095
11568
|
return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
|
|
11096
11569
|
}
|
|
11570
|
+
}, {
|
|
11571
|
+
key: "transferCost",
|
|
11572
|
+
get: function get() {
|
|
11573
|
+
return this.flv._transferCost.transferCost;
|
|
11574
|
+
}
|
|
11097
11575
|
}, {
|
|
11098
11576
|
key: "beforePlayerInit",
|
|
11099
11577
|
value: function beforePlayerInit() {
|
|
11100
11578
|
var _this2 = this;
|
|
11101
11579
|
var config = this.player.config;
|
|
11580
|
+
var mediaElem = this.player.media || this.player.video;
|
|
11102
11581
|
if (!config.url)
|
|
11103
11582
|
return;
|
|
11104
11583
|
if (this.flv)
|
|
@@ -11111,10 +11590,10 @@
|
|
|
11111
11590
|
this.flv = new Flv(_objectSpread2$2({
|
|
11112
11591
|
softDecode: this.softDecode,
|
|
11113
11592
|
isLive: config.isLive,
|
|
11114
|
-
media:
|
|
11593
|
+
media: mediaElem,
|
|
11115
11594
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
11116
|
-
var _this2$player
|
|
11117
|
-
return ((_this2$player
|
|
11595
|
+
var _this2$player, _this2$player$preProc;
|
|
11596
|
+
return ((_this2$player = _this2.player) === null || _this2$player === void 0 ? void 0 : (_this2$player$preProc = _this2$player.preProcessUrl) === null || _this2$player$preProc === void 0 ? void 0 : _this2$player$preProc.call(_this2$player, url, ext)) || {
|
|
11118
11597
|
url,
|
|
11119
11598
|
ext
|
|
11120
11599
|
};
|
|
@@ -11133,7 +11612,8 @@
|
|
|
11133
11612
|
}
|
|
11134
11613
|
if (this.softDecode) {
|
|
11135
11614
|
this.pluginExtension = new PluginExtension(_objectSpread2$2({
|
|
11136
|
-
media: this.player.video
|
|
11615
|
+
media: this.player.video,
|
|
11616
|
+
isLive: config.isLive
|
|
11137
11617
|
}, config.flv), this);
|
|
11138
11618
|
this.player.forceDegradeToVideo = function() {
|
|
11139
11619
|
var _this2$pluginExtensio;
|
|
@@ -11160,6 +11640,7 @@
|
|
|
11160
11640
|
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
11161
11641
|
this._transCoreEvent(EVENT.SOURCEBUFFER_CREATED);
|
|
11162
11642
|
this._transCoreEvent(EVENT.ANALYZE_DURATION_EXCEEDED);
|
|
11643
|
+
this._transCoreEvent(EVENT.APPEND_BUFFER);
|
|
11163
11644
|
this._transCoreEvent(EVENT.REMOVE_BUFFER);
|
|
11164
11645
|
this._transCoreEvent(EVENT.BUFFEREOS);
|
|
11165
11646
|
this._transCoreEvent(EVENT.KEYFRAME);
|