@hanifhan1f/vidstack-react 1.12.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 (284) hide show
  1. package/.templates/sandbox/document.css +27 -0
  2. package/.templates/sandbox/favicon-32x32.png +0 -0
  3. package/.templates/sandbox/index.html +21 -0
  4. package/.templates/sandbox/main.tsx +12 -0
  5. package/.templates/sandbox/player.css +39 -0
  6. package/.templates/sandbox/player.tsx +121 -0
  7. package/.templates/sandbox/tracks.ts +23 -0
  8. package/LICENSE +21 -0
  9. package/README.md +23 -0
  10. package/analyze.config.ts +7 -0
  11. package/build/build-icons.js +62 -0
  12. package/npm/analyze.json.d.ts +7 -0
  13. package/package.json +162 -0
  14. package/rollup.config.ts +256 -0
  15. package/src/components/announcer.tsx +47 -0
  16. package/src/components/layouts/default/audio-layout.tsx +231 -0
  17. package/src/components/layouts/default/context.ts +28 -0
  18. package/src/components/layouts/default/hooks.ts +13 -0
  19. package/src/components/layouts/default/icons.tsx +225 -0
  20. package/src/components/layouts/default/index.ts +11 -0
  21. package/src/components/layouts/default/media-layout.tsx +259 -0
  22. package/src/components/layouts/default/slots.tsx +98 -0
  23. package/src/components/layouts/default/ui/announcer.tsx +22 -0
  24. package/src/components/layouts/default/ui/buttons.tsx +301 -0
  25. package/src/components/layouts/default/ui/captions.tsx +16 -0
  26. package/src/components/layouts/default/ui/controls.tsx +12 -0
  27. package/src/components/layouts/default/ui/keyboard-display.tsx +132 -0
  28. package/src/components/layouts/default/ui/menus/accessibility-menu.tsx +100 -0
  29. package/src/components/layouts/default/ui/menus/audio-menu.tsx +167 -0
  30. package/src/components/layouts/default/ui/menus/captions-menu.tsx +61 -0
  31. package/src/components/layouts/default/ui/menus/chapters-menu.tsx +132 -0
  32. package/src/components/layouts/default/ui/menus/font-menu.tsx +331 -0
  33. package/src/components/layouts/default/ui/menus/items/menu-checkbox.tsx +72 -0
  34. package/src/components/layouts/default/ui/menus/items/menu-items.tsx +135 -0
  35. package/src/components/layouts/default/ui/menus/items/menu-slider.tsx +92 -0
  36. package/src/components/layouts/default/ui/menus/playback-menu.tsx +232 -0
  37. package/src/components/layouts/default/ui/menus/settings-menu.tsx +114 -0
  38. package/src/components/layouts/default/ui/menus/utils.ts +12 -0
  39. package/src/components/layouts/default/ui/sliders.tsx +136 -0
  40. package/src/components/layouts/default/ui/time.tsx +73 -0
  41. package/src/components/layouts/default/ui/title.tsx +24 -0
  42. package/src/components/layouts/default/ui/tooltip.tsx +27 -0
  43. package/src/components/layouts/default/ui.ts +8 -0
  44. package/src/components/layouts/default/video-layout.tsx +344 -0
  45. package/src/components/layouts/plyr/context.ts +26 -0
  46. package/src/components/layouts/plyr/icons/plyr-airplay.js +1 -0
  47. package/src/components/layouts/plyr/icons/plyr-captions-off.js +1 -0
  48. package/src/components/layouts/plyr/icons/plyr-captions-on.js +1 -0
  49. package/src/components/layouts/plyr/icons/plyr-download.js +1 -0
  50. package/src/components/layouts/plyr/icons/plyr-enter-fullscreen.js +1 -0
  51. package/src/components/layouts/plyr/icons/plyr-exit-fullscreen.js +1 -0
  52. package/src/components/layouts/plyr/icons/plyr-fast-forward.js +1 -0
  53. package/src/components/layouts/plyr/icons/plyr-muted.js +1 -0
  54. package/src/components/layouts/plyr/icons/plyr-pause.js +1 -0
  55. package/src/components/layouts/plyr/icons/plyr-pip.js +1 -0
  56. package/src/components/layouts/plyr/icons/plyr-play.js +1 -0
  57. package/src/components/layouts/plyr/icons/plyr-restart.js +1 -0
  58. package/src/components/layouts/plyr/icons/plyr-rewind.js +1 -0
  59. package/src/components/layouts/plyr/icons/plyr-settings.js +1 -0
  60. package/src/components/layouts/plyr/icons/plyr-volume.js +1 -0
  61. package/src/components/layouts/plyr/icons.tsx +71 -0
  62. package/src/components/layouts/plyr/index.ts +11 -0
  63. package/src/components/layouts/plyr/layout.tsx +1024 -0
  64. package/src/components/layouts/plyr/props.ts +104 -0
  65. package/src/components/layouts/plyr/slots.tsx +52 -0
  66. package/src/components/layouts/remotion-ui.ts +13 -0
  67. package/src/components/layouts/utils.ts +17 -0
  68. package/src/components/player-callbacks.ts +67 -0
  69. package/src/components/player.tsx +67 -0
  70. package/src/components/primitives/instances.ts +92 -0
  71. package/src/components/primitives/nodes.tsx +58 -0
  72. package/src/components/primitives/slot.tsx +132 -0
  73. package/src/components/provider.tsx +187 -0
  74. package/src/components/text-track.tsx +106 -0
  75. package/src/components/ui/buttons/airplay-button.tsx +53 -0
  76. package/src/components/ui/buttons/caption-button.tsx +55 -0
  77. package/src/components/ui/buttons/fullscreen-button.tsx +55 -0
  78. package/src/components/ui/buttons/google-cast-button.tsx +53 -0
  79. package/src/components/ui/buttons/live-button.tsx +56 -0
  80. package/src/components/ui/buttons/mute-button.tsx +60 -0
  81. package/src/components/ui/buttons/pip-button.tsx +54 -0
  82. package/src/components/ui/buttons/play-button.tsx +53 -0
  83. package/src/components/ui/buttons/seek-button.tsx +55 -0
  84. package/src/components/ui/buttons/toggle-button.tsx +51 -0
  85. package/src/components/ui/caption.tsx +70 -0
  86. package/src/components/ui/captions.tsx +41 -0
  87. package/src/components/ui/chapter-title.tsx +40 -0
  88. package/src/components/ui/controls.tsx +90 -0
  89. package/src/components/ui/gesture.tsx +43 -0
  90. package/src/components/ui/menu.tsx +251 -0
  91. package/src/components/ui/poster.tsx +101 -0
  92. package/src/components/ui/radio-group.tsx +88 -0
  93. package/src/components/ui/sliders/audio-gain-slider.tsx +55 -0
  94. package/src/components/ui/sliders/quality-slider.tsx +54 -0
  95. package/src/components/ui/sliders/slider-callbacks.ts +14 -0
  96. package/src/components/ui/sliders/slider-value.tsx +13 -0
  97. package/src/components/ui/sliders/slider.tsx +254 -0
  98. package/src/components/ui/sliders/speed-slider.tsx +54 -0
  99. package/src/components/ui/sliders/time-slider.tsx +379 -0
  100. package/src/components/ui/sliders/volume-slider.tsx +55 -0
  101. package/src/components/ui/spinner.tsx +105 -0
  102. package/src/components/ui/thumbnail.tsx +82 -0
  103. package/src/components/ui/time.tsx +77 -0
  104. package/src/components/ui/title.tsx +32 -0
  105. package/src/components/ui/tooltip.tsx +135 -0
  106. package/src/globals.d.ts +3 -0
  107. package/src/hooks/create-text-track.ts +22 -0
  108. package/src/hooks/options/use-audio-gain-options.ts +75 -0
  109. package/src/hooks/options/use-audio-options.ts +71 -0
  110. package/src/hooks/options/use-caption-options.ts +95 -0
  111. package/src/hooks/options/use-chapter-options.ts +97 -0
  112. package/src/hooks/options/use-playback-rate-options.ts +75 -0
  113. package/src/hooks/options/use-video-quality-options.ts +123 -0
  114. package/src/hooks/use-active-text-cues.ts +28 -0
  115. package/src/hooks/use-active-text-track.ts +19 -0
  116. package/src/hooks/use-chapter-title.ts +12 -0
  117. package/src/hooks/use-dom.ts +121 -0
  118. package/src/hooks/use-media-context.ts +6 -0
  119. package/src/hooks/use-media-player.ts +19 -0
  120. package/src/hooks/use-media-provider.ts +31 -0
  121. package/src/hooks/use-media-remote.ts +37 -0
  122. package/src/hooks/use-media-state.ts +58 -0
  123. package/src/hooks/use-signals.ts +24 -0
  124. package/src/hooks/use-slider-preview.ts +126 -0
  125. package/src/hooks/use-slider-state.ts +63 -0
  126. package/src/hooks/use-state.ts +47 -0
  127. package/src/hooks/use-text-cues.ts +33 -0
  128. package/src/hooks/use-thumbnails.ts +69 -0
  129. package/src/icon.ts +37 -0
  130. package/src/icons.ts +754 -0
  131. package/src/index.ts +181 -0
  132. package/src/providers/remotion/index.ts +10 -0
  133. package/src/providers/remotion/layout-engine.ts +123 -0
  134. package/src/providers/remotion/loader.ts +35 -0
  135. package/src/providers/remotion/playback-engine.ts +142 -0
  136. package/src/providers/remotion/provider.tsx +514 -0
  137. package/src/providers/remotion/type-check.ts +13 -0
  138. package/src/providers/remotion/types.ts +94 -0
  139. package/src/providers/remotion/ui/context.tsx +120 -0
  140. package/src/providers/remotion/ui/error-boundary.tsx +57 -0
  141. package/src/providers/remotion/ui/poster.tsx +33 -0
  142. package/src/providers/remotion/ui/slider-thumbnail.tsx +41 -0
  143. package/src/providers/remotion/ui/thumbnail.tsx +166 -0
  144. package/src/providers/remotion/validate.ts +220 -0
  145. package/src/source.ts +5 -0
  146. package/src/utils.ts +27 -0
  147. package/tsconfig.build.json +10 -0
  148. package/tsconfig.json +11 -0
  149. package/types/react/src/components/announcer.d.ts +16 -0
  150. package/types/react/src/components/layouts/default/audio-layout.d.ts +27 -0
  151. package/types/react/src/components/layouts/default/context.d.ts +14 -0
  152. package/types/react/src/components/layouts/default/hooks.d.ts +2 -0
  153. package/types/react/src/components/layouts/default/icons.d.ts +95 -0
  154. package/types/react/src/components/layouts/default/index.d.ts +5 -0
  155. package/types/react/src/components/layouts/default/media-layout.d.ts +133 -0
  156. package/types/react/src/components/layouts/default/slots.d.ts +22 -0
  157. package/types/react/src/components/layouts/default/ui/announcer.d.ts +6 -0
  158. package/types/react/src/components/layouts/default/ui/buttons.d.ts +54 -0
  159. package/types/react/src/components/layouts/default/ui/captions.d.ts +6 -0
  160. package/types/react/src/components/layouts/default/ui/controls.d.ts +6 -0
  161. package/types/react/src/components/layouts/default/ui/keyboard-display.d.ts +8 -0
  162. package/types/react/src/components/layouts/default/ui/menus/accessibility-menu.d.ts +10 -0
  163. package/types/react/src/components/layouts/default/ui/menus/audio-menu.d.ts +10 -0
  164. package/types/react/src/components/layouts/default/ui/menus/captions-menu.d.ts +10 -0
  165. package/types/react/src/components/layouts/default/ui/menus/chapters-menu.d.ts +7 -0
  166. package/types/react/src/components/layouts/default/ui/menus/font-menu.d.ts +6 -0
  167. package/types/react/src/components/layouts/default/ui/menus/items/menu-checkbox.d.ts +13 -0
  168. package/types/react/src/components/layouts/default/ui/menus/items/menu-items.d.ts +49 -0
  169. package/types/react/src/components/layouts/default/ui/menus/items/menu-slider.d.ts +26 -0
  170. package/types/react/src/components/layouts/default/ui/menus/playback-menu.d.ts +10 -0
  171. package/types/react/src/components/layouts/default/ui/menus/settings-menu.d.ts +15 -0
  172. package/types/react/src/components/layouts/default/ui/menus/utils.d.ts +1 -0
  173. package/types/react/src/components/layouts/default/ui/sliders.d.ts +24 -0
  174. package/types/react/src/components/layouts/default/ui/time.d.ts +30 -0
  175. package/types/react/src/components/layouts/default/ui/title.d.ts +6 -0
  176. package/types/react/src/components/layouts/default/ui/tooltip.d.ts +12 -0
  177. package/types/react/src/components/layouts/default/ui.d.ts +8 -0
  178. package/types/react/src/components/layouts/default/video-layout.d.ts +47 -0
  179. package/types/react/src/components/layouts/plyr/context.d.ts +12 -0
  180. package/types/react/src/components/layouts/plyr/icons/plyr-airplay.d.ts +2 -0
  181. package/types/react/src/components/layouts/plyr/icons/plyr-captions-off.d.ts +2 -0
  182. package/types/react/src/components/layouts/plyr/icons/plyr-captions-on.d.ts +2 -0
  183. package/types/react/src/components/layouts/plyr/icons/plyr-download.d.ts +2 -0
  184. package/types/react/src/components/layouts/plyr/icons/plyr-enter-fullscreen.d.ts +2 -0
  185. package/types/react/src/components/layouts/plyr/icons/plyr-exit-fullscreen.d.ts +2 -0
  186. package/types/react/src/components/layouts/plyr/icons/plyr-fast-forward.d.ts +2 -0
  187. package/types/react/src/components/layouts/plyr/icons/plyr-muted.d.ts +2 -0
  188. package/types/react/src/components/layouts/plyr/icons/plyr-pause.d.ts +2 -0
  189. package/types/react/src/components/layouts/plyr/icons/plyr-pip.d.ts +2 -0
  190. package/types/react/src/components/layouts/plyr/icons/plyr-play.d.ts +2 -0
  191. package/types/react/src/components/layouts/plyr/icons/plyr-restart.d.ts +2 -0
  192. package/types/react/src/components/layouts/plyr/icons/plyr-rewind.d.ts +2 -0
  193. package/types/react/src/components/layouts/plyr/icons/plyr-settings.d.ts +2 -0
  194. package/types/react/src/components/layouts/plyr/icons/plyr-volume.d.ts +2 -0
  195. package/types/react/src/components/layouts/plyr/icons.d.ts +25 -0
  196. package/types/react/src/components/layouts/plyr/index.d.ts +6 -0
  197. package/types/react/src/components/layouts/plyr/layout.d.ts +17 -0
  198. package/types/react/src/components/layouts/plyr/props.d.ts +71 -0
  199. package/types/react/src/components/layouts/plyr/slots.d.ts +9 -0
  200. package/types/react/src/components/layouts/remotion-ui.d.ts +3 -0
  201. package/types/react/src/components/layouts/utils.d.ts +1 -0
  202. package/types/react/src/components/player-callbacks.d.ts +6 -0
  203. package/types/react/src/components/player.d.ts +32 -0
  204. package/types/react/src/components/primitives/instances.d.ts +83 -0
  205. package/types/react/src/components/primitives/nodes.d.ts +15 -0
  206. package/types/react/src/components/primitives/slot.d.ts +11 -0
  207. package/types/react/src/components/provider.d.ts +26 -0
  208. package/types/react/src/components/text-track.d.ts +100 -0
  209. package/types/react/src/components/ui/buttons/airplay-button.d.ts +22 -0
  210. package/types/react/src/components/ui/buttons/caption-button.d.ts +24 -0
  211. package/types/react/src/components/ui/buttons/fullscreen-button.d.ts +24 -0
  212. package/types/react/src/components/ui/buttons/google-cast-button.d.ts +22 -0
  213. package/types/react/src/components/ui/buttons/live-button.d.ts +26 -0
  214. package/types/react/src/components/ui/buttons/mute-button.d.ts +30 -0
  215. package/types/react/src/components/ui/buttons/pip-button.d.ts +24 -0
  216. package/types/react/src/components/ui/buttons/play-button.d.ts +23 -0
  217. package/types/react/src/components/ui/buttons/seek-button.d.ts +25 -0
  218. package/types/react/src/components/ui/buttons/toggle-button.d.ts +22 -0
  219. package/types/react/src/components/ui/caption.d.ts +11 -0
  220. package/types/react/src/components/ui/captions.d.ts +20 -0
  221. package/types/react/src/components/ui/chapter-title.d.ts +20 -0
  222. package/types/react/src/components/ui/controls.d.ts +40 -0
  223. package/types/react/src/components/ui/gesture.d.ts +20 -0
  224. package/types/react/src/components/ui/menu.d.ts +102 -0
  225. package/types/react/src/components/ui/poster.d.ts +25 -0
  226. package/types/react/src/components/ui/radio-group.d.ts +39 -0
  227. package/types/react/src/components/ui/sliders/audio-gain-slider.d.ts +29 -0
  228. package/types/react/src/components/ui/sliders/quality-slider.d.ts +28 -0
  229. package/types/react/src/components/ui/sliders/slider-callbacks.d.ts +6 -0
  230. package/types/react/src/components/ui/sliders/slider-value.d.ts +9 -0
  231. package/types/react/src/components/ui/sliders/slider.d.ts +134 -0
  232. package/types/react/src/components/ui/sliders/speed-slider.d.ts +28 -0
  233. package/types/react/src/components/ui/sliders/time-slider.d.ts +124 -0
  234. package/types/react/src/components/ui/sliders/volume-slider.d.ts +29 -0
  235. package/types/react/src/components/ui/spinner.d.ts +31 -0
  236. package/types/react/src/components/ui/thumbnail.d.ts +26 -0
  237. package/types/react/src/components/ui/time.d.ts +20 -0
  238. package/types/react/src/components/ui/title.d.ts +15 -0
  239. package/types/react/src/components/ui/tooltip.d.ts +63 -0
  240. package/types/react/src/hooks/create-text-track.d.ts +7 -0
  241. package/types/react/src/hooks/options/use-audio-gain-options.d.ts +22 -0
  242. package/types/react/src/hooks/options/use-audio-options.d.ts +17 -0
  243. package/types/react/src/hooks/options/use-caption-options.d.ts +24 -0
  244. package/types/react/src/hooks/options/use-chapter-options.d.ts +18 -0
  245. package/types/react/src/hooks/options/use-playback-rate-options.d.ts +22 -0
  246. package/types/react/src/hooks/options/use-video-quality-options.d.ts +35 -0
  247. package/types/react/src/hooks/use-active-text-cues.d.ts +6 -0
  248. package/types/react/src/hooks/use-active-text-track.d.ts +5 -0
  249. package/types/react/src/hooks/use-chapter-title.d.ts +4 -0
  250. package/types/react/src/hooks/use-dom.d.ts +9 -0
  251. package/types/react/src/hooks/use-media-context.d.ts +1 -0
  252. package/types/react/src/hooks/use-media-player.d.ts +7 -0
  253. package/types/react/src/hooks/use-media-provider.d.ts +7 -0
  254. package/types/react/src/hooks/use-media-remote.d.ts +12 -0
  255. package/types/react/src/hooks/use-media-state.d.ts +15 -0
  256. package/types/react/src/hooks/use-signals.d.ts +5 -0
  257. package/types/react/src/hooks/use-slider-preview.d.ts +27 -0
  258. package/types/react/src/hooks/use-slider-state.d.ts +16 -0
  259. package/types/react/src/hooks/use-state.d.ts +18 -0
  260. package/types/react/src/hooks/use-text-cues.d.ts +6 -0
  261. package/types/react/src/hooks/use-thumbnails.d.ts +16 -0
  262. package/types/react/src/icon.d.ts +17 -0
  263. package/types/react/src/icons.d.ts +215 -0
  264. package/types/react/src/index.d.ts +78 -0
  265. package/types/react/src/providers/remotion/index.d.ts +7 -0
  266. package/types/react/src/providers/remotion/layout-engine.d.ts +8 -0
  267. package/types/react/src/providers/remotion/loader.d.ts +9 -0
  268. package/types/react/src/providers/remotion/playback-engine.d.ts +11 -0
  269. package/types/react/src/providers/remotion/provider.d.ts +26 -0
  270. package/types/react/src/providers/remotion/type-check.d.ts +6 -0
  271. package/types/react/src/providers/remotion/types.d.ts +91 -0
  272. package/types/react/src/providers/remotion/ui/context.d.ts +17 -0
  273. package/types/react/src/providers/remotion/ui/error-boundary.d.ts +21 -0
  274. package/types/react/src/providers/remotion/ui/poster.d.ts +18 -0
  275. package/types/react/src/providers/remotion/ui/slider-thumbnail.d.ts +17 -0
  276. package/types/react/src/providers/remotion/ui/thumbnail.d.ts +32 -0
  277. package/types/react/src/providers/remotion/validate.d.ts +12 -0
  278. package/types/react/src/source.d.ts +3 -0
  279. package/types/react/src/utils.d.ts +3 -0
  280. package/types/vidstack/src/core/api/src-types.d.ts +50 -0
  281. package/types/vidstack/src/utils/mime.d.ts +15 -0
  282. package/types/vidstack/src/utils/network.d.ts +17 -0
  283. package/types/vidstack/src/utils/support.d.ts +72 -0
  284. package/vite.config.ts +23 -0
