@therealtinhtute/baroiplayer 1.2.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -73
- package/dist/components/icons/index.d.ts +36 -0
- package/dist/components/icons/index.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/ArrowLeftIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/ArrowRightIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/AudioIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/AudioIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/BackwardIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/BackwardIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/CameraIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/CameraIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/CheckIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/CheckIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/EnablePiPIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/ForwardIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/ForwardIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/FullscreenEnterIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/FullscreenExitIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/LoadingIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/LoadingIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PauseIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PauseIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PlayIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PlayIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/PlaybackSpeedIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/QualityIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/QualityIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SettingsIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SettingsIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SliderIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SliderIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SubtitleIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SubtitleIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/SubtitleOffIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/UnPiPIcon.d.ts +4 -0
- package/dist/components/icons/svg-icons/UnPiPIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeMutedIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeOneIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeThreeIcon.d.ts.map +1 -0
- package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts +5 -0
- package/dist/components/icons/svg-icons/VolumeTwoIcon.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-audio.d.ts +13 -0
- package/dist/components/variants/gradient/gradient-audio.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-controls.d.ts +4 -0
- package/dist/components/variants/gradient/gradient-controls.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-glyphs.d.ts +30 -0
- package/dist/components/variants/gradient/gradient-glyphs.d.ts.map +1 -0
- package/dist/components/variants/gradient/gradient-video.d.ts +16 -0
- package/dist/components/variants/gradient/gradient-video.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -112
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +786 -6271
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +3 -0
- package/package.json +110 -108
- package/src/components/variants/gradient/gradient-audio.tsx +47 -0
- package/src/components/variants/gradient/gradient-controls.tsx +254 -0
- package/src/components/variants/gradient/gradient-glyphs.test.tsx +69 -0
- package/src/components/variants/gradient/gradient-glyphs.tsx +129 -0
- package/src/components/variants/gradient/gradient-skin.css +211 -0
- package/src/components/variants/gradient/gradient-video.tsx +70 -0
- package/src/index.ts +5 -198
- package/src/test/accessibility-utils.ts +0 -59
- package/dist/context/media.js +0 -2
- package/dist/context/media.js.map +0 -1
- package/dist/context/media.mjs +0 -15
- package/dist/context/media.mjs.map +0 -1
- package/dist/context/store.js +0 -2
- package/dist/context/store.js.map +0 -1
- package/dist/context/store.mjs +0 -5
- package/dist/context/store.mjs.map +0 -1
- package/dist/context-BYwDoSRX.js +0 -1172
- package/dist/context-BYwDoSRX.js.map +0 -1
- package/dist/context-eNS62_ac.cjs +0 -23
- package/dist/context-eNS62_ac.cjs.map +0 -1
- package/dist/core-events-B1iM2F46.cjs +0 -2
- package/dist/core-events-B1iM2F46.cjs.map +0 -1
- package/dist/core-events-DunPHKRE.js +0 -484
- package/dist/core-events-DunPHKRE.js.map +0 -1
- package/dist/core-plugins-By-4-kGs.cjs +0 -2
- package/dist/core-plugins-By-4-kGs.cjs.map +0 -1
- package/dist/core-plugins-DSBWcTuX.js +0 -821
- package/dist/core-plugins-DSBWcTuX.js.map +0 -1
- package/dist/core.js +0 -37
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -1233
- package/dist/core.mjs.map +0 -1
- package/dist/enhanced-components-B_l3cist.js +0 -1142
- package/dist/enhanced-components-B_l3cist.js.map +0 -1
- package/dist/enhanced-components-BspFs9OO.cjs +0 -2
- package/dist/enhanced-components-BspFs9OO.cjs.map +0 -1
- package/dist/hooks-BXwI8QG6.cjs +0 -4
- package/dist/hooks-BXwI8QG6.cjs.map +0 -1
- package/dist/hooks-Bpi-jDiO.js +0 -1816
- package/dist/hooks-Bpi-jDiO.js.map +0 -1
- package/dist/minimal-components-C4z900Ro.js +0 -1926
- package/dist/minimal-components-C4z900Ro.js.map +0 -1
- package/dist/minimal-components-v4qBp6jv.cjs +0 -2
- package/dist/minimal-components-v4qBp6jv.cjs.map +0 -1
- package/dist/minimal-components.css +0 -1
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor-C5k6FDXw.js +0 -301
- package/dist/performance-monitor-C5k6FDXw.js.map +0 -1
- package/dist/performance-monitor-lJmuUjQQ.cjs +0 -2
- package/dist/performance-monitor-lJmuUjQQ.cjs.map +0 -1
- package/dist/utils-CFOue_9K.cjs +0 -9
- package/dist/utils-CFOue_9K.cjs.map +0 -1
- package/dist/utils-Dzpl2ArK.js +0 -2844
- package/dist/utils-Dzpl2ArK.js.map +0 -1
- package/dist/utils.js +0 -2
- package/dist/utils.js.map +0 -1
- package/dist/utils.mjs +0 -11
- package/dist/utils.mjs.map +0 -1
- package/src/adapters/videojs-adapter.tsx +0 -470
- package/src/assets/mona-loading.gif +0 -0
- package/src/components/AnimateLoading.tsx +0 -107
- package/src/components/LoadingState.tsx +0 -239
- package/src/components/__tests__/media-player-accessibility.test.tsx +0 -510
- package/src/components/__tests__/media-player-react19.test.tsx +0 -457
- package/src/components/accessibility/keyboard-help-overlay.tsx +0 -207
- package/src/components/audio-player.tsx +0 -85
- package/src/components/basic/index.ts +0 -37
- package/src/components/enhanced/advanced-features.tsx +0 -311
- package/src/components/enhanced/debug-panel.tsx +0 -448
- package/src/components/enhanced/enhanced-controls.tsx +0 -597
- package/src/components/enhanced/enhanced-media-player.tsx +0 -566
- package/src/components/enhanced/error-handling.tsx +0 -338
- package/src/components/enhanced/index.ts +0 -39
- package/src/components/enhanced/media-player-enhanced.tsx +0 -383
- package/src/components/examples/basic-video-player.tsx +0 -50
- package/src/components/examples/custom-controls-example.tsx +0 -63
- package/src/components/examples/enhanced-controls-example.tsx +0 -100
- package/src/components/examples/enhanced-media-player-example.tsx +0 -302
- package/src/components/examples/loading-states-demo.tsx +0 -142
- package/src/components/examples/react-19-demo.tsx +0 -353
- package/src/components/examples/volume-orientation-demo.tsx +0 -106
- package/src/components/icon-demo.tsx +0 -196
- package/src/components/legacy.tsx +0 -87
- package/src/components/media-metadata-display.tsx +0 -99
- package/src/components/media-player-audio.tsx +0 -39
- package/src/components/media-player-controls.tsx +0 -223
- package/src/components/media-player-error.tsx +0 -163
- package/src/components/media-player-fullscreen.tsx +0 -109
- package/src/components/media-player-hls.tsx +0 -111
- package/src/components/media-player-loading.tsx +0 -76
- package/src/components/media-player-play.tsx +0 -75
- package/src/components/media-player-root.tsx +0 -338
- package/src/components/media-player-seek.tsx +0 -168
- package/src/components/media-player-time.tsx +0 -99
- package/src/components/media-player-tooltip.tsx +0 -58
- package/src/components/media-player-video.tsx +0 -54
- package/src/components/media-player-volume.tsx +0 -155
- package/src/components/media-player.tsx +0 -292
- package/src/components/media-suspense.tsx +0 -344
- package/src/components/player-settings-form.tsx +0 -158
- package/src/components/react-player-wrapper.tsx +0 -651
- package/src/components/simple-video-player.tsx +0 -62
- package/src/components/ui/blur-poster.tsx +0 -93
- package/src/components/ui/empty-state.tsx +0 -91
- package/src/components/ui/enhanced-seek-bar.tsx +0 -254
- package/src/components/ui/error-state.tsx +0 -124
- package/src/components/ui/fullscreen-button.tsx +0 -81
- package/src/components/ui/loading-skeleton.tsx +0 -107
- package/src/components/ui/media-resource-preloader.tsx +0 -458
- package/src/components/ui/offline-message.tsx +0 -98
- package/src/components/ui/play-button.tsx +0 -99
- package/src/components/ui/seek-bar.tsx +0 -191
- package/src/components/ui/time-display.tsx +0 -61
- package/src/components/ui/volume-control.tsx +0 -190
- package/src/components/unified/base-media-player.tsx +0 -252
- package/src/components/unified/media-player.tsx +0 -75
- package/src/components/variants/minimal/AccessibleMinimalPlayer.tsx +0 -587
- package/src/components/variants/minimal/EnhancedMinimalMediaPlayer.tsx +0 -573
- package/src/components/variants/minimal/MinimalControls.tsx +0 -124
- package/src/components/variants/minimal/MinimalLoading.tsx +0 -28
- package/src/components/variants/minimal/MinimalMediaPlayer.tsx +0 -318
- package/src/components/variants/minimal/MinimalOverlay.tsx +0 -58
- package/src/components/variants/minimal/MinimalPlayButton.tsx +0 -56
- package/src/components/variants/minimal/MinimalSeekBar.tsx +0 -140
- package/src/components/variants/minimal/MinimalVolumeControl.tsx +0 -75
- package/src/components/variants/minimal/SimpleMinimalPlayer.tsx +0 -206
- package/src/components/variants/minimal/components/CenterPlayButton.tsx +0 -22
- package/src/components/variants/minimal/components/ControlBar.tsx +0 -142
- package/src/components/variants/minimal/components/EnhancedSettingsMenu.tsx +0 -412
- package/src/components/variants/minimal/components/PlaybackControls.tsx +0 -46
- package/src/components/variants/minimal/components/RightControls.tsx +0 -164
- package/src/components/variants/minimal/components/SeekBar.tsx +0 -127
- package/src/components/variants/minimal/components/SettingsDropdown.tsx +0 -68
- package/src/components/variants/minimal/components/SubtitleDisplay.tsx +0 -21
- package/src/components/variants/minimal/components/TimeDisplay.tsx +0 -15
- package/src/components/variants/minimal/components/VideoElement.tsx +0 -33
- package/src/components/variants/minimal/components/VolumeControl.tsx +0 -220
- package/src/components/variants/minimal/index.ts +0 -23
- package/src/components/video-player.tsx +0 -100
- package/src/context/__tests__/media-store.test.ts +0 -509
- package/src/context/error-handling.ts +0 -398
- package/src/context/media-context.tsx +0 -254
- package/src/context/media-provider.tsx +0 -264
- package/src/context/media-store.ts +0 -387
- package/src/context/persistence.ts +0 -462
- package/src/core/events/event-system.ts +0 -448
- package/src/core/events/hooks.ts +0 -325
- package/src/core/events/index.ts +0 -22
- package/src/core/events/middleware.ts +0 -286
- package/src/core/index.ts +0 -22
- package/src/core/optimization/bundle-optimizer.tsx +0 -312
- package/src/core/performance/cicd.ts +0 -98
- package/src/core/performance/index.ts +0 -38
- package/src/core/performance/media-loading-optimizer.ts +0 -544
- package/src/core/performance/performance-budgets.ts +0 -437
- package/src/core/performance/performance-monitor.tsx +0 -488
- package/src/core/performance/performance-testing.ts +0 -461
- package/src/core/plugins/__tests__/registry.test.ts +0 -595
- package/src/core/plugins/base-plugin.ts +0 -225
- package/src/core/plugins/enhanced-plugin-system.ts +0 -435
- package/src/core/plugins/examples/analytics-plugin.ts +0 -241
- package/src/core/plugins/index.ts +0 -39
- package/src/core/plugins/registry.ts +0 -546
- package/src/core/plugins/types.ts +0 -169
- package/src/core/plugins/utils.ts +0 -317
- package/src/core/progressive-loading.tsx +0 -331
- package/src/core/providers/enhanced-hls-provider.ts +0 -307
- package/src/core/providers/lazy-provider.tsx +0 -14
- package/src/core/providers/service-provider.tsx +0 -164
- package/src/core/utils.tsx +0 -34
- package/src/features/media-session/media-session-manager.ts +0 -411
- package/src/features/picture-in-picture/pip-manager.ts +0 -428
- package/src/features/playlist/playlist-manager.ts +0 -626
- package/src/features/subtitles/subtitle-manager.ts +0 -435
- package/src/features/subtitles/subtitle-parser.ts +0 -284
- package/src/features/thumbnails/thumbnail-generator.ts +0 -528
- package/src/hooks/__tests__/currentTime-fix.test.ts +0 -149
- package/src/hooks/__tests__/use-media-player.test.ts +0 -712
- package/src/hooks/__tests__/use-media-state.test.tsx +0 -316
- package/src/hooks/accessibility/index.ts +0 -27
- package/src/hooks/accessibility/use-accessibility-preferences.ts +0 -190
- package/src/hooks/accessibility/use-focus-management.ts +0 -183
- package/src/hooks/accessibility/use-keyboard-shortcuts.ts +0 -152
- package/src/hooks/accessibility/use-screen-reader.ts +0 -212
- package/src/hooks/core/index.ts +0 -47
- package/src/hooks/legacy.ts +0 -21
- package/src/hooks/use-buffer-health.ts +0 -218
- package/src/hooks/use-enhanced-media-player.ts +0 -575
- package/src/hooks/use-focus-trap.tsx +0 -162
- package/src/hooks/use-intelligent-preloading.ts +0 -387
- package/src/hooks/use-keyboard-controls.ts +0 -115
- package/src/hooks/use-keyboard-shortcuts.ts +0 -255
- package/src/hooks/use-media-actions.ts +0 -184
- package/src/hooks/use-media-metadata.ts +0 -91
- package/src/hooks/use-media-optimistic.ts +0 -264
- package/src/hooks/use-media-player.ts +0 -343
- package/src/hooks/use-media-state.ts +0 -194
- package/src/hooks/use-memory-optimization.ts +0 -360
- package/src/hooks/use-network-status.ts +0 -124
- package/src/hooks/use-optimistic-controls.ts +0 -95
- package/src/hooks/use-optimized-media.ts +0 -283
- package/src/hooks/use-smart-preload.ts +0 -229
- package/src/hooks/use-touch-gestures.ts +0 -461
- package/src/hooks/useEnhancedSubtitles.ts +0 -258
- package/src/hooks/useKeyboardShortcuts.ts +0 -106
- package/src/hooks/useMediaControls.ts +0 -52
- package/src/hooks/useScreenshot.ts +0 -61
- package/src/hooks/useSubtitles.ts +0 -91
- package/src/hooks/useVideoPlayer.ts +0 -278
- package/src/icons/components/FullscreenIcon.tsx +0 -36
- package/src/icons/components/SettingsIcon.tsx +0 -37
- package/src/icons/components/animated/LoadingIcon.tsx +0 -27
- package/src/icons/components/animated/PlayPauseIcon.tsx +0 -42
- package/src/icons/components/media/PauseIcon.tsx +0 -38
- package/src/icons/components/media/PlayIcon.tsx +0 -37
- package/src/icons/components/volume/VolumeIcon.tsx +0 -38
- package/src/icons/components/volume/VolumeOffIcon.tsx +0 -38
- package/src/icons/index.ts +0 -56
- package/src/icons/provider.tsx +0 -58
- package/src/icons/types.ts +0 -60
- package/src/index-enhanced.ts +0 -35
- package/src/index-legacy.ts +0 -324
- package/src/index.css +0 -102
- package/src/lib/__tests__/async-utils.test.ts +0 -291
- package/src/lib/async-utils.ts +0 -194
- package/src/lib/deprecation.ts +0 -51
- package/src/lib/format-time.ts +0 -37
- package/src/lib/index.ts +0 -4
- package/src/lib/utils.ts +0 -6
- package/src/styles/globals.css +0 -462
- package/src/styles/minimal-player.css +0 -621
- package/src/styles/pixel-art.css +0 -41
- package/src/styles/videojs.css +0 -100
- package/src/types/events.ts +0 -47
- package/src/types/formats.ts +0 -79
- package/src/types/index.ts +0 -203
- package/src/types/videojs-plugins.d.ts +0 -14
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Legacy Components (Deprecated)
|
|
3
|
-
* These components are wrapped with deprecation warnings
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
"use client"
|
|
7
|
-
|
|
8
|
-
import React from "react"
|
|
9
|
-
import { showDeprecationWarning } from "../lib/deprecation"
|
|
10
|
-
|
|
11
|
-
import { AudioPlayer } from "./audio-player"
|
|
12
|
-
// Import current components
|
|
13
|
-
import { MediaPlayer } from "./media-player"
|
|
14
|
-
import { ModernMediaPlayer as ReactPlayerWrapper } from "./react-player-wrapper"
|
|
15
|
-
import { SimpleVideoPlayer as SimpleVideoPlayerBase } from "./simple-video-player"
|
|
16
|
-
import { FullscreenButton } from "./ui/fullscreen-button"
|
|
17
|
-
import { PlayButton } from "./ui/play-button"
|
|
18
|
-
import { SeekBar } from "./ui/seek-bar"
|
|
19
|
-
import { TimeDisplay } from "./ui/time-display"
|
|
20
|
-
import { VolumeControl } from "./ui/volume-control"
|
|
21
|
-
import { VideoPlayer } from "./video-player"
|
|
22
|
-
|
|
23
|
-
// Legacy component wrappers with deprecation warnings
|
|
24
|
-
export const ModernMediaPlayer = React.forwardRef<any, any>((props, ref) => {
|
|
25
|
-
showDeprecationWarning("ModernMediaPlayer", "MediaPlayer (the primary media player component)")
|
|
26
|
-
return <ReactPlayerWrapper {...props} ref={ref} />
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
ModernMediaPlayer.displayName = "DeprecatedModernMediaPlayer"
|
|
30
|
-
|
|
31
|
-
export const SimpleVideoPlayer = React.forwardRef<any, any>((props, ref) => {
|
|
32
|
-
showDeprecationWarning("SimpleVideoPlayer", "VideoPlayer (the primary video player component)")
|
|
33
|
-
return <SimpleVideoPlayerBase {...(props as any)} />
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
SimpleVideoPlayer.displayName = "DeprecatedSimpleVideoPlayer"
|
|
37
|
-
|
|
38
|
-
// Legacy UI components with deprecation warnings
|
|
39
|
-
export const LegacyPlayButton = React.forwardRef<any, any>((props, ref) => {
|
|
40
|
-
showDeprecationWarning(
|
|
41
|
-
"PlayButton",
|
|
42
|
-
"Use MediaPlayer compound components or MediaPlayer (all-in-one)"
|
|
43
|
-
)
|
|
44
|
-
return <PlayButton {...(props as any)} />
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
LegacyPlayButton.displayName = "DeprecatedPlayButton"
|
|
48
|
-
|
|
49
|
-
export const LegacySeekBar = React.forwardRef<any, any>((props, ref) => {
|
|
50
|
-
showDeprecationWarning(
|
|
51
|
-
"SeekBar",
|
|
52
|
-
"Use MediaPlayer compound components or MediaPlayer (all-in-one)"
|
|
53
|
-
)
|
|
54
|
-
return <SeekBar {...(props as any)} />
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
LegacySeekBar.displayName = "DeprecatedSeekBar"
|
|
58
|
-
|
|
59
|
-
export const LegacyTimeDisplay = React.forwardRef<any, any>((props, ref) => {
|
|
60
|
-
showDeprecationWarning(
|
|
61
|
-
"TimeDisplay",
|
|
62
|
-
"Use MediaPlayer compound components or MediaPlayer (all-in-one)"
|
|
63
|
-
)
|
|
64
|
-
return <TimeDisplay {...(props as any)} />
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
LegacyTimeDisplay.displayName = "DeprecatedTimeDisplay"
|
|
68
|
-
|
|
69
|
-
export const LegacyVolumeControl = React.forwardRef<any, any>((props, ref) => {
|
|
70
|
-
showDeprecationWarning(
|
|
71
|
-
"VolumeControl",
|
|
72
|
-
"Use MediaPlayer compound components or MediaPlayer (all-in-one)"
|
|
73
|
-
)
|
|
74
|
-
return <VolumeControl {...(props as any)} />
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
LegacyVolumeControl.displayName = "DeprecatedVolumeControl"
|
|
78
|
-
|
|
79
|
-
export const LegacyFullscreenButton = React.forwardRef<any, any>((props, ref) => {
|
|
80
|
-
showDeprecationWarning(
|
|
81
|
-
"FullscreenButton",
|
|
82
|
-
"Use MediaPlayer compound components or MediaPlayer (all-in-one)"
|
|
83
|
-
)
|
|
84
|
-
return <FullscreenButton {...(props as any)} />
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
LegacyFullscreenButton.displayName = "DeprecatedFullscreenButton"
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Suspense } from "react"
|
|
2
|
-
import { type MediaMetadata, formatTime, useMediaMetadata } from "../hooks/use-media-metadata"
|
|
3
|
-
|
|
4
|
-
interface MediaMetadataDisplayProps {
|
|
5
|
-
src: string
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function MetadataSkeleton() {
|
|
9
|
-
return (
|
|
10
|
-
<div className="animate-pulse space-y-2">
|
|
11
|
-
<div className="h-4 w-3/4 rounded bg-gray-700"></div>
|
|
12
|
-
<div className="h-3 w-1/2 rounded bg-gray-700"></div>
|
|
13
|
-
<div className="h-3 w-2/3 rounded bg-gray-700"></div>
|
|
14
|
-
</div>
|
|
15
|
-
)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function MediaMetadataContent({ src }: MediaMetadataDisplayProps) {
|
|
19
|
-
// Use the use() hook for async data - this will suspend until data loads
|
|
20
|
-
const metadata = useMediaMetadata(src)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="media-metadata space-y-2 text-white">
|
|
24
|
-
<div>
|
|
25
|
-
<span className="text-gray-400 text-sm">Duration: </span>
|
|
26
|
-
<span>{formatTime(metadata.duration)}</span>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<div>
|
|
30
|
-
<span className="text-gray-400 text-sm">Format: </span>
|
|
31
|
-
<span>{metadata.format}</span>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
{metadata.width && metadata.height && (
|
|
35
|
-
<div>
|
|
36
|
-
<span className="text-gray-400 text-sm">Resolution: </span>
|
|
37
|
-
<span>
|
|
38
|
-
{metadata.width} x {metadata.height}
|
|
39
|
-
</span>
|
|
40
|
-
</div>
|
|
41
|
-
)}
|
|
42
|
-
|
|
43
|
-
{metadata.title && (
|
|
44
|
-
<div>
|
|
45
|
-
<span className="text-gray-400 text-sm">Title: </span>
|
|
46
|
-
<span>{metadata.title}</span>
|
|
47
|
-
</div>
|
|
48
|
-
)}
|
|
49
|
-
|
|
50
|
-
{metadata.artist && (
|
|
51
|
-
<div>
|
|
52
|
-
<span className="text-gray-400 text-sm">Artist: </span>
|
|
53
|
-
<span>{metadata.artist}</span>
|
|
54
|
-
</div>
|
|
55
|
-
)}
|
|
56
|
-
</div>
|
|
57
|
-
)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export function MediaMetadataDisplay({ src }: MediaMetadataDisplayProps) {
|
|
61
|
-
return (
|
|
62
|
-
<div className="rounded-lg bg-gray-800 p-4">
|
|
63
|
-
<h4 className="mb-3 font-medium text-white">Media Information</h4>
|
|
64
|
-
<Suspense fallback={<MetadataSkeleton />}>
|
|
65
|
-
<MediaMetadataContent src={src} />
|
|
66
|
-
</Suspense>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Enhanced version with error boundary
|
|
72
|
-
interface MediaInfoProps {
|
|
73
|
-
src: string
|
|
74
|
-
title?: string
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function MediaErrorFallback({ error, retry }: { error: Error; retry: () => void }) {
|
|
78
|
-
return (
|
|
79
|
-
<div className="rounded-lg border border-red-700 bg-red-900/20 p-4">
|
|
80
|
-
<h4 className="mb-2 font-medium text-red-400">Failed to load metadata</h4>
|
|
81
|
-
<p className="mb-3 text-red-300 text-sm">{error.message}</p>
|
|
82
|
-
<button
|
|
83
|
-
onClick={retry}
|
|
84
|
-
className="rounded bg-red-700 px-3 py-1 text-sm text-white transition-colors hover:bg-red-600">
|
|
85
|
-
Retry
|
|
86
|
-
</button>
|
|
87
|
-
</div>
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export function MediaInfo({ src, title }: MediaInfoProps) {
|
|
92
|
-
return (
|
|
93
|
-
<div className="space-y-4">
|
|
94
|
-
{title && <h3 className="font-semibold text-white text-xl">{title}</h3>}
|
|
95
|
-
|
|
96
|
-
<MediaMetadataDisplay src={src} />
|
|
97
|
-
</div>
|
|
98
|
-
)
|
|
99
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import React from "react"
|
|
4
|
-
import { useMediaContext } from "../context/media-context"
|
|
5
|
-
|
|
6
|
-
export interface MediaPlayerAudioProps extends React.AudioHTMLAttributes<HTMLAudioElement> {
|
|
7
|
-
asChild?: boolean
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function MediaPlayerAudio({
|
|
11
|
-
asChild = false,
|
|
12
|
-
className,
|
|
13
|
-
children,
|
|
14
|
-
...props
|
|
15
|
-
}: MediaPlayerAudioProps) {
|
|
16
|
-
const context = useMediaContext()
|
|
17
|
-
|
|
18
|
-
if (asChild) {
|
|
19
|
-
// When asChild is true, clone the child element and add our props
|
|
20
|
-
const child = React.Children.only(children) as React.ReactElement
|
|
21
|
-
return React.cloneElement(child, {
|
|
22
|
-
...props,
|
|
23
|
-
ref: context.mediaRef,
|
|
24
|
-
"data-slot": "media-player-audio"
|
|
25
|
-
} as any)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<audio
|
|
30
|
-
ref={context.mediaRef as React.RefObject<HTMLAudioElement>}
|
|
31
|
-
data-slot="media-player-audio"
|
|
32
|
-
className={className}
|
|
33
|
-
{...props}>
|
|
34
|
-
{children}
|
|
35
|
-
</audio>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
MediaPlayerAudio.displayName = "MediaPlayerAudio"
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { useContainerQuery, useDeviceInfo } from "@rp/ui/hooks/use-mobile"
|
|
4
|
-
import React from "react"
|
|
5
|
-
import { useMediaSelector } from "../context/media-context"
|
|
6
|
-
import { cn } from "../lib/utils"
|
|
7
|
-
|
|
8
|
-
export interface MediaPlayerControlsProps {
|
|
9
|
-
children: React.ReactNode
|
|
10
|
-
className?: string
|
|
11
|
-
asChild?: boolean
|
|
12
|
-
variant?: "default" | "mobile" | "compact"
|
|
13
|
-
adaptiveLayout?: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function MediaPlayerControls({
|
|
17
|
-
children,
|
|
18
|
-
className,
|
|
19
|
-
asChild = false,
|
|
20
|
-
variant,
|
|
21
|
-
adaptiveLayout = true,
|
|
22
|
-
...props
|
|
23
|
-
}: MediaPlayerControlsProps) {
|
|
24
|
-
const isFullscreen = useMediaSelector((state) => state.isFullscreen)
|
|
25
|
-
const disabled = useMediaSelector((state) => state.error !== null)
|
|
26
|
-
const { isMobile, isTablet, isTouchDevice, orientation } = useDeviceInfo()
|
|
27
|
-
|
|
28
|
-
// Container ref for responsive queries
|
|
29
|
-
const containerRef = React.useRef<HTMLDivElement>(null)
|
|
30
|
-
const isCompactContainer = useContainerQuery(
|
|
31
|
-
containerRef as React.RefObject<HTMLElement>,
|
|
32
|
-
"(max-width: 480px)"
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
// Determine the effective variant
|
|
36
|
-
const effectiveVariant = React.useMemo(() => {
|
|
37
|
-
if (variant) return variant
|
|
38
|
-
if (!adaptiveLayout) return "default"
|
|
39
|
-
|
|
40
|
-
// Auto-detect based on device and container size
|
|
41
|
-
if (isMobile || isCompactContainer) return "mobile"
|
|
42
|
-
if (isTablet) return "compact"
|
|
43
|
-
return "default"
|
|
44
|
-
}, [variant, adaptiveLayout, isMobile, isTablet, isCompactContainer])
|
|
45
|
-
|
|
46
|
-
// Get mobile-optimized classes
|
|
47
|
-
const getMobileClasses = () => {
|
|
48
|
-
const baseClasses = [
|
|
49
|
-
// Base mobile-first classes
|
|
50
|
-
"pointer-events-none absolute right-0 bottom-0 left-0 z-50",
|
|
51
|
-
"opacity-0 transition-opacity duration-200",
|
|
52
|
-
"data-[visible]:pointer-events-auto data-[visible]:opacity-100"
|
|
53
|
-
]
|
|
54
|
-
|
|
55
|
-
switch (effectiveVariant) {
|
|
56
|
-
case "mobile":
|
|
57
|
-
return [
|
|
58
|
-
...baseClasses,
|
|
59
|
-
// Mobile-first layout with larger touch targets
|
|
60
|
-
"flex flex-col gap-3 px-4 py-4",
|
|
61
|
-
// Larger padding for better thumb reach
|
|
62
|
-
"[@container(min-width:360px)]:px-6 [@container(min-width:360px)]:py-5",
|
|
63
|
-
// Portrait orientation adjustments
|
|
64
|
-
orientation === "portrait" && "pb-6",
|
|
65
|
-
// Fullscreen mobile adjustments
|
|
66
|
-
"[:fullscreen_&]:px-8 [:fullscreen_&]:py-6",
|
|
67
|
-
// Ensure minimum touch target sizes (44px)
|
|
68
|
-
"[&_button]:min-h-[44px] [&_button]:min-w-[44px]",
|
|
69
|
-
"[&_[role=slider]]:min-h-[44px]",
|
|
70
|
-
// Better spacing for touch
|
|
71
|
-
"[&>*]:gap-4"
|
|
72
|
-
]
|
|
73
|
-
|
|
74
|
-
case "compact":
|
|
75
|
-
return [
|
|
76
|
-
...baseClasses,
|
|
77
|
-
// Tablet-optimized compact layout
|
|
78
|
-
"flex items-center gap-2 px-4 py-3",
|
|
79
|
-
"[:fullscreen_&]:px-6 [:fullscreen_&]:py-4",
|
|
80
|
-
// Medium-sized touch targets (40px)
|
|
81
|
-
"[&_button]:min-h-[40px] [&_button]:min-w-[40px]",
|
|
82
|
-
"[&_[role=slider]]:min-h-[40px]"
|
|
83
|
-
]
|
|
84
|
-
|
|
85
|
-
default:
|
|
86
|
-
return [
|
|
87
|
-
...baseClasses,
|
|
88
|
-
// Desktop default layout
|
|
89
|
-
"flex items-center gap-2 px-4 py-3",
|
|
90
|
-
"[:fullscreen_&]:px-6 [:fullscreen_&]:py-4",
|
|
91
|
-
// Standard button sizes for desktop
|
|
92
|
-
"[&_button]:min-h-[36px] [&_button]:min-w-[36px]"
|
|
93
|
-
]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (asChild) {
|
|
98
|
-
const child = React.Children.only(children) as React.ReactElement
|
|
99
|
-
return React.cloneElement(child, {
|
|
100
|
-
...props,
|
|
101
|
-
ref: containerRef,
|
|
102
|
-
"data-slot": "media-player-controls",
|
|
103
|
-
"data-state": isFullscreen ? "fullscreen" : "inline",
|
|
104
|
-
"data-disabled": disabled ? "" : undefined,
|
|
105
|
-
"data-variant": effectiveVariant,
|
|
106
|
-
"data-touch": isTouchDevice ? "" : undefined,
|
|
107
|
-
className: cn(
|
|
108
|
-
getMobileClasses(),
|
|
109
|
-
// Add container query support
|
|
110
|
-
"@container",
|
|
111
|
-
className
|
|
112
|
-
)
|
|
113
|
-
} as any)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<div
|
|
118
|
-
ref={containerRef}
|
|
119
|
-
data-slot="media-player-controls"
|
|
120
|
-
data-state={isFullscreen ? "fullscreen" : "inline"}
|
|
121
|
-
data-disabled={disabled ? "" : undefined}
|
|
122
|
-
data-variant={effectiveVariant}
|
|
123
|
-
data-touch={isTouchDevice ? "" : undefined}
|
|
124
|
-
className={cn(
|
|
125
|
-
"dark",
|
|
126
|
-
getMobileClasses(),
|
|
127
|
-
// Add container query support
|
|
128
|
-
"@container",
|
|
129
|
-
className
|
|
130
|
-
)}
|
|
131
|
-
{...props}>
|
|
132
|
-
{children}
|
|
133
|
-
</div>
|
|
134
|
-
)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
MediaPlayerControls.displayName = "MediaPlayerControls"
|
|
138
|
-
|
|
139
|
-
// Controls overlay for background gradient
|
|
140
|
-
export interface MediaPlayerControlsOverlayProps {
|
|
141
|
-
className?: string
|
|
142
|
-
asChild?: boolean
|
|
143
|
-
children?: React.ReactNode
|
|
144
|
-
variant?: "default" | "mobile" | "compact"
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export function MediaPlayerControlsOverlay({
|
|
148
|
-
className,
|
|
149
|
-
asChild = false,
|
|
150
|
-
children,
|
|
151
|
-
variant,
|
|
152
|
-
...props
|
|
153
|
-
}: MediaPlayerControlsOverlayProps) {
|
|
154
|
-
const isFullscreen = useMediaSelector((state) => state.isFullscreen)
|
|
155
|
-
const { isMobile, isTablet, isTouchDevice } = useDeviceInfo()
|
|
156
|
-
|
|
157
|
-
// Determine the effective variant
|
|
158
|
-
const effectiveVariant = React.useMemo(() => {
|
|
159
|
-
if (variant) return variant
|
|
160
|
-
if (isMobile) return "mobile"
|
|
161
|
-
if (isTablet) return "compact"
|
|
162
|
-
return "default"
|
|
163
|
-
}, [variant, isMobile, isTablet])
|
|
164
|
-
|
|
165
|
-
// Get mobile-optimized gradient classes
|
|
166
|
-
const getOverlayClasses = () => {
|
|
167
|
-
const baseClasses = [
|
|
168
|
-
"-z-10 pointer-events-none absolute inset-0",
|
|
169
|
-
"opacity-0 transition-opacity duration-200 data-[visible]:opacity-100"
|
|
170
|
-
]
|
|
171
|
-
|
|
172
|
-
switch (effectiveVariant) {
|
|
173
|
-
case "mobile":
|
|
174
|
-
return [
|
|
175
|
-
...baseClasses,
|
|
176
|
-
// Enhanced gradient for better readability on mobile
|
|
177
|
-
"bg-gradient-to-t from-black/90 via-black/60 to-transparent",
|
|
178
|
-
// Larger gradient area for mobile controls
|
|
179
|
-
"from-0% via-40% to-70%"
|
|
180
|
-
]
|
|
181
|
-
|
|
182
|
-
case "compact":
|
|
183
|
-
return [
|
|
184
|
-
...baseClasses,
|
|
185
|
-
// Medium gradient for tablet
|
|
186
|
-
"bg-gradient-to-t from-black/85 via-black/40 to-transparent",
|
|
187
|
-
"from-0% via-30% to-60%"
|
|
188
|
-
]
|
|
189
|
-
|
|
190
|
-
default:
|
|
191
|
-
return [
|
|
192
|
-
...baseClasses,
|
|
193
|
-
// Standard desktop gradient
|
|
194
|
-
"bg-gradient-to-t from-black/80 to-transparent"
|
|
195
|
-
]
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (asChild) {
|
|
200
|
-
const child = React.Children.only(children) as React.ReactElement
|
|
201
|
-
return React.cloneElement(child, {
|
|
202
|
-
...props,
|
|
203
|
-
"data-slot": "media-player-controls-overlay",
|
|
204
|
-
"data-state": isFullscreen ? "fullscreen" : "inline",
|
|
205
|
-
"data-variant": effectiveVariant,
|
|
206
|
-
"data-touch": isTouchDevice ? "" : undefined,
|
|
207
|
-
className: cn(getOverlayClasses(), className)
|
|
208
|
-
} as any)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
<div
|
|
213
|
-
data-slot="media-player-controls-overlay"
|
|
214
|
-
data-state={isFullscreen ? "fullscreen" : "inline"}
|
|
215
|
-
data-variant={effectiveVariant}
|
|
216
|
-
data-touch={isTouchDevice ? "" : undefined}
|
|
217
|
-
className={cn(getOverlayClasses(), className)}
|
|
218
|
-
{...props}
|
|
219
|
-
/>
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
MediaPlayerControlsOverlay.displayName = "MediaPlayerControlsOverlay"
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
import { Button } from "@rp/ui/components/button"
|
|
4
|
-
import { AlertTriangleIcon, RefreshCcwIcon, RotateCcwIcon } from "lucide-react"
|
|
5
|
-
import React from "react"
|
|
6
|
-
import { useMediaContext, useMediaSelector } from "../context/media-context"
|
|
7
|
-
import { cn } from "../lib/utils"
|
|
8
|
-
|
|
9
|
-
export interface MediaPlayerErrorProps {
|
|
10
|
-
error?: Error | string | null
|
|
11
|
-
label?: string
|
|
12
|
-
description?: string
|
|
13
|
-
onRetry?: () => void
|
|
14
|
-
onReload?: () => void
|
|
15
|
-
className?: string
|
|
16
|
-
asChild?: boolean
|
|
17
|
-
children?: React.ReactNode
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function MediaPlayerError({
|
|
21
|
-
error: errorProp,
|
|
22
|
-
label,
|
|
23
|
-
description,
|
|
24
|
-
onRetry: onRetryProp,
|
|
25
|
-
onReload: onReloadProp,
|
|
26
|
-
className,
|
|
27
|
-
asChild = false,
|
|
28
|
-
children,
|
|
29
|
-
...props
|
|
30
|
-
}: MediaPlayerErrorProps) {
|
|
31
|
-
const context = useMediaContext()
|
|
32
|
-
const stateError = useMediaSelector((state) => state.error)
|
|
33
|
-
|
|
34
|
-
const error = errorProp || stateError
|
|
35
|
-
const [actionState, setActionState] = React.useState({
|
|
36
|
-
retryPending: false,
|
|
37
|
-
reloadPending: false
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const handleRetry = React.useCallback(() => {
|
|
41
|
-
setActionState((prev) => ({ ...prev, retryPending: true }))
|
|
42
|
-
|
|
43
|
-
requestAnimationFrame(() => {
|
|
44
|
-
const mediaElement = context.mediaRef.current
|
|
45
|
-
if (!mediaElement) {
|
|
46
|
-
setActionState((prev) => ({ ...prev, retryPending: false }))
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (onRetryProp) {
|
|
51
|
-
onRetryProp()
|
|
52
|
-
} else {
|
|
53
|
-
const currentSrc = mediaElement.src
|
|
54
|
-
if (currentSrc) {
|
|
55
|
-
mediaElement.load()
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
setActionState((prev) => ({ ...prev, retryPending: false }))
|
|
60
|
-
})
|
|
61
|
-
}, [context.mediaRef, onRetryProp])
|
|
62
|
-
|
|
63
|
-
const handleReload = React.useCallback(() => {
|
|
64
|
-
setActionState((prev) => ({ ...prev, reloadPending: true }))
|
|
65
|
-
|
|
66
|
-
requestAnimationFrame(() => {
|
|
67
|
-
if (onReloadProp) {
|
|
68
|
-
onReloadProp()
|
|
69
|
-
} else {
|
|
70
|
-
window.location.reload()
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
}, [onReloadProp])
|
|
74
|
-
|
|
75
|
-
const errorLabel = React.useMemo(() => {
|
|
76
|
-
if (label) return label
|
|
77
|
-
|
|
78
|
-
if (error instanceof Error) {
|
|
79
|
-
return "Media Error"
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return "Playback Error"
|
|
83
|
-
}, [label, error])
|
|
84
|
-
|
|
85
|
-
const errorDescription = React.useMemo(() => {
|
|
86
|
-
if (description) return description
|
|
87
|
-
|
|
88
|
-
if (error instanceof Error) {
|
|
89
|
-
return error.message
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (typeof error === "string") {
|
|
93
|
-
return error
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return "An error occurred while loading the media"
|
|
97
|
-
}, [description, error])
|
|
98
|
-
|
|
99
|
-
if (!error) return null
|
|
100
|
-
|
|
101
|
-
const errorProps = {
|
|
102
|
-
role: "alert",
|
|
103
|
-
"aria-describedby": `${context.mediaId}-error-description`,
|
|
104
|
-
"aria-labelledby": `${context.mediaId}-error-label`,
|
|
105
|
-
"aria-live": "assertive" as const,
|
|
106
|
-
"data-slot": "media-player-error",
|
|
107
|
-
"data-state": "error",
|
|
108
|
-
className: cn(
|
|
109
|
-
"pointer-events-auto absolute inset-0 z-50 flex flex-col items-center justify-center bg-black/80 text-white backdrop-blur-sm",
|
|
110
|
-
className
|
|
111
|
-
),
|
|
112
|
-
...props
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const content = (
|
|
116
|
-
<div className="flex flex-col items-center gap-4 p-6 text-center">
|
|
117
|
-
<AlertTriangleIcon className="size-12 text-red-400" />
|
|
118
|
-
<div className="space-y-2">
|
|
119
|
-
<h3 id={`${context.mediaId}-error-label`} className="font-semibold text-lg">
|
|
120
|
-
{errorLabel}
|
|
121
|
-
</h3>
|
|
122
|
-
<p id={`${context.mediaId}-error-description`} className="text-sm text-white/80">
|
|
123
|
-
{errorDescription}
|
|
124
|
-
</p>
|
|
125
|
-
</div>
|
|
126
|
-
<div className="flex items-center gap-2">
|
|
127
|
-
<Button
|
|
128
|
-
variant="outline"
|
|
129
|
-
size="sm"
|
|
130
|
-
onClick={handleRetry}
|
|
131
|
-
disabled={actionState.retryPending}>
|
|
132
|
-
{actionState.retryPending ? (
|
|
133
|
-
<RefreshCcwIcon className="mr-2 size-4 animate-spin" />
|
|
134
|
-
) : (
|
|
135
|
-
<RefreshCcwIcon className="mr-2 size-4" />
|
|
136
|
-
)}
|
|
137
|
-
Try again
|
|
138
|
-
</Button>
|
|
139
|
-
<Button
|
|
140
|
-
variant="outline"
|
|
141
|
-
size="sm"
|
|
142
|
-
onClick={handleReload}
|
|
143
|
-
disabled={actionState.reloadPending}>
|
|
144
|
-
{actionState.reloadPending ? (
|
|
145
|
-
<RotateCcwIcon className="mr-2 size-4 animate-spin" />
|
|
146
|
-
) : (
|
|
147
|
-
<RotateCcwIcon className="mr-2 size-4" />
|
|
148
|
-
)}
|
|
149
|
-
Reload page
|
|
150
|
-
</Button>
|
|
151
|
-
</div>
|
|
152
|
-
</div>
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
if (asChild) {
|
|
156
|
-
const child = React.Children.only(children) as React.ReactElement
|
|
157
|
-
return React.cloneElement(child, errorProps as any, content)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return <div {...errorProps}>{content}</div>
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
MediaPlayerError.displayName = "MediaPlayerError"
|