@polyv/wx-live-player-core 3.0.0 → 3.1.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.
Files changed (39) hide show
  1. package/README.md +144 -9
  2. package/api/api-url.d.ts +36 -0
  3. package/api/index.d.ts +75 -0
  4. package/api/request.d.ts +7 -0
  5. package/core.d.ts +98 -0
  6. package/events-type.d.ts +86 -0
  7. package/export.d.ts +4 -0
  8. package/index.d.ts +4 -0
  9. package/modules/auth/auth-module.d.ts +14 -0
  10. package/modules/auth/type.d.ts +18 -0
  11. package/modules/channel/channel-module.d.ts +23 -0
  12. package/modules/channel/type.d.ts +167 -0
  13. package/modules/level-control/level-control-module.d.ts +34 -0
  14. package/modules/line-control/line-control-module.d.ts +27 -0
  15. package/modules/live/live-module.d.ts +14 -0
  16. package/modules/module-base.d.ts +7 -0
  17. package/modules/monitor/monitor-module.d.ts +20 -0
  18. package/modules/playback/playback-module.d.ts +16 -0
  19. package/modules/qos/export.d.ts +1 -0
  20. package/modules/qos/qos-module.d.ts +58 -0
  21. package/modules/qos/type.d.ts +81 -0
  22. package/modules/quick-control/quick-control-module.d.ts +40 -0
  23. package/modules/restrict/restrict-module.d.ts +21 -0
  24. package/modules/restrict/type.d.ts +35 -0
  25. package/modules/statistics/statistics-module.d.ts +73 -0
  26. package/modules/status/export.d.ts +1 -0
  27. package/modules/status/status-module.d.ts +45 -0
  28. package/modules/status/type.d.ts +47 -0
  29. package/modules/warm/warm-module.d.ts +14 -0
  30. package/package.json +2 -18
  31. package/player.d.ts +151 -0
  32. package/polyv-live-player.d.ts +95 -0
  33. package/polyv-live-player.js +3 -3
  34. package/store/index.d.ts +12 -0
  35. package/store/types.d.ts +54 -0
  36. package/types/error-code.d.ts +24 -0
  37. package/types/index.d.ts +202 -0
  38. package/utils/index.d.ts +34 -0
  39. package/utils/stringByte.d.ts +13 -0
