@volcengine/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
|
@@ -1598,6 +1598,8 @@
|
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
1600
|
);
|
|
1601
|
+
var PLAY = "play";
|
|
1602
|
+
var PAUSE = "pause";
|
|
1601
1603
|
var ERROR = "error";
|
|
1602
1604
|
var DESTROY = "destroy";
|
|
1603
1605
|
var URL_CHANGE = "urlchange";
|
|
@@ -4812,7 +4814,8 @@
|
|
|
4812
4814
|
loadTimeout: 5e3,
|
|
4813
4815
|
stallInterval: 400,
|
|
4814
4816
|
networkEvaluateInterval: 1e3,
|
|
4815
|
-
delayHint: 0
|
|
4817
|
+
delayHint: 0,
|
|
4818
|
+
seamlesslyReload: false
|
|
4816
4819
|
}, opts);
|
|
4817
4820
|
}
|
|
4818
4821
|
function _getStats(stats) {
|
|
@@ -5085,16 +5088,6 @@
|
|
|
5085
5088
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onTrack", function(e) {
|
|
5086
5089
|
logger.log("addTrack: ", e.track, e.streams);
|
|
5087
5090
|
_this["_".concat(e.track.kind)] = e.track;
|
|
5088
|
-
if (!_this._mediaStream) {
|
|
5089
|
-
_this._mediaStream = new MediaStream();
|
|
5090
|
-
_this._media.srcObject = _this._mediaStream;
|
|
5091
|
-
var req = _this._media.play();
|
|
5092
|
-
if (req && req.catch) {
|
|
5093
|
-
req.catch(function(e2) {
|
|
5094
|
-
});
|
|
5095
|
-
}
|
|
5096
|
-
}
|
|
5097
|
-
_this._mediaStream.addTrack(e.track);
|
|
5098
5091
|
});
|
|
5099
5092
|
_defineProperty$2(_assertThisInitialized$1(_this), "_mockWaitingByTimeupdate", function() {
|
|
5100
5093
|
var _this$_pc, _this$_pc2;
|
|
@@ -5253,6 +5246,7 @@
|
|
|
5253
5246
|
_this3.load(_this3._url);
|
|
5254
5247
|
}
|
|
5255
5248
|
if (pc.connectionState === "connected") {
|
|
5249
|
+
_this3._handleMediaStream();
|
|
5256
5250
|
_this3.emit(EVENT.TTFB, {
|
|
5257
5251
|
url: _this3._url,
|
|
5258
5252
|
responseUrl: _this3._url,
|
|
@@ -5261,6 +5255,31 @@
|
|
|
5261
5255
|
}
|
|
5262
5256
|
});
|
|
5263
5257
|
}
|
|
5258
|
+
}, {
|
|
5259
|
+
key: "_handleMediaStream",
|
|
5260
|
+
value: function _handleMediaStream() {
|
|
5261
|
+
if (this._opts.mediaStream && this._opts.seamlesslyReload) {
|
|
5262
|
+
var videoTrack = this._opts.mediaStream.getVideoTracks()[0];
|
|
5263
|
+
var audioTrack = this._opts.mediaStream.getAudioTracks()[0];
|
|
5264
|
+
if (videoTrack) {
|
|
5265
|
+
this._opts.mediaStream.removeTrack(videoTrack);
|
|
5266
|
+
}
|
|
5267
|
+
if (audioTrack) {
|
|
5268
|
+
this._opts.mediaStream.removeTrack(audioTrack);
|
|
5269
|
+
}
|
|
5270
|
+
this._mediaStream = this._opts.mediaStream;
|
|
5271
|
+
} else {
|
|
5272
|
+
this._mediaStream = new MediaStream();
|
|
5273
|
+
this._media.srcObject = this._mediaStream;
|
|
5274
|
+
var req = this._media.play();
|
|
5275
|
+
if (req && req.catch) {
|
|
5276
|
+
req.catch(function(e) {
|
|
5277
|
+
});
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
5280
|
+
this._mediaStream.addTrack(this._audio);
|
|
5281
|
+
this._mediaStream.addTrack(this._video);
|
|
5282
|
+
}
|
|
5264
5283
|
}, {
|
|
5265
5284
|
key: "_bindMediaEvent",
|
|
5266
5285
|
value: function _bindMediaEvent() {
|
|
@@ -5418,9 +5437,11 @@
|
|
|
5418
5437
|
}, {
|
|
5419
5438
|
key: "_disconnect",
|
|
5420
5439
|
value: function _disconnect() {
|
|
5421
|
-
var _this$_loader, _this$_networkEvaluat2;
|
|
5440
|
+
var _this$_loader, _this$_networkEvaluat2, _this$_videoTransceic, _this$_audioTransceic;
|
|
5422
5441
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
5423
5442
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
5443
|
+
(_this$_videoTransceic = this._videoTransceicer) === null || _this$_videoTransceic === void 0 ? void 0 : _this$_videoTransceic.stop();
|
|
5444
|
+
(_this$_audioTransceic = this._audioTransceicer) === null || _this$_audioTransceic === void 0 ? void 0 : _this$_audioTransceic.stop();
|
|
5424
5445
|
this._audioTransceicer = null;
|
|
5425
5446
|
this._videoTransceicer = null;
|
|
5426
5447
|
this._mediaStream = null;
|
|
@@ -5434,10 +5455,10 @@
|
|
|
5434
5455
|
}, {
|
|
5435
5456
|
key: "destroy",
|
|
5436
5457
|
value: function destroy() {
|
|
5437
|
-
var _this$_media2;
|
|
5458
|
+
var _this$_media2, _this$_opts;
|
|
5438
5459
|
this._disconnect();
|
|
5439
5460
|
(_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
|
|
5440
|
-
if (this._media) {
|
|
5461
|
+
if (this._media && !((_this$_opts = this._opts) !== null && _this$_opts !== void 0 && _this$_opts.seamlesslyReload)) {
|
|
5441
5462
|
this._media.srcObject = null;
|
|
5442
5463
|
}
|
|
5443
5464
|
if (this._pc) {
|
|
@@ -5537,15 +5558,35 @@
|
|
|
5537
5558
|
}
|
|
5538
5559
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
5539
5560
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rts", null);
|
|
5561
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_mediaStream", null);
|
|
5540
5562
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtsOpts", null);
|
|
5563
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_onPause", function() {
|
|
5564
|
+
var _this$_rts, _this$config, _this$_rts3;
|
|
5565
|
+
if (!((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc)) {
|
|
5566
|
+
return;
|
|
5567
|
+
}
|
|
5568
|
+
if ((_this$config = _this.config) !== null && _this$config !== void 0 && _this$config.seamlesslyReload) {
|
|
5569
|
+
var _this$_rts2;
|
|
5570
|
+
_this._mediaStream = (_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2._mediaStream;
|
|
5571
|
+
}
|
|
5572
|
+
(_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
|
|
5573
|
+
});
|
|
5574
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_onPlay", function() {
|
|
5575
|
+
var _this$_rts4;
|
|
5576
|
+
if ((_this$_rts4 = _this._rts) !== null && _this$_rts4 !== void 0 && _this$_rts4._pc) {
|
|
5577
|
+
return;
|
|
5578
|
+
}
|
|
5579
|
+
_this._init();
|
|
5580
|
+
});
|
|
5541
5581
|
_defineProperty$2(_assertThisInitialized$1(_this), "_init", function() {
|
|
5542
|
-
var _this$
|
|
5543
|
-
(_this$
|
|
5582
|
+
var _this$_rts5;
|
|
5583
|
+
(_this$_rts5 = _this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.destroy();
|
|
5544
5584
|
var config = _this.player.config;
|
|
5545
5585
|
var rtsOpts = config.rts || {};
|
|
5546
5586
|
_this._rtsOpts = rtsOpts;
|
|
5547
5587
|
_this._rts = new Rts(_objectSpread2$2({
|
|
5548
5588
|
media: _this.player.video,
|
|
5589
|
+
mediaStream: _this._mediaStream,
|
|
5549
5590
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
5550
5591
|
var _this$player$preProce, _this$player;
|
|
5551
5592
|
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)) || {
|
|
@@ -5563,29 +5604,29 @@
|
|
|
5563
5604
|
}
|
|
5564
5605
|
});
|
|
5565
5606
|
_defineProperty$2(_assertThisInitialized$1(_this), "destroy", function() {
|
|
5566
|
-
var _this$
|
|
5607
|
+
var _this$_rts6;
|
|
5567
5608
|
_this.player.switchURL = _this._originSwitchFn;
|
|
5568
|
-
(_this$
|
|
5609
|
+
(_this$_rts6 = _this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.destroy();
|
|
5569
5610
|
});
|
|
5570
5611
|
return _this;
|
|
5571
5612
|
}
|
|
5572
5613
|
_createClass$2(RtsPlugin2, [{
|
|
5573
5614
|
key: "pc",
|
|
5574
5615
|
get: function get() {
|
|
5575
|
-
var _this$
|
|
5576
|
-
return (_this$
|
|
5616
|
+
var _this$_rts7;
|
|
5617
|
+
return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.pc;
|
|
5577
5618
|
}
|
|
5578
5619
|
}, {
|
|
5579
5620
|
key: "videoTrack",
|
|
5580
5621
|
get: function get() {
|
|
5581
|
-
var _this$
|
|
5582
|
-
return (_this$
|
|
5622
|
+
var _this$_rts8;
|
|
5623
|
+
return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.videoTack;
|
|
5583
5624
|
}
|
|
5584
5625
|
}, {
|
|
5585
5626
|
key: "audioTrack",
|
|
5586
5627
|
get: function get() {
|
|
5587
|
-
var _this$
|
|
5588
|
-
return (_this$
|
|
5628
|
+
var _this$_rts9;
|
|
5629
|
+
return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.audioTrack;
|
|
5589
5630
|
}
|
|
5590
5631
|
}, {
|
|
5591
5632
|
key: "core",
|
|
@@ -5595,18 +5636,18 @@
|
|
|
5595
5636
|
}, {
|
|
5596
5637
|
key: "loader",
|
|
5597
5638
|
get: function get() {
|
|
5598
|
-
var _this$
|
|
5599
|
-
return (_this$
|
|
5639
|
+
var _this$_rts10;
|
|
5640
|
+
return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.loader;
|
|
5600
5641
|
}
|
|
5601
5642
|
}, {
|
|
5602
5643
|
key: "version",
|
|
5603
5644
|
get: function get() {
|
|
5604
|
-
return "0.2.1-alpha.
|
|
5645
|
+
return "0.2.1-alpha.2";
|
|
5605
5646
|
}
|
|
5606
5647
|
}, {
|
|
5607
5648
|
key: "beforePlayerInit",
|
|
5608
5649
|
value: function beforePlayerInit() {
|
|
5609
|
-
var _this$player2, _this2 = this;
|
|
5650
|
+
var _this$player2, _this2 = this, _this$player$config, _this$player$config$r;
|
|
5610
5651
|
this._init();
|
|
5611
5652
|
if (!this._originSwitchFn) {
|
|
5612
5653
|
this._originSwitchFn = this.player.switchURL.bind(this.player);
|
|
@@ -5618,6 +5659,10 @@
|
|
|
5618
5659
|
});
|
|
5619
5660
|
this.on(URL_CHANGE, this._onSwitchURL);
|
|
5620
5661
|
this.on(DESTROY, this.destroy);
|
|
5662
|
+
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) {
|
|
5663
|
+
this.on(PAUSE, this._onPause);
|
|
5664
|
+
this.on(PLAY, this._onPlay);
|
|
5665
|
+
}
|
|
5621
5666
|
this._transErrorEvent();
|
|
5622
5667
|
this._transCoreEvent(EVENT.LOAD_START);
|
|
5623
5668
|
this._transCoreEvent(EVENT.LOAD_COMPLETE);
|
|
@@ -5647,20 +5692,20 @@
|
|
|
5647
5692
|
}, {
|
|
5648
5693
|
key: "getStats",
|
|
5649
5694
|
value: function getStats2() {
|
|
5650
|
-
var _this$
|
|
5651
|
-
return (_this$
|
|
5695
|
+
var _this$_rts11;
|
|
5696
|
+
return (_this$_rts11 = this._rts) === null || _this$_rts11 === void 0 ? void 0 : _this$_rts11.getStats();
|
|
5652
5697
|
}
|
|
5653
5698
|
}, {
|
|
5654
5699
|
key: "getStatsSnapshoot",
|
|
5655
5700
|
value: function getStatsSnapshoot2() {
|
|
5656
|
-
var _this$
|
|
5657
|
-
return (_this$
|
|
5701
|
+
var _this$_rts12;
|
|
5702
|
+
return (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12.getStatsSnapshoot();
|
|
5658
5703
|
}
|
|
5659
5704
|
}, {
|
|
5660
5705
|
key: "getNetWorkInfo",
|
|
5661
5706
|
value: function getNetWorkInfo() {
|
|
5662
|
-
var _this$
|
|
5663
|
-
return (_this$
|
|
5707
|
+
var _this$_rts13;
|
|
5708
|
+
return (_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.networkStats;
|
|
5664
5709
|
}
|
|
5665
5710
|
}, {
|
|
5666
5711
|
key: "_transErrorEvent",
|
|
@@ -5697,14 +5742,8 @@
|
|
|
5697
5742
|
}
|
|
5698
5743
|
player.config.url = backupURL;
|
|
5699
5744
|
if (backupConstruct) {
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
}
|
|
5703
|
-
backupConstruct.forEach(function(construct) {
|
|
5704
|
-
var _newPlugin$beforePlay;
|
|
5705
|
-
var newPlugin = player.registerPlugin(construct);
|
|
5706
|
-
(_newPlugin$beforePlay = newPlugin.beforePlayerInit) === null || _newPlugin$beforePlay === void 0 ? void 0 : _newPlugin$beforePlay.call(newPlugin);
|
|
5707
|
-
});
|
|
5745
|
+
var newPlugin = player.registerPlugin(backupConstruct);
|
|
5746
|
+
newPlugin.beforePlayerInit();
|
|
5708
5747
|
} else {
|
|
5709
5748
|
player.video.src = backupURL;
|
|
5710
5749
|
}
|