@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,21 @@ 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 Degradation = /* @__PURE__ */ ((Degradation2) => {
|
|
13
|
+
Degradation2["SoftFirst"] = "soft-first";
|
|
14
|
+
Degradation2["H264First"] = "h264-first";
|
|
15
|
+
return Degradation2;
|
|
16
|
+
})(Degradation || {});
|
|
17
|
+
var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
|
|
18
|
+
DecodeType2["Software"] = "software";
|
|
19
|
+
DecodeType2["Hardware"] = "hardware";
|
|
20
|
+
return DecodeType2;
|
|
21
|
+
})(DecodeType || {});
|
|
7
22
|
function ownKeys$1(object, enumerableOnly) {
|
|
8
23
|
var keys = Object.keys(object);
|
|
9
24
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -6127,7 +6142,7 @@ var ErrorCode$1 = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
6127
6142
|
ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
|
|
6128
6143
|
ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
|
|
6129
6144
|
ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
|
|
6130
|
-
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] =
|
|
6145
|
+
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
|
|
6131
6146
|
ErrorCode2["UNKNOWN"] = "UNKNOWN";
|
|
6132
6147
|
return ErrorCode2;
|
|
6133
6148
|
})(ErrorCode$1 || {});
|
|
@@ -6224,7 +6239,7 @@ const ERROR_INFO = {
|
|
|
6224
6239
|
/* Error */
|
|
6225
6240
|
},
|
|
6226
6241
|
[
|
|
6227
|
-
|
|
6242
|
+
110
|
|
6228
6243
|
/* MODULE_LOAD_ERROR */
|
|
6229
6244
|
]: {
|
|
6230
6245
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
@@ -6299,6 +6314,11 @@ const ERROR_TYPE_INFO = {
|
|
|
6299
6314
|
}
|
|
6300
6315
|
};
|
|
6301
6316
|
let VeError$1 = class VeError extends Error {
|
|
6317
|
+
/**
|
|
6318
|
+
* @hidden
|
|
6319
|
+
* @param error
|
|
6320
|
+
* @param i18n
|
|
6321
|
+
*/
|
|
6302
6322
|
constructor(error2, i18n) {
|
|
6303
6323
|
var _a;
|
|
6304
6324
|
const errorInfo = typeof error2 === "string" ? {
|
|
@@ -6306,8 +6326,17 @@ let VeError$1 = class VeError extends Error {
|
|
|
6306
6326
|
} : error2;
|
|
6307
6327
|
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"));
|
|
6308
6328
|
super(message);
|
|
6329
|
+
/**
|
|
6330
|
+
* @brief 错误码,对应[错误码字典](#错误码)。
|
|
6331
|
+
*/
|
|
6309
6332
|
__publicField(this, "errorCode");
|
|
6333
|
+
/**
|
|
6334
|
+
* @brief 错误等级。
|
|
6335
|
+
*/
|
|
6310
6336
|
__publicField(this, "level");
|
|
6337
|
+
/**
|
|
6338
|
+
* @brief 其他错误信息。
|
|
6339
|
+
*/
|
|
6311
6340
|
__publicField(this, "ext");
|
|
6312
6341
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6313
6342
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -10775,12 +10804,13 @@ class MobilePlayerPanel {
|
|
|
10775
10804
|
}
|
|
10776
10805
|
}
|
|
10777
10806
|
var optionsIcon = "";
|
|
10778
|
-
|
|
10779
|
-
Middle
|
|
10780
|
-
Bottom
|
|
10781
|
-
Fullscreen
|
|
10782
|
-
Inner
|
|
10783
|
-
|
|
10807
|
+
var ListType = /* @__PURE__ */ ((ListType2) => {
|
|
10808
|
+
ListType2["Middle"] = "middle";
|
|
10809
|
+
ListType2["Bottom"] = "bottom";
|
|
10810
|
+
ListType2["Fullscreen"] = "fullscreen";
|
|
10811
|
+
ListType2["Inner"] = "inner";
|
|
10812
|
+
return ListType2;
|
|
10813
|
+
})(ListType || {});
|
|
10784
10814
|
var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
10785
10815
|
RenderType2["Icon"] = "Icon";
|
|
10786
10816
|
RenderType2["Text"] = "Text";
|
|
@@ -10788,20 +10818,26 @@ var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
|
10788
10818
|
})(RenderType || {});
|
|
10789
10819
|
const isMobile$1 = sniffer$1.device === "mobile";
|
|
10790
10820
|
const MOBILE_LIST_TYPES = [
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10821
|
+
"bottom",
|
|
10822
|
+
"fullscreen",
|
|
10823
|
+
"inner"
|
|
10824
|
+
/* Inner */
|
|
10825
|
+
];
|
|
10826
|
+
const PC_LIST_TYPES = [
|
|
10827
|
+
"middle"
|
|
10828
|
+
/* Middle */
|
|
10794
10829
|
];
|
|
10795
|
-
const PC_LIST_TYPES = [ListType.Middle];
|
|
10796
10830
|
const MODAL_TYPES = [
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10831
|
+
"bottom",
|
|
10832
|
+
"inner",
|
|
10833
|
+
"fullscreen"
|
|
10834
|
+
/* Fullscreen */
|
|
10800
10835
|
];
|
|
10801
10836
|
const CUSTOM_TYPES = [
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10837
|
+
"bottom",
|
|
10838
|
+
"inner",
|
|
10839
|
+
"fullscreen"
|
|
10840
|
+
/* Fullscreen */
|
|
10805
10841
|
];
|
|
10806
10842
|
class OptionsIcon extends Plugin {
|
|
10807
10843
|
constructor(args) {
|
|
@@ -10839,7 +10875,7 @@ class OptionsIcon extends Plugin {
|
|
|
10839
10875
|
// 默认手机端在“右上角”,pc端在控制栏右侧
|
|
10840
10876
|
position: isMobile$1 ? POSITIONS$1.ROOT_TOP_RIGHT : POSITIONS$1.CONTROLS_RIGHT,
|
|
10841
10877
|
// 默认手机端列表展示底部,pc端在控制栏默认
|
|
10842
|
-
listType: isMobile$1 ?
|
|
10878
|
+
listType: isMobile$1 ? "bottom" : "middle",
|
|
10843
10879
|
index: 100,
|
|
10844
10880
|
list: [],
|
|
10845
10881
|
listStyle: {},
|
|
@@ -11021,10 +11057,10 @@ class OptionsIcon extends Plugin {
|
|
|
11021
11057
|
listType = this.player.config.listType;
|
|
11022
11058
|
}
|
|
11023
11059
|
if (!isMobile$1 && (!listType || !MOBILE_LIST_TYPES.includes(listType))) {
|
|
11024
|
-
listType =
|
|
11060
|
+
listType = "bottom";
|
|
11025
11061
|
}
|
|
11026
11062
|
if (!isMobile$1 && (!listType || !PC_LIST_TYPES.includes(listType))) {
|
|
11027
|
-
listType =
|
|
11063
|
+
listType = "middle";
|
|
11028
11064
|
}
|
|
11029
11065
|
return listType;
|
|
11030
11066
|
}
|
|
@@ -12778,21 +12814,6 @@ class VeI18n {
|
|
|
12778
12814
|
}
|
|
12779
12815
|
}
|
|
12780
12816
|
var veplayerBase = "";
|
|
12781
|
-
var Codec = /* @__PURE__ */ ((Codec2) => {
|
|
12782
|
-
Codec2["H265"] = "h265";
|
|
12783
|
-
Codec2["H264"] = "h264";
|
|
12784
|
-
return Codec2;
|
|
12785
|
-
})(Codec || {});
|
|
12786
|
-
var Degradation = /* @__PURE__ */ ((Degradation2) => {
|
|
12787
|
-
Degradation2["SoftFirst"] = "soft-first";
|
|
12788
|
-
Degradation2["H264First"] = "h264-first";
|
|
12789
|
-
return Degradation2;
|
|
12790
|
-
})(Degradation || {});
|
|
12791
|
-
var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
|
|
12792
|
-
DecodeType2["Software"] = "software";
|
|
12793
|
-
DecodeType2["Hardware"] = "hardware";
|
|
12794
|
-
return DecodeType2;
|
|
12795
|
-
})(DecodeType || {});
|
|
12796
12817
|
const { POSITIONS: XGPosition } = Plugin;
|
|
12797
12818
|
const POSITIONS$1 = {
|
|
12798
12819
|
...XGPosition,
|
|
@@ -12802,7 +12823,7 @@ const DEFAULT_OPTIONS = {
|
|
|
12802
12823
|
id: "veplayer",
|
|
12803
12824
|
width: "100%",
|
|
12804
12825
|
height: "100%",
|
|
12805
|
-
decodeType:
|
|
12826
|
+
decodeType: DecodeType.Hardware,
|
|
12806
12827
|
fullscreen: {
|
|
12807
12828
|
useCssFullscreen: false
|
|
12808
12829
|
}
|
|
@@ -12830,6 +12851,9 @@ const transformOption = (options) => {
|
|
|
12830
12851
|
return xgOptions;
|
|
12831
12852
|
};
|
|
12832
12853
|
class VePlayerBase {
|
|
12854
|
+
/**
|
|
12855
|
+
* @hidden
|
|
12856
|
+
*/
|
|
12833
12857
|
constructor(options = {}) {
|
|
12834
12858
|
__publicField(this, "_player");
|
|
12835
12859
|
__publicField(this, "_sourceManager");
|
|
@@ -12881,74 +12905,162 @@ class VePlayerBase {
|
|
|
12881
12905
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
12882
12906
|
this._player.on(ERROR, this._errorCallback);
|
|
12883
12907
|
}
|
|
12908
|
+
/**
|
|
12909
|
+
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
12910
|
+
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
12911
|
+
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
12912
|
+
* - `2`:HAVE_CURRENT_DATA,当前播放位置的数据可用,但不足以播放下一帧
|
|
12913
|
+
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
12914
|
+
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
12915
|
+
*/
|
|
12884
12916
|
get readyState() {
|
|
12885
12917
|
return this._player.readyState;
|
|
12886
12918
|
}
|
|
12919
|
+
/**
|
|
12920
|
+
* @brief 获取当前已缓冲的时间范围。
|
|
12921
|
+
*/
|
|
12887
12922
|
get buffered() {
|
|
12888
12923
|
return this._player.buffered;
|
|
12889
12924
|
}
|
|
12925
|
+
/**
|
|
12926
|
+
* @brief 获取已经播放的音频/视频的时间范围。
|
|
12927
|
+
*/
|
|
12890
12928
|
get played() {
|
|
12891
12929
|
return this._player.played;
|
|
12892
12930
|
}
|
|
12931
|
+
/**
|
|
12932
|
+
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
12933
|
+
*/
|
|
12893
12934
|
get cumulateTime() {
|
|
12894
12935
|
return this._player.cumulateTime;
|
|
12895
12936
|
}
|
|
12937
|
+
/**
|
|
12938
|
+
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
12939
|
+
*/
|
|
12896
12940
|
get isFocused() {
|
|
12897
12941
|
return this._player.isActive;
|
|
12898
12942
|
}
|
|
12943
|
+
/**
|
|
12944
|
+
* @brief 获取播放器是否处于全屏状态。
|
|
12945
|
+
*/
|
|
12899
12946
|
get isFullscreen() {
|
|
12900
12947
|
return this._player.isFullscreen;
|
|
12901
12948
|
}
|
|
12949
|
+
/**
|
|
12950
|
+
* @brief 获取播放器是否处于网页全屏状态。
|
|
12951
|
+
*/
|
|
12902
12952
|
get isCssFullscreen() {
|
|
12903
12953
|
return this._player.isCssfullScreen;
|
|
12904
12954
|
}
|
|
12955
|
+
/**
|
|
12956
|
+
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
12957
|
+
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
12958
|
+
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
12959
|
+
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
12960
|
+
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
12961
|
+
*/
|
|
12905
12962
|
get networkState() {
|
|
12906
12963
|
return this._player.networkState;
|
|
12907
12964
|
}
|
|
12965
|
+
/**
|
|
12966
|
+
* @brief 获取当前视频是否处于暂停状态。
|
|
12967
|
+
*/
|
|
12908
12968
|
get paused() {
|
|
12909
12969
|
return this._player.paused;
|
|
12910
12970
|
}
|
|
12971
|
+
/**
|
|
12972
|
+
* @brief 获取当前视频是否播放结束。
|
|
12973
|
+
*/
|
|
12911
12974
|
get ended() {
|
|
12912
12975
|
return this._player.ended;
|
|
12913
12976
|
}
|
|
12977
|
+
/**
|
|
12978
|
+
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
12979
|
+
* - `0`:ERROR,播放出现错误
|
|
12980
|
+
* - `1`:INITIAL,初始化
|
|
12981
|
+
* - `2`:READY,配置/事件/插件等均已经初始化/绑定/实例化完成
|
|
12982
|
+
* - `3`:ATTACHING,进入媒体对象挂载阶段
|
|
12983
|
+
* - `4`:ATTACHED,媒体对象已经挂载到了 DOM 中
|
|
12984
|
+
* - `5`:NOTALLOW,播放被阻止
|
|
12985
|
+
* - `6`:RUNNING,已经成功起播进入播放流程
|
|
12986
|
+
* - `7`:ENDED,播放结束
|
|
12987
|
+
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
12988
|
+
*/
|
|
12914
12989
|
get state() {
|
|
12915
12990
|
return this._player.state;
|
|
12916
12991
|
}
|
|
12992
|
+
/**
|
|
12993
|
+
* 获取当前播放视频的拉流地址。
|
|
12994
|
+
*/
|
|
12917
12995
|
get url() {
|
|
12918
12996
|
return this._player.config.url;
|
|
12919
12997
|
}
|
|
12998
|
+
/**
|
|
12999
|
+
* @brief 获取当播放视频的线路名称唯一标识(name)。
|
|
13000
|
+
*/
|
|
12920
13001
|
get source() {
|
|
12921
13002
|
var _a;
|
|
12922
13003
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
12923
13004
|
}
|
|
13005
|
+
/**
|
|
13006
|
+
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13007
|
+
*/
|
|
12924
13008
|
get definition() {
|
|
12925
13009
|
var _a;
|
|
12926
13010
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
12927
13011
|
}
|
|
13012
|
+
/**
|
|
13013
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13014
|
+
*/
|
|
12928
13015
|
get crossOrigin() {
|
|
12929
13016
|
return this._player.crossOrigin;
|
|
12930
13017
|
}
|
|
13018
|
+
/**
|
|
13019
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13020
|
+
*/
|
|
12931
13021
|
set crossOrigin(crossOrigin) {
|
|
12932
13022
|
this._player.crossOrigin = crossOrigin;
|
|
12933
13023
|
}
|
|
13024
|
+
/**
|
|
13025
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13026
|
+
*/
|
|
12934
13027
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12935
13028
|
get volume() {
|
|
12936
13029
|
return this._player.volume;
|
|
12937
13030
|
}
|
|
13031
|
+
/**
|
|
13032
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13033
|
+
*/
|
|
12938
13034
|
set volume(volume) {
|
|
12939
13035
|
this._player.volume = volume;
|
|
12940
13036
|
}
|
|
13037
|
+
/**
|
|
13038
|
+
* @brief 获取和设置视频静音状态。
|
|
13039
|
+
* - `true`:静音
|
|
13040
|
+
* - `false`:非静音
|
|
13041
|
+
*/
|
|
12941
13042
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12942
13043
|
get muted() {
|
|
12943
13044
|
return this._player.muted;
|
|
12944
13045
|
}
|
|
13046
|
+
/**
|
|
13047
|
+
* @brief 获取和设置视频静音状态。
|
|
13048
|
+
* - `true`:静音
|
|
13049
|
+
* - `false`:非静音
|
|
13050
|
+
*/
|
|
12945
13051
|
set muted(isMuted) {
|
|
12946
13052
|
this._player.muted = isMuted;
|
|
12947
13053
|
}
|
|
13054
|
+
/**
|
|
13055
|
+
* @brief 获取和设置当前语言。
|
|
13056
|
+
*/
|
|
12948
13057
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12949
13058
|
get lang() {
|
|
12950
13059
|
return this._i18nManager.getLang();
|
|
12951
13060
|
}
|
|
13061
|
+
/**
|
|
13062
|
+
* @brief 获取和设置当前语言。
|
|
13063
|
+
*/
|
|
12952
13064
|
set lang(lang) {
|
|
12953
13065
|
var _a, _b;
|
|
12954
13066
|
if (this._player.lang === lang) {
|
|
@@ -12970,6 +13082,9 @@ class VePlayerBase {
|
|
|
12970
13082
|
get _src() {
|
|
12971
13083
|
return this._player.currentSrc;
|
|
12972
13084
|
}
|
|
13085
|
+
/**
|
|
13086
|
+
* @hidden
|
|
13087
|
+
*/
|
|
12973
13088
|
static async create(options = {}, Constructor) {
|
|
12974
13089
|
var _a;
|
|
12975
13090
|
const sourceManager = new SourceManager({
|
|
@@ -12991,6 +13106,11 @@ class VePlayerBase {
|
|
|
12991
13106
|
sourceManager
|
|
12992
13107
|
});
|
|
12993
13108
|
}
|
|
13109
|
+
/**
|
|
13110
|
+
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13111
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13112
|
+
* @param options 更多配置信息
|
|
13113
|
+
*/
|
|
12994
13114
|
async switch(target, options) {
|
|
12995
13115
|
var _a, _b;
|
|
12996
13116
|
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) {
|
|
@@ -13007,12 +13127,22 @@ class VePlayerBase {
|
|
|
13007
13127
|
await this._switch(targetDefinition);
|
|
13008
13128
|
return targetDefinition;
|
|
13009
13129
|
}
|
|
13130
|
+
/**
|
|
13131
|
+
* @brief 调用此方法更新拉流地址列表。
|
|
13132
|
+
* @param playlist 要更新的播放列表。
|
|
13133
|
+
* @param target 更新后默认播放的资源。
|
|
13134
|
+
*/
|
|
13010
13135
|
updatePlaylist(playlist, target) {
|
|
13011
13136
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
13012
13137
|
return this._switch(sourceManager.definition);
|
|
13013
13138
|
}
|
|
13014
13139
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13015
|
-
|
|
13140
|
+
/**
|
|
13141
|
+
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13142
|
+
* @param event 表示事件的名称。
|
|
13143
|
+
* @param callback 表示事件的名称。
|
|
13144
|
+
*/
|
|
13145
|
+
once(event, callback) {
|
|
13016
13146
|
var _a;
|
|
13017
13147
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
13018
13148
|
if (xgCallback) {
|
|
@@ -13020,27 +13150,45 @@ class VePlayerBase {
|
|
|
13020
13150
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
13021
13151
|
}
|
|
13022
13152
|
this._events[event].set(callback, xgCallback);
|
|
13023
|
-
this._player.once(xgEventName, xgCallback
|
|
13153
|
+
this._player.once(xgEventName, xgCallback);
|
|
13024
13154
|
}
|
|
13025
13155
|
}
|
|
13026
|
-
|
|
13156
|
+
/**
|
|
13157
|
+
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13158
|
+
* @param event 表示事件的名称。
|
|
13159
|
+
* @param callback 表示事件的名称。
|
|
13160
|
+
*/
|
|
13161
|
+
off(event, callback) {
|
|
13027
13162
|
var _a;
|
|
13028
13163
|
const xgCallback = (_a = this._events[event]) == null ? void 0 : _a.get(callback);
|
|
13029
13164
|
const { xgEventName } = this._transformEvent(event);
|
|
13030
13165
|
if (xgCallback) {
|
|
13031
|
-
this._player.off(xgEventName, xgCallback
|
|
13166
|
+
this._player.off(xgEventName, xgCallback);
|
|
13032
13167
|
this._events[event].delete(callback);
|
|
13033
13168
|
}
|
|
13034
13169
|
}
|
|
13035
|
-
|
|
13170
|
+
/**
|
|
13171
|
+
* @brief 调用此方法触发指定事件。
|
|
13172
|
+
* @param event 表示事件的名称。
|
|
13173
|
+
* @param data 事件信息。
|
|
13174
|
+
*/
|
|
13175
|
+
emit(event, data) {
|
|
13036
13176
|
const { xgEventName } = this._transformEvent(event);
|
|
13037
|
-
this._player.emit(xgEventName, data
|
|
13177
|
+
this._player.emit(xgEventName, data);
|
|
13038
13178
|
}
|
|
13179
|
+
/**
|
|
13180
|
+
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13181
|
+
*/
|
|
13039
13182
|
offAll() {
|
|
13040
13183
|
this._events = {};
|
|
13041
13184
|
this._player.offAll();
|
|
13042
13185
|
}
|
|
13043
|
-
|
|
13186
|
+
/**
|
|
13187
|
+
* @brief 调用此方法监听指定事件。
|
|
13188
|
+
* @param event 事件。
|
|
13189
|
+
* @param callback 事件回调。
|
|
13190
|
+
*/
|
|
13191
|
+
on(event, callback) {
|
|
13044
13192
|
var _a;
|
|
13045
13193
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
13046
13194
|
if (xgCallback) {
|
|
@@ -13048,56 +13196,105 @@ class VePlayerBase {
|
|
|
13048
13196
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
13049
13197
|
}
|
|
13050
13198
|
this._events[event].set(callback, xgCallback);
|
|
13051
|
-
this._player.on(xgEventName, xgCallback
|
|
13199
|
+
this._player.on(xgEventName, xgCallback);
|
|
13052
13200
|
}
|
|
13053
13201
|
}
|
|
13202
|
+
/**
|
|
13203
|
+
* @brief 调用此方法开始播放 。
|
|
13204
|
+
*/
|
|
13054
13205
|
play() {
|
|
13055
13206
|
/* istanbul ignore next -- @preserve */
|
|
13056
13207
|
return this._player.play();
|
|
13057
13208
|
}
|
|
13209
|
+
/**
|
|
13210
|
+
* @brief 调用此方法暂停播放。
|
|
13211
|
+
*/
|
|
13058
13212
|
pause() {
|
|
13059
13213
|
/* istanbul ignore next -- @preserve */
|
|
13060
13214
|
return this._player.pause();
|
|
13061
13215
|
}
|
|
13216
|
+
/**
|
|
13217
|
+
* @brief 调用此方法打开画中画。
|
|
13218
|
+
*/
|
|
13062
13219
|
requestPIP() {
|
|
13063
13220
|
var _a;
|
|
13064
13221
|
/* istanbul ignore next -- @preserve */
|
|
13065
13222
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
13066
13223
|
}
|
|
13224
|
+
/**
|
|
13225
|
+
* @brief 调用此方法关闭画中画。
|
|
13226
|
+
*/
|
|
13067
13227
|
exitPIP() {
|
|
13068
13228
|
var _a;
|
|
13069
13229
|
/* istanbul ignore next -- @preserve */
|
|
13070
13230
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
13071
13231
|
}
|
|
13232
|
+
/**
|
|
13233
|
+
* @brief 调用此方法重新拉流。
|
|
13234
|
+
*/
|
|
13072
13235
|
retry() {
|
|
13073
|
-
this._player.emit(Events$1.RETRY);
|
|
13074
13236
|
return this._player.retry();
|
|
13075
13237
|
}
|
|
13238
|
+
/**
|
|
13239
|
+
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13240
|
+
* @param data 播放器获取焦点配置信息。
|
|
13241
|
+
*/
|
|
13076
13242
|
focus(data) {
|
|
13077
13243
|
return this._player.focus(data);
|
|
13078
13244
|
}
|
|
13245
|
+
/**
|
|
13246
|
+
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13247
|
+
* @param data 播放器失去焦点配置信息。
|
|
13248
|
+
*/
|
|
13079
13249
|
blur(data) {
|
|
13080
13250
|
return this._player.blur(data);
|
|
13081
13251
|
}
|
|
13252
|
+
/**
|
|
13253
|
+
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13254
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13255
|
+
*/
|
|
13082
13256
|
getFullscreen(el) {
|
|
13083
13257
|
return this._player.getFullscreen(el);
|
|
13084
13258
|
}
|
|
13259
|
+
/**
|
|
13260
|
+
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13261
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13262
|
+
*/
|
|
13085
13263
|
exitFullscreen(el) {
|
|
13086
13264
|
return this._player.exitFullscreen(el);
|
|
13087
13265
|
}
|
|
13266
|
+
/**
|
|
13267
|
+
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13268
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13269
|
+
*/
|
|
13088
13270
|
getCssFullscreen(el) {
|
|
13089
13271
|
return this._player.getCssFullscreen(el);
|
|
13090
13272
|
}
|
|
13273
|
+
/**
|
|
13274
|
+
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13275
|
+
*/
|
|
13091
13276
|
exitCssFullscreen() {
|
|
13092
13277
|
return this._player.exitCssFullscreen();
|
|
13093
13278
|
}
|
|
13279
|
+
/**
|
|
13280
|
+
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13281
|
+
* @param plugin 插件构造函数。
|
|
13282
|
+
* @param config 插件的配置列表。
|
|
13283
|
+
*/
|
|
13094
13284
|
registerPlugin(plugin, config) {
|
|
13095
13285
|
return this._player.registerPlugin(plugin, config);
|
|
13096
13286
|
}
|
|
13097
|
-
|
|
13098
|
-
|
|
13287
|
+
/**
|
|
13288
|
+
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13289
|
+
* @param plugin 插件实例或者插件名称。
|
|
13290
|
+
*/
|
|
13291
|
+
unRegisterPlugin(plugin) {
|
|
13292
|
+
return this._player.unRegisterPlugin(plugin);
|
|
13099
13293
|
}
|
|
13100
|
-
|
|
13294
|
+
/**
|
|
13295
|
+
* @brief 调用此接口显示指定插件图标。
|
|
13296
|
+
* @param pluginNames 插件名称
|
|
13297
|
+
*/
|
|
13101
13298
|
showIcon(pluginNames) {
|
|
13102
13299
|
const morePlugin = this._player.getPlugin("more");
|
|
13103
13300
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13111,7 +13308,10 @@ class VePlayerBase {
|
|
|
13111
13308
|
}
|
|
13112
13309
|
});
|
|
13113
13310
|
}
|
|
13114
|
-
|
|
13311
|
+
/**
|
|
13312
|
+
* @brief 调用此接口隐藏指定插件图标。
|
|
13313
|
+
* @param pluginNames 插件名称
|
|
13314
|
+
*/
|
|
13115
13315
|
hideIcon(pluginNames) {
|
|
13116
13316
|
const morePlugin = this._player.getPlugin("more");
|
|
13117
13317
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13125,10 +13325,16 @@ class VePlayerBase {
|
|
|
13125
13325
|
}
|
|
13126
13326
|
});
|
|
13127
13327
|
}
|
|
13328
|
+
/**
|
|
13329
|
+
* @brief 调用此方法销毁播放器实例。
|
|
13330
|
+
*/
|
|
13128
13331
|
destroy() {
|
|
13129
13332
|
this._player.off(ERROR, this._errorCallback);
|
|
13130
13333
|
this._player.destroy();
|
|
13131
13334
|
}
|
|
13335
|
+
/**
|
|
13336
|
+
* @hidden
|
|
13337
|
+
*/
|
|
13132
13338
|
async prepare(url) {
|
|
13133
13339
|
var _a, _b;
|
|
13134
13340
|
const result = await ((_a = this._preparePlugins) == null ? void 0 : _a.call(this, url));
|
|
@@ -17755,7 +17961,7 @@ const getFlvStrategy = async (options) => {
|
|
|
17755
17961
|
let mseStrategy;
|
|
17756
17962
|
let softStrategy;
|
|
17757
17963
|
const codec = await getCodec(options);
|
|
17758
|
-
const isSoftDecode$1 =
|
|
17964
|
+
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
17759
17965
|
if (isSoftDecode$1) {
|
|
17760
17966
|
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
17761
17967
|
mseStrategy = createFlvMseStrategy(options);
|
|
@@ -17782,7 +17988,7 @@ const getHlsStrategy = async (options) => {
|
|
|
17782
17988
|
let mseStrategy;
|
|
17783
17989
|
let softStrategy;
|
|
17784
17990
|
const codec = await getCodec(options);
|
|
17785
|
-
const isSoftDecode$1 =
|
|
17991
|
+
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
17786
17992
|
if (isSoftDecode$1) {
|
|
17787
17993
|
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
17788
17994
|
mseStrategy = createHlsMseStrategy(options);
|
|
@@ -17888,10 +18094,13 @@ async function detectCodec(url) {
|
|
|
17888
18094
|
return "unknown";
|
|
17889
18095
|
}
|
|
17890
18096
|
}
|
|
17891
|
-
async function isSoftDecode(options) {
|
|
18097
|
+
async function isSoftDecode(options, currentCodec) {
|
|
17892
18098
|
if (options.decodeType === DecodeType.Software) {
|
|
17893
18099
|
return true;
|
|
17894
18100
|
}
|
|
18101
|
+
if (currentCodec === "unknown") {
|
|
18102
|
+
return false;
|
|
18103
|
+
}
|
|
17895
18104
|
const codec = await getCodec(options);
|
|
17896
18105
|
if (codec === Codec.H265) {
|
|
17897
18106
|
if (sniffer$1.isHevcSupported()) {
|
|
@@ -17911,7 +18120,7 @@ function combineOptions(strategyList) {
|
|
|
17911
18120
|
}
|
|
17912
18121
|
const { VeError: VeError2 } = error$1;
|
|
17913
18122
|
var LiveErrorCode = /* @__PURE__ */ ((LiveErrorCode2) => {
|
|
17914
|
-
LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] =
|
|
18123
|
+
LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 210] = "INVALID_PARAMETER";
|
|
17915
18124
|
return LiveErrorCode2;
|
|
17916
18125
|
})(LiveErrorCode || {});
|
|
17917
18126
|
const ErrorCode = {
|
|
@@ -17921,7 +18130,7 @@ const ErrorCode = {
|
|
|
17921
18130
|
const ERRORS = {
|
|
17922
18131
|
...ERROR_INFO,
|
|
17923
18132
|
[
|
|
17924
|
-
|
|
18133
|
+
210
|
|
17925
18134
|
/* INVALID_PARAMETER */
|
|
17926
18135
|
]: {
|
|
17927
18136
|
messageTextKey: "INVALID_PARAMETER",
|
|
@@ -17970,10 +18179,11 @@ const isRTMSupported = async () => {
|
|
|
17970
18179
|
const Rtm = await load(DynamicModule.PluginRtm);
|
|
17971
18180
|
return Rtm.isSupported();
|
|
17972
18181
|
};
|
|
17973
|
-
const isRTMSupportCodec = async (codec = "h264"
|
|
18182
|
+
const isRTMSupportCodec = async (codec = "h264") => {
|
|
17974
18183
|
const Rtm = await load(DynamicModule.PluginRtm);
|
|
17975
18184
|
if (codec === "h264")
|
|
17976
|
-
return Rtm.isSupportedH264(
|
|
18185
|
+
return Rtm.isSupportedH264();
|
|
18186
|
+
return false;
|
|
17977
18187
|
};
|
|
17978
18188
|
const getTypeStrategy = async (options) => {
|
|
17979
18189
|
const type = options.url ? util.getStreamType(options.url) : "";
|
|
@@ -20670,7 +20880,7 @@ class Logger extends Plugin {
|
|
|
20670
20880
|
user_id: this._userId,
|
|
20671
20881
|
device_id: this._deviceId,
|
|
20672
20882
|
ext: {
|
|
20673
|
-
veplayer_version: "2.0.0-rc.
|
|
20883
|
+
veplayer_version: "2.0.0-rc.2",
|
|
20674
20884
|
flv_version: "3.0.0-next.23",
|
|
20675
20885
|
hls_version: "3.0.0-next.36-1",
|
|
20676
20886
|
rts_version: "0.2.0-alpha.3"
|
|
@@ -20951,18 +21161,38 @@ const LIVE_DEFAULT_OPTIONS = {
|
|
|
20951
21161
|
};
|
|
20952
21162
|
const LIVE_DEFAULT_PLUGINS = [...DEFAULT_PLUGINS, Refresh, Logger, InfoPanel];
|
|
20953
21163
|
class VePlayerLive extends VePlayerBase {
|
|
21164
|
+
/**
|
|
21165
|
+
* @hidden
|
|
21166
|
+
* @param options
|
|
21167
|
+
*/
|
|
21168
|
+
constructor(options) {
|
|
21169
|
+
super(options);
|
|
21170
|
+
}
|
|
21171
|
+
/** {zh}
|
|
21172
|
+
* @brief 调用此方法开启直播日志上报。
|
|
21173
|
+
*/
|
|
20954
21174
|
openLog() {
|
|
20955
21175
|
var _a;
|
|
20956
21176
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.open();
|
|
20957
21177
|
}
|
|
21178
|
+
/** {zh}
|
|
21179
|
+
* @brief 调用此方法关闭直播日志上报。
|
|
21180
|
+
*/
|
|
20958
21181
|
closeLog() {
|
|
20959
21182
|
var _a;
|
|
20960
21183
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.close();
|
|
20961
21184
|
}
|
|
21185
|
+
/** {zh}
|
|
21186
|
+
* @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
|
|
21187
|
+
*/
|
|
20962
21188
|
openInfoPanel() {
|
|
20963
21189
|
var _a;
|
|
20964
21190
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
|
|
20965
21191
|
}
|
|
21192
|
+
/** {zh}
|
|
21193
|
+
* @brief 调用此方法关闭直播信息面板。
|
|
21194
|
+
*
|
|
21195
|
+
*/
|
|
20966
21196
|
closeInfoPanel() {
|
|
20967
21197
|
var _a;
|
|
20968
21198
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|