@gcorevideo/player 2.1.13 → 2.3.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.
Files changed (64) hide show
  1. package/dist/index.js +208 -218
  2. package/lib/Player.d.ts +2 -1
  3. package/lib/Player.d.ts.map +1 -1
  4. package/lib/Player.js +28 -7
  5. package/lib/version.d.ts +2 -0
  6. package/lib/version.d.ts.map +1 -1
  7. package/lib/version.js +2 -0
  8. package/package.json +1 -1
  9. package/src/Player.ts +32 -7
  10. package/src/version.ts +2 -0
  11. package/tsconfig.tsbuildinfo +1 -1
  12. package/assets/icons/new/arrow-left.svg +0 -5
  13. package/assets/icons/new/arrow-right.svg +0 -5
  14. package/assets/icons/new/check.svg +0 -5
  15. package/assets/icons/new/close.svg +0 -12
  16. package/assets/icons/new/full.svg +0 -8
  17. package/assets/icons/new/fullscreen-off.svg +0 -14
  18. package/assets/icons/new/fullscreen-on.svg +0 -14
  19. package/assets/icons/new/gear-hd.svg +0 -16
  20. package/assets/icons/new/gear.svg +0 -12
  21. package/assets/icons/new/hd.svg +0 -8
  22. package/assets/icons/new/pause.svg +0 -5
  23. package/assets/icons/new/pip.svg +0 -5
  24. package/assets/icons/new/play.svg +0 -10
  25. package/assets/icons/new/replayleft.svg +0 -5
  26. package/assets/icons/new/replayright.svg +0 -5
  27. package/assets/icons/new/speed.svg +0 -5
  28. package/assets/icons/new/stats.svg +0 -3
  29. package/assets/icons/new/stop.svg +0 -3
  30. package/assets/icons/new/subtitles-off.svg +0 -5
  31. package/assets/icons/new/subtitles-on.svg +0 -6
  32. package/assets/icons/new/volume-max.svg +0 -5
  33. package/assets/icons/new/volume-min.svg +0 -5
  34. package/assets/icons/new/volume-off.svg +0 -5
  35. package/assets/icons/old/cardboard.svg +0 -4
  36. package/assets/icons/old/close-share.svg +0 -13
  37. package/assets/icons/old/close.svg +0 -13
  38. package/assets/icons/old/fb.svg +0 -13
  39. package/assets/icons/old/fullscreen.svg +0 -12
  40. package/assets/icons/old/language.svg +0 -1
  41. package/assets/icons/old/pause.svg +0 -12
  42. package/assets/icons/old/play.svg +0 -12
  43. package/assets/icons/old/quality-arrow.svg +0 -13
  44. package/assets/icons/old/reload.svg +0 -4
  45. package/assets/icons/old/share.svg +0 -13
  46. package/assets/icons/old/sound-off.svg +0 -15
  47. package/assets/icons/old/sound-on.svg +0 -15
  48. package/assets/icons/old/streams.svg +0 -3
  49. package/assets/icons/old/twitter.svg +0 -13
  50. package/assets/icons/old/wn.svg +0 -15
  51. package/assets/icons/standard/01-play.svg +0 -3
  52. package/assets/icons/standard/02-pause.svg +0 -3
  53. package/assets/icons/standard/03-stop.svg +0 -3
  54. package/assets/icons/standard/04-volume.svg +0 -3
  55. package/assets/icons/standard/05-mute.svg +0 -3
  56. package/assets/icons/standard/06-expand.svg +0 -3
  57. package/assets/icons/standard/07-shrink.svg +0 -3
  58. package/assets/icons/standard/08-hd.svg +0 -3
  59. package/assets/icons/standard/09-cc.svg +0 -8
  60. package/assets/icons/standard/10-reload.svg +0 -4
  61. package/assets/style/main.scss +0 -50
  62. package/assets/style/theme.scss +0 -42
  63. package/assets/style/variables.scss +0 -7
  64. package/dist/index.css +0 -125
package/lib/Player.js CHANGED
@@ -5,7 +5,6 @@ import { reportError, trace } from './trace/index.js';
5
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
- import '../assets/style/main.scss'; // TODO check if needed
9
8
  const T = 'GPlayer';
