@volcengine/veplayer 2.0.0-rc.0 → 2.0.0-rc.2
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 +2042 -278
- package/esm/veplayer.biz.live.development.js +26 -5
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +4488 -836
- package/esm/veplayer.development.js +288 -58
- package/esm/veplayer.live.d.ts +4494 -843
- package/esm/veplayer.live.development.js +288 -58
- package/esm/veplayer.live.production.js +4 -4
- package/esm/veplayer.production.js +4 -4
- package/esm/veplayer.vod.d.ts +2042 -278
- package/esm/veplayer.vod.development.js +251 -40
- package/esm/veplayer.vod.production.js +3 -3
- package/package.json +1 -1
- package/umd/index.d.ts +2042 -278
- package/umd/veplayer.biz.live.development.js +26 -5
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +4488 -836
- package/umd/veplayer.development.js +288 -58
- package/umd/veplayer.live.d.ts +4494 -843
- package/umd/veplayer.live.development.js +288 -58
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +2042 -278
- package/umd/veplayer.vod.development.js +251 -40
- package/umd/veplayer.vod.production.js +1 -1
|
@@ -4,6 +4,16 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
+
var Codec = /* @__PURE__ */ ((Codec2) => {
|
|
8
|
+
Codec2["H265"] = "h265";
|
|
9
|
+
Codec2["H264"] = "h264";
|
|
10
|
+
return Codec2;
|
|
11
|
+
})(Codec || {});
|
|
12
|
+
var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
|
|
13
|
+
DecodeType2["Software"] = "software";
|
|
14
|
+
DecodeType2["Hardware"] = "hardware";
|
|
15
|
+
return DecodeType2;
|
|
16
|
+
})(DecodeType || {});
|
|
7
17
|
function ownKeys(object, enumerableOnly) {
|
|
8
18
|
var keys = Object.keys(object);
|
|
9
19
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -6122,7 +6132,7 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
6122
6132
|
ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
|
|
6123
6133
|
ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
|
|
6124
6134
|
ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
|
|
6125
|
-
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] =
|
|
6135
|
+
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
|
|
6126
6136
|
ErrorCode2["UNKNOWN"] = "UNKNOWN";
|
|
6127
6137
|
return ErrorCode2;
|
|
6128
6138
|
})(ErrorCode || {});
|
|
@@ -6208,7 +6218,7 @@ const ERROR_INFO = {
|
|
|
6208
6218
|
/* Error */
|
|
6209
6219
|
},
|
|
6210
6220
|
[
|
|
6211
|
-
|
|
6221
|
+
110
|
|
6212
6222
|
/* MODULE_LOAD_ERROR */
|
|
6213
6223
|
]: {
|
|
6214
6224
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
@@ -6283,6 +6293,11 @@ const ERROR_TYPE_INFO = {
|
|
|
6283
6293
|
}
|
|
6284
6294
|
};
|
|
6285
6295
|
class VeError extends Error {
|
|
6296
|
+
/**
|
|
6297
|
+
* @hidden
|
|
6298
|
+
* @param error
|
|
6299
|
+
* @param i18n
|
|
6300
|
+
*/
|
|
6286
6301
|
constructor(error2, i18n) {
|
|
6287
6302
|
var _a;
|
|
6288
6303
|
const errorInfo = typeof error2 === "string" ? {
|
|
@@ -6290,8 +6305,17 @@ class VeError extends Error {
|
|
|
6290
6305
|
} : error2;
|
|
6291
6306
|
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"));
|
|
6292
6307
|
super(message);
|
|
6308
|
+
/**
|
|
6309
|
+
* @brief 错误码,对应[错误码字典](#错误码)。
|
|
6310
|
+
*/
|
|
6293
6311
|
__publicField(this, "errorCode");
|
|
6312
|
+
/**
|
|
6313
|
+
* @brief 错误等级。
|
|
6314
|
+
*/
|
|
6294
6315
|
__publicField(this, "level");
|
|
6316
|
+
/**
|
|
6317
|
+
* @brief 其他错误信息。
|
|
6318
|
+
*/
|
|
6295
6319
|
__publicField(this, "ext");
|
|
6296
6320
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6297
6321
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -10672,12 +10696,13 @@ class MobilePlayerPanel {
|
|
|
10672
10696
|
}
|
|
10673
10697
|
}
|
|
10674
10698
|
var optionsIcon = "";
|
|
10675
|
-
|
|
10676
|
-
Middle
|
|
10677
|
-
Bottom
|
|
10678
|
-
Fullscreen
|
|
10679
|
-
Inner
|
|
10680
|
-
|
|
10699
|
+
var ListType = /* @__PURE__ */ ((ListType2) => {
|
|
10700
|
+
ListType2["Middle"] = "middle";
|
|
10701
|
+
ListType2["Bottom"] = "bottom";
|
|
10702
|
+
ListType2["Fullscreen"] = "fullscreen";
|
|
10703
|
+
ListType2["Inner"] = "inner";
|
|
10704
|
+
return ListType2;
|
|
10705
|
+
})(ListType || {});
|
|
10681
10706
|
var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
10682
10707
|
RenderType2["Icon"] = "Icon";
|
|
10683
10708
|
RenderType2["Text"] = "Text";
|
|
@@ -10685,20 +10710,26 @@ var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
|
10685
10710
|
})(RenderType || {});
|
|
10686
10711
|
const isMobile$1 = sniffer.device === "mobile";
|
|
10687
10712
|
const MOBILE_LIST_TYPES = [
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10713
|
+
"bottom",
|
|
10714
|
+
"fullscreen",
|
|
10715
|
+
"inner"
|
|
10716
|
+
/* Inner */
|
|
10717
|
+
];
|
|
10718
|
+
const PC_LIST_TYPES = [
|
|
10719
|
+
"middle"
|
|
10720
|
+
/* Middle */
|
|
10691
10721
|
];
|
|
10692
|
-
const PC_LIST_TYPES = [ListType.Middle];
|
|
10693
10722
|
const MODAL_TYPES = [
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10723
|
+
"bottom",
|
|
10724
|
+
"inner",
|
|
10725
|
+
"fullscreen"
|
|
10726
|
+
/* Fullscreen */
|
|
10697
10727
|
];
|
|
10698
10728
|
const CUSTOM_TYPES = [
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10729
|
+
"bottom",
|
|
10730
|
+
"inner",
|
|
10731
|
+
"fullscreen"
|
|
10732
|
+
/* Fullscreen */
|
|
10702
10733
|
];
|
|
10703
10734
|
class OptionsIcon extends Plugin {
|
|
10704
10735
|
constructor(args) {
|
|
@@ -10736,7 +10767,7 @@ class OptionsIcon extends Plugin {
|
|
|
10736
10767
|
// 默认手机端在“右上角”,pc端在控制栏右侧
|
|
10737
10768
|
position: isMobile$1 ? POSITIONS.ROOT_TOP_RIGHT : POSITIONS.CONTROLS_RIGHT,
|
|
10738
10769
|
// 默认手机端列表展示底部,pc端在控制栏默认
|
|
10739
|
-
listType: isMobile$1 ?
|
|
10770
|
+
listType: isMobile$1 ? "bottom" : "middle",
|
|
10740
10771
|
index: 100,
|
|
10741
10772
|
list: [],
|
|
10742
10773
|
listStyle: {},
|
|
@@ -10918,10 +10949,10 @@ class OptionsIcon extends Plugin {
|
|
|
10918
10949
|
listType = this.player.config.listType;
|
|
10919
10950
|
}
|
|
10920
10951
|
if (!isMobile$1 && (!listType || !MOBILE_LIST_TYPES.includes(listType))) {
|
|
10921
|
-
listType =
|
|
10952
|
+
listType = "bottom";
|
|
10922
10953
|
}
|
|
10923
10954
|
if (!isMobile$1 && (!listType || !PC_LIST_TYPES.includes(listType))) {
|
|
10924
|
-
listType =
|
|
10955
|
+
listType = "middle";
|
|
10925
10956
|
}
|
|
10926
10957
|
return listType;
|
|
10927
10958
|
}
|
|
@@ -12623,11 +12654,6 @@ class VeI18n {
|
|
|
12623
12654
|
}
|
|
12624
12655
|
}
|
|
12625
12656
|
var veplayerBase = "";
|
|
12626
|
-
var Codec = /* @__PURE__ */ ((Codec2) => {
|
|
12627
|
-
Codec2["H265"] = "h265";
|
|
12628
|
-
Codec2["H264"] = "h264";
|
|
12629
|
-
return Codec2;
|
|
12630
|
-
})(Codec || {});
|
|
12631
12657
|
const { POSITIONS: XGPosition } = Plugin;
|
|
12632
12658
|
const POSITIONS = {
|
|
12633
12659
|
...XGPosition,
|
|
@@ -12637,7 +12663,7 @@ const DEFAULT_OPTIONS = {
|
|
|
12637
12663
|
id: "veplayer",
|
|
12638
12664
|
width: "100%",
|
|
12639
12665
|
height: "100%",
|
|
12640
|
-
decodeType:
|
|
12666
|
+
decodeType: DecodeType.Hardware,
|
|
12641
12667
|
fullscreen: {
|
|
12642
12668
|
useCssFullscreen: false
|
|
12643
12669
|
}
|
|
@@ -12665,6 +12691,9 @@ const transformOption = (options) => {
|
|
|
12665
12691
|
return xgOptions;
|
|
12666
12692
|
};
|
|
12667
12693
|
class VePlayerBase {
|
|
12694
|
+
/**
|
|
12695
|
+
* @hidden
|
|
12696
|
+
*/
|
|
12668
12697
|
constructor(options = {}) {
|
|
12669
12698
|
__publicField(this, "_player");
|
|
12670
12699
|
__publicField(this, "_sourceManager");
|
|
@@ -12716,74 +12745,162 @@ class VePlayerBase {
|
|
|
12716
12745
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
12717
12746
|
this._player.on(ERROR, this._errorCallback);
|
|
12718
12747
|
}
|
|
12748
|
+
/**
|
|
12749
|
+
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
12750
|
+
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
12751
|
+
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
12752
|
+
* - `2`:HAVE_CURRENT_DATA,当前播放位置的数据可用,但不足以播放下一帧
|
|
12753
|
+
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
12754
|
+
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
12755
|
+
*/
|
|
12719
12756
|
get readyState() {
|
|
12720
12757
|
return this._player.readyState;
|
|
12721
12758
|
}
|
|
12759
|
+
/**
|
|
12760
|
+
* @brief 获取当前已缓冲的时间范围。
|
|
12761
|
+
*/
|
|
12722
12762
|
get buffered() {
|
|
12723
12763
|
return this._player.buffered;
|
|
12724
12764
|
}
|
|
12765
|
+
/**
|
|
12766
|
+
* @brief 获取已经播放的音频/视频的时间范围。
|
|
12767
|
+
*/
|
|
12725
12768
|
get played() {
|
|
12726
12769
|
return this._player.played;
|
|
12727
12770
|
}
|
|
12771
|
+
/**
|
|
12772
|
+
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
12773
|
+
*/
|
|
12728
12774
|
get cumulateTime() {
|
|
12729
12775
|
return this._player.cumulateTime;
|
|
12730
12776
|
}
|
|
12777
|
+
/**
|
|
12778
|
+
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
12779
|
+
*/
|
|
12731
12780
|
get isFocused() {
|
|
12732
12781
|
return this._player.isActive;
|
|
12733
12782
|
}
|
|
12783
|
+
/**
|
|
12784
|
+
* @brief 获取播放器是否处于全屏状态。
|
|
12785
|
+
*/
|
|
12734
12786
|
get isFullscreen() {
|
|
12735
12787
|
return this._player.isFullscreen;
|
|
12736
12788
|
}
|
|
12789
|
+
/**
|
|
12790
|
+
* @brief 获取播放器是否处于网页全屏状态。
|
|
12791
|
+
*/
|
|
12737
12792
|
get isCssFullscreen() {
|
|
12738
12793
|
return this._player.isCssfullScreen;
|
|
12739
12794
|
}
|
|
12795
|
+
/**
|
|
12796
|
+
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
12797
|
+
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
12798
|
+
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
12799
|
+
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
12800
|
+
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
12801
|
+
*/
|
|
12740
12802
|
get networkState() {
|
|
12741
12803
|
return this._player.networkState;
|
|
12742
12804
|
}
|
|
12805
|
+
/**
|
|
12806
|
+
* @brief 获取当前视频是否处于暂停状态。
|
|
12807
|
+
*/
|
|
12743
12808
|
get paused() {
|
|
12744
12809
|
return this._player.paused;
|
|
12745
12810
|
}
|
|
12811
|
+
/**
|
|
12812
|
+
* @brief 获取当前视频是否播放结束。
|
|
12813
|
+
*/
|
|
12746
12814
|
get ended() {
|
|
12747
12815
|
return this._player.ended;
|
|
12748
12816
|
}
|
|
12817
|
+
/**
|
|
12818
|
+
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
12819
|
+
* - `0`:ERROR,播放出现错误
|
|
12820
|
+
* - `1`:INITIAL,初始化
|
|
12821
|
+
* - `2`:READY,配置/事件/插件等均已经初始化/绑定/实例化完成
|
|
12822
|
+
* - `3`:ATTACHING,进入媒体对象挂载阶段
|
|
12823
|
+
* - `4`:ATTACHED,媒体对象已经挂载到了 DOM 中
|
|
12824
|
+
* - `5`:NOTALLOW,播放被阻止
|
|
12825
|
+
* - `6`:RUNNING,已经成功起播进入播放流程
|
|
12826
|
+
* - `7`:ENDED,播放结束
|
|
12827
|
+
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
12828
|
+
*/
|
|
12749
12829
|
get state() {
|
|
12750
12830
|
return this._player.state;
|
|
12751
12831
|
}
|
|
12832
|
+
/**
|
|
12833
|
+
* 获取当前播放视频的拉流地址。
|
|
12834
|
+
*/
|
|
12752
12835
|
get url() {
|
|
12753
12836
|
return this._player.config.url;
|
|
12754
12837
|
}
|
|
12838
|
+
/**
|
|
12839
|
+
* @brief 获取当播放视频的线路名称唯一标识(name)。
|
|
12840
|
+
*/
|
|
12755
12841
|
get source() {
|
|
12756
12842
|
var _a;
|
|
12757
12843
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
12758
12844
|
}
|
|
12845
|
+
/**
|
|
12846
|
+
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
12847
|
+
*/
|
|
12759
12848
|
get definition() {
|
|
12760
12849
|
var _a;
|
|
12761
12850
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
12762
12851
|
}
|
|
12852
|
+
/**
|
|
12853
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
12854
|
+
*/
|
|
12763
12855
|
get crossOrigin() {
|
|
12764
12856
|
return this._player.crossOrigin;
|
|
12765
12857
|
}
|
|
12858
|
+
/**
|
|
12859
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
12860
|
+
*/
|
|
12766
12861
|
set crossOrigin(crossOrigin) {
|
|
12767
12862
|
this._player.crossOrigin = crossOrigin;
|
|
12768
12863
|
}
|
|
12864
|
+
/**
|
|
12865
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
12866
|
+
*/
|
|
12769
12867
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12770
12868
|
get volume() {
|
|
12771
12869
|
return this._player.volume;
|
|
12772
12870
|
}
|
|
12871
|
+
/**
|
|
12872
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
12873
|
+
*/
|
|
12773
12874
|
set volume(volume) {
|
|
12774
12875
|
this._player.volume = volume;
|
|
12775
12876
|
}
|
|
12877
|
+
/**
|
|
12878
|
+
* @brief 获取和设置视频静音状态。
|
|
12879
|
+
* - `true`:静音
|
|
12880
|
+
* - `false`:非静音
|
|
12881
|
+
*/
|
|
12776
12882
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12777
12883
|
get muted() {
|
|
12778
12884
|
return this._player.muted;
|
|
12779
12885
|
}
|
|
12886
|
+
/**
|
|
12887
|
+
* @brief 获取和设置视频静音状态。
|
|
12888
|
+
* - `true`:静音
|
|
12889
|
+
* - `false`:非静音
|
|
12890
|
+
*/
|
|
12780
12891
|
set muted(isMuted) {
|
|
12781
12892
|
this._player.muted = isMuted;
|
|
12782
12893
|
}
|
|
12894
|
+
/**
|
|
12895
|
+
* @brief 获取和设置当前语言。
|
|
12896
|
+
*/
|
|
12783
12897
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12784
12898
|
get lang() {
|
|
12785
12899
|
return this._i18nManager.getLang();
|
|
12786
12900
|
}
|
|
12901
|
+
/**
|
|
12902
|
+
* @brief 获取和设置当前语言。
|
|
12903
|
+
*/
|
|
12787
12904
|
set lang(lang) {
|
|
12788
12905
|
var _a, _b;
|
|
12789
12906
|
if (this._player.lang === lang) {
|
|
@@ -12805,6 +12922,9 @@ class VePlayerBase {
|
|
|
12805
12922
|
get _src() {
|
|
12806
12923
|
return this._player.currentSrc;
|
|
12807
12924
|
}
|
|
12925
|
+
/**
|
|
12926
|
+
* @hidden
|
|
12927
|
+
*/
|
|
12808
12928
|
static async create(options = {}, Constructor) {
|
|
12809
12929
|
var _a;
|
|
12810
12930
|
const sourceManager = new SourceManager({
|
|
@@ -12826,6 +12946,11 @@ class VePlayerBase {
|
|
|
12826
12946
|
sourceManager
|
|
12827
12947
|
});
|
|
12828
12948
|
}
|
|
12949
|
+
/**
|
|
12950
|
+
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
12951
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
12952
|
+
* @param options 更多配置信息
|
|
12953
|
+
*/
|
|
12829
12954
|
async switch(target, options) {
|
|
12830
12955
|
var _a, _b;
|
|
12831
12956
|
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) {
|
|
@@ -12842,12 +12967,22 @@ class VePlayerBase {
|
|
|
12842
12967
|
await this._switch(targetDefinition);
|
|
12843
12968
|
return targetDefinition;
|
|
12844
12969
|
}
|
|
12970
|
+
/**
|
|
12971
|
+
* @brief 调用此方法更新拉流地址列表。
|
|
12972
|
+
* @param playlist 要更新的播放列表。
|
|
12973
|
+
* @param target 更新后默认播放的资源。
|
|
12974
|
+
*/
|
|
12845
12975
|
updatePlaylist(playlist, target) {
|
|
12846
12976
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
12847
12977
|
return this._switch(sourceManager.definition);
|
|
12848
12978
|
}
|
|
12849
12979
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
12850
|
-
|
|
12980
|
+
/**
|
|
12981
|
+
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
12982
|
+
* @param event 表示事件的名称。
|
|
12983
|
+
* @param callback 表示事件的名称。
|
|
12984
|
+
*/
|
|
12985
|
+
once(event, callback) {
|
|
12851
12986
|
var _a;
|
|
12852
12987
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
12853
12988
|
if (xgCallback) {
|
|
@@ -12855,27 +12990,45 @@ class VePlayerBase {
|
|
|
12855
12990
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
12856
12991
|
}
|
|
12857
12992
|
this._events[event].set(callback, xgCallback);
|
|
12858
|
-
this._player.once(xgEventName, xgCallback
|
|
12993
|
+
this._player.once(xgEventName, xgCallback);
|
|
12859
12994
|
}
|
|
12860
12995
|
}
|
|
12861
|
-
|
|
12996
|
+
/**
|
|
12997
|
+
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
12998
|
+
* @param event 表示事件的名称。
|
|
12999
|
+
* @param callback 表示事件的名称。
|
|
13000
|
+
*/
|
|
13001
|
+
off(event, callback) {
|
|
12862
13002
|
var _a;
|
|
12863
13003
|
const xgCallback = (_a = this._events[event]) == null ? void 0 : _a.get(callback);
|
|
12864
13004
|
const { xgEventName } = this._transformEvent(event);
|
|
12865
13005
|
if (xgCallback) {
|
|
12866
|
-
this._player.off(xgEventName, xgCallback
|
|
13006
|
+
this._player.off(xgEventName, xgCallback);
|
|
12867
13007
|
this._events[event].delete(callback);
|
|
12868
13008
|
}
|
|
12869
13009
|
}
|
|
12870
|
-
|
|
13010
|
+
/**
|
|
13011
|
+
* @brief 调用此方法触发指定事件。
|
|
13012
|
+
* @param event 表示事件的名称。
|
|
13013
|
+
* @param data 事件信息。
|
|
13014
|
+
*/
|
|
13015
|
+
emit(event, data) {
|
|
12871
13016
|
const { xgEventName } = this._transformEvent(event);
|
|
12872
|
-
this._player.emit(xgEventName, data
|
|
13017
|
+
this._player.emit(xgEventName, data);
|
|
12873
13018
|
}
|
|
13019
|
+
/**
|
|
13020
|
+
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13021
|
+
*/
|
|
12874
13022
|
offAll() {
|
|
12875
13023
|
this._events = {};
|
|
12876
13024
|
this._player.offAll();
|
|
12877
13025
|
}
|
|
12878
|
-
|
|
13026
|
+
/**
|
|
13027
|
+
* @brief 调用此方法监听指定事件。
|
|
13028
|
+
* @param event 事件。
|
|
13029
|
+
* @param callback 事件回调。
|
|
13030
|
+
*/
|
|
13031
|
+
on(event, callback) {
|
|
12879
13032
|
var _a;
|
|
12880
13033
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
12881
13034
|
if (xgCallback) {
|
|
@@ -12883,56 +13036,105 @@ class VePlayerBase {
|
|
|
12883
13036
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
12884
13037
|
}
|
|
12885
13038
|
this._events[event].set(callback, xgCallback);
|
|
12886
|
-
this._player.on(xgEventName, xgCallback
|
|
13039
|
+
this._player.on(xgEventName, xgCallback);
|
|
12887
13040
|
}
|
|
12888
13041
|
}
|
|
13042
|
+
/**
|
|
13043
|
+
* @brief 调用此方法开始播放 。
|
|
13044
|
+
*/
|
|
12889
13045
|
play() {
|
|
12890
13046
|
/* istanbul ignore next -- @preserve */
|
|
12891
13047
|
return this._player.play();
|
|
12892
13048
|
}
|
|
13049
|
+
/**
|
|
13050
|
+
* @brief 调用此方法暂停播放。
|
|
13051
|
+
*/
|
|
12893
13052
|
pause() {
|
|
12894
13053
|
/* istanbul ignore next -- @preserve */
|
|
12895
13054
|
return this._player.pause();
|
|
12896
13055
|
}
|
|
13056
|
+
/**
|
|
13057
|
+
* @brief 调用此方法打开画中画。
|
|
13058
|
+
*/
|
|
12897
13059
|
requestPIP() {
|
|
12898
13060
|
var _a;
|
|
12899
13061
|
/* istanbul ignore next -- @preserve */
|
|
12900
13062
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
12901
13063
|
}
|
|
13064
|
+
/**
|
|
13065
|
+
* @brief 调用此方法关闭画中画。
|
|
13066
|
+
*/
|
|
12902
13067
|
exitPIP() {
|
|
12903
13068
|
var _a;
|
|
12904
13069
|
/* istanbul ignore next -- @preserve */
|
|
12905
13070
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
12906
13071
|
}
|
|
13072
|
+
/**
|
|
13073
|
+
* @brief 调用此方法重新拉流。
|
|
13074
|
+
*/
|
|
12907
13075
|
retry() {
|
|
12908
|
-
this._player.emit(Events.RETRY);
|
|
12909
13076
|
return this._player.retry();
|
|
12910
13077
|
}
|
|
13078
|
+
/**
|
|
13079
|
+
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13080
|
+
* @param data 播放器获取焦点配置信息。
|
|
13081
|
+
*/
|
|
12911
13082
|
focus(data) {
|
|
12912
13083
|
return this._player.focus(data);
|
|
12913
13084
|
}
|
|
13085
|
+
/**
|
|
13086
|
+
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13087
|
+
* @param data 播放器失去焦点配置信息。
|
|
13088
|
+
*/
|
|
12914
13089
|
blur(data) {
|
|
12915
13090
|
return this._player.blur(data);
|
|
12916
13091
|
}
|
|
13092
|
+
/**
|
|
13093
|
+
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13094
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13095
|
+
*/
|
|
12917
13096
|
getFullscreen(el) {
|
|
12918
13097
|
return this._player.getFullscreen(el);
|
|
12919
13098
|
}
|
|
13099
|
+
/**
|
|
13100
|
+
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13101
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13102
|
+
*/
|
|
12920
13103
|
exitFullscreen(el) {
|
|
12921
13104
|
return this._player.exitFullscreen(el);
|
|
12922
13105
|
}
|
|
13106
|
+
/**
|
|
13107
|
+
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13108
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13109
|
+
*/
|
|
12923
13110
|
getCssFullscreen(el) {
|
|
12924
13111
|
return this._player.getCssFullscreen(el);
|
|
12925
13112
|
}
|
|
13113
|
+
/**
|
|
13114
|
+
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13115
|
+
*/
|
|
12926
13116
|
exitCssFullscreen() {
|
|
12927
13117
|
return this._player.exitCssFullscreen();
|
|
12928
13118
|
}
|
|
13119
|
+
/**
|
|
13120
|
+
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13121
|
+
* @param plugin 插件构造函数。
|
|
13122
|
+
* @param config 插件的配置列表。
|
|
13123
|
+
*/
|
|
12929
13124
|
registerPlugin(plugin, config) {
|
|
12930
13125
|
return this._player.registerPlugin(plugin, config);
|
|
12931
13126
|
}
|
|
12932
|
-
|
|
12933
|
-
|
|
13127
|
+
/**
|
|
13128
|
+
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13129
|
+
* @param plugin 插件实例或者插件名称。
|
|
13130
|
+
*/
|
|
13131
|
+
unRegisterPlugin(plugin) {
|
|
13132
|
+
return this._player.unRegisterPlugin(plugin);
|
|
12934
13133
|
}
|
|
12935
|
-
|
|
13134
|
+
/**
|
|
13135
|
+
* @brief 调用此接口显示指定插件图标。
|
|
13136
|
+
* @param pluginNames 插件名称
|
|
13137
|
+
*/
|
|
12936
13138
|
showIcon(pluginNames) {
|
|
12937
13139
|
const morePlugin = this._player.getPlugin("more");
|
|
12938
13140
|
pluginNames.forEach((pluginName) => {
|
|
@@ -12946,7 +13148,10 @@ class VePlayerBase {
|
|
|
12946
13148
|
}
|
|
12947
13149
|
});
|
|
12948
13150
|
}
|
|
12949
|
-
|
|
13151
|
+
/**
|
|
13152
|
+
* @brief 调用此接口隐藏指定插件图标。
|
|
13153
|
+
* @param pluginNames 插件名称
|
|
13154
|
+
*/
|
|
12950
13155
|
hideIcon(pluginNames) {
|
|
12951
13156
|
const morePlugin = this._player.getPlugin("more");
|
|
12952
13157
|
pluginNames.forEach((pluginName) => {
|
|
@@ -12960,10 +13165,16 @@ class VePlayerBase {
|
|
|
12960
13165
|
}
|
|
12961
13166
|
});
|
|
12962
13167
|
}
|
|
13168
|
+
/**
|
|
13169
|
+
* @brief 调用此方法销毁播放器实例。
|
|
13170
|
+
*/
|
|
12963
13171
|
destroy() {
|
|
12964
13172
|
this._player.off(ERROR, this._errorCallback);
|
|
12965
13173
|
this._player.destroy();
|
|
12966
13174
|
}
|
|
13175
|
+
/**
|
|
13176
|
+
* @hidden
|
|
13177
|
+
*/
|
|
12967
13178
|
async prepare(url) {
|
|
12968
13179
|
var _a, _b;
|
|
12969
13180
|
const result = await ((_a = this._preparePlugins) == null ? void 0 : _a.call(this, url));
|