@therealtinhtute/baroiplayer 1.2.1 → 2.0.0-beta.1

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 (302) hide show
  1. package/README.md +90 -71
  2. package/dist/components/icons/index.d.ts +36 -0
  3. package/dist/components/icons/index.d.ts.map +1 -0
  4. package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts +4 -0
  5. package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +1 -0
  6. package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts +5 -0
  7. package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts.map +1 -0
  8. package/dist/components/icons/svg-icons/AudioIcon.d.ts +5 -0
  9. package/dist/components/icons/svg-icons/AudioIcon.d.ts.map +1 -0
  10. package/dist/components/icons/svg-icons/BackwardIcon.d.ts +5 -0
  11. package/dist/components/icons/svg-icons/BackwardIcon.d.ts.map +1 -0
  12. package/dist/components/icons/svg-icons/CameraIcon.d.ts +5 -0
  13. package/dist/components/icons/svg-icons/CameraIcon.d.ts.map +1 -0
  14. package/dist/components/icons/svg-icons/CheckIcon.d.ts +5 -0
  15. package/dist/components/icons/svg-icons/CheckIcon.d.ts.map +1 -0
  16. package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts +4 -0
  17. package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts.map +1 -0
  18. package/dist/components/icons/svg-icons/ForwardIcon.d.ts +5 -0
  19. package/dist/components/icons/svg-icons/ForwardIcon.d.ts.map +1 -0
  20. package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts +5 -0
  21. package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +1 -0
  22. package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts +5 -0
  23. package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +1 -0
  24. package/dist/components/icons/svg-icons/LoadingIcon.d.ts +5 -0
  25. package/dist/components/icons/svg-icons/LoadingIcon.d.ts.map +1 -0
  26. package/dist/components/icons/svg-icons/PauseIcon.d.ts +5 -0
  27. package/dist/components/icons/svg-icons/PauseIcon.d.ts.map +1 -0
  28. package/dist/components/icons/svg-icons/PlayIcon.d.ts +5 -0
  29. package/dist/components/icons/svg-icons/PlayIcon.d.ts.map +1 -0
  30. package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +5 -0
  31. package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +1 -0
  32. package/dist/components/icons/svg-icons/QualityIcon.d.ts +5 -0
  33. package/dist/components/icons/svg-icons/QualityIcon.d.ts.map +1 -0
  34. package/dist/components/icons/svg-icons/SettingsIcon.d.ts +5 -0
  35. package/dist/components/icons/svg-icons/SettingsIcon.d.ts.map +1 -0
  36. package/dist/components/icons/svg-icons/SliderIcon.d.ts +5 -0
  37. package/dist/components/icons/svg-icons/SliderIcon.d.ts.map +1 -0
  38. package/dist/components/icons/svg-icons/SubtitleIcon.d.ts +5 -0
  39. package/dist/components/icons/svg-icons/SubtitleIcon.d.ts.map +1 -0
  40. package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts +5 -0
  41. package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +1 -0
  42. package/dist/components/icons/svg-icons/UnPiPIcon.d.ts +4 -0
  43. package/dist/components/icons/svg-icons/UnPiPIcon.d.ts.map +1 -0
  44. package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts +5 -0
  45. package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +1 -0
  46. package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts +5 -0
  47. package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts.map +1 -0
  48. package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts +5 -0
  49. package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +1 -0
  50. package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts +5 -0
  51. package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +1 -0
  52. package/dist/components/variants/gradient/gradient-audio.d.ts +13 -0
  53. package/dist/components/variants/gradient/gradient-audio.d.ts.map +1 -0
  54. package/dist/components/variants/gradient/gradient-controls.d.ts +4 -0
  55. package/dist/components/variants/gradient/gradient-controls.d.ts.map +1 -0
  56. package/dist/components/variants/gradient/gradient-glyphs.d.ts +30 -0
  57. package/dist/components/variants/gradient/gradient-glyphs.d.ts.map +1 -0
  58. package/dist/components/variants/gradient/gradient-video.d.ts +16 -0
  59. package/dist/components/variants/gradient/gradient-video.d.ts.map +1 -0
  60. package/dist/index.css +1 -1
  61. package/dist/index.d.ts +5 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +1 -41
  64. package/dist/index.js.map +1 -1
  65. package/dist/index.mjs +750 -5640
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/package.json +3 -0
  68. package/package.json +110 -114
  69. package/src/components/variants/gradient/gradient-audio.tsx +47 -0
  70. package/src/components/variants/gradient/gradient-controls.tsx +254 -0
  71. package/src/components/variants/gradient/gradient-glyphs.test.tsx +69 -0
  72. package/src/components/variants/gradient/gradient-glyphs.tsx +129 -0
  73. package/src/components/variants/gradient/gradient-skin.css +211 -0
  74. package/src/components/variants/gradient/gradient-video.tsx +70 -0
  75. package/src/index.ts +5 -198
  76. package/src/test/accessibility-utils.ts +0 -59
  77. package/dist/context/media.js +0 -1
  78. package/dist/context/media.mjs +0 -3
  79. package/dist/context/store.js +0 -1
  80. package/dist/context/store.mjs +0 -3
  81. package/dist/context-Bzd5QCKM.cjs +0 -7
  82. package/dist/context-Bzd5QCKM.cjs.map +0 -1
  83. package/dist/context-DD_SH4tT.js +0 -1053
  84. package/dist/context-DD_SH4tT.js.map +0 -1
  85. package/dist/core-events-BRnLMB7s.cjs +0 -2
  86. package/dist/core-events-BRnLMB7s.cjs.map +0 -1
  87. package/dist/core-events-v_mKdj5p.js +0 -417
  88. package/dist/core-events-v_mKdj5p.js.map +0 -1
  89. package/dist/core-plugins-CMBv-yVh.cjs +0 -2
  90. package/dist/core-plugins-CMBv-yVh.cjs.map +0 -1
  91. package/dist/core-plugins-CqCxLkbd.js +0 -754
  92. package/dist/core-plugins-CqCxLkbd.js.map +0 -1
  93. package/dist/core.js +0 -15
  94. package/dist/core.js.map +0 -1
  95. package/dist/core.mjs +0 -960
  96. package/dist/core.mjs.map +0 -1
  97. package/dist/enhanced-components-BwjBqSA1.js +0 -2858
  98. package/dist/enhanced-components-BwjBqSA1.js.map +0 -1
  99. package/dist/enhanced-components-C-ka-XLp.cjs +0 -2
  100. package/dist/enhanced-components-C-ka-XLp.cjs.map +0 -1
  101. package/dist/hooks-B-IIWPJr.js +0 -1842
  102. package/dist/hooks-B-IIWPJr.js.map +0 -1
  103. package/dist/hooks-DcHzmBwA.cjs +0 -4
  104. package/dist/hooks-DcHzmBwA.cjs.map +0 -1
  105. package/dist/minimal-components-BYsMQde5.js +0 -1610
  106. package/dist/minimal-components-BYsMQde5.js.map +0 -1
  107. package/dist/minimal-components-CsxQbDp7.cjs +0 -2
  108. package/dist/minimal-components-CsxQbDp7.cjs.map +0 -1
  109. package/dist/minimal-components.css +0 -1
  110. package/dist/mona-loading.gif +0 -0
  111. package/dist/performance-monitor-DCSijLJg.js +0 -312
  112. package/dist/performance-monitor-DCSijLJg.js.map +0 -1
  113. package/dist/performance-monitor-wNFKmqMr.cjs +0 -2
  114. package/dist/performance-monitor-wNFKmqMr.cjs.map +0 -1
  115. package/dist/rolldown-runtime-BmowowmI.js +0 -14
  116. package/dist/rolldown-runtime-mLOUI7ql.cjs +0 -1
  117. package/dist/utils-D2gQ7c2R.js +0 -64
  118. package/dist/utils-D2gQ7c2R.js.map +0 -1
  119. package/dist/utils-DJaAwiZ9.cjs +0 -2
  120. package/dist/utils-DJaAwiZ9.cjs.map +0 -1
  121. package/dist/utils.js +0 -1
  122. package/dist/utils.mjs +0 -3
  123. package/src/adapters/videojs-adapter.tsx +0 -470
  124. package/src/assets/mona-loading.gif +0 -0
  125. package/src/components/AnimateLoading.tsx +0 -111
  126. package/src/components/LoadingState.tsx +0 -239
  127. package/src/components/__tests__/media-player-accessibility.test.tsx +0 -510
  128. package/src/components/__tests__/media-player-react19.test.tsx +0 -457
  129. package/src/components/accessibility/keyboard-help-overlay.tsx +0 -207
  130. package/src/components/audio-player.tsx +0 -85
  131. package/src/components/basic/index.ts +0 -37
  132. package/src/components/enhanced/advanced-features.tsx +0 -311
  133. package/src/components/enhanced/debug-panel.tsx +0 -448
  134. package/src/components/enhanced/enhanced-controls.tsx +0 -597
  135. package/src/components/enhanced/enhanced-media-player.tsx +0 -566
  136. package/src/components/enhanced/error-handling.tsx +0 -338
  137. package/src/components/enhanced/index.ts +0 -39
  138. package/src/components/enhanced/media-player-enhanced.tsx +0 -383
  139. package/src/components/examples/basic-video-player.tsx +0 -50
  140. package/src/components/examples/custom-controls-example.tsx +0 -63
  141. package/src/components/examples/enhanced-controls-example.tsx +0 -100
  142. package/src/components/examples/enhanced-media-player-example.tsx +0 -302
  143. package/src/components/examples/loading-states-demo.tsx +0 -141
  144. package/src/components/examples/react-19-demo.tsx +0 -349
  145. package/src/components/examples/volume-orientation-demo.tsx +0 -105
  146. package/src/components/icon-demo.tsx +0 -196
  147. package/src/components/legacy.tsx +0 -87
  148. package/src/components/media-metadata-display.tsx +0 -99
  149. package/src/components/media-player-audio.tsx +0 -39
  150. package/src/components/media-player-controls.tsx +0 -223
  151. package/src/components/media-player-error.tsx +0 -163
  152. package/src/components/media-player-fullscreen.tsx +0 -109
  153. package/src/components/media-player-hls.tsx +0 -111
  154. package/src/components/media-player-loading.tsx +0 -76
  155. package/src/components/media-player-play.tsx +0 -75
  156. package/src/components/media-player-root.tsx +0 -338
  157. package/src/components/media-player-seek.tsx +0 -168
  158. package/src/components/media-player-time.tsx +0 -99
  159. package/src/components/media-player-tooltip.tsx +0 -58
  160. package/src/components/media-player-video.tsx +0 -54
  161. package/src/components/media-player-volume.tsx +0 -155
  162. package/src/components/media-player.tsx +0 -292
  163. package/src/components/media-suspense.tsx +0 -344
  164. package/src/components/player-settings-form.tsx +0 -158
  165. package/src/components/react-player-wrapper.tsx +0 -651
  166. package/src/components/simple-video-player.tsx +0 -62
  167. package/src/components/ui/blur-poster.tsx +0 -96
  168. package/src/components/ui/empty-state.tsx +0 -91
  169. package/src/components/ui/enhanced-seek-bar.tsx +0 -254
  170. package/src/components/ui/error-state.tsx +0 -124
  171. package/src/components/ui/fullscreen-button.tsx +0 -81
  172. package/src/components/ui/loading-skeleton.tsx +0 -107
  173. package/src/components/ui/media-resource-preloader.tsx +0 -458
  174. package/src/components/ui/offline-message.tsx +0 -98
  175. package/src/components/ui/play-button.tsx +0 -99
  176. package/src/components/ui/seek-bar.tsx +0 -191
  177. package/src/components/ui/time-display.tsx +0 -61
  178. package/src/components/ui/volume-control.tsx +0 -190
  179. package/src/components/unified/base-media-player.tsx +0 -252
  180. package/src/components/unified/media-player.tsx +0 -75
  181. package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +0 -587
  182. package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +0 -573
  183. package/src/components/variants/minimal/MinimalControls.tsx +0 -124
  184. package/src/components/variants/minimal/MinimalLoading.tsx +0 -28
  185. package/src/components/variants/minimal/MinimalMediaPlayer.tsx +0 -318
  186. package/src/components/variants/minimal/MinimalOverlay.tsx +0 -58
  187. package/src/components/variants/minimal/MinimalPlayButton.tsx +0 -56
  188. package/src/components/variants/minimal/MinimalSeekBar.tsx +0 -140
  189. package/src/components/variants/minimal/MinimalVolumeControl.tsx +0 -75
  190. package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +0 -206
  191. package/src/components/variants/minimal/components/CenterPlayButton.tsx +0 -22
  192. package/src/components/variants/minimal/components/ControlBar.tsx +0 -142
  193. package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +0 -412
  194. package/src/components/variants/minimal/components/PlaybackControls.tsx +0 -46
  195. package/src/components/variants/minimal/components/RightControls.tsx +0 -164
  196. package/src/components/variants/minimal/components/SeekBar.tsx +0 -127
  197. package/src/components/variants/minimal/components/SettingsDropdown.tsx +0 -68
  198. package/src/components/variants/minimal/components/SubtitleDisplay.tsx +0 -21
  199. package/src/components/variants/minimal/components/TimeDisplay.tsx +0 -15
  200. package/src/components/variants/minimal/components/VideoElement.tsx +0 -35
  201. package/src/components/variants/minimal/components/VolumeControl.tsx +0 -220
  202. package/src/components/variants/minimal/index.ts +0 -23
  203. package/src/components/video-player.tsx +0 -100
  204. package/src/context/__tests__/media-store.test.ts +0 -509
  205. package/src/context/error-handling.ts +0 -398
  206. package/src/context/media-context.tsx +0 -254
  207. package/src/context/media-provider.tsx +0 -264
  208. package/src/context/media-store.ts +0 -387
  209. package/src/context/persistence.ts +0 -462
  210. package/src/core/events/event-system.ts +0 -448
  211. package/src/core/events/hooks.ts +0 -325
  212. package/src/core/events/index.ts +0 -22
  213. package/src/core/events/middleware.ts +0 -286
  214. package/src/core/index.ts +0 -22
  215. package/src/core/optimization/bundle-optimizer.tsx +0 -312
  216. package/src/core/performance/cicd.ts +0 -98
  217. package/src/core/performance/index.ts +0 -38
  218. package/src/core/performance/media-loading-optimizer.ts +0 -545
  219. package/src/core/performance/performance-budgets.ts +0 -437
  220. package/src/core/performance/performance-monitor.tsx +0 -488
  221. package/src/core/performance/performance-testing.ts +0 -461
  222. package/src/core/plugins/__tests__/registry.test.ts +0 -595
  223. package/src/core/plugins/base-plugin.ts +0 -225
  224. package/src/core/plugins/enhanced-plugin-system.ts +0 -435
  225. package/src/core/plugins/examples/analytics-plugin.ts +0 -241
  226. package/src/core/plugins/index.ts +0 -39
  227. package/src/core/plugins/registry.ts +0 -546
  228. package/src/core/plugins/types.ts +0 -169
  229. package/src/core/plugins/utils.ts +0 -317
  230. package/src/core/progressive-loading.tsx +0 -331
  231. package/src/core/providers/enhanced-hls-provider.ts +0 -307
  232. package/src/core/providers/lazy-provider.tsx +0 -14
  233. package/src/core/providers/service-provider.tsx +0 -164
  234. package/src/core/utils.tsx +0 -34
  235. package/src/features/media-session/media-session-manager.ts +0 -411
  236. package/src/features/picture-in-picture/pip-manager.ts +0 -428
  237. package/src/features/playlist/playlist-manager.ts +0 -626
  238. package/src/features/subtitles/subtitle-manager.ts +0 -435
  239. package/src/features/subtitles/subtitle-parser.ts +0 -284
  240. package/src/features/thumbnails/thumbnail-generator.ts +0 -528
  241. package/src/hooks/__tests__/currentTime-fix.test.ts +0 -149
  242. package/src/hooks/__tests__/use-media-player.test.ts +0 -712
  243. package/src/hooks/__tests__/use-media-state.test.tsx +0 -316
  244. package/src/hooks/accessibility/index.ts +0 -27
  245. package/src/hooks/accessibility/use-accessibility-preferences.ts +0 -190
  246. package/src/hooks/accessibility/use-focus-management.ts +0 -183
  247. package/src/hooks/accessibility/use-keyboard-shortcuts.ts +0 -152
  248. package/src/hooks/accessibility/use-screen-reader.ts +0 -212
  249. package/src/hooks/core/index.ts +0 -47
  250. package/src/hooks/legacy.ts +0 -21
  251. package/src/hooks/use-buffer-health.ts +0 -218
  252. package/src/hooks/use-enhanced-media-player.ts +0 -575
  253. package/src/hooks/use-focus-trap.tsx +0 -162
  254. package/src/hooks/use-intelligent-preloading.ts +0 -387
  255. package/src/hooks/use-keyboard-controls.ts +0 -115
  256. package/src/hooks/use-keyboard-shortcuts.ts +0 -255
  257. package/src/hooks/use-media-actions.ts +0 -184
  258. package/src/hooks/use-media-metadata.ts +0 -91
  259. package/src/hooks/use-media-optimistic.ts +0 -264
  260. package/src/hooks/use-media-player.ts +0 -343
  261. package/src/hooks/use-media-state.ts +0 -194
  262. package/src/hooks/use-memory-optimization.ts +0 -360
  263. package/src/hooks/use-network-status.ts +0 -124
  264. package/src/hooks/use-optimistic-controls.ts +0 -95
  265. package/src/hooks/use-optimized-media.ts +0 -283
  266. package/src/hooks/use-smart-preload.ts +0 -229
  267. package/src/hooks/use-touch-gestures.ts +0 -461
  268. package/src/hooks/useEnhancedSubtitles.ts +0 -258
  269. package/src/hooks/useKeyboardShortcuts.ts +0 -106
  270. package/src/hooks/useMediaControls.ts +0 -52
  271. package/src/hooks/useScreenshot.ts +0 -77
  272. package/src/hooks/useSubtitles.ts +0 -91
  273. package/src/hooks/useVideoPlayer.ts +0 -278
  274. package/src/icons/components/FullscreenIcon.tsx +0 -36
  275. package/src/icons/components/SettingsIcon.tsx +0 -37
  276. package/src/icons/components/animated/LoadingIcon.tsx +0 -27
  277. package/src/icons/components/animated/PlayPauseIcon.tsx +0 -42
  278. package/src/icons/components/media/PauseIcon.tsx +0 -38
  279. package/src/icons/components/media/PlayIcon.tsx +0 -37
  280. package/src/icons/components/volume/VolumeIcon.tsx +0 -38
  281. package/src/icons/components/volume/VolumeOffIcon.tsx +0 -38
  282. package/src/icons/index.ts +0 -56
  283. package/src/icons/provider.tsx +0 -58
  284. package/src/icons/types.ts +0 -60
  285. package/src/index-enhanced.ts +0 -35
  286. package/src/index-legacy.ts +0 -324
  287. package/src/index.css +0 -102
  288. package/src/lib/__tests__/async-utils.test.ts +0 -291
  289. package/src/lib/async-utils.ts +0 -194
  290. package/src/lib/deprecation.ts +0 -51
  291. package/src/lib/format-time.ts +0 -37
  292. package/src/lib/index.ts +0 -4
  293. package/src/lib/utils.ts +0 -6
  294. package/src/styles/globals.css +0 -462
  295. package/src/styles/minimal-player.css +0 -621
  296. package/src/styles/pixel-art.css +0 -41
  297. package/src/styles/videojs.css +0 -100
  298. package/src/types/assets.d.ts +0 -29
  299. package/src/types/events.ts +0 -47
  300. package/src/types/formats.ts +0 -79
  301. package/src/types/index.ts +0 -203
  302. package/src/types/videojs-plugins.d.ts +0 -14
