@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
|
@@ -1538,7 +1538,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1538
1538
|
}
|
|
1539
1539
|
return offsetTime;
|
|
1540
1540
|
};
|
|
1541
|
-
var version = "3.0.
|
|
1541
|
+
var version = "3.0.20-rc.3";
|
|
1542
1542
|
var ERROR_MAP = {
|
|
1543
1543
|
1: 5101,
|
|
1544
1544
|
2: 5102,
|
|
@@ -5538,6 +5538,7 @@ var TrackType = {
|
|
|
5538
5538
|
METADATA: "metadata"
|
|
5539
5539
|
};
|
|
5540
5540
|
var VideoCodecType = {
|
|
5541
|
+
AV1: "av1",
|
|
5541
5542
|
AVC: "avc",
|
|
5542
5543
|
HEVC: "hevc"
|
|
5543
5544
|
};
|
|
@@ -5584,6 +5585,7 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5584
5585
|
_defineProperty(this, "isVideoEncryption", false);
|
|
5585
5586
|
_defineProperty(this, "isAudioEncryption", false);
|
|
5586
5587
|
_defineProperty(this, "isVideo", true);
|
|
5588
|
+
_defineProperty(this, "lastKeyFrameDts", 0);
|
|
5587
5589
|
_defineProperty(this, "kid", null);
|
|
5588
5590
|
_defineProperty(this, "pssh", null);
|
|
5589
5591
|
_defineProperty(this, "ext", void 0);
|
|
@@ -5626,6 +5628,9 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5626
5628
|
}, {
|
|
5627
5629
|
key: "exist",
|
|
5628
5630
|
value: function exist() {
|
|
5631
|
+
if (/av01/.test(this.codec)) {
|
|
5632
|
+
return true;
|
|
5633
|
+
}
|
|
5629
5634
|
return !!(this.pps.length && this.sps.length && this.codec);
|
|
5630
5635
|
}
|
|
5631
5636
|
}, {
|
|
@@ -7321,6 +7326,7 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7321
7326
|
value: function demux(data) {
|
|
7322
7327
|
var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
7323
7328
|
var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
7329
|
+
var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
|
|
7324
7330
|
var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
|
|
7325
7331
|
if (discontinuity || !contiguous) {
|
|
7326
7332
|
this._remainingData = null;
|
|
@@ -7378,6 +7384,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7378
7384
|
if (tagType === 8) {
|
|
7379
7385
|
this._parseAudio(bodyData, timestamp);
|
|
7380
7386
|
} else if (tagType === 9) {
|
|
7387
|
+
if (seamlessLoadingSwitching)
|
|
7388
|
+
this.seamlessLoadingSwitching = true;
|
|
7381
7389
|
this._parseVideo(bodyData, timestamp);
|
|
7382
7390
|
} else if (tagType === 18) {
|
|
7383
7391
|
this._parseScript(bodyData, timestamp);
|
|
@@ -7420,8 +7428,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7420
7428
|
}
|
|
7421
7429
|
}, {
|
|
7422
7430
|
key: "demuxAndFix",
|
|
7423
|
-
value: function demuxAndFix(data, discontinuity, contiguous, startTime) {
|
|
7424
|
-
this.demux(data, discontinuity, contiguous);
|
|
7431
|
+
value: function demuxAndFix(data, discontinuity, contiguous, startTime, seamlessLoadingSwitching) {
|
|
7432
|
+
this.demux(data, discontinuity, contiguous, seamlessLoadingSwitching);
|
|
7425
7433
|
return this.fix(startTime, discontinuity, contiguous);
|
|
7426
7434
|
}
|
|
7427
7435
|
}, {
|
|
@@ -7535,8 +7543,13 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7535
7543
|
units = this._checkAddMetaNalToUnits(isHevc, units, track);
|
|
7536
7544
|
if (units && units.length) {
|
|
7537
7545
|
var sample = new VideoSample(dts + cts, dts, units);
|
|
7546
|
+
if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
|
|
7547
|
+
return;
|
|
7548
|
+
}
|
|
7549
|
+
this.seamlessLoadingSwitching = false;
|
|
7538
7550
|
if (frameType === 1) {
|
|
7539
7551
|
sample.setToKeyframe();
|
|
7552
|
+
track.lastKeyFrameDts = dts;
|
|
7540
7553
|
}
|
|
7541
7554
|
track.samples.push(sample);
|
|
7542
7555
|
units.forEach(function(unit) {
|
|
@@ -8014,6 +8027,8 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
8014
8027
|
}
|
|
8015
8028
|
} else if (track.useEME && track.encv) {
|
|
8016
8029
|
content = MP42.encv(track);
|
|
8030
|
+
} else if (track.av1C) {
|
|
8031
|
+
content = MP42.av01(track);
|
|
8017
8032
|
} else {
|
|
8018
8033
|
content = MP42.avc1hev1(track);
|
|
8019
8034
|
}
|
|
@@ -8226,6 +8241,90 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
8226
8241
|
var schi = MP42.schi(data);
|
|
8227
8242
|
return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
|
|
8228
8243
|
}
|
|
8244
|
+
}, {
|
|
8245
|
+
key: "av01",
|
|
8246
|
+
value: function av01(track) {
|
|
8247
|
+
return MP42.box(MP42.types.av01, new Uint8Array([
|
|
8248
|
+
0,
|
|
8249
|
+
0,
|
|
8250
|
+
0,
|
|
8251
|
+
0,
|
|
8252
|
+
0,
|
|
8253
|
+
0,
|
|
8254
|
+
0,
|
|
8255
|
+
1,
|
|
8256
|
+
0,
|
|
8257
|
+
0,
|
|
8258
|
+
0,
|
|
8259
|
+
0,
|
|
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
|
+
track.width >> 8 & 255,
|
|
8273
|
+
track.width & 255,
|
|
8274
|
+
track.height >> 8 & 255,
|
|
8275
|
+
track.height & 255,
|
|
8276
|
+
0,
|
|
8277
|
+
72,
|
|
8278
|
+
0,
|
|
8279
|
+
0,
|
|
8280
|
+
0,
|
|
8281
|
+
72,
|
|
8282
|
+
0,
|
|
8283
|
+
0,
|
|
8284
|
+
0,
|
|
8285
|
+
0,
|
|
8286
|
+
0,
|
|
8287
|
+
0,
|
|
8288
|
+
0,
|
|
8289
|
+
1,
|
|
8290
|
+
0,
|
|
8291
|
+
0,
|
|
8292
|
+
0,
|
|
8293
|
+
0,
|
|
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
|
+
24,
|
|
8324
|
+
17,
|
|
8325
|
+
17
|
|
8326
|
+
]), track.av1C, track.colr);
|
|
8327
|
+
}
|
|
8229
8328
|
}, {
|
|
8230
8329
|
key: "avc1hev1",
|
|
8231
8330
|
value: function avc1hev1(track) {
|
|
@@ -9198,7 +9297,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
9198
9297
|
}]);
|
|
9199
9298
|
return MP42;
|
|
9200
9299
|
}();
|
|
9201
|
-
_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) {
|
|
9300
|
+
_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) {
|
|
9202
9301
|
p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
|
|
9203
9302
|
return p;
|
|
9204
9303
|
}, /* @__PURE__ */ Object.create(null)));
|
|
@@ -9533,30 +9632,46 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
|
|
|
9533
9632
|
};
|
|
9534
9633
|
}
|
|
9535
9634
|
var samples = track.samples;
|
|
9635
|
+
var isAV01 = /av01/.test(track.codec);
|
|
9536
9636
|
var mdatSize = 0;
|
|
9537
|
-
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
}, 0);
|
|
9541
|
-
mdatSize += s.units.length * 4;
|
|
9542
|
-
});
|
|
9543
|
-
var mdata = new Uint8Array(mdatSize);
|
|
9544
|
-
var mdatView = new DataView(mdata.buffer);
|
|
9545
|
-
var _loop = function _loop2(_offset, _sample) {
|
|
9546
|
-
_sample = samples[i];
|
|
9547
|
-
var sampleSize = 0;
|
|
9548
|
-
_sample.units.forEach(function(u) {
|
|
9549
|
-
mdatView.setUint32(_offset, u.byteLength);
|
|
9550
|
-
_offset += 4;
|
|
9551
|
-
mdata.set(u, _offset);
|
|
9552
|
-
_offset += u.byteLength;
|
|
9553
|
-
sampleSize += 4 + u.byteLength;
|
|
9637
|
+
if (isAV01) {
|
|
9638
|
+
samples.forEach(function(s) {
|
|
9639
|
+
mdatSize += s.data.byteLength;
|
|
9554
9640
|
});
|
|
9555
|
-
|
|
9556
|
-
|
|
9557
|
-
|
|
9558
|
-
|
|
9559
|
-
|
|
9641
|
+
} else {
|
|
9642
|
+
samples.forEach(function(s) {
|
|
9643
|
+
mdatSize += s.units.reduce(function(t, c) {
|
|
9644
|
+
return t + c.byteLength;
|
|
9645
|
+
}, 0);
|
|
9646
|
+
mdatSize += s.units.length * 4;
|
|
9647
|
+
});
|
|
9648
|
+
}
|
|
9649
|
+
var mdata = new Uint8Array(mdatSize);
|
|
9650
|
+
if (isAV01) {
|
|
9651
|
+
for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
|
|
9652
|
+
sample = samples[i];
|
|
9653
|
+
mdata.set(sample.data, offset);
|
|
9654
|
+
sample.size = sample.data.byteLength;
|
|
9655
|
+
offset += sample.size;
|
|
9656
|
+
}
|
|
9657
|
+
} else {
|
|
9658
|
+
var mdatView = new DataView(mdata.buffer);
|
|
9659
|
+
var _loop = function _loop2(_offset2, _sample2) {
|
|
9660
|
+
_sample2 = samples[_i];
|
|
9661
|
+
var sampleSize = 0;
|
|
9662
|
+
_sample2.units.forEach(function(u) {
|
|
9663
|
+
mdatView.setUint32(_offset2, u.byteLength);
|
|
9664
|
+
_offset2 += 4;
|
|
9665
|
+
mdata.set(u, _offset2);
|
|
9666
|
+
_offset2 += u.byteLength;
|
|
9667
|
+
sampleSize += 4 + u.byteLength;
|
|
9668
|
+
});
|
|
9669
|
+
_sample2.size = sampleSize;
|
|
9670
|
+
_offset = _offset2, _sample = _sample2;
|
|
9671
|
+
};
|
|
9672
|
+
for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
|
|
9673
|
+
_loop(_offset, _sample);
|
|
9674
|
+
}
|
|
9560
9675
|
}
|
|
9561
9676
|
var mdat = MP4.mdat(mdata);
|
|
9562
9677
|
var moof = MP4.moof([track]);
|
|
@@ -9586,6 +9701,55 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
|
|
|
9586
9701
|
}]);
|
|
9587
9702
|
return FMP4Remuxer2;
|
|
9588
9703
|
}();
|
|
9704
|
+
var TransferCost = /* @__PURE__ */ function() {
|
|
9705
|
+
function TransferCost2() {
|
|
9706
|
+
_classCallCheck$4(this, TransferCost2);
|
|
9707
|
+
_defineProperty$3(this, "_ttfb", 0);
|
|
9708
|
+
_defineProperty$3(this, "_demuxStart", 0);
|
|
9709
|
+
_defineProperty$3(this, "_demuxEnd", 0);
|
|
9710
|
+
_defineProperty$3(this, "_demuxCost", 0);
|
|
9711
|
+
_defineProperty$3(this, "_remuxStart", 0);
|
|
9712
|
+
_defineProperty$3(this, "_remuxEnd", 0);
|
|
9713
|
+
_defineProperty$3(this, "_remuxCost", 0);
|
|
9714
|
+
_defineProperty$3(this, "_appendStart", 0);
|
|
9715
|
+
_defineProperty$3(this, "_appendEnd", 0);
|
|
9716
|
+
_defineProperty$3(this, "_appendCost", 0);
|
|
9717
|
+
}
|
|
9718
|
+
_createClass$4(TransferCost2, [{
|
|
9719
|
+
key: "set",
|
|
9720
|
+
value: function set(event, value) {
|
|
9721
|
+
this["_".concat(event)] = value;
|
|
9722
|
+
}
|
|
9723
|
+
}, {
|
|
9724
|
+
key: "start",
|
|
9725
|
+
value: function start(event) {
|
|
9726
|
+
this["_".concat(event, "Start")] = Date.now();
|
|
9727
|
+
}
|
|
9728
|
+
}, {
|
|
9729
|
+
key: "end",
|
|
9730
|
+
value: function end(event) {
|
|
9731
|
+
this["_".concat(event, "End")] = Date.now();
|
|
9732
|
+
this["_".concat(event, "Cost")] = this["_".concat(event, "Cost")] + (this["_".concat(event, "End")] - this["_".concat(event, "Start")]);
|
|
9733
|
+
}
|
|
9734
|
+
}, {
|
|
9735
|
+
key: "transferCost",
|
|
9736
|
+
get: function get() {
|
|
9737
|
+
return {
|
|
9738
|
+
ttfbCost: this._ttfb,
|
|
9739
|
+
demuxCost: this._demuxCost,
|
|
9740
|
+
remuxCost: this._remuxCost,
|
|
9741
|
+
appendCost: this._appendCost
|
|
9742
|
+
};
|
|
9743
|
+
}
|
|
9744
|
+
}]);
|
|
9745
|
+
return TransferCost2;
|
|
9746
|
+
}();
|
|
9747
|
+
var TRANSFER_EVENT = {
|
|
9748
|
+
TTFB: "ttfb",
|
|
9749
|
+
DEMUX: "demux",
|
|
9750
|
+
REMUX: "remux",
|
|
9751
|
+
APPEND: "append"
|
|
9752
|
+
};
|
|
9589
9753
|
var logger$1 = new Logger$2("BufferService");
|
|
9590
9754
|
var BufferService = /* @__PURE__ */ function() {
|
|
9591
9755
|
function BufferService2(flv, softVideo) {
|
|
@@ -9673,7 +9837,8 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9673
9837
|
this._contiguous = false;
|
|
9674
9838
|
this._sourceCreated = false;
|
|
9675
9839
|
this._initSegmentId = "";
|
|
9676
|
-
|
|
9840
|
+
this.resetSeamlessSwitchStats();
|
|
9841
|
+
case 12:
|
|
9677
9842
|
case "end":
|
|
9678
9843
|
return _context.stop();
|
|
9679
9844
|
}
|
|
@@ -9684,6 +9849,15 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9684
9849
|
}
|
|
9685
9850
|
return reset;
|
|
9686
9851
|
}()
|
|
9852
|
+
}, {
|
|
9853
|
+
key: "resetSeamlessSwitchStats",
|
|
9854
|
+
value: function resetSeamlessSwitchStats() {
|
|
9855
|
+
this.seamlessLoadingSwitch = null;
|
|
9856
|
+
this.seamlessLoadingSwitching = false;
|
|
9857
|
+
if (this._demuxer) {
|
|
9858
|
+
this._demuxer.seamlessLoadingSwitching = false;
|
|
9859
|
+
}
|
|
9860
|
+
}
|
|
9687
9861
|
}, {
|
|
9688
9862
|
key: "endOfStream",
|
|
9689
9863
|
value: function() {
|
|
@@ -9789,32 +9963,56 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9789
9963
|
key: "appendBuffer",
|
|
9790
9964
|
value: function() {
|
|
9791
9965
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(chunk) {
|
|
9792
|
-
var
|
|
9966
|
+
var _this = this;
|
|
9967
|
+
var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
|
|
9793
9968
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
9794
9969
|
while (1)
|
|
9795
9970
|
switch (_context5.prev = _context5.next) {
|
|
9796
9971
|
case 0:
|
|
9972
|
+
switchingNoReset = false;
|
|
9797
9973
|
if (this._cachedBuffer) {
|
|
9798
9974
|
chunk = concatUint8Array$1(this._cachedBuffer, chunk);
|
|
9799
9975
|
this._cachedBuffer = null;
|
|
9800
9976
|
}
|
|
9801
9977
|
demuxer = this._demuxer;
|
|
9802
9978
|
if (!(!chunk || !chunk.length || !demuxer)) {
|
|
9803
|
-
_context5.next =
|
|
9979
|
+
_context5.next = 5;
|
|
9804
9980
|
break;
|
|
9805
9981
|
}
|
|
9806
9982
|
return _context5.abrupt("return");
|
|
9807
|
-
case
|
|
9808
|
-
_context5.prev =
|
|
9809
|
-
|
|
9810
|
-
|
|
9983
|
+
case 5:
|
|
9984
|
+
_context5.prev = 5;
|
|
9985
|
+
this.flv._transferCost.start(TRANSFER_EVENT.DEMUX);
|
|
9986
|
+
demuxer.demuxAndFix(chunk, this.seamlessLoadingSwitching || this._discontinuity, this._contiguous, this._demuxStartTime, this.seamlessLoadingSwitching);
|
|
9987
|
+
this.seamlessLoadingSwitching = false;
|
|
9988
|
+
this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
|
|
9989
|
+
_context5.next = 15;
|
|
9811
9990
|
break;
|
|
9812
|
-
case
|
|
9813
|
-
_context5.prev =
|
|
9814
|
-
_context5.t0 = _context5["catch"](
|
|
9991
|
+
case 12:
|
|
9992
|
+
_context5.prev = 12;
|
|
9993
|
+
_context5.t0 = _context5["catch"](5);
|
|
9815
9994
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, _context5.t0);
|
|
9816
|
-
case
|
|
9995
|
+
case 15:
|
|
9817
9996
|
videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
|
|
9997
|
+
if (!this.seamlessLoadingSwitch) {
|
|
9998
|
+
_context5.next = 25;
|
|
9999
|
+
break;
|
|
10000
|
+
}
|
|
10001
|
+
idx = videoTrack.samples.findIndex(function(sample) {
|
|
10002
|
+
return sample.originDts === videoTrack.lastKeyFrameDts;
|
|
10003
|
+
});
|
|
10004
|
+
if (!(idx >= 0)) {
|
|
10005
|
+
_context5.next = 25;
|
|
10006
|
+
break;
|
|
10007
|
+
}
|
|
10008
|
+
videoTrack.samples.splice(idx);
|
|
10009
|
+
_context5.next = 22;
|
|
10010
|
+
return this.seamlessLoadingSwitch();
|
|
10011
|
+
case 22:
|
|
10012
|
+
this.seamlessLoadingSwitch = null;
|
|
10013
|
+
chunk = null;
|
|
10014
|
+
switchingNoReset = true;
|
|
10015
|
+
case 25:
|
|
9818
10016
|
videoExist = videoTrack.exist();
|
|
9819
10017
|
audioExist = audioTrack.exist();
|
|
9820
10018
|
if (this._opts.onlyAudio) {
|
|
@@ -9826,7 +10024,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9826
10024
|
audioTrack.present = false;
|
|
9827
10025
|
}
|
|
9828
10026
|
if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
|
|
9829
|
-
_context5.next =
|
|
10027
|
+
_context5.next = 42;
|
|
9830
10028
|
break;
|
|
9831
10029
|
}
|
|
9832
10030
|
duration = 0;
|
|
@@ -9835,7 +10033,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9835
10033
|
duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
|
|
9836
10034
|
}
|
|
9837
10035
|
if (!(duration > this._opts.analyzeDuration)) {
|
|
9838
|
-
_context5.next =
|
|
10036
|
+
_context5.next = 40;
|
|
9839
10037
|
break;
|
|
9840
10038
|
}
|
|
9841
10039
|
logger$1.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
|
|
@@ -9844,18 +10042,20 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9844
10042
|
this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, {
|
|
9845
10043
|
duration
|
|
9846
10044
|
});
|
|
9847
|
-
_context5.next =
|
|
10045
|
+
_context5.next = 42;
|
|
9848
10046
|
break;
|
|
9849
|
-
case
|
|
10047
|
+
case 40:
|
|
9850
10048
|
this._cachedBuffer = chunk;
|
|
9851
10049
|
return _context5.abrupt("return");
|
|
9852
|
-
case
|
|
10050
|
+
case 42:
|
|
9853
10051
|
videoType = videoTrack.type;
|
|
9854
10052
|
audioType = audioTrack.type;
|
|
9855
10053
|
this._fireEvents(videoTrack, audioTrack, metadataTrack);
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
10054
|
+
if (!switchingNoReset) {
|
|
10055
|
+
this._discontinuity = false;
|
|
10056
|
+
this._contiguous = true;
|
|
10057
|
+
this._demuxStartTime = 0;
|
|
10058
|
+
}
|
|
9859
10059
|
mse = this._mse;
|
|
9860
10060
|
this.flv.emit(EVENT.DEMUXED_TRACK, {
|
|
9861
10061
|
videoTrack
|
|
@@ -9867,16 +10067,16 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9867
10067
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
9868
10068
|
}
|
|
9869
10069
|
if (!mse) {
|
|
9870
|
-
_context5.next =
|
|
10070
|
+
_context5.next = 80;
|
|
9871
10071
|
break;
|
|
9872
10072
|
}
|
|
9873
10073
|
if (this._sourceCreated) {
|
|
9874
|
-
_context5.next =
|
|
10074
|
+
_context5.next = 58;
|
|
9875
10075
|
break;
|
|
9876
10076
|
}
|
|
9877
|
-
_context5.next =
|
|
10077
|
+
_context5.next = 54;
|
|
9878
10078
|
return mse.open();
|
|
9879
|
-
case
|
|
10079
|
+
case 54:
|
|
9880
10080
|
if (videoExist) {
|
|
9881
10081
|
logger$1.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
|
|
9882
10082
|
mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
|
|
@@ -9887,26 +10087,28 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9887
10087
|
}
|
|
9888
10088
|
this._sourceCreated = true;
|
|
9889
10089
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
9890
|
-
case
|
|
9891
|
-
_context5.prev =
|
|
10090
|
+
case 58:
|
|
10091
|
+
_context5.prev = 58;
|
|
9892
10092
|
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
9893
10093
|
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
9894
10094
|
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
9895
10095
|
}
|
|
10096
|
+
this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
|
|
9896
10097
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
9897
|
-
|
|
10098
|
+
this.flv._transferCost.end(TRANSFER_EVENT.REMUX);
|
|
10099
|
+
_context5.next = 68;
|
|
9898
10100
|
break;
|
|
9899
|
-
case
|
|
9900
|
-
_context5.prev =
|
|
9901
|
-
_context5.t1 = _context5["catch"](
|
|
10101
|
+
case 65:
|
|
10102
|
+
_context5.prev = 65;
|
|
10103
|
+
_context5.t1 = _context5["catch"](58);
|
|
9902
10104
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
9903
|
-
case
|
|
10105
|
+
case 68:
|
|
9904
10106
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
9905
|
-
_context5.next =
|
|
10107
|
+
_context5.next = 70;
|
|
9906
10108
|
break;
|
|
9907
10109
|
}
|
|
9908
10110
|
return _context5.abrupt("return");
|
|
9909
|
-
case
|
|
10111
|
+
case 70:
|
|
9910
10112
|
this._needInitSegment = false;
|
|
9911
10113
|
p = [];
|
|
9912
10114
|
if (remuxResult.videoInitSegment)
|
|
@@ -9917,16 +10119,19 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9917
10119
|
p.push(mse.append(videoType, remuxResult.videoSegment));
|
|
9918
10120
|
if (remuxResult.audioSegment)
|
|
9919
10121
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
9920
|
-
|
|
9921
|
-
|
|
10122
|
+
this.flv._transferCost.start(TRANSFER_EVENT.APPEND);
|
|
10123
|
+
return _context5.abrupt("return", Promise.all(p).then(function() {
|
|
10124
|
+
_this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
|
|
10125
|
+
}));
|
|
10126
|
+
case 80:
|
|
9922
10127
|
if (this._softVideo) {
|
|
9923
10128
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
9924
10129
|
}
|
|
9925
|
-
case
|
|
10130
|
+
case 81:
|
|
9926
10131
|
case "end":
|
|
9927
10132
|
return _context5.stop();
|
|
9928
10133
|
}
|
|
9929
|
-
}, _callee5, this, [[
|
|
10134
|
+
}, _callee5, this, [[5, 12], [58, 65]]);
|
|
9930
10135
|
}));
|
|
9931
10136
|
function appendBuffer(_x2) {
|
|
9932
10137
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -9937,7 +10142,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9937
10142
|
key: "evictBuffer",
|
|
9938
10143
|
value: function() {
|
|
9939
10144
|
var _evictBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(bufferBehind) {
|
|
9940
|
-
var
|
|
10145
|
+
var _this2 = this;
|
|
9941
10146
|
var media, currentTime, removeEnd, start;
|
|
9942
10147
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
9943
10148
|
while (1)
|
|
@@ -9966,7 +10171,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9966
10171
|
return _context6.abrupt("return");
|
|
9967
10172
|
case 10:
|
|
9968
10173
|
return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
|
|
9969
|
-
return
|
|
10174
|
+
return _this2.flv.emit(EVENT.REMOVE_BUFFER, {
|
|
9970
10175
|
removeEnd
|
|
9971
10176
|
});
|
|
9972
10177
|
}));
|
|
@@ -10016,16 +10221,16 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10016
10221
|
}, {
|
|
10017
10222
|
key: "_fireEvents",
|
|
10018
10223
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
|
|
10019
|
-
var
|
|
10224
|
+
var _this3 = this;
|
|
10020
10225
|
logger$1.debug(videoTrack.samples, audioTrack.samples);
|
|
10021
10226
|
metadataTrack.flvScriptSamples.forEach(function(sample) {
|
|
10022
|
-
|
|
10227
|
+
_this3.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
|
|
10023
10228
|
logger$1.debug("flvScriptData", sample);
|
|
10024
10229
|
});
|
|
10025
10230
|
videoTrack.samples.forEach(function(sample) {
|
|
10026
10231
|
if (sample.keyframe) {
|
|
10027
|
-
|
|
10028
|
-
pts: sample.
|
|
10232
|
+
_this3.flv.emit(EVENT.KEYFRAME, {
|
|
10233
|
+
pts: sample.originPts
|
|
10029
10234
|
});
|
|
10030
10235
|
}
|
|
10031
10236
|
});
|
|
@@ -10043,7 +10248,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10043
10248
|
break;
|
|
10044
10249
|
}
|
|
10045
10250
|
if (type)
|
|
10046
|
-
|
|
10251
|
+
_this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10047
10252
|
type
|
|
10048
10253
|
}));
|
|
10049
10254
|
logger$1.warn("video exception", warn);
|
|
@@ -10062,13 +10267,13 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10062
10267
|
break;
|
|
10063
10268
|
}
|
|
10064
10269
|
if (type)
|
|
10065
|
-
|
|
10270
|
+
_this3.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10066
10271
|
type
|
|
10067
10272
|
}));
|
|
10068
10273
|
logger$1.warn("audio exception", warn);
|
|
10069
10274
|
});
|
|
10070
10275
|
metadataTrack.seiSamples.forEach(function(sei) {
|
|
10071
|
-
|
|
10276
|
+
_this3.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
|
|
10072
10277
|
sei: {
|
|
10073
10278
|
code: sei.data.type,
|
|
10074
10279
|
content: sei.data.payload,
|
|
@@ -10103,7 +10308,8 @@ function getOption(opts) {
|
|
|
10103
10308
|
durationForMSELowLatencyOff: 6,
|
|
10104
10309
|
chunkCountForSpeed: 50,
|
|
10105
10310
|
skipChunkSize: 1e3,
|
|
10106
|
-
longtimeNoReceived: 3e3
|
|
10311
|
+
longtimeNoReceived: 3e3,
|
|
10312
|
+
enableStartGapJump: true
|
|
10107
10313
|
}, opts);
|
|
10108
10314
|
if (ret.isLive) {
|
|
10109
10315
|
if (ret.preloadTime) {
|
|
@@ -10171,7 +10377,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10171
10377
|
_defineProperty$3(_assertThisInitialized$3(_this), "_acceptRanges", true);
|
|
10172
10378
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onProgress", /* @__PURE__ */ function() {
|
|
10173
10379
|
var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee(chunk, done, _ref, response) {
|
|
10174
|
-
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
|
|
10380
|
+
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, elapsed, _this$_bufferService, remaining, maxReaderInterval;
|
|
10175
10381
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10176
10382
|
while (1)
|
|
10177
10383
|
switch (_context.prev = _context.next) {
|
|
@@ -10179,7 +10385,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10179
10385
|
startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
|
|
10180
10386
|
_this._loading = !done;
|
|
10181
10387
|
if (_this._firstProgressEmit) {
|
|
10182
|
-
_context.next =
|
|
10388
|
+
_context.next = 13;
|
|
10183
10389
|
break;
|
|
10184
10390
|
}
|
|
10185
10391
|
if (_this.media) {
|
|
@@ -10190,49 +10396,51 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10190
10396
|
return _context.abrupt("return");
|
|
10191
10397
|
case 6:
|
|
10192
10398
|
headers = response.headers;
|
|
10399
|
+
elapsed = st ? firstByteTime - st : endTime - startTime;
|
|
10193
10400
|
_this.emit(EVENT.TTFB, {
|
|
10194
10401
|
url: _this._opts.url,
|
|
10195
10402
|
responseUrl: response.url,
|
|
10196
|
-
elapsed
|
|
10403
|
+
elapsed
|
|
10197
10404
|
});
|
|
10198
10405
|
_this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
10199
10406
|
headers
|
|
10200
10407
|
});
|
|
10408
|
+
_this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
|
|
10201
10409
|
_this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
|
|
10202
10410
|
_this._firstProgressEmit = true;
|
|
10203
|
-
case
|
|
10411
|
+
case 13:
|
|
10204
10412
|
if (_this._bufferService) {
|
|
10205
|
-
_context.next =
|
|
10413
|
+
_context.next = 15;
|
|
10206
10414
|
break;
|
|
10207
10415
|
}
|
|
10208
10416
|
return _context.abrupt("return");
|
|
10209
|
-
case
|
|
10417
|
+
case 15:
|
|
10210
10418
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
10211
10419
|
_this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
|
|
10212
|
-
_context.prev =
|
|
10213
|
-
_context.next =
|
|
10420
|
+
_context.prev = 17;
|
|
10421
|
+
_context.next = 20;
|
|
10214
10422
|
return _this._bufferService.appendBuffer(chunk);
|
|
10215
|
-
case
|
|
10423
|
+
case 20:
|
|
10216
10424
|
(_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
|
|
10217
|
-
_context.next =
|
|
10425
|
+
_context.next = 33;
|
|
10218
10426
|
break;
|
|
10219
|
-
case
|
|
10220
|
-
_context.prev =
|
|
10221
|
-
_context.t0 = _context["catch"](
|
|
10427
|
+
case 23:
|
|
10428
|
+
_context.prev = 23;
|
|
10429
|
+
_context.t0 = _context["catch"](17);
|
|
10222
10430
|
if (!(!_this.isLive && _this._bufferService.isFull())) {
|
|
10223
|
-
_context.next =
|
|
10431
|
+
_context.next = 32;
|
|
10224
10432
|
break;
|
|
10225
10433
|
}
|
|
10226
|
-
_context.next =
|
|
10434
|
+
_context.next = 28;
|
|
10227
10435
|
return _this._mediaLoader.cancel();
|
|
10228
|
-
case
|
|
10436
|
+
case 28:
|
|
10229
10437
|
_this._loading = false;
|
|
10230
10438
|
remaining = _this.bufferInfo().remaining;
|
|
10231
10439
|
_this._opts.preloadTime = parseInt(remaining) / 2;
|
|
10232
10440
|
return _context.abrupt("return");
|
|
10233
|
-
case
|
|
10441
|
+
case 32:
|
|
10234
10442
|
return _context.abrupt("return", _this._emitError(StreamingError.create(_context.t0)));
|
|
10235
|
-
case
|
|
10443
|
+
case 33:
|
|
10236
10444
|
if (_this._urlSwitching) {
|
|
10237
10445
|
_this._urlSwitching = false;
|
|
10238
10446
|
_this.emit(EVENT.SWITCH_URL_SUCCESS, {
|
|
@@ -10244,7 +10452,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10244
10452
|
_this._tick();
|
|
10245
10453
|
}
|
|
10246
10454
|
if (!(done && !_this.media.seeking)) {
|
|
10247
|
-
_context.next =
|
|
10455
|
+
_context.next = 40;
|
|
10248
10456
|
break;
|
|
10249
10457
|
}
|
|
10250
10458
|
_this.emit(EVENT.LOAD_COMPLETE);
|
|
@@ -10253,13 +10461,13 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10253
10461
|
_this._end();
|
|
10254
10462
|
}
|
|
10255
10463
|
return _context.abrupt("return");
|
|
10256
|
-
case
|
|
10464
|
+
case 40:
|
|
10257
10465
|
if (_this.isLive) {
|
|
10258
|
-
_context.next =
|
|
10466
|
+
_context.next = 42;
|
|
10259
10467
|
break;
|
|
10260
10468
|
}
|
|
10261
10469
|
return _context.abrupt("return");
|
|
10262
|
-
case
|
|
10470
|
+
case 42:
|
|
10263
10471
|
maxReaderInterval = _this._opts.maxReaderInterval;
|
|
10264
10472
|
if (maxReaderInterval && _this._firstProgressEmit) {
|
|
10265
10473
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
@@ -10273,11 +10481,11 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10273
10481
|
_this._end();
|
|
10274
10482
|
}, maxReaderInterval);
|
|
10275
10483
|
}
|
|
10276
|
-
case
|
|
10484
|
+
case 44:
|
|
10277
10485
|
case "end":
|
|
10278
10486
|
return _context.stop();
|
|
10279
10487
|
}
|
|
10280
|
-
}, _callee, null, [[
|
|
10488
|
+
}, _callee, null, [[17, 23]]);
|
|
10281
10489
|
}));
|
|
10282
10490
|
return function(_x, _x2, _x3, _x4) {
|
|
10283
10491
|
return _ref2.apply(this, arguments);
|
|
@@ -10310,12 +10518,12 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10310
10518
|
if (bufferEnd < MAX_HOLE || !media.readyState)
|
|
10311
10519
|
return;
|
|
10312
10520
|
var opts = _this._opts;
|
|
10313
|
-
if (isMediaPlaying(media)) {
|
|
10521
|
+
if (isMediaPlaying(media) && media.currentTime) {
|
|
10314
10522
|
if (_this._gapService) {
|
|
10315
10523
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10316
10524
|
}
|
|
10317
10525
|
} else {
|
|
10318
|
-
if (!media.currentTime && _this._gapService) {
|
|
10526
|
+
if (!media.currentTime && _this._gapService && opts.enableStartGapJump) {
|
|
10319
10527
|
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10320
10528
|
if (gapJump) {
|
|
10321
10529
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
@@ -10471,6 +10679,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10471
10679
|
responseType: "arraybuffer"
|
|
10472
10680
|
}));
|
|
10473
10681
|
_this._disconnectRetryCount = _this._opts.disconnectRetryCount;
|
|
10682
|
+
_this._transferCost = new TransferCost();
|
|
10474
10683
|
_this._bufferService = new BufferService(_assertThisInitialized$3(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
|
|
10475
10684
|
_this._seiService = new SeiService(_assertThisInitialized$3(_this));
|
|
10476
10685
|
_this._bandwidthService = new BandwidthService({
|
|
@@ -10494,7 +10703,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10494
10703
|
_createClass$4(Flv2, [{
|
|
10495
10704
|
key: "version",
|
|
10496
10705
|
get: function get() {
|
|
10497
|
-
return "3.0.
|
|
10706
|
+
return "3.0.20-rc.3";
|
|
10498
10707
|
}
|
|
10499
10708
|
}, {
|
|
10500
10709
|
key: "isLive",
|
|
@@ -10610,9 +10819,9 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10610
10819
|
return this._clear();
|
|
10611
10820
|
case 8:
|
|
10612
10821
|
setTimeout(function() {
|
|
10822
|
+
_this2._seamlessSwitching = true;
|
|
10613
10823
|
_this2._loadData(_this2._opts.url);
|
|
10614
10824
|
_this2._bufferService.seamlessSwitch();
|
|
10615
|
-
_this2._seamlessSwitching = true;
|
|
10616
10825
|
});
|
|
10617
10826
|
_context5.next = 13;
|
|
10618
10827
|
break;
|
|
@@ -10636,50 +10845,82 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10636
10845
|
}, {
|
|
10637
10846
|
key: "disconnect",
|
|
10638
10847
|
value: function disconnect() {
|
|
10848
|
+
var _this$_bufferService4;
|
|
10639
10849
|
logger.debug("disconnect!");
|
|
10850
|
+
(_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
|
|
10640
10851
|
return this._clear();
|
|
10641
10852
|
}
|
|
10642
10853
|
}, {
|
|
10643
10854
|
key: "switchURL",
|
|
10644
10855
|
value: function() {
|
|
10645
|
-
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10856
|
+
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(url, seamless) {
|
|
10646
10857
|
var _this3 = this;
|
|
10647
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10858
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
10648
10859
|
while (1)
|
|
10649
|
-
switch (
|
|
10860
|
+
switch (_context7.prev = _context7.next) {
|
|
10650
10861
|
case 0:
|
|
10651
10862
|
if (this._bufferService) {
|
|
10652
|
-
|
|
10863
|
+
_context7.next = 2;
|
|
10653
10864
|
break;
|
|
10654
10865
|
}
|
|
10655
|
-
return
|
|
10866
|
+
return _context7.abrupt("return");
|
|
10656
10867
|
case 2:
|
|
10657
10868
|
this._resetDisconnectCount();
|
|
10869
|
+
if (!(this._loading && seamless)) {
|
|
10870
|
+
_context7.next = 6;
|
|
10871
|
+
break;
|
|
10872
|
+
}
|
|
10873
|
+
this._bufferService.seamlessLoadingSwitch = /* @__PURE__ */ function() {
|
|
10874
|
+
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(pts) {
|
|
10875
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10876
|
+
while (1)
|
|
10877
|
+
switch (_context6.prev = _context6.next) {
|
|
10878
|
+
case 0:
|
|
10879
|
+
_context6.next = 2;
|
|
10880
|
+
return _this3._clear();
|
|
10881
|
+
case 2:
|
|
10882
|
+
_this3._bufferService.seamlessLoadingSwitching = true;
|
|
10883
|
+
_this3._urlSwitching = true;
|
|
10884
|
+
_this3._seamlessSwitching = true;
|
|
10885
|
+
_this3._bufferService.seamlessSwitch();
|
|
10886
|
+
_this3._loadData(url);
|
|
10887
|
+
case 7:
|
|
10888
|
+
case "end":
|
|
10889
|
+
return _context6.stop();
|
|
10890
|
+
}
|
|
10891
|
+
}, _callee6);
|
|
10892
|
+
}));
|
|
10893
|
+
return function(_x8) {
|
|
10894
|
+
return _ref5.apply(this, arguments);
|
|
10895
|
+
};
|
|
10896
|
+
}();
|
|
10897
|
+
return _context7.abrupt("return");
|
|
10898
|
+
case 6:
|
|
10658
10899
|
if (!(!seamless || !this._opts.isLive)) {
|
|
10659
|
-
|
|
10900
|
+
_context7.next = 11;
|
|
10660
10901
|
break;
|
|
10661
10902
|
}
|
|
10662
|
-
|
|
10903
|
+
_context7.next = 9;
|
|
10663
10904
|
return this.load(url);
|
|
10664
|
-
case
|
|
10905
|
+
case 9:
|
|
10665
10906
|
this._urlSwitching = true;
|
|
10666
|
-
return
|
|
10907
|
+
return _context7.abrupt("return", this.media.play(true).catch(function() {
|
|
10667
10908
|
}));
|
|
10668
|
-
case
|
|
10669
|
-
|
|
10909
|
+
case 11:
|
|
10910
|
+
_context7.next = 13;
|
|
10670
10911
|
return this._clear();
|
|
10671
|
-
case
|
|
10912
|
+
case 13:
|
|
10672
10913
|
setTimeout(function() {
|
|
10673
10914
|
_this3._urlSwitching = true;
|
|
10674
10915
|
_this3._seamlessSwitching = true;
|
|
10675
10916
|
_this3._loadData(url);
|
|
10676
10917
|
_this3._bufferService.seamlessSwitch();
|
|
10677
10918
|
});
|
|
10678
|
-
case
|
|
10919
|
+
case 14:
|
|
10679
10920
|
case "end":
|
|
10680
|
-
return
|
|
10921
|
+
return _context7.stop();
|
|
10681
10922
|
}
|
|
10682
|
-
},
|
|
10923
|
+
}, _callee7, this);
|
|
10683
10924
|
}));
|
|
10684
10925
|
function switchURL(_x6, _x7) {
|
|
10685
10926
|
return _switchURL.apply(this, arguments);
|
|
@@ -10689,16 +10930,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10689
10930
|
}, {
|
|
10690
10931
|
key: "destroy",
|
|
10691
10932
|
value: function() {
|
|
10692
|
-
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10693
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10933
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
|
|
10934
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
10694
10935
|
while (1)
|
|
10695
|
-
switch (
|
|
10936
|
+
switch (_context8.prev = _context8.next) {
|
|
10696
10937
|
case 0:
|
|
10697
10938
|
if (this.media) {
|
|
10698
|
-
|
|
10939
|
+
_context8.next = 2;
|
|
10699
10940
|
break;
|
|
10700
10941
|
}
|
|
10701
|
-
return
|
|
10942
|
+
return _context8.abrupt("return");
|
|
10702
10943
|
case 2:
|
|
10703
10944
|
this.removeAllListeners();
|
|
10704
10945
|
this._seiService.reset();
|
|
@@ -10708,16 +10949,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10708
10949
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10709
10950
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10710
10951
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10711
|
-
|
|
10952
|
+
_context8.next = 12;
|
|
10712
10953
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10713
10954
|
case 12:
|
|
10714
10955
|
this.media = null;
|
|
10715
10956
|
this._bufferService = null;
|
|
10716
10957
|
case 14:
|
|
10717
10958
|
case "end":
|
|
10718
|
-
return
|
|
10959
|
+
return _context8.stop();
|
|
10719
10960
|
}
|
|
10720
|
-
},
|
|
10961
|
+
}, _callee8, this);
|
|
10721
10962
|
}));
|
|
10722
10963
|
function destroy() {
|
|
10723
10964
|
return _destroy.apply(this, arguments);
|
|
@@ -10746,26 +10987,26 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10746
10987
|
}, {
|
|
10747
10988
|
key: "_reset",
|
|
10748
10989
|
value: function() {
|
|
10749
|
-
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10750
|
-
var reuseMse,
|
|
10751
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10990
|
+
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
|
|
10991
|
+
var reuseMse, _args9 = arguments;
|
|
10992
|
+
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
10752
10993
|
while (1)
|
|
10753
|
-
switch (
|
|
10994
|
+
switch (_context9.prev = _context9.next) {
|
|
10754
10995
|
case 0:
|
|
10755
|
-
reuseMse =
|
|
10996
|
+
reuseMse = _args9.length > 0 && _args9[0] !== void 0 ? _args9[0] : false;
|
|
10756
10997
|
this._seiService.reset();
|
|
10757
10998
|
this._bandwidthService.reset();
|
|
10758
10999
|
this._stats.reset();
|
|
10759
|
-
|
|
11000
|
+
_context9.next = 6;
|
|
10760
11001
|
return this._clear();
|
|
10761
11002
|
case 6:
|
|
10762
|
-
|
|
11003
|
+
_context9.next = 8;
|
|
10763
11004
|
return this._bufferService.reset(reuseMse);
|
|
10764
11005
|
case 8:
|
|
10765
11006
|
case "end":
|
|
10766
|
-
return
|
|
11007
|
+
return _context9.stop();
|
|
10767
11008
|
}
|
|
10768
|
-
},
|
|
11009
|
+
}, _callee9, this);
|
|
10769
11010
|
}));
|
|
10770
11011
|
function _reset() {
|
|
10771
11012
|
return _reset2.apply(this, arguments);
|
|
@@ -10775,17 +11016,17 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10775
11016
|
}, {
|
|
10776
11017
|
key: "_loadData",
|
|
10777
11018
|
value: function() {
|
|
10778
|
-
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
11019
|
+
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10(url, range) {
|
|
10779
11020
|
var finnalUrl;
|
|
10780
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11021
|
+
return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
|
|
10781
11022
|
while (1)
|
|
10782
|
-
switch (
|
|
11023
|
+
switch (_context10.prev = _context10.next) {
|
|
10783
11024
|
case 0:
|
|
10784
11025
|
if (url)
|
|
10785
11026
|
this._opts.url = url;
|
|
10786
11027
|
finnalUrl = url = this._opts.url;
|
|
10787
11028
|
if (url) {
|
|
10788
|
-
|
|
11029
|
+
_context10.next = 4;
|
|
10789
11030
|
break;
|
|
10790
11031
|
}
|
|
10791
11032
|
throw new Error("Source url is missing");
|
|
@@ -10800,34 +11041,34 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10800
11041
|
});
|
|
10801
11042
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
10802
11043
|
if (!this._loading) {
|
|
10803
|
-
|
|
11044
|
+
_context10.next = 11;
|
|
10804
11045
|
break;
|
|
10805
11046
|
}
|
|
10806
|
-
|
|
11047
|
+
_context10.next = 11;
|
|
10807
11048
|
return this._mediaLoader.cancel();
|
|
10808
11049
|
case 11:
|
|
10809
11050
|
this._loading = true;
|
|
10810
|
-
|
|
10811
|
-
|
|
11051
|
+
_context10.prev = 12;
|
|
11052
|
+
_context10.next = 15;
|
|
10812
11053
|
return this._mediaLoader.load({
|
|
10813
11054
|
url: finnalUrl,
|
|
10814
11055
|
range
|
|
10815
11056
|
});
|
|
10816
11057
|
case 15:
|
|
10817
|
-
|
|
11058
|
+
_context10.next = 21;
|
|
10818
11059
|
break;
|
|
10819
11060
|
case 17:
|
|
10820
|
-
|
|
10821
|
-
|
|
11061
|
+
_context10.prev = 17;
|
|
11062
|
+
_context10.t0 = _context10["catch"](12);
|
|
10822
11063
|
this._loading = false;
|
|
10823
|
-
return
|
|
11064
|
+
return _context10.abrupt("return", this._emitError(StreamingError.network(_context10.t0), false));
|
|
10824
11065
|
case 21:
|
|
10825
11066
|
case "end":
|
|
10826
|
-
return
|
|
11067
|
+
return _context10.stop();
|
|
10827
11068
|
}
|
|
10828
|
-
},
|
|
11069
|
+
}, _callee10, this, [[12, 17]]);
|
|
10829
11070
|
}));
|
|
10830
|
-
function _loadData(
|
|
11071
|
+
function _loadData(_x9, _x10) {
|
|
10831
11072
|
return _loadData2.apply(this, arguments);
|
|
10832
11073
|
}
|
|
10833
11074
|
return _loadData;
|
|
@@ -10835,16 +11076,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10835
11076
|
}, {
|
|
10836
11077
|
key: "_clear",
|
|
10837
11078
|
value: function() {
|
|
10838
|
-
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10839
|
-
return _regeneratorRuntime$1().wrap(function
|
|
11079
|
+
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee11() {
|
|
11080
|
+
return _regeneratorRuntime$1().wrap(function _callee11$(_context11) {
|
|
10840
11081
|
while (1)
|
|
10841
|
-
switch (
|
|
11082
|
+
switch (_context11.prev = _context11.next) {
|
|
10842
11083
|
case 0:
|
|
10843
11084
|
if (!this._mediaLoader) {
|
|
10844
|
-
|
|
11085
|
+
_context11.next = 3;
|
|
10845
11086
|
break;
|
|
10846
11087
|
}
|
|
10847
|
-
|
|
11088
|
+
_context11.next = 3;
|
|
10848
11089
|
return this._mediaLoader.cancel();
|
|
10849
11090
|
case 3:
|
|
10850
11091
|
clearTimeout(this._maxChunkWaitTimer);
|
|
@@ -10853,9 +11094,9 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10853
11094
|
this._firstProgressEmit = false;
|
|
10854
11095
|
case 7:
|
|
10855
11096
|
case "end":
|
|
10856
|
-
return
|
|
11097
|
+
return _context11.stop();
|
|
10857
11098
|
}
|
|
10858
|
-
},
|
|
11099
|
+
}, _callee11, this);
|
|
10859
11100
|
}));
|
|
10860
11101
|
function _clear() {
|
|
10861
11102
|
return _clear2.apply(this, arguments);
|
|
@@ -11049,6 +11290,11 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
11049
11290
|
var _this$flv3;
|
|
11050
11291
|
return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
|
|
11051
11292
|
}
|
|
11293
|
+
}, {
|
|
11294
|
+
key: "transferCost",
|
|
11295
|
+
get: function get() {
|
|
11296
|
+
return this.flv._transferCost.transferCost;
|
|
11297
|
+
}
|
|
11052
11298
|
}, {
|
|
11053
11299
|
key: "beforePlayerInit",
|
|
11054
11300
|
value: function beforePlayerInit() {
|
|
@@ -11068,8 +11314,8 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
11068
11314
|
isLive: config.isLive,
|
|
11069
11315
|
media: this.player.video,
|
|
11070
11316
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
11071
|
-
var _this2$player
|
|
11072
|
-
return ((_this2$player
|
|
11317
|
+
var _this2$player, _this2$player$preProc;
|
|
11318
|
+
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)) || {
|
|
11073
11319
|
url,
|
|
11074
11320
|
ext
|
|
11075
11321
|
};
|