@byteplus/veplayer-plugin 2.4.1-rc.0 → 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 +84 -60
- package/esm/index.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +3 -18
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +81 -42
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.flv.development.js +3 -18
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +81 -42
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -1594,6 +1594,8 @@ var Errors = /* @__PURE__ */ _createClass$1(
|
|
|
1594
1594
|
}
|
|
1595
1595
|
}
|
|
1596
1596
|
);
|
|
1597
|
+
var PLAY = "play";
|
|
1598
|
+
var PAUSE = "pause";
|
|
1597
1599
|
var ERROR = "error";
|
|
1598
1600
|
var DESTROY = "destroy";
|
|
1599
1601
|
var URL_CHANGE = "urlchange";
|
|
@@ -4808,7 +4810,8 @@ function getOption(opts) {
|
|
|
4808
4810
|
loadTimeout: 5e3,
|
|
4809
4811
|
stallInterval: 400,
|
|
4810
4812
|
networkEvaluateInterval: 1e3,
|
|
4811
|
-
delayHint: 0
|
|
4813
|
+
delayHint: 0,
|
|
4814
|
+
seamlesslyReload: false
|
|
4812
4815
|
}, opts);
|
|
4813
4816
|
}
|
|
4814
4817
|
function _getStats(stats) {
|
|
@@ -5081,16 +5084,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5081
5084
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onTrack", function(e) {
|
|
5082
5085
|
logger.log("addTrack: ", e.track, e.streams);
|
|
5083
5086
|
_this["_".concat(e.track.kind)] = e.track;
|
|
5084
|
-
if (!_this._mediaStream) {
|
|
5085
|
-
_this._mediaStream = new MediaStream();
|
|
5086
|
-
_this._media.srcObject = _this._mediaStream;
|
|
5087
|
-
var req = _this._media.play();
|
|
5088
|
-
if (req && req.catch) {
|
|
5089
|
-
req.catch(function(e2) {
|
|
5090
|
-
});
|
|
5091
|
-
}
|
|
5092
|
-
}
|
|
5093
|
-
_this._mediaStream.addTrack(e.track);
|
|
5094
5087
|
});
|
|
5095
5088
|
_defineProperty$2(_assertThisInitialized$1(_this), "_mockWaitingByTimeupdate", function() {
|
|
5096
5089
|
var _this$_pc, _this$_pc2;
|
|
@@ -5249,6 +5242,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5249
5242
|
_this3.load(_this3._url);
|
|
5250
5243
|
}
|
|
5251
5244
|
if (pc.connectionState === "connected") {
|
|
5245
|
+
_this3._handleMediaStream();
|
|
5252
5246
|
_this3.emit(EVENT.TTFB, {
|
|
5253
5247
|
url: _this3._url,
|
|
5254
5248
|
responseUrl: _this3._url,
|
|
@@ -5257,6 +5251,31 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5257
5251
|
}
|
|
5258
5252
|
});
|
|
5259
5253
|
}
|
|
5254
|
+
}, {
|
|
5255
|
+
key: "_handleMediaStream",
|
|
5256
|
+
value: function _handleMediaStream() {
|
|
5257
|
+
if (this._opts.mediaStream && this._opts.seamlesslyReload) {
|
|
5258
|
+
var videoTrack = this._opts.mediaStream.getVideoTracks()[0];
|
|
5259
|
+
var audioTrack = this._opts.mediaStream.getAudioTracks()[0];
|
|
5260
|
+
if (videoTrack) {
|
|
5261
|
+
this._opts.mediaStream.removeTrack(videoTrack);
|
|
5262
|
+
}
|
|
5263
|
+
if (audioTrack) {
|
|
5264
|
+
this._opts.mediaStream.removeTrack(audioTrack);
|
|
5265
|
+
}
|
|
5266
|
+
this._mediaStream = this._opts.mediaStream;
|
|
5267
|
+
} else {
|
|
5268
|
+
this._mediaStream = new MediaStream();
|
|
5269
|
+
this._media.srcObject = this._mediaStream;
|
|
5270
|
+
var req = this._media.play();
|
|
5271
|
+
if (req && req.catch) {
|
|
5272
|
+
req.catch(function(e) {
|
|
5273
|
+
});
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
5276
|
+
this._mediaStream.addTrack(this._audio);
|
|
5277
|
+
this._mediaStream.addTrack(this._video);
|
|
5278
|
+
}
|
|
5260
5279
|
}, {
|
|
5261
5280
|
key: "_bindMediaEvent",
|
|
5262
5281
|
value: function _bindMediaEvent() {
|
|
@@ -5414,9 +5433,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5414
5433
|
}, {
|
|
5415
5434
|
key: "_disconnect",
|
|
5416
5435
|
value: function _disconnect() {
|
|
5417
|
-
var _this$_loader, _this$_networkEvaluat2;
|
|
5436
|
+
var _this$_loader, _this$_networkEvaluat2, _this$_videoTransceic, _this$_audioTransceic;
|
|
5418
5437
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
5419
5438
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
5439
|
+
(_this$_videoTransceic = this._videoTransceicer) === null || _this$_videoTransceic === void 0 ? void 0 : _this$_videoTransceic.stop();
|
|
5440
|
+
(_this$_audioTransceic = this._audioTransceicer) === null || _this$_audioTransceic === void 0 ? void 0 : _this$_audioTransceic.stop();
|
|
5420
5441
|
this._audioTransceicer = null;
|
|
5421
5442
|
this._videoTransceicer = null;
|
|
5422
5443
|
this._mediaStream = null;
|
|
@@ -5430,10 +5451,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5430
5451
|
}, {
|
|
5431
5452
|
key: "destroy",
|
|
5432
5453
|
value: function destroy() {
|
|
5433
|
-
var _this$_media2;
|
|
5454
|
+
var _this$_media2, _this$_opts;
|
|
5434
5455
|
this._disconnect();
|
|
5435
5456
|
(_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
|
|
5436
|
-
if (this._media) {
|
|
5457
|
+
if (this._media && !((_this$_opts = this._opts) !== null && _this$_opts !== void 0 && _this$_opts.seamlesslyReload)) {
|
|
5437
5458
|
this._media.srcObject = null;
|
|
5438
5459
|
}
|
|
5439
5460
|
if (this._pc) {
|
|
@@ -5533,15 +5554,35 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5533
5554
|
}
|
|
5534
5555
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
5535
5556
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rts", null);
|
|
5557
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_mediaStream", null);
|
|
5536
5558
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtsOpts", null);
|
|
5559
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_onPause", function() {
|
|
5560
|
+
var _this$_rts, _this$config, _this$_rts3;
|
|
5561
|
+
if (!((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc)) {
|
|
5562
|
+
return;
|
|
5563
|
+
}
|
|
5564
|
+
if ((_this$config = _this.config) !== null && _this$config !== void 0 && _this$config.seamlesslyReload) {
|
|
5565
|
+
var _this$_rts2;
|
|
5566
|
+
_this._mediaStream = (_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2._mediaStream;
|
|
5567
|
+
}
|
|
5568
|
+
(_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
|
|
5569
|
+
});
|
|
5570
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_onPlay", function() {
|
|
5571
|
+
var _this$_rts4;
|
|
5572
|
+
if ((_this$_rts4 = _this._rts) !== null && _this$_rts4 !== void 0 && _this$_rts4._pc) {
|
|
5573
|
+
return;
|
|
5574
|
+
}
|
|
5575
|
+
_this._init();
|
|
5576
|
+
});
|
|
5537
5577
|
_defineProperty$2(_assertThisInitialized$1(_this), "_init", function() {
|
|
5538
|
-
var _this$
|
|
5539
|
-
(_this$
|
|
5578
|
+
var _this$_rts5;
|
|
5579
|
+
(_this$_rts5 = _this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.destroy();
|
|
5540
5580
|
var config = _this.player.config;
|
|
5541
5581
|
var rtsOpts = config.rts || {};
|
|
5542
5582
|
_this._rtsOpts = rtsOpts;
|
|
5543
5583
|
_this._rts = new Rts(_objectSpread2$2({
|
|
5544
5584
|
media: _this.player.video,
|
|
5585
|
+
mediaStream: _this._mediaStream,
|
|
5545
5586
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
5546
5587
|
var _this$player$preProce, _this$player;
|
|
5547
5588
|
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)) || {
|
|
@@ -5559,29 +5600,29 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5559
5600
|
}
|
|
5560
5601
|
});
|
|
5561
5602
|
_defineProperty$2(_assertThisInitialized$1(_this), "destroy", function() {
|
|
5562
|
-
var _this$
|
|
5603
|
+
var _this$_rts6;
|
|
5563
5604
|
_this.player.switchURL = _this._originSwitchFn;
|
|
5564
|
-
(_this$
|
|
5605
|
+
(_this$_rts6 = _this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.destroy();
|
|
5565
5606
|
});
|
|
5566
5607
|
return _this;
|
|
5567
5608
|
}
|
|
5568
5609
|
_createClass$2(RtsPlugin2, [{
|
|
5569
5610
|
key: "pc",
|
|
5570
5611
|
get: function get() {
|
|
5571
|
-
var _this$
|
|
5572
|
-
return (_this$
|
|
5612
|
+
var _this$_rts7;
|
|
5613
|
+
return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.pc;
|
|
5573
5614
|
}
|
|
5574
5615
|
}, {
|
|
5575
5616
|
key: "videoTrack",
|
|
5576
5617
|
get: function get() {
|
|
5577
|
-
var _this$
|
|
5578
|
-
return (_this$
|
|
5618
|
+
var _this$_rts8;
|
|
5619
|
+
return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.videoTack;
|
|
5579
5620
|
}
|
|
5580
5621
|
}, {
|
|
5581
5622
|
key: "audioTrack",
|
|
5582
5623
|
get: function get() {
|
|
5583
|
-
var _this$
|
|
5584
|
-
return (_this$
|
|
5624
|
+
var _this$_rts9;
|
|
5625
|
+
return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.audioTrack;
|
|
5585
5626
|
}
|
|
5586
5627
|
}, {
|
|
5587
5628
|
key: "core",
|
|
@@ -5591,18 +5632,18 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5591
5632
|
}, {
|
|
5592
5633
|
key: "loader",
|
|
5593
5634
|
get: function get() {
|
|
5594
|
-
var _this$
|
|
5595
|
-
return (_this$
|
|
5635
|
+
var _this$_rts10;
|
|
5636
|
+
return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.loader;
|
|
5596
5637
|
}
|
|
5597
5638
|
}, {
|
|
5598
5639
|
key: "version",
|
|
5599
5640
|
get: function get() {
|
|
5600
|
-
return "0.2.1-alpha.
|
|
5641
|
+
return "0.2.1-alpha.2";
|
|
5601
5642
|
}
|
|
5602
5643
|
}, {
|
|
5603
5644
|
key: "beforePlayerInit",
|
|
5604
5645
|
value: function beforePlayerInit() {
|
|
5605
|
-
var _this$player2, _this2 = this;
|
|
5646
|
+
var _this$player2, _this2 = this, _this$player$config, _this$player$config$r;
|
|
5606
5647
|
this._init();
|
|
5607
5648
|
if (!this._originSwitchFn) {
|
|
5608
5649
|
this._originSwitchFn = this.player.switchURL.bind(this.player);
|
|
@@ -5614,6 +5655,10 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5614
5655
|
});
|
|
5615
5656
|
this.on(URL_CHANGE, this._onSwitchURL);
|
|
5616
5657
|
this.on(DESTROY, this.destroy);
|
|
5658
|
+
if ((_this$player$config = this.player.config) !== null && _this$player$config !== void 0 && (_this$player$config$r = _this$player$config.rts) !== null && _this$player$config$r !== void 0 && _this$player$config$r.seamlesslyReload) {
|
|
5659
|
+
this.on(PAUSE, this._onPause);
|
|
5660
|
+
this.on(PLAY, this._onPlay);
|
|
5661
|
+
}
|
|
5617
5662
|
this._transErrorEvent();
|
|
5618
5663
|
this._transCoreEvent(EVENT.LOAD_START);
|
|
5619
5664
|
this._transCoreEvent(EVENT.LOAD_COMPLETE);
|
|
@@ -5643,20 +5688,20 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5643
5688
|
}, {
|
|
5644
5689
|
key: "getStats",
|
|
5645
5690
|
value: function getStats2() {
|
|
5646
|
-
var _this$
|
|
5647
|
-
return (_this$
|
|
5691
|
+
var _this$_rts11;
|
|
5692
|
+
return (_this$_rts11 = this._rts) === null || _this$_rts11 === void 0 ? void 0 : _this$_rts11.getStats();
|
|
5648
5693
|
}
|
|
5649
5694
|
}, {
|
|
5650
5695
|
key: "getStatsSnapshoot",
|
|
5651
5696
|
value: function getStatsSnapshoot2() {
|
|
5652
|
-
var _this$
|
|
5653
|
-
return (_this$
|
|
5697
|
+
var _this$_rts12;
|
|
5698
|
+
return (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12.getStatsSnapshoot();
|
|
5654
5699
|
}
|
|
5655
5700
|
}, {
|
|
5656
5701
|
key: "getNetWorkInfo",
|
|
5657
5702
|
value: function getNetWorkInfo() {
|
|
5658
|
-
var _this$
|
|
5659
|
-
return (_this$
|
|
5703
|
+
var _this$_rts13;
|
|
5704
|
+
return (_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.networkStats;
|
|
5660
5705
|
}
|
|
5661
5706
|
}, {
|
|
5662
5707
|
key: "_transErrorEvent",
|
|
@@ -5693,14 +5738,8 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5693
5738
|
}
|
|
5694
5739
|
player.config.url = backupURL;
|
|
5695
5740
|
if (backupConstruct) {
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
}
|
|
5699
|
-
backupConstruct.forEach(function(construct) {
|
|
5700
|
-
var _newPlugin$beforePlay;
|
|
5701
|
-
var newPlugin = player.registerPlugin(construct);
|
|
5702
|
-
(_newPlugin$beforePlay = newPlugin.beforePlayerInit) === null || _newPlugin$beforePlay === void 0 ? void 0 : _newPlugin$beforePlay.call(newPlugin);
|
|
5703
|
-
});
|
|
5741
|
+
var newPlugin = player.registerPlugin(backupConstruct);
|
|
5742
|
+
newPlugin.beforePlayerInit();
|
|
5704
5743
|
} else {
|
|
5705
5744
|
player.video.src = backupURL;
|
|
5706
5745
|
}
|