@gcorevideo/player 2.1.10 → 2.1.12
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 +96 -40
- package/lib/Player.d.ts +2 -2
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +97 -41
- package/package.json +1 -1
- package/src/Player.ts +375 -170
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -42221,7 +42221,7 @@ HlsPlayback.canPlay = function (resource, mimeType) {
|
|
|
42221
42221
|
return !!(hasSupport && isHls);
|
|
42222
42222
|
};
|
|
42223
42223
|
|
|
42224
|
-
const T =
|
|
42224
|
+
const T = 'GPlayer';
|
|
42225
42225
|
const DEFAULT_OPTIONS = {
|
|
42226
42226
|
autoPlay: false,
|
|
42227
42227
|
mute: false,
|
|
@@ -42249,7 +42249,8 @@ class Player {
|
|
|
42249
42249
|
if (!this.player?.core.activePlayback) {
|
|
42250
42250
|
return null;
|
|
42251
42251
|
}
|
|
42252
|
-
switch (this.player.core.activePlayback
|
|
42252
|
+
switch (this.player.core.activePlayback
|
|
42253
|
+
.name) {
|
|
42253
42254
|
case 'dash':
|
|
42254
42255
|
return 'dash';
|
|
42255
42256
|
case 'hls':
|
|
@@ -42262,7 +42263,8 @@ class Player {
|
|
|
42262
42263
|
return this.bitrateInfo;
|
|
42263
42264
|
}
|
|
42264
42265
|
get hd() {
|
|
42265
|
-
return this.player?.core.activePlayback
|
|
42266
|
+
return (this.player?.core.activePlayback
|
|
42267
|
+
?.isHighDefinitionInUse || false);
|
|
42266
42268
|
}
|
|
42267
42269
|
get playbackType() {
|
|
42268
42270
|
return this.player?.core.activePlayback?.getPlaybackType();
|
|
@@ -42289,11 +42291,15 @@ class Player {
|
|
|
42289
42291
|
this.config.debug === 'clappr') {
|
|
42290
42292
|
Log.setLevel(0);
|
|
42291
42293
|
}
|
|
42292
|
-
trace(`${T} init`, {
|
|
42294
|
+
trace(`${T} init`, {
|
|
42295
|
+
config: this.config,
|
|
42296
|
+
});
|
|
42293
42297
|
this.configurePlaybacks();
|
|
42294
42298
|
const coreOpts = this.buildCoreOptions(playerElement);
|
|
42295
|
-
const { core, container
|
|
42296
|
-
trace(`${T} init`, {
|
|
42299
|
+
const { core, container } = Loader.registeredPlugins;
|
|
42300
|
+
trace(`${T} init`, {
|
|
42301
|
+
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.name),
|
|
42302
|
+
});
|
|
42297
42303
|
coreOpts.plugins = {
|
|
42298
42304
|
core: Object.values(core),
|
|
42299
42305
|
container: Object.values(container),
|
|
@@ -42302,7 +42308,9 @@ class Player {
|
|
|
42302
42308
|
return this.initPlayer(coreOpts);
|
|
42303
42309
|
}
|
|
42304
42310
|
destroy() {
|
|
42305
|
-
trace(`${T} destroy`, {
|
|
42311
|
+
trace(`${T} destroy`, {
|
|
42312
|
+
player: !!this.player,
|
|
42313
|
+
});
|
|
42306
42314
|
if (this.player) {
|
|
42307
42315
|
this.player.destroy();
|
|
42308
42316
|
this.player = null;
|
|
@@ -42338,16 +42346,22 @@ class Player {
|
|
|
42338
42346
|
Loader.unregisterPlugin(plugin);
|
|
42339
42347
|
}
|
|
42340
42348
|
initPlayer(coreOptions) {
|
|
42341
|
-
trace(`${T} initPlayer`, {
|
|
42349
|
+
trace(`${T} initPlayer`, {
|
|
42350
|
+
coreOptions,
|
|
42351
|
+
});
|
|
42342
42352
|
assert.ok(!this.player, 'Player already initialized');
|
|
42343
42353
|
const player = new Player$1(coreOptions);
|
|
42344
42354
|
this.player = player;
|
|
42345
42355
|
// TODO checks if the whole thing is necessary
|
|
42346
|
-
this.tuneInTimerId =
|
|
42347
|
-
|
|
42348
|
-
|
|
42349
|
-
|
|
42350
|
-
|
|
42356
|
+
this.tuneInTimerId =
|
|
42357
|
+
globalThis.setTimeout(() => {
|
|
42358
|
+
trace(`${T} tuneInTimer`, {
|
|
42359
|
+
ready: this.ready,
|
|
42360
|
+
tunedIn: this.tunedIn,
|
|
42361
|
+
});
|
|
42362
|
+
this.tuneInTimerId = null;
|
|
42363
|
+
this.tuneIn();
|
|
42364
|
+
}, 4000);
|
|
42351
42365
|
}
|
|
42352
42366
|
async tuneIn() {
|
|
42353
42367
|
assert.ok(this.player);
|
|
@@ -42383,11 +42397,22 @@ class Player {
|
|
|
42383
42397
|
}
|
|
42384
42398
|
});
|
|
42385
42399
|
}
|
|
42400
|
+
player.core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation, }) => {
|
|
42401
|
+
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation });
|
|
42402
|
+
}, null);
|
|
42386
42403
|
if (this.config.autoPlay) {
|
|
42387
42404
|
setTimeout(() => {
|
|
42388
|
-
trace(`${T} autoPlay`, {
|
|
42405
|
+
trace(`${T} autoPlay`, {
|
|
42406
|
+
player: !!this.player,
|
|
42407
|
+
container: !!this.player?.core
|
|
42408
|
+
.activeContainer,
|
|
42409
|
+
playback: this.player?.core
|
|
42410
|
+
.activePlayback.name,
|
|
42411
|
+
});
|
|
42389
42412
|
assert(this.player);
|
|
42390
|
-
this.player.play({
|
|
42413
|
+
this.player.play({
|
|
42414
|
+
autoPlay: true,
|
|
42415
|
+
});
|
|
42391
42416
|
}, 0);
|
|
42392
42417
|
}
|
|
42393
42418
|
}
|
|
@@ -42406,6 +42431,11 @@ class Player {
|
|
|
42406
42431
|
}
|
|
42407
42432
|
setTimeout(() => this.tuneIn(), 0);
|
|
42408
42433
|
},
|
|
42434
|
+
onResize: (newSize) => {
|
|
42435
|
+
trace(`${T} CORE_RESIZE`, {
|
|
42436
|
+
newSize,
|
|
42437
|
+
});
|
|
42438
|
+
},
|
|
42409
42439
|
onPlay: () => {
|
|
42410
42440
|
try {
|
|
42411
42441
|
this.emitter.emit(PlayerEvent.Play);
|
|
@@ -42441,10 +42471,16 @@ class Player {
|
|
|
42441
42471
|
};
|
|
42442
42472
|
buildCoreOptions(playerElement) {
|
|
42443
42473
|
const multisources = this.config.multisources;
|
|
42444
|
-
const mainSource = this.config.playbackType ===
|
|
42445
|
-
|
|
42446
|
-
|
|
42447
|
-
|
|
42474
|
+
const mainSource = this.config.playbackType ===
|
|
42475
|
+
'live'
|
|
42476
|
+
? multisources.find((ms) => ms.live !== false)
|
|
42477
|
+
: multisources[0];
|
|
42478
|
+
const mediaSources = mainSource
|
|
42479
|
+
? this.buildMediaSourcesList(mainSource)
|
|
42480
|
+
: [];
|
|
42481
|
+
// const mainSourceUrl = mediaSources[0];
|
|
42482
|
+
const poster = mainSource?.poster ??
|
|
42483
|
+
this.config.poster;
|
|
42448
42484
|
const coreOptions = {
|
|
42449
42485
|
...this.config.pluginSettings,
|
|
42450
42486
|
allowUserInteraction: true,
|
|
@@ -42458,11 +42494,15 @@ class Player {
|
|
|
42458
42494
|
playback: {
|
|
42459
42495
|
controls: false,
|
|
42460
42496
|
playInline: true,
|
|
42461
|
-
preload: Browser.isiOS
|
|
42497
|
+
preload: Browser.isiOS
|
|
42498
|
+
? 'metadata'
|
|
42499
|
+
: 'none',
|
|
42462
42500
|
mute: this.config.mute,
|
|
42463
42501
|
crossOrigin: 'anonymous', // TODO
|
|
42464
42502
|
hlsjsConfig: {
|
|
42465
|
-
debug: this.config.debug ===
|
|
42503
|
+
debug: this.config.debug ===
|
|
42504
|
+
'all' ||
|
|
42505
|
+
this.config.debug === 'hls',
|
|
42466
42506
|
},
|
|
42467
42507
|
},
|
|
42468
42508
|
parent: playerElement,
|
|
@@ -42494,34 +42534,50 @@ class Player {
|
|
|
42494
42534
|
};
|
|
42495
42535
|
switch (this.config.priorityTransport) {
|
|
42496
42536
|
case 'dash':
|
|
42497
|
-
|
|
42498
|
-
msl.push(sources.dash);
|
|
42499
|
-
sources.dash = null;
|
|
42500
|
-
}
|
|
42537
|
+
addDash();
|
|
42501
42538
|
break;
|
|
42502
42539
|
case 'hls':
|
|
42503
|
-
|
|
42504
|
-
msl.push(sources.hls);
|
|
42505
|
-
sources.hls = null;
|
|
42506
|
-
}
|
|
42507
|
-
if (sources.master?.endsWith('.m3u8')) {
|
|
42508
|
-
msl.push(sources.master);
|
|
42509
|
-
sources.master = null;
|
|
42510
|
-
}
|
|
42540
|
+
addHls();
|
|
42511
42541
|
break;
|
|
42512
42542
|
case 'mpegts':
|
|
42513
|
-
|
|
42514
|
-
|
|
42515
|
-
|
|
42516
|
-
|
|
42543
|
+
addMpegts();
|
|
42544
|
+
break;
|
|
42545
|
+
case 'auto':
|
|
42546
|
+
addDash();
|
|
42547
|
+
addHls();
|
|
42517
42548
|
break;
|
|
42518
42549
|
}
|
|
42519
|
-
Object.values(sources).forEach(s => {
|
|
42550
|
+
Object.values(sources).forEach((s) => {
|
|
42520
42551
|
if (s) {
|
|
42521
42552
|
msl.push(s);
|
|
42522
42553
|
}
|
|
42523
42554
|
});
|
|
42524
42555
|
return msl;
|
|
42556
|
+
function addMpegts() {
|
|
42557
|
+
if (sources.mpegts) {
|
|
42558
|
+
msl.push(sources.mpegts);
|
|
42559
|
+
sources.mpegts = null;
|
|
42560
|
+
}
|
|
42561
|
+
}
|
|
42562
|
+
function addHls() {
|
|
42563
|
+
if (sources.hls &&
|
|
42564
|
+
HlsPlayback.canPlay(sources.hls)) {
|
|
42565
|
+
msl.push(sources.hls);
|
|
42566
|
+
sources.hls = null;
|
|
42567
|
+
}
|
|
42568
|
+
if (sources.master?.endsWith('.m3u8') &&
|
|
42569
|
+
HlsPlayback.canPlay(sources.master)) {
|
|
42570
|
+
msl.push(sources.master);
|
|
42571
|
+
sources.master = null;
|
|
42572
|
+
}
|
|
42573
|
+
}
|
|
42574
|
+
function addDash() {
|
|
42575
|
+
if (sources.dash &&
|
|
42576
|
+
DashPlayback.canPlay(sources.dash)) {
|
|
42577
|
+
msl.push(sources.dash);
|
|
42578
|
+
sources.dash = null;
|
|
42579
|
+
}
|
|
42580
|
+
}
|
|
42525
42581
|
}
|
|
42526
42582
|
}
|
|
42527
42583
|
|
|
@@ -42647,12 +42703,12 @@ class SentryTracer {
|
|
|
42647
42703
|
}
|
|
42648
42704
|
}
|
|
42649
42705
|
|
|
42650
|
-
var version$1 = "2.1.
|
|
42706
|
+
var version$1 = "2.1.12";
|
|
42651
42707
|
|
|
42652
42708
|
var packages = {
|
|
42653
42709
|
"": {
|
|
42654
42710
|
name: "@gcorevideo/player",
|
|
42655
|
-
version: "2.1.
|
|
42711
|
+
version: "2.1.12",
|
|
42656
42712
|
license: "Apache-2.0",
|
|
42657
42713
|
dependencies: {
|
|
42658
42714
|
"@clappr/core": "^0.11.3",
|
package/lib/Player.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BitrateInfo, PlaybackType, PlayerPlugin } from
|
|
2
|
-
import { PlayerConfig, PlayerEvent } from
|
|
1
|
+
import type { BitrateInfo, PlaybackType, PlayerPlugin } from './types.js';
|
|
2
|
+
import { PlayerConfig, PlayerEvent } from './types.js';
|
|
3
3
|
import '../assets/style/main.scss';
|
|
4
4
|
type PlayerEventHandler<T extends PlayerEvent> = () => void;
|
|
5
5
|
export type PlaybackModule = 'dash' | 'hls' | 'native';
|
package/lib/Player.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EAEb,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EAEb,MAAM,YAAY,CAAA;AAKnB,OAAO,EACL,YAAY,EACZ,WAAW,EACZ,MAAM,YAAY,CAAA;AAInB,OAAO,2BAA2B,CAAA;AAIlC,KAAK,kBAAkB,CACrB,CAAC,SAAS,WAAW,IACnB,MAAM,IAAI,CAAA;AAiBd,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,KAAK,GACL,QAAQ,CAAA;AAOZ;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,WAAW,CACb;IAEN,OAAO,CAAC,MAAM,CACG;IAEjB,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,MAAM,CACR;IAEN,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,aAAa,CAEN;IAEf,OAAO,CAAC,OAAO,CAAQ;IAEvB,IAAI,cAAc,IAAI,cAAc,GAAG,IAAI,CAiB1C;IAED,IAAI,OAAO,IAAI,WAAW,GAAG,IAAI,CAEhC;IAED,IAAI,EAAE,QAKL;IAED,IAAI,YAAY,IACZ,YAAY,GACZ,SAAS,CAEZ;gBAEW,MAAM,EAAE,YAAY;IAIhC,EAAE,CAAC,CAAC,SAAS,WAAW,EACtB,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAKhC,GAAG,CAAC,CAAC,SAAS,WAAW,EACvB,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAKhC,SAAS,CACP,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC;IAK/B,OAAO,CAAC,SAAS;IAUX,IAAI,CACR,aAAa,EAAE,WAAW;IA4C5B,OAAO;IAiBP,KAAK;IAQL,IAAI;IAQJ,MAAM,CAAC,IAAI,EAAE,MAAM;IAQnB,IAAI;IAQJ,MAAM,CAAC,cAAc,CACnB,MAAM,EAAE,YAAY;IAKtB,MAAM,CAAC,gBAAgB,CACrB,MAAM,EAAE,YAAY;IAKtB,OAAO,CAAC,UAAU;YA6BJ,MAAM;IA8EpB,OAAO,CAAC,MAAM,CA2Db;IAED,OAAO,CAAC,gBAAgB;IA8DxB,OAAO,CAAC,kBAAkB;IAO1B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,qBAAqB;CAkF9B"}
|
package/lib/Player.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Browser, Events as ClapprEvents, Log, Player as PlayerClappr, $, Loader, } from '@clappr/core';
|
|
2
2
|
import assert from 'assert';
|
|
3
|
-
import EventLite from
|
|
4
|
-
import { reportError, trace } from
|
|
5
|
-
import { PlayerEvent, } from
|
|
3
|
+
import EventLite from 'event-lite';
|
|
4
|
+
import { reportError, trace, } from './trace/index.js';
|
|
5
|
+
import { PlayerEvent, } from './types.js';
|
|
6
6
|
import DashPlayback from './plugins/dash-playback/DashPlayback.js';
|
|
7
7
|
import HlsPlayback from './plugins/hls-playback/HlsPlayback.js';
|
|
8
8
|
import '../assets/style/main.scss'; // TODO check if needed
|
|
9
|
-
const T =
|
|
9
|
+
const T = 'GPlayer';
|
|
10
10
|
const DEFAULT_OPTIONS = {
|
|
11
11
|
autoPlay: false,
|
|
12
12
|
mute: false,
|
|
@@ -34,7 +34,8 @@ export class Player {
|
|
|
34
34
|
if (!this.player?.core.activePlayback) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
switch (this.player.core.activePlayback
|
|
37
|
+
switch (this.player.core.activePlayback
|
|
38
|
+
.name) {
|
|
38
39
|
case 'dash':
|
|
39
40
|
return 'dash';
|
|
40
41
|
case 'hls':
|
|
@@ -47,7 +48,8 @@ export class Player {
|
|
|
47
48
|
return this.bitrateInfo;
|
|
48
49
|
}
|
|
49
50
|
get hd() {
|
|
50
|
-
return this.player?.core.activePlayback
|
|
51
|
+
return (this.player?.core.activePlayback
|
|
52
|
+
?.isHighDefinitionInUse || false);
|
|
51
53
|
}
|
|
52
54
|
get playbackType() {
|
|
53
55
|
return this.player?.core.activePlayback?.getPlaybackType();
|
|
@@ -74,11 +76,15 @@ export class Player {
|
|
|
74
76
|
this.config.debug === 'clappr') {
|
|
75
77
|
Log.setLevel(0);
|
|
76
78
|
}
|
|
77
|
-
trace(`${T} init`, {
|
|
79
|
+
trace(`${T} init`, {
|
|
80
|
+
config: this.config,
|
|
81
|
+
});
|
|
78
82
|
this.configurePlaybacks();
|
|
79
83
|
const coreOpts = this.buildCoreOptions(playerElement);
|
|
80
|
-
const { core, container
|
|
81
|
-
trace(`${T} init`, {
|
|
84
|
+
const { core, container } = Loader.registeredPlugins;
|
|
85
|
+
trace(`${T} init`, {
|
|
86
|
+
registeredPlaybacks: Loader.registeredPlaybacks.map((p) => p.name),
|
|
87
|
+
});
|
|
82
88
|
coreOpts.plugins = {
|
|
83
89
|
core: Object.values(core),
|
|
84
90
|
container: Object.values(container),
|
|
@@ -87,7 +93,9 @@ export class Player {
|
|
|
87
93
|
return this.initPlayer(coreOpts);
|
|
88
94
|
}
|
|
89
95
|
destroy() {
|
|
90
|
-
trace(`${T} destroy`, {
|
|
96
|
+
trace(`${T} destroy`, {
|
|
97
|
+
player: !!this.player,
|
|
98
|
+
});
|
|
91
99
|
if (this.player) {
|
|
92
100
|
this.player.destroy();
|
|
93
101
|
this.player = null;
|
|
@@ -123,16 +131,22 @@ export class Player {
|
|
|
123
131
|
Loader.unregisterPlugin(plugin);
|
|
124
132
|
}
|
|
125
133
|
initPlayer(coreOptions) {
|
|
126
|
-
trace(`${T} initPlayer`, {
|
|
134
|
+
trace(`${T} initPlayer`, {
|
|
135
|
+
coreOptions,
|
|
136
|
+
});
|
|
127
137
|
assert.ok(!this.player, 'Player already initialized');
|
|
128
138
|
const player = new PlayerClappr(coreOptions);
|
|
129
139
|
this.player = player;
|
|
130
140
|
// TODO checks if the whole thing is necessary
|
|
131
|
-
this.tuneInTimerId =
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
141
|
+
this.tuneInTimerId =
|
|
142
|
+
globalThis.setTimeout(() => {
|
|
143
|
+
trace(`${T} tuneInTimer`, {
|
|
144
|
+
ready: this.ready,
|
|
145
|
+
tunedIn: this.tunedIn,
|
|
146
|
+
});
|
|
147
|
+
this.tuneInTimerId = null;
|
|
148
|
+
this.tuneIn();
|
|
149
|
+
}, 4000);
|
|
136
150
|
}
|
|
137
151
|
async tuneIn() {
|
|
138
152
|
assert.ok(this.player);
|
|
@@ -168,11 +182,22 @@ export class Player {
|
|
|
168
182
|
}
|
|
169
183
|
});
|
|
170
184
|
}
|
|
185
|
+
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation, }) => {
|
|
186
|
+
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation });
|
|
187
|
+
}, null);
|
|
171
188
|
if (this.config.autoPlay) {
|
|
172
189
|
setTimeout(() => {
|
|
173
|
-
trace(`${T} autoPlay`, {
|
|
190
|
+
trace(`${T} autoPlay`, {
|
|
191
|
+
player: !!this.player,
|
|
192
|
+
container: !!this.player?.core
|
|
193
|
+
.activeContainer,
|
|
194
|
+
playback: this.player?.core
|
|
195
|
+
.activePlayback.name,
|
|
196
|
+
});
|
|
174
197
|
assert(this.player);
|
|
175
|
-
this.player.play({
|
|
198
|
+
this.player.play({
|
|
199
|
+
autoPlay: true,
|
|
200
|
+
});
|
|
176
201
|
}, 0);
|
|
177
202
|
}
|
|
178
203
|
}
|
|
@@ -191,6 +216,11 @@ export class Player {
|
|
|
191
216
|
}
|
|
192
217
|
setTimeout(() => this.tuneIn(), 0);
|
|
193
218
|
},
|
|
219
|
+
onResize: (newSize) => {
|
|
220
|
+
trace(`${T} CORE_RESIZE`, {
|
|
221
|
+
newSize,
|
|
222
|
+
});
|
|
223
|
+
},
|
|
194
224
|
onPlay: () => {
|
|
195
225
|
try {
|
|
196
226
|
this.emitter.emit(PlayerEvent.Play);
|
|
@@ -226,10 +256,16 @@ export class Player {
|
|
|
226
256
|
};
|
|
227
257
|
buildCoreOptions(playerElement) {
|
|
228
258
|
const multisources = this.config.multisources;
|
|
229
|
-
const mainSource = this.config.playbackType ===
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
259
|
+
const mainSource = this.config.playbackType ===
|
|
260
|
+
'live'
|
|
261
|
+
? multisources.find((ms) => ms.live !== false)
|
|
262
|
+
: multisources[0];
|
|
263
|
+
const mediaSources = mainSource
|
|
264
|
+
? this.buildMediaSourcesList(mainSource)
|
|
265
|
+
: [];
|
|
266
|
+
// const mainSourceUrl = mediaSources[0];
|
|
267
|
+
const poster = mainSource?.poster ??
|
|
268
|
+
this.config.poster;
|
|
233
269
|
const coreOptions = {
|
|
234
270
|
...this.config.pluginSettings,
|
|
235
271
|
allowUserInteraction: true,
|
|
@@ -243,11 +279,15 @@ export class Player {
|
|
|
243
279
|
playback: {
|
|
244
280
|
controls: false,
|
|
245
281
|
playInline: true,
|
|
246
|
-
preload: Browser.isiOS
|
|
282
|
+
preload: Browser.isiOS
|
|
283
|
+
? 'metadata'
|
|
284
|
+
: 'none',
|
|
247
285
|
mute: this.config.mute,
|
|
248
286
|
crossOrigin: 'anonymous', // TODO
|
|
249
287
|
hlsjsConfig: {
|
|
250
|
-
debug: this.config.debug ===
|
|
288
|
+
debug: this.config.debug ===
|
|
289
|
+
'all' ||
|
|
290
|
+
this.config.debug === 'hls',
|
|
251
291
|
},
|
|
252
292
|
},
|
|
253
293
|
parent: playerElement,
|
|
@@ -279,33 +319,49 @@ export class Player {
|
|
|
279
319
|
};
|
|
280
320
|
switch (this.config.priorityTransport) {
|
|
281
321
|
case 'dash':
|
|
282
|
-
|
|
283
|
-
msl.push(sources.dash);
|
|
284
|
-
sources.dash = null;
|
|
285
|
-
}
|
|
322
|
+
addDash();
|
|
286
323
|
break;
|
|
287
324
|
case 'hls':
|
|
288
|
-
|
|
289
|
-
msl.push(sources.hls);
|
|
290
|
-
sources.hls = null;
|
|
291
|
-
}
|
|
292
|
-
if (sources.master?.endsWith('.m3u8')) {
|
|
293
|
-
msl.push(sources.master);
|
|
294
|
-
sources.master = null;
|
|
295
|
-
}
|
|
325
|
+
addHls();
|
|
296
326
|
break;
|
|
297
327
|
case 'mpegts':
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
328
|
+
addMpegts();
|
|
329
|
+
break;
|
|
330
|
+
case 'auto':
|
|
331
|
+
addDash();
|
|
332
|
+
addHls();
|
|
302
333
|
break;
|
|
303
334
|
}
|
|
304
|
-
Object.values(sources).forEach(s => {
|
|
335
|
+
Object.values(sources).forEach((s) => {
|
|
305
336
|
if (s) {
|
|
306
337
|
msl.push(s);
|
|
307
338
|
}
|
|
308
339
|
});
|
|
309
340
|
return msl;
|
|
341
|
+
function addMpegts() {
|
|
342
|
+
if (sources.mpegts) {
|
|
343
|
+
msl.push(sources.mpegts);
|
|
344
|
+
sources.mpegts = null;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function addHls() {
|
|
348
|
+
if (sources.hls &&
|
|
349
|
+
HlsPlayback.canPlay(sources.hls)) {
|
|
350
|
+
msl.push(sources.hls);
|
|
351
|
+
sources.hls = null;
|
|
352
|
+
}
|
|
353
|
+
if (sources.master?.endsWith('.m3u8') &&
|
|
354
|
+
HlsPlayback.canPlay(sources.master)) {
|
|
355
|
+
msl.push(sources.master);
|
|
356
|
+
sources.master = null;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
function addDash() {
|
|
360
|
+
if (sources.dash &&
|
|
361
|
+
DashPlayback.canPlay(sources.dash)) {
|
|
362
|
+
msl.push(sources.dash);
|
|
363
|
+
sources.dash = null;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
310
366
|
}
|
|
311
367
|
}
|