@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,448 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debug Panel Component for Performance Monitoring
|
|
3
|
-
* Development-only component for displaying performance metrics
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useMemo } from "react"
|
|
7
|
-
import { cn } from "../../lib/utils"
|
|
8
|
-
|
|
9
|
-
interface PerformanceMetrics {
|
|
10
|
-
fps: number
|
|
11
|
-
memoryUsage: number
|
|
12
|
-
bufferHealth: number
|
|
13
|
-
networkBandwidth: number
|
|
14
|
-
droppedFrames: number
|
|
15
|
-
decodedFrames: number
|
|
16
|
-
presentationTime: number
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface PreloadingStats {
|
|
20
|
-
preloadedItems: number
|
|
21
|
-
engagementScore: number
|
|
22
|
-
queueLength: number
|
|
23
|
-
hitRate: number
|
|
24
|
-
totalSaved: number
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface DebugPanelProps {
|
|
28
|
-
/** Performance metrics to display */
|
|
29
|
-
performanceMetrics?: Partial<PerformanceMetrics>
|
|
30
|
-
/** Preloading statistics */
|
|
31
|
-
preloadingStats?: PreloadingStats
|
|
32
|
-
/** Current playback state */
|
|
33
|
-
playbackState?: {
|
|
34
|
-
currentTime: number
|
|
35
|
-
duration: number
|
|
36
|
-
volume: number
|
|
37
|
-
isPlaying: boolean
|
|
38
|
-
quality: number
|
|
39
|
-
isBuffering: boolean
|
|
40
|
-
error?: string
|
|
41
|
-
}
|
|
42
|
-
/** HLS-specific metrics */
|
|
43
|
-
hlsMetrics?: {
|
|
44
|
-
currentLevel: number
|
|
45
|
-
availableLevels: number
|
|
46
|
-
bandwidthEstimate: number
|
|
47
|
-
droppedFrames: number
|
|
48
|
-
}
|
|
49
|
-
/** Plugin information */
|
|
50
|
-
pluginInfo?: {
|
|
51
|
-
loadedPlugins: string[]
|
|
52
|
-
activePlugins: string[]
|
|
53
|
-
pluginCount: number
|
|
54
|
-
}
|
|
55
|
-
/** Additional debug information */
|
|
56
|
-
debugInfo?: Record<string, any>
|
|
57
|
-
/** Custom className */
|
|
58
|
-
className?: string
|
|
59
|
-
/** Panel position */
|
|
60
|
-
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left"
|
|
61
|
-
/** Whether the panel is collapsed by default */
|
|
62
|
-
defaultCollapsed?: boolean
|
|
63
|
-
/** Custom title */
|
|
64
|
-
title?: string
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Debug Panel Component
|
|
69
|
-
*/
|
|
70
|
-
export const DebugPanel: React.FC<DebugPanelProps> = ({
|
|
71
|
-
performanceMetrics = {},
|
|
72
|
-
preloadingStats = {} as PreloadingStats,
|
|
73
|
-
playbackState = {} as any,
|
|
74
|
-
hlsMetrics = {},
|
|
75
|
-
pluginInfo = {},
|
|
76
|
-
debugInfo = {},
|
|
77
|
-
className,
|
|
78
|
-
position = "top-right",
|
|
79
|
-
defaultCollapsed = false,
|
|
80
|
-
title = "BaroiPlayer Debug Panel"
|
|
81
|
-
}) => {
|
|
82
|
-
const [isCollapsed, setIsCollapsed] = React.useState(defaultCollapsed)
|
|
83
|
-
const [activeTab, setActiveTab] = React.useState<"performance" | "hls" | "plugins" | "debug">(
|
|
84
|
-
"performance"
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
// Position classes
|
|
88
|
-
const positionClasses = useMemo(() => {
|
|
89
|
-
switch (position) {
|
|
90
|
-
case "top-left":
|
|
91
|
-
return "top-4 left-4"
|
|
92
|
-
case "top-right":
|
|
93
|
-
return "top-4 right-4"
|
|
94
|
-
case "bottom-left":
|
|
95
|
-
return "bottom-4 left-4"
|
|
96
|
-
case "bottom-right":
|
|
97
|
-
return "bottom-4 right-4"
|
|
98
|
-
default:
|
|
99
|
-
return "top-4 right-4"
|
|
100
|
-
}
|
|
101
|
-
}, [position])
|
|
102
|
-
|
|
103
|
-
// Format bytes
|
|
104
|
-
const formatBytes = (bytes: number): string => {
|
|
105
|
-
if (bytes === 0) return "0 B"
|
|
106
|
-
const k = 1024
|
|
107
|
-
const sizes = ["B", "KB", "MB", "GB"]
|
|
108
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k))
|
|
109
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i]
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Format time
|
|
113
|
-
const formatTime = (seconds: number): string => {
|
|
114
|
-
const mins = Math.floor(seconds / 60)
|
|
115
|
-
const secs = Math.floor(seconds % 60)
|
|
116
|
-
return `${mins}:${secs.toString().padStart(2, "0")}`
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Render performance metrics
|
|
120
|
-
const renderPerformanceMetrics = () => (
|
|
121
|
-
<div className="space-y-2">
|
|
122
|
-
<div className="grid grid-cols-2 gap-2 text-xs">
|
|
123
|
-
<div>
|
|
124
|
-
<span className="text-green-400">FPS:</span>
|
|
125
|
-
<span className="ml-2 font-mono">{performanceMetrics.fps || 0}</span>
|
|
126
|
-
</div>
|
|
127
|
-
<div>
|
|
128
|
-
<span className="text-blue-400">Memory:</span>
|
|
129
|
-
<span className="ml-2 font-mono">
|
|
130
|
-
{((performanceMetrics.memoryUsage || 0) / 1024 / 1024).toFixed(1)} MB
|
|
131
|
-
</span>
|
|
132
|
-
</div>
|
|
133
|
-
<div>
|
|
134
|
-
<span className="text-yellow-400">Buffer:</span>
|
|
135
|
-
<span className="ml-2 font-mono">
|
|
136
|
-
{(performanceMetrics.bufferHealth || 0).toFixed(2)}s
|
|
137
|
-
</span>
|
|
138
|
-
</div>
|
|
139
|
-
<div>
|
|
140
|
-
<span className="text-purple-400">Bandwidth:</span>
|
|
141
|
-
<span className="ml-2 font-mono">
|
|
142
|
-
{formatBytes(performanceMetrics.networkBandwidth || 0)}/s
|
|
143
|
-
</span>
|
|
144
|
-
</div>
|
|
145
|
-
<div>
|
|
146
|
-
<span className="text-red-400">Dropped:</span>
|
|
147
|
-
<span className="ml-2 font-mono">{performanceMetrics.droppedFrames || 0} frames</span>
|
|
148
|
-
</div>
|
|
149
|
-
<div>
|
|
150
|
-
<span className="text-cyan-400">Decoded:</span>
|
|
151
|
-
<span className="ml-2 font-mono">{performanceMetrics.decodedFrames || 0} frames</span>
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
// Render playback state
|
|
158
|
-
const renderPlaybackState = () => (
|
|
159
|
-
<div className="space-y-2">
|
|
160
|
-
<div className="grid grid-cols-2 gap-2 text-xs">
|
|
161
|
-
<div>
|
|
162
|
-
<span className="text-green-400">Status:</span>
|
|
163
|
-
<span className="ml-2 font-mono">
|
|
164
|
-
{playbackState.isPlaying ? (
|
|
165
|
-
<span className="text-green-300">Playing</span>
|
|
166
|
-
) : (
|
|
167
|
-
<span className="text-red-300">Paused</span>
|
|
168
|
-
)}
|
|
169
|
-
</span>
|
|
170
|
-
</div>
|
|
171
|
-
<div>
|
|
172
|
-
<span className="text-blue-400">Time:</span>
|
|
173
|
-
<span className="ml-2 font-mono">
|
|
174
|
-
{formatTime(playbackState.currentTime || 0)} / {formatTime(playbackState.duration || 0)}
|
|
175
|
-
</span>
|
|
176
|
-
</div>
|
|
177
|
-
<div>
|
|
178
|
-
<span className="text-yellow-400">Volume:</span>
|
|
179
|
-
<span className="ml-2 font-mono">{Math.round((playbackState.volume || 0) * 100)}%</span>
|
|
180
|
-
</div>
|
|
181
|
-
<div>
|
|
182
|
-
<span className="text-purple-400">Quality:</span>
|
|
183
|
-
<span className="ml-2 font-mono">{playbackState.quality || 0}p</span>
|
|
184
|
-
</div>
|
|
185
|
-
<div>
|
|
186
|
-
<span className="text-red-400">Buffering:</span>
|
|
187
|
-
<span className="ml-2 font-mono">
|
|
188
|
-
{playbackState.isBuffering ? (
|
|
189
|
-
<span className="text-yellow-300">Yes</span>
|
|
190
|
-
) : (
|
|
191
|
-
<span className="text-green-300">No</span>
|
|
192
|
-
)}
|
|
193
|
-
</span>
|
|
194
|
-
</div>
|
|
195
|
-
{playbackState.error && (
|
|
196
|
-
<div className="col-span-2">
|
|
197
|
-
<span className="text-red-400">Error:</span>
|
|
198
|
-
<span className="ml-2 break-all font-mono text-red-300 text-xs">
|
|
199
|
-
{playbackState.error}
|
|
200
|
-
</span>
|
|
201
|
-
</div>
|
|
202
|
-
)}
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
)
|
|
206
|
-
|
|
207
|
-
// Render preloading stats
|
|
208
|
-
const renderPreloadingStats = () => (
|
|
209
|
-
<div className="space-y-2">
|
|
210
|
-
<div className="grid grid-cols-2 gap-2 text-xs">
|
|
211
|
-
<div>
|
|
212
|
-
<span className="text-green-400">Preloaded:</span>
|
|
213
|
-
<span className="ml-2 font-mono">{preloadingStats.preloadedItems || 0} items</span>
|
|
214
|
-
</div>
|
|
215
|
-
<div>
|
|
216
|
-
<span className="text-blue-400">Engagement:</span>
|
|
217
|
-
<span className="ml-2 font-mono">
|
|
218
|
-
{(preloadingStats.engagementScore || 0).toFixed(1)}%
|
|
219
|
-
</span>
|
|
220
|
-
</div>
|
|
221
|
-
<div>
|
|
222
|
-
<span className="text-yellow-400">Queue:</span>
|
|
223
|
-
<span className="ml-2 font-mono">{preloadingStats.queueLength || 0} items</span>
|
|
224
|
-
</div>
|
|
225
|
-
<div>
|
|
226
|
-
<span className="text-purple-400">Hit Rate:</span>
|
|
227
|
-
<span className="ml-2 font-mono">{(preloadingStats.hitRate || 0).toFixed(1)}%</span>
|
|
228
|
-
</div>
|
|
229
|
-
<div className="col-span-2">
|
|
230
|
-
<span className="text-cyan-400">Saved:</span>
|
|
231
|
-
<span className="ml-2 font-mono">{formatBytes(preloadingStats.totalSaved || 0)}</span>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
)
|
|
236
|
-
|
|
237
|
-
// Render HLS metrics
|
|
238
|
-
const renderHLSMetrics = () => (
|
|
239
|
-
<div className="space-y-2">
|
|
240
|
-
<div className="grid grid-cols-2 gap-2 text-xs">
|
|
241
|
-
<div>
|
|
242
|
-
<span className="text-green-400">Level:</span>
|
|
243
|
-
<span className="ml-2 font-mono">
|
|
244
|
-
{hlsMetrics.currentLevel || 0} / {hlsMetrics.availableLevels || 0}
|
|
245
|
-
</span>
|
|
246
|
-
</div>
|
|
247
|
-
<div>
|
|
248
|
-
<span className="text-blue-400">Bandwidth:</span>
|
|
249
|
-
<span className="ml-2 font-mono">{formatBytes(hlsMetrics.bandwidthEstimate || 0)}/s</span>
|
|
250
|
-
</div>
|
|
251
|
-
<div>
|
|
252
|
-
<span className="text-red-400">Dropped:</span>
|
|
253
|
-
<span className="ml-2 font-mono">{hlsMetrics.droppedFrames || 0} frames</span>
|
|
254
|
-
</div>
|
|
255
|
-
</div>
|
|
256
|
-
</div>
|
|
257
|
-
)
|
|
258
|
-
|
|
259
|
-
// Render plugin info
|
|
260
|
-
const renderPluginInfo = () => (
|
|
261
|
-
<div className="space-y-2">
|
|
262
|
-
<div className="text-xs">
|
|
263
|
-
<div>
|
|
264
|
-
<span className="text-green-400">Total:</span>
|
|
265
|
-
<span className="ml-2 font-mono">{pluginInfo.pluginCount || 0} plugins</span>
|
|
266
|
-
</div>
|
|
267
|
-
<div className="mt-2">
|
|
268
|
-
<span className="text-blue-400">Active:</span>
|
|
269
|
-
<div className="ml-2 space-y-1 font-mono text-xs">
|
|
270
|
-
{pluginInfo.activePlugins?.map((plugin, index) => (
|
|
271
|
-
<div key={index} className="text-green-300">
|
|
272
|
-
• {plugin}
|
|
273
|
-
</div>
|
|
274
|
-
)) || <div className="text-gray-400">None</div>}
|
|
275
|
-
</div>
|
|
276
|
-
</div>
|
|
277
|
-
{pluginInfo.loadedPlugins &&
|
|
278
|
-
pluginInfo.loadedPlugins.length > (pluginInfo.activePlugins?.length || 0) && (
|
|
279
|
-
<div className="mt-2">
|
|
280
|
-
<span className="text-yellow-400">Loaded (inactive):</span>
|
|
281
|
-
<div className="ml-2 space-y-1 font-mono text-xs">
|
|
282
|
-
{pluginInfo.loadedPlugins
|
|
283
|
-
.filter((plugin) => !pluginInfo.activePlugins?.includes(plugin))
|
|
284
|
-
.map((plugin, index) => (
|
|
285
|
-
<div key={index} className="text-yellow-300">
|
|
286
|
-
• {plugin}
|
|
287
|
-
</div>
|
|
288
|
-
))}
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
)}
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
)
|
|
295
|
-
|
|
296
|
-
// Render debug info
|
|
297
|
-
const renderDebugInfo = () => (
|
|
298
|
-
<div className="space-y-2">
|
|
299
|
-
<div className="space-y-1 font-mono text-xs">
|
|
300
|
-
{Object.entries(debugInfo).map(([key, value]) => (
|
|
301
|
-
<div key={key}>
|
|
302
|
-
<span className="text-yellow-400">{key}:</span>
|
|
303
|
-
<span className="ml-2 text-gray-300">
|
|
304
|
-
{typeof value === "object" ? JSON.stringify(value, null, 2) : String(value)}
|
|
305
|
-
</span>
|
|
306
|
-
</div>
|
|
307
|
-
))}
|
|
308
|
-
</div>
|
|
309
|
-
</div>
|
|
310
|
-
)
|
|
311
|
-
|
|
312
|
-
// Render tabs
|
|
313
|
-
const renderTabs = () => (
|
|
314
|
-
<div className="flex space-x-1 border-gray-600 border-b">
|
|
315
|
-
{[
|
|
316
|
-
{ id: "performance", label: "Performance" },
|
|
317
|
-
{ id: "hls", label: "HLS" },
|
|
318
|
-
{ id: "plugins", label: "Plugins" },
|
|
319
|
-
{ id: "debug", label: "Debug" }
|
|
320
|
-
].map((tab) => (
|
|
321
|
-
<button
|
|
322
|
-
key={tab.id}
|
|
323
|
-
onClick={() => setActiveTab(tab.id as any)}
|
|
324
|
-
className={cn(
|
|
325
|
-
"px-2 py-1 font-medium text-xs transition-colors",
|
|
326
|
-
activeTab === tab.id
|
|
327
|
-
? "border-blue-400 border-b text-blue-400"
|
|
328
|
-
: "text-gray-400 hover:text-white"
|
|
329
|
-
)}>
|
|
330
|
-
{tab.label}
|
|
331
|
-
</button>
|
|
332
|
-
))}
|
|
333
|
-
</div>
|
|
334
|
-
)
|
|
335
|
-
|
|
336
|
-
// Render active tab content
|
|
337
|
-
const renderTabContent = () => {
|
|
338
|
-
switch (activeTab) {
|
|
339
|
-
case "performance":
|
|
340
|
-
return (
|
|
341
|
-
<div className="space-y-3">
|
|
342
|
-
{renderPerformanceMetrics()}
|
|
343
|
-
<hr className="border-gray-600" />
|
|
344
|
-
{renderPlaybackState()}
|
|
345
|
-
<hr className="border-gray-600" />
|
|
346
|
-
{renderPreloadingStats()}
|
|
347
|
-
</div>
|
|
348
|
-
)
|
|
349
|
-
case "hls":
|
|
350
|
-
return renderHLSMetrics()
|
|
351
|
-
case "plugins":
|
|
352
|
-
return renderPluginInfo()
|
|
353
|
-
case "debug":
|
|
354
|
-
return renderDebugInfo()
|
|
355
|
-
default:
|
|
356
|
-
return renderPerformanceMetrics()
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// Only render in development
|
|
361
|
-
if (process.env.NODE_ENV !== "development") {
|
|
362
|
-
return null
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
return (
|
|
366
|
-
<div
|
|
367
|
-
className={cn(
|
|
368
|
-
"fixed z-50 min-w-80 max-w-96 rounded-lg border border-gray-700 bg-black/90 p-3 font-mono text-white text-xs backdrop-blur-sm",
|
|
369
|
-
positionClasses,
|
|
370
|
-
className
|
|
371
|
-
)}>
|
|
372
|
-
{/* Header */}
|
|
373
|
-
<div className="mb-3 flex items-center justify-between">
|
|
374
|
-
<h3 className="font-bold text-blue-400 text-sm">{title}</h3>
|
|
375
|
-
<div className="flex items-center space-x-2">
|
|
376
|
-
<button
|
|
377
|
-
onClick={() => setIsCollapsed(!isCollapsed)}
|
|
378
|
-
className="text-gray-400 transition-colors hover:text-white"
|
|
379
|
-
aria-label={isCollapsed ? "Expand" : "Collapse"}>
|
|
380
|
-
{isCollapsed ? (
|
|
381
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
382
|
-
<path
|
|
383
|
-
d="M3 4.5L6 7.5L9 4.5"
|
|
384
|
-
stroke="currentColor"
|
|
385
|
-
strokeWidth="1.5"
|
|
386
|
-
strokeLinecap="round"
|
|
387
|
-
strokeLinejoin="round"
|
|
388
|
-
/>
|
|
389
|
-
</svg>
|
|
390
|
-
) : (
|
|
391
|
-
<svg width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
392
|
-
<path
|
|
393
|
-
d="M3 7.5L6 4.5L9 7.5"
|
|
394
|
-
stroke="currentColor"
|
|
395
|
-
strokeWidth="1.5"
|
|
396
|
-
strokeLinecap="round"
|
|
397
|
-
strokeLinejoin="round"
|
|
398
|
-
/>
|
|
399
|
-
</svg>
|
|
400
|
-
)}
|
|
401
|
-
</button>
|
|
402
|
-
</div>
|
|
403
|
-
</div>
|
|
404
|
-
|
|
405
|
-
{/* Collapsed content */}
|
|
406
|
-
{isCollapsed ? (
|
|
407
|
-
<div className="grid grid-cols-2 gap-2 text-xs">
|
|
408
|
-
<div>
|
|
409
|
-
<span className="text-green-400">FPS:</span>
|
|
410
|
-
<span className="ml-1 font-mono">{performanceMetrics.fps || 0}</span>
|
|
411
|
-
</div>
|
|
412
|
-
<div>
|
|
413
|
-
<span className="text-blue-400">Memory:</span>
|
|
414
|
-
<span className="ml-1 font-mono">
|
|
415
|
-
{((performanceMetrics.memoryUsage || 0) / 1024 / 1024).toFixed(1)}MB
|
|
416
|
-
</span>
|
|
417
|
-
</div>
|
|
418
|
-
</div>
|
|
419
|
-
) : (
|
|
420
|
-
<>
|
|
421
|
-
{/* Tabs */}
|
|
422
|
-
{renderTabs()}
|
|
423
|
-
|
|
424
|
-
{/* Tab Content */}
|
|
425
|
-
<div className="mt-3 max-h-64 overflow-y-auto">{renderTabContent()}</div>
|
|
426
|
-
</>
|
|
427
|
-
)}
|
|
428
|
-
</div>
|
|
429
|
-
)
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Performance Debug Panel - simplified version focused on performance metrics
|
|
434
|
-
*/
|
|
435
|
-
export const PerformanceDebugPanel: React.FC<
|
|
436
|
-
Omit<DebugPanelProps, "position" | "defaultCollapsed" | "title">
|
|
437
|
-
> = (props) => {
|
|
438
|
-
return (
|
|
439
|
-
<DebugPanel
|
|
440
|
-
{...props}
|
|
441
|
-
position="top-right"
|
|
442
|
-
defaultCollapsed={false}
|
|
443
|
-
title="Performance Monitor"
|
|
444
|
-
/>
|
|
445
|
-
)
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
export default DebugPanel
|