@volcengine/veplayer 2.5.0-rc.1 → 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.d.ts +80 -83
- package/esm/veplayer.biz.live.development.js +251 -35
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +1249 -323
- package/esm/veplayer.development.js +198 -85
- package/esm/veplayer.live.d.ts +1250 -323
- package/esm/veplayer.live.development.js +198 -85
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +80 -83
- package/esm/veplayer.vod.development.js +100 -56
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +80 -83
- package/umd/veplayer.biz.live.development.js +251 -35
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +1249 -323
- package/umd/veplayer.development.js +198 -85
- package/umd/veplayer.live.d.ts +1250 -323
- package/umd/veplayer.live.development.js +198 -85
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +80 -83
- package/umd/veplayer.vod.development.js +100 -56
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +1249 -323
- package/veplayer.live.d.ts +1250 -323
- package/veplayer.vod.d.ts +80 -83
|
@@ -1452,7 +1452,7 @@ var sniffer = {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
}
|
|
1454
1454
|
};
|
|
1455
|
-
var version = "3.0.
|
|
1455
|
+
var version = "3.0.21-rc.2";
|
|
1456
1456
|
var ERROR_TYPE_MAP = {
|
|
1457
1457
|
1: "media",
|
|
1458
1458
|
2: "media",
|
|
@@ -2803,6 +2803,18 @@ var BasePlugin = /* @__PURE__ */ function() {
|
|
|
2803
2803
|
}
|
|
2804
2804
|
}
|
|
2805
2805
|
}
|
|
2806
|
+
}, {
|
|
2807
|
+
key: "defineMethod",
|
|
2808
|
+
value: function defineMethod(Obj, map) {
|
|
2809
|
+
for (var key in map) {
|
|
2810
|
+
if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
|
|
2811
|
+
Object.defineProperty(Obj, key, {
|
|
2812
|
+
configurable: true,
|
|
2813
|
+
value: map[key]
|
|
2814
|
+
});
|
|
2815
|
+
}
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2806
2818
|
}, {
|
|
2807
2819
|
key: "defaultConfig",
|
|
2808
2820
|
get: function get() {
|
|
@@ -3448,7 +3460,7 @@ var ResizeObserver = /* @__PURE__ */ function() {
|
|
|
3448
3460
|
if (!this.observer) {
|
|
3449
3461
|
return;
|
|
3450
3462
|
}
|
|
3451
|
-
this.observer
|
|
3463
|
+
this.observer.observe(target);
|
|
3452
3464
|
var _pid = target.getAttribute(PLATER_ID);
|
|
3453
3465
|
var __handlers = this.__handlers;
|
|
3454
3466
|
var index = -1;
|
|
@@ -3477,16 +3489,17 @@ var ResizeObserver = /* @__PURE__ */ function() {
|
|
|
3477
3489
|
}
|
|
3478
3490
|
});
|
|
3479
3491
|
try {
|
|
3480
|
-
|
|
3492
|
+
var _this$observer;
|
|
3493
|
+
(_this$observer = this.observer) === null || _this$observer === void 0 ? void 0 : _this$observer.unobserve(target);
|
|
3481
3494
|
} catch (e) {
|
|
3482
3495
|
}
|
|
3483
|
-
this.observer && this.observer.unobserve(target);
|
|
3484
3496
|
i > -1 && this.__handlers.splice(i, 1);
|
|
3485
3497
|
}
|
|
3486
3498
|
}, {
|
|
3487
3499
|
key: "destroyObserver",
|
|
3488
3500
|
value: function destroyObserver() {
|
|
3489
|
-
|
|
3501
|
+
var _this$observer2;
|
|
3502
|
+
(_this$observer2 = this.observer) === null || _this$observer2 === void 0 ? void 0 : _this$observer2.disconnect();
|
|
3490
3503
|
this.observer = null;
|
|
3491
3504
|
this.__handlers = null;
|
|
3492
3505
|
}
|
|
@@ -3518,7 +3531,8 @@ function addObserver(target, handler) {
|
|
|
3518
3531
|
return resizeObserver;
|
|
3519
3532
|
}
|
|
3520
3533
|
function unObserver(target, handler) {
|
|
3521
|
-
|
|
3534
|
+
var _resizeObserver;
|
|
3535
|
+
(_resizeObserver = resizeObserver) === null || _resizeObserver === void 0 ? void 0 : _resizeObserver.unObserver(target, handler);
|
|
3522
3536
|
}
|
|
3523
3537
|
var pluginsManager = {
|
|
3524
3538
|
pluginGroup: {},
|
|
@@ -5110,7 +5124,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5110
5124
|
if (!url) {
|
|
5111
5125
|
url = _this8.url || _this8.config.url;
|
|
5112
5126
|
}
|
|
5113
|
-
var _furl = _this8.
|
|
5127
|
+
var _furl = _this8.preProcessUrl(url);
|
|
5114
5128
|
var ret = _this8._startInit(_furl.url);
|
|
5115
5129
|
return ret;
|
|
5116
5130
|
}).catch(function(e) {
|
|
@@ -5128,7 +5142,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5128
5142
|
if (util.typeOf(url) === "Object") {
|
|
5129
5143
|
_src = url.url;
|
|
5130
5144
|
}
|
|
5131
|
-
_src = this.
|
|
5145
|
+
_src = this.preProcessUrl(_src).url;
|
|
5132
5146
|
var curTime = this.currentTime;
|
|
5133
5147
|
this.__startTime = curTime;
|
|
5134
5148
|
var isPaused = this.paused && !this.isError;
|
|
@@ -5469,7 +5483,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5469
5483
|
runHooks(this, "retry", function() {
|
|
5470
5484
|
var cur = _this20.currentTime;
|
|
5471
5485
|
var url = _this20.config.url;
|
|
5472
|
-
var _srcRet = !util.isMSE(_this20.media) ? _this20.
|
|
5486
|
+
var _srcRet = !util.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
|
|
5473
5487
|
url
|
|
5474
5488
|
};
|
|
5475
5489
|
_this20.src = _srcRet.url;
|
|
@@ -6125,11 +6139,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
6125
6139
|
this._state = newState;
|
|
6126
6140
|
}
|
|
6127
6141
|
}, {
|
|
6128
|
-
key: "
|
|
6129
|
-
value: function
|
|
6130
|
-
var _this$config7 = this.config,
|
|
6142
|
+
key: "preProcessUrl",
|
|
6143
|
+
value: function preProcessUrl(url, ext) {
|
|
6144
|
+
var _this$config7 = this.config, preProcessUrl2 = _this$config7.preProcessUrl, preProcessUrlOptions = _this$config7.preProcessUrlOptions;
|
|
6131
6145
|
var processUrlOptions = Object.assign({}, preProcessUrlOptions, ext);
|
|
6132
|
-
return !util.isBlob(url) && typeof
|
|
6146
|
+
return !util.isBlob(url) && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, processUrlOptions) : {
|
|
6133
6147
|
url
|
|
6134
6148
|
};
|
|
6135
6149
|
}
|
|
@@ -6695,11 +6709,11 @@ class VeError extends Error {
|
|
|
6695
6709
|
} : error2;
|
|
6696
6710
|
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"));
|
|
6697
6711
|
super(message);
|
|
6698
|
-
/**
|
|
6712
|
+
/** {zh}
|
|
6699
6713
|
* @brief 错误码。
|
|
6700
6714
|
*/
|
|
6701
6715
|
/** {en}
|
|
6702
|
-
* @brief
|
|
6716
|
+
* @brief Error code.
|
|
6703
6717
|
*/
|
|
6704
6718
|
__publicField(this, "errorCode");
|
|
6705
6719
|
/** {zh}
|
|
@@ -8474,7 +8488,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
|
|
|
8474
8488
|
}
|
|
8475
8489
|
this.on(DURATION_CHANGE, function() {
|
|
8476
8490
|
var player2 = _this2.player, config2 = _this2.config;
|
|
8477
|
-
if (player2.duration * 1e3 < config2.moveDuration) {
|
|
8491
|
+
if (player2.duration > 0 && player2.duration * 1e3 < config2.moveDuration) {
|
|
8478
8492
|
config2.moveDuration = player2.duration * 1e3;
|
|
8479
8493
|
}
|
|
8480
8494
|
});
|
|
@@ -8788,10 +8802,13 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
|
|
|
8788
8802
|
}, {
|
|
8789
8803
|
key: "updateBrightness",
|
|
8790
8804
|
value: function updateBrightness(percent) {
|
|
8805
|
+
var pos = this.pos, config = this.config, xgMask = this.xgMask;
|
|
8806
|
+
if (!config.darkness) {
|
|
8807
|
+
return;
|
|
8808
|
+
}
|
|
8791
8809
|
if (this.player.rotateDeg) {
|
|
8792
8810
|
percent = -percent;
|
|
8793
8811
|
}
|
|
8794
|
-
var pos = this.pos, config = this.config, xgMask = this.xgMask;
|
|
8795
8812
|
var light = pos.light + 0.8 * percent;
|
|
8796
8813
|
light = light > config.maxDarkness ? config.maxDarkness : light < 0 ? 0 : light;
|
|
8797
8814
|
if (xgMask) {
|
|
@@ -8852,12 +8869,12 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
|
|
|
8852
8869
|
}, {
|
|
8853
8870
|
key: "disableGesture",
|
|
8854
8871
|
value: function disableGesture() {
|
|
8855
|
-
this.config.disableGesture =
|
|
8872
|
+
this.config.disableGesture = true;
|
|
8856
8873
|
}
|
|
8857
8874
|
}, {
|
|
8858
8875
|
key: "enableGesture",
|
|
8859
8876
|
value: function enableGesture() {
|
|
8860
|
-
this.config.disableGesture =
|
|
8877
|
+
this.config.disableGesture = false;
|
|
8861
8878
|
}
|
|
8862
8879
|
}, {
|
|
8863
8880
|
key: "destroy",
|
|
@@ -9726,7 +9743,7 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
9726
9743
|
}, {
|
|
9727
9744
|
key: "toggleFullScreen",
|
|
9728
9745
|
value: function toggleFullScreen(e) {
|
|
9729
|
-
if (e) {
|
|
9746
|
+
if (e instanceof Event) {
|
|
9730
9747
|
e.preventDefault();
|
|
9731
9748
|
e.stopPropagation();
|
|
9732
9749
|
}
|
|
@@ -10409,7 +10426,7 @@ var PIP = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
10409
10426
|
key: "isPIPAvailable",
|
|
10410
10427
|
value: function isPIPAvailable() {
|
|
10411
10428
|
var video = this.player.media;
|
|
10412
|
-
var _isEnabled = util.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled :
|
|
10429
|
+
var _isEnabled = util.typeOf(document.pictureInPictureEnabled) === "Boolean" ? document.pictureInPictureEnabled : false;
|
|
10413
10430
|
return _isEnabled && (util.typeOf(video.disablePictureInPicture) === "Boolean" && !video.disablePictureInPicture || video.webkitSupportsPresentationMode && util.typeOf(video.webkitSetPresentationMode) === "Function") || this.isDocPIPAvailable();
|
|
10414
10431
|
}
|
|
10415
10432
|
}, {
|
|
@@ -12788,11 +12805,15 @@ async function isSoftDecodeSupported() {
|
|
|
12788
12805
|
const { XGVideoPlugin } = await load(DynamicModule.PluginXgvideo);
|
|
12789
12806
|
return XGVideoPlugin == null ? void 0 : XGVideoPlugin.isSupported();
|
|
12790
12807
|
}
|
|
12808
|
+
function isMMSSupported() {
|
|
12809
|
+
return typeof ManagedMediaSource !== "undefined";
|
|
12810
|
+
}
|
|
12791
12811
|
({
|
|
12792
12812
|
...util,
|
|
12793
12813
|
getStreamType,
|
|
12794
12814
|
isMseSupported,
|
|
12795
12815
|
isSoftDecodeSupported,
|
|
12816
|
+
isMMSSupported,
|
|
12796
12817
|
appendSearchParams,
|
|
12797
12818
|
getUrlObject
|
|
12798
12819
|
});
|
|
@@ -13005,7 +13026,6 @@ class Autoplay extends Plugin {
|
|
|
13005
13026
|
}
|
|
13006
13027
|
// 有音量修改,取消静音
|
|
13007
13028
|
handleVolumechange() {
|
|
13008
|
-
this._state.mode = this.player.muted ? 1 : 0;
|
|
13009
13029
|
if (!this._state.showUnmuteBt)
|
|
13010
13030
|
return;
|
|
13011
13031
|
this._state.showUnmuteBt = false;
|
|
@@ -13411,28 +13431,33 @@ const DEFAULT_OPTIONS = {
|
|
|
13411
13431
|
useCssFullscreen: false
|
|
13412
13432
|
}
|
|
13413
13433
|
};
|
|
13414
|
-
const transformOption = (
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
xgOptions.videoAttributes = {
|
|
13428
|
-
...xgOptions.videoAttributes ?? {},
|
|
13429
|
-
muted: autoplay2 == null ? void 0 : autoplay2.muted
|
|
13434
|
+
const transformOption = (
|
|
13435
|
+
/** {zh}
|
|
13436
|
+
* @param options 更多配置信息。
|
|
13437
|
+
*/
|
|
13438
|
+
(options) => {
|
|
13439
|
+
const { autoplay: autoplay2, ...rest } = options;
|
|
13440
|
+
const xgOptions = rest;
|
|
13441
|
+
if (xgOptions.poster) {
|
|
13442
|
+
xgOptions.poster = escapeHtml(xgOptions.poster);
|
|
13443
|
+
}
|
|
13444
|
+
xgOptions.icons = {
|
|
13445
|
+
...DEFAULT_ICONS,
|
|
13446
|
+
...xgOptions.icons ? escapeIcons(xgOptions.icons) : {}
|
|
13430
13447
|
};
|
|
13431
|
-
xgOptions.
|
|
13448
|
+
xgOptions.autoplay = Boolean(autoplay2);
|
|
13449
|
+
if (autoplay2 && typeof autoplay2 !== "boolean") {
|
|
13450
|
+
xgOptions.autoplayMuted = autoplay2 == null ? void 0 : autoplay2.muted;
|
|
13451
|
+
xgOptions.videoAttributes = {
|
|
13452
|
+
...xgOptions.videoAttributes ?? {},
|
|
13453
|
+
muted: autoplay2 == null ? void 0 : autoplay2.muted
|
|
13454
|
+
};
|
|
13455
|
+
xgOptions.autoplayPlugin = autoplay2;
|
|
13456
|
+
}
|
|
13457
|
+
delete xgOptions.i18n;
|
|
13458
|
+
return xgOptions;
|
|
13432
13459
|
}
|
|
13433
|
-
|
|
13434
|
-
return xgOptions;
|
|
13435
|
-
};
|
|
13460
|
+
);
|
|
13436
13461
|
class VePlayerBase {
|
|
13437
13462
|
/** {zh}
|
|
13438
13463
|
* @hidden
|
|
@@ -13452,7 +13477,9 @@ class VePlayerBase {
|
|
|
13452
13477
|
this._sourceManager = options.sourceManager;
|
|
13453
13478
|
this._preparePlugins = options.preparePlugins;
|
|
13454
13479
|
this._previousPrepareResult = options.prepareResult;
|
|
13455
|
-
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
13480
|
+
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
13481
|
+
i18n: options.i18n
|
|
13482
|
+
});
|
|
13456
13483
|
const xgOptions = transformOption({
|
|
13457
13484
|
...options,
|
|
13458
13485
|
...(_a = this._previousPrepareResult) == null ? void 0 : _a.options
|
|
@@ -13647,9 +13674,14 @@ class VePlayerBase {
|
|
|
13647
13674
|
/** {zh}
|
|
13648
13675
|
* 获取播放器版本号
|
|
13649
13676
|
* @returns
|
|
13677
|
+
* @brief
|
|
13678
|
+
* 获取播放器 SDK 版本号。
|
|
13679
|
+
*/
|
|
13680
|
+
/** {en}
|
|
13681
|
+
* @brief Retrieve the player SDK version number.
|
|
13650
13682
|
*/
|
|
13651
13683
|
get playerVersion() {
|
|
13652
|
-
return "2.5.0
|
|
13684
|
+
return "2.5.0";
|
|
13653
13685
|
}
|
|
13654
13686
|
/** {zh}
|
|
13655
13687
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -13797,8 +13829,8 @@ class VePlayerBase {
|
|
|
13797
13829
|
}
|
|
13798
13830
|
/** {zh}
|
|
13799
13831
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13800
|
-
* @param target
|
|
13801
|
-
* @param options
|
|
13832
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度。
|
|
13833
|
+
* @param options 更多配置信息。
|
|
13802
13834
|
*/
|
|
13803
13835
|
/** {en}
|
|
13804
13836
|
* @brief Switches the pull stream address, playback source, or resolution.
|
|
@@ -13809,7 +13841,9 @@ class VePlayerBase {
|
|
|
13809
13841
|
var _a, _b;
|
|
13810
13842
|
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) {
|
|
13811
13843
|
this._sourceManager.updateSources(target);
|
|
13812
|
-
await this._switchUrl(target, {
|
|
13844
|
+
await this._switchUrl(target, {
|
|
13845
|
+
seamless: options == null ? void 0 : options.seamless
|
|
13846
|
+
});
|
|
13813
13847
|
return this._sourceManager.definition;
|
|
13814
13848
|
}
|
|
13815
13849
|
const targetDefinition = this._sourceManager.find(target, options);
|
|
@@ -13836,16 +13870,15 @@ class VePlayerBase {
|
|
|
13836
13870
|
return this._switch(sourceManager.definition);
|
|
13837
13871
|
}
|
|
13838
13872
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13839
|
-
/**
|
|
13840
13873
|
/** {zh}
|
|
13841
13874
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13842
13875
|
* @param event 表示事件的名称。
|
|
13843
13876
|
* @param callback 表示事件的回调函数。
|
|
13844
13877
|
*/
|
|
13845
13878
|
/** {en}
|
|
13846
|
-
* @brief
|
|
13847
|
-
* @param event The event
|
|
13848
|
-
* @param callback
|
|
13879
|
+
* @brief Call this method to listen for the specified event. The event handler is executed only once.
|
|
13880
|
+
* @param event The name representing the event.
|
|
13881
|
+
* @param callback Callback functions representing events.
|
|
13849
13882
|
*/
|
|
13850
13883
|
once(event, callback) {
|
|
13851
13884
|
var _a;
|
|
@@ -13996,10 +14029,14 @@ class VePlayerBase {
|
|
|
13996
14029
|
return this._player.blur(data);
|
|
13997
14030
|
}
|
|
13998
14031
|
/** {zh}
|
|
13999
|
-
* @brief
|
|
14000
|
-
* @param type
|
|
14032
|
+
* @brief 判断浏览器是否支持播放格式。
|
|
14033
|
+
* @param type 播放格式。
|
|
14001
14034
|
* @returns
|
|
14002
14035
|
*/
|
|
14036
|
+
/** {en}
|
|
14037
|
+
* @brief Determine whether the browser supports the playback format.
|
|
14038
|
+
* @param type The playback format.
|
|
14039
|
+
*/
|
|
14003
14040
|
canPlayType(type) {
|
|
14004
14041
|
return this._player.canPlayType(type);
|
|
14005
14042
|
}
|
|
@@ -14071,7 +14108,7 @@ class VePlayerBase {
|
|
|
14071
14108
|
}
|
|
14072
14109
|
/** {zh}
|
|
14073
14110
|
* @brief 调用此接口显示指定插件图标。
|
|
14074
|
-
* @param pluginNames
|
|
14111
|
+
* @param pluginNames 插件名称。
|
|
14075
14112
|
*/
|
|
14076
14113
|
/** {en}
|
|
14077
14114
|
* @brief Displays the icon of a specified plugin.
|
|
@@ -14092,7 +14129,7 @@ class VePlayerBase {
|
|
|
14092
14129
|
}
|
|
14093
14130
|
/** {zh}
|
|
14094
14131
|
* @brief 调用此接口隐藏指定插件图标。
|
|
14095
|
-
* @param pluginNames
|
|
14132
|
+
* @param pluginNames 插件名称。
|
|
14096
14133
|
*/
|
|
14097
14134
|
/** {en}
|
|
14098
14135
|
* @brief Hides the icon of a specified plugin.
|
|
@@ -14164,7 +14201,14 @@ class VePlayerBase {
|
|
|
14164
14201
|
this._player.once("canplay", () => {
|
|
14165
14202
|
this._sourceManager.resetFallback();
|
|
14166
14203
|
});
|
|
14167
|
-
this.emit(Events.FALLBACK, {
|
|
14204
|
+
this.emit(Events.FALLBACK, {
|
|
14205
|
+
from: {
|
|
14206
|
+
url: preUrl
|
|
14207
|
+
},
|
|
14208
|
+
to: {
|
|
14209
|
+
url
|
|
14210
|
+
}
|
|
14211
|
+
});
|
|
14168
14212
|
this._switchUrl(url);
|
|
14169
14213
|
}
|
|
14170
14214
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|