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