@@ -1,28 +0,0 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import { cn } from "../../../lib/utils"
5
-
6
- export interface MinimalLoadingProps {
7
- icon?: React.FC<{ size?: number; className?: string }>
8
- className?: string
9
- }
10
-
11
- export function MinimalLoading({ icon: LoadingIcon, className }: MinimalLoadingProps) {
12
- return (
13
- <div
14
- className={cn(
15
- "absolute inset-0 z-40 flex items-center justify-center",
16
- "bg-black/60 backdrop-blur-sm",
17
- className
18
- )}>
19
- <div className="text-white">
20
- {LoadingIcon ? (
21
- <LoadingIcon size={48} className="animate-spin" />
22
- ) : (
23
- <div className="minimal-spinner h-12 w-12 animate-spin rounded-full border-3 border-white/20 border-t-white" />
24
- )}
25
- </div>
26
- </div>
27
- )
28
- }
@@ -1,318 +0,0 @@
1
- "use client"
2
-
3
- import React, { useCallback, useEffect, useRef, useState } from "react"
4
- import { cn } from "../../../lib/utils"
5
- import type { IconSet } from "../../icons"
6
- import { defaultMinimalIcons } from "../../icons"
7
- import { MediaPlayerRoot } from "../../media-player-root"
8
- import { MediaPlayerVideo } from "../../media-player-video"
9
- import { MinimalControls } from "./MinimalControls"
10
- import { MinimalLoading } from "./MinimalLoading"
11
- import { MinimalOverlay } from "./MinimalOverlay"
12
-
13
- export interface MinimalMediaPlayerProps {
14
- src: string | string[]
15
- poster?: string
16
- autoPlay?: boolean
17
- muted?: boolean
18
- loop?: boolean
19
- autoHideControls?: boolean
20
- hideDelay?: number
21
- theme?: "dark" | "light" | "transparent"
22
- customIcons?: IconSet
23
- showCenterPlayButton?: boolean
24
- showLoadingSpinner?: boolean
25
- className?: string
26
- onPlay?: () => void
27
- onPause?: () => void
28
- onEnded?: () => void
29
- onTimeUpdate?: (currentTime: number) => void
30
- onVolumeChange?: (volume: number) => void
31
- onSeek?: (time: number) => void
32
- onError?: (error: Error) => void
33
- watermark?: {
34
- src: string
35
- position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
36
- opacity?: number
37
- size?: "small" | "medium" | "large"
38
- }
39
- qualities?: Array<{
40
- src: string
41
- quality: string
42
- default?: boolean
43
- }>
44
- showQualitySelector?: boolean
45
- showSpeedControl?: boolean
46
- thumbnails?: string
47
- }
48
-
49
- export function MinimalMediaPlayer({
50
- src,
51
- poster,
52
- autoPlay = false,
53
- muted = false,
54
- loop = false,
55
- autoHideControls = true,
56
- hideDelay = 2500,
57
- theme = "dark",
58
- customIcons,
59
- showCenterPlayButton = true,
60
- showLoadingSpinner = true,
61
- className,
62
- onPlay,
63
- onPause,
64
- onEnded,
65
- onTimeUpdate,
66
- onVolumeChange,
67
- onSeek,
68
- onError,
69
- watermark,
70
- qualities,
71
- showQualitySelector = false,
72
- showSpeedControl = false,
73
- thumbnails
74
- }: MinimalMediaPlayerProps) {
75
- const [controlsVisible, setControlsVisible] = useState(true)
76
- const [isPlaying, setIsPlaying] = useState(false)
77
- const [isLoading, setIsLoading] = useState(false)
78
- const [error, setError] = useState<string | null>(null)
79
- const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null)
80
- const containerRef = useRef<HTMLDivElement | null>(null)
81
- const [isHovered, setIsHovered] = useState(false)
82
- const [userInteracting, setUserInteracting] = useState(false)
83
-
84
- // Merge default icons with custom icons
85
- const icons = { ...defaultMinimalIcons, ...customIcons }
86
-
87
- // Auto-hide controls logic
88
- const resetHideTimer = () => {
89
- if (!autoHideControls) return
90
-
91
- if (hideTimeoutRef.current) {
92
- clearTimeout(hideTimeoutRef.current)
93
- }
94
- setControlsVisible(true)
95
-
96
- if (!userInteracting && isPlaying) {
97
- hideTimeoutRef.current = setTimeout(() => {
98
- setControlsVisible(false)
99
- }, hideDelay)
100
- }
101
- }
102
-
103
- // Handle mouse movement
104
- const handleMouseMove = () => {
105
- resetHideTimer()
106
- }
107
-
108
- // Handle mouse enter/leave
109
- const handleMouseEnter = () => {
110
- setIsHovered(true)
111
- setControlsVisible(true)
112
- if (hideTimeoutRef.current) {
113
- clearTimeout(hideTimeoutRef.current)
114
- }
115
- }
116
-
117
- const handleMouseLeave = () => {
118
- setIsHovered(false)
119
- if (isPlaying && autoHideControls && !userInteracting) {
120
- hideTimeoutRef.current = setTimeout(() => {
121
- setControlsVisible(false)
122
- }, 500)
123
- }
124
- }
125
-
126
- // Handle user interaction
127
- const handleUserInteractionStart = () => {
128
- setUserInteracting(true)
129
- setControlsVisible(true)
130
- if (hideTimeoutRef.current) {
131
- clearTimeout(hideTimeoutRef.current)
132
- }
133
- }
134
-
135
- const handleUserInteractionEnd = () => {
136
- setUserInteracting(false)
137
- resetHideTimer()
138
- }
139
-
140
- // Handle play state changes
141
- const handlePlayStateChange = (playing: boolean) => {
142
- setIsPlaying(playing)
143
- if (playing) {
144
- onPlay?.()
145
- resetHideTimer()
146
- } else {
147
- onPause?.()
148
- setControlsVisible(true)
149
- if (hideTimeoutRef.current) {
150
- clearTimeout(hideTimeoutRef.current)
151
- }
152
- }
153
- }
154
-
155
- // Handle loading state
156
- const handleLoadStart = () => {
157
- setIsLoading(true)
158
- setError(null)
159
- }
160
-
161
- const handleLoadedData = () => {
162
- setIsLoading(false)
163
- }
164
-
165
- // Handle errors
166
- const handleError = (e: Error) => {
167
- setIsLoading(false)
168
- setError(e.message || "An error occurred")
169
- onError?.(e)
170
- }
171
-
172
- // Cleanup on unmount
173
- useEffect(() => {
174
- return () => {
175
- if (hideTimeoutRef.current) {
176
- clearTimeout(hideTimeoutRef.current)
177
- }
178
- }
179
- }, [])
180
-
181
- // Determine video source
182
- const videoSrc =
183
- qualities && qualities.length > 0
184
- ? qualities.find((q) => q.default)?.src ||
185
- qualities[0]?.src ||
186
- (typeof src === "string" ? src : src[0])
187
- : typeof src === "string"
188
- ? src
189
- : src[0]
190
-
191
- return (
192
- <div
193
- ref={containerRef}
194
- className={cn(
195
- "minimal-player theme-minimal relative overflow-hidden rounded-lg bg-black",
196
- `theme-minimal-${theme}`,
197
- className
198
- )}
199
- data-theme={theme}
200
- onMouseMove={handleMouseMove}
201
- onMouseEnter={handleMouseEnter}
202
- onMouseLeave={handleMouseLeave}>
203
- <MediaPlayerRoot
204
- className="relative h-full w-full"
205
- autoHide={false}
206
- enableGestures={true}
207
- enableMobileOptimizations={true}>
208
- {/* Video Element */}
209
- <MediaPlayerVideo
210
- src={videoSrc}
211
- poster={poster}
212
- autoPlay={autoPlay}
213
- muted={muted}
214
- loop={loop}
215
- playsInline
216
- crossOrigin="anonymous"
217
- onPlay={() => handlePlayStateChange(true)}
218
- onPause={() => handlePlayStateChange(false)}
219
- onEnded={onEnded}
220
- onTimeUpdate={(e) => {
221
- const video = e.currentTarget as HTMLVideoElement
222
- onTimeUpdate?.(video.currentTime)
223
- }}
224
- onVolumeChange={(e) => {
225
- const video = e.currentTarget as HTMLVideoElement
226
- onVolumeChange?.(video.volume)
227
- }}
228
- onLoadStart={handleLoadStart}
229
- onLoadedData={handleLoadedData}
230
- onError={(e) => handleError(new Error("Failed to load video"))}
231
- />
232
-
233
- {/* Loading State */}
234
- {showLoadingSpinner && isLoading && <MinimalLoading icon={icons.spinner} />}
235
-
236
- {/* Error State */}
237
- {error && (
238
- <div className="absolute inset-0 z-50 flex items-center justify-center bg-black/80">
239
- <div className="text-center">
240
- <div className="mb-4 text-red-500">
241
- <svg
242
- className="mx-auto h-12 w-12"
243
- fill="none"
244
- viewBox="0 0 24 24"
245
- stroke="currentColor">
246
- <path
247
- strokeLinecap="round"
248
- strokeLinejoin="round"
249
- strokeWidth={2}
250
- d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
251
- />
252
- </svg>
253
- </div>
254
- <p className="mb-2 text-lg text-white">Playback Error</p>
255
- <p className="text-gray-400 text-sm">{error}</p>
256
- </div>
257
- </div>
258
- )}
259
-
260
- {/* Watermark */}
261
- {watermark && (
262
- <div
263
- className={cn("pointer-events-none absolute z-20", {
264
- "top-4 left-4": watermark.position === "top-left",
265
- "top-4 right-4": watermark.position === "top-right",
266
- "bottom-16 left-4": watermark.position === "bottom-left",
267
- "right-4 bottom-16": watermark.position === "bottom-right"
268
- })}
269
- style={{ opacity: watermark.opacity || 0.7 }}>
270
- <img
271
- src={watermark.src}
272
- alt=""
273
- className={cn("object-contain", {
274
- "h-8": watermark.size === "small",
275
- "h-12": watermark.size === "medium" || !watermark.size,
276
- "h-16": watermark.size === "large"
277
- })}
278
- />
279
- </div>
280
- )}
281
-
282
- {/* Center Play Button */}
283
- {showCenterPlayButton && !isPlaying && !isLoading && (
284
- <MinimalOverlay
285
- visible={true}
286
- showCenterButton={true}
287
- isPlaying={isPlaying}
288
- icons={icons}
289
- onPlayPause={() => {
290
- const video = containerRef.current?.querySelector("video")
291
- if (video) {
292
- if (isPlaying) {
293
- video.pause()
294
- } else {
295
- video.play()
296
- }
297
- }
298
- }}
299
- />
300
- )}
301
-
302
- {/* Controls */}
303
- <MinimalControls
304
- visible={controlsVisible || !isPlaying || isHovered}
305
- icons={icons}
306
- isPlaying={isPlaying}
307
- showQualitySelector={showQualitySelector}
308
- showSpeedControl={showSpeedControl}
309
- qualities={qualities}
310
- thumbnails={thumbnails}
311
- onUserInteractionStart={handleUserInteractionStart}
312
- onUserInteractionEnd={handleUserInteractionEnd}
313
- onSeek={onSeek}
314
- />
315
- </MediaPlayerRoot>
316
- </div>
317
- )
318
- }
@@ -1,58 +0,0 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import { cn } from "../../../lib/utils"
5
- import type { IconSet } from "../../icons"
6
-
7
- export interface MinimalOverlayProps {
8
- visible: boolean
9
- showCenterButton?: boolean
10
- isPlaying?: boolean
11
- icons: IconSet
12
- onPlayPause?: () => void
13
- className?: string
14
- }
15
-
16
- export function MinimalOverlay({
17
- visible,
18
- showCenterButton = false,
19
- isPlaying = false,
20
- icons,
21
- onPlayPause,
22
- className
23
- }: MinimalOverlayProps) {
24
- if (!visible || !showCenterButton) return null
25
-
26
- const PlayIcon = icons.play
27
- const PauseIcon = icons.pause
28
-
29
- if (!PlayIcon || !PauseIcon) return null
30
-
31
- return (
32
- <div
33
- className={cn(
34
- "absolute inset-0 z-30 flex items-center justify-center",
35
- "bg-black/20 transition-opacity duration-200",
36
- className
37
- )}
38
- onClick={onPlayPause}>
39
- <button
40
- className={cn(
41
- "minimal-center-play",
42
- "h-20 w-20 rounded-full",
43
- "flex items-center justify-center",
44
- "text-white",
45
- "transition-all duration-200",
46
- "hover:scale-110",
47
- "active:scale-95"
48
- )}
49
- onClick={(e) => {
50
- e.stopPropagation()
51
- onPlayPause?.()
52
- }}
53
- aria-label={isPlaying ? "Pause" : "Play"}>
54
- {isPlaying ? <PauseIcon size={48} /> : <PlayIcon size={48} className="ml-1" />}
55
- </button>
56
- </div>
57
- )
58
- }
@@ -1,56 +0,0 @@
1
- "use client"
2
-
3
- import React from "react"
4
- import { MediaActionTypes, useMediaContext, useMediaDispatch } from "../../../context/media-context"
5
- import { cn } from "../../../lib/utils"
6
- import type { IconSet } from "../../icons"
7
-
8
- export interface MinimalPlayButtonProps {
9
- isPlaying: boolean
10
- icons: IconSet
11
- size?: "sm" | "md" | "lg" | "xl"
12
- className?: string
13
- }
14
-
15
- export function MinimalPlayButton({
16
- isPlaying,
17
- icons,
18
- size = "md",
19
- className
20
- }: MinimalPlayButtonProps) {
21
- const dispatch = useMediaDispatch()
22
-
23
- const handleClick = () => {
24
- dispatch({
25
- type: isPlaying ? MediaActionTypes.PAUSE : MediaActionTypes.PLAY
26
- })
27
- }
28
-
29
- const sizeClasses = {
30
- sm: "h-10 w-10",
31
- md: "h-12 w-12 minimal-btn",
32
- lg: "h-16 w-16 minimal-btn-lg",
33
- xl: "h-20 w-20 minimal-btn-lg"
34
- }
35
-
36
- const iconSizes = {
37
- sm: 27,
38
- md: 30,
39
- lg: 36,
40
- xl: 42
41
- }
42
-
43
- const PlayIcon = icons.play
44
- const PauseIcon = icons.pause
45
-
46
- if (!PlayIcon || !PauseIcon) return null
47
-
48
- return (
49
- <button
50
- className={cn("minimal-btn", sizeClasses[size], className)}
51
- onClick={handleClick}
52
- aria-label={isPlaying ? "Pause" : "Play"}>
53
- {isPlaying ? <PauseIcon size={iconSizes[size]} /> : <PlayIcon size={iconSizes[size]} />}
54
- </button>
55
- )
56
- }
@@ -1,140 +0,0 @@
1
- "use client"
2
-
3
- import React, { useRef, useState } from "react"
4
- import {
5
- MediaActionTypes,
6
- useMediaDispatch,
7
- useMediaSelector
8
- } from "../../../context/media-context"
9
- import { formatTime } from "../../../lib/format-time"
10
- import { cn } from "../../../lib/utils"
11
-
12
- export interface MinimalSeekBarProps {
13
- thumbnails?: string
14
- onSeek?: (time: number) => void
15
- className?: string
16
- }
17
-
18
- export function MinimalSeekBar({ thumbnails, onSeek, className }: MinimalSeekBarProps) {
19
- const dispatch = useMediaDispatch()
20
- const currentTime = useMediaSelector((state) => state.currentTime)
21
- const duration = useMediaSelector((state) => state.duration)
22
- const buffered = useMediaSelector((state) => state.buffered)
23
-
24
- const [isDragging, setIsDragging] = useState(false)
25
- const [hoverTime, setHoverTime] = useState(0)
26
- const [hoverPosition, setHoverPosition] = useState(0)
27
- const seekBarRef = useRef<HTMLDivElement>(null)
28
-
29
- const progress = duration > 0 ? (currentTime / duration) * 100 : 0
30
- const bufferedProgress =
31
- buffered && buffered.length > 0 && duration > 0
32
- ? (buffered.end(buffered.length - 1) / duration) * 100
33
- : 0
34
-
35
- const handleSeek = (clientX: number) => {
36
- if (!seekBarRef.current || duration === 0) return
37
-
38
- const rect = seekBarRef.current.getBoundingClientRect()
39
- const position = Math.max(0, Math.min(1, (clientX - rect.left) / rect.width))
40
- const newTime = position * duration
41
-
42
- dispatch({
43
- type: MediaActionTypes.SEEK,
44
- detail: newTime
45
- })
46
-
47
- onSeek?.(newTime)
48
- }
49
-
50
- const handleMouseDown = (e: React.MouseEvent) => {
51
- e.preventDefault()
52
- setIsDragging(true)
53
- handleSeek(e.clientX)
54
- }
55
-
56
- const handleMouseMove = (e: React.MouseEvent) => {
57
- if (!seekBarRef.current || duration === 0) return
58
-
59
- const rect = seekBarRef.current.getBoundingClientRect()
60
- const position = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width))
61
- const time = position * duration
62
-
63
- setHoverTime(time)
64
- setHoverPosition(e.clientX - rect.left)
65
-
66
- if (isDragging) {
67
- handleSeek(e.clientX)
68
- }
69
- }
70
-
71
- const handleMouseUp = () => {
72
- setIsDragging(false)
73
- }
74
-
75
- const handleMouseLeave = () => {
76
- setIsDragging(false)
77
- setHoverTime(0)
78
- }
79
-
80
- React.useEffect(() => {
81
- if (isDragging) {
82
- const handleGlobalMouseMove = (e: MouseEvent) => {
83
- handleSeek(e.clientX)
84
- }
85
-
86
- const handleGlobalMouseUp = () => {
87
- setIsDragging(false)
88
- }
89
-
90
- document.addEventListener("mousemove", handleGlobalMouseMove)
91
- document.addEventListener("mouseup", handleGlobalMouseUp)
92
-
93
- return () => {
94
- document.removeEventListener("mousemove", handleGlobalMouseMove)
95
- document.removeEventListener("mouseup", handleGlobalMouseUp)
96
- }
97
- }
98
- }, [isDragging])
99
-
100
- return (
101
- <div className={cn("group relative", className)}>
102
- {/* Preview Tooltip */}
103
- {hoverTime > 0 && (
104
- <div
105
- className="pointer-events-none absolute bottom-full z-50 mb-2"
106
- style={{ left: `${hoverPosition}px`, transform: "translateX(-50%)" }}>
107
- {thumbnails && (
108
- <div className="mb-1 rounded bg-black/90 p-1">
109
- <div className="h-18 w-32 rounded bg-gray-800" />
110
- </div>
111
- )}
112
- <div className="whitespace-nowrap rounded bg-black/90 px-2 py-1 text-white text-xs">
113
- {formatTime(hoverTime)}
114
- </div>
115
- </div>
116
- )}
117
-
118
- {/* Seek Bar */}
119
- <div
120
- ref={seekBarRef}
121
- className="minimal-seekbar"
122
- onMouseDown={handleMouseDown}
123
- onMouseMove={handleMouseMove}
124
- onMouseUp={handleMouseUp}
125
- onMouseLeave={handleMouseLeave}>
126
- {/* Buffered Progress */}
127
- <div className="minimal-seekbar-buffered" style={{ width: `${bufferedProgress}%` }} />
128
-
129
- {/* Progress */}
130
- <div className="minimal-seekbar-progress" style={{ width: `${progress}%` }} />
131
-
132
- {/* Thumb */}
133
- <div
134
- className={cn("minimal-seekbar-thumb", isDragging && "active")}
135
- style={{ left: `${progress}%` }}
136
- />
137
- </div>
138
- </div>
139
- )
140
- }
@@ -1,75 +0,0 @@
1
- "use client"
2
-
3
- import React, { useState } from "react"
4
- import {
5
- MediaActionTypes,
6
- useMediaDispatch,
7
- useMediaSelector
8
- } from "../../../context/media-context"
9
- import { cn } from "../../../lib/utils"
10
- import type { IconSet } from "../../icons"
11
-
12
- export interface MinimalVolumeControlProps {
13
- icons: IconSet
14
- className?: string
15
- }
16
-
17
- export function MinimalVolumeControl({ icons, className }: MinimalVolumeControlProps) {
18
- const dispatch = useMediaDispatch()
19
- const volume = useMediaSelector((state) => state.volume)
20
- const isMuted = useMediaSelector((state) => state.isMuted)
21
- const [isExpanded, setIsExpanded] = useState(false)
22
-
23
- const handleVolumeChange = (e: React.ChangeEvent<HTMLInputElement>) => {
24
- const newVolume = parseFloat(e.target.value)
25
- dispatch({
26
- type: MediaActionTypes.SET_VOLUME,
27
- detail: newVolume
28
- })
29
- }
30
-
31
- const handleMuteToggle = () => {
32
- dispatch({
33
- type: MediaActionTypes.TOGGLE_MUTE
34
- })
35
- }
36
-
37
- const VolumeIcon = isMuted || volume === 0 ? icons.volumeMuted : icons.volume
38
-
39
- if (!VolumeIcon) return null
40
-
41
- return (
42
- <div
43
- className={cn("minimal-volume-group flex items-center gap-2", className)}
44
- onMouseEnter={() => setIsExpanded(true)}
45
- onMouseLeave={() => setIsExpanded(false)}>
46
- {/* Volume Button */}
47
- <button
48
- className="minimal-btn inline-flex h-8 w-8 items-center justify-center rounded-full border border-white/20 bg-white/10 text-white transition-all duration-150 hover:border-white/30 hover:bg-white/20"
49
- onClick={handleMuteToggle}
50
- aria-label={isMuted ? "Unmute" : "Mute"}>
51
- <VolumeIcon size={18} />
52
- </button>
53
-
54
- {/* Volume Slider */}
55
- <div
56
- className={cn(
57
- "overflow-hidden transition-all duration-250",
58
- isExpanded ? "w-20 opacity-100" : "w-0 opacity-0"
59
- )}>
60
- <input
61
- type="range"
62
- min="0"
63
- max="1"
64
- step="0.01"
65
- value={isMuted ? 0 : volume}
66
- onChange={handleVolumeChange}
67
- className="minimal-volume-slider h-1 w-full cursor-pointer appearance-none rounded-full bg-white/20"
68
- style={{
69
- background: `linear-gradient(to right, rgb(59 130 246) 0%, rgb(59 130 246) ${(isMuted ? 0 : volume) * 100}%, rgba(255,255,255,0.2) ${(isMuted ? 0 : volume) * 100}%, rgba(255,255,255,0.2) 100%)`
70
- }}
71
- />
72
- </div>
73
- </div>
74
- )
75
- }