@byteplus/veplayer-plugin 2.5.0-rc.2 → 2.6.0-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.
Files changed (31) hide show
  1. package/esm/index.d.ts +1 -0
  2. package/esm/index.development.css +11 -0
  3. package/esm/index.development.js +44338 -32853
  4. package/esm/index.production.css +1 -1
  5. package/esm/index.production.js +13 -4
  6. package/esm/veplayer.plugin.ad.development.css +11 -0
  7. package/esm/veplayer.plugin.ad.development.js +13194 -0
  8. package/esm/veplayer.plugin.ad.production.css +1 -0
  9. package/esm/veplayer.plugin.ad.production.js +4 -0
  10. package/esm/veplayer.plugin.flv.development.js +2 -2
  11. package/esm/veplayer.plugin.flv.production.js +1 -1
  12. package/esm/veplayer.plugin.hls.development.js +11 -5
  13. package/esm/veplayer.plugin.hls.production.js +1 -1
  14. package/esm/veplayer.plugin.mp4.development.js +1 -1
  15. package/esm/veplayer.plugin.mp4.production.js +1 -1
  16. package/esm/veplayer.plugin.rtm.development.js +45 -142
  17. package/esm/veplayer.plugin.rtm.production.js +1 -1
  18. package/package.json +1 -1
  19. package/umd/index.d.ts +1 -0
  20. package/umd/veplayer.plugin.ad.development.css +11 -0
  21. package/umd/veplayer.plugin.ad.development.js +13197 -0
  22. package/umd/veplayer.plugin.ad.production.css +1 -0
  23. package/umd/veplayer.plugin.ad.production.js +1 -0
  24. package/umd/veplayer.plugin.flv.development.js +2 -2
  25. package/umd/veplayer.plugin.flv.production.js +1 -1
  26. package/umd/veplayer.plugin.hls.development.js +11 -5
  27. package/umd/veplayer.plugin.hls.production.js +1 -1
  28. package/umd/veplayer.plugin.mp4.development.js +1 -1
  29. package/umd/veplayer.plugin.mp4.production.js +1 -1
  30. package/umd/veplayer.plugin.rtm.development.js +45 -142
  31. package/umd/veplayer.plugin.rtm.production.js +1 -1
@@ -1534,7 +1534,7 @@
1534
1534
  }
1535
1535
  return offsetTime;
1536
1536
  };
1537
- var version = "3.0.21-rc.2";
1537
+ var version = "3.0.21-rc.3";
1538
1538
  var ERROR_MAP = {
1539
1539
  1: 5101,
1540
1540
  2: 5102,
@@ -1598,8 +1598,6 @@
1598
1598
  }
1599
1599
  }
1600
1600
  );
1601
- var PLAY = "play";
1602
- var PAUSE = "pause";
1603
1601
  var ERROR = "error";
1604
1602
  var DESTROY = "destroy";
1605
1603
  var URL_CHANGE = "urlchange";
@@ -4882,8 +4880,7 @@
4882
4880
  loadTimeout: 5e3,
4883
4881
  stallInterval: 400,
4884
4882
  networkEvaluateInterval: 1e3,
4885
- delayHint: 0,
4886
- seamlesslyReload: false
4883
+ delayHint: 0
4887
4884
  }, opts);
4888
4885
  }
4889
4886
  function _getStats(stats) {
@@ -5146,7 +5143,6 @@
5146
5143
  _defineProperty$2(_assertThisInitialized$1(_this), "_audioTransceicer", null);
5147
5144
  _defineProperty$2(_assertThisInitialized$1(_this), "_videoTransceicer", null);
5148
5145
  _defineProperty$2(_assertThisInitialized$1(_this), "_mediaStream", null);
5149
- _defineProperty$2(_assertThisInitialized$1(_this), "_lastMediaStream", null);
5150
5146
  _defineProperty$2(_assertThisInitialized$1(_this), "_media", null);
5151
5147
  _defineProperty$2(_assertThisInitialized$1(_this), "_opts", null);
5152
5148
  _defineProperty$2(_assertThisInitialized$1(_this), "_loader", null);
@@ -5154,10 +5150,19 @@
5154
5150
  _defineProperty$2(_assertThisInitialized$1(_this), "_retry", 0);
5155
5151
  _defineProperty$2(_assertThisInitialized$1(_this), "_waitingTimer", 0);
5156
5152
  _defineProperty$2(_assertThisInitialized$1(_this), "_rctConnectStartTs", 0);
5157
- _defineProperty$2(_assertThisInitialized$1(_this), "_isReplacing", false);
5158
5153
  _defineProperty$2(_assertThisInitialized$1(_this), "_onTrack", function(e) {
5159
5154
  logger.log("addTrack: ", e.track, e.streams);
5160
5155
  _this["_".concat(e.track.kind)] = e.track;
5156
+ if (!_this._mediaStream) {
5157
+ _this._mediaStream = new MediaStream();
5158
+ _this._media.srcObject = _this._mediaStream;
5159
+ var req = _this._media.play();
5160
+ if (req && req.catch) {
5161
+ req.catch(function(e2) {
5162
+ });
5163
+ }
5164
+ }
5165
+ _this._mediaStream.addTrack(e.track);
5161
5166
  });
5162
5167
  _defineProperty$2(_assertThisInitialized$1(_this), "_mockWaitingByTimeupdate", function() {
5163
5168
  var _this$_pc, _this$_pc2;
@@ -5205,9 +5210,6 @@
5205
5210
  }));
