xgplayer 3.0.24 → 3.0.25-alpha.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.
@@ -7,7 +7,7 @@ declare namespace util {
7
7
  * @param { string } [cname='']
8
8
  * @returns { HTMLElement | null }
9
9
  */
10
- function createDom(el?: string, tpl?: string, attrs?: {
10
+ export function createDom(el?: string, tpl?: string, attrs?: {
11
11
  [propName: string]: any;
12
12
  }, cname?: string): HTMLElement;
13
13
  /**
@@ -17,7 +17,7 @@ declare namespace util {
17
17
  * @param { string } [classname=""]
18
18
  * @returns { HTMLElement | null }
19
19
  */
20
- function createDomFromHtml(html: string, attrs?: {
20
+ export function createDomFromHtml(html: string, attrs?: {
21
21
  [propName: string]: any;
22
22
  }, classname?: string): HTMLElement;
23
23
  /**
@@ -26,89 +26,89 @@ declare namespace util {
26
26
  * @param { string } className
27
27
  * @returns { boolean }
28
28
  */
29
- function hasClass(el: HTMLElement, className: string): boolean;
29
+ export function hasClass(el: HTMLElement, className: string): boolean;
30
30
  /**
31
31
  *
32
32
  * @param { HTMLElement } el
33
33
  * @param { string } className
34
34
  * @returns { void }
35
35
  */
36
- function addClass(el: HTMLElement, className: string): void;
36
+ export function addClass(el: HTMLElement, className: string): void;
37
37
  /**
38
38
  *
39
39
  * @param { HTMLElement } el
40
40
  * @param { string } className
41
41
  * @returns { void }
42
42
  */
43
- function removeClass(el: HTMLElement, className: string): void;
43
+ export function removeClass(el: HTMLElement, className: string): void;
44
44
  /**
45
45
  *
46
46
  * @param { HTMLElement } el
47
47
  * @param { string } className
48
48
  * @returns { void }
49
49
  */
50
- function toggleClass(el: HTMLElement, className: string): void;
50
+ export function toggleClass(el: HTMLElement, className: string): void;
51
51
  /**
52
52
  *
53
53
  * @param { string | Object } args0
54
54
  * @param { string } [className]
55
55
  * @returns { string }
56
56
  */
57
- function classNames(...args: any[]): string;
57
+ export function classNames(...args: any[]): string;
58
58
  /**
59
59
  *
60
60
  * @param { HTMLElement } el
61
61
  * @param { string } sel
62
62
  * @returns { HTMLElement }
63
63
  */
64
- function findDom(el: HTMLElement, sel: string): HTMLElement;
64
+ export function findDom(el: HTMLElement, sel: string): HTMLElement;
65
65
  /**
66
66
  *
67
67
  * @param { HTMLElement } dom
68
68
  * @param { string } key
69
69
  * @returns { any }
70
70
  */
71
- function getCss(dom: HTMLElement, key: string): any;
72
- function padStart(str: any, length: any, pad: any): string;
71
+ export function getCss(dom: HTMLElement, key: string): any;
72
+ export function padStart(str: any, length: any, pad: any): string;
73
73
  /**
74
74
  *
75
75
  * @param { number } time
76
76
  * @returns { string }
77
77
  */
78
- function format(time: number): string;
78
+ export function format(time: number): string;
79
79
  /**
80
80
  *
81
81
  * @param { Object } e
82
82
  * @returns { Object }
83
83
  */
84
- function event(e: any): any;
84
+ export function event(e: any): any;
85
85
  /**
86
86
  *
87
87
  * @param { any } obj
88
88
  * @returns { string }
89
89
  */
90
- function typeOf(obj: any): string;
90
+ export function typeOf(obj: any): string;
91
91
  /**
92
92
  *
93
93
  * @param { any } dst
94
94
  * @param { any } src
95
95
  * @returns { any }
96
96
  */
97
- function deepCopy(dst: any, src: any): any;
97
+ export function deepCopy(dst: any, src: any): any;
98
98
  /**
99
99
  *
100
100
  * @param { any } dst
101
101
  * @param { any } src
102
102
  * @returns { any }
103
103
  */
104
- function deepMerge(dst: any, src: any): any;
105
- function getBgImage(el: any): string;
104
+ export function deepMerge(dst: any, src: any): any;
105
+ export function getBgImage(el: any): string;
106
106
  /**
107
107
  *
108
108
  * @param { HTMLElement } dom
109
109
  * @returns { HTMLElement | null }
110
110
  */
111
- function copyDom(dom: HTMLElement): HTMLElement;
111
+ export function copyDom(dom: HTMLElement): HTMLElement;
112
112
  /**
113
113
  *
114
114
  * @param { any } context
@@ -116,14 +116,14 @@ declare namespace util {
116
116
  * @param { function } intervalFunc
117
117
  * @param { number } frequency
118
118
  */
119
- function setInterval(context: any, eventName: string, intervalFunc: Function, frequency: number): void;
119
+ export function setInterval(context: any, eventName: string, intervalFunc: Function, frequency: number): void;
120
120
  /**
121
121
  *
122
122
  * @param { any } context
123
123
  * @param { string } eventName
124
124
  * @returns { void }
125
125
  */
126
- function clearInterval(context: any, eventName: string): void;
126
+ export function clearInterval(context: any, eventName: string): void;
127
127
  /**
128
128
  *
129
129
  * @param { any } context
@@ -131,18 +131,18 @@ declare namespace util {
131
131
  * @param { number } time
132
132
  * @returns { number }
133
133
  */
134
- function setTimeout(context: any, fun: Function, time: number): number;
134
+ export function setTimeout(context: any, fun: Function, time: number): number;
135
135
  /**
136
136
  *
137
137
  * @param { any } context
138
138
  * @param { number } id
139
139
  */
140
- function clearTimeout(context: any, id: number): void;
140
+ export function clearTimeout(context: any, id: number): void;
141
141
  /**
142
142
  *
143
143
  * @param { any } context
144
144
  */
145
- function clearAllTimers(context: any): void;
145
+ export function clearAllTimers(context: any): void;
146
146
  /**
147
147
  *
148
148
  * @param { string } name
@@ -151,59 +151,59 @@ declare namespace util {
151
151
  * @param { number } [height]
152
152
  * @returns { HTMLElement }
153
153
  */
154
- function createImgBtn(name: string, imgUrl: string, width?: number, height?: number): HTMLElement;
154
+ export function createImgBtn(name: string, imgUrl: string, width?: number, height?: number): HTMLElement;
155
155
  /**
156
156
  *
157
157
  * @param { string } hex
158
158
  * @param { string | number } alpha
159
159
  * @returns { string }
160
160
  */
161
- function Hex2RGBA(hex: string, alpha: string | number): string;
161
+ export function Hex2RGBA(hex: string, alpha: string | number): string;
162
162
  /**
163
163
  *
164
164
  * @returns { HTMLElement | null }
165
165
  */
166
- function getFullScreenEl(): HTMLElement;
166
+ export function getFullScreenEl(): HTMLElement;
167
167
  /**
168
168
  * @param { any }
169
169
  * @returns { boolean }
170
170
  */
171
- function checkIsFunction(fun: any): boolean;
171
+ export function checkIsFunction(fun: any): boolean;
172
172
  /**
173
173
  * @param { any }
174
174
  * @returns { boolean }
175
175
  */
176
- function checkIsObject(obj: any): boolean;
176
+ export function checkIsObject(obj: any): boolean;
177
177
  /**
178
178
  * @param { HTMLElement }
179
179
  */
180
- function hide(dom: any): void;
180
+ export function hide(dom: any): void;
181
181
  /**
182
182
  * @param { HTMLElement }
183
183
  * @param { block | flex | inline-block | inline-flex } [display]
184
184
  */
185
- function show(dom: any, display: any): void;
185
+ export function show(dom: any, display: any): void;
186
186
  /**
187
187
  *
188
188
  * @param { any } val
189
189
  * @returns { boolean }
190
190
  */
191
- function isUndefined(val: any): boolean;
192
- function isNotNull(val: any): boolean;
191
+ export function isUndefined(val: any): boolean;
192
+ export function isNotNull(val: any): boolean;
193
193
  /**
194
194
  *
195
195
  * @param { HTMLElement } dom
196
196
  * @param { string } [text]
197
197
  * @returns
198
198
  */
199
- function setStyleFromCsstext(dom: HTMLElement, text?: string): void;
199
+ export function setStyleFromCsstext(dom: HTMLElement, text?: string): void;
200
200
  /**
201
201
  *
202
202
  * @param { HTMLElement } dom
203
203
  * @param { Array<string> } [list] attribute names to filter
204
204
  * @returns { {} | {[propName: string]: any;} }
205
205
  */
206
- function filterStyleFromText(dom: HTMLElement, list?: string[]): {} | {
206
+ export function filterStyleFromText(dom: HTMLElement, list?: string[]): {} | {
207
207
  [propName: string]: any;
208
208
  };
209
209
  /**
@@ -211,15 +211,15 @@ declare namespace util {
211
211
  * @param { HTMLElement } dom
212
212
  * @returns { {} | {[propName: string]: any;} }
213
213
  */
214
- function getStyleFromCsstext(dom: HTMLElement): {} | {
214
+ export function getStyleFromCsstext(dom: HTMLElement): {} | {
215
215
  [propName: string]: any;
216
216
  };
217
- function preloadImg(url: any, onload?: () => void, onerror?: () => void): void;
218
- function stopPropagation(e: any): void;
219
- function scrollTop(): number;
220
- function scrollLeft(): number;
221
- function checkTouchSupport(): boolean;
222
- function getBuffered2(vbuffered: any, maxHoleDuration?: number): XgplayerTimeRange;
217
+ export function preloadImg(url: any, onload?: () => void, onerror?: () => void): void;
218
+ export function stopPropagation(e: any): void;
219
+ export function scrollTop(): number;
220
+ export function scrollLeft(): number;
221
+ export function checkTouchSupport(): boolean;
222
+ export function getBuffered2(vbuffered: any, maxHoleDuration?: number): XgplayerTimeRange;
223
223
  /**
224
224
  * @description css中有zoom的时候,位移会等比缩放,但是元素的宽高不会等比缩放,所以通过该api做统一
225
225
  * https://bugs.chromium.org/p/chromium/issues/detail?id=429140#c8
@@ -227,7 +227,7 @@ declare namespace util {
227
227
  * @param {number} zoom
228
228
  * @returns
229
229
  */
230
- function getEventPos(e: Event, zoom?: number): {
230
+ export function getEventPos(e: Event, zoom?: number): {
231
231
  x: number;
232
232
  y: number;
233
233
  clientX: number;
@@ -237,22 +237,22 @@ declare namespace util {
237
237
  pageX: number;
238
238
  pageY: number;
239
239
  };
240
- function requestAnimationFrame(callback: any): any;
241
- function getHostFromUrl(url: any): string;
242
- function cancelAnimationFrame(frameId: any): void;
240
+ export function requestAnimationFrame(callback: any): any;
241
+ export function getHostFromUrl(url: any): string;
242
+ export function cancelAnimationFrame(frameId: any): void;
243
243
  /**
244
244
  * @desc Check whether it is MediaSource start
245
245
  * @param { HTMLVideoElement | HTMLAudioElement | HTMLElement } video
246
246
  * @returns { boolean }
247
247
  */
248
- function isMSE(video: HTMLElement | HTMLVideoElement | HTMLAudioElement): boolean;
249
- function isBlob(url: any): boolean;
248
+ export function isMSE(video: HTMLElement | HTMLVideoElement | HTMLAudioElement): boolean;
249
+ export function isBlob(url: any): boolean;
250
250
  /**
251
251
  * @param { number } did
252
252
  * @returns { string }
253
253
  */
254
- function generateSessionId(did?: number): string;
255
- function createEvent(eventName: any): Event;
254
+ export function generateSessionId(did?: number): string;
255
+ export function createEvent(eventName: any): Event;
256
256
  /**
257
257
  * @description Adjust currentTime according to duration, when ended is true and currentTime is less than duration, or
258
258
  * currentTime is greater than duration, return duration
@@ -261,9 +261,9 @@ declare namespace util {
261
261
  * @param { boolean } isEnded
262
262
  * @returns { number } Adjusted time
263
263
  */
264
- function adjustTimeByDuration(time: number, duration: number, isEnded: boolean): number;
265
- function createPositionBar(className: any, root: any): HTMLElement;
266
- function getTransformStyle(pos?: {
264
+ export function adjustTimeByDuration(time: number, duration: number, isEnded: boolean): number;
265
+ export function createPositionBar(className: any, root: any): HTMLElement;
266
+ export function getTransformStyle(pos?: {
267
267
  x: number;
268
268
  y: number;
269
269
  scale: number;
@@ -274,16 +274,18 @@ declare namespace util {
274
274
  * @param {number} val
275
275
  * @returns {number}
276
276
  */
277
- function convertDeg(val: number): number;
278
- function getIndexByTime(time: any, segments: any): number;
279
- function getOffsetCurrentTime(currentTime: any, segments: any, index?: number): any;
277
+ export function convertDeg(val: number): number;
278
+ export function getIndexByTime(time: any, segments: any): number;
279
+ export function getOffsetCurrentTime(currentTime: any, segments: any, index?: number): any;
280
280
  /**
281
281
  *
282
282
  * @param {*} offsetTime
283
283
  * @param {*} segments
284
284
  * @returns
285
285
  */
286
- function getCurrentTimeByOffset(offsetTime: any, segments: any): any;
286
+ export function getCurrentTimeByOffset(offsetTime: any, segments: any): any;
287
+ export { debounce };
288
+ export { throttle };
287
289
  }
288
290
  export function checkIsCurrentVideo(element: any, playerId: any, key: any): boolean;
289
291
  export function debounce(func: any, wait: any, options: any): {
package/es/utils/util.js CHANGED
@@ -810,6 +810,8 @@ function throttle(func, wait, options) {
810
810
  maxWait: wait
811
811
  });
812
812
  }
813
+ util.debounce = debounce;
814
+ util.throttle = throttle;
813
815
  function getLang() {
814
816
  var lang = (document.documentElement.getAttribute("lang") || navigator.language || "zh-cn").toLocaleLowerCase();
815
817
  if (lang === "zh-cn") {
package/es/version.js CHANGED
@@ -1,2 +1,2 @@
1
- var version = "3.0.24";
1
+ var version = "3.0.25-alpha.0";
2
2
  export { version as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xgplayer",
3
- "version": "3.0.24",
3
+ "version": "3.0.25-alpha.0",
4
4
  "description": "video player",
5
5
  "main": "dist/index.min.js",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "publishConfig": {
17
17
  "registry": "https://registry.npmjs.org/",
18
18
  "access": "public",
19
- "tag": "latest"
19
+ "tag": "alpha"
20
20
  },
21
21
  "files": [
22
22
  "dist",
@@ -42,7 +42,7 @@
42
42
  "danmu.js": ">=1.2.1",
43
43
  "delegate": "^3.2.0",
44
44
  "eventemitter3": "^4.0.7",
45
- "xgplayer-subtitles": "3.0.24"
45
+ "xgplayer-subtitles": "3.0.25-alpha.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "core-js": ">=3.12.1"