@gcorevideo/player 2.1.14 → 2.3.1

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 (67) hide show
  1. package/dist/index.js +191 -216
  2. package/lib/Player.d.ts +4 -4
  3. package/lib/Player.d.ts.map +1 -1
  4. package/lib/Player.js +11 -5
  5. package/lib/types.d.ts +4 -3
  6. package/lib/types.d.ts.map +1 -1
  7. package/lib/version.d.ts +2 -0
  8. package/lib/version.d.ts.map +1 -1
  9. package/lib/version.js +2 -0
  10. package/package.json +1 -1
  11. package/src/Player.ts +16 -8
  12. package/src/types.ts +72 -69
  13. package/src/version.ts +2 -0
  14. package/tsconfig.tsbuildinfo +1 -1
  15. package/assets/icons/new/arrow-left.svg +0 -5
  16. package/assets/icons/new/arrow-right.svg +0 -5
  17. package/assets/icons/new/check.svg +0 -5
  18. package/assets/icons/new/close.svg +0 -12
  19. package/assets/icons/new/full.svg +0 -8
  20. package/assets/icons/new/fullscreen-off.svg +0 -14
  21. package/assets/icons/new/fullscreen-on.svg +0 -14
  22. package/assets/icons/new/gear-hd.svg +0 -16
  23. package/assets/icons/new/gear.svg +0 -12
  24. package/assets/icons/new/hd.svg +0 -8
  25. package/assets/icons/new/pause.svg +0 -5
  26. package/assets/icons/new/pip.svg +0 -5
  27. package/assets/icons/new/play.svg +0 -10
  28. package/assets/icons/new/replayleft.svg +0 -5
  29. package/assets/icons/new/replayright.svg +0 -5
  30. package/assets/icons/new/speed.svg +0 -5
  31. package/assets/icons/new/stats.svg +0 -3
  32. package/assets/icons/new/stop.svg +0 -3
  33. package/assets/icons/new/subtitles-off.svg +0 -5
  34. package/assets/icons/new/subtitles-on.svg +0 -6
  35. package/assets/icons/new/volume-max.svg +0 -5
  36. package/assets/icons/new/volume-min.svg +0 -5
  37. package/assets/icons/new/volume-off.svg +0 -5
  38. package/assets/icons/old/cardboard.svg +0 -4
  39. package/assets/icons/old/close-share.svg +0 -13
  40. package/assets/icons/old/close.svg +0 -13
  41. package/assets/icons/old/fb.svg +0 -13
  42. package/assets/icons/old/fullscreen.svg +0 -12
  43. package/assets/icons/old/language.svg +0 -1
  44. package/assets/icons/old/pause.svg +0 -12
  45. package/assets/icons/old/play.svg +0 -12
  46. package/assets/icons/old/quality-arrow.svg +0 -13
  47. package/assets/icons/old/reload.svg +0 -4
  48. package/assets/icons/old/share.svg +0 -13
  49. package/assets/icons/old/sound-off.svg +0 -15
  50. package/assets/icons/old/sound-on.svg +0 -15
  51. package/assets/icons/old/streams.svg +0 -3
  52. package/assets/icons/old/twitter.svg +0 -13
  53. package/assets/icons/old/wn.svg +0 -15
  54. package/assets/icons/standard/01-play.svg +0 -3
  55. package/assets/icons/standard/02-pause.svg +0 -3
  56. package/assets/icons/standard/03-stop.svg +0 -3
  57. package/assets/icons/standard/04-volume.svg +0 -3
  58. package/assets/icons/standard/05-mute.svg +0 -3
  59. package/assets/icons/standard/06-expand.svg +0 -3
  60. package/assets/icons/standard/07-shrink.svg +0 -3
  61. package/assets/icons/standard/08-hd.svg +0 -3
  62. package/assets/icons/standard/09-cc.svg +0 -8
  63. package/assets/icons/standard/10-reload.svg +0 -4
  64. package/assets/style/main.scss +0 -50
  65. package/assets/style/theme.scss +0 -42
  66. package/assets/style/variables.scss +0 -7
  67. 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,
