@byteplus/veplayer-plugin 2.4.1-rc.1 → 2.4.2-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 +42132 -43390
- package/esm/index.production.js +3 -3
- package/esm/veplayer.plugin.abr.development.js +2238 -2555
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +158 -419
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +79 -738
- 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 +138 -61
- 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 +2238 -2555
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +158 -419
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +79 -738
- 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 +138 -61
- 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.19-rc.0";
|
|
1542
1542
|
var ERROR_MAP = {
|
|
1543
1543
|
1: 5101,
|
|
1544
1544
|
2: 5102,
|
|
@@ -2759,21 +2759,6 @@ var Buffer$1 = /* @__PURE__ */ function() {
|
|
|
2759
2759
|
length: Buffer2.totalLength && Buffer2.totalLength(buffers)
|
|
2760
2760
|
};
|
|
2761
2761
|
}
|
|
2762
|
-
}, {
|
|
2763
|
-
key: "isBuffered",
|
|
2764
|
-
value: function isBuffered(media, pos) {
|
|
2765
|
-
if (media) {
|
|
2766
|
-
var buffered = Buffer2.get(media);
|
|
2767
|
-
if (buffered !== null && buffered !== void 0 && buffered.length) {
|
|
2768
|
-
for (var i = 0; i < buffered.length; i++) {
|
|
2769
|
-
if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
|
|
2770
|
-
return true;
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
2775
|
-
return false;
|
|
2776
|
-
}
|
|
2777
2762
|
}]);
|
|
2778
2763
|
return Buffer2;
|
|
2779
2764
|
}();
|
|
@@ -5538,7 +5523,6 @@ var TrackType = {
|
|
|
5538
5523
|
METADATA: "metadata"
|
|
5539
5524
|
};
|
|
5540
5525
|
var VideoCodecType = {
|
|
5541
|
-
AV1: "av1",
|
|
5542
5526
|
AVC: "avc",
|
|
5543
5527
|
HEVC: "hevc"
|
|
5544
5528
|
};
|
|
@@ -5585,7 +5569,6 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5585
5569
|
_defineProperty(this, "isVideoEncryption", false);
|
|
5586
5570
|
_defineProperty(this, "isAudioEncryption", false);
|
|
5587
5571
|
_defineProperty(this, "isVideo", true);
|
|
5588
|
-
_defineProperty(this, "lastKeyFrameDts", 0);
|
|
5589
5572
|
_defineProperty(this, "kid", null);
|
|
5590
5573
|
_defineProperty(this, "pssh", null);
|
|
5591
5574
|
_defineProperty(this, "ext", void 0);
|
|
@@ -5628,9 +5611,6 @@ var VideoTrack = /* @__PURE__ */ function() {
|
|
|
5628
5611
|
}, {
|
|
5629
5612
|
key: "exist",
|
|
5630
5613
|
value: function exist() {
|
|
5631
|
-
if (/av01/.test(this.codec)) {
|
|
5632
|
-
return true;
|
|
5633
|
-
}
|
|
5634
5614
|
return !!(this.pps.length && this.sps.length && this.codec);
|
|
5635
5615
|
}
|
|
5636
5616
|
}, {
|
|
@@ -5908,7 +5888,7 @@ var AAC = /* @__PURE__ */ function() {
|
|
|
5908
5888
|
continue;
|
|
5909
5889
|
}
|
|
5910
5890
|
frameLength = (data[i + 3] & 3) << 11 | data[i + 4] << 3 | (data[i + 5] & 224) >> 5;
|
|
5911
|
-
if (
|
|
5891
|
+
if (len - i < frameLength)
|
|
5912
5892
|
break;
|
|
5913
5893
|
protectionSkipBytes = (~data[i + 1] & 1) * 2;
|
|
5914
5894
|
frames.push({
|
|
@@ -7326,7 +7306,6 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7326
7306
|
value: function demux(data) {
|
|
7327
7307
|
var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
7328
7308
|
var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
7329
|
-
var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
|
|
7330
7309
|
var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
|
|
7331
7310
|
if (discontinuity || !contiguous) {
|
|
7332
7311
|
this._remainingData = null;
|
|
@@ -7384,8 +7363,6 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7384
7363
|
if (tagType === 8) {
|
|
7385
7364
|
this._parseAudio(bodyData, timestamp);
|
|
7386
7365
|
} else if (tagType === 9) {
|
|
7387
|
-
if (seamlessLoadingSwitching)
|
|
7388
|
-
this.seamlessLoadingSwitching = true;
|
|
7389
7366
|
this._parseVideo(bodyData, timestamp);
|
|
7390
7367
|
} else if (tagType === 18) {
|
|
7391
7368
|
this._parseScript(bodyData, timestamp);
|
|
@@ -7428,8 +7405,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7428
7405
|
}
|
|
7429
7406
|
}, {
|
|
7430
7407
|
key: "demuxAndFix",
|
|
7431
|
-
value: function demuxAndFix(data, discontinuity, contiguous, startTime
|
|
7432
|
-
this.demux(data, discontinuity, contiguous
|
|
7408
|
+
value: function demuxAndFix(data, discontinuity, contiguous, startTime) {
|
|
7409
|
+
this.demux(data, discontinuity, contiguous);
|
|
7433
7410
|
return this.fix(startTime, discontinuity, contiguous);
|
|
7434
7411
|
}
|
|
7435
7412
|
}, {
|
|
@@ -7543,13 +7520,8 @@ var FlvDemuxer = /* @__PURE__ */ function() {
|
|
|
7543
7520
|
units = this._checkAddMetaNalToUnits(isHevc, units, track);
|
|
7544
7521
|
if (units && units.length) {
|
|
7545
7522
|
var sample = new VideoSample(dts + cts, dts, units);
|
|
7546
|
-
if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
|
|
7547
|
-
return;
|
|
7548
|
-
}
|
|
7549
|
-
this.seamlessLoadingSwitching = false;
|
|
7550
7523
|
if (frameType === 1) {
|
|
7551
7524
|
sample.setToKeyframe();
|
|
7552
|
-
track.lastKeyFrameDts = dts;
|
|
7553
7525
|
}
|
|
7554
7526
|
track.samples.push(sample);
|
|
7555
7527
|
units.forEach(function(unit) {
|
|
@@ -8027,8 +7999,6 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
8027
7999
|
}
|
|
8028
8000
|
} else if (track.useEME && track.encv) {
|
|
8029
8001
|
content = MP42.encv(track);
|
|
8030
|
-
} else if (track.av1C) {
|
|
8031
|
-
content = MP42.av01(track);
|
|
8032
8002
|
} else {
|
|
8033
8003
|
content = MP42.avc1hev1(track);
|
|
8034
8004
|
}
|
|
@@ -8241,90 +8211,6 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
8241
8211
|
var schi = MP42.schi(data);
|
|
8242
8212
|
return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
|
|
8243
8213
|
}
|
|
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
|
-
}
|
|
8328
8214
|
}, {
|
|
8329
8215
|
key: "avc1hev1",
|
|
8330
8216
|
value: function avc1hev1(track) {
|
|
@@ -9297,7 +9183,7 @@ var MP4 = /* @__PURE__ */ function() {
|
|
|
9297
9183
|
}]);
|
|
9298
9184
|
return MP42;
|
|
9299
9185
|
}();
|
|
9300
|
-
_defineProperty(MP4, "types", ["
|
|
9186
|
+
_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) {
|
|
9301
9187
|
p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
|
|
9302
9188
|
return p;
|
|
9303
9189
|
}, /* @__PURE__ */ Object.create(null)));
|
|
@@ -9632,46 +9518,30 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
|
|
|
9632
9518
|
};
|
|
9633
9519
|
}
|
|
9634
9520
|
var samples = track.samples;
|
|
9635
|
-
var isAV01 = /av01/.test(track.codec);
|
|
9636
9521
|
var mdatSize = 0;
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9640
|
-
});
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
mdatSize += s.units.reduce(function(t, c) {
|
|
9644
|
-
return t + c.byteLength;
|
|
9645
|
-
}, 0);
|
|
9646
|
-
mdatSize += s.units.length * 4;
|
|
9647
|
-
});
|
|
9648
|
-
}
|
|
9522
|
+
samples.forEach(function(s) {
|
|
9523
|
+
mdatSize += s.units.reduce(function(t, c) {
|
|
9524
|
+
return t + c.byteLength;
|
|
9525
|
+
}, 0);
|
|
9526
|
+
mdatSize += s.units.length * 4;
|
|
9527
|
+
});
|
|
9649
9528
|
var mdata = new Uint8Array(mdatSize);
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
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
|
-
}
|
|
9529
|
+
var mdatView = new DataView(mdata.buffer);
|
|
9530
|
+
var _loop = function _loop2(_offset, _sample) {
|
|
9531
|
+
_sample = samples[i];
|
|
9532
|
+
var sampleSize = 0;
|
|
9533
|
+
_sample.units.forEach(function(u) {
|
|
9534
|
+
mdatView.setUint32(_offset, u.byteLength);
|
|
9535
|
+
_offset += 4;
|
|
9536
|
+
mdata.set(u, _offset);
|
|
9537
|
+
_offset += u.byteLength;
|
|
9538
|
+
sampleSize += 4 + u.byteLength;
|
|
9539
|
+
});
|
|
9540
|
+
_sample.size = sampleSize;
|
|
9541
|
+
offset = _offset, sample = _sample;
|
|
9542
|
+
};
|
|
9543
|
+
for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
|
|
9544
|
+
_loop(offset, sample);
|
|
9675
9545
|
}
|
|
9676
9546
|
var mdat = MP4.mdat(mdata);
|
|
9677
9547
|
var moof = MP4.moof([track]);
|
|
@@ -9701,55 +9571,6 @@ var FMP4Remuxer = /* @__PURE__ */ function() {
|
|
|
9701
9571
|
}]);
|
|
9702
9572
|
return FMP4Remuxer2;
|
|
9703
9573
|
}();
|
|
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
|
-
};
|
|
9753
9574
|
var logger$1 = new Logger$2("BufferService");
|
|
9754
9575
|
var BufferService = /* @__PURE__ */ function() {
|
|
9755
9576
|
function BufferService2(flv, softVideo) {
|
|
@@ -9837,8 +9658,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9837
9658
|
this._contiguous = false;
|
|
9838
9659
|
this._sourceCreated = false;
|
|
9839
9660
|
this._initSegmentId = "";
|
|
9840
|
-
|
|
9841
|
-
case 12:
|
|
9661
|
+
case 11:
|
|
9842
9662
|
case "end":
|
|
9843
9663
|
return _context.stop();
|
|
9844
9664
|
}
|
|
@@ -9849,15 +9669,6 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9849
9669
|
}
|
|
9850
9670
|
return reset;
|
|
9851
9671
|
}()
|
|
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
|
-
}
|
|
9861
9672
|
}, {
|
|
9862
9673
|
key: "endOfStream",
|
|
9863
9674
|
value: function() {
|
|
@@ -9963,56 +9774,32 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
9963
9774
|
key: "appendBuffer",
|
|
9964
9775
|
value: function() {
|
|
9965
9776
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(chunk) {
|
|
9966
|
-
var
|
|
9967
|
-
var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
|
|
9777
|
+
var demuxer, videoTrack, audioTrack, metadataTrack, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
|
|
9968
9778
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
9969
9779
|
while (1)
|
|
9970
9780
|
switch (_context5.prev = _context5.next) {
|
|
9971
9781
|
case 0:
|
|
9972
|
-
switchingNoReset = false;
|
|
9973
9782
|
if (this._cachedBuffer) {
|
|
9974
9783
|
chunk = concatUint8Array$1(this._cachedBuffer, chunk);
|
|
9975
9784
|
this._cachedBuffer = null;
|
|
9976
9785
|
}
|
|
9977
9786
|
demuxer = this._demuxer;
|
|
9978
9787
|
if (!(!chunk || !chunk.length || !demuxer)) {
|
|
9979
|
-
_context5.next =
|
|
9788
|
+
_context5.next = 4;
|
|
9980
9789
|
break;
|
|
9981
9790
|
}
|
|
9982
9791
|
return _context5.abrupt("return");
|
|
9983
|
-
case
|
|
9984
|
-
_context5.prev =
|
|
9985
|
-
this.
|
|
9986
|
-
|
|
9987
|
-
this.seamlessLoadingSwitching = false;
|
|
9988
|
-
this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
|
|
9989
|
-
_context5.next = 15;
|
|
9792
|
+
case 4:
|
|
9793
|
+
_context5.prev = 4;
|
|
9794
|
+
demuxer.demuxAndFix(chunk, this._discontinuity, this._contiguous, this._demuxStartTime);
|
|
9795
|
+
_context5.next = 11;
|
|
9990
9796
|
break;
|
|
9991
|
-
case
|
|
9992
|
-
_context5.prev =
|
|
9993
|
-
_context5.t0 = _context5["catch"](
|
|
9797
|
+
case 8:
|
|
9798
|
+
_context5.prev = 8;
|
|
9799
|
+
_context5.t0 = _context5["catch"](4);
|
|
9994
9800
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, _context5.t0);
|
|
9995
|
-
case
|
|
9801
|
+
case 11:
|
|
9996
9802
|
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:
|
|
10016
9803
|
videoExist = videoTrack.exist();
|
|
10017
9804
|
audioExist = audioTrack.exist();
|
|
10018
9805
|
if (this._opts.onlyAudio) {
|
|
@@ -10024,7 +9811,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10024
9811
|
audioTrack.present = false;
|
|
10025
9812
|
}
|
|
10026
9813
|
if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
|
|
10027
|
-
_context5.next =
|
|
9814
|
+
_context5.next = 29;
|
|
10028
9815
|
break;
|
|
10029
9816
|
}
|
|
10030
9817
|
duration = 0;
|
|
@@ -10033,7 +9820,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10033
9820
|
duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
|
|
10034
9821
|
}
|
|
10035
9822
|
if (!(duration > this._opts.analyzeDuration)) {
|
|
10036
|
-
_context5.next =
|
|
9823
|
+
_context5.next = 27;
|
|
10037
9824
|
break;
|
|
10038
9825
|
}
|
|
10039
9826
|
logger$1.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
|
|
@@ -10042,20 +9829,18 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10042
9829
|
this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, {
|
|
10043
9830
|
duration
|
|
10044
9831
|
});
|
|
10045
|
-
_context5.next =
|
|
9832
|
+
_context5.next = 29;
|
|
10046
9833
|
break;
|
|
10047
|
-
case
|
|
9834
|
+
case 27:
|
|
10048
9835
|
this._cachedBuffer = chunk;
|
|
10049
9836
|
return _context5.abrupt("return");
|
|
10050
|
-
case
|
|
9837
|
+
case 29:
|
|
10051
9838
|
videoType = videoTrack.type;
|
|
10052
9839
|
audioType = audioTrack.type;
|
|
10053
9840
|
this._fireEvents(videoTrack, audioTrack, metadataTrack);
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
this._demuxStartTime = 0;
|
|
10058
|
-
}
|
|
9841
|
+
this._discontinuity = false;
|
|
9842
|
+
this._contiguous = true;
|
|
9843
|
+
this._demuxStartTime = 0;
|
|
10059
9844
|
mse = this._mse;
|
|
10060
9845
|
this.flv.emit(EVENT.DEMUXED_TRACK, {
|
|
10061
9846
|
videoTrack
|
|
@@ -10067,16 +9852,16 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10067
9852
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
10068
9853
|
}
|
|
10069
9854
|
if (!mse) {
|
|
10070
|
-
_context5.next =
|
|
9855
|
+
_context5.next = 66;
|
|
10071
9856
|
break;
|
|
10072
9857
|
}
|
|
10073
9858
|
if (this._sourceCreated) {
|
|
10074
|
-
_context5.next =
|
|
9859
|
+
_context5.next = 47;
|
|
10075
9860
|
break;
|
|
10076
9861
|
}
|
|
10077
|
-
_context5.next =
|
|
9862
|
+
_context5.next = 43;
|
|
10078
9863
|
return mse.open();
|
|
10079
|
-
case
|
|
9864
|
+
case 43:
|
|
10080
9865
|
if (videoExist) {
|
|
10081
9866
|
logger$1.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
|
|
10082
9867
|
mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
|
|
@@ -10087,28 +9872,26 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10087
9872
|
}
|
|
10088
9873
|
this._sourceCreated = true;
|
|
10089
9874
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
10090
|
-
case
|
|
10091
|
-
_context5.prev =
|
|
9875
|
+
case 47:
|
|
9876
|
+
_context5.prev = 47;
|
|
10092
9877
|
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
10093
9878
|
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
10094
9879
|
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
10095
9880
|
}
|
|
10096
|
-
this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
|
|
10097
9881
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
10098
|
-
|
|
10099
|
-
_context5.next = 68;
|
|
9882
|
+
_context5.next = 55;
|
|
10100
9883
|
break;
|
|
10101
|
-
case
|
|
10102
|
-
_context5.prev =
|
|
10103
|
-
_context5.t1 = _context5["catch"](
|
|
9884
|
+
case 52:
|
|
9885
|
+
_context5.prev = 52;
|
|
9886
|
+
_context5.t1 = _context5["catch"](47);
|
|
10104
9887
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
10105
|
-
case
|
|
9888
|
+
case 55:
|
|
10106
9889
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
10107
|
-
_context5.next =
|
|
9890
|
+
_context5.next = 57;
|
|
10108
9891
|
break;
|
|
10109
9892
|
}
|
|
10110
9893
|
return _context5.abrupt("return");
|
|
10111
|
-
case
|
|
9894
|
+
case 57:
|
|
10112
9895
|
this._needInitSegment = false;
|
|
10113
9896
|
p = [];
|
|
10114
9897
|
if (remuxResult.videoInitSegment)
|
|
@@ -10119,19 +9902,16 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10119
9902
|
p.push(mse.append(videoType, remuxResult.videoSegment));
|
|
10120
9903
|
if (remuxResult.audioSegment)
|
|
10121
9904
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
_this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
|
|
10125
|
-
}));
|
|
10126
|
-
case 80:
|
|
9905
|
+
return _context5.abrupt("return", Promise.all(p));
|
|
9906
|
+
case 66:
|
|
10127
9907
|
if (this._softVideo) {
|
|
10128
9908
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
10129
9909
|
}
|
|
10130
|
-
case
|
|
9910
|
+
case 67:
|
|
10131
9911
|
case "end":
|
|
10132
9912
|
return _context5.stop();
|
|
10133
9913
|
}
|
|
10134
|
-
}, _callee5, this, [[
|
|
9914
|
+
}, _callee5, this, [[4, 8], [47, 52]]);
|
|
10135
9915
|
}));
|
|
10136
9916
|
function appendBuffer(_x2) {
|
|
10137
9917
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -10142,7 +9922,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10142
9922
|
key: "evictBuffer",
|
|
10143
9923
|
value: function() {
|
|
10144
9924
|
var _evictBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(bufferBehind) {
|
|
10145
|
-
var
|
|
9925
|
+
var _this = this;
|
|
10146
9926
|
var media, currentTime, removeEnd, start;
|
|
10147
9927
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10148
9928
|
while (1)
|
|
@@ -10171,7 +9951,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10171
9951
|
return _context6.abrupt("return");
|
|
10172
9952
|
case 10:
|
|
10173
9953
|
return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
|
|
10174
|
-
return
|
|
9954
|
+
return _this.flv.emit(EVENT.REMOVE_BUFFER, {
|
|
10175
9955
|
removeEnd
|
|
10176
9956
|
});
|
|
10177
9957
|
}));
|
|
@@ -10221,16 +10001,16 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10221
10001
|
}, {
|
|
10222
10002
|
key: "_fireEvents",
|
|
10223
10003
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
|
|
10224
|
-
var
|
|
10004
|
+
var _this2 = this;
|
|
10225
10005
|
logger$1.debug(videoTrack.samples, audioTrack.samples);
|
|
10226
10006
|
metadataTrack.flvScriptSamples.forEach(function(sample) {
|
|
10227
|
-
|
|
10007
|
+
_this2.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
|
|
10228
10008
|
logger$1.debug("flvScriptData", sample);
|
|
10229
10009
|
});
|
|
10230
10010
|
videoTrack.samples.forEach(function(sample) {
|
|
10231
10011
|
if (sample.keyframe) {
|
|
10232
|
-
|
|
10233
|
-
pts: sample.
|
|
10012
|
+
_this2.flv.emit(EVENT.KEYFRAME, {
|
|
10013
|
+
pts: sample.pts
|
|
10234
10014
|
});
|
|
10235
10015
|
}
|
|
10236
10016
|
});
|
|
@@ -10248,7 +10028,7 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10248
10028
|
break;
|
|
10249
10029
|
}
|
|
10250
10030
|
if (type)
|
|
10251
|
-
|
|
10031
|
+
_this2.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10252
10032
|
type
|
|
10253
10033
|
}));
|
|
10254
10034
|
logger$1.warn("video exception", warn);
|
|
@@ -10267,13 +10047,13 @@ var BufferService = /* @__PURE__ */ function() {
|
|
|
10267
10047
|
break;
|
|
10268
10048
|
}
|
|
10269
10049
|
if (type)
|
|
10270
|
-
|
|
10050
|
+
_this2.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10271
10051
|
type
|
|
10272
10052
|
}));
|
|
10273
10053
|
logger$1.warn("audio exception", warn);
|
|
10274
10054
|
});
|
|
10275
10055
|
metadataTrack.seiSamples.forEach(function(sei) {
|
|
10276
|
-
|
|
10056
|
+
_this2.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
|
|
10277
10057
|
sei: {
|
|
10278
10058
|
code: sei.data.type,
|
|
10279
10059
|
content: sei.data.payload,
|
|
@@ -10308,8 +10088,7 @@ function getOption(opts) {
|
|
|
10308
10088
|
durationForMSELowLatencyOff: 6,
|
|
10309
10089
|
chunkCountForSpeed: 50,
|
|
10310
10090
|
skipChunkSize: 1e3,
|
|
10311
|
-
longtimeNoReceived: 3e3
|
|
10312
|
-
enableStartGapJump: true
|
|
10091
|
+
longtimeNoReceived: 3e3
|
|
10313
10092
|
}, opts);
|
|
10314
10093
|
if (ret.isLive) {
|
|
10315
10094
|
if (ret.preloadTime) {
|
|
@@ -10377,7 +10156,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10377
10156
|
_defineProperty$3(_assertThisInitialized$3(_this), "_acceptRanges", true);
|
|
10378
10157
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onProgress", /* @__PURE__ */ function() {
|
|
10379
10158
|
var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee(chunk, done, _ref, response) {
|
|
10380
|
-
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers,
|
|
10159
|
+
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
|
|
10381
10160
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10382
10161
|
while (1)
|
|
10383
10162
|
switch (_context.prev = _context.next) {
|
|
@@ -10385,7 +10164,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10385
10164
|
startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
|
|
10386
10165
|
_this._loading = !done;
|
|
10387
10166
|
if (_this._firstProgressEmit) {
|
|
10388
|
-
_context.next =
|
|
10167
|
+
_context.next = 11;
|
|
10389
10168
|
break;
|
|
10390
10169
|
}
|
|
10391
10170
|
if (_this.media) {
|
|
@@ -10396,51 +10175,49 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10396
10175
|
return _context.abrupt("return");
|
|
10397
10176
|
case 6:
|
|
10398
10177
|
headers = response.headers;
|
|
10399
|
-
elapsed = st ? firstByteTime - st : endTime - startTime;
|
|
10400
10178
|
_this.emit(EVENT.TTFB, {
|
|
10401
10179
|
url: _this._opts.url,
|
|
10402
10180
|
responseUrl: response.url,
|
|
10403
|
-
elapsed
|
|
10181
|
+
elapsed: st ? firstByteTime - st : endTime - startTime
|
|
10404
10182
|
});
|
|
10405
10183
|
_this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
10406
10184
|
headers
|
|
10407
10185
|
});
|
|
10408
|
-
_this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
|
|
10409
10186
|
_this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
|
|
10410
10187
|
_this._firstProgressEmit = true;
|
|
10411
|
-
case
|
|
10188
|
+
case 11:
|
|
10412
10189
|
if (_this._bufferService) {
|
|
10413
|
-
_context.next =
|
|
10190
|
+
_context.next = 13;
|
|
10414
10191
|
break;
|
|
10415
10192
|
}
|
|
10416
10193
|
return _context.abrupt("return");
|
|
10417
|
-
case
|
|
10194
|
+
case 13:
|
|
10418
10195
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
10419
10196
|
_this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
|
|
10420
|
-
_context.prev =
|
|
10421
|
-
_context.next =
|
|
10197
|
+
_context.prev = 15;
|
|
10198
|
+
_context.next = 18;
|
|
10422
10199
|
return _this._bufferService.appendBuffer(chunk);
|
|
10423
|
-
case
|
|
10200
|
+
case 18:
|
|
10424
10201
|
(_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
|
|
10425
|
-
_context.next =
|
|
10202
|
+
_context.next = 31;
|
|
10426
10203
|
break;
|
|
10427
|
-
case
|
|
10428
|
-
_context.prev =
|
|
10429
|
-
_context.t0 = _context["catch"](
|
|
10204
|
+
case 21:
|
|
10205
|
+
_context.prev = 21;
|
|
10206
|
+
_context.t0 = _context["catch"](15);
|
|
10430
10207
|
if (!(!_this.isLive && _this._bufferService.isFull())) {
|
|
10431
|
-
_context.next =
|
|
10208
|
+
_context.next = 30;
|
|
10432
10209
|
break;
|
|
10433
10210
|
}
|
|
10434
|
-
_context.next =
|
|
10211
|
+
_context.next = 26;
|
|
10435
10212
|
return _this._mediaLoader.cancel();
|
|
10436
|
-
case
|
|
10213
|
+
case 26:
|
|
10437
10214
|
_this._loading = false;
|
|
10438
10215
|
remaining = _this.bufferInfo().remaining;
|
|
10439
10216
|
_this._opts.preloadTime = parseInt(remaining) / 2;
|
|
10440
10217
|
return _context.abrupt("return");
|
|
10441
|
-
case
|
|
10218
|
+
case 30:
|
|
10442
10219
|
return _context.abrupt("return", _this._emitError(StreamingError.create(_context.t0)));
|
|
10443
|
-
case
|
|
10220
|
+
case 31:
|
|
10444
10221
|
if (_this._urlSwitching) {
|
|
10445
10222
|
_this._urlSwitching = false;
|
|
10446
10223
|
_this.emit(EVENT.SWITCH_URL_SUCCESS, {
|
|
@@ -10452,7 +10229,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10452
10229
|
_this._tick();
|
|
10453
10230
|
}
|
|
10454
10231
|
if (!(done && !_this.media.seeking)) {
|
|
10455
|
-
_context.next =
|
|
10232
|
+
_context.next = 38;
|
|
10456
10233
|
break;
|
|
10457
10234
|
}
|
|
10458
10235
|
_this.emit(EVENT.LOAD_COMPLETE);
|
|
@@ -10461,13 +10238,13 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10461
10238
|
_this._end();
|
|
10462
10239
|
}
|
|
10463
10240
|
return _context.abrupt("return");
|
|
10464
|
-
case
|
|
10241
|
+
case 38:
|
|
10465
10242
|
if (_this.isLive) {
|
|
10466
|
-
_context.next =
|
|
10243
|
+
_context.next = 40;
|
|
10467
10244
|
break;
|
|
10468
10245
|
}
|
|
10469
10246
|
return _context.abrupt("return");
|
|
10470
|
-
case
|
|
10247
|
+
case 40:
|
|
10471
10248
|
maxReaderInterval = _this._opts.maxReaderInterval;
|
|
10472
10249
|
if (maxReaderInterval && _this._firstProgressEmit) {
|
|
10473
10250
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
@@ -10481,11 +10258,11 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10481
10258
|
_this._end();
|
|
10482
10259
|
}, maxReaderInterval);
|
|
10483
10260
|
}
|
|
10484
|
-
case
|
|
10261
|
+
case 42:
|
|
10485
10262
|
case "end":
|
|
10486
10263
|
return _context.stop();
|
|
10487
10264
|
}
|
|
10488
|
-
}, _callee, null, [[
|
|
10265
|
+
}, _callee, null, [[15, 21]]);
|
|
10489
10266
|
}));
|
|
10490
10267
|
return function(_x, _x2, _x3, _x4) {
|
|
10491
10268
|
return _ref2.apply(this, arguments);
|
|
@@ -10518,19 +10295,19 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10518
10295
|
if (bufferEnd < MAX_HOLE || !media.readyState)
|
|
10519
10296
|
return;
|
|
10520
10297
|
var opts = _this._opts;
|
|
10521
|
-
if (isMediaPlaying(media)
|
|
10298
|
+
if (isMediaPlaying(media)) {
|
|
10522
10299
|
if (_this._gapService) {
|
|
10523
10300
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10524
10301
|
}
|
|
10525
10302
|
} else {
|
|
10526
|
-
if (!media.currentTime && _this._gapService
|
|
10303
|
+
if (!media.currentTime && _this._gapService) {
|
|
10527
10304
|
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10528
10305
|
if (gapJump) {
|
|
10529
10306
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10530
10307
|
}
|
|
10531
10308
|
return;
|
|
10532
10309
|
}
|
|
10533
|
-
if (opts.isLive && media.readyState === 4 && bufferEnd
|
|
10310
|
+
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
10534
10311
|
_this.disconnect();
|
|
10535
10312
|
}
|
|
10536
10313
|
}
|
|
@@ -10679,7 +10456,6 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10679
10456
|
responseType: "arraybuffer"
|
|
10680
10457
|
}));
|
|
10681
10458
|
_this._disconnectRetryCount = _this._opts.disconnectRetryCount;
|
|
10682
|
-
_this._transferCost = new TransferCost();
|
|
10683
10459
|
_this._bufferService = new BufferService(_assertThisInitialized$3(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
|
|
10684
10460
|
_this._seiService = new SeiService(_assertThisInitialized$3(_this));
|
|
10685
10461
|
_this._bandwidthService = new BandwidthService({
|
|
@@ -10703,7 +10479,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10703
10479
|
_createClass$4(Flv2, [{
|
|
10704
10480
|
key: "version",
|
|
10705
10481
|
get: function get() {
|
|
10706
|
-
return "3.0.
|
|
10482
|
+
return "3.0.19-rc.0";
|
|
10707
10483
|
}
|
|
10708
10484
|
}, {
|
|
10709
10485
|
key: "isLive",
|
|
@@ -10819,9 +10595,9 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10819
10595
|
return this._clear();
|
|
10820
10596
|
case 8:
|
|
10821
10597
|
setTimeout(function() {
|
|
10822
|
-
_this2._seamlessSwitching = true;
|
|
10823
10598
|
_this2._loadData(_this2._opts.url);
|
|
10824
10599
|
_this2._bufferService.seamlessSwitch();
|
|
10600
|
+
_this2._seamlessSwitching = true;
|
|
10825
10601
|
});
|
|
10826
10602
|
_context5.next = 13;
|
|
10827
10603
|
break;
|
|
@@ -10845,82 +10621,50 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10845
10621
|
}, {
|
|
10846
10622
|
key: "disconnect",
|
|
10847
10623
|
value: function disconnect() {
|
|
10848
|
-
var _this$_bufferService4;
|
|
10849
10624
|
logger.debug("disconnect!");
|
|
10850
|
-
(_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
|
|
10851
10625
|
return this._clear();
|
|
10852
10626
|
}
|
|
10853
10627
|
}, {
|
|
10854
10628
|
key: "switchURL",
|
|
10855
10629
|
value: function() {
|
|
10856
|
-
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10630
|
+
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(url, seamless) {
|
|
10857
10631
|
var _this3 = this;
|
|
10858
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10632
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10859
10633
|
while (1)
|
|
10860
|
-
switch (
|
|
10634
|
+
switch (_context6.prev = _context6.next) {
|
|
10861
10635
|
case 0:
|
|
10862
10636
|
if (this._bufferService) {
|
|
10863
|
-
|
|
10637
|
+
_context6.next = 2;
|
|
10864
10638
|
break;
|
|
10865
10639
|
}
|
|
10866
|
-
return
|
|
10640
|
+
return _context6.abrupt("return");
|
|
10867
10641
|
case 2:
|
|
10868
10642
|
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:
|
|
10899
10643
|
if (!(!seamless || !this._opts.isLive)) {
|
|
10900
|
-
|
|
10644
|
+
_context6.next = 8;
|
|
10901
10645
|
break;
|
|
10902
10646
|
}
|
|
10903
|
-
|
|
10647
|
+
_context6.next = 6;
|
|
10904
10648
|
return this.load(url);
|
|
10905
|
-
case
|
|
10649
|
+
case 6:
|
|
10906
10650
|
this._urlSwitching = true;
|
|
10907
|
-
return
|
|
10651
|
+
return _context6.abrupt("return", this.media.play(true).catch(function() {
|
|
10908
10652
|
}));
|
|
10909
|
-
case
|
|
10910
|
-
|
|
10653
|
+
case 8:
|
|
10654
|
+
_context6.next = 10;
|
|
10911
10655
|
return this._clear();
|
|
10912
|
-
case
|
|
10656
|
+
case 10:
|
|
10913
10657
|
setTimeout(function() {
|
|
10914
10658
|
_this3._urlSwitching = true;
|
|
10915
10659
|
_this3._seamlessSwitching = true;
|
|
10916
10660
|
_this3._loadData(url);
|
|
10917
10661
|
_this3._bufferService.seamlessSwitch();
|
|
10918
10662
|
});
|
|
10919
|
-
case
|
|
10663
|
+
case 11:
|
|
10920
10664
|
case "end":
|
|
10921
|
-
return
|
|
10665
|
+
return _context6.stop();
|
|
10922
10666
|
}
|
|
10923
|
-
},
|
|
10667
|
+
}, _callee6, this);
|
|
10924
10668
|
}));
|
|
10925
10669
|
function switchURL(_x6, _x7) {
|
|
10926
10670
|
return _switchURL.apply(this, arguments);
|
|
@@ -10930,16 +10674,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10930
10674
|
}, {
|
|
10931
10675
|
key: "destroy",
|
|
10932
10676
|
value: function() {
|
|
10933
|
-
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10934
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10677
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7() {
|
|
10678
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
10935
10679
|
while (1)
|
|
10936
|
-
switch (
|
|
10680
|
+
switch (_context7.prev = _context7.next) {
|
|
10937
10681
|
case 0:
|
|
10938
10682
|
if (this.media) {
|
|
10939
|
-
|
|
10683
|
+
_context7.next = 2;
|
|
10940
10684
|
break;
|
|
10941
10685
|
}
|
|
10942
|
-
return
|
|
10686
|
+
return _context7.abrupt("return");
|
|
10943
10687
|
case 2:
|
|
10944
10688
|
this.removeAllListeners();
|
|
10945
10689
|
this._seiService.reset();
|
|
@@ -10949,16 +10693,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10949
10693
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10950
10694
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10951
10695
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10952
|
-
|
|
10696
|
+
_context7.next = 12;
|
|
10953
10697
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10954
10698
|
case 12:
|
|
10955
10699
|
this.media = null;
|
|
10956
10700
|
this._bufferService = null;
|
|
10957
10701
|
case 14:
|
|
10958
10702
|
case "end":
|
|
10959
|
-
return
|
|
10703
|
+
return _context7.stop();
|
|
10960
10704
|
}
|
|
10961
|
-
},
|
|
10705
|
+
}, _callee7, this);
|
|
10962
10706
|
}));
|
|
10963
10707
|
function destroy() {
|
|
10964
10708
|
return _destroy.apply(this, arguments);
|
|
@@ -10987,26 +10731,26 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
10987
10731
|
}, {
|
|
10988
10732
|
key: "_reset",
|
|
10989
10733
|
value: function() {
|
|
10990
|
-
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10991
|
-
var reuseMse,
|
|
10992
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10734
|
+
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
|
|
10735
|
+
var reuseMse, _args8 = arguments;
|
|
10736
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
10993
10737
|
while (1)
|
|
10994
|
-
switch (
|
|
10738
|
+
switch (_context8.prev = _context8.next) {
|
|
10995
10739
|
case 0:
|
|
10996
|
-
reuseMse =
|
|
10740
|
+
reuseMse = _args8.length > 0 && _args8[0] !== void 0 ? _args8[0] : false;
|
|
10997
10741
|
this._seiService.reset();
|
|
10998
10742
|
this._bandwidthService.reset();
|
|
10999
10743
|
this._stats.reset();
|
|
11000
|
-
|
|
10744
|
+
_context8.next = 6;
|
|
11001
10745
|
return this._clear();
|
|
11002
10746
|
case 6:
|
|
11003
|
-
|
|
10747
|
+
_context8.next = 8;
|
|
11004
10748
|
return this._bufferService.reset(reuseMse);
|
|
11005
10749
|
case 8:
|
|
11006
10750
|
case "end":
|
|
11007
|
-
return
|
|
10751
|
+
return _context8.stop();
|
|
11008
10752
|
}
|
|
11009
|
-
},
|
|
10753
|
+
}, _callee8, this);
|
|
11010
10754
|
}));
|
|
11011
10755
|
function _reset() {
|
|
11012
10756
|
return _reset2.apply(this, arguments);
|
|
@@ -11016,17 +10760,17 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
11016
10760
|
}, {
|
|
11017
10761
|
key: "_loadData",
|
|
11018
10762
|
value: function() {
|
|
11019
|
-
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10763
|
+
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9(url, range) {
|
|
11020
10764
|
var finnalUrl;
|
|
11021
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10765
|
+
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
11022
10766
|
while (1)
|
|
11023
|
-
switch (
|
|
10767
|
+
switch (_context9.prev = _context9.next) {
|
|
11024
10768
|
case 0:
|
|
11025
10769
|
if (url)
|
|
11026
10770
|
this._opts.url = url;
|
|
11027
10771
|
finnalUrl = url = this._opts.url;
|
|
11028
10772
|
if (url) {
|
|
11029
|
-
|
|
10773
|
+
_context9.next = 4;
|
|
11030
10774
|
break;
|
|
11031
10775
|
}
|
|
11032
10776
|
throw new Error("Source url is missing");
|
|
@@ -11041,34 +10785,34 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
11041
10785
|
});
|
|
11042
10786
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
11043
10787
|
if (!this._loading) {
|
|
11044
|
-
|
|
10788
|
+
_context9.next = 11;
|
|
11045
10789
|
break;
|
|
11046
10790
|
}
|
|
11047
|
-
|
|
10791
|
+
_context9.next = 11;
|
|
11048
10792
|
return this._mediaLoader.cancel();
|
|
11049
10793
|
case 11:
|
|
11050
10794
|
this._loading = true;
|
|
11051
|
-
|
|
11052
|
-
|
|
10795
|
+
_context9.prev = 12;
|
|
10796
|
+
_context9.next = 15;
|
|
11053
10797
|
return this._mediaLoader.load({
|
|
11054
10798
|
url: finnalUrl,
|
|
11055
10799
|
range
|
|
11056
10800
|
});
|
|
11057
10801
|
case 15:
|
|
11058
|
-
|
|
10802
|
+
_context9.next = 21;
|
|
11059
10803
|
break;
|
|
11060
10804
|
case 17:
|
|
11061
|
-
|
|
11062
|
-
|
|
10805
|
+
_context9.prev = 17;
|
|
10806
|
+
_context9.t0 = _context9["catch"](12);
|
|
11063
10807
|
this._loading = false;
|
|
11064
|
-
return
|
|
10808
|
+
return _context9.abrupt("return", this._emitError(StreamingError.network(_context9.t0), false));
|
|
11065
10809
|
case 21:
|
|
11066
10810
|
case "end":
|
|
11067
|
-
return
|
|
10811
|
+
return _context9.stop();
|
|
11068
10812
|
}
|
|
11069
|
-
},
|
|
10813
|
+
}, _callee9, this, [[12, 17]]);
|
|
11070
10814
|
}));
|
|
11071
|
-
function _loadData(
|
|
10815
|
+
function _loadData(_x8, _x9) {
|
|
11072
10816
|
return _loadData2.apply(this, arguments);
|
|
11073
10817
|
}
|
|
11074
10818
|
return _loadData;
|
|
@@ -11076,16 +10820,16 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
11076
10820
|
}, {
|
|
11077
10821
|
key: "_clear",
|
|
11078
10822
|
value: function() {
|
|
11079
|
-
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
11080
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10823
|
+
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10() {
|
|
10824
|
+
return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
|
|
11081
10825
|
while (1)
|
|
11082
|
-
switch (
|
|
10826
|
+
switch (_context10.prev = _context10.next) {
|
|
11083
10827
|
case 0:
|
|
11084
10828
|
if (!this._mediaLoader) {
|
|
11085
|
-
|
|
10829
|
+
_context10.next = 3;
|
|
11086
10830
|
break;
|
|
11087
10831
|
}
|
|
11088
|
-
|
|
10832
|
+
_context10.next = 3;
|
|
11089
10833
|
return this._mediaLoader.cancel();
|
|
11090
10834
|
case 3:
|
|
11091
10835
|
clearTimeout(this._maxChunkWaitTimer);
|
|
@@ -11094,9 +10838,9 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
11094
10838
|
this._firstProgressEmit = false;
|
|
11095
10839
|
case 7:
|
|
11096
10840
|
case "end":
|
|
11097
|
-
return
|
|
10841
|
+
return _context10.stop();
|
|
11098
10842
|
}
|
|
11099
|
-
},
|
|
10843
|
+
}, _callee10, this);
|
|
11100
10844
|
}));
|
|
11101
10845
|
function _clear() {
|
|
11102
10846
|
return _clear2.apply(this, arguments);
|
|
@@ -11290,11 +11034,6 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
11290
11034
|
var _this$flv3;
|
|
11291
11035
|
return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
|
|
11292
11036
|
}
|
|
11293
|
-
}, {
|
|
11294
|
-
key: "transferCost",
|
|
11295
|
-
get: function get() {
|
|
11296
|
-
return this.flv._transferCost.transferCost;
|
|
11297
|
-
}
|
|
11298
11037
|
}, {
|
|
11299
11038
|
key: "beforePlayerInit",
|
|
11300
11039
|
value: function beforePlayerInit() {
|
|
@@ -11314,8 +11053,8 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
11314
11053
|
isLive: config.isLive,
|
|
11315
11054
|
media: this.player.video,
|
|
11316
11055
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
11317
|
-
var _this2$player, _this2$player
|
|
11318
|
-
return ((_this2$player =
|
|
11056
|
+
var _this2$player$preProc, _this2$player;
|
|
11057
|
+
return ((_this2$player$preProc = (_this2$player = _this2.player).preProcessUrl) === null || _this2$player$preProc === void 0 ? void 0 : _this2$player$preProc.call(_this2$player, url, ext)) || {
|
|
11319
11058
|
url,
|
|
11320
11059
|
ext
|
|
11321
11060
|
};
|