10
9
  const DEFAULT_OPTIONS = {
11
10
  autoPlay: false,
@@ -28,6 +27,7 @@ export class Player {
28
27
  emitter = new EventLite();
29
28
  player = null;
30
29
  ready = false;
30
+ rootNode = null;
31
31
  tuneInTimerId = null;
32
32
  tunedIn = false;
33
33
  get activePlayback() {
@@ -43,6 +43,12 @@ export class Player {
43
43
  return 'native';
44
44
  }
45
45
  }
46
+ get activeSource() {
47
+ if (!this.player?.core.activePlayback) {
48
+ return null;
49
+ }
50
+ return this.player.core.activePlayback.options.src;
51
+ }
46
52
  get bitrate() {
47
53
  return this.bitrateInfo;
48
54
  }
@@ -165,6 +171,7 @@ export class Player {
165
171
  this.bindBitrateChangeHandler();
166
172
  }
167
173
  player.core.on(ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, () => {
174
+ // this.trigger(Events.ContainerChanged)
168
175
  this.bindBitrateChangeHandler();
169
176
  }, null);
170
177
  if (Browser.isiOS && player.core.activePlayback) {
@@ -178,7 +185,19 @@ export class Player {
178
185
  });
179
186
  }
180
187
  player.core.on(ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED, ({ orientation }) => {
181
- trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation });
188
+ trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
189
+ orientation,
190
+ rootNode: {
191
+ width: this.rootNode?.clientWidth,
192
+ height: this.rootNode?.clientHeight,
193
+ },
194
+ });
195
+ if (Browser.isiOS && this.rootNode) {
196
+ player.core.resize({
197
+ width: this.rootNode.clientWidth,
198
+ height: this.rootNode.clientHeight,
199
+ });
200
+ }
182
201
  }, null);
