@volcengine/veplayer 2.5.0-rc.1 → 2.6.0-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 +79 -83
- package/esm/veplayer.biz.live.development.js +65 -18
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +1360 -316
- package/esm/veplayer.development.js +162 -74
- package/esm/veplayer.live.d.ts +1360 -316
- package/esm/veplayer.live.development.js +162 -74
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +79 -83
- package/esm/veplayer.vod.development.js +96 -55
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +79 -83
- package/umd/veplayer.biz.live.development.js +65 -18
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +1360 -316
- package/umd/veplayer.development.js +162 -74
- package/umd/veplayer.live.d.ts +1360 -316
- package/umd/veplayer.live.development.js +162 -74
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +79 -83
- package/umd/veplayer.vod.development.js +96 -55
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +1360 -316
- package/veplayer.live.d.ts +1360 -316
- package/veplayer.vod.d.ts +79 -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.3";
|
|
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
|
}, {
|
|
@@ -13411,28 +13428,33 @@ const DEFAULT_OPTIONS = {
|
|
|
13411
13428
|
useCssFullscreen: false
|
|
13412
13429
|
}
|
|
13413
13430
|
};
|
|
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
|
|
13431
|
+
const transformOption = (
|
|
13432
|
+
/** {zh}
|
|
13433
|
+
* @param options 更多配置信息。
|
|
13434
|
+
*/
|
|
13435
|
+
(options) => {
|
|
13436
|
+
const { autoplay: autoplay2, ...rest } = options;
|
|
13437
|
+
const xgOptions = rest;
|
|
13438
|
+
if (xgOptions.poster) {
|
|
13439
|
+
xgOptions.poster = escapeHtml(xgOptions.poster);
|
|
13440
|
+
}
|
|
13441
|
+
xgOptions.icons = {
|
|
13442
|
+
...DEFAULT_ICONS,
|
|
13443
|
+
...xgOptions.icons ? escapeIcons(xgOptions.icons) : {}
|
|
13430
13444
|
};
|
|
13431
|
-
xgOptions.
|
|
13445
|
+
xgOptions.autoplay = Boolean(autoplay2);
|
|
13446
|
+
if (autoplay2 && typeof autoplay2 !== "boolean") {
|
|
13447
|
+
xgOptions.autoplayMuted = autoplay2 == null ? void 0 : autoplay2.muted;
|
|
13448
|
+
xgOptions.videoAttributes = {
|
|
13449
|
+
...xgOptions.videoAttributes ?? {},
|
|
13450
|
+
muted: autoplay2 == null ? void 0 : autoplay2.muted
|
|
13451
|
+
};
|
|
13452
|
+
xgOptions.autoplayPlugin = autoplay2;
|
|
13453
|
+
}
|
|
13454
|
+
delete xgOptions.i18n;
|
|
13455
|
+
return xgOptions;
|
|
13432
13456
|
}
|
|
13433
|
-
|
|
13434
|
-
return xgOptions;
|
|
13435
|
-
};
|
|
13457
|
+
);
|
|
13436
13458
|
class VePlayerBase {
|
|
13437
13459
|
/** {zh}
|
|
13438
13460
|
* @hidden
|
|
@@ -13452,7 +13474,9 @@ class VePlayerBase {
|
|
|
13452
13474
|
this._sourceManager = options.sourceManager;
|
|
13453
13475
|
this._preparePlugins = options.preparePlugins;
|
|
13454
13476
|
this._previousPrepareResult = options.prepareResult;
|
|
13455
|
-
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
13477
|
+
this._i18nManager = options.i18nManager ?? new VeI18n({
|
|
13478
|
+
i18n: options.i18n
|
|
13479
|
+
});
|
|
13456
13480
|
const xgOptions = transformOption({
|
|
13457
13481
|
...options,
|
|
13458
13482
|
...(_a = this._previousPrepareResult) == null ? void 0 : _a.options
|
|
@@ -13647,9 +13671,14 @@ class VePlayerBase {
|
|
|
13647
13671
|
/** {zh}
|
|
13648
13672
|
* 获取播放器版本号
|
|
13649
13673
|
* @returns
|
|
13674
|
+
* @brief
|
|
13675
|
+
* 获取播放器 SDK 版本号。
|
|
13676
|
+
*/
|
|
13677
|
+
/** {en}
|
|
13678
|
+
* @brief Retrieve the player SDK version number.
|
|
13650
13679
|
*/
|
|
13651
13680
|
get playerVersion() {
|
|
13652
|
-
return "2.
|
|
13681
|
+
return "2.6.0-rc.0";
|
|
13653
13682
|
}
|
|
13654
13683
|
/** {zh}
|
|
13655
13684
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -13797,8 +13826,8 @@ class VePlayerBase {
|
|
|
13797
13826
|
}
|
|
13798
13827
|
/** {zh}
|
|
13799
13828
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13800
|
-
* @param target
|
|
13801
|
-
* @param options
|
|
13829
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度。
|
|
13830
|
+
* @param options 更多配置信息。
|
|
13802
13831
|
*/
|
|
13803
13832
|
/** {en}
|
|
13804
13833
|
* @brief Switches the pull stream address, playback source, or resolution.
|
|
@@ -13809,7 +13838,9 @@ class VePlayerBase {
|
|
|
13809
13838
|
var _a, _b;
|
|
13810
13839
|
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
13840
|
this._sourceManager.updateSources(target);
|
|
13812
|
-
await this._switchUrl(target, {
|
|
13841
|
+
await this._switchUrl(target, {
|
|
13842
|
+
seamless: options == null ? void 0 : options.seamless
|
|
13843
|
+
});
|
|
13813
13844
|
return this._sourceManager.definition;
|
|
13814
13845
|
}
|
|
13815
13846
|
const targetDefinition = this._sourceManager.find(target, options);
|
|
@@ -13836,16 +13867,15 @@ class VePlayerBase {
|
|
|
13836
13867
|
return this._switch(sourceManager.definition);
|
|
13837
13868
|
}
|
|
13838
13869
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13839
|
-
/**
|
|
13840
13870
|
/** {zh}
|
|
13841
13871
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13842
13872
|
* @param event 表示事件的名称。
|
|
13843
13873
|
* @param callback 表示事件的回调函数。
|
|
13844
13874
|
*/
|
|
13845
13875
|
/** {en}
|
|
13846
|
-
* @brief
|
|
13847
|
-
* @param event The event
|
|
13848
|
-
* @param callback
|
|
13876
|
+
* @brief Call this method to listen for the specified event. The event handler is executed only once.
|
|
13877
|
+
* @param event The name representing the event.
|
|
13878
|
+
* @param callback Callback functions representing events.
|
|
13849
13879
|
*/
|
|
13850
13880
|
once(event, callback) {
|
|
13851
13881
|
var _a;
|
|
@@ -13996,10 +14026,14 @@ class VePlayerBase {
|
|
|
13996
14026
|
return this._player.blur(data);
|
|
13997
14027
|
}
|
|
13998
14028
|
/** {zh}
|
|
13999
|
-
* @brief
|
|
14000
|
-
* @param type
|
|
14029
|
+
* @brief 判断浏览器是否支持播放格式。
|
|
14030
|
+
* @param type 播放格式。
|
|
14001
14031
|
* @returns
|
|
14002
14032
|
*/
|
|
14033
|
+
/** {en}
|
|
14034
|
+
* @brief Determine whether the browser supports the playback format.
|
|
14035
|
+
* @param type The playback format.
|
|
14036
|
+
*/
|
|
14003
14037
|
canPlayType(type) {
|
|
14004
14038
|
return this._player.canPlayType(type);
|
|
14005
14039
|
}
|
|
@@ -14071,7 +14105,7 @@ class VePlayerBase {
|
|
|
14071
14105
|
}
|
|
14072
14106
|
/** {zh}
|
|
14073
14107
|
* @brief 调用此接口显示指定插件图标。
|
|
14074
|
-
* @param pluginNames
|
|
14108
|
+
* @param pluginNames 插件名称。
|
|
14075
14109
|
*/
|
|
14076
14110
|
/** {en}
|
|
14077
14111
|
* @brief Displays the icon of a specified plugin.
|
|
@@ -14092,7 +14126,7 @@ class VePlayerBase {
|
|
|
14092
14126
|
}
|
|
14093
14127
|
/** {zh}
|
|
14094
14128
|
* @brief 调用此接口隐藏指定插件图标。
|
|
14095
|
-
* @param pluginNames
|
|
14129
|
+
* @param pluginNames 插件名称。
|
|
14096
14130
|
*/
|
|
14097
14131
|
/** {en}
|
|
14098
14132
|
* @brief Hides the icon of a specified plugin.
|
|
@@ -14164,7 +14198,14 @@ class VePlayerBase {
|
|
|
14164
14198
|
this._player.once("canplay", () => {
|
|
14165
14199
|
this._sourceManager.resetFallback();
|
|
14166
14200
|
});
|
|
14167
|
-
this.emit(Events.FALLBACK, {
|
|
14201
|
+
this.emit(Events.FALLBACK, {
|
|
14202
|
+
from: {
|
|
14203
|
+
url: preUrl
|
|
14204
|
+
},
|
|
14205
|
+
to: {
|
|
14206
|
+
url
|
|
14207
|
+
}
|
|
14208
|
+
});
|
|
14168
14209
|
this._switchUrl(url);
|
|
14169
14210
|
}
|
|
14170
14211
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|