@gcorevideo/player 2.1.12 → 2.1.13
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.js +29 -38
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +29 -38
- package/package.json +1 -1
- package/src/Player.ts +103 -256
- package/tsconfig.tsbuildinfo +1 -1
package/src/Player.ts
CHANGED
|
@@ -20,14 +20,8 @@ import type {
|
|
|
20
20
|
PlayerPlugin,
|
|
21
21
|
StreamMediaSource,
|
|
22
22
|
} from './types.js'
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
trace,
|
|
26
|
-
} from './trace/index.js'
|
|
27
|
-
import {
|
|
28
|
-
PlayerConfig,
|
|
29
|
-
PlayerEvent,
|
|
30
|
-
} from './types.js'
|
|
23
|
+
import { reportError, trace } from './trace/index.js'
|
|
24
|
+
import { PlayerConfig, PlayerEvent } from './types.js'
|
|
31
25
|
import DashPlayback from './plugins/dash-playback/DashPlayback.js'
|
|
32
26
|
import HlsPlayback from './plugins/hls-playback/HlsPlayback.js'
|
|
33
27
|
|
|
@@ -35,9 +29,7 @@ import '../assets/style/main.scss' // TODO check if needed
|
|
|
35
29
|
|
|
36
30
|
// TODO implement transport retry/failover and fallback logic
|
|
37
31
|
|
|
38
|
-
type PlayerEventHandler<
|
|
39
|
-
T extends PlayerEvent,
|
|
40
|
-
> = () => void
|
|
32
|
+
type PlayerEventHandler<T extends PlayerEvent> = () => void
|
|
41
33
|
|
|
42
34
|
const T = 'GPlayer'
|
|
43
35
|
|
|
@@ -54,49 +46,33 @@ const DEFAULT_OPTIONS: PlayerConfig = {
|
|
|
54
46
|
poster: '',
|
|
55
47
|
}
|
|
56
48
|
|
|
57
|
-
export type PlaybackModule =
|
|
58
|
-
| 'dash'
|
|
59
|
-
| 'hls'
|
|
60
|
-
| 'native'
|
|
49
|
+
export type PlaybackModule = 'dash' | 'hls' | 'native'
|
|
61
50
|
|
|
62
|
-
type PluginOptions = Record<
|
|
63
|
-
string,
|
|
64
|
-
unknown
|
|
65
|
-
>
|
|
51
|
+
type PluginOptions = Record<string, unknown>
|
|
66
52
|
|
|
67
53
|
/**
|
|
68
54
|
* @beta
|
|
69
55
|
*/
|
|
70
56
|
export class Player {
|
|
71
|
-
private bitrateInfo: BitrateInfo | null =
|
|
72
|
-
null
|
|
57
|
+
private bitrateInfo: BitrateInfo | null = null
|
|
73
58
|
|
|
74
|
-
private config: PlayerConfig =
|
|
75
|
-
DEFAULT_OPTIONS
|
|
59
|
+
private config: PlayerConfig = DEFAULT_OPTIONS
|
|
76
60
|
|
|
77
61
|
private emitter = new EventLite()
|
|
78
62
|
|
|
79
|
-
private player: PlayerClappr | null =
|
|
80
|
-
null
|
|
63
|
+
private player: PlayerClappr | null = null
|
|
81
64
|
|
|
82
65
|
private ready = false
|
|
83
66
|
|
|
84
|
-
private tuneInTimerId: ReturnType<
|
|
85
|
-
typeof setTimeout
|
|
86
|
-
> | null = null
|
|
67
|
+
private tuneInTimerId: ReturnType<typeof setTimeout> | null = null
|
|
87
68
|
|
|
88
69
|
private tunedIn = false
|
|
89
70
|
|
|
90
71
|
get activePlayback(): PlaybackModule | null {
|
|
91
|
-
if (
|
|
92
|
-
!this.player?.core.activePlayback
|
|
93
|
-
) {
|
|
72
|
+
if (!this.player?.core.activePlayback) {
|
|
94
73
|
return null
|
|
95
74
|
}
|
|
96
|
-
switch (
|
|
97
|
-
this.player.core.activePlayback
|
|
98
|
-
.name
|
|
99
|
-
) {
|
|
75
|
+
switch (this.player.core.activePlayback.name) {
|
|
100
76
|
case 'dash':
|
|
101
77
|
return 'dash'
|
|
102
78
|
case 'hls':
|
|
@@ -111,15 +87,10 @@ export class Player {
|
|
|
111
87
|
}
|
|
112
88
|
|
|
113
89
|
get hd() {
|
|
114
|
-
return
|
|
115
|
-
this.player?.core.activePlayback
|
|
116
|
-
?.isHighDefinitionInUse || false
|
|
117
|
-
)
|
|
90
|
+
return this.player?.core.activePlayback?.isHighDefinitionInUse || false
|
|
118
91
|
}
|
|
119
92
|
|
|
120
|
-
get playbackType():
|
|
121
|
-
| PlaybackType
|
|
122
|
-
| undefined {
|
|
93
|
+
get playbackType(): PlaybackType | undefined {
|
|
123
94
|
return this.player?.core.activePlayback?.getPlaybackType()
|
|
124
95
|
}
|
|
125
96
|
|
|
@@ -127,51 +98,26 @@ export class Player {
|
|
|
127
98
|
this.setConfig(config)
|
|
128
99
|
}
|
|
129
100
|
|
|
130
|
-
on<T extends PlayerEvent>(
|
|
131
|
-
event: T,
|
|
132
|
-
handler: PlayerEventHandler<T>,
|
|
133
|
-
) {
|
|
101
|
+
on<T extends PlayerEvent>(event: T, handler: PlayerEventHandler<T>) {
|
|
134
102
|
this.emitter.on(event, handler)
|
|
135
103
|
}
|
|
136
104
|
|
|
137
|
-
off<T extends PlayerEvent>(
|
|
138
|
-
event: T,
|
|
139
|
-
handler: PlayerEventHandler<T>,
|
|
140
|
-
) {
|
|
105
|
+
off<T extends PlayerEvent>(event: T, handler: PlayerEventHandler<T>) {
|
|
141
106
|
this.emitter.off(event, handler)
|
|
142
107
|
}
|
|
143
108
|
|
|
144
|
-
configure(
|
|
145
|
-
config: Partial<PlayerConfig>,
|
|
146
|
-
) {
|
|
109
|
+
configure(config: Partial<PlayerConfig>) {
|
|
147
110
|
this.setConfig(config)
|
|
148
111
|
}
|
|
149
112
|
|
|
150
|
-
private setConfig(
|
|
151
|
-
config
|
|
152
|
-
) {
|
|
153
|
-
this.config = $.extend(
|
|
154
|
-
true,
|
|
155
|
-
this.config,
|
|
156
|
-
config,
|
|
157
|
-
)
|
|
113
|
+
private setConfig(config: Partial<PlayerConfig>) {
|
|
114
|
+
this.config = $.extend(true, this.config, config)
|
|
158
115
|
}
|
|
159
116
|
|
|
160
|
-
async init(
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
!this.player,
|
|
165
|
-
'Player already initialized',
|
|
166
|
-
)
|
|
167
|
-
assert.ok(
|
|
168
|
-
playerElement,
|
|
169
|
-
'Player container element is required',
|
|
170
|
-
)
|
|
171
|
-
if (
|
|
172
|
-
this.config.debug === 'all' ||
|
|
173
|
-
this.config.debug === 'clappr'
|
|
174
|
-
) {
|
|
117
|
+
async init(playerElement: HTMLElement) {
|
|
118
|
+
assert.ok(!this.player, 'Player already initialized')
|
|
119
|
+
assert.ok(playerElement, 'Player container element is required')
|
|
120
|
+
if (this.config.debug === 'all' || this.config.debug === 'clappr') {
|
|
175
121
|
Log.setLevel(0)
|
|
176
122
|
}
|
|
177
123
|
|
|
@@ -180,24 +126,15 @@ export class Player {
|
|
|
180
126
|
})
|
|
181
127
|
|
|
182
128
|
this.configurePlaybacks()
|
|
183
|
-
const coreOpts =
|
|
184
|
-
|
|
185
|
-
playerElement,
|
|
186
|
-
)
|
|
187
|
-
const { core, container } =
|
|
188
|
-
Loader.registeredPlugins
|
|
129
|
+
const coreOpts = this.buildCoreOptions(playerElement)
|
|
130
|
+
const { core, container } = Loader.registeredPlugins
|
|
189
131
|
trace(`${T} init`, {
|
|
190
|
-
registeredPlaybacks:
|
|
191
|
-
Loader.registeredPlaybacks.map(
|
|
192
|
-
(p) => p.name,
|
|
193
|
-
),
|
|
132
|
+
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.name),
|
|
194
133
|
})
|
|
195
134
|
coreOpts.plugins = {
|
|
196
135
|
core: Object.values(core),
|
|
197
|
-
container:
|
|
198
|
-
|
|
199
|
-
playback:
|
|
200
|
-
Loader.registeredPlaybacks,
|
|
136
|
+
container: Object.values(container),
|
|
137
|
+
playback: Loader.registeredPlaybacks,
|
|
201
138
|
} as CorePluginOptions
|
|
202
139
|
return this.initPlayer(coreOpts)
|
|
203
140
|
}
|
|
@@ -220,76 +157,52 @@ export class Player {
|
|
|
220
157
|
}
|
|
221
158
|
|
|
222
159
|
pause() {
|
|
223
|
-
assert.ok(
|
|
224
|
-
this.player,
|
|
225
|
-
'Player not initialized',
|
|
226
|
-
)
|
|
160
|
+
assert.ok(this.player, 'Player not initialized')
|
|
227
161
|
this.player.pause()
|
|
228
162
|
}
|
|
229
163
|
|
|
230
164
|
play() {
|
|
231
|
-
assert.ok(
|
|
232
|
-
this.player,
|
|
233
|
-
'Player not initialized',
|
|
234
|
-
)
|
|
165
|
+
assert.ok(this.player, 'Player not initialized')
|
|
235
166
|
this.player.play()
|
|
236
167
|
}
|
|
237
168
|
|
|
238
169
|
seekTo(time: number) {
|
|
239
|
-
assert.ok(
|
|
240
|
-
this.player,
|
|
241
|
-
'Player not initialized',
|
|
242
|
-
)
|
|
170
|
+
assert.ok(this.player, 'Player not initialized')
|
|
243
171
|
this.player.seek(time)
|
|
244
172
|
}
|
|
245
173
|
|
|
246
174
|
stop() {
|
|
247
|
-
assert.ok(
|
|
248
|
-
this.player,
|
|
249
|
-
'Player not initialized',
|
|
250
|
-
)
|
|
175
|
+
assert.ok(this.player, 'Player not initialized')
|
|
251
176
|
this.player.stop()
|
|
252
177
|
}
|
|
253
178
|
|
|
254
|
-
static registerPlugin(
|
|
255
|
-
plugin: PlayerPlugin,
|
|
256
|
-
) {
|
|
179
|
+
static registerPlugin(plugin: PlayerPlugin) {
|
|
257
180
|
Loader.registerPlugin(plugin)
|
|
258
181
|
}
|
|
259
182
|
|
|
260
|
-
static unregisterPlugin(
|
|
261
|
-
plugin: PlayerPlugin,
|
|
262
|
-
) {
|
|
183
|
+
static unregisterPlugin(plugin: PlayerPlugin) {
|
|
263
184
|
Loader.unregisterPlugin(plugin)
|
|
264
185
|
}
|
|
265
186
|
|
|
266
|
-
private initPlayer(
|
|
267
|
-
coreOptions: CoreOptions,
|
|
268
|
-
) {
|
|
187
|
+
private initPlayer(coreOptions: CoreOptions) {
|
|
269
188
|
trace(`${T} initPlayer`, {
|
|
270
189
|
coreOptions,
|
|
271
190
|
})
|
|
272
191
|
|
|
273
|
-
assert.ok(
|
|
274
|
-
!this.player,
|
|
275
|
-
'Player already initialized',
|
|
276
|
-
)
|
|
192
|
+
assert.ok(!this.player, 'Player already initialized')
|
|
277
193
|
|
|
278
|
-
const player = new PlayerClappr(
|
|
279
|
-
coreOptions,
|
|
280
|
-
)
|
|
194
|
+
const player = new PlayerClappr(coreOptions)
|
|
281
195
|
this.player = player
|
|
282
196
|
|
|
283
197
|
// TODO checks if the whole thing is necessary
|
|
284
|
-
this.tuneInTimerId =
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}, 4000)
|
|
198
|
+
this.tuneInTimerId = globalThis.setTimeout(() => {
|
|
199
|
+
trace(`${T} tuneInTimer`, {
|
|
200
|
+
ready: this.ready,
|
|
201
|
+
tunedIn: this.tunedIn,
|
|
202
|
+
})
|
|
203
|
+
this.tuneInTimerId = null
|
|
204
|
+
this.tuneIn()
|
|
205
|
+
}, 4000)
|
|
293
206
|
}
|
|
294
207
|
|
|
295
208
|
private async tuneIn() {
|
|
@@ -304,9 +217,7 @@ export class Player {
|
|
|
304
217
|
this.tunedIn = true
|
|
305
218
|
const player = this.player
|
|
306
219
|
try {
|
|
307
|
-
this.emitter.emit(
|
|
308
|
-
PlayerEvent.Ready,
|
|
309
|
-
)
|
|
220
|
+
this.emitter.emit(PlayerEvent.Ready)
|
|
310
221
|
} catch (e) {
|
|
311
222
|
reportError(e)
|
|
312
223
|
}
|
|
@@ -320,34 +231,29 @@ export class Player {
|
|
|
320
231
|
},
|
|
321
232
|
null,
|
|
322
233
|
)
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
player.core.handleFullscreenChange()
|
|
332
|
-
} catch (e) {
|
|
333
|
-
reportError(e)
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
)
|
|
234
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
235
|
+
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
236
|
+
try {
|
|
237
|
+
player.core.handleFullscreenChange()
|
|
238
|
+
} catch (e) {
|
|
239
|
+
reportError(e)
|
|
240
|
+
}
|
|
241
|
+
})
|
|
337
242
|
}
|
|
338
243
|
player.core.on(
|
|
339
244
|
ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED,
|
|
340
|
-
({
|
|
341
|
-
orientation
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
245
|
+
({ orientation }: { orientation: 'landscape' | 'portrait' }) => {
|
|
246
|
+
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation })
|
|
247
|
+
},
|
|
248
|
+
null,
|
|
249
|
+
)
|
|
250
|
+
player.core.on(
|
|
251
|
+
ClapprEvents.CORE_RESIZE,
|
|
252
|
+
({ width, height }: { width: number; height: number }) => {
|
|
253
|
+
trace(`${T} CORE_RESIZE`, {
|
|
254
|
+
width,
|
|
255
|
+
height,
|
|
256
|
+
})
|
|
351
257
|
},
|
|
352
258
|
null,
|
|
353
259
|
)
|
|
@@ -355,12 +261,8 @@ export class Player {
|
|
|
355
261
|
setTimeout(() => {
|
|
356
262
|
trace(`${T} autoPlay`, {
|
|
357
263
|
player: !!this.player,
|
|
358
|
-
container:
|
|
359
|
-
|
|
360
|
-
.activeContainer,
|
|
361
|
-
playback:
|
|
362
|
-
this.player?.core
|
|
363
|
-
.activePlayback.name,
|
|
264
|
+
container: !!this.player?.core.activeContainer,
|
|
265
|
+
playback: this.player?.core.activePlayback.name,
|
|
364
266
|
})
|
|
365
267
|
assert(this.player)
|
|
366
268
|
this.player.play({
|
|
@@ -385,105 +287,75 @@ export class Player {
|
|
|
385
287
|
}
|
|
386
288
|
setTimeout(() => this.tuneIn(), 0)
|
|
387
289
|
},
|
|
388
|
-
onResize: (newSize: {
|
|
389
|
-
width: number
|
|
390
|
-
height: number
|
|
391
|
-
}) => {
|
|
290
|
+
onResize: (newSize: { width: number; height: number }) => {
|
|
392
291
|
trace(`${T} CORE_RESIZE`, {
|
|
393
292
|
newSize,
|
|
394
293
|
})
|
|
395
294
|
},
|
|
396
295
|
onPlay: () => {
|
|
397
296
|
try {
|
|
398
|
-
this.emitter.emit(
|
|
399
|
-
PlayerEvent.Play,
|
|
400
|
-
)
|
|
297
|
+
this.emitter.emit(PlayerEvent.Play)
|
|
401
298
|
} catch (e) {
|
|
402
299
|
reportError(e)
|
|
403
300
|
}
|
|
404
301
|
},
|
|
405
302
|
onPause: () => {
|
|
406
303
|
try {
|
|
407
|
-
this.emitter.emit(
|
|
408
|
-
PlayerEvent.Pause,
|
|
409
|
-
)
|
|
304
|
+
this.emitter.emit(PlayerEvent.Pause)
|
|
410
305
|
} catch (e) {
|
|
411
306
|
reportError(e)
|
|
412
307
|
}
|
|
413
308
|
},
|
|
414
309
|
onEnded: () => {
|
|
415
310
|
try {
|
|
416
|
-
this.emitter.emit(
|
|
417
|
-
PlayerEvent.Ended,
|
|
418
|
-
)
|
|
311
|
+
this.emitter.emit(PlayerEvent.Ended)
|
|
419
312
|
} catch (e) {
|
|
420
313
|
reportError(e)
|
|
421
314
|
}
|
|
422
315
|
},
|
|
423
316
|
onStop: () => {
|
|
424
317
|
try {
|
|
425
|
-
this.emitter.emit(
|
|
426
|
-
PlayerEvent.Stop,
|
|
427
|
-
)
|
|
318
|
+
this.emitter.emit(PlayerEvent.Stop)
|
|
428
319
|
} catch (e) {
|
|
429
320
|
reportError(e)
|
|
430
321
|
}
|
|
431
322
|
},
|
|
432
323
|
}
|
|
433
324
|
|
|
434
|
-
private buildCoreOptions(
|
|
435
|
-
|
|
436
|
-
): CoreOptions {
|
|
437
|
-
const multisources =
|
|
438
|
-
this.config.multisources
|
|
325
|
+
private buildCoreOptions(playerElement: HTMLElement): CoreOptions {
|
|
326
|
+
const multisources = this.config.multisources
|
|
439
327
|
const mainSource =
|
|
440
|
-
this.config.playbackType ===
|
|
441
|
-
|
|
442
|
-
? multisources.find(
|
|
443
|
-
(ms) => ms.live !== false,
|
|
444
|
-
)
|
|
328
|
+
this.config.playbackType === 'live'
|
|
329
|
+
? multisources.find((ms) => ms.live !== false)
|
|
445
330
|
: multisources[0]
|
|
446
331
|
const mediaSources = mainSource
|
|
447
|
-
? this.buildMediaSourcesList(
|
|
448
|
-
mainSource,
|
|
449
|
-
)
|
|
332
|
+
? this.buildMediaSourcesList(mainSource)
|
|
450
333
|
: []
|
|
451
334
|
// const mainSourceUrl = mediaSources[0];
|
|
452
|
-
const poster =
|
|
453
|
-
mainSource?.poster ??
|
|
454
|
-
this.config.poster
|
|
335
|
+
const poster = mainSource?.poster ?? this.config.poster
|
|
455
336
|
|
|
456
|
-
const coreOptions: CoreOptions &
|
|
457
|
-
PluginOptions = {
|
|
337
|
+
const coreOptions: CoreOptions & PluginOptions = {
|
|
458
338
|
...this.config.pluginSettings,
|
|
459
339
|
allowUserInteraction: true,
|
|
460
340
|
autoPlay: false,
|
|
461
|
-
debug:
|
|
462
|
-
this.config.debug || 'none',
|
|
341
|
+
debug: this.config.debug || 'none',
|
|
463
342
|
events: this.events,
|
|
464
|
-
height:
|
|
465
|
-
playerElement.clientHeight,
|
|
343
|
+
height: playerElement.clientHeight,
|
|
466
344
|
loop: this.config.loop,
|
|
467
345
|
multisources,
|
|
468
346
|
mute: this.config.mute,
|
|
469
347
|
playback: {
|
|
470
348
|
controls: false,
|
|
471
349
|
playInline: true,
|
|
472
|
-
preload: Browser.isiOS
|
|
473
|
-
? 'metadata'
|
|
474
|
-
: 'none',
|
|
350
|
+
preload: Browser.isiOS ? 'metadata' : 'none',
|
|
475
351
|
mute: this.config.mute,
|
|
476
352
|
crossOrigin: 'anonymous', // TODO
|
|
477
353
|
hlsjsConfig: {
|
|
478
|
-
debug:
|
|
479
|
-
this.config.debug ===
|
|
480
|
-
'all' ||
|
|
481
|
-
this.config.debug === 'hls',
|
|
354
|
+
debug: this.config.debug === 'all' || this.config.debug === 'hls',
|
|
482
355
|
},
|
|
483
356
|
},
|
|
484
357
|
parent: playerElement,
|
|
485
|
-
playbackType:
|
|
486
|
-
this.config.playbackType,
|
|
358
|
+
playbackType: this.config.playbackType,
|
|
487
359
|
poster,
|
|
488
360
|
width: playerElement.clientWidth,
|
|
489
361
|
// source: mainSourceUrl,
|
|
@@ -494,9 +366,7 @@ export class Player {
|
|
|
494
366
|
}
|
|
495
367
|
|
|
496
368
|
private configurePlaybacks() {
|
|
497
|
-
Loader.registerPlayback(
|
|
498
|
-
DashPlayback,
|
|
499
|
-
)
|
|
369
|
+
Loader.registerPlayback(DashPlayback)
|
|
500
370
|
Loader.registerPlayback(HlsPlayback)
|
|
501
371
|
}
|
|
502
372
|
|
|
@@ -509,25 +379,16 @@ export class Player {
|
|
|
509
379
|
)
|
|
510
380
|
}
|
|
511
381
|
|
|
512
|
-
private buildMediaSourcesList(
|
|
513
|
-
ms: StreamMediaSource,
|
|
514
|
-
): string[] {
|
|
382
|
+
private buildMediaSourcesList(ms: StreamMediaSource): string[] {
|
|
515
383
|
const msl: string[] = []
|
|
516
|
-
const sources: Record<
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
master: ms.source,
|
|
525
|
-
hls: ms.hlsCmafUrl,
|
|
526
|
-
mpegts: ms.hlsMpegtsUrl,
|
|
527
|
-
}
|
|
528
|
-
switch (
|
|
529
|
-
this.config.priorityTransport
|
|
530
|
-
) {
|
|
384
|
+
const sources: Record<'dash' | 'master' | 'hls' | 'mpegts', string | null> =
|
|
385
|
+
{
|
|
386
|
+
dash: ms.sourceDash,
|
|
387
|
+
master: ms.source,
|
|
388
|
+
hls: ms.hlsCmafUrl,
|
|
389
|
+
mpegts: ms.hlsMpegtsUrl,
|
|
390
|
+
}
|
|
391
|
+
switch (this.config.priorityTransport) {
|
|
531
392
|
case 'dash':
|
|
532
393
|
addDash()
|
|
533
394
|
break
|
|
@@ -542,13 +403,11 @@ export class Player {
|
|
|
542
403
|
addHls()
|
|
543
404
|
break
|
|
544
405
|
}
|
|
545
|
-
Object.values(sources).forEach(
|
|
546
|
-
(s)
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
},
|
|
551
|
-
)
|
|
406
|
+
Object.values(sources).forEach((s) => {
|
|
407
|
+
if (s) {
|
|
408
|
+
msl.push(s)
|
|
409
|
+
}
|
|
410
|
+
})
|
|
552
411
|
return msl
|
|
553
412
|
|
|
554
413
|
function addMpegts() {
|
|
@@ -559,20 +418,13 @@ export class Player {
|
|
|
559
418
|
}
|
|
560
419
|
|
|
561
420
|
function addHls() {
|
|
562
|
-
if (
|
|
563
|
-
sources.hls &&
|
|
564
|
-
HlsPlayback.canPlay(sources.hls)
|
|
565
|
-
) {
|
|
421
|
+
if (sources.hls && HlsPlayback.canPlay(sources.hls)) {
|
|
566
422
|
msl.push(sources.hls)
|
|
567
423
|
sources.hls = null
|
|
568
424
|
}
|
|
569
425
|
if (
|
|
570
|
-
sources.master?.endsWith(
|
|
571
|
-
|
|
572
|
-
) &&
|
|
573
|
-
HlsPlayback.canPlay(
|
|
574
|
-
sources.master,
|
|
575
|
-
)
|
|
426
|
+
sources.master?.endsWith('.m3u8') &&
|
|
427
|
+
HlsPlayback.canPlay(sources.master)
|
|
576
428
|
) {
|
|
577
429
|
msl.push(sources.master)
|
|
578
430
|
sources.master = null
|
|
@@ -580,12 +432,7 @@ export class Player {
|
|
|
580
432
|
}
|
|
581
433
|
|
|
582
434
|
function addDash() {
|
|
583
|
-
if (
|
|
584
|
-
sources.dash &&
|
|
585
|
-
DashPlayback.canPlay(
|
|
586
|
-
sources.dash,
|
|
587
|
-
)
|
|
588
|
-
) {
|
|
435
|
+
if (sources.dash && DashPlayback.canPlay(sources.dash)) {
|
|
589
436
|
msl.push(sources.dash)
|
|
590
437
|
sources.dash = null
|
|
591
438
|
}
|