183
202
  player.core.on(ClapprEvents.CORE_RESIZE, ({ width, height }) => {
184
203
  trace(`${T} CORE_RESIZE`, {
@@ -216,7 +235,7 @@ export class Player {
216
235
  setTimeout(() => this.tuneIn(), 0);
217
236
  },
218
237
  onResize: (newSize) => {
219
- trace(`${T} CORE_RESIZE`, {
238
+ trace(`${T} onResize`, {
220
239
  newSize,
221
240
  });
222
241
  },
@@ -253,7 +272,7 @@ export class Player {
253
272
  }
254
273
  },
255
274
  };
256
- buildCoreOptions(playerElement) {
275
+ buildCoreOptions(rootNode) {
257
276
  const multisources = this.config.multisources;
258
277
  const mainSource = this.config.playbackType === 'live'
259
278
  ? multisources.find((ms) => ms.live !== false)
@@ -263,13 +282,14 @@ export class Player {
263
282
  : [];
264
283
  // const mainSourceUrl = mediaSources[0];
265
284
  const poster = mainSource?.poster ?? this.config.poster;
285
+ this.rootNode = rootNode;
266
286
  const coreOptions = {
267
287
  ...this.config.pluginSettings,
268
288
  allowUserInteraction: true,
269
289
  autoPlay: false,
270
290
  debug: this.config.debug || 'none',
271
291
  events: this.events,
272
- height: playerElement.clientHeight,
292
+ height: rootNode.clientHeight,
273
293
  loop: this.config.loop,
274
294
  multisources,
275
295
  mute: this.config.mute,
@@ -283,10 +303,10 @@ export class Player {
283
303
  debug: this.config.debug === 'all' || this.config.debug === 'hls',
284
304
  },
285
305
  },
286
- parent: playerElement,
306
+ parent: rootNode,
287
307
  playbackType: this.config.playbackType,
288
308
  poster,
289
- width: playerElement.clientWidth,
309
+ width: rootNode.clientWidth,
290
310
  // source: mainSourceUrl,
291
311
  sources: mediaSources,
292
312
  strings: this.config.strings,
@@ -294,6 +314,7 @@ export class Player {
294
314
  return coreOptions;
295
315
  }
296
316
  configurePlaybacks() {
317
+ // TODO check if there are DASH and HLS sources and don't register the respective playbacks if not
297
318
  Loader.registerPlayback(DashPlayback);
298
319
  Loader.registerPlayback(HlsPlayback);
299
320
  }
package/lib/version.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export declare function version(): {
2
2
  gplayer: string;
3
3
  clappr: string;
4
+ dashjs: string;
5
+ hlsjs: string;
4
6
  };
5
7
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO;;;EAKtB"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO;;;;;EAOtB"}
package/lib/version.js CHANGED
@@ -4,5 +4,7 @@ export function version() {
4
4
  return {
5
5
  gplayer: pkg.version,
6
6
  clappr: lock.packages['node_modules/@clappr/core'].version,
7
+ dashjs: lock.packages['node_modules/dashjs'].version,
8
+ hlsjs: lock.packages['node_modules/hls.js'].version,
7
9
  };
8
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.1.13",
3
+ "version": "2.3.0",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/Player.ts CHANGED
@@ -25,7 +25,7 @@ import { PlayerConfig, PlayerEvent } from './types.js'
25
25
  import DashPlayback from './plugins/dash-playback/DashPlayback.js'
26
26
  import HlsPlayback from './plugins/hls-playback/HlsPlayback.js'
27
27
 
28
- import '../assets/style/main.scss' // TODO check if needed
28
+ // import '../assets/style/main.scss' // TODO check if needed
29
29
 
30
30
  // TODO implement transport retry/failover and fallback logic
31
31
 
@@ -64,6 +64,8 @@ export class Player {
64
64
 
65
65
  private ready = false
66
66
 
67
+ private rootNode: HTMLElement | null = null
68
+
67
69
  private tuneInTimerId: ReturnType<typeof setTimeout> | null = null
68
70
 
69
71
  private tunedIn = false
@@ -82,6 +84,13 @@ export class Player {
82
84
  }
83
85
  }
84
86
 
87
+ get activeSource(): string | null {
88
+ if (!this.player?.core.activePlayback) {
89
+ return null
90
+ }
91
+ return this.player.core.activePlayback.options.src
92
+ }
93
+
85
94
  get bitrate(): BitrateInfo | null {
86
95
  return this.bitrateInfo
87
96
  }
@@ -227,6 +236,7 @@ export class Player {
227
236
  player.core.on(
228
237
  ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED,
229
238
  () => {
239
+ // this.trigger(Events.ContainerChanged)
230
240
  this.bindBitrateChangeHandler()
231
241
  },
232
242
  null,
@@ -243,7 +253,19 @@ export class Player {
243
253
  player.core.on(
244
254
  ClapprEvents.CORE_SCREEN_ORIENTATION_CHANGED,
245
255
  ({ orientation }: { orientation: 'landscape' | 'portrait' }) => {
246
- trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, { orientation })
256
+ trace(`${T} CORE_SCREEN_ORIENTATION_CHANGED`, {
257
+ orientation,
258
+ rootNode: {
259
+ width: this.rootNode?.clientWidth,
260
+ height: this.rootNode?.clientHeight,
261
+ },
262
+ })
263
+ if (Browser.isiOS && this.rootNode) {
264
+ player.core.resize({
265
+ width: this.rootNode.clientWidth,
266
+ height: this.rootNode.clientHeight,
267
+ })
268
+ }
247
269
  },
248
270
  null,
249
271
  )
@@ -288,7 +310,7 @@ export class Player {
288
310
  setTimeout(() => this.tuneIn(), 0)
289
311
  },
290
312
  onResize: (newSize: { width: number; height: number }) => {
291
- trace(`${T} CORE_RESIZE`, {
313
+ trace(`${T} onResize`, {
292
314
  newSize,
293
315
  })
294
316
  },
@@ -322,7 +344,7 @@ export class Player {
322
344
  },
323
345
  }
324
346
 
325
- private buildCoreOptions(playerElement: HTMLElement): CoreOptions {
347
+ private buildCoreOptions(rootNode: HTMLElement): CoreOptions {
326
348
  const multisources = this.config.multisources
327
349
  const mainSource =
328
350
  this.config.playbackType === 'live'
@@ -334,13 +356,15 @@ export class Player {
334
356
  // const mainSourceUrl = mediaSources[0];
335
357
  const poster = mainSource?.poster ?? this.config.poster
336
358
 
359
+ this.rootNode = rootNode
360
+
337
361
  const coreOptions: CoreOptions & PluginOptions = {
338
362
  ...this.config.pluginSettings,
339
363
  allowUserInteraction: true,
340
364
  autoPlay: false,
341
365
  debug: this.config.debug || 'none',
342
366
  events: this.events,
343
- height: playerElement.clientHeight,
367
+ height: rootNode.clientHeight,
344
368
  loop: this.config.loop,
345
369
  multisources,
346
370
  mute: this.config.mute,
@@ -354,10 +378,10 @@ export class Player {
354
378
  debug: this.config.debug === 'all' || this.config.debug === 'hls',
355
379
  },
356
380
  },
357
- parent: playerElement,
381
+ parent: rootNode,
358
382
  playbackType: this.config.playbackType,
359
383
  poster,
360
- width: playerElement.clientWidth,
384
+ width: rootNode.clientWidth,
361
385
  // source: mainSourceUrl,
362
386
  sources: mediaSources,
363
387
  strings: this.config.strings,
@@ -366,6 +390,7 @@ export class Player {
366
390
  }
367
391
 
368
392
  private configurePlaybacks() {
393
+ // TODO check if there are DASH and HLS sources and don't register the respective playbacks if not
369
394
  Loader.registerPlayback(DashPlayback)
370
395
  Loader.registerPlayback(HlsPlayback)
371
396
  }
package/src/version.ts CHANGED
@@ -5,5 +5,7 @@ export function version() {
5
5
  return {
6
6
  gplayer: pkg.version,
7
7
  clappr: lock.packages['node_modules/@clappr/core'].version,
8
+ dashjs: lock.packages['node_modules/dashjs'].version,
9
+ hlsjs: lock.packages['node_modules/hls.js'].version,
8
10
  }
9
11
  }