@volcengine/veplayer 2.3.0-rc.0 → 2.3.0-rc.1
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 +1681 -219
- package/esm/veplayer.biz.live.development.js +18 -1
- package/esm/veplayer.d.ts +3585 -494
- package/esm/veplayer.development.js +274 -54
- package/esm/veplayer.live.d.ts +3585 -494
- package/esm/veplayer.live.development.js +274 -54
- package/esm/veplayer.live.production.js +2 -2
- package/esm/veplayer.production.js +2 -2
- package/esm/veplayer.vod.d.ts +1681 -219
- package/esm/veplayer.vod.development.js +255 -52
- package/esm/veplayer.vod.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +1681 -219
- package/umd/veplayer.biz.live.development.js +18 -1
- package/umd/veplayer.d.ts +3585 -494
- package/umd/veplayer.development.js +274 -54
- package/umd/veplayer.live.d.ts +3585 -494
- package/umd/veplayer.live.development.js +274 -54
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +1681 -219
- package/umd/veplayer.vod.development.js +255 -52
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +3585 -494
- package/veplayer.live.d.ts +3585 -494
- package/veplayer.vod.d.ts +1681 -219
|
@@ -6594,7 +6594,12 @@ const ERROR_TYPE_INFO = {
|
|
|
6594
6594
|
}
|
|
6595
6595
|
};
|
|
6596
6596
|
class VeError extends Error {
|
|
6597
|
-
/**
|
|
6597
|
+
/** {zh}
|
|
6598
|
+
* @hidden
|
|
6599
|
+
* @param error
|
|
6600
|
+
* @param i18n
|
|
6601
|
+
*/
|
|
6602
|
+
/** {en}
|
|
6598
6603
|
* @hidden
|
|
6599
6604
|
* @param error
|
|
6600
6605
|
* @param i18n
|
|
@@ -6607,16 +6612,25 @@ class VeError extends Error {
|
|
|
6607
6612
|
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"));
|
|
6608
6613
|
super(message);
|
|
6609
6614
|
/**
|
|
6610
|
-
* @brief
|
|
6615
|
+
* @brief 错误码。
|
|
6616
|
+
*/
|
|
6617
|
+
/** {en}
|
|
6618
|
+
* @brief The error code.
|
|
6611
6619
|
*/
|
|
6612
6620
|
__publicField(this, "errorCode");
|
|
6613
|
-
/**
|
|
6621
|
+
/** {zh}
|
|
6614
6622
|
* @brief 错误等级。
|
|
6615
6623
|
*/
|
|
6624
|
+
/** {en}
|
|
6625
|
+
* @brief The error level.
|
|
6626
|
+
*/
|
|
6616
6627
|
__publicField(this, "level");
|
|
6617
|
-
/**
|
|
6628
|
+
/** {zh}
|
|
6618
6629
|
* @brief 其他错误信息。
|
|
6619
6630
|
*/
|
|
6631
|
+
/** {en}
|
|
6632
|
+
* @brief Other error messages.
|
|
6633
|
+
*/
|
|
6620
6634
|
__publicField(this, "ext");
|
|
6621
6635
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6622
6636
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -13224,7 +13238,10 @@ const transformOption = (options) => {
|
|
|
13224
13238
|
return xgOptions;
|
|
13225
13239
|
};
|
|
13226
13240
|
class VePlayerBase {
|
|
13227
|
-
/**
|
|
13241
|
+
/** {zh}
|
|
13242
|
+
* @hidden
|
|
13243
|
+
*/
|
|
13244
|
+
/** {en}
|
|
13228
13245
|
* @hidden
|
|
13229
13246
|
*/
|
|
13230
13247
|
constructor(options = {}) {
|
|
@@ -13277,7 +13294,7 @@ class VePlayerBase {
|
|
|
13277
13294
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
13278
13295
|
this._player.on(ERROR, this._errorCallback);
|
|
13279
13296
|
}
|
|
13280
|
-
/**
|
|
13297
|
+
/** {zh}
|
|
13281
13298
|
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
13282
13299
|
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
13283
13300
|
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
@@ -13285,68 +13302,107 @@ class VePlayerBase {
|
|
|
13285
13302
|
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
13286
13303
|
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
13287
13304
|
*/
|
|
13305
|
+
/** {en}
|
|
13306
|
+
* @brief Gets the readiness of the video.
|
|
13307
|
+
* - `0`: HAVE_NOTHING, which means there is no information about the media resources.
|
|
13308
|
+
* - `1`: HAVE_METADATA, which means enough media resources have been retrieved to initialize the metadata and fast-forward/rewind will not raise an exception.
|
|
13309
|
+
* - `2`: HAVE_CURRENT_DATA, which means the data for the current playback position is available, but there is not enough data to play the next frame.
|
|
13310
|
+
* - `3`: HAVE_FUTURE_DATA, which means there is enough data for the current playback position and at least a short period in the future (at least two following frames).
|
|
13311
|
+
* - `4`: HAVE_ENOUGH_DATA, which means there is enough data and the download rate is sufficient for the video to be played without interruption until the end.
|
|
13312
|
+
*/
|
|
13288
13313
|
get readyState() {
|
|
13289
13314
|
return this._player.readyState;
|
|
13290
13315
|
}
|
|
13291
|
-
/**
|
|
13316
|
+
/** {zh}
|
|
13292
13317
|
* @brief 获取当前已缓冲的时间范围。
|
|
13293
13318
|
*/
|
|
13319
|
+
/** {en}
|
|
13320
|
+
* @brief Gets the currently buffered time range.
|
|
13321
|
+
*/
|
|
13294
13322
|
get buffered() {
|
|
13295
13323
|
return this._player.buffered;
|
|
13296
13324
|
}
|
|
13297
|
-
/**
|
|
13325
|
+
/** {zh}
|
|
13298
13326
|
* @brief 获取已经播放的音频/视频的时间范围。
|
|
13299
13327
|
*/
|
|
13328
|
+
/** {en}
|
|
13329
|
+
* @brief Gets the time range of the audio/video that has been played.
|
|
13330
|
+
*/
|
|
13300
13331
|
get played() {
|
|
13301
13332
|
return this._player.played;
|
|
13302
13333
|
}
|
|
13303
|
-
/**
|
|
13334
|
+
/** {zh}
|
|
13304
13335
|
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
13305
13336
|
*/
|
|
13337
|
+
/** {en}
|
|
13338
|
+
* @brief Sets or gets the current playback position of the video, in seconds.
|
|
13339
|
+
*/
|
|
13306
13340
|
get cumulateTime() {
|
|
13307
13341
|
return this._player.cumulateTime;
|
|
13308
13342
|
}
|
|
13309
|
-
/**
|
|
13343
|
+
/** {zh}
|
|
13310
13344
|
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
13311
13345
|
*/
|
|
13346
|
+
/** {en}
|
|
13347
|
+
* @brief Gets whether the player has focus. The control bar is displayed when the player has focus.
|
|
13348
|
+
*/
|
|
13312
13349
|
get isFocused() {
|
|
13313
13350
|
return this._player.isActive;
|
|
13314
13351
|
}
|
|
13315
|
-
/**
|
|
13352
|
+
/** {zh}
|
|
13316
13353
|
* @brief 获取播放器是否处于全屏状态。
|
|
13317
13354
|
*/
|
|
13355
|
+
/** {en}
|
|
13356
|
+
* @brief Gets whether the player is in full-screen mode, in which the player covers the entire desktop.
|
|
13357
|
+
*/
|
|
13318
13358
|
get isFullscreen() {
|
|
13319
13359
|
return this._player.isFullscreen;
|
|
13320
13360
|
}
|
|
13321
|
-
/**
|
|
13361
|
+
/** {zh}
|
|
13322
13362
|
* @brief 获取播放器是否处于网页全屏状态。
|
|
13323
13363
|
*/
|
|
13364
|
+
/** {en}
|
|
13365
|
+
* @brief Gets whether the player is in full-window mode, in which the player covers the entire browser window.
|
|
13366
|
+
*/
|
|
13324
13367
|
get isCssFullscreen() {
|
|
13325
13368
|
return this._player.isCssfullScreen;
|
|
13326
13369
|
}
|
|
13327
|
-
/**
|
|
13370
|
+
/** {zh}
|
|
13328
13371
|
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
13329
13372
|
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
13330
13373
|
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
13331
13374
|
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
13332
13375
|
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
13333
13376
|
*/
|
|
13377
|
+
/** {en}
|
|
13378
|
+
* @brief Gets the network condition of the video.
|
|
13379
|
+
* - `0`: NETWORK_EMPTY, which means there is no data yet, and `readyState` is `HAVE_NOTHING`.
|
|
13380
|
+
* - `1`: NETWORK_IDLE, which means the `HTMLMediaElement` element is active and the resources have been selected, but the network is not in use.
|
|
13381
|
+
* - `2`: NETWORK_LOADING, which means the browser is downloading the data of the `HTMLMediaElement` element.
|
|
13382
|
+
* - `3`: NETWORK_NO_SOURCE, the media source is not found according to the `src` property of the `HTMLMediaElement` element.
|
|
13383
|
+
*/
|
|
13334
13384
|
get networkState() {
|
|
13335
13385
|
return this._player.networkState;
|
|
13336
13386
|
}
|
|
13337
|
-
/**
|
|
13387
|
+
/** {zh}
|
|
13338
13388
|
* @brief 获取当前视频是否处于暂停状态。
|
|
13339
13389
|
*/
|
|
13390
|
+
/** {en}
|
|
13391
|
+
* @brief Gets whether the current video is suspended.
|
|
13392
|
+
*/
|
|
13340
13393
|
get paused() {
|
|
13341
13394
|
return this._player.paused;
|
|
13342
13395
|
}
|
|
13343
|
-
/**
|
|
13396
|
+
/** {zh}
|
|
13344
13397
|
* @brief 获取当前视频是否播放结束。
|
|
13345
13398
|
*/
|
|
13399
|
+
/** {en}
|
|
13400
|
+
* @brief Gets whether the current video has finished playing.
|
|
13401
|
+
*/
|
|
13346
13402
|
get ended() {
|
|
13347
13403
|
return this._player.ended;
|
|
13348
13404
|
}
|
|
13349
|
-
/**
|
|
13405
|
+
/** {zh}
|
|
13350
13406
|
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
13351
13407
|
* - `0`:ERROR,播放出现错误
|
|
13352
13408
|
* - `1`:INITIAL,初始化
|
|
@@ -13358,81 +13414,130 @@ class VePlayerBase {
|
|
|
13358
13414
|
* - `7`:ENDED,播放结束
|
|
13359
13415
|
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
13360
13416
|
*/
|
|
13417
|
+
/** {en}
|
|
13418
|
+
* @brief Gets the current state of the player.
|
|
13419
|
+
* - `0`: ERROR, which means a playback error occurred
|
|
13420
|
+
* - `1`: INITIAL, which means initialization
|
|
13421
|
+
* - `2`: READY, which means the configuration/event/plug-in has been initialized/bound/instantiated
|
|
13422
|
+
* - `3`: ATTACHING, which means the media object is being mounted.
|
|
13423
|
+
* - `4`: ATTACHED, which means the media object has been mounted in the DOM
|
|
13424
|
+
* - `5`: NOTALLOW, which means the playback is blocked
|
|
13425
|
+
* - `6`: RUNNING, which means the playback has started successfully
|
|
13426
|
+
* - `7`: ENDED, which means the playback has ended
|
|
13427
|
+
* - `8`: DESTROYED, which means the player instance is destroyed
|
|
13428
|
+
*/
|
|
13361
13429
|
get state() {
|
|
13362
13430
|
return this._player.state;
|
|
13363
13431
|
}
|
|
13364
|
-
/**
|
|
13432
|
+
/** {zh}
|
|
13365
13433
|
* 获取当前播放视频的拉流地址。
|
|
13366
13434
|
*/
|
|
13435
|
+
/** {en}
|
|
13436
|
+
* Gets the current pull stream address.
|
|
13437
|
+
*/
|
|
13367
13438
|
get url() {
|
|
13368
13439
|
return this._player.config.url;
|
|
13369
13440
|
}
|
|
13370
|
-
/**
|
|
13371
|
-
* @brief
|
|
13441
|
+
/** {zh}
|
|
13442
|
+
* @brief 获取当前播放视频的线路名称唯一标识(name)。
|
|
13443
|
+
*/
|
|
13444
|
+
/** {en}
|
|
13445
|
+
* @brief Gets the current playback source ID.
|
|
13372
13446
|
*/
|
|
13373
13447
|
get source() {
|
|
13374
13448
|
var _a;
|
|
13375
13449
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
13376
13450
|
}
|
|
13377
|
-
/**
|
|
13451
|
+
/** {zh}
|
|
13378
13452
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13379
13453
|
*/
|
|
13454
|
+
/** {en}
|
|
13455
|
+
* @brief Gets the current resolution ID.
|
|
13456
|
+
*/
|
|
13380
13457
|
get definition() {
|
|
13381
13458
|
var _a;
|
|
13382
13459
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
13383
13460
|
}
|
|
13384
|
-
/**
|
|
13461
|
+
/** {zh}
|
|
13385
13462
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13386
13463
|
*/
|
|
13464
|
+
/** {en}
|
|
13465
|
+
* @brief Gets the player's cross-domain configurations. For more information, refer to [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
|
|
13466
|
+
*/
|
|
13387
13467
|
get crossOrigin() {
|
|
13388
13468
|
return this._player.crossOrigin;
|
|
13389
13469
|
}
|
|
13390
|
-
/**
|
|
13470
|
+
/** {zh}
|
|
13391
13471
|
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13392
13472
|
*/
|
|
13473
|
+
/** {en}
|
|
13474
|
+
* @brief Sets the player's cross-domain configurations. For more information, refer to the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin).
|
|
13475
|
+
*/
|
|
13393
13476
|
set crossOrigin(crossOrigin) {
|
|
13394
13477
|
this._player.crossOrigin = crossOrigin;
|
|
13395
13478
|
}
|
|
13396
|
-
/**
|
|
13479
|
+
/** {zh}
|
|
13397
13480
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13398
13481
|
*/
|
|
13482
|
+
/** {en}
|
|
13483
|
+
* @brief Gets the volume of the video. The value range is [0,1].
|
|
13484
|
+
*/
|
|
13399
13485
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13400
13486
|
get volume() {
|
|
13401
13487
|
return this._player.volume;
|
|
13402
13488
|
}
|
|
13403
|
-
/**
|
|
13489
|
+
/** {zh}
|
|
13404
13490
|
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13405
13491
|
*/
|
|
13492
|
+
/** {en}
|
|
13493
|
+
* @brief Sets the volume of the video. Valid range: [0,1].
|
|
13494
|
+
*/
|
|
13406
13495
|
set volume(volume) {
|
|
13407
13496
|
this._player.volume = volume;
|
|
13408
13497
|
}
|
|
13409
|
-
/**
|
|
13498
|
+
/** {zh}
|
|
13410
13499
|
* @brief 获取和设置视频静音状态。
|
|
13411
13500
|
* - `true`:静音
|
|
13412
13501
|
* - `false`:非静音
|
|
13413
13502
|
*/
|
|
13503
|
+
/** {en}
|
|
13504
|
+
* @brief Gets whether the video is muted.
|
|
13505
|
+
* - `true`: Muted.
|
|
13506
|
+
* - `false`: Not muted.
|
|
13507
|
+
*/
|
|
13414
13508
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13415
13509
|
get muted() {
|
|
13416
13510
|
return this._player.muted;
|
|
13417
13511
|
}
|
|
13418
|
-
/**
|
|
13512
|
+
/** {zh}
|
|
13419
13513
|
* @brief 获取和设置视频静音状态。
|
|
13420
13514
|
* - `true`:静音
|
|
13421
13515
|
* - `false`:非静音
|
|
13422
13516
|
*/
|
|
13517
|
+
/** {en}
|
|
13518
|
+
* @brief Mute or unmute the video.
|
|
13519
|
+
* - `true`: Mute the video.
|
|
13520
|
+
* - `false`: Unmute the video.
|
|
13521
|
+
*/
|
|
13423
13522
|
set muted(isMuted) {
|
|
13424
13523
|
this._player.muted = isMuted;
|
|
13425
13524
|
}
|
|
13426
|
-
/**
|
|
13525
|
+
/** {zh}
|
|
13427
13526
|
* @brief 获取和设置当前语言。
|
|
13428
13527
|
*/
|
|
13528
|
+
/** {en}
|
|
13529
|
+
* @brief Gets the current language.
|
|
13530
|
+
*/
|
|
13429
13531
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
13430
13532
|
get lang() {
|
|
13431
13533
|
return this._i18nManager.getLang();
|
|
13432
13534
|
}
|
|
13433
|
-
/**
|
|
13535
|
+
/** {zh}
|
|
13434
13536
|
* @brief 获取和设置当前语言。
|
|
13435
13537
|
*/
|
|
13538
|
+
/** {en}
|
|
13539
|
+
* @brief Sets the current language.
|
|
13540
|
+
*/
|
|
13436
13541
|
set lang(lang) {
|
|
13437
13542
|
var _a, _b;
|
|
13438
13543
|
if (this._player.lang === lang) {
|
|
@@ -13454,7 +13559,10 @@ class VePlayerBase {
|
|
|
13454
13559
|
get _src() {
|
|
13455
13560
|
return this._player.currentSrc;
|
|
13456
13561
|
}
|
|
13457
|
-
/**
|
|
13562
|
+
/** {zh}
|
|
13563
|
+
* @hidden
|
|
13564
|
+
*/
|
|
13565
|
+
/** {en}
|
|
13458
13566
|
* @hidden
|
|
13459
13567
|
*/
|
|
13460
13568
|
static async create(options = {}, Constructor) {
|
|
@@ -13484,11 +13592,16 @@ class VePlayerBase {
|
|
|
13484
13592
|
sourceManager
|
|
13485
13593
|
});
|
|
13486
13594
|
}
|
|
13487
|
-
/**
|
|
13595
|
+
/** {zh}
|
|
13488
13596
|
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13489
13597
|
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13490
13598
|
* @param options 更多配置信息
|
|
13491
13599
|
*/
|
|
13600
|
+
/** {en}
|
|
13601
|
+
* @brief Switches the pull stream address, playback source, or resolution.
|
|
13602
|
+
* @param target The target pull stream address, playback source, or resolution.
|
|
13603
|
+
* @param options More configurations.
|
|
13604
|
+
*/
|
|
13492
13605
|
async switch(target, options) {
|
|
13493
13606
|
var _a, _b;
|
|
13494
13607
|
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) {
|
|
@@ -13505,21 +13618,32 @@ class VePlayerBase {
|
|
|
13505
13618
|
await this._switch(targetDefinition);
|
|
13506
13619
|
return targetDefinition;
|
|
13507
13620
|
}
|
|
13508
|
-
/**
|
|
13621
|
+
/** {zh}
|
|
13509
13622
|
* @brief 调用此方法更新拉流地址列表。
|
|
13510
13623
|
* @param playlist 要更新的播放列表。
|
|
13511
13624
|
* @param target 更新后默认播放的资源。
|
|
13512
13625
|
*/
|
|
13626
|
+
/** {en}
|
|
13627
|
+
* @brief Updates the list of pull stream addresses.
|
|
13628
|
+
* @param Playlist The updated list.
|
|
13629
|
+
* @param Target The default playback resource after the update.
|
|
13630
|
+
*/
|
|
13513
13631
|
updatePlaylist(playlist, target) {
|
|
13514
13632
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
13515
13633
|
return this._switch(sourceManager.definition);
|
|
13516
13634
|
}
|
|
13517
13635
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13518
13636
|
/**
|
|
13637
|
+
/** {zh}
|
|
13519
13638
|
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13520
13639
|
* @param event 表示事件的名称。
|
|
13521
13640
|
* @param callback 表示事件的回调函数。
|
|
13522
13641
|
*/
|
|
13642
|
+
/** {en}
|
|
13643
|
+
* @brief Listens for a specified event. The event handler is executed only once.
|
|
13644
|
+
* @param event The event name.
|
|
13645
|
+
* @param callback The callback function for the event.
|
|
13646
|
+
*/
|
|
13523
13647
|
once(event, callback) {
|
|
13524
13648
|
var _a;
|
|
13525
13649
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
@@ -13531,11 +13655,16 @@ class VePlayerBase {
|
|
|
13531
13655
|
this._player.once(xgEventName, xgCallback);
|
|
13532
13656
|
}
|
|
13533
13657
|
}
|
|
13534
|
-
/**
|
|
13658
|
+
/** {zh}
|
|
13535
13659
|
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13536
13660
|
* @param event 表示事件的名称。
|
|
13537
13661
|
* @param callback 表示事件的回调函数。
|
|
13538
13662
|
*/
|
|
13663
|
+
/** {en}
|
|
13664
|
+
* @brief Stops listening for a specified event.
|
|
13665
|
+
* @param event The event name.
|
|
13666
|
+
* @param callback The callback function for the event.
|
|
13667
|
+
*/
|
|
13539
13668
|
off(event, callback) {
|
|
13540
13669
|
var _a;
|
|
13541
13670
|
const xgCallback = (_a = this._events[event]) == null ? void 0 : _a.get(callback);
|
|
@@ -13545,27 +13674,40 @@ class VePlayerBase {
|
|
|
13545
13674
|
this._events[event].delete(callback);
|
|
13546
13675
|
}
|
|
13547
13676
|
}
|
|
13548
|
-
/**
|
|
13677
|
+
/** {zh}
|
|
13549
13678
|
* @brief 调用此方法触发指定事件。
|
|
13550
13679
|
* @param event 表示事件的名称。
|
|
13551
13680
|
* @param data 事件信息。
|
|
13552
13681
|
*/
|
|
13682
|
+
/** {en}
|
|
13683
|
+
* @brief Triggers a specified event.
|
|
13684
|
+
* @param event The event name.
|
|
13685
|
+
* @param data The event information.
|
|
13686
|
+
*/
|
|
13553
13687
|
emit(event, data) {
|
|
13554
13688
|
const { xgEventName } = this._transformEvent(event);
|
|
13555
13689
|
this._player.emit(xgEventName, data);
|
|
13556
13690
|
}
|
|
13557
|
-
/**
|
|
13691
|
+
/** {zh}
|
|
13558
13692
|
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13559
13693
|
*/
|
|
13694
|
+
/** {en}
|
|
13695
|
+
* @brief Stops listening to any player event.
|
|
13696
|
+
*/
|
|
13560
13697
|
offAll() {
|
|
13561
13698
|
this._events = {};
|
|
13562
13699
|
this._player.offAll();
|
|
13563
13700
|
}
|
|
13564
|
-
/**
|
|
13701
|
+
/** {zh}
|
|
13565
13702
|
* @brief 调用此方法监听指定事件。
|
|
13566
13703
|
* @param event 表示事件名称。
|
|
13567
13704
|
* @param callback 表示事件的回调函数。
|
|
13568
13705
|
*/
|
|
13706
|
+
/** {en}
|
|
13707
|
+
* @brief Listens for a specified event.
|
|
13708
|
+
* @param event The event name.
|
|
13709
|
+
* @param callback The callback function for the event.
|
|
13710
|
+
*/
|
|
13569
13711
|
on(event, callback) {
|
|
13570
13712
|
var _a;
|
|
13571
13713
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
@@ -13577,102 +13719,153 @@ class VePlayerBase {
|
|
|
13577
13719
|
this._player.on(xgEventName, xgCallback);
|
|
13578
13720
|
}
|
|
13579
13721
|
}
|
|
13580
|
-
/**
|
|
13722
|
+
/** {zh}
|
|
13581
13723
|
* @brief 调用此方法开始播放 。
|
|
13582
13724
|
*/
|
|
13725
|
+
/** {en}
|
|
13726
|
+
* @brief Starts playback.
|
|
13727
|
+
*/
|
|
13583
13728
|
play() {
|
|
13584
13729
|
/* istanbul ignore next -- @preserve */
|
|
13585
13730
|
return this._player.play();
|
|
13586
13731
|
}
|
|
13587
|
-
/**
|
|
13732
|
+
/** {zh}
|
|
13588
13733
|
* @brief 调用此方法暂停播放。
|
|
13589
13734
|
*/
|
|
13735
|
+
/** {en}
|
|
13736
|
+
* @brief Pauses playback.
|
|
13737
|
+
*/
|
|
13590
13738
|
pause() {
|
|
13591
13739
|
/* istanbul ignore next -- @preserve */
|
|
13592
13740
|
return this._player.pause();
|
|
13593
13741
|
}
|
|
13594
|
-
/**
|
|
13742
|
+
/** {zh}
|
|
13595
13743
|
* @brief 调用此方法打开画中画。
|
|
13596
13744
|
*/
|
|
13745
|
+
/** {en}
|
|
13746
|
+
* @brief Turns on Picture-in-Picture (PIP).
|
|
13747
|
+
*/
|
|
13597
13748
|
requestPIP() {
|
|
13598
13749
|
var _a;
|
|
13599
13750
|
/* istanbul ignore next -- @preserve */
|
|
13600
13751
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
13601
13752
|
}
|
|
13602
|
-
/**
|
|
13753
|
+
/** {zh}
|
|
13603
13754
|
* @brief 调用此方法关闭画中画。
|
|
13604
13755
|
*/
|
|
13756
|
+
/** {en}
|
|
13757
|
+
* @brief Turns off Picture-in-Picture (PIP).
|
|
13758
|
+
*/
|
|
13605
13759
|
exitPIP() {
|
|
13606
13760
|
var _a;
|
|
13607
13761
|
/* istanbul ignore next -- @preserve */
|
|
13608
13762
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
13609
13763
|
}
|
|
13610
|
-
/**
|
|
13764
|
+
/** {zh}
|
|
13611
13765
|
* @brief 调用此方法重新拉流。
|
|
13612
13766
|
*/
|
|
13767
|
+
/** {en}
|
|
13768
|
+
* @brief Retries stream-pulling.
|
|
13769
|
+
*/
|
|
13613
13770
|
retry() {
|
|
13614
13771
|
return this._player.retry();
|
|
13615
13772
|
}
|
|
13616
|
-
/**
|
|
13773
|
+
/** {zh}
|
|
13617
13774
|
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13618
13775
|
* @param data 播放器获取焦点配置信息。
|
|
13619
13776
|
*/
|
|
13777
|
+
/** {en}
|
|
13778
|
+
* @brief The player gets focus. When the method is called, `veplayer.isFocused` will become `true` and the `PLAYER_FOCUS` event will be triggered.
|
|
13779
|
+
* @param data Related configurations.
|
|
13780
|
+
*/
|
|
13620
13781
|
focus(data) {
|
|
13621
13782
|
return this._player.focus(data);
|
|
13622
13783
|
}
|
|
13623
|
-
/**
|
|
13784
|
+
/** {zh}
|
|
13624
13785
|
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13625
13786
|
* @param data 播放器失去焦点配置信息。
|
|
13626
13787
|
*/
|
|
13788
|
+
/** {en}
|
|
13789
|
+
* @brief The player loses focus. When the method is called, `veplayer.isFocused` will become `false` and the `PLAYER_BLUR` event will be triggered.
|
|
13790
|
+
* @param data The related configurations.
|
|
13791
|
+
*/
|
|
13627
13792
|
blur(data) {
|
|
13628
13793
|
return this._player.blur(data);
|
|
13629
13794
|
}
|
|
13630
|
-
/**
|
|
13795
|
+
/** {zh}
|
|
13631
13796
|
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13632
13797
|
* @param el 全屏作用的 DOM 节点。
|
|
13633
13798
|
*/
|
|
13799
|
+
/** {en}
|
|
13800
|
+
* @brief Turns the player into full-screen mode, in which the player covers the entire desktop. If the player is in full-window mode when the method is called, it will automatically exit full-window mode, and the `Events.FULLSCREEN_CHANGE` event will be triggered.
|
|
13801
|
+
* @param el The DOM node in which the player is displayed in full-screen mode.
|
|
13802
|
+
*/
|
|
13634
13803
|
requestFullscreen(el) {
|
|
13635
13804
|
return this._player.getFullscreen(el);
|
|
13636
13805
|
}
|
|
13637
|
-
/**
|
|
13806
|
+
/** {zh}
|
|
13638
13807
|
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13639
13808
|
* @param el 全屏作用的 DOM 节点。
|
|
13640
13809
|
*/
|
|
13810
|
+
/** {en}
|
|
13811
|
+
* @brief Exits full-screen mode. After the method is called, `veplayer.isFullscreen` will become `false` and the `Events.FULLSCREEN_CHANGE` event will be triggered.
|
|
13812
|
+
* @param el The DOM node of the full screen effect.
|
|
13813
|
+
*/
|
|
13641
13814
|
exitFullscreen(el) {
|
|
13642
13815
|
return this._player.exitFullscreen(el);
|
|
13643
13816
|
}
|
|
13644
|
-
/**
|
|
13817
|
+
/** {zh}
|
|
13645
13818
|
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13646
13819
|
* @param el 全屏作用的 DOM 节点。
|
|
13647
13820
|
*/
|
|
13821
|
+
/** {en}
|
|
13822
|
+
* @brief Turns the player into full-window mode, in which the player covers the entire browser window. If the player is in full-screen mode when the method is called, it will automatically exit full-screen mode, and the `Events.CSS_FULLSCREEN_CHANGE` event will be triggered.
|
|
13823
|
+
* @param el The DOM node in which the player is displayed in full-window mode.
|
|
13824
|
+
*/
|
|
13648
13825
|
requestCssFullscreen(el) {
|
|
13649
13826
|
return this._player.getCssFullscreen(el);
|
|
13650
13827
|
}
|
|
13651
|
-
/**
|
|
13828
|
+
/** {zh}
|
|
13652
13829
|
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13653
13830
|
*/
|
|
13831
|
+
/** {en}
|
|
13832
|
+
* @brief Exits the full-window mode. When the method is called, `veplayer.isFullscreen` will become `false` and the `Events.CSS_FULLSCREEN_CHANGE` event will be triggered.
|
|
13833
|
+
*/
|
|
13654
13834
|
exitCssFullscreen() {
|
|
13655
13835
|
return this._player.exitCssFullscreen();
|
|
13656
13836
|
}
|
|
13657
|
-
/**
|
|
13837
|
+
/** {zh}
|
|
13658
13838
|
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13659
13839
|
* @param plugin 插件构造函数。
|
|
13660
13840
|
* @param config 插件的配置列表。
|
|
13661
13841
|
*/
|
|
13842
|
+
/** {en}
|
|
13843
|
+
* @brief Registers a specified plug-in to the current player.
|
|
13844
|
+
* @param Plugin The plugin constructor.
|
|
13845
|
+
* @param config The plugin configurations.
|
|
13846
|
+
*/
|
|
13662
13847
|
registerPlugin(plugin, config) {
|
|
13663
13848
|
return this._player.registerPlugin(plugin, config);
|
|
13664
13849
|
}
|
|
13665
|
-
/**
|
|
13850
|
+
/** {zh}
|
|
13666
13851
|
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13667
13852
|
* @param plugin 插件实例或者插件名称。
|
|
13668
13853
|
*/
|
|
13854
|
+
/** {en}
|
|
13855
|
+
* @brief Destroys or unregisters a specified plugin from the player.
|
|
13856
|
+
* @param Plugin The plugin instance or name.
|
|
13857
|
+
*/
|
|
13669
13858
|
unRegisterPlugin(plugin) {
|
|
13670
13859
|
return this._player.unRegisterPlugin(plugin);
|
|
13671
13860
|
}
|
|
13672
|
-
/**
|
|
13861
|
+
/** {zh}
|
|
13673
13862
|
* @brief 调用此接口显示指定插件图标。
|
|
13674
13863
|
* @param pluginNames 插件名称
|
|
13675
13864
|
*/
|
|
13865
|
+
/** {en}
|
|
13866
|
+
* @brief Displays the icon of a specified plugin.
|
|
13867
|
+
* @param PluginNames The plugin name.
|
|
13868
|
+
*/
|
|
13676
13869
|
showIcon(pluginNames) {
|
|
13677
13870
|
const morePlugin = this._player.getPlugin("more");
|
|
13678
13871
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13686,10 +13879,14 @@ class VePlayerBase {
|
|
|
13686
13879
|
}
|
|
13687
13880
|
});
|
|
13688
13881
|
}
|
|
13689
|
-
/**
|
|
13882
|
+
/** {zh}
|
|
13690
13883
|
* @brief 调用此接口隐藏指定插件图标。
|
|
13691
13884
|
* @param pluginNames 插件名称
|
|
13692
13885
|
*/
|
|
13886
|
+
/** {en}
|
|
13887
|
+
* @brief Hides the icon of a specified plugin.
|
|
13888
|
+
* @param PluginNames The plugin name.
|
|
13889
|
+
*/
|
|
13693
13890
|
hideIcon(pluginNames) {
|
|
13694
13891
|
const morePlugin = this._player.getPlugin("more");
|
|
13695
13892
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13703,14 +13900,20 @@ class VePlayerBase {
|
|
|
13703
13900
|
}
|
|
13704
13901
|
});
|
|
13705
13902
|
}
|
|
13706
|
-
/**
|
|
13903
|
+
/** {zh}
|
|
13707
13904
|
* @brief 调用此方法销毁播放器实例。
|
|
13708
13905
|
*/
|
|
13906
|
+
/** {en}
|
|
13907
|
+
* @brief Destroys the player instance.
|
|
13908
|
+
*/
|
|
13709
13909
|
destroy() {
|
|
13710
13910
|
this._player.off(ERROR, this._errorCallback);
|
|
13711
13911
|
this._player.destroy();
|
|
13712
13912
|
}
|
|
13713
|
-
/**
|
|
13913
|
+
/** {zh}
|
|
13914
|
+
* @hidden
|
|
13915
|
+
*/
|
|
13916
|
+
/** {en}
|
|
13714
13917
|
* @hidden
|
|
13715
13918
|
*/
|
|
13716
13919
|
async prepare(url) {
|