@gcorevideo/player 2.17.0 → 2.18.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 (69) hide show
  1. package/dist/index.js +182 -109
  2. package/dist/player.d.ts +150 -24
  3. package/docs/api/player.containersize.md +19 -0
  4. package/docs/api/player.dashsettings.md +2 -0
  5. package/docs/api/player.errorlevel.md +1 -0
  6. package/docs/api/player.langtag.md +6 -0
  7. package/docs/api/player.md +57 -22
  8. package/docs/api/player.mediatransport.md +1 -0
  9. package/docs/api/player.playbackerror.code.md +2 -0
  10. package/docs/api/player.playbackerror.description.md +2 -0
  11. package/docs/api/player.playbackerror.level.md +2 -0
  12. package/docs/api/player.playbackerror.md +43 -4
  13. package/docs/api/player.playbackerror.message.md +2 -0
  14. package/docs/api/player.playbackerror.origin.md +21 -0
  15. package/docs/api/player.playbackerror.scope.md +16 -0
  16. package/docs/api/player.playbackerrorcode.md +4 -3
  17. package/docs/api/player.playbackmodule.md +1 -0
  18. package/docs/api/player.player.isdvrinuse.md +24 -0
  19. package/docs/api/player.player.isplaying.md +1 -1
  20. package/docs/api/player.player.md +15 -1
  21. package/docs/api/player.player.off.md +4 -4
  22. package/docs/api/player.player.on.md +5 -5
  23. package/docs/api/player.player.resize.md +3 -6
  24. package/docs/api/player.playercomponenttype.md +16 -0
  25. package/docs/api/player.playerdebugsettings.md +1 -1
  26. package/docs/api/player.playerdebugtag.md +1 -0
  27. package/docs/api/player.playerevent.md +96 -0
  28. package/docs/api/player.playereventhandler.md +3 -2
  29. package/docs/api/player.playereventparams.md +20 -0
  30. package/docs/api/player.playermediasourcedesc.md +1 -1
  31. package/docs/api/player.playermediasourcedesc.mimetype.md +1 -1
  32. package/docs/api/player.qualitylevel.bitrate.md +16 -0
  33. package/docs/api/player.qualitylevel.height.md +16 -0
  34. package/docs/api/player.qualitylevel.level.md +16 -0
  35. package/docs/api/player.qualitylevel.md +104 -7
  36. package/docs/api/player.qualitylevel.width.md +16 -0
  37. package/docs/api/player.timeposition.current.md +16 -0
  38. package/docs/api/player.timeposition.md +65 -7
  39. package/docs/api/player.timeposition.total.md +16 -0
  40. package/docs/api/player.timevalue.md +1 -1
  41. package/docs/api/player.translationsettings.md +7 -1
  42. package/docs/api/player.transportpreference.md +1 -0
  43. package/lib/Player.d.ts +30 -14
  44. package/lib/Player.d.ts.map +1 -1
  45. package/lib/Player.js +72 -65
  46. package/lib/internal.types.d.ts +3 -5
  47. package/lib/internal.types.d.ts.map +1 -1
  48. package/lib/playback/dash-playback/DashPlayback.d.ts +2 -0
  49. package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
  50. package/lib/playback/dash-playback/DashPlayback.js +37 -25
  51. package/lib/playback/hls-playback/HlsPlayback.d.ts +3 -0
  52. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  53. package/lib/playback/hls-playback/HlsPlayback.js +33 -18
  54. package/lib/playback.types.d.ts +65 -6
  55. package/lib/playback.types.d.ts.map +1 -1
  56. package/lib/playback.types.js +10 -0
  57. package/lib/types.d.ts +54 -5
  58. package/lib/types.d.ts.map +1 -1
  59. package/lib/types.js +31 -2
  60. package/package.json +1 -1
  61. package/src/Player.ts +109 -78
  62. package/src/internal.types.ts +3 -2
  63. package/src/playback/dash-playback/DashPlayback.ts +64 -35
  64. package/src/playback/hls-playback/HlsPlayback.ts +46 -22
  65. package/src/playback.types.ts +65 -5
  66. package/src/types.ts +56 -6
  67. package/temp/player.api.json +611 -87
  68. package/tsconfig.tsbuildinfo +1 -1
  69. package/dist/DashPlayback-BRJzl8D8.js +0 -901
