@byteplus/veplayer-plugin 2.4.1-rc.1 → 2.4.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.development.js +42074 -43370
- 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 +82 -43
- 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 +82 -43
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +1 -1
- package/umd/veplayer.plugin.shaka.production.js +1 -1
|
@@ -1542,7 +1542,7 @@
|
|
|
1542
1542
|
}
|
|
1543
1543
|
return offsetTime;
|
|
1544
1544
|
};
|
|
1545
|
-
var version = "3.0.
|
|
1545
|
+
var version = "3.0.19-rc.0";
|
|
1546
1546
|
var ERROR_MAP = {
|
|
1547
1547
|
1: 5101,
|
|
1548
1548
|
2: 5102,
|
|
@@ -2763,21 +2763,6 @@
|
|
|
2763
2763
|
length: Buffer2.totalLength && Buffer2.totalLength(buffers)
|
|
2764
2764
|
};
|
|
2765
2765
|
}
|
|
2766
|
-
}, {
|
|
2767
|
-
key: "isBuffered",
|
|
2768
|
-
value: function isBuffered(media, pos) {
|
|
2769
|
-
if (media) {
|
|
2770
|
-
var buffered = Buffer2.get(media);
|
|
2771
|
-
if (buffered !== null && buffered !== void 0 && buffered.length) {
|
|
2772
|
-
for (var i = 0; i < buffered.length; i++) {
|
|
2773
|
-
if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
|
|
2774
|
-
return true;
|
|
2775
|
-
}
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
return false;
|
|
2780
|
-
}
|
|
2781
2766
|
}]);
|
|
2782
2767
|
return Buffer2;
|
|
2783
2768
|
}();
|
|
@@ -5542,7 +5527,6 @@
|
|
|
5542
5527
|
METADATA: "metadata"
|
|
5543
5528
|
};
|
|
5544
5529
|
var VideoCodecType = {
|
|
5545
|
-
AV1: "av1",
|
|
5546
5530
|
AVC: "avc",
|
|
5547
5531
|
HEVC: "hevc"
|
|
5548
5532
|
};
|
|
@@ -5589,7 +5573,6 @@
|
|
|
5589
5573
|
_defineProperty(this, "isVideoEncryption", false);
|
|
5590
5574
|
_defineProperty(this, "isAudioEncryption", false);
|
|
5591
5575
|
_defineProperty(this, "isVideo", true);
|
|
5592
|
-
_defineProperty(this, "lastKeyFrameDts", 0);
|
|
5593
5576
|
_defineProperty(this, "kid", null);
|
|
5594
5577
|
_defineProperty(this, "pssh", null);
|
|
5595
5578
|
_defineProperty(this, "ext", void 0);
|
|
@@ -5632,9 +5615,6 @@
|
|
|
5632
5615
|
}, {
|
|
5633
5616
|
key: "exist",
|
|
5634
5617
|
value: function exist() {
|
|
5635
|
-
if (/av01/.test(this.codec)) {
|
|
5636
|
-
return true;
|
|
5637
|
-
}
|
|
5638
5618
|
return !!(this.pps.length && this.sps.length && this.codec);
|
|
5639
5619
|
}
|
|
5640
5620
|
}, {
|
|
@@ -5912,7 +5892,7 @@
|
|
|
5912
5892
|
continue;
|
|
5913
5893
|
}
|
|
5914
5894
|
frameLength = (data[i + 3] & 3) << 11 | data[i + 4] << 3 | (data[i + 5] & 224) >> 5;
|
|
5915
|
-
if (
|
|
5895
|
+
if (len - i < frameLength)
|
|
5916
5896
|
break;
|
|
5917
5897
|
protectionSkipBytes = (~data[i + 1] & 1) * 2;
|
|
5918
5898
|
frames.push({
|
|
@@ -7330,7 +7310,6 @@
|
|
|
7330
7310
|
value: function demux(data) {
|
|
7331
7311
|
var discontinuity = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
7332
7312
|
var contiguous = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
7333
|
-
var seamlessLoadingSwitching = arguments.length > 3 ? arguments[3] : void 0;
|
|
7334
7313
|
var audioTrack = this.audioTrack, videoTrack = this.videoTrack, metadataTrack = this.metadataTrack;
|
|
7335
7314
|
if (discontinuity || !contiguous) {
|
|
7336
7315
|
this._remainingData = null;
|
|
@@ -7388,8 +7367,6 @@
|
|
|
7388
7367
|
if (tagType === 8) {
|
|
7389
7368
|
this._parseAudio(bodyData, timestamp);
|
|
7390
7369
|
} else if (tagType === 9) {
|
|
7391
|
-
if (seamlessLoadingSwitching)
|
|
7392
|
-
this.seamlessLoadingSwitching = true;
|
|
7393
7370
|
this._parseVideo(bodyData, timestamp);
|
|
7394
7371
|
} else if (tagType === 18) {
|
|
7395
7372
|
this._parseScript(bodyData, timestamp);
|
|
@@ -7432,8 +7409,8 @@
|
|
|
7432
7409
|
}
|
|
7433
7410
|
}, {
|
|
7434
7411
|
key: "demuxAndFix",
|
|
7435
|
-
value: function demuxAndFix(data, discontinuity, contiguous, startTime
|
|
7436
|
-
this.demux(data, discontinuity, contiguous
|
|
7412
|
+
value: function demuxAndFix(data, discontinuity, contiguous, startTime) {
|
|
7413
|
+
this.demux(data, discontinuity, contiguous);
|
|
7437
7414
|
return this.fix(startTime, discontinuity, contiguous);
|
|
7438
7415
|
}
|
|
7439
7416
|
}, {
|
|
@@ -7547,13 +7524,8 @@
|
|
|
7547
7524
|
units = this._checkAddMetaNalToUnits(isHevc, units, track);
|
|
7548
7525
|
if (units && units.length) {
|
|
7549
7526
|
var sample = new VideoSample(dts + cts, dts, units);
|
|
7550
|
-
if (this.seamlessLoadingSwitching && dts < track.lastKeyFrameDts) {
|
|
7551
|
-
return;
|
|
7552
|
-
}
|
|
7553
|
-
this.seamlessLoadingSwitching = false;
|
|
7554
7527
|
if (frameType === 1) {
|
|
7555
7528
|
sample.setToKeyframe();
|
|
7556
|
-
track.lastKeyFrameDts = dts;
|
|
7557
7529
|
}
|
|
7558
7530
|
track.samples.push(sample);
|
|
7559
7531
|
units.forEach(function(unit) {
|
|
@@ -8031,8 +8003,6 @@
|
|
|
8031
8003
|
}
|
|
8032
8004
|
} else if (track.useEME && track.encv) {
|
|
8033
8005
|
content = MP42.encv(track);
|
|
8034
|
-
} else if (track.av1C) {
|
|
8035
|
-
content = MP42.av01(track);
|
|
8036
8006
|
} else {
|
|
8037
8007
|
content = MP42.avc1hev1(track);
|
|
8038
8008
|
}
|
|
@@ -8245,90 +8215,6 @@
|
|
|
8245
8215
|
var schi = MP42.schi(data);
|
|
8246
8216
|
return MP42.box(MP42.types.sinf, content, MP42.box(MP42.types.frma, frma), MP42.box(MP42.types.schm, schm), schi);
|
|
8247
8217
|
}
|
|
8248
|
-
}, {
|
|
8249
|
-
key: "av01",
|
|
8250
|
-
value: function av01(track) {
|
|
8251
|
-
return MP42.box(MP42.types.av01, new Uint8Array([
|
|
8252
|
-
0,
|
|
8253
|
-
0,
|
|
8254
|
-
0,
|
|
8255
|
-
0,
|
|
8256
|
-
0,
|
|
8257
|
-
0,
|
|
8258
|
-
0,
|
|
8259
|
-
1,
|
|
8260
|
-
0,
|
|
8261
|
-
0,
|
|
8262
|
-
0,
|
|
8263
|
-
0,
|
|
8264
|
-
0,
|
|
8265
|
-
0,
|
|
8266
|
-
0,
|
|
8267
|
-
0,
|
|
8268
|
-
0,
|
|
8269
|
-
0,
|
|
8270
|
-
0,
|
|
8271
|
-
0,
|
|
8272
|
-
0,
|
|
8273
|
-
0,
|
|
8274
|
-
0,
|
|
8275
|
-
0,
|
|
8276
|
-
track.width >> 8 & 255,
|
|
8277
|
-
track.width & 255,
|
|
8278
|
-
track.height >> 8 & 255,
|
|
8279
|
-
track.height & 255,
|
|
8280
|
-
0,
|
|
8281
|
-
72,
|
|
8282
|
-
0,
|
|
8283
|
-
0,
|
|
8284
|
-
0,
|
|
8285
|
-
72,
|
|
8286
|
-
0,
|
|
8287
|
-
0,
|
|
8288
|
-
0,
|
|
8289
|
-
0,
|
|
8290
|
-
0,
|
|
8291
|
-
0,
|
|
8292
|
-
0,
|
|
8293
|
-
1,
|
|
8294
|
-
0,
|
|
8295
|
-
0,
|
|
8296
|
-
0,
|
|
8297
|
-
0,
|
|
8298
|
-
0,
|
|
8299
|
-
0,
|
|
8300
|
-
0,
|
|
8301
|
-
0,
|
|
8302
|
-
0,
|
|
8303
|
-
0,
|
|
8304
|
-
0,
|
|
8305
|
-
0,
|
|
8306
|
-
0,
|
|
8307
|
-
0,
|
|
8308
|
-
0,
|
|
8309
|
-
0,
|
|
8310
|
-
0,
|
|
8311
|
-
0,
|
|
8312
|
-
0,
|
|
8313
|
-
0,
|
|
8314
|
-
0,
|
|
8315
|
-
0,
|
|
8316
|
-
0,
|
|
8317
|
-
0,
|
|
8318
|
-
0,
|
|
8319
|
-
0,
|
|
8320
|
-
0,
|
|
8321
|
-
0,
|
|
8322
|
-
0,
|
|
8323
|
-
0,
|
|
8324
|
-
0,
|
|
8325
|
-
0,
|
|
8326
|
-
0,
|
|
8327
|
-
24,
|
|
8328
|
-
17,
|
|
8329
|
-
17
|
|
8330
|
-
]), track.av1C, track.colr);
|
|
8331
|
-
}
|
|
8332
8218
|
}, {
|
|
8333
8219
|
key: "avc1hev1",
|
|
8334
8220
|
value: function avc1hev1(track) {
|
|
@@ -9301,7 +9187,7 @@
|
|
|
9301
9187
|
}]);
|
|
9302
9188
|
return MP42;
|
|
9303
9189
|
}();
|
|
9304
|
-
_defineProperty(MP4, "types", ["
|
|
9190
|
+
_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) {
|
|
9305
9191
|
p[c] = [c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2), c.charCodeAt(3)];
|
|
9306
9192
|
return p;
|
|
9307
9193
|
}, /* @__PURE__ */ Object.create(null)));
|
|
@@ -9636,46 +9522,30 @@
|
|
|
9636
9522
|
};
|
|
9637
9523
|
}
|
|
9638
9524
|
var samples = track.samples;
|
|
9639
|
-
var isAV01 = /av01/.test(track.codec);
|
|
9640
9525
|
var mdatSize = 0;
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
});
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
mdatSize += s.units.reduce(function(t, c) {
|
|
9648
|
-
return t + c.byteLength;
|
|
9649
|
-
}, 0);
|
|
9650
|
-
mdatSize += s.units.length * 4;
|
|
9651
|
-
});
|
|
9652
|
-
}
|
|
9526
|
+
samples.forEach(function(s) {
|
|
9527
|
+
mdatSize += s.units.reduce(function(t, c) {
|
|
9528
|
+
return t + c.byteLength;
|
|
9529
|
+
}, 0);
|
|
9530
|
+
mdatSize += s.units.length * 4;
|
|
9531
|
+
});
|
|
9653
9532
|
var mdata = new Uint8Array(mdatSize);
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
_offset2 += u.byteLength;
|
|
9671
|
-
sampleSize += 4 + u.byteLength;
|
|
9672
|
-
});
|
|
9673
|
-
_sample2.size = sampleSize;
|
|
9674
|
-
_offset = _offset2, _sample = _sample2;
|
|
9675
|
-
};
|
|
9676
|
-
for (var _i = 0, _l = samples.length, _offset = 0, _sample; _i < _l; _i++) {
|
|
9677
|
-
_loop(_offset, _sample);
|
|
9678
|
-
}
|
|
9533
|
+
var mdatView = new DataView(mdata.buffer);
|
|
9534
|
+
var _loop = function _loop2(_offset, _sample) {
|
|
9535
|
+
_sample = samples[i];
|
|
9536
|
+
var sampleSize = 0;
|
|
9537
|
+
_sample.units.forEach(function(u) {
|
|
9538
|
+
mdatView.setUint32(_offset, u.byteLength);
|
|
9539
|
+
_offset += 4;
|
|
9540
|
+
mdata.set(u, _offset);
|
|
9541
|
+
_offset += u.byteLength;
|
|
9542
|
+
sampleSize += 4 + u.byteLength;
|
|
9543
|
+
});
|
|
9544
|
+
_sample.size = sampleSize;
|
|
9545
|
+
offset = _offset, sample = _sample;
|
|
9546
|
+
};
|
|
9547
|
+
for (var i = 0, l = samples.length, offset = 0, sample; i < l; i++) {
|
|
9548
|
+
_loop(offset, sample);
|
|
9679
9549
|
}
|
|
9680
9550
|
var mdat = MP4.mdat(mdata);
|
|
9681
9551
|
var moof = MP4.moof([track]);
|
|
@@ -9705,55 +9575,6 @@
|
|
|
9705
9575
|
}]);
|
|
9706
9576
|
return FMP4Remuxer2;
|
|
9707
9577
|
}();
|
|
9708
|
-
var TransferCost = /* @__PURE__ */ function() {
|
|
9709
|
-
function TransferCost2() {
|
|
9710
|
-
_classCallCheck$4(this, TransferCost2);
|
|
9711
|
-
_defineProperty$3(this, "_ttfb", 0);
|
|
9712
|
-
_defineProperty$3(this, "_demuxStart", 0);
|
|
9713
|
-
_defineProperty$3(this, "_demuxEnd", 0);
|
|
9714
|
-
_defineProperty$3(this, "_demuxCost", 0);
|
|
9715
|
-
_defineProperty$3(this, "_remuxStart", 0);
|
|
9716
|
-
_defineProperty$3(this, "_remuxEnd", 0);
|
|
9717
|
-
_defineProperty$3(this, "_remuxCost", 0);
|
|
9718
|
-
_defineProperty$3(this, "_appendStart", 0);
|
|
9719
|
-
_defineProperty$3(this, "_appendEnd", 0);
|
|
9720
|
-
_defineProperty$3(this, "_appendCost", 0);
|
|
9721
|
-
}
|
|
9722
|
-
_createClass$4(TransferCost2, [{
|
|
9723
|
-
key: "set",
|
|
9724
|
-
value: function set(event, value) {
|
|
9725
|
-
this["_".concat(event)] = value;
|
|
9726
|
-
}
|
|
9727
|
-
}, {
|
|
9728
|
-
key: "start",
|
|
9729
|
-
value: function start(event) {
|
|
9730
|
-
this["_".concat(event, "Start")] = Date.now();
|
|
9731
|
-
}
|
|
9732
|
-
}, {
|
|
9733
|
-
key: "end",
|
|
9734
|
-
value: function end(event) {
|
|
9735
|
-
this["_".concat(event, "End")] = Date.now();
|
|
9736
|
-
this["_".concat(event, "Cost")] = this["_".concat(event, "Cost")] + (this["_".concat(event, "End")] - this["_".concat(event, "Start")]);
|
|
9737
|
-
}
|
|
9738
|
-
}, {
|
|
9739
|
-
key: "transferCost",
|
|
9740
|
-
get: function get() {
|
|
9741
|
-
return {
|
|
9742
|
-
ttfbCost: this._ttfb,
|
|
9743
|
-
demuxCost: this._demuxCost,
|
|
9744
|
-
remuxCost: this._remuxCost,
|
|
9745
|
-
appendCost: this._appendCost
|
|
9746
|
-
};
|
|
9747
|
-
}
|
|
9748
|
-
}]);
|
|
9749
|
-
return TransferCost2;
|
|
9750
|
-
}();
|
|
9751
|
-
var TRANSFER_EVENT = {
|
|
9752
|
-
TTFB: "ttfb",
|
|
9753
|
-
DEMUX: "demux",
|
|
9754
|
-
REMUX: "remux",
|
|
9755
|
-
APPEND: "append"
|
|
9756
|
-
};
|
|
9757
9578
|
var logger$1 = new Logger$2("BufferService");
|
|
9758
9579
|
var BufferService = /* @__PURE__ */ function() {
|
|
9759
9580
|
function BufferService2(flv, softVideo) {
|
|
@@ -9841,8 +9662,7 @@
|
|
|
9841
9662
|
this._contiguous = false;
|
|
9842
9663
|
this._sourceCreated = false;
|
|
9843
9664
|
this._initSegmentId = "";
|
|
9844
|
-
|
|
9845
|
-
case 12:
|
|
9665
|
+
case 11:
|
|
9846
9666
|
case "end":
|
|
9847
9667
|
return _context.stop();
|
|
9848
9668
|
}
|
|
@@ -9853,15 +9673,6 @@
|
|
|
9853
9673
|
}
|
|
9854
9674
|
return reset;
|
|
9855
9675
|
}()
|
|
9856
|
-
}, {
|
|
9857
|
-
key: "resetSeamlessSwitchStats",
|
|
9858
|
-
value: function resetSeamlessSwitchStats() {
|
|
9859
|
-
this.seamlessLoadingSwitch = null;
|
|
9860
|
-
this.seamlessLoadingSwitching = false;
|
|
9861
|
-
if (this._demuxer) {
|
|
9862
|
-
this._demuxer.seamlessLoadingSwitching = false;
|
|
9863
|
-
}
|
|
9864
|
-
}
|
|
9865
9676
|
}, {
|
|
9866
9677
|
key: "endOfStream",
|
|
9867
9678
|
value: function() {
|
|
@@ -9967,56 +9778,32 @@
|
|
|
9967
9778
|
key: "appendBuffer",
|
|
9968
9779
|
value: function() {
|
|
9969
9780
|
var _appendBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5(chunk) {
|
|
9970
|
-
var
|
|
9971
|
-
var switchingNoReset, demuxer, videoTrack, audioTrack, metadataTrack, idx, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
|
|
9781
|
+
var demuxer, videoTrack, audioTrack, metadataTrack, videoExist, audioExist, duration, track, videoType, audioType, mse, newId, remuxResult, p;
|
|
9972
9782
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
9973
9783
|
while (1)
|
|
9974
9784
|
switch (_context5.prev = _context5.next) {
|
|
9975
9785
|
case 0:
|
|
9976
|
-
switchingNoReset = false;
|
|
9977
9786
|
if (this._cachedBuffer) {
|
|
9978
9787
|
chunk = concatUint8Array$1(this._cachedBuffer, chunk);
|
|
9979
9788
|
this._cachedBuffer = null;
|
|
9980
9789
|
}
|
|
9981
9790
|
demuxer = this._demuxer;
|
|
9982
9791
|
if (!(!chunk || !chunk.length || !demuxer)) {
|
|
9983
|
-
_context5.next =
|
|
9792
|
+
_context5.next = 4;
|
|
9984
9793
|
break;
|
|
9985
9794
|
}
|
|
9986
9795
|
return _context5.abrupt("return");
|
|
9987
|
-
case
|
|
9988
|
-
_context5.prev =
|
|
9989
|
-
this.
|
|
9990
|
-
|
|
9991
|
-
this.seamlessLoadingSwitching = false;
|
|
9992
|
-
this.flv._transferCost.end(TRANSFER_EVENT.DEMUX);
|
|
9993
|
-
_context5.next = 15;
|
|
9796
|
+
case 4:
|
|
9797
|
+
_context5.prev = 4;
|
|
9798
|
+
demuxer.demuxAndFix(chunk, this._discontinuity, this._contiguous, this._demuxStartTime);
|
|
9799
|
+
_context5.next = 11;
|
|
9994
9800
|
break;
|
|
9995
|
-
case
|
|
9996
|
-
_context5.prev =
|
|
9997
|
-
_context5.t0 = _context5["catch"](
|
|
9801
|
+
case 8:
|
|
9802
|
+
_context5.prev = 8;
|
|
9803
|
+
_context5.t0 = _context5["catch"](4);
|
|
9998
9804
|
throw new StreamingError(ERR.DEMUX, ERR.SUB_TYPES.FLV, _context5.t0);
|
|
9999
|
-
case
|
|
9805
|
+
case 11:
|
|
10000
9806
|
videoTrack = demuxer.videoTrack, audioTrack = demuxer.audioTrack, metadataTrack = demuxer.metadataTrack;
|
|
10001
|
-
if (!this.seamlessLoadingSwitch) {
|
|
10002
|
-
_context5.next = 25;
|
|
10003
|
-
break;
|
|
10004
|
-
}
|
|
10005
|
-
idx = videoTrack.samples.findIndex(function(sample) {
|
|
10006
|
-
return sample.originDts === videoTrack.lastKeyFrameDts;
|
|
10007
|
-
});
|
|
10008
|
-
if (!(idx >= 0)) {
|
|
10009
|
-
_context5.next = 25;
|
|
10010
|
-
break;
|
|
10011
|
-
}
|
|
10012
|
-
videoTrack.samples.splice(idx);
|
|
10013
|
-
_context5.next = 22;
|
|
10014
|
-
return this.seamlessLoadingSwitch();
|
|
10015
|
-
case 22:
|
|
10016
|
-
this.seamlessLoadingSwitch = null;
|
|
10017
|
-
chunk = null;
|
|
10018
|
-
switchingNoReset = true;
|
|
10019
|
-
case 25:
|
|
10020
9807
|
videoExist = videoTrack.exist();
|
|
10021
9808
|
audioExist = audioTrack.exist();
|
|
10022
9809
|
if (this._opts.onlyAudio) {
|
|
@@ -10028,7 +9815,7 @@
|
|
|
10028
9815
|
audioTrack.present = false;
|
|
10029
9816
|
}
|
|
10030
9817
|
if (!(!videoExist && videoTrack.present || !audioExist && audioTrack.present)) {
|
|
10031
|
-
_context5.next =
|
|
9818
|
+
_context5.next = 29;
|
|
10032
9819
|
break;
|
|
10033
9820
|
}
|
|
10034
9821
|
duration = 0;
|
|
@@ -10037,7 +9824,7 @@
|
|
|
10037
9824
|
duration = (track.samples[track.samples.length - 1].originPts - track.samples[0].originPts) / track.timescale * 1e3;
|
|
10038
9825
|
}
|
|
10039
9826
|
if (!(duration > this._opts.analyzeDuration)) {
|
|
10040
|
-
_context5.next =
|
|
9827
|
+
_context5.next = 27;
|
|
10041
9828
|
break;
|
|
10042
9829
|
}
|
|
10043
9830
|
logger$1.warn("analyze duration exceeded, ".concat(duration, "ms"), track);
|
|
@@ -10046,20 +9833,18 @@
|
|
|
10046
9833
|
this.flv.emit(EVENT.ANALYZE_DURATION_EXCEEDED, {
|
|
10047
9834
|
duration
|
|
10048
9835
|
});
|
|
10049
|
-
_context5.next =
|
|
9836
|
+
_context5.next = 29;
|
|
10050
9837
|
break;
|
|
10051
|
-
case
|
|
9838
|
+
case 27:
|
|
10052
9839
|
this._cachedBuffer = chunk;
|
|
10053
9840
|
return _context5.abrupt("return");
|
|
10054
|
-
case
|
|
9841
|
+
case 29:
|
|
10055
9842
|
videoType = videoTrack.type;
|
|
10056
9843
|
audioType = audioTrack.type;
|
|
10057
9844
|
this._fireEvents(videoTrack, audioTrack, metadataTrack);
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
this._demuxStartTime = 0;
|
|
10062
|
-
}
|
|
9845
|
+
this._discontinuity = false;
|
|
9846
|
+
this._contiguous = true;
|
|
9847
|
+
this._demuxStartTime = 0;
|
|
10063
9848
|
mse = this._mse;
|
|
10064
9849
|
this.flv.emit(EVENT.DEMUXED_TRACK, {
|
|
10065
9850
|
videoTrack
|
|
@@ -10071,16 +9856,16 @@
|
|
|
10071
9856
|
this._emitMetaParsedEvent(videoTrack, audioTrack);
|
|
10072
9857
|
}
|
|
10073
9858
|
if (!mse) {
|
|
10074
|
-
_context5.next =
|
|
9859
|
+
_context5.next = 66;
|
|
10075
9860
|
break;
|
|
10076
9861
|
}
|
|
10077
9862
|
if (this._sourceCreated) {
|
|
10078
|
-
_context5.next =
|
|
9863
|
+
_context5.next = 47;
|
|
10079
9864
|
break;
|
|
10080
9865
|
}
|
|
10081
|
-
_context5.next =
|
|
9866
|
+
_context5.next = 43;
|
|
10082
9867
|
return mse.open();
|
|
10083
|
-
case
|
|
9868
|
+
case 43:
|
|
10084
9869
|
if (videoExist) {
|
|
10085
9870
|
logger$1.log("codec: video/mp4;codecs=".concat(videoTrack.codec));
|
|
10086
9871
|
mse.createSource(videoType, "video/mp4;codecs=".concat(videoTrack.codec));
|
|
@@ -10091,28 +9876,26 @@
|
|
|
10091
9876
|
}
|
|
10092
9877
|
this._sourceCreated = true;
|
|
10093
9878
|
this.flv.emit(EVENT.SOURCEBUFFER_CREATED);
|
|
10094
|
-
case
|
|
10095
|
-
_context5.prev =
|
|
9879
|
+
case 47:
|
|
9880
|
+
_context5.prev = 47;
|
|
10096
9881
|
if (this._needInitSegment && !this._opts.mseLowLatency) {
|
|
10097
9882
|
videoTrack.duration = this._opts.durationForMSELowLatencyOff * videoTrack.timescale;
|
|
10098
9883
|
audioTrack.duration = this._opts.durationForMSELowLatencyOff * audioExist.timescale;
|
|
10099
9884
|
}
|
|
10100
|
-
this.flv._transferCost.start(TRANSFER_EVENT.REMUX);
|
|
10101
9885
|
remuxResult = this._remuxer.remux(this._needInitSegment);
|
|
10102
|
-
|
|
10103
|
-
_context5.next = 68;
|
|
9886
|
+
_context5.next = 55;
|
|
10104
9887
|
break;
|
|
10105
|
-
case
|
|
10106
|
-
_context5.prev =
|
|
10107
|
-
_context5.t1 = _context5["catch"](
|
|
9888
|
+
case 52:
|
|
9889
|
+
_context5.prev = 52;
|
|
9890
|
+
_context5.t1 = _context5["catch"](47);
|
|
10108
9891
|
throw new StreamingError(ERR.REMUX, ERR.SUB_TYPES.FMP4, _context5.t1);
|
|
10109
|
-
case
|
|
9892
|
+
case 55:
|
|
10110
9893
|
if (!(this._needInitSegment && !remuxResult.videoInitSegment && !remuxResult.audioInitSegment)) {
|
|
10111
|
-
_context5.next =
|
|
9894
|
+
_context5.next = 57;
|
|
10112
9895
|
break;
|
|
10113
9896
|
}
|
|
10114
9897
|
return _context5.abrupt("return");
|
|
10115
|
-
case
|
|
9898
|
+
case 57:
|
|
10116
9899
|
this._needInitSegment = false;
|
|
10117
9900
|
p = [];
|
|
10118
9901
|
if (remuxResult.videoInitSegment)
|
|
@@ -10123,19 +9906,16 @@
|
|
|
10123
9906
|
p.push(mse.append(videoType, remuxResult.videoSegment));
|
|
10124
9907
|
if (remuxResult.audioSegment)
|
|
10125
9908
|
p.push(mse.append(audioType, remuxResult.audioSegment));
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
_this.flv._transferCost.end(TRANSFER_EVENT.APPEND);
|
|
10129
|
-
}));
|
|
10130
|
-
case 80:
|
|
9909
|
+
return _context5.abrupt("return", Promise.all(p));
|
|
9910
|
+
case 66:
|
|
10131
9911
|
if (this._softVideo) {
|
|
10132
9912
|
this._softVideo.appendBuffer(videoTrack, audioTrack);
|
|
10133
9913
|
}
|
|
10134
|
-
case
|
|
9914
|
+
case 67:
|
|
10135
9915
|
case "end":
|
|
10136
9916
|
return _context5.stop();
|
|
10137
9917
|
}
|
|
10138
|
-
}, _callee5, this, [[
|
|
9918
|
+
}, _callee5, this, [[4, 8], [47, 52]]);
|
|
10139
9919
|
}));
|
|
10140
9920
|
function appendBuffer(_x2) {
|
|
10141
9921
|
return _appendBuffer.apply(this, arguments);
|
|
@@ -10146,7 +9926,7 @@
|
|
|
10146
9926
|
key: "evictBuffer",
|
|
10147
9927
|
value: function() {
|
|
10148
9928
|
var _evictBuffer = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(bufferBehind) {
|
|
10149
|
-
var
|
|
9929
|
+
var _this = this;
|
|
10150
9930
|
var media, currentTime, removeEnd, start;
|
|
10151
9931
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10152
9932
|
while (1)
|
|
@@ -10175,7 +9955,7 @@
|
|
|
10175
9955
|
return _context6.abrupt("return");
|
|
10176
9956
|
case 10:
|
|
10177
9957
|
return _context6.abrupt("return", this._mse.clearBuffer(0, removeEnd).then(function() {
|
|
10178
|
-
return
|
|
9958
|
+
return _this.flv.emit(EVENT.REMOVE_BUFFER, {
|
|
10179
9959
|
removeEnd
|
|
10180
9960
|
});
|
|
10181
9961
|
}));
|
|
@@ -10225,16 +10005,16 @@
|
|
|
10225
10005
|
}, {
|
|
10226
10006
|
key: "_fireEvents",
|
|
10227
10007
|
value: function _fireEvents(videoTrack, audioTrack, metadataTrack) {
|
|
10228
|
-
var
|
|
10008
|
+
var _this2 = this;
|
|
10229
10009
|
logger$1.debug(videoTrack.samples, audioTrack.samples);
|
|
10230
10010
|
metadataTrack.flvScriptSamples.forEach(function(sample) {
|
|
10231
|
-
|
|
10011
|
+
_this2.flv.emit(EVENT.FLV_SCRIPT_DATA, sample);
|
|
10232
10012
|
logger$1.debug("flvScriptData", sample);
|
|
10233
10013
|
});
|
|
10234
10014
|
videoTrack.samples.forEach(function(sample) {
|
|
10235
10015
|
if (sample.keyframe) {
|
|
10236
|
-
|
|
10237
|
-
pts: sample.
|
|
10016
|
+
_this2.flv.emit(EVENT.KEYFRAME, {
|
|
10017
|
+
pts: sample.pts
|
|
10238
10018
|
});
|
|
10239
10019
|
}
|
|
10240
10020
|
});
|
|
@@ -10252,7 +10032,7 @@
|
|
|
10252
10032
|
break;
|
|
10253
10033
|
}
|
|
10254
10034
|
if (type)
|
|
10255
|
-
|
|
10035
|
+
_this2.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10256
10036
|
type
|
|
10257
10037
|
}));
|
|
10258
10038
|
logger$1.warn("video exception", warn);
|
|
@@ -10271,13 +10051,13 @@
|
|
|
10271
10051
|
break;
|
|
10272
10052
|
}
|
|
10273
10053
|
if (type)
|
|
10274
|
-
|
|
10054
|
+
_this2.flv.emit(EVENT.STREAM_EXCEPTION, _objectSpread2$2(_objectSpread2$2({}, warn), {}, {
|
|
10275
10055
|
type
|
|
10276
10056
|
}));
|
|
10277
10057
|
logger$1.warn("audio exception", warn);
|
|
10278
10058
|
});
|
|
10279
10059
|
metadataTrack.seiSamples.forEach(function(sei) {
|
|
10280
|
-
|
|
10060
|
+
_this2.flv.emit(EVENT.SEI, _objectSpread2$2(_objectSpread2$2({}, sei), {}, {
|
|
10281
10061
|
sei: {
|
|
10282
10062
|
code: sei.data.type,
|
|
10283
10063
|
content: sei.data.payload,
|
|
@@ -10312,8 +10092,7 @@
|
|
|
10312
10092
|
durationForMSELowLatencyOff: 6,
|
|
10313
10093
|
chunkCountForSpeed: 50,
|
|
10314
10094
|
skipChunkSize: 1e3,
|
|
10315
|
-
longtimeNoReceived: 3e3
|
|
10316
|
-
enableStartGapJump: true
|
|
10095
|
+
longtimeNoReceived: 3e3
|
|
10317
10096
|
}, opts);
|
|
10318
10097
|
if (ret.isLive) {
|
|
10319
10098
|
if (ret.preloadTime) {
|
|
@@ -10381,7 +10160,7 @@
|
|
|
10381
10160
|
_defineProperty$3(_assertThisInitialized$3(_this), "_acceptRanges", true);
|
|
10382
10161
|
_defineProperty$3(_assertThisInitialized$3(_this), "_onProgress", /* @__PURE__ */ function() {
|
|
10383
10162
|
var _ref2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee(chunk, done, _ref, response) {
|
|
10384
|
-
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers,
|
|
10163
|
+
var startTime, endTime, st, firstByteTime, _this$_mediaLoader, headers, _this$_bufferService, remaining, maxReaderInterval;
|
|
10385
10164
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
10386
10165
|
while (1)
|
|
10387
10166
|
switch (_context.prev = _context.next) {
|
|
@@ -10389,7 +10168,7 @@
|
|
|
10389
10168
|
startTime = _ref.startTime, endTime = _ref.endTime, st = _ref.st, firstByteTime = _ref.firstByteTime;
|
|
10390
10169
|
_this._loading = !done;
|
|
10391
10170
|
if (_this._firstProgressEmit) {
|
|
10392
|
-
_context.next =
|
|
10171
|
+
_context.next = 11;
|
|
10393
10172
|
break;
|
|
10394
10173
|
}
|
|
10395
10174
|
if (_this.media) {
|
|
@@ -10400,51 +10179,49 @@
|
|
|
10400
10179
|
return _context.abrupt("return");
|
|
10401
10180
|
case 6:
|
|
10402
10181
|
headers = response.headers;
|
|
10403
|
-
elapsed = st ? firstByteTime - st : endTime - startTime;
|
|
10404
10182
|
_this.emit(EVENT.TTFB, {
|
|
10405
10183
|
url: _this._opts.url,
|
|
10406
10184
|
responseUrl: response.url,
|
|
10407
|
-
elapsed
|
|
10185
|
+
elapsed: st ? firstByteTime - st : endTime - startTime
|
|
10408
10186
|
});
|
|
10409
10187
|
_this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
10410
10188
|
headers
|
|
10411
10189
|
});
|
|
10412
|
-
_this._transferCost.set(TRANSFER_EVENT.TTFB, elapsed);
|
|
10413
10190
|
_this._acceptRanges = !!(headers !== null && headers !== void 0 && headers.get("Accept-Ranges")) || !!(headers !== null && headers !== void 0 && headers.get("Content-Range"));
|
|
10414
10191
|
_this._firstProgressEmit = true;
|
|
10415
|
-
case
|
|
10192
|
+
case 11:
|
|
10416
10193
|
if (_this._bufferService) {
|
|
10417
|
-
_context.next =
|
|
10194
|
+
_context.next = 13;
|
|
10418
10195
|
break;
|
|
10419
10196
|
}
|
|
10420
10197
|
return _context.abrupt("return");
|
|
10421
|
-
case
|
|
10198
|
+
case 13:
|
|
10422
10199
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
10423
10200
|
_this._bandwidthService.addChunkRecord(chunk === null || chunk === void 0 ? void 0 : chunk.byteLength, endTime - startTime);
|
|
10424
|
-
_context.prev =
|
|
10425
|
-
_context.next =
|
|
10201
|
+
_context.prev = 15;
|
|
10202
|
+
_context.next = 18;
|
|
10426
10203
|
return _this._bufferService.appendBuffer(chunk);
|
|
10427
|
-
case
|
|
10204
|
+
case 18:
|
|
10428
10205
|
(_this$_bufferService = _this._bufferService) === null || _this$_bufferService === void 0 ? void 0 : _this$_bufferService.evictBuffer(_this._opts.bufferBehind);
|
|
10429
|
-
_context.next =
|
|
10206
|
+
_context.next = 31;
|
|
10430
10207
|
break;
|
|
10431
|
-
case
|
|
10432
|
-
_context.prev =
|
|
10433
|
-
_context.t0 = _context["catch"](
|
|
10208
|
+
case 21:
|
|
10209
|
+
_context.prev = 21;
|
|
10210
|
+
_context.t0 = _context["catch"](15);
|
|
10434
10211
|
if (!(!_this.isLive && _this._bufferService.isFull())) {
|
|
10435
|
-
_context.next =
|
|
10212
|
+
_context.next = 30;
|
|
10436
10213
|
break;
|
|
10437
10214
|
}
|
|
10438
|
-
_context.next =
|
|
10215
|
+
_context.next = 26;
|
|
10439
10216
|
return _this._mediaLoader.cancel();
|
|
10440
|
-
case
|
|
10217
|
+
case 26:
|
|
10441
10218
|
_this._loading = false;
|
|
10442
10219
|
remaining = _this.bufferInfo().remaining;
|
|
10443
10220
|
_this._opts.preloadTime = parseInt(remaining) / 2;
|
|
10444
10221
|
return _context.abrupt("return");
|
|
10445
|
-
case
|
|
10222
|
+
case 30:
|
|
10446
10223
|
return _context.abrupt("return", _this._emitError(StreamingError.create(_context.t0)));
|
|
10447
|
-
case
|
|
10224
|
+
case 31:
|
|
10448
10225
|
if (_this._urlSwitching) {
|
|
10449
10226
|
_this._urlSwitching = false;
|
|
10450
10227
|
_this.emit(EVENT.SWITCH_URL_SUCCESS, {
|
|
@@ -10456,7 +10233,7 @@
|
|
|
10456
10233
|
_this._tick();
|
|
10457
10234
|
}
|
|
10458
10235
|
if (!(done && !_this.media.seeking)) {
|
|
10459
|
-
_context.next =
|
|
10236
|
+
_context.next = 38;
|
|
10460
10237
|
break;
|
|
10461
10238
|
}
|
|
10462
10239
|
_this.emit(EVENT.LOAD_COMPLETE);
|
|
@@ -10465,13 +10242,13 @@
|
|
|
10465
10242
|
_this._end();
|
|
10466
10243
|
}
|
|
10467
10244
|
return _context.abrupt("return");
|
|
10468
|
-
case
|
|
10245
|
+
case 38:
|
|
10469
10246
|
if (_this.isLive) {
|
|
10470
|
-
_context.next =
|
|
10247
|
+
_context.next = 40;
|
|
10471
10248
|
break;
|
|
10472
10249
|
}
|
|
10473
10250
|
return _context.abrupt("return");
|
|
10474
|
-
case
|
|
10251
|
+
case 40:
|
|
10475
10252
|
maxReaderInterval = _this._opts.maxReaderInterval;
|
|
10476
10253
|
if (maxReaderInterval && _this._firstProgressEmit) {
|
|
10477
10254
|
clearTimeout(_this._maxChunkWaitTimer);
|
|
@@ -10485,11 +10262,11 @@
|
|
|
10485
10262
|
_this._end();
|
|
10486
10263
|
}, maxReaderInterval);
|
|
10487
10264
|
}
|
|
10488
|
-
case
|
|
10265
|
+
case 42:
|
|
10489
10266
|
case "end":
|
|
10490
10267
|
return _context.stop();
|
|
10491
10268
|
}
|
|
10492
|
-
}, _callee, null, [[
|
|
10269
|
+
}, _callee, null, [[15, 21]]);
|
|
10493
10270
|
}));
|
|
10494
10271
|
return function(_x, _x2, _x3, _x4) {
|
|
10495
10272
|
return _ref2.apply(this, arguments);
|
|
@@ -10522,19 +10299,19 @@
|
|
|
10522
10299
|
if (bufferEnd < MAX_HOLE || !media.readyState)
|
|
10523
10300
|
return;
|
|
10524
10301
|
var opts = _this._opts;
|
|
10525
|
-
if (isMediaPlaying(media)
|
|
10302
|
+
if (isMediaPlaying(media)) {
|
|
10526
10303
|
if (_this._gapService) {
|
|
10527
10304
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10528
10305
|
}
|
|
10529
10306
|
} else {
|
|
10530
|
-
if (!media.currentTime && _this._gapService
|
|
10307
|
+
if (!media.currentTime && _this._gapService) {
|
|
10531
10308
|
var gapJump = _this._opts.mseLowLatency || _this._opts.mseLowLatency === false && _this.bufferInfo(MAX_START_GAP).nextStart;
|
|
10532
10309
|
if (gapJump) {
|
|
10533
10310
|
_this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
|
|
10534
10311
|
}
|
|
10535
10312
|
return;
|
|
10536
10313
|
}
|
|
10537
|
-
if (opts.isLive && media.readyState === 4 && bufferEnd
|
|
10314
|
+
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
10538
10315
|
_this.disconnect();
|
|
10539
10316
|
}
|
|
10540
10317
|
}
|
|
@@ -10683,7 +10460,6 @@
|
|
|
10683
10460
|
responseType: "arraybuffer"
|
|
10684
10461
|
}));
|
|
10685
10462
|
_this._disconnectRetryCount = _this._opts.disconnectRetryCount;
|
|
10686
|
-
_this._transferCost = new TransferCost();
|
|
10687
10463
|
_this._bufferService = new BufferService(_assertThisInitialized$3(_this), _this._opts.softDecode ? _this.media : void 0, _this._opts);
|
|
10688
10464
|
_this._seiService = new SeiService(_assertThisInitialized$3(_this));
|
|
10689
10465
|
_this._bandwidthService = new BandwidthService({
|
|
@@ -10707,7 +10483,7 @@
|
|
|
10707
10483
|
_createClass$4(Flv2, [{
|
|
10708
10484
|
key: "version",
|
|
10709
10485
|
get: function get() {
|
|
10710
|
-
return "3.0.
|
|
10486
|
+
return "3.0.19-rc.0";
|
|
10711
10487
|
}
|
|
10712
10488
|
}, {
|
|
10713
10489
|
key: "isLive",
|
|
@@ -10823,9 +10599,9 @@
|
|
|
10823
10599
|
return this._clear();
|
|
10824
10600
|
case 8:
|
|
10825
10601
|
setTimeout(function() {
|
|
10826
|
-
_this2._seamlessSwitching = true;
|
|
10827
10602
|
_this2._loadData(_this2._opts.url);
|
|
10828
10603
|
_this2._bufferService.seamlessSwitch();
|
|
10604
|
+
_this2._seamlessSwitching = true;
|
|
10829
10605
|
});
|
|
10830
10606
|
_context5.next = 13;
|
|
10831
10607
|
break;
|
|
@@ -10849,82 +10625,50 @@
|
|
|
10849
10625
|
}, {
|
|
10850
10626
|
key: "disconnect",
|
|
10851
10627
|
value: function disconnect() {
|
|
10852
|
-
var _this$_bufferService4;
|
|
10853
10628
|
logger.debug("disconnect!");
|
|
10854
|
-
(_this$_bufferService4 = this._bufferService) === null || _this$_bufferService4 === void 0 ? void 0 : _this$_bufferService4.resetSeamlessSwitchStats();
|
|
10855
10629
|
return this._clear();
|
|
10856
10630
|
}
|
|
10857
10631
|
}, {
|
|
10858
10632
|
key: "switchURL",
|
|
10859
10633
|
value: function() {
|
|
10860
|
-
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10634
|
+
var _switchURL = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(url, seamless) {
|
|
10861
10635
|
var _this3 = this;
|
|
10862
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10636
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10863
10637
|
while (1)
|
|
10864
|
-
switch (
|
|
10638
|
+
switch (_context6.prev = _context6.next) {
|
|
10865
10639
|
case 0:
|
|
10866
10640
|
if (this._bufferService) {
|
|
10867
|
-
|
|
10641
|
+
_context6.next = 2;
|
|
10868
10642
|
break;
|
|
10869
10643
|
}
|
|
10870
|
-
return
|
|
10644
|
+
return _context6.abrupt("return");
|
|
10871
10645
|
case 2:
|
|
10872
10646
|
this._resetDisconnectCount();
|
|
10873
|
-
if (!(this._loading && seamless)) {
|
|
10874
|
-
_context7.next = 6;
|
|
10875
|
-
break;
|
|
10876
|
-
}
|
|
10877
|
-
this._bufferService.seamlessLoadingSwitch = /* @__PURE__ */ function() {
|
|
10878
|
-
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(pts) {
|
|
10879
|
-
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
10880
|
-
while (1)
|
|
10881
|
-
switch (_context6.prev = _context6.next) {
|
|
10882
|
-
case 0:
|
|
10883
|
-
_context6.next = 2;
|
|
10884
|
-
return _this3._clear();
|
|
10885
|
-
case 2:
|
|
10886
|
-
_this3._bufferService.seamlessLoadingSwitching = true;
|
|
10887
|
-
_this3._urlSwitching = true;
|
|
10888
|
-
_this3._seamlessSwitching = true;
|
|
10889
|
-
_this3._bufferService.seamlessSwitch();
|
|
10890
|
-
_this3._loadData(url);
|
|
10891
|
-
case 7:
|
|
10892
|
-
case "end":
|
|
10893
|
-
return _context6.stop();
|
|
10894
|
-
}
|
|
10895
|
-
}, _callee6);
|
|
10896
|
-
}));
|
|
10897
|
-
return function(_x8) {
|
|
10898
|
-
return _ref5.apply(this, arguments);
|
|
10899
|
-
};
|
|
10900
|
-
}();
|
|
10901
|
-
return _context7.abrupt("return");
|
|
10902
|
-
case 6:
|
|
10903
10647
|
if (!(!seamless || !this._opts.isLive)) {
|
|
10904
|
-
|
|
10648
|
+
_context6.next = 8;
|
|
10905
10649
|
break;
|
|
10906
10650
|
}
|
|
10907
|
-
|
|
10651
|
+
_context6.next = 6;
|
|
10908
10652
|
return this.load(url);
|
|
10909
|
-
case
|
|
10653
|
+
case 6:
|
|
10910
10654
|
this._urlSwitching = true;
|
|
10911
|
-
return
|
|
10655
|
+
return _context6.abrupt("return", this.media.play(true).catch(function() {
|
|
10912
10656
|
}));
|
|
10913
|
-
case
|
|
10914
|
-
|
|
10657
|
+
case 8:
|
|
10658
|
+
_context6.next = 10;
|
|
10915
10659
|
return this._clear();
|
|
10916
|
-
case
|
|
10660
|
+
case 10:
|
|
10917
10661
|
setTimeout(function() {
|
|
10918
10662
|
_this3._urlSwitching = true;
|
|
10919
10663
|
_this3._seamlessSwitching = true;
|
|
10920
10664
|
_this3._loadData(url);
|
|
10921
10665
|
_this3._bufferService.seamlessSwitch();
|
|
10922
10666
|
});
|
|
10923
|
-
case
|
|
10667
|
+
case 11:
|
|
10924
10668
|
case "end":
|
|
10925
|
-
return
|
|
10669
|
+
return _context6.stop();
|
|
10926
10670
|
}
|
|
10927
|
-
},
|
|
10671
|
+
}, _callee6, this);
|
|
10928
10672
|
}));
|
|
10929
10673
|
function switchURL(_x6, _x7) {
|
|
10930
10674
|
return _switchURL.apply(this, arguments);
|
|
@@ -10934,16 +10678,16 @@
|
|
|
10934
10678
|
}, {
|
|
10935
10679
|
key: "destroy",
|
|
10936
10680
|
value: function() {
|
|
10937
|
-
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10938
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10681
|
+
var _destroy = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7() {
|
|
10682
|
+
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
10939
10683
|
while (1)
|
|
10940
|
-
switch (
|
|
10684
|
+
switch (_context7.prev = _context7.next) {
|
|
10941
10685
|
case 0:
|
|
10942
10686
|
if (this.media) {
|
|
10943
|
-
|
|
10687
|
+
_context7.next = 2;
|
|
10944
10688
|
break;
|
|
10945
10689
|
}
|
|
10946
|
-
return
|
|
10690
|
+
return _context7.abrupt("return");
|
|
10947
10691
|
case 2:
|
|
10948
10692
|
this.removeAllListeners();
|
|
10949
10693
|
this._seiService.reset();
|
|
@@ -10953,16 +10697,16 @@
|
|
|
10953
10697
|
this.media.removeEventListener("timeupdate", this._onTimeupdate);
|
|
10954
10698
|
this.media.removeEventListener("waiting", this._onWaiting);
|
|
10955
10699
|
this.media.removeEventListener("progress", this._onBufferUpdate);
|
|
10956
|
-
|
|
10700
|
+
_context7.next = 12;
|
|
10957
10701
|
return Promise.all([this._clear(), this._bufferService.destroy()]);
|
|
10958
10702
|
case 12:
|
|
10959
10703
|
this.media = null;
|
|
10960
10704
|
this._bufferService = null;
|
|
10961
10705
|
case 14:
|
|
10962
10706
|
case "end":
|
|
10963
|
-
return
|
|
10707
|
+
return _context7.stop();
|
|
10964
10708
|
}
|
|
10965
|
-
},
|
|
10709
|
+
}, _callee7, this);
|
|
10966
10710
|
}));
|
|
10967
10711
|
function destroy() {
|
|
10968
10712
|
return _destroy.apply(this, arguments);
|
|
@@ -10991,26 +10735,26 @@
|
|
|
10991
10735
|
}, {
|
|
10992
10736
|
key: "_reset",
|
|
10993
10737
|
value: function() {
|
|
10994
|
-
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10995
|
-
var reuseMse,
|
|
10996
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10738
|
+
var _reset2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee8() {
|
|
10739
|
+
var reuseMse, _args8 = arguments;
|
|
10740
|
+
return _regeneratorRuntime$1().wrap(function _callee8$(_context8) {
|
|
10997
10741
|
while (1)
|
|
10998
|
-
switch (
|
|
10742
|
+
switch (_context8.prev = _context8.next) {
|
|
10999
10743
|
case 0:
|
|
11000
|
-
reuseMse =
|
|
10744
|
+
reuseMse = _args8.length > 0 && _args8[0] !== void 0 ? _args8[0] : false;
|
|
11001
10745
|
this._seiService.reset();
|
|
11002
10746
|
this._bandwidthService.reset();
|
|
11003
10747
|
this._stats.reset();
|
|
11004
|
-
|
|
10748
|
+
_context8.next = 6;
|
|
11005
10749
|
return this._clear();
|
|
11006
10750
|
case 6:
|
|
11007
|
-
|
|
10751
|
+
_context8.next = 8;
|
|
11008
10752
|
return this._bufferService.reset(reuseMse);
|
|
11009
10753
|
case 8:
|
|
11010
10754
|
case "end":
|
|
11011
|
-
return
|
|
10755
|
+
return _context8.stop();
|
|
11012
10756
|
}
|
|
11013
|
-
},
|
|
10757
|
+
}, _callee8, this);
|
|
11014
10758
|
}));
|
|
11015
10759
|
function _reset() {
|
|
11016
10760
|
return _reset2.apply(this, arguments);
|
|
@@ -11020,17 +10764,17 @@
|
|
|
11020
10764
|
}, {
|
|
11021
10765
|
key: "_loadData",
|
|
11022
10766
|
value: function() {
|
|
11023
|
-
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
10767
|
+
var _loadData2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9(url, range) {
|
|
11024
10768
|
var finnalUrl;
|
|
11025
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10769
|
+
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
11026
10770
|
while (1)
|
|
11027
|
-
switch (
|
|
10771
|
+
switch (_context9.prev = _context9.next) {
|
|
11028
10772
|
case 0:
|
|
11029
10773
|
if (url)
|
|
11030
10774
|
this._opts.url = url;
|
|
11031
10775
|
finnalUrl = url = this._opts.url;
|
|
11032
10776
|
if (url) {
|
|
11033
|
-
|
|
10777
|
+
_context9.next = 4;
|
|
11034
10778
|
break;
|
|
11035
10779
|
}
|
|
11036
10780
|
throw new Error("Source url is missing");
|
|
@@ -11045,34 +10789,34 @@
|
|
|
11045
10789
|
});
|
|
11046
10790
|
logger.debug("load data, loading:", this._loading, finnalUrl);
|
|
11047
10791
|
if (!this._loading) {
|
|
11048
|
-
|
|
10792
|
+
_context9.next = 11;
|
|
11049
10793
|
break;
|
|
11050
10794
|
}
|
|
11051
|
-
|
|
10795
|
+
_context9.next = 11;
|
|
11052
10796
|
return this._mediaLoader.cancel();
|
|
11053
10797
|
case 11:
|
|
11054
10798
|
this._loading = true;
|
|
11055
|
-
|
|
11056
|
-
|
|
10799
|
+
_context9.prev = 12;
|
|
10800
|
+
_context9.next = 15;
|
|
11057
10801
|
return this._mediaLoader.load({
|
|
11058
10802
|
url: finnalUrl,
|
|
11059
10803
|
range
|
|
11060
10804
|
});
|
|
11061
10805
|
case 15:
|
|
11062
|
-
|
|
10806
|
+
_context9.next = 21;
|
|
11063
10807
|
break;
|
|
11064
10808
|
case 17:
|
|
11065
|
-
|
|
11066
|
-
|
|
10809
|
+
_context9.prev = 17;
|
|
10810
|
+
_context9.t0 = _context9["catch"](12);
|
|
11067
10811
|
this._loading = false;
|
|
11068
|
-
return
|
|
10812
|
+
return _context9.abrupt("return", this._emitError(StreamingError.network(_context9.t0), false));
|
|
11069
10813
|
case 21:
|
|
11070
10814
|
case "end":
|
|
11071
|
-
return
|
|
10815
|
+
return _context9.stop();
|
|
11072
10816
|
}
|
|
11073
|
-
},
|
|
10817
|
+
}, _callee9, this, [[12, 17]]);
|
|
11074
10818
|
}));
|
|
11075
|
-
function _loadData(
|
|
10819
|
+
function _loadData(_x8, _x9) {
|
|
11076
10820
|
return _loadData2.apply(this, arguments);
|
|
11077
10821
|
}
|
|
11078
10822
|
return _loadData;
|
|
@@ -11080,16 +10824,16 @@
|
|
|
11080
10824
|
}, {
|
|
11081
10825
|
key: "_clear",
|
|
11082
10826
|
value: function() {
|
|
11083
|
-
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function
|
|
11084
|
-
return _regeneratorRuntime$1().wrap(function
|
|
10827
|
+
var _clear2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee10() {
|
|
10828
|
+
return _regeneratorRuntime$1().wrap(function _callee10$(_context10) {
|
|
11085
10829
|
while (1)
|
|
11086
|
-
switch (
|
|
10830
|
+
switch (_context10.prev = _context10.next) {
|
|
11087
10831
|
case 0:
|
|
11088
10832
|
if (!this._mediaLoader) {
|
|
11089
|
-
|
|
10833
|
+
_context10.next = 3;
|
|
11090
10834
|
break;
|
|
11091
10835
|
}
|
|
11092
|
-
|
|
10836
|
+
_context10.next = 3;
|
|
11093
10837
|
return this._mediaLoader.cancel();
|
|
11094
10838
|
case 3:
|
|
11095
10839
|
clearTimeout(this._maxChunkWaitTimer);
|
|
@@ -11098,9 +10842,9 @@
|
|
|
11098
10842
|
this._firstProgressEmit = false;
|
|
11099
10843
|
case 7:
|
|
11100
10844
|
case "end":
|
|
11101
|
-
return
|
|
10845
|
+
return _context10.stop();
|
|
11102
10846
|
}
|
|
11103
|
-
},
|
|
10847
|
+
}, _callee10, this);
|
|
11104
10848
|
}));
|
|
11105
10849
|
function _clear() {
|
|
11106
10850
|
return _clear2.apply(this, arguments);
|
|
@@ -11294,11 +11038,6 @@
|
|
|
11294
11038
|
var _this$flv3;
|
|
11295
11039
|
return (_this$flv3 = this.flv) === null || _this$flv3 === void 0 ? void 0 : _this$flv3.loader;
|
|
11296
11040
|
}
|
|
11297
|
-
}, {
|
|
11298
|
-
key: "transferCost",
|
|
11299
|
-
get: function get() {
|
|
11300
|
-
return this.flv._transferCost.transferCost;
|
|
11301
|
-
}
|
|
11302
11041
|
}, {
|
|
11303
11042
|
key: "beforePlayerInit",
|
|
11304
11043
|
value: function beforePlayerInit() {
|
|
@@ -11318,8 +11057,8 @@
|
|
|
11318
11057
|
isLive: config.isLive,
|
|
11319
11058
|
media: this.player.video,
|
|
11320
11059
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
11321
|
-
var _this2$player, _this2$player
|
|
11322
|
-
return ((_this2$player =
|
|
11060
|
+
var _this2$player$preProc, _this2$player;
|
|
11061
|
+
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)) || {
|
|
11323
11062
|
url,
|
|
11324
11063
|
ext
|
|
11325
11064
|
};
|