@gcorevideo/player 2.24.11 → 2.24.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.
Files changed (47) hide show
  1. package/README.md +1 -0
  2. package/assets/dvr-controls/dvr_controls.scss +43 -80
  3. package/assets/dvr-controls/index.ejs +8 -2
  4. package/assets/media-control/width370.scss +1 -1
  5. package/dist/core.js +18 -17
  6. package/dist/index.css +516 -542
  7. package/dist/index.embed.js +91 -65
  8. package/dist/index.js +156 -128
  9. package/dist/player.d.ts +3264 -0
  10. package/lib/playback/dash-playback/DashPlayback.d.ts +2 -0
  11. package/lib/playback/dash-playback/DashPlayback.d.ts.map +1 -1
  12. package/lib/playback/dash-playback/DashPlayback.js +17 -11
  13. package/lib/playback/hls-playback/HlsPlayback.d.ts.map +1 -1
  14. package/lib/playback/hls-playback/HlsPlayback.js +0 -5
  15. package/lib/plugins/audio-selector/AudioTracks.js +1 -1
  16. package/lib/plugins/bottom-gear/BottomGear.js +1 -1
  17. package/lib/plugins/clips/Clips.js +1 -1
  18. package/lib/plugins/dvr-controls/DvrControls.d.ts +3 -3
  19. package/lib/plugins/dvr-controls/DvrControls.d.ts.map +1 -1
  20. package/lib/plugins/dvr-controls/DvrControls.js +14 -12
  21. package/lib/plugins/media-control/MediaControl.d.ts +14 -5
  22. package/lib/plugins/media-control/MediaControl.d.ts.map +1 -1
  23. package/lib/plugins/media-control/MediaControl.js +55 -29
  24. package/lib/plugins/picture-in-picture/PictureInPicture.js +1 -1
  25. package/lib/plugins/subtitles/ClosedCaptions.js +1 -1
  26. package/lib/testUtils.d.ts.map +1 -1
  27. package/lib/testUtils.js +2 -0
  28. package/package.json +1 -1
  29. package/src/playback/dash-playback/DashPlayback.ts +20 -13
  30. package/src/playback/hls-playback/HlsPlayback.ts +3 -8
  31. package/src/plugins/audio-selector/AudioTracks.ts +1 -1
  32. package/src/plugins/audio-selector/__tests__/AudioTracks.test.ts +2 -2
  33. package/src/plugins/bottom-gear/BottomGear.ts +1 -1
  34. package/src/plugins/bottom-gear/__tests__/BottomGear.test.ts +2 -2
  35. package/src/plugins/clips/Clips.ts +1 -1
  36. package/src/plugins/clips/__tests__/Clips.test.ts +1 -1
  37. package/src/plugins/dvr-controls/DvrControls.ts +14 -14
  38. package/src/plugins/dvr-controls/__tests__/DvrControls.test.ts +20 -17
  39. package/src/plugins/dvr-controls/__tests__/__snapshots__/DvrControls.test.ts.snap +4 -2
  40. package/src/plugins/media-control/MediaControl.ts +69 -35
  41. package/src/plugins/media-control/__tests__/MediaControl.test.ts +128 -112
  42. package/src/plugins/media-control/__tests__/__snapshots__/MediaControl.test.ts.snap +227 -24
  43. package/src/plugins/picture-in-picture/PictureInPicture.ts +1 -1
  44. package/src/plugins/subtitles/ClosedCaptions.ts +1 -1
  45. package/src/plugins/subtitles/__tests__/ClosedCaptions.test.ts +1 -1
  46. package/src/testUtils.ts +2 -0
  47. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,3264 @@
