@volcengine/veplayer-plugin 2.4.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 +79 -34
- package/esm/index.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +79 -34
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.rtm.development.js +79 -34
- package/umd/veplayer.plugin.rtm.production.js +1 -1
package/esm/index.development.js
CHANGED
|
@@ -1759,6 +1759,8 @@ var Errors = /* @__PURE__ */ _createClass$i(
|
|
|
1759
1759
|
}
|
|
1760
1760
|
}
|
|
1761
1761
|
);
|
|
1762
|
+
var PLAY = "play";
|
|
1763
|
+
var PAUSE = "pause";
|
|
1762
1764
|
var ERROR = "error";
|
|
1763
1765
|
var TIME_UPDATE = "timeupdate";
|
|
1764
1766
|
var WAITING = "waiting";
|
|
@@ -30173,7 +30175,8 @@ function getOption(opts) {
|
|
|
30173
30175
|
loadTimeout: 5e3,
|
|
30174
30176
|
stallInterval: 400,
|
|
30175
30177
|
networkEvaluateInterval: 1e3,
|
|
30176
|
-
delayHint: 0
|
|
30178
|
+
delayHint: 0,
|
|
30179
|
+
seamlesslyReload: false
|
|
30177
30180
|
}, opts);
|
|
30178
30181
|
}
|
|
30179
30182
|
function _getStats(stats) {
|
|
@@ -30446,16 +30449,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30446
30449
|
_defineProperty$c(_assertThisInitialized$b(_this), "_onTrack", function(e) {
|
|
30447
30450
|
logger$6.log("addTrack: ", e.track, e.streams);
|
|
30448
30451
|
_this["_".concat(e.track.kind)] = e.track;
|
|
30449
|
-
if (!_this._mediaStream) {
|
|
30450
|
-
_this._mediaStream = new MediaStream();
|
|
30451
|
-
_this._media.srcObject = _this._mediaStream;
|
|
30452
|
-
var req = _this._media.play();
|
|
30453
|
-
if (req && req.catch) {
|
|
30454
|
-
req.catch(function(e2) {
|
|
30455
|
-
});
|
|
30456
|
-
}
|
|
30457
|
-
}
|
|
30458
|
-
_this._mediaStream.addTrack(e.track);
|
|
30459
30452
|
});
|
|
30460
30453
|
_defineProperty$c(_assertThisInitialized$b(_this), "_mockWaitingByTimeupdate", function() {
|
|
30461
30454
|
var _this$_pc, _this$_pc2;
|
|
@@ -30614,6 +30607,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30614
30607
|
_this3.load(_this3._url);
|
|
30615
30608
|
}
|
|
30616
30609
|
if (pc.connectionState === "connected") {
|
|
30610
|
+
_this3._handleMediaStream();
|
|
30617
30611
|
_this3.emit(EVENT$2.TTFB, {
|
|
30618
30612
|
url: _this3._url,
|
|
30619
30613
|
responseUrl: _this3._url,
|
|
@@ -30622,6 +30616,31 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30622
30616
|
}
|
|
30623
30617
|
});
|
|
30624
30618
|
}
|
|
30619
|
+
}, {
|
|
30620
|
+
key: "_handleMediaStream",
|
|
30621
|
+
value: function _handleMediaStream() {
|
|
30622
|
+
if (this._opts.mediaStream && this._opts.seamlesslyReload) {
|
|
30623
|
+
var videoTrack = this._opts.mediaStream.getVideoTracks()[0];
|
|
30624
|
+
var audioTrack = this._opts.mediaStream.getAudioTracks()[0];
|
|
30625
|
+
if (videoTrack) {
|
|
30626
|
+
this._opts.mediaStream.removeTrack(videoTrack);
|
|
30627
|
+
}
|
|
30628
|
+
if (audioTrack) {
|
|
30629
|
+
this._opts.mediaStream.removeTrack(audioTrack);
|
|
30630
|
+
}
|
|
30631
|
+
this._mediaStream = this._opts.mediaStream;
|
|
30632
|
+
} else {
|
|
30633
|
+
this._mediaStream = new MediaStream();
|
|
30634
|
+
this._media.srcObject = this._mediaStream;
|
|
30635
|
+
var req = this._media.play();
|
|
30636
|
+
if (req && req.catch) {
|
|
30637
|
+
req.catch(function(e) {
|
|
30638
|
+
});
|
|
30639
|
+
}
|
|
30640
|
+
}
|
|
30641
|
+
this._mediaStream.addTrack(this._audio);
|
|
30642
|
+
this._mediaStream.addTrack(this._video);
|
|
30643
|
+
}
|
|
30625
30644
|
}, {
|
|
30626
30645
|
key: "_bindMediaEvent",
|
|
30627
30646
|
value: function _bindMediaEvent() {
|
|
@@ -30779,9 +30798,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30779
30798
|
}, {
|
|
30780
30799
|
key: "_disconnect",
|
|
30781
30800
|
value: function _disconnect() {
|
|
30782
|
-
var _this$_loader, _this$_networkEvaluat2;
|
|
30801
|
+
var _this$_loader, _this$_networkEvaluat2, _this$_videoTransceic, _this$_audioTransceic;
|
|
30783
30802
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
30784
30803
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
30804
|
+
(_this$_videoTransceic = this._videoTransceicer) === null || _this$_videoTransceic === void 0 ? void 0 : _this$_videoTransceic.stop();
|
|
30805
|
+
(_this$_audioTransceic = this._audioTransceicer) === null || _this$_audioTransceic === void 0 ? void 0 : _this$_audioTransceic.stop();
|
|
30785
30806
|
this._audioTransceicer = null;
|
|
30786
30807
|
this._videoTransceicer = null;
|
|
30787
30808
|
this._mediaStream = null;
|
|
@@ -30795,10 +30816,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30795
30816
|
}, {
|
|
30796
30817
|
key: "destroy",
|
|
30797
30818
|
value: function destroy() {
|
|
30798
|
-
var _this$_media2;
|
|
30819
|
+
var _this$_media2, _this$_opts;
|
|
30799
30820
|
this._disconnect();
|
|
30800
30821
|
(_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
|
|
30801
|
-
if (this._media) {
|
|
30822
|
+
if (this._media && !((_this$_opts = this._opts) !== null && _this$_opts !== void 0 && _this$_opts.seamlesslyReload)) {
|
|
30802
30823
|
this._media.srcObject = null;
|
|
30803
30824
|
}
|
|
30804
30825
|
if (this._pc) {
|
|
@@ -30898,15 +30919,35 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30898
30919
|
}
|
|
30899
30920
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
30900
30921
|
_defineProperty$c(_assertThisInitialized$b(_this), "_rts", null);
|
|
30922
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_mediaStream", null);
|
|
30901
30923
|
_defineProperty$c(_assertThisInitialized$b(_this), "_rtsOpts", null);
|
|
30924
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_onPause", function() {
|
|
30925
|
+
var _this$_rts, _this$config, _this$_rts3;
|
|
30926
|
+
if (!((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc)) {
|
|
30927
|
+
return;
|
|
30928
|
+
}
|
|
30929
|
+
if ((_this$config = _this.config) !== null && _this$config !== void 0 && _this$config.seamlesslyReload) {
|
|
30930
|
+
var _this$_rts2;
|
|
30931
|
+
_this._mediaStream = (_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2._mediaStream;
|
|
30932
|
+
}
|
|
30933
|
+
(_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
|
|
30934
|
+
});
|
|
30935
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_onPlay", function() {
|
|
30936
|
+
var _this$_rts4;
|
|
30937
|
+
if ((_this$_rts4 = _this._rts) !== null && _this$_rts4 !== void 0 && _this$_rts4._pc) {
|
|
30938
|
+
return;
|
|
30939
|
+
}
|
|
30940
|
+
_this._init();
|
|
30941
|
+
});
|
|
30902
30942
|
_defineProperty$c(_assertThisInitialized$b(_this), "_init", function() {
|
|
30903
|
-
var _this$
|
|
30904
|
-
(_this$
|
|
30943
|
+
var _this$_rts5;
|
|
30944
|
+
(_this$_rts5 = _this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.destroy();
|
|
30905
30945
|
var config = _this.player.config;
|
|
30906
30946
|
var rtsOpts = config.rts || {};
|
|
30907
30947
|
_this._rtsOpts = rtsOpts;
|
|
30908
30948
|
_this._rts = new Rts(_objectSpread2$7({
|
|
30909
30949
|
media: _this.player.video,
|
|
30950
|
+
mediaStream: _this._mediaStream,
|
|
30910
30951
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
30911
30952
|
var _this$player$preProce, _this$player;
|
|
30912
30953
|
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)) || {
|
|
@@ -30924,29 +30965,29 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30924
30965
|
}
|
|
30925
30966
|
});
|
|
30926
30967
|
_defineProperty$c(_assertThisInitialized$b(_this), "destroy", function() {
|
|
30927
|
-
var _this$
|
|
30968
|
+
var _this$_rts6;
|
|
30928
30969
|
_this.player.switchURL = _this._originSwitchFn;
|
|
30929
|
-
(_this$
|
|
30970
|
+
(_this$_rts6 = _this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.destroy();
|
|
30930
30971
|
});
|
|
30931
30972
|
return _this;
|
|
30932
30973
|
}
|
|
30933
30974
|
_createClass$e(RtsPlugin2, [{
|
|
30934
30975
|
key: "pc",
|
|
30935
30976
|
get: function get3() {
|
|
30936
|
-
var _this$
|
|
30937
|
-
return (_this$
|
|
30977
|
+
var _this$_rts7;
|
|
30978
|
+
return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.pc;
|
|
30938
30979
|
}
|
|
30939
30980
|
}, {
|
|
30940
30981
|
key: "videoTrack",
|
|
30941
30982
|
get: function get3() {
|
|
30942
|
-
var _this$
|
|
30943
|
-
return (_this$
|
|
30983
|
+
var _this$_rts8;
|
|
30984
|
+
return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.videoTack;
|
|
30944
30985
|
}
|
|
30945
30986
|
}, {
|
|
30946
30987
|
key: "audioTrack",
|
|
30947
30988
|
get: function get3() {
|
|
30948
|
-
var _this$
|
|
30949
|
-
return (_this$
|
|
30989
|
+
var _this$_rts9;
|
|
30990
|
+
return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.audioTrack;
|
|
30950
30991
|
}
|
|
30951
30992
|
}, {
|
|
30952
30993
|
key: "core",
|
|
@@ -30956,18 +30997,18 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30956
30997
|
}, {
|
|
30957
30998
|
key: "loader",
|
|
30958
30999
|
get: function get3() {
|
|
30959
|
-
var _this$
|
|
30960
|
-
return (_this$
|
|
31000
|
+
var _this$_rts10;
|
|
31001
|
+
return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.loader;
|
|
30961
31002
|
}
|
|
30962
31003
|
}, {
|
|
30963
31004
|
key: "version",
|
|
30964
31005
|
get: function get3() {
|
|
30965
|
-
return "0.2.1-alpha.
|
|
31006
|
+
return "0.2.1-alpha.2";
|
|
30966
31007
|
}
|
|
30967
31008
|
}, {
|
|
30968
31009
|
key: "beforePlayerInit",
|
|
30969
31010
|
value: function beforePlayerInit() {
|
|
30970
|
-
var _this$player2, _this2 = this;
|
|
31011
|
+
var _this$player2, _this2 = this, _this$player$config, _this$player$config$r;
|
|
30971
31012
|
this._init();
|
|
30972
31013
|
if (!this._originSwitchFn) {
|
|
30973
31014
|
this._originSwitchFn = this.player.switchURL.bind(this.player);
|
|
@@ -30979,6 +31020,10 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30979
31020
|
});
|
|
30980
31021
|
this.on(URL_CHANGE, this._onSwitchURL);
|
|
30981
31022
|
this.on(DESTROY, this.destroy);
|
|
31023
|
+
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) {
|
|
31024
|
+
this.on(PAUSE, this._onPause);
|
|
31025
|
+
this.on(PLAY, this._onPlay);
|
|
31026
|
+
}
|
|
30982
31027
|
this._transErrorEvent();
|
|
30983
31028
|
this._transCoreEvent(EVENT$2.LOAD_START);
|
|
30984
31029
|
this._transCoreEvent(EVENT$2.LOAD_COMPLETE);
|
|
@@ -31008,20 +31053,20 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
31008
31053
|
}, {
|
|
31009
31054
|
key: "getStats",
|
|
31010
31055
|
value: function getStats2() {
|
|
31011
|
-
var _this$
|
|
31012
|
-
return (_this$
|
|
31056
|
+
var _this$_rts11;
|
|
31057
|
+
return (_this$_rts11 = this._rts) === null || _this$_rts11 === void 0 ? void 0 : _this$_rts11.getStats();
|
|
31013
31058
|
}
|
|
31014
31059
|
}, {
|
|
31015
31060
|
key: "getStatsSnapshoot",
|
|
31016
31061
|
value: function getStatsSnapshoot2() {
|
|
31017
|
-
var _this$
|
|
31018
|
-
return (_this$
|
|
31062
|
+
var _this$_rts12;
|
|
31063
|
+
return (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12.getStatsSnapshoot();
|
|
31019
31064
|
}
|
|
31020
31065
|
}, {
|
|
31021
31066
|
key: "getNetWorkInfo",
|
|
31022
31067
|
value: function getNetWorkInfo() {
|
|
31023
|
-
var _this$
|
|
31024
|
-
return (_this$
|
|
31068
|
+
var _this$_rts13;
|
|
31069
|
+
return (_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.networkStats;
|
|
31025
31070
|
}
|
|
31026
31071
|
}, {
|
|
31027
31072
|
key: "_transErrorEvent",
|