@gcorevideo/player 2.1.12 → 2.1.14
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 +50 -44
- package/lib/Player.d.ts +1 -0
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +50 -44
- package/package.json +1 -1
- package/src/Player.ts +123 -259
- package/tsconfig.tsbuildinfo +1 -1
package/dist/index.js
CHANGED
|
@@ -42243,14 +42243,14 @@ class Player {
|
|
|
42243
42243
|
emitter = new EventLite();
|
|
42244
42244
|
player = null;
|
|
42245
42245
|
ready = false;
|
|
42246
|
+
rootNode = null;
|
|
42246
42247
|
tuneInTimerId = null;
|
|
42247
42248
|
tunedIn = false;
|
|
42248
42249
|
get activePlayback() {
|
|
42249
42250
|
if (!this.player?.core.activePlayback) {
|
|
42250
42251
|
return null;
|
|
42251
42252
|
}
|
|
42252
|
-
switch (this.player.core.activePlayback
|
|
42253
|
-
.name) {
|
|
42253
|
+
switch (this.player.core.activePlayback.name) {
|
|
42254
42254
|
case 'dash':
|
|
42255
42255
|
return 'dash';
|
|
42256
42256
|
case 'hls':
|
|
@@ -42263,8 +42263,7 @@ class Player {
|
|
|
42263
42263
|
return this.bitrateInfo;
|
|
42264
42264
|
}
|
|
42265
42265
|
get hd() {
|
|
42266
|
-
return
|
|
42267
|
-
?.isHighDefinitionInUse || false);
|
|
42266
|
+
return this.player?.core.activePlayback?.isHighDefinitionInUse || false;
|
|
42268
42267
|
}
|
|
42269
42268
|
get playbackType() {
|
|
42270
42269
|
return this.player?.core.activePlayback?.getPlaybackType();
|
|
@@ -42287,8 +42286,7 @@ class Player {
|
|
|
42287
42286
|
async init(playerElement) {
|
|
42288
42287
|
assert.ok(!this.player, 'Player already initialized');
|
|
42289
42288
|
assert.ok(playerElement, 'Player container element is required');
|
|
42290
|
-
if (this.config.debug === 'all' ||
|
|
42291
|
-
this.config.debug === 'clappr') {
|
|
42289
|
+
if (this.config.debug === 'all' || this.config.debug === 'clappr') {
|
|
42292
42290
|
Log.setLevel(0);
|
|
42293
42291
|
}
|
|
42294
42292
|
trace(`${T} init`, {
|
|
@@ -42353,15 +42351,14 @@ class Player {
|
|
|
42353
42351
|
const player = new Player$1(coreOptions);
|
|
42354
42352
|
this.player = player;
|
|
42355
42353
|
// TODO checks if the whole thing is necessary
|
|
42356
|
-
this.tuneInTimerId =
|
|
42357
|
-
|
|
42358
|
-
|
|
42359
|
-
|
|
42360
|
-
|
|
42361
|
-
|
|
42362
|
-
|
|
42363
|
-
|
|
42364
|
-
}, 4000);
|
|
42354
|
+
this.tuneInTimerId = globalThis.setTimeout(() => {
|
|
42355
|
+
trace(`${T} tuneInTimer`, {
|
|
42356
|
+
ready: this.ready,
|
|
42357
|
+
tunedIn: this.tunedIn,
|
|
42358
|
+
});
|
|
42359
|
+
this.tuneInTimerId = null;
|
|
42360
|
+
this.tuneIn();
|
|
42361
|
+
}, 4000);
|
|
42365
42362
|
}
|
|
42366
42363
|
async tuneIn() {
|
|
42367
42364
|
assert.ok(this.player);
|
|
@@ -42386,8 +42383,7 @@ class Player {
|
|
|
42386
42383
|
player.core.on(Events$1.CORE_ACTIVE_CONTAINER_CHANGED, () => {
|
|
42387
42384
|
this.bindBitrateChangeHandler();
|
|
42388
42385
|
}, null);
|
|
42389
|
-
if (Browser.isiOS &&
|
|
42390
|
-
player.core.activePlayback) {
|
|
42386
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
42391
42387
|
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
42392
42388
|
try {
|
|
42393
42389
|
player.core.handleFullscreenChange();
|
|
@@ -42397,17 +42393,33 @@ class Player {
|
|
|
42397
42393
|
}
|
|
42398
42394
|
});
|
|
42399
42395
|
}
|
|
42400
|
-
player.core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation
|
|
42401
|
-
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
42396
|
+
player.core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
42397
|
+
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
42398
|
+
orientation,
|
|
42399
|
+
rootNode: {
|
|
42400
|
+
width: this.rootNode?.clientWidth,
|
|
42401
|
+
height: this.rootNode?.clientHeight,
|
|
42402
|
+
},
|
|
42403
|
+
});
|
|
42404
|
+
if (Browser.isiOS && this.rootNode) {
|
|
42405
|
+
player.core.resize({
|
|
42406
|
+
width: this.rootNode.clientWidth,
|
|
42407
|
+
height: this.rootNode.clientHeight,
|
|
42408
|
+
});
|
|
42409
|
+
}
|
|
42410
|
+
}, null);
|
|
42411
|
+
player.core.on(Events$1.CORE_RESIZE, ({ width, height }) => {
|
|
42412
|
+
trace(`${T} CORE_RESIZE`, {
|
|
42413
|
+
width,
|
|
42414
|
+
height,
|
|
42415
|
+
});
|
|
42402
42416
|
}, null);
|
|
42403
42417
|
if (this.config.autoPlay) {
|
|
42404
42418
|
setTimeout(() => {
|
|
42405
42419
|
trace(`${T} autoPlay`, {
|
|
42406
42420
|
player: !!this.player,
|
|
42407
|
-
container: !!this.player?.core
|
|
42408
|
-
|
|
42409
|
-
playback: this.player?.core
|
|
42410
|
-
.activePlayback.name,
|
|
42421
|
+
container: !!this.player?.core.activeContainer,
|
|
42422
|
+
playback: this.player?.core.activePlayback.name,
|
|
42411
42423
|
});
|
|
42412
42424
|
assert(this.player);
|
|
42413
42425
|
this.player.play({
|
|
@@ -42432,7 +42444,7 @@ class Player {
|
|
|
42432
42444
|
setTimeout(() => this.tuneIn(), 0);
|
|
42433
42445
|
},
|
|
42434
42446
|
onResize: (newSize) => {
|
|
42435
|
-
trace(`${T}
|
|
42447
|
+
trace(`${T} onResize`, {
|
|
42436
42448
|
newSize,
|
|
42437
42449
|
});
|
|
42438
42450
|
},
|
|
@@ -42469,46 +42481,41 @@ class Player {
|
|
|
42469
42481
|
}
|
|
42470
42482
|
},
|
|
42471
42483
|
};
|
|
42472
|
-
buildCoreOptions(
|
|
42484
|
+
buildCoreOptions(rootNode) {
|
|
42473
42485
|
const multisources = this.config.multisources;
|
|
42474
|
-
const mainSource = this.config.playbackType ===
|
|
42475
|
-
'live'
|
|
42486
|
+
const mainSource = this.config.playbackType === 'live'
|
|
42476
42487
|
? multisources.find((ms) => ms.live !== false)
|
|
42477
42488
|
: multisources[0];
|
|
42478
42489
|
const mediaSources = mainSource
|
|
42479
42490
|
? this.buildMediaSourcesList(mainSource)
|
|
42480
42491
|
: [];
|
|
42481
42492
|
// const mainSourceUrl = mediaSources[0];
|
|
42482
|
-
const poster = mainSource?.poster ??
|
|
42483
|
-
|
|
42493
|
+
const poster = mainSource?.poster ?? this.config.poster;
|
|
42494
|
+
this.rootNode = rootNode;
|
|
42484
42495
|
const coreOptions = {
|
|
42485
42496
|
...this.config.pluginSettings,
|
|
42486
42497
|
allowUserInteraction: true,
|
|
42487
42498
|
autoPlay: false,
|
|
42488
42499
|
debug: this.config.debug || 'none',
|
|
42489
42500
|
events: this.events,
|
|
42490
|
-
height:
|
|
42501
|
+
height: rootNode.clientHeight,
|
|
42491
42502
|
loop: this.config.loop,
|
|
42492
42503
|
multisources,
|
|
42493
42504
|
mute: this.config.mute,
|
|
42494
42505
|
playback: {
|
|
42495
42506
|
controls: false,
|
|
42496
42507
|
playInline: true,
|
|
42497
|
-
preload: Browser.isiOS
|
|
42498
|
-
? 'metadata'
|
|
42499
|
-
: 'none',
|
|
42508
|
+
preload: Browser.isiOS ? 'metadata' : 'none',
|
|
42500
42509
|
mute: this.config.mute,
|
|
42501
42510
|
crossOrigin: 'anonymous', // TODO
|
|
42502
42511
|
hlsjsConfig: {
|
|
42503
|
-
debug: this.config.debug ===
|
|
42504
|
-
'all' ||
|
|
42505
|
-
this.config.debug === 'hls',
|
|
42512
|
+
debug: this.config.debug === 'all' || this.config.debug === 'hls',
|
|
42506
42513
|
},
|
|
42507
42514
|
},
|
|
42508
|
-
parent:
|
|
42515
|
+
parent: rootNode,
|
|
42509
42516
|
playbackType: this.config.playbackType,
|
|
42510
42517
|
poster,
|
|
42511
|
-
width:
|
|
42518
|
+
width: rootNode.clientWidth,
|
|
42512
42519
|
// source: mainSourceUrl,
|
|
42513
42520
|
sources: mediaSources,
|
|
42514
42521
|
strings: this.config.strings,
|
|
@@ -42516,6 +42523,7 @@ class Player {
|
|
|
42516
42523
|
return coreOptions;
|
|
42517
42524
|
}
|
|
42518
42525
|
configurePlaybacks() {
|
|
42526
|
+
// TODO check if there are DASH and HLS sources and don't register the respective playbacks if not
|
|
42519
42527
|
Loader.registerPlayback(DashPlayback);
|
|
42520
42528
|
Loader.registerPlayback(HlsPlayback);
|
|
42521
42529
|
}
|
|
@@ -42560,8 +42568,7 @@ class Player {
|
|
|
42560
42568
|
}
|
|
42561
42569
|
}
|
|
42562
42570
|
function addHls() {
|
|
42563
|
-
if (sources.hls &&
|
|
42564
|
-
HlsPlayback.canPlay(sources.hls)) {
|
|
42571
|
+
if (sources.hls && HlsPlayback.canPlay(sources.hls)) {
|
|
42565
42572
|
msl.push(sources.hls);
|
|
42566
42573
|
sources.hls = null;
|
|
42567
42574
|
}
|
|
@@ -42572,8 +42579,7 @@ class Player {
|
|
|
42572
42579
|
}
|
|
42573
42580
|
}
|
|
42574
42581
|
function addDash() {
|
|
42575
|
-
if (sources.dash &&
|
|
42576
|
-
DashPlayback.canPlay(sources.dash)) {
|
|
42582
|
+
if (sources.dash && DashPlayback.canPlay(sources.dash)) {
|
|
42577
42583
|
msl.push(sources.dash);
|
|
42578
42584
|
sources.dash = null;
|
|
42579
42585
|
}
|
|
@@ -42703,12 +42709,12 @@ class SentryTracer {
|
|
|
42703
42709
|
}
|
|
42704
42710
|
}
|
|
42705
42711
|
|
|
42706
|
-
var version$1 = "2.1.
|
|
42712
|
+
var version$1 = "2.1.14";
|
|
42707
42713
|
|
|
42708
42714
|
var packages = {
|
|
42709
42715
|
"": {
|
|
42710
42716
|
name: "@gcorevideo/player",
|
|
42711
|
-
version: "2.1.
|
|
42717
|
+
version: "2.1.14",
|
|
42712
42718
|
license: "Apache-2.0",
|
|
42713
42719
|
dependencies: {
|
|
42714
42720
|
"@clappr/core": "^0.11.3",
|
package/lib/Player.d.ts
CHANGED
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,CAAA;
|
|
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;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAItD,OAAO,2BAA2B,CAAA;AAIlC,KAAK,kBAAkB,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,IAAI,CAAA;AAiB3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAA;AAItD;;GAEG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,MAAM,CAAgC;IAE9C,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,MAAM,CAA4B;IAE1C,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,QAAQ,CAA2B;IAE3C,OAAO,CAAC,aAAa,CAA6C;IAElE,OAAO,CAAC,OAAO,CAAQ;IAEvB,IAAI,cAAc,IAAI,cAAc,GAAG,IAAI,CAY1C;IAED,IAAI,OAAO,IAAI,WAAW,GAAG,IAAI,CAEhC;IAED,IAAI,EAAE,QAEL;IAED,IAAI,YAAY,IAAI,YAAY,GAAG,SAAS,CAE3C;gBAEW,MAAM,EAAE,YAAY;IAIhC,EAAE,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAIlE,GAAG,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAInE,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC;IAIvC,OAAO,CAAC,SAAS;IAIX,IAAI,CAAC,aAAa,EAAE,WAAW;IAyBrC,OAAO;IAiBP,KAAK;IAKL,IAAI;IAKJ,MAAM,CAAC,IAAI,EAAE,MAAM;IAKnB,IAAI;IAKJ,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY;IAI1C,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,YAAY;IAI5C,OAAO,CAAC,UAAU;YAqBJ,MAAM;IA+EpB,OAAO,CAAC,MAAM,CAgDb;IAED,OAAO,CAAC,gBAAgB;IA6CxB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,qBAAqB;CA2D9B"}
|
package/lib/Player.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Browser, Events as ClapprEvents, Log, Player as PlayerClappr, $, Loader, } from '@clappr/core';
|
|
2
2
|
import assert from 'assert';
|
|
3
3
|
import EventLite from 'event-lite';
|
|
4
|
-
import { reportError, trace
|
|
5
|
-
import { PlayerEvent
|
|
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
|
|
@@ -28,14 +28,14 @@ export class Player {
|
|
|
28
28
|
emitter = new EventLite();
|
|
29
29
|
player = null;
|
|
30
30
|
ready = false;
|
|
31
|
+
rootNode = null;
|
|
31
32
|
tuneInTimerId = null;
|
|
32
33
|
tunedIn = false;
|
|
33
34
|
get activePlayback() {
|
|
34
35
|
if (!this.player?.core.activePlayback) {
|
|
35
36
|
return null;
|
|
36
37
|
}
|
|
37
|
-
switch (this.player.core.activePlayback
|
|
38
|
-
.name) {
|
|
38
|
+
switch (this.player.core.activePlayback.name) {
|
|
39
39
|
case 'dash':
|
|
40
40
|
return 'dash';
|
|
41
41
|
case 'hls':
|
|
@@ -48,8 +48,7 @@ export class Player {
|
|
|
48
48
|
return this.bitrateInfo;
|
|
49
49
|
}
|
|
50
50
|
get hd() {
|
|
51
|
-
return
|
|
52
|
-
?.isHighDefinitionInUse || false);
|
|
51
|
+
return this.player?.core.activePlayback?.isHighDefinitionInUse || false;
|
|
53
52
|
}
|
|
54
53
|
get playbackType() {
|
|
55
54
|
return this.player?.core.activePlayback?.getPlaybackType();
|
|
@@ -72,8 +71,7 @@ export class Player {
|
|
|
72
71
|
async init(playerElement) {
|
|
73
72
|
assert.ok(!this.player, 'Player already initialized');
|
|
74
73
|
assert.ok(playerElement, 'Player container element is required');
|
|
75
|
-
if (this.config.debug === 'all' ||
|
|
76
|
-
this.config.debug === 'clappr') {
|
|
74
|
+
if (this.config.debug === 'all' || this.config.debug === 'clappr') {
|
|
77
75
|
Log.setLevel(0);
|
|
78
76
|
}
|
|
79
77
|
trace(`${T} init`, {
|
|
@@ -138,15 +136,14 @@ export class Player {
|
|
|
138
136
|
const player = new PlayerClappr(coreOptions);
|
|
139
137
|
this.player = player;
|
|
140
138
|
// TODO checks if the whole thing is necessary
|
|
141
|
-
this.tuneInTimerId =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}, 4000);
|
|
139
|
+
this.tuneInTimerId = globalThis.setTimeout(() => {
|
|
140
|
+
trace(`${T} tuneInTimer`, {
|
|
141
|
+
ready: this.ready,
|
|
142
|
+
tunedIn: this.tunedIn,
|
|
143
|
+
});
|
|
144
|
+
this.tuneInTimerId = null;
|
|
145
|
+
this.tuneIn();
|
|
146
|
+
}, 4000);
|
|
150
147
|
}
|
|
151
148
|
async tuneIn() {
|
|
152
149
|
assert.ok(this.player);
|
|
@@ -171,8 +168,7 @@ export class Player {
|
|
|
171
168
|
player.core.on(ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, () => {
|
|
172
169
|
this.bindBitrateChangeHandler();
|
|
173
170
|
}, null);
|
|
174
|
-
if (Browser.isiOS &&
|
|
175
|
-
player.core.activePlayback) {
|
|
171
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
176
172
|
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
177
173
|
try {
|
|
178
174
|
player.core.handleFullscreenChange();
|
|
@@ -182,17 +178,33 @@ export class Player {
|
|
|
182
178
|
}
|
|
183
179
|
});
|
|
184
180
|
}
|
|
185
|
-
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation
|
|
186
|
-
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
181
|
+
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
182
|
+
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
|
|
183
|
+
orientation,
|
|
184
|
+
rootNode: {
|
|
185
|
+
width: this.rootNode?.clientWidth,
|
|
186
|
+
height: this.rootNode?.clientHeight,
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
if (Browser.isiOS && this.rootNode) {
|
|
190
|
+
player.core.resize({
|
|
191
|
+
width: this.rootNode.clientWidth,
|
|
192
|
+
height: this.rootNode.clientHeight,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}, null);
|
|
196
|
+
player.core.on(ClapprEvents.CORE_RESIZE, ({ width, height }) => {
|
|
197
|
+
trace(`${T} CORE_RESIZE`, {
|
|
198
|
+
width,
|
|
199
|
+
height,
|
|
200
|
+
});
|
|
187
201
|
}, null);
|
|
188
202
|
if (this.config.autoPlay) {
|
|
189
203
|
setTimeout(() => {
|
|
190
204
|
trace(`${T} autoPlay`, {
|
|
191
205
|
player: !!this.player,
|
|
192
|
-
container: !!this.player?.core
|
|
193
|
-
|
|
194
|
-
playback: this.player?.core
|
|
195
|
-
.activePlayback.name,
|
|
206
|
+
container: !!this.player?.core.activeContainer,
|
|
207
|
+
playback: this.player?.core.activePlayback.name,
|
|
196
208
|
});
|
|
197
209
|
assert(this.player);
|
|
198
210
|
this.player.play({
|
|
@@ -217,7 +229,7 @@ export class Player {
|
|
|
217
229
|
setTimeout(() => this.tuneIn(), 0);
|
|
218
230
|
},
|
|
219
231
|
onResize: (newSize) => {
|
|
220
|
-
trace(`${T}
|
|
232
|
+
trace(`${T} onResize`, {
|
|
221
233
|
newSize,
|
|
222
234
|
});
|
|
223
235
|
},
|
|
@@ -254,46 +266,41 @@ export class Player {
|
|
|
254
266
|
}
|
|
255
267
|
},
|
|
256
268
|
};
|
|
257
|
-
buildCoreOptions(
|
|
269
|
+
buildCoreOptions(rootNode) {
|
|
258
270
|
const multisources = this.config.multisources;
|
|
259
|
-
const mainSource = this.config.playbackType ===
|
|
260
|
-
'live'
|
|
271
|
+
const mainSource = this.config.playbackType === 'live'
|
|
261
272
|
? multisources.find((ms) => ms.live !== false)
|
|
262
273
|
: multisources[0];
|
|
263
274
|
const mediaSources = mainSource
|
|
264
275
|
? this.buildMediaSourcesList(mainSource)
|
|
265
276
|
: [];
|
|
266
277
|
// const mainSourceUrl = mediaSources[0];
|
|
267
|
-
const poster = mainSource?.poster ??
|
|
268
|
-
|
|
278
|
+
const poster = mainSource?.poster ?? this.config.poster;
|
|
279
|
+
this.rootNode = rootNode;
|
|
269
280
|
const coreOptions = {
|
|
270
281
|
...this.config.pluginSettings,
|
|
271
282
|
allowUserInteraction: true,
|
|
272
283
|
autoPlay: false,
|
|
273
284
|
debug: this.config.debug || 'none',
|
|
274
285
|
events: this.events,
|
|
275
|
-
height:
|
|
286
|
+
height: rootNode.clientHeight,
|
|
276
287
|
loop: this.config.loop,
|
|
277
288
|
multisources,
|
|
278
289
|
mute: this.config.mute,
|
|
279
290
|
playback: {
|
|
280
291
|
controls: false,
|
|
281
292
|
playInline: true,
|
|
282
|
-
preload: Browser.isiOS
|
|
283
|
-
? 'metadata'
|
|
284
|
-
: 'none',
|
|
293
|
+
preload: Browser.isiOS ? 'metadata' : 'none',
|
|
285
294
|
mute: this.config.mute,
|
|
286
295
|
crossOrigin: 'anonymous', // TODO
|
|
287
296
|
hlsjsConfig: {
|
|
288
|
-
debug: this.config.debug ===
|
|
289
|
-
'all' ||
|
|
290
|
-
this.config.debug === 'hls',
|
|
297
|
+
debug: this.config.debug === 'all' || this.config.debug === 'hls',
|
|
291
298
|
},
|
|
292
299
|
},
|
|
293
|
-
parent:
|
|
300
|
+
parent: rootNode,
|
|
294
301
|
playbackType: this.config.playbackType,
|
|
295
302
|
poster,
|
|
296
|
-
width:
|
|
303
|
+
width: rootNode.clientWidth,
|
|
297
304
|
// source: mainSourceUrl,
|
|
298
305
|
sources: mediaSources,
|
|
299
306
|
strings: this.config.strings,
|
|
@@ -301,6 +308,7 @@ export class Player {
|
|
|
301
308
|
return coreOptions;
|
|
302
309
|
}
|
|
303
310
|
configurePlaybacks() {
|
|
311
|
+
// TODO check if there are DASH and HLS sources and don't register the respective playbacks if not
|
|
304
312
|
Loader.registerPlayback(DashPlayback);
|
|
305
313
|
Loader.registerPlayback(HlsPlayback);
|
|
306
314
|
}
|
|
@@ -345,8 +353,7 @@ export class Player {
|
|
|
345
353
|
}
|
|
346
354
|
}
|
|
347
355
|
function addHls() {
|
|
348
|
-
if (sources.hls &&
|
|
349
|
-
HlsPlayback.canPlay(sources.hls)) {
|
|
356
|
+
if (sources.hls && HlsPlayback.canPlay(sources.hls)) {
|
|
350
357
|
msl.push(sources.hls);
|
|
351
358
|
sources.hls = null;
|
|
352
359
|
}
|
|
@@ -357,8 +364,7 @@ export class Player {
|
|
|
357
364
|
}
|
|
358
365
|
}
|
|
359
366
|
function addDash() {
|
|
360
|
-
if (sources.dash &&
|
|
361
|
-
DashPlayback.canPlay(sources.dash)) {
|
|
367
|
+
if (sources.dash && DashPlayback.canPlay(sources.dash)) {
|
|
362
368
|
msl.push(sources.dash);
|
|
363
369
|
sources.dash = null;
|
|
364
370
|
}
|