xgplayer 3.0.25-rc.9 → 3.0.26
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/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/defaultConfig.d.ts +15 -15
- package/es/error.d.ts +12 -12
- package/es/events.d.ts +3 -3
- package/es/icons.d.ts +1 -1
- package/es/index.d.ts +19 -19
- package/es/index.umd.d.ts +17 -17
- package/es/instManager.d.ts +1 -1
- package/es/lang/br.d.ts +54 -54
- package/es/lang/de.d.ts +54 -54
- package/es/lang/en.d.ts +55 -55
- package/es/lang/es.d.ts +54 -54
- package/es/lang/fr.d.ts +54 -54
- package/es/lang/i18n.d.ts +7 -0
- package/es/lang/id.d.ts +54 -54
- package/es/lang/index.d.ts +1 -1
- package/es/lang/it.d.ts +54 -54
- package/es/lang/jp.d.ts +55 -55
- package/es/lang/kr.d.ts +54 -54
- package/es/lang/ms-my.d.ts +54 -54
- package/es/lang/ru.d.ts +54 -54
- package/es/lang/th.d.ts +54 -54
- package/es/lang/vn.d.ts +54 -54
- package/es/lang/zh-cn.d.ts +55 -55
- package/es/lang/zh-hk.d.ts +55 -55
- package/es/lang/zh-hk.js +1 -1
- package/es/mediaProxy.d.ts +42 -30
- package/es/mediaProxy.js +35 -21
- package/es/player.d.ts +51 -52
- package/es/player.js +3 -3
- package/es/plugin/basePlugin.d.ts +12 -12
- package/es/plugin/hooksDescriptor.d.ts +3 -3
- package/es/plugin/index.d.ts +12 -12
- package/es/plugin/plugin.d.ts +26 -23
- package/es/plugin/plugin.js +3 -1
- package/es/plugin/pluginsManager.d.ts +9 -71
- package/es/plugin/pluginsManager.js +22 -9
- package/es/plugin/resizeObserver.d.ts +1 -1
- package/es/plugins/common/iconPlugin.d.ts +1 -1
- package/es/plugins/common/optionList.d.ts +4 -4
- package/es/plugins/common/optionsIcon.d.ts +7 -7
- package/es/plugins/common/thumbnail.d.ts +4 -4
- package/es/plugins/controls/index.d.ts +8 -8
- package/es/plugins/cssFullScreen/index.d.ts +4 -4
- package/es/plugins/danmu/danmuIcon.d.ts +1 -1
- package/es/plugins/danmu/danmuPanel.d.ts +2 -2
- package/es/plugins/danmu/index.d.ts +3 -3
- package/es/plugins/definition/index.d.ts +2 -2
- package/es/plugins/download/index.d.ts +5 -5
- package/es/plugins/download/saveAs.d.ts +6 -6
- package/es/plugins/dynamicBg/index.d.ts +14 -15
- package/es/plugins/enter/index.d.ts +3 -3
- package/es/plugins/error/index.d.ts +3 -3
- package/es/plugins/fpsDetect/index.d.ts +5 -5
- package/es/plugins/fullscreen/backicon.d.ts +2 -2
- package/es/plugins/fullscreen/index.d.ts +4 -4
- package/es/plugins/gapJump/index.d.ts +6 -6
- package/es/plugins/heatmap/index.d.ts +3 -4
- package/es/plugins/keyboard/index.d.ts +5 -5
- package/es/plugins/keyboard/index.js +1 -1
- package/es/plugins/loading/index.d.ts +1 -1
- package/es/plugins/logger/index.d.ts +22 -22
- package/es/plugins/miniScreen/index.d.ts +8 -8
- package/es/plugins/miniScreen/miniScreenIcon.d.ts +1 -1
- package/es/plugins/mobile/index.d.ts +8 -8
- package/es/plugins/netAdaption/index.d.ts +2 -2
- package/es/plugins/pc/index.d.ts +2 -2
- package/es/plugins/pc/index.js +1 -1
- package/es/plugins/pip/index.d.ts +12 -12
- package/es/plugins/play/index.d.ts +2 -2
- package/es/plugins/playNext/index.d.ts +5 -5
- package/es/plugins/playbackRate/index.d.ts +5 -5
- package/es/plugins/poster/index.d.ts +3 -3
- package/es/plugins/progress/index.d.ts +15 -15
- package/es/plugins/progress/innerList.d.ts +6 -6
- package/es/plugins/progress/innerList.js +1 -1
- package/es/plugins/progress/miniProgress.d.ts +4 -4
- package/es/plugins/progressPreview/dotsApi.js +1 -1
- package/es/plugins/progressPreview/index.d.ts +17 -17
- package/es/plugins/prompt/index.d.ts +3 -3
- package/es/plugins/replay/index.d.ts +2 -2
- package/es/plugins/rotate/index.d.ts +5 -5
- package/es/plugins/screenShot/index.d.ts +6 -6
- package/es/plugins/start/index.d.ts +5 -5
- package/es/plugins/stats/index.d.ts +7 -7
- package/es/plugins/stats/index.js +1 -1
- package/es/plugins/testspeed/index.d.ts +6 -6
- package/es/plugins/time/index.d.ts +8 -9
- package/es/plugins/time/timesegments.d.ts +3 -3
- package/es/plugins/time/timesegments.js +1 -1
- package/es/plugins/track/index.d.ts +14 -15
- package/es/plugins/track/nativeSubTitle.d.ts +2 -1
- package/es/plugins/volume/index.d.ts +9 -9
- package/es/plugins/waitingTimeoutJump/index.d.ts +4 -4
- package/es/presets/default-en.d.ts +27 -27
- package/es/presets/default.d.ts +28 -28
- package/es/presets/live.d.ts +14 -14
- package/es/presets/mobile.d.ts +23 -23
- package/es/state.d.ts +8 -8
- package/es/stateClassMap.d.ts +29 -29
- package/es/utils/database.d.ts +11 -4
- package/es/utils/debug.d.ts +1 -1
- package/es/utils/draggabilly.d.ts +3 -2
- package/es/utils/sniffer.d.ts +2 -2
- package/es/utils/util.d.ts +61 -59
- package/es/utils/util.js +2 -0
- package/es/version.js +1 -1
- package/package.json +3 -3
package/es/lang/zh-hk.d.ts
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
|
-
|
|
2
|
+
let LANG: string;
|
|
3
3
|
namespace TEXT {
|
|
4
4
|
namespace ERROR_TYPES {
|
|
5
5
|
namespace network {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
let code: number;
|
|
7
|
+
let msg: string;
|
|
8
8
|
}
|
|
9
9
|
namespace mse {
|
|
10
|
-
|
|
10
|
+
let code_1: number;
|
|
11
11
|
export { code_1 as code };
|
|
12
|
-
|
|
12
|
+
let msg_1: string;
|
|
13
13
|
export { msg_1 as msg };
|
|
14
14
|
}
|
|
15
15
|
namespace parse {
|
|
16
|
-
|
|
16
|
+
let code_2: number;
|
|
17
17
|
export { code_2 as code };
|
|
18
|
-
|
|
18
|
+
let msg_2: string;
|
|
19
19
|
export { msg_2 as msg };
|
|
20
20
|
}
|
|
21
21
|
namespace format {
|
|
22
|
-
|
|
22
|
+
let code_3: number;
|
|
23
23
|
export { code_3 as code };
|
|
24
|
-
|
|
24
|
+
let msg_3: string;
|
|
25
25
|
export { msg_3 as msg };
|
|
26
26
|
}
|
|
27
27
|
namespace decoder {
|
|
28
|
-
|
|
28
|
+
let code_4: number;
|
|
29
29
|
export { code_4 as code };
|
|
30
|
-
|
|
30
|
+
let msg_4: string;
|
|
31
31
|
export { msg_4 as msg };
|
|
32
32
|
}
|
|
33
33
|
namespace runtime {
|
|
34
|
-
|
|
34
|
+
let code_5: number;
|
|
35
35
|
export { code_5 as code };
|
|
36
|
-
|
|
36
|
+
let msg_5: string;
|
|
37
37
|
export { msg_5 as msg };
|
|
38
38
|
}
|
|
39
39
|
namespace timeout {
|
|
40
|
-
|
|
40
|
+
let code_6: number;
|
|
41
41
|
export { code_6 as code };
|
|
42
|
-
|
|
42
|
+
let msg_6: string;
|
|
43
43
|
export { msg_6 as msg };
|
|
44
44
|
}
|
|
45
45
|
namespace other {
|
|
46
|
-
|
|
46
|
+
let code_7: number;
|
|
47
47
|
export { code_7 as code };
|
|
48
|
-
|
|
48
|
+
let msg_7: string;
|
|
49
49
|
export { msg_7 as msg };
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
52
|
+
let HAVE_NOTHING: string;
|
|
53
|
+
let HAVE_METADATA: string;
|
|
54
|
+
let HAVE_CURRENT_DATA: string;
|
|
55
|
+
let HAVE_FUTURE_DATA: string;
|
|
56
|
+
let HAVE_ENOUGH_DATA: string;
|
|
57
|
+
let NETWORK_EMPTY: string;
|
|
58
|
+
let NETWORK_IDLE: string;
|
|
59
|
+
let NETWORK_LOADING: string;
|
|
60
|
+
let NETWORK_NO_SOURCE: string;
|
|
61
|
+
let MEDIA_ERR_ABORTED: string;
|
|
62
|
+
let MEDIA_ERR_NETWORK: string;
|
|
63
|
+
let MEDIA_ERR_DECODE: string;
|
|
64
|
+
let MEDIA_ERR_SRC_NOT_SUPPORTED: string;
|
|
65
|
+
let REPLAY: string;
|
|
66
|
+
let ERROR: string;
|
|
67
|
+
let PLAY_TIPS: string;
|
|
68
|
+
let PAUSE_TIPS: string;
|
|
69
|
+
let PLAYNEXT_TIPS: string;
|
|
70
|
+
let DOWNLOAD_TIPS: string;
|
|
71
|
+
let ROTATE_TIPS: string;
|
|
72
|
+
let RELOAD_TIPS: string;
|
|
73
|
+
let FULLSCREEN_TIPS: string;
|
|
74
|
+
let EXITFULLSCREEN_TIPS: string;
|
|
75
|
+
let CSSFULLSCREEN_TIPS: string;
|
|
76
|
+
let EXITCSSFULLSCREEN_TIPS: string;
|
|
77
|
+
let TEXTTRACK: string;
|
|
78
|
+
let TEXTTRACK_OFF: string;
|
|
79
|
+
let PIP: string;
|
|
80
|
+
let SCREENSHOT: string;
|
|
81
|
+
let LIVE: string;
|
|
82
|
+
let OFF: string;
|
|
83
|
+
let OPEN: string;
|
|
84
|
+
let MINI_DRAG: string;
|
|
85
|
+
let MINISCREEN: string;
|
|
86
|
+
let REFRESH_TIPS: string;
|
|
87
|
+
let REFRESH: string;
|
|
88
|
+
let FORWARD: string;
|
|
89
|
+
let LIVE_TIP: string;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
export default _default;
|
package/es/lang/zh-hk.js
CHANGED
package/es/mediaProxy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default MediaProxy;
|
|
2
|
-
export type EventEmitter = import(
|
|
2
|
+
export type EventEmitter = import("eventemitter3");
|
|
3
3
|
export type IMediaProxy = {
|
|
4
4
|
duration: number;
|
|
5
5
|
currentTime: number;
|
|
@@ -18,11 +18,11 @@ export type IMediaProxy = {
|
|
|
18
18
|
play: Function;
|
|
19
19
|
pause: Function;
|
|
20
20
|
};
|
|
21
|
-
export type IPlayerOptions = import(
|
|
21
|
+
export type IPlayerOptions = import("./defaultConfig").IPlayerOptions;
|
|
22
22
|
/**
|
|
23
23
|
* @extends { EventEmitter }
|
|
24
24
|
*/
|
|
25
|
-
declare class MediaProxy {
|
|
25
|
+
declare class MediaProxy extends EventEmitter<string | symbol, any> {
|
|
26
26
|
/**
|
|
27
27
|
* @param { IPlayerOptions } options
|
|
28
28
|
*/
|
|
@@ -73,7 +73,7 @@ declare class MediaProxy {
|
|
|
73
73
|
* @type { HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null }
|
|
74
74
|
*/
|
|
75
75
|
media: HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null;
|
|
76
|
-
set volume(
|
|
76
|
+
set volume(vol: number);
|
|
77
77
|
/**
|
|
78
78
|
* @type { number }
|
|
79
79
|
* @description 设置/返回视频的音量
|
|
@@ -121,6 +121,23 @@ declare class MediaProxy {
|
|
|
121
121
|
* @param { any } [media]
|
|
122
122
|
*/
|
|
123
123
|
detachVideoEvents(media?: any): void;
|
|
124
|
+
/**
|
|
125
|
+
* @description Assemble source elements for the media element,
|
|
126
|
+
* and add error event listeners to each source element
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
public assembleSource(urls: any, mediaEl: any): void;
|
|
130
|
+
/**
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
private _videoSourceCount;
|
|
134
|
+
_videoSourceIndex: any;
|
|
135
|
+
_sourceError: ((e: any) => void) | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* @description disassemble source elements for the media element
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
public disassembleSource(mediaEl: any): void;
|
|
124
141
|
/**
|
|
125
142
|
* 针对source列表播放方式添加错误监听
|
|
126
143
|
* @doc https://stackoverflow.com/questions/47557135/html5-detect-the-type-of-error-when-trying-to-load-a-video-using-a-source-elem
|
|
@@ -132,13 +149,7 @@ declare class MediaProxy {
|
|
|
132
149
|
src: string;
|
|
133
150
|
type: string;
|
|
134
151
|
}>): void;
|
|
135
|
-
|
|
136
|
-
* @private
|
|
137
|
-
*/
|
|
138
|
-
private _videoSourceCount;
|
|
139
|
-
_videoSourceIndex: number;
|
|
140
|
-
_vLoadeddata: (e: any) => void;
|
|
141
|
-
_sourceError: (e: any) => void;
|
|
152
|
+
_vLoadeddata: ((e: any) => void) | undefined;
|
|
142
153
|
/**
|
|
143
154
|
* 移除source列表错误事件监听
|
|
144
155
|
* @protected
|
|
@@ -149,18 +160,18 @@ declare class MediaProxy {
|
|
|
149
160
|
* @description Media Error handler
|
|
150
161
|
* @param { string } eventName
|
|
151
162
|
*/
|
|
152
|
-
errorHandler(name: any, error?:
|
|
163
|
+
errorHandler(name: any, error?: null): void;
|
|
153
164
|
destroy(): void;
|
|
154
165
|
/**
|
|
155
166
|
* @type { HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null }
|
|
156
167
|
* @deprecated Property [video] is renamed to [media],you can access using player.media= xx
|
|
157
168
|
*/
|
|
158
|
-
set video(
|
|
169
|
+
set video(media: HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null);
|
|
159
170
|
/**
|
|
160
171
|
* @type { HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null }
|
|
161
172
|
* @deprecated Property [video] is renamed to [media],you can access using player.media
|
|
162
173
|
*/
|
|
163
|
-
get video():
|
|
174
|
+
get video(): HTMLVideoElement | HTMLAudioElement | HTMLElement | IMediaProxy | null;
|
|
164
175
|
/**
|
|
165
176
|
*
|
|
166
177
|
* @returns { Promise<void> | null }
|
|
@@ -184,21 +195,21 @@ declare class MediaProxy {
|
|
|
184
195
|
* @type { boolean }
|
|
185
196
|
* @description 设置/返回 自动播放属性
|
|
186
197
|
*/
|
|
187
|
-
set autoplay(
|
|
198
|
+
set autoplay(isTrue: any);
|
|
188
199
|
get autoplay(): any;
|
|
189
200
|
/**
|
|
190
201
|
* @type { TimeRanges | null }
|
|
191
202
|
* @description 返回当前缓冲的TimeRange对象集合
|
|
192
203
|
*/
|
|
193
|
-
get buffered(): TimeRanges;
|
|
204
|
+
get buffered(): TimeRanges | null;
|
|
194
205
|
/**
|
|
195
206
|
* @type { Array<{start: number, end: number}> | null}
|
|
196
207
|
* @description 返回当前自定义的缓存列表
|
|
197
208
|
*/
|
|
198
|
-
get buffered2(): {
|
|
209
|
+
get buffered2(): Array<{
|
|
199
210
|
start: number;
|
|
200
211
|
end: number;
|
|
201
|
-
}
|
|
212
|
+
}> | null;
|
|
202
213
|
/**
|
|
203
214
|
* @type { {start: number, end: number} }
|
|
204
215
|
*/
|
|
@@ -206,25 +217,25 @@ declare class MediaProxy {
|
|
|
206
217
|
start: number;
|
|
207
218
|
end: number;
|
|
208
219
|
};
|
|
209
|
-
set crossOrigin(
|
|
220
|
+
set crossOrigin(isTrue: string);
|
|
210
221
|
/**
|
|
211
222
|
* @type { string}
|
|
212
223
|
* @description 设置/返回是否跨域
|
|
213
224
|
* */
|
|
214
225
|
get crossOrigin(): string;
|
|
215
|
-
set currentSrc(
|
|
226
|
+
set currentSrc(src: string);
|
|
216
227
|
/**
|
|
217
228
|
* @type { string }
|
|
218
229
|
* @description 设置/返回视频播放地址
|
|
219
230
|
* */
|
|
220
231
|
get currentSrc(): string;
|
|
221
|
-
set currentTime(
|
|
232
|
+
set currentTime(time: number);
|
|
222
233
|
/**
|
|
223
234
|
* @type { number }
|
|
224
235
|
* @description 设置/返回视频当前播放时间
|
|
225
236
|
* */
|
|
226
237
|
get currentTime(): number;
|
|
227
|
-
set defaultMuted(
|
|
238
|
+
set defaultMuted(isTrue: boolean);
|
|
228
239
|
/**
|
|
229
240
|
* @type { boolean }
|
|
230
241
|
* 设置/返回视频默认静音
|
|
@@ -250,13 +261,13 @@ declare class MediaProxy {
|
|
|
250
261
|
* @description return error description text
|
|
251
262
|
*/
|
|
252
263
|
get errorNote(): string;
|
|
253
|
-
set loop(
|
|
264
|
+
set loop(isTrue: boolean);
|
|
254
265
|
/**
|
|
255
266
|
* @type { boolean }
|
|
256
267
|
* @description 否开启了循环播放
|
|
257
268
|
*/
|
|
258
269
|
get loop(): boolean;
|
|
259
|
-
set muted(
|
|
270
|
+
set muted(isTrue: boolean);
|
|
260
271
|
/**
|
|
261
272
|
* @type { boolean }
|
|
262
273
|
* @description 静音
|
|
@@ -266,13 +277,13 @@ declare class MediaProxy {
|
|
|
266
277
|
* @type { 0 | 1 | 2 | 3 }
|
|
267
278
|
* @description 返回视频的当前网络状态
|
|
268
279
|
*/
|
|
269
|
-
get networkState(): 0 |
|
|
280
|
+
get networkState(): 0 | 1 | 2 | 3;
|
|
270
281
|
/**
|
|
271
282
|
* @type { boolean }
|
|
272
283
|
* @description 回当前视频是否是暂停状态
|
|
273
284
|
*/
|
|
274
285
|
get paused(): boolean;
|
|
275
|
-
set playbackRate(
|
|
286
|
+
set playbackRate(rate: number);
|
|
276
287
|
/**
|
|
277
288
|
* @type { number }
|
|
278
289
|
* @description 返回/设置倍速
|
|
@@ -281,8 +292,8 @@ declare class MediaProxy {
|
|
|
281
292
|
/**
|
|
282
293
|
* @type { TimeRanges | null}
|
|
283
294
|
*/
|
|
284
|
-
get played(): TimeRanges;
|
|
285
|
-
set preload(
|
|
295
|
+
get played(): TimeRanges | null;
|
|
296
|
+
set preload(isTrue: boolean);
|
|
286
297
|
/**
|
|
287
298
|
* @type { boolean }
|
|
288
299
|
*/
|
|
@@ -291,7 +302,7 @@ declare class MediaProxy {
|
|
|
291
302
|
* @type { 0 | 1 | 2 | 3 | 4 }
|
|
292
303
|
* @description 回视频的就绪状态
|
|
293
304
|
*/
|
|
294
|
-
get readyState(): 0 |
|
|
305
|
+
get readyState(): 0 | 1 | 2 | 3 | 4;
|
|
295
306
|
/**
|
|
296
307
|
* @type { boolean }
|
|
297
308
|
* @description 当前视频是否可以seek
|
|
@@ -302,7 +313,7 @@ declare class MediaProxy {
|
|
|
302
313
|
* @description 当前视频是否处于seeking状态下
|
|
303
314
|
*/
|
|
304
315
|
get seeking(): boolean;
|
|
305
|
-
set src(
|
|
316
|
+
set src(url: any);
|
|
306
317
|
/**
|
|
307
318
|
* @type { any }
|
|
308
319
|
* @description 设置/返回当前视频的地址
|
|
@@ -343,3 +354,4 @@ declare class MediaProxy {
|
|
|
343
354
|
off(event: string, callback: (...args: any[]) => any, ...args: any[]): void;
|
|
344
355
|
offAll(): void;
|
|
345
356
|
}
|
|
357
|
+
import EventEmitter from 'eventemitter3';
|
package/es/mediaProxy.js
CHANGED
|
@@ -3,7 +3,7 @@ import EventEmitter from "eventemitter3";
|
|
|
3
3
|
import util from "./utils/util.js";
|
|
4
4
|
import sniffer from "./utils/sniffer.js";
|
|
5
5
|
import Errors, { ERROR_TYPE_MAP } from "./error.js";
|
|
6
|
-
import { VIDEO_EVENTS,
|
|
6
|
+
import { VIDEO_EVENTS, SOURCE_ERROR, SOURCE_SUCCESS, URL_CHANGE, WAITING } from "./events.js";
|
|
7
7
|
function emitVideoEvent(eventKey, e) {
|
|
8
8
|
if (!this || !this.emit) {
|
|
9
9
|
return;
|
|
@@ -183,30 +183,20 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
183
183
|
this._evHandlers = null;
|
|
184
184
|
}
|
|
185
185
|
}, {
|
|
186
|
-
key: "
|
|
187
|
-
value: function
|
|
186
|
+
key: "assembleSource",
|
|
187
|
+
value: function assembleSource(urls, mediaEl) {
|
|
188
188
|
var _this6 = this;
|
|
189
|
-
video
|
|
190
|
-
video.load();
|
|
189
|
+
var media = mediaEl || this.media || this.video;
|
|
191
190
|
urls.forEach(function(item, index) {
|
|
192
|
-
|
|
191
|
+
media.appendChild(util.createDom("source", "", {
|
|
193
192
|
src: "".concat(item.src),
|
|
194
193
|
type: "".concat(item.type || ""),
|
|
195
194
|
"data-index": index + 1
|
|
196
195
|
}));
|
|
197
196
|
});
|
|
198
|
-
var _c =
|
|
199
|
-
if (!_c) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
197
|
+
var _c = media.children;
|
|
202
198
|
this._videoSourceCount = _c.length;
|
|
203
199
|
this._videoSourceIndex = _c.length;
|
|
204
|
-
this._vLoadeddata = function(e) {
|
|
205
|
-
_this6.emit(SOURCE_SUCCESS, {
|
|
206
|
-
src: e.target.currentSrc,
|
|
207
|
-
host: util.getHostFromUrl(e.target.currentSrc)
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
200
|
var _eHandler = null;
|
|
211
201
|
for (var i = 0; i < this._evHandlers.length; i++) {
|
|
212
202
|
if (Object.keys(this._evHandlers[i])[0] === "error") {
|
|
@@ -239,12 +229,12 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
239
229
|
for (var _i = 0; _i < _c.length; _i++) {
|
|
240
230
|
_c[_i].addEventListener("error", this._sourceError);
|
|
241
231
|
}
|
|
242
|
-
video.addEventListener("loadeddata", this._vLoadeddata);
|
|
243
232
|
}
|
|
244
233
|
}, {
|
|
245
|
-
key: "
|
|
246
|
-
value: function
|
|
247
|
-
var
|
|
234
|
+
key: "disassembleSource",
|
|
235
|
+
value: function disassembleSource(mediaEl) {
|
|
236
|
+
var media = mediaEl || this.media || this.video;
|
|
237
|
+
var _c = media.children;
|
|
248
238
|
if (!_c || _c.length === 0 || !this._sourceError) {
|
|
249
239
|
return;
|
|
250
240
|
}
|
|
@@ -252,8 +242,32 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
252
242
|
_c[i].removeEventListener("error", this._sourceError);
|
|
253
243
|
}
|
|
254
244
|
while (_c.length > 0) {
|
|
255
|
-
|
|
245
|
+
media.removeChild(_c[0]);
|
|
256
246
|
}
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "_attachSourceEvents",
|
|
250
|
+
value: function _attachSourceEvents(video, urls) {
|
|
251
|
+
var _this7 = this;
|
|
252
|
+
video.removeAttribute("src");
|
|
253
|
+
video.load();
|
|
254
|
+
this.assembleSource(urls, video);
|
|
255
|
+
var _c = video.children;
|
|
256
|
+
if (!_c) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
this._vLoadeddata = function(e) {
|
|
260
|
+
_this7.emit(SOURCE_SUCCESS, {
|
|
261
|
+
src: e.target.currentSrc,
|
|
262
|
+
host: util.getHostFromUrl(e.target.currentSrc)
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
video.addEventListener("loadeddata", this._vLoadeddata);
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
key: "_detachSourceEvents",
|
|
269
|
+
value: function _detachSourceEvents(video) {
|
|
270
|
+
this.disassembleSource(video);
|
|
257
271
|
this._vLoadeddata && video.removeEventListener("loadeddata", this._vLoadeddata);
|
|
258
272
|
}
|
|
259
273
|
}, {
|