@therealtinhtute/baroiplayer 1.2.0 → 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.
- package/README.md +91 -73
- package/dist/components/icons/index.d.ts +36 -0
- package/dist/components/icons/index.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/AudioIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/AudioIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/BackwardIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/BackwardIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/CameraIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/CameraIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/CheckIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/CheckIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ForwardIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/ForwardIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/LoadingIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/LoadingIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PauseIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PauseIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PlayIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PlayIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/QualityIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/QualityIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SettingsIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SettingsIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SliderIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SliderIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SubtitleIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SubtitleIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/UnPiPIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/UnPiPIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-audio.d.ts +13 -0
- package/dist/components/variants/gradient/gradient-audio.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-controls.d.ts +4 -0
- package/dist/components/variants/gradient/gradient-controls.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-glyphs.d.ts +30 -0
- package/dist/components/variants/gradient/gradient-glyphs.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-video.d.ts +16 -0
- package/dist/components/variants/gradient/gradient-video.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +786 -6271
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +3 -0
- package/package.json +110 -108
- package/src/components/variants/gradient/gradient-audio.tsx +47 -0
- package/src/components/variants/gradient/gradient-controls.tsx +254 -0
- package/src/components/variants/gradient/gradient-glyphs.test.tsx +69 -0
- package/src/components/variants/gradient/gradient-glyphs.tsx +129 -0
- package/src/components/variants/gradient/gradient-skin.css +211 -0
- package/src/components/variants/gradient/gradient-video.tsx +70 -0
- package/src/index.ts +5 -198
- package/src/test/accessibility-utils.ts +0 -59
- package/dist/context/media.js +0 -2
- package/dist/context/media.js.map +0 -1
- package/dist/context/media.mjs +0 -15
- package/dist/context/media.mjs.map +0 -1
- package/dist/context/store.js +0 -2
- package/dist/context/store.js.map +0 -1
- package/dist/context/store.mjs +0 -5
- package/dist/context/store.mjs.map +0 -1
- package/dist/context-BYwDoSRX.js +0 -1172
- package/dist/context-BYwDoSRX.js.map +0 -1
- package/dist/context-eNS62_ac.cjs +0 -23
- package/dist/context-eNS62_ac.cjs.map +0 -1
- package/dist/core-events-B1iM2F46.cjs +0 -2
- package/dist/core-events-B1iM2F46.cjs.map +0 -1
- package/dist/core-events-DunPHKRE.js +0 -484
- package/dist/core-events-DunPHKRE.js.map +0 -1
- package/dist/core-plugins-By-4-kGs.cjs +0 -2
- package/dist/core-plugins-By-4-kGs.cjs.map +0 -1
- package/dist/core-plugins-DSBWcTuX.js +0 -821
- package/dist/core-plugins-DSBWcTuX.js.map +0 -1
- package/dist/core.js +0 -37
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -1233
- package/dist/core.mjs.map +0 -1
- package/dist/enhanced-components-B_l3cist.js +0 -1142
- package/dist/enhanced-components-B_l3cist.js.map +0 -1
- package/dist/enhanced-components-BspFs9OO.cjs +0 -2
- package/dist/enhanced-components-BspFs9OO.cjs.map +0 -1
- package/dist/hooks-BXwI8QG6.cjs +0 -4
- package/dist/hooks-BXwI8QG6.cjs.map +0 -1
- package/dist/hooks-Bpi-jDiO.js +0 -1816
- package/dist/hooks-Bpi-jDiO.js.map +0 -1
- package/dist/minimal-components-C4z900Ro.js +0 -1926
- package/dist/minimal-components-C4z900Ro.js.map +0 -1
- package/dist/minimal-components-v4qBp6jv.cjs +0 -2
- package/dist/minimal-components-v4qBp6jv.cjs.map +0 -1
- package/dist/minimal-components.css +0 -1
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor-C5k6FDXw.js +0 -301
- package/dist/performance-monitor-C5k6FDXw.js.map +0 -1
- package/dist/performance-monitor-lJmuUjQQ.cjs +0 -2
- package/dist/performance-monitor-lJmuUjQQ.cjs.map +0 -1
- package/dist/utils-CFOue_9K.cjs +0 -9
- package/dist/utils-CFOue_9K.cjs.map +0 -1
- package/dist/utils-Dzpl2ArK.js +0 -2844
- package/dist/utils-Dzpl2ArK.js.map +0 -1
- package/dist/utils.js +0 -2
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs +0 -11
- package/dist/utils.mjs.map +0 -1
- package/src/adapters/videojs-adapter.tsx +0 -470
- package/src/assets/mona-loading.gif +0 -0
- package/src/components/AnimateLoading.tsx +0 -107
- package/src/components/LoadingState.tsx +0 -239
- package/src/components/__tests__/media-player-accessibility.test.tsx +0 -510
- package/src/components/__tests__/media-player-react19.test.tsx +0 -457
- package/src/components/accessibility/keyboard-help-overlay.tsx +0 -207
- package/src/components/audio-player.tsx +0 -85
- package/src/components/basic/index.ts +0 -37
- package/src/components/enhanced/advanced-features.tsx +0 -311
- package/src/components/enhanced/debug-panel.tsx +0 -448
- package/src/components/enhanced/enhanced-controls.tsx +0 -597
- package/src/components/enhanced/enhanced-media-player.tsx +0 -566
- package/src/components/enhanced/error-handling.tsx +0 -338
- package/src/components/enhanced/index.ts +0 -39
- package/src/components/enhanced/media-player-enhanced.tsx +0 -383
- package/src/components/examples/basic-video-player.tsx +0 -50
- package/src/components/examples/custom-controls-example.tsx +0 -63
- package/src/components/examples/enhanced-controls-example.tsx +0 -100
- package/src/components/examples/enhanced-media-player-example.tsx +0 -302
- package/src/components/examples/loading-states-demo.tsx +0 -142
- package/src/components/examples/react-19-demo.tsx +0 -353
- package/src/components/examples/volume-orientation-demo.tsx +0 -106
- package/src/components/icon-demo.tsx +0 -196
- package/src/components/legacy.tsx +0 -87
- package/src/components/media-metadata-display.tsx +0 -99
- package/src/components/media-player-audio.tsx +0 -39
- package/src/components/media-player-controls.tsx +0 -223
- package/src/components/media-player-error.tsx +0 -163
- package/src/components/media-player-fullscreen.tsx +0 -109
- package/src/components/media-player-hls.tsx +0 -111
- package/src/components/media-player-loading.tsx +0 -76
- package/src/components/media-player-play.tsx +0 -75
- package/src/components/media-player-root.tsx +0 -338
- package/src/components/media-player-seek.tsx +0 -168
- package/src/components/media-player-time.tsx +0 -99
- package/src/components/media-player-tooltip.tsx +0 -58
- package/src/components/media-player-video.tsx +0 -54
- package/src/components/media-player-volume.tsx +0 -155
- package/src/components/media-player.tsx +0 -292
- package/src/components/media-suspense.tsx +0 -344
- package/src/components/player-settings-form.tsx +0 -158
- package/src/components/react-player-wrapper.tsx +0 -651
- package/src/components/simple-video-player.tsx +0 -62
- package/src/components/ui/blur-poster.tsx +0 -93
- package/src/components/ui/empty-state.tsx +0 -91
- package/src/components/ui/enhanced-seek-bar.tsx +0 -254
- package/src/components/ui/error-state.tsx +0 -124
- package/src/components/ui/fullscreen-button.tsx +0 -81
- package/src/components/ui/loading-skeleton.tsx +0 -107
- package/src/components/ui/media-resource-preloader.tsx +0 -458
- package/src/components/ui/offline-message.tsx +0 -98
- package/src/components/ui/play-button.tsx +0 -99
- package/src/components/ui/seek-bar.tsx +0 -191
- package/src/components/ui/time-display.tsx +0 -61
- package/src/components/ui/volume-control.tsx +0 -190
- package/src/components/unified/base-media-player.tsx +0 -252
- package/src/components/unified/media-player.tsx +0 -75
- package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +0 -587
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +0 -573
- package/src/components/variants/minimal/MinimalControls.tsx +0 -124
- package/src/components/variants/minimal/MinimalLoading.tsx +0 -28
- package/src/components/variants/minimal/MinimalMediaPlayer.tsx +0 -318
- package/src/components/variants/minimal/MinimalOverlay.tsx +0 -58
- package/src/components/variants/minimal/MinimalPlayButton.tsx +0 -56
- package/src/components/variants/minimal/MinimalSeekBar.tsx +0 -140
- package/src/components/variants/minimal/MinimalVolumeControl.tsx +0 -75
- package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +0 -206
- package/src/components/variants/minimal/components/CenterPlayButton.tsx +0 -22
- package/src/components/variants/minimal/components/ControlBar.tsx +0 -142
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +0 -412
- package/src/components/variants/minimal/components/PlaybackControls.tsx +0 -46
- package/src/components/variants/minimal/components/RightControls.tsx +0 -164
- package/src/components/variants/minimal/components/SeekBar.tsx +0 -127
- package/src/components/variants/minimal/components/SettingsDropdown.tsx +0 -68
- package/src/components/variants/minimal/components/SubtitleDisplay.tsx +0 -21
- package/src/components/variants/minimal/components/TimeDisplay.tsx +0 -15
- package/src/components/variants/minimal/components/VideoElement.tsx +0 -33
- package/src/components/variants/minimal/components/VolumeControl.tsx +0 -220
- package/src/components/variants/minimal/index.ts +0 -23
- package/src/components/video-player.tsx +0 -100
- package/src/context/__tests__/media-store.test.ts +0 -509
- package/src/context/error-handling.ts +0 -398
- package/src/context/media-context.tsx +0 -254
- package/src/context/media-provider.tsx +0 -264
- package/src/context/media-store.ts +0 -387
- package/src/context/persistence.ts +0 -462
- package/src/core/events/event-system.ts +0 -448
- package/src/core/events/hooks.ts +0 -325
- package/src/core/events/index.ts +0 -22
- package/src/core/events/middleware.ts +0 -286
- package/src/core/index.ts +0 -22
- package/src/core/optimization/bundle-optimizer.tsx +0 -312
- package/src/core/performance/cicd.ts +0 -98
- package/src/core/performance/index.ts +0 -38
- package/src/core/performance/media-loading-optimizer.ts +0 -544
- package/src/core/performance/performance-budgets.ts +0 -437
- package/src/core/performance/performance-monitor.tsx +0 -488
- package/src/core/performance/performance-testing.ts +0 -461
- package/src/core/plugins/__tests__/registry.test.ts +0 -595
- package/src/core/plugins/base-plugin.ts +0 -225
- package/src/core/plugins/enhanced-plugin-system.ts +0 -435
- package/src/core/plugins/examples/analytics-plugin.ts +0 -241
- package/src/core/plugins/index.ts +0 -39
- package/src/core/plugins/registry.ts +0 -546
- package/src/core/plugins/types.ts +0 -169
- package/src/core/plugins/utils.ts +0 -317
- package/src/core/progressive-loading.tsx +0 -331
- package/src/core/providers/enhanced-hls-provider.ts +0 -307
- package/src/core/providers/lazy-provider.tsx +0 -14
- package/src/core/providers/service-provider.tsx +0 -164
- package/src/core/utils.tsx +0 -34
- package/src/features/media-session/media-session-manager.ts +0 -411
- package/src/features/picture-in-picture/pip-manager.ts +0 -428
- package/src/features/playlist/playlist-manager.ts +0 -626
- package/src/features/subtitles/subtitle-manager.ts +0 -435
- package/src/features/subtitles/subtitle-parser.ts +0 -284
- package/src/features/thumbnails/thumbnail-generator.ts +0 -528
- package/src/hooks/__tests__/currentTime-fix.test.ts +0 -149
- package/src/hooks/__tests__/use-media-player.test.ts +0 -712
- package/src/hooks/__tests__/use-media-state.test.tsx +0 -316
- package/src/hooks/accessibility/index.ts +0 -27
- package/src/hooks/accessibility/use-accessibility-preferences.ts +0 -190
- package/src/hooks/accessibility/use-focus-management.ts +0 -183
- package/src/hooks/accessibility/use-keyboard-shortcuts.ts +0 -152
- package/src/hooks/accessibility/use-screen-reader.ts +0 -212
- package/src/hooks/core/index.ts +0 -47
- package/src/hooks/legacy.ts +0 -21
- package/src/hooks/use-buffer-health.ts +0 -218
- package/src/hooks/use-enhanced-media-player.ts +0 -575
- package/src/hooks/use-focus-trap.tsx +0 -162
- package/src/hooks/use-intelligent-preloading.ts +0 -387
- package/src/hooks/use-keyboard-controls.ts +0 -115
- package/src/hooks/use-keyboard-shortcuts.ts +0 -255
- package/src/hooks/use-media-actions.ts +0 -184
- package/src/hooks/use-media-metadata.ts +0 -91
- package/src/hooks/use-media-optimistic.ts +0 -264
- package/src/hooks/use-media-player.ts +0 -343
- package/src/hooks/use-media-state.ts +0 -194
- package/src/hooks/use-memory-optimization.ts +0 -360
- package/src/hooks/use-network-status.ts +0 -124
- package/src/hooks/use-optimistic-controls.ts +0 -95
- package/src/hooks/use-optimized-media.ts +0 -283
- package/src/hooks/use-smart-preload.ts +0 -229
- package/src/hooks/use-touch-gestures.ts +0 -461
- package/src/hooks/useEnhancedSubtitles.ts +0 -258
- package/src/hooks/useKeyboardShortcuts.ts +0 -106
- package/src/hooks/useMediaControls.ts +0 -52
- package/src/hooks/useScreenshot.ts +0 -61
- package/src/hooks/useSubtitles.ts +0 -91
- package/src/hooks/useVideoPlayer.ts +0 -278
- package/src/icons/components/FullscreenIcon.tsx +0 -36
- package/src/icons/components/SettingsIcon.tsx +0 -37
- package/src/icons/components/animated/LoadingIcon.tsx +0 -27
- package/src/icons/components/animated/PlayPauseIcon.tsx +0 -42
- package/src/icons/components/media/PauseIcon.tsx +0 -38
- package/src/icons/components/media/PlayIcon.tsx +0 -37
- package/src/icons/components/volume/VolumeIcon.tsx +0 -38
- package/src/icons/components/volume/VolumeOffIcon.tsx +0 -38
- package/src/icons/index.ts +0 -56
- package/src/icons/provider.tsx +0 -58
- package/src/icons/types.ts +0 -60
- package/src/index-enhanced.ts +0 -35
- package/src/index-legacy.ts +0 -324
- package/src/index.css +0 -102
- package/src/lib/__tests__/async-utils.test.ts +0 -291
- package/src/lib/async-utils.ts +0 -194
- package/src/lib/deprecation.ts +0 -51
- package/src/lib/format-time.ts +0 -37
- package/src/lib/index.ts +0 -4
- package/src/lib/utils.ts +0 -6
- package/src/styles/globals.css +0 -462
- package/src/styles/minimal-player.css +0 -621
- package/src/styles/pixel-art.css +0 -41
- package/src/styles/videojs.css +0 -100
- package/src/types/events.ts +0 -47
- package/src/types/formats.ts +0 -79
- package/src/types/index.ts +0 -203
- package/src/types/videojs-plugins.d.ts +0 -14
|
@@ -1,573 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React, {
|
|
4
|
-
useCallback,
|
|
5
|
-
useEffect,
|
|
6
|
-
useRef,
|
|
7
|
-
useState,
|
|
8
|
-
useTransition,
|
|
9
|
-
useOptimistic,
|
|
10
|
-
useDeferredValue,
|
|
11
|
-
Suspense
|
|
12
|
-
} from "react"
|
|
13
|
-
import { useIntelligentPreloading } from "../../../hooks/use-intelligent-preloading"
|
|
14
|
-
import { cn } from "../../../lib/utils"
|
|
15
|
-
import { DebugPanel } from "../../enhanced/debug-panel"
|
|
16
|
-
import { PerformanceIndicator } from "../../enhanced/enhanced-controls"
|
|
17
|
-
import type { IconSet } from "../../icons"
|
|
18
|
-
import { defaultMinimalIcons } from "../../icons"
|
|
19
|
-
import { MediaPlayerRoot } from "../../media-player-root"
|
|
20
|
-
import { MediaPlayerVideo } from "../../media-player-video"
|
|
21
|
-
import { MinimalControls } from "./MinimalControls"
|
|
22
|
-
import { MinimalLoading } from "./MinimalLoading"
|
|
23
|
-
import { MinimalOverlay } from "./MinimalOverlay"
|
|
24
|
-
|
|
25
|
-
export interface EnhancedMinimalMediaPlayerProps {
|
|
26
|
-
src: string | string[]
|
|
27
|
-
poster?: string
|
|
28
|
-
autoPlay?: boolean
|
|
29
|
-
muted?: boolean
|
|
30
|
-
loop?: boolean
|
|
31
|
-
autoHideControls?: boolean
|
|
32
|
-
hideDelay?: number
|
|
33
|
-
theme?: "dark" | "light" | "transparent"
|
|
34
|
-
customIcons?: IconSet
|
|
35
|
-
showCenterPlayButton?: boolean
|
|
36
|
-
showLoadingSpinner?: boolean
|
|
37
|
-
className?: string
|
|
38
|
-
onPlay?: () => void
|
|
39
|
-
onPause?: () => void
|
|
40
|
-
onEnded?: () => void
|
|
41
|
-
onTimeUpdate?: (currentTime: number) => void
|
|
42
|
-
onVolumeChange?: (volume: number) => void
|
|
43
|
-
onSeek?: (time: number) => void
|
|
44
|
-
onError?: (error: Error) => void
|
|
45
|
-
watermark?: {
|
|
46
|
-
src: string
|
|
47
|
-
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"
|
|
48
|
-
opacity?: number
|
|
49
|
-
size?: "small" | "medium" | "large"
|
|
50
|
-
}
|
|
51
|
-
qualities?: Array<{
|
|
52
|
-
src: string
|
|
53
|
-
quality: string
|
|
54
|
-
default?: boolean
|
|
55
|
-
}>
|
|
56
|
-
showQualitySelector?: boolean
|
|
57
|
-
showSpeedControl?: boolean
|
|
58
|
-
thumbnails?: string
|
|
59
|
-
|
|
60
|
-
// Enhanced features
|
|
61
|
-
enableIntelligentPreloading?: boolean
|
|
62
|
-
enablePerformanceMonitoring?: boolean
|
|
63
|
-
showDebugPanel?: boolean
|
|
64
|
-
preloadingStrategy?: "conservative" | "balanced" | "aggressive"
|
|
65
|
-
enableReact19Optimizations?: boolean
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface MediaState {
|
|
69
|
-
isPlaying: boolean
|
|
70
|
-
isLoading: boolean
|
|
71
|
-
error: string | null
|
|
72
|
-
controlsVisible: boolean
|
|
73
|
-
isHovered: boolean
|
|
74
|
-
userInteracting: boolean
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
interface PerformanceMetrics {
|
|
78
|
-
fps: number
|
|
79
|
-
bufferHealth: number
|
|
80
|
-
quality: number
|
|
81
|
-
bandwidth: number
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function EnhancedMinimalMediaPlayer({
|
|
85
|
-
src,
|
|
86
|
-
poster,
|
|
87
|
-
autoPlay = false,
|
|
88
|
-
muted = false,
|
|
89
|
-
loop = false,
|
|
90
|
-
autoHideControls = true,
|
|
91
|
-
hideDelay = 2500,
|
|
92
|
-
theme = "dark",
|
|
93
|
-
customIcons,
|
|
94
|
-
showCenterPlayButton = true,
|
|
95
|
-
showLoadingSpinner = true,
|
|
96
|
-
className,
|
|
97
|
-
onPlay,
|
|
98
|
-
onPause,
|
|
99
|
-
onEnded,
|
|
100
|
-
onTimeUpdate,
|
|
101
|
-
onVolumeChange,
|
|
102
|
-
onSeek,
|
|
103
|
-
onError,
|
|
104
|
-
watermark,
|
|
105
|
-
qualities,
|
|
106
|
-
showQualitySelector = false,
|
|
107
|
-
showSpeedControl = false,
|
|
108
|
-
thumbnails,
|
|
109
|
-
|
|
110
|
-
// Enhanced features
|
|
111
|
-
enableIntelligentPreloading = true,
|
|
112
|
-
enablePerformanceMonitoring = process.env.NODE_ENV === "development",
|
|
113
|
-
showDebugPanel = false,
|
|
114
|
-
preloadingStrategy = "balanced",
|
|
115
|
-
enableReact19Optimizations = true
|
|
116
|
-
}: EnhancedMinimalMediaPlayerProps) {
|
|
117
|
-
// React 19 concurrent features
|
|
118
|
-
const [isPending, startTransition] = useTransition()
|
|
119
|
-
|
|
120
|
-
// Optimistic state for instant UI updates
|
|
121
|
-
const optimisticState = useOptimistic(
|
|
122
|
-
{ isPlaying: false, isLoading: false, controlsVisible: true },
|
|
123
|
-
(state, update: Partial<MediaState>) => ({ ...state, ...update })
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
// Deferred values for non-critical updates
|
|
127
|
-
const deferredCurrentTime = useDeferredValue(0)
|
|
128
|
-
const deferredVolume = useDeferredValue(1)
|
|
129
|
-
|
|
130
|
-
// State management
|
|
131
|
-
const [mediaState, setMediaState] = useState<MediaState>({
|
|
132
|
-
isPlaying: false,
|
|
133
|
-
isLoading: false,
|
|
134
|
-
error: null,
|
|
135
|
-
controlsVisible: true,
|
|
136
|
-
isHovered: false,
|
|
137
|
-
userInteracting: false
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
// Performance metrics
|
|
141
|
-
const [performanceMetrics, setPerformanceMetrics] = useState<PerformanceMetrics>({
|
|
142
|
-
fps: 0,
|
|
143
|
-
bufferHealth: 0,
|
|
144
|
-
quality: 0,
|
|
145
|
-
bandwidth: 0
|
|
146
|
-
})
|
|
147
|
-
|
|
148
|
-
// Refs
|
|
149
|
-
const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
150
|
-
const containerRef = useRef<HTMLDivElement | null>(null)
|
|
151
|
-
const videoRef = useRef<HTMLVideoElement | null>(null)
|
|
152
|
-
const frameCountRef = useRef(0)
|
|
153
|
-
const lastTimeRef = useRef(performance.now())
|
|
154
|
-
|
|
155
|
-
// Merge default icons with custom icons
|
|
156
|
-
const icons = { ...defaultMinimalIcons, ...customIcons }
|
|
157
|
-
|
|
158
|
-
// Prepare media sources for preloading
|
|
159
|
-
const mediaSources = React.useMemo(() => {
|
|
160
|
-
if (qualities && qualities.length > 0) {
|
|
161
|
-
return qualities.map((q) => ({ src: q.src, type: "video/mp4" as const }))
|
|
162
|
-
}
|
|
163
|
-
const sources = Array.isArray(src) ? src : [src]
|
|
164
|
-
return sources.map((s) => ({ src: s, type: "video/mp4" as const }))
|
|
165
|
-
}, [src, qualities])
|
|
166
|
-
|
|
167
|
-
// Intelligent preloading
|
|
168
|
-
const preloadingControls = useIntelligentPreloading(mediaSources, {
|
|
169
|
-
trackUserBehavior: enableIntelligentPreloading,
|
|
170
|
-
adaptToNetwork: true,
|
|
171
|
-
strategy: preloadingStrategy,
|
|
172
|
-
maxPreloadItems: 2
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
// Auto-hide controls logic
|
|
176
|
-
const resetHideTimer = useCallback(() => {
|
|
177
|
-
if (!autoHideControls) return
|
|
178
|
-
|
|
179
|
-
if (hideTimeoutRef.current) {
|
|
180
|
-
clearTimeout(hideTimeoutRef.current)
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
startTransition(() => {
|
|
184
|
-
setMediaState((prev) => ({ ...prev, controlsVisible: true }))
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
if (!mediaState.userInteracting && mediaState.isPlaying) {
|
|
188
|
-
hideTimeoutRef.current = setTimeout(() => {
|
|
189
|
-
startTransition(() => {
|
|
190
|
-
setMediaState((prev) => ({ ...prev, controlsVisible: false }))
|
|
191
|
-
})
|
|
192
|
-
}, hideDelay)
|
|
193
|
-
}
|
|
194
|
-
}, [
|
|
195
|
-
autoHideControls,
|
|
196
|
-
hideDelay,
|
|
197
|
-
mediaState.userInteracting,
|
|
198
|
-
mediaState.isPlaying,
|
|
199
|
-
startTransition
|
|
200
|
-
])
|
|
201
|
-
|
|
202
|
-
// Handle mouse movement
|
|
203
|
-
const handleMouseMove = useCallback(() => {
|
|
204
|
-
resetHideTimer()
|
|
205
|
-
}, [resetHideTimer])
|
|
206
|
-
|
|
207
|
-
// Handle mouse enter/leave
|
|
208
|
-
const handleMouseEnter = useCallback(() => {
|
|
209
|
-
startTransition(() => {
|
|
210
|
-
setMediaState((prev) => ({ ...prev, isHovered: true, controlsVisible: true }))
|
|
211
|
-
})
|
|
212
|
-
if (hideTimeoutRef.current) {
|
|
213
|
-
clearTimeout(hideTimeoutRef.current)
|
|
214
|
-
}
|
|
215
|
-
}, [startTransition])
|
|
216
|
-
|
|
217
|
-
const handleMouseLeave = useCallback(() => {
|
|
218
|
-
startTransition(() => {
|
|
219
|
-
setMediaState((prev) => ({ ...prev, isHovered: false }))
|
|
220
|
-
})
|
|
221
|
-
if (mediaState.isPlaying && autoHideControls && !mediaState.userInteracting) {
|
|
222
|
-
hideTimeoutRef.current = setTimeout(() => {
|
|
223
|
-
startTransition(() => {
|
|
224
|
-
setMediaState((prev) => ({ ...prev, controlsVisible: false }))
|
|
225
|
-
})
|
|
226
|
-
}, 500)
|
|
227
|
-
}
|
|
228
|
-
}, [mediaState.isPlaying, autoHideControls, mediaState.userInteracting, startTransition])
|
|
229
|
-
|
|
230
|
-
// Handle user interaction
|
|
231
|
-
const handleUserInteractionStart = useCallback(() => {
|
|
232
|
-
startTransition(() => {
|
|
233
|
-
setMediaState((prev) => ({ ...prev, userInteracting: true, controlsVisible: true }))
|
|
234
|
-
})
|
|
235
|
-
if (hideTimeoutRef.current) {
|
|
236
|
-
clearTimeout(hideTimeoutRef.current)
|
|
237
|
-
}
|
|
238
|
-
}, [startTransition])
|
|
239
|
-
|
|
240
|
-
const handleUserInteractionEnd = useCallback(() => {
|
|
241
|
-
startTransition(() => {
|
|
242
|
-
setMediaState((prev) => ({ ...prev, userInteracting: false }))
|
|
243
|
-
})
|
|
244
|
-
resetHideTimer()
|
|
245
|
-
}, [resetHideTimer, startTransition])
|
|
246
|
-
|
|
247
|
-
// Handle play state changes
|
|
248
|
-
const handlePlayStateChange = useCallback(
|
|
249
|
-
(playing: boolean) => {
|
|
250
|
-
startTransition(() => {
|
|
251
|
-
setMediaState((prev) => ({ ...prev, isPlaying: playing }))
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
if (playing) {
|
|
255
|
-
onPlay?.()
|
|
256
|
-
resetHideTimer()
|
|
257
|
-
} else {
|
|
258
|
-
onPause?.()
|
|
259
|
-
startTransition(() => {
|
|
260
|
-
setMediaState((prev) => ({ ...prev, controlsVisible: true }))
|
|
261
|
-
})
|
|
262
|
-
if (hideTimeoutRef.current) {
|
|
263
|
-
clearTimeout(hideTimeoutRef.current)
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
[onPlay, onPause, resetHideTimer, startTransition]
|
|
268
|
-
)
|
|
269
|
-
|
|
270
|
-
// Handle loading state
|
|
271
|
-
const handleLoadStart = useCallback(() => {
|
|
272
|
-
startTransition(() => {
|
|
273
|
-
setMediaState((prev) => ({ ...prev, isLoading: true, error: null }))
|
|
274
|
-
})
|
|
275
|
-
}, [startTransition])
|
|
276
|
-
|
|
277
|
-
const handleLoadedData = useCallback(() => {
|
|
278
|
-
startTransition(() => {
|
|
279
|
-
setMediaState((prev) => ({ ...prev, isLoading: false }))
|
|
280
|
-
})
|
|
281
|
-
}, [startTransition])
|
|
282
|
-
|
|
283
|
-
// Handle errors
|
|
284
|
-
const handleError = useCallback(
|
|
285
|
-
(e: Error) => {
|
|
286
|
-
startTransition(() => {
|
|
287
|
-
setMediaState((prev) => ({
|
|
288
|
-
...prev,
|
|
289
|
-
isLoading: false,
|
|
290
|
-
error: e.message || "An error occurred"
|
|
291
|
-
}))
|
|
292
|
-
})
|
|
293
|
-
onError?.(e)
|
|
294
|
-
},
|
|
295
|
-
[onError, startTransition]
|
|
296
|
-
)
|
|
297
|
-
|
|
298
|
-
// Performance monitoring
|
|
299
|
-
useEffect(() => {
|
|
300
|
-
if (!enablePerformanceMonitoring) return
|
|
301
|
-
|
|
302
|
-
const measureFPS = () => {
|
|
303
|
-
frameCountRef.current++
|
|
304
|
-
const currentTime = performance.now()
|
|
305
|
-
|
|
306
|
-
if (currentTime - lastTimeRef.current >= 1000) {
|
|
307
|
-
const fps = Math.round((frameCountRef.current * 1000) / (currentTime - lastTimeRef.current))
|
|
308
|
-
|
|
309
|
-
startTransition(() => {
|
|
310
|
-
setPerformanceMetrics((prev) => ({ ...prev, fps }))
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
frameCountRef.current = 0
|
|
314
|
-
lastTimeRef.current = currentTime
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
if (videoRef.current && !videoRef.current.paused) {
|
|
318
|
-
requestAnimationFrame(measureFPS)
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (videoRef.current) {
|
|
323
|
-
videoRef.current.addEventListener("play", measureFPS)
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
return () => {
|
|
327
|
-
if (videoRef.current) {
|
|
328
|
-
videoRef.current.removeEventListener("play", measureFPS)
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}, [enablePerformanceMonitoring, startTransition])
|
|
332
|
-
|
|
333
|
-
// Buffer health monitoring
|
|
334
|
-
useEffect(() => {
|
|
335
|
-
if (!enablePerformanceMonitoring || !videoRef.current) return
|
|
336
|
-
|
|
337
|
-
const updateBufferHealth = () => {
|
|
338
|
-
if (videoRef.current) {
|
|
339
|
-
const buffered = videoRef.current.buffered
|
|
340
|
-
const currentTime = videoRef.current.currentTime
|
|
341
|
-
let bufferHealth = 0
|
|
342
|
-
|
|
343
|
-
for (let i = 0; i < buffered.length; i++) {
|
|
344
|
-
const start = buffered.start(i)
|
|
345
|
-
const end = buffered.end(i)
|
|
346
|
-
if (start <= currentTime && end > currentTime) {
|
|
347
|
-
bufferHealth = end - currentTime
|
|
348
|
-
break
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
startTransition(() => {
|
|
353
|
-
setPerformanceMetrics((prev) => ({ ...prev, bufferHealth }))
|
|
354
|
-
})
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
const interval = setInterval(updateBufferHealth, 500)
|
|
359
|
-
return () => clearInterval(interval)
|
|
360
|
-
}, [enablePerformanceMonitoring, startTransition])
|
|
361
|
-
|
|
362
|
-
// Cleanup on unmount
|
|
363
|
-
useEffect(() => {
|
|
364
|
-
return () => {
|
|
365
|
-
if (hideTimeoutRef.current) {
|
|
366
|
-
clearTimeout(hideTimeoutRef.current)
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}, [])
|
|
370
|
-
|
|
371
|
-
// Determine video source
|
|
372
|
-
const videoSrc =
|
|
373
|
-
qualities && qualities.length > 0
|
|
374
|
-
? qualities.find((q) => q.default)?.src ||
|
|
375
|
-
qualities[0]?.src ||
|
|
376
|
-
(typeof src === "string" ? src : src[0])
|
|
377
|
-
: typeof src === "string"
|
|
378
|
-
? src
|
|
379
|
-
: src[0]
|
|
380
|
-
|
|
381
|
-
// Determine current quality for performance display
|
|
382
|
-
const currentQuality = React.useMemo(() => {
|
|
383
|
-
if (!qualities || !videoRef.current) return 0
|
|
384
|
-
const currentSrc = videoRef.current.currentSrc
|
|
385
|
-
const currentQuality = qualities.find((q) => q.src === currentSrc || q.src.includes(currentSrc))
|
|
386
|
-
return parseInt(currentQuality?.quality?.replace("p", "") || "0") || 0
|
|
387
|
-
}, [qualities, videoRef.current?.currentSrc])
|
|
388
|
-
|
|
389
|
-
return (
|
|
390
|
-
<div
|
|
391
|
-
ref={containerRef}
|
|
392
|
-
className={cn(
|
|
393
|
-
"enhanced-minimal-player theme-minimal relative overflow-hidden rounded-lg bg-black",
|
|
394
|
-
`theme-minimal-${theme}`,
|
|
395
|
-
className
|
|
396
|
-
)}
|
|
397
|
-
data-theme={theme}
|
|
398
|
-
onMouseMove={handleMouseMove}
|
|
399
|
-
onMouseEnter={handleMouseEnter}
|
|
400
|
-
onMouseLeave={handleMouseLeave}>
|
|
401
|
-
<MediaPlayerRoot
|
|
402
|
-
className="relative h-full w-full"
|
|
403
|
-
autoHide={false}
|
|
404
|
-
enableGestures={true}
|
|
405
|
-
enableMobileOptimizations={true}>
|
|
406
|
-
{/* Media Resource Preloader */}
|
|
407
|
-
{enableIntelligentPreloading && (
|
|
408
|
-
<Suspense fallback={null}>
|
|
409
|
-
<div className="pointer-events-none absolute inset-0 z-10">
|
|
410
|
-
{/* Preloader component would go here */}
|
|
411
|
-
</div>
|
|
412
|
-
</Suspense>
|
|
413
|
-
)}
|
|
414
|
-
|
|
415
|
-
{/* Video Element */}
|
|
416
|
-
<MediaPlayerVideo
|
|
417
|
-
|
|
418
|
-
src={videoSrc}
|
|
419
|
-
poster={poster}
|
|
420
|
-
autoPlay={autoPlay}
|
|
421
|
-
muted={muted}
|
|
422
|
-
loop={loop}
|
|
423
|
-
playsInline
|
|
424
|
-
crossOrigin="anonymous"
|
|
425
|
-
onPlay={() => handlePlayStateChange(true)}
|
|
426
|
-
onPause={() => handlePlayStateChange(false)}
|
|
427
|
-
onEnded={onEnded}
|
|
428
|
-
onTimeUpdate={(e) => {
|
|
429
|
-
const video = e.currentTarget as HTMLVideoElement
|
|
430
|
-
onTimeUpdate?.(deferredCurrentTime || video.currentTime)
|
|
431
|
-
}}
|
|
432
|
-
onVolumeChange={(e) => {
|
|
433
|
-
const video = e.currentTarget as HTMLVideoElement
|
|
434
|
-
onVolumeChange?.(deferredVolume || video.volume)
|
|
435
|
-
}}
|
|
436
|
-
onLoadStart={handleLoadStart}
|
|
437
|
-
onLoadedData={handleLoadedData}
|
|
438
|
-
onError={(e) => handleError(new Error("Failed to load video"))}
|
|
439
|
-
/>
|
|
440
|
-
|
|
441
|
-
{/* Loading State */}
|
|
442
|
-
{showLoadingSpinner && (mediaState.isLoading || isPending) && (
|
|
443
|
-
<MinimalLoading icon={icons.spinner} />
|
|
444
|
-
)}
|
|
445
|
-
|
|
446
|
-
{/* Error State */}
|
|
447
|
-
{mediaState.error && (
|
|
448
|
-
<div className="absolute inset-0 z-50 flex items-center justify-center bg-black/80">
|
|
449
|
-
<div className="text-center">
|
|
450
|
-
<div className="mb-4 text-red-500">
|
|
451
|
-
<svg
|
|
452
|
-
className="mx-auto h-12 w-12"
|
|
453
|
-
fill="none"
|
|
454
|
-
viewBox="0 0 24 24"
|
|
455
|
-
stroke="currentColor">
|
|
456
|
-
<path
|
|
457
|
-
strokeLinecap="round"
|
|
458
|
-
strokeLinejoin="round"
|
|
459
|
-
strokeWidth={2}
|
|
460
|
-
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
461
|
-
/>
|
|
462
|
-
</svg>
|
|
463
|
-
</div>
|
|
464
|
-
<p className="mb-2 text-lg text-white">Playback Error</p>
|
|
465
|
-
<p className="text-gray-400 text-sm">{mediaState.error}</p>
|
|
466
|
-
</div>
|
|
467
|
-
</div>
|
|
468
|
-
)}
|
|
469
|
-
|
|
470
|
-
{/* Watermark */}
|
|
471
|
-
{watermark && (
|
|
472
|
-
<div
|
|
473
|
-
className={cn("pointer-events-none absolute z-20", {
|
|
474
|
-
"top-4 left-4": watermark.position === "top-left",
|
|
475
|
-
"top-4 right-4": watermark.position === "top-right",
|
|
476
|
-
"bottom-16 left-4": watermark.position === "bottom-left",
|
|
477
|
-
"right-4 bottom-16": watermark.position === "bottom-right"
|
|
478
|
-
})}
|
|
479
|
-
style={{ opacity: watermark.opacity || 0.7 }}>
|
|
480
|
-
<img
|
|
481
|
-
src={watermark.src}
|
|
482
|
-
alt=""
|
|
483
|
-
className={cn("object-contain", {
|
|
484
|
-
"h-8": watermark.size === "small",
|
|
485
|
-
"h-12": watermark.size === "medium" || !watermark.size,
|
|
486
|
-
"h-16": watermark.size === "large"
|
|
487
|
-
})}
|
|
488
|
-
/>
|
|
489
|
-
</div>
|
|
490
|
-
)}
|
|
491
|
-
|
|
492
|
-
{/* Center Play Button */}
|
|
493
|
-
{showCenterPlayButton && !mediaState.isPlaying && !mediaState.isLoading && (
|
|
494
|
-
<MinimalOverlay
|
|
495
|
-
visible={true}
|
|
496
|
-
showCenterButton={true}
|
|
497
|
-
isPlaying={mediaState.isPlaying}
|
|
498
|
-
icons={icons}
|
|
499
|
-
onPlayPause={() => {
|
|
500
|
-
const video = containerRef.current?.querySelector("video")
|
|
501
|
-
if (video) {
|
|
502
|
-
if (mediaState.isPlaying) {
|
|
503
|
-
video.pause()
|
|
504
|
-
} else {
|
|
505
|
-
video.play()
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
}}
|
|
509
|
-
/>
|
|
510
|
-
)}
|
|
511
|
-
|
|
512
|
-
{/* Controls */}
|
|
513
|
-
<MinimalControls
|
|
514
|
-
visible={mediaState.controlsVisible || !mediaState.isPlaying || mediaState.isHovered}
|
|
515
|
-
icons={icons}
|
|
516
|
-
isPlaying={mediaState.isPlaying}
|
|
517
|
-
showQualitySelector={showQualitySelector}
|
|
518
|
-
showSpeedControl={showSpeedControl}
|
|
519
|
-
qualities={qualities}
|
|
520
|
-
thumbnails={thumbnails}
|
|
521
|
-
onUserInteractionStart={handleUserInteractionStart}
|
|
522
|
-
onUserInteractionEnd={handleUserInteractionEnd}
|
|
523
|
-
onSeek={onSeek}
|
|
524
|
-
/>
|
|
525
|
-
|
|
526
|
-
{/* Performance Indicator (development only) */}
|
|
527
|
-
{enablePerformanceMonitoring && (
|
|
528
|
-
<div className="absolute top-2 left-2 z-30">
|
|
529
|
-
<PerformanceIndicator
|
|
530
|
-
metrics={{
|
|
531
|
-
fps: performanceMetrics.fps,
|
|
532
|
-
bufferHealth: performanceMetrics.bufferHealth,
|
|
533
|
-
quality: currentQuality,
|
|
534
|
-
bandwidth: performanceMetrics.bandwidth
|
|
535
|
-
}}
|
|
536
|
-
className="text-white/60 text-xs"
|
|
537
|
-
/>
|
|
538
|
-
</div>
|
|
539
|
-
)}
|
|
540
|
-
</MediaPlayerRoot>
|
|
541
|
-
|
|
542
|
-
{/* Debug Panel */}
|
|
543
|
-
{showDebugPanel && (
|
|
544
|
-
<DebugPanel
|
|
545
|
-
performanceMetrics={{
|
|
546
|
-
fps: performanceMetrics.fps,
|
|
547
|
-
bufferHealth: performanceMetrics.bufferHealth,
|
|
548
|
-
networkBandwidth: performanceMetrics.bandwidth
|
|
549
|
-
}}
|
|
550
|
-
playbackState={{
|
|
551
|
-
currentTime: deferredCurrentTime,
|
|
552
|
-
duration: videoRef.current?.duration || 0,
|
|
553
|
-
volume: deferredVolume,
|
|
554
|
-
isPlaying: mediaState.isPlaying,
|
|
555
|
-
quality: currentQuality,
|
|
556
|
-
isBuffering: mediaState.isLoading || isPending
|
|
557
|
-
}}
|
|
558
|
-
preloadingStats={{
|
|
559
|
-
preloadedItems: preloadingControls.getStats().preloadedItems,
|
|
560
|
-
engagementScore: preloadingControls.getStats().engagementScore,
|
|
561
|
-
queueLength: preloadingControls.getStats().queueLength,
|
|
562
|
-
hitRate: 0,
|
|
563
|
-
totalSaved: 0
|
|
564
|
-
}}
|
|
565
|
-
position="top-right"
|
|
566
|
-
title="Enhanced Minimal Player Debug"
|
|
567
|
-
/>
|
|
568
|
-
)}
|
|
569
|
-
</div>
|
|
570
|
-
)
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
export default EnhancedMinimalMediaPlayer
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React from "react"
|
|
4
|
-
import { cn } from "../../../lib/utils"
|
|
5
|
-
import type { IconSet } from "../../icons"
|
|
6
|
-
import { MediaPlayerFullscreen } from "../../media-player-fullscreen"
|
|
7
|
-
import { MediaPlayerPlay } from "../../media-player-play"
|
|
8
|
-
import { MediaPlayerSeek } from "../../media-player-seek"
|
|
9
|
-
import { MediaPlayerTime } from "../../media-player-time"
|
|
10
|
-
import { MediaPlayerVolume } from "../../media-player-volume"
|
|
11
|
-
import { MinimalPlayButton } from "./MinimalPlayButton"
|
|
12
|
-
import { MinimalSeekBar } from "./MinimalSeekBar"
|
|
13
|
-
import { MinimalVolumeControl } from "./MinimalVolumeControl"
|
|
14
|
-
|
|
15
|
-
export interface MinimalControlsProps {
|
|
16
|
-
visible: boolean
|
|
17
|
-
icons: IconSet
|
|
18
|
-
isPlaying: boolean
|
|
19
|
-
showQualitySelector?: boolean
|
|
20
|
-
showSpeedControl?: boolean
|
|
21
|
-
qualities?: Array<{
|
|
22
|
-
src: string
|
|
23
|
-
quality: string
|
|
24
|
-
default?: boolean
|
|
25
|
-
}>
|
|
26
|
-
thumbnails?: string
|
|
27
|
-
onUserInteractionStart?: () => void
|
|
28
|
-
onUserInteractionEnd?: () => void
|
|
29
|
-
onSeek?: (time: number) => void
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function MinimalControls({
|
|
33
|
-
visible,
|
|
34
|
-
icons,
|
|
35
|
-
isPlaying,
|
|
36
|
-
showQualitySelector,
|
|
37
|
-
showSpeedControl,
|
|
38
|
-
qualities,
|
|
39
|
-
thumbnails,
|
|
40
|
-
onUserInteractionStart,
|
|
41
|
-
onUserInteractionEnd,
|
|
42
|
-
onSeek
|
|
43
|
-
}: MinimalControlsProps) {
|
|
44
|
-
return (
|
|
45
|
-
<div
|
|
46
|
-
className={cn(
|
|
47
|
-
"minimal-control-bar",
|
|
48
|
-
"absolute right-0 bottom-0 left-0 z-40",
|
|
49
|
-
"px-6 py-3 transition-all duration-200",
|
|
50
|
-
visible ? "minimal-controls-visible" : "minimal-controls-hidden"
|
|
51
|
-
)}
|
|
52
|
-
data-hidden={!visible}
|
|
53
|
-
onMouseDown={onUserInteractionStart}
|
|
54
|
-
onMouseUp={onUserInteractionEnd}
|
|
55
|
-
onTouchStart={onUserInteractionStart}
|
|
56
|
-
onTouchEnd={onUserInteractionEnd}>
|
|
57
|
-
{/* Seek Bar - Top of controls */}
|
|
58
|
-
<div className="mb-2">
|
|
59
|
-
<MinimalSeekBar thumbnails={thumbnails} onSeek={onSeek} />
|
|
60
|
-
</div>
|
|
61
|
-
|
|
62
|
-
{/* Main Controls Row */}
|
|
63
|
-
<div className="flex items-center justify-between gap-3">
|
|
64
|
-
{/* Left Side Controls */}
|
|
65
|
-
<div className="flex items-center gap-3">
|
|
66
|
-
{/* Play/Pause Button */}
|
|
67
|
-
<MinimalPlayButton isPlaying={isPlaying} icons={icons} />
|
|
68
|
-
|
|
69
|
-
{/* Volume Control */}
|
|
70
|
-
<MinimalVolumeControl icons={icons} />
|
|
71
|
-
|
|
72
|
-
{/* Time Display */}
|
|
73
|
-
<div className="minimal-time select-none font-mono text-sm text-white/90">
|
|
74
|
-
<MediaPlayerTime variant="current" />
|
|
75
|
-
<span className="mx-1 text-white/60">/</span>
|
|
76
|
-
<MediaPlayerTime variant="duration" />
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
{/* Right Side Controls */}
|
|
81
|
-
<div className="flex items-center gap-2">
|
|
82
|
-
{/* Quality Selector */}
|
|
83
|
-
{showQualitySelector && qualities && qualities.length > 1 && (
|
|
84
|
-
<button className="minimal-btn w-auto px-3 font-medium text-xs" title="Quality">
|
|
85
|
-
{qualities.find((q) => q.default)?.quality || qualities[0]?.quality || "Auto"}
|
|
86
|
-
</button>
|
|
87
|
-
)}
|
|
88
|
-
|
|
89
|
-
{/* Speed Control */}
|
|
90
|
-
{showSpeedControl && (
|
|
91
|
-
<button className="minimal-btn w-auto px-3 font-medium text-xs" title="Playback Speed">
|
|
92
|
-
1x
|
|
93
|
-
</button>
|
|
94
|
-
)}
|
|
95
|
-
|
|
96
|
-
{/* Settings */}
|
|
97
|
-
{icons.settings && (showQualitySelector || showSpeedControl) && (
|
|
98
|
-
<button className="minimal-btn" title="Settings">
|
|
99
|
-
<icons.settings size={18} />
|
|
100
|
-
</button>
|
|
101
|
-
)}
|
|
102
|
-
|
|
103
|
-
{/* Fullscreen Button */}
|
|
104
|
-
<button
|
|
105
|
-
className="minimal-btn"
|
|
106
|
-
title="Toggle Fullscreen"
|
|
107
|
-
onClick={() => {
|
|
108
|
-
// This would need to be connected to fullscreen logic
|
|
109
|
-
const elem = document.documentElement
|
|
110
|
-
if (!document.fullscreenElement) {
|
|
111
|
-
elem.requestFullscreen?.()
|
|
112
|
-
} else {
|
|
113
|
-
document.exitFullscreen?.()
|
|
114
|
-
}
|
|
115
|
-
}}>
|
|
116
|
-
{document.fullscreenElement
|
|
117
|
-
? icons.exitFullscreen && <icons.exitFullscreen size={18} />
|
|
118
|
-
: icons.fullscreen && <icons.fullscreen size={18} />}
|
|
119
|
-
</button>
|
|
120
|
-
</div>
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
|
-
)
|
|
124
|
-
}
|