@byteplus/veplayer-plugin 2.4.0 → 2.4.1-rc.1

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