@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/dist/index.js
CHANGED
|
@@ -42249,8 +42249,7 @@ class Player {
|
|
|
42249
42249
|
if (!this.player?.core.activePlayback) {
|
|
42250
42250
|
return null;
|
|
42251
42251
|
}
|
|
42252
|
-
switch (this.player.core.activePlayback
|
|
42253
|
-
.name) {
|
|
42252
|
+
switch (this.player.core.activePlayback.name) {
|
|
42254
42253
|
case 'dash':
|
|
42255
42254
|
return 'dash';
|
|
42256
42255
|
case 'hls':
|
|
@@ -42263,8 +42262,7 @@ class Player {
|
|
|
42263
42262
|
return this.bitrateInfo;
|
|
42264
42263
|
}
|
|
42265
42264
|
get hd() {
|
|
42266
|
-
return
|
|
42267
|
-
?.isHighDefinitionInUse || false);
|
|
42265
|
+
return this.player?.core.activePlayback?.isHighDefinitionInUse || false;
|
|
42268
42266
|
}
|
|
42269
42267
|
get playbackType() {
|
|
42270
42268
|
return this.player?.core.activePlayback?.getPlaybackType();
|
|
@@ -42287,8 +42285,7 @@ class Player {
|
|
|
42287
42285
|
async init(playerElement) {
|
|
42288
42286
|
assert.ok(!this.player, 'Player already initialized');
|
|
42289
42287
|
assert.ok(playerElement, 'Player container element is required');
|
|
42290
|
-
if (this.config.debug === 'all' ||
|
|
42291
|
-
this.config.debug === 'clappr') {
|
|
42288
|
+
if (this.config.debug === 'all' || this.config.debug === 'clappr') {
|
|
42292
42289
|
Log.setLevel(0);
|
|
42293
42290
|
}
|
|
42294
42291
|
trace(`${T} init`, {
|
|
@@ -42353,15 +42350,14 @@ class Player {
|
|
|
42353
42350
|
const player = new Player$1(coreOptions);
|
|
42354
42351
|
this.player = player;
|
|
42355
42352
|
// TODO checks if the whole thing is necessary
|
|
42356
|
-
this.tuneInTimerId =
|
|
42357
|
-
|
|
42358
|
-
|
|
42359
|
-
|
|
42360
|
-
|
|
42361
|
-
|
|
42362
|
-
|
|
42363
|
-
|
|
42364
|
-
}, 4000);
|
|
42353
|
+
this.tuneInTimerId = globalThis.setTimeout(() => {
|
|
42354
|
+
trace(`${T} tuneInTimer`, {
|
|
42355
|
+
ready: this.ready,
|
|
42356
|
+
tunedIn: this.tunedIn,
|
|
42357
|
+
});
|
|
42358
|
+
this.tuneInTimerId = null;
|
|
42359
|
+
this.tuneIn();
|
|
42360
|
+
}, 4000);
|
|
42365
42361
|
}
|
|
42366
42362
|
async tuneIn() {
|
|
42367
42363
|
assert.ok(this.player);
|
|
@@ -42386,8 +42382,7 @@ class Player {
|
|
|
42386
42382
|
player.core.on(Events$1.CORE_ACTIVE_CONTAINER_CHANGED, () => {
|
|
42387
42383
|
this.bindBitrateChangeHandler();
|
|
42388
42384
|
}, null);
|
|
42389
|
-
if (Browser.isiOS &&
|
|
42390
|
-
player.core.activePlayback) {
|
|
42385
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
42391
42386
|
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
42392
42387
|
try {
|
|
42393
42388
|
player.core.handleFullscreenChange();
|
|
@@ -42397,17 +42392,21 @@ class Player {
|
|
|
42397
42392
|
}
|
|
42398
42393
|
});
|
|
42399
42394
|
}
|
|
42400
|
-
player.core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation
|
|
42395
|
+
player.core.on(Events$1.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
42401
42396
|
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation });
|
|
42402
42397
|
}, null);
|
|
42398
|
+
player.core.on(Events$1.CORE_RESIZE, ({ width, height }) => {
|
|
42399
|
+
trace(`${T} CORE_RESIZE`, {
|
|
42400
|
+
width,
|
|
42401
|
+
height,
|
|
42402
|
+
});
|
|
42403
|
+
}, null);
|
|
42403
42404
|
if (this.config.autoPlay) {
|
|
42404
42405
|
setTimeout(() => {
|
|
42405
42406
|
trace(`${T} autoPlay`, {
|
|
42406
42407
|
player: !!this.player,
|
|
42407
|
-
container: !!this.player?.core
|
|
42408
|
-
|
|
42409
|
-
playback: this.player?.core
|
|
42410
|
-
.activePlayback.name,
|
|
42408
|
+
container: !!this.player?.core.activeContainer,
|
|
42409
|
+
playback: this.player?.core.activePlayback.name,
|
|
42411
42410
|
});
|
|
42412
42411
|
assert(this.player);
|
|
42413
42412
|
this.player.play({
|
|
@@ -42471,16 +42470,14 @@ class Player {
|
|
|
42471
42470
|
};
|
|
42472
42471
|
buildCoreOptions(playerElement) {
|
|
42473
42472
|
const multisources = this.config.multisources;
|
|
42474
|
-
const mainSource = this.config.playbackType ===
|
|
42475
|
-
'live'
|
|
42473
|
+
const mainSource = this.config.playbackType === 'live'
|
|
42476
42474
|
? multisources.find((ms) => ms.live !== false)
|
|
42477
42475
|
: multisources[0];
|
|
42478
42476
|
const mediaSources = mainSource
|
|
42479
42477
|
? this.buildMediaSourcesList(mainSource)
|
|
42480
42478
|
: [];
|
|
42481
42479
|
// const mainSourceUrl = mediaSources[0];
|
|
42482
|
-
const poster = mainSource?.poster ??
|
|
42483
|
-
this.config.poster;
|
|
42480
|
+
const poster = mainSource?.poster ?? this.config.poster;
|
|
42484
42481
|
const coreOptions = {
|
|
42485
42482
|
...this.config.pluginSettings,
|
|
42486
42483
|
allowUserInteraction: true,
|
|
@@ -42494,15 +42491,11 @@ class Player {
|
|
|
42494
42491
|
playback: {
|
|
42495
42492
|
controls: false,
|
|
42496
42493
|
playInline: true,
|
|
42497
|
-
preload: Browser.isiOS
|
|
42498
|
-
? 'metadata'
|
|
42499
|
-
: 'none',
|
|
42494
|
+
preload: Browser.isiOS ? 'metadata' : 'none',
|
|
42500
42495
|
mute: this.config.mute,
|
|
42501
42496
|
crossOrigin: 'anonymous', // TODO
|
|
42502
42497
|
hlsjsConfig: {
|
|
42503
|
-
debug: this.config.debug ===
|
|
42504
|
-
'all' ||
|
|
42505
|
-
this.config.debug === 'hls',
|
|
42498
|
+
debug: this.config.debug === 'all' || this.config.debug === 'hls',
|
|
42506
42499
|
},
|
|
42507
42500
|
},
|
|
42508
42501
|
parent: playerElement,
|
|
@@ -42560,8 +42553,7 @@ class Player {
|
|
|
42560
42553
|
}
|
|
42561
42554
|
}
|
|
42562
42555
|
function addHls() {
|
|
42563
|
-
if (sources.hls &&
|
|
42564
|
-
HlsPlayback.canPlay(sources.hls)) {
|
|
42556
|
+
if (sources.hls && HlsPlayback.canPlay(sources.hls)) {
|
|
42565
42557
|
msl.push(sources.hls);
|
|
42566
42558
|
sources.hls = null;
|
|
42567
42559
|
}
|
|
@@ -42572,8 +42564,7 @@ class Player {
|
|
|
42572
42564
|
}
|
|
42573
42565
|
}
|
|
42574
42566
|
function addDash() {
|
|
42575
|
-
if (sources.dash &&
|
|
42576
|
-
DashPlayback.canPlay(sources.dash)) {
|
|
42567
|
+
if (sources.dash && DashPlayback.canPlay(sources.dash)) {
|
|
42577
42568
|
msl.push(sources.dash);
|
|
42578
42569
|
sources.dash = null;
|
|
42579
42570
|
}
|
|
@@ -42703,12 +42694,12 @@ class SentryTracer {
|
|
|
42703
42694
|
}
|
|
42704
42695
|
}
|
|
42705
42696
|
|
|
42706
|
-
var version$1 = "2.1.
|
|
42697
|
+
var version$1 = "2.1.13";
|
|
42707
42698
|
|
|
42708
42699
|
var packages = {
|
|
42709
42700
|
"": {
|
|
42710
42701
|
name: "@gcorevideo/player",
|
|
42711
|
-
version: "2.1.
|
|
42702
|
+
version: "2.1.13",
|
|
42712
42703
|
license: "Apache-2.0",
|
|
42713
42704
|
dependencies: {
|
|
42714
42705
|
"@clappr/core": "^0.11.3",
|
package/lib/Player.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../src/Player.ts"],"names":[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AAE,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;IAmEpB,OAAO,CAAC,MAAM,CAgDb;IAED,OAAO,CAAC,gBAAgB;IA2CxB,OAAO,CAAC,kBAAkB;IAK1B,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
|
|
@@ -34,8 +34,7 @@ export class Player {
|
|
|
34
34
|
if (!this.player?.core.activePlayback) {
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
switch (this.player.core.activePlayback
|
|
38
|
-
.name) {
|
|
37
|
+
switch (this.player.core.activePlayback.name) {
|
|
39
38
|
case 'dash':
|
|
40
39
|
return 'dash';
|
|
41
40
|
case 'hls':
|
|
@@ -48,8 +47,7 @@ export class Player {
|
|
|
48
47
|
return this.bitrateInfo;
|
|
49
48
|
}
|
|
50
49
|
get hd() {
|
|
51
|
-
return
|
|
52
|
-
?.isHighDefinitionInUse || false);
|
|
50
|
+
return this.player?.core.activePlayback?.isHighDefinitionInUse || false;
|
|
53
51
|
}
|
|
54
52
|
get playbackType() {
|
|
55
53
|
return this.player?.core.activePlayback?.getPlaybackType();
|
|
@@ -72,8 +70,7 @@ export class Player {
|
|
|
72
70
|
async init(playerElement) {
|
|
73
71
|
assert.ok(!this.player, 'Player already initialized');
|
|
74
72
|
assert.ok(playerElement, 'Player container element is required');
|
|
75
|
-
if (this.config.debug === 'all' ||
|
|
76
|
-
this.config.debug === 'clappr') {
|
|
73
|
+
if (this.config.debug === 'all' || this.config.debug === 'clappr') {
|
|
77
74
|
Log.setLevel(0);
|
|
78
75
|
}
|
|
79
76
|
trace(`${T} init`, {
|
|
@@ -138,15 +135,14 @@ export class Player {
|
|
|
138
135
|
const player = new PlayerClappr(coreOptions);
|
|
139
136
|
this.player = player;
|
|
140
137
|
// TODO checks if the whole thing is necessary
|
|
141
|
-
this.tuneInTimerId =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}, 4000);
|
|
138
|
+
this.tuneInTimerId = globalThis.setTimeout(() => {
|
|
139
|
+
trace(`${T} tuneInTimer`, {
|
|
140
|
+
ready: this.ready,
|
|
141
|
+
tunedIn: this.tunedIn,
|
|
142
|
+
});
|
|
143
|
+
this.tuneInTimerId = null;
|
|
144
|
+
this.tuneIn();
|
|
145
|
+
}, 4000);
|
|
150
146
|
}
|
|
151
147
|
async tuneIn() {
|
|
152
148
|
assert.ok(this.player);
|
|
@@ -171,8 +167,7 @@ export class Player {
|
|
|
171
167
|
player.core.on(ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, () => {
|
|
172
168
|
this.bindBitrateChangeHandler();
|
|
173
169
|
}, null);
|
|
174
|
-
if (Browser.isiOS &&
|
|
175
|
-
player.core.activePlayback) {
|
|
170
|
+
if (Browser.isiOS && player.core.activePlayback) {
|
|
176
171
|
player.core.activePlayback.$el.on('webkitendfullscreen', () => {
|
|
177
172
|
try {
|
|
178
173
|
player.core.handleFullscreenChange();
|
|
@@ -182,17 +177,21 @@ export class Player {
|
|
|
182
177
|
}
|
|
183
178
|
});
|
|
184
179
|
}
|
|
185
|
-
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation
|
|
180
|
+
player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
|
|
186
181
|
trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation });
|
|
187
182
|
}, null);
|
|
183
|
+
player.core.on(ClapprEvents.CORE_RESIZE, ({ width, height }) => {
|
|
184
|
+
trace(`${T} CORE_RESIZE`, {
|
|
185
|
+
width,
|
|
186
|
+
height,
|
|
187
|
+
});
|
|
188
|
+
}, null);
|
|
188
189
|
if (this.config.autoPlay) {
|
|
189
190
|
setTimeout(() => {
|
|
190
191
|
trace(`${T} autoPlay`, {
|
|
191
192
|
player: !!this.player,
|
|
192
|
-
container: !!this.player?.core
|
|
193
|
-
|
|
194
|
-
playback: this.player?.core
|
|
195
|
-
.activePlayback.name,
|
|
193
|
+
container: !!this.player?.core.activeContainer,
|
|
194
|
+
playback: this.player?.core.activePlayback.name,
|
|
196
195
|
});
|
|
197
196
|
assert(this.player);
|
|
198
197
|
this.player.play({
|
|
@@ -256,16 +255,14 @@ export class Player {
|
|
|
256
255
|
};
|
|
257
256
|
buildCoreOptions(playerElement) {
|
|
258
257
|
const multisources = this.config.multisources;
|
|
259
|
-
const mainSource = this.config.playbackType ===
|
|
260
|
-
'live'
|
|
258
|
+
const mainSource = this.config.playbackType === 'live'
|
|
261
259
|
? multisources.find((ms) => ms.live !== false)
|
|
262
260
|
: multisources[0];
|
|
263
261
|
const mediaSources = mainSource
|
|
264
262
|
? this.buildMediaSourcesList(mainSource)
|
|
265
263
|
: [];
|
|
266
264
|
// const mainSourceUrl = mediaSources[0];
|
|
267
|
-
const poster = mainSource?.poster ??
|
|
268
|
-
this.config.poster;
|
|
265
|
+
const poster = mainSource?.poster ?? this.config.poster;
|
|
269
266
|
const coreOptions = {
|
|
270
267
|
...this.config.pluginSettings,
|
|
271
268
|
allowUserInteraction: true,
|
|
@@ -279,15 +276,11 @@ export class Player {
|
|
|
279
276
|
playback: {
|
|
280
277
|
controls: false,
|
|
281
278
|
playInline: true,
|
|
282
|
-
preload: Browser.isiOS
|
|
283
|
-
? 'metadata'
|
|
284
|
-
: 'none',
|
|
279
|
+
preload: Browser.isiOS ? 'metadata' : 'none',
|
|
285
280
|
mute: this.config.mute,
|
|
286
281
|
crossOrigin: 'anonymous', // TODO
|
|
287
282
|
hlsjsConfig: {
|
|
288
|
-
debug: this.config.debug ===
|
|
289
|
-
'all' ||
|
|
290
|
-
this.config.debug === 'hls',
|
|
283
|
+
debug: this.config.debug === 'all' || this.config.debug === 'hls',
|
|
291
284
|
},
|
|
292
285
|
},
|
|
293
286
|
parent: playerElement,
|
|
@@ -345,8 +338,7 @@ export class Player {
|
|
|
345
338
|
}
|
|
346
339
|
}
|
|
347
340
|
function addHls() {
|
|
348
|
-
if (sources.hls &&
|
|
349
|
-
HlsPlayback.canPlay(sources.hls)) {
|
|
341
|
+
if (sources.hls && HlsPlayback.canPlay(sources.hls)) {
|
|
350
342
|
msl.push(sources.hls);
|
|
351
343
|
sources.hls = null;
|
|
352
344
|
}
|
|
@@ -357,8 +349,7 @@ export class Player {
|
|
|
357
349
|
}
|
|
358
350
|
}
|
|
359
351
|
function addDash() {
|
|
360
|
-
if (sources.dash &&
|
|
361
|
-
DashPlayback.canPlay(sources.dash)) {
|
|
352
|
+
if (sources.dash && DashPlayback.canPlay(sources.dash)) {
|
|
362
353
|
msl.push(sources.dash);
|
|
363
354
|
sources.dash = null;
|
|
364
355
|
}
|