@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
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";
|
|
@@ -2923,21 +2925,6 @@ var Buffer$6 = /* @__PURE__ */ function() {
|
|
|
2923
2925
|
length: Buffer22.totalLength && Buffer22.totalLength(buffers)
|
|
2924
2926
|
};
|
|
2925
2927
|
}
|
|
2926
|
-
}, {
|
|
2927
|
-
key: "isBuffered",
|
|
2928
|
-
value: function isBuffered(media, pos) {
|
|
2929
|
-
if (media) {
|
|
2930
|
-
var buffered = Buffer22.get(media);
|
|
2931
|
-
if (buffered !== null && buffered !== void 0 && buffered.length) {
|
|
2932
|
-
for (var i = 0; i < buffered.length; i++) {
|
|
2933
|
-
if (pos >= buffered.start(i) && pos <= buffered.end(i)) {
|
|
2934
|
-
return true;
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
return false;
|
|
2940
|
-
}
|
|
2941
2928
|
}]);
|
|
2942
2929
|
return Buffer22;
|
|
2943
2930
|
}();
|
|
@@ -6067,7 +6054,7 @@ var AAC$2 = /* @__PURE__ */ function() {
|
|
|
6067
6054
|
continue;
|
|
6068
6055
|
}
|
|
6069
6056
|
frameLength = (data2[i + 3] & 3) << 11 | data2[i + 4] << 3 | (data2[i + 5] & 224) >> 5;
|
|
6070
|
-
if (
|
|
6057
|
+
if (len - i < frameLength)
|
|
6071
6058
|
break;
|
|
6072
6059
|
protectionSkipBytes = (~data2[i + 1] & 1) * 2;
|
|
6073
6060
|
frames.push({
|
|
@@ -12153,7 +12140,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
12153
12140
|
}
|
|
12154
12141
|
return;
|
|
12155
12142
|
}
|
|
12156
|
-
if (opts.isLive && media.readyState === 4 && bufferEnd
|
|
12143
|
+
if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
|
|
12157
12144
|
_this.disconnect();
|
|
12158
12145
|
}
|
|
12159
12146
|
}
|
|
@@ -12325,7 +12312,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
12325
12312
|
_createClass$j(Flv2, [{
|
|
12326
12313
|
key: "version",
|
|
12327
12314
|
get: function get3() {
|
|
12328
|
-
return "3.0.19-rc.
|
|
12315
|
+
return "3.0.19-rc.0";
|
|
12329
12316
|
}
|
|
12330
12317
|
}, {
|
|
12331
12318
|
key: "isLive",
|
|
@@ -30188,7 +30175,8 @@ function getOption(opts) {
|
|
|
30188
30175
|
loadTimeout: 5e3,
|
|
30189
30176
|
stallInterval: 400,
|
|
30190
30177
|
networkEvaluateInterval: 1e3,
|
|
30191
|
-
delayHint: 0
|
|
30178
|
+
delayHint: 0,
|
|
30179
|
+
seamlesslyReload: false
|
|
30192
30180
|
}, opts);
|
|
30193
30181
|
}
|
|
30194
30182
|
function _getStats(stats) {
|
|
@@ -30461,16 +30449,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30461
30449
|
_defineProperty$c(_assertThisInitialized$b(_this), "_onTrack", function(e) {
|
|
30462
30450
|
logger$6.log("addTrack: ", e.track, e.streams);
|
|
30463
30451
|
_this["_".concat(e.track.kind)] = e.track;
|
|
30464
|
-
if (!_this._mediaStream) {
|
|
30465
|
-
_this._mediaStream = new MediaStream();
|
|
30466
|
-
_this._media.srcObject = _this._mediaStream;
|
|
30467
|
-
var req = _this._media.play();
|
|
30468
|
-
if (req && req.catch) {
|
|
30469
|
-
req.catch(function(e2) {
|
|
30470
|
-
});
|
|
30471
|
-
}
|
|
30472
|
-
}
|
|
30473
|
-
_this._mediaStream.addTrack(e.track);
|
|
30474
30452
|
});
|
|
30475
30453
|
_defineProperty$c(_assertThisInitialized$b(_this), "_mockWaitingByTimeupdate", function() {
|
|
30476
30454
|
var _this$_pc, _this$_pc2;
|
|
@@ -30629,6 +30607,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30629
30607
|
_this3.load(_this3._url);
|
|
30630
30608
|
}
|
|
30631
30609
|
if (pc.connectionState === "connected") {
|
|
30610
|
+
_this3._handleMediaStream();
|
|
30632
30611
|
_this3.emit(EVENT$2.TTFB, {
|
|
30633
30612
|
url: _this3._url,
|
|
30634
30613
|
responseUrl: _this3._url,
|
|
@@ -30637,6 +30616,31 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30637
30616
|
}
|
|
30638
30617
|
});
|
|
30639
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
|
+
}
|
|
30640
30644
|
}, {
|
|
30641
30645
|
key: "_bindMediaEvent",
|
|
30642
30646
|
value: function _bindMediaEvent() {
|
|
@@ -30794,9 +30798,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30794
30798
|
}, {
|
|
30795
30799
|
key: "_disconnect",
|
|
30796
30800
|
value: function _disconnect() {
|
|
30797
|
-
var _this$_loader, _this$_networkEvaluat2;
|
|
30801
|
+
var _this$_loader, _this$_networkEvaluat2, _this$_videoTransceic, _this$_audioTransceic;
|
|
30798
30802
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
30799
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();
|
|
30800
30806
|
this._audioTransceicer = null;
|
|
30801
30807
|
this._videoTransceicer = null;
|
|
30802
30808
|
this._mediaStream = null;
|
|
@@ -30810,10 +30816,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
30810
30816
|
}, {
|
|
30811
30817
|
key: "destroy",
|
|
30812
30818
|
value: function destroy() {
|
|
30813
|
-
var _this$_media2;
|
|
30819
|
+
var _this$_media2, _this$_opts;
|
|
30814
30820
|
this._disconnect();
|
|
30815
30821
|
(_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
|
|
30816
|
-
if (this._media) {
|
|
30822
|
+
if (this._media && !((_this$_opts = this._opts) !== null && _this$_opts !== void 0 && _this$_opts.seamlesslyReload)) {
|
|
30817
30823
|
this._media.srcObject = null;
|
|
30818
30824
|
}
|
|
30819
30825
|
if (this._pc) {
|
|
@@ -30913,15 +30919,35 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30913
30919
|
}
|
|
30914
30920
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
30915
30921
|
_defineProperty$c(_assertThisInitialized$b(_this), "_rts", null);
|
|
30922
|
+
_defineProperty$c(_assertThisInitialized$b(_this), "_mediaStream", null);
|
|
30916
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
|
+
});
|
|
30917
30942
|
_defineProperty$c(_assertThisInitialized$b(_this), "_init", function() {
|
|
30918
|
-
var _this$
|
|
30919
|
-
(_this$
|
|
30943
|
+
var _this$_rts5;
|
|
30944
|
+
(_this$_rts5 = _this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.destroy();
|
|
30920
30945
|
var config = _this.player.config;
|
|
30921
30946
|
var rtsOpts = config.rts || {};
|
|
30922
30947
|
_this._rtsOpts = rtsOpts;
|
|
30923
30948
|
_this._rts = new Rts(_objectSpread2$7({
|
|
30924
30949
|
media: _this.player.video,
|
|
30950
|
+
mediaStream: _this._mediaStream,
|
|
30925
30951
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
30926
30952
|
var _this$player$preProce, _this$player;
|
|
30927
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)) || {
|
|
@@ -30939,29 +30965,29 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30939
30965
|
}
|
|
30940
30966
|
});
|
|
30941
30967
|
_defineProperty$c(_assertThisInitialized$b(_this), "destroy", function() {
|
|
30942
|
-
var _this$
|
|
30968
|
+
var _this$_rts6;
|
|
30943
30969
|
_this.player.switchURL = _this._originSwitchFn;
|
|
30944
|
-
(_this$
|
|
30970
|
+
(_this$_rts6 = _this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.destroy();
|
|
30945
30971
|
});
|
|
30946
30972
|
return _this;
|
|
30947
30973
|
}
|
|
30948
30974
|
_createClass$e(RtsPlugin2, [{
|
|
30949
30975
|
key: "pc",
|
|
30950
30976
|
get: function get3() {
|
|
30951
|
-
var _this$
|
|
30952
|
-
return (_this$
|
|
30977
|
+
var _this$_rts7;
|
|
30978
|
+
return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.pc;
|
|
30953
30979
|
}
|
|
30954
30980
|
}, {
|
|
30955
30981
|
key: "videoTrack",
|
|
30956
30982
|
get: function get3() {
|
|
30957
|
-
var _this$
|
|
30958
|
-
return (_this$
|
|
30983
|
+
var _this$_rts8;
|
|
30984
|
+
return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.videoTack;
|
|
30959
30985
|
}
|
|
30960
30986
|
}, {
|
|
30961
30987
|
key: "audioTrack",
|
|
30962
30988
|
get: function get3() {
|
|
30963
|
-
var _this$
|
|
30964
|
-
return (_this$
|
|
30989
|
+
var _this$_rts9;
|
|
30990
|
+
return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.audioTrack;
|
|
30965
30991
|
}
|
|
30966
30992
|
}, {
|
|
30967
30993
|
key: "core",
|
|
@@ -30971,18 +30997,18 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30971
30997
|
}, {
|
|
30972
30998
|
key: "loader",
|
|
30973
30999
|
get: function get3() {
|
|
30974
|
-
var _this$
|
|
30975
|
-
return (_this$
|
|
31000
|
+
var _this$_rts10;
|
|
31001
|
+
return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.loader;
|
|
30976
31002
|
}
|
|
30977
31003
|
}, {
|
|
30978
31004
|
key: "version",
|
|
30979
31005
|
get: function get3() {
|
|
30980
|
-
return "0.2.1-alpha.
|
|
31006
|
+
return "0.2.1-alpha.2";
|
|
30981
31007
|
}
|
|
30982
31008
|
}, {
|
|
30983
31009
|
key: "beforePlayerInit",
|
|
30984
31010
|
value: function beforePlayerInit() {
|
|
30985
|
-
var _this$player2, _this2 = this;
|
|
31011
|
+
var _this$player2, _this2 = this, _this$player$config, _this$player$config$r;
|
|
30986
31012
|
this._init();
|
|
30987
31013
|
if (!this._originSwitchFn) {
|
|
30988
31014
|
this._originSwitchFn = this.player.switchURL.bind(this.player);
|
|
@@ -30994,6 +31020,10 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
30994
31020
|
});
|
|
30995
31021
|
this.on(URL_CHANGE, this._onSwitchURL);
|
|
30996
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
|
+
}
|
|
30997
31027
|
this._transErrorEvent();
|
|
30998
31028
|
this._transCoreEvent(EVENT$2.LOAD_START);
|
|
30999
31029
|
this._transCoreEvent(EVENT$2.LOAD_COMPLETE);
|
|
@@ -31023,20 +31053,20 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
31023
31053
|
}, {
|
|
31024
31054
|
key: "getStats",
|
|
31025
31055
|
value: function getStats2() {
|
|
31026
|
-
var _this$
|
|
31027
|
-
return (_this$
|
|
31056
|
+
var _this$_rts11;
|
|
31057
|
+
return (_this$_rts11 = this._rts) === null || _this$_rts11 === void 0 ? void 0 : _this$_rts11.getStats();
|
|
31028
31058
|
}
|
|
31029
31059
|
}, {
|
|
31030
31060
|
key: "getStatsSnapshoot",
|
|
31031
31061
|
value: function getStatsSnapshoot2() {
|
|
31032
|
-
var _this$
|
|
31033
|
-
return (_this$
|
|
31062
|
+
var _this$_rts12;
|
|
31063
|
+
return (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12.getStatsSnapshoot();
|
|
31034
31064
|
}
|
|
31035
31065
|
}, {
|
|
31036
31066
|
key: "getNetWorkInfo",
|
|
31037
31067
|
value: function getNetWorkInfo() {
|
|
31038
|
-
var _this$
|
|
31039
|
-
return (_this$
|
|
31068
|
+
var _this$_rts13;
|
|
31069
|
+
return (_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.networkStats;
|
|
31040
31070
|
}
|
|
31041
31071
|
}, {
|
|
31042
31072
|
key: "_transErrorEvent",
|
|
@@ -31073,14 +31103,8 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
31073
31103
|
}
|
|
31074
31104
|
player.config.url = backupURL;
|
|
31075
31105
|
if (backupConstruct) {
|
|
31076
|
-
|
|
31077
|
-
|
|
31078
|
-
}
|
|
31079
|
-
backupConstruct.forEach(function(construct3) {
|
|
31080
|
-
var _newPlugin$beforePlay;
|
|
31081
|
-
var newPlugin = player.registerPlugin(construct3);
|
|
31082
|
-
(_newPlugin$beforePlay = newPlugin.beforePlayerInit) === null || _newPlugin$beforePlay === void 0 ? void 0 : _newPlugin$beforePlay.call(newPlugin);
|
|
31083
|
-
});
|
|
31106
|
+
var newPlugin = player.registerPlugin(backupConstruct);
|
|
31107
|
+
newPlugin.beforePlayerInit();
|
|
31084
31108
|
} else {
|
|
31085
31109
|
player.video.src = backupURL;
|
|
31086
31110
|
}
|