@therealtinhtute/baroiplayer 1.2.1 → 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 +90 -71
- 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 +1 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +750 -5640
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +3 -0
- package/package.json +110 -114
- 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 -1
- package/dist/context/media.mjs +0 -3
- package/dist/context/store.js +0 -1
- package/dist/context/store.mjs +0 -3
- package/dist/context-Bzd5QCKM.cjs +0 -7
- package/dist/context-Bzd5QCKM.cjs.map +0 -1
- package/dist/context-DD_SH4tT.js +0 -1053
- package/dist/context-DD_SH4tT.js.map +0 -1
- package/dist/core-events-BRnLMB7s.cjs +0 -2
- package/dist/core-events-BRnLMB7s.cjs.map +0 -1
- package/dist/core-events-v_mKdj5p.js +0 -417
- package/dist/core-events-v_mKdj5p.js.map +0 -1
- package/dist/core-plugins-CMBv-yVh.cjs +0 -2
- package/dist/core-plugins-CMBv-yVh.cjs.map +0 -1
- package/dist/core-plugins-CqCxLkbd.js +0 -754
- package/dist/core-plugins-CqCxLkbd.js.map +0 -1
- package/dist/core.js +0 -15
- package/dist/core.js.map +0 -1
- package/dist/core.mjs +0 -960
- package/dist/core.mjs.map +0 -1
- package/dist/enhanced-components-BwjBqSA1.js +0 -2858
- package/dist/enhanced-components-BwjBqSA1.js.map +0 -1
- package/dist/enhanced-components-C-ka-XLp.cjs +0 -2
- package/dist/enhanced-components-C-ka-XLp.cjs.map +0 -1
- package/dist/hooks-B-IIWPJr.js +0 -1842
- package/dist/hooks-B-IIWPJr.js.map +0 -1
- package/dist/hooks-DcHzmBwA.cjs +0 -4
- package/dist/hooks-DcHzmBwA.cjs.map +0 -1
- package/dist/minimal-components-BYsMQde5.js +0 -1610
- package/dist/minimal-components-BYsMQde5.js.map +0 -1
- package/dist/minimal-components-CsxQbDp7.cjs +0 -2
- package/dist/minimal-components-CsxQbDp7.cjs.map +0 -1
- package/dist/minimal-components.css +0 -1
- package/dist/mona-loading.gif +0 -0
- package/dist/performance-monitor-DCSijLJg.js +0 -312
- package/dist/performance-monitor-DCSijLJg.js.map +0 -1
- package/dist/performance-monitor-wNFKmqMr.cjs +0 -2
- package/dist/performance-monitor-wNFKmqMr.cjs.map +0 -1
- package/dist/rolldown-runtime-BmowowmI.js +0 -14
- package/dist/rolldown-runtime-mLOUI7ql.cjs +0 -1
- package/dist/utils-D2gQ7c2R.js +0 -64
- package/dist/utils-D2gQ7c2R.js.map +0 -1
- package/dist/utils-DJaAwiZ9.cjs +0 -2
- package/dist/utils-DJaAwiZ9.cjs.map +0 -1
- package/dist/utils.js +0 -1
- package/dist/utils.mjs +0 -3
- package/src/adapters/videojs-adapter.tsx +0 -470
- package/src/assets/mona-loading.gif +0 -0
- package/src/components/AnimateLoading.tsx +0 -111
- 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 -141
- package/src/components/examples/react-19-demo.tsx +0 -349
- package/src/components/examples/volume-orientation-demo.tsx +0 -105
- 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 -96
- 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 -35
- 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 -545
- 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 -77
- 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/assets.d.ts +0 -29
- 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
package/dist/hooks-B-IIWPJr.js
DELETED
|
@@ -1,1842 +0,0 @@
|
|
|
1
|
-
import { n as e } from "./rolldown-runtime-BmowowmI.js";
|
|
2
|
-
import { a as t, f as n, p as r } from "./context-DD_SH4tT.js";
|
|
3
|
-
import * as i from "react";
|
|
4
|
-
import a, { useCallback as o, useEffect as s, useMemo as c, useOptimistic as l, useRef as u, useState as d, useTransition as f } from "react";
|
|
5
|
-
//#region src/hooks/use-media-actions.ts
|
|
6
|
-
function p(e, t) {
|
|
7
|
-
return ((n, r = !1) => {
|
|
8
|
-
let i = {
|
|
9
|
-
type: e,
|
|
10
|
-
detail: n,
|
|
11
|
-
optimistic: r,
|
|
12
|
-
timestamp: Date.now()
|
|
13
|
-
};
|
|
14
|
-
return r ? t.dispatchOptimistic(i) : (t.dispatch(i), Promise.resolve());
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function m(e) {
|
|
18
|
-
let [t, n] = a.useState(e.getActionState());
|
|
19
|
-
return a.useEffect(() => e.subscribe(() => {
|
|
20
|
-
let t = e.getActionState();
|
|
21
|
-
n((e) => JSON.stringify(e) === JSON.stringify(t) ? e : t);
|
|
22
|
-
}), [e]), t;
|
|
23
|
-
}
|
|
24
|
-
function h(e) {
|
|
25
|
-
let n = a.useMemo(() => ({
|
|
26
|
-
play: p(t.PLAY, e),
|
|
27
|
-
pause: p(t.PAUSE, e),
|
|
28
|
-
seek: p(t.SEEK, e),
|
|
29
|
-
setVolume: p(t.SET_VOLUME, e),
|
|
30
|
-
mute: p(t.MUTE, e),
|
|
31
|
-
unmute: p(t.UNMUTE, e),
|
|
32
|
-
toggleMute: p(t.TOGGLE_MUTE, e),
|
|
33
|
-
setDuration: p(t.SET_DURATION, e),
|
|
34
|
-
setCurrentTime: p(t.SET_CURRENT_TIME, e),
|
|
35
|
-
setBuffered: p(t.SET_BUFFERED, e),
|
|
36
|
-
setLoading: p(t.SET_LOADING, e),
|
|
37
|
-
setError: p(t.SET_ERROR, e),
|
|
38
|
-
enterFullscreen: p(t.ENTER_FULLSCREEN, e),
|
|
39
|
-
exitFullscreen: p(t.EXIT_FULLSCREEN, e),
|
|
40
|
-
enterPiP: p(t.ENTER_PIP, e),
|
|
41
|
-
exitPiP: p(t.EXIT_PIP, e),
|
|
42
|
-
setPlaybackRate: p(t.SET_PLAYBACK_RATE, e),
|
|
43
|
-
setSubtitleTrack: p(t.SET_SUBTITLE_TRACK, e),
|
|
44
|
-
setRendition: p(t.SET_RENDITION, e),
|
|
45
|
-
toggleSubtitles: p(t.TOGGLE_SUBTITLES, e),
|
|
46
|
-
previewTime: p(t.PREVIEW_TIME, e),
|
|
47
|
-
clearPreview: p(t.CLEAR_PREVIEW, e)
|
|
48
|
-
}), [e]), r = m(e), i = a.useMemo(() => ({
|
|
49
|
-
togglePlayPause: async (e) => {
|
|
50
|
-
e ? await n.pause(!0) : await n.play(!0);
|
|
51
|
-
},
|
|
52
|
-
seekWithPreview: async (e) => {
|
|
53
|
-
await n.previewTime(e, !0), await n.seek(e, !0);
|
|
54
|
-
},
|
|
55
|
-
adjustVolume: async (e, t) => {
|
|
56
|
-
let r = Math.max(0, Math.min(1, t + e));
|
|
57
|
-
await n.setVolume(r, !0);
|
|
58
|
-
},
|
|
59
|
-
toggleFullscreenOptimistic: async (e) => {
|
|
60
|
-
e ? await n.exitFullscreen(!0) : await n.enterFullscreen(!0);
|
|
61
|
-
}
|
|
62
|
-
}), [n]), o = a.useCallback(async () => {
|
|
63
|
-
let { lastAction: t } = r;
|
|
64
|
-
t && r.error && await e.dispatchOptimistic({
|
|
65
|
-
...t,
|
|
66
|
-
retryCount: (t.retryCount || 0) + 1
|
|
67
|
-
});
|
|
68
|
-
}, [e, r]);
|
|
69
|
-
return {
|
|
70
|
-
...n,
|
|
71
|
-
...i,
|
|
72
|
-
actionState: r,
|
|
73
|
-
retryLastAction: o,
|
|
74
|
-
isLoading: r.pending,
|
|
75
|
-
hasError: !!r.error,
|
|
76
|
-
errorMessage: r.error,
|
|
77
|
-
retryCount: r.retryCount
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/hooks/use-media-optimistic.ts
|
|
82
|
-
function g(e, t) {
|
|
83
|
-
if (!t.optimistic) return e;
|
|
84
|
-
switch (t.type) {
|
|
85
|
-
case "PLAY": return {
|
|
86
|
-
...e,
|
|
87
|
-
isPlaying: !0,
|
|
88
|
-
error: null
|
|
89
|
-
};
|
|
90
|
-
case "PAUSE": return {
|
|
91
|
-
...e,
|
|
92
|
-
isPlaying: !1
|
|
93
|
-
};
|
|
94
|
-
case "SEEK": return {
|
|
95
|
-
...e,
|
|
96
|
-
currentTime: t.detail
|
|
97
|
-
};
|
|
98
|
-
case "SET_VOLUME": return {
|
|
99
|
-
...e,
|
|
100
|
-
volume: Math.max(0, Math.min(1, t.detail))
|
|
101
|
-
};
|
|
102
|
-
case "MUTE": return {
|
|
103
|
-
...e,
|
|
104
|
-
isMuted: !0
|
|
105
|
-
};
|
|
106
|
-
case "UNMUTE": return {
|
|
107
|
-
...e,
|
|
108
|
-
isMuted: !1
|
|
109
|
-
};
|
|
110
|
-
case "TOGGLE_MUTE": return {
|
|
111
|
-
...e,
|
|
112
|
-
isMuted: !e.isMuted
|
|
113
|
-
};
|
|
114
|
-
case "ENTER_FULLSCREEN": return {
|
|
115
|
-
...e,
|
|
116
|
-
isFullscreen: !0
|
|
117
|
-
};
|
|
118
|
-
case "EXIT_FULLSCREEN": return {
|
|
119
|
-
...e,
|
|
120
|
-
isFullscreen: !1
|
|
121
|
-
};
|
|
122
|
-
case "SET_PLAYBACK_RATE": return {
|
|
123
|
-
...e,
|
|
124
|
-
playbackRate: t.detail
|
|
125
|
-
};
|
|
126
|
-
case "TOGGLE_SUBTITLES": return {
|
|
127
|
-
...e,
|
|
128
|
-
subtitlesShowing: !e.subtitlesShowing
|
|
129
|
-
};
|
|
130
|
-
case "PREVIEW_TIME": return {
|
|
131
|
-
...e,
|
|
132
|
-
previewTime: t.detail
|
|
133
|
-
};
|
|
134
|
-
case "CLEAR_PREVIEW": return {
|
|
135
|
-
...e,
|
|
136
|
-
previewTime: null,
|
|
137
|
-
previewImage: null,
|
|
138
|
-
previewCoords: null
|
|
139
|
-
};
|
|
140
|
-
default: return e;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function _(e) {
|
|
144
|
-
let t = a.useSyncExternalStore(e.subscribe, e.getState, e.getState), [n, r] = l(t, g), i = a.useCallback(async (t) => {
|
|
145
|
-
t.optimistic && r(t), await e.dispatchOptimistic(t);
|
|
146
|
-
}, [e, r]), o = a.useMemo(() => ({
|
|
147
|
-
togglePlayPause: async () => {
|
|
148
|
-
await i({
|
|
149
|
-
type: n.isPlaying ? "PAUSE" : "PLAY",
|
|
150
|
-
optimistic: !0,
|
|
151
|
-
timestamp: Date.now()
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
setVolumeOptimistic: async (e) => {
|
|
155
|
-
await i({
|
|
156
|
-
type: "SET_VOLUME",
|
|
157
|
-
detail: Math.max(0, Math.min(1, e)),
|
|
158
|
-
optimistic: !0,
|
|
159
|
-
timestamp: Date.now()
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
seekOptimistic: async (e) => {
|
|
163
|
-
await i({
|
|
164
|
-
type: "SEEK",
|
|
165
|
-
detail: e,
|
|
166
|
-
optimistic: !0,
|
|
167
|
-
timestamp: Date.now()
|
|
168
|
-
});
|
|
169
|
-
},
|
|
170
|
-
toggleMuteOptimistic: async () => {
|
|
171
|
-
await i({
|
|
172
|
-
type: "TOGGLE_MUTE",
|
|
173
|
-
optimistic: !0,
|
|
174
|
-
timestamp: Date.now()
|
|
175
|
-
});
|
|
176
|
-
},
|
|
177
|
-
toggleFullscreenOptimistic: async () => {
|
|
178
|
-
await i({
|
|
179
|
-
type: n.isFullscreen ? "EXIT_FULLSCREEN" : "ENTER_FULLSCREEN",
|
|
180
|
-
optimistic: !0,
|
|
181
|
-
timestamp: Date.now()
|
|
182
|
-
});
|
|
183
|
-
},
|
|
184
|
-
setPlaybackRateOptimistic: async (e) => {
|
|
185
|
-
await i({
|
|
186
|
-
type: "SET_PLAYBACK_RATE",
|
|
187
|
-
detail: e,
|
|
188
|
-
optimistic: !0,
|
|
189
|
-
timestamp: Date.now()
|
|
190
|
-
});
|
|
191
|
-
},
|
|
192
|
-
toggleSubtitlesOptimistic: async () => {
|
|
193
|
-
await i({
|
|
194
|
-
type: "TOGGLE_SUBTITLES",
|
|
195
|
-
optimistic: !0,
|
|
196
|
-
timestamp: Date.now()
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}), [n, i]);
|
|
200
|
-
return {
|
|
201
|
-
state: n,
|
|
202
|
-
actualState: t,
|
|
203
|
-
...a.useMemo(() => ({
|
|
204
|
-
isPlaying: n.isPlaying,
|
|
205
|
-
currentTime: n.currentTime,
|
|
206
|
-
volume: n.volume,
|
|
207
|
-
isMuted: n.isMuted,
|
|
208
|
-
isFullscreen: n.isFullscreen,
|
|
209
|
-
playbackRate: n.playbackRate,
|
|
210
|
-
subtitlesShowing: n.subtitlesShowing,
|
|
211
|
-
previewTime: n.previewTime,
|
|
212
|
-
progress: n.duration > 0 ? n.currentTime / n.duration : 0,
|
|
213
|
-
formattedTime: v(n.currentTime),
|
|
214
|
-
formattedDuration: v(n.duration),
|
|
215
|
-
canPlay: !n.isLoading && !n.error,
|
|
216
|
-
hasError: !!n.error,
|
|
217
|
-
isBuffering: n.isLoading
|
|
218
|
-
}), [n]),
|
|
219
|
-
...o,
|
|
220
|
-
dispatchOptimistic: i
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
function v(e) {
|
|
224
|
-
if (!e || !isFinite(e)) return "0:00";
|
|
225
|
-
let t = Math.floor(e / 60), n = Math.floor(e % 60), r = Math.floor(t / 60);
|
|
226
|
-
return r > 0 ? `${r}:${String(t % 60).padStart(2, "0")}:${String(n).padStart(2, "0")}` : `${t}:${String(n).padStart(2, "0")}`;
|
|
227
|
-
}
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/hooks/use-enhanced-media-player.ts
|
|
230
|
-
function y(e, t) {
|
|
231
|
-
if (!Number.isFinite(t)) return console.warn(`Attempted to set non-finite currentTime: ${t}`), !1;
|
|
232
|
-
if (t < 0) return console.warn(`Attempted to set negative currentTime: ${t}`), !1;
|
|
233
|
-
try {
|
|
234
|
-
return e.currentTime = t, !0;
|
|
235
|
-
} catch (e) {
|
|
236
|
-
return console.error(`Failed to set currentTime to ${t}:`, e), !1;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function b(e) {
|
|
240
|
-
let t = u(null), i = u(null), [d, p] = f(), [m, g] = f();
|
|
241
|
-
a.useRef(0);
|
|
242
|
-
let v = a.useRef(0), b = a.useRef(0);
|
|
243
|
-
u(void 0);
|
|
244
|
-
let x = u(0), S = r(), C = "getOptimisticState" in S, w = n((e) => e.isPlaying), T = n((e) => e.currentTime), E = n((e) => e.duration), D = n((e) => e.volume), O = n((e) => e.isMuted), k = n((e) => e.isLoading), A = n((e) => e.isBuffering), j = n((e) => e.error), M = n((e) => e.buffered), N = n((e) => e.isFullscreen), P = S, F = _(P), I = h(P), [L, R] = a.useState({
|
|
245
|
-
frameRate: 0,
|
|
246
|
-
averageRenderTime: 0,
|
|
247
|
-
droppedFrames: 0,
|
|
248
|
-
bufferHealth: 0
|
|
249
|
-
}), [z, B] = l(D, (e, t) => Math.max(0, Math.min(1, t))), [V, H] = l(T, (e, t) => Math.max(0, Math.min(E || 0, t)));
|
|
250
|
-
s(() => {
|
|
251
|
-
let n = t.current;
|
|
252
|
-
n && (Object.entries({
|
|
253
|
-
volume: e.volume,
|
|
254
|
-
muted: e.muted,
|
|
255
|
-
autoplay: e.autoPlay,
|
|
256
|
-
loop: e.loop,
|
|
257
|
-
preload: e.preload,
|
|
258
|
-
crossOrigin: e.crossOrigin
|
|
259
|
-
}).forEach(([e, t]) => {
|
|
260
|
-
t !== void 0 && (n[e] = t);
|
|
261
|
-
}), n.setAttribute("preload", e.preloadStrategy === "eager" ? "auto" : "metadata"), e.bufferingStrategy === "aggressive" && n.setAttribute("buffered", "auto"), n instanceof HTMLVideoElement && (n.style.willChange = "transform", n.style.transform = "translateZ(0)"));
|
|
262
|
-
}, [
|
|
263
|
-
e.volume,
|
|
264
|
-
e.muted,
|
|
265
|
-
e.autoPlay,
|
|
266
|
-
e.loop,
|
|
267
|
-
e.preload,
|
|
268
|
-
e.crossOrigin,
|
|
269
|
-
e.preloadStrategy,
|
|
270
|
-
e.bufferingStrategy
|
|
271
|
-
]);
|
|
272
|
-
let U = o(() => {
|
|
273
|
-
let n = t.current;
|
|
274
|
-
if (!n) return;
|
|
275
|
-
let r = performance.now();
|
|
276
|
-
if (e.enableTimeUpdateThrottling !== !1) {
|
|
277
|
-
if (r - x.current < (e.timeUpdateThrottleMs || 100)) return;
|
|
278
|
-
x.current = r;
|
|
279
|
-
}
|
|
280
|
-
p(() => {
|
|
281
|
-
C && I && I.setCurrentTime(n.currentTime);
|
|
282
|
-
});
|
|
283
|
-
}, [
|
|
284
|
-
e.enableTimeUpdateThrottling,
|
|
285
|
-
e.timeUpdateThrottleMs,
|
|
286
|
-
C,
|
|
287
|
-
I
|
|
288
|
-
]), W = o(() => {
|
|
289
|
-
p(() => {
|
|
290
|
-
C && I && I.play(!0);
|
|
291
|
-
}), e.onPlay?.();
|
|
292
|
-
}, [
|
|
293
|
-
C,
|
|
294
|
-
I,
|
|
295
|
-
e.onPlay
|
|
296
|
-
]), G = o(() => {
|
|
297
|
-
p(() => {
|
|
298
|
-
C && I && I.pause(!0);
|
|
299
|
-
}), e.onPause?.();
|
|
300
|
-
}, [
|
|
301
|
-
C,
|
|
302
|
-
I,
|
|
303
|
-
e.onPause
|
|
304
|
-
]), K = o(() => {
|
|
305
|
-
let e = t.current;
|
|
306
|
-
e && p(() => {
|
|
307
|
-
C && I && (I.setVolume(e.volume, !0), e.muted ? I.mute(!0) : I.unmute(!0));
|
|
308
|
-
});
|
|
309
|
-
}, [C, I]), q = o(() => {
|
|
310
|
-
g(() => {});
|
|
311
|
-
}, []), J = o(() => {}, []), Y = o(() => {
|
|
312
|
-
let e = t.current;
|
|
313
|
-
e && p(() => {
|
|
314
|
-
C && I && I.setBuffered(e.buffered);
|
|
315
|
-
});
|
|
316
|
-
}, [C, I]), X = o(() => {
|
|
317
|
-
let e = performance.now();
|
|
318
|
-
if (e - b.current > 0 && (v.current++, v.current >= 60)) {
|
|
319
|
-
let t = Math.round(v.current * 1e3 / (e - b.current));
|
|
320
|
-
R((e) => ({
|
|
321
|
-
...e,
|
|
322
|
-
frameRate: t,
|
|
323
|
-
droppedFrames: Math.max(0, 60 - t)
|
|
324
|
-
})), v.current = 0, b.current = e;
|
|
325
|
-
}
|
|
326
|
-
}, []);
|
|
327
|
-
s(() => {
|
|
328
|
-
let n = t.current;
|
|
329
|
-
if (!n) return;
|
|
330
|
-
let r = [
|
|
331
|
-
{
|
|
332
|
-
event: "timeupdate",
|
|
333
|
-
handler: U,
|
|
334
|
-
passive: !0
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
event: "play",
|
|
338
|
-
handler: W
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
event: "pause",
|
|
342
|
-
handler: G
|
|
343
|
-
},
|
|
344
|
-
{
|
|
345
|
-
event: "volumechange",
|
|
346
|
-
handler: K
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
event: "seeking",
|
|
350
|
-
handler: q
|
|
351
|
-
},
|
|
352
|
-
{
|
|
353
|
-
event: "seeked",
|
|
354
|
-
handler: J
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
event: "progress",
|
|
358
|
-
handler: Y,
|
|
359
|
-
passive: !0
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
event: "loadedmetadata",
|
|
363
|
-
handler: () => X()
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
event: "loadeddata",
|
|
367
|
-
handler: () => X()
|
|
368
|
-
}
|
|
369
|
-
];
|
|
370
|
-
r.forEach(({ event: e, handler: t, passive: r }) => {
|
|
371
|
-
n.addEventListener(e, t, r ? { passive: !0 } : {});
|
|
372
|
-
});
|
|
373
|
-
let i, a = () => {
|
|
374
|
-
X(), i = requestAnimationFrame(a);
|
|
375
|
-
};
|
|
376
|
-
return e.enablePerformanceMonitoring && a(), () => {
|
|
377
|
-
r.forEach(({ event: e, handler: t }) => {
|
|
378
|
-
n.removeEventListener(e, t);
|
|
379
|
-
}), i && cancelAnimationFrame(i);
|
|
380
|
-
};
|
|
381
|
-
}, [
|
|
382
|
-
U,
|
|
383
|
-
W,
|
|
384
|
-
G,
|
|
385
|
-
K,
|
|
386
|
-
q,
|
|
387
|
-
J,
|
|
388
|
-
Y,
|
|
389
|
-
X,
|
|
390
|
-
e.enablePerformanceMonitoring
|
|
391
|
-
]);
|
|
392
|
-
let Z = c(() => {
|
|
393
|
-
let e = async () => {
|
|
394
|
-
let e = t.current;
|
|
395
|
-
if (e) if (C && I) await I.play(!0);
|
|
396
|
-
else try {
|
|
397
|
-
await e.play();
|
|
398
|
-
} catch (e) {
|
|
399
|
-
console.error("Failed to play media:", e);
|
|
400
|
-
}
|
|
401
|
-
}, n = () => {
|
|
402
|
-
let e = t.current;
|
|
403
|
-
e && (C && I ? I.pause(!0) : e.pause());
|
|
404
|
-
}, r = () => {
|
|
405
|
-
w ? n() : e();
|
|
406
|
-
}, a = (e) => {
|
|
407
|
-
let n = t.current;
|
|
408
|
-
if (!n) return;
|
|
409
|
-
let r = Number.isFinite(E) && E > 0 ? E : Number.isFinite(n.duration) ? n.duration : 0;
|
|
410
|
-
if (r === 0) {
|
|
411
|
-
console.warn("Cannot seek: duration is not available");
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
let i = Math.max(0, Math.min(e, r));
|
|
415
|
-
if (!Number.isFinite(i)) {
|
|
416
|
-
console.warn(`Computed non-finite seek time: ${i}`);
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
C && I ? g(() => {
|
|
420
|
-
I.seek(i, !0);
|
|
421
|
-
}) : y(n, i);
|
|
422
|
-
}, o = (e) => {
|
|
423
|
-
let n = t.current;
|
|
424
|
-
if (!n) return;
|
|
425
|
-
let r = Math.max(0, Math.min(1, e));
|
|
426
|
-
C && I ? (B(r), p(() => {
|
|
427
|
-
I.setVolume(r, !0);
|
|
428
|
-
})) : n.volume = r;
|
|
429
|
-
}, s = () => {
|
|
430
|
-
let e = t.current;
|
|
431
|
-
e && (C && I ? I.toggleMute(!0) : e.muted = !e.muted);
|
|
432
|
-
}, c = async () => {
|
|
433
|
-
let e = i.current;
|
|
434
|
-
if (!(!e || !document.fullscreenEnabled)) try {
|
|
435
|
-
await e.requestFullscreen(), C && I && I.enterFullscreen(!0);
|
|
436
|
-
} catch (e) {
|
|
437
|
-
console.error("Failed to enter fullscreen:", e);
|
|
438
|
-
}
|
|
439
|
-
}, l = async () => {
|
|
440
|
-
if (document.fullscreenElement) try {
|
|
441
|
-
await document.exitFullscreen(), C && I && I.exitFullscreen(!0);
|
|
442
|
-
} catch (e) {
|
|
443
|
-
console.error("Failed to exit fullscreen:", e);
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
return {
|
|
447
|
-
play: e,
|
|
448
|
-
pause: n,
|
|
449
|
-
toggle: r,
|
|
450
|
-
seek: a,
|
|
451
|
-
setCurrentTime: (e) => {
|
|
452
|
-
let n = t.current;
|
|
453
|
-
if (!n) return;
|
|
454
|
-
let r = Number.isFinite(E) && E > 0 ? E : Number.isFinite(n.duration) ? n.duration : 0;
|
|
455
|
-
if (r === 0) {
|
|
456
|
-
console.warn("Cannot set currentTime: duration is not available");
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
let i = Math.max(0, Math.min(e, r));
|
|
460
|
-
if (!Number.isFinite(i)) {
|
|
461
|
-
console.warn(`Computed non-finite currentTime: ${i}`);
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
y(n, i);
|
|
465
|
-
},
|
|
466
|
-
setVolume: o,
|
|
467
|
-
mute: () => {
|
|
468
|
-
let e = t.current;
|
|
469
|
-
e && (C && I ? I.mute(!0) : e.muted = !0);
|
|
470
|
-
},
|
|
471
|
-
unmute: () => {
|
|
472
|
-
let e = t.current;
|
|
473
|
-
e && (C && I ? I.unmute(!0) : e.muted = !1);
|
|
474
|
-
},
|
|
475
|
-
toggleMute: s,
|
|
476
|
-
enterFullscreen: c,
|
|
477
|
-
exitFullscreen: l,
|
|
478
|
-
toggleFullscreen: async () => {
|
|
479
|
-
N ? await l() : await c();
|
|
480
|
-
}
|
|
481
|
-
};
|
|
482
|
-
}, [
|
|
483
|
-
w,
|
|
484
|
-
N,
|
|
485
|
-
E,
|
|
486
|
-
C,
|
|
487
|
-
I,
|
|
488
|
-
p,
|
|
489
|
-
g,
|
|
490
|
-
B
|
|
491
|
-
]);
|
|
492
|
-
return {
|
|
493
|
-
mediaRef: t,
|
|
494
|
-
containerRef: i,
|
|
495
|
-
state: c(() => ({
|
|
496
|
-
isPlaying: F?.isPlaying ?? w,
|
|
497
|
-
currentTime: F?.currentTime ?? T,
|
|
498
|
-
duration: F?.actualState?.duration ?? E,
|
|
499
|
-
volume: F?.volume ?? z,
|
|
500
|
-
isMuted: F?.isMuted ?? O,
|
|
501
|
-
isLoading: F?.isBuffering ?? k,
|
|
502
|
-
isBuffering: F?.isBuffering ?? A,
|
|
503
|
-
error: F?.actualState?.error ?? j,
|
|
504
|
-
buffered: F?.actualState?.buffered ?? M,
|
|
505
|
-
isFullscreen: F?.isFullscreen ?? N,
|
|
506
|
-
progress: E > 0 ? T / E : 0,
|
|
507
|
-
isTransitioning: d || m,
|
|
508
|
-
canPlay: !k && !A && !j
|
|
509
|
-
}), [
|
|
510
|
-
F,
|
|
511
|
-
w,
|
|
512
|
-
T,
|
|
513
|
-
E,
|
|
514
|
-
z,
|
|
515
|
-
O,
|
|
516
|
-
k,
|
|
517
|
-
A,
|
|
518
|
-
j,
|
|
519
|
-
M,
|
|
520
|
-
N,
|
|
521
|
-
d,
|
|
522
|
-
m
|
|
523
|
-
]),
|
|
524
|
-
actualState: F?.actualState,
|
|
525
|
-
controls: Z,
|
|
526
|
-
performanceMetrics: L,
|
|
527
|
-
isTransitioning: d || m,
|
|
528
|
-
actions: F,
|
|
529
|
-
actionState: F,
|
|
530
|
-
optimisticState: F,
|
|
531
|
-
isEnhanced: C
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
//#endregion
|
|
535
|
-
//#region src/hooks/use-keyboard-controls.ts
|
|
536
|
-
var x = /* @__PURE__ */ e({ useKeyboardControls: () => S });
|
|
537
|
-
function S({ enabled: e = !0, state: t, controls: n, seekStep: r = 10, volumeStep: i = .1 }) {
|
|
538
|
-
let a = (a) => {
|
|
539
|
-
if (!e) return;
|
|
540
|
-
let o = a.target;
|
|
541
|
-
if (!(o.tagName === "INPUT" || o.tagName === "TEXTAREA" || o.contentEditable === "true")) switch (a.code) {
|
|
542
|
-
case "Space":
|
|
543
|
-
case "KeyK":
|
|
544
|
-
a.preventDefault(), n.toggle();
|
|
545
|
-
break;
|
|
546
|
-
case "KeyM":
|
|
547
|
-
a.preventDefault(), n.toggleMute();
|
|
548
|
-
break;
|
|
549
|
-
case "KeyF":
|
|
550
|
-
a.preventDefault(), n.toggleFullscreen();
|
|
551
|
-
break;
|
|
552
|
-
case "ArrowLeft":
|
|
553
|
-
a.preventDefault(), n.seek(Math.max(0, t.currentTime - r));
|
|
554
|
-
break;
|
|
555
|
-
case "ArrowRight":
|
|
556
|
-
a.preventDefault(), n.seek(Math.min(t.duration, t.currentTime + r));
|
|
557
|
-
break;
|
|
558
|
-
case "ArrowUp":
|
|
559
|
-
a.preventDefault(), n.setVolume(Math.min(1, t.volume + i));
|
|
560
|
-
break;
|
|
561
|
-
case "ArrowDown":
|
|
562
|
-
a.preventDefault(), n.setVolume(Math.max(0, t.volume - i));
|
|
563
|
-
break;
|
|
564
|
-
case "Digit0":
|
|
565
|
-
case "Digit1":
|
|
566
|
-
case "Digit2":
|
|
567
|
-
case "Digit3":
|
|
568
|
-
case "Digit4":
|
|
569
|
-
case "Digit5":
|
|
570
|
-
case "Digit6":
|
|
571
|
-
case "Digit7":
|
|
572
|
-
case "Digit8":
|
|
573
|
-
case "Digit9":
|
|
574
|
-
a.preventDefault();
|
|
575
|
-
let e = parseInt(a.code.replace("Digit", ""), 10) / 10;
|
|
576
|
-
n.seek(t.duration * e);
|
|
577
|
-
break;
|
|
578
|
-
case "Home":
|
|
579
|
-
a.preventDefault(), n.seek(0);
|
|
580
|
-
break;
|
|
581
|
-
case "End":
|
|
582
|
-
a.preventDefault(), n.seek(t.duration);
|
|
583
|
-
break;
|
|
584
|
-
default: break;
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
return s(() => {
|
|
588
|
-
if (e) return document.addEventListener("keydown", a), () => {
|
|
589
|
-
document.removeEventListener("keydown", a);
|
|
590
|
-
};
|
|
591
|
-
}, [e, a]), { handleKeyDown: a };
|
|
592
|
-
}
|
|
593
|
-
//#endregion
|
|
594
|
-
//#region src/hooks/use-memory-optimization.ts
|
|
595
|
-
function C(e = {}) {
|
|
596
|
-
let { maxMemoryUsage: t = 100, cleanupInterval: n = 3e4, enableGC: r = !0, monitorMemory: i = !0 } = e;
|
|
597
|
-
u(void 0);
|
|
598
|
-
let c = u(/* @__PURE__ */ new Set()), l = u(/* @__PURE__ */ new Map()), d = u(/* @__PURE__ */ new Set()), f = u(/* @__PURE__ */ new Set()), p = o(() => {
|
|
599
|
-
if (typeof window > "u" || !("memory" in performance)) return {
|
|
600
|
-
used: 0,
|
|
601
|
-
total: 0,
|
|
602
|
-
limit: 0
|
|
603
|
-
};
|
|
604
|
-
let e = performance.memory;
|
|
605
|
-
return {
|
|
606
|
-
used: e.usedJSHeapSize,
|
|
607
|
-
total: e.totalJSHeapSize,
|
|
608
|
-
limit: e.jsHeapSizeLimit
|
|
609
|
-
};
|
|
610
|
-
}, []), [m, h] = a.useState({
|
|
611
|
-
used: 0,
|
|
612
|
-
total: 0,
|
|
613
|
-
limit: 0,
|
|
614
|
-
usage: 0,
|
|
615
|
-
isHighUsage: !1
|
|
616
|
-
}), g = o(() => {
|
|
617
|
-
d.current.forEach((e) => {
|
|
618
|
-
clearTimeout(e);
|
|
619
|
-
}), d.current.clear(), f.current.forEach((e) => {
|
|
620
|
-
cancelAnimationFrame(e);
|
|
621
|
-
}), f.current.clear(), c.current.forEach((e) => {
|
|
622
|
-
e.disconnect();
|
|
623
|
-
}), c.current.clear(), l.current.forEach((e, t) => {
|
|
624
|
-
e.forEach(({ event: e, handler: n }) => {
|
|
625
|
-
t.removeEventListener(e, n);
|
|
626
|
-
});
|
|
627
|
-
}), l.current.clear(), typeof window < "u" && "gc" in window && window.gc();
|
|
628
|
-
}, []), _ = o((e, t) => {
|
|
629
|
-
let n = globalThis.setInterval(e, t);
|
|
630
|
-
return d.current.add(n), () => {
|
|
631
|
-
globalThis.clearInterval(n), d.current.delete(n);
|
|
632
|
-
};
|
|
633
|
-
}, []);
|
|
634
|
-
s(() => {
|
|
635
|
-
if (!i) return;
|
|
636
|
-
let e = () => {
|
|
637
|
-
let e = p(), n = e.used / 1024 / 1024, i = n > t;
|
|
638
|
-
h({
|
|
639
|
-
...e,
|
|
640
|
-
usage: n,
|
|
641
|
-
isHighUsage: i
|
|
642
|
-
}), i && r && g();
|
|
643
|
-
};
|
|
644
|
-
return e(), _(e, n);
|
|
645
|
-
}, [
|
|
646
|
-
i,
|
|
647
|
-
p,
|
|
648
|
-
t,
|
|
649
|
-
r,
|
|
650
|
-
n,
|
|
651
|
-
g
|
|
652
|
-
]);
|
|
653
|
-
let v = o((e, t, n, r) => (e.addEventListener(t, n, r), l.current.has(e) || l.current.set(e, []), l.current.get(e).push({
|
|
654
|
-
event: t,
|
|
655
|
-
handler: n
|
|
656
|
-
}), () => {
|
|
657
|
-
e.removeEventListener(t, n);
|
|
658
|
-
let r = l.current.get(e);
|
|
659
|
-
if (r) {
|
|
660
|
-
let i = r.findIndex((e) => e.event === t && e.handler === n);
|
|
661
|
-
i > -1 && r.splice(i, 1), r.length === 0 && l.current.delete(e);
|
|
662
|
-
}
|
|
663
|
-
}), []), y = o((e, t) => {
|
|
664
|
-
let n = globalThis.setTimeout(e, t);
|
|
665
|
-
return d.current.add(n), () => {
|
|
666
|
-
globalThis.clearTimeout(n), d.current.delete(n);
|
|
667
|
-
};
|
|
668
|
-
}, []), b = o((e) => {
|
|
669
|
-
let t = globalThis.requestAnimationFrame(e);
|
|
670
|
-
return f.current.add(t), () => {
|
|
671
|
-
globalThis.cancelAnimationFrame(t), f.current.delete(t);
|
|
672
|
-
};
|
|
673
|
-
}, []), x = o((e) => (c.current.add(e), () => {
|
|
674
|
-
e.disconnect(), c.current.delete(e);
|
|
675
|
-
}), []);
|
|
676
|
-
return s(() => () => {
|
|
677
|
-
g();
|
|
678
|
-
}, [g]), {
|
|
679
|
-
memoryStats: m,
|
|
680
|
-
getMemoryUsage: p,
|
|
681
|
-
performCleanup: g,
|
|
682
|
-
addEventListener: v,
|
|
683
|
-
setInterval: _,
|
|
684
|
-
setTimeout: y,
|
|
685
|
-
requestAnimationFrame: b,
|
|
686
|
-
addObserver: x,
|
|
687
|
-
formatBytes: (e) => {
|
|
688
|
-
if (e === 0) return "0 Bytes";
|
|
689
|
-
let t = 1024, n = [
|
|
690
|
-
"Bytes",
|
|
691
|
-
"KB",
|
|
692
|
-
"MB",
|
|
693
|
-
"GB"
|
|
694
|
-
], r = Math.floor(Math.log(e) / Math.log(t));
|
|
695
|
-
return parseFloat((e / t ** r).toFixed(2)) + " " + n[r];
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
//#endregion
|
|
700
|
-
//#region src/hooks/use-media-state.ts
|
|
701
|
-
function w() {
|
|
702
|
-
let [e, t] = d({
|
|
703
|
-
isPlaying: !1,
|
|
704
|
-
currentTime: 0,
|
|
705
|
-
duration: 0,
|
|
706
|
-
volume: 1,
|
|
707
|
-
isMuted: !1,
|
|
708
|
-
isLoading: !1,
|
|
709
|
-
isFullscreen: !1,
|
|
710
|
-
error: null,
|
|
711
|
-
buffered: null
|
|
712
|
-
}), n = (e) => {
|
|
713
|
-
t((t) => ({
|
|
714
|
-
...t,
|
|
715
|
-
...e
|
|
716
|
-
}));
|
|
717
|
-
};
|
|
718
|
-
return {
|
|
719
|
-
state: e,
|
|
720
|
-
updateState: n,
|
|
721
|
-
setPlaying: (e) => {
|
|
722
|
-
n({ isPlaying: e });
|
|
723
|
-
},
|
|
724
|
-
setCurrentTime: (e) => {
|
|
725
|
-
n({ currentTime: e });
|
|
726
|
-
},
|
|
727
|
-
setDuration: (e) => {
|
|
728
|
-
n({ duration: e });
|
|
729
|
-
},
|
|
730
|
-
setVolume: (e) => {
|
|
731
|
-
n({ volume: Math.max(0, Math.min(1, e)) });
|
|
732
|
-
},
|
|
733
|
-
setMuted: (e) => {
|
|
734
|
-
n({ isMuted: e });
|
|
735
|
-
},
|
|
736
|
-
setLoading: (e) => {
|
|
737
|
-
n({ isLoading: e });
|
|
738
|
-
},
|
|
739
|
-
setFullscreen: (e) => {
|
|
740
|
-
n({ isFullscreen: e });
|
|
741
|
-
},
|
|
742
|
-
setError: (e) => {
|
|
743
|
-
n({ error: e });
|
|
744
|
-
},
|
|
745
|
-
setBuffered: (e) => {
|
|
746
|
-
n({ buffered: e });
|
|
747
|
-
}
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
//#endregion
|
|
751
|
-
//#region src/hooks/use-media-player.ts
|
|
752
|
-
function T(e, t) {
|
|
753
|
-
if (!Number.isFinite(t)) return console.warn(`Attempted to set non-finite currentTime: ${t}`), !1;
|
|
754
|
-
if (t < 0) return console.warn(`Attempted to set negative currentTime: ${t}`), !1;
|
|
755
|
-
try {
|
|
756
|
-
return e.currentTime = t, !0;
|
|
757
|
-
} catch (e) {
|
|
758
|
-
return console.error(`Failed to set currentTime to ${t}:`, e), !1;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
function E(e) {
|
|
762
|
-
let t = u(null), n = u(null), { state: r, setPlaying: i, setCurrentTime: a, setDuration: c, setVolume: l, setMuted: d, setLoading: f, setFullscreen: p, setError: m, setBuffered: h } = w();
|
|
763
|
-
s(() => {
|
|
764
|
-
let n = t.current;
|
|
765
|
-
n && (e.volume !== void 0 && (n.volume = e.volume, l(e.volume)), e.muted !== void 0 && (n.muted = e.muted, d(e.muted)), e.autoPlay !== void 0 && (n.autoplay = e.autoPlay), e.loop !== void 0 && (n.loop = e.loop), e.preload !== void 0 && (n.preload = e.preload), e.crossOrigin !== void 0 && (n.crossOrigin = e.crossOrigin));
|
|
766
|
-
}, [
|
|
767
|
-
e,
|
|
768
|
-
l,
|
|
769
|
-
d
|
|
770
|
-
]);
|
|
771
|
-
let g = o(() => {
|
|
772
|
-
i(!0), e.onPlay?.();
|
|
773
|
-
}, [i, e]), _ = o(() => {
|
|
774
|
-
i(!1), e.onPause?.();
|
|
775
|
-
}, [i, e]), v = o(() => {
|
|
776
|
-
let n = t.current;
|
|
777
|
-
n && (a(n.currentTime), e.onTimeUpdate?.(n.currentTime));
|
|
778
|
-
}, [a, e]), y = o(() => {
|
|
779
|
-
let n = t.current;
|
|
780
|
-
n && (c(n.duration), e.onDurationChange?.(n.duration));
|
|
781
|
-
}, [c, e]), b = o(() => {
|
|
782
|
-
let n = t.current;
|
|
783
|
-
n && (l(n.volume), d(n.muted), e.onVolumeChange?.(n.volume));
|
|
784
|
-
}, [
|
|
785
|
-
l,
|
|
786
|
-
d,
|
|
787
|
-
e
|
|
788
|
-
]), x = o(() => {
|
|
789
|
-
f(!0), m(null), e.onLoadStart?.();
|
|
790
|
-
}, [
|
|
791
|
-
f,
|
|
792
|
-
m,
|
|
793
|
-
e
|
|
794
|
-
]), S = o(() => {
|
|
795
|
-
f(!1), e.onLoadedData?.();
|
|
796
|
-
}, [f, e]), C = o(() => {
|
|
797
|
-
let n = t.current;
|
|
798
|
-
if (!n) return;
|
|
799
|
-
let r = n.error?.message || "An error occurred while loading the media";
|
|
800
|
-
m(r), f(!1), e.onError?.(r);
|
|
801
|
-
}, [
|
|
802
|
-
m,
|
|
803
|
-
f,
|
|
804
|
-
e
|
|
805
|
-
]), E = o(() => {
|
|
806
|
-
i(!1), e.onEnded?.();
|
|
807
|
-
}, [i, e]), D = o(() => {
|
|
808
|
-
let e = t.current;
|
|
809
|
-
e && h(e.buffered);
|
|
810
|
-
}, [h]);
|
|
811
|
-
s(() => {
|
|
812
|
-
let e = t.current;
|
|
813
|
-
if (e) return e.addEventListener("play", g), e.addEventListener("pause", _), e.addEventListener("timeupdate", v), e.addEventListener("durationchange", y), e.addEventListener("volumechange", b), e.addEventListener("loadstart", x), e.addEventListener("loadeddata", S), e.addEventListener("error", C), e.addEventListener("ended", E), e.addEventListener("progress", D), () => {
|
|
814
|
-
e.removeEventListener("play", g), e.removeEventListener("pause", _), e.removeEventListener("timeupdate", v), e.removeEventListener("durationchange", y), e.removeEventListener("volumechange", b), e.removeEventListener("loadstart", x), e.removeEventListener("loadeddata", S), e.removeEventListener("error", C), e.removeEventListener("ended", E), e.removeEventListener("progress", D);
|
|
815
|
-
};
|
|
816
|
-
}, [
|
|
817
|
-
g,
|
|
818
|
-
_,
|
|
819
|
-
v,
|
|
820
|
-
y,
|
|
821
|
-
b,
|
|
822
|
-
x,
|
|
823
|
-
S,
|
|
824
|
-
C,
|
|
825
|
-
E,
|
|
826
|
-
D
|
|
827
|
-
]);
|
|
828
|
-
let O = o(async () => {
|
|
829
|
-
let e = t.current;
|
|
830
|
-
if (e) try {
|
|
831
|
-
await e.play();
|
|
832
|
-
} catch (e) {
|
|
833
|
-
console.error("Failed to play media:", e), m("Failed to play media");
|
|
834
|
-
}
|
|
835
|
-
}, [m]), k = o(() => {
|
|
836
|
-
let e = t.current;
|
|
837
|
-
e && e.pause();
|
|
838
|
-
}, []), A = o(() => {
|
|
839
|
-
r.isPlaying ? k() : O();
|
|
840
|
-
}, [
|
|
841
|
-
r.isPlaying,
|
|
842
|
-
k,
|
|
843
|
-
O
|
|
844
|
-
]), j = o((e) => {
|
|
845
|
-
let n = t.current;
|
|
846
|
-
if (!n) return;
|
|
847
|
-
let r = Number.isFinite(n.duration) ? n.duration : 0;
|
|
848
|
-
if (r === 0) {
|
|
849
|
-
console.warn("Cannot seek: duration is not available");
|
|
850
|
-
return;
|
|
851
|
-
}
|
|
852
|
-
T(n, Math.max(0, Math.min(e, r)));
|
|
853
|
-
}, []), M = o((e) => {
|
|
854
|
-
let n = t.current;
|
|
855
|
-
n && (n.volume = Math.max(0, Math.min(1, e)));
|
|
856
|
-
}, []), N = o(() => {
|
|
857
|
-
let e = t.current;
|
|
858
|
-
e && (e.muted = !0);
|
|
859
|
-
}, []), P = o(() => {
|
|
860
|
-
let e = t.current;
|
|
861
|
-
e && (e.muted = !1);
|
|
862
|
-
}, []), F = o(() => {
|
|
863
|
-
let e = t.current;
|
|
864
|
-
e && (e.muted = !e.muted);
|
|
865
|
-
}, []), I = o(async () => {
|
|
866
|
-
let e = n.current;
|
|
867
|
-
if (!(!e || !document.fullscreenEnabled)) try {
|
|
868
|
-
await e.requestFullscreen(), p(!0);
|
|
869
|
-
} catch (e) {
|
|
870
|
-
console.error("Failed to enter fullscreen:", e);
|
|
871
|
-
}
|
|
872
|
-
}, [p]), L = o(async () => {
|
|
873
|
-
if (document.fullscreenElement) try {
|
|
874
|
-
await document.exitFullscreen(), p(!1);
|
|
875
|
-
} catch (e) {
|
|
876
|
-
console.error("Failed to exit fullscreen:", e);
|
|
877
|
-
}
|
|
878
|
-
}, [p]), R = o(() => {
|
|
879
|
-
document.fullscreenElement ? L() : I();
|
|
880
|
-
}, [L, I]);
|
|
881
|
-
return s(() => {
|
|
882
|
-
let e = () => {
|
|
883
|
-
p(!!document.fullscreenElement);
|
|
884
|
-
};
|
|
885
|
-
return document.addEventListener("fullscreenchange", e), () => {
|
|
886
|
-
document.removeEventListener("fullscreenchange", e);
|
|
887
|
-
};
|
|
888
|
-
}, [p]), {
|
|
889
|
-
state: r,
|
|
890
|
-
controls: {
|
|
891
|
-
play: O,
|
|
892
|
-
pause: k,
|
|
893
|
-
toggle: A,
|
|
894
|
-
seek: j,
|
|
895
|
-
setCurrentTime: j,
|
|
896
|
-
setVolume: M,
|
|
897
|
-
mute: N,
|
|
898
|
-
unmute: P,
|
|
899
|
-
toggleMute: F,
|
|
900
|
-
enterFullscreen: I,
|
|
901
|
-
exitFullscreen: L,
|
|
902
|
-
toggleFullscreen: R
|
|
903
|
-
},
|
|
904
|
-
mediaRef: t,
|
|
905
|
-
containerRef: n
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
//#endregion
|
|
909
|
-
//#region ../ui/src/hooks/use-mobile.ts
|
|
910
|
-
var D = {
|
|
911
|
-
mobile: 768,
|
|
912
|
-
tablet: 1024,
|
|
913
|
-
desktop: 1280
|
|
914
|
-
};
|
|
915
|
-
function O() {
|
|
916
|
-
if (typeof window > "u") return "unknown";
|
|
917
|
-
let e = window.navigator.userAgent.toLowerCase();
|
|
918
|
-
return /iphone|ipad|ipod/.test(e) ? "ios" : /android/.test(e) ? "android" : /windows|mac|linux/.test(e) ? "desktop" : "unknown";
|
|
919
|
-
}
|
|
920
|
-
function k() {
|
|
921
|
-
return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
922
|
-
}
|
|
923
|
-
function A() {
|
|
924
|
-
return typeof window > "u" ? !1 : "vibrate" in navigator || "vibration" in navigator || "ondevicemotion" in window;
|
|
925
|
-
}
|
|
926
|
-
function j() {
|
|
927
|
-
let [e, t] = i.useState(() => {
|
|
928
|
-
if (typeof window > "u") return {
|
|
929
|
-
isMobile: !1,
|
|
930
|
-
isTablet: !1,
|
|
931
|
-
isDesktop: !0,
|
|
932
|
-
isTouchDevice: !1,
|
|
933
|
-
platform: "unknown",
|
|
934
|
-
supportsHaptics: !1,
|
|
935
|
-
screenSize: {
|
|
936
|
-
width: 1920,
|
|
937
|
-
height: 1080
|
|
938
|
-
},
|
|
939
|
-
orientation: "landscape"
|
|
940
|
-
};
|
|
941
|
-
let e = window.innerWidth, t = window.innerHeight;
|
|
942
|
-
return {
|
|
943
|
-
isMobile: e < D.mobile,
|
|
944
|
-
isTablet: e >= D.mobile && e < D.desktop,
|
|
945
|
-
isDesktop: e >= D.desktop,
|
|
946
|
-
isTouchDevice: k(),
|
|
947
|
-
platform: O(),
|
|
948
|
-
supportsHaptics: A(),
|
|
949
|
-
screenSize: {
|
|
950
|
-
width: e,
|
|
951
|
-
height: t
|
|
952
|
-
},
|
|
953
|
-
orientation: e > t ? "landscape" : "portrait"
|
|
954
|
-
};
|
|
955
|
-
});
|
|
956
|
-
return i.useEffect(() => {
|
|
957
|
-
let e = () => {
|
|
958
|
-
let e = window.innerWidth, n = window.innerHeight;
|
|
959
|
-
t({
|
|
960
|
-
isMobile: e < D.mobile,
|
|
961
|
-
isTablet: e >= D.mobile && e < D.desktop,
|
|
962
|
-
isDesktop: e >= D.desktop,
|
|
963
|
-
isTouchDevice: k(),
|
|
964
|
-
platform: O(),
|
|
965
|
-
supportsHaptics: A(),
|
|
966
|
-
screenSize: {
|
|
967
|
-
width: e,
|
|
968
|
-
height: n
|
|
969
|
-
},
|
|
970
|
-
orientation: e > n ? "landscape" : "portrait"
|
|
971
|
-
});
|
|
972
|
-
};
|
|
973
|
-
window.addEventListener("resize", e), window.addEventListener("orientationchange", e);
|
|
974
|
-
let n = window.matchMedia(`(max-width: ${D.mobile - 1}px)`), r = window.matchMedia(`(min-width: ${D.mobile}px) and (max-width: ${D.desktop - 1}px)`), i = window.matchMedia(`(min-width: ${D.desktop}px)`);
|
|
975
|
-
return n.addEventListener("change", e), r.addEventListener("change", e), i.addEventListener("change", e), () => {
|
|
976
|
-
window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e), n.removeEventListener("change", e), r.removeEventListener("change", e), i.removeEventListener("change", e);
|
|
977
|
-
};
|
|
978
|
-
}, []), e;
|
|
979
|
-
}
|
|
980
|
-
function M() {
|
|
981
|
-
let { platform: e, isMobile: t } = j();
|
|
982
|
-
i.useEffect(() => {
|
|
983
|
-
if (t) {
|
|
984
|
-
if (e === "ios") {
|
|
985
|
-
let e = (e) => {
|
|
986
|
-
e.touches.length > 1 && e.preventDefault();
|
|
987
|
-
};
|
|
988
|
-
return document.addEventListener("touchstart", e, { passive: !1 }), document.body.style.webkitOverflowScrolling = "touch", () => {
|
|
989
|
-
document.removeEventListener("touchstart", e);
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
e === "android" && (document.body.style.touchAction = "manipulation"), document.documentElement.style.setProperty("--webkit-transform", "translateZ(0)"), document.documentElement.style.setProperty("--transform", "translateZ(0)");
|
|
993
|
-
}
|
|
994
|
-
}, [e, t]);
|
|
995
|
-
}
|
|
996
|
-
function N() {
|
|
997
|
-
let { supportsHaptics: e } = j();
|
|
998
|
-
return {
|
|
999
|
-
triggerHaptic: i.useCallback((t = "light") => {
|
|
1000
|
-
if (!e) return;
|
|
1001
|
-
let n = {
|
|
1002
|
-
light: [10],
|
|
1003
|
-
medium: [20],
|
|
1004
|
-
heavy: [30],
|
|
1005
|
-
success: [
|
|
1006
|
-
10,
|
|
1007
|
-
10,
|
|
1008
|
-
10
|
|
1009
|
-
],
|
|
1010
|
-
warning: [20, 20],
|
|
1011
|
-
error: [
|
|
1012
|
-
50,
|
|
1013
|
-
20,
|
|
1014
|
-
50
|
|
1015
|
-
]
|
|
1016
|
-
}[t];
|
|
1017
|
-
"vibrate" in navigator && navigator.vibrate(n);
|
|
1018
|
-
}, [e]),
|
|
1019
|
-
supportsHaptics: e
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
//#endregion
|
|
1023
|
-
//#region src/hooks/use-touch-gestures.ts
|
|
1024
|
-
var P = {
|
|
1025
|
-
enabledGestures: [
|
|
1026
|
-
"tap",
|
|
1027
|
-
"double-tap",
|
|
1028
|
-
"long-press",
|
|
1029
|
-
"swipe-left",
|
|
1030
|
-
"swipe-right",
|
|
1031
|
-
"swipe-up",
|
|
1032
|
-
"swipe-down",
|
|
1033
|
-
"pinch-in",
|
|
1034
|
-
"pinch-out"
|
|
1035
|
-
],
|
|
1036
|
-
tapThreshold: 200,
|
|
1037
|
-
doubleTapThreshold: 300,
|
|
1038
|
-
longPressThreshold: 500,
|
|
1039
|
-
swipeThreshold: 50,
|
|
1040
|
-
swipeVelocityThreshold: .5,
|
|
1041
|
-
pinchThreshold: .1,
|
|
1042
|
-
rotationThreshold: 15,
|
|
1043
|
-
enableHapticFeedback: !0
|
|
1044
|
-
};
|
|
1045
|
-
function F(e, t, n = {}) {
|
|
1046
|
-
let r = {
|
|
1047
|
-
...P,
|
|
1048
|
-
...n
|
|
1049
|
-
}, { isTouchDevice: a } = j(), { triggerHaptic: o } = N(), s = i.useRef({
|
|
1050
|
-
isTracking: !1,
|
|
1051
|
-
touches: [],
|
|
1052
|
-
startTouches: []
|
|
1053
|
-
}), c = (e) => ({
|
|
1054
|
-
id: e.identifier,
|
|
1055
|
-
x: e.clientX,
|
|
1056
|
-
y: e.clientY,
|
|
1057
|
-
timestamp: Date.now()
|
|
1058
|
-
}), l = (e, t) => Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2), u = (e, t) => {
|
|
1059
|
-
let n = Math.max(t.timestamp - e.timestamp, 1);
|
|
1060
|
-
return {
|
|
1061
|
-
x: (t.x - e.x) / n,
|
|
1062
|
-
y: (t.y - e.y) / n
|
|
1063
|
-
};
|
|
1064
|
-
}, d = (t, n, r, i = {}) => ({
|
|
1065
|
-
type: t,
|
|
1066
|
-
startPoint: {
|
|
1067
|
-
x: n.x,
|
|
1068
|
-
y: n.y
|
|
1069
|
-
},
|
|
1070
|
-
currentPoint: {
|
|
1071
|
-
x: r.x,
|
|
1072
|
-
y: r.y
|
|
1073
|
-
},
|
|
1074
|
-
duration: r.timestamp - n.timestamp,
|
|
1075
|
-
target: e.current,
|
|
1076
|
-
preventDefault: () => {},
|
|
1077
|
-
...i
|
|
1078
|
-
}), f = i.useCallback((e) => {
|
|
1079
|
-
if (!r.enabledGestures.length) return;
|
|
1080
|
-
let n = Array.from(e.touches).map(c), i = s.current;
|
|
1081
|
-
i.isTracking = !0, i.touches = n, i.startTouches = [...n], i.longPressTimer && clearTimeout(i.longPressTimer), n.length === 1 && r.enabledGestures.includes("long-press") && (i.longPressTimer = setTimeout(() => {
|
|
1082
|
-
i.touches.length === 1 && n[0] && (t(d("long-press", n[0], n[0])), r.enableHapticFeedback && o("heavy"));
|
|
1083
|
-
}, r.longPressThreshold)), n.length === 2 && n[0] && n[1] && (i.initialDistance = l(n[0], n[1]), i.initialScale = 1, i.lastScale = 1);
|
|
1084
|
-
}, [
|
|
1085
|
-
r,
|
|
1086
|
-
t,
|
|
1087
|
-
o
|
|
1088
|
-
]), p = i.useCallback((e) => {
|
|
1089
|
-
let n = s.current;
|
|
1090
|
-
if (!n.isTracking) return;
|
|
1091
|
-
let i = Array.from(e.touches).map(c);
|
|
1092
|
-
if (n.touches = i, i.length === 2 && n.initialDistance && i[0] && i[1]) {
|
|
1093
|
-
let e = l(i[0], i[1]), a = e / n.initialDistance;
|
|
1094
|
-
if (Math.abs(a - (n.lastScale || 1)) > r.pinchThreshold) {
|
|
1095
|
-
let o = a > (n.lastScale || 1) ? "pinch-out" : "pinch-in";
|
|
1096
|
-
if (r.enabledGestures.includes(o)) {
|
|
1097
|
-
let r = {
|
|
1098
|
-
x: (i[0].x + i[1].x) / 2,
|
|
1099
|
-
y: (i[0].y + i[1].y) / 2,
|
|
1100
|
-
id: -1,
|
|
1101
|
-
timestamp: Date.now()
|
|
1102
|
-
}, s = {
|
|
1103
|
-
x: ((n.startTouches[0]?.x ?? 0) + (n.startTouches[1]?.x ?? 0)) / 2,
|
|
1104
|
-
y: ((n.startTouches[0]?.y ?? 0) + (n.startTouches[1]?.y ?? 0)) / 2,
|
|
1105
|
-
id: -1,
|
|
1106
|
-
timestamp: n.startTouches[0]?.timestamp ?? Date.now()
|
|
1107
|
-
};
|
|
1108
|
-
t(d(o, s, r, {
|
|
1109
|
-
scale: a,
|
|
1110
|
-
distance: e
|
|
1111
|
-
})), n.lastScale = a;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
if (n.longPressTimer && i.length === 1 && n.startTouches[0] && i[0]) {
|
|
1116
|
-
let e = n.startTouches[0], t = i[0];
|
|
1117
|
-
l(e, t) > r.swipeThreshold && (clearTimeout(n.longPressTimer), n.longPressTimer = void 0);
|
|
1118
|
-
}
|
|
1119
|
-
}, [r, t]), m = i.useCallback((e) => {
|
|
1120
|
-
let n = s.current;
|
|
1121
|
-
if (!n.isTracking) return;
|
|
1122
|
-
let i = Array.from(e.changedTouches).map(c), a = Date.now();
|
|
1123
|
-
if (n.longPressTimer && (clearTimeout(n.longPressTimer), n.longPressTimer = void 0), n.startTouches.length === 1 && i.length === 1 && n.startTouches[0] && i[0]) {
|
|
1124
|
-
let e = n.startTouches[0], s = i[0], c = l(e, s), f = s.timestamp - e.timestamp;
|
|
1125
|
-
if (c > r.swipeThreshold) {
|
|
1126
|
-
let n = u(e, s), i = Math.abs(n.x), a = Math.abs(n.y);
|
|
1127
|
-
if (i > r.swipeVelocityThreshold || a > r.swipeVelocityThreshold) {
|
|
1128
|
-
let l;
|
|
1129
|
-
l = i > a ? n.x > 0 ? "swipe-right" : "swipe-left" : n.y > 0 ? "swipe-down" : "swipe-up", r.enabledGestures.includes(l) && (t(d(l, e, s, {
|
|
1130
|
-
velocity: n,
|
|
1131
|
-
distance: c
|
|
1132
|
-
})), r.enableHapticFeedback && o("light"));
|
|
1133
|
-
}
|
|
1134
|
-
} else f < r.tapThreshold && c < r.swipeThreshold && (n.lastTap && a - n.lastTap.timestamp < r.doubleTapThreshold && l({
|
|
1135
|
-
...n.lastTap.point,
|
|
1136
|
-
id: -1,
|
|
1137
|
-
timestamp: n.lastTap.timestamp
|
|
1138
|
-
}, s) < r.swipeThreshold ? (r.enabledGestures.includes("double-tap") && (t(d("double-tap", e, s)), r.enableHapticFeedback && o("medium")), n.lastTap = void 0) : (r.enabledGestures.includes("tap") && (t(d("tap", e, s)), r.enableHapticFeedback && o("light")), n.lastTap = {
|
|
1139
|
-
timestamp: a,
|
|
1140
|
-
point: {
|
|
1141
|
-
x: s.x,
|
|
1142
|
-
y: s.y
|
|
1143
|
-
}
|
|
1144
|
-
}));
|
|
1145
|
-
}
|
|
1146
|
-
e.touches.length === 0 && (n.isTracking = !1, n.touches = [], n.startTouches = [], n.initialDistance = void 0, n.initialScale = void 0, n.lastScale = void 0);
|
|
1147
|
-
}, [
|
|
1148
|
-
r,
|
|
1149
|
-
t,
|
|
1150
|
-
o
|
|
1151
|
-
]);
|
|
1152
|
-
return i.useEffect(() => {
|
|
1153
|
-
let t = e.current;
|
|
1154
|
-
if (!(!t || !a)) return t.addEventListener("touchstart", f, { passive: !1 }), t.addEventListener("touchmove", p, { passive: !1 }), t.addEventListener("touchend", m, { passive: !1 }), t.addEventListener("touchcancel", m, { passive: !1 }), () => {
|
|
1155
|
-
t.removeEventListener("touchstart", f), t.removeEventListener("touchmove", p), t.removeEventListener("touchend", m), t.removeEventListener("touchcancel", m);
|
|
1156
|
-
};
|
|
1157
|
-
}, [
|
|
1158
|
-
f,
|
|
1159
|
-
p,
|
|
1160
|
-
m,
|
|
1161
|
-
a
|
|
1162
|
-
]), { isGestureEnabled: a && r.enabledGestures.length > 0 };
|
|
1163
|
-
}
|
|
1164
|
-
function I(e, t) {
|
|
1165
|
-
return F(e, i.useCallback((n) => {
|
|
1166
|
-
let { type: r, velocity: i, distance: a, scale: o } = n;
|
|
1167
|
-
switch (r) {
|
|
1168
|
-
case "double-tap":
|
|
1169
|
-
t.onPlayPause?.();
|
|
1170
|
-
break;
|
|
1171
|
-
case "swipe-left":
|
|
1172
|
-
let r = Math.min((a || 0) / 10, 30);
|
|
1173
|
-
t.onSeek?.("backward", r);
|
|
1174
|
-
break;
|
|
1175
|
-
case "swipe-right":
|
|
1176
|
-
let i = Math.min((a || 0) / 10, 30);
|
|
1177
|
-
t.onSeek?.("forward", i);
|
|
1178
|
-
break;
|
|
1179
|
-
case "swipe-up":
|
|
1180
|
-
if (n.startPoint.x > (e.current?.clientWidth || 0) / 2) {
|
|
1181
|
-
let e = Math.min((a || 0) / 100, .2);
|
|
1182
|
-
t.onVolumeChange?.("up", e);
|
|
1183
|
-
}
|
|
1184
|
-
break;
|
|
1185
|
-
case "swipe-down":
|
|
1186
|
-
if (n.startPoint.x > (e.current?.clientWidth || 0) / 2) {
|
|
1187
|
-
let e = Math.min((a || 0) / 100, .2);
|
|
1188
|
-
t.onVolumeChange?.("down", e);
|
|
1189
|
-
}
|
|
1190
|
-
break;
|
|
1191
|
-
case "pinch-out":
|
|
1192
|
-
t.onZoom?.(o || 1);
|
|
1193
|
-
break;
|
|
1194
|
-
case "pinch-in":
|
|
1195
|
-
t.onZoom?.(o || 1);
|
|
1196
|
-
break;
|
|
1197
|
-
case "long-press":
|
|
1198
|
-
t.onToggleFullscreen?.();
|
|
1199
|
-
break;
|
|
1200
|
-
default: break;
|
|
1201
|
-
}
|
|
1202
|
-
}, [t, e]), {
|
|
1203
|
-
enabledGestures: [
|
|
1204
|
-
"tap",
|
|
1205
|
-
"double-tap",
|
|
1206
|
-
"long-press",
|
|
1207
|
-
"swipe-left",
|
|
1208
|
-
"swipe-right",
|
|
1209
|
-
"swipe-up",
|
|
1210
|
-
"swipe-down",
|
|
1211
|
-
"pinch-in",
|
|
1212
|
-
"pinch-out"
|
|
1213
|
-
],
|
|
1214
|
-
enableHapticFeedback: !0,
|
|
1215
|
-
swipeThreshold: 30,
|
|
1216
|
-
swipeVelocityThreshold: .3
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
|
-
//#endregion
|
|
1220
|
-
//#region src/hooks/useEnhancedSubtitles.ts
|
|
1221
|
-
var L = /* @__PURE__ */ e({ useEnhancedSubtitles: () => R });
|
|
1222
|
-
function R({ subtitleSrc: e, subtitleTracks: t = [], defaultFontSize: n = "medium", onLoadError: r } = {}) {
|
|
1223
|
-
let [i, a] = d(!1), [o, c] = d([]), [l, u] = d(""), [f, p] = d(null), [m, h] = d(n), [g, _] = d(null), [v, y] = d(!1), b = {
|
|
1224
|
-
small: "text-sm",
|
|
1225
|
-
medium: "text-base",
|
|
1226
|
-
large: "text-lg"
|
|
1227
|
-
}, x = !!(e || t && t.length > 0), S = (e) => {
|
|
1228
|
-
let t = e.split(":"), n = t[2] ? parseFloat(t[2]) : 0, r = t[1] ? parseInt(t[1], 10) * 60 : 0;
|
|
1229
|
-
return (t[0] ? parseInt(t[0], 10) * 3600 : 0) + r + n;
|
|
1230
|
-
}, C = (e) => {
|
|
1231
|
-
let [t, n] = e.split(","), r = (t || "").split(":"), i = n ? parseInt(n, 10) / 1e3 : 0, a = r[2] ? parseInt(r[2], 10) : 0, o = r[1] ? parseInt(r[1], 10) * 60 : 0;
|
|
1232
|
-
return (r[0] ? parseInt(r[0], 10) * 3600 : 0) + o + a + i;
|
|
1233
|
-
}, w = async (e) => {
|
|
1234
|
-
y(!0), _(null);
|
|
1235
|
-
try {
|
|
1236
|
-
let t = await fetch(e);
|
|
1237
|
-
if (!t.ok) throw Error(`Failed to load subtitles: ${t.status} ${t.statusText}`);
|
|
1238
|
-
let n = await t.text(), r = [], i = n.split("\n"), a = 0, o = n.includes("WEBVTT") || e.endsWith(".vtt"), s = e.endsWith(".srt") || /^\d+$/.test(i[0]?.trim() || "");
|
|
1239
|
-
if (o) for (; a < i.length;) {
|
|
1240
|
-
if (i[a]?.includes("-->")) {
|
|
1241
|
-
let [e, t] = (i[a] || "").split("-->").map((e) => e.trim()), n = S(e || ""), o = S(t || "");
|
|
1242
|
-
a++;
|
|
1243
|
-
let s = "";
|
|
1244
|
-
for (; a < i.length && i[a]?.trim() !== "";) s += (s ? " " : "") + i[a]?.trim(), a++;
|
|
1245
|
-
s && r.push({
|
|
1246
|
-
start: n,
|
|
1247
|
-
end: o,
|
|
1248
|
-
text: s
|
|
1249
|
-
});
|
|
1250
|
-
}
|
|
1251
|
-
a++;
|
|
1252
|
-
}
|
|
1253
|
-
else if (s) for (; a < i.length;) {
|
|
1254
|
-
if (/^\d+$/.test(i[a]?.trim() || "") && (a++, i[a]?.includes("-->"))) {
|
|
1255
|
-
let [e, t] = (i[a] || "").split("-->").map((e) => e.trim()), n = C(e || ""), o = C(t || "");
|
|
1256
|
-
a++;
|
|
1257
|
-
let s = "";
|
|
1258
|
-
for (; a < i.length && i[a]?.trim() !== "";) s += (s ? " " : "") + i[a]?.trim(), a++;
|
|
1259
|
-
s && r.push({
|
|
1260
|
-
start: n,
|
|
1261
|
-
end: o,
|
|
1262
|
-
text: s
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
a++;
|
|
1266
|
-
}
|
|
1267
|
-
else throw Error("Unsupported subtitle format. Only VTT and SRT are supported.");
|
|
1268
|
-
if (r.length === 0) throw Error("No subtitle cues found in file");
|
|
1269
|
-
c(r), y(!1);
|
|
1270
|
-
} catch (e) {
|
|
1271
|
-
let t = e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load subtitles");
|
|
1272
|
-
console.error("Failed to load subtitles:", t), _(t), y(!1), c([]), r?.(t);
|
|
1273
|
-
}
|
|
1274
|
-
}, T = (e) => !i || o.length === 0 ? "" : o.find((t) => e >= t.start && e <= t.end)?.text || "", E = () => {
|
|
1275
|
-
a((n) => {
|
|
1276
|
-
let r = !n;
|
|
1277
|
-
if (r && !g) {
|
|
1278
|
-
if (o.length === 0 && !v) {
|
|
1279
|
-
let n = e || t[0]?.src;
|
|
1280
|
-
n && (w(n), t[0] && p(t[0].id));
|
|
1281
|
-
}
|
|
1282
|
-
} else r || u("");
|
|
1283
|
-
return r;
|
|
1284
|
-
});
|
|
1285
|
-
}, D = (e) => {
|
|
1286
|
-
if (!e) {
|
|
1287
|
-
a(!1), p(null), u("");
|
|
1288
|
-
return;
|
|
1289
|
-
}
|
|
1290
|
-
let n = t.find((t) => t.id === e);
|
|
1291
|
-
n?.src && (p(e), w(n.src), a(!0));
|
|
1292
|
-
}, O = (e) => {
|
|
1293
|
-
h(e);
|
|
1294
|
-
}, k = {
|
|
1295
|
-
fontSize: b[m],
|
|
1296
|
-
className: `${b[m]} font-medium`
|
|
1297
|
-
};
|
|
1298
|
-
return s(() => {
|
|
1299
|
-
i || u("");
|
|
1300
|
-
}, [i]), s(() => {}, []), {
|
|
1301
|
-
subtitlesEnabled: i,
|
|
1302
|
-
currentSubtitle: l,
|
|
1303
|
-
subtitleCues: o,
|
|
1304
|
-
currentTrackId: f,
|
|
1305
|
-
fontSize: m,
|
|
1306
|
-
loadError: g,
|
|
1307
|
-
isLoading: v,
|
|
1308
|
-
hasSubtitles: x,
|
|
1309
|
-
toggleSubtitles: E,
|
|
1310
|
-
selectSubtitleTrack: D,
|
|
1311
|
-
changeSubtitleFontSize: O,
|
|
1312
|
-
setCurrentSubtitle: u,
|
|
1313
|
-
getCurrentSubtitle: T,
|
|
1314
|
-
getSubtitleStyles: k,
|
|
1315
|
-
availableTracks: t
|
|
1316
|
-
};
|
|
1317
|
-
}
|
|
1318
|
-
//#endregion
|
|
1319
|
-
//#region src/hooks/useKeyboardShortcuts.ts
|
|
1320
|
-
function z(e, t) {
|
|
1321
|
-
if (!Number.isFinite(t)) return console.warn(`Attempted to set non-finite currentTime: ${t}`), !1;
|
|
1322
|
-
if (t < 0) return console.warn(`Attempted to set negative currentTime: ${t}`), !1;
|
|
1323
|
-
try {
|
|
1324
|
-
return e.currentTime = t, !0;
|
|
1325
|
-
} catch (e) {
|
|
1326
|
-
return console.error(`Failed to set currentTime to ${t}:`, e), !1;
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
function B({ videoControls: e, toggleSubtitles: t, takeScreenshot: n, duration: r }) {
|
|
1330
|
-
let i = (i) => {
|
|
1331
|
-
let a = document.querySelector("video");
|
|
1332
|
-
if (a) switch (i.key.toLowerCase()) {
|
|
1333
|
-
case " ":
|
|
1334
|
-
case "k":
|
|
1335
|
-
i.preventDefault(), e.togglePlay();
|
|
1336
|
-
break;
|
|
1337
|
-
case "j":
|
|
1338
|
-
i.preventDefault(), e.seekBackward();
|
|
1339
|
-
break;
|
|
1340
|
-
case "l":
|
|
1341
|
-
i.preventDefault(), e.seekForward();
|
|
1342
|
-
break;
|
|
1343
|
-
case "arrowleft":
|
|
1344
|
-
i.preventDefault(), z(a, Math.max(0, (Number.isFinite(a.currentTime) ? a.currentTime : 0) - 5));
|
|
1345
|
-
break;
|
|
1346
|
-
case "arrowright":
|
|
1347
|
-
i.preventDefault();
|
|
1348
|
-
let o = Number.isFinite(r) && r > 0 ? r : Number.isFinite(a.duration) ? a.duration : 0;
|
|
1349
|
-
if (o === 0) {
|
|
1350
|
-
console.warn("Cannot seek: duration is not available");
|
|
1351
|
-
break;
|
|
1352
|
-
}
|
|
1353
|
-
z(a, Math.min(o, (Number.isFinite(a.currentTime) ? a.currentTime : 0) + 5));
|
|
1354
|
-
break;
|
|
1355
|
-
case "arrowup":
|
|
1356
|
-
i.preventDefault(), a.volume = Math.min(1, a.volume + .1);
|
|
1357
|
-
break;
|
|
1358
|
-
case "arrowdown":
|
|
1359
|
-
i.preventDefault(), a.volume = Math.max(0, a.volume - .1);
|
|
1360
|
-
break;
|
|
1361
|
-
case "m":
|
|
1362
|
-
i.preventDefault(), e.toggleMute();
|
|
1363
|
-
break;
|
|
1364
|
-
case "f":
|
|
1365
|
-
i.preventDefault(), e.toggleFullscreen();
|
|
1366
|
-
break;
|
|
1367
|
-
case "c":
|
|
1368
|
-
i.preventDefault(), t();
|
|
1369
|
-
break;
|
|
1370
|
-
case "s":
|
|
1371
|
-
i.preventDefault(), n(i.ctrlKey || i.metaKey);
|
|
1372
|
-
break;
|
|
1373
|
-
}
|
|
1374
|
-
};
|
|
1375
|
-
s(() => (document.addEventListener("keydown", i), () => document.removeEventListener("keydown", i)), [i]);
|
|
1376
|
-
}
|
|
1377
|
-
//#endregion
|
|
1378
|
-
//#region src/hooks/useMediaControls.ts
|
|
1379
|
-
function V(e, t) {
|
|
1380
|
-
let [n, r] = d(!0), [i, a] = d(!1), o = u(null), c = () => {
|
|
1381
|
-
r(!0), o.current && clearTimeout(o.current), e && !t && (o.current = setTimeout(() => {
|
|
1382
|
-
r(!1);
|
|
1383
|
-
}, 3e3));
|
|
1384
|
-
};
|
|
1385
|
-
return s(() => (c(), () => {
|
|
1386
|
-
o.current && clearTimeout(o.current);
|
|
1387
|
-
}), [c]), {
|
|
1388
|
-
controlsVisible: n,
|
|
1389
|
-
showVolumeSlider: i,
|
|
1390
|
-
setShowVolumeSlider: a,
|
|
1391
|
-
handleMouseMove: () => {
|
|
1392
|
-
c();
|
|
1393
|
-
},
|
|
1394
|
-
handleMouseEnter: () => {
|
|
1395
|
-
r(!0);
|
|
1396
|
-
},
|
|
1397
|
-
handleMouseLeave: () => {
|
|
1398
|
-
e && r(!1);
|
|
1399
|
-
}
|
|
1400
|
-
};
|
|
1401
|
-
}
|
|
1402
|
-
//#endregion
|
|
1403
|
-
//#region src/hooks/useScreenshot.ts
|
|
1404
|
-
function H(e) {
|
|
1405
|
-
return !!(e instanceof DOMException && e.name === "SecurityError" || e instanceof Error && /tainted/i.test(e.message));
|
|
1406
|
-
}
|
|
1407
|
-
function U(e) {
|
|
1408
|
-
return { takeScreenshot: o((t = !1) => {
|
|
1409
|
-
let n = e.current;
|
|
1410
|
-
if (!n) return;
|
|
1411
|
-
if (!n.videoWidth || !n.videoHeight) {
|
|
1412
|
-
console.warn("Screenshot skipped: video frame not ready yet.");
|
|
1413
|
-
return;
|
|
1414
|
-
}
|
|
1415
|
-
let r = document.createElement("canvas");
|
|
1416
|
-
r.width = n.videoWidth, r.height = n.videoHeight;
|
|
1417
|
-
let i = r.getContext("2d");
|
|
1418
|
-
if (i) try {
|
|
1419
|
-
i.drawImage(n, 0, 0), r.toBlob((e) => {
|
|
1420
|
-
if (!e) {
|
|
1421
|
-
console.error("Screenshot failed: could not create image blob.");
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
|
-
if (t) {
|
|
1425
|
-
if (navigator.clipboard && window.ClipboardItem) {
|
|
1426
|
-
let t = new ClipboardItem({ "image/png": e });
|
|
1427
|
-
navigator.clipboard.write([t]).catch((e) => {
|
|
1428
|
-
console.error("Failed to copy screenshot to clipboard:", e);
|
|
1429
|
-
});
|
|
1430
|
-
} else console.warn("Clipboard API not supported for screenshot copy.");
|
|
1431
|
-
return;
|
|
1432
|
-
}
|
|
1433
|
-
let n = URL.createObjectURL(e), r = document.createElement("a");
|
|
1434
|
-
r.href = n, r.download = `screenshot-${Date.now()}.png`, r.click(), URL.revokeObjectURL(n);
|
|
1435
|
-
}, "image/png");
|
|
1436
|
-
} catch (e) {
|
|
1437
|
-
if (H(e)) {
|
|
1438
|
-
console.error("Screenshot failed: canvas tainted. The video is cross-origin without CORS allowing canvas use. Serve the media with Access-Control-Allow-Origin and set crossOrigin=\"anonymous\" on the player (must be set before the media loads).");
|
|
1439
|
-
return;
|
|
1440
|
-
}
|
|
1441
|
-
console.error("Screenshot failed:", e);
|
|
1442
|
-
}
|
|
1443
|
-
}, [e]) };
|
|
1444
|
-
}
|
|
1445
|
-
//#endregion
|
|
1446
|
-
//#region src/hooks/useVideoPlayer.ts
|
|
1447
|
-
function W(e, t) {
|
|
1448
|
-
if (!Number.isFinite(t)) return console.warn(`Attempted to set non-finite currentTime: ${t}`), !1;
|
|
1449
|
-
if (t < 0) return console.warn(`Attempted to set negative currentTime: ${t}`), !1;
|
|
1450
|
-
try {
|
|
1451
|
-
return e.currentTime = t, !0;
|
|
1452
|
-
} catch (e) {
|
|
1453
|
-
return console.error(`Failed to set currentTime to ${t}:`, e), !1;
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
function G(e) {
|
|
1457
|
-
let t = u(null), [n, r] = d({
|
|
1458
|
-
isPlaying: !1,
|
|
1459
|
-
currentTime: 0,
|
|
1460
|
-
duration: 0,
|
|
1461
|
-
volume: 1,
|
|
1462
|
-
isMuted: !1,
|
|
1463
|
-
isFullscreen: !1,
|
|
1464
|
-
isLoading: !0,
|
|
1465
|
-
isSeeking: !1,
|
|
1466
|
-
isBuffering: !1,
|
|
1467
|
-
bufferedRanges: []
|
|
1468
|
-
});
|
|
1469
|
-
return s(() => {
|
|
1470
|
-
let e = t.current;
|
|
1471
|
-
if (!e) return;
|
|
1472
|
-
let n = () => {
|
|
1473
|
-
r((t) => ({
|
|
1474
|
-
...t,
|
|
1475
|
-
currentTime: e.currentTime
|
|
1476
|
-
}));
|
|
1477
|
-
}, i = () => {
|
|
1478
|
-
r((t) => ({
|
|
1479
|
-
...t,
|
|
1480
|
-
duration: e.duration
|
|
1481
|
-
}));
|
|
1482
|
-
}, a = () => {
|
|
1483
|
-
r((e) => ({
|
|
1484
|
-
...e,
|
|
1485
|
-
isPlaying: !0,
|
|
1486
|
-
isBuffering: !1
|
|
1487
|
-
}));
|
|
1488
|
-
}, o = () => {
|
|
1489
|
-
r((e) => ({
|
|
1490
|
-
...e,
|
|
1491
|
-
isPlaying: !1
|
|
1492
|
-
}));
|
|
1493
|
-
}, s = () => {
|
|
1494
|
-
r((t) => ({
|
|
1495
|
-
...t,
|
|
1496
|
-
volume: e.volume,
|
|
1497
|
-
isMuted: e.muted
|
|
1498
|
-
}));
|
|
1499
|
-
}, c = () => {
|
|
1500
|
-
r((e) => ({
|
|
1501
|
-
...e,
|
|
1502
|
-
isLoading: !0
|
|
1503
|
-
}));
|
|
1504
|
-
}, l = () => {
|
|
1505
|
-
r((e) => ({
|
|
1506
|
-
...e,
|
|
1507
|
-
isLoading: !1
|
|
1508
|
-
}));
|
|
1509
|
-
}, u = () => {
|
|
1510
|
-
r((e) => ({
|
|
1511
|
-
...e,
|
|
1512
|
-
isSeeking: !0
|
|
1513
|
-
}));
|
|
1514
|
-
}, d = () => {
|
|
1515
|
-
r((e) => ({
|
|
1516
|
-
...e,
|
|
1517
|
-
isSeeking: !1
|
|
1518
|
-
}));
|
|
1519
|
-
}, f = () => {
|
|
1520
|
-
r((e) => ({
|
|
1521
|
-
...e,
|
|
1522
|
-
isBuffering: !0
|
|
1523
|
-
}));
|
|
1524
|
-
}, p = () => {
|
|
1525
|
-
r((e) => ({
|
|
1526
|
-
...e,
|
|
1527
|
-
isBuffering: !1,
|
|
1528
|
-
isLoading: !1
|
|
1529
|
-
}));
|
|
1530
|
-
}, m = () => {
|
|
1531
|
-
r((e) => ({
|
|
1532
|
-
...e,
|
|
1533
|
-
isLoading: !1,
|
|
1534
|
-
isBuffering: !1
|
|
1535
|
-
}));
|
|
1536
|
-
}, h = () => {
|
|
1537
|
-
if (!e.buffered || e.buffered.length === 0 || e.duration === 0) {
|
|
1538
|
-
r((e) => ({
|
|
1539
|
-
...e,
|
|
1540
|
-
bufferedRanges: []
|
|
1541
|
-
}));
|
|
1542
|
-
return;
|
|
1543
|
-
}
|
|
1544
|
-
let t = [];
|
|
1545
|
-
for (let n = 0; n < e.buffered.length; n++) {
|
|
1546
|
-
let r = e.buffered.start(n), i = e.buffered.end(n);
|
|
1547
|
-
t.push({
|
|
1548
|
-
start: r,
|
|
1549
|
-
end: i,
|
|
1550
|
-
percentage: (i - r) / e.duration * 100
|
|
1551
|
-
});
|
|
1552
|
-
}
|
|
1553
|
-
r((e) => ({
|
|
1554
|
-
...e,
|
|
1555
|
-
bufferedRanges: t
|
|
1556
|
-
}));
|
|
1557
|
-
};
|
|
1558
|
-
return e.addEventListener("timeupdate", n), e.addEventListener("loadedmetadata", i), e.addEventListener("play", a), e.addEventListener("pause", o), e.addEventListener("volumechange", s), e.addEventListener("loadstart", c), e.addEventListener("loadeddata", l), e.addEventListener("seeking", u), e.addEventListener("seeked", d), e.addEventListener("waiting", f), e.addEventListener("playing", p), e.addEventListener("canplay", m), e.addEventListener("progress", h), () => {
|
|
1559
|
-
e.removeEventListener("timeupdate", n), e.removeEventListener("loadedmetadata", i), e.removeEventListener("play", a), e.removeEventListener("pause", o), e.removeEventListener("volumechange", s), e.removeEventListener("loadstart", c), e.removeEventListener("loadeddata", l), e.removeEventListener("seeking", u), e.removeEventListener("seeked", d), e.removeEventListener("waiting", f), e.removeEventListener("playing", p), e.removeEventListener("canplay", m), e.removeEventListener("progress", h);
|
|
1560
|
-
};
|
|
1561
|
-
}, []), {
|
|
1562
|
-
videoRef: t,
|
|
1563
|
-
state: n,
|
|
1564
|
-
controls: {
|
|
1565
|
-
togglePlay: () => {
|
|
1566
|
-
let e = t.current;
|
|
1567
|
-
e && (n.isPlaying ? e.pause() : e.play());
|
|
1568
|
-
},
|
|
1569
|
-
seekForward: (e = 10) => {
|
|
1570
|
-
let r = t.current;
|
|
1571
|
-
if (!r) return;
|
|
1572
|
-
let i = Number.isFinite(r.duration) ? r.duration : Number.isFinite(n.duration) ? n.duration : 0;
|
|
1573
|
-
if (i === 0) {
|
|
1574
|
-
console.warn("Cannot seek forward: duration is not available");
|
|
1575
|
-
return;
|
|
1576
|
-
}
|
|
1577
|
-
W(r, Math.min(i, (Number.isFinite(r.currentTime) ? r.currentTime : 0) + e));
|
|
1578
|
-
},
|
|
1579
|
-
seekBackward: (e = 10) => {
|
|
1580
|
-
let n = t.current;
|
|
1581
|
-
n && W(n, Math.max(0, (Number.isFinite(n.currentTime) ? n.currentTime : 0) - e));
|
|
1582
|
-
},
|
|
1583
|
-
toggleMute: () => {
|
|
1584
|
-
let e = t.current;
|
|
1585
|
-
e && (e.muted = !n.isMuted);
|
|
1586
|
-
},
|
|
1587
|
-
setVolume: (e) => {
|
|
1588
|
-
let r = t.current;
|
|
1589
|
-
r && (r.volume = e, e > 0 && n.isMuted && (r.muted = !1));
|
|
1590
|
-
},
|
|
1591
|
-
toggleFullscreen: () => {
|
|
1592
|
-
let t = e.current;
|
|
1593
|
-
t && (n.isFullscreen ? document.exitFullscreen && document.exitFullscreen() : t.requestFullscreen && t.requestFullscreen(), r((e) => ({
|
|
1594
|
-
...e,
|
|
1595
|
-
isFullscreen: !e.isFullscreen
|
|
1596
|
-
})));
|
|
1597
|
-
},
|
|
1598
|
-
seekTo: (e) => {
|
|
1599
|
-
let r = t.current;
|
|
1600
|
-
if (!r) return;
|
|
1601
|
-
let i = Number.isFinite(r.duration) ? r.duration : Number.isFinite(n.duration) ? n.duration : 0;
|
|
1602
|
-
if (i === 0) {
|
|
1603
|
-
console.warn("Cannot seek: duration is not available");
|
|
1604
|
-
return;
|
|
1605
|
-
}
|
|
1606
|
-
W(r, Math.max(0, Math.min(i, e)));
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
};
|
|
1610
|
-
}
|
|
1611
|
-
//#endregion
|
|
1612
|
-
//#region src/hooks/use-intelligent-preloading.ts
|
|
1613
|
-
var K = (e, t = {}) => {
|
|
1614
|
-
let { trackUserBehavior: n = !0, adaptToNetwork: r = !0, strategy: i = "balanced", maxPreloadItems: a = 3, preloadRadius: l = 2 } = t, d = u({
|
|
1615
|
-
mouseMovements: 0,
|
|
1616
|
-
scrollEvents: 0,
|
|
1617
|
-
keyPresses: 0,
|
|
1618
|
-
focusEvents: 0,
|
|
1619
|
-
timeOnPage: 0,
|
|
1620
|
-
engagementScore: 0,
|
|
1621
|
-
lastInteraction: Date.now()
|
|
1622
|
-
}), f = u(null), p = u(/* @__PURE__ */ new Set()), m = u([]), h = o(() => {
|
|
1623
|
-
let e = d.current, t = Math.min(e.timeOnPage / 6e4, 1), n = Math.min((e.mouseMovements + e.scrollEvents + e.keyPresses) / 100, 1);
|
|
1624
|
-
return (t * .4 + n * .6) * 100;
|
|
1625
|
-
}, []), g = o((e, t = 1) => {
|
|
1626
|
-
let n = d.current;
|
|
1627
|
-
n[e] = typeof n[e] == "number" ? n[e] + t : Date.now(), n.engagementScore = h(), n.lastInteraction = Date.now();
|
|
1628
|
-
}, [h]), _ = o(() => {
|
|
1629
|
-
if (!f.current || !r) return {
|
|
1630
|
-
type: "unknown",
|
|
1631
|
-
downlink: 10,
|
|
1632
|
-
effectiveType: "4g",
|
|
1633
|
-
saveData: !1
|
|
1634
|
-
};
|
|
1635
|
-
let e = f.current;
|
|
1636
|
-
return {
|
|
1637
|
-
type: e.type,
|
|
1638
|
-
downlink: e.downlink || 10,
|
|
1639
|
-
effectiveType: e.effectiveType || "4g",
|
|
1640
|
-
saveData: e.saveData || !1,
|
|
1641
|
-
rtt: e.rtt || 100
|
|
1642
|
-
};
|
|
1643
|
-
}, [r]), v = o((e, t, n = 0) => {
|
|
1644
|
-
if (p.current.has(e.src)) return {
|
|
1645
|
-
shouldPreload: !1,
|
|
1646
|
-
priority: "low",
|
|
1647
|
-
reason: "Already preloaded"
|
|
1648
|
-
};
|
|
1649
|
-
let r = Math.abs(t - n);
|
|
1650
|
-
if (r > l) return {
|
|
1651
|
-
shouldPreload: !1,
|
|
1652
|
-
priority: "low",
|
|
1653
|
-
reason: "Outside preload radius"
|
|
1654
|
-
};
|
|
1655
|
-
let a = d.current, o = _(), s = a.engagementScore, c = Date.now() - a.lastInteraction;
|
|
1656
|
-
if (o.saveData) return {
|
|
1657
|
-
shouldPreload: !1,
|
|
1658
|
-
priority: "low",
|
|
1659
|
-
reason: "Data saver mode"
|
|
1660
|
-
};
|
|
1661
|
-
let u = !1, f = "medium", m = "";
|
|
1662
|
-
switch (i) {
|
|
1663
|
-
case "conservative":
|
|
1664
|
-
u = s > 70 && o.effectiveType !== "2g" && r === 1, f = u ? "medium" : "low", m = u ? "High engagement and optimal network" : "Conservative strategy";
|
|
1665
|
-
break;
|
|
1666
|
-
case "aggressive":
|
|
1667
|
-
u = s > 30 && o.effectiveType !== "slow-2g", f = s > 70 ? "high" : s > 50 ? "medium" : "low", m = u ? "Aggressive preloading" : "Low engagement";
|
|
1668
|
-
break;
|
|
1669
|
-
default:
|
|
1670
|
-
let e = s * (o.effectiveType === "4g" ? 1 : o.effectiveType === "3g" ? .7 : .3);
|
|
1671
|
-
u = e > 40 && r <= 2, f = e > 70 ? "high" : e > 55 ? "medium" : "low", m = u ? `Balanced: score ${e.toFixed(1)}` : "Low adjusted score";
|
|
1672
|
-
break;
|
|
1673
|
-
}
|
|
1674
|
-
if (u) {
|
|
1675
|
-
let t = e.type;
|
|
1676
|
-
(t === "hls" || t === "m3u8" || t === "application/x-mpegURL") && (f = f === "low" ? "medium" : "high"), c < 5e3 && (f = "high", m += " + Recent interaction"), (t === "mp4" || t === "webm" || t === "video/mp4" || t === "video/webm") && (f = f === "low" ? "medium" : f);
|
|
1677
|
-
}
|
|
1678
|
-
return {
|
|
1679
|
-
shouldPreload: u,
|
|
1680
|
-
priority: f,
|
|
1681
|
-
reason: m
|
|
1682
|
-
};
|
|
1683
|
-
}, [
|
|
1684
|
-
i,
|
|
1685
|
-
l,
|
|
1686
|
-
_,
|
|
1687
|
-
h
|
|
1688
|
-
]), y = o(async (e, t) => {
|
|
1689
|
-
try {
|
|
1690
|
-
let n = document.createElement("link");
|
|
1691
|
-
switch (n.rel = "preload", n.href = e.src, e.type) {
|
|
1692
|
-
case "hls":
|
|
1693
|
-
case "m3u8":
|
|
1694
|
-
case "application/x-mpegURL":
|
|
1695
|
-
n.as = "fetch";
|
|
1696
|
-
break;
|
|
1697
|
-
case "mp4":
|
|
1698
|
-
case "webm":
|
|
1699
|
-
case "video/mp4":
|
|
1700
|
-
case "video/webm":
|
|
1701
|
-
n.as = "video";
|
|
1702
|
-
break;
|
|
1703
|
-
case "mp3":
|
|
1704
|
-
case "wav":
|
|
1705
|
-
case "ogg":
|
|
1706
|
-
case "audio/mpeg":
|
|
1707
|
-
case "audio/wav":
|
|
1708
|
-
case "audio/ogg":
|
|
1709
|
-
n.as = "audio";
|
|
1710
|
-
break;
|
|
1711
|
-
default: n.as = "fetch";
|
|
1712
|
-
}
|
|
1713
|
-
n.crossOrigin = "anonymous", document.head.appendChild(n), p.current.add(e.src), console.debug(`Preloaded: ${e.src} (${t})`), setTimeout(() => {
|
|
1714
|
-
document.head.contains(n) && document.head.removeChild(n);
|
|
1715
|
-
}, 3e4);
|
|
1716
|
-
} catch (t) {
|
|
1717
|
-
console.warn("Failed to preload source:", e.src, t);
|
|
1718
|
-
}
|
|
1719
|
-
}, []), b = o(() => {
|
|
1720
|
-
if (m.current.length === 0) return;
|
|
1721
|
-
let e = [...m.current].sort((e, t) => t.priority - e.priority).slice(0, a);
|
|
1722
|
-
m.current = [], e.forEach(({ source: e, priority: t }) => {
|
|
1723
|
-
y(e, t);
|
|
1724
|
-
});
|
|
1725
|
-
}, [a, y]), x = o((t = 0) => {
|
|
1726
|
-
m.current = [], e.forEach((e, n) => {
|
|
1727
|
-
let r = v(e, n, t);
|
|
1728
|
-
r.shouldPreload && m.current.push({
|
|
1729
|
-
source: e,
|
|
1730
|
-
priority: r.priority === "high" ? 3 : r.priority === "medium" ? 2 : 1
|
|
1731
|
-
});
|
|
1732
|
-
}), b();
|
|
1733
|
-
}, [
|
|
1734
|
-
e,
|
|
1735
|
-
v,
|
|
1736
|
-
b
|
|
1737
|
-
]);
|
|
1738
|
-
return s(() => {
|
|
1739
|
-
if (!n) return;
|
|
1740
|
-
let e = () => g("mouseMovements"), t = () => g("scrollEvents"), r = () => g("keyPresses"), i = () => g("focusEvents");
|
|
1741
|
-
document.addEventListener("mousemove", e, { passive: !0 }), document.addEventListener("scroll", t, { passive: !0 }), document.addEventListener("keydown", r, { passive: !0 }), document.addEventListener("focusin", i, { passive: !0 });
|
|
1742
|
-
let a = setInterval(() => {
|
|
1743
|
-
g("timeOnPage", 1);
|
|
1744
|
-
}, 1e3);
|
|
1745
|
-
return () => {
|
|
1746
|
-
document.removeEventListener("mousemove", e), document.removeEventListener("scroll", t), document.removeEventListener("keydown", r), document.removeEventListener("focusin", i), clearInterval(a);
|
|
1747
|
-
};
|
|
1748
|
-
}, [n, g]), s(() => {
|
|
1749
|
-
if (!r || !("connection" in navigator)) return;
|
|
1750
|
-
let e = navigator.connection;
|
|
1751
|
-
f.current = e;
|
|
1752
|
-
let t = () => {
|
|
1753
|
-
x();
|
|
1754
|
-
};
|
|
1755
|
-
return e.addEventListener("change", t), () => {
|
|
1756
|
-
e.removeEventListener("change", t);
|
|
1757
|
-
};
|
|
1758
|
-
}, [r, x]), s(() => {
|
|
1759
|
-
x();
|
|
1760
|
-
}, [x]), c(() => ({
|
|
1761
|
-
preloadAtIndex: (e) => {
|
|
1762
|
-
x(e);
|
|
1763
|
-
},
|
|
1764
|
-
getUserBehavior: () => ({ ...d.current }),
|
|
1765
|
-
getNetworkConditions: _,
|
|
1766
|
-
clearCache: () => {
|
|
1767
|
-
p.current.clear();
|
|
1768
|
-
},
|
|
1769
|
-
getStats: () => ({
|
|
1770
|
-
preloadedItems: p.current.size,
|
|
1771
|
-
engagementScore: d.current.engagementScore,
|
|
1772
|
-
queueLength: m.current.length,
|
|
1773
|
-
maxPreloadItems: a
|
|
1774
|
-
})
|
|
1775
|
-
}), [
|
|
1776
|
-
x,
|
|
1777
|
-
_,
|
|
1778
|
-
a
|
|
1779
|
-
]);
|
|
1780
|
-
};
|
|
1781
|
-
//#endregion
|
|
1782
|
-
//#region src/hooks/useSubtitles.ts
|
|
1783
|
-
function q(e) {
|
|
1784
|
-
let [t, n] = d(!1), [r, i] = d([]), [a, o] = d(""), c = (e) => {
|
|
1785
|
-
let t = e.split(":"), n = t[2] ? parseFloat(t[2]) : 0, r = t[1] ? parseInt(t[1], 10) * 60 : 0;
|
|
1786
|
-
return (t[0] ? parseInt(t[0], 10) * 3600 : 0) + r + n;
|
|
1787
|
-
}, l = async (e) => {
|
|
1788
|
-
try {
|
|
1789
|
-
let t = await (await fetch(e)).text(), n = [], r = t.split("\n"), a = 0;
|
|
1790
|
-
for (; a < r.length;) {
|
|
1791
|
-
if (r[a]?.includes("-->")) {
|
|
1792
|
-
let [e, t] = (r[a] || "").split("-->").map((e) => e.trim()), i = c(e || ""), o = c(t || "");
|
|
1793
|
-
a++;
|
|
1794
|
-
let s = "";
|
|
1795
|
-
for (; a < r.length && r[a]?.trim() !== "";) s += (s ? " " : "") + r[a]?.trim(), a++;
|
|
1796
|
-
s && n.push({
|
|
1797
|
-
start: i,
|
|
1798
|
-
end: o,
|
|
1799
|
-
text: s
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
|
-
a++;
|
|
1803
|
-
}
|
|
1804
|
-
i(n);
|
|
1805
|
-
} catch (e) {
|
|
1806
|
-
console.error("Failed to load subtitles:", e);
|
|
1807
|
-
}
|
|
1808
|
-
};
|
|
1809
|
-
return s(() => {
|
|
1810
|
-
t || o("");
|
|
1811
|
-
}, [t]), {
|
|
1812
|
-
subtitlesEnabled: t,
|
|
1813
|
-
currentSubtitle: a,
|
|
1814
|
-
toggleSubtitles: () => {
|
|
1815
|
-
n((t) => {
|
|
1816
|
-
let n = !t;
|
|
1817
|
-
return n && e && r.length === 0 ? l(e) : n || o(""), n;
|
|
1818
|
-
});
|
|
1819
|
-
},
|
|
1820
|
-
getCurrentSubtitle: (e) => !t || r.length === 0 ? "" : r.find((t) => e >= t.start && e <= t.end)?.text || "",
|
|
1821
|
-
setCurrentSubtitle: o
|
|
1822
|
-
};
|
|
1823
|
-
}
|
|
1824
|
-
//#endregion
|
|
1825
|
-
//#region src/lib/deprecation.ts
|
|
1826
|
-
var J = /* @__PURE__ */ new Set();
|
|
1827
|
-
function Y(e, t, n = "2.0") {
|
|
1828
|
-
let r = `${e}-${t}-${n}`;
|
|
1829
|
-
J.has(r) || (J.add(r), console.warn(`⚠️ [BaroiPlayer] DEPRECATION WARNING: ${e} is deprecated and will be removed in v${n}.\n Please replace it with: ${t}\n See https://github.com/baroi/baroiplayer/blob/main/MIGRATION.md for migration guide.`));
|
|
1830
|
-
}
|
|
1831
|
-
//#endregion
|
|
1832
|
-
//#region src/hooks/legacy.ts
|
|
1833
|
-
function X(e) {
|
|
1834
|
-
return Y("useVideoPlayer", "useMediaPlayer (the primary media player hook)"), E(e);
|
|
1835
|
-
}
|
|
1836
|
-
function Z(e) {
|
|
1837
|
-
return Y("useEnhancedSubtitles", "useSubtitles (the current subtitle hook)"), q(e);
|
|
1838
|
-
}
|
|
1839
|
-
//#endregion
|
|
1840
|
-
export { h as C, m as S, w as _, K as a, x as b, V as c, L as d, I as f, E as g, M as h, q as i, B as l, j as m, X as n, G as o, F as p, Y as r, U as s, Z as t, R as u, C as v, b as x, S as y };
|
|
1841
|
-
|
|
1842
|
-
//# sourceMappingURL=hooks-B-IIWPJr.js.map
|