@cloudnest/redxplyr 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.editorconfig +10 -0
  2. package/.gitpod.yml +6 -0
  3. package/.node-version +1 -0
  4. package/.prettierrc +7 -0
  5. package/.stickler.yml +5 -0
  6. package/.stylelintrc.json +26 -0
  7. package/CHANGELOG.md +16 -0
  8. package/CONTRIBUTING.md +34 -0
  9. package/CONTROLS.md +49 -0
  10. package/Dockerfile +32 -0
  11. package/LICENSE.md +22 -0
  12. package/README.md +194 -0
  13. package/cspell.json +48 -0
  14. package/dist/redxplyr.css +1 -0
  15. package/dist/redxplyr.js +8801 -0
  16. package/dist/redxplyr.min.js +2 -0
  17. package/dist/redxplyr.min.js.map +1 -0
  18. package/dist/redxplyr.min.mjs +1 -0
  19. package/dist/redxplyr.min.mjs.map +1 -0
  20. package/dist/redxplyr.mjs +8793 -0
  21. package/dist/redxplyr.polyfilled.js +9294 -0
  22. package/dist/redxplyr.polyfilled.min.js +2 -0
  23. package/dist/redxplyr.polyfilled.min.js.map +1 -0
  24. package/dist/redxplyr.polyfilled.min.mjs +1 -0
  25. package/dist/redxplyr.polyfilled.min.mjs.map +1 -0
  26. package/dist/redxplyr.polyfilled.mjs +9286 -0
  27. package/dist/redxplyr.svg +1 -0
  28. package/eslint.config.mjs +39 -0
  29. package/gulpfile.js +8 -0
  30. package/package.json +114 -0
  31. package/pnpm-workspace.yaml +8 -0
  32. package/src/js/captions.js +411 -0
  33. package/src/js/config/defaults.js +459 -0
  34. package/src/js/config/states.js +10 -0
  35. package/src/js/config/types.js +34 -0
  36. package/src/js/console.js +28 -0
  37. package/src/js/controls.js +1870 -0
  38. package/src/js/fullscreen.js +305 -0
  39. package/src/js/html5.js +148 -0
  40. package/src/js/listeners.js +854 -0
  41. package/src/js/media.js +61 -0
  42. package/src/js/plugins/ads.js +647 -0
  43. package/src/js/plugins/preview-thumbnails.js +706 -0
  44. package/src/js/plugins/vimeo.js +443 -0
  45. package/src/js/plugins/youtube.js +451 -0
  46. package/src/js/plyr.d.ts +729 -0
  47. package/src/js/plyr.js +1291 -0
  48. package/src/js/plyr.polyfilled.js +13 -0
  49. package/src/js/source.js +155 -0
  50. package/src/js/storage.js +70 -0
  51. package/src/js/support.js +100 -0
  52. package/src/js/ui.js +297 -0
  53. package/src/js/utils/animation.js +33 -0
  54. package/src/js/utils/arrays.js +23 -0
  55. package/src/js/utils/browser.js +21 -0
  56. package/src/js/utils/elements.js +263 -0
  57. package/src/js/utils/events.js +116 -0
  58. package/src/js/utils/fetch.js +45 -0
  59. package/src/js/utils/i18n.js +47 -0
  60. package/src/js/utils/is.js +81 -0
  61. package/src/js/utils/load-image.js +19 -0
  62. package/src/js/utils/load-script.js +14 -0
  63. package/src/js/utils/load-sprite.js +77 -0
  64. package/src/js/utils/numbers.js +17 -0
  65. package/src/js/utils/objects.js +43 -0
  66. package/src/js/utils/promise.js +14 -0
  67. package/src/js/utils/strings.js +80 -0
  68. package/src/js/utils/style.js +148 -0
  69. package/src/js/utils/time.js +36 -0
  70. package/src/js/utils/urls.js +40 -0
  71. package/src/sass/base.scss +69 -0
  72. package/src/sass/components/badges.scss +12 -0
  73. package/src/sass/components/captions.scss +58 -0
  74. package/src/sass/components/control.scss +52 -0
  75. package/src/sass/components/controls.scss +65 -0
  76. package/src/sass/components/menus.scss +205 -0
  77. package/src/sass/components/poster.scss +27 -0
  78. package/src/sass/components/progress.scss +107 -0
  79. package/src/sass/components/sliders.scss +99 -0
  80. package/src/sass/components/times.scss +20 -0
  81. package/src/sass/components/tooltips.scss +91 -0
  82. package/src/sass/components/volume.scss +18 -0
  83. package/src/sass/lib/animation.scss +31 -0
  84. package/src/sass/lib/css-vars.scss +103 -0
  85. package/src/sass/lib/functions.scss +3 -0
  86. package/src/sass/lib/mixins.scss +82 -0
  87. package/src/sass/plugins/ads.scss +53 -0
  88. package/src/sass/plugins/preview-thumbnails/index.scss +121 -0
  89. package/src/sass/plugins/preview-thumbnails/settings.scss +17 -0
  90. package/src/sass/plyr.scss +46 -0
  91. package/src/sass/settings/badges.scss +7 -0
  92. package/src/sass/settings/breakpoints.scss +9 -0
  93. package/src/sass/settings/captions.scss +10 -0
  94. package/src/sass/settings/colors.scss +18 -0
  95. package/src/sass/settings/controls.scss +30 -0
  96. package/src/sass/settings/cosmetics.scss +5 -0
  97. package/src/sass/settings/helpers.scss +7 -0
  98. package/src/sass/settings/menus.scss +13 -0
  99. package/src/sass/settings/progress.scss +18 -0
  100. package/src/sass/settings/sliders.scss +39 -0
  101. package/src/sass/settings/tooltips.scss +11 -0
  102. package/src/sass/settings/type.scss +16 -0
  103. package/src/sass/states/fullscreen.scss +15 -0
  104. package/src/sass/types/audio.scss +61 -0
  105. package/src/sass/types/video.scss +170 -0
  106. package/src/sass/utils/animation.scss +7 -0
  107. package/src/sass/utils/hidden.scss +28 -0
  108. package/src/sprite/plyr-airplay.svg +8 -0
  109. package/src/sprite/plyr-captions-off.svg +7 -0
  110. package/src/sprite/plyr-captions-on.svg +7 -0
  111. package/src/sprite/plyr-download.svg +8 -0
  112. package/src/sprite/plyr-enter-fullscreen.svg +4 -0
  113. package/src/sprite/plyr-exit-fullscreen.svg +4 -0
  114. package/src/sprite/plyr-fast-forward.svg +3 -0
  115. package/src/sprite/plyr-logo-vimeo.svg +6 -0
  116. package/src/sprite/plyr-logo-youtube.svg +6 -0
  117. package/src/sprite/plyr-muted.svg +8 -0
  118. package/src/sprite/plyr-pause.svg +8 -0
  119. package/src/sprite/plyr-pip.svg +6 -0
  120. package/src/sprite/plyr-play.svg +5 -0
  121. package/src/sprite/plyr-restart.svg +5 -0
  122. package/src/sprite/plyr-rewind.svg +3 -0
  123. package/src/sprite/plyr-settings.svg +5 -0
  124. package/src/sprite/plyr-volume.svg +11 -0
  125. package/tasks/build.js +226 -0
  126. package/tasks/deploy.js +216 -0
  127. package/tasks/utils/publish.js +34 -0
