@gcorevideo/player 2.16.17 → 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.
- package/README.md +68 -19
- package/dist/index.js +272 -125
- package/dist/player.d.ts +230 -73
- package/docs/api/index.md +1 -1
- package/docs/api/player.containersize.md +19 -0
- package/docs/api/player.dashsettings.md +2 -0
- package/docs/api/player.errorlevel.md +1 -0
- package/docs/api/player.langtag.md +6 -0
- package/docs/api/player.md +59 -24
- package/docs/api/player.mediatransport.md +1 -0
- package/docs/api/player.playbackerror.code.md +2 -0
- package/docs/api/player.playbackerror.description.md +2 -0
- package/docs/api/player.playbackerror.level.md +2 -0
- package/docs/api/player.playbackerror.md +43 -4
- package/docs/api/player.playbackerror.message.md +2 -0
- package/docs/api/player.playbackerror.origin.md +21 -0
- package/docs/api/player.playbackerror.scope.md +16 -0
- package/docs/api/player.playbackerrorcode.md +8 -7
- package/docs/api/player.playbackmodule.md +1 -0
- package/docs/api/player.player.attachto.md +26 -0
- package/docs/api/player.player.configure.md +6 -2
- package/docs/api/player.player.destroy.md +1 -1
- package/docs/api/player.player.getcurrenttime.md +6 -2
- package/docs/api/player.player.getduration.md +4 -0
- package/docs/api/player.player.getvolume.md +22 -0
- package/docs/api/player.player.isdvrenabled.md +20 -0
- package/docs/api/player.player.isdvrinuse.md +24 -0
- package/docs/api/player.player.isplaying.md +20 -0
- package/docs/api/player.player.md +76 -8
- package/docs/api/player.player.mute.md +1 -1
- package/docs/api/player.player.off.md +5 -5
- package/docs/api/player.player.on.md +5 -5
- package/docs/api/player.player.registerplugin.md +14 -1
- package/docs/api/player.player.resize.md +6 -5
- package/docs/api/player.player.seek.md +1 -1
- package/docs/api/player.player.setvolume.md +56 -0
- package/docs/api/player.player.unmute.md +1 -1
- package/docs/api/player.player.unregisterplugin.md +2 -2
- package/docs/api/player.playercomponenttype.md +16 -0
- package/docs/api/player.playerdebugsettings.md +1 -1
- package/docs/api/player.playerdebugtag.md +1 -0
- package/docs/api/player.playerevent.md +96 -0
- package/docs/api/player.playereventhandler.md +3 -2
- package/docs/api/player.playereventparams.md +20 -0
- package/docs/api/player.playermediasourcedesc.md +1 -1
- package/docs/api/player.playermediasourcedesc.mimetype.md +1 -1
- package/docs/api/player.qualitylevel.bitrate.md +16 -0
- package/docs/api/player.qualitylevel.height.md +16 -0
- package/docs/api/player.qualitylevel.level.md +16 -0
- package/docs/api/player.qualitylevel.md +104 -7
- package/docs/api/player.qualitylevel.width.md +16 -0
- package/docs/api/player.timeposition.current.md +16 -0
- package/docs/api/player.timeposition.md +65 -7
- package/docs/api/player.timeposition.total.md +16 -0
- package/docs/api/player.timevalue.md +1 -1
- package/docs/api/player.translationsettings.md +7 -1
- package/docs/api/player.transportpreference.md +1 -0
- package/lib/Player.d.ts +107 -26
- package/lib/Player.d.ts.map +1 -1
- package/lib/Player.js +161 -77
- package/lib/index.d.ts +2 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -3
- package/lib/internal.types.d.ts +3 -5
- package/lib/internal.types.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.d.ts +2 -0
- package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
- package/lib/playback/dash-playback/DashPlayback.js +37 -25
- package/lib/playback/hls-playback/HlsPlayback.d.ts +3 -0
- package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
- package/lib/playback/hls-playback/HlsPlayback.js +33 -18
- package/lib/playback.types.d.ts +65 -6
- package/lib/playback.types.d.ts.map +1 -1
- package/lib/playback.types.js +10 -0
- package/lib/types.d.ts +54 -5
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +31 -2
- package/package.json +1 -1
- package/rollup.config.js +1 -1
- package/src/Player.ts +202 -91
- package/src/__tests__/Player.test.ts +9 -3
- package/src/index.ts +2 -3
- package/src/internal.types.ts +3 -2
- package/src/playback/dash-playback/DashPlayback.ts +64 -35
- package/src/playback/hls-playback/HlsPlayback.ts +46 -22
- package/src/playback.types.ts +65 -5
- package/src/types.ts +56 -6
- package/src/utils/__tests__/mediaSources.test.ts +8 -2
- package/temp/player.api.json +771 -106
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/DashPlayback-BRJzl8D8.js +0 -901
package/dist/player.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Video player for the
|
|
2
|
+
* Video player for the Gcore streaming platform
|
|
3
3
|
*
|
|
4
4
|
* @remarks
|
|
5
|
-
* This package provides a video player for the
|
|
5
|
+
* This package provides a video player for the Gcore streaming platform.
|
|
6
6
|
* It is built on top of the Clappr library and provides a framework for building custom integrations.
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import EventLite from 'event-lite';
|
|
12
11
|
import { Logger } from '@gcorevideo/utils';
|
|
13
12
|
import { LogTracer } from '@gcorevideo/utils';
|
|
14
13
|
import { reportError as reportError_2 } from '@gcorevideo/utils';
|
|
@@ -17,17 +16,30 @@ import { setTracer } from '@gcorevideo/utils';
|
|
|
17
16
|
import { trace } from '@gcorevideo/utils';
|
|
18
17
|
|
|
19
18
|
/**
|
|
19
|
+
* Dimensions of the player container DOM element.
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
export declare type ContainerSize = {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A plain JS object that must conform to the DASH.js settings schema.
|
|
20
29
|
* @beta
|
|
21
30
|
* {@link https://cdn.dashjs.org/latest/jsdoc/module-Settings.html | DASH.js settings}
|
|
22
31
|
*/
|
|
23
32
|
export declare type DashSettings = Record<string, unknown>;
|
|
24
33
|
|
|
25
34
|
/**
|
|
35
|
+
* Levels of severity of errors. Non-fatal errors usually can be ignored.
|
|
26
36
|
* @beta
|
|
27
37
|
*/
|
|
28
38
|
export declare type ErrorLevel = 'FATAL' | 'WARN' | 'INFO';
|
|
29
39
|
|
|
30
40
|
/**
|
|
41
|
+
* An ISO 639-1 language code.
|
|
42
|
+
* @example `pt`
|
|
31
43
|
* @beta
|
|
32
44
|
*/
|
|
33
45
|
export declare type LangTag = string;
|
|
@@ -37,63 +49,67 @@ export { Logger }
|
|
|
37
49
|
export { LogTracer }
|
|
38
50
|
|
|
39
51
|
/**
|
|
52
|
+
* Media delivery protocol
|
|
40
53
|
* @beta
|
|
41
54
|
*/
|
|
42
55
|
export declare type MediaTransport = 'dash' | 'hls';
|
|
43
56
|
|
|
44
57
|
/**
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
export declare class _MockPlayback extends EventLite {
|
|
48
|
-
protected options: any;
|
|
49
|
-
readonly i18n: any;
|
|
50
|
-
protected playerError?: any | undefined;
|
|
51
|
-
constructor(options: any, i18n: any, playerError?: any | undefined);
|
|
52
|
-
get name(): string;
|
|
53
|
-
consent(): void;
|
|
54
|
-
play(): void;
|
|
55
|
-
pause(): void;
|
|
56
|
-
stop(): void;
|
|
57
|
-
destroy(): void;
|
|
58
|
-
seek(): void;
|
|
59
|
-
seekPercentage(): void;
|
|
60
|
-
getDuration(): number;
|
|
61
|
-
enterPiP(): void;
|
|
62
|
-
exitPiP(): void;
|
|
63
|
-
getPlaybackType(): string;
|
|
64
|
-
getStartTimeOffset(): number;
|
|
65
|
-
getCurrentTime(): number;
|
|
66
|
-
isHighDefinitionInUse(): boolean;
|
|
67
|
-
mute(): void;
|
|
68
|
-
unmute(): void;
|
|
69
|
-
volume(): void;
|
|
70
|
-
configure(): void;
|
|
71
|
-
attemptAutoPlay(): boolean;
|
|
72
|
-
canAutoPlay(): boolean;
|
|
73
|
-
onResize(): boolean;
|
|
74
|
-
trigger(event: string, ...args: any[]): void;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
58
|
+
* An error occurred during the playback.
|
|
78
59
|
* @beta
|
|
79
60
|
*/
|
|
80
61
|
export declare interface PlaybackError {
|
|
62
|
+
/**
|
|
63
|
+
* Error code.
|
|
64
|
+
*/
|
|
81
65
|
code: PlaybackErrorCode;
|
|
66
|
+
/**
|
|
67
|
+
* Detailed description of the error.
|
|
68
|
+
*/
|
|
82
69
|
description: string;
|
|
70
|
+
/**
|
|
71
|
+
* Level of severity of the error.
|
|
72
|
+
*/
|
|
83
73
|
level: ErrorLevel;
|
|
74
|
+
/**
|
|
75
|
+
* Error message. Non-fatal usually can be ignored.
|
|
76
|
+
*/
|
|
84
77
|
message: string;
|
|
78
|
+
/**
|
|
79
|
+
* Exact component that originated the error.
|
|
80
|
+
* @example
|
|
81
|
+
* - 'core'
|
|
82
|
+
* - 'dash'
|
|
83
|
+
* - 'media_control'
|
|
84
|
+
*/
|
|
85
|
+
origin: string;
|
|
86
|
+
/**
|
|
87
|
+
* Component subsystem of the error origin
|
|
88
|
+
*/
|
|
89
|
+
scope: PlayerComponentType;
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
/**
|
|
93
|
+
* Codes of errors occurring within the playback component.
|
|
88
94
|
* @beta
|
|
89
95
|
*/
|
|
90
96
|
export declare enum PlaybackErrorCode {
|
|
97
|
+
/**
|
|
98
|
+
* An unknown or uncategorised error.
|
|
99
|
+
*/
|
|
91
100
|
Generic = 0,
|
|
101
|
+
/**
|
|
102
|
+
* The media source is not available. Typically a network error.
|
|
103
|
+
*/
|
|
92
104
|
MediaSourceUnavailable = 1,
|
|
93
|
-
|
|
105
|
+
/**
|
|
106
|
+
* The media source is not accessible due to some protection policy.
|
|
107
|
+
*/
|
|
108
|
+
MediaSourceAccessDenied = 3
|
|
94
109
|
}
|
|
95
110
|
|
|
96
111
|
/**
|
|
112
|
+
* Module to perform the playback.
|
|
97
113
|
* @beta
|
|
98
114
|
*/
|
|
99
115
|
export declare type PlaybackModule = 'dash' | 'hls' | 'html5_video';
|
|
@@ -106,11 +122,11 @@ export declare type PlaybackType = 'live' | 'vod';
|
|
|
106
122
|
|
|
107
123
|
/**
|
|
108
124
|
* The main component to use in the application code.
|
|
125
|
+
* @beta
|
|
109
126
|
* @remarks
|
|
110
127
|
* The Player object provides very basic API to control playback.
|
|
111
128
|
* To build a sophisticated UI, use the plugins framework to tap into the Clappr core.
|
|
112
129
|
* {@link https://github.com/clappr/clappr/wiki/Architecture}
|
|
113
|
-
* @beta
|
|
114
130
|
*/
|
|
115
131
|
export declare class Player {
|
|
116
132
|
private config;
|
|
@@ -123,50 +139,95 @@ export declare class Player {
|
|
|
123
139
|
constructor(config: PlayerConfig);
|
|
124
140
|
/**
|
|
125
141
|
* Adds a listener to a player event
|
|
126
|
-
* @param event -
|
|
127
|
-
* @param handler -
|
|
142
|
+
* @param event - event type, see {@link PlayerEvent}
|
|
143
|
+
* @param handler - a callback function to handle the event
|
|
128
144
|
*/
|
|
129
|
-
on<
|
|
145
|
+
on<E extends PlayerEvent>(event: E, handler: PlayerEventHandler<E>): void;
|
|
130
146
|
/**
|
|
131
|
-
* Removes a
|
|
147
|
+
* Removes a previously added event listener
|
|
132
148
|
* @param event - See {@link PlayerEvent}
|
|
133
|
-
* @param handler -
|
|
149
|
+
* @param handler - a callback attached earlier to that event type
|
|
134
150
|
*/
|
|
135
|
-
off<
|
|
151
|
+
off<E extends PlayerEvent>(event: E, handler: PlayerEventHandler<E>): void;
|
|
136
152
|
/**
|
|
137
153
|
* Configures the player.
|
|
138
154
|
*
|
|
139
|
-
* Can be called multiple times. Each consequent call extends the previous configuration.
|
|
140
|
-
* After a reconfiguration, if something significant has changed, the must be reinitialized (i.e, a `.destroy()` followed by an `.init()` call).
|
|
141
|
-
*
|
|
142
155
|
* @param config - complete or partial configuration
|
|
156
|
+
* @remarks
|
|
157
|
+
* Can be called multiple times.
|
|
158
|
+
* Each consequent call extends the previous configuration with only the new keys overridden.
|
|
159
|
+
*
|
|
160
|
+
* After a reconfiguration, if something significant has changed, it might make sense reinitialize the player (i.e, a `.destroy()` followed by an `.init()` call).
|
|
143
161
|
*/
|
|
144
162
|
configure(config: Partial<PlayerConfig>): void;
|
|
145
163
|
/**
|
|
146
164
|
* Initializes the player at the given container element.
|
|
147
165
|
* @param playerElement - DOM element to host the player
|
|
166
|
+
* @remarks
|
|
167
|
+
* The player will be initialized and attached to the given element.
|
|
168
|
+
*
|
|
169
|
+
* All the core plugins will be initialized at this point.
|
|
170
|
+
*
|
|
171
|
+
* If no sources were configured, it will trigger an error.
|
|
172
|
+
*
|
|
173
|
+
* The player container will be initialized and then all the registered UI plugins.
|
|
174
|
+
*
|
|
175
|
+
* If the `autoPlay` option is set, then it will trigger playback immediately.
|
|
176
|
+
*
|
|
177
|
+
* It is an error to call this method twice. If you need to attache player to another DOM element,
|
|
178
|
+
* first call {@link Player.destroy} and then {@link Player.attachTo}.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```ts
|
|
182
|
+
* const player = new Player({
|
|
183
|
+
* sources: [{ source: 'https://example.com/a.mpd', mimeType: 'application/dash+xml' }],
|
|
184
|
+
* })
|
|
185
|
+
* document.addEventListener('DOMContentLoaded', () => {
|
|
186
|
+
* player.attachTo(document.getElementById('video-container'))
|
|
187
|
+
* })
|
|
188
|
+
* ```
|
|
148
189
|
*/
|
|
149
190
|
attachTo(playerElement: HTMLElement): void;
|
|
150
191
|
/**
|
|
151
|
-
* Destroys the player, releasing all resources and
|
|
192
|
+
* Destroys the player, releasing all resources and unmounting its UI from the DOM.
|
|
152
193
|
*/
|
|
153
194
|
destroy(): void;
|
|
154
195
|
/**
|
|
155
|
-
* Current playback time
|
|
156
|
-
*
|
|
196
|
+
* Current playback (time since the beginning of the stream), if appropriate.
|
|
197
|
+
*
|
|
198
|
+
* @returns Time in seconds
|
|
199
|
+
* @remarks
|
|
200
|
+
* For live streams, it returns the current time within the current segment.
|
|
157
201
|
*/
|
|
158
202
|
getCurrentTime(): number;
|
|
159
203
|
/**
|
|
160
204
|
* Duration of the current media in seconds, if appropriate.
|
|
161
|
-
*
|
|
205
|
+
*
|
|
206
|
+
* @returns Time in seconds
|
|
207
|
+
* @remarks
|
|
208
|
+
* For live streams, it returns the duration of the current segment.
|
|
162
209
|
*/
|
|
163
210
|
getDuration(): number;
|
|
164
211
|
/**
|
|
165
|
-
*
|
|
212
|
+
* Indicates whether DVR is enabled.
|
|
213
|
+
*/
|
|
214
|
+
isDvrEnabled(): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Indicates whether DVR is in use.
|
|
217
|
+
* @remarks
|
|
218
|
+
* DVR mode, if it is enabled, is triggered we a user seeks behind the live edge.
|
|
219
|
+
*/
|
|
220
|
+
isDvrInUse(): boolean;
|
|
221
|
+
/**
|
|
222
|
+
* Indicates the playing state.
|
|
223
|
+
*/
|
|
224
|
+
isPlaying(): boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Mutes the sound of the video.
|
|
166
227
|
*/
|
|
167
228
|
mute(): void;
|
|
168
229
|
/**
|
|
169
|
-
* Unmutes the
|
|
230
|
+
* Unmutes the video sound.
|
|
170
231
|
*/
|
|
171
232
|
unmute(): void;
|
|
172
233
|
/**
|
|
@@ -180,40 +241,71 @@ export declare class Player {
|
|
|
180
241
|
/**
|
|
181
242
|
* Resizes the player container element and everything within it.
|
|
182
243
|
* @param newSize - new size of the player
|
|
244
|
+
* @remarks
|
|
245
|
+
* Use this method when the player itself does not detect properly the change in size of its container element.
|
|
246
|
+
* It can be a case for orientation change on some mobile devices.
|
|
183
247
|
*/
|
|
184
|
-
resize(newSize:
|
|
185
|
-
width: number;
|
|
186
|
-
height: number;
|
|
187
|
-
}): void;
|
|
248
|
+
resize(newSize: ContainerSize): void;
|
|
188
249
|
/**
|
|
189
250
|
* Seeks to the given time.
|
|
190
|
-
* @param time - time to seek to in seconds
|
|
251
|
+
* @param time - time to seek to in seconds (since the beginning of the stream)
|
|
191
252
|
*/
|
|
192
253
|
seek(time: number): void;
|
|
254
|
+
/**
|
|
255
|
+
* Gets the current volume of the media content being played.
|
|
256
|
+
* @returns a number between 0 and 1
|
|
257
|
+
*/
|
|
258
|
+
getVolume(): number;
|
|
259
|
+
/**
|
|
260
|
+
* Sets the current volume of the media content being played.
|
|
261
|
+
* @param volume - a number between 0 and 1
|
|
262
|
+
*/
|
|
263
|
+
setVolume(volume: number): void;
|
|
193
264
|
/**
|
|
194
265
|
* Stops playback.
|
|
195
266
|
*/
|
|
196
267
|
stop(): void;
|
|
197
268
|
/**
|
|
198
269
|
* Registers a plugin.
|
|
199
|
-
* @param plugin - plugin
|
|
270
|
+
* @param plugin - a plugin class
|
|
271
|
+
* @remarks
|
|
272
|
+
* Use this method to extend the player with custom behavior.
|
|
273
|
+
* The plugin class must inherit from one of the Clappr UIPlugin, UIContainerPlugin or CorePlugin classes.
|
|
274
|
+
* A core plugin will be initialized and attached to the player when the player is initialized.
|
|
275
|
+
* A UI plugin will be initialized and attached to the player container is initialized.
|
|
276
|
+
*
|
|
277
|
+
* @see {@link https://github.com/clappr/clappr/wiki/Architecture}
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import MyPlugin from './MyPlugin.js'
|
|
281
|
+
*
|
|
282
|
+
* Player.registerPlugin(MyPlugin)
|
|
283
|
+
* ```
|
|
200
284
|
*/
|
|
201
285
|
static registerPlugin(plugin: PlayerPlugin): void;
|
|
202
286
|
/**
|
|
203
|
-
* Unregisters a plugin.
|
|
204
|
-
* @param plugin - plugin
|
|
287
|
+
* Unregisters a plugin registered earlier with {@link Player.registerPlugin}.
|
|
288
|
+
* @param plugin - a plugin class
|
|
205
289
|
*/
|
|
206
290
|
static unregisterPlugin(plugin: PlayerPlugin): void;
|
|
207
291
|
private setConfig;
|
|
208
292
|
private initPlayer;
|
|
209
293
|
private tuneIn;
|
|
294
|
+
private safeTriggerEvent;
|
|
210
295
|
private events;
|
|
211
296
|
private buildCoreOptions;
|
|
212
297
|
private configurePlaybacks;
|
|
213
298
|
private buildMediaSourcesList;
|
|
214
299
|
private bindContainerEventListeners;
|
|
300
|
+
private bindSizeManagementListeners;
|
|
215
301
|
}
|
|
216
302
|
|
|
303
|
+
/**
|
|
304
|
+
* Subsystems of a player component.
|
|
305
|
+
* @beta
|
|
306
|
+
*/
|
|
307
|
+
export declare type PlayerComponentType = 'container' | 'core' | 'playback';
|
|
308
|
+
|
|
217
309
|
/**
|
|
218
310
|
* Configuration options for the player
|
|
219
311
|
*
|
|
@@ -310,12 +402,13 @@ export declare interface PlayerConfig extends Record<string, unknown> {
|
|
|
310
402
|
}
|
|
311
403
|
|
|
312
404
|
/**
|
|
313
|
-
* @remarks true is equivalent to 'all'
|
|
405
|
+
* @remarks `true` is equivalent to `'all'`, `false` is equivalent to `'none'`
|
|
314
406
|
* @beta
|
|
315
407
|
*/
|
|
316
408
|
export declare type PlayerDebugSettings = PlayerDebugTag | boolean;
|
|
317
409
|
|
|
318
410
|
/**
|
|
411
|
+
* Debug output category selector
|
|
319
412
|
* @beta
|
|
320
413
|
*/
|
|
321
414
|
export declare type PlayerDebugTag = 'all' | 'clappr' | 'dash' | 'hls' | 'none';
|
|
@@ -325,6 +418,20 @@ export declare type PlayerDebugTag = 'all' | 'clappr' | 'dash' | 'hls' | 'none';
|
|
|
325
418
|
* @beta
|
|
326
419
|
*/
|
|
327
420
|
export declare enum PlayerEvent {
|
|
421
|
+
/**
|
|
422
|
+
* Playback has reached the end of the media.
|
|
423
|
+
*/
|
|
424
|
+
Ended = "ended",
|
|
425
|
+
/**
|
|
426
|
+
* An error occurred.
|
|
427
|
+
* Parameters: {@link PlaybackError}
|
|
428
|
+
*/
|
|
429
|
+
Error = "error",
|
|
430
|
+
/**
|
|
431
|
+
* The player has switched to or from the fullscreen mode.
|
|
432
|
+
* Parameters:`boolean` isFullscreen
|
|
433
|
+
*/
|
|
434
|
+
Fullscreen = "fullscreen",
|
|
328
435
|
/**
|
|
329
436
|
* The player is ready to use.
|
|
330
437
|
*/
|
|
@@ -337,20 +444,45 @@ export declare enum PlayerEvent {
|
|
|
337
444
|
* Playback has been paused.
|
|
338
445
|
*/
|
|
339
446
|
Pause = "pause",
|
|
447
|
+
/**
|
|
448
|
+
* The player's container has been resized.
|
|
449
|
+
* Parameters: {@link ContainerSize}
|
|
450
|
+
*/
|
|
451
|
+
Resize = "resize",
|
|
452
|
+
/**
|
|
453
|
+
* The player is seeking to a new position.
|
|
454
|
+
*/
|
|
455
|
+
Seek = "seek",
|
|
340
456
|
/**
|
|
341
457
|
* Playback has been stopped.
|
|
342
458
|
*/
|
|
343
459
|
Stop = "stop",
|
|
344
460
|
/**
|
|
345
|
-
*
|
|
461
|
+
* The current playback time has changed.
|
|
462
|
+
* Parameters: {@link TimePosition}
|
|
346
463
|
*/
|
|
347
|
-
|
|
464
|
+
TimeUpdate = "timeupdate",
|
|
465
|
+
/**
|
|
466
|
+
* The volume has changed.
|
|
467
|
+
* Parameters: `number` volume in the range 0..1
|
|
468
|
+
*/
|
|
469
|
+
VolumeUpdate = "volumeupdate"
|
|
348
470
|
}
|
|
349
471
|
|
|
350
472
|
/**
|
|
473
|
+
* Type of a listener callback function for a player event.
|
|
474
|
+
* See the description of the event parameters in {@link PlayerEvent}.
|
|
351
475
|
* @beta
|
|
352
476
|
*/
|
|
353
|
-
export declare type PlayerEventHandler<
|
|
477
|
+
export declare type PlayerEventHandler<E extends PlayerEvent> = (...args: PlayerEventParams<E>) => void;
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* @beta
|
|
481
|
+
*/
|
|
482
|
+
export declare type PlayerEventParams<E extends PlayerEvent> = E extends PlayerEvent.Seek ? [number] : E extends PlayerEvent.VolumeUpdate ? [number] : E extends PlayerEvent.TimeUpdate ? [TimePosition] : E extends PlayerEvent.Resize ? [{
|
|
483
|
+
width: number;
|
|
484
|
+
height: number;
|
|
485
|
+
}] : E extends PlayerEvent.Fullscreen ? [boolean] : E extends PlayerEvent.Error ? [PlaybackError] : [];
|
|
354
486
|
|
|
355
487
|
/**
|
|
356
488
|
* A media source to fetch the media data from
|
|
@@ -368,7 +500,8 @@ export declare type PlayerMediaSource = string | PlayerMediaSourceDesc;
|
|
|
368
500
|
*/
|
|
369
501
|
export declare interface PlayerMediaSourceDesc {
|
|
370
502
|
/**
|
|
371
|
-
* The MIME type of the media source (e.g. "video/mp4"
|
|
503
|
+
* The MIME type of the media source (e.g. `"video/mp4"`, `"application/x-mpegURL"`).
|
|
504
|
+
* Necessary if the type cannot be detected from file extension of the source URL.
|
|
372
505
|
*/
|
|
373
506
|
mimeType?: string;
|
|
374
507
|
/**
|
|
@@ -387,14 +520,27 @@ export declare type PlayerPlugin = {
|
|
|
387
520
|
};
|
|
388
521
|
|
|
389
522
|
/**
|
|
523
|
+
* A level of quality within a media source.
|
|
390
524
|
* @beta
|
|
391
525
|
*/
|
|
392
|
-
export declare
|
|
526
|
+
export declare interface QualityLevel {
|
|
527
|
+
/**
|
|
528
|
+
* Zero-based index of the quality level.
|
|
529
|
+
*/
|
|
393
530
|
level: number;
|
|
531
|
+
/**
|
|
532
|
+
* Width of the video, pixels.
|
|
533
|
+
*/
|
|
394
534
|
width: number;
|
|
535
|
+
/**
|
|
536
|
+
* Height of the video, pixels.
|
|
537
|
+
*/
|
|
395
538
|
height: number;
|
|
539
|
+
/**
|
|
540
|
+
* Bitrate of the video, bps.
|
|
541
|
+
*/
|
|
396
542
|
bitrate: number;
|
|
397
|
-
}
|
|
543
|
+
}
|
|
398
544
|
|
|
399
545
|
export { reportError_2 as reportError }
|
|
400
546
|
|
|
@@ -403,13 +549,19 @@ export { SentryTracer }
|
|
|
403
549
|
export { setTracer }
|
|
404
550
|
|
|
405
551
|
/**
|
|
406
|
-
*
|
|
552
|
+
* Current playback time and total duration of the media.
|
|
407
553
|
* @beta
|
|
408
554
|
*/
|
|
409
|
-
export declare
|
|
555
|
+
export declare interface TimePosition {
|
|
556
|
+
/**
|
|
557
|
+
* Current playback time, 0..duration, seconds.
|
|
558
|
+
*/
|
|
410
559
|
current: TimeValue;
|
|
560
|
+
/**
|
|
561
|
+
* Total duration of the media, seconds.
|
|
562
|
+
*/
|
|
411
563
|
total: TimeValue;
|
|
412
|
-
}
|
|
564
|
+
}
|
|
413
565
|
|
|
414
566
|
/**
|
|
415
567
|
* For the plugin development
|
|
@@ -429,7 +581,6 @@ export declare type TimeUpdate = TimePosition & {
|
|
|
429
581
|
|
|
430
582
|
/**
|
|
431
583
|
* Playback time in seconds since the beginning of the stream (or a segment for the live streams)
|
|
432
|
-
* For the plugin development
|
|
433
584
|
* @beta
|
|
434
585
|
*/
|
|
435
586
|
export declare type TimeValue = number;
|
|
@@ -442,7 +593,12 @@ export { trace }
|
|
|
442
593
|
export declare type TranslationKey = string;
|
|
443
594
|
|
|
444
595
|
/**
|
|
445
|
-
*
|
|
596
|
+
* Localization strings for the player UI.
|
|
597
|
+
* @remarks
|
|
598
|
+
* The keys are language codes, and the values are objects with keys being the translation keys and values being the translations.
|
|
599
|
+
*
|
|
600
|
+
* This dictionary is used to localize the player UI, including the error messages and is shared across all the player components (including the plugins).
|
|
601
|
+
*
|
|
446
602
|
* @example
|
|
447
603
|
* ```
|
|
448
604
|
* {
|
|
@@ -463,6 +619,7 @@ export declare type TranslationKey = string;
|
|
|
463
619
|
export declare type TranslationSettings = Partial<Record<LangTag, Record<TranslationKey, string>>>;
|
|
464
620
|
|
|
465
621
|
/**
|
|
622
|
+
* Preferred media delivery protocol
|
|
466
623
|
* @beta
|
|
467
624
|
*/
|
|
468
625
|
export declare type TransportPreference = MediaTransport;
|
package/docs/api/index.md
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@gcorevideo/player](./player.md) > [ContainerSize](./player.containersize.md)
|
|
4
|
+
|
|
5
|
+
## ContainerSize type
|
|
6
|
+
|
|
7
|
+
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
Dimensions of the player container DOM element.
|
|
11
|
+
|
|
12
|
+
**Signature:**
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
export type ContainerSize = {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
```
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
8
|
>
|
|
9
9
|
|
|
10
|
+
A plain JS object that must conform to the DASH.js settings schema.
|
|
11
|
+
|
|
10
12
|
[DASH.js settings](https://cdn.dashjs.org/latest/jsdoc/module-Settings.html)
|
|
11
13
|
|
|
12
14
|
**Signature:**
|
|
@@ -7,9 +7,15 @@
|
|
|
7
7
|
> This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
8
|
>
|
|
9
9
|
|
|
10
|
+
An ISO 639-1 language code.
|
|
10
11
|
|
|
11
12
|
**Signature:**
|
|
12
13
|
|
|
13
14
|
```typescript
|
|
14
15
|
export type LangTag = string;
|
|
15
16
|
```
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
`pt`
|
|
21
|
+
|