@volcengine/veplayer 2.5.0-rc.1 → 2.5.1-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.d.ts +88 -98
- package/esm/veplayer.biz.live.development.js +172 -49
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +1400 -383
- package/esm/veplayer.development.js +301 -143
- package/esm/veplayer.live.d.ts +1401 -383
- package/esm/veplayer.live.development.js +300 -142
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +88 -98
- package/esm/veplayer.vod.development.js +127 -58
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +88 -98
- package/umd/veplayer.biz.live.development.js +371 -61
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +1400 -383
- package/umd/veplayer.development.js +301 -143
- package/umd/veplayer.live.d.ts +1401 -383
- package/umd/veplayer.live.development.js +303 -142
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +88 -98
- package/umd/veplayer.vod.development.js +127 -58
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +1400 -383
- package/veplayer.live.d.ts +1401 -383
- package/veplayer.vod.d.ts +88 -98
|
@@ -1457,7 +1457,7 @@ var sniffer$1 = {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
1459
|
};
|
|
1460
|
-
var version = "3.0.
|
|
1460
|
+
var version = "3.0.21-rc.5";
|
|
1461
1461
|
var ERROR_TYPE_MAP = {
|
|
1462
1462
|
1: "media",
|
|
1463
1463
|
2: "media",
|
|
@@ -1913,7 +1913,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1913
1913
|
var _e = this.media.error || error2;
|
|
1914
1914
|
var type = _e.code ? ERROR_TYPE_MAP[_e.code] : "other";
|
|
1915
1915
|
var message = _e.message;
|
|
1916
|
-
if (!this.media.currentSrc) {
|
|
1916
|
+
if (!(this.media.currentSrc || this.media.srcObject)) {
|
|
1917
1917
|
message = "empty_src";
|
|
1918
1918
|
_e = {
|
|
1919
1919
|
code: 6,
|
|
@@ -2808,6 +2808,18 @@ var BasePlugin = /* @__PURE__ */ function() {
|
|
|
2808
2808
|
}
|
|
2809
2809
|
}
|
|
2810
2810
|
}
|
|
2811
|
+
}, {
|
|
2812
|
+
key: "defineMethod",
|
|
2813
|
+
value: function defineMethod(Obj, map) {
|
|
2814
|
+
for (var key in map) {
|
|
2815
|
+
if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
|
|
2816
|
+
Object.defineProperty(Obj, key, {
|
|
2817
|
+
configurable: true,
|
|
2818
|
+
value: map[key]
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2811
2823
|
}, {
|
|
2812
2824
|
key: "defaultConfig",
|
|
2813
2825
|
get: function get() {
|
|
@@ -3453,7 +3465,7 @@ var ResizeObserver = /* @__PURE__ */ function() {
|
|
|
3453
3465
|
if (!this.observer) {
|
|
3454
3466
|
return;
|
|
3455
3467
|
}
|
|
3456
|
-
this.observer
|
|
3468
|
+
this.observer.observe(target);
|
|
3457
3469
|
var _pid = target.getAttribute(PLATER_ID);
|
|
3458
3470
|
var __handlers = this.__handlers;
|
|
3459
3471
|
var index = -1;
|
|
@@ -3482,16 +3494,17 @@ var ResizeObserver = /* @__PURE__ */ function() {
|
|
|
3482
3494
|
}
|
|
3483
3495
|
});
|
|
3484
3496
|
try {
|
|
3485
|
-
|
|
3497
|
+
var _this$observer;
|
|
3498
|
+
(_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
|
|
3486
3499
|
} catch (e3) {
|
|
3487
3500
|
}
|
|
3488
|
-
this.observer && this.observer.unobserve(target);
|
|
3489
3501
|
i2 > -1 && this.__handlers.splice(i2, 1);
|
|
3490
3502
|
}
|
|
3491
3503
|
}, {
|
|
3492
3504
|
key: "destroyObserver",
|
|
3493
3505
|
value: function destroyObserver() {
|
|
3494
|
-
|
|
3506
|
+
var _this$observer2;
|
|
3507
|
+
(_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
|
|
3495
3508
|
this.observer = null;
|
|
3496
3509
|
this.__handlers = null;
|
|
3497
3510
|
}
|
|
@@ -3523,7 +3536,8 @@ function addObserver(target, handler) {
|
|
|
3523
3536
|
return resizeObserver;
|
|
3524
3537
|
}
|
|
3525
3538
|
function unObserver(target, handler) {
|
|
3526
|
-
|
|
3539
|
+
var _resizeObserver;
|
|
3540
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
|
|
3527
3541
|
}
|
|
3528
3542
|
var pluginsManager = {
|
|
3529
3543
|
pluginGroup: {},
|
|
@@ -4113,6 +4127,10 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
4113
4127
|
this.unbind("mouseenter", this.onMouseEnter);
|
|
4114
4128
|
this.unbind("mouseleave", this.onMouseLeave);
|
|
4115
4129
|
}
|
|
4130
|
+
this.left = null;
|
|
4131
|
+
this.center = null;
|
|
4132
|
+
this.right = null;
|
|
4133
|
+
this.innerRoot = null;
|
|
4116
4134
|
}
|
|
4117
4135
|
}, {
|
|
4118
4136
|
key: "render",
|
|
@@ -5115,7 +5133,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5115
5133
|
if (!url) {
|
|
5116
5134
|
url = _this8.url || _this8.config.url;
|
|
5117
5135
|
}
|
|
5118
|
-
var _furl = _this8.
|
|
5136
|
+
var _furl = _this8.preProcessUrl(url);
|
|
5119
5137
|
var ret = _this8._startInit(_furl.url);
|
|
5120
5138
|
return ret;
|
|
5121
5139
|
}).catch(function(e3) {
|
|
@@ -5133,7 +5151,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5133
5151
|
if (util$1.typeOf(url) === "Object") {
|
|
5134
5152
|
_src = url.url;
|
|
5135
5153
|
}
|
|
5136
|
-
_src = this.
|
|
5154
|
+
_src = this.preProcessUrl(_src).url;
|
|
5137
5155
|
var curTime = this.currentTime;
|
|
5138
5156
|
this.__startTime = curTime;
|
|
5139
5157
|
var isPaused = this.paused && !this.isError;
|
|
@@ -5474,7 +5492,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5474
5492
|
runHooks(this, "retry", function() {
|
|
5475
5493
|
var cur = _this20.currentTime;
|
|
5476
5494
|
var url = _this20.config.url;
|
|
5477
|
-
var _srcRet = !util$1.isMSE(_this20.media) ? _this20.
|
|
5495
|
+
var _srcRet = !util$1.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
|
|
5478
5496
|
url
|
|
5479
5497
|
};
|
|
5480
5498
|
_this20.src = _srcRet.url;
|
|
@@ -6130,11 +6148,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6130
6148
|
this._state = newState;
|
|
6131
6149
|
}
|
|
6132
6150
|
}, {
|
|
6133
|
-
key: "
|
|
6134
|
-
value: function
|
|
6135
|
-
var _this$config7 = this.config,
|
|
6151
|
+
key: "preProcessUrl",
|
|
6152
|
+
value: function preProcessUrl(url, ext) {
|
|
6153
|
+
var _this$config7 = this.config, preProcessUrl2 = _this$config7.preProcessUrl, preProcessUrlOptions = _this$config7.preProcessUrlOptions;
|
|
6136
6154
|
var processUrlOptions = Object.assign({}, preProcessUrlOptions, ext);
|
|
6137
|
-
return !util$1.isBlob(url) && typeof
|
|
6155
|
+
return !util$1.isBlob(url) && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, processUrlOptions) : {
|
|
6138
6156
|
url
|
|
6139
6157
|
};
|
|
6140
6158
|
}
|
|
@@ -6716,11 +6734,11 @@ let VeError$1 = class VeError extends Error {
|
|
|
6716
6734
|
} : error2;
|
|
6717
6735
|
const message = (i18n == null ? void 0 : i18n.getText(errorInfo == null ? void 0 : errorInfo.messageTextKey)) ?? (errorInfo == null ? void 0 : errorInfo.message) ?? ((_a = errorInfo == null ? void 0 : errorInfo.error) == null ? void 0 : _a.message) ?? (i18n == null ? void 0 : i18n.getText("UNKNOWN"));
|
|
6718
6736
|
super(message);
|
|
6719
|
-
/**
|
|
6737
|
+
/** {zh}
|
|
6720
6738
|
* @brief 错误码。
|
|
6721
6739
|
*/
|
|
6722
6740
|
/** {en}
|
|
6723
|
-
* @brief
|
|
6741
|
+
* @brief Error code.
|
|
6724
6742
|
*/
|
|
6725
6743
|
__publicField(this, "errorCode");
|
|
6726
6744
|
/** {zh}
|
|
@@ -8506,7 +8524,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
|
|
|
8506
8524
|
}
|
|
8507
8525
|
this.on(DURATION_CHANGE, function() {
|
|
8508
8526
|
var player2 = _this2.player, config2 = _this2.config;
|
|
8509
|
-
if (player2.duration * 1e3 < config2.moveDuration) {
|
|
8527
|
+
if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
|
|
8510
8528
|
config2.moveDuration = player2.duration * 1e3;
|
|
8511
8529
|
}
|
|
8512
8530
|
});
|
|
@@ -8820,10 +8838,13 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
|
|
|
8820
8838
|
}, {
|
|
8821
8839
|
key: "updateBrightness",
|
|
8822
8840
|
value: function updateBrightness(percent) {
|
|
8841
|
+
var pos = this.pos, config = this.config, xgMask = this.xgMask;
|
|
8842
|
+
if (!config.darkness) {
|
|
8843
|
+
return;
|
|
8844
|
+
}
|
|
8823
8845
|
if (this.player.rotateDeg) {
|
|
8824
8846
|
percent = -percent;
|
|
8825
8847
|
}
|
|
8826
|
-
var pos = this.pos, config = this.config, xgMask = this.xgMask;
|
|
8827
8848
|
var light = pos.light + 0.8 * percent;
|
|
8828
8849
|
light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
|
|
8829
8850
|
if (xgMask) {
|
|
@@ -8884,12 +8905,12 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
|
|
|
8884
8905
|
}, {
|
|
8885
8906
|
key: "disableGesture",
|
|
8886
8907
|
value: function disableGesture() {
|
|
8887
|
-
this.config.disableGesture =
|
|
8908
|
+
this.config.disableGesture = true;
|
|
8888
8909
|
}
|
|
8889
8910
|
}, {
|
|
8890
8911
|
key: "enableGesture",
|
|
8891
8912
|
value: function enableGesture() {
|
|
8892
|
-
this.config.disableGesture =
|
|
8913
|
+
this.config.disableGesture = false;
|
|
8893
8914
|
}
|
|
8894
8915
|
}, {
|
|
8895
8916
|
key: "destroy",
|
|
@@ -9758,7 +9779,7 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9758
9779
|
}, {
|
|
9759
9780
|
key: "toggleFullScreen",
|
|
9760
9781
|
value: function toggleFullScreen(e3) {
|
|
9761
|
-
if (e3) {
|
|
9782
|
+
if (e3 instanceof Event) {
|
|
9762
9783
|
e3.preventDefault();
|
|
9763
9784
|
e3.stopPropagation();
|
|
9764
9785
|
}
|
|
@@ -10441,7 +10462,7 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
10441
10462
|
key: "isPIPAvailable",
|
|
10442
10463
|
value: function isPIPAvailable() {
|
|
10443
10464
|
var video = this.player.media;
|
|
10444
|
-
var _isEnabled = util$1.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled :
|
|
10465
|
+
var _isEnabled = util$1.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : false;
|
|
10445
10466
|
return _isEnabled && (util$1.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util$1.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
|
|
10446
10467
|
}
|
|
10447
10468
|
}, {
|
|
@@ -12823,7 +12844,7 @@ async function load(name, src2) {
|
|
|
12823
12844
|
});
|
|
12824
12845
|
}
|
|
12825
12846
|
}
|
|
12826
|
-
const appendSearchParams = (url, searchParams) => {
|
|
12847
|
+
const appendSearchParams$1 = (url, searchParams) => {
|
|
12827
12848
|
var _a, _b;
|
|
12828
12849
|
const urlObject = getUrlObject(url);
|
|
12829
12850
|
if (!url || !urlObject) {
|
|
@@ -12858,6 +12879,13 @@ const getUrlObject = (url) => {
|
|
|
12858
12879
|
return;
|
|
12859
12880
|
}
|
|
12860
12881
|
};
|
|
12882
|
+
const H264_MIME = 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
12883
|
+
const H265_MIME = [
|
|
12884
|
+
'video/mp4;codecs="hev1.1.6.L120.90"',
|
|
12885
|
+
'video/mp4;codecs="hev1.2.4.L120.90"',
|
|
12886
|
+
'video/mp4;codecs="hev1.3.E.L120.90"',
|
|
12887
|
+
'video/mp4;codecs="hev1.4.10.L120.90"'
|
|
12888
|
+
];
|
|
12861
12889
|
function isType(suffix) {
|
|
12862
12890
|
return function(url) {
|
|
12863
12891
|
return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
|
|
@@ -12886,22 +12914,40 @@ function getStreamType(url) {
|
|
|
12886
12914
|
}
|
|
12887
12915
|
return "unknown";
|
|
12888
12916
|
}
|
|
12889
|
-
function isMseSupported(codec = Codec.H264) {
|
|
12917
|
+
function isMseSupported$1(codec = Codec.H264) {
|
|
12890
12918
|
if (codec === Codec.H265) {
|
|
12891
12919
|
return sniffer$1.isHevcSupported();
|
|
12892
12920
|
}
|
|
12893
|
-
|
|
12921
|
+
if (codec === Codec.H264) {
|
|
12922
|
+
return sniffer$1.isMSESupport();
|
|
12923
|
+
}
|
|
12924
|
+
return sniffer$1.isMSESupport(codec);
|
|
12894
12925
|
}
|
|
12895
12926
|
async function isSoftDecodeSupported() {
|
|
12896
12927
|
const { XGVideoPlugin } = await load(DynamicModule.PluginXgvideo);
|
|
12897
12928
|
return XGVideoPlugin == null ? void 0 : XGVideoPlugin.isSupported();
|
|
12898
12929
|
}
|
|
12930
|
+
function isMMSSupported$1(codec = Codec.H264) {
|
|
12931
|
+
if (typeof window.ManagedMediaSource === "undefined") {
|
|
12932
|
+
return false;
|
|
12933
|
+
}
|
|
12934
|
+
if (codec === Codec.H264) {
|
|
12935
|
+
return window.ManagedMediaSource.isTypeSupported(H264_MIME);
|
|
12936
|
+
}
|
|
12937
|
+
if (codec === Codec.H265) {
|
|
12938
|
+
return H265_MIME.some((mine) => {
|
|
12939
|
+
return window.ManagedMediaSource.isTypeSupported(mine);
|
|
12940
|
+
});
|
|
12941
|
+
}
|
|
12942
|
+
return window.ManagedMediaSource.isTypeSupported(codec);
|
|
12943
|
+
}
|
|
12899
12944
|
const util = {
|
|
12900
12945
|
...util$1,
|
|
12901
12946
|
getStreamType,
|
|
12902
|
-
isMseSupported,
|
|
12947
|
+
isMseSupported: isMseSupported$1,
|
|
12903
12948
|
isSoftDecodeSupported,
|
|
12904
|
-
|
|
12949
|
+
isMMSSupported: isMMSSupported$1,
|
|
12950
|
+
appendSearchParams: appendSearchParams$1,
|
|
12905
12951
|
getUrlObject
|
|
12906
12952
|
};
|
|
12907
12953
|
var autoplay = "";
|
|
@@ -13113,7 +13159,6 @@ class Autoplay extends Plugin {
|
|
|
13113
13159
|
}
|
|
13114
13160
|
// 有音量修改,取消静音
|
|
13115
13161
|
handleVolumechange() {
|
|
13116
|
-
this._state.mode = this.player.muted ? 1 : 0;
|
|
13117
13162
|
if (!this._state.showUnmuteBt)
|
|
13118
13163
|
return;
|
|
13119
13164
|
this._state.showUnmuteBt = false;
|
|
@@ -13573,28 +13618,33 @@ const DEFAULT_OPTIONS = {
|
|
|
13573
13618
|
useCssFullscreen: false
|
|
13574
13619
|
}
|
|
13575
13620
|
};
|
|
13576
|
-
const transformOption = (
|
|
13577
|
-
|
|
13578
|
-
|
|
13579
|
-
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13584
|
-
|
|
13585
|
-
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13589
|
-
xgOptions.videoAttributes = {
|
|
13590
|
-
...xgOptions.videoAttributes ?? {},
|
|
13591
|
-
muted: autoplay2 == null ? void 0 : autoplay2.muted
|
|
13621
|
+
const transformOption = (
|
|
13622
|
+
/** {zh}
|
|
13623
|
+
* @param options 更多配置信息。
|
|
13624
|
+
*/
|
|
13625
|
+
(options) => {
|
|
13626
|
+
const { autoplay: autoplay2, ...rest } = options;
|
|
13627
|
+
const xgOptions = rest;
|
|
13628
|
+
if (xgOptions.poster) {
|
|
13629
|
+
xgOptions.poster = escapeHtml(xgOptions.poster);
|
|
13630
|
+
}
|
|
13631
|
+
xgOptions.icons = {
|
|
13632
|
+
...DEFAULT_ICONS,
|
|
13633
|
+
...xgOptions.icons ? escapeIcons(xgOptions.icons) : {}
|
|
13592
13634
|
};
|
|
13593
|
-
xgOptions.
|
|
13635
|
+
xgOptions.autoplay = Boolean(autoplay2);
|
|
13636
|
+
if (autoplay2 && typeof autoplay2 !== "boolean") {
|
|
13637
|
+
xgOptions.autoplayMuted = autoplay2 == null ? void 0 : autoplay2.muted;
|
|
13638
|
+
xgOptions.videoAttributes = {
|
|
13639
|
+
...xgOptions.videoAttributes ?? {},
|
|
13640
|
+
muted: autoplay2 == null ? void 0 : autoplay2.muted
|
|
13641
|
+
};
|
|
13642
|
+
xgOptions.autoplayPlugin = autoplay2;
|
|
13643
|
+
}
|
|
13644
|
+
delete xgOptions.i18n;
|
|
13645
|
+
return xgOptions;
|
|
13594
13646
|
}
|
|
13595
|
-
|
|
13596
|
-
return xgOptions;
|
|
13597
|
-
};
|
|
13647
|
+
);
|
|
13598
13648
|
class VePlayerBase {
|
|
13599
13649
|
/** {zh}
|
|
13600
13650
|
* @hidden
|
|
@@ -13614,7 +13664,9 @@ class VePlayerBase {
|
|
|
13614
13664
|
this._sourceManager = options.sourceManager;
|
|
13615
13665
|
this._preparePlugins = options.preparePlugins;
|
|
13616
13666
|
this._previousPrepareResult = options.prepareResult;
|
|
13617
|
-
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
13667
|
+
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
13668
|
+
i18n: options.i18n
|
|
13669
|
+
});
|
|
13618
13670
|
const xgOptions = transformOption({
|
|
13619
13671
|
...options,
|
|
13620
13672
|
...(_a = this._previousPrepareResult) == null ? void 0 : _a.options
|
|
@@ -13809,9 +13861,14 @@ class VePlayerBase {
|
|
|
13809
13861
|
/** {zh}
|
|
13810
13862
|
* 获取播放器版本号
|
|
13811
13863
|
* @returns
|
|
13864
|
+
* @brief
|
|
13865
|
+
* 获取播放器 SDK 版本号。
|
|
13866
|
+
*/
|
|
13867
|
+
/** {en}
|
|
13868
|
+
* @brief Retrieve the player SDK version number.
|
|
13812
13869
|
*/
|
|
13813
13870
|
get playerVersion() {
|
|
13814
|
-
return "2.5.
|
|
13871
|
+
return "2.5.1-rc.0";
|
|
13815
13872
|
}
|
|
13816
13873
|
/** {zh}
|
|
13817
13874
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -13959,8 +14016,8 @@ class VePlayerBase {
|
|
|
13959
14016
|
}
|
|
13960
14017
|
/** {zh}
|
|
13961
14018
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13962
|
-
* @param target
|
|
13963
|
-
* @param options
|
|
14019
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度。
|
|
14020
|
+
* @param options 更多配置信息。
|
|
13964
14021
|
*/
|
|
13965
14022
|
/** {en}
|
|
13966
14023
|
* @brief Switches the pull stream address, playback source, or resolution.
|
|
@@ -13971,7 +14028,9 @@ class VePlayerBase {
|
|
|
13971
14028
|
var _a, _b;
|
|
13972
14029
|
if (typeof target === "string" && this._sourceManager.sources.length === 1 && ((_b = (_a = this._sourceManager.sources) == null ? void 0 : _a[0].definitions) == null ? void 0 : _b.length) === 1) {
|
|
13973
14030
|
this._sourceManager.updateSources(target);
|
|
13974
|
-
await this._switchUrl(target, {
|
|
14031
|
+
await this._switchUrl(target, {
|
|
14032
|
+
seamless: options == null ? void 0 : options.seamless
|
|
14033
|
+
});
|
|
13975
14034
|
return this._sourceManager.definition;
|
|
13976
14035
|
}
|
|
13977
14036
|
const targetDefinition = this._sourceManager.find(target, options);
|
|
@@ -13998,16 +14057,15 @@ class VePlayerBase {
|
|
|
13998
14057
|
return this._switch(sourceManager.definition);
|
|
13999
14058
|
}
|
|
14000
14059
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
14001
|
-
/**
|
|
14002
14060
|
/** {zh}
|
|
14003
14061
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
14004
14062
|
* @param event 表示事件的名称。
|
|
14005
14063
|
* @param callback 表示事件的回调函数。
|
|
14006
14064
|
*/
|
|
14007
14065
|
/** {en}
|
|
14008
|
-
* @brief
|
|
14009
|
-
* @param event The event
|
|
14010
|
-
* @param callback
|
|
14066
|
+
* @brief Call this method to listen for the specified event. The event handler is executed only once.
|
|
14067
|
+
* @param event The name representing the event.
|
|
14068
|
+
* @param callback Callback functions representing events.
|
|
14011
14069
|
*/
|
|
14012
14070
|
once(event, callback) {
|
|
14013
14071
|
var _a;
|
|
@@ -14158,10 +14216,14 @@ class VePlayerBase {
|
|
|
14158
14216
|
return this._player.blur(data);
|
|
14159
14217
|
}
|
|
14160
14218
|
/** {zh}
|
|
14161
|
-
* @brief
|
|
14162
|
-
* @param type
|
|
14219
|
+
* @brief 判断浏览器是否支持播放格式。
|
|
14220
|
+
* @param type 播放格式。
|
|
14163
14221
|
* @returns
|
|
14164
14222
|
*/
|
|
14223
|
+
/** {en}
|
|
14224
|
+
* @brief Determine whether the browser supports the playback format.
|
|
14225
|
+
* @param type The playback format.
|
|
14226
|
+
*/
|
|
14165
14227
|
canPlayType(type) {
|
|
14166
14228
|
return this._player.canPlayType(type);
|
|
14167
14229
|
}
|
|
@@ -14233,7 +14295,7 @@ class VePlayerBase {
|
|
|
14233
14295
|
}
|
|
14234
14296
|
/** {zh}
|
|
14235
14297
|
* @brief 调用此接口显示指定插件图标。
|
|
14236
|
-
* @param pluginNames
|
|
14298
|
+
* @param pluginNames 插件名称。
|
|
14237
14299
|
*/
|
|
14238
14300
|
/** {en}
|
|
14239
14301
|
* @brief Displays the icon of a specified plugin.
|
|
@@ -14254,7 +14316,7 @@ class VePlayerBase {
|
|
|
14254
14316
|
}
|
|
14255
14317
|
/** {zh}
|
|
14256
14318
|
* @brief 调用此接口隐藏指定插件图标。
|
|
14257
|
-
* @param pluginNames
|
|
14319
|
+
* @param pluginNames 插件名称。
|
|
14258
14320
|
*/
|
|
14259
14321
|
/** {en}
|
|
14260
14322
|
* @brief Hides the icon of a specified plugin.
|
|
@@ -14326,7 +14388,14 @@ class VePlayerBase {
|
|
|
14326
14388
|
this._player.once("canplay", () => {
|
|
14327
14389
|
this._sourceManager.resetFallback();
|
|
14328
14390
|
});
|
|
14329
|
-
this.emit(Events$1.FALLBACK, {
|
|
14391
|
+
this.emit(Events$1.FALLBACK, {
|
|
14392
|
+
from: {
|
|
14393
|
+
url: preUrl
|
|
14394
|
+
},
|
|
14395
|
+
to: {
|
|
14396
|
+
url
|
|
14397
|
+
}
|
|
14398
|
+
});
|
|
14330
14399
|
this._switchUrl(url);
|
|
14331
14400
|
}
|
|
14332
14401
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -18920,46 +18989,6 @@ class Lite {
|
|
|
18920
18989
|
return result;
|
|
18921
18990
|
}
|
|
18922
18991
|
}
|
|
18923
|
-
const getFlvStrategy = async (options) => {
|
|
18924
|
-
var _a, _b, _c, _d, _e, _f;
|
|
18925
|
-
let mseStrategy;
|
|
18926
|
-
let softStrategy;
|
|
18927
|
-
const enableLowLatency = ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.enableLowLatency) && sniffer$1.device === "pc";
|
|
18928
|
-
const enableFrameChasing = ((_c = (_b = options == null ? void 0 : options.flv) == null ? void 0 : _b.lowLatency) == null ? void 0 : _c.enableFrameChasing) ?? true;
|
|
18929
|
-
const abrPts = ((_e = (_d = options == null ? void 0 : options.flv) == null ? void 0 : _d.lowLatency) == null ? void 0 : _e.abrPts) ?? "-800";
|
|
18930
|
-
const codec = await getCodec(options);
|
|
18931
|
-
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
18932
|
-
if (isSoftDecode$1) {
|
|
18933
|
-
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
18934
|
-
mseStrategy = createFlvMseStrategy(options);
|
|
18935
|
-
}
|
|
18936
|
-
if (codec === "unknown" ? isMseSupported(Codec.H264) : isMseSupported(codec)) {
|
|
18937
|
-
mseStrategy = createFlvMseStrategy(options);
|
|
18938
|
-
}
|
|
18939
|
-
if (!mseStrategy && !softStrategy) {
|
|
18940
|
-
return {};
|
|
18941
|
-
}
|
|
18942
|
-
const [mseModule, softModule] = await Promise.all([
|
|
18943
|
-
(mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
|
|
18944
|
-
(softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
|
|
18945
|
-
]);
|
|
18946
|
-
(softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_f = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _f.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
|
|
18947
|
-
const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
|
|
18948
|
-
const plugins = [];
|
|
18949
|
-
if (enableLowLatency) {
|
|
18950
|
-
combineOptions$1.url = appendSearchParams(options.url, { abr_pts: abrPts });
|
|
18951
|
-
}
|
|
18952
|
-
if (mseModule) {
|
|
18953
|
-
plugins.push(mseModule.FlvPlugin);
|
|
18954
|
-
if (enableLowLatency && enableFrameChasing) {
|
|
18955
|
-
plugins.push(mseModule.Adaptive);
|
|
18956
|
-
}
|
|
18957
|
-
}
|
|
18958
|
-
return {
|
|
18959
|
-
options: combineOptions$1,
|
|
18960
|
-
plugins
|
|
18961
|
-
};
|
|
18962
|
-
};
|
|
18963
18992
|
const getHlsStrategy = async (options) => {
|
|
18964
18993
|
var _a, _b;
|
|
18965
18994
|
let mseStrategy;
|
|
@@ -18970,7 +18999,7 @@ const getHlsStrategy = async (options) => {
|
|
|
18970
18999
|
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
18971
19000
|
mseStrategy = createHlsMseStrategy(options);
|
|
18972
19001
|
}
|
|
18973
|
-
if ((sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && (codec === "unknown" ? isMseSupported(Codec.H264) : isMseSupported(codec))) {
|
|
19002
|
+
if ((sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && (codec === "unknown" ? isMseSupported$1(Codec.H264) : isMseSupported$1(codec))) {
|
|
18974
19003
|
mseStrategy = createHlsMseStrategy(options);
|
|
18975
19004
|
}
|
|
18976
19005
|
if (!mseStrategy && !softStrategy) {
|
|
@@ -18987,24 +19016,38 @@ const getHlsStrategy = async (options) => {
|
|
|
18987
19016
|
plugins: (mseModule == null ? void 0 : mseModule.HlsPlugin) ? [mseModule.HlsPlugin] : []
|
|
18988
19017
|
};
|
|
18989
19018
|
};
|
|
18990
|
-
const
|
|
19019
|
+
const getDefaultFlvOptions = (options) => {
|
|
18991
19020
|
var _a;
|
|
18992
19021
|
return {
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
retryCount: 0,
|
|
18996
|
-
disconnectRetryCount: ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.retryCount) ?? void 0,
|
|
18997
|
-
...(options == null ? void 0 : options.flv) ?? {}
|
|
18998
|
-
}
|
|
18999
|
-
},
|
|
19000
|
-
module: DynamicModule.PluginFlv
|
|
19022
|
+
retryCount: 0,
|
|
19023
|
+
disconnectRetryCount: ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.retryCount) ?? void 0
|
|
19001
19024
|
};
|
|
19002
19025
|
};
|
|
19026
|
+
const createFlvMseStrategy = (options) => ({
|
|
19027
|
+
options: {
|
|
19028
|
+
flv: {
|
|
19029
|
+
...getDefaultFlvOptions(options),
|
|
19030
|
+
...(options == null ? void 0 : options.flv) ?? {}
|
|
19031
|
+
}
|
|
19032
|
+
},
|
|
19033
|
+
module: DynamicModule.PluginFlv
|
|
19034
|
+
});
|
|
19035
|
+
const createFlvMssStrategy = (options) => ({
|
|
19036
|
+
options: {
|
|
19037
|
+
flv: {
|
|
19038
|
+
preferMMS: true,
|
|
19039
|
+
...getDefaultFlvOptions(options),
|
|
19040
|
+
...(options == null ? void 0 : options.flv) ?? {}
|
|
19041
|
+
}
|
|
19042
|
+
},
|
|
19043
|
+
module: DynamicModule.PluginFlv
|
|
19044
|
+
});
|
|
19003
19045
|
const createHlsMseStrategy = (options) => ({
|
|
19004
19046
|
options: {
|
|
19005
19047
|
hls: {
|
|
19006
19048
|
retryCount: 0,
|
|
19007
19049
|
pollRetryCount: 0,
|
|
19050
|
+
allowedStreamTrackChange: false,
|
|
19008
19051
|
...(options == null ? void 0 : options.hls) ?? {}
|
|
19009
19052
|
}
|
|
19010
19053
|
},
|
|
@@ -19103,6 +19146,7 @@ function combineOptions(strategyList) {
|
|
|
19103
19146
|
const { VeError: VeError2 } = error$1;
|
|
19104
19147
|
var LiveErrorCode = /* @__PURE__ */ ((LiveErrorCode2) => {
|
|
19105
19148
|
LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 210] = "INVALID_PARAMETER";
|
|
19149
|
+
LiveErrorCode2[LiveErrorCode2["INVALID_LOGGER"] = 220] = "INVALID_LOGGER";
|
|
19106
19150
|
return LiveErrorCode2;
|
|
19107
19151
|
})(LiveErrorCode || {});
|
|
19108
19152
|
const ErrorCode = {
|
|
@@ -19117,10 +19161,23 @@ const ERRORS = {
|
|
|
19117
19161
|
]: {
|
|
19118
19162
|
messageTextKey: "INVALID_PARAMETER",
|
|
19119
19163
|
level: Level.Fatal
|
|
19164
|
+
},
|
|
19165
|
+
[
|
|
19166
|
+
220
|
|
19167
|
+
/* INVALID_LOGGER */
|
|
19168
|
+
]: {
|
|
19169
|
+
messageTextKey: "INVALID_LOGGER",
|
|
19170
|
+
level: Level.Error
|
|
19120
19171
|
}
|
|
19121
19172
|
};
|
|
19122
19173
|
function create(errorCode, i18n) {
|
|
19123
|
-
return new VeError2(
|
|
19174
|
+
return new VeError2(
|
|
19175
|
+
{
|
|
19176
|
+
errorCode,
|
|
19177
|
+
...ERRORS[errorCode]
|
|
19178
|
+
},
|
|
19179
|
+
i18n
|
|
19180
|
+
);
|
|
19124
19181
|
}
|
|
19125
19182
|
async function isRTMSupported() {
|
|
19126
19183
|
const { RtmPlugin } = await load(DynamicModule.PluginRtm);
|
|
@@ -19238,6 +19295,55 @@ function isMseSupportedWithDrm({
|
|
|
19238
19295
|
}
|
|
19239
19296
|
return true;
|
|
19240
19297
|
}
|
|
19298
|
+
const { isMMSSupported, isMseSupported } = util;
|
|
19299
|
+
function enableMMS() {
|
|
19300
|
+
return sniffer$1.os.isIos;
|
|
19301
|
+
}
|
|
19302
|
+
function isFLVSupported(codec = Codec.H264) {
|
|
19303
|
+
const isMediaSourceSupported = enableMMS() ? isMMSSupported : isMseSupported;
|
|
19304
|
+
return isMediaSourceSupported(codec);
|
|
19305
|
+
}
|
|
19306
|
+
const { appendSearchParams } = util;
|
|
19307
|
+
const getFlvStrategy = async (options) => {
|
|
19308
|
+
var _a, _b, _c, _d, _e, _f;
|
|
19309
|
+
let mseStrategy;
|
|
19310
|
+
let softStrategy;
|
|
19311
|
+
const enableLowLatency = ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.enableLowLatency) && sniffer$1.device === "pc";
|
|
19312
|
+
const enableFrameChasing = ((_c = (_b = options == null ? void 0 : options.flv) == null ? void 0 : _b.lowLatency) == null ? void 0 : _c.enableFrameChasing) ?? true;
|
|
19313
|
+
const abrPts = ((_e = (_d = options == null ? void 0 : options.flv) == null ? void 0 : _d.lowLatency) == null ? void 0 : _e.abrPts) ?? "-800";
|
|
19314
|
+
const codec = await getCodec(options);
|
|
19315
|
+
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
19316
|
+
if (isSoftDecode$1) {
|
|
19317
|
+
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
19318
|
+
mseStrategy = createFlvMseStrategy(options);
|
|
19319
|
+
}
|
|
19320
|
+
if (codec === "unknown" ? isFLVSupported(Codec.H264) : isFLVSupported(codec)) {
|
|
19321
|
+
mseStrategy = enableMMS() ? createFlvMssStrategy(options) : createFlvMseStrategy(options);
|
|
19322
|
+
}
|
|
19323
|
+
if (!mseStrategy && !softStrategy) {
|
|
19324
|
+
return {};
|
|
19325
|
+
}
|
|
19326
|
+
const [mseModule, softModule] = await Promise.all([
|
|
19327
|
+
(mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
|
|
19328
|
+
(softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
|
|
19329
|
+
]);
|
|
19330
|
+
(softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_f = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _f.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
|
|
19331
|
+
const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
|
|
19332
|
+
const plugins = [];
|
|
19333
|
+
if (enableLowLatency) {
|
|
19334
|
+
combineOptions$1.url = appendSearchParams(options.url, { abr_pts: abrPts });
|
|
19335
|
+
}
|
|
19336
|
+
if (mseModule) {
|
|
19337
|
+
plugins.push(mseModule.FlvPlugin);
|
|
19338
|
+
if (enableLowLatency && enableFrameChasing) {
|
|
19339
|
+
plugins.push(mseModule.Adaptive);
|
|
19340
|
+
}
|
|
19341
|
+
}
|
|
19342
|
+
return {
|
|
19343
|
+
options: combineOptions$1,
|
|
19344
|
+
plugins
|
|
19345
|
+
};
|
|
19346
|
+
};
|
|
19241
19347
|
const getTypeStrategy = async (options, player) => {
|
|
19242
19348
|
const type = options.url ? util.getStreamType(options.url) : "";
|
|
19243
19349
|
if (!type || type === "unknown") {
|
|
@@ -22001,7 +22107,7 @@ class Logger extends Plugin {
|
|
|
22001
22107
|
}
|
|
22002
22108
|
static get defaultConfig() {
|
|
22003
22109
|
return {
|
|
22004
|
-
appId:
|
|
22110
|
+
appId: 654925,
|
|
22005
22111
|
enable: true,
|
|
22006
22112
|
showUserIdInErrorPanel: true
|
|
22007
22113
|
};
|
|
@@ -22011,10 +22117,6 @@ class Logger extends Plugin {
|
|
|
22011
22117
|
if (!this.config.enable) {
|
|
22012
22118
|
return;
|
|
22013
22119
|
}
|
|
22014
|
-
if (!this.config.appId) {
|
|
22015
|
-
console.info("not found appId, please generate an appId");
|
|
22016
|
-
return;
|
|
22017
|
-
}
|
|
22018
22120
|
this._userId = ((_a = this.config) == null ? void 0 : _a.userId) || getUserId2();
|
|
22019
22121
|
this._deviceId = ((_b = this.config) == null ? void 0 : _b.deviceId) || getDeviceID2();
|
|
22020
22122
|
this.open();
|
|
@@ -22057,16 +22159,17 @@ class Logger extends Plugin {
|
|
|
22057
22159
|
this._liveLogger = new LoggerControl({
|
|
22058
22160
|
Tea: q,
|
|
22059
22161
|
player: this.player,
|
|
22060
|
-
aid: this.config.appId,
|
|
22162
|
+
aid: this.config.appId || 654925,
|
|
22061
22163
|
project_key: this.config.appId,
|
|
22062
22164
|
app_name: this.config.appName || this.config.appId,
|
|
22063
22165
|
user_id: this._userId,
|
|
22064
22166
|
device_id: this._deviceId,
|
|
22167
|
+
error_report_stop: true,
|
|
22065
22168
|
ext: {
|
|
22066
|
-
veplayer_version: "2.5.
|
|
22067
|
-
flv_version: "3.0.
|
|
22068
|
-
hls_version: "3.0.
|
|
22069
|
-
rts_version: "0.2.1-alpha.
|
|
22169
|
+
veplayer_version: "2.5.1-rc.0",
|
|
22170
|
+
flv_version: "3.0.21-rc.5",
|
|
22171
|
+
hls_version: "3.0.21-rc.5",
|
|
22172
|
+
rts_version: "0.2.1-alpha.14"
|
|
22070
22173
|
}
|
|
22071
22174
|
});
|
|
22072
22175
|
}
|
|
@@ -22298,6 +22401,7 @@ class InfoPanel extends Plugin {
|
|
|
22298
22401
|
const EN = {
|
|
22299
22402
|
...EN$1,
|
|
22300
22403
|
INVALID_PARAMETER: "The imported parameter is empty, please pass in necessary parameters such as the stream address",
|
|
22404
|
+
INVALID_LOGGER: "Log options not configured correctly. Please refer to this document https://docs.byteplus.com/en/docs/byteplus-media-live/docs-feature-implementation#uploading-logs to configure the logs.",
|
|
22301
22405
|
// info-panel
|
|
22302
22406
|
FORMAT: "format",
|
|
22303
22407
|
FPS: "fps",
|
|
@@ -22315,6 +22419,7 @@ const EN = {
|
|
|
22315
22419
|
const ZH_CN = {
|
|
22316
22420
|
...ZH_CN$1,
|
|
22317
22421
|
INVALID_PARAMETER: "入参为空,请传入流地址等必要参数",
|
|
22422
|
+
INVALID_LOGGER: "未正确配置质量日志参数, 请参考 https://www.volcengine.com/docs/6469/138655#日志上报 配置",
|
|
22318
22423
|
// info-panel
|
|
22319
22424
|
FORMAT: "格式",
|
|
22320
22425
|
FPS: "帧率",
|
|
@@ -22394,7 +22499,9 @@ VeI18n.extend([
|
|
|
22394
22499
|
}
|
|
22395
22500
|
]);
|
|
22396
22501
|
const LIVE_DEFAULT_OPTIONS = {
|
|
22397
|
-
autoplay: {
|
|
22502
|
+
autoplay: {
|
|
22503
|
+
muted: true
|
|
22504
|
+
}
|
|
22398
22505
|
};
|
|
22399
22506
|
const LIVE_DEFAULT_PLUGINS = [...DEFAULT_PLUGINS, Refresh, Logger, InfoPanel];
|
|
22400
22507
|
var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
|
|
@@ -22414,7 +22521,10 @@ class VePlayerLive extends VePlayerBase {
|
|
|
22414
22521
|
super(options);
|
|
22415
22522
|
}
|
|
22416
22523
|
/** {zh}
|
|
22417
|
-
* @brief
|
|
22524
|
+
* @brief 获取已经播放的时长,不包含暂停和等待时间,单位为秒。
|
|
22525
|
+
*/
|
|
22526
|
+
/** {en}
|
|
22527
|
+
* @brief Obtain the duration that has been played, excluding pause and waiting time, with the unit of seconds.
|
|
22418
22528
|
*/
|
|
22419
22529
|
get playTime() {
|
|
22420
22530
|
var _a, _b, _c, _d;
|
|
@@ -22473,7 +22583,10 @@ class VePlayerLive extends VePlayerBase {
|
|
|
22473
22583
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
22474
22584
|
}
|
|
22475
22585
|
/** {zh}
|
|
22476
|
-
* @brief
|
|
22586
|
+
* @brief 打开码率自适应(ABR)切换功能。
|
|
22587
|
+
*/
|
|
22588
|
+
/** {en}
|
|
22589
|
+
* @brief Enable the Adaptive Bitrate Streaming (ABR) switching feature.
|
|
22477
22590
|
*/
|
|
22478
22591
|
openAbr() {
|
|
22479
22592
|
var _a, _b, _c, _d;
|
|
@@ -22487,7 +22600,10 @@ class VePlayerLive extends VePlayerBase {
|
|
|
22487
22600
|
}
|
|
22488
22601
|
}
|
|
22489
22602
|
/** {zh}
|
|
22490
|
-
* @brief
|
|
22603
|
+
* @brief 关闭码率自适应(ABR)切换功能。
|
|
22604
|
+
*/
|
|
22605
|
+
/** {en}
|
|
22606
|
+
* @brief Disable the Adaptive Bitrate Streaming (ABR) switching feature.
|
|
22491
22607
|
*/
|
|
22492
22608
|
closeAbr() {
|
|
22493
22609
|
var _a, _b, _c, _d;
|
|
@@ -22501,18 +22617,25 @@ class VePlayerLive extends VePlayerBase {
|
|
|
22501
22617
|
}
|
|
22502
22618
|
}
|
|
22503
22619
|
/** {zh}
|
|
22504
|
-
* @brief 调用此方法更新 DRM
|
|
22505
|
-
|
|
22620
|
+
* @brief 调用此方法更新 DRM 配置。
|
|
22621
|
+
*/
|
|
22622
|
+
/** {en}
|
|
22623
|
+
* @brief Use this method to update DRM configuration.
|
|
22624
|
+
* @param config
|
|
22506
22625
|
*/
|
|
22507
22626
|
updateDrmConfig(config) {
|
|
22508
22627
|
var _a, _b, _c;
|
|
22509
22628
|
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
22510
22629
|
}
|
|
22511
22630
|
/** {zh}
|
|
22512
|
-
* @brief
|
|
22513
|
-
* @param options
|
|
22631
|
+
* @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。
|
|
22632
|
+
* @param options ABR 的配置。
|
|
22514
22633
|
* @returns
|
|
22515
22634
|
*/
|
|
22635
|
+
/** {en}
|
|
22636
|
+
* @brief Modify ABR configuration, including enabling or disabling the ABR feature and adjusting other resolutions.
|
|
22637
|
+
* @param options Configuration of ABR.
|
|
22638
|
+
*/
|
|
22516
22639
|
switchAbr(options) {
|
|
22517
22640
|
var _a, _b;
|
|
22518
22641
|
if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
|
|
@@ -22523,7 +22646,9 @@ class VePlayerLive extends VePlayerBase {
|
|
|
22523
22646
|
if (!url) {
|
|
22524
22647
|
return;
|
|
22525
22648
|
}
|
|
22526
|
-
this.switch(url, {
|
|
22649
|
+
this.switch(url, {
|
|
22650
|
+
seamless: true
|
|
22651
|
+
});
|
|
22527
22652
|
this._player.plugins.abr.bitrate = options.bitrate;
|
|
22528
22653
|
}
|
|
22529
22654
|
if (typeof (options == null ? void 0 : options.enable) !== "undefined") {
|
|
@@ -22531,37 +22656,52 @@ class VePlayerLive extends VePlayerBase {
|
|
|
22531
22656
|
}
|
|
22532
22657
|
}
|
|
22533
22658
|
/** {zh}
|
|
22534
|
-
* @brief 获取 RTM
|
|
22659
|
+
* @brief 获取 RTM 拉流的网络评估信息。
|
|
22535
22660
|
* @returns
|
|
22536
22661
|
*/
|
|
22662
|
+
/** {en}
|
|
22663
|
+
* @brief Obtain the network assessment information of RTM pull streaming.
|
|
22664
|
+
*/
|
|
22537
22665
|
getRTMNetWorkInfo() {
|
|
22538
22666
|
var _a, _b, _c;
|
|
22539
22667
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
|
|
22540
22668
|
}
|
|
22541
22669
|
/** {zh}
|
|
22542
|
-
* @brief 获取 RTM
|
|
22670
|
+
* @brief 获取 RTM 拉流的播放信息。
|
|
22543
22671
|
* @returns
|
|
22544
22672
|
*/
|
|
22673
|
+
/** {en}
|
|
22674
|
+
* @brief Obtain the playback information of RTM pull stream.
|
|
22675
|
+
*/
|
|
22545
22676
|
async getRTMStats() {
|
|
22546
22677
|
var _a, _b, _c;
|
|
22547
22678
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot();
|
|
22548
22679
|
}
|
|
22549
22680
|
/** {zh}
|
|
22550
|
-
* @brief 获取 FLV
|
|
22681
|
+
* @brief 获取 FLV 拉流的播放信息。
|
|
22551
22682
|
* @returns
|
|
22552
22683
|
*/
|
|
22684
|
+
/** {en}
|
|
22685
|
+
* @brief Obtain the playback information of FLV pull streaming.
|
|
22686
|
+
*/
|
|
22553
22687
|
getFLVStats() {
|
|
22554
22688
|
var _a, _b, _c;
|
|
22555
22689
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|
|
22556
22690
|
}
|
|
22557
22691
|
}
|
|
22558
22692
|
async function createLivePlayer(options) {
|
|
22559
|
-
var _a, _b;
|
|
22693
|
+
var _a, _b, _c, _d;
|
|
22560
22694
|
let player = void 0;
|
|
22695
|
+
const i18n = new VeI18n({
|
|
22696
|
+
lang: options == null ? void 0 : options.lang,
|
|
22697
|
+
i18n: options == null ? void 0 : options.i18n
|
|
22698
|
+
});
|
|
22561
22699
|
if (!options || !options.url && !options.playlist) {
|
|
22562
|
-
throw create(ErrorCode.INVALID_PARAMETER,
|
|
22700
|
+
throw create(ErrorCode.INVALID_PARAMETER, i18n);
|
|
22701
|
+
}
|
|
22702
|
+
if (!((_a = options.logger) == null ? void 0 : _a.appId) && ((_b = options == null ? void 0 : options.logger) == null ? void 0 : _b.enable) !== false) {
|
|
22703
|
+
console.warn(create(ErrorCode.INVALID_LOGGER, i18n).message);
|
|
22563
22704
|
}
|
|
22564
|
-
const i18n = new VeI18n({ lang: options == null ? void 0 : options.lang, i18n: options == null ? void 0 : options.i18n });
|
|
22565
22705
|
const finalOptions = {
|
|
22566
22706
|
...options,
|
|
22567
22707
|
plugins: [...LIVE_DEFAULT_PLUGINS, ...options.plugins ?? []]
|
|
@@ -22579,9 +22719,24 @@ async function createLivePlayer(options) {
|
|
|
22579
22719
|
},
|
|
22580
22720
|
async preparePlugins(url) {
|
|
22581
22721
|
const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
|
|
22582
|
-
getTypeStrategy(
|
|
22583
|
-
|
|
22584
|
-
|
|
22722
|
+
getTypeStrategy(
|
|
22723
|
+
{
|
|
22724
|
+
...finalOptions,
|
|
22725
|
+
url
|
|
22726
|
+
},
|
|
22727
|
+
player
|
|
22728
|
+
),
|
|
22729
|
+
getDrmStrategy(
|
|
22730
|
+
{
|
|
22731
|
+
...finalOptions,
|
|
22732
|
+
url
|
|
22733
|
+
},
|
|
22734
|
+
player
|
|
22735
|
+
),
|
|
22736
|
+
getAbrStrategy({
|
|
22737
|
+
...finalOptions,
|
|
22738
|
+
url
|
|
22739
|
+
})
|
|
22585
22740
|
]);
|
|
22586
22741
|
const { options: options2, plugins } = typeStrategy ?? {};
|
|
22587
22742
|
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
@@ -22599,7 +22754,7 @@ async function createLivePlayer(options) {
|
|
|
22599
22754
|
VePlayerLive
|
|
22600
22755
|
);
|
|
22601
22756
|
if (player) {
|
|
22602
|
-
const RTMDegrade = (
|
|
22757
|
+
const RTMDegrade = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.config) == null ? void 0 : _d._RTMdegrade;
|
|
22603
22758
|
if (RTMDegrade) {
|
|
22604
22759
|
player.emit("degrade", {
|
|
22605
22760
|
originRtmUrl: RTMDegrade._originRtmUrl,
|
|
@@ -22620,6 +22775,7 @@ var live = /* @__PURE__ */ Object.freeze({
|
|
|
22620
22775
|
setModuleSystem("esm");
|
|
22621
22776
|
util.isMseSupported;
|
|
22622
22777
|
util.isSoftDecodeSupported;
|
|
22778
|
+
util.isMMSSupported;
|
|
22623
22779
|
setModuleSystem("esm");
|
|
22624
22780
|
export {
|
|
22625
22781
|
Codec,
|
|
@@ -22634,7 +22790,9 @@ export {
|
|
|
22634
22790
|
sniffer$1 as Sniffer,
|
|
22635
22791
|
ZH_CN$1 as ZH_CN,
|
|
22636
22792
|
createLivePlayer,
|
|
22637
|
-
|
|
22793
|
+
isFLVSupported,
|
|
22794
|
+
isMMSSupported$1 as isMMSSupported,
|
|
22795
|
+
isMseSupported$1 as isMseSupported,
|
|
22638
22796
|
isRTMSupportCodec,
|
|
22639
22797
|
isRTMSupported,
|
|
22640
22798
|
isSoftDecodeSupported,
|