@therealtinhtute/baroiplayer 1.0.6 → 1.0.7
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/dist/index.d.ts +1 -1
- package/dist/package.json +1 -1
- package/package.json +1 -1
- 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-Af84FynT.js +0 -1179
- package/dist/context-Af84FynT.js.map +0 -1
- package/dist/context-CwZnPdz0.cjs +0 -23
- package/dist/context-CwZnPdz0.cjs.map +0 -1
- package/dist/core-events-B5W_j8yU.js +0 -480
- package/dist/core-events-B5W_j8yU.js.map +0 -1
- package/dist/core-events-CN0-Vhhq.cjs +0 -2
- package/dist/core-events-CN0-Vhhq.cjs.map +0 -1
- package/dist/core-plugins-Bq9KLany.js +0 -696
- package/dist/core-plugins-Bq9KLany.js.map +0 -1
- package/dist/core-plugins-CPDSHMiQ.cjs +0 -2
- package/dist/core-plugins-CPDSHMiQ.cjs.map +0 -1
- package/dist/core.js +0 -37
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -1217
- package/dist/core.mjs.map +0 -1
- package/dist/enhanced-components-CXnYiOt6.cjs +0 -2
- package/dist/enhanced-components-CXnYiOt6.cjs.map +0 -1
- package/dist/enhanced-components-Da0TSvKe.js +0 -1073
- package/dist/enhanced-components-Da0TSvKe.js.map +0 -1
- package/dist/hooks-BCMilGRf.cjs +0 -4
- package/dist/hooks-BCMilGRf.cjs.map +0 -1
- package/dist/hooks-BPtHV1ZT.js +0 -2042
- package/dist/hooks-BPtHV1ZT.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/minimal-components-BHJMuaL7.cjs +0 -2
- package/dist/minimal-components-BHJMuaL7.cjs.map +0 -1
- package/dist/minimal-components-BmqRefl1.js +0 -2002
- package/dist/minimal-components-BmqRefl1.js.map +0 -1
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor--rzKTlbj.js +0 -302
- package/dist/performance-monitor--rzKTlbj.js.map +0 -1
- package/dist/performance-monitor-cjIvZE2D.cjs +0 -2
- package/dist/performance-monitor-cjIvZE2D.cjs.map +0 -1
- package/dist/src/adapters/videojs-adapter.d.ts.map +0 -1
- package/dist/src/adapters/videojs-adapter.js +0 -350
- package/dist/src/assets/mona-loading.gif +0 -0
- package/dist/src/components/AnimateLoading.d.ts.map +0 -1
- package/dist/src/components/AnimateLoading.js +0 -41
- package/dist/src/components/LoadingState.d.ts.map +0 -1
- package/dist/src/components/LoadingState.js +0 -111
- package/dist/src/components/accessibility/keyboard-help-overlay.d.ts.map +0 -1
- package/dist/src/components/accessibility/keyboard-help-overlay.js +0 -90
- package/dist/src/components/audio-player.d.ts.map +0 -1
- package/dist/src/components/audio-player.js +0 -31
- package/dist/src/components/basic/index.d.ts.map +0 -1
- package/dist/src/components/basic/index.js +0 -29
- package/dist/src/components/enhanced/advanced-features.d.ts.map +0 -1
- package/dist/src/components/enhanced/advanced-features.js +0 -64
- package/dist/src/components/enhanced/debug-panel.d.ts.map +0 -1
- package/dist/src/components/enhanced/debug-panel.js +0 -94
- package/dist/src/components/enhanced/enhanced-controls.d.ts.map +0 -1
- package/dist/src/components/enhanced/enhanced-controls.js +0 -233
- package/dist/src/components/enhanced/enhanced-media-player.d.ts.map +0 -1
- package/dist/src/components/enhanced/enhanced-media-player.js +0 -316
- package/dist/src/components/enhanced/error-handling.d.ts.map +0 -1
- package/dist/src/components/enhanced/error-handling.js +0 -153
- package/dist/src/components/enhanced/index.d.ts.map +0 -1
- package/dist/src/components/enhanced/index.js +0 -10
- package/dist/src/components/enhanced/media-player-enhanced.d.ts.map +0 -1
- package/dist/src/components/enhanced/media-player-enhanced.js +0 -250
- package/dist/src/components/examples/basic-video-player.d.ts.map +0 -1
- package/dist/src/components/examples/basic-video-player.js +0 -16
- package/dist/src/components/examples/custom-controls-example.d.ts.map +0 -1
- package/dist/src/components/examples/custom-controls-example.js +0 -12
- package/dist/src/components/examples/enhanced-controls-example.d.ts.map +0 -1
- package/dist/src/components/examples/enhanced-controls-example.js +0 -18
- package/dist/src/components/examples/enhanced-media-player-example.d.ts.map +0 -1
- package/dist/src/components/examples/enhanced-media-player-example.js +0 -13
- package/dist/src/components/examples/loading-states-demo.d.ts.map +0 -1
- package/dist/src/components/examples/loading-states-demo.js +0 -41
- package/dist/src/components/examples/react-19-demo.d.ts.map +0 -1
- package/dist/src/components/examples/react-19-demo.js +0 -104
- package/dist/src/components/examples/volume-orientation-demo.d.ts.map +0 -1
- package/dist/src/components/examples/volume-orientation-demo.js +0 -31
- package/dist/src/components/icon-demo.d.ts.map +0 -1
- package/dist/src/components/icon-demo.js +0 -16
- package/dist/src/components/icons/index.d.ts.map +0 -1
- package/dist/src/components/icons/index.js +0 -59
- package/dist/src/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/ArrowLeftIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/ArrowRightIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/ArrowRightIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/AudioIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/AudioIcon.js +0 -4
- package/dist/src/components/icons/svg-icons/BackwardIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/BackwardIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/CameraIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/CameraIcon.js +0 -4
- package/dist/src/components/icons/svg-icons/CheckIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/CheckIcon.js +0 -4
- package/dist/src/components/icons/svg-icons/EnablePiPIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/EnablePiPIcon.js +0 -5
- package/dist/src/components/icons/svg-icons/ForwardIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/ForwardIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/FullscreenEnterIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/FullscreenExitIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/LoadingIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/LoadingIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/PauseIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/PauseIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/PlayIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/PlayIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/PlaybackSpeedIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/QualityIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/QualityIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/SettingsIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/SettingsIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/SliderIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/SliderIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/SubtitleIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/SubtitleIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/SubtitleOffIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/UnPiPIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/UnPiPIcon.js +0 -5
- package/dist/src/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/VolumeMutedIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/VolumeOneIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/VolumeOneIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/VolumeThreeIcon.js +0 -3
- package/dist/src/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +0 -1
- package/dist/src/components/icons/svg-icons/VolumeTwoIcon.js +0 -3
- package/dist/src/components/legacy.d.ts.map +0 -1
- package/dist/src/components/legacy.js +0 -52
- package/dist/src/components/media-metadata-display.d.ts.map +0 -1
- package/dist/src/components/media-metadata-display.js +0 -20
- package/dist/src/components/media-player-audio.d.ts.map +0 -1
- package/dist/src/components/media-player-audio.js +0 -18
- package/dist/src/components/media-player-controls.d.ts.map +0 -1
- package/dist/src/components/media-player-controls.js +0 -150
- package/dist/src/components/media-player-error.d.ts.map +0 -1
- package/dist/src/components/media-player-error.js +0 -85
- package/dist/src/components/media-player-fullscreen.d.ts.map +0 -1
- package/dist/src/components/media-player-fullscreen.js +0 -68
- package/dist/src/components/media-player-hls.d.ts.map +0 -1
- package/dist/src/components/media-player-hls.js +0 -20
- package/dist/src/components/media-player-loading.d.ts.map +0 -1
- package/dist/src/components/media-player-loading.js +0 -53
- package/dist/src/components/media-player-play.d.ts.map +0 -1
- package/dist/src/components/media-player-play.js +0 -44
- package/dist/src/components/media-player-root.d.ts.map +0 -1
- package/dist/src/components/media-player-root.js +0 -243
- package/dist/src/components/media-player-seek.d.ts.map +0 -1
- package/dist/src/components/media-player-seek.js +0 -92
- package/dist/src/components/media-player-time.d.ts.map +0 -1
- package/dist/src/components/media-player-time.js +0 -57
- package/dist/src/components/media-player-tooltip.d.ts.map +0 -1
- package/dist/src/components/media-player-tooltip.js +0 -14
- package/dist/src/components/media-player-video.d.ts.map +0 -1
- package/dist/src/components/media-player-video.js +0 -18
- package/dist/src/components/media-player-volume.d.ts.map +0 -1
- package/dist/src/components/media-player-volume.js +0 -88
- package/dist/src/components/media-player.d.ts.map +0 -1
- package/dist/src/components/media-player.js +0 -67
- package/dist/src/components/media-suspense.d.ts.map +0 -1
- package/dist/src/components/media-suspense.js +0 -173
- package/dist/src/components/player-settings-form.d.ts.map +0 -1
- package/dist/src/components/player-settings-form.js +0 -46
- package/dist/src/components/react-player-wrapper.d.ts.map +0 -1
- package/dist/src/components/react-player-wrapper.js +0 -163
- package/dist/src/components/simple-video-player.d.ts.map +0 -1
- package/dist/src/components/simple-video-player.js +0 -41
- package/dist/src/components/ui/enhanced-seek-bar.d.ts.map +0 -1
- package/dist/src/components/ui/enhanced-seek-bar.js +0 -112
- package/dist/src/components/ui/fullscreen-button.d.ts.map +0 -1
- package/dist/src/components/ui/fullscreen-button.js +0 -21
- package/dist/src/components/ui/media-resource-preloader.d.ts.map +0 -1
- package/dist/src/components/ui/media-resource-preloader.js +0 -295
- package/dist/src/components/ui/play-button.d.ts.map +0 -1
- package/dist/src/components/ui/play-button.js +0 -26
- package/dist/src/components/ui/seek-bar.d.ts.map +0 -1
- package/dist/src/components/ui/seek-bar.js +0 -54
- package/dist/src/components/ui/time-display.d.ts.map +0 -1
- package/dist/src/components/ui/time-display.js +0 -18
- package/dist/src/components/ui/volume-control.d.ts.map +0 -1
- package/dist/src/components/ui/volume-control.js +0 -71
- package/dist/src/components/unified/base-media-player.d.ts.map +0 -1
- package/dist/src/components/unified/base-media-player.js +0 -104
- package/dist/src/components/unified/media-player.d.ts.map +0 -1
- package/dist/src/components/unified/media-player.js +0 -41
- package/dist/src/components/variants/minimal/AccessibleMinimalPlayer.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/AccessibleMinimalPlayer.js +0 -322
- package/dist/src/components/variants/minimal/EnhancedMinimalMediaPlayer.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/EnhancedMinimalMediaPlayer.js +0 -280
- package/dist/src/components/variants/minimal/MinimalControls.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalControls.js +0 -19
- package/dist/src/components/variants/minimal/MinimalLoading.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalLoading.js +0 -6
- package/dist/src/components/variants/minimal/MinimalMediaPlayer.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalMediaPlayer.js +0 -135
- package/dist/src/components/variants/minimal/MinimalOverlay.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalOverlay.js +0 -15
- package/dist/src/components/variants/minimal/MinimalPlayButton.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalPlayButton.js +0 -29
- package/dist/src/components/variants/minimal/MinimalSeekBar.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalSeekBar.js +0 -73
- package/dist/src/components/variants/minimal/MinimalVolumeControl.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/MinimalVolumeControl.js +0 -29
- package/dist/src/components/variants/minimal/SimpleMinimalPlayer.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/SimpleMinimalPlayer.js +0 -51
- package/dist/src/components/variants/minimal/components/CenterPlayButton.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/CenterPlayButton.js +0 -8
- package/dist/src/components/variants/minimal/components/ControlBar.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/ControlBar.js +0 -10
- package/dist/src/components/variants/minimal/components/EnhancedSettingsMenu.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/EnhancedSettingsMenu.js +0 -68
- package/dist/src/components/variants/minimal/components/PlaybackControls.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/PlaybackControls.js +0 -9
- package/dist/src/components/variants/minimal/components/RightControls.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/RightControls.js +0 -40
- package/dist/src/components/variants/minimal/components/SeekBar.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/SeekBar.js +0 -43
- package/dist/src/components/variants/minimal/components/SettingsDropdown.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/SettingsDropdown.js +0 -18
- package/dist/src/components/variants/minimal/components/SubtitleDisplay.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/SubtitleDisplay.js +0 -6
- package/dist/src/components/variants/minimal/components/TimeDisplay.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/TimeDisplay.js +0 -5
- package/dist/src/components/variants/minimal/components/VideoElement.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/VideoElement.js +0 -4
- package/dist/src/components/variants/minimal/components/VolumeControl.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/components/VolumeControl.js +0 -99
- package/dist/src/components/variants/minimal/index.d.ts.map +0 -1
- package/dist/src/components/variants/minimal/index.js +0 -8
- package/dist/src/components/video-player.d.ts.map +0 -1
- package/dist/src/components/video-player.js +0 -38
- package/dist/src/context/error-handling.d.ts.map +0 -1
- package/dist/src/context/error-handling.js +0 -300
- package/dist/src/context/media-context.d.ts.map +0 -1
- package/dist/src/context/media-context.js +0 -121
- package/dist/src/context/media-provider.d.ts.map +0 -1
- package/dist/src/context/media-provider.js +0 -164
- package/dist/src/context/media-store.d.ts.map +0 -1
- package/dist/src/context/media-store.js +0 -273
- package/dist/src/context/persistence.d.ts.map +0 -1
- package/dist/src/context/persistence.js +0 -356
- package/dist/src/core/events/event-system.d.ts.map +0 -1
- package/dist/src/core/events/event-system.js +0 -288
- package/dist/src/core/events/hooks.d.ts.map +0 -1
- package/dist/src/core/events/hooks.js +0 -198
- package/dist/src/core/events/index.d.ts.map +0 -1
- package/dist/src/core/events/index.js +0 -7
- package/dist/src/core/events/middleware.d.ts.map +0 -1
- package/dist/src/core/events/middleware.js +0 -219
- package/dist/src/core/index.d.ts.map +0 -1
- package/dist/src/core/index.js +0 -15
- package/dist/src/core/optimization/bundle-optimizer.d.ts.map +0 -1
- package/dist/src/core/optimization/bundle-optimizer.js +0 -217
- package/dist/src/core/performance/cicd.d.ts.map +0 -1
- package/dist/src/core/performance/cicd.js +0 -83
- package/dist/src/core/performance/index.d.ts.map +0 -1
- package/dist/src/core/performance/index.js +0 -14
- package/dist/src/core/performance/media-loading-optimizer.d.ts.map +0 -1
- package/dist/src/core/performance/media-loading-optimizer.js +0 -404
- package/dist/src/core/performance/performance-budgets.d.ts.map +0 -1
- package/dist/src/core/performance/performance-budgets.js +0 -326
- package/dist/src/core/performance/performance-monitor.d.ts.map +0 -1
- package/dist/src/core/performance/performance-monitor.js +0 -297
- package/dist/src/core/performance/performance-testing.d.ts.map +0 -1
- package/dist/src/core/performance/performance-testing.js +0 -314
- package/dist/src/core/plugins/base-plugin.d.ts.map +0 -1
- package/dist/src/core/plugins/base-plugin.js +0 -151
- package/dist/src/core/plugins/enhanced-plugin-system.d.ts.map +0 -1
- package/dist/src/core/plugins/enhanced-plugin-system.js +0 -305
- package/dist/src/core/plugins/examples/analytics-plugin.d.ts.map +0 -1
- package/dist/src/core/plugins/examples/analytics-plugin.js +0 -191
- package/dist/src/core/plugins/index.d.ts.map +0 -1
- package/dist/src/core/plugins/index.js +0 -9
- package/dist/src/core/plugins/registry.d.ts.map +0 -1
- package/dist/src/core/plugins/registry.js +0 -261
- package/dist/src/core/plugins/types.d.ts.map +0 -1
- package/dist/src/core/plugins/types.js +0 -31
- package/dist/src/core/plugins/utils.d.ts.map +0 -1
- package/dist/src/core/plugins/utils.js +0 -274
- package/dist/src/core/progressive-loading.d.ts.map +0 -1
- package/dist/src/core/progressive-loading.js +0 -239
- package/dist/src/core/providers/enhanced-hls-provider.d.ts.map +0 -1
- package/dist/src/core/providers/enhanced-hls-provider.js +0 -273
- package/dist/src/core/providers/service-provider.d.ts.map +0 -1
- package/dist/src/core/providers/service-provider.js +0 -105
- package/dist/src/core/utils.d.ts.map +0 -1
- package/dist/src/core/utils.js +0 -21
- package/dist/src/features/media-session/media-session-manager.d.ts.map +0 -1
- package/dist/src/features/media-session/media-session-manager.js +0 -331
- package/dist/src/features/picture-in-picture/pip-manager.d.ts.map +0 -1
- package/dist/src/features/picture-in-picture/pip-manager.js +0 -353
- package/dist/src/features/playlist/playlist-manager.d.ts.map +0 -1
- package/dist/src/features/playlist/playlist-manager.js +0 -475
- package/dist/src/features/subtitles/subtitle-manager.d.ts.map +0 -1
- package/dist/src/features/subtitles/subtitle-manager.js +0 -335
- package/dist/src/features/subtitles/subtitle-parser.d.ts.map +0 -1
- package/dist/src/features/subtitles/subtitle-parser.js +0 -217
- package/dist/src/features/thumbnails/thumbnail-generator.d.ts.map +0 -1
- package/dist/src/features/thumbnails/thumbnail-generator.js +0 -388
- package/dist/src/hooks/accessibility/index.d.ts.map +0 -1
- package/dist/src/hooks/accessibility/index.js +0 -4
- package/dist/src/hooks/accessibility/use-accessibility-preferences.d.ts.map +0 -1
- package/dist/src/hooks/accessibility/use-accessibility-preferences.js +0 -156
- package/dist/src/hooks/accessibility/use-focus-management.d.ts.map +0 -1
- package/dist/src/hooks/accessibility/use-focus-management.js +0 -142
- package/dist/src/hooks/accessibility/use-keyboard-shortcuts.d.ts.map +0 -1
- package/dist/src/hooks/accessibility/use-keyboard-shortcuts.js +0 -101
- package/dist/src/hooks/accessibility/use-screen-reader.d.ts.map +0 -1
- package/dist/src/hooks/accessibility/use-screen-reader.js +0 -148
- package/dist/src/hooks/core/index.d.ts.map +0 -1
- package/dist/src/hooks/core/index.js +0 -19
- package/dist/src/hooks/legacy.d.ts.map +0 -1
- package/dist/src/hooks/legacy.js +0 -17
- package/dist/src/hooks/use-enhanced-media-player.d.ts.map +0 -1
- package/dist/src/hooks/use-enhanced-media-player.js +0 -395
- package/dist/src/hooks/use-intelligent-preloading.d.ts.map +0 -1
- package/dist/src/hooks/use-intelligent-preloading.js +0 -258
- package/dist/src/hooks/use-keyboard-controls.d.ts.map +0 -1
- package/dist/src/hooks/use-keyboard-controls.js +0 -83
- package/dist/src/hooks/use-media-actions.d.ts.map +0 -1
- package/dist/src/hooks/use-media-actions.js +0 -121
- package/dist/src/hooks/use-media-metadata.d.ts.map +0 -1
- package/dist/src/hooks/use-media-metadata.js +0 -74
- package/dist/src/hooks/use-media-optimistic.d.ts.map +0 -1
- package/dist/src/hooks/use-media-optimistic.js +0 -205
- package/dist/src/hooks/use-media-player.d.ts.map +0 -1
- package/dist/src/hooks/use-media-player.js +0 -251
- package/dist/src/hooks/use-media-state.d.ts.map +0 -1
- package/dist/src/hooks/use-media-state.js +0 -162
- package/dist/src/hooks/use-memory-optimization.d.ts.map +0 -1
- package/dist/src/hooks/use-memory-optimization.js +0 -288
- package/dist/src/hooks/use-optimistic-controls.d.ts.map +0 -1
- package/dist/src/hooks/use-optimistic-controls.js +0 -60
- package/dist/src/hooks/use-optimized-media.d.ts.map +0 -1
- package/dist/src/hooks/use-optimized-media.js +0 -211
- package/dist/src/hooks/use-touch-gestures.d.ts.map +0 -1
- package/dist/src/hooks/use-touch-gestures.js +0 -289
- package/dist/src/hooks/useEnhancedSubtitles.d.ts.map +0 -1
- package/dist/src/hooks/useEnhancedSubtitles.js +0 -205
- package/dist/src/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/dist/src/hooks/useKeyboardShortcuts.js +0 -59
- package/dist/src/hooks/useMediaControls.d.ts.map +0 -1
- package/dist/src/hooks/useMediaControls.js +0 -44
- package/dist/src/hooks/useScreenshot.d.ts.map +0 -1
- package/dist/src/hooks/useScreenshot.js +0 -56
- package/dist/src/hooks/useSubtitles.d.ts.map +0 -1
- package/dist/src/hooks/useSubtitles.js +0 -73
- package/dist/src/hooks/useVideoPlayer.d.ts.map +0 -1
- package/dist/src/hooks/useVideoPlayer.js +0 -184
- package/dist/src/icons/components/FullscreenIcon.d.ts.map +0 -1
- package/dist/src/icons/components/FullscreenIcon.js +0 -11
- package/dist/src/icons/components/SettingsIcon.d.ts.map +0 -1
- package/dist/src/icons/components/SettingsIcon.js +0 -11
- package/dist/src/icons/components/animated/LoadingIcon.d.ts.map +0 -1
- package/dist/src/icons/components/animated/LoadingIcon.js +0 -11
- package/dist/src/icons/components/animated/PlayPauseIcon.d.ts.map +0 -1
- package/dist/src/icons/components/animated/PlayPauseIcon.js +0 -9
- package/dist/src/icons/components/media/PauseIcon.d.ts.map +0 -1
- package/dist/src/icons/components/media/PauseIcon.js +0 -12
- package/dist/src/icons/components/media/PlayIcon.d.ts.map +0 -1
- package/dist/src/icons/components/media/PlayIcon.js +0 -12
- package/dist/src/icons/components/volume/VolumeIcon.d.ts.map +0 -1
- package/dist/src/icons/components/volume/VolumeIcon.js +0 -11
- package/dist/src/icons/components/volume/VolumeOffIcon.d.ts.map +0 -1
- package/dist/src/icons/components/volume/VolumeOffIcon.js +0 -11
- package/dist/src/icons/index.d.ts.map +0 -1
- package/dist/src/icons/index.js +0 -45
- package/dist/src/icons/provider.d.ts.map +0 -1
- package/dist/src/icons/provider.js +0 -37
- package/dist/src/icons/types.d.ts.map +0 -1
- package/dist/src/icons/types.js +0 -1
- package/dist/src/index-enhanced.d.ts.map +0 -1
- package/dist/src/index-enhanced.js +0 -16
- package/dist/src/index-legacy.d.ts.map +0 -1
- package/dist/src/index-legacy.js +0 -97
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -90
- package/dist/src/index.minimal.d.ts.map +0 -1
- package/dist/src/index.minimal.js +0 -3
- package/dist/src/lib/deprecation.d.ts.map +0 -1
- package/dist/src/lib/deprecation.js +0 -31
- package/dist/src/lib/format-time.d.ts.map +0 -1
- package/dist/src/lib/format-time.js +0 -32
- package/dist/src/lib/index.d.ts.map +0 -1
- package/dist/src/lib/index.js +0 -3
- package/dist/src/lib/utils.d.ts.map +0 -1
- package/dist/src/lib/utils.js +0 -5
- package/dist/src/test/setup.d.ts.map +0 -1
- package/dist/src/test/setup.js +0 -65
- package/dist/src/types/events.d.ts.map +0 -1
- package/dist/src/types/events.js +0 -2
- package/dist/src/types/formats.d.ts.map +0 -1
- package/dist/src/types/formats.js +0 -63
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js +0 -4
- package/dist/utils-Db13763z.cjs +0 -9
- package/dist/utils-Db13763z.cjs.map +0 -1
- package/dist/utils-nTO4AnHo.js +0 -2809
- package/dist/utils-nTO4AnHo.js.map +0 -1
- package/dist/utils.js +0 -2
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs +0 -7
- package/dist/utils.mjs.map +0 -1
- package/src/adapters/videojs-adapter.js +0 -350
- package/src/components/AnimateLoading.js +0 -41
- package/src/components/LoadingState.js +0 -111
- package/src/components/accessibility/keyboard-help-overlay.js +0 -90
- package/src/components/audio-player.js +0 -31
- package/src/components/basic/index.js +0 -29
- package/src/components/enhanced/advanced-features.js +0 -64
- package/src/components/enhanced/debug-panel.js +0 -94
- package/src/components/enhanced/enhanced-controls.js +0 -233
- package/src/components/enhanced/enhanced-media-player.js +0 -316
- package/src/components/enhanced/error-handling.js +0 -153
- package/src/components/enhanced/index.js +0 -10
- package/src/components/enhanced/media-player-enhanced.js +0 -250
- package/src/components/examples/basic-video-player.js +0 -16
- package/src/components/examples/custom-controls-example.js +0 -12
- package/src/components/examples/enhanced-controls-example.js +0 -18
- package/src/components/examples/enhanced-media-player-example.js +0 -13
- package/src/components/examples/loading-states-demo.js +0 -41
- package/src/components/examples/react-19-demo.js +0 -104
- package/src/components/examples/volume-orientation-demo.js +0 -31
- package/src/components/icon-demo.js +0 -16
- package/src/components/icons/index.js +0 -59
- package/src/components/icons/svg-icons/ArrowLeftIcon.js +0 -3
- package/src/components/icons/svg-icons/ArrowRightIcon.js +0 -3
- package/src/components/icons/svg-icons/AudioIcon.js +0 -4
- package/src/components/icons/svg-icons/BackwardIcon.js +0 -3
- package/src/components/icons/svg-icons/CameraIcon.js +0 -4
- package/src/components/icons/svg-icons/CheckIcon.js +0 -4
- package/src/components/icons/svg-icons/EnablePiPIcon.js +0 -5
- package/src/components/icons/svg-icons/ForwardIcon.js +0 -3
- package/src/components/icons/svg-icons/FullscreenEnterIcon.js +0 -3
- package/src/components/icons/svg-icons/FullscreenExitIcon.js +0 -3
- package/src/components/icons/svg-icons/LoadingIcon.js +0 -3
- package/src/components/icons/svg-icons/PauseIcon.js +0 -3
- package/src/components/icons/svg-icons/PlayIcon.js +0 -3
- package/src/components/icons/svg-icons/PlaybackSpeedIcon.js +0 -3
- package/src/components/icons/svg-icons/QualityIcon.js +0 -3
- package/src/components/icons/svg-icons/SettingsIcon.js +0 -3
- package/src/components/icons/svg-icons/SliderIcon.js +0 -3
- package/src/components/icons/svg-icons/SubtitleIcon.js +0 -3
- package/src/components/icons/svg-icons/SubtitleOffIcon.js +0 -3
- package/src/components/icons/svg-icons/UnPiPIcon.js +0 -5
- package/src/components/icons/svg-icons/VolumeMutedIcon.js +0 -3
- package/src/components/icons/svg-icons/VolumeOneIcon.js +0 -3
- package/src/components/icons/svg-icons/VolumeThreeIcon.js +0 -3
- package/src/components/icons/svg-icons/VolumeTwoIcon.js +0 -3
- package/src/components/legacy.js +0 -52
- package/src/components/media-metadata-display.js +0 -20
- package/src/components/media-player-audio.js +0 -18
- package/src/components/media-player-controls.js +0 -150
- package/src/components/media-player-error.js +0 -85
- package/src/components/media-player-fullscreen.js +0 -68
- package/src/components/media-player-hls.js +0 -20
- package/src/components/media-player-loading.js +0 -53
- package/src/components/media-player-play.js +0 -44
- package/src/components/media-player-root.js +0 -243
- package/src/components/media-player-seek.js +0 -92
- package/src/components/media-player-time.js +0 -57
- package/src/components/media-player-tooltip.js +0 -14
- package/src/components/media-player-video.js +0 -18
- package/src/components/media-player-volume.js +0 -88
- package/src/components/media-player.js +0 -67
- package/src/components/media-suspense.js +0 -173
- package/src/components/player-settings-form.js +0 -46
- package/src/components/react-player-wrapper.js +0 -163
- package/src/components/simple-video-player.js +0 -41
- package/src/components/ui/enhanced-seek-bar.js +0 -112
- package/src/components/ui/fullscreen-button.js +0 -21
- package/src/components/ui/media-resource-preloader.js +0 -295
- package/src/components/ui/play-button.js +0 -26
- package/src/components/ui/seek-bar.js +0 -54
- package/src/components/ui/time-display.js +0 -18
- package/src/components/ui/volume-control.js +0 -71
- package/src/components/unified/base-media-player.js +0 -104
- package/src/components/unified/media-player.js +0 -41
- package/src/components/variants/minimal/AccessibleMinimalPlayer.js +0 -322
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.js +0 -280
- package/src/components/variants/minimal/MinimalControls.js +0 -19
- package/src/components/variants/minimal/MinimalLoading.js +0 -6
- package/src/components/variants/minimal/MinimalMediaPlayer.js +0 -135
- package/src/components/variants/minimal/MinimalOverlay.js +0 -15
- package/src/components/variants/minimal/MinimalPlayButton.js +0 -29
- package/src/components/variants/minimal/MinimalSeekBar.js +0 -73
- package/src/components/variants/minimal/MinimalVolumeControl.js +0 -29
- package/src/components/variants/minimal/SimpleMinimalPlayer.js +0 -51
- package/src/components/variants/minimal/components/CenterPlayButton.js +0 -8
- package/src/components/variants/minimal/components/ControlBar.js +0 -10
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.js +0 -68
- package/src/components/variants/minimal/components/PlaybackControls.js +0 -9
- package/src/components/variants/minimal/components/RightControls.js +0 -40
- package/src/components/variants/minimal/components/SeekBar.js +0 -43
- package/src/components/variants/minimal/components/SettingsDropdown.js +0 -18
- package/src/components/variants/minimal/components/SubtitleDisplay.js +0 -6
- package/src/components/variants/minimal/components/TimeDisplay.js +0 -5
- package/src/components/variants/minimal/components/VideoElement.js +0 -4
- package/src/components/variants/minimal/components/VolumeControl.js +0 -99
- package/src/components/variants/minimal/index.js +0 -8
- package/src/components/video-player.js +0 -38
- package/src/context/error-handling.js +0 -300
- package/src/context/media-context.js +0 -121
- package/src/context/media-provider.js +0 -164
- package/src/context/media-store.js +0 -273
- package/src/context/persistence.js +0 -356
- package/src/core/events/event-system.js +0 -288
- package/src/core/events/hooks.js +0 -198
- package/src/core/events/index.js +0 -7
- package/src/core/events/middleware.js +0 -219
- package/src/core/index.js +0 -15
- package/src/core/optimization/bundle-optimizer.js +0 -217
- package/src/core/performance/cicd.js +0 -83
- package/src/core/performance/index.js +0 -14
- package/src/core/performance/media-loading-optimizer.js +0 -404
- package/src/core/performance/performance-budgets.js +0 -326
- package/src/core/performance/performance-monitor.js +0 -297
- package/src/core/performance/performance-testing.js +0 -314
- package/src/core/plugins/base-plugin.js +0 -151
- package/src/core/plugins/enhanced-plugin-system.js +0 -305
- package/src/core/plugins/examples/analytics-plugin.js +0 -191
- package/src/core/plugins/index.js +0 -9
- package/src/core/plugins/registry.js +0 -261
- package/src/core/plugins/types.js +0 -31
- package/src/core/plugins/utils.js +0 -274
- package/src/core/progressive-loading.js +0 -239
- package/src/core/providers/enhanced-hls-provider.js +0 -273
- package/src/core/providers/service-provider.js +0 -105
- package/src/core/utils.js +0 -21
- package/src/features/media-session/media-session-manager.js +0 -331
- package/src/features/picture-in-picture/pip-manager.js +0 -353
- package/src/features/playlist/playlist-manager.js +0 -475
- package/src/features/subtitles/subtitle-manager.js +0 -335
- package/src/features/subtitles/subtitle-parser.js +0 -217
- package/src/features/thumbnails/thumbnail-generator.js +0 -388
- package/src/hooks/accessibility/index.js +0 -4
- package/src/hooks/accessibility/use-accessibility-preferences.js +0 -156
- package/src/hooks/accessibility/use-focus-management.js +0 -142
- package/src/hooks/accessibility/use-keyboard-shortcuts.js +0 -101
- package/src/hooks/accessibility/use-screen-reader.js +0 -148
- package/src/hooks/core/index.js +0 -19
- package/src/hooks/legacy.js +0 -17
- package/src/hooks/use-enhanced-media-player.js +0 -395
- package/src/hooks/use-intelligent-preloading.js +0 -258
- package/src/hooks/use-keyboard-controls.js +0 -83
- package/src/hooks/use-media-actions.js +0 -121
- package/src/hooks/use-media-metadata.js +0 -74
- package/src/hooks/use-media-optimistic.js +0 -205
- package/src/hooks/use-media-player.js +0 -251
- package/src/hooks/use-media-state.js +0 -162
- package/src/hooks/use-memory-optimization.js +0 -288
- package/src/hooks/use-optimistic-controls.js +0 -60
- package/src/hooks/use-optimized-media.js +0 -211
- package/src/hooks/use-touch-gestures.js +0 -289
- package/src/hooks/useEnhancedSubtitles.js +0 -205
- package/src/hooks/useKeyboardShortcuts.js +0 -59
- package/src/hooks/useMediaControls.js +0 -44
- package/src/hooks/useScreenshot.js +0 -56
- package/src/hooks/useSubtitles.js +0 -73
- package/src/hooks/useVideoPlayer.js +0 -184
- package/src/icons/components/FullscreenIcon.js +0 -11
- package/src/icons/components/SettingsIcon.js +0 -11
- package/src/icons/components/animated/LoadingIcon.js +0 -11
- package/src/icons/components/animated/PlayPauseIcon.js +0 -9
- package/src/icons/components/media/PauseIcon.js +0 -12
- package/src/icons/components/media/PlayIcon.js +0 -12
- package/src/icons/components/volume/VolumeIcon.js +0 -11
- package/src/icons/components/volume/VolumeOffIcon.js +0 -11
- package/src/icons/index.js +0 -45
- package/src/icons/provider.js +0 -37
- package/src/icons/types.js +0 -1
- package/src/index-enhanced.js +0 -16
- package/src/index-legacy.js +0 -97
- package/src/index.js +0 -90
- package/src/index.minimal.js +0 -3
- package/src/lib/deprecation.js +0 -31
- package/src/lib/format-time.js +0 -32
- package/src/lib/index.js +0 -3
- package/src/lib/utils.js +0 -5
- package/src/test/setup.js +0 -65
- package/src/types/events.js +0 -2
- package/src/types/formats.js +0 -63
- package/src/types/index.js +0 -4
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
export class ThumbnailGenerator {
|
|
2
|
-
config;
|
|
3
|
-
cache = new Map();
|
|
4
|
-
videoElement = null;
|
|
5
|
-
canvas;
|
|
6
|
-
context;
|
|
7
|
-
constructor(config) {
|
|
8
|
-
this.config = {
|
|
9
|
-
defaultWidth: 160,
|
|
10
|
-
defaultHeight: 90,
|
|
11
|
-
defaultQuality: 0.8,
|
|
12
|
-
defaultFormat: 'jpeg',
|
|
13
|
-
maxCacheSize: 50,
|
|
14
|
-
enableCaching: true,
|
|
15
|
-
...config
|
|
16
|
-
};
|
|
17
|
-
this.canvas = document.createElement('canvas');
|
|
18
|
-
const ctx = this.canvas.getContext('2d');
|
|
19
|
-
if (!ctx) {
|
|
20
|
-
throw new Error('Canvas 2D context not supported');
|
|
21
|
-
}
|
|
22
|
-
this.context = ctx;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Set the video element to generate thumbnails from
|
|
26
|
-
*/
|
|
27
|
-
setVideoElement(video) {
|
|
28
|
-
this.videoElement = video;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Generate thumbnail at specific time
|
|
32
|
-
*/
|
|
33
|
-
async generateThumbnail(time, options = {}) {
|
|
34
|
-
if (!this.videoElement) {
|
|
35
|
-
throw new Error('Video element not set');
|
|
36
|
-
}
|
|
37
|
-
const cacheKey = this.getCacheKey(time, options);
|
|
38
|
-
// Check cache first
|
|
39
|
-
if (this.config.enableCaching && this.cache.has(cacheKey)) {
|
|
40
|
-
const cached = this.cache.get(cacheKey);
|
|
41
|
-
return { ...cached };
|
|
42
|
-
}
|
|
43
|
-
const width = options.width || this.config.defaultWidth;
|
|
44
|
-
const height = options.height || this.config.defaultHeight;
|
|
45
|
-
const quality = options.quality || this.config.defaultQuality;
|
|
46
|
-
const format = options.format || this.config.defaultFormat;
|
|
47
|
-
// Setup canvas
|
|
48
|
-
this.canvas.width = width;
|
|
49
|
-
this.canvas.height = height;
|
|
50
|
-
// Set video time and wait for seek
|
|
51
|
-
const originalTime = this.videoElement.currentTime;
|
|
52
|
-
await this.seekToTime(time);
|
|
53
|
-
// Draw video frame to canvas
|
|
54
|
-
this.context.clearRect(0, 0, width, height);
|
|
55
|
-
// Calculate aspect ratio preserving dimensions
|
|
56
|
-
const videoAspect = this.videoElement.videoWidth / this.videoElement.videoHeight;
|
|
57
|
-
const canvasAspect = width / height;
|
|
58
|
-
let drawWidth = width;
|
|
59
|
-
let drawHeight = height;
|
|
60
|
-
let offsetX = 0;
|
|
61
|
-
let offsetY = 0;
|
|
62
|
-
if (videoAspect > canvasAspect) {
|
|
63
|
-
// Video is wider, fit to height
|
|
64
|
-
drawHeight = height;
|
|
65
|
-
drawWidth = height * videoAspect;
|
|
66
|
-
offsetX = (width - drawWidth) / 2;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
// Video is taller, fit to width
|
|
70
|
-
drawWidth = width;
|
|
71
|
-
drawHeight = width / videoAspect;
|
|
72
|
-
offsetY = (height - drawHeight) / 2;
|
|
73
|
-
}
|
|
74
|
-
this.context.drawImage(this.videoElement, offsetX, offsetY, drawWidth, drawHeight);
|
|
75
|
-
// Convert to blob
|
|
76
|
-
const blob = await this.canvasToBlob(format, quality);
|
|
77
|
-
const dataUrl = this.canvas.toDataURL(`image/${format}`, quality);
|
|
78
|
-
const objectUrl = URL.createObjectURL(blob);
|
|
79
|
-
const thumbnail = {
|
|
80
|
-
blob,
|
|
81
|
-
dataUrl,
|
|
82
|
-
objectUrl,
|
|
83
|
-
width,
|
|
84
|
-
height,
|
|
85
|
-
timestamp: time
|
|
86
|
-
};
|
|
87
|
-
// Cache thumbnail
|
|
88
|
-
if (this.config.enableCaching) {
|
|
89
|
-
this.addToCache(cacheKey, thumbnail);
|
|
90
|
-
}
|
|
91
|
-
// Restore original time
|
|
92
|
-
if (originalTime !== time) {
|
|
93
|
-
await this.seekToTime(originalTime);
|
|
94
|
-
}
|
|
95
|
-
return thumbnail;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Generate multiple thumbnails for scrub bar
|
|
99
|
-
*/
|
|
100
|
-
async generateScrubThumbnails(count, options = {}) {
|
|
101
|
-
if (!this.videoElement) {
|
|
102
|
-
throw new Error('Video element not set');
|
|
103
|
-
}
|
|
104
|
-
const duration = this.videoElement.duration;
|
|
105
|
-
if (!duration || duration === 0) {
|
|
106
|
-
throw new Error('Video duration not available');
|
|
107
|
-
}
|
|
108
|
-
const thumbnails = [];
|
|
109
|
-
const interval = duration / count;
|
|
110
|
-
for (let i = 0; i < count; i++) {
|
|
111
|
-
const time = i * interval;
|
|
112
|
-
try {
|
|
113
|
-
const thumbnail = await this.generateThumbnail(time, options);
|
|
114
|
-
thumbnails.push(thumbnail);
|
|
115
|
-
}
|
|
116
|
-
catch (error) {
|
|
117
|
-
console.warn(`Failed to generate thumbnail at ${time}s:`, error);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return thumbnails;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Generate thumbnail sprite sheet
|
|
124
|
-
*/
|
|
125
|
-
async generateSprite(count, options = {}) {
|
|
126
|
-
if (!this.videoElement) {
|
|
127
|
-
throw new Error('Video element not set');
|
|
128
|
-
}
|
|
129
|
-
const duration = this.videoElement.duration;
|
|
130
|
-
if (!duration || duration === 0) {
|
|
131
|
-
throw new Error('Video duration not available');
|
|
132
|
-
}
|
|
133
|
-
const thumbnailWidth = options.width || this.config.defaultWidth;
|
|
134
|
-
const thumbnailHeight = options.height || this.config.defaultHeight;
|
|
135
|
-
const quality = options.quality || this.config.defaultQuality;
|
|
136
|
-
const format = options.format || this.config.defaultFormat;
|
|
137
|
-
// Calculate sprite dimensions
|
|
138
|
-
const columns = options.columns || Math.ceil(Math.sqrt(count));
|
|
139
|
-
const rows = Math.ceil(count / columns);
|
|
140
|
-
const spriteWidth = columns * thumbnailWidth;
|
|
141
|
-
const spriteHeight = rows * thumbnailHeight;
|
|
142
|
-
// Create sprite canvas
|
|
143
|
-
const spriteCanvas = document.createElement('canvas');
|
|
144
|
-
spriteCanvas.width = spriteWidth;
|
|
145
|
-
spriteCanvas.height = spriteHeight;
|
|
146
|
-
const spriteContext = spriteCanvas.getContext('2d');
|
|
147
|
-
if (!spriteContext) {
|
|
148
|
-
throw new Error('Canvas 2D context not supported');
|
|
149
|
-
}
|
|
150
|
-
const thumbnails = [];
|
|
151
|
-
const interval = duration / count;
|
|
152
|
-
// Generate each thumbnail
|
|
153
|
-
for (let i = 0; i < count; i++) {
|
|
154
|
-
const time = i * interval;
|
|
155
|
-
const col = i % columns;
|
|
156
|
-
const row = Math.floor(i / columns);
|
|
157
|
-
const x = col * thumbnailWidth;
|
|
158
|
-
const y = row * thumbnailHeight;
|
|
159
|
-
try {
|
|
160
|
-
// Generate individual thumbnail
|
|
161
|
-
const thumbnail = await this.generateThumbnail(time, {
|
|
162
|
-
width: thumbnailWidth,
|
|
163
|
-
height: thumbnailHeight,
|
|
164
|
-
quality,
|
|
165
|
-
format
|
|
166
|
-
});
|
|
167
|
-
// Draw thumbnail to sprite
|
|
168
|
-
const img = new Image();
|
|
169
|
-
img.src = thumbnail.dataUrl;
|
|
170
|
-
await new Promise((resolve, reject) => {
|
|
171
|
-
img.onload = () => {
|
|
172
|
-
spriteContext.drawImage(img, x, y, thumbnailWidth, thumbnailHeight);
|
|
173
|
-
resolve();
|
|
174
|
-
};
|
|
175
|
-
img.onerror = reject;
|
|
176
|
-
});
|
|
177
|
-
thumbnails.push({
|
|
178
|
-
x,
|
|
179
|
-
y,
|
|
180
|
-
width: thumbnailWidth,
|
|
181
|
-
height: thumbnailHeight,
|
|
182
|
-
time
|
|
183
|
-
});
|
|
184
|
-
// Clean up individual thumbnail
|
|
185
|
-
URL.revokeObjectURL(thumbnail.objectUrl);
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
console.warn(`Failed to add thumbnail at ${time}s to sprite:`, error);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
// Create final sprite image
|
|
192
|
-
const spriteImage = new Image();
|
|
193
|
-
spriteImage.src = spriteCanvas.toDataURL(`image/${format}`, quality);
|
|
194
|
-
const sprite = {
|
|
195
|
-
image: spriteImage,
|
|
196
|
-
thumbnails,
|
|
197
|
-
spriteWidth,
|
|
198
|
-
spriteHeight,
|
|
199
|
-
thumbnailWidth,
|
|
200
|
-
thumbnailHeight
|
|
201
|
-
};
|
|
202
|
-
return sprite;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Extract thumbnail from sprite at specific time
|
|
206
|
-
*/
|
|
207
|
-
getThumbnailFromSprite(sprite, time) {
|
|
208
|
-
// Find closest thumbnail
|
|
209
|
-
const thumbnail = sprite.thumbnails.reduce((closest, current) => {
|
|
210
|
-
return Math.abs(current.time - time) < Math.abs(closest.time - time)
|
|
211
|
-
? current
|
|
212
|
-
: closest;
|
|
213
|
-
});
|
|
214
|
-
if (!thumbnail)
|
|
215
|
-
return null;
|
|
216
|
-
// Create canvas for extracted thumbnail
|
|
217
|
-
const canvas = document.createElement('canvas');
|
|
218
|
-
canvas.width = thumbnail.width;
|
|
219
|
-
canvas.height = thumbnail.height;
|
|
220
|
-
const context = canvas.getContext('2d');
|
|
221
|
-
if (!context)
|
|
222
|
-
return null;
|
|
223
|
-
// Draw portion of sprite to canvas
|
|
224
|
-
context.drawImage(sprite.image, thumbnail.x, thumbnail.y, thumbnail.width, thumbnail.height, 0, 0, thumbnail.width, thumbnail.height);
|
|
225
|
-
return canvas;
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Clear cache
|
|
229
|
-
*/
|
|
230
|
-
clearCache() {
|
|
231
|
-
// Revoke object URLs to prevent memory leaks
|
|
232
|
-
this.cache.forEach(thumbnail => {
|
|
233
|
-
URL.revokeObjectURL(thumbnail.objectUrl);
|
|
234
|
-
});
|
|
235
|
-
this.cache.clear();
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Get cache size
|
|
239
|
-
*/
|
|
240
|
-
getCacheSize() {
|
|
241
|
-
return this.cache.size;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Get cache info
|
|
245
|
-
*/
|
|
246
|
-
getCacheInfo() {
|
|
247
|
-
return Array.from(this.cache.entries()).map(([key, thumbnail]) => ({
|
|
248
|
-
key,
|
|
249
|
-
timestamp: thumbnail.timestamp,
|
|
250
|
-
size: thumbnail.blob.size
|
|
251
|
-
}));
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Set configuration
|
|
255
|
-
*/
|
|
256
|
-
updateConfig(config) {
|
|
257
|
-
this.config = { ...this.config, ...config };
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Seek video to specific time
|
|
261
|
-
*/
|
|
262
|
-
async seekToTime(time) {
|
|
263
|
-
if (!this.videoElement)
|
|
264
|
-
return;
|
|
265
|
-
return new Promise((resolve, reject) => {
|
|
266
|
-
let timeoutId;
|
|
267
|
-
const onSeeked = () => {
|
|
268
|
-
this.videoElement.removeEventListener('seeked', onSeeked);
|
|
269
|
-
clearTimeout(timeoutId);
|
|
270
|
-
resolve();
|
|
271
|
-
};
|
|
272
|
-
const onError = () => {
|
|
273
|
-
this.videoElement.removeEventListener('error', onError);
|
|
274
|
-
this.videoElement.removeEventListener('seeked', onSeeked);
|
|
275
|
-
clearTimeout(timeoutId);
|
|
276
|
-
reject(new Error('Seek failed'));
|
|
277
|
-
};
|
|
278
|
-
// Set timeout to avoid hanging
|
|
279
|
-
timeoutId = window.setTimeout(() => {
|
|
280
|
-
this.videoElement.removeEventListener('seeked', onSeeked);
|
|
281
|
-
this.videoElement.removeEventListener('error', onError);
|
|
282
|
-
reject(new Error('Seek timeout'));
|
|
283
|
-
}, 5000);
|
|
284
|
-
this.videoElement.addEventListener('seeked', onSeeked);
|
|
285
|
-
this.videoElement.addEventListener('error', onError);
|
|
286
|
-
this.videoElement.currentTime = Math.max(0, Math.min(time, this.videoElement.duration));
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Convert canvas to blob
|
|
291
|
-
*/
|
|
292
|
-
canvasToBlob(format, quality) {
|
|
293
|
-
return new Promise((resolve, reject) => {
|
|
294
|
-
this.canvas.toBlob((blob) => {
|
|
295
|
-
if (blob) {
|
|
296
|
-
resolve(blob);
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
reject(new Error('Failed to create blob from canvas'));
|
|
300
|
-
}
|
|
301
|
-
}, `image/${format}`, quality);
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Generate cache key
|
|
306
|
-
*/
|
|
307
|
-
getCacheKey(time, options) {
|
|
308
|
-
const width = options.width || this.config.defaultWidth;
|
|
309
|
-
const height = options.height || this.config.defaultHeight;
|
|
310
|
-
const quality = options.quality || this.config.defaultQuality;
|
|
311
|
-
const format = options.format || this.config.defaultFormat;
|
|
312
|
-
return `${time}-${width}x${height}-${quality}-${format}`;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Add thumbnail to cache
|
|
316
|
-
*/
|
|
317
|
-
addToCache(key, thumbnail) {
|
|
318
|
-
// Remove oldest items if cache is full
|
|
319
|
-
if (this.cache.size >= this.config.maxCacheSize) {
|
|
320
|
-
const oldestKey = this.cache.keys().next().value;
|
|
321
|
-
const oldThumbnail = this.cache.get(oldestKey);
|
|
322
|
-
if (oldThumbnail) {
|
|
323
|
-
URL.revokeObjectURL(oldThumbnail.objectUrl);
|
|
324
|
-
}
|
|
325
|
-
this.cache.delete(oldestKey);
|
|
326
|
-
}
|
|
327
|
-
this.cache.set(key, thumbnail);
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Cleanup resources
|
|
331
|
-
*/
|
|
332
|
-
destroy() {
|
|
333
|
-
this.clearCache();
|
|
334
|
-
this.videoElement = null;
|
|
335
|
-
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
// Utility functions for thumbnail operations
|
|
339
|
-
export const thumbnailUtils = {
|
|
340
|
-
/**
|
|
341
|
-
* Calculate optimal thumbnail dimensions maintaining aspect ratio
|
|
342
|
-
*/
|
|
343
|
-
calculateDimensions(sourceWidth, sourceHeight, targetWidth, targetHeight) {
|
|
344
|
-
const sourceAspect = sourceWidth / sourceHeight;
|
|
345
|
-
const targetAspect = targetWidth / targetHeight;
|
|
346
|
-
let width = targetWidth;
|
|
347
|
-
let height = targetHeight;
|
|
348
|
-
let offsetX = 0;
|
|
349
|
-
let offsetY = 0;
|
|
350
|
-
if (sourceAspect > targetAspect) {
|
|
351
|
-
height = targetHeight;
|
|
352
|
-
width = targetHeight * sourceAspect;
|
|
353
|
-
offsetX = (targetWidth - width) / 2;
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
width = targetWidth;
|
|
357
|
-
height = targetWidth / sourceAspect;
|
|
358
|
-
offsetY = (targetHeight - height) / 2;
|
|
359
|
-
}
|
|
360
|
-
return { width, height, offsetX, offsetY };
|
|
361
|
-
},
|
|
362
|
-
/**
|
|
363
|
-
* Create thumbnail URL from blob
|
|
364
|
-
*/
|
|
365
|
-
createThumbnailUrl(blob) {
|
|
366
|
-
return URL.createObjectURL(blob);
|
|
367
|
-
},
|
|
368
|
-
/**
|
|
369
|
-
* Revoke thumbnail URL
|
|
370
|
-
*/
|
|
371
|
-
revokeThumbnailUrl(url) {
|
|
372
|
-
URL.revokeObjectURL(url);
|
|
373
|
-
},
|
|
374
|
-
/**
|
|
375
|
-
* Convert time to thumbnail index
|
|
376
|
-
*/
|
|
377
|
-
timeToIndex(time, duration, count) {
|
|
378
|
-
const normalizedTime = Math.max(0, Math.min(time, duration));
|
|
379
|
-
const index = Math.floor((normalizedTime / duration) * count);
|
|
380
|
-
return Math.min(index, count - 1);
|
|
381
|
-
},
|
|
382
|
-
/**
|
|
383
|
-
* Convert index to time
|
|
384
|
-
*/
|
|
385
|
-
indexToTime(index, duration, count) {
|
|
386
|
-
return (index / count) * duration;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { useKeyboardShortcuts, createMediaKeyboardShortcuts } from './use-keyboard-shortcuts';
|
|
2
|
-
export { useFocusManagement, useMediaPlayerFocus } from './use-focus-management';
|
|
3
|
-
export { useScreenReader, useMediaScreenReader } from './use-screen-reader';
|
|
4
|
-
export { useAccessibilityPreferences, useAccessibilityStyles, useFocusVisible } from './use-accessibility-preferences';
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
-
export function useAccessibilityPreferences() {
|
|
3
|
-
const [preferences, setPreferences] = useState({
|
|
4
|
-
prefersReducedMotion: false,
|
|
5
|
-
prefersHighContrast: false,
|
|
6
|
-
prefersColorScheme: 'no-preference',
|
|
7
|
-
prefersReducedTransparency: false
|
|
8
|
-
});
|
|
9
|
-
const updatePreferences = useCallback(() => {
|
|
10
|
-
if (typeof window === 'undefined')
|
|
11
|
-
return;
|
|
12
|
-
const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
13
|
-
const prefersHighContrast = window.matchMedia('(prefers-contrast: high)').matches;
|
|
14
|
-
const prefersReducedTransparency = window.matchMedia('(prefers-reduced-transparency: reduce)').matches;
|
|
15
|
-
let prefersColorScheme = 'no-preference';
|
|
16
|
-
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
17
|
-
prefersColorScheme = 'dark';
|
|
18
|
-
}
|
|
19
|
-
else if (window.matchMedia('(prefers-color-scheme: light)').matches) {
|
|
20
|
-
prefersColorScheme = 'light';
|
|
21
|
-
}
|
|
22
|
-
setPreferences({
|
|
23
|
-
prefersReducedMotion,
|
|
24
|
-
prefersHighContrast,
|
|
25
|
-
prefersColorScheme,
|
|
26
|
-
prefersReducedTransparency
|
|
27
|
-
});
|
|
28
|
-
}, []);
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (typeof window === 'undefined')
|
|
31
|
-
return;
|
|
32
|
-
// Initial check
|
|
33
|
-
updatePreferences();
|
|
34
|
-
// Set up media query listeners
|
|
35
|
-
const mediaQueries = [
|
|
36
|
-
window.matchMedia('(prefers-reduced-motion: reduce)'),
|
|
37
|
-
window.matchMedia('(prefers-contrast: high)'),
|
|
38
|
-
window.matchMedia('(prefers-color-scheme: dark)'),
|
|
39
|
-
window.matchMedia('(prefers-color-scheme: light)'),
|
|
40
|
-
window.matchMedia('(prefers-reduced-transparency: reduce)')
|
|
41
|
-
];
|
|
42
|
-
// Add listeners
|
|
43
|
-
mediaQueries.forEach(mq => {
|
|
44
|
-
mq.addEventListener('change', updatePreferences);
|
|
45
|
-
});
|
|
46
|
-
// Cleanup
|
|
47
|
-
return () => {
|
|
48
|
-
mediaQueries.forEach(mq => {
|
|
49
|
-
mq.removeEventListener('change', updatePreferences);
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
}, [updatePreferences]);
|
|
53
|
-
return preferences;
|
|
54
|
-
}
|
|
55
|
-
// Hook for applying accessibility styles
|
|
56
|
-
export function useAccessibilityStyles() {
|
|
57
|
-
const preferences = useAccessibilityPreferences();
|
|
58
|
-
// Generate CSS custom properties based on preferences
|
|
59
|
-
const cssVariables = useCallback(() => {
|
|
60
|
-
const vars = {};
|
|
61
|
-
if (preferences.prefersHighContrast) {
|
|
62
|
-
vars['--media-contrast'] = 'high';
|
|
63
|
-
vars['--media-bg-opacity'] = '1';
|
|
64
|
-
vars['--media-border-width'] = '2px';
|
|
65
|
-
vars['--media-focus-outline-width'] = '3px';
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
vars['--media-contrast'] = 'normal';
|
|
69
|
-
vars['--media-bg-opacity'] = '0.8';
|
|
70
|
-
vars['--media-border-width'] = '1px';
|
|
71
|
-
vars['--media-focus-outline-width'] = '2px';
|
|
72
|
-
}
|
|
73
|
-
if (preferences.prefersReducedMotion) {
|
|
74
|
-
vars['--media-transition-duration'] = '0ms';
|
|
75
|
-
vars['--media-animation-duration'] = '0ms';
|
|
76
|
-
vars['--media-motion'] = 'none';
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
vars['--media-transition-duration'] = '200ms';
|
|
80
|
-
vars['--media-animation-duration'] = '300ms';
|
|
81
|
-
vars['--media-motion'] = 'auto';
|
|
82
|
-
}
|
|
83
|
-
if (preferences.prefersReducedTransparency) {
|
|
84
|
-
vars['--media-backdrop-blur'] = '0px';
|
|
85
|
-
vars['--media-bg-opacity'] = '1';
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
vars['--media-backdrop-blur'] = '10px';
|
|
89
|
-
}
|
|
90
|
-
return vars;
|
|
91
|
-
}, [preferences]);
|
|
92
|
-
// Apply styles to document
|
|
93
|
-
const applyStyles = useCallback(() => {
|
|
94
|
-
if (typeof document === 'undefined')
|
|
95
|
-
return;
|
|
96
|
-
const vars = cssVariables();
|
|
97
|
-
Object.entries(vars).forEach(([property, value]) => {
|
|
98
|
-
document.documentElement.style.setProperty(property, value);
|
|
99
|
-
});
|
|
100
|
-
}, [cssVariables]);
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
applyStyles();
|
|
103
|
-
}, [applyStyles]);
|
|
104
|
-
return {
|
|
105
|
-
preferences,
|
|
106
|
-
cssVariables: cssVariables(),
|
|
107
|
-
applyStyles
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
// Hook for managing focus visibility
|
|
111
|
-
export function useFocusVisible() {
|
|
112
|
-
const [isFocusVisible, setIsFocusVisible] = useState(false);
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (typeof window === 'undefined')
|
|
115
|
-
return;
|
|
116
|
-
let hadKeyboardEvent = true;
|
|
117
|
-
let keyboardThrottleTimeoutID;
|
|
118
|
-
const handleKeyDown = (e) => {
|
|
119
|
-
if (e.metaKey || e.altKey || e.ctrlKey) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
hadKeyboardEvent = true;
|
|
123
|
-
setIsFocusVisible(true);
|
|
124
|
-
};
|
|
125
|
-
const handlePointerDown = () => {
|
|
126
|
-
hadKeyboardEvent = false;
|
|
127
|
-
setIsFocusVisible(false);
|
|
128
|
-
};
|
|
129
|
-
const handleFocus = (e) => {
|
|
130
|
-
if (hadKeyboardEvent || e.target?.matches(':focus-visible')) {
|
|
131
|
-
setIsFocusVisible(true);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
const handleBlur = () => {
|
|
135
|
-
setIsFocusVisible(false);
|
|
136
|
-
};
|
|
137
|
-
document.addEventListener('keydown', handleKeyDown, true);
|
|
138
|
-
document.addEventListener('mousedown', handlePointerDown, true);
|
|
139
|
-
document.addEventListener('pointerdown', handlePointerDown, true);
|
|
140
|
-
document.addEventListener('touchstart', handlePointerDown, true);
|
|
141
|
-
document.addEventListener('focus', handleFocus, true);
|
|
142
|
-
document.addEventListener('blur', handleBlur, true);
|
|
143
|
-
return () => {
|
|
144
|
-
document.removeEventListener('keydown', handleKeyDown, true);
|
|
145
|
-
document.removeEventListener('mousedown', handlePointerDown, true);
|
|
146
|
-
document.removeEventListener('pointerdown', handlePointerDown, true);
|
|
147
|
-
document.removeEventListener('touchstart', handlePointerDown, true);
|
|
148
|
-
document.removeEventListener('focus', handleFocus, true);
|
|
149
|
-
document.removeEventListener('blur', handleBlur, true);
|
|
150
|
-
if (keyboardThrottleTimeoutID) {
|
|
151
|
-
clearTimeout(keyboardThrottleTimeoutID);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
}, []);
|
|
155
|
-
return isFocusVisible;
|
|
156
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { useRef, useCallback, useEffect } from 'react';
|
|
2
|
-
export function useFocusManagement({ restoreFocus = true, initialFocus } = {}) {
|
|
3
|
-
const previousFocusRef = useRef(null);
|
|
4
|
-
const containerRef = useRef(null);
|
|
5
|
-
// Store the previously focused element
|
|
6
|
-
const storePreviousFocus = useCallback(() => {
|
|
7
|
-
previousFocusRef.current = document.activeElement;
|
|
8
|
-
}, []);
|
|
9
|
-
// Restore focus to the previously focused element
|
|
10
|
-
const restorePreviousFocus = useCallback((options = {}) => {
|
|
11
|
-
if (previousFocusRef.current && restoreFocus) {
|
|
12
|
-
previousFocusRef.current.focus({
|
|
13
|
-
preventScroll: options.preventScroll
|
|
14
|
-
});
|
|
15
|
-
previousFocusRef.current = null;
|
|
16
|
-
}
|
|
17
|
-
}, [restoreFocus]);
|
|
18
|
-
// Focus an element by selector or element
|
|
19
|
-
const focusElement = useCallback((target, options = {}) => {
|
|
20
|
-
let element = null;
|
|
21
|
-
if (typeof target === 'string') {
|
|
22
|
-
element = containerRef.current?.querySelector(target) ||
|
|
23
|
-
document.querySelector(target);
|
|
24
|
-
}
|
|
25
|
-
else if (typeof target === 'function') {
|
|
26
|
-
element = target();
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
element = target;
|
|
30
|
-
}
|
|
31
|
-
if (element) {
|
|
32
|
-
element.focus({
|
|
33
|
-
preventScroll: options.preventScroll
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}, []);
|
|
37
|
-
// Get all focusable elements within a container
|
|
38
|
-
const getFocusableElements = useCallback((container) => {
|
|
39
|
-
const root = container || containerRef.current || document;
|
|
40
|
-
const focusableSelectors = [
|
|
41
|
-
'button:not([disabled])',
|
|
42
|
-
'input:not([disabled])',
|
|
43
|
-
'textarea:not([disabled])',
|
|
44
|
-
'select:not([disabled])',
|
|
45
|
-
'a[href]',
|
|
46
|
-
'[tabindex]:not([tabindex="-1"])',
|
|
47
|
-
'audio[controls]',
|
|
48
|
-
'video[controls]',
|
|
49
|
-
'[contenteditable]:not([contenteditable="false"])'
|
|
50
|
-
].join(', ');
|
|
51
|
-
return Array.from(root.querySelectorAll(focusableSelectors));
|
|
52
|
-
}, []);
|
|
53
|
-
// Create a focus trap within the container
|
|
54
|
-
const createFocusTrap = useCallback(() => {
|
|
55
|
-
const handleKeyDown = (event) => {
|
|
56
|
-
if (event.key !== 'Tab')
|
|
57
|
-
return;
|
|
58
|
-
const focusableElements = getFocusableElements();
|
|
59
|
-
if (focusableElements.length === 0)
|
|
60
|
-
return;
|
|
61
|
-
const firstFocusable = focusableElements[0];
|
|
62
|
-
const lastFocusable = focusableElements[focusableElements.length - 1];
|
|
63
|
-
if (event.shiftKey) {
|
|
64
|
-
// Shift + Tab
|
|
65
|
-
if (document.activeElement === firstFocusable) {
|
|
66
|
-
event.preventDefault();
|
|
67
|
-
lastFocusable.focus();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// Tab
|
|
72
|
-
if (document.activeElement === lastFocusable) {
|
|
73
|
-
event.preventDefault();
|
|
74
|
-
firstFocusable.focus();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
79
|
-
return () => document.removeEventListener('keydown', handleKeyDown);
|
|
80
|
-
}, [getFocusableElements]);
|
|
81
|
-
// Navigate to next/previous focusable element
|
|
82
|
-
const navigateFocus = useCallback((direction) => {
|
|
83
|
-
const focusableElements = getFocusableElements();
|
|
84
|
-
const currentIndex = focusableElements.indexOf(document.activeElement);
|
|
85
|
-
let nextIndex;
|
|
86
|
-
if (direction === 'next') {
|
|
87
|
-
nextIndex = currentIndex + 1 >= focusableElements.length ? 0 : currentIndex + 1;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
nextIndex = currentIndex - 1 < 0 ? focusableElements.length - 1 : currentIndex - 1;
|
|
91
|
-
}
|
|
92
|
-
focusableElements[nextIndex]?.focus();
|
|
93
|
-
}, [getFocusableElements]);
|
|
94
|
-
// Initialize focus on mount
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
if (initialFocus) {
|
|
97
|
-
const timer = setTimeout(() => {
|
|
98
|
-
focusElement(initialFocus);
|
|
99
|
-
}, 0);
|
|
100
|
-
return () => clearTimeout(timer);
|
|
101
|
-
}
|
|
102
|
-
}, [initialFocus, focusElement]);
|
|
103
|
-
return {
|
|
104
|
-
containerRef,
|
|
105
|
-
storePreviousFocus,
|
|
106
|
-
restorePreviousFocus,
|
|
107
|
-
focusElement,
|
|
108
|
-
getFocusableElements,
|
|
109
|
-
createFocusTrap,
|
|
110
|
-
navigateFocus
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
// Hook for managing focus within media player controls
|
|
114
|
-
export function useMediaPlayerFocus() {
|
|
115
|
-
const focusManager = useFocusManagement({
|
|
116
|
-
restoreFocus: true,
|
|
117
|
-
initialFocus: '[data-media-control="play-pause"]'
|
|
118
|
-
});
|
|
119
|
-
// Focus on play/pause button
|
|
120
|
-
const focusPlayPause = useCallback(() => {
|
|
121
|
-
focusManager.focusElement('[data-media-control="play-pause"]');
|
|
122
|
-
}, [focusManager]);
|
|
123
|
-
// Focus on seek bar
|
|
124
|
-
const focusSeekBar = useCallback(() => {
|
|
125
|
-
focusManager.focusElement('[data-media-control="seek-bar"]');
|
|
126
|
-
}, [focusManager]);
|
|
127
|
-
// Focus on volume control
|
|
128
|
-
const focusVolumeControl = useCallback(() => {
|
|
129
|
-
focusManager.focusElement('[data-media-control="volume"]');
|
|
130
|
-
}, [focusManager]);
|
|
131
|
-
// Focus on settings button
|
|
132
|
-
const focusSettings = useCallback(() => {
|
|
133
|
-
focusManager.focusElement('[data-media-control="settings"]');
|
|
134
|
-
}, [focusManager]);
|
|
135
|
-
return {
|
|
136
|
-
...focusManager,
|
|
137
|
-
focusPlayPause,
|
|
138
|
-
focusSeekBar,
|
|
139
|
-
focusVolumeControl,
|
|
140
|
-
focusSettings
|
|
141
|
-
};
|
|
142
|
-
}
|