@@ -1,16 +1,21 @@
1
1
  /**
2
2
  * Playback time in seconds since the beginning of the stream (or a segment for the live streams)
3
- * For the plugin development
4
3
  * @beta
5
4
  */
6
5
  export type TimeValue = number
7
6
 
8
7
  /**
9
- * For the plugin development
8
+ * Current playback time and total duration of the media.
10
9
  * @beta
11
10
  */
12
- export type TimePosition = {
11
+ export interface TimePosition {
12
+ /**
13
+ * Current playback time, 0..duration, seconds.
14
+ */
13
15
  current: TimeValue
16
+ /**
17
+ * Total duration of the media, seconds.
18
+ */
14
19
  total: TimeValue
15
20
  }
16
21
 
@@ -29,35 +34,90 @@ export type TimeUpdate = TimePosition & {
29
34
  }
30
35
 
31
36
  /**
37
+ * A level of quality within a media source.
32
38
  * @beta
33
39
  */
34
- export type QualityLevel = {
35
- level: number // 0-based index
40
+ export interface QualityLevel {
41
+ /**
42
+ * Zero-based index of the quality level.
43
+ */
44
+ level: number
45
+ /**
46
+ * Width of the video, pixels.
47
+ */
36
48
  width: number
49
+ /**
50
+ * Height of the video, pixels.
51
+ */
37
52
  height: number
53
+ /**
54
+ * Bitrate of the video, bps.
55
+ */
38
56
  bitrate: number
39
57
  }
40
58
 
41
59
  /**
60
+ * Codes of errors occurring within the playback component.
42
61
  * @beta
43
62
  */
44
63
  export enum PlaybackErrorCode {
64
+ /**
65
+ * An unknown or uncategorised error.
66
+ */
45
67
  Generic = 0,
68
+ /**
69
+ * The media source is not available. Typically a network error.
70
+ */
46
71
  MediaSourceUnavailable = 1,
72
+ /**
73
+ * The media source is not accessible due to some protection policy.
74
+ */
47
75
  MediaSourceAccessDenied = 3,
48
76
  }
49
77
 
50
78
  /**
79
+ * Levels of severity of errors. Non-fatal errors usually can be ignored.
51
80
  * @beta
52
81
  */
53
82
  export type ErrorLevel = 'FATAL' | 'WARN' | 'INFO'
54
83
 
55
84
  /**
85
+ * Subsystems of a player component.
86
+ * @beta
87
+ */
88
+ export type PlayerComponentType = 'container' | 'core' | 'playback'
89
+
90
+ /**
91
+ * An error occurred during the playback.
56
92
  * @beta
57
93
  */
58
94
  export interface PlaybackError {
95
+ /**
96
+ * Error code.
97
+ */
59
98
  code: PlaybackErrorCode
99
+ /**
100
+ * Detailed description of the error.
101
+ */
60
102
  description: string
103
+ /**
104
+ * Level of severity of the error.
105
+ */
61
106
  level: ErrorLevel
107
+ /**
108
+ * Error message. Non-fatal usually can be ignored.
109
+ */
62
110
  message: string
111
+ /**
112
+ * Exact component that originated the error.
113
+ * @example
114
+ * - 'core'
115
+ * - 'dash'
116
+ * - 'media_control'
117
+ */
118
+ origin: string
119
+ /**
120
+ * Component subsystem of the error origin
121
+ */
122
+ scope: PlayerComponentType
63
123
  }
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ContainerPlugin, CorePlugin } from "@clappr/core"
1
+ import { ContainerPlugin, CorePlugin } from '@clappr/core'
2
2
 
3
3
  /**
4
4
  * Describes a media source with its MIME type and URL.
@@ -10,7 +10,8 @@ import { ContainerPlugin, CorePlugin } from "@clappr/core"
10
10
  */
11
11
  export interface PlayerMediaSourceDesc {
12
12
  /**
13
- * The MIME type of the media source (e.g. "video/mp4", "application/x-mpegURL")
13
+ * The MIME type of the media source (e.g. `"video/mp4"`, `"application/x-mpegURL"`).
14
+ * Necessary if the type cannot be detected from file extension of the source URL.
14
15
  */
15
16
  mimeType?: string
16
17
 
@@ -27,12 +28,13 @@ export interface PlayerMediaSourceDesc {
27
28
  export type PlayerMediaSource = string | PlayerMediaSourceDesc
28
29
 
29
30
  /**
31
+ * Debug output category selector
30
32
  * @beta
31
33
  */
32
34
  export type PlayerDebugTag = 'all' | 'clappr' | 'dash' | 'hls' | 'none'
33
35
 
34
36
  /**
35
- * @remarks true is equivalent to 'all', false is equivalent to 'none'
37
+ * @remarks `true` is equivalent to `'all'`, `false` is equivalent to `'none'`
36
38
  * @beta
37
39
  */
38
40
  export type PlayerDebugSettings = PlayerDebugTag | boolean
@@ -44,11 +46,13 @@ export type PlayerDebugSettings = PlayerDebugTag | boolean
44
46
  export type PlaybackType = 'live' | 'vod'
45
47
 
46
48
  /**
49
+ * Media delivery protocol
47
50
  * @beta
48
51
  */
49
52
  export type MediaTransport = 'dash' | 'hls'
50
53
 
51
54
  /**
55
+ * Preferred media delivery protocol
52
56
  * @beta
53
57
  */
54
58
  export type TransportPreference = MediaTransport
@@ -167,6 +171,8 @@ export interface PlayerConfig extends Record<string, unknown> {
167
171
  }
168
172
 
169
173
  /**
174
+ * An ISO 639-1 language code.
175
+ * @example `pt`
170
176
  * @beta
171
177
  */
172
178
  export type LangTag = string
@@ -177,13 +183,19 @@ export type LangTag = string
177
183
  export type TranslationKey = string
178
184
 
179
185
  /**
186
+ * A plain JS object that must conform to the DASH.js settings schema.
180
187
  * @beta
181
188
  * {@link https://cdn.dashjs.org/latest/jsdoc/module-Settings.html | DASH.js settings}
182
189
  */
183
190
  export type DashSettings = Record<string, unknown>
184
191
 
185
192
  /**
186
- * [language][key] =\> string
193
+ * Localization strings for the player UI.
194
+ * @remarks
195
+ * The keys are language codes, and the values are objects with keys being the translation keys and values being the translations.
196
+ *
197
+ * This dictionary is used to localize the player UI, including the error messages and is shared across all the player components (including the plugins).
198
+ *
187
199
  * @example
188
200
  * ```
189
201
  * {
@@ -205,11 +217,34 @@ export type TranslationSettings = Partial<
205
217
  Record<LangTag, Record<TranslationKey, string>>
206
218
  >
207
219
 
220
+ /**
221
+ * Dimensions of the player container DOM element.
222
+ * @beta
223
+ */
224
+ export type ContainerSize = {
225
+ width: number
226
+ height: number
227
+ }
228
+
208
229
  /**
209
230
  * A top-level event on the player object
210
231
  * @beta
211
232
  */
212
233
  export enum PlayerEvent {
234
+ /**
235
+ * Playback has reached the end of the media.
236
+ */
237
+ Ended = 'ended',
238
+ /**
239
+ * An error occurred.
240
+ * Parameters: {@link PlaybackError}
241
+ */
242
+ Error = 'error',
243
+ /**
244
+ * The player has switched to or from the fullscreen mode.
245
+ * Parameters:`boolean` isFullscreen
246
+ */
247
+ Fullscreen = 'fullscreen',
213
248
  /**
214
249
  * The player is ready to use.
215
250
  */
@@ -222,12 +257,27 @@ export enum PlayerEvent {
222
257
  * Playback has been paused.
223
258
  */
224
259
  Pause = 'pause',
260
+ /**
261
+ * The player's container has been resized.
262
+ * Parameters: {@link ContainerSize}
263
+ */
264
+ Resize = 'resize',
265
+ /**
266
+ * The player is seeking to a new position.
267
+ */
268
+ Seek = 'seek',
225
269
  /**
226
270
  * Playback has been stopped.
227
271
  */
228
272
  Stop = 'stop',
229
273
  /**
230
- * Playback has reached the end of the media.
274
+ * The current playback time has changed.
275
+ * Parameters: {@link TimePosition}
231
276
  */
232
- Ended = 'ended',
277
+ TimeUpdate = 'timeupdate',
278
+ /**
279
+ * The volume has changed.
280
+ * Parameters: `number` volume in the range 0..1
281
+ */
282
+ VolumeUpdate = 'volumeupdate',
233
283
  }