@volcengine/veplayer-plugin 2.4.5-rc.0 → 2.5.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 +2267 -578
- package/esm/index.production.js +3 -3
- package/esm/veplayer.plugin.abr.development.js +71 -3
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.drm.development.js +71 -3
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +729 -196
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +1505 -378
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +73 -5
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +213 -48
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.plugin.shaka.development.js +72 -4
- package/esm/veplayer.plugin.shaka.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.abr.development.js +71 -3
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +71 -3
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +729 -196
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +1472 -345
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +73 -5
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +213 -48
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +72 -4
- package/umd/veplayer.plugin.shaka.production.js +1 -1
|
@@ -1530,7 +1530,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
return offsetTime;
|
|
1532
1532
|
};
|
|
1533
|
-
var version = "3.0.
|
|
1533
|
+
var version = "3.0.21-rc.2";
|
|
1534
1534
|
var ERROR_MAP = {
|
|
1535
1535
|
1: 5101,
|
|
1536
1536
|
2: 5102,
|
|
@@ -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";
|
|
@@ -1638,8 +1640,7 @@ function hook(hookName, handler) {
|
|
|
1638
1640
|
}
|
|
1639
1641
|
if (this.__hooks && this.__hooks[hookName]) {
|
|
1640
1642
|
try {
|
|
1641
|
-
var
|
|
1642
|
-
var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
|
|
1643
|
+
var preRet = runHooks(this, hookName, handler);
|
|
1643
1644
|
if (preRet) {
|
|
1644
1645
|
if (preRet.then) {
|
|
1645
1646
|
preRet.then(function(isContinue) {
|
|
@@ -1664,6 +1665,19 @@ function hook(hookName, handler) {
|
|
|
1664
1665
|
}
|
|
1665
1666
|
}.bind(this);
|
|
1666
1667
|
}
|
|
1668
|
+
function findHookIndex(hookName, handler) {
|
|
1669
|
+
var __hooks = this.__hooks;
|
|
1670
|
+
if (!__hooks || !Array.isArray(__hooks[hookName])) {
|
|
1671
|
+
return -1;
|
|
1672
|
+
}
|
|
1673
|
+
var hookHandlers = __hooks[hookName];
|
|
1674
|
+
for (var i = 0; i < hookHandlers.length; i++) {
|
|
1675
|
+
if (hookHandlers[i] === handler) {
|
|
1676
|
+
return i;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
return -1;
|
|
1680
|
+
}
|
|
1667
1681
|
function useHooks(hookName, handler) {
|
|
1668
1682
|
var __hooks = this.__hooks;
|
|
1669
1683
|
if (!__hooks) {
|
|
@@ -1673,7 +1687,12 @@ function useHooks(hookName, handler) {
|
|
|
1673
1687
|
console.warn("has no supported hook which name [".concat(hookName, "]"));
|
|
1674
1688
|
return false;
|
|
1675
1689
|
}
|
|
1676
|
-
|
|
1690
|
+
if (!Array.isArray(__hooks[hookName])) {
|
|
1691
|
+
__hooks[hookName] = [];
|
|
1692
|
+
}
|
|
1693
|
+
if (findHookIndex.call(this, hookName, handler) === -1) {
|
|
1694
|
+
__hooks[hookName].push(handler);
|
|
1695
|
+
}
|
|
1677
1696
|
return true;
|
|
1678
1697
|
}
|
|
1679
1698
|
function removeHooks(hookName, handler) {
|
|
@@ -1681,6 +1700,13 @@ function removeHooks(hookName, handler) {
|
|
|
1681
1700
|
if (!__hooks) {
|
|
1682
1701
|
return;
|
|
1683
1702
|
}
|
|
1703
|
+
if (Array.isArray(__hooks[hookName])) {
|
|
1704
|
+
var hooks = __hooks[hookName];
|
|
1705
|
+
var index = findHookIndex.call(this, hookName, handler);
|
|
1706
|
+
if (index !== -1) {
|
|
1707
|
+
hooks.splice(index, 1);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1684
1710
|
delete __hooks[hookName];
|
|
1685
1711
|
}
|
|
1686
1712
|
function hooksDescriptor(instance) {
|
|
@@ -1702,6 +1728,38 @@ function hooksDescriptor(instance) {
|
|
|
1702
1728
|
function delHooksDescriptor(instance) {
|
|
1703
1729
|
instance.__hooks = null;
|
|
1704
1730
|
}
|
|
1731
|
+
function runHooks(obj, hookName, handler) {
|
|
1732
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
|
|
1733
|
+
args[_key5 - 3] = arguments[_key5];
|
|
1734
|
+
}
|
|
1735
|
+
if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
|
|
1736
|
+
var hooks = obj.__hooks[hookName];
|
|
1737
|
+
var index = -1;
|
|
1738
|
+
var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
|
|
1739
|
+
for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
|
|
1740
|
+
args2[_key6 - 3] = arguments[_key6];
|
|
1741
|
+
}
|
|
1742
|
+
index++;
|
|
1743
|
+
if (hooks.length === 0 || index === hooks.length) {
|
|
1744
|
+
return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
|
|
1745
|
+
}
|
|
1746
|
+
var hook2 = hooks[index];
|
|
1747
|
+
var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
|
|
1748
|
+
if (ret && ret.then) {
|
|
1749
|
+
return ret.then(function(data) {
|
|
1750
|
+
return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
|
|
1751
|
+
}).catch(function(e) {
|
|
1752
|
+
console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
|
|
1753
|
+
});
|
|
1754
|
+
} else if (ret !== false) {
|
|
1755
|
+
return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
|
|
1759
|
+
} else {
|
|
1760
|
+
return handler.call.apply(handler, [obj, obj].concat(args));
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1705
1763
|
function showErrorMsg(pluginName, msg) {
|
|
1706
1764
|
XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
|
|
1707
1765
|
}
|
|
@@ -1941,6 +1999,18 @@ var BasePlugin = /* @__PURE__ */ function() {
|
|
|
1941
1999
|
}
|
|
1942
2000
|
}
|
|
1943
2001
|
}
|
|
2002
|
+
}, {
|
|
2003
|
+
key: "defineMethod",
|
|
2004
|
+
value: function defineMethod(Obj, map) {
|
|
2005
|
+
for (var key in map) {
|
|
2006
|
+
if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
|
|
2007
|
+
Object.defineProperty(Obj, key, {
|
|
2008
|
+
configurable: true,
|
|
2009
|
+
value: map[key]
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
1944
2014
|
}, {
|
|
1945
2015
|
key: "defaultConfig",
|
|
1946
2016
|
get: function get() {
|
|
@@ -4808,7 +4878,8 @@ function getOption(opts) {
|
|
|
4808
4878
|
loadTimeout: 5e3,
|
|
4809
4879
|
stallInterval: 400,
|
|
4810
4880
|
networkEvaluateInterval: 1e3,
|
|
4811
|
-
delayHint: 0
|
|
4881
|
+
delayHint: 0,
|
|
4882
|
+
seamlesslyReload: false
|
|
4812
4883
|
}, opts);
|
|
4813
4884
|
}
|
|
4814
4885
|
function _getStats(stats) {
|
|
@@ -5071,6 +5142,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5071
5142
|
_defineProperty$2(_assertThisInitialized$1(_this), "_audioTransceicer", null);
|
|
5072
5143
|
_defineProperty$2(_assertThisInitialized$1(_this), "_videoTransceicer", null);
|
|
5073
5144
|
_defineProperty$2(_assertThisInitialized$1(_this), "_mediaStream", null);
|
|
5145
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_lastMediaStream", null);
|
|
5074
5146
|
_defineProperty$2(_assertThisInitialized$1(_this), "_media", null);
|
|
5075
5147
|
_defineProperty$2(_assertThisInitialized$1(_this), "_opts", null);
|
|
5076
5148
|
_defineProperty$2(_assertThisInitialized$1(_this), "_loader", null);
|
|
@@ -5078,19 +5150,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5078
5150
|
_defineProperty$2(_assertThisInitialized$1(_this), "_retry", 0);
|
|
5079
5151
|
_defineProperty$2(_assertThisInitialized$1(_this), "_waitingTimer", 0);
|
|
5080
5152
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rctConnectStartTs", 0);
|
|
5153
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_isReplacing", false);
|
|
5081
5154
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onTrack", function(e) {
|
|
5082
5155
|
logger.log("addTrack: ", e.track, e.streams);
|
|
5083
5156
|
_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
5157
|
});
|
|
5095
5158
|
_defineProperty$2(_assertThisInitialized$1(_this), "_mockWaitingByTimeupdate", function() {
|
|
5096
5159
|
var _this$_pc, _this$_pc2;
|
|
@@ -5138,6 +5201,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5138
5201
|
}));
|
|
5139
5202
|
_this._retry = _this._opts.retryCount;
|
|
5140
5203
|
_this._bindMediaEvent();
|
|
5204
|
+
if (_this._opts.mediaStream && _this._opts.seamlesslyReload) {
|
|
5205
|
+
_this._lastMediaStream = _this._opts.mediaStream;
|
|
5206
|
+
}
|
|
5141
5207
|
return _this;
|
|
5142
5208
|
}
|
|
5143
5209
|
_createClass$2(Rts2, [{
|
|
@@ -5249,6 +5315,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5249
5315
|
_this3.load(_this3._url);
|
|
5250
5316
|
}
|
|
5251
5317
|
if (pc.connectionState === "connected") {
|
|
5318
|
+
_this3._handleMediaStream();
|
|
5252
5319
|
_this3.emit(EVENT.TTFB, {
|
|
5253
5320
|
url: _this3._url,
|
|
5254
5321
|
responseUrl: _this3._url,
|
|
@@ -5257,6 +5324,40 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5257
5324
|
}
|
|
5258
5325
|
});
|
|
5259
5326
|
}
|
|
5327
|
+
}, {
|
|
5328
|
+
key: "_handleMediaStream",
|
|
5329
|
+
value: function _handleMediaStream() {
|
|
5330
|
+
var _this4 = this;
|
|
5331
|
+
if (this._lastMediaStream) {
|
|
5332
|
+
var _this$_media$play;
|
|
5333
|
+
var videoTrack = this._lastMediaStream.getVideoTracks()[0];
|
|
5334
|
+
var audioTrack = this._lastMediaStream.getAudioTracks()[0];
|
|
5335
|
+
if (videoTrack) {
|
|
5336
|
+
this._lastMediaStream.removeTrack(videoTrack);
|
|
5337
|
+
}
|
|
5338
|
+
if (audioTrack) {
|
|
5339
|
+
this._lastMediaStream.removeTrack(audioTrack);
|
|
5340
|
+
}
|
|
5341
|
+
this._mediaStream = this._lastMediaStream;
|
|
5342
|
+
this._audio && this._mediaStream.addTrack(this._audio);
|
|
5343
|
+
this._video && this._mediaStream.addTrack(this._video);
|
|
5344
|
+
this._isReplacing = true;
|
|
5345
|
+
this._media.pause();
|
|
5346
|
+
(_this$_media$play = this._media.play()) === null || _this$_media$play === void 0 ? void 0 : _this$_media$play.finally(function() {
|
|
5347
|
+
_this4._isReplacing = false;
|
|
5348
|
+
});
|
|
5349
|
+
} else {
|
|
5350
|
+
this._mediaStream = new MediaStream();
|
|
5351
|
+
this._audio && this._mediaStream.addTrack(this._audio);
|
|
5352
|
+
this._video && this._mediaStream.addTrack(this._video);
|
|
5353
|
+
this._media.srcObject = this._mediaStream;
|
|
5354
|
+
var req = this._media.play();
|
|
5355
|
+
if (req && req.catch) {
|
|
5356
|
+
req.catch(function(e) {
|
|
5357
|
+
});
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5260
5361
|
}, {
|
|
5261
5362
|
key: "_bindMediaEvent",
|
|
5262
5363
|
value: function _bindMediaEvent() {
|
|
@@ -5429,11 +5530,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
5429
5530
|
}
|
|
5430
5531
|
}, {
|
|
5431
5532
|
key: "destroy",
|
|
5432
|
-
value: function destroy() {
|
|
5533
|
+
value: function destroy(keepClearMediaStream) {
|
|
5433
5534
|
var _this$_media2;
|
|
5434
5535
|
this._disconnect();
|
|
5435
5536
|
(_this$_media2 = this._media) === null || _this$_media2 === void 0 ? void 0 : _this$_media2.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
|
|
5436
|
-
if (this._media) {
|
|
5537
|
+
if (this._media && !keepClearMediaStream) {
|
|
5437
5538
|
this._media.srcObject = null;
|
|
5438
5539
|
}
|
|
5439
5540
|
if (this._pc) {
|
|
@@ -5533,15 +5634,36 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5533
5634
|
}
|
|
5534
5635
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
5535
5636
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rts", null);
|
|
5637
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_mediaStream", null);
|
|
5638
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_disconnectTimer", void 0);
|
|
5536
5639
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtsOpts", null);
|
|
5537
|
-
_defineProperty$2(_assertThisInitialized$1(_this), "
|
|
5640
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_onPause", function() {
|
|
5641
|
+
if (_this._disconnectTimer) {
|
|
5642
|
+
return;
|
|
5643
|
+
}
|
|
5644
|
+
_this._disconnectTimer = setTimeout(function() {
|
|
5645
|
+
_this._closeAfterPause();
|
|
5646
|
+
_this._clearDisconnectTimer();
|
|
5647
|
+
}, _this.config.disconnectTime * 1e3);
|
|
5648
|
+
});
|
|
5649
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_reInit", function() {
|
|
5538
5650
|
var _this$_rts;
|
|
5539
|
-
|
|
5651
|
+
_this._clearDisconnectTimer();
|
|
5652
|
+
if ((_this$_rts = _this._rts) !== null && _this$_rts !== void 0 && _this$_rts._pc) {
|
|
5653
|
+
return;
|
|
5654
|
+
}
|
|
5655
|
+
_this._init();
|
|
5656
|
+
_this._bindRtsEvents();
|
|
5657
|
+
});
|
|
5658
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_init", function() {
|
|
5659
|
+
var _this$_rts2;
|
|
5660
|
+
(_this$_rts2 = _this._rts) === null || _this$_rts2 === void 0 ? void 0 : _this$_rts2.destroy();
|
|
5540
5661
|
var config = _this.player.config;
|
|
5541
5662
|
var rtsOpts = config.rts || {};
|
|
5542
5663
|
_this._rtsOpts = rtsOpts;
|
|
5543
5664
|
_this._rts = new Rts(_objectSpread2$2({
|
|
5544
5665
|
media: _this.player.video,
|
|
5666
|
+
mediaStream: _this._mediaStream,
|
|
5545
5667
|
preProcessUrl: function preProcessUrl(url, ext) {
|
|
5546
5668
|
var _this$player$preProce, _this$player;
|
|
5547
5669
|
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)) || {
|
|
@@ -5553,35 +5675,40 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5553
5675
|
_this._rts.load(config.url);
|
|
5554
5676
|
});
|
|
5555
5677
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onSwitchURL", function(url) {
|
|
5556
|
-
if (
|
|
5678
|
+
if (url) {
|
|
5557
5679
|
_this.player.config.url = url;
|
|
5680
|
+
}
|
|
5681
|
+
if (_this._rts) {
|
|
5558
5682
|
_this._rts.switchURL(url);
|
|
5683
|
+
} else {
|
|
5684
|
+
_this._reInit();
|
|
5559
5685
|
}
|
|
5560
5686
|
});
|
|
5561
5687
|
_defineProperty$2(_assertThisInitialized$1(_this), "destroy", function() {
|
|
5562
|
-
var _this$
|
|
5688
|
+
var _this$_rts3;
|
|
5563
5689
|
_this.player.switchURL = _this._originSwitchFn;
|
|
5564
|
-
|
|
5690
|
+
_this._clearDisconnectTimer();
|
|
5691
|
+
(_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
|
|
5565
5692
|
});
|
|
5566
5693
|
return _this;
|
|
5567
5694
|
}
|
|
5568
5695
|
_createClass$2(RtsPlugin2, [{
|
|
5569
5696
|
key: "pc",
|
|
5570
5697
|
get: function get() {
|
|
5571
|
-
var _this$
|
|
5572
|
-
return (_this$
|
|
5698
|
+
var _this$_rts4;
|
|
5699
|
+
return (_this$_rts4 = this._rts) === null || _this$_rts4 === void 0 ? void 0 : _this$_rts4.pc;
|
|
5573
5700
|
}
|
|
5574
5701
|
}, {
|
|
5575
5702
|
key: "videoTrack",
|
|
5576
5703
|
get: function get() {
|
|
5577
|
-
var _this$
|
|
5578
|
-
return (_this$
|
|
5704
|
+
var _this$_rts5;
|
|
5705
|
+
return (_this$_rts5 = this._rts) === null || _this$_rts5 === void 0 ? void 0 : _this$_rts5.videoTack;
|
|
5579
5706
|
}
|
|
5580
5707
|
}, {
|
|
5581
5708
|
key: "audioTrack",
|
|
5582
5709
|
get: function get() {
|
|
5583
|
-
var _this$
|
|
5584
|
-
return (_this$
|
|
5710
|
+
var _this$_rts6;
|
|
5711
|
+
return (_this$_rts6 = this._rts) === null || _this$_rts6 === void 0 ? void 0 : _this$_rts6.audioTrack;
|
|
5585
5712
|
}
|
|
5586
5713
|
}, {
|
|
5587
5714
|
key: "core",
|
|
@@ -5591,37 +5718,43 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5591
5718
|
}, {
|
|
5592
5719
|
key: "loader",
|
|
5593
5720
|
get: function get() {
|
|
5594
|
-
var _this$
|
|
5595
|
-
return (_this$
|
|
5721
|
+
var _this$_rts7;
|
|
5722
|
+
return (_this$_rts7 = this._rts) === null || _this$_rts7 === void 0 ? void 0 : _this$_rts7.loader;
|
|
5596
5723
|
}
|
|
5597
5724
|
}, {
|
|
5598
5725
|
key: "version",
|
|
5599
5726
|
get: function get() {
|
|
5600
|
-
return "0.2.1-alpha.
|
|
5727
|
+
return "0.2.1-alpha.12";
|
|
5601
5728
|
}
|
|
5602
5729
|
}, {
|
|
5603
5730
|
key: "beforePlayerInit",
|
|
5604
5731
|
value: function beforePlayerInit() {
|
|
5605
|
-
var _this$player2, _this2 = this;
|
|
5732
|
+
var _this$player2, _this2 = this, _this$player$config, _this$player$config$r;
|
|
5606
5733
|
this._init();
|
|
5607
5734
|
if (!this._originSwitchFn) {
|
|
5608
5735
|
this._originSwitchFn = this.player.switchURL.bind(this.player);
|
|
5609
5736
|
}
|
|
5610
5737
|
this.player.switchURL = this._onSwitchURL;
|
|
5611
5738
|
(_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.useHooks("replay", function() {
|
|
5612
|
-
|
|
5613
|
-
return (_this2$_rts = _this2._rts) === null || _this2$_rts === void 0 ? void 0 : _this2$_rts.switchURL();
|
|
5739
|
+
return _this2._onSwitchURL();
|
|
5614
5740
|
});
|
|
5615
5741
|
this.on(URL_CHANGE, this._onSwitchURL);
|
|
5616
5742
|
this.on(DESTROY, this.destroy);
|
|
5617
|
-
this.
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5743
|
+
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") {
|
|
5744
|
+
this.on(PAUSE, function() {
|
|
5745
|
+
var _this2$_rts;
|
|
5746
|
+
if (!((_this2$_rts = _this2._rts) !== null && _this2$_rts !== void 0 && _this2$_rts._isReplacing)) {
|
|
5747
|
+
_this2._onPause();
|
|
5748
|
+
}
|
|
5749
|
+
});
|
|
5750
|
+
this.on(PLAY, function() {
|
|
5751
|
+
var _this2$_rts2;
|
|
5752
|
+
if (!((_this2$_rts2 = _this2._rts) !== null && _this2$_rts2 !== void 0 && _this2$_rts2._isReplacing)) {
|
|
5753
|
+
_this2._reInit();
|
|
5754
|
+
}
|
|
5755
|
+
});
|
|
5756
|
+
}
|
|
5757
|
+
this._bindRtsEvents();
|
|
5625
5758
|
try {
|
|
5626
5759
|
BasePlugin.defineGetterOrSetter(this.player, {
|
|
5627
5760
|
__url: {
|
|
@@ -5643,20 +5776,52 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
5643
5776
|
}, {
|
|
5644
5777
|
key: "getStats",
|
|
5645
5778
|
value: function getStats2() {
|
|
5646
|
-
var _this$
|
|
5647
|
-
return (_this$
|
|
5779
|
+
var _this$_rts8;
|
|
5780
|
+
return (_this$_rts8 = this._rts) === null || _this$_rts8 === void 0 ? void 0 : _this$_rts8.getStats();
|
|
5648
5781
|
}
|
|
5649
5782
|
}, {
|
|
5650
5783
|
key: "getStatsSnapshoot",
|
|
5651
5784
|
value: function getStatsSnapshoot2() {
|
|
5652
|
-
var _this$
|
|
5653
|
-
return (_this$
|
|
5785
|
+
var _this$_rts9;
|
|
5786
|
+
return (_this$_rts9 = this._rts) === null || _this$_rts9 === void 0 ? void 0 : _this$_rts9.getStatsSnapshoot();
|
|
5654
5787
|
}
|
|
5655
5788
|
}, {
|
|
5656
5789
|
key: "getNetWorkInfo",
|
|
5657
5790
|
value: function getNetWorkInfo() {
|
|
5658
|
-
var _this$
|
|
5659
|
-
return (_this$
|
|
5791
|
+
var _this$_rts10;
|
|
5792
|
+
return (_this$_rts10 = this._rts) === null || _this$_rts10 === void 0 ? void 0 : _this$_rts10.networkStats;
|
|
5793
|
+
}
|
|
5794
|
+
}, {
|
|
5795
|
+
key: "_clearDisconnectTimer",
|
|
5796
|
+
value: function _clearDisconnectTimer() {
|
|
5797
|
+
clearTimeout(this._disconnectTimer);
|
|
5798
|
+
this._disconnectTimer = void 0;
|
|
5799
|
+
}
|
|
5800
|
+
}, {
|
|
5801
|
+
key: "_closeAfterPause",
|
|
5802
|
+
value: function _closeAfterPause() {
|
|
5803
|
+
var _this$_rts11, _this$config, _this$_rts13;
|
|
5804
|
+
if (!((_this$_rts11 = this._rts) !== null && _this$_rts11 !== void 0 && _this$_rts11._pc)) {
|
|
5805
|
+
return;
|
|
5806
|
+
}
|
|
5807
|
+
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.seamlesslyReload) {
|
|
5808
|
+
var _this$_rts12;
|
|
5809
|
+
this._mediaStream = (_this$_rts12 = this._rts) === null || _this$_rts12 === void 0 ? void 0 : _this$_rts12._mediaStream;
|
|
5810
|
+
}
|
|
5811
|
+
(_this$_rts13 = this._rts) === null || _this$_rts13 === void 0 ? void 0 : _this$_rts13.destroy(true);
|
|
5812
|
+
this._rts = null;
|
|
5813
|
+
}
|
|
5814
|
+
}, {
|
|
5815
|
+
key: "_bindRtsEvents",
|
|
5816
|
+
value: function _bindRtsEvents() {
|
|
5817
|
+
this._transErrorEvent();
|
|
5818
|
+
this._transCoreEvent(EVENT.LOAD_START);
|
|
5819
|
+
this._transCoreEvent(EVENT.LOAD_COMPLETE);
|
|
5820
|
+
this._transCoreEvent(EVENT.TTFB);
|
|
5821
|
+
this._transCoreEvent(EVENT.LOAD_RESPONSE_HEADERS);
|
|
5822
|
+
this._transCoreEvent(EVENT.LOAD_RETRY);
|
|
5823
|
+
this._transCoreEvent(EVENT.METADATA_PARSED);
|
|
5824
|
+
this._transCoreEvent(EXTEND_EVENTS.RTC_STATE_CHANGE);
|
|
5660
5825
|
}
|
|
5661
5826
|
}, {
|
|
5662
5827
|
key: "_transErrorEvent",
|