@byteplus/veplayer-plugin 2.4.1-rc.0 → 2.4.1-rc.1
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.development.js +43368 -42048
- package/esm/index.production.js +3 -3
- package/esm/veplayer.plugin.abr.development.js +2555 -2238
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +402 -156
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +738 -79
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +2 -2
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +1 -1
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.plugin.shaka.development.js +1 -1
- package/esm/veplayer.plugin.shaka.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.abr.development.js +2555 -2238
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +402 -156
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +738 -79
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +2 -2
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +1 -1
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +1 -1
- package/umd/veplayer.plugin.shaka.production.js +1 -1
|
@@ -1542,7 +1542,7 @@
|
|
|
1542
1542
|
}
|
|
1543
1543
|
return offsetTime;
|
|
1544
1544
|
};
|
|
1545
|
-
var version = "3.0.
|
|
1545
|
+
var version = "3.0.20-rc.3";
|
|
1546
1546
|
var ERROR_MAP = {
|
|
1547
1547
|
1: 5101,
|
|
1548
1548
|
2: 5102,
|
|
@@ -5542,6 +5542,7 @@
|
|
|
5542
5542
|
METADATA: "metadata"
|
|
5543
5543
|
};
|
|
5544
5544
|
var VideoCodecType = {
|
|
5545
|
+
AV1: "av1",
|
|
5545
5546
|
AVC: "avc",
|
|
5546
5547
|
HEVC: "hevc"
|
|
5547
5548
|
};
|
|
@@ -5588,6 +5589,7 @@
|
|
|
5588
5589
|
_defineProperty(this, "isVideoEncryption", false);
|
|
5589
5590
|
_defineProperty(this, "isAudioEncryption", false);
|
|
5590
5591
|
_defineProperty(this, "isVideo", true);
|
|
5592
|
+
_defineProperty(this, "lastKeyFrameDts", 0);
|
|
5591
5593
|
_defineProperty(this, "kid", null);
|
|
5592
5594
|
_defineProperty(this, "pssh", null);
|
|
5593
5595
|
_defineProperty(this, "ext", void 0);
|
|
@@ -5630,6 +5632,9 @@
|
|
|
5630
5632
|
}, {
|
|
5631
5633
|
key: "exist",
|
|
5632
5634
|
value: function exist() {
|
|
5635
|
+
if (/av01/.test(this.codec)) {
|
|
5636
|
+
return true;
|
|
5637
|
+
}
|
|
5633
5638
|
return !!(this.pps.length && this.sps.length && this.codec);
|
|
5634
5639
|
}
|
|
5635
5640
|
}, {
|
|
@@ -7325,6 +7330,7 @@
|
|
|
7325
7330
|
value: function demux(data) {
|
|
7326
7331
|
var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
7327
7332
|
var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
7333
|
+
var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
|
|
7328
7334
|
var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
|
|
7329
7335
|
if (discontinuity || !contiguous) {
|
|
7330
7336
|
this._remainingData = null;
|
|
@@ -7382,6 +7388,8 @@
|
|
|
7382
7388
|
if (tagType === 8) {
|
|
7383
7389
|
this._parseAudio(bodyData, timestamp);
|
|
7384
7390
|
} else if (tagType === 9) {
|
|
7391
|
+
if (seamlessLoadingSwitching)
|
|
7392
|
+
this.seamlessLoadingSwitching = true;
|
|
7385
7393
|
this._parseVideo(bodyData, timestamp);
|
|
7386
7394
|
} else if (tagType === 18) {
|
|
7387
7395
|
this._parseScript(bodyData, timestamp);
|
|
@@ -7424,8 +7432,8 @@
|
|
|
7424
7432
|
}
|
|
7425
7433
|
}, {
|
|
7426
7434
|
key: "demuxAndFix",
|
|
7427
|
-
value: function demuxAndFix(data, discontinuity, contiguous, startTime) {
|
|
7428
|
-
this.demux(data, discontinuity, contiguous);
|
|
7435
|
+
value: function demuxAndFix(data, discontinuity, contiguous, startTime, seamlessLoadingSwitching) {
|
|
7436
|
+
this.demux(data, discontinuity, contiguous, seamlessLoadingSwitching);
|
|
7429
7437
|
return this.fix(startTime, discontinuity, contiguous);
|
|
7430
7438
|
}
|
|
7431
7439
|
}, {
|
|
@@ -7539,8 +7547,13 @@
|
|
|
7539
7547
|
units = this._checkAddMetaNalToUnits(isHevc, units, track);
|
|
7540
7548
|
if (units && units.length) {
|
|
7541
7549
|
var sample = new VideoSample(dts + cts, dts, units);
|
|
7550
|
+
if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
|
|
7551
|
+
return;
|
|
7552
|
+
}
|
|
7553
|
+
this.seamlessLoadingSwitching = false;
|
|
7542
7554
|
if (frameType === 1) {
|
|
7543
7555
|
sample.setToKeyframe();
|
|
7556
|
+
track.lastKeyFrameDts = dts;
|
|
7544
7557
|
}
|
|
7545
7558
|
track.samples.push(sample);
|
|
7546
7559
|
units.forEach(function(unit) {
|
|
@@ -8018,6 +8031,8 @@
|
|
|
8018
8031
|
}
|
|
8019
8032
|
} else if (track.useEME && track.encv) {
|
|
8020
8033
|
content = MP42.encv(track);
|
|
8034
|
+
} else if (track.av1C) {
|
|
8035
|
+
content = MP42.av01(track);
|
|
8021
8036
|
} else {
|
|
8022
8037
|
content = MP42.avc1hev1(track);
|
|
8023
8038
|
}
|
|
@@ -8230,6 +8245,90 @@
|
|
|
8230
8245
|
var schi = MP42.schi(data);
|
|
8231
8246
|
return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
|
|
8232
8247
|
}
|
|
8248
|
+
}, {
|
|
8249
|
+
key: "av01",
|
|
8250
|
+
value: function av01(track) {
|
|
8251
|
+
return MP42.box(MP42.types.av01, new Uint8Array([
|
|
8252
|
+
0,
|
|
8253
|
+
0,
|
|
8254
|
+
0,
|
|
8255
|
+
0,
|
|
8256
|
+
0,
|
|
8257
|
+
0,
|
|
8258
|
+
0,
|
|
8259
|
+
1,
|
|
8260
|
+
0,
|
|
8261
|
+
0,
|
|
8262
|
+
0,
|
|
8263
|
+
0,
|
|
8264
|
+
0,
|
|
8265
|
+
0,
|
|
8266
|
+
0,
|
|
8267
|
+
0,
|
|
8268
|
+
0,
|
|
8269
|
+
0,
|
|
8270
|
+
0,
|
|
8271
|
+
0,
|
|
8272
|
+
0,
|
|
8273
|
+
0,
|
|
8274
|
+
0,
|
|
8275
|
+
0,
|
|
8276
|
+
track.width >> 8 & 255,
|
|
8277
|
+
track.width & 255,
|
|
8278
|
+
track.height >> 8 & 255,
|
|
8279
|
+
track.height & 255,
|
|
8280
|
+
0,
|
|
8281
|
+
72,
|
|
8282
|
+
0,
|
|
8283
|
+
0,
|
|
8284
|
+
0,
|
|
8285
|
+
72,
|
|
8286
|
+
0,
|
|
8287
|
+
0,
|
|
8288
|
+
0,
|
|
8289
|
+
0,
|
|
8290
|
+
0,
|
|
8291
|
+
0,
|
|
8292
|
+
0,
|
|
8293
|
+
1,
|
|
8294
|
+
0,
|
|
8295
|
+
0,
|
|
8296
|
+
0,
|
|
8297
|
+
0,
|
|
8298
|
+
0,
|
|
8299
|
+
0,
|
|
8300
|
+
0,
|
|
8301
|
+
0,
|
|
8302
|
+
0,
|
|
8303
|
+
0,
|
|
8304
|
+
0,
|
|
8305
|
+
0,
|
|
8306
|
+
0,
|
|
8307
|
+
0,
|
|
8308
|
+
0,
|
|
8309
|
+
0,
|
|
8310
|
+
0,
|
|
8311
|
+
0,
|
|
8312
|
+
0,
|
|
8313
|
+
0,
|
|
8314
|
+
0,
|
|
8315
|
+
0,
|
|
8316
|
+
0,
|
|
8317
|
+
0,
|
|
8318
|
+
0,
|
|
8319
|
+
0,
|
|
8320
|
+
0,
|
|
8321
|
+
0,
|
|
8322
|
+
0,
|
|
8323
|
+
0,
|
|
8324
|
+
0,
|
|
8325
|
+
0,
|
|
8326
|
+
0,
|
|
8327
|
+
24,
|
|
8328
|
+
17,
|
|
8329
|
+
17
|
|
8330
|
+
]), track.av1C, track.colr);
|
|
8331
|
+
}
|
|
8233
8332
|
}, {
|
|
8234
8333
|
key: "avc1hev1",
|
|
8235
8334
|
value: function avc1hev1(track) {
|
|
@@ -9202,7 +9301,7 @@
|
|
|
9202
9301
|
}]);
|
|
9203
9302
|
return MP42;
|
|
9204
9303
|
}();
|
|
9205
|
-
_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) {
|
|
9304
|
+
_defineProperty(MP4, "types", ["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) {
|
|
9206
9305
|
p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
|
|
9207
9306
|
return p;
|
|
9208
9307
|
}, /* @__PURE__ */ Object.create(null)));
|
|
@@ -9537,30 +9636,46 @@
|
|
|
9537
9636
|
};
|
|
9538
9637
|
}
|
|
9539
9638
|
var samples = track.samples;
|
|
9639
|
+
var isAV01 = /av01/.test(track.codec);
|
|
9540
9640
|
var mdatSize = 0;
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
}, 0);
|
|
9545
|
-
mdatSize += s.units.length * 4;
|
|
9546
|
-
});
|
|
9547
|
-
var mdata = new Uint8Array(mdatSize);
|
|
9548
|
-
var mdatView = new DataView(mdata.buffer);
|
|
9549
|
-
var _loop = function _loop2(_offset, _sample) {
|
|
9550
|
-
_sample = samples[i];
|
|
9551
|
-
var sampleSize = 0;
|
|
9552
|
-
_sample.units.forEach(function(u) {
|
|
9553
|
-
mdatView.setUint32(_offset, u.byteLength);
|
|
9554
|
-
_offset += 4;
|
|
9555
|
-
mdata.set(u, _offset);
|
|
9556
|
-
_offset += u.byteLength;
|
|
9557
|
-
sampleSize += 4 + u.byteLength;
|
|
9641
|
+
if (isAV01) {
|
|
9642
|
+
samples.forEach(function(s) {
|
|
9643
|
+
mdatSize += s.data.byteLength;
|
|
9558
9644
|
});
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
|
|
9645
|
+
} else {
|
|
9646
|
+
samples.forEach(function(s) {
|
|
9647
|
+
mdatSize += s.units.reduce(function(t, c) {
|
|
9648
|
+
return t + c.byteLength;
|
|
9649
|
+
}, 0);
|
|
9650
|
+
mdatSize += s.units.length * 4;
|
|
9651
|
+
});
|
|
9652
|
+
}
|
|
9653
|
+
var mdata = new Uint8Array(mdatSize);
|
|
9654
|
+
if (isAV01) {
|
|
9655
|
+
for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
|
|
9656
|
+
sample = samples[i];
|
|
9657
|
+
mdata.set(sample.data, offset);
|
|
9658
|
+
sample.size = sample.data.byteLength;
|
|
9659
|
+
offset += sample.size;
|
|
9660
|
+
}
|
|
9661
|
+
} else {
|
|
9662
|
+
var mdatView = new DataView(mdata.buffer);
|
|
9663
|
+
var _loop = function _loop2(_offset2, _sample2) {
|
|
9664
|
+
_sample2 = samples[_i];
|
|
9665
|
+
var sampleSize = 0;
|
|
9666
|
+
_sample2.units.forEach(function(u) {
|
|
9667
|
+
mdatView.setUint32(_offset2, u.byteLength);
|
|
9668
|
+
_offset2 += 4;
|
|
9669
|
+
mdata.set(u, _offset2);
|
|
9670
|
+
_offset2 += u.byteLength;
|
|
9671
|
+
sampleSize += 4 + u.byteLength;
|
|
9672
|
+
});
|
|
9673
|
+
_sample2.size = sampleSize;
|
|
9674
|
+
_offset = _offset2, _sample = _sample2;
|
|
9675
|
+
};
|
|
9676
|
+
for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
|
|
9677
|
+
_loop(_offset, _sample);
|
|
9678
|
+
}
|
|
9564
9679
|
}
|
|
9565
9680
|
var mdat = MP4.mdat(mdata);
|
|
9566
9681
|
var moof = MP4.moof([track]);
|
|
@@ -9590,6 +9705,55 @@
|
|
|
9590
9705
|
}]);
|
|
9591
9706
|
return FMP4Remuxer2;
|
|
9592
9707
|
}();
|
|
9708
|
+
var TransferCost = /* @__PURE__ */ function() {
|
|
9709
|
+
function TransferCost2() {
|
|
9710
|
+
_classCallCheck$4(this, TransferCost2);
|
|
9711
|
+
_defineProperty$3(this, "_ttfb", 0);
|
|
9712
|
+
_defineProperty$3(this, "_demuxStart", 0);
|
|
9713
|
+
_defineProperty$3(this, "_demuxEnd", 0);
|
|
9714
|
+
_defineProperty$3(this, "_demuxCost", 0);
|
|
9715
|
+
_defineProperty$3(this, "_remuxStart", 0);
|
|
9716
|
+
_defineProperty$3(this, "_remuxEnd", 0);
|
|
9717
|
+
_defineProperty$3(this, "_remuxCost", 0);
|
|
9718
|
+
_defineProperty$3(this, "_appendStart", 0);
|
|
9719
|
+
_defineProperty$3(this, "_appendEnd", 0);
|
|
9720
|
+
_defineProperty$3(this, "_appendCost", 0);
|
|
9721
|
+
}
|
|
9722
|
+
_createClass$4(TransferCost2, [{
|
|
9723
|
+
key: "set",
|
|
9724
|
+
value: function set(event, value) {
|
|
9725
|
+
this["_".concat(event)] = value;
|
|
9726
|
+
}
|
|
9727
|
+
}, {
|
|
9728
|
+
key: "start",
|
|
9729
|
+
value: function start(event) {
|
|
9730
|
+
this["_".concat(event, "Start")] = Date.now();
|
|
9731
|
+
}
|
|
9732
|
+
}, {
|
|
9733
|
+
key: "end",
|
|
9734
|
+
value: function end(event) {
|
|
9735
|
+
this["_".concat(event, "End")] = Date.now();
|
|
9736
|
+
this["_".concat(event, "Cost")] = this["_".concat(event, "Cost")] + (this["_".concat(event, "End")] - this["_".concat(event, "Start")]);
|
|
9737
|
+
}
|
|
9738
|
+
}, {
|
|
9739
|
+
key: "transferCost",
|
|
9740
|
+
get: function get() {
|
|
9741
|
+
return {
|
|
9742
|
+
ttfbCost: this._ttfb,
|
|
9743
|
+
demuxCost: this._demuxCost,
|
|
9744
|
+
remuxCost: this._remuxCost,
|
|
9745
|
+
appendCost: this._appendCost
|
|
9746
|
+
};
|
|
9747
|
+
}
|
|
9748
|
+
}]);
|
|
9749
|
+
return TransferCost2;
|
|
9750
|
+
}();
|
|
9751
|
+
var TRANSFER_EVENT = {
|
|
9752
|
+
TTFB: "ttfb",
|
|
9753
|
+
DEMUX: "demux",
|
|
9754
|
+
REMUX: "remux",
|
|
9755
|
+
APPEND: "append"
|
|
9756
|
+
};
|
|
9593
9757
|
var logger$1 = new Logger$2("BufferService");
|
|
9594
9758
|
var BufferService = /* @__PURE__ */ function() {
|
|
9595
9759
|
function BufferService2(flv, softVideo) {
|
|
@@ -9677,7 +9841,8 @@
|
|
|
9677
9841
|
this._contiguous = false;
|
|
9678
9842
|
this._sourceCreated = false;
|
|
9679
9843
|
this._initSegmentId = "";
|
|
9680
|
-
|
|
9844
|
+
this.resetSeamlessSwitchStats();
|
|
9845
|
+
case 12:
|
|
9681
9846
|
case "end":
|
|
9682
9847
|
return _context.stop();
|
|
9683
9848
|
}
|
|
@@ -9688,6 +9853,15 @@
|
|
|
9688
9853
|
}
|
|
9689
9854
|
return reset;
|
|
9690
9855
|
}()
|
|
9856
|
+
}, {
|
|
9857
|
+
key: "resetSeamlessSwitchStats",
|
|
9858
|
+
value: function resetSeamlessSwitchStats() {
|
|
9859
|
+
this.seamlessLoadingSwitch = null;
|
|
9860
|
+
this.seamlessLoadingSwitching = false;
|
|
9861
|
+
if (this._demuxer) {
|
|
9862
|
+
this._demuxer.seamlessLoadingSwitching = false;
|
|
9863
|
+
}
|
|
9864
|
+
}
|
|
9691
9865
|
}, {
|
|
9692
9866
|
key: "endOfStream",
|
|
9693
9867
|
value: function() {
|
|
@@ -9793,32 +9967,56 @@
|
|
|
9793
9967
|
key: "appendBuffer",
|
|
9794
9968
|
value: function() {
|
|
9795
9969
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(chunk) {
|
|
9796
|
-
var
|
|
9970
|
+
var _this = this;
|
|
9971
|
+
var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
|
|
9797
9972
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
9798
9973
|
while (1)
|
|
9799
9974
|
switch (_context5.prev = _context5.next) {
|
|
9800
9975
|
case 0:
|
|
9976
|
+
switchingNoReset = false;
|
|
9801
9977
|
if (this._cachedBuffer) {
|
|
9802
9978
|
chunk = concatUint8Array$1(this._cachedBuffer, chunk);
|
|
9803
9979
|
this._cachedBuffer = null;
|
|
9804
9980
|
}
|
|
9805
9981
|
demuxer = this._demuxer;
|
|
9806
9982
|
if (!(!chunk || !chunk.length || !demuxer)) {
|
|
9807
|
-
_context5.next =
|
|
9983
|
+
_context5.next = 5;
|
|
9808
9984
|
break;
|
|
9809
9985
|
}
|
|
9810
9986
|
return _context5.abrupt("return");
|
|
9811
|
-
case
|
|
9812
|
-
_context5.prev =
|
|
9813
|
-
|
|
9814
|
-
|
|
9987
|
+
case 5:
|
|
9988
|
+
_context5.prev = 5;
|
|
9989
|
+
this.flv._transferCost.start(TRANSFER_EVENT.DEMUX);
|
|
9990
|
+
demuxer.demuxAndFix(chunk, this.seamlessLoadingSwitching || this._discontinuity, this._contiguous, this._demuxStartTime, this.seamlessLoadingSwitching);
|
|
9991
|
+
this.seamlessLoadingSwitching = false;
|
|
9992
|
+
this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
|
|
9993
|
+
_context5.next = 15;
|
|
9815
9994
|
break;
|
|
9816
|
-
case
|
|
9817
|
-
_context5.prev =
|
|
9818
|
-
_context5.t0 = _context5["catch"](
|
|
9995
|
+
case 12:
|
|
9996
|
+
_context5.prev = 12;
|
|
9997
|
+
_context5.t0 = _context5["catch"](5);
|
|
9819
9998
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, _context5.t0);
|
|
9820
|
-
case
|
|
9999
|
+
case 15:
|
|
9821
10000
|
videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
|
|
10001
|
+
if (!this.seamlessLoadingSwitch) {
|
|
10002
|
+
_context5.next = 25;
|
|
10003
|
+
break;
|
|
10004
|
+
}
|
|
10005
|
+
idx = videoTrack.samples.findIndex(function(sample) {
|
|
10006
|
+
return sample.originDts === videoTrack.lastKeyFrameDts;
|
|
10007
|
+
});
|
|
10008
|
+
if (!(idx >= 0)) {
|
|
10009
|
+
_context5.next = 25;
|
|
10010
|
+
break;
|
|
10011
|
+
}
|
|
10012
|
+
videoTrack.samples.splice(idx);
|
|
10013
|
+
_context5.next = 22;
|
|
10014
|
+
return this.seamlessLoadingSwitch();
|
|
10015
|
+
case 22:
|
|
10016
|
+
this.seamlessLoadingSwitch = null;
|
|
10017
|
+
chunk = null;
|
|
10018
|
+
switchingNoReset = true;
|
|
10019
|
+
case 25:
|
|
9822
10020
|
videoExist = videoTrack.exist();
|
|
9823
10021
|
audioExist = audioTrack.exist();
|
|
9824
10022
|
if (this._opts.onlyAudio) {
|
|
@@ -9830,7 +10028,7 @@
|
|
|
9830
10028
|
audioTrack.present = false;
|
|
9831
10029
|
}
|
|
9832
10030
|
if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
|
|
9833
|
-
_context5.next =
|
|
10031
|
+
_context5.next = 42;
|
|
9834
10032
|
break;
|
|
9835
10033
|
}
|
|
9836
10034
|
duration = 0;
|
|
@@ -9839,7 +10037,7 @@
|
|
|
9839
10037
|
duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
|
|
9840
10038
|
}
|
|
9841
10039
|
if (!(duration > this._opts.analyzeDuration)) {
|
|
9842
|
-
_context5.next =
|
|
10040
|
+
_context5.next = 40;
|
|
9843
10041
|
break;
|
|
9844
10042
|
}
|
|
9845
10043
|
logger$1.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
|
|
@@ -9848,18 +10046,20 @@
|
|
|
9848
10046
|
this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, {
|
|
9849
10047
|
duration
|
|
9850
10048
|
});
|
|
9851
|
-
_context5.next =
|
|
10049
|
+
_context5.next = 42;
|
|
9852
10050
|
break;
|
|
9853
|
-
case
|
|
10051
|
+
case 40:
|
|
9854
10052
|
this._cachedBuffer = chunk;
|
|
9855
10053
|
return _context5.abrupt("return");
|
|
9856
|
-
case
|
|
10054
|
+
case 42:
|
|
9857
10055
|
videoType = videoTrack.type;
|
|
9858
10056
|
audioType = audioTrack.type;
|
|
9859
10057
|
this._fireEvents(videoTrack, audioTrack, metadataTrack);
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
10058
|
+
if (!switchingNoReset) {
|
|
10059
|
+
this._discontinuity = false;
|
|
10060
|
+
this._contiguous = true;
|
|
10061
|
+
this._demuxStartTime = 0;
|
|
10062
|
+
}
|
|
9863
10063
|
mse = this._mse;
|
|
9864
10064
|
this.flv.emit(EVENT.DEMUXED_TRACK, {
|
|
9865
10065
|
videoTrack
|
|
@@ -9871,16 +10071,16 @@
|
|
|
9871
10071
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
9872
10072
|
}
|
|
9873
10073
|
if (!mse) {
|
|
9874
|
-
_context5.next =
|
|
10074
|
+
_context5.next = 80;
|
|
9875
10075
|
break;
|
|
9876
10076
|
}
|
|
9877
10077
|
if (this._sourceCreated) {
|
|
9878
|
-
_context5.next =
|
|
10078
|
+
_context5.next = 58;
|
|
9879
10079
|
break;
|
|
9880
10080
|
}
|
|
9881
|
-
_context5.next =
|
|
10081
|
+
_context5.next = 54;
|
|
9882
10082
|
return mse.open();
|
|
9883
|
-
case
|
|
10083
|
+
case 54:
|
|
9884
10084
|
if (videoExist) {
|
|
9885
10085
|
logger$1.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
|
|
9886
10086
|
mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
|
|
@@ -9891,26 +10091,28 @@
|
|
|
9891
10091
|
}
|
|
9892
10092
|
this._sourceCreated = true;
|
|
9893
10093
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
9894
|
-
case
|
|
9895
|
-
_context5.prev =
|
|
10094
|
+
case 58:
|
|
10095
|
+
_context5.prev = 58;
|
|
9896
10096
|
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
9897
10097
|
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
9898
10098
|
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
9899
10099
|
}
|
|
10100
|
+
this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
|
|
9900
10101
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
9901
|
-
|
|
10102
|
+
this.flv._transferCost.end(TRANSFER_EVENT.REMUX);
|
|
10103
|
+
_context5.next = 68;
|
|
9902
10104
|
break;
|
|
9903
|
-
case
|
|
9904
|
-
_context5.prev =
|
|
9905
|
-
_context5.t1 = _context5["catch"](
|
|
10105
|
+
case 65:
|
|
10106
|
+
_context5.prev = 65;
|
|
10107
|
+
_context5.t1 = _context5["catch"](58);
|
|
9906
10108
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
9907
|
-
case
|
|
10109
|
+
case 68:
|
|
9908
10110
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
9909
|
-
_context5.next =
|
|
10111
|
+
_context5.next = 70;
|
|
9910
10112
|
break;
|
|
9911
10113
|
}
|
|
9912
10114
|
return _context5.abrupt("return");
|
|
9913
|
-
case
|
|
10115
|
+
case 70:
|
|
9914
10116
|
this._needInitSegment = false;
|
|
9915
10117
|
p = [];
|
|
9916
10118
|
if (remuxResult.videoInitSegment)
|
|
@@ -9921,16 +10123,19 @@
|
|
|
9921
10123
|
p.push(mse.append(videoType, remuxResult.videoSegment));
|
|
9922
10124
|
if (remuxResult.audioSegment)
|
|
9923
10125
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
9924
|
-
|
|
9925
|
-
|
|
10126
|
+
this.flv._transferCost.start(TRANSFER_EVENT.APPEND);
|
|
10127
|
+
return _context5.abrupt("return", Promise.all(p).then(function() {
|
|
10128
|
+
_this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
|
|
10129
|
+
}));
|
|
10130
|
+
case 80:
|
|
9926
10131
|
if (this._softVideo) {
|
|
9927
10132
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
9928
10133
|
}
|
|
9929
|
-
case
|
|
10134
|
+
case 81:
|
|
9930
10135
|
case "end":
|
|
9931
10136
|
return _context5.stop();
|
|
9932
10137
|
}
|
|
9933
|
-
}, _callee5, this, [[
|
|
10138
|
+
}, _callee5, this, [[5, 12], [58, 65]]);
|
|
9934
10139
|
}));
|
|
9935
10140
|
function appendBuffer(_x2) {
|
|
9936
10141
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -9941,7 +10146,7 @@
|
|
|
9941
10146
|
key: "evictBuffer",
|
|
9942
10147
|
value: function() {
|
|
9943
10148
|
var _evictBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(bufferBehind) {
|
|
9944
|
-
var
|
|
10149
|
+
var _this2 = this;
|
|
9945
10150
|
var media, currentTime, removeEnd, start;
|
|
9946
10151
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
9947
10152
|
while (1)
|
|
@@ -9970,7 +10175,7 @@
|
|
|
9970
10175
|
return _context6.abrupt("return");
|
|
9971
10176
|
case 10:
|
|
9972
10177
|
return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
|
|
9973
|
-
return
|
|
10178
|
+
return _this2.flv.emit(EVENT.REMOVE_BUFFER, {
|
|
9974
10179
|
removeEnd
|
|
9975
10180
|
});
|
|
9976
10181
|
}));
|
|
@@ -10020,16 +10225,16 @@
|
|
|
10020
10225
|
}, {
|
|
10021
10226
|
key: "_fireEvents",
|
|
10022
10227
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
|
|
10023
|
-
var
|
|
10228
|
+
var _this3 = this;
|
|
10024
10229
|
logger$1.debug(videoTrack.samples, audioTrack.samples);
|
|
10025
10230
|
metadataTrack.flvScriptSamples.forEach(function(sample) {
|
|
10026
|
-
|
|
10231
|
+
_this3.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
|
|
10027
10232
|
logger$1.debug("flvScriptData", sample);
|
|
10028
10233
|
});
|
|
10029
10234
|
videoTrack.samples.forEach(function(sample) {
|
|
10030
10235
|
if (sample.keyframe) {
|
|
10031
|
-
|
|
10032
|
-
pts: sample.
|
|
10236
|
+
_this3.flv.emit(EVENT.KEYFRAME, {
|
|
10237
|
+
pts: sample.originPts
|
|
10033
10238
|
});
|
|
10034
10239
|
}
|
|
10035
10240
|
});
|
|
@@ -10047,7 +10252,7 @@
|
|
|
10047
10252
|
break;
|
|
10048
10253
|
}
|
|
10049
10254
|
if (type)
|
|
10050
|
-
|
|
10255
|
+
_this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10051
10256
|
type
|
|
10052
10257
|
}));
|
|
10053
10258
|
logger$1.warn("video exception", warn);
|
|
@@ -10066,13 +10271,13 @@
|
|
|
10066
10271
|
break;
|
|
10067
10272
|
}
|
|
10068
10273
|
if (type)
|
|
10069
|
-
|
|
10274
|
+
_this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10070
10275
|
type
|
|
10071
10276
|
}));
|
|
10072
10277
|
logger$1.warn("audio exception", warn);
|
|
10073
10278
|
});
|
|
10074
10279
|
metadataTrack.seiSamples.forEach(function(sei) {
|
|
10075
|
-
|
|
10280
|
+
_this3.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
|
|
10076
10281
|
sei: {
|
|
10077
10282
|
code: sei.data.type,
|
|
10078
10283
|
content: sei.data.payload,
|
|
@@ -10107,7 +10312,8 @@
|
|
|
10107
10312
|
durationForMSELowLatencyOff: 6,
|
|
10108
10313
|
chunkCountForSpeed: 50,
|
|
10109
10314
|
skipChunkSize: 1e3,
|
|
10110
|
-
longtimeNoReceived: 3e3
|
|
10315
|
+
longtimeNoReceived: 3e3,
|
|
10316
|
+
enableStartGapJump: true
|
|
10111
10317
|
}, opts);
|
|
10112
10318
|
if (ret.isLive) {
|
|
10113
10319
|
if (ret.preloadTime) {
|
|
@@ -10175,7 +10381,7 @@
|
|
|
10175
10381
|
_defineProperty$3(_assertThisInitialized$3(_this), "_acceptRanges", true);
|
|
10176
10382
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onProgress", /* @__PURE__ */ function() {
|
|
10177
10383
|
var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee(chunk, done, _ref, response) {
|
|
10178
|
-
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
|
|
10384
|
+
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, elapsed, _this$_bufferService, remaining, maxReaderInterval;
|
|
10179
10385
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10180
10386
|
while (1)
|
|
10181
10387
|
switch (_context.prev = _context.next) {
|
|
@@ -10183,7 +10389,7 @@
|
|
|
10183
10389
|
startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
|
|
10184
10390
|
_this._loading = !done;
|
|
10185
10391
|
if (_this._firstProgressEmit) {
|
|
10186
|
-
_context.next =
|
|
10392
|
+
_context.next = 13;
|
|
10187
10393
|
break;
|
|
10188
10394
|
}
|
|
10189
10395
|
if (_this.media) {
|
|
@@ -10194,49 +10400,51 @@
|
|
|
10194
10400
|
return _context.abrupt("return");
|
|
10195
10401
|
case 6:
|
|
10196
10402
|
headers = response.headers;
|
|
10403
|
+
elapsed = st ? firstByteTime - st : endTime - startTime;
|
|
10197
10404
|
_this.emit(EVENT.TTFB, {
|
|
10198
10405
|
url: _this._opts.url,
|
|
10199
10406
|
responseUrl: response.url,
|
|
10200
|
-
elapsed
|
|
10407
|
+
elapsed
|
|
10201
10408
|
});
|
|
10202
10409
|
_this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
10203
10410
|
headers
|
|
10204
10411
|
});
|
|
10412
|
+
_this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
|
|
10205
10413
|
_this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
|
|
10206
10414
|
_this._firstProgressEmit = true;
|
|
10207
|
-
case
|
|
10415
|
+
case 13:
|
|
10208
10416
|
if (_this._bufferService) {
|
|
10209
|
-
_context.next =
|
|
10417
|
+
_context.next = 15;
|
|
10210
10418
|
break;
|
|
10211
10419
|
}
|
|
10212
10420
|
return _context.abrupt("return");
|
|
10213
|
-
case
|
|
10421
|
+
case 15:
|
|
10214
10422
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
10215
10423
|
_this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
|
|
10216
|
-
_context.prev =
|
|
10217
|
-
_context.next =
|
|
10424
|
+
_context.prev = 17;
|
|
10425
|
+
_context.next = 20;
|
|
10218
10426
|
return _this._bufferService.appendBuffer(chunk);
|
|
10219
|
-
case
|
|
10427
|
+
case 20:
|
|
10220
10428
|
(_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
|
|
10221
|
-
_context.next =
|
|
10429
|
+
_context.next = 33;
|
|
10222
10430
|
break;
|
|
10223
|
-
case
|
|
10224
|
-
_context.prev =
|
|
10225
|
-
_context.t0 = _context["catch"](
|
|
10431
|
+
case 23:
|
|
10432
|
+
_context.prev = 23;
|
|
10433
|
+
_context.t0 = _context["catch"](17);
|
|
10226
10434
|
if (!(!_this.isLive && _this._bufferService.isFull())) {
|
|
10227
|
-
_context.next =
|
|
10435
|
+
_context.next = 32;
|
|
10228
10436
|
break;
|
|
10229
10437
|
}
|
|
10230
|
-
_context.next =
|
|
10438
|
+
_context.next = 28;
|
|
10231
10439
|
return _this._mediaLoader.cancel();
|
|
10232
|
-
case
|
|
10440
|
+
case 28:
|
|
10233
10441
|
_this._loading = false;
|
|
10234
10442
|
remaining = _this.bufferInfo().remaining;
|
|
10235
10443
|
_this._opts.preloadTime = parseInt(remaining) / 2;
|
|
10236
10444
|
return _context.abrupt("return");
|
|
10237
|
-
case
|
|
10445
|
+
case 32:
|
|
10238
10446
|
return _context.abrupt("return", _this._emitError(StreamingError.create(_context.t0)));
|
|
10239
|
-
case
|
|
10447
|
+
case 33:
|
|
10240
10448
|
if (_this._urlSwitching) {
|
|
10241
10449
|
_this._urlSwitching = false;
|
|
10242
10450
|
_this.emit(EVENT.SWITCH_URL_SUCCESS, {
|
|
@@ -10248,7 +10456,7 @@
|
|
|
10248
10456
|
_this._tick();
|
|
10249
10457
|
}
|
|
10250
10458
|
if (!(done && !_this.media.seeking)) {
|
|
10251
|
-
_context.next =
|
|
10459
|
+
_context.next = 40;
|
|
10252
10460
|
break;
|
|
10253
10461
|
}
|
|
10254
10462
|
_this.emit(EVENT.LOAD_COMPLETE);
|
|
@@ -10257,13 +10465,13 @@
|
|
|
10257
10465
|
_this._end();
|
|
10258
10466
|
}
|
|
10259
10467
|
return _context.abrupt("return");
|
|
10260
|
-
case
|
|
10468
|
+
case 40:
|
|
10261
10469
|
if (_this.isLive) {
|
|
10262
|
-
_context.next =
|
|
10470
|
+
_context.next = 42;
|
|
10263
10471
|
break;
|
|
10264
10472
|
}
|
|
10265
10473
|
return _context.abrupt("return");
|
|
10266
|
-
case
|
|
10474
|
+
case 42:
|
|
10267
10475
|
maxReaderInterval = _this._opts.maxReaderInterval;
|
|
10268
10476
|
if (maxReaderInterval && _this._firstProgressEmit) {
|
|
10269
10477
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
@@ -10277,11 +10485,11 @@
|
|
|
10277
10485
|
_this._end();
|
|
10278
10486
|
}, maxReaderInterval);
|
|
10279
10487
|
}
|
|
10280
|
-
case
|
|
10488
|
+
case 44:
|
|
10281
10489
|
case "end":
|
|
10282
10490
|
return _context.stop();
|
|
10283
10491
|
}
|
|
10284
|
-
}, _callee, null, [[
|
|
10492
|
+
}, _callee, null, [[17, 23]]);
|
|
10285
10493
|
}));
|
|
10286
10494
|
return function(_x, _x2, _x3, _x4) {
|
|
10287
10495
|
return _ref2.apply(this, arguments);
|
|
@@ -10314,12 +10522,12 @@
|
|
|
10314
10522
|
if (bufferEnd < MAX_HOLE || !media.readyState)
|
|
10315
10523
|
return;
|
|
10316
10524
|
var opts = _this._opts;
|
|
10317
|
-
if (isMediaPlaying(media)) {
|
|
10525
|
+
if (isMediaPlaying(media) && media.currentTime) {
|
|
10318
10526
|
if (_this._gapService) {
|
|
10319
10527
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10320
10528
|
}
|
|
10321
10529
|
} else {
|
|
10322
|
-
if (!media.currentTime && _this._gapService) {
|
|
10530
|
+
if (!media.currentTime && _this._gapService && opts.enableStartGapJump) {
|
|
10323
10531
|
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10324
10532
|
if (gapJump) {
|
|
10325
10533
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
@@ -10475,6 +10683,7 @@
|
|
|
10475
10683
|
responseType: "arraybuffer"
|
|
10476
10684
|
}));
|
|
10477
10685
|
_this._disconnectRetryCount = _this._opts.disconnectRetryCount;
|
|
10686
|
+
_this._transferCost = new TransferCost();
|
|
10478
10687
|
_this._bufferService = new BufferService(_assertThisInitialized$3(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
|
|
10479
10688
|
_this._seiService = new SeiService(_assertThisInitialized$3(_this));
|
|
10480
10689
|
_this._bandwidthService = new BandwidthService({
|
|
@@ -10498,7 +10707,7 @@
|
|
|
10498
10707
|
_createClass$4(Flv2, [{
|
|
10499
10708
|
key: "version",
|
|
10500
10709
|
get: function get() {
|
|
10501
|
-
return "3.0.
|
|
10710
|
+
return "3.0.20-rc.3";
|
|
10502
10711
|
}
|
|
10503
10712
|
}, {
|
|
10504
10713
|
key: "isLive",
|
|
@@ -10614,9 +10823,9 @@
|
|
|
10614
10823
|
return this._clear();
|
|
10615
10824
|
case 8:
|
|
10616
10825
|
setTimeout(function() {
|
|
10826
|
+
_this2._seamlessSwitching = true;
|
|
10617
10827
|
_this2._loadData(_this2._opts.url);
|
|
10618
10828
|
_this2._bufferService.seamlessSwitch();
|
|
10619
|
-
_this2._seamlessSwitching = true;
|
|
10620
10829
|
});
|
|
10621
10830
|
_context5.next = 13;
|
|
10622
10831
|
break;
|
|
@@ -10640,50 +10849,82 @@
|
|
|
10640
10849
|
}, {
|
|
10641
10850
|
key: "disconnect",
|
|
10642
10851
|
value: function disconnect() {
|
|
10852
|
+
var _this$_bufferService4;
|
|
10643
10853
|
logger.debug("disconnect!");
|
|
10854
|
+
(_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
|
|
10644
10855
|
return this._clear();
|
|
10645
10856
|
}
|
|
10646
10857
|
}, {
|
|
10647
10858
|
key: "switchURL",
|
|
10648
10859
|
value: function() {
|
|
10649
|
-
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10860
|
+
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(url, seamless) {
|
|
10650
10861
|
var _this3 = this;
|
|
10651
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10862
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
10652
10863
|
while (1)
|
|
10653
|
-
switch (
|
|
10864
|
+
switch (_context7.prev = _context7.next) {
|
|
10654
10865
|
case 0:
|
|
10655
10866
|
if (this._bufferService) {
|
|
10656
|
-
|
|
10867
|
+
_context7.next = 2;
|
|
10657
10868
|
break;
|
|
10658
10869
|
}
|
|
10659
|
-
return
|
|
10870
|
+
return _context7.abrupt("return");
|
|
10660
10871
|
case 2:
|
|
10661
10872
|
this._resetDisconnectCount();
|
|
10873
|
+
if (!(this._loading && seamless)) {
|
|
10874
|
+
_context7.next = 6;
|
|
10875
|
+
break;
|
|
10876
|
+
}
|
|
10877
|
+
this._bufferService.seamlessLoadingSwitch = /* @__PURE__ */ function() {
|
|
10878
|
+
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(pts) {
|
|
10879
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10880
|
+
while (1)
|
|
10881
|
+
switch (_context6.prev = _context6.next) {
|
|
10882
|
+
case 0:
|
|
10883
|
+
_context6.next = 2;
|
|
10884
|
+
return _this3._clear();
|
|
10885
|
+
case 2:
|
|
10886
|
+
_this3._bufferService.seamlessLoadingSwitching = true;
|
|
10887
|
+
_this3._urlSwitching = true;
|
|
10888
|
+
_this3._seamlessSwitching = true;
|
|
10889
|
+
_this3._bufferService.seamlessSwitch();
|
|
10890
|
+
_this3._loadData(url);
|
|
10891
|
+
case 7:
|
|
10892
|
+
case "end":
|
|
10893
|
+
return _context6.stop();
|
|
10894
|
+
}
|
|
10895
|
+
}, _callee6);
|
|
10896
|
+
}));
|
|
10897
|
+
return function(_x8) {
|
|
10898
|
+
return _ref5.apply(this, arguments);
|
|
10899
|
+
};
|
|
10900
|
+
}();
|
|
10901
|
+
return _context7.abrupt("return");
|
|
10902
|
+
case 6:
|
|
10662
10903
|
if (!(!seamless || !this._opts.isLive)) {
|
|
10663
|
-
|
|
10904
|
+
_context7.next = 11;
|
|
10664
10905
|
break;
|
|
10665
10906
|
}
|
|
10666
|
-
|
|
10907
|
+
_context7.next = 9;
|
|
10667
10908
|
return this.load(url);
|
|
10668
|
-
case
|
|
10909
|
+
case 9:
|
|
10669
10910
|
this._urlSwitching = true;
|
|
10670
|
-
return
|
|
10911
|
+
return _context7.abrupt("return", this.media.play(true).catch(function() {
|
|
10671
10912
|
}));
|
|
10672
|
-
case
|
|
10673
|
-
|
|
10913
|
+
case 11:
|
|
10914
|
+
_context7.next = 13;
|
|
10674
10915
|
return this._clear();
|
|
10675
|
-
case
|
|
10916
|
+
case 13:
|
|
10676
10917
|
setTimeout(function() {
|
|
10677
10918
|
_this3._urlSwitching = true;
|
|
10678
10919
|
_this3._seamlessSwitching = true;
|
|
10679
10920
|
_this3._loadData(url);
|
|
10680
10921
|
_this3._bufferService.seamlessSwitch();
|
|
10681
10922
|
});
|
|
10682
|
-
case
|
|
10923
|
+
case 14:
|
|
10683
10924
|
case "end":
|
|
10684
|
-
return
|
|
10925
|
+
return _context7.stop();
|
|
10685
10926
|
}
|
|
10686
|
-
},
|
|
10927
|
+
}, _callee7, this);
|
|
10687
10928
|
}));
|
|
10688
10929
|
function switchURL(_x6, _x7) {
|
|
10689
10930
|
return _switchURL.apply(this, arguments);
|
|
@@ -10693,16 +10934,16 @@
|
|
|
10693
10934
|
}, {
|
|
10694
10935
|
key: "destroy",
|
|
10695
10936
|
value: function() {
|
|
10696
|
-
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10697
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10937
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
|
|
10938
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
10698
10939
|
while (1)
|
|
10699
|
-
switch (
|
|
10940
|
+
switch (_context8.prev = _context8.next) {
|
|
10700
10941
|
case 0:
|
|
10701
10942
|
if (this.media) {
|
|
10702
|
-
|
|
10943
|
+
_context8.next = 2;
|
|
10703
10944
|
break;
|
|
10704
10945
|
}
|
|
10705
|
-
return
|
|
10946
|
+
return _context8.abrupt("return");
|
|
10706
10947
|
case 2:
|
|
10707
10948
|
this.removeAllListeners();
|
|
10708
10949
|
this._seiService.reset();
|
|
@@ -10712,16 +10953,16 @@
|
|
|
10712
10953
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10713
10954
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10714
10955
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10715
|
-
|
|
10956
|
+
_context8.next = 12;
|
|
10716
10957
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10717
10958
|
case 12:
|
|
10718
10959
|
this.media = null;
|
|
10719
10960
|
this._bufferService = null;
|
|
10720
10961
|
case 14:
|
|
10721
10962
|
case "end":
|
|
10722
|
-
return
|
|
10963
|
+
return _context8.stop();
|
|
10723
10964
|
}
|
|
10724
|
-
},
|
|
10965
|
+
}, _callee8, this);
|
|
10725
10966
|
}));
|
|
10726
10967
|
function destroy() {
|
|
10727
10968
|
return _destroy.apply(this, arguments);
|
|
@@ -10750,26 +10991,26 @@
|
|
|
10750
10991
|
}, {
|
|
10751
10992
|
key: "_reset",
|
|
10752
10993
|
value: function() {
|
|
10753
|
-
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10754
|
-
var reuseMse,
|
|
10755
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10994
|
+
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
|
|
10995
|
+
var reuseMse, _args9 = arguments;
|
|
10996
|
+
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
10756
10997
|
while (1)
|
|
10757
|
-
switch (
|
|
10998
|
+
switch (_context9.prev = _context9.next) {
|
|
10758
10999
|
case 0:
|
|
10759
|
-
reuseMse =
|
|
11000
|
+
reuseMse = _args9.length > 0 && _args9[0] !== void 0 ? _args9[0] : false;
|
|
10760
11001
|
this._seiService.reset();
|
|
10761
11002
|
this._bandwidthService.reset();
|
|
10762
11003
|
this._stats.reset();
|
|
10763
|
-
|
|
11004
|
+
_context9.next = 6;
|
|
10764
11005
|
return this._clear();
|
|
10765
11006
|
case 6:
|
|
10766
|
-
|
|
11007
|
+
_context9.next = 8;
|
|
10767
11008
|
return this._bufferService.reset(reuseMse);
|
|
10768
11009
|
case 8:
|
|
10769
11010
|
case "end":
|
|
10770
|
-
return
|
|
11011
|
+
return _context9.stop();
|
|
10771
11012
|
}
|
|
10772
|
-
},
|
|
11013
|
+
}, _callee9, this);
|
|
10773
11014
|
}));
|
|
10774
11015
|
function _reset() {
|
|
10775
11016
|
return _reset2.apply(this, arguments);
|
|
@@ -10779,17 +11020,17 @@
|
|
|
10779
11020
|
}, {
|
|
10780
11021
|
key: "_loadData",
|
|
10781
11022
|
value: function() {
|
|
10782
|
-
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
11023
|
+
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10(url, range) {
|
|
10783
11024
|
var finnalUrl;
|
|
10784
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11025
|
+
return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
|
|
10785
11026
|
while (1)
|
|
10786
|
-
switch (
|
|
11027
|
+
switch (_context10.prev = _context10.next) {
|
|
10787
11028
|
case 0:
|
|
10788
11029
|
if (url)
|
|
10789
11030
|
this._opts.url = url;
|
|
10790
11031
|
finnalUrl = url = this._opts.url;
|
|
10791
11032
|
if (url) {
|
|
10792
|
-
|
|
11033
|
+
_context10.next = 4;
|
|
10793
11034
|
break;
|
|
10794
11035
|
}
|
|
10795
11036
|
throw new Error("Source url is missing");
|
|
@@ -10804,34 +11045,34 @@
|
|
|
10804
11045
|
});
|
|
10805
11046
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
10806
11047
|
if (!this._loading) {
|
|
10807
|
-
|
|
11048
|
+
_context10.next = 11;
|
|
10808
11049
|
break;
|
|
10809
11050
|
}
|
|
10810
|
-
|
|
11051
|
+
_context10.next = 11;
|
|
10811
11052
|
return this._mediaLoader.cancel();
|
|
10812
11053
|
case 11:
|
|
10813
11054
|
this._loading = true;
|
|
10814
|
-
|
|
10815
|
-
|
|
11055
|
+
_context10.prev = 12;
|
|
11056
|
+
_context10.next = 15;
|
|
10816
11057
|
return this._mediaLoader.load({
|
|
10817
11058
|
url: finnalUrl,
|
|
10818
11059
|
range
|
|
10819
11060
|
});
|
|
10820
11061
|
case 15:
|
|
10821
|
-
|
|
11062
|
+
_context10.next = 21;
|
|
10822
11063
|
break;
|
|
10823
11064
|
case 17:
|
|
10824
|
-
|
|
10825
|
-
|
|
11065
|
+
_context10.prev = 17;
|
|
11066
|
+
_context10.t0 = _context10["catch"](12);
|
|
10826
11067
|
this._loading = false;
|
|
10827
|
-
return
|
|
11068
|
+
return _context10.abrupt("return", this._emitError(StreamingError.network(_context10.t0), false));
|
|
10828
11069
|
case 21:
|
|
10829
11070
|
case "end":
|
|
10830
|
-
return
|
|
11071
|
+
return _context10.stop();
|
|
10831
11072
|
}
|
|
10832
|
-
},
|
|
11073
|
+
}, _callee10, this, [[12, 17]]);
|
|
10833
11074
|
}));
|
|
10834
|
-
function _loadData(
|
|
11075
|
+
function _loadData(_x9, _x10) {
|
|
10835
11076
|
return _loadData2.apply(this, arguments);
|
|
10836
11077
|
}
|
|
10837
11078
|
return _loadData;
|
|
@@ -10839,16 +11080,16 @@
|
|
|
10839
11080
|
}, {
|
|
10840
11081
|
key: "_clear",
|
|
10841
11082
|
value: function() {
|
|
10842
|
-
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10843
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11083
|
+
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee11() {
|
|
11084
|
+
return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
|
|
10844
11085
|
while (1)
|
|
10845
|
-
switch (
|
|
11086
|
+
switch (_context11.prev = _context11.next) {
|
|
10846
11087
|
case 0:
|
|
10847
11088
|
if (!this._mediaLoader) {
|
|
10848
|
-
|
|
11089
|
+
_context11.next = 3;
|
|
10849
11090
|
break;
|
|
10850
11091
|
}
|
|
10851
|
-
|
|
11092
|
+
_context11.next = 3;
|
|
10852
11093
|
return this._mediaLoader.cancel();
|
|
10853
11094
|
case 3:
|
|
10854
11095
|
clearTimeout(this._maxChunkWaitTimer);
|
|
@@ -10857,9 +11098,9 @@
|
|
|
10857
11098
|
this._firstProgressEmit = false;
|
|
10858
11099
|
case 7:
|
|
10859
11100
|
case "end":
|
|
10860
|
-
return
|
|
11101
|
+
return _context11.stop();
|
|
10861
11102
|
}
|
|
10862
|
-
},
|
|
11103
|
+
}, _callee11, this);
|
|
10863
11104
|
}));
|
|
10864
11105
|
function _clear() {
|
|
10865
11106
|
return _clear2.apply(this, arguments);
|
|
@@ -11053,6 +11294,11 @@
|
|
|
11053
11294
|
var _this$flv3;
|
|
11054
11295
|
return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
|
|
11055
11296
|
}
|
|
11297
|
+
}, {
|
|
11298
|
+
key: "transferCost",
|
|
11299
|
+
get: function get() {
|
|
11300
|
+
return this.flv._transferCost.transferCost;
|
|
11301
|
+
}
|
|
11056
11302
|
}, {
|
|
11057
11303
|
key: "beforePlayerInit",
|
|
11058
11304
|
value: function beforePlayerInit() {
|
|
@@ -11072,8 +11318,8 @@
|
|
|
11072
11318
|
isLive: config.isLive,
|
|
11073
11319
|
media: this.player.video,
|
|
11074
11320
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
11075
|
-
var _this2$player
|
|
11076
|
-
return ((_this2$player
|
|
11321
|
+
var _this2$player, _this2$player$preProc;
|
|
11322
|
+
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)) || {
|
|
11077
11323
|
url,
|
|
11078
11324
|
ext
|
|
11079
11325
|
};
|