5206
5211
  _this._retry = _this._opts.retryCount;
5207
5212
  _this._bindMediaEvent();
5208
- if (_this._opts.mediaStream && _this._opts.seamlesslyReload) {
5209
- _this._lastMediaStream = _this._opts.mediaStream;
5210
- }
5211
5213
  return _this;
5212
5214
  }
5213
5215
  _createClass$2(Rts2, [{
@@ -5319,7 +5321,6 @@
5319
5321
  _this3.load(_this3._url);
5320
5322
  }
5321
5323
  if (pc.connectionState === "connected") {
5322
- _this3._handleMediaStream();
5323
5324
  _this3.emit(EVENT.TTFB, {
5324
5325
  url: _this3._url,
5325
5326
  responseUrl: _this3._url,
@@ -5328,40 +5329,6 @@
5328
5329
  }
5329
5330
  });
5330
5331
  }
5331
- }, {
5332
- key: "_handleMediaStream",
5333
- value: function _handleMediaStream() {
5334
- var _this4 = this;
5335
- if (this._lastMediaStream) {
5336
- var _this$_media$play;
5337
- var videoTrack = this._lastMediaStream.getVideoTracks()[0];
5338
- var audioTrack = this._lastMediaStream.getAudioTracks()[0];
5339
- if (videoTrack) {
5340
- this._lastMediaStream.removeTrack(videoTrack);
5341
- }
5342
- if (audioTrack) {
5343
- this._lastMediaStream.removeTrack(audioTrack);
5344
- }
5345
- this._mediaStream = this._lastMediaStream;
5346
- this._audio && this._mediaStream.addTrack(this._audio);
5347
- this._video && this._mediaStream.addTrack(this._video);
5348
- this._isReplacing = true;
5349
- this._media.pause();
5350
- (_this$_media$play = this._media.play()) === null || _this$_media$play === void 0 ? void 0 : _this$_media$play.finally(function() {
5351
- _this4._isReplacing = false;
5352
- });
5353
- } else {
5354
- this._mediaStream = new MediaStream();
5355
- this._audio && this._mediaStream.addTrack(this._audio);
5356
- this._video && this._mediaStream.addTrack(this._video);
5357
- this._media.srcObject = this._mediaStream;
5358
- var req = this._media.play();
5359
- if (req && req.catch) {
5360
- req.catch(function(e) {
5361
- });
5362
- }
5363
- }
5364
- }
5365
5332
  }, {
5366
5333
  key: "_bindMediaEvent",
5367
5334
  value: function _bindMediaEvent() {
@@ -5534,11 +5501,11 @@
5534
5501
  }
5535
5502
  }, {
5536
5503
  key: "destroy",
5537
- value: function destroy(keepClearMediaStream) {
5504
+ value: function destroy() {
5538
5505
  var _this$_media2;
5539
5506
  this._disconnect();
5540
5507
  (_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
5541
- if (this._media && !keepClearMediaStream) {
5508
+ if (this._media) {
5542
5509
  this._media.srcObject = null;
5543
5510
  }
5544
5511
  if (this._pc) {
@@ -5638,36 +5605,15 @@
5638
5605
  }
5639
5606
  _this = _super.call.apply(_super, [this].concat(args));
5640
5607
  _defineProperty$2(_assertThisInitialized$1(_this), "_rts", null);
5641
- _defineProperty$2(_assertThisInitialized$1(_this), "_mediaStream", null);
5642
- _defineProperty$2(_assertThisInitialized$1(_this), "_disconnectTimer", void 0);
5643
5608
  _defineProperty$2(_assertThisInitialized$1(_this), "_rtsOpts", null);
5644
- _defineProperty$2(_assertThisInitialized$1(_this), "_onPause", function() {
5645
- if (_this._disconnectTimer) {
5646
- return;
5647
- }
5648
- _this._disconnectTimer = setTimeout(function() {
5649
- _this._closeAfterPause();
5650
- _this._clearDisconnectTimer();
5651
- }, _this.config.disconnectTime * 1e3);
5652
- });
5653
- _defineProperty$2(_assertThisInitialized$1(_this), "_reInit", function() {
5654
- var _this$_rts;
5655
- _this._clearDisconnectTimer();
5656
- if ((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc) {
5657
- return;
5658
- }
5659
- _this._init();
5660
- _this._bindRtsEvents();
5661
- });
5662
5609
  _defineProperty$2(_assertThisInitialized$1(_this), "_init", function() {
5663
- var _this$_rts2;
5664
- (_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2.destroy();
5610
+ var _this$_rts;
5611
+ (_this$_rts = _this._rts) === null || _this$_rts === void 0 ? void 0 : _this$_rts.destroy();
5665
5612
  var config = _this.player.config;
5666
5613
  var rtsOpts = config.rts || {};
5667
5614
  _this._rtsOpts = rtsOpts;
5668
5615
  _this._rts = new Rts(_objectSpread2$2({
5669
5616
  media: _this.player.video,
5670
- mediaStream: _this._mediaStream,
5671
5617
  preProcessUrl: function preProcessUrl(url, ext) {
5672
5618
  var _this$player$preProce, _this$player;
5673
5619
  return ((_this$player$preProce = (_this$player = _this.player).preProcessUrl) === null || _this$player$preProce === void 0 ? void 0 : _this$player$preProce.call(_this$player, url, ext)) || {
@@ -5679,40 +5625,35 @@
5679
5625
  _this._rts.load(config.url);
5680
5626
  });
5681
5627
  _defineProperty$2(_assertThisInitialized$1(_this), "_onSwitchURL", function(url) {
5682
- if (url) {
5683
- _this.player.config.url = url;
5684
- }
5685
5628
  if (_this._rts) {
5629
+ _this.player.config.url = url;
5686
5630
  _this._rts.switchURL(url);
5687
- } else {
5688
- _this._reInit();
5689
5631
  }
5690
5632
  });
5691
5633
  _defineProperty$2(_assertThisInitialized$1(_this), "destroy", function() {
5692
- var _this$_rts3;
5634
+ var _this$_rts2;
5693
5635
  _this.player.switchURL = _this._originSwitchFn;
5694
- _this._clearDisconnectTimer();
5695
- (_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
5636
+ (_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2.destroy();
5696
5637
  });
5697
5638
  return _this;
5698
5639
  }
5699
5640
  _createClass$2(RtsPlugin2, [{
5700
5641
  key: "pc",
5701
5642
  get: function get() {
5702
- var _this$_rts4;
5703
- return (_this$_rts4 = this._rts) === null || _this$_rts4 === void 0 ? void 0 : _this$_rts4.pc;
5643
+ var _this$_rts3;
5644
+ return (_this$_rts3 = this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.pc;
5704
5645
  }
5705
5646
  }, {
5706
5647
  key: "videoTrack",
5707
5648
  get: function get() {
5708
- var _this$_rts5;
5709
- return (_this$_rts5 = this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.videoTack;
5649
+ var _this$_rts4;
5650
+ return (_this$_rts4 = this._rts) === null || _this$_rts4 === void 0 ? void 0 : _this$_rts4.videoTack;
5710
5651
  }
5711
5652
  }, {
5712
5653
  key: "audioTrack",
5713
5654
  get: function get() {
5714
- var _this$_rts6;
5715
- return (_this$_rts6 = this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.audioTrack;
5655
+ var _this$_rts5;
5656
+ return (_this$_rts5 = this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.audioTrack;
5716
5657
  }
5717
5658
  }, {
5718
5659
  key: "core",
@@ -5722,43 +5663,37 @@
5722
5663
  }, {
5723
5664
  key: "loader",
5724
5665
  get: function get() {
5725
- var _this$_rts7;
5726
- return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.loader;
5666
+ var _this$_rts6;
5667
+ return (_this$_rts6 = this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.loader;
5727
5668
  }
5728
5669
  }, {
5729
5670
  key: "version",
5730
5671
  get: function get() {
5731
- return "0.2.1-alpha.12";
5672
+ return "0.2.1-alpha.0";
5732
5673
  }
5733
5674
  }, {
5734
5675
  key: "beforePlayerInit",
5735
5676
  value: function beforePlayerInit() {
5736
- var _this$player2, _this2 = this, _this$player$config, _this$player$config$r;
5677
+ var _this$player2, _this2 = this;
5737
5678
  this._init();
5738
5679
  if (!this._originSwitchFn) {
5739
5680
  this._originSwitchFn = this.player.switchURL.bind(this.player);
5740
5681
  }
5741
5682
  this.player.switchURL = this._onSwitchURL;
5742
5683
  (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.useHooks("replay", function() {
5743
- return _this2._onSwitchURL();
5684
+ var _this2$_rts;
5685
+ return (_this2$_rts = _this2._rts) === null || _this2$_rts === void 0 ? void 0 : _this2$_rts.switchURL();
5744
5686
  });
5745
5687
  this.on(URL_CHANGE, this._onSwitchURL);
5746
5688
  this.on(DESTROY, this.destroy);
5747
- if (typeof ((_this$player$config = this.player.config) === null || _this$player$config === void 0 ? void 0 : (_this$player$config$r = _this$player$config.rts) === null || _this$player$config$r === void 0 ? void 0 : _this$player$config$r.disconnectTime) !== "undefined") {
5748
- this.on(PAUSE, function() {
5749
- var _this2$_rts;
5750
- if (!((_this2$_rts = _this2._rts) !== null && _this2$_rts !== void 0 && _this2$_rts._isReplacing)) {
5751
- _this2._onPause();
5752
- }
5753
- });
5754
- this.on(PLAY, function() {
5755
- var _this2$_rts2;
5756
- if (!((_this2$_rts2 = _this2._rts) !== null && _this2$_rts2 !== void 0 && _this2$_rts2._isReplacing)) {
5757
- _this2._reInit();
5758
- }
5759
- });
5760
- }
5761
- this._bindRtsEvents();
5689
+ this._transErrorEvent();
5690
+ this._transCoreEvent(EVENT.LOAD_START);
5691
+ this._transCoreEvent(EVENT.LOAD_COMPLETE);
5692
+ this._transCoreEvent(EVENT.TTFB);
5693
+ this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS);
5694
+ this._transCoreEvent(EVENT.LOAD_RETRY);
5695
+ this._transCoreEvent(EVENT.METADATA_PARSED);
5696
+ this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);
5762
5697
  try {
5763
5698
  BasePlugin.defineGetterOrSetter(this.player, {
5764
5699
  __url: {
@@ -5780,52 +5715,20 @@
5780
5715
  }, {
5781
5716
  key: "getStats",
5782
5717
  value: function getStats2() {
5783
- var _this$_rts8;
5784
- return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.getStats();
5718
+ var _this$_rts7;
5719
+ return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.getStats();
5785
5720
  }
5786
5721
  }, {
5787
5722
  key: "getStatsSnapshoot",
5788
5723
  value: function getStatsSnapshoot2() {
5789
- var _this$_rts9;
5790
- return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.getStatsSnapshoot();
5724
+ var _this$_rts8;
5725
+ return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.getStatsSnapshoot();
5791
5726
  }
5792
5727
  }, {
5793
5728
  key: "getNetWorkInfo",
5794
5729
  value: function getNetWorkInfo() {
5795
- var _this$_rts10;
5796
- return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.networkStats;
5797
- }
5798
- }, {
5799
- key: "_clearDisconnectTimer",
5800
- value: function _clearDisconnectTimer() {
5801
- clearTimeout(this._disconnectTimer);
5802
- this._disconnectTimer = void 0;
5803
- }
5804
- }, {
5805
- key: "_closeAfterPause",
5806
- value: function _closeAfterPause() {
5807
- var _this$_rts11, _this$config, _this$_rts13;
5808
- if (!((_this$_rts11 = this._rts) !== null && _this$_rts11 !== void 0 && _this$_rts11._pc)) {
5809
- return;
5810
- }
5811
- if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.seamlesslyReload) {
5812
- var _this$_rts12;
5813
- this._mediaStream = (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12._mediaStream;
5814
- }
5815
- (_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.destroy(true);
5816
- this._rts = null;
5817
- }
5818
- }, {
5819
- key: "_bindRtsEvents",
5820
- value: function _bindRtsEvents() {
5821
- this._transErrorEvent();
5822
- this._transCoreEvent(EVENT.LOAD_START);
5823
- this._transCoreEvent(EVENT.LOAD_COMPLETE);
5824
- this._transCoreEvent(EVENT.TTFB);
5825
- this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS);
5826
- this._transCoreEvent(EVENT.LOAD_RETRY);
5827
- this._transCoreEvent(EVENT.METADATA_PARSED);
5828
- this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);
5730
+ var _this$_rts9;
5731
+ return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.networkStats;
5829
5732
  }
5830
5733
  }, {
5831
5734
  key: "_transErrorEvent",