@therealtinhtute/baroiplayer 1.0.7 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +15 -15
- package/dist/context/media.js +2 -0
- package/dist/context/media.js.map +1 -0
- package/dist/context/media.mjs +15 -0
- package/dist/context/media.mjs.map +1 -0
- package/dist/context/store.js +2 -0
- package/dist/context/store.js.map +1 -0
- package/dist/context/store.mjs +5 -0
- package/dist/context/store.mjs.map +1 -0
- package/dist/context-BYwDoSRX.js +1172 -0
- package/dist/context-BYwDoSRX.js.map +1 -0
- package/dist/context-eNS62_ac.cjs +23 -0
- package/dist/context-eNS62_ac.cjs.map +1 -0
- package/dist/core-events-B1iM2F46.cjs +2 -0
- package/dist/core-events-B1iM2F46.cjs.map +1 -0
- package/dist/core-events-DunPHKRE.js +484 -0
- package/dist/core-events-DunPHKRE.js.map +1 -0
- package/dist/core-plugins-CROGvQUy.js +686 -0
- package/dist/core-plugins-CROGvQUy.js.map +1 -0
- package/dist/core-plugins-DtsHBOtF.cjs +2 -0
- package/dist/core-plugins-DtsHBOtF.cjs.map +1 -0
- package/dist/core.js +37 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +1233 -0
- package/dist/core.mjs.map +1 -0
- package/dist/enhanced-components-DUw2KrmQ.js +1142 -0
- package/dist/enhanced-components-DUw2KrmQ.js.map +1 -0
- package/dist/enhanced-components-DXBCHU0v.cjs +2 -0
- package/dist/enhanced-components-DXBCHU0v.cjs.map +1 -0
- package/dist/hooks-BW-JjVgP.cjs +4 -0
- package/dist/hooks-BW-JjVgP.cjs.map +1 -0
- package/dist/hooks-CyX6De5M.js +1693 -0
- package/dist/hooks-CyX6De5M.js.map +1 -0
- package/dist/index.css +1 -102
- package/dist/index.js +112 -27
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6275 -17
- package/dist/index.mjs.map +1 -0
- package/dist/minimal-components-Bdcpxav5.cjs +2 -0
- package/dist/minimal-components-Bdcpxav5.cjs.map +1 -0
- package/dist/minimal-components-DlRK7Qu_.js +1927 -0
- package/dist/minimal-components-DlRK7Qu_.js.map +1 -0
- package/dist/minimal-components.css +1 -589
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor-C5k6FDXw.js +301 -0
- package/dist/performance-monitor-C5k6FDXw.js.map +1 -0
- package/dist/performance-monitor-lJmuUjQQ.cjs +2 -0
- package/dist/performance-monitor-lJmuUjQQ.cjs.map +1 -0
- package/dist/utils-CFOue_9K.cjs +9 -0
- package/dist/utils-CFOue_9K.cjs.map +1 -0
- package/dist/utils-Dzpl2ArK.js +2844 -0
- package/dist/utils-Dzpl2ArK.js.map +1 -0
- package/dist/utils.js +2 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +11 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +11 -40
- package/src/adapters/videojs-adapter.tsx +441 -441
- package/src/components/AnimateLoading.tsx +85 -93
- package/src/components/LoadingState.tsx +199 -208
- package/src/components/__tests__/media-player-accessibility.test.tsx +510 -0
- package/src/components/__tests__/media-player-react19.test.tsx +457 -0
- package/src/components/accessibility/keyboard-help-overlay.tsx +199 -207
- package/src/components/basic/index.ts +28 -28
- package/src/components/enhanced/advanced-features.tsx +49 -54
- package/src/components/enhanced/debug-panel.tsx +148 -122
- package/src/components/enhanced/enhanced-controls.tsx +117 -120
- package/src/components/enhanced/enhanced-media-player.tsx +228 -214
- package/src/components/enhanced/error-handling.tsx +50 -57
- package/src/components/enhanced/index.ts +27 -27
- package/src/components/enhanced/media-player-enhanced.tsx +117 -83
- package/src/components/examples/basic-video-player.tsx +35 -40
- package/src/components/examples/enhanced-controls-example.tsx +16 -30
- package/src/components/examples/enhanced-media-player-example.tsx +196 -187
- package/src/components/examples/loading-states-demo.tsx +113 -113
- package/src/components/examples/react-19-demo.tsx +88 -116
- package/src/components/examples/volume-orientation-demo.tsx +77 -85
- package/src/components/icon-demo.tsx +189 -202
- package/src/components/icons/svg-icons/ArrowLeftIcon.tsx +13 -13
- package/src/components/icons/svg-icons/ArrowRightIcon.tsx +13 -13
- package/src/components/icons/svg-icons/AudioIcon.tsx +16 -16
- package/src/components/icons/svg-icons/BackwardIcon.tsx +7 -7
- package/src/components/icons/svg-icons/CameraIcon.tsx +13 -13
- package/src/components/icons/svg-icons/CheckIcon.tsx +13 -13
- package/src/components/icons/svg-icons/EnablePiPIcon.tsx +13 -13
- package/src/components/icons/svg-icons/ForwardIcon.tsx +7 -7
- package/src/components/icons/svg-icons/FullscreenEnterIcon.tsx +18 -18
- package/src/components/icons/svg-icons/FullscreenExitIcon.tsx +18 -18
- package/src/components/icons/svg-icons/LoadingIcon.tsx +27 -27
- package/src/components/icons/svg-icons/PauseIcon.tsx +18 -18
- package/src/components/icons/svg-icons/PlayIcon.tsx +16 -16
- package/src/components/icons/svg-icons/PlaybackSpeedIcon.tsx +18 -18
- package/src/components/icons/svg-icons/QualityIcon.tsx +16 -16
- package/src/components/icons/svg-icons/SettingsIcon.tsx +7 -7
- package/src/components/icons/svg-icons/SliderIcon.tsx +16 -16
- package/src/components/icons/svg-icons/SubtitleIcon.tsx +16 -16
- package/src/components/icons/svg-icons/SubtitleOffIcon.tsx +20 -20
- package/src/components/icons/svg-icons/UnPiPIcon.tsx +13 -13
- package/src/components/icons/svg-icons/VolumeMutedIcon.tsx +11 -11
- package/src/components/icons/svg-icons/VolumeOneIcon.tsx +17 -17
- package/src/components/icons/svg-icons/VolumeThreeIcon.tsx +11 -11
- package/src/components/icons/svg-icons/VolumeTwoIcon.tsx +11 -11
- package/src/components/legacy.tsx +8 -14
- package/src/components/media-metadata-display.tsx +78 -79
- package/src/components/media-player-controls.tsx +37 -40
- package/src/components/media-player-error.tsx +2 -2
- package/src/components/media-player-fullscreen.tsx +2 -2
- package/src/components/media-player-hls.tsx +89 -89
- package/src/components/media-player-play.tsx +2 -2
- package/src/components/media-player-root.tsx +20 -22
- package/src/components/media-player-seek.tsx +1 -1
- package/src/components/media-player-tooltip.tsx +1 -1
- package/src/components/media-player-video.tsx +28 -6
- package/src/components/media-player-volume.tsx +3 -3
- package/src/components/media-player.tsx +209 -174
- package/src/components/media-suspense.tsx +71 -89
- package/src/components/player-settings-form.tsx +143 -148
- package/src/components/react-player-wrapper.tsx +23 -23
- package/src/components/simple-video-player.tsx +53 -51
- package/src/components/ui/blur-poster.tsx +93 -0
- package/src/components/ui/empty-state.tsx +91 -0
- package/src/components/ui/enhanced-seek-bar.tsx +75 -56
- package/src/components/ui/error-state.tsx +124 -0
- package/src/components/ui/fullscreen-button.tsx +71 -50
- package/src/components/ui/loading-skeleton.tsx +107 -0
- package/src/components/ui/media-resource-preloader.tsx +265 -198
- package/src/components/ui/offline-message.tsx +98 -0
- package/src/components/ui/play-button.tsx +79 -87
- package/src/components/ui/seek-bar.tsx +170 -140
- package/src/components/ui/time-display.tsx +33 -12
- package/src/components/ui/volume-control.tsx +91 -44
- package/src/components/unified/base-media-player.tsx +45 -51
- package/src/components/unified/media-player.tsx +3 -3
- package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +508 -502
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +108 -87
- package/src/components/variants/minimal/MinimalControls.tsx +100 -118
- package/src/components/variants/minimal/MinimalLoading.tsx +19 -23
- package/src/components/variants/minimal/MinimalMediaPlayer.tsx +283 -280
- package/src/components/variants/minimal/MinimalOverlay.tsx +43 -49
- package/src/components/variants/minimal/MinimalPlayButton.tsx +44 -53
- package/src/components/variants/minimal/MinimalSeekBar.tsx +130 -140
- package/src/components/variants/minimal/MinimalVolumeControl.tsx +59 -64
- package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +29 -32
- package/src/components/variants/minimal/components/CenterPlayButton.tsx +1 -1
- package/src/components/variants/minimal/components/ControlBar.tsx +7 -11
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +381 -330
- package/src/components/variants/minimal/components/PlaybackControls.tsx +6 -11
- package/src/components/variants/minimal/components/RightControls.tsx +8 -17
- package/src/components/variants/minimal/components/SeekBar.tsx +16 -20
- package/src/components/variants/minimal/components/SettingsDropdown.tsx +12 -14
- package/src/components/variants/minimal/components/SubtitleDisplay.tsx +1 -1
- package/src/components/variants/minimal/components/TimeDisplay.tsx +2 -5
- package/src/components/variants/minimal/components/VideoElement.tsx +3 -10
- package/src/components/variants/minimal/components/VolumeControl.tsx +42 -39
- package/src/components/video-player.tsx +10 -10
- package/src/context/__tests__/media-store.test.ts +509 -0
- package/src/context/error-handling.ts +106 -102
- package/src/context/media-context.tsx +56 -10
- package/src/context/media-provider.tsx +16 -17
- package/src/context/media-store.ts +68 -60
- package/src/context/persistence.ts +74 -65
- package/src/core/events/event-system.ts +422 -416
- package/src/core/events/hooks.ts +275 -252
- package/src/core/events/index.ts +14 -14
- package/src/core/events/middleware.ts +269 -252
- package/src/core/index.ts +8 -8
- package/src/core/optimization/bundle-optimizer.tsx +65 -60
- package/src/core/performance/cicd.ts +91 -89
- package/src/core/performance/index.ts +22 -22
- package/src/core/performance/media-loading-optimizer.ts +518 -512
- package/src/core/performance/performance-budgets.ts +414 -409
- package/src/core/performance/performance-monitor.tsx +451 -439
- package/src/core/performance/performance-testing.ts +439 -437
- package/src/core/plugins/__tests__/registry.test.ts +595 -0
- package/src/core/plugins/base-plugin.ts +197 -196
- package/src/core/plugins/enhanced-plugin-system.ts +136 -136
- package/src/core/plugins/examples/analytics-plugin.ts +229 -230
- package/src/core/plugins/index.ts +26 -26
- package/src/core/plugins/registry.ts +315 -323
- package/src/core/plugins/types.ts +97 -105
- package/src/core/plugins/utils.ts +292 -291
- package/src/core/progressive-loading.tsx +297 -288
- package/src/core/providers/enhanced-hls-provider.ts +118 -90
- package/src/core/providers/lazy-provider.tsx +51 -0
- package/src/core/providers/service-provider.tsx +104 -108
- package/src/core/utils.tsx +22 -26
- package/src/features/media-session/media-session-manager.ts +406 -402
- package/src/features/picture-in-picture/pip-manager.ts +364 -365
- package/src/features/playlist/playlist-manager.ts +597 -585
- package/src/features/subtitles/subtitle-manager.ts +424 -430
- package/src/features/subtitles/subtitle-parser.ts +274 -273
- package/src/features/thumbnails/thumbnail-generator.ts +504 -502
- package/src/hooks/__tests__/use-media-player.test.ts +712 -0
- package/src/hooks/__tests__/use-media-state.test.tsx +316 -0
- package/src/hooks/accessibility/index.ts +20 -20
- package/src/hooks/accessibility/use-accessibility-preferences.ts +177 -175
- package/src/hooks/accessibility/use-focus-management.ts +170 -163
- package/src/hooks/accessibility/use-keyboard-shortcuts.ts +132 -124
- package/src/hooks/accessibility/use-screen-reader.ts +191 -161
- package/src/hooks/core/index.ts +30 -30
- package/src/hooks/legacy.ts +3 -9
- package/src/hooks/use-buffer-health.ts +218 -0
- package/src/hooks/use-enhanced-media-player.ts +74 -82
- package/src/hooks/use-focus-trap.tsx +162 -0
- package/src/hooks/use-intelligent-preloading.ts +236 -232
- package/src/hooks/use-keyboard-controls.ts +80 -80
- package/src/hooks/use-keyboard-shortcuts.ts +255 -0
- package/src/hooks/use-media-actions.ts +81 -72
- package/src/hooks/use-media-metadata.ts +75 -73
- package/src/hooks/use-media-optimistic.ts +145 -151
- package/src/hooks/use-media-player.ts +109 -107
- package/src/hooks/use-media-state.ts +63 -59
- package/src/hooks/use-memory-optimization.ts +119 -117
- package/src/hooks/use-network-status.ts +124 -0
- package/src/hooks/use-optimistic-controls.ts +91 -88
- package/src/hooks/use-optimized-media.ts +76 -56
- package/src/hooks/use-smart-preload.ts +230 -0
- package/src/hooks/use-touch-gestures.ts +427 -383
- package/src/hooks/useEnhancedSubtitles.ts +245 -245
- package/src/hooks/useKeyboardShortcuts.ts +52 -52
- package/src/hooks/useMediaControls.ts +22 -22
- package/src/hooks/useScreenshot.ts +51 -47
- package/src/hooks/useSubtitles.ts +53 -53
- package/src/hooks/useVideoPlayer.ts +61 -61
- package/src/icons/components/FullscreenIcon.tsx +34 -35
- package/src/icons/components/SettingsIcon.tsx +35 -36
- package/src/icons/components/animated/LoadingIcon.tsx +25 -41
- package/src/icons/components/animated/PlayPauseIcon.tsx +38 -46
- package/src/icons/components/media/PauseIcon.tsx +36 -37
- package/src/icons/components/media/PlayIcon.tsx +35 -36
- package/src/icons/components/volume/VolumeIcon.tsx +36 -37
- package/src/icons/components/volume/VolumeOffIcon.tsx +36 -37
- package/src/icons/index.ts +38 -38
- package/src/icons/provider.tsx +40 -46
- package/src/icons/types.ts +51 -31
- package/src/index-enhanced.ts +10 -10
- package/src/index-legacy.ts +3 -4
- package/src/index.css +80 -80
- package/src/index.ts +8 -23
- package/src/lib/__tests__/async-utils.test.ts +291 -0
- package/src/lib/async-utils.ts +194 -0
- package/src/lib/deprecation.ts +4 -4
- package/src/lib/index.ts +3 -2
- package/src/lib/utils.ts +3 -3
- package/src/styles/globals.css +3 -3
- package/src/styles/minimal-player.css +606 -574
- package/src/styles/pixel-art.css +23 -28
- package/src/styles/videojs.css +43 -43
- package/src/test/accessibility-utils.ts +208 -0
- package/src/test/browser-simulation.ts +235 -0
- package/src/test/media-mocks.ts +156 -0
- package/src/test/performance-utils.ts +192 -0
- package/src/test/setup.ts +241 -44
- package/src/types/events.ts +30 -30
- package/src/types/formats.ts +56 -72
- package/src/types/index.ts +5 -40
- package/src/types/videojs-plugins.d.ts +6 -6
- package/dist/index.d.ts +0 -1425
- package/dist/package.json +0 -62
- package/dist/src/adapters/videojs-adapter.d.ts +0 -38
- package/dist/src/adapters/videojs-adapter.tsx +0 -470
- package/dist/src/components/AnimateLoading.d.ts +0 -9
- package/dist/src/components/AnimateLoading.tsx +0 -115
- package/dist/src/components/LoadingState.d.ts +0 -33
- package/dist/src/components/LoadingState.tsx +0 -248
- package/dist/src/components/accessibility/keyboard-help-overlay.d.ts +0 -17
- package/dist/src/components/accessibility/keyboard-help-overlay.tsx +0 -213
- package/dist/src/components/audio-player.d.ts +0 -3
- package/dist/src/components/audio-player.tsx +0 -85
- package/dist/src/components/basic/index.d.ts +0 -26
- package/dist/src/components/basic/index.ts +0 -37
- package/dist/src/components/enhanced/advanced-features.d.ts +0 -45
- package/dist/src/components/enhanced/advanced-features.tsx +0 -316
- package/dist/src/components/enhanced/debug-panel.d.ts +0 -70
- package/dist/src/components/enhanced/debug-panel.tsx +0 -422
- package/dist/src/components/enhanced/enhanced-controls.d.ts +0 -50
- package/dist/src/components/enhanced/enhanced-controls.tsx +0 -600
- package/dist/src/components/enhanced/enhanced-media-player.d.ts +0 -26
- package/dist/src/components/enhanced/enhanced-media-player.tsx +0 -509
- package/dist/src/components/enhanced/error-handling.d.ts +0 -36
- package/dist/src/components/enhanced/error-handling.tsx +0 -345
- package/dist/src/components/enhanced/index.d.ts +0 -7
- package/dist/src/components/enhanced/index.ts +0 -39
- package/dist/src/components/enhanced/media-player-enhanced.d.ts +0 -21
- package/dist/src/components/enhanced/media-player-enhanced.tsx +0 -349
- package/dist/src/components/examples/basic-video-player.d.ts +0 -10
- package/dist/src/components/examples/basic-video-player.tsx +0 -55
- package/dist/src/components/examples/custom-controls-example.d.ts +0 -10
- package/dist/src/components/examples/custom-controls-example.tsx +0 -63
- package/dist/src/components/examples/enhanced-controls-example.d.ts +0 -9
- package/dist/src/components/examples/enhanced-controls-example.tsx +0 -114
- package/dist/src/components/examples/enhanced-media-player-example.d.ts +0 -9
- package/dist/src/components/examples/enhanced-media-player-example.tsx +0 -293
- package/dist/src/components/examples/loading-states-demo.d.ts +0 -2
- package/dist/src/components/examples/loading-states-demo.tsx +0 -142
- package/dist/src/components/examples/react-19-demo.d.ts +0 -10
- package/dist/src/components/examples/react-19-demo.tsx +0 -381
- package/dist/src/components/examples/volume-orientation-demo.d.ts +0 -2
- package/dist/src/components/examples/volume-orientation-demo.tsx +0 -114
- package/dist/src/components/icon-demo.d.ts +0 -2
- package/dist/src/components/icon-demo.tsx +0 -209
- package/dist/src/components/icons/index.d.ts +0 -36
- package/dist/src/components/icons/index.tsx +0 -166
- package/dist/src/components/icons/svg-icons/ArrowLeftIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/ArrowLeftIcon.tsx +0 -18
- package/dist/src/components/icons/svg-icons/ArrowRightIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/ArrowRightIcon.tsx +0 -18
- package/dist/src/components/icons/svg-icons/AudioIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/AudioIcon.tsx +0 -22
- package/dist/src/components/icons/svg-icons/BackwardIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/BackwardIcon.tsx +0 -12
- package/dist/src/components/icons/svg-icons/CameraIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/CameraIcon.tsx +0 -19
- package/dist/src/components/icons/svg-icons/CheckIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/CheckIcon.tsx +0 -19
- package/dist/src/components/icons/svg-icons/EnablePiPIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/EnablePiPIcon.tsx +0 -17
- package/dist/src/components/icons/svg-icons/ForwardIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/ForwardIcon.tsx +0 -12
- package/dist/src/components/icons/svg-icons/FullscreenEnterIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/FullscreenEnterIcon.tsx +0 -23
- package/dist/src/components/icons/svg-icons/FullscreenExitIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/FullscreenExitIcon.tsx +0 -23
- package/dist/src/components/icons/svg-icons/LoadingIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/LoadingIcon.tsx +0 -32
- package/dist/src/components/icons/svg-icons/PauseIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/PauseIcon.tsx +0 -23
- package/dist/src/components/icons/svg-icons/PlayIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/PlayIcon.tsx +0 -21
- package/dist/src/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/PlaybackSpeedIcon.tsx +0 -23
- package/dist/src/components/icons/svg-icons/QualityIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/QualityIcon.tsx +0 -21
- package/dist/src/components/icons/svg-icons/SettingsIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/SettingsIcon.tsx +0 -12
- package/dist/src/components/icons/svg-icons/SliderIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/SliderIcon.tsx +0 -21
- package/dist/src/components/icons/svg-icons/SubtitleIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/SubtitleIcon.tsx +0 -21
- package/dist/src/components/icons/svg-icons/SubtitleOffIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/SubtitleOffIcon.tsx +0 -25
- package/dist/src/components/icons/svg-icons/UnPiPIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/UnPiPIcon.tsx +0 -17
- package/dist/src/components/icons/svg-icons/VolumeMutedIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/VolumeMutedIcon.tsx +0 -16
- package/dist/src/components/icons/svg-icons/VolumeOneIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/VolumeOneIcon.tsx +0 -22
- package/dist/src/components/icons/svg-icons/VolumeThreeIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/VolumeThreeIcon.tsx +0 -16
- package/dist/src/components/icons/svg-icons/VolumeTwoIcon.d.ts +0 -4
- package/dist/src/components/icons/svg-icons/VolumeTwoIcon.tsx +0 -16
- package/dist/src/components/legacy.d.ts +0 -13
- package/dist/src/components/legacy.tsx +0 -93
- package/dist/src/components/media-metadata-display.d.ts +0 -11
- package/dist/src/components/media-metadata-display.tsx +0 -100
- package/dist/src/components/media-player-audio.d.ts +0 -9
- package/dist/src/components/media-player-audio.tsx +0 -39
- package/dist/src/components/media-player-controls.d.ts +0 -23
- package/dist/src/components/media-player-controls.tsx +0 -226
- package/dist/src/components/media-player-error.d.ts +0 -16
- package/dist/src/components/media-player-error.tsx +0 -163
- package/dist/src/components/media-player-fullscreen.d.ts +0 -12
- package/dist/src/components/media-player-fullscreen.tsx +0 -109
- package/dist/src/components/media-player-hls.d.ts +0 -23
- package/dist/src/components/media-player-hls.tsx +0 -111
- package/dist/src/components/media-player-loading.d.ts +0 -12
- package/dist/src/components/media-player-loading.tsx +0 -76
- package/dist/src/components/media-player-play.d.ts +0 -11
- package/dist/src/components/media-player-play.tsx +0 -75
- package/dist/src/components/media-player-root.d.ts +0 -28
- package/dist/src/components/media-player-root.tsx +0 -340
- package/dist/src/components/media-player-seek.d.ts +0 -15
- package/dist/src/components/media-player-seek.tsx +0 -168
- package/dist/src/components/media-player-time.d.ts +0 -12
- package/dist/src/components/media-player-time.tsx +0 -99
- package/dist/src/components/media-player-tooltip.d.ts +0 -13
- package/dist/src/components/media-player-tooltip.tsx +0 -58
- package/dist/src/components/media-player-video.d.ts +0 -9
- package/dist/src/components/media-player-video.tsx +0 -39
- package/dist/src/components/media-player-volume.d.ts +0 -13
- package/dist/src/components/media-player-volume.tsx +0 -155
- package/dist/src/components/media-player.d.ts +0 -3
- package/dist/src/components/media-player.tsx +0 -257
- package/dist/src/components/media-suspense.d.ts +0 -78
- package/dist/src/components/media-suspense.tsx +0 -362
- package/dist/src/components/player-settings-form.d.ts +0 -8
- package/dist/src/components/player-settings-form.tsx +0 -163
- package/dist/src/components/react-player-wrapper.d.ts +0 -64
- package/dist/src/components/react-player-wrapper.tsx +0 -651
- package/dist/src/components/simple-video-player.d.ts +0 -9
- package/dist/src/components/simple-video-player.tsx +0 -60
- package/dist/src/components/ui/button.tsx +0 -49
- package/dist/src/components/ui/dropdown-menu.tsx +0 -137
- package/dist/src/components/ui/enhanced-seek-bar.d.ts +0 -3
- package/dist/src/components/ui/enhanced-seek-bar.tsx +0 -235
- package/dist/src/components/ui/fullscreen-button.d.ts +0 -3
- package/dist/src/components/ui/fullscreen-button.tsx +0 -60
- package/dist/src/components/ui/icons.tsx +0 -174
- package/dist/src/components/ui/media-resource-preloader.d.ts +0 -21
- package/dist/src/components/ui/media-resource-preloader.tsx +0 -393
- package/dist/src/components/ui/play-button.d.ts +0 -3
- package/dist/src/components/ui/play-button.tsx +0 -107
- package/dist/src/components/ui/seek-bar.d.ts +0 -3
- package/dist/src/components/ui/seek-bar.tsx +0 -161
- package/dist/src/components/ui/slider.tsx +0 -55
- package/dist/src/components/ui/time-display.d.ts +0 -3
- package/dist/src/components/ui/time-display.tsx +0 -40
- package/dist/src/components/ui/tooltip.tsx +0 -131
- package/dist/src/components/ui/volume-control.d.ts +0 -3
- package/dist/src/components/ui/volume-control.tsx +0 -143
- package/dist/src/components/unified/base-media-player.d.ts +0 -18
- package/dist/src/components/unified/base-media-player.tsx +0 -246
- package/dist/src/components/unified/media-player.d.ts +0 -37
- package/dist/src/components/unified/media-player.tsx +0 -75
- package/dist/src/components/variants/minimal/AccessibleMinimalPlayer.d.ts +0 -42
- package/dist/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +0 -561
- package/dist/src/components/variants/minimal/EnhancedMinimalMediaPlayer.d.ts +0 -44
- package/dist/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +0 -552
- package/dist/src/components/variants/minimal/MinimalControls.d.ts +0 -19
- package/dist/src/components/variants/minimal/MinimalControls.tsx +0 -142
- package/dist/src/components/variants/minimal/MinimalLoading.d.ts +0 -10
- package/dist/src/components/variants/minimal/MinimalLoading.tsx +0 -32
- package/dist/src/components/variants/minimal/MinimalMediaPlayer.d.ts +0 -38
- package/dist/src/components/variants/minimal/MinimalMediaPlayer.tsx +0 -315
- package/dist/src/components/variants/minimal/MinimalOverlay.d.ts +0 -11
- package/dist/src/components/variants/minimal/MinimalOverlay.tsx +0 -64
- package/dist/src/components/variants/minimal/MinimalPlayButton.d.ts +0 -9
- package/dist/src/components/variants/minimal/MinimalPlayButton.tsx +0 -65
- package/dist/src/components/variants/minimal/MinimalSeekBar.d.ts +0 -7
- package/dist/src/components/variants/minimal/MinimalSeekBar.tsx +0 -150
- package/dist/src/components/variants/minimal/MinimalVolumeControl.d.ts +0 -7
- package/dist/src/components/variants/minimal/MinimalVolumeControl.tsx +0 -80
- package/dist/src/components/variants/minimal/SimpleMinimalPlayer.d.ts +0 -22
- package/dist/src/components/variants/minimal/SimpleMinimalPlayer.tsx +0 -209
- package/dist/src/components/variants/minimal/components/CenterPlayButton.d.ts +0 -7
- package/dist/src/components/variants/minimal/components/CenterPlayButton.tsx +0 -22
- package/dist/src/components/variants/minimal/components/ControlBar.d.ts +0 -43
- package/dist/src/components/variants/minimal/components/ControlBar.tsx +0 -146
- package/dist/src/components/variants/minimal/components/EnhancedSettingsMenu.d.ts +0 -24
- package/dist/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +0 -361
- package/dist/src/components/variants/minimal/components/PlaybackControls.d.ts +0 -9
- package/dist/src/components/variants/minimal/components/PlaybackControls.tsx +0 -51
- package/dist/src/components/variants/minimal/components/RightControls.d.ts +0 -25
- package/dist/src/components/variants/minimal/components/RightControls.tsx +0 -173
- package/dist/src/components/variants/minimal/components/SeekBar.d.ts +0 -11
- package/dist/src/components/variants/minimal/components/SeekBar.tsx +0 -131
- package/dist/src/components/variants/minimal/components/SettingsDropdown.d.ts +0 -9
- package/dist/src/components/variants/minimal/components/SettingsDropdown.tsx +0 -70
- package/dist/src/components/variants/minimal/components/SubtitleDisplay.d.ts +0 -7
- package/dist/src/components/variants/minimal/components/SubtitleDisplay.tsx +0 -21
- package/dist/src/components/variants/minimal/components/TimeDisplay.d.ts +0 -7
- package/dist/src/components/variants/minimal/components/TimeDisplay.tsx +0 -18
- package/dist/src/components/variants/minimal/components/VideoElement.d.ts +0 -13
- package/dist/src/components/variants/minimal/components/VideoElement.tsx +0 -40
- package/dist/src/components/variants/minimal/components/VolumeControl.d.ts +0 -13
- package/dist/src/components/variants/minimal/components/VolumeControl.tsx +0 -217
- package/dist/src/components/variants/minimal/index.d.ts +0 -17
- package/dist/src/components/variants/minimal/index.ts +0 -23
- package/dist/src/components/video-player.d.ts +0 -3
- package/dist/src/components/video-player.tsx +0 -100
- package/dist/src/context/error-handling.d.ts +0 -72
- package/dist/src/context/error-handling.ts +0 -394
- package/dist/src/context/media-context.d.ts +0 -104
- package/dist/src/context/media-context.tsx +0 -208
- package/dist/src/context/media-provider.d.ts +0 -26
- package/dist/src/context/media-provider.tsx +0 -265
- package/dist/src/context/media-store.d.ts +0 -33
- package/dist/src/context/media-store.ts +0 -379
- package/dist/src/context/persistence.d.ts +0 -83
- package/dist/src/context/persistence.ts +0 -453
- package/dist/src/core/events/event-system.d.ts +0 -170
- package/dist/src/core/events/event-system.ts +0 -442
- package/dist/src/core/events/hooks.d.ts +0 -33
- package/dist/src/core/events/hooks.ts +0 -302
- package/dist/src/core/events/index.d.ts +0 -6
- package/dist/src/core/events/index.ts +0 -22
- package/dist/src/core/events/middleware.d.ts +0 -39
- package/dist/src/core/events/middleware.ts +0 -269
- package/dist/src/core/index.d.ts +0 -8
- package/dist/src/core/index.ts +0 -22
- package/dist/src/core/optimization/bundle-optimizer.d.ts +0 -44
- package/dist/src/core/optimization/bundle-optimizer.tsx +0 -308
- package/dist/src/core/performance/cicd.d.ts +0 -8
- package/dist/src/core/performance/cicd.ts +0 -96
- package/dist/src/core/performance/index.d.ts +0 -10
- package/dist/src/core/performance/index.ts +0 -38
- package/dist/src/core/performance/media-loading-optimizer.d.ts +0 -105
- package/dist/src/core/performance/media-loading-optimizer.ts +0 -538
- package/dist/src/core/performance/performance-budgets.d.ts +0 -68
- package/dist/src/core/performance/performance-budgets.ts +0 -432
- package/dist/src/core/performance/performance-monitor.d.ts +0 -95
- package/dist/src/core/performance/performance-monitor.tsx +0 -476
- package/dist/src/core/performance/performance-testing.d.ts +0 -69
- package/dist/src/core/performance/performance-testing.ts +0 -459
- package/dist/src/core/plugins/base-plugin.d.ts +0 -52
- package/dist/src/core/plugins/base-plugin.ts +0 -224
- package/dist/src/core/plugins/enhanced-plugin-system.d.ts +0 -160
- package/dist/src/core/plugins/enhanced-plugin-system.ts +0 -417
- package/dist/src/core/plugins/examples/analytics-plugin.d.ts +0 -30
- package/dist/src/core/plugins/examples/analytics-plugin.ts +0 -242
- package/dist/src/core/plugins/index.d.ts +0 -8
- package/dist/src/core/plugins/index.ts +0 -39
- package/dist/src/core/plugins/registry.d.ts +0 -31
- package/dist/src/core/plugins/registry.ts +0 -327
- package/dist/src/core/plugins/types.d.ts +0 -101
- package/dist/src/core/plugins/types.ts +0 -159
- package/dist/src/core/plugins/utils.d.ts +0 -38
- package/dist/src/core/plugins/utils.ts +0 -316
- package/dist/src/core/progressive-loading.d.ts +0 -88
- package/dist/src/core/progressive-loading.tsx +0 -322
- package/dist/src/core/providers/enhanced-hls-provider.d.ts +0 -50
- package/dist/src/core/providers/enhanced-hls-provider.ts +0 -308
- package/dist/src/core/providers/service-provider.d.ts +0 -49
- package/dist/src/core/providers/service-provider.tsx +0 -168
- package/dist/src/core/utils.d.ts +0 -25
- package/dist/src/core/utils.tsx +0 -38
- package/dist/src/features/media-session/media-session-manager.d.ts +0 -132
- package/dist/src/features/media-session/media-session-manager.ts +0 -429
- package/dist/src/features/picture-in-picture/pip-manager.d.ts +0 -94
- package/dist/src/features/picture-in-picture/pip-manager.ts +0 -429
- package/dist/src/features/playlist/playlist-manager.d.ts +0 -208
- package/dist/src/features/playlist/playlist-manager.ts +0 -606
- package/dist/src/features/subtitles/subtitle-manager.d.ts +0 -136
- package/dist/src/features/subtitles/subtitle-manager.ts +0 -441
- package/dist/src/features/subtitles/subtitle-parser.d.ts +0 -60
- package/dist/src/features/subtitles/subtitle-parser.ts +0 -280
- package/dist/src/features/thumbnails/thumbnail-generator.d.ts +0 -136
- package/dist/src/features/thumbnails/thumbnail-generator.ts +0 -519
- package/dist/src/hooks/accessibility/index.d.ts +0 -5
- package/dist/src/hooks/accessibility/index.ts +0 -27
- package/dist/src/hooks/accessibility/use-accessibility-preferences.d.ts +0 -14
- package/dist/src/hooks/accessibility/use-accessibility-preferences.ts +0 -188
- package/dist/src/hooks/accessibility/use-focus-management.d.ts +0 -31
- package/dist/src/hooks/accessibility/use-focus-management.ts +0 -176
- package/dist/src/hooks/accessibility/use-keyboard-shortcuts.d.ts +0 -38
- package/dist/src/hooks/accessibility/use-keyboard-shortcuts.ts +0 -144
- package/dist/src/hooks/accessibility/use-screen-reader.d.ts +0 -22
- package/dist/src/hooks/accessibility/use-screen-reader.ts +0 -182
- package/dist/src/hooks/core/index.d.ts +0 -18
- package/dist/src/hooks/core/index.ts +0 -47
- package/dist/src/hooks/legacy.d.ts +0 -18
- package/dist/src/hooks/legacy.ts +0 -27
- package/dist/src/hooks/use-enhanced-media-player.d.ts +0 -88
- package/dist/src/hooks/use-enhanced-media-player.ts +0 -485
- package/dist/src/hooks/use-intelligent-preloading.d.ts +0 -66
- package/dist/src/hooks/use-intelligent-preloading.ts +0 -363
- package/dist/src/hooks/use-keyboard-controls.d.ts +0 -13
- package/dist/src/hooks/use-keyboard-controls.ts +0 -115
- package/dist/src/hooks/use-media-actions.d.ts +0 -62
- package/dist/src/hooks/use-media-actions.ts +0 -175
- package/dist/src/hooks/use-media-metadata.d.ts +0 -11
- package/dist/src/hooks/use-media-metadata.ts +0 -89
- package/dist/src/hooks/use-media-optimistic.d.ts +0 -36
- package/dist/src/hooks/use-media-optimistic.ts +0 -270
- package/dist/src/hooks/use-media-player.d.ts +0 -31
- package/dist/src/hooks/use-media-player.ts +0 -310
- package/dist/src/hooks/use-media-state.d.ts +0 -17
- package/dist/src/hooks/use-media-state.ts +0 -190
- package/dist/src/hooks/use-memory-optimization.d.ts +0 -40
- package/dist/src/hooks/use-memory-optimization.ts +0 -358
- package/dist/src/hooks/use-mobile.ts +0 -125
- package/dist/src/hooks/use-optimistic-controls.d.ts +0 -22
- package/dist/src/hooks/use-optimistic-controls.ts +0 -92
- package/dist/src/hooks/use-optimized-media.d.ts +0 -46
- package/dist/src/hooks/use-optimized-media.ts +0 -263
- package/dist/src/hooks/use-touch-gestures.d.ts +0 -47
- package/dist/src/hooks/use-touch-gestures.ts +0 -417
- package/dist/src/hooks/useEnhancedSubtitles.d.ts +0 -39
- package/dist/src/hooks/useEnhancedSubtitles.ts +0 -258
- package/dist/src/hooks/useKeyboardShortcuts.d.ts +0 -10
- package/dist/src/hooks/useKeyboardShortcuts.ts +0 -74
- package/dist/src/hooks/useMediaControls.d.ts +0 -9
- package/dist/src/hooks/useMediaControls.ts +0 -52
- package/dist/src/hooks/useScreenshot.d.ts +0 -4
- package/dist/src/hooks/useScreenshot.ts +0 -57
- package/dist/src/hooks/useSubtitles.d.ts +0 -8
- package/dist/src/hooks/useSubtitles.ts +0 -91
- package/dist/src/hooks/useVideoPlayer.d.ts +0 -32
- package/dist/src/hooks/useVideoPlayer.ts +0 -232
- package/dist/src/icons/components/FullscreenIcon.d.ts +0 -3
- package/dist/src/icons/components/FullscreenIcon.tsx +0 -37
- package/dist/src/icons/components/SettingsIcon.d.ts +0 -3
- package/dist/src/icons/components/SettingsIcon.tsx +0 -38
- package/dist/src/icons/components/animated/LoadingIcon.d.ts +0 -3
- package/dist/src/icons/components/animated/LoadingIcon.tsx +0 -43
- package/dist/src/icons/components/animated/PlayPauseIcon.d.ts +0 -7
- package/dist/src/icons/components/animated/PlayPauseIcon.tsx +0 -50
- package/dist/src/icons/components/media/PauseIcon.d.ts +0 -3
- package/dist/src/icons/components/media/PauseIcon.tsx +0 -39
- package/dist/src/icons/components/media/PlayIcon.d.ts +0 -3
- package/dist/src/icons/components/media/PlayIcon.tsx +0 -38
- package/dist/src/icons/components/volume/VolumeIcon.d.ts +0 -3
- package/dist/src/icons/components/volume/VolumeIcon.tsx +0 -39
- package/dist/src/icons/components/volume/VolumeOffIcon.d.ts +0 -3
- package/dist/src/icons/components/volume/VolumeOffIcon.tsx +0 -39
- package/dist/src/icons/index.d.ts +0 -28
- package/dist/src/icons/index.ts +0 -56
- package/dist/src/icons/provider.d.ts +0 -13
- package/dist/src/icons/provider.tsx +0 -64
- package/dist/src/icons/types.d.ts +0 -18
- package/dist/src/icons/types.ts +0 -40
- package/dist/src/index-enhanced.d.ts +0 -13
- package/dist/src/index-enhanced.ts +0 -35
- package/dist/src/index-legacy.d.ts +0 -81
- package/dist/src/index-legacy.ts +0 -327
- package/dist/src/index.css +0 -102
- package/dist/src/index.d.ts +0 -38
- package/dist/src/index.minimal.d.ts +0 -2
- package/dist/src/index.minimal.ts +0 -4
- package/dist/src/index.ts +0 -216
- package/dist/src/lib/deprecation.d.ts +0 -7
- package/dist/src/lib/deprecation.ts +0 -51
- package/dist/src/lib/format-time.d.ts +0 -9
- package/dist/src/lib/format-time.ts +0 -37
- package/dist/src/lib/index.d.ts +0 -3
- package/dist/src/lib/index.ts +0 -3
- package/dist/src/lib/utils.d.ts +0 -3
- package/dist/src/lib/utils.ts +0 -6
- package/dist/src/styles/globals.css +0 -462
- package/dist/src/styles/minimal-player.css +0 -589
- package/dist/src/styles/pixel-art.css +0 -46
- package/dist/src/styles/videojs.css +0 -100
- package/dist/src/test/setup.d.ts +0 -2
- package/dist/src/test/setup.ts +0 -79
- package/dist/src/types/events.d.ts +0 -41
- package/dist/src/types/events.ts +0 -47
- package/dist/src/types/formats.d.ts +0 -45
- package/dist/src/types/formats.ts +0 -95
- package/dist/src/types/index.d.ts +0 -128
- package/dist/src/types/index.ts +0 -225
- package/dist/src/types/videojs-plugins.d.ts +0 -14
- package/dist/styles/globals.css +0 -462
- package/dist/styles/minimal-player.css +0 -589
- package/dist/styles/pixel-art.css +0 -46
- package/dist/styles/videojs.css +0 -100
- package/src/adapters/videojs-adapter.d.ts +0 -38
- package/src/adapters/videojs-adapter.d.ts.map +0 -1
- package/src/components/AnimateLoading.d.ts +0 -9
- package/src/components/AnimateLoading.d.ts.map +0 -1
- package/src/components/LoadingState.d.ts +0 -33
- package/src/components/LoadingState.d.ts.map +0 -1
- package/src/components/accessibility/keyboard-help-overlay.d.ts +0 -17
- package/src/components/accessibility/keyboard-help-overlay.d.ts.map +0 -1
- package/src/components/audio-player.d.ts +0 -3
- package/src/components/audio-player.d.ts.map +0 -1
- package/src/components/basic/index.d.ts +0 -26
- package/src/components/basic/index.d.ts.map +0 -1
- package/src/components/enhanced/advanced-features.d.ts +0 -45
- package/src/components/enhanced/advanced-features.d.ts.map +0 -1
- package/src/components/enhanced/debug-panel.d.ts +0 -70
- package/src/components/enhanced/debug-panel.d.ts.map +0 -1
- package/src/components/enhanced/enhanced-controls.d.ts +0 -50
- package/src/components/enhanced/enhanced-controls.d.ts.map +0 -1
- package/src/components/enhanced/enhanced-media-player.d.ts +0 -26
- package/src/components/enhanced/enhanced-media-player.d.ts.map +0 -1
- package/src/components/enhanced/error-handling.d.ts +0 -36
- package/src/components/enhanced/error-handling.d.ts.map +0 -1
- package/src/components/enhanced/index.d.ts +0 -7
- package/src/components/enhanced/index.d.ts.map +0 -1
- package/src/components/enhanced/media-player-enhanced.d.ts +0 -21
- package/src/components/enhanced/media-player-enhanced.d.ts.map +0 -1
- package/src/components/examples/basic-video-player.d.ts +0 -10
- package/src/components/examples/basic-video-player.d.ts.map +0 -1
- package/src/components/examples/custom-controls-example.d.ts +0 -10
- package/src/components/examples/custom-controls-example.d.ts.map +0 -1
- package/src/components/examples/enhanced-controls-example.d.ts +0 -9
- package/src/components/examples/enhanced-controls-example.d.ts.map +0 -1
- package/src/components/examples/enhanced-media-player-example.d.ts +0 -9
- package/src/components/examples/enhanced-media-player-example.d.ts.map +0 -1
- package/src/components/examples/loading-states-demo.d.ts +0 -2
- package/src/components/examples/loading-states-demo.d.ts.map +0 -1
- package/src/components/examples/react-19-demo.d.ts +0 -10
- package/src/components/examples/react-19-demo.d.ts.map +0 -1
- package/src/components/examples/volume-orientation-demo.d.ts +0 -2
- package/src/components/examples/volume-orientation-demo.d.ts.map +0 -1
- package/src/components/icon-demo.d.ts +0 -2
- package/src/components/icon-demo.d.ts.map +0 -1
- package/src/components/icons/index.d.ts +0 -36
- package/src/components/icons/index.d.ts.map +0 -1
- package/src/components/icons/svg-icons/ArrowLeftIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/ArrowRightIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/ArrowRightIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/AudioIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/AudioIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/BackwardIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/BackwardIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/CameraIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/CameraIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/CheckIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/CheckIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/EnablePiPIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/EnablePiPIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/ForwardIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/ForwardIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/FullscreenEnterIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/FullscreenExitIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/LoadingIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/LoadingIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/PauseIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/PauseIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/PlayIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/PlayIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/QualityIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/QualityIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/SettingsIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/SettingsIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/SliderIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/SliderIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/SubtitleIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/SubtitleIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/SubtitleOffIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/UnPiPIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/UnPiPIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/VolumeMutedIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/VolumeOneIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/VolumeOneIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/VolumeThreeIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +0 -1
- package/src/components/icons/svg-icons/VolumeTwoIcon.d.ts +0 -4
- package/src/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +0 -1
- package/src/components/legacy.d.ts +0 -13
- package/src/components/legacy.d.ts.map +0 -1
- package/src/components/media-metadata-display.d.ts +0 -11
- package/src/components/media-metadata-display.d.ts.map +0 -1
- package/src/components/media-player-audio.d.ts +0 -9
- package/src/components/media-player-audio.d.ts.map +0 -1
- package/src/components/media-player-controls.d.ts +0 -23
- package/src/components/media-player-controls.d.ts.map +0 -1
- package/src/components/media-player-error.d.ts +0 -16
- package/src/components/media-player-error.d.ts.map +0 -1
- package/src/components/media-player-fullscreen.d.ts +0 -12
- package/src/components/media-player-fullscreen.d.ts.map +0 -1
- package/src/components/media-player-hls.d.ts +0 -23
- package/src/components/media-player-hls.d.ts.map +0 -1
- package/src/components/media-player-loading.d.ts +0 -12
- package/src/components/media-player-loading.d.ts.map +0 -1
- package/src/components/media-player-play.d.ts +0 -11
- package/src/components/media-player-play.d.ts.map +0 -1
- package/src/components/media-player-root.d.ts +0 -28
- package/src/components/media-player-root.d.ts.map +0 -1
- package/src/components/media-player-seek.d.ts +0 -15
- package/src/components/media-player-seek.d.ts.map +0 -1
- package/src/components/media-player-time.d.ts +0 -12
- package/src/components/media-player-time.d.ts.map +0 -1
- package/src/components/media-player-tooltip.d.ts +0 -13
- package/src/components/media-player-tooltip.d.ts.map +0 -1
- package/src/components/media-player-video.d.ts +0 -9
- package/src/components/media-player-video.d.ts.map +0 -1
- package/src/components/media-player-volume.d.ts +0 -13
- package/src/components/media-player-volume.d.ts.map +0 -1
- package/src/components/media-player.d.ts +0 -3
- package/src/components/media-player.d.ts.map +0 -1
- package/src/components/media-suspense.d.ts +0 -78
- package/src/components/media-suspense.d.ts.map +0 -1
- package/src/components/player-settings-form.d.ts +0 -8
- package/src/components/player-settings-form.d.ts.map +0 -1
- package/src/components/react-player-wrapper.d.ts +0 -64
- package/src/components/react-player-wrapper.d.ts.map +0 -1
- package/src/components/simple-video-player.d.ts +0 -9
- package/src/components/simple-video-player.d.ts.map +0 -1
- package/src/components/ui/button.tsx +0 -49
- package/src/components/ui/dropdown-menu.tsx +0 -137
- package/src/components/ui/enhanced-seek-bar.d.ts +0 -3
- package/src/components/ui/enhanced-seek-bar.d.ts.map +0 -1
- package/src/components/ui/fullscreen-button.d.ts +0 -3
- package/src/components/ui/fullscreen-button.d.ts.map +0 -1
- package/src/components/ui/icons.tsx +0 -174
- package/src/components/ui/media-resource-preloader.d.ts +0 -21
- package/src/components/ui/media-resource-preloader.d.ts.map +0 -1
- package/src/components/ui/play-button.d.ts +0 -3
- package/src/components/ui/play-button.d.ts.map +0 -1
- package/src/components/ui/seek-bar.d.ts +0 -3
- package/src/components/ui/seek-bar.d.ts.map +0 -1
- package/src/components/ui/slider.tsx +0 -55
- package/src/components/ui/time-display.d.ts +0 -3
- package/src/components/ui/time-display.d.ts.map +0 -1
- package/src/components/ui/tooltip.tsx +0 -131
- package/src/components/ui/volume-control.d.ts +0 -3
- package/src/components/ui/volume-control.d.ts.map +0 -1
- package/src/components/unified/base-media-player.d.ts +0 -18
- package/src/components/unified/base-media-player.d.ts.map +0 -1
- package/src/components/unified/media-player.d.ts +0 -37
- package/src/components/unified/media-player.d.ts.map +0 -1
- package/src/components/variants/minimal/AccessibleMinimalPlayer.d.ts +0 -42
- package/src/components/variants/minimal/AccessibleMinimalPlayer.d.ts.map +0 -1
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.d.ts +0 -44
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalControls.d.ts +0 -19
- package/src/components/variants/minimal/MinimalControls.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalLoading.d.ts +0 -10
- package/src/components/variants/minimal/MinimalLoading.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalMediaPlayer.d.ts +0 -38
- package/src/components/variants/minimal/MinimalMediaPlayer.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalOverlay.d.ts +0 -11
- package/src/components/variants/minimal/MinimalOverlay.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalPlayButton.d.ts +0 -9
- package/src/components/variants/minimal/MinimalPlayButton.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalSeekBar.d.ts +0 -7
- package/src/components/variants/minimal/MinimalSeekBar.d.ts.map +0 -1
- package/src/components/variants/minimal/MinimalVolumeControl.d.ts +0 -7
- package/src/components/variants/minimal/MinimalVolumeControl.d.ts.map +0 -1
- package/src/components/variants/minimal/SimpleMinimalPlayer.d.ts +0 -22
- package/src/components/variants/minimal/SimpleMinimalPlayer.d.ts.map +0 -1
- package/src/components/variants/minimal/components/CenterPlayButton.d.ts +0 -7
- package/src/components/variants/minimal/components/CenterPlayButton.d.ts.map +0 -1
- package/src/components/variants/minimal/components/ControlBar.d.ts +0 -43
- package/src/components/variants/minimal/components/ControlBar.d.ts.map +0 -1
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.d.ts +0 -24
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.d.ts.map +0 -1
- package/src/components/variants/minimal/components/PlaybackControls.d.ts +0 -9
- package/src/components/variants/minimal/components/PlaybackControls.d.ts.map +0 -1
- package/src/components/variants/minimal/components/RightControls.d.ts +0 -25
- package/src/components/variants/minimal/components/RightControls.d.ts.map +0 -1
- package/src/components/variants/minimal/components/SeekBar.d.ts +0 -11
- package/src/components/variants/minimal/components/SeekBar.d.ts.map +0 -1
- package/src/components/variants/minimal/components/SettingsDropdown.d.ts +0 -9
- package/src/components/variants/minimal/components/SettingsDropdown.d.ts.map +0 -1
- package/src/components/variants/minimal/components/SubtitleDisplay.d.ts +0 -7
- package/src/components/variants/minimal/components/SubtitleDisplay.d.ts.map +0 -1
- package/src/components/variants/minimal/components/TimeDisplay.d.ts +0 -7
- package/src/components/variants/minimal/components/TimeDisplay.d.ts.map +0 -1
- package/src/components/variants/minimal/components/VideoElement.d.ts +0 -13
- package/src/components/variants/minimal/components/VideoElement.d.ts.map +0 -1
- package/src/components/variants/minimal/components/VolumeControl.d.ts +0 -13
- package/src/components/variants/minimal/components/VolumeControl.d.ts.map +0 -1
- package/src/components/variants/minimal/index.d.ts +0 -17
- package/src/components/variants/minimal/index.d.ts.map +0 -1
- package/src/components/video-player.d.ts +0 -3
- package/src/components/video-player.d.ts.map +0 -1
- package/src/context/error-handling.d.ts +0 -72
- package/src/context/error-handling.d.ts.map +0 -1
- package/src/context/media-context.d.ts +0 -104
- package/src/context/media-context.d.ts.map +0 -1
- package/src/context/media-provider.d.ts +0 -26
- package/src/context/media-provider.d.ts.map +0 -1
- package/src/context/media-store.d.ts +0 -33
- package/src/context/media-store.d.ts.map +0 -1
- package/src/context/persistence.d.ts +0 -83
- package/src/context/persistence.d.ts.map +0 -1
- package/src/core/events/event-system.d.ts +0 -170
- package/src/core/events/event-system.d.ts.map +0 -1
- package/src/core/events/hooks.d.ts +0 -33
- package/src/core/events/hooks.d.ts.map +0 -1
- package/src/core/events/index.d.ts +0 -6
- package/src/core/events/index.d.ts.map +0 -1
- package/src/core/events/middleware.d.ts +0 -39
- package/src/core/events/middleware.d.ts.map +0 -1
- package/src/core/index.d.ts +0 -8
- package/src/core/index.d.ts.map +0 -1
- package/src/core/optimization/bundle-optimizer.d.ts +0 -44
- package/src/core/optimization/bundle-optimizer.d.ts.map +0 -1
- package/src/core/performance/cicd.d.ts +0 -8
- package/src/core/performance/cicd.d.ts.map +0 -1
- package/src/core/performance/index.d.ts +0 -10
- package/src/core/performance/index.d.ts.map +0 -1
- package/src/core/performance/media-loading-optimizer.d.ts +0 -105
- package/src/core/performance/media-loading-optimizer.d.ts.map +0 -1
- package/src/core/performance/performance-budgets.d.ts +0 -68
- package/src/core/performance/performance-budgets.d.ts.map +0 -1
- package/src/core/performance/performance-monitor.d.ts +0 -95
- package/src/core/performance/performance-monitor.d.ts.map +0 -1
- package/src/core/performance/performance-testing.d.ts +0 -69
- package/src/core/performance/performance-testing.d.ts.map +0 -1
- package/src/core/plugins/base-plugin.d.ts +0 -52
- package/src/core/plugins/base-plugin.d.ts.map +0 -1
- package/src/core/plugins/enhanced-plugin-system.d.ts +0 -160
- package/src/core/plugins/enhanced-plugin-system.d.ts.map +0 -1
- package/src/core/plugins/examples/analytics-plugin.d.ts +0 -30
- package/src/core/plugins/examples/analytics-plugin.d.ts.map +0 -1
- package/src/core/plugins/index.d.ts +0 -8
- package/src/core/plugins/index.d.ts.map +0 -1
- package/src/core/plugins/registry.d.ts +0 -31
- package/src/core/plugins/registry.d.ts.map +0 -1
- package/src/core/plugins/types.d.ts +0 -101
- package/src/core/plugins/types.d.ts.map +0 -1
- package/src/core/plugins/utils.d.ts +0 -38
- package/src/core/plugins/utils.d.ts.map +0 -1
- package/src/core/progressive-loading.d.ts +0 -88
- package/src/core/progressive-loading.d.ts.map +0 -1
- package/src/core/providers/enhanced-hls-provider.d.ts +0 -50
- package/src/core/providers/enhanced-hls-provider.d.ts.map +0 -1
- package/src/core/providers/service-provider.d.ts +0 -49
- package/src/core/providers/service-provider.d.ts.map +0 -1
- package/src/core/utils.d.ts +0 -25
- package/src/core/utils.d.ts.map +0 -1
- package/src/features/media-session/media-session-manager.d.ts +0 -132
- package/src/features/media-session/media-session-manager.d.ts.map +0 -1
- package/src/features/picture-in-picture/pip-manager.d.ts +0 -94
- package/src/features/picture-in-picture/pip-manager.d.ts.map +0 -1
- package/src/features/playlist/playlist-manager.d.ts +0 -208
- package/src/features/playlist/playlist-manager.d.ts.map +0 -1
- package/src/features/subtitles/subtitle-manager.d.ts +0 -136
- package/src/features/subtitles/subtitle-manager.d.ts.map +0 -1
- package/src/features/subtitles/subtitle-parser.d.ts +0 -60
- package/src/features/subtitles/subtitle-parser.d.ts.map +0 -1
- package/src/features/thumbnails/thumbnail-generator.d.ts +0 -136
- package/src/features/thumbnails/thumbnail-generator.d.ts.map +0 -1
- package/src/hooks/accessibility/index.d.ts +0 -5
- package/src/hooks/accessibility/index.d.ts.map +0 -1
- package/src/hooks/accessibility/use-accessibility-preferences.d.ts +0 -14
- package/src/hooks/accessibility/use-accessibility-preferences.d.ts.map +0 -1
- package/src/hooks/accessibility/use-focus-management.d.ts +0 -31
- package/src/hooks/accessibility/use-focus-management.d.ts.map +0 -1
- package/src/hooks/accessibility/use-keyboard-shortcuts.d.ts +0 -38
- package/src/hooks/accessibility/use-keyboard-shortcuts.d.ts.map +0 -1
- package/src/hooks/accessibility/use-screen-reader.d.ts +0 -22
- package/src/hooks/accessibility/use-screen-reader.d.ts.map +0 -1
- package/src/hooks/core/index.d.ts +0 -18
- package/src/hooks/core/index.d.ts.map +0 -1
- package/src/hooks/legacy.d.ts +0 -18
- package/src/hooks/legacy.d.ts.map +0 -1
- package/src/hooks/use-enhanced-media-player.d.ts +0 -88
- package/src/hooks/use-enhanced-media-player.d.ts.map +0 -1
- package/src/hooks/use-intelligent-preloading.d.ts +0 -66
- package/src/hooks/use-intelligent-preloading.d.ts.map +0 -1
- package/src/hooks/use-keyboard-controls.d.ts +0 -13
- package/src/hooks/use-keyboard-controls.d.ts.map +0 -1
- package/src/hooks/use-media-actions.d.ts +0 -62
- package/src/hooks/use-media-actions.d.ts.map +0 -1
- package/src/hooks/use-media-metadata.d.ts +0 -11
- package/src/hooks/use-media-metadata.d.ts.map +0 -1
- package/src/hooks/use-media-optimistic.d.ts +0 -36
- package/src/hooks/use-media-optimistic.d.ts.map +0 -1
- package/src/hooks/use-media-player.d.ts +0 -31
- package/src/hooks/use-media-player.d.ts.map +0 -1
- package/src/hooks/use-media-state.d.ts +0 -17
- package/src/hooks/use-media-state.d.ts.map +0 -1
- package/src/hooks/use-memory-optimization.d.ts +0 -40
- package/src/hooks/use-memory-optimization.d.ts.map +0 -1
- package/src/hooks/use-mobile.ts +0 -125
- package/src/hooks/use-optimistic-controls.d.ts +0 -22
- package/src/hooks/use-optimistic-controls.d.ts.map +0 -1
- package/src/hooks/use-optimized-media.d.ts +0 -46
- package/src/hooks/use-optimized-media.d.ts.map +0 -1
- package/src/hooks/use-touch-gestures.d.ts +0 -47
- package/src/hooks/use-touch-gestures.d.ts.map +0 -1
- package/src/hooks/useEnhancedSubtitles.d.ts +0 -39
- package/src/hooks/useEnhancedSubtitles.d.ts.map +0 -1
- package/src/hooks/useKeyboardShortcuts.d.ts +0 -10
- package/src/hooks/useKeyboardShortcuts.d.ts.map +0 -1
- package/src/hooks/useMediaControls.d.ts +0 -9
- package/src/hooks/useMediaControls.d.ts.map +0 -1
- package/src/hooks/useScreenshot.d.ts +0 -4
- package/src/hooks/useScreenshot.d.ts.map +0 -1
- package/src/hooks/useSubtitles.d.ts +0 -8
- package/src/hooks/useSubtitles.d.ts.map +0 -1
- package/src/hooks/useVideoPlayer.d.ts +0 -32
- package/src/hooks/useVideoPlayer.d.ts.map +0 -1
- package/src/icons/components/FullscreenIcon.d.ts +0 -3
- package/src/icons/components/FullscreenIcon.d.ts.map +0 -1
- package/src/icons/components/SettingsIcon.d.ts +0 -3
- package/src/icons/components/SettingsIcon.d.ts.map +0 -1
- package/src/icons/components/animated/LoadingIcon.d.ts +0 -3
- package/src/icons/components/animated/LoadingIcon.d.ts.map +0 -1
- package/src/icons/components/animated/PlayPauseIcon.d.ts +0 -7
- package/src/icons/components/animated/PlayPauseIcon.d.ts.map +0 -1
- package/src/icons/components/media/PauseIcon.d.ts +0 -3
- package/src/icons/components/media/PauseIcon.d.ts.map +0 -1
- package/src/icons/components/media/PlayIcon.d.ts +0 -3
- package/src/icons/components/media/PlayIcon.d.ts.map +0 -1
- package/src/icons/components/volume/VolumeIcon.d.ts +0 -3
- package/src/icons/components/volume/VolumeIcon.d.ts.map +0 -1
- package/src/icons/components/volume/VolumeOffIcon.d.ts +0 -3
- package/src/icons/components/volume/VolumeOffIcon.d.ts.map +0 -1
- package/src/icons/index.d.ts +0 -28
- package/src/icons/index.d.ts.map +0 -1
- package/src/icons/provider.d.ts +0 -13
- package/src/icons/provider.d.ts.map +0 -1
- package/src/icons/types.d.ts +0 -18
- package/src/icons/types.d.ts.map +0 -1
- package/src/index-enhanced.d.ts +0 -13
- package/src/index-enhanced.d.ts.map +0 -1
- package/src/index-legacy.d.ts +0 -81
- package/src/index-legacy.d.ts.map +0 -1
- package/src/index.d.ts +0 -38
- package/src/index.d.ts.map +0 -1
- package/src/index.minimal.d.ts +0 -2
- package/src/index.minimal.d.ts.map +0 -1
- package/src/index.minimal.ts +0 -4
- package/src/lib/deprecation.d.ts +0 -7
- package/src/lib/deprecation.d.ts.map +0 -1
- package/src/lib/format-time.d.ts +0 -9
- package/src/lib/format-time.d.ts.map +0 -1
- package/src/lib/index.d.ts +0 -3
- package/src/lib/index.d.ts.map +0 -1
- package/src/lib/utils.d.ts +0 -3
- package/src/lib/utils.d.ts.map +0 -1
- package/src/test/setup.d.ts +0 -2
- package/src/test/setup.d.ts.map +0 -1
- package/src/types/events.d.ts +0 -41
- package/src/types/events.d.ts.map +0 -1
- package/src/types/formats.d.ts +0 -45
- package/src/types/formats.d.ts.map +0 -1
- package/src/types/index.d.ts +0 -128
- package/src/types/index.d.ts.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import React from "react"
|
|
4
|
-
import type {
|
|
4
|
+
import type { MediaAction, MediaActionType, MediaState } from "./media-context"
|
|
5
5
|
import { MediaActionTypes, initialMediaState } from "./media-context"
|
|
6
6
|
|
|
7
7
|
// Enhanced action types for React 19 features
|
|
@@ -34,7 +34,7 @@ export interface EnhancedMediaStore {
|
|
|
34
34
|
getState: () => MediaState
|
|
35
35
|
setState: (updates: Partial<MediaState>) => void
|
|
36
36
|
dispatch: (action: MediaAction) => void
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
// React 19 enhancements
|
|
39
39
|
getOptimisticState: () => MediaState
|
|
40
40
|
dispatchOptimistic: (action: OptimisticMediaAction) => Promise<void>
|
|
@@ -71,7 +71,7 @@ export function createEnhancedMediaStore(
|
|
|
71
71
|
const listeners = new Set<() => void>()
|
|
72
72
|
const optimisticQueue = new Map<string, OptimisticMediaAction>()
|
|
73
73
|
let persistenceTimeout: NodeJS.Timeout | null = null
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
const subscribe = (callback: () => void) => {
|
|
76
76
|
listeners.add(callback)
|
|
77
77
|
return () => listeners.delete(callback)
|
|
@@ -89,20 +89,26 @@ export function createEnhancedMediaStore(
|
|
|
89
89
|
|
|
90
90
|
// Persistence helpers
|
|
91
91
|
const persistState = async () => {
|
|
92
|
-
if (!config.enabled || typeof window ===
|
|
93
|
-
|
|
94
|
-
const persistedData = config.persist.reduce(
|
|
95
|
-
(acc
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
if (!config.enabled || typeof window === "undefined") return
|
|
93
|
+
|
|
94
|
+
const persistedData = config.persist.reduce(
|
|
95
|
+
(acc, key) => {
|
|
96
|
+
;(acc as any)[key] = state[key]
|
|
97
|
+
return acc
|
|
98
|
+
},
|
|
99
|
+
{} as Partial<MediaState>
|
|
100
|
+
)
|
|
98
101
|
|
|
99
102
|
try {
|
|
100
|
-
localStorage.setItem(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
localStorage.setItem(
|
|
104
|
+
config.key,
|
|
105
|
+
JSON.stringify({
|
|
106
|
+
...persistedData,
|
|
107
|
+
timestamp: Date.now()
|
|
108
|
+
})
|
|
109
|
+
)
|
|
104
110
|
} catch (error) {
|
|
105
|
-
console.warn(
|
|
111
|
+
console.warn("Failed to persist media state:", error)
|
|
106
112
|
}
|
|
107
113
|
}
|
|
108
114
|
|
|
@@ -114,7 +120,7 @@ export function createEnhancedMediaStore(
|
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
const rehydrateFromStorage = async () => {
|
|
117
|
-
if (!config.enabled || typeof window ===
|
|
123
|
+
if (!config.enabled || typeof window === "undefined") return
|
|
118
124
|
|
|
119
125
|
try {
|
|
120
126
|
const stored = localStorage.getItem(config.key)
|
|
@@ -138,16 +144,16 @@ export function createEnhancedMediaStore(
|
|
|
138
144
|
notifyListeners()
|
|
139
145
|
}
|
|
140
146
|
} catch (error) {
|
|
141
|
-
console.warn(
|
|
147
|
+
console.warn("Failed to rehydrate media state:", error)
|
|
142
148
|
}
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
const clearPersistedState = () => {
|
|
146
|
-
if (typeof window ===
|
|
152
|
+
if (typeof window === "undefined") return
|
|
147
153
|
try {
|
|
148
154
|
localStorage.removeItem(config.key)
|
|
149
155
|
} catch (error) {
|
|
150
|
-
console.warn(
|
|
156
|
+
console.warn("Failed to clear persisted state:", error)
|
|
151
157
|
}
|
|
152
158
|
}
|
|
153
159
|
|
|
@@ -160,7 +166,7 @@ export function createEnhancedMediaStore(
|
|
|
160
166
|
if (JSON.stringify(newState) !== JSON.stringify(state)) {
|
|
161
167
|
state = newState
|
|
162
168
|
optimisticState = { ...newState }
|
|
163
|
-
|
|
169
|
+
|
|
164
170
|
// Persist relevant changes
|
|
165
171
|
debouncedPersist()
|
|
166
172
|
notifyListeners()
|
|
@@ -169,14 +175,14 @@ export function createEnhancedMediaStore(
|
|
|
169
175
|
|
|
170
176
|
const applyOptimisticUpdate = (action: OptimisticMediaAction) => {
|
|
171
177
|
const actionId = `${action.type}-${Date.now()}-${Math.random()}`
|
|
172
|
-
|
|
178
|
+
|
|
173
179
|
// Store original action for rollback
|
|
174
180
|
optimisticQueue.set(actionId, { ...action, timestamp: Date.now() })
|
|
175
181
|
|
|
176
182
|
// Apply optimistic update to optimistic state
|
|
177
183
|
const optimisticUpdate = processMediaAction(optimisticState, action)
|
|
178
184
|
optimisticState = { ...optimisticState, ...optimisticUpdate }
|
|
179
|
-
|
|
185
|
+
|
|
180
186
|
notifyListeners()
|
|
181
187
|
return actionId
|
|
182
188
|
}
|
|
@@ -186,86 +192,89 @@ export function createEnhancedMediaStore(
|
|
|
186
192
|
|
|
187
193
|
// Remove from queue and recalculate optimistic state
|
|
188
194
|
optimisticQueue.delete(actionId)
|
|
189
|
-
|
|
195
|
+
|
|
190
196
|
// Rebuild optimistic state from actual state + remaining optimistic actions
|
|
191
197
|
optimisticState = { ...state }
|
|
192
198
|
for (const [, action] of optimisticQueue) {
|
|
193
199
|
const update = processMediaAction(optimisticState, action)
|
|
194
200
|
optimisticState = { ...optimisticState, ...update }
|
|
195
201
|
}
|
|
196
|
-
|
|
202
|
+
|
|
197
203
|
notifyListeners()
|
|
198
204
|
}
|
|
199
205
|
|
|
200
206
|
// Process media action and return state updates
|
|
201
|
-
const processMediaAction = (
|
|
207
|
+
const processMediaAction = (
|
|
208
|
+
currentState: MediaState,
|
|
209
|
+
action: MediaAction
|
|
210
|
+
): Partial<MediaState> => {
|
|
202
211
|
switch (action.type) {
|
|
203
212
|
case MediaActionTypes.PLAY:
|
|
204
213
|
return { isPlaying: true, error: null }
|
|
205
|
-
|
|
214
|
+
|
|
206
215
|
case MediaActionTypes.PAUSE:
|
|
207
216
|
return { isPlaying: false }
|
|
208
|
-
|
|
217
|
+
|
|
209
218
|
case MediaActionTypes.SEEK:
|
|
210
219
|
return { currentTime: action.detail }
|
|
211
|
-
|
|
220
|
+
|
|
212
221
|
case MediaActionTypes.SET_VOLUME:
|
|
213
222
|
return { volume: Math.max(0, Math.min(1, action.detail)) }
|
|
214
|
-
|
|
223
|
+
|
|
215
224
|
case MediaActionTypes.MUTE:
|
|
216
225
|
return { isMuted: true }
|
|
217
|
-
|
|
226
|
+
|
|
218
227
|
case MediaActionTypes.UNMUTE:
|
|
219
228
|
return { isMuted: false }
|
|
220
|
-
|
|
229
|
+
|
|
221
230
|
case MediaActionTypes.TOGGLE_MUTE:
|
|
222
231
|
return { isMuted: !currentState.isMuted }
|
|
223
|
-
|
|
232
|
+
|
|
224
233
|
case MediaActionTypes.SET_DURATION:
|
|
225
234
|
return { duration: action.detail }
|
|
226
|
-
|
|
235
|
+
|
|
227
236
|
case MediaActionTypes.SET_CURRENT_TIME:
|
|
228
237
|
return { currentTime: action.detail }
|
|
229
|
-
|
|
238
|
+
|
|
230
239
|
case MediaActionTypes.SET_BUFFERED:
|
|
231
240
|
return { buffered: action.detail }
|
|
232
|
-
|
|
241
|
+
|
|
233
242
|
case MediaActionTypes.SET_LOADING:
|
|
234
243
|
return { isLoading: action.detail }
|
|
235
|
-
|
|
244
|
+
|
|
236
245
|
case MediaActionTypes.SET_ERROR:
|
|
237
246
|
return { error: action.detail, isLoading: false }
|
|
238
|
-
|
|
247
|
+
|
|
239
248
|
case MediaActionTypes.ENTER_FULLSCREEN:
|
|
240
249
|
return { isFullscreen: true }
|
|
241
|
-
|
|
250
|
+
|
|
242
251
|
case MediaActionTypes.EXIT_FULLSCREEN:
|
|
243
252
|
return { isFullscreen: false }
|
|
244
|
-
|
|
253
|
+
|
|
245
254
|
case MediaActionTypes.ENTER_PIP:
|
|
246
255
|
return { isPictureInPicture: true }
|
|
247
|
-
|
|
256
|
+
|
|
248
257
|
case MediaActionTypes.EXIT_PIP:
|
|
249
258
|
return { isPictureInPicture: false }
|
|
250
|
-
|
|
259
|
+
|
|
251
260
|
case MediaActionTypes.SET_PLAYBACK_RATE:
|
|
252
261
|
return { playbackRate: action.detail }
|
|
253
|
-
|
|
262
|
+
|
|
254
263
|
case MediaActionTypes.SET_SUBTITLE_TRACK:
|
|
255
264
|
return { selectedSubtitleTrack: action.detail }
|
|
256
|
-
|
|
265
|
+
|
|
257
266
|
case MediaActionTypes.SET_RENDITION:
|
|
258
267
|
return { selectedRendition: action.detail }
|
|
259
|
-
|
|
268
|
+
|
|
260
269
|
case MediaActionTypes.TOGGLE_SUBTITLES:
|
|
261
270
|
return { subtitlesShowing: !currentState.subtitlesShowing }
|
|
262
|
-
|
|
271
|
+
|
|
263
272
|
case MediaActionTypes.PREVIEW_TIME:
|
|
264
273
|
return { previewTime: action.detail }
|
|
265
|
-
|
|
274
|
+
|
|
266
275
|
case MediaActionTypes.CLEAR_PREVIEW:
|
|
267
276
|
return { previewTime: null, previewImage: null, previewCoords: null }
|
|
268
|
-
|
|
277
|
+
|
|
269
278
|
default:
|
|
270
279
|
console.warn(`Unknown media action type: ${action.type}`)
|
|
271
280
|
return {}
|
|
@@ -285,26 +294,26 @@ export function createEnhancedMediaStore(
|
|
|
285
294
|
lastAction: action,
|
|
286
295
|
retryCount: action.retryCount || 0
|
|
287
296
|
}
|
|
288
|
-
|
|
297
|
+
|
|
289
298
|
// Apply optimistic update immediately
|
|
290
299
|
const actionId = applyOptimisticUpdate(action)
|
|
291
|
-
|
|
300
|
+
|
|
292
301
|
try {
|
|
293
302
|
// Simulate async operation (e.g., network request, DOM manipulation)
|
|
294
|
-
await new Promise(resolve => setTimeout(resolve, 0))
|
|
295
|
-
|
|
303
|
+
await new Promise((resolve) => setTimeout(resolve, 0))
|
|
304
|
+
|
|
296
305
|
// Apply the actual update to the real state
|
|
297
306
|
const updates = processMediaAction(state, action)
|
|
298
307
|
const newState = { ...state, ...updates }
|
|
299
|
-
|
|
308
|
+
|
|
300
309
|
if (JSON.stringify(newState) !== JSON.stringify(state)) {
|
|
301
310
|
state = newState
|
|
302
311
|
debouncedPersist()
|
|
303
312
|
}
|
|
304
|
-
|
|
313
|
+
|
|
305
314
|
// Clean up optimistic action
|
|
306
315
|
optimisticQueue.delete(actionId)
|
|
307
|
-
|
|
316
|
+
|
|
308
317
|
// Update action state
|
|
309
318
|
actionState = {
|
|
310
319
|
pending: false,
|
|
@@ -312,26 +321,25 @@ export function createEnhancedMediaStore(
|
|
|
312
321
|
lastAction: action,
|
|
313
322
|
retryCount: 0
|
|
314
323
|
}
|
|
315
|
-
|
|
324
|
+
|
|
316
325
|
// Sync optimistic state with actual state
|
|
317
326
|
optimisticState = { ...state }
|
|
318
327
|
for (const [, queuedAction] of optimisticQueue) {
|
|
319
328
|
const update = processMediaAction(optimisticState, queuedAction)
|
|
320
329
|
optimisticState = { ...optimisticState, ...update }
|
|
321
330
|
}
|
|
322
|
-
|
|
323
331
|
} catch (error) {
|
|
324
332
|
// Rollback optimistic update on error
|
|
325
333
|
rollbackOptimistic(actionId)
|
|
326
|
-
|
|
327
|
-
const errorMessage = error instanceof Error ? error.message :
|
|
334
|
+
|
|
335
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"
|
|
328
336
|
actionState = {
|
|
329
337
|
pending: false,
|
|
330
338
|
error: errorMessage,
|
|
331
339
|
lastAction: action,
|
|
332
340
|
retryCount: (action.retryCount || 0) + 1
|
|
333
341
|
}
|
|
334
|
-
|
|
342
|
+
|
|
335
343
|
// Auto-retry logic for certain actions
|
|
336
344
|
if (actionState.retryCount < 3 && shouldRetry(action.type)) {
|
|
337
345
|
setTimeout(() => {
|
|
@@ -342,7 +350,7 @@ export function createEnhancedMediaStore(
|
|
|
342
350
|
}, Math.pow(2, actionState.retryCount) * 1000) // Exponential backoff
|
|
343
351
|
}
|
|
344
352
|
}
|
|
345
|
-
|
|
353
|
+
|
|
346
354
|
notifyListeners()
|
|
347
355
|
}
|
|
348
356
|
|
|
@@ -376,4 +384,4 @@ export function createEnhancedMediaStore(
|
|
|
376
384
|
rehydrateFromStorage,
|
|
377
385
|
clearPersistedState
|
|
378
386
|
}
|
|
379
|
-
}
|
|
387
|
+
}
|
|
@@ -47,14 +47,14 @@ export interface PersistenceConfig {
|
|
|
47
47
|
userPreferences: boolean
|
|
48
48
|
sessionState: boolean
|
|
49
49
|
playbackHistory: boolean
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
// Limits
|
|
52
52
|
maxHistoryItems: number
|
|
53
53
|
maxCacheAge: number // milliseconds
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
// Debouncing
|
|
56
56
|
debounceMs: number
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
// Custom storage adapter
|
|
59
59
|
storage?: StorageAdapter
|
|
60
60
|
}
|
|
@@ -70,42 +70,42 @@ export interface StorageAdapter {
|
|
|
70
70
|
// Default localStorage adapter
|
|
71
71
|
class LocalStorageAdapter implements StorageAdapter {
|
|
72
72
|
async getItem(key: string): Promise<string | null> {
|
|
73
|
-
if (typeof window ===
|
|
73
|
+
if (typeof window === "undefined") return null
|
|
74
74
|
try {
|
|
75
75
|
return localStorage.getItem(key)
|
|
76
76
|
} catch (error) {
|
|
77
|
-
console.warn(
|
|
77
|
+
console.warn("Failed to read from localStorage:", error)
|
|
78
78
|
return null
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
async setItem(key: string, value: string): Promise<void> {
|
|
83
|
-
if (typeof window ===
|
|
83
|
+
if (typeof window === "undefined") return
|
|
84
84
|
try {
|
|
85
85
|
localStorage.setItem(key, value)
|
|
86
86
|
} catch (error) {
|
|
87
|
-
console.warn(
|
|
87
|
+
console.warn("Failed to write to localStorage:", error)
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
async removeItem(key: string): Promise<void> {
|
|
92
|
-
if (typeof window ===
|
|
92
|
+
if (typeof window === "undefined") return
|
|
93
93
|
try {
|
|
94
94
|
localStorage.removeItem(key)
|
|
95
95
|
} catch (error) {
|
|
96
|
-
console.warn(
|
|
96
|
+
console.warn("Failed to remove from localStorage:", error)
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
async clear(): Promise<void> {
|
|
101
|
-
if (typeof window ===
|
|
101
|
+
if (typeof window === "undefined") return
|
|
102
102
|
try {
|
|
103
103
|
// Only clear baroi-player keys
|
|
104
|
-
Object.values(STORAGE_KEYS).forEach(key => {
|
|
104
|
+
Object.values(STORAGE_KEYS).forEach((key) => {
|
|
105
105
|
localStorage.removeItem(key)
|
|
106
106
|
})
|
|
107
107
|
} catch (error) {
|
|
108
|
-
console.warn(
|
|
108
|
+
console.warn("Failed to clear localStorage:", error)
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -141,7 +141,7 @@ export class MediaPersistenceManager {
|
|
|
141
141
|
if (!data) return null
|
|
142
142
|
|
|
143
143
|
const parsed = JSON.parse(data) as { preferences: UserPreferences; timestamp: number }
|
|
144
|
-
|
|
144
|
+
|
|
145
145
|
// Validate cache age
|
|
146
146
|
if (this.isCacheExpired(parsed.timestamp)) {
|
|
147
147
|
await this.clearUserPreferences()
|
|
@@ -150,7 +150,7 @@ export class MediaPersistenceManager {
|
|
|
150
150
|
|
|
151
151
|
return parsed.preferences
|
|
152
152
|
} catch (error) {
|
|
153
|
-
console.warn(
|
|
153
|
+
console.warn("Failed to get user preferences:", error)
|
|
154
154
|
return null
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -160,15 +160,18 @@ export class MediaPersistenceManager {
|
|
|
160
160
|
|
|
161
161
|
this.debounce(STORAGE_KEYS.USER_PREFERENCES, async () => {
|
|
162
162
|
try {
|
|
163
|
-
const existing = await this.getUserPreferences() || {}
|
|
163
|
+
const existing = (await this.getUserPreferences()) || {}
|
|
164
164
|
const updated = { ...existing, ...preferences }
|
|
165
|
-
|
|
166
|
-
await this.storage.setItem(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
|
|
166
|
+
await this.storage.setItem(
|
|
167
|
+
STORAGE_KEYS.USER_PREFERENCES,
|
|
168
|
+
JSON.stringify({
|
|
169
|
+
preferences: updated,
|
|
170
|
+
timestamp: Date.now()
|
|
171
|
+
})
|
|
172
|
+
)
|
|
170
173
|
} catch (error) {
|
|
171
|
-
console.warn(
|
|
174
|
+
console.warn("Failed to save user preferences:", error)
|
|
172
175
|
}
|
|
173
176
|
})
|
|
174
177
|
}
|
|
@@ -177,7 +180,7 @@ export class MediaPersistenceManager {
|
|
|
177
180
|
try {
|
|
178
181
|
await this.storage.removeItem(STORAGE_KEYS.USER_PREFERENCES)
|
|
179
182
|
} catch (error) {
|
|
180
|
-
console.warn(
|
|
183
|
+
console.warn("Failed to clear user preferences:", error)
|
|
181
184
|
}
|
|
182
185
|
}
|
|
183
186
|
|
|
@@ -192,7 +195,7 @@ export class MediaPersistenceManager {
|
|
|
192
195
|
const parsed = JSON.parse(data) as { state: SessionState; timestamp: number }
|
|
193
196
|
return parsed.state
|
|
194
197
|
} catch (error) {
|
|
195
|
-
console.warn(
|
|
198
|
+
console.warn("Failed to get session state:", error)
|
|
196
199
|
return null
|
|
197
200
|
}
|
|
198
201
|
}
|
|
@@ -202,18 +205,21 @@ export class MediaPersistenceManager {
|
|
|
202
205
|
|
|
203
206
|
this.debounce(STORAGE_KEYS.SESSION_STATE, async () => {
|
|
204
207
|
try {
|
|
205
|
-
const existing = await this.getSessionState() || {
|
|
208
|
+
const existing = (await this.getSessionState()) || {
|
|
206
209
|
currentTime: 0,
|
|
207
210
|
playbackPosition: {}
|
|
208
211
|
}
|
|
209
212
|
const updated = { ...existing, ...state }
|
|
210
213
|
|
|
211
|
-
await this.storage.setItem(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
await this.storage.setItem(
|
|
215
|
+
STORAGE_KEYS.SESSION_STATE,
|
|
216
|
+
JSON.stringify({
|
|
217
|
+
state: updated,
|
|
218
|
+
timestamp: Date.now()
|
|
219
|
+
})
|
|
220
|
+
)
|
|
215
221
|
} catch (error) {
|
|
216
|
-
console.warn(
|
|
222
|
+
console.warn("Failed to save session state:", error)
|
|
217
223
|
}
|
|
218
224
|
})
|
|
219
225
|
}
|
|
@@ -222,7 +228,7 @@ export class MediaPersistenceManager {
|
|
|
222
228
|
try {
|
|
223
229
|
await this.storage.removeItem(STORAGE_KEYS.SESSION_STATE)
|
|
224
230
|
} catch (error) {
|
|
225
|
-
console.warn(
|
|
231
|
+
console.warn("Failed to clear session state:", error)
|
|
226
232
|
}
|
|
227
233
|
}
|
|
228
234
|
|
|
@@ -235,7 +241,7 @@ export class MediaPersistenceManager {
|
|
|
235
241
|
if (!data) return []
|
|
236
242
|
|
|
237
243
|
const parsed = JSON.parse(data) as { history: PlaybackHistoryItem[]; timestamp: number }
|
|
238
|
-
|
|
244
|
+
|
|
239
245
|
// Validate cache age
|
|
240
246
|
if (this.isCacheExpired(parsed.timestamp)) {
|
|
241
247
|
await this.clearPlaybackHistory()
|
|
@@ -244,12 +250,12 @@ export class MediaPersistenceManager {
|
|
|
244
250
|
|
|
245
251
|
return parsed.history || []
|
|
246
252
|
} catch (error) {
|
|
247
|
-
console.warn(
|
|
253
|
+
console.warn("Failed to get playback history:", error)
|
|
248
254
|
return []
|
|
249
255
|
}
|
|
250
256
|
}
|
|
251
257
|
|
|
252
|
-
async addToPlaybackHistory(item: Omit<PlaybackHistoryItem,
|
|
258
|
+
async addToPlaybackHistory(item: Omit<PlaybackHistoryItem, "timestamp">): Promise<void> {
|
|
253
259
|
if (!this.config.playbackHistory) return
|
|
254
260
|
|
|
255
261
|
try {
|
|
@@ -260,18 +266,20 @@ export class MediaPersistenceManager {
|
|
|
260
266
|
}
|
|
261
267
|
|
|
262
268
|
// Remove existing entry for the same media
|
|
263
|
-
const filteredHistory = history.filter(h => h.mediaId !== item.mediaId)
|
|
264
|
-
|
|
269
|
+
const filteredHistory = history.filter((h) => h.mediaId !== item.mediaId)
|
|
270
|
+
|
|
265
271
|
// Add new item at the beginning
|
|
266
|
-
const updatedHistory = [newItem, ...filteredHistory]
|
|
267
|
-
.slice(0, this.config.maxHistoryItems)
|
|
272
|
+
const updatedHistory = [newItem, ...filteredHistory].slice(0, this.config.maxHistoryItems)
|
|
268
273
|
|
|
269
|
-
await this.storage.setItem(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
await this.storage.setItem(
|
|
275
|
+
STORAGE_KEYS.PLAYBACK_HISTORY,
|
|
276
|
+
JSON.stringify({
|
|
277
|
+
history: updatedHistory,
|
|
278
|
+
timestamp: Date.now()
|
|
279
|
+
})
|
|
280
|
+
)
|
|
273
281
|
} catch (error) {
|
|
274
|
-
console.warn(
|
|
282
|
+
console.warn("Failed to add to playback history:", error)
|
|
275
283
|
}
|
|
276
284
|
}
|
|
277
285
|
|
|
@@ -279,7 +287,7 @@ export class MediaPersistenceManager {
|
|
|
279
287
|
try {
|
|
280
288
|
await this.storage.removeItem(STORAGE_KEYS.PLAYBACK_HISTORY)
|
|
281
289
|
} catch (error) {
|
|
282
|
-
console.warn(
|
|
290
|
+
console.warn("Failed to clear playback history:", error)
|
|
283
291
|
}
|
|
284
292
|
}
|
|
285
293
|
|
|
@@ -287,7 +295,7 @@ export class MediaPersistenceManager {
|
|
|
287
295
|
async savePlaybackPosition(mediaId: string, position: number): Promise<void> {
|
|
288
296
|
const session = await this.getSessionState()
|
|
289
297
|
const playbackPosition = session?.playbackPosition || {}
|
|
290
|
-
|
|
298
|
+
|
|
291
299
|
await this.saveSessionState({
|
|
292
300
|
playbackPosition: {
|
|
293
301
|
...playbackPosition,
|
|
@@ -354,14 +362,14 @@ export class MediaPersistenceManager {
|
|
|
354
362
|
// Hook for using persistence in components
|
|
355
363
|
export function useMediaPersistence(config?: Partial<PersistenceConfig>) {
|
|
356
364
|
const [manager] = React.useState(() => new MediaPersistenceManager(config))
|
|
357
|
-
|
|
365
|
+
|
|
358
366
|
React.useEffect(() => {
|
|
359
367
|
return () => {
|
|
360
368
|
// Clear any pending debounced operations
|
|
361
369
|
manager.clearAll()
|
|
362
370
|
}
|
|
363
371
|
}, [manager])
|
|
364
|
-
|
|
372
|
+
|
|
365
373
|
return manager
|
|
366
374
|
}
|
|
367
375
|
|
|
@@ -373,20 +381,20 @@ export function useAutoMediaPersistence(
|
|
|
373
381
|
) {
|
|
374
382
|
const manager = useMediaPersistence(config)
|
|
375
383
|
const [isRehydrated, setIsRehydrated] = React.useState(false)
|
|
376
|
-
|
|
384
|
+
|
|
377
385
|
// Rehydrate on mount
|
|
378
386
|
React.useEffect(() => {
|
|
379
387
|
let isMounted = true
|
|
380
|
-
|
|
388
|
+
|
|
381
389
|
const rehydrate = async () => {
|
|
382
390
|
try {
|
|
383
391
|
const [preferences, session] = await Promise.all([
|
|
384
392
|
manager.getUserPreferences(),
|
|
385
393
|
manager.getSessionState()
|
|
386
394
|
])
|
|
387
|
-
|
|
395
|
+
|
|
388
396
|
if (!isMounted) return
|
|
389
|
-
|
|
397
|
+
|
|
390
398
|
// Return the rehydrated state for the store to apply
|
|
391
399
|
const rehydratedState: Partial<MediaState> = {
|
|
392
400
|
...(preferences && {
|
|
@@ -395,51 +403,52 @@ export function useAutoMediaPersistence(
|
|
|
395
403
|
playbackRate: preferences.playbackRate,
|
|
396
404
|
subtitlesShowing: preferences.subtitlesShowing
|
|
397
405
|
}),
|
|
398
|
-
...(session &&
|
|
399
|
-
|
|
400
|
-
|
|
406
|
+
...(session &&
|
|
407
|
+
mediaId === session.mediaId && {
|
|
408
|
+
currentTime: session.currentTime
|
|
409
|
+
})
|
|
401
410
|
}
|
|
402
|
-
|
|
411
|
+
|
|
403
412
|
// Apply rehydrated state via callback if provided
|
|
404
413
|
if (Object.keys(rehydratedState).length > 0) {
|
|
405
414
|
// This would be handled by the store
|
|
406
|
-
console.log(
|
|
415
|
+
console.log("Rehydrated state:", rehydratedState)
|
|
407
416
|
}
|
|
408
|
-
|
|
417
|
+
|
|
409
418
|
setIsRehydrated(true)
|
|
410
419
|
} catch (error) {
|
|
411
|
-
console.warn(
|
|
420
|
+
console.warn("Failed to rehydrate state:", error)
|
|
412
421
|
setIsRehydrated(true)
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
|
-
|
|
424
|
+
|
|
416
425
|
rehydrate()
|
|
417
|
-
|
|
426
|
+
|
|
418
427
|
return () => {
|
|
419
428
|
isMounted = false
|
|
420
429
|
}
|
|
421
430
|
}, [manager, mediaId])
|
|
422
|
-
|
|
431
|
+
|
|
423
432
|
// Auto-persist changes
|
|
424
433
|
React.useEffect(() => {
|
|
425
434
|
if (!isRehydrated) return
|
|
426
|
-
|
|
435
|
+
|
|
427
436
|
// Save user preferences
|
|
428
437
|
const preferences = manager.extractUserPreferences(state)
|
|
429
438
|
manager.saveUserPreferences(preferences)
|
|
430
|
-
|
|
439
|
+
|
|
431
440
|
// Save session state
|
|
432
441
|
if (mediaId) {
|
|
433
442
|
const session = manager.extractSessionState(state, mediaId)
|
|
434
443
|
manager.saveSessionState(session)
|
|
435
|
-
|
|
444
|
+
|
|
436
445
|
// Save playback position
|
|
437
446
|
if (state.currentTime > 0 && state.duration > 0) {
|
|
438
447
|
manager.savePlaybackPosition(mediaId, state.currentTime)
|
|
439
448
|
}
|
|
440
449
|
}
|
|
441
450
|
}, [manager, state, mediaId, isRehydrated])
|
|
442
|
-
|
|
451
|
+
|
|
443
452
|
return {
|
|
444
453
|
manager,
|
|
445
454
|
isRehydrated
|
|
@@ -450,4 +459,4 @@ export function useAutoMediaPersistence(
|
|
|
450
459
|
export const defaultStorageAdapter = new LocalStorageAdapter()
|
|
451
460
|
|
|
452
461
|
// Import React for hooks
|
|
453
|
-
import React from "react"
|
|
462
|
+
import React from "react"
|