1
+ /**
2
+ * Video player for the Gcore streaming platform
3
+ *
4
+ * @remarks
5
+ * This package provides a video player for the Gcore streaming platform.
6
+ * It is built on top of the {@link https://github.com/clappr/clappr | Clappr} library and provides a framework for building custom integrations.
7
+ * Start with {@link Player} for more information.
8
+ *
9
+ * Various plugins (marked with `PLUGIN` keyword) are available to extend the core functionality with additional features.
10
+ * @example
11
+ * ```ts
12
+ * import { Player, MediaControl, ErrorScreen } from '@gcorevideo/player'
13
+ *
14
+ * Player.registerPlugin(MediaControl)
15
+ * Player.registerPlugin(ErrorScreen)
16
+ *
17
+ * const player = new Player({
18
+ * autoPlay: true,
19
+ * mute: true,
20
+ * sources: [{ source: 'https://example.com/a.mpd', mimeType: 'application/dash+xml' }],
21
+ * })
22
+ *
23
+ * player.attachTo(document.getElementById('container'))
24
+ * ```
25
+ *
26
+ * @packageDocumentation
27
+ */
28
+
29
+ import { $ } from '@clappr/core';
30
+ import { Container } from '@clappr/core';
31
+ import { ContainerPlugin } from '@clappr/core';
32
+ import { Core } from '@clappr/core';
33
+ import { CorePlugin } from '@clappr/core';
34
+ import { Logger } from '@gcorevideo/utils';
35
+ import { LogTracer } from '@gcorevideo/utils';
36
+ import { reportError as reportError_2 } from '@gcorevideo/utils';
37
+ import { SentryTracer } from '@gcorevideo/utils';
38
+ import { setTracer } from '@gcorevideo/utils';
39
+ import { trace } from '@gcorevideo/utils';
40
+ import { UIContainerPlugin } from '@clappr/core';
41
+ import { UICorePlugin } from '@clappr/core';
42
+ import { UIObject } from '@clappr/core';
43
+
44
+ /**
45
+ * `PLUGIN` that makes possible to switch audio tracks via the media control UI.
46
+ * @beta
47
+ * @remarks
48
+ * The plugin is activated when there are multiple audio tracks available.
49
+ * The plugin adds a button showing the current audio track and a dropdown to switch to another audio track.
50
+ * Depends on:
51
+ *
52
+ * - {@link MediaControl}
53
+ */
54
+ declare class AudioTracks extends UICorePlugin {
55
+ private currentTrack;
56
+ private tracks;
57
+ /**
58
+ * @internal
59
+ */
60
+ get name(): string;
61
+ /**
62
+ * @internal
63
+ */
64
+ get supportedVersion(): {
65
+ min: string;
66
+ };
67
+ /**
68
+ * @internal
69
+ */
70
+ static get version(): string;
71
+ private static readonly template;
72
+ /**
73
+ * @internal
74
+ */
75
+ get attributes(): {
76
+ class: string;
77
+ };
78
+ /**
79
+ * @internal
80
+ */
81
+ get events(): {
82
+ 'click [data-audiotracks-select]': string;
83
+ 'click #audiotracks-button': string;
84
+ };
85
+ /**
86
+ * @internal
87
+ */
88
+ bindEvents(): void;
89
+ private onCoreReady;
90
+ private onActiveContainerChanged;
91
+ private shouldRender;
92
+ /**
93
+ * @internal
94
+ */
95
+ render(): this;
96
+ private onTrackSelect;
97
+ private selectAudioTrack;
98
+ private hideMenu;
99
+ private toggleMenu;
100
+ private buttonElement;
101
+ private buttonElementText;
102
+ private trackElement;
103
+ private getTitle;
104
+ private startTrackSwitching;
105
+ private updateText;
106
+ private highlightCurrentTrack;
107
+ }
108
+ export { AudioTracks as AudioSelector }
109
+ export { AudioTracks }
110
+
111
+ /**
112
+ * `PLUGIN` that displays a big mute button over the video when it's being played muted.
113
+ * @beta
114
+ * @remarks
115
+ * When pressed, it unmutes the video.
116
+ * @example
117
+ * ```ts
118
+ * import { BigMuteButton } from '@gcorevideo/player'
119
+ * Player.registerPlugin(BigMuteButton)
120
+ * ```
121
+ */
122
+ export declare class BigMuteButton extends UICorePlugin {
123
+ private autoPlay;
124
+ private hidden;
125
+ private _adIsPlaying;
126
+ /**
127
+ * @internal
128
+ */
129
+ get name(): string;
130
+ /**
131
+ * @internal
132
+ */
133
+ get supportedVersion(): {
134
+ min: string;
135
+ };
136
+ private static readonly template;
137
+ /**
138
+ * @internal
139
+ */
140
+ get events(): {
141
+ click: string;
142
+ };
143
+ /**
144
+ * @internal
145
+ */
146
+ bindEvents(): void;
147
+ private onCoreReady;
148
+ private onContainerChanged;
149
+ private onPlay;
150
+ private onStop;
151
+ private onPause;
152
+ private onContainerVolume;
153
+ private onPlaybackEnded;
154
+ private onStartAd;
155
+ private onFinishAd;
156
+ /**
157
+ * @internal
158
+ */
159
+ render(): this;
160
+ private mount;
161
+ private hide;
162
+ private show;
163
+ private clicked;
164
+ }
165
+
166
+ /**
167
+ * `PLUGIN` that adds a button to extend the media controls UI with extra options.
168
+ * @beta
169
+ * @remarks
170
+ * The plugin renders small gear icon to the right of the media controls.
171
+ * It provides a base for attaching custom settings UI in the gear menu
172
+ *
173
+ * Depends on:
174
+ *
175
+ * - {@link MediaControl}
176
+ *
177
+ * @example
178
+ * You can use bottom gear to add custom settings UI to the gear menu.
179
+ *
180
+ * ```ts
181
+ * import { BottomGear } from '@gcorevideo/player/plugins/bottom-gear';
182
+ *
183
+ * class CustomOptionsPlugin extends UICorePlugin {
184
+ * // ...
185
+ *
186
+ * override get events() {
187
+ * return {
188
+ * 'click #my-button': 'doMyAction',
189
+ * }
190
+ * }
191
+ *
192
+ * private doMyAction() {
193
+ * // ...
194
+ * }
195
+ *
196
+ * override render() {
197
+ * const bottomGear = this.core.getPlugin('bottom_gear');
198
+ * if (!bottomGear) {
199
+ * return this;
200
+ * }
201
+ * this.$el.html('<button class="custom-option">Custom option</button>');
202
+ * // Put rendered element into the gear menu
203
+ * bottomGear.addItem('custom').html(this.$el)
204
+ * return this;
205
+ * }
206
+ *
207
+ * // alternatively, add an option with a submenu
208
+ * override render() {
209
+ * this.$el.html(template(templateHtml)({
210
+ * // ...
211
+ * })));
212
+ * return this;
213
+ * }
214
+ *
215
+ * private addGearOption() {
216
+ * this.core.getPlugin('bottom_gear')
217
+ * .addItem('custom', this.$el)
218
+ * .html($('<button class="custom-option">Custom option</button>'))
219
+ * }
220
+ *
221
+ * override bindEvents() {
222
+ * this.listenToOnce(this.core, ClapprEvents.CORE_READY, () => {
223
+ * const bottomGear = this.core.getPlugin('bottom_gear');
224
+ * assert(bottomGear, 'bottom_gear plugin is required');
225
+ * // simple case
226
+ * this.listenTo(bottomGear, GearEvents.RENDERED, this.render);
227
+ * // or with a submenu
228
+ * this.listenTo(bottomGear, GearEvents.RENDERED, this.addGearOption);
229
+ * });
230
+ * }
231
+ * }
232
+ * ```
233
+ */
234
+ export declare class BottomGear extends UICorePlugin {
235
+ private hd;
236
+ private numItems;
237
+ private collapsed;
238
+ /**
239
+ * @internal
240
+ */
241
+ get name(): string;
242
+ /**
243
+ * @internal
244
+ */
245
+ get supportedVersion(): {
246
+ min: string;
247
+ };
248
+ /**
249
+ * @internal
250
+ */
251
+ static get version(): string;
252
+ private static readonly template;
253
+ /**
254
+ * @internal
255
+ */
256
+ get attributes(): {
257
+ class: string;
258
+ };
259
+ /**
260
+ * @internal
261
+ */
262
+ get events(): {
263
+ 'click #gear-button': string;
264
+ };
265
+ /**
266
+ * @internal
267
+ */
268
+ bindEvents(): void;
269
+ /**
270
+ * Adds a custom option to the gear menu
271
+ * @param name - A unique name of the option
272
+ * @param $subMenu - The submenu to attach to the option
273
+ * @returns The added item placeholder to attach custom markup
274
+ * @remarks
275
+ * When called with $submenu param, a click on the added item will toggle the submenu visibility.
276
+ *
277
+ * When added without submenu, it's responsibility of the caller to handle the click event however needed.
278
+ * @example
279
+ * ```ts
280
+ * class MyPlugin extends UICorePlugin {
281
+ * override render() {
282
+ * this.$el.html('<div class="my-awesome-settings">...</div>')
283
+ * this.core.getPlugin('bottom_gear')
284
+ * ?.addItem('custom', this.$el)
285
+ * .html($('<button>Custom settings</button>'))
286
+ * return this
287
+ * }
288
+ * }
289
+ * ```
290
+ */
291
+ addItem(name: string, $subMenu?: ZeptoResult): ZeptoResult;
292
+ private bindContainerEvents;
293
+ private highDefinitionUpdate;
294
+ /**
295
+ * @internal
296
+ */
297
+ render(): this;
298
+ /**
299
+ * Collapses any submenu open back to the gear menu.
300
+ * @remarks
301
+ * Should be called by the UI plugin that added a gear item with a submenu when the latter is closed (e.g., when a "back" button is clicked).
302
+ */
303
+ refresh(): void;
304
+ private collapseSubmenus;
305
+ private toggleMenu;
306
+ private collapse;
307
+ private onCoreReady;
308
+ private onMediaControlRendered;
309
+ private mount;
310
+ private alignSubmenu;
311
+ }
312
+
313
+ /**
314
+ * `PLUGIN` that measures data about playback, which can be useful for analyzing performance and UX.
315
+ * @beta
316
+ * @remarks
317
+ * This plugin does not render anything and is supposed to be extended or used together with other plugins that actually render something.
318
+ *
319
+ * @see {@link NerdStats} - a plugin that visualises the playback metrics
320
+ *
321
+ * Configuration options - {@link ClapprStatsSettings}
322
+ *
323
+ * Events - {@link ClapprStatsEvents}
324
+ */
325
+ export declare class ClapprStats extends ContainerPlugin {
326
+ private timerId;
327
+ private lastDecodedFramesCount;
328
+ private metrics;
329
+ private timers;
330
+ private runEach;
331
+ /**
332
+ * @internal
333
+ */
334
+ get name(): string;
335
+ /**
336
+ * @internal
337
+ */
338
+ get supportedVersion(): {
339
+ min: string;
340
+ };
341
+ private get playbackName();
342
+ private get playbackType();
343
+ private now;
344
+ private inc;
345
+ private start;
346
+ private stop;
347
+ constructor(container: Container);
348
+ /**
349
+ * @internal
350
+ */
351
+ bindEvents(): void;
352
+ /**
353
+ * @internal
354
+ */
355
+ destroy(): void;
356
+ /**
357
+ * Returns the collected metrics.
358
+ * @returns Measurements collected so far
359
+ */
360
+ exportMetrics(): ClapprStatsMetrics;
361
+ clearMetrics(): void;
362
+ private onBitrate;
363
+ private stopReporting;
364
+ private startTimers;
365
+ private onFirstPlaying;
366
+ private playAfterPause;
367
+ private onPlay;
368
+ private onPause;
369
+ private onSeek;
370
+ private onTimeUpdate;
371
+ private onContainerUpdateWhilePlaying;
372
+ private onBuffering;
373
+ private onBufferfull;
374
+ private onProgress;
375
+ private onCompletion;
376
+ private buildReport;
377
+ private fetchFPS;
378
+ private calcBitrates;
379
+ private calcBufferingPercentage;
380
+ private html5FetchFPS;
381
+ }
382
+
383
+ /**
384
+ * @beta
385
+ */
386
+ export declare type ClapprStatsBitrateTrack = {
387
+ start: number;
388
+ end?: number;
389
+ time?: number;
390
+ bitrate: number;
391
+ };
392
+
393
+ /**
394
+ * @beta
395
+ */
396
+ export declare enum ClapprStatsChronograph {
397
+ Startup = "startup",
398
+ Watch = "watch",
399
+ Pause = "pause",
400
+ Buffering = "buffering",
401
+ Session = "session"
402
+ }
403
+
404
+ /**
405
+ * @beta
406
+ */
407
+ export declare enum ClapprStatsCounter {
408
+ Play = "play",
409
+ Pause = "pause",
410
+ Error = "error",
411
+ Buffering = "buffering",
412
+ DecodedFrames = "decodedFrames",
413
+ DroppedFrames = "droppedFrames",
414
+ Fps = "fps",
415
+ ChangeLevel = "changeLevel",
416
+ Seek = "seek",
417
+ Fullscreen = "fullscreen",
418
+ DvrUsage = "dvrUsage"
419
+ }
420
+
421
+ /**
422
+ * @beta
423
+ */
424
+ export declare enum ClapprStatsEvents {
425
+ /**
426
+ * Emitted periodically with current measurements.
427
+ */
428
+ REPORT = "clappr:stats:report"
429
+ }
430
+
431
+ /**
432
+ * @beta
433
+ */
434
+ export declare type ClapprStatsMetrics = {
435
+ /**
436
+ * Events count counters
437
+ */
438
+ counters: {
439
+ /**
440
+ *
441
+ */
442
+ [ClapprStatsCounter.Play]: number;
443
+ [ClapprStatsCounter.Pause]: number;
444
+ [ClapprStatsCounter.Error]: number;
445
+ [ClapprStatsCounter.Buffering]: number;
446
+ [ClapprStatsCounter.DecodedFrames]: number;
447
+ [ClapprStatsCounter.DroppedFrames]: number;
448
+ [ClapprStatsCounter.Fps]: number;
449
+ [ClapprStatsCounter.ChangeLevel]: number;
450
+ [ClapprStatsCounter.Seek]: number;
451
+ [ClapprStatsCounter.Fullscreen]: number;
452
+ [ClapprStatsCounter.DvrUsage]: number;
453
+ };
454
+ /**
455
+ * Time measurements - accumulated duration of time-based activities
456
+ */
457
+ chrono: {
458
+ /**
459
+ * Time spent in the startup phase
460
+ */
461
+ [ClapprStatsChronograph.Startup]: number;
462
+ /**
463
+ * Total time spent in the watch phase
464
+ */
465
+ [ClapprStatsChronograph.Watch]: number;
466
+ /**
467
+ *
468
+ */
469
+ [ClapprStatsChronograph.Pause]: number;
470
+ [ClapprStatsChronograph.Buffering]: number;
471
+ [ClapprStatsChronograph.Session]: number;
472
+ };
473
+ extra: {
474
+ playbackName: string;
475
+ playbackType: string;
476
+ bitratesHistory: ClapprStatsBitrateTrack[];
477
+ bitrateWeightedMean: number;
478
+ bitrateMostUsed: number;
479
+ buffersize: number;
480
+ watchHistory: Array<[number, number]>;
481
+ watchedPercentage: number;
482
+ bufferingPercentage: number;
483
+ bandwidth: number;
484
+ duration: number;
485
+ currentTime: number;
486
+ };
487
+ };
488
+
489
+ /**
490
+ * Config options for the {@link ClapprStats} plugin
491
+ * @beta
492
+ */
493
+ export declare interface ClapprStatsSettings {
494
+ /**
495
+ * The interval in milliseconds of periodic measurements.
496
+ * The plugin will emit a {@link ClapprStatsEvents.REPORT} event with the collected metrics at the specified interval.
497
+ */
498
+ runEach?: number;
499
+ }
500
+
501
+ /**
502
+ * A small `PLUGIN` that toggles the playback state on click over the video container
503
+ * @beta
504
+ */
505
+ export declare class ClickToPause extends ContainerPlugin {
506
+ private pointerEnabled;
507
+ private timer;
508
+ /**
509
+ * @internal
510
+ */
511
+ get name(): string;
512
+ /**
513
+ * @internal
514
+ */
515
+ get supportedVersion(): {
516
+ min: string;
517
+ };
518
+ /**
519
+ * @internal
520
+ */
521
+ bindEvents(): void;
522
+ private click;
523
+ private settingsUpdate;
524
+ private togglePlay;
525
+ private clearTimer;
526
+ }
527
+
528
+ /**
529
+ * `PLUGIN` that allows marking up the timeline of the video
530
+ * @beta
531
+ * @remarks
532
+ * The plugin decorates the seekbar with notches to indicate the clips of the video and displays current clip text in the left panel
533
+ *
534
+ * Depends on:
535
+ *
536
+ * - {@link MediaControl}
537
+ *
538
+ * Configuration options - {@link ClipsPluginSettings}
539
+ */
540
+ export declare class Clips extends UICorePlugin {
541
+ private barStyle;
542
+ private clips;
543
+ private oldContainer;
544
+ private svgMask;
545
+ private static readonly template;
546
+ /**
547
+ * @internal
548
+ */
549
+ get name(): string;
550
+ /**
551
+ * @internal
552
+ */
553
+ get attributes(): {
554
+ class: string;
555
+ };
556
+ get version(): string;
557
+ get supportedVersion(): {
558
+ min: string;
559
+ };
560
+ /**
561
+ * @internal
562
+ */
563
+ bindEvents(): void;
564
+ render(): this;
565
+ destroy(): UIObject;
566
+ disable(): void;
567
+ enable(): void;
568
+ /**
569
+ * Get the text of the clip at the given time
570
+ * @param time - The time to get the text for
571
+ * @returns The text of the clip at the given time
572
+ */
573
+ getText(time: TimeValue): string | undefined;
574
+ private onCoreReady;
575
+ private onMcRender;
576
+ private onContainerChanged;
577
+ private playerResize;
578
+ private onTimeUpdate;
579
+ private parseClips;
580
+ private makeSvg;
581
+ private setSVGMask;
582
+ private setClipText;
583
+ }
584
+
585
+ /**
586
+ * Configuration options for the {@link Clips} plugin.
587
+ * @beta
588
+ */
589
+ export declare interface ClipsPluginSettings {
590
+ /**
591
+ * The compiled text of the clips description, one clip per line in format:
592
+ * `HH:MM:SS text` or `MM:SS text` or `SS text`
593
+ */
594
+ text: string;
595
+ }
596
+
597
+ /**
598
+ * `PLUGIN` that provides a UI to select the subtitles when available.
599
+ * @beta
600
+ *
601
+ * @remarks
602
+ * The plugin is activated when closed captions tracks are detected in the media source.
603
+ * It shows a familiar "CC" button with a dropdown menu to select the subtitles language.
604
+ *
605
+ * Depends on:
606
+ *
607
+ * - {@link MediaControl}
608
+ *
609
+ * Configuration options - {@link ClosedCaptionsPluginSettings}
610
+ * @example
611
+ * ```ts
612
+ * import { ClosedCaptions } from '@gcorevideo/player'
613
+ *
614
+ * Player.registerPlugin(ClosedCaptions)
615
+ *
616
+ * new Player({
617
+ * ...
618
+ * cc: {
619
+ * language: 'pt-BR',
620
+ * },
621
+ * })
622
+ * ```
623
+ */
624
+ declare class ClosedCaptions extends UICorePlugin {
625
+ private isPreselectedApplied;
626
+ private active;
627
+ private track;
628
+ private tracks;
629
+ private $line;
630
+ /**
631
+ * @internal
632
+ */
633
+ get name(): string;
634
+ /**
635
+ * @internal
636
+ */
637
+ get supportedVersion(): {
638
+ min: string;
639
+ };
640
+ /**
641
+ * @internal
642
+ */
643
+ static get version(): string;
644
+ private static readonly template;
645
+ private static readonly templateString;
646
+ /**
647
+ * @internal
648
+ */
649
+ get attributes(): {
650
+ class: string;
651
+ };
652
+ /**
653
+ * @internal
654
+ */
655
+ get events(): {
656
+ 'click #cc-select li a': string;
657
+ 'click #cc-button': string;
658
+ };
659
+ private get preselectedLanguage();
660
+ /**
661
+ * @internal
662
+ */
663
+ bindEvents(): void;
664
+ private onCoreReady;
665
+ private onContainerChanged;
666
+ private onSubtitleAvailable;
667
+ private onSubtitleChanged;
668
+ private applyTracks;
669
+ private onStartAd;
670
+ private onFinishAd;
671
+ private playerResize;
672
+ /**
673
+ * Hides the subtitles menu and the subtitles.
674
+ */
675
+ hide(): void;
676
+ /**
677
+ * Shows the subtitles menu and the subtitles.
678
+ */
679
+ show(): void;
680
+ private shouldRender;
681
+ private resizeFont;
682
+ /**
683
+ * @internal
684
+ */
685
+ render(): this;
686
+ private findById;
687
+ private selectItem;
688
+ private onItemSelect;
689
+ private applyPreselectedSubtitles;
690
+ private hideMenu;
691
+ private toggleMenu;
692
+ private itemElement;
693
+ private allItemElements;
694
+ private selectSubtitles;
695
+ private getSubtitleText;
696
+ private setSubtitleText;
697
+ private clearSubtitleText;
698
+ private updateSelection;
699
+ private highlightCurrentSubtitles;
700
+ private renderIcon;
701
+ }
702
+ export { ClosedCaptions }
703
+ export { ClosedCaptions as Subtitles }
704
+
705
+ /**
706
+ * Configuration options for the {@link ClosedCaptions} plugin.
707
+ * @beta
708
+ */
709
+ export declare type ClosedCaptionsPluginSettings = {
710
+ /**
711
+ * Initially selected subtitles language.
712
+ */
713
+ language?: string;
714
+ };
715
+
716
+ /**
717
+ * A `PLUGIN` that configures {@link https://cdn.cta.tech/cta/media/media/resources/standards/pdfs/cta-5004-final.pdf | CMCD} for playback
718
+ * @beta
719
+ * @remarks
720
+ * Configuration options - {@link CmcdConfigOptions}.
721
+ * @example
722
+ * ```ts
723
+ * import { CmcdConfig } from '@gcorevideo/player'
724
+ * Player.registerPlugin(CmcdConfig)
725
+ *
726
+ * const player = new Player({
727
+ * source: 'https://example.com/video.mp4',
728
+ * cmcd: {
729
+ * sessionId: '1234567890',
730
+ * contentId: 'f572d396fae9206628714fb2ce00f72e94f2258f',
731
+ * },
732
+ * })
733
+ * ```
734
+ */
735
+ export declare class CmcdConfig extends CorePlugin {
736
+ private sid;
737
+ private cid;
738
+ /**
739
+ * @internal
740
+ */
741
+ get name(): string;
742
+ /**
743
+ * @internal
744
+ */
745
+ get version(): string;
746
+ /**
747
+ * @internal
748
+ */
749
+ get supportedVersion(): string;
750
+ constructor(core: Core);
751
+ /**
752
+ * @internal
753
+ */
754
+ bindEvents(): void;
755
+ /**
756
+ * Returns the current `sid` and `cid` values.
757
+ * Useful when the auto-generated values need to be known.
758
+ * @returns `sid` and `cid` values
759
+ */
760
+ exportIds(): {
761
+ sid: string;
762
+ cid: string;
763
+ };
764
+ private updateSettings;
765
+ private generateContentId;
766
+ }
767
+
768
+ /**
769
+ * Config options for the {@link CmcdConfig} plugin
770
+ * @beta
771
+ */
772
+ export declare interface CmcdConfigOptions {
773
+ /**
774
+ * `sid` value. If ommitted, a random UUID will be generated
775
+ */
776
+ sessionId?: string;
777
+ /**
778
+ * `cid` value.
779
+ * If ommitted, the pathname part of the first source URL will be used
780
+ */
781
+ contentId?: string;
782
+ }
783
+
784
+ /**
785
+ * @public
786
+ */
787
+ export declare type ContainerPluginConstructor = {
788
+ new (container: Container): PlayerPlugin;
789
+ type: string;
790
+ };
791
+
792
+ /**
793
+ * Dimensions of the player container DOM element.
794
+ * @public
795
+ */
796
+ export declare type ContainerSize = {
797
+ width: number;
798
+ height: number;
799
+ };
800
+
801
+ /**
802
+ * `PLUGIN` that displays a small context menu when clicked on the player container.
803
+ * @beta
804
+ * @remarks
805
+ * Configuration options - {@link ContextMenuPluginSettings}
806
+ *
807
+ * Should not be used together with {@link ClickToPause} plugin
808
+ */
809
+ export declare class ContextMenu extends UIContainerPlugin {
810
+ private open;
811
+ /**
812
+ * @internal
813
+ */
814
+ get name(): string;
815
+ /**
816
+ * @internal
817
+ */
818
+ get supportedVersion(): {
819
+ min: string;
820
+ };
821
+ /**
822
+ * @internal
823
+ */
824
+ get attributes(): {
825
+ class: string;
826
+ };
827
+ private static readonly template;
828
+ /**
829
+ * @internal
830
+ */
831
+ get events(): {
832
+ 'click [role="menuitem"]': string;
833
+ };
834
+ constructor(container: Container);
835
+ /**
836
+ * @internal
837
+ */
838
+ bindEvents(): void;
839
+ /**
840
+ * @internal
841
+ */
842
+ destroy(): UIObject;
843
+ private onContainerClick;
844
+ private onContextMenu;
845
+ private show;
846
+ private hide;
847
+ private runAction;
848
+ /**
849
+ * @internal
850
+ */
851
+ render(): this;
852
+ private hideOnBodyClick;
853
+ }
854
+
855
+ /**
856
+ * Context menu plugin settings
857
+ * @beta
858
+ */
859
+ export declare interface ContextMenuPluginSettings {
860
+ options?: MenuOption[];
861
+ }
862
+
863
+ /**
864
+ * @public
865
+ */
866
+ export declare type CorePluginConstructor = {
867
+ new (core: Core): PlayerPlugin;
868
+ type: string;
869
+ };
870
+
871
+ /**
872
+ * A plain JS object that must conform to the DASH.js settings schema.
873
+ * @public
874
+ * {@link https://cdn.dashjs.org/latest/jsdoc/module-Settings.html | DASH.js settings}
875
+ */
876
+ export declare type DashSettings = Record<string, unknown>;
877
+
878
+ /**
879
+ * `PLUGIN` that adds the DVR controls to the media control UI
880
+ *
881
+ * @beta
882
+ *
883
+ * @remarks
884
+ * Depends on:
885
+ *
886
+ * - {@link MediaControl}
887
+ *
888
+ * The plugin renders live stream indicator.
889
+ * If DVR is enabled, the indicator shows whether the current position is at the live edge of the stream or not.
890
+ * In the latter case, the indicator can be clicked to seek to the live edge.
891
+ */
892
+ export declare class DvrControls extends UICorePlugin {
893
+ private static readonly template;
894
+ /**
895
+ * @internal
896
+ */
897
+ get name(): string;
898
+ /**
899
+ * @internal
900
+ */
901
+ get supportedVersion(): {
902
+ min: string;
903
+ };
904
+ /**
905
+ * @internal
906
+ */
907
+ get events(): {
908
+ 'click #gplayer-mc-back-to-live': string;
909
+ };
910
+ /**
911
+ * @internal
912
+ */
913
+ get attributes(): {
914
+ class: string;
915
+ };
916
+ /**
917
+ * @internal
918
+ */
919
+ bindEvents(): void;
920
+ private onCoreReady;
921
+ private onActiveContainerChanged;
922
+ private clicked;
923
+ /**
924
+ * @internal
925
+ */
926
+ render(): this;
927
+ private onMetadataLoaded;
928
+ private mount;
929
+ private onDvrStateChanged;
930
+ private toggleState;
931
+ }
932
+
933
+ /**
934
+ * Levels of severity of errors. Non-fatal errors usually can be ignored.
935
+ * @public
936
+ */
937
+ export declare type ErrorLevel = 'FATAL' | 'WARN' | 'INFO';
938
+
939
+ /**
940
+ * `PLUGIN` that displays fatal errors nicely in the overlay on top of the player.
941
+ * @public
942
+ * @remarks
943
+ * A fatal error is an error that prevents the player from playing the content.
944
+ * It's usually a network error that persists after multiple retries.
945
+ *
946
+ * The error screen should not be confused with the content stub that is shown when no media sources are available.
947
+ * This can happen due to the lack of the support of the given sources type or because the sources are misconfigured (e.g., omitted).
948
+ *
949
+ * Configuration options - {@link ErrorScreenPluginSettings}
950
+ *
951
+ * @example
952
+ * ```ts
953
+ * import { ErrorScreen, Player } from '@gcorevideo/player'
954
+ *
955
+ * Player.registerPlugin(ErrorScreen)
956
+ * ```
957
+ */
958
+ export declare class ErrorScreen extends UICorePlugin {
959
+ private err;
960
+ /**
961
+ * @internal
962
+ */
963
+ get name(): string;
964
+ /**
965
+ * @internal
966
+ */
967
+ get supportedVersion(): {
968
+ min: string;
969
+ };
970
+ private static readonly template;
971
+ /**
972
+ * @internal
973
+ */
974
+ get attributes(): {
975
+ class: string;
976
+ 'data-error-screen': string;
977
+ };
978
+ /**
979
+ * @internal
980
+ */
981
+ bindEvents(): void;
982
+ private onPlay;
983
+ private unmount;
984
+ /**
985
+ * @internal
986
+ */
987
+ get events(): {
988
+ 'click .player-error-screen__reload': string;
989
+ };
990
+ private reload;
991
+ private onActiveContainerChanged;
992
+ private onError;
993
+ /**
994
+ * @internal
995
+ */
996
+ render(): this;
997
+ }
998
+
999
+ /**
1000
+ * Configuration options for the {@link ErrorScreen} plugin.
1001
+ * @public
1002
+ */
1003
+ export declare type ErrorScreenPluginSettings = {
1004
+ /**
1005
+ * Whether to hide the reload button.
1006
+ */
1007
+ noReload?: boolean;
1008
+ };
1009
+
1010
+ /**
1011
+ * Settings for the {@link ErrorScreen} plugin.
1012
+ * @public
1013
+ */
1014
+ export declare type ErrorScreenSettings = {
1015
+ /**
1016
+ * Whether to hide the reload button. The reload button triggers reload of the current source.
1017
+ */
1018
+ noReload?: boolean;
1019
+ };
1020
+
1021
+ /**
1022
+ * Extended events for the {@link MediaControl} plugin
1023
+ * @beta
1024
+ */
1025
+ export declare enum ExtendedEvents {
1026
+ MEDIACONTROL_VOLUME = "mediacontrol:volume",
1027
+ MEDIACONTROL_MENU_COLLAPSE = "mediacontrol:menu:collapse"
1028
+ }
1029
+
1030
+ /**
1031
+ * `PLUGIN` that changes the favicon according to the player's state.
1032
+ * @beta
1033
+ * @remarks
1034
+ * There are three states: stopped, playing and paused.
1035
+ */
1036
+ export declare class Favicon extends CorePlugin {
1037
+ private oldIcon;
1038
+ private playIcon;
1039
+ private pauseIcon;
1040
+ private stopIcon;
1041
+ /**
1042
+ * @internal
1043
+ */
1044
+ get name(): string;
1045
+ /**
1046
+ * @internal
1047
+ */
1048
+ get supportedVersion(): {
1049
+ min: string;
1050
+ };
1051
+ /**
1052
+ * @internal
1053
+ */
1054
+ constructor(core: Core);
1055
+ /**
1056
+ * @internal
1057
+ */
1058
+ bindEvents(): void;
1059
+ private containerChanged;
1060
+ /**
1061
+ * @internal
1062
+ */
1063
+ disable(): void;
1064
+ /**
1065
+ * @internal
1066
+ */
1067
+ destroy(): void;
1068
+ private createIcon;
1069
+ private setPlayIcon;
1070
+ private setPauseIcon;
1071
+ private resetIcon;
1072
+ private changeIcon;
1073
+ }
1074
+
1075
+ /**
1076
+ * @beta
1077
+ */
1078
+ export declare interface FaviconPluginSettings {
1079
+ /**
1080
+ * CSS color of the favicon.
1081
+ */
1082
+ faviconColor?: string;
1083
+ }
1084
+
1085
+ /**
1086
+ * Events triggered by the plugin
1087
+ * @beta
1088
+ */
1089
+ export declare enum GearEvents {
1090
+ /**
1091
+ * Subscribe to this event to accurately attach an item to the gear menu
1092
+ */
1093
+ RENDERED = "rendered"
1094
+ }
1095
+
1096
+ /**
1097
+ * `PLUGIN` that integrates with Google Analytics
1098
+ * @beta
1099
+ */
1100
+ export declare class GoogleAnalytics extends ContainerPlugin {
1101
+ private account;
1102
+ private trackerName;
1103
+ private domainName;
1104
+ private currentHDState;
1105
+ get name(): string;
1106
+ get supportedVersion(): {
1107
+ min: string;
1108
+ };
1109
+ constructor(container: Container);
1110
+ embedScript(): void;
1111
+ addEventListeners(): void;
1112
+ onReady(): void;
1113
+ onPlay(): void;
1114
+ onStop(): void;
1115
+ onEnded(): void;
1116
+ onBuffering(): void;
1117
+ onBufferFull(): void;
1118
+ onError(): void;
1119
+ onHD(isHD: boolean): void;
1120
+ private onPlaybackChanged;
1121
+ onDVR(dvrInUse: boolean): void;
1122
+ onPause(): void;
1123
+ onSeek(): void;
1124
+ onVolumeChanged(): void;
1125
+ onFullscreen(): void;
1126
+ push(array: string[]): void;
1127
+ }
1128
+
1129
+ /**
1130
+ * Telemetry init event data
1131
+ * @beta
1132
+ */
1133
+ export declare interface InitEventData {
1134
+ event: TelemetryEvent.Init;
1135
+ }
1136
+
1137
+ /**
1138
+ * An ISO 639-1 language code.
1139
+ * @example `pt`
1140
+ * @public
1141
+ */
1142
+ export declare type LangTag = string;
1143
+
1144
+ export { Logger }
1145
+
1146
+ /**
1147
+ * `PLUGIN` that adds custom logo to the player.
1148
+ * @beta
1149
+ */
1150
+ export declare class Logo extends UIContainerPlugin {
1151
+ private hasStartedPlaying;
1152
+ private $logoContainer;
1153
+ get name(): string;
1154
+ get supportedVersion(): {
1155
+ min: string;
1156
+ };
1157
+ get template(): any;
1158
+ get attributes(): {
1159
+ class: string;
1160
+ 'data-logo': string;
1161
+ };
1162
+ private get shouldRender();
1163
+ bindEvents(): void;
1164
+ stopListening(): this;
1165
+ private onPlay;
1166
+ private onStop;
1167
+ private update;
1168
+ constructor(container: Container);
1169
+ render(): this;
1170
+ private setLogoImgAttrs;
1171
+ private setLogoWidth;
1172
+ private setPosition;
1173
+ private setStyles;
1174
+ private setStyle;
1175
+ }
1176
+
1177
+ export { LogTracer }
1178
+
1179
+ /**
1180
+ * `PLUGIN` that provides basic playback controls UI and a foundation for developing custom UI.
1181
+ * @beta
1182
+ * @remarks
1183
+ * The methods exposed are to be used by the other plugins that extend the media control UI.
1184
+ *
1185
+ * Configuration options:
1186
+ *
1187
+ * - `mediaControl`: {@link MediaControlSettings} - specifies the allowed media control elements in each area
1188
+ *
1189
+ * - `persistConfig`: boolean - `common` option, makes the plugin persist the media control settings
1190
+ *
1191
+ * - `chromeless`: boolean
1192
+ */
1193
+ export declare class MediaControl extends UICorePlugin {
1194
+ private buttonsColor;
1195
+ private currentDurationValue;
1196
+ private currentPositionValue;
1197
+ private currentSeekBarPercentage;
1198
+ private disabledClickableList;
1199
+ private displayedDuration;
1200
+ private displayedPosition;
1201
+ private displayedSeekBarPercentage;
1202
+ private draggingSeekBar;
1203
+ private draggingVolumeBar;
1204
+ private fullScreenOnVideoTagSupported;
1205
+ private hideId;
1206
+ private hideVolumeId;
1207
+ private intendedVolume;
1208
+ private keepVisible;
1209
+ private kibo;
1210
+ private lastMouseX;
1211
+ private lastMouseY;
1212
+ private metadataLoaded;
1213
+ private hasUpdate;
1214
+ private persistConfig;
1215
+ private renderTimerId;
1216
+ private rendered;
1217
+ private settings;
1218
+ private userDisabled;
1219
+ private userKeepVisible;
1220
+ private verticalVolume;
1221
+ private $duration;
1222
+ private $fullscreenToggle;
1223
+ private $multiCameraSelector;
1224
+ private $playPauseToggle;
1225
+ private $playStopToggle;
1226
+ private $position;
1227
+ private $seekBarContainer;
1228
+ private $seekBarHover;
1229
+ private $seekBarLoaded;
1230
+ private $seekBarPosition;
1231
+ private $seekBarScrubber;
1232
+ private $volumeBarContainer;
1233
+ private $volumeBarBackground;
1234
+ private $volumeBarFill;
1235
+ private $volumeBarScrubber;
1236
+ private $volumeContainer;
1237
+ private $volumeIcon;
1238
+ private static readonly template;
1239
+ /**
1240
+ * @internal
1241
+ */
1242
+ get name(): string;
1243
+ /**
1244
+ * @internal
1245
+ */
1246
+ get supportedVersion(): {
1247
+ min: string;
1248
+ };
1249
+ private get disabled();
1250
+ /**
1251
+ * Use in mediacontrol-based plugins to access the active container
1252
+ * @internal
1253
+ */
1254
+ get container(): any;
1255
+ /**
1256
+ * @internal
1257
+ * @deprecated Use core.activePlayback directly
1258
+ */
1259
+ get playback(): any;
1260
+ /**
1261
+ * @internal
1262
+ */
1263
+ get attributes(): {
1264
+ class: string;
1265
+ 'data-media-control-skin-1': string;
1266
+ };
1267
+ /**
1268
+ * @internal
1269
+ */
1270
+ get events(): {
1271
+ 'click [data-play]': string;
1272
+ 'click [data-pause]': string;
1273
+ 'click [data-playpause]': string;
1274
+ 'click [data-stop]': string;
1275
+ 'click [data-playstop]': string;
1276
+ 'click [data-fullscreen]': string;
1277
+ 'click .bar-container[data-volume]': string;
1278
+ 'click .drawer-icon[data-volume]': string;
1279
+ 'mouseenter .drawer-container[data-volume]': string;
1280
+ 'mouseleave .drawer-container[data-volume]': string;
1281
+ 'mousedown .bar-container[data-volume]': string;
1282
+ 'touchstart .bar-container[data-volume]': string;
1283
+ 'mousemove .bar-container[data-volume]': string;
1284
+ 'touchmove .bar-container[data-volume]': string;
1285
+ 'mousedown .bar-scrubber[data-seekbar]': string;
1286
+ 'mousedown .bar-container[data-seekbar]': string;
1287
+ 'touchstart .bar-scrubber[data-seekbar]': string;
1288
+ 'touchstart .bar-container[data-seekbar]': string;
1289
+ 'mousemove .bar-container[data-seekbar]': string;
1290
+ 'touchmove .bar-container[data-seekbar]': string;
1291
+ 'mouseleave .bar-container[data-seekbar]': string;
1292
+ 'touchend .bar-container[data-seekbar]': string;
1293
+ 'mouseenter .media-control-layer[data-controls]': string;
1294
+ 'mouseleave .media-control-layer[data-controls]': string;
1295
+ };
1296
+ get currentSeekPos(): number;
1297
+ /**
1298
+ * Current volume [0..100]
1299
+ */
1300
+ get volume(): number;
1301
+ /**
1302
+ * Muted state
1303
+ */
1304
+ get muted(): boolean;
1305
+ constructor(core: Core);
1306
+ /**
1307
+ * @internal
1308
+ */
1309
+ getExternalInterface(): {
1310
+ setVolume: (value: number, isInitialVolume?: boolean) => void;
1311
+ getVolume: () => number;
1312
+ };
1313
+ /**
1314
+ * @internal
1315
+ */
1316
+ bindEvents(): void;
1317
+ private bindContainerEvents;
1318
+ /**
1319
+ * Hides the media control UI
1320
+ */
1321
+ disable(): void;
1322
+ /**
1323
+ * Reenables the plugin disabled earlier with the {@link MediaControl.disable} method
1324
+ */
1325
+ enable(): void;
1326
+ /**
1327
+ *
1328
+ * @returns Vertical space available to render something on top of the container.
1329
+ * @remarks
1330
+ * This takes into account the container height and excludes the height of the controls bar
1331
+ */
1332
+ getAvailableHeight(): number;
1333
+ /**
1334
+ * Set the initial volume, which is preserved when playback is interrupted by an advertisement
1335
+ */
1336
+ setInitialVolume(): void;
1337
+ private onVolumeChanged;
1338
+ private onLoadedMetadata;
1339
+ private updateVolumeUI;
1340
+ private changeTogglePlay;
1341
+ private mousemoveOnSeekBar;
1342
+ private mouseleaveOnSeekBar;
1343
+ private onVolumeClick;
1344
+ private mousemoveOnVolumeBar;
1345
+ private playerResize;
1346
+ private togglePlayPause;
1347
+ private togglePlayStop;
1348
+ private startSeekDrag;
1349
+ private startVolumeDrag;
1350
+ private stopDrag;
1351
+ private updateDrag;
1352
+ private getVolumeFromUIEvent;
1353
+ private toggleMute;
1354
+ /**
1355
+ * Set the volume
1356
+ * @param value - The volume value
1357
+ * @param isInitialVolume - save as the initial volume
1358
+ * @remarks
1359
+ * Initial volume can be restored later
1360
+ */
1361
+ setVolume(value: number, isInitialVolume?: boolean): void;
1362
+ private toggleFullscreen;
1363
+ private onActiveContainerChanged;
1364
+ private showVolumeBar;
1365
+ private hideVolumeBar;
1366
+ private ended;
1367
+ private updateProgressBar;
1368
+ private onTimeUpdate;
1369
+ private renderSeekBar;
1370
+ private drawDurationAndPosition;
1371
+ private seek;
1372
+ private setUserKeepVisible;
1373
+ private resetUserKeepVisible;
1374
+ private isVisible;
1375
+ private show;
1376
+ private hide;
1377
+ private updateCursorStyle;
1378
+ private updateSettings;
1379
+ private onHdUpdate;
1380
+ private createCachedElements;
1381
+ /**
1382
+ * Get a media control element DOM node
1383
+ * @param name - The name of the media control element
1384
+ * @returns The DOM node to render to or extend
1385
+ * @remarks
1386
+ * Use this method to render custom media control UI in a plugin
1387
+ * @example
1388
+ * ```ts
1389
+ * class MyPlugin extends UICorePlugin {
1390
+ * override render() {
1391
+ * this.$el.html('<div data-clips>Here we go</div>')
1392
+ * this.core.getPlugin('media_control').mount('clips', this.$el)
1393
+ * return this
1394
+ * }
1395
+ * }
1396
+ * ```
1397
+ */
1398
+ mount(name: MediaControlElement, element: ZeptoResult): void;
1399
+ /**
1400
+ * Toggle the visibility of a media control element
1401
+ * @param name - The name of the media control element
1402
+ * @param show - Visibility state
1403
+ */
1404
+ toggleElement(area: MediaControlElement, show: boolean): void;
1405
+ private getRightPanel;
1406
+ private getLeftPanel;
1407
+ private getCenterPanel;
1408
+ private resetIndicators;
1409
+ private initializeIcons;
1410
+ private setSeekPercentage;
1411
+ private seekRelative;
1412
+ private bindKeyAndShow;
1413
+ private bindKeyEvents;
1414
+ private unbindKeyEvents;
1415
+ private parseColors;
1416
+ private applyButtonStyle;
1417
+ /**
1418
+ * @internal
1419
+ */
1420
+ destroy(): UIObject;
1421
+ private cancelRenderTimer;
1422
+ private configure;
1423
+ /**
1424
+ * @internal
1425
+ */
1426
+ render(): this;
1427
+ private handleFullScreenOnBtn;
1428
+ private onStartAd;
1429
+ private onFinishAd;
1430
+ private hideControllAds;
1431
+ private static getPageX;
1432
+ private static getPageY;
1433
+ /**
1434
+ * Enable the user interaction disabled earlier
1435
+ */
1436
+ enableControlButton(): void;
1437
+ /**
1438
+ * Disable the user interaction for the control buttons
1439
+ */
1440
+ disabledControlButton(): void;
1441
+ private isSeekEnabledForHtml5Playback;
1442
+ private getElementLocation;
1443
+ private onDvrStateChanged;
1444
+ }
1445
+
1446
+ /**
1447
+ * Built-in media control elements.
1448
+ * @beta
1449
+ */
1450
+ export declare type MediaControlElement = MediaControlLeftElement | MediaControlLayerElement | MediaControlRightElement;
1451
+
1452
+ /**
1453
+ * Media control elements that appear in main layer, spanning the entire width of the player.
1454
+ * @beta
1455
+ */
1456
+ export declare type MediaControlLayerElement = 'seekbar' | 'seekBarContainer';
1457
+
1458
+ /**
1459
+ * Media control elements that appear in the left area.
1460
+ * @beta
1461
+ */
1462
+ export declare type MediaControlLeftElement = 'clipText' | 'duration' | 'dvr' | 'playpause' | 'playstop' | 'position' | 'volume' | 'clips';
1463
+
1464
+ /**
1465
+ * Media control elements that appear in the right area.
1466
+ * @beta
1467
+ */
1468
+ export declare type MediaControlRightElement = 'audiotracks' | 'cc' | 'fullscreen' | 'hd-indicator' | 'gear' | 'multicamera' | 'pip' | 'vr';
1469
+
1470
+ /**
1471
+ * Specifies the allowed media control elements in each area.
1472
+ * Can be used to restrict rendered media control elements.
1473
+ * @beta
1474
+ */
1475
+ export declare type MediaControlSettings = {
1476
+ left: MediaControlLeftElement[];
1477
+ right: MediaControlRightElement[];
1478
+ default: MediaControlLayerElement[];
1479
+ seekEnabled: boolean;
1480
+ };
1481
+
1482
+ /**
1483
+ * @beta
1484
+ */
1485
+ export declare type MenuOption = {
1486
+ /**
1487
+ * Menu item label text. One of `label` or `labelKey` must be specified.
1488
+ */
1489
+ label?: string;
1490
+ /**
1491
+ * Menu item label localisation key, if specified, the `label` will be ignored
1492
+ */
1493
+ labelKey?: string;
1494
+ /**
1495
+ * Menu item name. Must be unique.
1496
+ */
1497
+ name: string;
1498
+ /**
1499
+ * Menu item handler function
1500
+ */
1501
+ handler?: () => void;
1502
+ /**
1503
+ * Menu item icon, plain HTML string
1504
+ */
1505
+ icon?: string;
1506
+ };
1507
+
1508
+ /**
1509
+ * `PLUGIN` that adds support for loading multiple streams and switching between them using the media control UI.
1510
+ * @beta
1511
+ */
1512
+ export declare class MultiCamera extends UICorePlugin {
1513
+ private currentCamera;
1514
+ private currentTime;
1515
+ private playing;
1516
+ private multicamera;
1517
+ private noActiveStreams;
1518
+ get name(): string;
1519
+ get supportedVersion(): {
1520
+ min: string;
1521
+ };
1522
+ static get version(): string;
1523
+ get template(): any;
1524
+ get attributes(): {
1525
+ class: string;
1526
+ 'data-multicamera': string;
1527
+ };
1528
+ get events(): {
1529
+ 'click [data-multicamera-selector-select]': string;
1530
+ 'click [data-multicamera-button]': string;
1531
+ };
1532
+ constructor(core: Core);
1533
+ bindEvents(): void;
1534
+ unBindEvents(): void;
1535
+ private onPlay;
1536
+ private bindPlaybackEvents;
1537
+ private reload;
1538
+ private shouldRender;
1539
+ render(): this;
1540
+ private onCameraSelect;
1541
+ activeById(id: number, active: boolean): void;
1542
+ private setLiveStatus;
1543
+ private behaviorLive;
1544
+ private behaviorOne;
1545
+ private behaviorAll;
1546
+ private findAndInitNextStream;
1547
+ private showError;
1548
+ private hideError;
1549
+ private changeById;
1550
+ private getCamerasList;
1551
+ private getCurrentCamera;
1552
+ private findElementById;
1553
+ private findIndexById;
1554
+ private onShowLevelSelectMenu;
1555
+ private hideSelectLevelMenu;
1556
+ private toggleContextMenu;
1557
+ private levelElement;
1558
+ private highlightCurrentLevel;
1559
+ }
1560
+
1561
+ /**
1562
+ * `PLUGIN` that displays useful statistics regarding the playback as well as the network quality estimation.
1563
+ * @beta
1564
+ *
1565
+ * @remarks
1566
+ * Depends on:
1567
+ *
1568
+ * - {@link BottomGear} - where the button is attached
1569
+ *
1570
+ * - {@link ClapprStats} - to get the metrics from
1571
+ *
1572
+ * The plugin is rendered as an item in the gear menu.
1573
+ *
1574
+ * When clicked, it shows an overlay window with the information about the network speed, latency, etc,
1575
+ * and recommended quality level.
1576
+ */
1577
+ declare class NerdStats extends UICorePlugin {
1578
+ private container;
1579
+ private speedtestMetrics;
1580
+ private metrics;
1581
+ private open;
1582
+ private shortcut;
1583
+ private iconPosition;
1584
+ private static readonly buttonTemplate;
1585
+ /**
1586
+ * @internal
1587
+ */
1588
+ get name(): string;
1589
+ /**
1590
+ * @internal
1591
+ */
1592
+ get supportedVersion(): {
1593
+ min: string;
1594
+ };
1595
+ private static readonly template;
1596
+ /**
1597
+ * @internal
1598
+ */
1599
+ get attributes(): {
1600
+ class: string;
1601
+ };
1602
+ /**
1603
+ * @internal
1604
+ */
1605
+ get events(): {
1606
+ click: string;
1607
+ 'click #nerd-stats-close': string;
1608
+ 'click #nerd-stats-refresh': string;
1609
+ };
1610
+ private clicked;
1611
+ private get statsBoxElem();
1612
+ private get statsBoxWidthThreshold();
1613
+ private get playerWidth();
1614
+ private get playerHeight();
1615
+ constructor(core: Core);
1616
+ /**
1617
+ * @internal
1618
+ */
1619
+ bindEvents(): void;
1620
+ private onCoreReady;
1621
+ private onActiveContainerChanged;
1622
+ /**
1623
+ * @internal
1624
+ */
1625
+ destroy(): UIObject;
1626
+ private toggle;
1627
+ private show;
1628
+ private hide;
1629
+ private onPlayerResize;
1630
+ private updateResolution;
1631
+ private estimateQuality;
1632
+ private updateMetrics;
1633
+ private updateCustomMetrics;
1634
+ private updateEstimatedQuality;
1635
+ private setStatsBoxSize;
1636
+ /**
1637
+ * @internal
1638
+ */
1639
+ render(): this;
1640
+ private attach;
1641
+ private clearSpeedtestMetrics;
1642
+ private refreshSpeedTest;
1643
+ private formatPlaybackName;
1644
+ }
1645
+ export { NerdStats as ClapprNerdStats }
1646
+ export { NerdStats }
1647
+
1648
+ /**
1649
+ * `PLUGIN` that enables picture in picture mode.
1650
+ * @beta
1651
+ * @remarks
1652
+ * Depends on:
1653
+ *
1654
+ * - {@link MediaControl}
1655
+ *
1656
+ * It renders a button to toggle picture in picture mode in the media control UI.
1657
+ */
1658
+ export declare class PictureInPicture extends UICorePlugin {
1659
+ /**
1660
+ * @internal
1661
+ */
1662
+ get name(): string;
1663
+ /**
1664
+ * @internal
1665
+ */
1666
+ get supportedVersion(): {
1667
+ min: string;
1668
+ };
1669
+ /**
1670
+ * @internal
1671
+ */
1672
+ static get version(): string;
1673
+ private static buttonTemplate;
1674
+ /**
1675
+ * @internal
1676
+ */
1677
+ get events(): {
1678
+ 'click button': string;
1679
+ };
1680
+ get attributes(): {
1681
+ class: string;
1682
+ };
1683
+ private get videoElement();
1684
+ /**
1685
+ * @internal
1686
+ */
1687
+ bindEvents(): void;
1688
+ private isPiPSupported;
1689
+ /**
1690
+ * @internal
1691
+ */
1692
+ render(): this;
1693
+ private togglePictureInPicture;
1694
+ private requestPictureInPicture;
1695
+ private exitPictureInPicture;
1696
+ }
1697
+
1698
+ /**
1699
+ * An error occurred during the playback.
1700
+ * @public
1701
+ */
1702
+ export declare interface PlaybackError {
1703
+ /**
1704
+ * Error code.
1705
+ */
1706
+ code: PlaybackErrorCode;
1707
+ /**
1708
+ * Detailed description of the error.
1709
+ */
1710
+ description: string;
1711
+ /**
1712
+ * Level of severity of the error.
1713
+ */
1714
+ level: ErrorLevel;
1715
+ /**
1716
+ * Error message. Non-fatal usually can be ignored.
1717
+ */
1718
+ message: string;
1719
+ /**
1720
+ * Name of the component that originated the error.
1721
+ * @example
1722
+ * - 'core'
1723
+ * - 'dash'
1724
+ * - 'media_control'
1725
+ */
1726
+ origin: string;
1727
+ /**
1728
+ * Component subsystem of the error origin, together with the `origin` uniquely identifies the originating component.
1729
+ */
1730
+ scope: PlayerComponentType;
1731
+ /**
1732
+ * UI description of the error.
1733
+ */
1734
+ UI?: {
1735
+ title: string;
1736
+ message: string;
1737
+ icon?: string;
1738
+ };
1739
+ }
1740
+
1741
+ /**
1742
+ * Codes of errors occurring within the playback component.
1743
+ * @public
1744
+ */
1745
+ export declare enum PlaybackErrorCode {
1746
+ /**
1747
+ * An unknown or uncategorised error.
1748
+ */
1749
+ Generic = "GENERIC_ERROR",
1750
+ /**
1751
+ * The media source is not available. Typically a network error.
1752
+ */
1753
+ MediaSourceUnavailable = "MEDIA_SOURCE_UNAVAILABLE",
1754
+ /**
1755
+ * The media source is not accessible due to some protection policy.
1756
+ */
1757
+ MediaSourceAccessDenied = "MEDIA_SOURCE_ACCESS_DENIED"
1758
+ }
1759
+
1760
+ /**
1761
+ * Module to perform the playback.
1762
+ * @public
1763
+ */
1764
+ export declare type PlaybackModule = 'dash' | 'hls' | 'html5_video';
1765
+
1766
+ /**
1767
+ * `PLUGIN` that allows changing the playback speed of the video.
1768
+ * @beta
1769
+ *
1770
+ * @remarks
1771
+ * Depends on:
1772
+ *
1773
+ * - {@link MediaControl}
1774
+ *
1775
+ * - {@link BottomGear}
1776
+ *
1777
+ * It renders an option in the gear menu, which opens a dropdown with the options to change the playback rate.
1778
+ * Note that the playback rate change is supported only for VOD or DVR-enabled live streams.
1779
+ *
1780
+ * Plugin settings - {@link PlaybackRateSettings}
1781
+ *
1782
+ * @example
1783
+ * ```ts
1784
+ * import { Player, PlaybackRateSettings } from '@gcorevideo/player'
1785
+ * Player.registerPlugin(PlaybackRate)
1786
+ * const player = new Player({
1787
+ * playbackRate: {
1788
+ * options: [
1789
+ * { value: 0.5, label: '0.5x' },
1790
+ * { value: 1, label: '1x' },
1791
+ * ],
1792
+ * defaultValue: 1,
1793
+ * },
1794
+ * })
1795
+ * ```
1796
+ */
1797
+ export declare class PlaybackRate extends UICorePlugin {
1798
+ private selectedRate;
1799
+ private metadataLoaded;
1800
+ private mountTimerId;
1801
+ /**
1802
+ * @internal
1803
+ */
1804
+ get name(): string;
1805
+ /**
1806
+ * @internal
1807
+ */
1808
+ get supportedVersion(): {
1809
+ min: string;
1810
+ };
1811
+ private static readonly buttonTemplate;
1812
+ private static readonly listTemplate;
1813
+ constructor(core: Core);
1814
+ private get playbackRates();
1815
+ /**
1816
+ * @internal
1817
+ */
1818
+ get attributes(): {
1819
+ class: string;
1820
+ };
1821
+ /**
1822
+ * @internal
1823
+ */
1824
+ get events(): {
1825
+ 'click [data-rate]': string;
1826
+ 'click #playback-rate-back-button': string;
1827
+ };
1828
+ /**
1829
+ * @internal
1830
+ */
1831
+ bindEvents(): void;
1832
+ private onCoreReady;
1833
+ private onActiveContainerChange;
1834
+ private onMediaControlRendered;
1835
+ private onGearRendered;
1836
+ private mount;
1837
+ private onMetaDataLoaded;
1838
+ private allRateElements;
1839
+ private rateElement;
1840
+ private onPlaybackRateChange;
1841
+ private shouldMount;
1842
+ /**
1843
+ * @internal
1844
+ */
1845
+ render(): this;
1846
+ /**
1847
+ * @internal
1848
+ */
1849
+ destroy(): UIObject;
1850
+ private onPlay;
1851
+ private syncRate;
1852
+ private resetPlaybackRate;
1853
+ private onStop;
1854
+ private onSelect;
1855
+ private goBack;
1856
+ private setSelectedRate;
1857
+ private getTitle;
1858
+ private highlightCurrentRate;
1859
+ private updateGearOptionLabel;
1860
+ }
1861
+
1862
+ /**
1863
+ * @beta
1864
+ */
1865
+ export declare type PlaybackRateOption = {
1866
+ value: number;
1867
+ label: string;
1868
+ };
1869
+
1870
+ /**
1871
+ * @beta
1872
+ */
1873
+ export declare type PlaybackRateSettings = {
1874
+ options?: PlaybackRateOption[];
1875
+ defaultValue?: number;
1876
+ };
1877
+
1878
+ /**
1879
+ * Type of a stream
1880
+ * @public
1881
+ */
1882
+ export declare type PlaybackType = 'live' | 'vod';
1883
+
1884
+ /**
1885
+ * `MAIN` component to use in the application code.
1886
+ * @public
1887
+ * @remarks
1888
+ * The Player object provides very basic API to control playback.
1889
+ * To build a sophisticated UI, use the plugins framework to tap into the Clappr core.
1890
+ * {@link https://github.com/clappr/clappr/wiki/Architecture}
1891
+ */
1892
+ export declare class Player {
1893
+ private config;
1894
+ private emitter;
1895
+ private player;
1896
+ private ready;
1897
+ private rootNode;
1898
+ constructor(config: PlayerConfig);
1899
+ /**
1900
+ * Adds a listener to a player event
1901
+ * @param event - event type, see {@link PlayerEvent}
1902
+ * @param handler - a callback function to handle the event
1903
+ */
1904
+ on<E extends PlayerEvent>(event: E, handler: PlayerEventHandler<E>): void;
1905
+ /**
1906
+ * Removes a previously added event listener
1907
+ * @param event - See {@link PlayerEvent}
1908
+ * @param handler - a callback attached earlier to that event type
1909
+ */
1910
+ off<E extends PlayerEvent>(event: E, handler: PlayerEventHandler<E>): void;
1911
+ /**
1912
+ * Configures the player.
1913
+ *
1914
+ * @param config - complete or partial configuration
1915
+ * @remarks
1916
+ * Can be called multiple times.
1917
+ * Each consequent call extends the previous configuration with only the new keys overridden.
1918
+ *
1919
+ * After a reconfiguration, if something significant has changed, it might make sense reinitialize the player (i.e, a `.destroy()` followed by an `.init()` call).
1920
+ */
1921
+ configure(config: Partial<PlayerConfig>): void;
1922
+ /**
1923
+ * Initializes the player at the given container element.
1924
+ * @param playerElement - DOM element to host the player
1925
+ * @remarks
1926
+ * The player will be initialized and attached to the given element.
1927
+ *
1928
+ * All the core plugins will be initialized at this point.
1929
+ *
1930
+ * If no sources were configured, it will trigger an error.
1931
+ *
1932
+ * The player container will be initialized and then all the registered UI plugins.
1933
+ *
1934
+ * If the `autoPlay` option is set, then it will trigger playback immediately.
1935
+ *
1936
+ * It is an error to call this method twice. If you need to attache player to another DOM element,
1937
+ * first call {@link Player.destroy} and then {@link Player.attachTo}.
1938
+ *
1939
+ * @example
1940
+ * ```ts
1941
+ * const player = new Player({
1942
+ * sources: [{ source: 'https://example.com/a.mpd', mimeType: 'application/dash+xml' }],
1943
+ * })
1944
+ * document.addEventListener('DOMContentLoaded', () => {
1945
+ * player.attachTo(document.getElementById('video-container'))
1946
+ * })
1947
+ * ```
1948
+ */
1949
+ attachTo(playerElement: HTMLElement): void;
1950
+ /**
1951
+ * Destroys the player, releasing all resources and unmounting its UI from the DOM.
1952
+ */
1953
+ destroy(): void;
1954
+ /**
1955
+ * Current playback (time since the beginning of the stream), if appropriate.
1956
+ *
1957
+ * @returns Time in seconds
1958
+ * @remarks
1959
+ * For live streams, it returns the current time within the current segment.
1960
+ */
1961
+ getCurrentTime(): number;
1962
+ /**
1963
+ * Duration of the current media in seconds, if appropriate.
1964
+ *
1965
+ * @returns Time in seconds
1966
+ * @remarks
1967
+ * For live streams, it returns the duration of the current segment.
1968
+ */
1969
+ getDuration(): number;
1970
+ /**
1971
+ * Indicates whether DVR is enabled.
1972
+ */
1973
+ isDvrEnabled(): boolean;
1974
+ /**
1975
+ * Indicates whether DVR is in use.
1976
+ * @remarks
1977
+ * DVR mode, if it is enabled, is triggered we a user seeks behind the live edge.
1978
+ */
1979
+ isDvrInUse(): boolean;
1980
+ /**
1981
+ * Indicates muted state of the video.
1982
+ * @remarks
1983
+ * Note that muted state is independent from the volume level.
1984
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/muted}
1985
+ */
1986
+ isMuted(): boolean;
1987
+ /**
1988
+ * Indicates the playing state.
1989
+ */
1990
+ isPlaying(): boolean;
1991
+ /**
1992
+ * Mutes the sound of the video.
1993
+ */
1994
+ mute(): void;
1995
+ /**
1996
+ * Unmutes the video sound.
1997
+ */
1998
+ unmute(): void;
1999
+ /**
2000
+ * Pauses playback.
2001
+ */
2002
+ pause(): void;
2003
+ /**
2004
+ * Starts playback.
2005
+ */
2006
+ play(): void;
2007
+ /**
2008
+ * Resizes the player container element and everything within it.
2009
+ * @param newSize - new size of the player
2010
+ * @remarks
2011
+ * Use this method when the player itself does not detect properly the change in size of its container element.
2012
+ * It can be a case for orientation change on some mobile devices.
2013
+ */
2014
+ resize(newSize: ContainerSize): void;
2015
+ /**
2016
+ * Seeks to the given time.
2017
+ * @param time - time to seek to in seconds (since the beginning of the stream)
2018
+ */
2019
+ seek(time: number): void;
2020
+ /**
2021
+ * Gets the current volume of the media content being played.
2022
+ * @returns a number between 0 and 1
2023
+ */
2024
+ getVolume(): number;
2025
+ /**
2026
+ * Sets the current volume of the media content being played.
2027
+ * @param volume - a number between 0 and 1
2028
+ */
2029
+ setVolume(volume: number): void;
2030
+ /**
2031
+ * Stops playback.
2032
+ */
2033
+ stop(): void;
2034
+ /**
2035
+ * Registers a plugin.
2036
+ * @param plugin - a plugin class
2037
+ * @remarks
2038
+ * Use this method to extend the player with custom behavior.
2039
+ * The plugin class must inherit from one of the Clappr UIPlugin, UIContainerPlugin or CorePlugin classes.
2040
+ * A core plugin will be initialized and attached to the player when the player is initialized.
2041
+ * A UI plugin will be initialized and attached to the player container is initialized.
2042
+ *
2043
+ * @see {@link https://github.com/clappr/clappr/wiki/Architecture}
2044
+ * @example
2045
+ * ```ts
2046
+ * import MyPlugin from './MyPlugin.js'
2047
+ *
2048
+ * Player.registerPlugin(MyPlugin)
2049
+ * ```
2050
+ */
2051
+ static registerPlugin(plugin: PlayerPluginConstructor): void;
2052
+ /**
2053
+ * Unregisters a plugin registered earlier with {@link Player.registerPlugin}.
2054
+ * @remarks
2055
+ * It can be also used to unregister a built-in default plugin.
2056
+ *
2057
+ * Currently, the plugins that are always registered are:
2058
+ *
2059
+ * - {@link https://github.com/clappr/clappr-core/blob/3126c3a38a6eee9d5aba3918b194e6380fa1178c/src/plugins/strings/strings.js | 'strings'}, which supports internationalization of the player UI
2060
+ *
2061
+ * - {@link https://github.com/clappr/clappr-core/blob/3126c3a38a6eee9d5aba3918b194e6380fa1178c/src/plugins/sources/sources.js | 'sources'}, which lets to specify multiple media sources and selects the first suitable playback module
2062
+ *
2063
+ * @param name - name of the plugin
2064
+ */
2065
+ static unregisterPlugin(name: string): void;
2066
+ private static getRegisteredPlugins;
2067
+ private static corePlugins;
2068
+ private setConfig;
2069
+ private initPlayer;
2070
+ private tuneIn;
2071
+ private triggerAutoPlay;
2072
+ private safeTriggerEvent;
2073
+ private events;
2074
+ private buildCoreOptions;
2075
+ private configurePlaybacks;
2076
+ private buildMediaSourcesList;
2077
+ private bindContainerEventListeners;
2078
+ private bindCoreListeners;
2079
+ }
2080
+
2081
+ /**
2082
+ * Subsystems of a player component.
2083
+ * @public
2084
+ */
2085
+ export declare type PlayerComponentType = 'container' | 'core' | 'playback';
2086
+
2087
+ /**
2088
+ * Configuration options for the player
2089
+ *
2090
+ * @remarks
2091
+ * You can specify multiple sources, each in two forms: just a plain URL or a full object with `source` and `mimeType` fields {@link PlayerMediaSource}.
2092
+ * The player will pick the first viable media source according to the source availability, and either the transport preference or standard transport selection order.
2093
+ *
2094
+ * `priorityTransport` is used to specify the preferred transport protocol
2095
+ * when multiple sources are available.
2096
+ * It will first try to use the transport specified if it's supported (by a playback engine) and the source is available.
2097
+ * Otherwise it will try the other transports in the regular order (dash, hls, mpegts).
2098
+ *
2099
+ * The `autoPlay` option should be used together with the {@link PlayerConfig.mute | mute} to avoid issues with the browsers' autoplay policies.
2100
+ *
2101
+ * Note that the `playbackType` is specified explicitly in the examle below, but a playback engine might be able to detect the type of the stream automatically.
2102
+ *
2103
+ * A plugin options can be specified in the configuration object under a unique key, typically corresponding to the plugin name.
2104
+ * The plugin object will have access to the internal normalized configuration object that contains all the custom options.
2105
+ * in the examle below, the `poster` field is the `Poster` plugin configuration options.
2106
+ *
2107
+ * @example
2108
+ * ```ts
2109
+ * {
2110
+ * autoPlay: true,
2111
+ * mute: true,
2112
+ * playbackType: 'live',
2113
+ * priorityTransport: 'dash',
2114
+ * sources: [{
2115
+ * source: 'https://example.com/myownair66.mpd',
2116
+ * mimeType: 'application/dash+xml',
2117
+ * }, {
2118
+ * source: 'https://example.com/myownair66.m3u8',
2119
+ * mimeType: 'application/x-mpegURL',
2120
+ * }],
2121
+ * poster: {
2122
+ * url: settings.poster,
2123
+ * },
2124
+ * }
2125
+ * ```
2126
+ * @public
2127
+ */
2128
+ export declare interface PlayerConfig extends Record<string, unknown> {
2129
+ /**
2130
+ * Start playback automatically when the player is ready
2131
+ * @defaultValue false
2132
+ */
2133
+ autoPlay?: boolean;
2134
+ /**
2135
+ * Configuration settings for the DASH playback engine
2136
+ * @defaultValue \{\}
2137
+ * {@link https://cdn.dashjs.org/latest/jsdoc/module-Settings.html}
2138
+ */
2139
+ dash?: DashSettings;
2140
+ /**
2141
+ * Controls the debug output level
2142
+ * @defaultValue 'none'
2143
+ */
2144
+ debug?: PlayerDebugSettings;
2145
+ /**
2146
+ * A language code for the player UI, for example, `es`. Must reference a key in the {@link PlayerConfig.strings | strings} record.
2147
+ * @defaultValue 'en'
2148
+ */
2149
+ language?: string;
2150
+ /**
2151
+ * Repeat playback when the media ends.
2152
+ * Is used with the `vod` {@link PlayerConfig.playbackType | playbackType}
2153
+ * @defaultValue false
2154
+ */
2155
+ loop?: boolean;
2156
+ /**
2157
+ * Mute the audio output in order to comply with browsers' autoplay policy.
2158
+ * @defaultValue false
2159
+ */
2160
+ mute?: boolean;
2161
+ /**
2162
+ * Stream type.
2163
+ * @remarks
2164
+ * Should only be set if known in advance, as it should not change once determined.
2165
+ * Otherwise it might cause inconsistencies in the UI plugins behavior, for instance, glitches with rendering of the DVR controls or seek bar.
2166
+ */
2167
+ playbackType?: PlaybackType;
2168
+ /**
2169
+ * Preferred transport protocol when multiple sources are available.
2170
+ * @defaultValue 'dash'
2171
+ */
2172
+ priorityTransport?: TransportPreference;
2173
+ /**
2174
+ * List of media sources, at least one is required.
2175
+ */
2176
+ sources: PlayerMediaSource[];
2177
+ /**
2178
+ * Localization strings for the player UI.
2179
+ */
2180
+ strings?: TranslationSettings;
2181
+ }
2182
+
2183
+ /**
2184
+ * @remarks `true` is equivalent to `'all'`, `false` is equivalent to `'none'`
2185
+ * @public
2186
+ */
2187
+ export declare type PlayerDebugSettings = PlayerDebugTag | boolean;
2188
+
2189
+ /**
2190
+ * Debug output category selector
2191
+ * @public
2192
+ */
2193
+ export declare type PlayerDebugTag = 'all' | 'clappr' | 'dash' | 'hls' | 'none';
2194
+
2195
+ /**
2196
+ * A top-level event on the player object
2197
+ * @public
2198
+ */
2199
+ export declare enum PlayerEvent {
2200
+ /**
2201
+ * Playback has reached the end of the media.
2202
+ */
2203
+ Ended = "ended",
2204
+ /**
2205
+ * An error occurred.
2206
+ * Parameters: {@link PlaybackError}
2207
+ */
2208
+ Error = "error",
2209
+ /**
2210
+ * The player has switched to or from the fullscreen mode.
2211
+ * Parameters:`boolean` isFullscreen
2212
+ */
2213
+ Fullscreen = "fullscreen",
2214
+ /**
2215
+ * The player is ready to use.
2216
+ */
2217
+ Ready = "ready",
2218
+ /**
2219
+ * Playback has started.
2220
+ */
2221
+ Play = "play",
2222
+ /**
2223
+ * Playback has been paused.
2224
+ */
2225
+ Pause = "pause",
2226
+ /**
2227
+ * The player's container has been resized.
2228
+ * Parameters: {@link ContainerSize}
2229
+ */
2230
+ Resize = "resize",
2231
+ /**
2232
+ * The player is seeking to a new position.
2233
+ */
2234
+ Seek = "seek",
2235
+ /**
2236
+ * Playback has been stopped.
2237
+ */
2238
+ Stop = "stop",
2239
+ /**
2240
+ * The current playback time has changed.
2241
+ * Parameters: {@link TimePosition}
2242
+ */
2243
+ TimeUpdate = "timeupdate",
2244
+ /**
2245
+ * The volume has changed.
2246
+ * Parameters: `number` volume in the range 0..1
2247
+ */
2248
+ VolumeUpdate = "volumeupdate"
2249
+ }
2250
+
2251
+ /**
2252
+ * Type of a listener callback function for a player event.
2253
+ * See the description of the event parameters in {@link PlayerEvent}.
2254
+ * @public
2255
+ */
2256
+ export declare type PlayerEventHandler<E extends PlayerEvent> = (...args: PlayerEventParams<E>) => void;
2257
+
2258
+ /**
2259
+ * @public
2260
+ */
2261
+ 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 ? [{
2262
+ width: number;
2263
+ height: number;
2264
+ }] : E extends PlayerEvent.Fullscreen ? [boolean] : E extends PlayerEvent.Error ? [PlaybackError] : [];
2265
+
2266
+ /**
2267
+ * A media source to fetch the media data from
2268
+ * @public
2269
+ */
2270
+ export declare type PlayerMediaSource = string | PlayerMediaSourceDesc;
2271
+
2272
+ /**
2273
+ * Describes a media source with its MIME type and URL.
2274
+ *
2275
+ * @remarks
2276
+ * When the MIME type is provided, it helps the player determine the appropriate playback engine.
2277
+ * If omitted, the player will attempt to detect the type from the source URL extension.
2278
+ * @public
2279
+ */
2280
+ export declare interface PlayerMediaSourceDesc {
2281
+ /**
2282
+ * The MIME type of the media source (e.g. `"video/mp4"`, `"application/x-mpegURL"`).
2283
+ * Necessary if the type cannot be detected from file extension of the source URL.
2284
+ */
2285
+ mimeType?: string;
2286
+ /**
2287
+ * URL of the media source
2288
+ */
2289
+ source: string;
2290
+ }
2291
+
2292
+ /**
2293
+ * @public
2294
+ * @see {@link https://clappr.github.io/classes/UIContainerPlugin.html},
2295
+ * {@link https://clappr.github.io/classes/ContainerPlugin.html}
2296
+ */
2297
+ export declare type PlayerPlugin = {
2298
+ name: string;
2299
+ };
2300
+
2301
+ /**
2302
+ * @public
2303
+ */
2304
+ export declare type PlayerPluginConstructor = CorePluginConstructor | ContainerPluginConstructor;
2305
+
2306
+ /**
2307
+ * `PLUGIN` that displays a poster image in the background and a big play button on top when playback is stopped
2308
+ * @beta
2309
+ * @remarks
2310
+ * When the playback is stopped or not yet started, the media control UI is disabled and hidden.
2311
+ * Media control gets activated once the metadata is loaded after playback is initiated.
2312
+ * This plugin displays a big play button on top of the poster image to allow user to start playback.
2313
+ * Note that the poster image, if specified via the player config, will be used to update video element's poster attribute by the
2314
+ * HTML5-video-based playback module.
2315
+ *
2316
+ * Configuration options - {@link PosterPluginSettings}
2317
+ *
2318
+ * @example
2319
+ * ```ts
2320
+ * new Player({
2321
+ * ...
2322
+ * poster: {
2323
+ * showForNoOp: true,
2324
+ * url: 'https://via.placeholder.com/150.png',
2325
+ * }
2326
+ * })
2327
+ * ```
2328
+ */
2329
+ export declare class Poster extends UIContainerPlugin {
2330
+ private hasFatalError;
2331
+ private playing;
2332
+ private playRequested;
2333
+ private $playButton;
2334
+ /**
2335
+ * @internal
2336
+ */
2337
+ get name(): string;
2338
+ /**
2339
+ * @internal
2340
+ */
2341
+ get supportedVersion(): {
2342
+ min: string;
2343
+ };
2344
+ private static readonly template;
2345
+ private get shouldRender();
2346
+ private get isNoOp();
2347
+ /**
2348
+ * @internal
2349
+ */
2350
+ get attributes(): {
2351
+ class: string;
2352
+ };
2353
+ /**
2354
+ * @internal
2355
+ */
2356
+ get events(): {
2357
+ click: string;
2358
+ };
2359
+ /**
2360
+ * @internal
2361
+ */
2362
+ bindEvents(): void;
2363
+ /**
2364
+ * Reenables earlier disabled plugin
2365
+ */
2366
+ enable(): void;
2367
+ /**
2368
+ * Disables the plugin, unmounting it from the DOM
2369
+ */
2370
+ disable(): void;
2371
+ private onError;
2372
+ private onPlay;
2373
+ private onPlayIntent;
2374
+ private onStop;
2375
+ private updatePlayButton;
2376
+ private showPlayButton;
2377
+ private hidePlayButton;
2378
+ private clicked;
2379
+ private shouldHideOnPlay;
2380
+ private update;
2381
+ private updatePoster;
2382
+ private showPoster;
2383
+ private hidePoster;
2384
+ /**
2385
+ * @internal
2386
+ */
2387
+ render(): this;
2388
+ /**
2389
+ * @internal
2390
+ */
2391
+ destroy(): this;
2392
+ }
2393
+
2394
+ /**
2395
+ * Config options for the {@link Poster} plugin
2396
+ * @beta
2397
+ */
2398
+ export declare interface PosterPluginSettings {
2399
+ /**
2400
+ * Custom CSS background
2401
+ */
2402
+ custom?: string;
2403
+ /**
2404
+ * Whether to show the poster image when the playback is noop (i.e., when there is no appropriate video playback engine for current media sources set or the media sources are not set at all)
2405
+ */
2406
+ showForNoOp?: boolean;
2407
+ /**
2408
+ * Poster image URL
2409
+ */
2410
+ url?: string;
2411
+ /**
2412
+ * Whether to show the poster after playback has ended, by default `true`
2413
+ */
2414
+ showOnVideoEnd?: boolean;
2415
+ }
2416
+
2417
+ /**
2418
+ * A level of quality within a media source/representation.
2419
+ * @public
2420
+ */
2421
+ export declare interface QualityLevel {
2422
+ /**
2423
+ * Zero-based index of the quality level.
2424
+ * Quality levels go from low to high
2425
+ */
2426
+ level: number;
2427
+ /**
2428
+ * Width of the video frame, pixels.
2429
+ */
2430
+ width: number;
2431
+ /**
2432
+ * Height of the video frame, pixels.
2433
+ */
2434
+ height: number;
2435
+ /**
2436
+ * Bitrate of the video, bps.
2437
+ */
2438
+ bitrate: number;
2439
+ }
2440
+
2441
+ /**
2442
+ * `PLUGIN` that provides a UI to select the desired quality level of the playback.
2443
+ * @beta
2444
+ *
2445
+ * @remarks
2446
+ * Depends on:
2447
+ *
2448
+ * - {@link MediaControl}
2449
+ *
2450
+ * - {@link BottomGear}
2451
+ *
2452
+ * The plugin is rendered as an item in the gear menu, which, when clicked, shows a list of quality levels to choose from.
2453
+ *
2454
+ * Configuration options - {@link QualityLevelsPluginSettings}
2455
+ *
2456
+ * @example
2457
+ * ```ts
2458
+ * new Player({
2459
+ * qualityLevels: {
2460
+ * restrictResolution: 360,
2461
+ * labels: { 360: 'SD', 720: 'HD' },
2462
+ * },
2463
+ * })
2464
+ * ```
2465
+ */
2466
+ declare class QualityLevels extends UICorePlugin {
2467
+ private levels;
2468
+ private levelLabels;
2469
+ private removeAuto;
2470
+ private isHd;
2471
+ private currentText;
2472
+ private selectedLevelId;
2473
+ private static readonly buttonTemplate;
2474
+ private static readonly listTemplate;
2475
+ /**
2476
+ * @internal
2477
+ */
2478
+ get name(): string;
2479
+ /**
2480
+ * @internal
2481
+ */
2482
+ get supportedVersion(): {
2483
+ min: string;
2484
+ };
2485
+ /**
2486
+ * @internal
2487
+ */
2488
+ static get version(): string;
2489
+ /**
2490
+ * @internal
2491
+ */
2492
+ get attributes(): {
2493
+ class: string;
2494
+ 'data-level-selector': string;
2495
+ };
2496
+ get events(): {
2497
+ 'click .gear-sub-menu_btn': string;
2498
+ 'click .go-back': string;
2499
+ };
2500
+ /**
2501
+ * @internal
2502
+ */
2503
+ bindEvents(): void;
2504
+ private onCoreReady;
2505
+ private onGearRendered;
2506
+ private onActiveContainerChange;
2507
+ private updateHd;
2508
+ private onStop;
2509
+ private shouldRender;
2510
+ /**
2511
+ * @internal
2512
+ */
2513
+ render(): this;
2514
+ private renderDropdown;
2515
+ private updateButton;
2516
+ private get pluginOptions();
2517
+ private get maxLevel();
2518
+ private onLevelsAvailable;
2519
+ private makeLevelsLabels;
2520
+ private onSelect;
2521
+ private goBack;
2522
+ private setLevel;
2523
+ private allLevelElements;
2524
+ private levelElement;
2525
+ private onLevelSwitchStart;
2526
+ private onLevelSwitchEnd;
2527
+ private updateText;
2528
+ private getLevelLabel;
2529
+ private onBitrate;
2530
+ private highlightCurrentLevel;
2531
+ }
2532
+ export { QualityLevels as LevelSelector }
2533
+ export { QualityLevels }
2534
+
2535
+ /**
2536
+ * Configuration options for the {@link QualityLevels} plugin.
2537
+ * @beta
2538
+ */
2539
+ export declare interface QualityLevelsPluginSettings {
2540
+ /**
2541
+ * The maximum resolution to allow in the level selector.
2542
+ */
2543
+ restrictResolution?: number;
2544
+ /**
2545
+ * The labels to show in the level selector.
2546
+ * @example
2547
+ * ```ts
2548
+ * { 360: 'SD', 720: 'HD' }
2549
+ * ```
2550
+ */
2551
+ labels?: Record<number, string>;
2552
+ }
2553
+
2554
+ export { reportError_2 as reportError }
2555
+
2556
+ /**
2557
+ * `PLUGIN` that adds a seek time indicator when the mouse pointer is over the seek bar.
2558
+ * @beta
2559
+ * @remarks
2560
+ * Configuration options - {@link SeekTimeSettings}
2561
+ */
2562
+ export declare class SeekTime extends UICorePlugin {
2563
+ get name(): string;
2564
+ get supportedVersion(): {
2565
+ min: string;
2566
+ };
2567
+ private static readonly template;
2568
+ get attributes(): {
2569
+ class: string;
2570
+ };
2571
+ private get isLiveStreamWithDvr();
2572
+ private get showDuration();
2573
+ private hoveringOverSeekBar;
2574
+ private hoverPosition;
2575
+ private displayedDuration;
2576
+ private displayedSeekTime;
2577
+ private duration;
2578
+ /**
2579
+ * @internal
2580
+ */
2581
+ bindEvents(): void;
2582
+ private onCoreReady;
2583
+ private onContainerChanged;
2584
+ private onTimeUpdate;
2585
+ private showTime;
2586
+ private hideTime;
2587
+ private calculateHoverPosition;
2588
+ private getSeekTime;
2589
+ private update;
2590
+ private shouldBeVisible;
2591
+ /**
2592
+ * @internal
2593
+ */
2594
+ render(): this;
2595
+ private mount;
2596
+ }
2597
+
2598
+ /**
2599
+ * Configuration options for the SeekTime plugin.
2600
+ * @beta
2601
+ */
2602
+ export declare type SeekTimeSettings = {
2603
+ /**
2604
+ * Whether to show the duration of the video. Applies only to the VOD streams.
2605
+ * @beta
2606
+ */
2607
+ duration?: boolean;
2608
+ };
2609
+
2610
+ export { SentryTracer }
2611
+
2612
+ export { setTracer }
2613
+
2614
+ /**
2615
+ * `PLUGIN` that adds a share button to the media control UI.
2616
+ * @beta
2617
+ */
2618
+ export declare class Share extends UICorePlugin {
2619
+ private hide;
2620
+ private container;
2621
+ get name(): string;
2622
+ get supportedVersion(): {
2623
+ min: string;
2624
+ };
2625
+ get template(): any;
2626
+ get attributes(): {
2627
+ class: string;
2628
+ 'data-share': string;
2629
+ };
2630
+ get events(): {
2631
+ 'click [data-share-button]': string;
2632
+ 'click [data-share-close]': string;
2633
+ 'click [data-share-fb]': string;
2634
+ 'click [data-share-tw]': string;
2635
+ 'click [data-share-link]': string;
2636
+ 'click [data-share-embed]': string;
2637
+ };
2638
+ bindEvents(): void;
2639
+ unBindEvents(): void;
2640
+ canShowShare(): void;
2641
+ private onReady;
2642
+ render(): this;
2643
+ hideShare(): void;
2644
+ showShare(): void;
2645
+ initializeIcons(): void;
2646
+ onShareShow(): void;
2647
+ onShareHide(): void;
2648
+ onShareFB(): void;
2649
+ onShareTW(): void;
2650
+ onShareLinkClick(): void;
2651
+ onShareEmbedClick(): void;
2652
+ }
2653
+
2654
+ /**
2655
+ * `PLUGIN` that allows skipping time by tapping on the left or right side of the video.
2656
+ * @beta
2657
+ */
2658
+ export declare class SkipTime extends UICorePlugin {
2659
+ get name(): string;
2660
+ get supportedVersion(): {
2661
+ min: string;
2662
+ };
2663
+ get container(): any;
2664
+ private static readonly template;
2665
+ /**
2666
+ * @internal
2667
+ */
2668
+ get attributes(): {
2669
+ class: string;
2670
+ };
2671
+ private position;
2672
+ /**
2673
+ * @internal
2674
+ */
2675
+ get events(): {
2676
+ 'click #mc-skip-left': string;
2677
+ 'click #mc-skip-mid': string;
2678
+ 'click #mc-skip-right': string;
2679
+ };
2680
+ /**
2681
+ * @internal
2682
+ */
2683
+ bindEvents(): void;
2684
+ private onContainerChanged;
2685
+ private setBack;
2686
+ private handleRewindClicks;
2687
+ private handleSkip;
2688
+ private setMidClick;
2689
+ private setForward;
2690
+ private toggleFullscreen;
2691
+ /**
2692
+ * @internal
2693
+ */
2694
+ render(): this;
2695
+ private mount;
2696
+ }
2697
+
2698
+ /**
2699
+ * `PLUGIN` that is managing the automatic failover between media sources.
2700
+ * @public
2701
+ * @remarks
2702
+ * Have a look at the {@link https://miro.com/app/board/uXjVLiN15tY=/?share_link_id=390327585787 | source failover diagram} for the details
2703
+ * on how sources ordering and selection works. Below is a simplified diagram:
2704
+ *
2705
+ * ```markdown
2706
+ * sources_list:
2707
+ * - a.mpd | +--------------------+
2708
+ * - b.m3u8 |--->| init |
2709
+ * - ... | |--------------------|
2710
+ * | current_source = 0 |
2711
+ * +--------------------+
2712
+ * |
2713
+ * | source = a.mpd
2714
+ * | playback = dash.js
2715
+ * v
2716
+ * +------------------+
2717
+ * +-->| load source |
2718
+ * | +---------|--------+
2719
+ * | v
2720
+ * | +------------------+
2721
+ * | | play |
2722
+ * | +---------|--------+
2723
+ * | |
2724
+ * | v
2725
+ * | +-----------------------+
2726
+ * | | on playback_error |
2727
+ * | |-----------------------|
2728
+ * | | current_source = |
2729
+ * | | (current_source + 1) |
2730
+ * | | % len sources_list |
2731
+ * | | |
2732
+ * | | delay 1..3s |
2733
+ * | +---------------|-------+
2734
+ * | |
2735
+ * | source=b.m3u8 |
2736
+ * | playback=hls.js |
2737
+ * +-------------------+
2738
+ *
2739
+ * ```
2740
+ *
2741
+ * This plugin does not expose any public methods apart from required by the Clappr plugin interface.
2742
+ * It is supposed to work autonomously.
2743
+ *
2744
+ * @example
2745
+ * ```ts
2746
+ * import { SourceController } from '@gcorevideo/player'
2747
+ *
2748
+ * Player.registerPlugin(SourceController)
2749
+ * ```
2750
+ */
2751
+ export declare class SourceController extends CorePlugin {
2752
+ private sourcesList;
2753
+ private currentSourceIndex;
2754
+ private sourcesDelay;
2755
+ private active;
2756
+ private autoPlay;
2757
+ private switching;
2758
+ private sync;
2759
+ /**
2760
+ * @internal
2761
+ */
2762
+ get name(): string;
2763
+ /**
2764
+ * @internal
2765
+ */
2766
+ get supportedVersion(): {
2767
+ min: string;
2768
+ };
2769
+ /**
2770
+ * @param core - The Clappr core instance.
2771
+ */
2772
+ constructor(core: Core);
2773
+ /**
2774
+ * @internal
2775
+ */
2776
+ bindEvents(): void;
2777
+ private onCoreReady;
2778
+ private onActiveContainerChanged;
2779
+ private bindContainerEventListeners;
2780
+ private reset;
2781
+ private retryPlayback;
2782
+ private getNextMediaSource;
2783
+ /**
2784
+ * @internal
2785
+ */
2786
+ static get version(): string;
2787
+ }
2788
+
2789
+ /**
2790
+ * Custom events emitted by the plugin
2791
+ * @public
2792
+ */
2793
+ export declare enum SpinnerEvents {
2794
+ /**
2795
+ * Emitted at the end of the spinner animation cycle to facilitate smooth UI updates,
2796
+ * for instance, {@link SourceController} listens to this event to reload the source when the spinner is hidden
2797
+ */
2798
+ SYNC = "plugins:spinner:sync"
2799
+ }
2800
+
2801
+ /**
2802
+ * `PLUGIN` that shows a pending operation indicator when playback is buffering or in a similar state.
2803
+ * @public
2804
+ * @remarks
2805
+ * It is aliased as `Spinner` for convenience.
2806
+ * Events emitted - {@link SpinnerEvents}
2807
+ * Other plugins can use {@link SpinnerThreeBounce.show | show} and {@link SpinnerThreeBounce.hide | hide} methods to
2808
+ * implement custom pending/progress indication scenarios.
2809
+ */
2810
+ declare class SpinnerThreeBounce extends UIContainerPlugin {
2811
+ private userShown;
2812
+ /**
2813
+ * @internal
2814
+ */
2815
+ get name(): string;
2816
+ /**
2817
+ * @internal
2818
+ */
2819
+ get supportedVersion(): {
2820
+ min: string;
2821
+ };
2822
+ /**
2823
+ * @internal
2824
+ */
2825
+ get attributes(): {
2826
+ 'data-spinner': string;
2827
+ class: string;
2828
+ };
2829
+ private showTimeout;
2830
+ private template;
2831
+ private hasFatalError;
2832
+ private hasBuffering;
2833
+ constructor(container: Container);
2834
+ private onBuffering;
2835
+ private onBufferFull;
2836
+ private onPlay;
2837
+ private onStop;
2838
+ private onError;
2839
+ /**
2840
+ * Shows the spinner.
2841
+ *
2842
+ * The method call prevents spinner's built-in logic from automatically hiding it until {@link SpinnerThreeBounce.hide} is called
2843
+ *
2844
+ * @param delay - The delay in milliseconds before the spinner is shown.
2845
+ */
2846
+ show(delay?: number): void;
2847
+ /**
2848
+ * Hides the spinner.
2849
+ */
2850
+ hide(): void;
2851
+ private _show;
2852
+ private _hide;
2853
+ /**
2854
+ * @internal
2855
+ */
2856
+ render(): this;
2857
+ }
2858
+ export { SpinnerThreeBounce as Spinner }
2859
+ export { SpinnerThreeBounce }
2860
+
2861
+ /**
2862
+ * Playback stall event data
2863
+ * @beta
2864
+ */
2865
+ export declare interface StallEventData {
2866
+ event: TelemetryEvent.Stall;
2867
+ /**
2868
+ * Accumulated buffering duration over the measurement interval, ms
2869
+ */
2870
+ total_ms: number;
2871
+ /**
2872
+ * Number of stalls
2873
+ */
2874
+ count: number;
2875
+ /**
2876
+ * Playback time when the stall is reported at the end of a stall measurement interval, s
2877
+ */
2878
+ time: number;
2879
+ }
2880
+
2881
+ /**
2882
+ * Telemetry start event data
2883
+ * @beta
2884
+ */
2885
+ export declare interface StartEventData {
2886
+ event: TelemetryEvent.Start;
2887
+ }
2888
+
2889
+ /**
2890
+ * `PLUGIN` that collects and reports the performance statistics.
2891
+ * @beta
2892
+ * @remarks
2893
+ * This plugin is experimental and its API is likely to change.
2894
+ *
2895
+ * Configuration options {@link TelemetryPluginSettings}
2896
+ *
2897
+ * @example
2898
+ * ```ts
2899
+ * import { Statistics } from '@gcorevideo/player'
2900
+ *
2901
+ * Player.registerPlugin(Statistics)
2902
+ *
2903
+ * const player = new Player({
2904
+ * statistics: {
2905
+ * send: (data) => {
2906
+ * fetch('/stats', {
2907
+ * method: 'POST',
2908
+ * body: JSON.stringify(data),
2909
+ * headers: { 'content-type': 'application/json' },
2910
+ * })
2911
+ * },
2912
+ * },
2913
+ * ...
2914
+ * })
2915
+ * ```
2916
+ */
2917
+ export declare class Telemetry extends ContainerPlugin {
2918
+ /**
2919
+ * The name of the plugin.
2920
+ */
2921
+ get name(): string;
2922
+ /**
2923
+ * The supported version of the plugin.
2924
+ */
2925
+ get supportedVersion(): {
2926
+ min: string;
2927
+ };
2928
+ private started;
2929
+ private timeStart;
2930
+ private stallSent;
2931
+ private stallLastTime;
2932
+ private watchSent;
2933
+ private bufTracking;
2934
+ private numStalls;
2935
+ /**
2936
+ * The time when buffering last started.
2937
+ */
2938
+ private bufLastStarted;
2939
+ /**
2940
+ * The accumulated buffering duration.
2941
+ */
2942
+ private stallAcc;
2943
+ constructor(container: Container);
2944
+ /**
2945
+ * @internal
2946
+ */
2947
+ bindEvents(): void;
2948
+ private startLevelSwitch;
2949
+ private endLevelSwitch;
2950
+ private onBuffering;
2951
+ private onBufferFull;
2952
+ private onReady;
2953
+ private sendInit;
2954
+ private send;
2955
+ private sendStall;
2956
+ private onTimeUpdate;
2957
+ private onStart;
2958
+ }
2959
+
2960
+ /**
2961
+ * Telemetry event type
2962
+ * @beta
2963
+ */
2964
+ export declare enum TelemetryEvent {
2965
+ Init = 1,
2966
+ Start = 2,
2967
+ Watch = 3,
2968
+ Stall = 4
2969
+ }
2970
+
2971
+ /**
2972
+ * Telemetry event data
2973
+ * @beta
2974
+ */
2975
+ export declare type TelemetryEventData = StallEventData | InitEventData | StartEventData | WatchEventData;
2976
+
2977
+ /**
2978
+ * Plugin settings
2979
+ * @beta
2980
+ */
2981
+ export declare interface TelemetryPluginSettings {
2982
+ /**
2983
+ * Sends the statistics record to the storage.
2984
+ * The actual delivery is presumably async and batched.
2985
+ */
2986
+ send: TelemetrySendFn;
2987
+ }
2988
+
2989
+ /**
2990
+ * Telemetry record
2991
+ * @beta
2992
+ */
2993
+ export declare type TelemetryRecord = {
2994
+ type: PlaybackType;
2995
+ } & TelemetryEventData;
2996
+
2997
+ /**
2998
+ * Callback to send the telemetry record to the storage.
2999
+ * @param data - The telemetry record to send.
3000
+ * @beta
3001
+ */
3002
+ export declare type TelemetrySendFn = (data: TelemetryRecord) => void;
3003
+
3004
+ /**
3005
+ * `PLUGIN` that displays the thumbnails of the video when available.
3006
+ * @beta
3007
+ * @remarks
3008
+ * The plugin needs specially crafted VTT file with a thumbnail sprite sheet to work.
3009
+ * The VTT consist of timestamp records followed by a thumbnail area
3010
+ *
3011
+ * Configuration options - {@link ThumbnailsPluginSettings}
3012
+ *
3013
+ * @example
3014
+ * ```ts
3015
+ * import { Thumbnails } from '@gcorevideo/player'
3016
+ *
3017
+ * Player.registerPlugin(Thumbnails)
3018
+ *
3019
+ * new Player({
3020
+ * thumbnails: {
3021
+ * backdropHeight: 200,
3022
+ * backdropMinOpacity: 0.9,
3023
+ * backdropMaxOpacity: 0.99,
3024
+ * spotlightHeight: 100,
3025
+ * vtt: '1\n00:00:00,000 --> 00:00:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,0,100,56\n\n2\n00:00:10,000 --> 00:00:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,0,100,56\n\n3\n00:00:20,000 --> 00:00:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,0,100,56\n\n4\n00:00:30,000 --> 00:00:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,0,100,56\n\n5\n00:00:40,000 --> 00:00:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,0,100,56\n\n6\n00:00:50,000 --> 00:01:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,0,100,56\n\n7\n00:01:00,000 --> 00:01:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,0,100,56\n\n8\n00:01:10,000 --> 00:01:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,56,100,56\n\n9\n00:01:20,000 --> 00:01:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,56,100,56\n\n10\n00:01:30,000 --> 00:01:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,56,100,56\n\n11\n00:01:40,000 --> 00:01:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,56,100,56\n\n12\n00:01:50,000 --> 00:02:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,56,100,56\n\n13\n00:02:00,000 --> 00:02:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,56,100,56\n\n14\n00:02:10,000 --> 00:02:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,56,100,56\n\n15\n00:02:20,000 --> 00:02:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,112,100,56\n\n16\n00:02:30,000 --> 00:02:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,112,100,56\n\n17\n00:02:40,000 --> 00:02:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,112,100,56\n\n18\n00:02:50,000 --> 00:03:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,112,100,56\n\n19\n00:03:00,000 --> 00:03:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,112,100,56\n\n20\n00:03:10,000 --> 00:03:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,112,100,56\n\n21\n00:03:20,000 --> 00:03:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,112,100,56\n\n22\n00:03:30,000 --> 00:03:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,168,100,56\n\n23\n00:03:40,000 --> 00:03:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,168,100,56\n\n24\n00:03:50,000 --> 00:04:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,168,100,56\n\n25\n00:04:00,000 --> 00:04:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,168,100,56\n\n26\n00:04:10,000 --> 00:04:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,168,100,56\n\n27\n00:04:20,000 --> 00:04:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,168,100,56\n\n28\n00:04:30,000 --> 00:04:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,168,100,56\n\n29\n00:04:40,000 --> 00:04:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,224,100,56\n\n30\n00:04:50,000 --> 00:05:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,224,100,56\n\n31\n00:05:00,000 --> 00:05:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,224,100,56\n\n32\n00:05:10,000 --> 00:05:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,224,100,56\n\n33\n00:05:20,000 --> 00:05:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,224,100,56\n\n34\n00:05:30,000 --> 00:05:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,224,100,56\n\n35\n00:05:40,000 --> 00:05:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,224,100,56\n\n36\n00:05:50,000 --> 00:06:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,280,100,56\n\n37\n00:06:00,000 --> 00:06:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,280,100,56\n\n38\n00:06:10,000 --> 00:06:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,280,100,56\n\n39\n00:06:20,000 --> 00:06:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,280,100,56\n\n40\n00:06:30,000 --> 00:06:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,280,100,56\n\n41\n00:06:40,000 --> 00:06:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,280,100,56\n\n42\n00:06:50,000 --> 00:07:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,280,100,56\n\n43\n00:07:00,000 --> 00:07:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=0,336,100,56\n\n44\n00:07:10,000 --> 00:07:20,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=100,336,100,56\n\n45\n00:07:20,000 --> 00:07:30,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=200,336,100,56\n\n46\n00:07:30,000 --> 00:07:40,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=300,336,100,56\n\n47\n00:07:40,000 --> 00:07:50,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=400,336,100,56\n\n48\n00:07:50,000 --> 00:08:00,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=500,336,100,56\n\n49\n00:08:00,000 --> 00:08:10,000\n3dk4NsRt6vWsffEr_sprite.jpg#xywh=600,336,100,56\n',
3026
+ * sprite:
3027
+ * 'https://static.gvideo.co/videoplatform/sprites/2675/2452164_3dk4NsRt6vWsffEr.mp4_sprite.jpg',
3028
+ * },
3029
+ * })
3030
+ * ```
3031
+ */
3032
+ export declare class Thumbnails extends UICorePlugin {
3033
+ private $backdropCarouselImgs;
3034
+ private spriteSheetHeight;
3035
+ private spriteSheetWidth;
3036
+ private hoverPosition;
3037
+ private showing;
3038
+ private thumbsLoaded;
3039
+ private spotlightHeight;
3040
+ private backdropHeight;
3041
+ private thumbs;
3042
+ /**
3043
+ * @internal
3044
+ */
3045
+ get name(): string;
3046
+ /**
3047
+ * @internal
3048
+ */
3049
+ get supportedVersion(): {
3050
+ min: string;
3051
+ };
3052
+ /**
3053
+ * @internal
3054
+ */
3055
+ get attributes(): {
3056
+ class: string;
3057
+ };
3058
+ private static readonly template;
3059
+ constructor(core: Core);
3060
+ private buildSpriteConfig;
3061
+ /**
3062
+ * @internal
3063
+ */
3064
+ bindEvents(): void;
3065
+ private bindContainerEvents;
3066
+ private onCoreReady;
3067
+ private loadSpriteSheet;
3068
+ private onContainerChanged;
3069
+ private init;
3070
+ private mount;
3071
+ private onMouseMoveSeekbar;
3072
+ private onMouseLeave;
3073
+ private buildThumbImage;
3074
+ private loadBackdrop;
3075
+ private setText;
3076
+ private updateCarousel;
3077
+ private updateSpotlightThumb;
3078
+ private getThumbIndexForTime;
3079
+ private update;
3080
+ private fixElements;
3081
+ private get shouldRender();
3082
+ render(): this;
3083
+ }
3084
+
3085
+ /**
3086
+ * Plugin configuration options for the thumbnails plugin.
3087
+ * @beta
3088
+ */
3089
+ export declare type ThumbnailsPluginSettings = {
3090
+ backdropHeight?: number;
3091
+ backdropMaxOpacity?: number;
3092
+ backdropMinOpacity?: number;
3093
+ spotlightHeight?: number;
3094
+ sprite: string;
3095
+ vtt: string;
3096
+ };
3097
+
3098
+ /**
3099
+ * Current playback time and total duration of the media.
3100
+ * @public
3101
+ */
3102
+ export declare interface TimePosition {
3103
+ /**
3104
+ * Current playback time, 0..duration
3105
+ */
3106
+ current: TimeValue;
3107
+ /**
3108
+ * Total duration of the media content (or DVR window size or segment duration for live streams)
3109
+ */
3110
+ total: TimeValue;
3111
+ }
3112
+
3113
+ /**
3114
+ * Time progress information indicated by Clappr CONTAINER_PROGRESS and PLAYBACK_PROGRESS events.
3115
+ * @beta
3116
+ */
3117
+ export declare type TimeProgress = {
3118
+ /**
3119
+ * Current playback time
3120
+ */
3121
+ start: TimeValue;
3122
+ /**
3123
+ * Current buffer length beginning from the start (=current) time
3124
+ */
3125
+ current: TimeValue;
3126
+ /**
3127
+ * Total duration of the media content
3128
+ */
3129
+ total: TimeValue;
3130
+ };
3131
+
3132
+ /**
3133
+ * For the plugin development
3134
+ * @beta
3135
+ * @deprecated Use TimePosition instead
3136
+ */
3137
+ export declare type TimeUpdate = TimePosition;
3138
+
3139
+ /**
3140
+ * Playback time position in seconds since the beginning of the stream.
3141
+ * For the live streams this is limited to the length of a segment. When DVR is enabled, this refers to the
3142
+ * @public
3143
+ */
3144
+ export declare type TimeValue = number;
3145
+
3146
+ export { trace }
3147
+
3148
+ /**
3149
+ * @public
3150
+ */
3151
+ export declare type TranslationKey = string;
3152
+
3153
+ /**
3154
+ * Localization strings for the player UI.
3155
+ * @remarks
3156
+ * The keys are language codes, and the values are objects with keys being the translation keys and values being the translations.
3157
+ *
3158
+ * This dictionary is used to localize the player UI, including the error messages and is shared across all the player components (including the plugins).
3159
+ *
3160
+ * @example
3161
+ * ```
3162
+ * {
3163
+ * en: {
3164
+ * play: 'Play',
3165
+ * ...
3166
+ * },
3167
+ * es: {
3168
+ * play: 'Reproducir',
3169
+ * ...
3170
+ * },
3171
+ * ...
3172
+ * }
3173
+ * ```
3174
+ *
3175
+ * @public
3176
+ */
3177
+ export declare type TranslationSettings = Partial<Record<LangTag, Record<TranslationKey, string>>>;
3178
+
3179
+ /**
3180
+ * Preferred streaming media delivery protocol
3181
+ * @public
3182
+ */
3183
+ export declare type TransportPreference = 'dash' | 'hls';
3184
+
3185
+ /**
3186
+ * Version information about the gplayer and its main dependencies
3187
+ * @returns Version information about the gplayer and its main dependencies
3188
+ * @beta
3189
+ */
3190
+ export declare function version(): {
3191
+ gplayer: string;
3192
+ clappr: string;
3193
+ dashjs: string;
3194
+ hlsjs: string;
3195
+ };
3196
+
3197
+ /**
3198
+ * `PLUGIN` that mutes the sound and fades it in when the mouse is over the player.
3199
+ * @beta
3200
+ *
3201
+ * @remarks
3202
+ * When the user moves the mouse over and away from the player, the sound is unmuted and unmuted with a fade effect.
3203
+ *
3204
+ * Depends on {@link MediaControl} plugin.
3205
+ * Configuration options - {@link VolumeFadeSettings}
3206
+ */
3207
+ export declare class VolumeFade extends UICorePlugin {
3208
+ private activeVolume;
3209
+ private duration;
3210
+ private timerId;
3211
+ /**
3212
+ * @internal
3213
+ */
3214
+ get name(): string;
3215
+ constructor(core: Core);
3216
+ /**
3217
+ * @internal
3218
+ */
3219
+ bindEvents(): void;
3220
+ private onCoreReady;
3221
+ private onVolumeChange;
3222
+ private onEnter;
3223
+ private onLeave;
3224
+ private fade;
3225
+ private stopFade;
3226
+ }
3227
+
3228
+ /**
3229
+ * Events emitted by the VolumeFade plugin.
3230
+ * @beta
3231
+ */
3232
+ export declare enum VolumeFadeEvents {
3233
+ FADE = "core:volume:fade"
3234
+ }
3235
+
3236
+ /**
3237
+ * @beta
3238
+ */
3239
+ export declare type VolumeFadeSettings = {
3240
+ /**
3241
+ * Initial active volume level, effective until volume is changed via media control
3242
+ */
3243
+ level?: number;
3244
+ /**
3245
+ * Fade duration, ms
3246
+ */
3247
+ duration?: number;
3248
+ };
3249
+
3250
+ /**
3251
+ * Telemetry watch event data
3252
+ * @beta
3253
+ */
3254
+ export declare interface WatchEventData {
3255
+ event: TelemetryEvent.Watch;
3256
+ }
3257
+
3258
+ /**
3259
+ * {@link https://zeptojs.com/#$() | Zepto query result}
3260
+ * @beta
3261
+ */
3262
+ export declare type ZeptoResult = ReturnType<typeof $>;
3263
+
3264
+ export { }