@@ -0,0 +1,729 @@
1
+ // Type definitions for redxplyr 3.8
2
+ // Project: https://redxplyr.flyingdarkdev.com
3
+ // Definitions by: ondratra <https://github.com/ondratra>
4
+ // TypeScript Version: 3.0
5
+
6
+
7
+
8
+ declare class Plyr {
9
+ /**
10
+ * Setup a new instance
11
+ */
12
+ static setup(targets: NodeList | HTMLElement | HTMLElement[] | string, options?: Plyr.Options): Plyr[];
13
+
14
+ /**
15
+ * Check for support
16
+ * @param mediaType
17
+ * @param provider
18
+ * @param playsInline Whether the player has the playsinline attribute (only applicable to iOS 10+)
19
+ */
20
+ static supported(mediaType?: Plyr.MediaType, provider?: Plyr.Provider, playsInline?: boolean): Plyr.Support;
21
+
22
+ constructor(targets: NodeList | HTMLElement | HTMLElement[] | string, options?: Plyr.Options);
23
+
24
+ /**
25
+ * Indicates if the current player is HTML5.
26
+ */
27
+ readonly isHTML5: boolean;
28
+
29
+ /**
30
+ * Indicates if the current player is an embedded player.
31
+ */
32
+ readonly isEmbed: boolean;
33
+
34
+ /**
35
+ * Indicates if the current player is playing.
36
+ */
37
+ readonly playing: boolean;
38
+
39
+ /**
40
+ * Indicates if the current player is paused.
41
+ */
42
+ readonly paused: boolean;
43
+
44
+ /**
45
+ * Indicates if the current player is stopped.
46
+ */
47
+ readonly stopped: boolean;
48
+
49
+ /**
50
+ * Indicates if the current player has finished playback.
51
+ */
52
+ readonly ended: boolean;
53
+
54
+ /**
55
+ * Returns a float between 0 and 1 indicating how much of the media is buffered
56
+ */
57
+ readonly buffered: number;
58
+
59
+ /**
60
+ * Gets or sets the currentTime for the player. The setter accepts a float in seconds.
61
+ */
62
+ currentTime: number;
63
+
64
+ /**
65
+ * Indicates if the current player is seeking.
66
+ */
67
+ readonly seeking: boolean;
68
+
69
+ /**
70
+ * Returns the duration for the current media.
71
+ */
72
+ readonly duration: number;
73
+
74
+ /**
75
+ * Gets or sets the volume for the player. The setter accepts a float between 0 and 1.
76
+ */
77
+ volume: number;
78
+
79
+ /**
80
+ * Gets or sets the muted state of the player. The setter accepts a boolean.
81
+ */
82
+ muted: boolean;
83
+
84
+ /**
85
+ * Indicates if the current media has an audio track.
86
+ */
87
+ readonly hasAudio: boolean;
88
+
89
+ /**
90
+ * Gets or sets the speed for the player. The setter accepts a value in the options specified in your config. Generally the minimum should be 0.5.
91
+ */
92
+ speed: number;
93
+
94
+ /**
95
+ * Gets or sets the quality for the player. The setter accepts a value from the options specified in your config.
96
+ */
97
+ quality: number;
98
+
99
+ /**
100
+ * Gets or sets the current loop state of the player.
101
+ */
102
+ loop: boolean;
103
+
104
+ /**
105
+ * Gets or sets the current source for the player.
106
+ */
107
+ source: Plyr.SourceInfo;
108
+
109
+ /**
110
+ * Gets or sets the current poster image URL for the player.
111
+ */
112
+ poster: string;
113
+
114
+ /**
115
+ * Gets or sets the autoplay state of the player.
116
+ */
117
+ autoplay: boolean;
118
+
119
+ /**
120
+ * Gets or sets the caption track by index. 1 means the track is missing or captions is not active
121
+ */
122
+ currentTrack: number;
123
+
124
+ /**
125
+ * Gets or sets the preferred captions language for the player. The setter accepts an ISO twoletter language code. Support for the languages is dependent on the captions you include.
126
+ * If your captions don't have any language data, or if you have multiple tracks with the same language, you may want to use currentTrack instead.
127
+ */
128
+ language: string;
129
+
130
+ /**
131
+ * Gets or sets the picture-in-picture state of the player. This currently only supported on Safari 10+ on MacOS Sierra+ and iOS 10+.
132
+ */
133
+ pip: boolean;
134
+
135
+ /**
136
+ * Gets or sets the aspect ratio for embedded players.
137
+ */
138
+ ratio?: string;
139
+
140
+ /**
141
+ * Access Elements cache
142
+ */
143
+ elements: Plyr.Elements;
144
+
145
+ /**
146
+ * Returns the current video Provider
147
+ */
148
+ readonly provider: Plyr.Provider;
149
+
150
+ /**
151
+ * Returns the native API for Vimeo or Youtube players
152
+ */
153
+ readonly embed?: any;
154
+
155
+ readonly fullscreen: Plyr.FullscreenControl;
156
+
157
+ /**
158
+ * Start playback.
159
+ * For HTML5 players, play() will return a Promise in some browsers - WebKit and Mozilla according to MDN at time of writing.
160
+ */
161
+ play(): Promise<void> | void;
162
+
163
+ /**
164
+ * Pause playback.
165
+ */
166
+ pause(): void;
167
+
168
+ /**
169
+ * Toggle playback, if no parameters are passed, it will toggle based on current status.
170
+ */
171
+ togglePlay(toggle?: boolean): boolean;
172
+
173
+ /**
174
+ * Stop playback and reset to start.
175
+ */
176
+ stop(): void;
177
+
178
+ /**
179
+ * Restart playback.
180
+ */
181
+ restart(): void;
182
+
183
+ /**
184
+ * Rewind playback by the specified seek time. If no parameter is passed, the default seek time will be used.
185
+ */
186
+ rewind(seekTime?: number): void;
187
+
188
+ /**
189
+ * Fast forward by the specified seek time. If no parameter is passed, the default seek time will be used.
190
+ */
191
+ forward(seekTime?: number): void;
192
+
193
+ /**
194
+ * Increase volume by the specified step. If no parameter is passed, the default step will be used.
195
+ */
196
+ increaseVolume(step?: number): void;
197
+
198
+ /**
199
+ * Increase volume by the specified step. If no parameter is passed, the default step will be used.
200
+ */
201
+ decreaseVolume(step?: number): void;
202
+
203
+ /**
204
+ * Toggle captions display. If no parameter is passed, it will toggle based on current status.
205
+ */
206
+ toggleCaptions(toggle?: boolean): void;
207
+
208
+ /**
209
+ * Trigger the airplay dialog on supported devices.
210
+ */
211
+ airplay(): void;
212
+
213
+ /**
214
+ * Sets the preview thumbnails for the current source.
215
+ */
216
+ setPreviewThumbnails(source: Plyr.PreviewThumbnailsOptions): void;
217
+
218
+ /**
219
+ * Toggle the controls (video only). Takes optional truthy value to force it on/off.
220
+ */
221
+ toggleControls(toggle: boolean): void;
222
+
223
+ /**
224
+ * Add an event listener for the specified event.
225
+ */
226
+ on<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
227
+
228
+ /**
229
+ * Add an event listener for the specified event once.
230
+ */
231
+ once<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
232
+
233
+ /**
234
+ * Remove an event listener for the specified event.
235
+ */
236
+ off<K extends keyof Plyr.PlyrEventMap>(event: K, callback: (this: this, event: Plyr.PlyrEventMap[K]) => void): void;
237
+
238
+ /**
239
+ * Check support for a mime type.
240
+ */
241
+ supports(type: string): boolean;
242
+
243
+ /**
244
+ * Destroy lib instance
245
+ * @param {Function} callback - Callback for when destroy is complete
246
+ * @param {Boolean} soft - Whether it's a soft destroy (for source changes etc)
247
+ */
248
+ destroy(callback?: (...args: any[]) => void, soft?: boolean): void;
249
+ }
250
+
251
+ declare namespace Plyr {
252
+ type MediaType = 'audio' | 'video';
253
+ type Provider = 'html5' | 'youtube' | 'vimeo';
254
+ type StandardEventMap = {
255
+ progress: PlyrEvent;
256
+ playing: PlyrEvent;
257
+ play: PlyrEvent;
258
+ pause: PlyrEvent;
259
+ timeupdate: PlyrEvent;
260
+ volumechange: PlyrEvent;
261
+ seeking: PlyrEvent;
262
+ seeked: PlyrEvent;
263
+ ratechange: PlyrEvent;
264
+ ended: PlyrEvent;
265
+ enterfullscreen: PlyrEvent;
266
+ exitfullscreen: PlyrEvent;
267
+ captionsenabled: PlyrEvent;
268
+ captionsdisabled: PlyrEvent;
269
+ languagechange: PlyrEvent;
270
+ controlshidden: PlyrEvent;
271
+ controlsshown: PlyrEvent;
272
+ ready: PlyrEvent;
273
+ };
274
+ // For retrocompatibility, we keep StandardEvent
275
+ type StandardEvent = keyof Plyr.StandardEventMap;
276
+ type Html5EventMap = {
277
+ loadstart: PlyrEvent;
278
+ loadeddata: PlyrEvent;
279
+ loadedmetadata: PlyrEvent;
280
+ canplay: PlyrEvent;
281
+ canplaythrough: PlyrEvent;
282
+ stalled: PlyrEvent;
283
+ waiting: PlyrEvent;
284
+ emptied: PlyrEvent;
285
+ cuechange: PlyrEvent;
286
+ error: PlyrEvent;
287
+ };
288
+ // For retrocompatibility, we keep Html5Event
289
+ type Html5Event = keyof Plyr.Html5EventMap;
290
+ type YoutubeEventMap = {
291
+ statechange: PlyrStateChangeEvent;
292
+ qualitychange: PlyrEvent;
293
+ qualityrequested: PlyrEvent;
294
+ };
295
+ // For retrocompatibility, we keep YoutubeEvent
296
+ type YoutubeEvent = keyof Plyr.YoutubeEventMap;
297
+
298
+ type PlyrEventMap = StandardEventMap & Html5EventMap & YoutubeEventMap;
299
+
300
+ interface FullscreenControl {
301
+ /**
302
+ * Indicates if the current player is in fullscreen mode.
303
+ */
304
+ readonly active: boolean;
305
+
306
+ /**
307
+ * Indicates if the current player has fullscreen enabled.
308
+ */
309
+ readonly enabled: boolean;
310
+
311
+ /**
312
+ * Enter fullscreen. If fullscreen is not supported, a fallback ""full window/viewport"" is used instead.
313
+ */
314
+ enter(): void;
315
+
316
+ /**
317
+ * Exit fullscreen.
318
+ */
319
+ exit(): void;
320
+
321
+ /**
322
+ * Toggle fullscreen.
323
+ */
324
+ toggle(): void;
325
+ }
326
+
327
+ interface Options {
328
+ /**
329
+ * Completely disable Plyr. This would allow you to do a User Agent check or similar to programmatically enable or disable Plyr for a certain UA. Example below.
330
+ */
331
+ enabled?: boolean;
332
+
333
+ /**
334
+ * Display debugging information in the console
335
+ */
336
+ debug?: boolean;
337
+
338
+ /**
339
+ * If a function is passed, it is assumed your method will return either an element or HTML string for the controls. Three arguments will be passed to your function;
340
+ * id (the unique id for the player), seektime (the seektime step in seconds), and title (the media title). See CONTROLS.md for more info on how the html needs to be structured.
341
+ * Defaults to ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'settings', 'pip', 'airplay', 'fullscreen']
342
+ */
343
+ controls?: string | string[] | ((id: string, seektime: number, title: string) => unknown) | Element;
344
+
345
+ /**
346
+ * If you're using the default controls are used then you can specify which settings to show in the menu
347
+ * Defaults to ['captions', 'quality', 'speed', 'loop']
348
+ */
349
+ settings?: string[];
350
+
351
+ /**
352
+ * Used for internationalization (i18n) of the text within the UI.
353
+ */
354
+ i18n?: any;
355
+
356
+ /**
357
+ * Load the SVG sprite specified as the iconUrl option (if a URL). If false, it is assumed you are handling sprite loading yourself.
358
+ */
359
+ loadSprite?: boolean;
360
+
361
+ /**
362
+ * Specify a URL or path to the SVG sprite. See the SVG section for more info.
363
+ */
364
+ iconUrl?: string;
365
+
366
+ /**
367
+ * Specify the id prefix for the icons used in the default controls (e.g. plyr-play would be plyr).
368
+ * This is to prevent clashes if you're using your own SVG sprite but with the default controls.
369
+ * Most people can ignore this option.
370
+ */
371
+ iconPrefix?: string;
372
+
373
+ /**
374
+ * Specify a URL or path to a blank video file used to properly cancel network requests.
375
+ */
376
+ blankVideo?: string;
377
+
378
+ /**
379
+ * Autoplay the media on load. This is generally advised against on UX grounds. It is also disabled by default in some browsers.
380
+ * If the autoplay attribute is present on a <video> or <audio> element, this will be automatically set to true.
381
+ */
382
+ autoplay?: boolean;
383
+
384
+ /**
385
+ * Only allow one player playing at once.
386
+ */
387
+ autopause?: boolean;
388
+
389
+ /**
390
+ * The time, in seconds, to seek when a user hits fast forward or rewind.
391
+ */
392
+ seekTime?: number;
393
+
394
+ /**
395
+ * A number, between 0 and 1, representing the initial volume of the player.
396
+ */
397
+ volume?: number;
398
+
399
+ /**
400
+ * Whether to start playback muted. If the muted attribute is present on a <video> or <audio> element, this will be automatically set to true.
401
+ */
402
+ muted?: boolean;
403
+
404
+ /**
405
+ * Click (or tap) of the video container will toggle play/pause.
406
+ */
407
+ clickToPlay?: boolean;
408
+
409
+ /**
410
+ * Disable right click menu on video to help as very primitive obfuscation to prevent downloads of content.
411
+ */
412
+ disableContextMenu?: boolean;
413
+
414
+ /**
415
+ * Hide video controls automatically after 2s of no mouse or focus movement, on control element blur (tab out), on playback start or entering fullscreen.
416
+ * As soon as the mouse is moved, a control element is focused or playback is paused, the controls reappear instantly.
417
+ */
418
+ hideControls?: boolean;
419
+
420
+ /**
421
+ * Reset the playback to the start once playback is complete.
422
+ */
423
+ resetOnEnd?: boolean;
424
+
425
+ /**
426
+ * Enable keyboard shortcuts for focused players only or globally
427
+ */
428
+ keyboard?: KeyboardOptions;
429
+
430
+ /**
431
+ * controls: Display control labels as tooltips on :hover & :focus (by default, the labels are screen reader only).
432
+ * seek: Display a seek tooltip to indicate on click where the media would seek to.
433
+ */
434
+ tooltips?: TooltipOptions;
435
+
436
+ /**
437
+ * Specify a custom duration for media.
438
+ */
439
+ duration?: number;
440
+
441
+ /**
442
+ * Displays the duration of the media on the metadataloaded event (on startup) in the current time display.
443
+ * This will only work if the preload attribute is not set to none (or is not set at all) and you choose not to display the duration (see controls option).
444
+ */
445
+ displayDuration?: boolean;
446
+
447
+ /**
448
+ * Display the current time as a countdown rather than an incremental counter.
449
+ */
450
+ invertTime?: boolean;
451
+
452
+ /**
453
+ * Allow users to click to toggle the above.
454
+ */
455
+ toggleInvert?: boolean;
456
+
457
+ /**
458
+ * Allows binding of event listeners to the controls before the default handlers. See the defaults.js for available listeners.
459
+ * If your handler prevents default on the event (event.preventDefault()), the default handler will not fire.
460
+ */
461
+ listeners?: { [key: string]: (error: PlyrEvent) => void };
462
+
463
+ /**
464
+ * active: Toggles if captions should be active by default. language: Sets the default language to load (if available). 'auto' uses the browser language.
465
+ * update: Listen to changes to tracks and update menu. This is needed for some streaming libraries, but can result in unselectable language options).
466
+ */
467
+ captions?: CaptionOptions;
468
+
469
+ /**
470
+ * enabled: Toggles whether fullscreen should be enabled. fallback: Allow fallback to a full-window solution.
471
+ * iosNative: whether to use native iOS fullscreen when entering fullscreen (no custom controls)
472
+ */
473
+ fullscreen?: FullScreenOptions;
474
+
475
+ /**
476
+ * The aspect ratio you want to use for embedded players.
477
+ */
478
+ ratio?: string;
479
+
480
+ /**
481
+ * enabled: Allow use of local storage to store user settings. key: The key name to use.
482
+ */
483
+ storage?: StorageOptions;
484
+
485
+ /**
486
+ * selected: The default speed for playback. options: The speed options to display in the UI. YouTube and Vimeo will ignore any options outside of the 0.5-2 range, so options outside of this range will be hidden automatically.
487
+ */
488
+ speed?: SpeedOptions;
489
+
490
+ /**
491
+ * Currently only supported by YouTube. default is the default quality level, determined by YouTube. options are the options to display.
492
+ */
493
+ quality?: QualityOptions;
494
+
495
+ /**
496
+ * active: Whether to loop the current video. If the loop attribute is present on a <video> or <audio> element,
497
+ * this will be automatically set to true This is an object to support future functionality.
498
+ */
499
+ loop?: LoopOptions;
500
+
501
+ /**
502
+ * enabled: Whether to enable vi.ai ads. publisherId: Your unique vi.ai publisher ID.
503
+ */
504
+ ads?: AdOptions;
505
+
506
+ /**
507
+ * Vimeo Player Options.
508
+ */
509
+ vimeo?: object;
510
+
511
+ /**
512
+ * Youtube Player Options.
513
+ */
514
+ youtube?: object;
515
+
516
+ /**
517
+ * Preview Thumbnails Options.
518
+ */
519
+ previewThumbnails?: PreviewThumbnailsOptions;
520
+
521
+ /**
522
+ * Media Metadata Options.
523
+ */
524
+ mediaMetadata?: MediaMetadataOptions;
525
+
526
+ /**
527
+ * Markers Options
528
+ */
529
+ markers?: MarkersOptions;
530
+ }
531
+
532
+ interface QualityOptions {
533
+ default: number;
534
+ forced?: boolean;
535
+ onChange?: (quality: number) => void;
536
+ options: number[];
537
+ }
538
+
539
+ interface LoopOptions {
540
+ active: boolean;
541
+ }
542
+
543
+ interface AdOptions {
544
+ enabled: boolean;
545
+ publisherId?: string;
546
+ tagUrl?: string;
547
+ }
548
+
549
+ interface SpeedOptions {
550
+ selected: number;
551
+ options: number[];
552
+ }
553
+
554
+ interface KeyboardOptions {
555
+ focused?: boolean;
556
+ global?: boolean;
557
+ }
558
+
559
+ interface TooltipOptions {
560
+ controls?: boolean;
561
+ seek?: boolean;
562
+ }
563
+
564
+ interface FullScreenOptions {
565
+ enabled?: boolean;
566
+ fallback?: boolean | 'force';
567
+ iosNative?: boolean;
568
+ container?: string;
569
+ }
570
+
571
+ interface CaptionOptions {
572
+ active?: boolean;
573
+ language?: string;
574
+ update?: boolean;
575
+ }
576
+
577
+ interface StorageOptions {
578
+ enabled?: boolean;
579
+ key?: string;
580
+ }
581
+
582
+ interface PreviewThumbnailsOptions {
583
+ enabled?: boolean;
584
+ src?: string | string[];
585
+ withCredentials?: boolean;
586
+ }
587
+
588
+ interface MediaMetadataArtwork {
589
+ src: string;
590
+ sizes?: string;
591
+ type: string;
592
+ }
593
+
594
+ interface MediaMetadataOptions {
595
+ title?: string;
596
+ artist?: string;
597
+ album?: string;
598
+ artwork?: MediaMetadataArtwork[];
599
+ }
600
+
601
+ interface MarkersPoints {
602
+ time: number;
603
+ label: string;
604
+ }
605
+
606
+ interface MarkersOptions {
607
+ enabled: boolean;
608
+ points: MarkersPoints[];
609
+ }
610
+
611
+ export interface Elements {
612
+ buttons: {
613
+ airplay?: HTMLButtonElement;
614
+ captions?: HTMLButtonElement;
615
+ download?: HTMLButtonElement;
616
+ fastForward?: HTMLButtonElement;
617
+ fullscreen?: HTMLButtonElement;
618
+ mute?: HTMLButtonElement;
619
+ pip?: HTMLButtonElement;
620
+ play?: HTMLButtonElement | HTMLButtonElement[];
621
+ restart?: HTMLButtonElement;
622
+ rewind?: HTMLButtonElement;
623
+ settings?: HTMLButtonElement;
624
+ };
625
+ captions: HTMLElement | null;
626
+ container: HTMLElement | null;
627
+ controls: HTMLElement | null;
628
+ fullscreen: HTMLElement | null;
629
+ wrapper: HTMLElement | null;
630
+ }
631
+
632
+ interface SourceInfo {
633
+ /**
634
+ * Note: YouTube and Vimeo are currently not supported as audio sources.
635
+ */
636
+ type: MediaType;
637
+
638
+ /**
639
+ * Title of the new media. Used for the aria-label attribute on the play button, and outer container. YouTube and Vimeo are populated automatically.
640
+ */
641
+ title?: string;
642
+
643
+ /**
644
+ * This is an array of sources. For HTML5 media, the properties of this object are mapped directly to HTML attributes so more can be added to the object if required.
645
+ */
646
+ sources: Source[];
647
+
648
+ /**
649
+ * The URL for the poster image (HTML5 video only).
650
+ */
651
+ poster?: string;
652
+
653
+ /**
654
+ * An array of track objects. Each element in the array is mapped directly to a track element and any keys mapped directly to HTML attributes so as in the example above,
655
+ * it will render as <track kind="captions" label="English" srclang="en" src="https://cdn.selz.com/plyr/1.0/example_captions_en.vtt" default> and similar for the French version.
656
+ * Booleans are converted to HTML5 value-less attributes.
657
+ */
658
+ tracks?: Track[];
659
+
660
+ /**
661
+ * Enable or disable preview thumbnails for current source
662
+ */
663
+ previewThumbnails?: Plyr.PreviewThumbnailsOptions;
664
+ }
665
+
666
+ interface Source {
667
+ /**
668
+ * The URL of the media file (or YouTube/Vimeo URL).
669
+ */
670
+ src: string;
671
+ /**
672
+ * The MIME type of the media file (if HTML5).
673
+ */
674
+ type?: string;
675
+ provider?: Provider;
676
+ size?: number;
677
+ }
678
+
679
+ type TrackKind = 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
680
+ interface Track {
681
+ /**
682
+ * Indicates how the text track is meant to be used
683
+ */
684
+ kind: TrackKind;
685
+ /**
686
+ * Indicates a user-readable title for the track
687
+ */
688
+ label: string;
689
+ /**
690
+ * The language of the track text data. It must be a valid BCP 47 language tag. If the kind attribute is set to subtitles, then srclang must be defined.
691
+ */
692
+ srcLang?: string;
693
+ /**
694
+ * The URL of the track (.vtt file).
695
+ */
696
+ src: string;
697
+
698
+ default?: boolean;
699
+ }
700
+
701
+ interface PlyrEvent extends CustomEvent {
702
+ readonly detail: { readonly plyr: Plyr };
703
+ }
704
+
705
+ enum YoutubeState {
706
+ UNSTARTED = -1,
707
+ ENDED = 0,
708
+ PLAYING = 1,
709
+ PAUSED = 2,
710
+ BUFFERING = 3,
711
+ CUED = 5,
712
+ }
713
+
714
+ interface PlyrStateChangeEvent extends CustomEvent {
715
+ readonly detail: {
716
+ readonly plyr: Plyr;
717
+ readonly code: YoutubeState;
718
+ };
719
+ }
720
+
721
+ interface Support {
722
+ api: boolean;
723
+ ui: boolean;
724
+ }
725
+ }
726
+
727
+ export = Plyr;
728
+ export as namespace Plyr;
729
+ export default Plyr;