@@ -0,0 +1,202 @@
1
+ /**
2
+ * 是/否
3
+ */
4
+ export type YN = 'Y' | 'N';
5
+ /** 鉴权配置 */
6
+ export interface AuthSetting {
7
+ /** 应用ID */
8
+ appId: string;
9
+ /**
10
+ * 校验签名
11
+ * @example
12
+ * 签名计算示例,注意:请勿在前端代码出现明文appSecret,建议通过后端接口获取appSecret
13
+ * ```ts
14
+ * const params = {
15
+ * appId: appId,
16
+ * channelId: channelId,
17
+ * timestamp: new Date().getTime(),
18
+ * }
19
+ * const appSecret = '123456';
20
+ * const sign = md5(`${appId}${timestamp}${appSecret}`).toUpperCase();
21
+ * ```
22
+ */
23
+ sign: string;
24
+ /** 校验时间戳 */
25
+ timestamp: number;
26
+ }
27
+ /**
28
+ * 播放器初始化配置项
29
+ */
30
+ export interface PlayerConfig {
31
+ /**
32
+ * 鉴权参数
33
+ */
34
+ auth: AuthSetting;
35
+ /**
36
+ * 用户id
37
+ */
38
+ uid: string;
39
+ /**
40
+ * 频道id
41
+ */
42
+ cid: string;
43
+ /**
44
+ * 统计数据
45
+ */
46
+ statistics?: StatisticsSetting;
47
+ /**
48
+ * 回放地址
49
+ */
50
+ vodSrc?: string;
51
+ /**
52
+ * 回放时长
53
+ */
54
+ vodDuration?: number;
55
+ /**
56
+ * 自动切换直播和回放视频,默认false
57
+ */
58
+ isAutoChange?: boolean;
59
+ /**
60
+ * 是否强制使用video组件播放直播, 默认false
61
+ */
62
+ forceVideo?: boolean;
63
+ /**
64
+ * 默认使用线路
65
+ */
66
+ line?: number;
67
+ /**
68
+ * 默认使用清晰度
69
+ */
70
+ level?: number;
71
+ /**
72
+ * 鉴权token
73
+ */
74
+ xAuthToken?: string;
75
+ /**
76
+ * 延迟内核
77
+ */
78
+ playCore?: number;
79
+ }
80
+ /**
81
+ * 统计数据
82
+ */
83
+ export type StatisticsSetting = Partial<{
84
+ param1: string;
85
+ param2: string;
86
+ param4: string;
87
+ param5: string;
88
+ sessionId: string;
89
+ }>;
90
+ /**
91
+ * 播放器设置的统计数据
92
+ */
93
+ export type PlayerStatisticsSetting = Omit<StatisticsSetting, 'sessionId'>;
94
+ /**
95
+ * 播放类型
96
+ */
97
+ export declare enum PlayType {
98
+ /**
99
+ * 直播
100
+ */
101
+ LIVE = "live",
102
+ /**
103
+ * 回放
104
+ */
105
+ VOD = "vod",
106
+ /**
107
+ * 暖场图片
108
+ */
109
+ WARM_IMAGE = "warmImage",
110
+ /**
111
+ * 暖场视频
112
+ */
113
+ WARM_VIDEO = "warmVideo",
114
+ /**
115
+ * 等待开始直播
116
+ */
117
+ WAIT_START = "waitStart"
118
+ }
119
+ /**
120
+ * 清晰度类型
121
+ */
122
+ export declare enum LevelType {
123
+ /**
124
+ * 流畅
125
+ */
126
+ SD = "sd",
127
+ /**
128
+ * 高清
129
+ */
130
+ HD = "hd",
131
+ /**
132
+ * 超清
133
+ */
134
+ FHD = "fhd"
135
+ }
136
+ /**
137
+ * 清晰度列表节点
138
+ */
139
+ export interface LevelItem {
140
+ /** 清晰度类型 */
141
+ type: LevelType;
142
+ /** 级别 */
143
+ level: number;
144
+ }
145
+ /**
146
+ * 线路列表节点
147
+ */
148
+ export interface LineItem {
149
+ /** 线路类型 */
150
+ type: string;
151
+ /** 线路 */
152
+ line: number;
153
+ }
154
+ /**
155
+ * 延迟内核类型
156
+ */
157
+ export declare enum PlayCoreType {
158
+ /** 普通延迟 */
159
+ CDN = "cdn",
160
+ /** 无延迟 */
161
+ QUICK = "quick"
162
+ }
163
+ /**
164
+ * 延迟内核列表节点
165
+ */
166
+ export interface PlayCoreItem {
167
+ /** 延迟内核类型 */
168
+ type: PlayCoreType;
169
+ /** 延迟内核 */
170
+ core: number;
171
+ /** 是否可启用 */
172
+ enabled: boolean;
173
+ }
174
+ export interface PlayerMediaInfo {
175
+ /** 链接(直播、回放、暖场图片、暖场视频链接) */
176
+ src: string;
177
+ /** 回放视频返回回放时长 */
178
+ duration?: number;
179
+ /** 播放类型 */
180
+ type: typeof PlayType;
181
+ /** 线路选项信息 */
182
+ lines?: {
183
+ /** 线路选项 */
184
+ options: LineItem[];
185
+ /** 当前选中线路 */
186
+ active: number;
187
+ };
188
+ /** 清晰度选项信息 */
189
+ levels?: {
190
+ /** 清晰度选项 */
191
+ options: LevelItem[];
192
+ /** 当前选中清晰度 */
193
+ active: number;
194
+ };
195
+ /** 延迟内核选项信息 */
196
+ playCores?: {
197
+ /** 延迟内核选项 */
198
+ options: PlayCoreItem[];
199
+ /** 当前选中延迟内核 */
200
+ active: number;
201
+ };
202
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 限制数字范围
3
+ * @param num 原始数字
4
+ * @param min 最小值
5
+ * @param max 最大值
6
+ * @returns 限制后的数字
7
+ */
8
+ export declare function limit(num: number, min?: number, max?: number): number;
9
+ /**
10
+ * 清除字符串的双引号
11
+ * @param str 原始字符串
12
+ * @returns 清除双引号后的字符串
13
+ */
14
+ export declare function removeQuotes(str: string): string;
15
+ /**
16
+ * 拼接url
17
+ * @param url 原始url
18
+ * @param str 拼接字符串
19
+ * @returns 拼接后的url
20
+ */
21
+ export declare function concatUrl(url: string, str: string): string;
22
+ /**
23
+ * 检测链接是否为m3u8格式
24
+ * @param url 需要检测的链接
25
+ * @returns 是否为m3u8格式
26
+ */
27
+ export declare function isM3u8(url: string): boolean;
28
+ /**
29
+ * 比较版本号
30
+ * @param versionA 版本号A
31
+ * @param versionB 版本号B
32
+ * @returns 比较结果
33
+ */
34
+ export declare function compareVersions(versionA: string, versionB: string): 1 | -1 | 0;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 获取配置文件解密k ey
3
+ */
4
+ export declare function getString(): string;
5
+ /**
6
+ * 获取配置文件解密i v
7
+ */
8
+ export declare function getString2(): string;
9
+ /**
10
+ * 字符串转字节数组
11
+ * @param str
12
+ */
13
+ export declare function stringToBytes(str: string): number[];