@@ -0,0 +1,225 @@
1
+ import * as React from 'react';
2
+
3
+ import accessibilityIconPaths from 'media-icons/dist/icons/accessibility.js';
4
+ import airPlayIconPaths from 'media-icons/dist/icons/airplay.js';
5
+ import arrowDownIconPaths from 'media-icons/dist/icons/arrow-down.js';
6
+ import arrowLeftIconPaths from 'media-icons/dist/icons/arrow-left.js';
7
+ import arrowUpIconPaths from 'media-icons/dist/icons/arrow-up.js';
8
+ import chaptersIconPaths from 'media-icons/dist/icons/chapters.js';
9
+ import checkIconPaths from 'media-icons/dist/icons/check.js';
10
+ import arrowRightIconPaths from 'media-icons/dist/icons/chevron-right.js';
11
+ import googleCastIconPaths from 'media-icons/dist/icons/chromecast.js';
12
+ import ccOnIconPaths from 'media-icons/dist/icons/closed-captions-on.js';
13
+ import ccIconPaths from 'media-icons/dist/icons/closed-captions.js';
14
+ import downloadIconPaths from 'media-icons/dist/icons/download.js';
15
+ import eyeIconPaths from 'media-icons/dist/icons/eye.js';
16
+ import fastBackwardIconPaths from 'media-icons/dist/icons/fast-backward.js';
17
+ import fastForwardIconPaths from 'media-icons/dist/icons/fast-forward.js';
18
+ import exitFullscreenIconPaths from 'media-icons/dist/icons/fullscreen-exit.js';
19
+ import enterFullscreenIconPaths from 'media-icons/dist/icons/fullscreen.js';
20
+ import musicIconPaths from 'media-icons/dist/icons/music.js';
21
+ import muteIconPaths from 'media-icons/dist/icons/mute.js';
22
+ import noEyeIconPaths from 'media-icons/dist/icons/no-eye.js';
23
+ import pauseIconPaths from 'media-icons/dist/icons/pause.js';
24
+ import exitPIPIconPaths from 'media-icons/dist/icons/picture-in-picture-exit.js';
25
+ import enterPIPIconPaths from 'media-icons/dist/icons/picture-in-picture.js';
26
+ import playIconPaths from 'media-icons/dist/icons/play.js';
27
+ import playbackIconPaths from 'media-icons/dist/icons/playback-speed-circle.js';
28
+ import replayIconPaths from 'media-icons/dist/icons/replay.js';
29
+ import seekBackwardIconPaths from 'media-icons/dist/icons/seek-backward-10.js';
30
+ import seekForwardIconPaths from 'media-icons/dist/icons/seek-forward-10.js';
31
+ import settingsIconPaths from 'media-icons/dist/icons/settings.js';
32
+ import volumeHighIconPaths from 'media-icons/dist/icons/volume-high.js';
33
+ import volumeLowIconPaths from 'media-icons/dist/icons/volume-low.js';
34
+
35
+ import { Icon } from '../../../icon';
36
+
37
+ function createIcon(paths: string) {
38
+ function DefaultLayoutIcon(props: DefaultLayoutIconProps) {
39
+ return <Icon paths={paths} {...props} />;
40
+ }
41
+
42
+ DefaultLayoutIcon.displayName = 'DefaultLayoutIcon';
43
+ return DefaultLayoutIcon;
44
+ }
45
+
46
+ export const defaultLayoutIcons: DefaultLayoutIcons = {
47
+ AirPlayButton: {
48
+ Default: createIcon(airPlayIconPaths),
49
+ },
50
+ GoogleCastButton: {
51
+ Default: createIcon(googleCastIconPaths),
52
+ },
53
+ PlayButton: {
54
+ Play: createIcon(playIconPaths),
55
+ Pause: createIcon(pauseIconPaths),
56
+ Replay: createIcon(replayIconPaths),
57
+ },
58
+ MuteButton: {
59
+ Mute: createIcon(muteIconPaths),
60
+ VolumeLow: createIcon(volumeLowIconPaths),
61
+ VolumeHigh: createIcon(volumeHighIconPaths),
62
+ },
63
+ CaptionButton: {
64
+ On: createIcon(ccOnIconPaths),
65
+ Off: createIcon(ccIconPaths),
66
+ },
67
+ PIPButton: {
68
+ Enter: createIcon(enterPIPIconPaths),
69
+ Exit: createIcon(exitPIPIconPaths),
70
+ },
71
+ FullscreenButton: {
72
+ Enter: createIcon(enterFullscreenIconPaths),
73
+ Exit: createIcon(exitFullscreenIconPaths),
74
+ },
75
+ SeekButton: {
76
+ Backward: createIcon(seekBackwardIconPaths),
77
+ Forward: createIcon(seekForwardIconPaths),
78
+ },
79
+ DownloadButton: {
80
+ Default: createIcon(downloadIconPaths),
81
+ },
82
+ Menu: {
83
+ Accessibility: createIcon(accessibilityIconPaths),
84
+ ArrowLeft: createIcon(arrowLeftIconPaths),
85
+ ArrowRight: createIcon(arrowRightIconPaths),
86
+ Audio: createIcon(musicIconPaths),
87
+ Chapters: createIcon(chaptersIconPaths),
88
+ Captions: createIcon(ccIconPaths),
89
+ Playback: createIcon(playbackIconPaths),
90
+ Settings: createIcon(settingsIconPaths),
91
+ AudioBoostUp: createIcon(volumeHighIconPaths),
92
+ AudioBoostDown: createIcon(volumeLowIconPaths),
93
+ SpeedUp: createIcon(fastForwardIconPaths),
94
+ SpeedDown: createIcon(fastBackwardIconPaths),
95
+ QualityUp: createIcon(arrowUpIconPaths),
96
+ QualityDown: createIcon(arrowDownIconPaths),
97
+ FontSizeUp: createIcon(arrowUpIconPaths),
98
+ FontSizeDown: createIcon(arrowDownIconPaths),
99
+ OpacityUp: createIcon(eyeIconPaths),
100
+ OpacityDown: createIcon(noEyeIconPaths),
101
+ RadioCheck: createIcon(checkIconPaths),
102
+ },
103
+ KeyboardDisplay: {
104
+ Play: createIcon(playIconPaths),
105
+ Pause: createIcon(pauseIconPaths),
106
+ Mute: createIcon(muteIconPaths),
107
+ VolumeUp: createIcon(volumeHighIconPaths),
108
+ VolumeDown: createIcon(volumeLowIconPaths),
109
+ EnterFullscreen: createIcon(enterFullscreenIconPaths),
110
+ ExitFullscreen: createIcon(exitFullscreenIconPaths),
111
+ EnterPiP: createIcon(enterPIPIconPaths),
112
+ ExitPiP: createIcon(exitPIPIconPaths),
113
+ CaptionsOn: createIcon(ccOnIconPaths),
114
+ CaptionsOff: createIcon(ccIconPaths),
115
+ SeekForward: createIcon(fastForwardIconPaths),
116
+ SeekBackward: createIcon(fastBackwardIconPaths),
117
+ },
118
+ };
119
+
120
+ export interface DefaultLayoutIconProps
121
+ extends React.PropsWithoutRef<React.SVGProps<SVGSVGElement>> {}
122
+
123
+ export interface DefaultLayoutIcon {
124
+ (props: DefaultLayoutIconProps): React.ReactNode;
125
+ }
126
+
127
+ export interface DefaultAirPlayButtonIcons {
128
+ Default: DefaultLayoutIcon;
129
+ Connecting?: DefaultLayoutIcon;
130
+ Connected?: DefaultLayoutIcon;
131
+ }
132
+
133
+ export interface DefaultGoogleCastButtonIcons {
134
+ Default: DefaultLayoutIcon;
135
+ Connecting?: DefaultLayoutIcon;
136
+ Connected?: DefaultLayoutIcon;
137
+ }
138
+
139
+ export interface DefaultPlayButtonIcons {
140
+ Play: DefaultLayoutIcon;
141
+ Pause: DefaultLayoutIcon;
142
+ Replay: DefaultLayoutIcon;
143
+ }
144
+
145
+ export interface DefaultMuteButtonIcons {
146
+ Mute: DefaultLayoutIcon;
147
+ VolumeLow: DefaultLayoutIcon;
148
+ VolumeHigh: DefaultLayoutIcon;
149
+ }
150
+
151
+ export interface DefaultCaptionButtonIcons {
152
+ On: DefaultLayoutIcon;
153
+ Off: DefaultLayoutIcon;
154
+ }
155
+
156
+ export interface DefaultPIPButtonIcons {
157
+ Enter: DefaultLayoutIcon;
158
+ Exit: DefaultLayoutIcon;
159
+ }
160
+
161
+ export interface DefaultFullscreenButtonIcons {
162
+ Enter: DefaultLayoutIcon;
163
+ Exit: DefaultLayoutIcon;
164
+ }
165
+
166
+ export interface DefaultSeekButtonIcons {
167
+ Backward: DefaultLayoutIcon;
168
+ Forward: DefaultLayoutIcon;
169
+ }
170
+
171
+ export interface DefaultDownloadButtonIcons {
172
+ Default: DefaultLayoutIcon;
173
+ }
174
+
175
+ export interface DefaultMenuIcons {
176
+ Accessibility: DefaultLayoutIcon;
177
+ ArrowLeft: DefaultLayoutIcon;
178
+ ArrowRight: DefaultLayoutIcon;
179
+ Audio: DefaultLayoutIcon;
180
+ AudioBoostUp: DefaultLayoutIcon;
181
+ AudioBoostDown: DefaultLayoutIcon;
182
+ Chapters: DefaultLayoutIcon;
183
+ Captions: DefaultLayoutIcon;
184
+ Playback: DefaultLayoutIcon;
185
+ Settings: DefaultLayoutIcon;
186
+ SpeedUp: DefaultLayoutIcon;
187
+ SpeedDown: DefaultLayoutIcon;
188
+ QualityUp: DefaultLayoutIcon;
189
+ QualityDown: DefaultLayoutIcon;
190
+ FontSizeUp: DefaultLayoutIcon;
191
+ FontSizeDown: DefaultLayoutIcon;
192
+ OpacityUp: DefaultLayoutIcon;
193
+ OpacityDown: DefaultLayoutIcon;
194
+ RadioCheck: DefaultLayoutIcon;
195
+ }
196
+
197
+ export interface DefaultKeyboardDisplayIcons {
198
+ Play: DefaultLayoutIcon;
199
+ Pause: DefaultLayoutIcon;
200
+ Mute: DefaultLayoutIcon;
201
+ VolumeUp: DefaultLayoutIcon;
202
+ VolumeDown: DefaultLayoutIcon;
203
+ EnterFullscreen: DefaultLayoutIcon;
204
+ ExitFullscreen: DefaultLayoutIcon;
205
+ EnterPiP: DefaultLayoutIcon;
206
+ ExitPiP: DefaultLayoutIcon;
207
+ CaptionsOn: DefaultLayoutIcon;
208
+ CaptionsOff: DefaultLayoutIcon;
209
+ SeekForward: DefaultLayoutIcon;
210
+ SeekBackward: DefaultLayoutIcon;
211
+ }
212
+
213
+ export interface DefaultLayoutIcons {
214
+ AirPlayButton: DefaultAirPlayButtonIcons;
215
+ GoogleCastButton: DefaultGoogleCastButtonIcons;
216
+ PlayButton: DefaultPlayButtonIcons;
217
+ MuteButton: DefaultMuteButtonIcons;
218
+ CaptionButton: DefaultCaptionButtonIcons;
219
+ PIPButton: DefaultPIPButtonIcons;
220
+ FullscreenButton: DefaultFullscreenButtonIcons;
221
+ SeekButton: DefaultSeekButtonIcons;
222
+ DownloadButton?: DefaultDownloadButtonIcons;
223
+ Menu: DefaultMenuIcons;
224
+ KeyboardDisplay?: Partial<DefaultKeyboardDisplayIcons>;
225
+ }
@@ -0,0 +1,11 @@
1
+ export type {
2
+ DefaultLayoutSlots,
3
+ DefaultAudioLayoutSlots,
4
+ DefaultVideoLayoutSlots,
5
+ DefaultLayoutSlotName,
6
+ DefaultLayoutMenuSlotName,
7
+ } from './slots';
8
+ export type { DefaultLayoutTranslations, DefaultLayoutWord } from 'vidstack';
9
+ export type { DefaultLayoutProps } from './media-layout';
10
+ export * from './context';
11
+ export * from './ui';
@@ -0,0 +1,259 @@
1
+ import * as React from 'react';
2
+
3
+ import { composeRefs, useSignal } from 'maverick.js/react';
4
+ import { isBoolean } from 'maverick.js/std';
5
+ import {
6
+ type DefaultLayoutTranslations,
7
+ type FileDownloadInfo,
8
+ type MediaPlayerQuery,
9
+ type MediaStreamType,
10
+ type ThumbnailSrc,
11
+ } from 'vidstack';
12
+
13
+ import { useMediaContext } from '../../../hooks/use-media-context';
14
+ import { useMediaState } from '../../../hooks/use-media-state';
15
+ import { createComputed, createSignal } from '../../../hooks/use-signals';
16
+ import type { PrimitivePropsWithRef } from '../../primitives/nodes';
17
+ import { DefaultLayoutContext } from './context';
18
+ import { useColorSchemeClass } from './hooks';
19
+ import type { DefaultLayoutIcons } from './icons';
20
+
21
+ /* -------------------------------------------------------------------------------------------------
22
+ * DefaultMediaLayout
23
+ * -----------------------------------------------------------------------------------------------*/
24
+
25
+ export interface DefaultLayoutProps<Slots = unknown> extends PrimitivePropsWithRef<'div'> {
26
+ children?: React.ReactNode;
27
+ /**
28
+ * The icons to be rendered and displayed inside the layout.
29
+ */
30
+ icons: DefaultLayoutIcons;
31
+ /**
32
+ * Whether light or dark color theme should be active. Defaults to user operating system
33
+ * preference.
34
+ *
35
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme}
36
+ */
37
+ colorScheme?: 'light' | 'dark' | 'system' | 'default';
38
+ /**
39
+ * Sets the download URL and filename for the download button.
40
+ */
41
+ download?: FileDownloadInfo;
42
+ /**
43
+ * Specifies the number of milliseconds to wait before tooltips are visible after interacting
44
+ * with a control.
45
+ *
46
+ * @defaultValue 700
47
+ */
48
+ showTooltipDelay?: number;
49
+ /**
50
+ * Specifies the number of milliseconds to wait before menus are visible after opening them.
51
+ *
52
+ * @defaultValue 0
53
+ */
54
+ showMenuDelay?: number;
55
+ /**
56
+ * Whether the bitrate should be hidden in the settings quality menu next to each option.
57
+ *
58
+ * @defaultValue false
59
+ */
60
+ hideQualityBitrate?: boolean;
61
+ /**
62
+ * Determines when the small (e.g., mobile) UI should be displayed.
63
+ *
64
+ * @defaultValue `({ width, height }) => width < 576 || height < 380`
65
+ */
66
+ smallLayoutWhen?: boolean | MediaPlayerQuery;
67
+ /**
68
+ * The thumbnails resource.
69
+ *
70
+ * @see {@link https://www.vidstack.io/docs/wc/player/core-concepts/loading#thumbnails}
71
+ */
72
+ thumbnails?: ThumbnailSrc;
73
+ /**
74
+ * Translation map from english to your desired language for words used throughout the layout.
75
+ */
76
+ translations?: Partial<DefaultLayoutTranslations> | null;
77
+ /**
78
+ * A document query selector string or `HTMLElement` to mount menus inside.
79
+ *
80
+ * @defaultValue `document.body`
81
+ */
82
+ menuContainer?: string | HTMLElement | null;
83
+ /**
84
+ * Specifies whether menu buttons should be placed in the top or bottom controls group. This
85
+ * only applies to the large video layout.
86
+ */
87
+ menuGroup?: 'top' | 'bottom';
88
+ /**
89
+ * Disable audio boost slider in the settings menu.
90
+ */
91
+ noAudioGain?: boolean;
92
+ /**
93
+ * The audio gain options to be displayed in the settings menu.
94
+ */
95
+ audioGains?: number[] | { min: number; max: number; step: number };
96
+ /**
97
+ * Whether modal menus should be disabled when the small layout is active. A modal menu is
98
+ * a floating panel that floats up from the bottom of the screen (outside of the player). It's
99
+ * enabled by default as it provides a better user experience for touch devices.
100
+ */
101
+ noModal?: boolean;
102
+ /**
103
+ * Whether to disable scrubbing by touch swiping left or right on the player canvas.
104
+ */
105
+ noScrubGesture?: boolean;
106
+ /**
107
+ * The minimum width of the slider to start displaying slider chapters when available.
108
+ */
109
+ sliderChaptersMinWidth?: number;
110
+ /**
111
+ * Whether the time slider should be disabled.
112
+ */
113
+ disableTimeSlider?: boolean;
114
+ /**
115
+ * Whether all gestures such as press to play or seek should not be active.
116
+ */
117
+ noGestures?: boolean;
118
+ /**
119
+ * Whether keyboard actions should not be displayed.
120
+ */
121
+ noKeyboardAnimations?: boolean;
122
+ /**
123
+ * The playback rate options to be displayed in the settings menu.
124
+ */
125
+ playbackRates?: number[] | { min: number; max: number; step: number };
126
+ /**
127
+ * The number of seconds to seek forward or backward when pressing the seek button or using
128
+ * keyboard shortcuts.
129
+ */
130
+ seekStep?: number;
131
+ /**
132
+ * Provide additional content to be inserted in specific positions.
133
+ */
134
+ slots?: Slots;
135
+ }
136
+
137
+ export interface CreateDefaultMediaLayout {
138
+ type: 'audio' | 'video';
139
+ smLayoutWhen: MediaPlayerQuery;
140
+ renderLayout: (props: {
141
+ streamType: MediaStreamType;
142
+ isLoadLayout: boolean;
143
+ isSmallLayout: boolean;
144
+ }) => React.ReactNode;
145
+ }
146
+
147
+ export function createDefaultMediaLayout({
148
+ type,
149
+ smLayoutWhen,
150
+ renderLayout,
151
+ }: CreateDefaultMediaLayout) {
152
+ const Layout = React.forwardRef<HTMLDivElement, DefaultLayoutProps>(
153
+ (
154
+ {
155
+ children,
156
+ className,
157
+ disableTimeSlider = false,
158
+ hideQualityBitrate = false,
159
+ icons,
160
+ colorScheme = 'system',
161
+ download = null,
162
+ menuContainer = null,
163
+ menuGroup = 'bottom',
164
+ noAudioGain = false,
165
+ audioGains = { min: 0, max: 300, step: 25 },
166
+ noGestures = false,
167
+ noKeyboardAnimations = false,
168
+ noModal = false,
169
+ noScrubGesture,
170
+ playbackRates = { min: 0, max: 2, step: 0.25 },
171
+ seekStep = 10,
172
+ showMenuDelay,
173
+ showTooltipDelay = 700,
174
+ sliderChaptersMinWidth = 325,
175
+ slots,
176
+ smallLayoutWhen = smLayoutWhen,
177
+ thumbnails = null,
178
+ translations,
179
+ ...props
180
+ },
181
+ forwardRef,
182
+ ) => {
183
+ const media = useMediaContext(),
184
+ $load = useSignal(media.$props.load),
185
+ $canLoad = useMediaState('canLoad'),
186
+ $viewType = useMediaState('viewType'),
187
+ $streamType = useMediaState('streamType'),
188
+ $smallWhen = createComputed(() => {
189
+ return isBoolean(smallLayoutWhen) ? smallLayoutWhen : smallLayoutWhen(media.player.state);
190
+ }, [smallLayoutWhen]),
191
+ userPrefersAnnouncements = createSignal(true),
192
+ userPrefersKeyboardAnimations = createSignal(true),
193
+ isMatch = $viewType === type,
194
+ isSmallLayout = $smallWhen(),
195
+ isForcedLayout = isBoolean(smallLayoutWhen),
196
+ isLoadLayout = $load === 'play' && !$canLoad,
197
+ canRender = $canLoad || isForcedLayout || isLoadLayout,
198
+ colorSchemeClass = useColorSchemeClass(colorScheme),
199
+ layoutEl = createSignal<HTMLElement | null>(null);
200
+
201
+ useSignal($smallWhen);
202
+
203
+ return (
204
+ <div
205
+ {...props}
206
+ className={
207
+ `vds-${type}-layout` +
208
+ (colorSchemeClass ? ` ${colorSchemeClass}` : '') +
209
+ (className ? ` ${className}` : '')
210
+ }
211
+ data-match={isMatch ? '' : null}
212
+ data-sm={isSmallLayout ? '' : null}
213
+ data-lg={!isSmallLayout ? '' : null}
214
+ data-size={isSmallLayout ? 'sm' : 'lg'}
215
+ data-no-scrub-gesture={noScrubGesture ? '' : null}
216
+ ref={composeRefs(layoutEl.set as any, forwardRef)}
217
+ >
218
+ {canRender && isMatch ? (
219
+ <DefaultLayoutContext.Provider
220
+ value={{
221
+ disableTimeSlider,
222
+ hideQualityBitrate,
223
+ icons: icons,
224
+ colorScheme,
225
+ download,
226
+ isSmallLayout,
227
+ menuContainer,
228
+ menuGroup,
229
+ noAudioGain,
230
+ audioGains,
231
+ layoutEl,
232
+ noGestures,
233
+ noKeyboardAnimations,
234
+ noModal,
235
+ noScrubGesture,
236
+ showMenuDelay,
237
+ showTooltipDelay,
238
+ sliderChaptersMinWidth,
239
+ slots,
240
+ seekStep,
241
+ playbackRates,
242
+ thumbnails,
243
+ translations,
244
+ userPrefersAnnouncements,
245
+ userPrefersKeyboardAnimations,
246
+ }}
247
+ >
248
+ {renderLayout({ streamType: $streamType, isSmallLayout, isLoadLayout })}
249
+ {children}
250
+ </DefaultLayoutContext.Provider>
251
+ ) : null}
252
+ </div>
253
+ );
254
+ },
255
+ );
256
+
257
+ Layout.displayName = 'DefaultMediaLayout';
258
+ return Layout;
259
+ }
@@ -0,0 +1,98 @@
1
+ import * as React from 'react';
2
+
3
+ import { isUndefined, uppercaseFirstChar } from 'maverick.js/std';
4
+
5
+ import { DefaultLayoutContext } from './context';
6
+
7
+ export type SlotPositions<Name extends string> =
8
+ | `before${Capitalize<Name>}`
9
+ | Name
10
+ | `after${Capitalize<Name>}`;
11
+
12
+ export type Slots<Names extends string> = {
13
+ [slotName in SlotPositions<Names>]?: React.ReactNode;
14
+ };
15
+
16
+ export type DefaultLayoutSlotName =
17
+ | 'bufferingIndicator'
18
+ | 'captionButton'
19
+ | 'captions'
20
+ | 'title'
21
+ | 'chapterTitle'
22
+ | 'currentTime'
23
+ | 'timeDivider'
24
+ | 'endTime'
25
+ | 'fullscreenButton'
26
+ | 'liveButton'
27
+ | 'livePlayButton'
28
+ | 'muteButton'
29
+ | 'pipButton'
30
+ | 'airPlayButton'
31
+ | 'googleCastButton'
32
+ | 'downloadButton'
33
+ | 'playButton'
34
+ | 'loadButton'
35
+ | 'seekBackwardButton'
36
+ | 'seekForwardButton'
37
+ | 'startDuration'
38
+ | 'timeSlider'
39
+ | 'volumeSlider'
40
+ | 'topControlsGroupStart'
41
+ | 'topControlsGroupCenter'
42
+ | 'topControlsGroupEnd'
43
+ | 'centerControlsGroupStart'
44
+ | 'centerControlsGroupCenter'
45
+ | 'centerControlsGroupEnd'
46
+ | DefaultLayoutMenuSlotName;
47
+
48
+ export type DefaultLayoutMenuSlotName =
49
+ | 'chaptersMenu'
50
+ | 'settingsMenu'
51
+ /** @deprecated - use `settingsMenuItemsStart` */
52
+ | 'settingsMenuStartItems'
53
+ /** @deprecated - use `settingsMenuItemsEnd` */
54
+ | 'settingsMenuEndItems'
55
+ | 'settingsMenuItemsStart'
56
+ | 'settingsMenuItemsEnd'
57
+ | 'playbackMenuItemsStart'
58
+ | 'playbackMenuItemsEnd'
59
+ | 'playbackMenuLoop'
60
+ | 'accessibilityMenuItemsStart'
61
+ | 'accessibilityMenuItemsEnd'
62
+ | 'audioMenuItemsStart'
63
+ | 'audioMenuItemsEnd'
64
+ | 'captionsMenuItemsStart'
65
+ | 'captionsMenuItemsEnd';
66
+
67
+ export interface DefaultLayoutSlots extends Slots<DefaultLayoutSlotName> {}
68
+
69
+ export interface DefaultAudioLayoutSlots extends DefaultLayoutSlots {}
70
+
71
+ export interface DefaultVideoLayoutSlots extends DefaultLayoutSlots {
72
+ smallLayout?: DefaultLayoutSlots;
73
+ largeLayout?: DefaultLayoutSlots;
74
+ }
75
+
76
+ export function useDefaultAudioLayoutSlots() {
77
+ return React.useContext(DefaultLayoutContext).slots as DefaultAudioLayoutSlots | undefined;
78
+ }
79
+
80
+ export function useDefaultVideoLayoutSlots() {
81
+ return React.useContext(DefaultLayoutContext).slots as DefaultVideoLayoutSlots | undefined;
82
+ }
83
+
84
+ export function slot<T>(
85
+ slots: T | undefined,
86
+ name: keyof T,
87
+ defaultValue: React.ReactNode,
88
+ ): React.ReactNode {
89
+ const slot = slots?.[name],
90
+ capitalizedName = uppercaseFirstChar(name as string);
91
+ return (
92
+ <>
93
+ {slots?.[`before${capitalizedName}`]}
94
+ {isUndefined(slot) ? defaultValue : slot}
95
+ {slots?.[`after${capitalizedName}`]}
96
+ </>
97
+ );
98
+ }
@@ -0,0 +1,22 @@
1
+ import * as React from 'react';
2
+
3
+ import { useSignal } from 'maverick.js/react';
4
+
5
+ import { MediaAnnouncer } from '../../../announcer';
6
+ import { useDefaultLayoutContext } from '../context';
7
+
8
+ /* -------------------------------------------------------------------------------------------------
9
+ * DefaultAnnouncer
10
+ * -----------------------------------------------------------------------------------------------*/
11
+
12
+ function DefaultAnnouncer() {
13
+ const { userPrefersAnnouncements, translations } = useDefaultLayoutContext(),
14
+ $userPrefersAnnouncements = useSignal(userPrefersAnnouncements);
15
+
16
+ if (!$userPrefersAnnouncements) return null;
17
+
18
+ return <MediaAnnouncer translations={translations} />;
19
+ }
20
+
21
+ DefaultAnnouncer.displayName = 'DefaultAnnouncer';
22
+ export { DefaultAnnouncer };