@@ -23,7 +22,7 @@ const DEFAULT_OPTIONS = {
23
22
  * @beta
24
23
  */
25
24
  export class Player {
26
- bitrateInfo = null;
25
+ qLevel = null;
27
26
  config = DEFAULT_OPTIONS;
28
27
  emitter = new EventLite();
29
28
  player = null;
@@ -44,8 +43,14 @@ export class Player {
44
43
  return 'native';
45
44
  }
46
45
  }
46
+ get activeSource() {
47
+ if (!this.player?.core.activePlayback) {
48
+ return null;
49
+ }
50
+ return this.player.core.activePlayback.options.src;
51
+ }
47
52
  get bitrate() {
48
- return this.bitrateInfo;
53
+ return this.qLevel;
49
54
  }
50
55
  get hd() {
51
56
  return this.player?.core.activePlayback?.isHighDefinitionInUse || false;
@@ -104,7 +109,7 @@ export class Player {
104
109
  clearTimeout(this.tuneInTimerId);
105
110
  this.tuneInTimerId = null;
106
111
  }
107
- this.bitrateInfo = null;
112
+ this.qLevel = null;
108
113
  }
109
114
  pause() {
110
115
  assert.ok(this.player, 'Player not initialized');
@@ -166,6 +171,7 @@ export class Player {
166
171
  this.bindBitrateChangeHandler();
167
172
  }
168
173
  player.core.on(ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED, () => {
174
+ // this.trigger(Events.ContainerChanged)
169
175
  this.bindBitrateChangeHandler();
170
176
  }, null);
171
177
  if (Browser.isiOS && player.core.activePlayback) {
@@ -314,7 +320,7 @@ export class Player {
314
320
  }
315
321
  bindBitrateChangeHandler() {
316
322
  this.player?.core.activeContainer.on(ClapprEvents.CONTAINER_BITRATE, (bitrate) => {
317
- this.bitrateInfo = bitrate;
323
+ this.qLevel = bitrate;
318
324
  });
319
325
  }
320
326
  buildMediaSourcesList(ms) {
package/lib/types.d.ts CHANGED
@@ -77,12 +77,13 @@ export type StreamMediaSource = {
77
77
  export type SrcProjectionType = 'regular' | '360' | 'vr180' | 'vr360tb';
78
78
  export type ProjectionType = '360' | '180' | '360_TB';
79
79
  export type TranslationSettings = Partial<Record<LangTag, Record<TranslationKey, string>>>;
80
- export type BitrateInfo = {
81
- height: number;
80
+ export type QualityLevelInfo = {
81
+ level: number;
82
82
  width: number;
83
+ height: number;
83
84
  bitrate: number;
84
- level: number;
85
85
  };
86
+ export type BitrateInfo = QualityLevelInfo;
86
87
  export declare enum PlayerEvent {
87
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AO,CAAA;IACb,iBAAiB,EAAE,mBAAmB,CAAA;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,UAAU,EAAE,cAAc,GAAG,IAAI,CAAA;IACjC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAA;AACvE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAA;AAErD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAChD,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG,gBAAgB,CAAA;AAE1C,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB"}
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.14",
3
+ "version": "2.3.1",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/Player.ts CHANGED
@@ -15,9 +15,9 @@ import type {
15
15
  CorePluginOptions,
16
16
  } from './internal.types.js'
17
17
  import type {
18
- BitrateInfo,
19
18
  PlaybackType,
20
19
  PlayerPlugin,
20
+ QualityLevelInfo,
21
21
  StreamMediaSource,
22
22
  } from './types.js'
23
23
  import { reportError, trace } from './trace/index.js'
@@ -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
 
@@ -54,7 +54,7 @@ type PluginOptions = Record<string, unknown>
54
54
  * @beta
55
55
  */
56
56
  export class Player {
57
- private bitrateInfo: BitrateInfo | null = null
57
+ private qLevel: QualityLevelInfo | null = null
58
58
 
59
59
  private config: PlayerConfig = DEFAULT_OPTIONS
60
60
 
@@ -84,8 +84,15 @@ export class Player {
84
84
  }
85
85
  }
86
86
 
87
- get bitrate(): BitrateInfo | null {
88
- return this.bitrateInfo
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
+
94
+ get bitrate(): QualityLevelInfo | null {
95
+ return this.qLevel
89
96
  }
90
97
 
91
98
  get hd() {
@@ -155,7 +162,7 @@ export class Player {
155
162
  clearTimeout(this.tuneInTimerId)
156
163
  this.tuneInTimerId = null
157
164
  }
158
- this.bitrateInfo = null
165
+ this.qLevel = null
159
166
  }
160
167
 
161
168
  pause() {
@@ -229,6 +236,7 @@ export class Player {
229
236
  player.core.on(
230
237
  ClapprEvents.CORE_ACTIVE_CONTAINER_CHANGED,
231
238
  () => {
239
+ // this.trigger(Events.ContainerChanged)
232
240
  this.bindBitrateChangeHandler()
233
241
  },
234
242
  null,
@@ -390,8 +398,8 @@ export class Player {
390
398
  private bindBitrateChangeHandler() {
391
399
  this.player?.core.activeContainer.on(
392
400
  ClapprEvents.CONTAINER_BITRATE,
393
- (bitrate: BitrateInfo) => {
394
- this.bitrateInfo = bitrate
401
+ (bitrate: QualityLevelInfo) => {
402
+ this.qLevel = bitrate
395
403
  },
396
404
  )
397
405
  }
package/src/types.ts CHANGED
@@ -1,107 +1,110 @@
1
- export type PlayerDebugTag = 'all' | 'clappr' | 'dash' | 'hls' | 'none';
2
- export type PlayerDebugSettings = PlayerDebugTag | boolean;
1
+ export type PlayerDebugTag = 'all' | 'clappr' | 'dash' | 'hls' | 'none'
2
+ export type PlayerDebugSettings = PlayerDebugTag | boolean
3
3
 
4
- export type PlaybackType = 'live' | 'vod';
5
- export type MediaTransport = 'dash' | 'hls' | 'mpegts';
6
- export type TransportPreference = MediaTransport | 'auto';
4
+ export type PlaybackType = 'live' | 'vod'
5
+ export type MediaTransport = 'dash' | 'hls' | 'mpegts'
6
+ export type TransportPreference = MediaTransport | 'auto'
7
7
 
8
8
  export type PlayerPlugin = {
9
- new(...args: any[]): unknown;
10
- type: string; // 'core' | 'container' | 'playback';
9
+ new (...args: any[]): unknown
10
+ type: string // 'core' | 'container' | 'playback';
11
11
  }
12
12
 
13
13
  export type PlayerConfig = {
14
- autoPlay?: boolean;
15
- debug?: PlayerDebugSettings;
16
- language?: string;
17
- loop?: boolean;
18
- multisources: StreamMediaSource[]; // TODO rename sources or better split the sources and the source description settings
19
- mute?: boolean;
20
- playbackType?: PlaybackType;
21
- pluginSettings?: Record<string, unknown>;
22
- poster?: string;
23
- priorityTransport?: TransportPreference;
24
- strings: TranslationSettings;
14
+ autoPlay?: boolean
15
+ debug?: PlayerDebugSettings
16
+ language?: string
17
+ loop?: boolean
18
+ multisources: StreamMediaSource[] // TODO rename sources or better split the sources and the source description settings
19
+ mute?: boolean
20
+ playbackType?: PlaybackType
21
+ pluginSettings?: Record<string, unknown>
22
+ poster?: string
23
+ priorityTransport?: TransportPreference
24
+ strings: TranslationSettings
25
25
  }
26
26
 
27
27
  export type PlayerOptionsThumbnails = {
28
- sprite?: string | null;
29
- vtt?: string | null;
30
-
28
+ sprite?: string | null
29
+ vtt?: string | null
31
30
  }
32
31
 
33
32
  export type ContextMenuSettings = {
34
- preventShowContextMenu?: boolean;
33
+ preventShowContextMenu?: boolean
35
34
  }
36
35
 
37
- type LangTag = string;
38
- type TranslationKey = string;
36
+ type LangTag = string
37
+ type TranslationKey = string
39
38
 
40
39
  export type BroadcastSettings = {
41
- status?: 'live' | 'noActiveStreams';
40
+ status?: 'live' | 'noActiveStreams'
42
41
  }
43
42
 
44
- export type ClipsPluginOptions = Record<string, unknown>; // TODO
43
+ export type ClipsPluginOptions = Record<string, unknown> // TODO
45
44
 
46
45
  export type PlaybackSettings = {
47
- hlsjsConfig?: Record<string, unknown>;
48
- playInline?: boolean;
49
- preload?: 'auto' | 'metadata' | 'none';
50
- triggerFatalErrorOnResourceDenied?: boolean;
46
+ hlsjsConfig?: Record<string, unknown>
47
+ playInline?: boolean
48
+ preload?: 'auto' | 'metadata' | 'none'
49
+ triggerFatalErrorOnResourceDenied?: boolean
51
50
  }
52
51
 
53
- export type DashSettings = Record<string, unknown>; //
52
+ export type DashSettings = Record<string, unknown> //
54
53
 
55
54
  // TODO consult with the Broadcaster team
56
55
  // TODO turn into camel case convert at user level
57
56
  export type StreamMediaSourceDto = {
58
- description: string;
59
- dvr: boolean;
60
- hls_cmaf_url?: string;
61
- hls_mpegts_url?: string;
62
- id: number;
63
- live: boolean;
64
- priority_transport: TransportPreference;
65
- poster: string | null;
66
- projection: ProjectionType | null;
67
- screenshot: string | null;
57
+ description: string
58
+ dvr: boolean
59
+ hls_cmaf_url?: string
60
+ hls_mpegts_url?: string
61
+ id: number
62
+ live: boolean
63
+ priority_transport: TransportPreference
64
+ poster: string | null
65
+ projection: ProjectionType | null
66
+ screenshot: string | null
68
67
  source: string
69
- source_dash: string | null;
70
- sprite: string | null;
71
- title: string;
72
- vtt: string | null;
68
+ source_dash: string | null
69
+ sprite: string | null
70
+ title: string
71
+ vtt: string | null
73
72
  }
74
73
 
75
74
  // TODO split into sources and source attributes
76
75
  export type StreamMediaSource = {
77
- description: string;
78
- dvr: boolean;
79
- hlsCmafUrl: string | null;
80
- hlsMpegtsUrl: string | null;
81
- id: number;
82
- live: boolean;
83
- priorityTransport: TransportPreference;
84
- poster: string | null;
85
- projection: ProjectionType | null;
86
- screenshot: string | null;
87
- source: string | null;
88
- sourceDash: string | null;
89
- sprite: string | null;
90
- title: string;
91
- vtt: string | null;
76
+ description: string
77
+ dvr: boolean
78
+ hlsCmafUrl: string | null
79
+ hlsMpegtsUrl: string | null
80
+ id: number
81
+ live: boolean
82
+ priorityTransport: TransportPreference
83
+ poster: string | null
84
+ projection: ProjectionType | null
85
+ screenshot: string | null
86
+ source: string | null
87
+ sourceDash: string | null
88
+ sprite: string | null
89
+ title: string
90
+ vtt: string | null
92
91
  }
93
92
 
94
- export type SrcProjectionType = 'regular' | '360' | 'vr180' | 'vr360tb';
95
- export type ProjectionType = '360' | '180' | '360_TB';
93
+ export type SrcProjectionType = 'regular' | '360' | 'vr180' | 'vr360tb'
94
+ export type ProjectionType = '360' | '180' | '360_TB'
95
+
96
+ export type TranslationSettings = Partial<
97
+ Record<LangTag, Record<TranslationKey, string>>
98
+ >
96
99
 
97
- export type TranslationSettings = Partial<Record<LangTag, Record<TranslationKey, string>>>;
100
+ export type QualityLevelInfo = {
101
+ level: number
102
+ width: number
103
+ height: number
104
+ bitrate: number
105
+ }
98
106
 
99
- export type BitrateInfo = {
100
- height: number;
101
- width: number;
102
- bitrate: number;
103
- level: number;
104
- };
107
+ export type BitrateInfo = QualityLevelInfo
105
108
 
106
109
  export enum PlayerEvent {
107
110
  Ready = 'ready',
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
  }