@zuude-ui/video 0.1.35 → 0.1.42

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 ADDED
@@ -0,0 +1,223 @@
1
+ # @zuude-ui/video
2
+
3
+ A comprehensive video player library with advanced time formatting utilities.
4
+
5
+ ## Video Time Formatting Utilities
6
+
7
+ Similar to `date-fns` but specifically designed for video durations and time formatting.
8
+
9
+ ### Basic Usage
10
+
11
+ ```tsx
12
+ import { formatTime, humanizeTime, parseTime } from "@zuude-ui/video/utils";
13
+
14
+ // Basic formatting
15
+ formatTime(125.5); // "2:05"
16
+ formatTime(125.5, "h:mm:ss"); // "0:02:05"
17
+ formatTime(125.5, "ss"); // "125s"
18
+
19
+ // Human readable
20
+ humanizeTime(125.5); // "2 minutes 5 seconds"
21
+ humanizeTime(125.5, { compact: true }); // "2 minutes"
22
+
23
+ // Parse time strings
24
+ parseTime("2:30"); // 150
25
+ parseTime("1:23:45"); // 5025
26
+ parseTime("90s"); // 90
27
+ ```
28
+
29
+ ### Available Functions
30
+
31
+ #### `formatTime(time, options)`
32
+
33
+ Format time in seconds to various formats.
34
+
35
+ **Parameters:**
36
+
37
+ - `time` (number): Time in seconds
38
+ - `options` (TimeFormatOptions | TimeFormat): Format options
39
+
40
+ **Formats:**
41
+
42
+ - `"mm:ss"` (default): "2:05"
43
+ - `"h:mm:ss"`: "0:02:05"
44
+ - `"ss"`: "125s"
45
+ - `"human"`: "2 minutes 5 seconds"
46
+ - `"compact"`: "2:05"
47
+ - `"detailed"`: "00:02:05.000"
48
+
49
+ **Options:**
50
+
51
+ ```tsx
52
+ interface TimeFormatOptions {
53
+ format?: TimeFormat;
54
+ showHours?: boolean;
55
+ showLeadingZeros?: boolean;
56
+ showMilliseconds?: boolean;
57
+ humanize?: boolean;
58
+ compact?: boolean;
59
+ }
60
+ ```
61
+
62
+ #### `humanizeTime(time, options)`
63
+
64
+ Convert time to human-readable format.
65
+
66
+ ```tsx
67
+ humanizeTime(125.5); // "2 minutes 5 seconds"
68
+ humanizeTime(125.5, { compact: true }); // "2 minutes"
69
+ humanizeTime(3600); // "1 hour"
70
+ ```
71
+
72
+ #### `compactTime(time)`
73
+
74
+ Compact time format.
75
+
76
+ ```tsx
77
+ compactTime(125.5); // "2:05"
78
+ compactTime(3600); // "1:00:00"
79
+ ```
80
+
81
+ #### `detailedTime(time, options)`
82
+
83
+ Detailed time format with optional milliseconds.
84
+
85
+ ```tsx
86
+ detailedTime(125.5); // "00:02:05"
87
+ detailedTime(125.5, { showMilliseconds: true }); // "00:02:05.000"
88
+ ```
89
+
90
+ #### `parseTime(timeString)`
91
+
92
+ Parse time string to seconds.
93
+
94
+ ```tsx
95
+ parseTime("2:30"); // 150
96
+ parseTime("1:23:45"); // 5025
97
+ parseTime("90s"); // 90
98
+ parseTime("1.5m"); // 90
99
+ parseTime("0.5h"); // 1800
100
+ ```
101
+
102
+ #### `timeRemaining(current, total, format)`
103
+
104
+ Calculate remaining time.
105
+
106
+ ```tsx
107
+ timeRemaining(125.5, 3600); // "57:54"
108
+ timeRemaining(125.5, 3600, "human"); // "57 minutes 54 seconds"
109
+ ```
110
+
111
+ #### `formatTimeWithPercentage(current, total, format)`
112
+
113
+ Format time with percentage.
114
+
115
+ ```tsx
116
+ formatTimeWithPercentage(125.5, 3600); // "2:05 (3%)"
117
+ ```
118
+
119
+ #### `getTimeSegments(duration, segments)`
120
+
121
+ Get time segments for timeline.
122
+
123
+ ```tsx
124
+ getTimeSegments(3600, 5); // [0, 720, 1440, 2160, 2880, 3600]
125
+ ```
126
+
127
+ #### `formatTimeForAccessibility(time)`
128
+
129
+ Format time for screen readers.
130
+
131
+ ```tsx
132
+ formatTimeForAccessibility(125.5); // "2 minutes, 5 seconds"
133
+ ```
134
+
135
+ ### Advanced Examples
136
+
137
+ #### Custom Timeline Component
138
+
139
+ ```tsx
140
+ import { formatTime, getTimeSegments } from "@zuude-ui/video/utils";
141
+
142
+ const Timeline = ({ currentTime, duration }) => {
143
+ const segments = getTimeSegments(duration, 10);
144
+
145
+ return (
146
+ <div className="timeline">
147
+ {segments.map((time, i) => (
148
+ <div key={i} className="segment">
149
+ {formatTime(time, "mm:ss")}
150
+ </div>
151
+ ))}
152
+ </div>
153
+ );
154
+ };
155
+ ```
156
+
157
+ #### Video Progress Display
158
+
159
+ ```tsx
160
+ import {
161
+ formatTime,
162
+ timeRemaining,
163
+ formatTimeWithPercentage,
164
+ } from "@zuude-ui/video/utils";
165
+
166
+ const VideoProgress = ({ currentTime, duration }) => {
167
+ return (
168
+ <div className="video-progress">
169
+ <span>{formatTime(currentTime)}</span>
170
+ <span>{timeRemaining(currentTime, duration)}</span>
171
+ <span>{formatTimeWithPercentage(currentTime, duration)}</span>
172
+ </div>
173
+ );
174
+ };
175
+ ```
176
+
177
+ #### Accessibility-Friendly Time Display
178
+
179
+ ```tsx
180
+ import { formatTimeForAccessibility } from "@zuude-ui/video/utils";
181
+
182
+ const AccessibleTimeDisplay = ({ time }) => {
183
+ return (
184
+ <span aria-label={formatTimeForAccessibility(time)}>
185
+ {formatTime(time)}
186
+ </span>
187
+ );
188
+ };
189
+ ```
190
+
191
+ ### Comparison with Other Libraries
192
+
193
+ | Feature | @zuude-ui/video | date-fns | humanize-duration |
194
+ | ------------------ | --------------- | -------- | ----------------- |
195
+ | Video-specific | ✅ | ❌ | ❌ |
196
+ | Multiple formats | ✅ | ✅ | ❌ |
197
+ | Time parsing | ✅ | ❌ | ❌ |
198
+ | Accessibility | ✅ | ❌ | ❌ |
199
+ | Percentage display | ✅ | ❌ | ❌ |
200
+ | Time segments | ✅ | ❌ | ❌ |
201
+ | Bundle size | Small | Large | Medium |
202
+
203
+ ### Installation
204
+
205
+ ```bash
206
+ npm install @zuude-ui/video
207
+ # or
208
+ yarn add @zuude-ui/video
209
+ # or
210
+ pnpm add @zuude-ui/video
211
+ ```
212
+
213
+ ### TypeScript Support
214
+
215
+ Full TypeScript support with comprehensive type definitions:
216
+
217
+ ```tsx
218
+ import type { TimeFormat, TimeFormatOptions } from "@zuude-ui/video/utils";
219
+ ```
220
+
221
+ ## Video Player Components
222
+
223
+ The library also includes a complete video player with hooks and components. See the main documentation for video player usage.
@@ -0,0 +1,2 @@
1
+ import A from"react";var Q=(t,e,n)=>{A.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;(async()=>{var u;try{await((u=t.current)==null?void 0:u.play())}catch(a){if(a instanceof Error&&a.name==="NotAllowedError"){if(n==null||n("NotAllowedError"),console.error("NotAllowedError"),t!=null&&t.current){t.current.muted=!0;try{await t.current.play()}catch(c){console.error(c)}}}else console.error(a)}})()},[e,t==null?void 0:t.current])};import K from"react";var Z=(t,e,n=!0)=>{K.useEffect(()=>{if(!(t!=null&&t.current)||!n)return;let s=new IntersectionObserver(u=>{u.forEach(a=>{var c;t!=null&&t.current&&(a.isIntersecting?t.current.play().catch(r=>{t.current&&(t.current.pause(),t.current.muted=!0,t.current.play(),console.error(r))}):(c=t.current)==null||c.pause())})},{threshold:e!=null?e:.5});return s.observe(t==null?void 0:t.current),()=>{s.disconnect()}},[t==null?void 0:t.current])};import L from"react";var v=t=>{let[e,n]=L.useState(!1),s=L.useRef(null);L.useEffect(()=>{let a=()=>{let c=!!document.fullscreenElement;n(c);let r=t==null?void 0:t.current;r&&(c?(s.current={objectFit:r.style.objectFit||"cover",borderRadius:r.style.borderRadius||"",width:r.style.width||"",height:r.style.height||"",maxWidth:r.style.maxWidth||"",maxHeight:r.style.maxHeight||"",margin:r.style.margin||""},r.style.objectFit="contain",r.style.borderRadius="0",r.style.width="100%",r.style.height="100%",r.style.maxWidth="none",r.style.maxHeight="none",r.style.margin="0"):s.current&&(r.style.objectFit=s.current.objectFit,r.style.borderRadius=s.current.borderRadius,r.style.width=s.current.width,r.style.height=s.current.height,r.style.maxWidth=s.current.maxWidth,r.style.maxHeight=s.current.maxHeight,r.style.margin=s.current.margin,s.current=null))};return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[t]);let u=()=>{let a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),c=t==null?void 0:t.current;if(c&&a){if(c.webkitEnterFullscreen){c.webkitEnterFullscreen();return}else if(c.requestFullscreen){c.requestFullscreen();return}}let r=c==null?void 0:c.closest("[data-zuude-video-wrapper]");r&&(e?document.exitFullscreen():r.requestFullscreen())};return{isFullscreen:e!=null?e:!1,toggleFullscreen:u}};import V from"react";var rt=t=>{let[e,n]=V.useState(!1),[s,u]=V.useState(null);return V.useEffect(()=>{if(!(t!=null&&t.current))return;n(!0);let a=()=>{var l,m;u((m=(l=t.current)==null?void 0:l.duration)!=null?m:null),n(!1)},c=()=>{n(!1)},r=t.current;if(r.duration&&!isNaN(r.duration))u(r.duration),n(!1);else return r.addEventListener("loadedmetadata",a),r.addEventListener("error",c),r.addEventListener("loadeddata",a),()=>{r.removeEventListener("loadedmetadata",a),r.removeEventListener("error",c),r.removeEventListener("loadeddata",a)}},[t]),{duration:s,isLoading:e}};import{useEffect as $}from"react";var ut=(t,e,n=!0)=>{let s=u=>{u.key===t&&(u.preventDefault(),e(u))};$(()=>{if(n)return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[t,e,n])};import E from"react";var at=t=>{let[e,n]=E.useState(!1),s=E.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!t.current.muted)},[t==null?void 0:t.current]),u=E.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!0)},[t==null?void 0:t.current]),a=E.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!1)},[t==null?void 0:t.current]);return E.useEffect(()=>{if(!(t!=null&&t.current))return;n(t.current.muted);let c=()=>{t.current&&n(t.current.muted)};return t.current.addEventListener("volumechange",c),()=>{var r;(r=t.current)==null||r.removeEventListener("volumechange",c)}},[t==null?void 0:t.current]),{toggleMute:s,isMuted:e,mute:u,unmute:a}};var mt=t=>({togglePictureInPicture:async()=>{let u=t==null?void 0:t.current;if(u)try{document.pictureInPictureElement?await document.exitPictureInPicture():await u.requestPictureInPicture()}catch(a){if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent))u.webkitEnterFullscreen?u.webkitEnterFullscreen():u.requestFullscreen&&u.requestFullscreen();else{let r=u.closest("[data-zuude-video-wrapper]");r&&(document.fullscreenElement?await document.exitFullscreen():await r.requestFullscreen())}}},requestPictureInPicture:async()=>{let u=t==null?void 0:t.current;u&&await u.requestPictureInPicture()},exitPictureInPicture:async()=>{t!=null&&t.current&&await document.exitPictureInPicture()}});import b from"react";var yt=t=>{let[e,n]=b.useState(!1),s=b.useCallback(()=>{t!=null&&t.current&&(t.current.paused?t.current.play():t.current.pause())},[t==null?void 0:t.current]),u=b.useCallback(()=>{t!=null&&t.current&&t.current.play()},[t==null?void 0:t.current]),a=b.useCallback(()=>{t!=null&&t.current&&t.current.pause()},[t==null?void 0:t.current]);return b.useEffect(()=>{if(!(t!=null&&t.current))return;let c=()=>{n(!0)},r=()=>{n(!1)};if(n(!(t!=null&&t.current.paused)),t!=null&&t.current)return t.current.addEventListener("play",c),t.current.addEventListener("pause",r),()=>{var l,m;(l=t.current)==null||l.removeEventListener("play",c),(m=t.current)==null||m.removeEventListener("pause",r)}},[t==null?void 0:t.current]),{togglePlay:s,isPlaying:e,play:u,pause:a}};import M from"react";var Et=(t,e=10)=>{let n=M.useCallback(()=>{t!=null&&t.current&&(t.current.currentTime+=e)},[t==null?void 0:t.current]),s=M.useCallback(()=>{t!=null&&t.current&&(t.current.currentTime-=e)},[t==null?void 0:t.current]);return{seekForward:n,seekBackward:s}};import P from"react";var wt=t=>{let[e,n]=P.useState(1),s=u=>{n(u)};return P.useEffect(()=>{t!=null&&t.current&&n(t.current.playbackRate)},[t==null?void 0:t.current]),P.useEffect(()=>{t!=null&&t.current&&(t.current.playbackRate=e)},[e,t==null?void 0:t.current]),{speed:e,onChangeSpeed:s}};import z from"react";var Pt=(t,e)=>{z.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;let n=t==null?void 0:t.current;n&&e&&(n.currentTime=e)},[e,t==null?void 0:t.current])};import x from"react";var It=(t,e=10)=>{let[n,s]=x.useState(!1),[u,a]=x.useState(0);return x.useEffect(()=>{if(t!=null&&t.current&&n){let r=setInterval(()=>{var l;a(((l=t.current)==null?void 0:l.currentTime)||0)},e);return()=>clearInterval(r)}},[t==null?void 0:t.current,n]),x.useEffect(()=>{if(!(t!=null&&t.current))return;let r=t.current,l=()=>s(!0),m=()=>s(!1);return r.addEventListener("play",l),r.addEventListener("pause",m),()=>{r.removeEventListener("play",l),r.removeEventListener("pause",m)}},[t==null?void 0:t.current]),{currentTime:u,onTimeUpdate:r=>{t!=null&&t.current&&(a(r),t.current.currentTime=r)}}};import{useEffect as i,useState as F}from"react";var Tt=t=>{let[e,n]=F(!1),[s,u]=F(!1),[a,c]=F(!1);return i(()=>{let r=t.current;if(r)return r.addEventListener("play",()=>n(!0)),r.addEventListener("pause",()=>n(!1)),()=>{r.removeEventListener("play",()=>n(!0)),r.removeEventListener("pause",()=>n(!1))}},[t]),i(()=>{if(!(t!=null&&t.current))return;u(t.current.muted);let r=()=>{t.current&&u(t.current.muted)};return t.current.addEventListener("volumechange",r),()=>{var l;(l=t.current)==null||l.removeEventListener("volumechange",r)}},[t]),i(()=>{if(!(t!=null&&t.current))return;let r=()=>{c(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",r),()=>document.removeEventListener("fullscreenchange",r)},[t]),{isPlaying:e,isMuted:s,isFullscreen:a}};import I from"react";var qt=(t,e=100)=>{let[n,s]=I.useState(e),u=a=>{s(a)};return I.useEffect(()=>{t!=null&&t.current&&s(t.current.volume*100)},[t==null?void 0:t.current]),I.useEffect(()=>{t!=null&&t.current&&(t.current.volume=n/100)},[n,t==null?void 0:t.current]),{volume:n,onChangeVolume:u}};import w from"react";var Ut=(t,e)=>{let[n,s]=w.useState(!1),[u,a]=w.useState(0);return w.useEffect(()=>{if(t!=null&&t.current&&n){let c=setInterval(()=>{var r;(r=t.current)!=null&&r.buffered.length&&a(t.current.buffered.end(t.current.buffered.length-1))},10);return()=>clearInterval(c)}},[t==null?void 0:t.current,n]),w.useEffect(()=>{if(t!=null&&t.current)return t.current.addEventListener("play",()=>s(!0)),t.current.addEventListener("pause",()=>s(!1)),()=>{var c,r;(c=t.current)==null||c.removeEventListener("play",()=>s(!0)),(r=t.current)==null||r.removeEventListener("pause",()=>s(!1))}},[]),{buffered:u,bufferedPercentage:u/(e||0)*100||0}};import{useEffect as G,useState as k,useCallback as U}from"react";var Ot=t=>{let[e,n]=k(!1),[s,u]=k(0),[a,c]=k(null),r=U(async m=>{var p;if(!(t!=null&&t.current)){c("Video element not found");return}let y=t.current,g=y.src||y.currentSrc;if(!g){c("No video source found");return}try{n(!0),c(null),u(0);let o=await fetch(g);if(!o.ok)throw new Error(`Failed to fetch video: ${o.statusText}`);let S=o.headers.get("content-length"),C=S?parseInt(S,10):0,T=(p=o.body)==null?void 0:p.getReader();if(!T)throw new Error("Failed to create download stream");let D=[],j=0;for(;;){let{done:O,value:H}=await T.read();if(O)break;if(D.push(H),j+=H.length,C>0){let W=j/C*100;u(Math.round(W))}}let N=new Blob(D,{type:o.headers.get("content-type")||"video/mp4"}),q=URL.createObjectURL(N),h=document.createElement("a");h.href=q;let B=m||`video-${Date.now()}.mp4`;h.download=B,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(q),u(100),n(!1)}catch(o){c(o instanceof Error?o.message:"Download failed"),n(!1),u(0)}},[t]),l=U(m=>{if(!(t!=null&&t.current)){c("Video element not found");return}let y=t.current,g=y.src||y.currentSrc;if(!g){c("No video source found");return}try{n(!0),c(null),u(0);let p=document.createElement("a");p.href=g,p.download=m||`video-${Date.now()}.mp4`,p.target="_blank",document.body.appendChild(p),p.click(),document.body.removeChild(p),n(!1),u(100)}catch(p){c(p instanceof Error?p.message:"Download failed"),n(!1),u(0)}},[t]);return G(()=>()=>{n(!1),u(0),c(null)},[]),{downloadVideo:r,downloadDirect:l,isDownloading:e,downloadProgress:s,error:a,resetError:()=>c(null)}};import _ from"react";var Kt=(t,e)=>{_.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;let n=t.current;if(n){let s=()=>{(n.currentTime>=e[1]||n.currentTime<=e[0])&&(n.currentTime=e[0])};return n.addEventListener("timeupdate",s),()=>{n.removeEventListener("timeupdate",s)}}},[e,t==null?void 0:t.current])};export{Q as a,ut as b,Et as c,yt as d,at as e,v as f,mt as g,Z as h,rt as i,wt as j,Pt as k,It as l,Tt as m,qt as n,Ut as o,Ot as p,Kt as q};
2
+ //# sourceMappingURL=chunk-XV6ODTKT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-autoplay-by-force.tsx","../src/hooks/use-autoplay-on-visible.tsx","../src/hooks/use-fullscreen.tsx","../src/hooks/use-get-duration.tsx","../src/hooks/use-hot-keys.tsx","../src/hooks/use-mute-unmute.tsx","../src/hooks/use-picture-in-picture.tsx","../src/hooks/use-play-pause.tsx","../src/hooks/use-seek.tsx","../src/hooks/use-speed.tsx","../src/hooks/use-start-at.tsx","../src/hooks/use-current-time.tsx","../src/hooks/use-video-state.tsx","../src/hooks/use-volume.tsx","../src/hooks/use-buffer.tsx","../src/hooks/use-download.tsx","../src/hooks/use-range.tsx"],"sourcesContent":["import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useAutoplayByForce = (\n videoRef: VideoRef,\n enabled: boolean,\n setError?: (error: string | null) => void\n) => {\n React.useEffect(() => {\n if (!videoRef?.current || !enabled) return;\n\n const playVideo = async () => {\n try {\n await videoRef.current?.play();\n } catch (error) {\n // If autoplay fails, try muting and playing again\n if (error instanceof Error && error.name === \"NotAllowedError\") {\n setError?.(\"NotAllowedError\");\n console.error(\"NotAllowedError\");\n if (videoRef?.current) {\n videoRef.current.muted = true;\n try {\n await videoRef.current.play();\n } catch (retryError) {\n console.error(retryError);\n }\n }\n } else {\n console.error(error);\n }\n }\n };\n\n playVideo();\n }, [enabled, videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useAutoplayOnVisible = (\n videoRef: VideoRef,\n threshold: number | undefined,\n enabled = true\n) => {\n React.useEffect(() => {\n if (!videoRef?.current || !enabled) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (!videoRef?.current) return;\n\n if (entry.isIntersecting) {\n videoRef.current.play().catch((error) => {\n if (!videoRef.current) return;\n\n videoRef.current.pause();\n videoRef.current.muted = true;\n videoRef.current.play();\n console.error(error);\n });\n } else {\n videoRef.current?.pause();\n }\n });\n },\n { threshold: threshold ?? 0.5 }\n );\n\n observer.observe(videoRef?.current);\n\n return () => {\n observer.disconnect();\n };\n }, [videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nconst useFullscreen = (videoRef: VideoRef) => {\n const [isFullscreen, setIsFullscreen] = React.useState(false);\n const previousStylesRef = React.useRef<{\n objectFit: string;\n borderRadius: string;\n width: string;\n height: string;\n maxWidth: string;\n maxHeight: string;\n margin: string;\n } | null>(null);\n\n React.useEffect(() => {\n const handleFullscreenChange = () => {\n const isCurrentlyFullscreen = !!document.fullscreenElement;\n setIsFullscreen(isCurrentlyFullscreen);\n\n // Apply styles based on fullscreen state\n const video = videoRef?.current;\n if (video) {\n if (isCurrentlyFullscreen) {\n // Store previous styles before entering fullscreen\n previousStylesRef.current = {\n objectFit: video.style.objectFit || \"cover\",\n borderRadius: video.style.borderRadius || \"\",\n width: video.style.width || \"\",\n height: video.style.height || \"\",\n maxWidth: video.style.maxWidth || \"\",\n maxHeight: video.style.maxHeight || \"\",\n margin: video.style.margin || \"\",\n };\n // Apply fullscreen styles\n video.style.objectFit = \"contain\";\n video.style.borderRadius = \"0\";\n video.style.width = \"100%\";\n video.style.height = \"100%\";\n video.style.maxWidth = \"none\";\n video.style.maxHeight = \"none\";\n video.style.margin = \"0\";\n } else {\n // Restore previous styles when exiting fullscreen\n if (previousStylesRef.current) {\n video.style.objectFit = previousStylesRef.current.objectFit;\n video.style.borderRadius = previousStylesRef.current.borderRadius;\n video.style.width = previousStylesRef.current.width;\n video.style.height = previousStylesRef.current.height;\n video.style.maxWidth = previousStylesRef.current.maxWidth;\n video.style.maxHeight = previousStylesRef.current.maxHeight;\n video.style.margin = previousStylesRef.current.margin;\n previousStylesRef.current = null;\n }\n }\n }\n };\n\n document.addEventListener(\"fullscreenchange\", handleFullscreenChange);\n return () =>\n document.removeEventListener(\"fullscreenchange\", handleFullscreenChange);\n }, [videoRef]);\n\n const toggleFullscreen = () => {\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n const video = videoRef?.current;\n\n if (video && isSafari) {\n if ((video as any).webkitEnterFullscreen) {\n (video as any).webkitEnterFullscreen();\n return;\n } else if (video.requestFullscreen) {\n video.requestFullscreen();\n return;\n }\n }\n\n const videoContainer = video?.closest(\n \"[data-zuude-video-wrapper]\"\n ) as HTMLElement;\n\n if (videoContainer) {\n if (!isFullscreen) {\n videoContainer.requestFullscreen();\n } else {\n document.exitFullscreen();\n }\n }\n };\n\n return { isFullscreen: isFullscreen ?? false, toggleFullscreen };\n};\n\nexport { useFullscreen };\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useGetDuration = (videoRef: VideoRef) => {\n const [isLoading, setIsLoading] = React.useState(false);\n const [duration, setDuration] = React.useState<number | null>(null);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n setIsLoading(true);\n\n const getDuration = () => {\n setDuration(videoRef.current?.duration ?? null);\n setIsLoading(false);\n };\n\n const handleError = () => {\n setIsLoading(false);\n };\n\n const video = videoRef.current;\n\n // Check if duration is already available\n if (video.duration && !isNaN(video.duration)) {\n setDuration(video.duration);\n setIsLoading(false);\n } else {\n // Add event listeners\n video.addEventListener(\"loadedmetadata\", getDuration);\n video.addEventListener(\"error\", handleError);\n video.addEventListener(\"loadeddata\", getDuration);\n\n return () => {\n video.removeEventListener(\"loadedmetadata\", getDuration);\n video.removeEventListener(\"error\", handleError);\n video.removeEventListener(\"loadeddata\", getDuration);\n };\n }\n }, [videoRef]);\n\n return { duration, isLoading };\n};\n","import { useEffect } from \"react\";\n\nexport const useHotKeys = (\n key: string,\n func: (event: KeyboardEvent) => void,\n enabled = true\n) => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === key) {\n event.preventDefault();\n func(event);\n }\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [key, func, enabled]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useMuteUnmute = (videoRef: VideoRef) => {\n const [isMuted, setIsMuted] = React.useState(false);\n\n const toggleMute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = !videoRef.current.muted;\n }\n }, [videoRef?.current]);\n\n const mute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = true;\n }\n }, [videoRef?.current]);\n\n const unmute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = false;\n }\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n // Set the initial state\n setIsMuted(videoRef.current.muted);\n\n const handleVolumeChange = () => {\n if (videoRef.current) {\n setIsMuted(videoRef.current.muted);\n }\n };\n\n videoRef.current.addEventListener(\"volumechange\", handleVolumeChange);\n\n return () => {\n videoRef.current?.removeEventListener(\"volumechange\", handleVolumeChange);\n };\n }, [videoRef?.current]);\n\n return { toggleMute, isMuted, mute, unmute };\n};\n","import type { VideoRef } from \"../types\";\n\nexport const usePictureInPicture = (videoRef: VideoRef) => {\n const togglePictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n\n try {\n if (document.pictureInPictureElement) {\n await document.exitPictureInPicture();\n } else {\n await video.requestPictureInPicture();\n }\n } catch (error) {\n // Fallback for browsers that don't support PiP\n const isSafari = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent\n );\n\n if (isSafari) {\n if ((video as any).webkitEnterFullscreen) {\n (video as any).webkitEnterFullscreen();\n } else if (video.requestFullscreen) {\n video.requestFullscreen();\n }\n } else {\n const videoContainer = video.closest(\n \"[data-zuude-video-wrapper]\"\n ) as HTMLElement;\n if (videoContainer) {\n if (!document.fullscreenElement) {\n await videoContainer.requestFullscreen();\n } else {\n await document.exitFullscreen();\n }\n }\n }\n }\n };\n\n const requestPictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n await video.requestPictureInPicture();\n };\n\n const exitPictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n await document.exitPictureInPicture();\n };\n\n return {\n togglePictureInPicture,\n requestPictureInPicture,\n exitPictureInPicture,\n };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const usePlayPause = (videoRef: VideoRef) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n\n const togglePlay = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.paused\n ? videoRef.current.play()\n : videoRef.current.pause();\n }\n }, [videoRef?.current]);\n\n const play = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.play();\n }\n }, [videoRef?.current]);\n\n const pause = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.pause();\n }\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n const handlePlay = () => {\n setIsPlaying(true);\n };\n const handlePause = () => {\n setIsPlaying(false);\n };\n\n setIsPlaying(!videoRef?.current.paused);\n\n if (videoRef?.current) {\n videoRef.current.addEventListener(\"play\", handlePlay);\n videoRef.current.addEventListener(\"pause\", handlePause);\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", handlePlay);\n videoRef.current?.removeEventListener(\"pause\", handlePause);\n };\n }\n }, [videoRef?.current]);\n\n return { togglePlay, isPlaying, play, pause };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useSeek = (videoRef: VideoRef, value = 10) => {\n const seekForward = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.currentTime += value;\n }\n }, [videoRef?.current]);\n\n const seekBackward = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.currentTime -= value;\n }\n }, [videoRef?.current]);\n\n return { seekForward, seekBackward };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useSpeed = (videoRef: VideoRef) => {\n const [speed, setSpeed] = React.useState(1);\n\n const onChangeSpeed = (speed: number) => {\n setSpeed(speed);\n };\n\n // Get the speed from the video element\n React.useEffect(() => {\n if (!videoRef?.current) return;\n setSpeed(videoRef.current.playbackRate);\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.playbackRate = speed;\n }, [speed, videoRef?.current]);\n\n return { speed, onChangeSpeed };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useStartAt = (videoRef: VideoRef, startAt: number) => {\n React.useEffect(() => {\n if (!videoRef?.current || !startAt) return;\n\n const video = videoRef?.current;\n if (video && startAt) {\n video.currentTime = startAt;\n }\n }, [startAt, videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types.js\";\n\nexport const useCurrentTime = (videoRef: VideoRef, interval = 10) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n const [currentTime, setCurrentTime] = React.useState(0);\n\n React.useEffect(() => {\n if (videoRef?.current && isPlaying) {\n const intervalId = setInterval(() => {\n setCurrentTime(videoRef.current?.currentTime || 0);\n }, interval);\n\n return () => clearInterval(intervalId);\n }\n }, [videoRef?.current, isPlaying]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n const video = videoRef.current;\n\n // Store handlers in variables for proper cleanup (critical for Safari memory safety)\n const handlePlay = () => setIsPlaying(true);\n const handlePause = () => setIsPlaying(false);\n\n video.addEventListener(\"play\", handlePlay);\n video.addEventListener(\"pause\", handlePause);\n\n return () => {\n video.removeEventListener(\"play\", handlePlay);\n video.removeEventListener(\"pause\", handlePause);\n };\n }, [videoRef?.current]);\n\n const onTimeUpdate = (time: number) => {\n if (videoRef?.current) {\n setCurrentTime(time);\n videoRef.current.currentTime = time;\n }\n };\n\n return {\n currentTime,\n onTimeUpdate,\n };\n};\n","import { RefObject, useEffect, useState } from \"react\";\n\nconst useVideoState = (videoRef: RefObject<HTMLVideoElement | null>) => {\n const [isPlaying, setIsPlaying] = useState(false);\n const [isMuted, setIsMuted] = useState(false);\n const [isFullscreen, setIsFullscreen] = useState(false);\n\n useEffect(() => {\n const video = videoRef.current;\n\n if (video) {\n video.addEventListener(\"play\", () => setIsPlaying(true));\n video.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n video.removeEventListener(\"play\", () => setIsPlaying(true));\n video.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }\n }, [videoRef]);\n\n useEffect(() => {\n if (!videoRef?.current) return;\n\n // Set the initial state\n setIsMuted(videoRef.current.muted);\n\n const handleVolumeChange = () => {\n if (videoRef.current) {\n setIsMuted(videoRef.current.muted);\n }\n };\n\n videoRef.current.addEventListener(\"volumechange\", handleVolumeChange);\n\n return () => {\n videoRef.current?.removeEventListener(\"volumechange\", handleVolumeChange);\n };\n }, [videoRef]);\n\n useEffect(() => {\n if (!videoRef?.current) return;\n\n const handleFullscreenChange = () => {\n setIsFullscreen(!!document.fullscreenElement);\n };\n\n document.addEventListener(\"fullscreenchange\", handleFullscreenChange);\n return () =>\n document.removeEventListener(\"fullscreenchange\", handleFullscreenChange);\n }, [videoRef]);\n\n return { isPlaying, isMuted, isFullscreen };\n};\n\nexport { useVideoState };\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useVolume = (videoRef: VideoRef, initialVolume = 100) => {\n const [volume, setVolume] = React.useState(initialVolume);\n\n const onChangeVolume = (volume: number) => {\n setVolume(volume);\n };\n\n // Get the volume from the video element\n React.useEffect(() => {\n if (!videoRef?.current) return;\n setVolume(videoRef.current.volume * 100);\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.volume = volume / 100;\n }, [volume, videoRef?.current]);\n\n return { volume, onChangeVolume };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types.js\";\n\nexport const useBuffer = (videoRef: VideoRef, duration?: number) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n const [buffered, setBuffered] = React.useState(0);\n\n React.useEffect(() => {\n if (videoRef?.current && isPlaying) {\n const intervalId = setInterval(() => {\n if (videoRef.current?.buffered.length) {\n setBuffered(\n videoRef.current.buffered.end(videoRef.current.buffered.length - 1)\n );\n }\n }, 10);\n\n return () => clearInterval(intervalId);\n }\n }, [videoRef?.current, isPlaying]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.addEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current?.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }, []);\n\n return {\n buffered,\n bufferedPercentage: (buffered / (duration || 0)) * 100 || 0,\n };\n};\n","import { useEffect, useState, useCallback } from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useDownload = (videoRef: VideoRef) => {\n const [isDownloading, setIsDownloading] = useState(false);\n const [downloadProgress, setDownloadProgress] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const downloadVideo = useCallback(\n async (filename?: string) => {\n if (!videoRef?.current) {\n setError(\"Video element not found\");\n return;\n }\n\n const video = videoRef.current;\n const videoSrc = video.src || video.currentSrc;\n\n if (!videoSrc) {\n setError(\"No video source found\");\n return;\n }\n\n try {\n setIsDownloading(true);\n setError(null);\n setDownloadProgress(0);\n\n // Fetch the video file\n const response = await fetch(videoSrc);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch video: ${response.statusText}`);\n }\n\n // Get the content length for progress tracking\n const contentLength = response.headers.get(\"content-length\");\n const total = contentLength ? parseInt(contentLength, 10) : 0;\n\n // Create a readable stream to track progress\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error(\"Failed to create download stream\");\n }\n\n const chunks: BlobPart[] = [];\n let receivedLength = 0;\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) break;\n\n chunks.push(value);\n receivedLength += value.length;\n\n if (total > 0) {\n const progress = (receivedLength / total) * 100;\n setDownloadProgress(Math.round(progress));\n }\n }\n\n // Combine chunks into a single blob\n const blob = new Blob(chunks, {\n type: response.headers.get(\"content-type\") || \"video/mp4\",\n });\n\n // Create download link\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n\n // Generate filename if not provided\n const defaultFilename = filename || `video-${Date.now()}.mp4`;\n link.download = defaultFilename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n // Clean up\n URL.revokeObjectURL(url);\n\n setDownloadProgress(100);\n setIsDownloading(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Download failed\");\n setIsDownloading(false);\n setDownloadProgress(0);\n }\n },\n [videoRef]\n );\n\n // Alternative simple download method for direct video URLs\n const downloadDirect = useCallback(\n (filename?: string) => {\n if (!videoRef?.current) {\n setError(\"Video element not found\");\n return;\n }\n\n const video = videoRef.current;\n const videoSrc = video.src || video.currentSrc;\n\n if (!videoSrc) {\n setError(\"No video source found\");\n return;\n }\n\n try {\n setIsDownloading(true);\n setError(null);\n setDownloadProgress(0);\n\n const link = document.createElement(\"a\");\n link.href = videoSrc;\n link.download = filename || `video-${Date.now()}.mp4`;\n link.target = \"_blank\";\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n setIsDownloading(false);\n setDownloadProgress(100);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Download failed\");\n setIsDownloading(false);\n setDownloadProgress(0);\n }\n },\n [videoRef]\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n setIsDownloading(false);\n setDownloadProgress(0);\n setError(null);\n };\n }, []);\n\n return {\n downloadVideo,\n downloadDirect,\n isDownloading,\n downloadProgress,\n error,\n resetError: () => setError(null),\n };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useRange = (videoRef: VideoRef, range: [number, number]) => {\n React.useEffect(() => {\n if (!videoRef?.current || !range) return;\n\n const video = videoRef.current;\n\n if (video) {\n const handleTimeUpdate = () => {\n if (video.currentTime >= range[1]) {\n video.currentTime = range[0];\n } else if (video.currentTime <= range[0]) {\n video.currentTime = range[0];\n }\n };\n\n video.addEventListener(\"timeupdate\", handleTimeUpdate);\n\n return () => {\n video.removeEventListener(\"timeupdate\", handleTimeUpdate);\n };\n }\n }, [range, videoRef?.current]);\n};\n"],"mappings":"AAAA,OAAOA,MAAW,QAGX,IAAMC,EAAqB,CAChCC,EACAC,EACAC,IACG,CACHJ,EAAM,UAAU,IAAM,CACpB,GAAI,EAACE,GAAA,MAAAA,EAAU,UAAW,CAACC,EAAS,QAElB,SAAY,CAXlC,IAAAE,EAYM,GAAI,CACF,OAAMA,EAAAH,EAAS,UAAT,YAAAG,EAAkB,OAC1B,OAASC,EAAO,CAEd,GAAIA,aAAiB,OAASA,EAAM,OAAS,mBAG3C,GAFAF,GAAA,MAAAA,EAAW,mBACX,QAAQ,MAAM,iBAAiB,EAC3BF,GAAA,MAAAA,EAAU,QAAS,CACrBA,EAAS,QAAQ,MAAQ,GACzB,GAAI,CACF,MAAMA,EAAS,QAAQ,KAAK,CAC9B,OAASK,EAAY,CACnB,QAAQ,MAAMA,CAAU,CAC1B,CACF,OAEA,QAAQ,MAAMD,CAAK,CAEvB,CACF,GAEU,CACZ,EAAG,CAACH,EAASD,GAAA,YAAAA,EAAU,OAAO,CAAC,CACjC,ECnCA,OAAOM,MAAW,QAGX,IAAMC,EAAuB,CAClCC,EACAC,EACAC,EAAU,KACP,CACHJ,EAAM,UAAU,IAAM,CACpB,GAAI,EAACE,GAAA,MAAAA,EAAU,UAAW,CAACE,EAAS,OAEpC,IAAMC,EAAW,IAAI,qBAClBC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CAAC,CAAC,EAEE,CACL,cAAAC,EACA,eAAAmB,EACA,cAAAzB,EACA,iBAAAE,EACA,MAAAE,EACA,WAAY,IAAMC,EAAS,IAAI,CACjC,CACF,ECzJA,OAAOqB,MAAW,QAGX,IAAMC,GAAW,CAACC,EAAoBC,IAA4B,CACvEH,EAAM,UAAU,IAAM,CACpB,GAAI,EAACE,GAAA,MAAAA,EAAU,UAAW,CAACC,EAAO,OAElC,IAAMC,EAAQF,EAAS,QAEvB,GAAIE,EAAO,CACT,IAAMC,EAAmB,IAAM,EACzBD,EAAM,aAAeD,EAAM,CAAC,GAErBC,EAAM,aAAeD,EAAM,CAAC,KACrCC,EAAM,YAAcD,EAAM,CAAC,EAE/B,EAEA,OAAAC,EAAM,iBAAiB,aAAcC,CAAgB,EAE9C,IAAM,CACXD,EAAM,oBAAoB,aAAcC,CAAgB,CAC1D,CACF,CACF,EAAG,CAACF,EAAOD,GAAA,YAAAA,EAAU,OAAO,CAAC,CAC/B","names":["React","useAutoplayByForce","videoRef","enabled","setError","_a","error","retryError","React","useAutoplayOnVisible","videoRef","threshold","enabled","observer","entries","entry","_a","error","React","useFullscreen","videoRef","isFullscreen","setIsFullscreen","previousStylesRef","handleFullscreenChange","isCurrentlyFullscreen","video","toggleFullscreen","isSafari","videoContainer","React","useGetDuration","videoRef","isLoading","setIsLoading","duration","setDuration","getDuration","_a","_b","handleError","video","useEffect","useHotKeys","key","func","enabled","handleKeyDown","event","React","useMuteUnmute","videoRef","isMuted","setIsMuted","toggleMute","mute","unmute","handleVolumeChange","_a","usePictureInPicture","videoRef","video","error","videoContainer","React","usePlayPause","videoRef","isPlaying","setIsPlaying","togglePlay","play","pause","handlePlay","handlePause","_a","_b","React","useSeek","videoRef","value","seekForward","seekBackward","React","useSpeed","videoRef","speed","setSpeed","onChangeSpeed","React","useStartAt","videoRef","startAt","video","React","useCurrentTime","videoRef","interval","isPlaying","setIsPlaying","currentTime","setCurrentTime","intervalId","_a","video","handlePlay","handlePause","time","useEffect","useState","useVideoState","videoRef","isPlaying","setIsPlaying","isMuted","setIsMuted","isFullscreen","setIsFullscreen","video","handleVolumeChange","_a","handleFullscreenChange","React","useVolume","videoRef","initialVolume","volume","setVolume","onChangeVolume","React","useBuffer","videoRef","duration","isPlaying","setIsPlaying","buffered","setBuffered","intervalId","_a","_b","useEffect","useState","useCallback","useDownload","videoRef","isDownloading","setIsDownloading","downloadProgress","setDownloadProgress","error","setError","downloadVideo","filename","_a","video","videoSrc","response","contentLength","total","reader","chunks","receivedLength","done","value","progress","blob","url","link","defaultFilename","err","downloadDirect","React","useRange","videoRef","range","video","handleTimeUpdate"]}
@@ -0,0 +1,2 @@
1
+ import A from"react";var Q=(t,e,n)=>{A.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;(async()=>{var u;try{await((u=t.current)==null?void 0:u.play())}catch(a){if(a instanceof Error&&a.name==="NotAllowedError"){if(n==null||n("NotAllowedError"),console.error("NotAllowedError"),t!=null&&t.current){t.current.muted=!0;try{await t.current.play()}catch(c){console.error(c)}}}else console.error(a)}})()},[e,t==null?void 0:t.current])};import K from"react";var Z=(t,e,n=!0)=>{K.useEffect(()=>{if(!(t!=null&&t.current)||!n)return;let s=new IntersectionObserver(u=>{u.forEach(a=>{var c;t!=null&&t.current&&(a.isIntersecting?t.current.play().catch(r=>{t.current&&(t.current.pause(),t.current.muted=!0,t.current.play(),console.error(r))}):(c=t.current)==null||c.pause())})},{threshold:e!=null?e:.5});return s.observe(t==null?void 0:t.current),()=>{s.disconnect()}},[t==null?void 0:t.current])};import L from"react";var v=t=>{let[e,n]=L.useState(!1),s=L.useRef(null);L.useEffect(()=>{let a=()=>{let c=!!document.fullscreenElement;n(c);let r=t==null?void 0:t.current;r&&(c?(s.current={objectFit:r.style.objectFit||"cover",borderRadius:r.style.borderRadius||"",width:r.style.width||"",height:r.style.height||"",maxWidth:r.style.maxWidth||"",maxHeight:r.style.maxHeight||"",margin:r.style.margin||""},r.style.objectFit="contain",r.style.borderRadius="0",r.style.width="100%",r.style.height="100%",r.style.maxWidth="none",r.style.maxHeight="none",r.style.margin="0"):s.current&&(r.style.objectFit=s.current.objectFit,r.style.borderRadius=s.current.borderRadius,r.style.width=s.current.width,r.style.height=s.current.height,r.style.maxWidth=s.current.maxWidth,r.style.maxHeight=s.current.maxHeight,r.style.margin=s.current.margin,s.current=null))};return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[t]);let u=()=>{let a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),c=t==null?void 0:t.current;if(c&&a){if(c.webkitEnterFullscreen){c.webkitEnterFullscreen();return}else if(c.requestFullscreen){c.requestFullscreen();return}}let r=c==null?void 0:c.closest("[data-zuude-video-wrapper]");r&&(e?document.exitFullscreen():r.requestFullscreen())};return{isFullscreen:e!=null?e:!1,toggleFullscreen:u}};import V from"react";var rt=t=>{let[e,n]=V.useState(!1),[s,u]=V.useState(null);return V.useEffect(()=>{if(!(t!=null&&t.current))return;n(!0);let a=()=>{var l,p;u((p=(l=t.current)==null?void 0:l.duration)!=null?p:null),n(!1)},c=()=>{n(!1)},r=t.current;if(r.duration&&!isNaN(r.duration))u(r.duration),n(!1);else return r.addEventListener("loadedmetadata",a),r.addEventListener("error",c),r.addEventListener("loadeddata",a),()=>{r.removeEventListener("loadedmetadata",a),r.removeEventListener("error",c),r.removeEventListener("loadeddata",a)}},[t]),{duration:s,isLoading:e}};import{useEffect as $}from"react";var ut=(t,e,n=!0)=>{let s=u=>{u.key===t&&(u.preventDefault(),e(u))};$(()=>{if(n)return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[t,e,n])};import E from"react";var at=t=>{let[e,n]=E.useState(!1),s=E.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!t.current.muted)},[t==null?void 0:t.current]),u=E.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!0)},[t==null?void 0:t.current]),a=E.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!1)},[t==null?void 0:t.current]);return E.useEffect(()=>{if(!(t!=null&&t.current))return;n(t.current.muted);let c=()=>{t.current&&n(t.current.muted)};return t.current.addEventListener("volumechange",c),()=>{var r;(r=t.current)==null||r.removeEventListener("volumechange",c)}},[t==null?void 0:t.current]),{toggleMute:s,isMuted:e,mute:u,unmute:a}};var mt=t=>({togglePictureInPicture:async()=>{let u=t==null?void 0:t.current;if(u)try{document.pictureInPictureElement?await document.exitPictureInPicture():await u.requestPictureInPicture()}catch(a){if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent))u.webkitEnterFullscreen?u.webkitEnterFullscreen():u.requestFullscreen&&u.requestFullscreen();else{let r=u.closest("[data-zuude-video-wrapper]");r&&(document.fullscreenElement?await document.exitFullscreen():await r.requestFullscreen())}}},requestPictureInPicture:async()=>{let u=t==null?void 0:t.current;u&&await u.requestPictureInPicture()},exitPictureInPicture:async()=>{t!=null&&t.current&&await document.exitPictureInPicture()}});import b from"react";var yt=t=>{let[e,n]=b.useState(!1),s=b.useCallback(()=>{t!=null&&t.current&&(t.current.paused?t.current.play():t.current.pause())},[t==null?void 0:t.current]),u=b.useCallback(()=>{t!=null&&t.current&&t.current.play()},[t==null?void 0:t.current]),a=b.useCallback(()=>{t!=null&&t.current&&t.current.pause()},[t==null?void 0:t.current]);return b.useEffect(()=>{if(!(t!=null&&t.current))return;let c=()=>{n(!0)},r=()=>{n(!1)};if(n(!(t!=null&&t.current.paused)),t!=null&&t.current)return t.current.addEventListener("play",c),t.current.addEventListener("pause",r),()=>{var l,p;(l=t.current)==null||l.removeEventListener("play",c),(p=t.current)==null||p.removeEventListener("pause",r)}},[t==null?void 0:t.current]),{togglePlay:s,isPlaying:e,play:u,pause:a}};import M from"react";var Et=(t,e=10)=>{let n=M.useCallback(()=>{t!=null&&t.current&&(t.current.currentTime+=e)},[t==null?void 0:t.current]),s=M.useCallback(()=>{t!=null&&t.current&&(t.current.currentTime-=e)},[t==null?void 0:t.current]);return{seekForward:n,seekBackward:s}};import P from"react";var wt=t=>{let[e,n]=P.useState(1),s=u=>{n(u)};return P.useEffect(()=>{t!=null&&t.current&&n(t.current.playbackRate)},[t==null?void 0:t.current]),P.useEffect(()=>{t!=null&&t.current&&(t.current.playbackRate=e)},[e,t==null?void 0:t.current]),{speed:e,onChangeSpeed:s}};import z from"react";var Pt=(t,e)=>{z.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;let n=t==null?void 0:t.current;n&&e&&(n.currentTime=e)},[e,t==null?void 0:t.current])};import x from"react";var It=(t,e=10)=>{let[n,s]=x.useState(!1),[u,a]=x.useState(0);return x.useEffect(()=>{if(t!=null&&t.current&&n){let r=setInterval(()=>{var l;a(((l=t.current)==null?void 0:l.currentTime)||0)},e);return()=>clearInterval(r)}},[t==null?void 0:t.current,n]),x.useEffect(()=>{if(t!=null&&t.current)return t.current.addEventListener("play",()=>s(!0)),t.current.addEventListener("pause",()=>s(!1)),()=>{var r,l;(r=t.current)==null||r.removeEventListener("play",()=>s(!0)),(l=t.current)==null||l.removeEventListener("pause",()=>s(!1))}},[t==null?void 0:t.current]),{currentTime:u,onTimeUpdate:r=>{t!=null&&t.current&&(a(r),t.current.currentTime=r)}}};import{useEffect as i,useState as F}from"react";var Tt=t=>{let[e,n]=F(!1),[s,u]=F(!1),[a,c]=F(!1);return i(()=>{let r=t.current;if(r)return r.addEventListener("play",()=>n(!0)),r.addEventListener("pause",()=>n(!1)),()=>{r.removeEventListener("play",()=>n(!0)),r.removeEventListener("pause",()=>n(!1))}},[t]),i(()=>{if(!(t!=null&&t.current))return;u(t.current.muted);let r=()=>{t.current&&u(t.current.muted)};return t.current.addEventListener("volumechange",r),()=>{var l;(l=t.current)==null||l.removeEventListener("volumechange",r)}},[t]),i(()=>{if(!(t!=null&&t.current))return;let r=()=>{c(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",r),()=>document.removeEventListener("fullscreenchange",r)},[t]),{isPlaying:e,isMuted:s,isFullscreen:a}};import I from"react";var qt=(t,e=100)=>{let[n,s]=I.useState(e),u=a=>{s(a)};return I.useEffect(()=>{t!=null&&t.current&&s(t.current.volume*100)},[t==null?void 0:t.current]),I.useEffect(()=>{t!=null&&t.current&&(t.current.volume=n/100)},[n,t==null?void 0:t.current]),{volume:n,onChangeVolume:u}};import w from"react";var Ut=(t,e)=>{let[n,s]=w.useState(!1),[u,a]=w.useState(0);return w.useEffect(()=>{if(t!=null&&t.current&&n){let c=setInterval(()=>{var r;(r=t.current)!=null&&r.buffered.length&&a(t.current.buffered.end(t.current.buffered.length-1))},10);return()=>clearInterval(c)}},[t==null?void 0:t.current,n]),w.useEffect(()=>{if(t!=null&&t.current)return t.current.addEventListener("play",()=>s(!0)),t.current.addEventListener("pause",()=>s(!1)),()=>{var c,r;(c=t.current)==null||c.removeEventListener("play",()=>s(!0)),(r=t.current)==null||r.removeEventListener("pause",()=>s(!1))}},[]),{buffered:u,bufferedPercentage:u/(e||0)*100||0}};import{useEffect as G,useState as k,useCallback as U}from"react";var Ot=t=>{let[e,n]=k(!1),[s,u]=k(0),[a,c]=k(null),r=U(async p=>{var m;if(!(t!=null&&t.current)){c("Video element not found");return}let y=t.current,g=y.src||y.currentSrc;if(!g){c("No video source found");return}try{n(!0),c(null),u(0);let o=await fetch(g);if(!o.ok)throw new Error(`Failed to fetch video: ${o.statusText}`);let S=o.headers.get("content-length"),C=S?parseInt(S,10):0,T=(m=o.body)==null?void 0:m.getReader();if(!T)throw new Error("Failed to create download stream");let D=[],j=0;for(;;){let{done:O,value:H}=await T.read();if(O)break;if(D.push(H),j+=H.length,C>0){let W=j/C*100;u(Math.round(W))}}let N=new Blob(D,{type:o.headers.get("content-type")||"video/mp4"}),q=URL.createObjectURL(N),h=document.createElement("a");h.href=q;let B=p||`video-${Date.now()}.mp4`;h.download=B,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(q),u(100),n(!1)}catch(o){c(o instanceof Error?o.message:"Download failed"),n(!1),u(0)}},[t]),l=U(p=>{if(!(t!=null&&t.current)){c("Video element not found");return}let y=t.current,g=y.src||y.currentSrc;if(!g){c("No video source found");return}try{n(!0),c(null),u(0);let m=document.createElement("a");m.href=g,m.download=p||`video-${Date.now()}.mp4`,m.target="_blank",document.body.appendChild(m),m.click(),document.body.removeChild(m),n(!1),u(100)}catch(m){c(m instanceof Error?m.message:"Download failed"),n(!1),u(0)}},[t]);return G(()=>()=>{n(!1),u(0),c(null)},[]),{downloadVideo:r,downloadDirect:l,isDownloading:e,downloadProgress:s,error:a,resetError:()=>c(null)}};import _ from"react";var Kt=(t,e)=>{_.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;let n=t.current;if(n){let s=()=>{(n.currentTime>=e[1]||n.currentTime<=e[0])&&(n.currentTime=e[0])};return n.addEventListener("timeupdate",s),()=>{n.removeEventListener("timeupdate",s)}}},[e,t==null?void 0:t.current])};export{Q as a,ut as b,Et as c,yt as d,at as e,v as f,mt as g,Z as h,rt as i,wt as j,Pt as k,It as l,Tt as m,qt as n,Ut as o,Ot as p,Kt as q};
2
+ //# sourceMappingURL=chunk-ZTXJNTLA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/use-autoplay-by-force.tsx","../src/hooks/use-autoplay-on-visible.tsx","../src/hooks/use-fullscreen.tsx","../src/hooks/use-get-duration.tsx","../src/hooks/use-hot-keys.tsx","../src/hooks/use-mute-unmute.tsx","../src/hooks/use-picture-in-picture.tsx","../src/hooks/use-play-pause.tsx","../src/hooks/use-seek.tsx","../src/hooks/use-speed.tsx","../src/hooks/use-start-at.tsx","../src/hooks/use-current-time.tsx","../src/hooks/use-video-state.tsx","../src/hooks/use-volume.tsx","../src/hooks/use-buffer.tsx","../src/hooks/use-download.tsx","../src/hooks/use-range.tsx"],"sourcesContent":["import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useAutoplayByForce = (\n videoRef: VideoRef,\n enabled: boolean,\n setError?: (error: string | null) => void\n) => {\n React.useEffect(() => {\n if (!videoRef?.current || !enabled) return;\n\n const playVideo = async () => {\n try {\n await videoRef.current?.play();\n } catch (error) {\n // If autoplay fails, try muting and playing again\n if (error instanceof Error && error.name === \"NotAllowedError\") {\n setError?.(\"NotAllowedError\");\n console.error(\"NotAllowedError\");\n if (videoRef?.current) {\n videoRef.current.muted = true;\n try {\n await videoRef.current.play();\n } catch (retryError) {\n console.error(retryError);\n }\n }\n } else {\n console.error(error);\n }\n }\n };\n\n playVideo();\n }, [enabled, videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useAutoplayOnVisible = (\n videoRef: VideoRef,\n threshold: number | undefined,\n enabled = true\n) => {\n React.useEffect(() => {\n if (!videoRef?.current || !enabled) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (!videoRef?.current) return;\n\n if (entry.isIntersecting) {\n videoRef.current.play().catch((error) => {\n if (!videoRef.current) return;\n\n videoRef.current.pause();\n videoRef.current.muted = true;\n videoRef.current.play();\n console.error(error);\n });\n } else {\n videoRef.current?.pause();\n }\n });\n },\n { threshold: threshold ?? 0.5 }\n );\n\n observer.observe(videoRef?.current);\n\n return () => {\n observer.disconnect();\n };\n }, [videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nconst useFullscreen = (videoRef: VideoRef) => {\n const [isFullscreen, setIsFullscreen] = React.useState(false);\n const previousStylesRef = React.useRef<{\n objectFit: string;\n borderRadius: string;\n width: string;\n height: string;\n maxWidth: string;\n maxHeight: string;\n margin: string;\n } | null>(null);\n\n React.useEffect(() => {\n const handleFullscreenChange = () => {\n const isCurrentlyFullscreen = !!document.fullscreenElement;\n setIsFullscreen(isCurrentlyFullscreen);\n\n // Apply styles based on fullscreen state\n const video = videoRef?.current;\n if (video) {\n if (isCurrentlyFullscreen) {\n // Store previous styles before entering fullscreen\n previousStylesRef.current = {\n objectFit: video.style.objectFit || \"cover\",\n borderRadius: video.style.borderRadius || \"\",\n width: video.style.width || \"\",\n height: video.style.height || \"\",\n maxWidth: video.style.maxWidth || \"\",\n maxHeight: video.style.maxHeight || \"\",\n margin: video.style.margin || \"\",\n };\n // Apply fullscreen styles\n video.style.objectFit = \"contain\";\n video.style.borderRadius = \"0\";\n video.style.width = \"100%\";\n video.style.height = \"100%\";\n video.style.maxWidth = \"none\";\n video.style.maxHeight = \"none\";\n video.style.margin = \"0\";\n } else {\n // Restore previous styles when exiting fullscreen\n if (previousStylesRef.current) {\n video.style.objectFit = previousStylesRef.current.objectFit;\n video.style.borderRadius = previousStylesRef.current.borderRadius;\n video.style.width = previousStylesRef.current.width;\n video.style.height = previousStylesRef.current.height;\n video.style.maxWidth = previousStylesRef.current.maxWidth;\n video.style.maxHeight = previousStylesRef.current.maxHeight;\n video.style.margin = previousStylesRef.current.margin;\n previousStylesRef.current = null;\n }\n }\n }\n };\n\n document.addEventListener(\"fullscreenchange\", handleFullscreenChange);\n return () =>\n document.removeEventListener(\"fullscreenchange\", handleFullscreenChange);\n }, [videoRef]);\n\n const toggleFullscreen = () => {\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n const video = videoRef?.current;\n\n if (video && isSafari) {\n if ((video as any).webkitEnterFullscreen) {\n (video as any).webkitEnterFullscreen();\n return;\n } else if (video.requestFullscreen) {\n video.requestFullscreen();\n return;\n }\n }\n\n const videoContainer = video?.closest(\n \"[data-zuude-video-wrapper]\"\n ) as HTMLElement;\n\n if (videoContainer) {\n if (!isFullscreen) {\n videoContainer.requestFullscreen();\n } else {\n document.exitFullscreen();\n }\n }\n };\n\n return { isFullscreen: isFullscreen ?? false, toggleFullscreen };\n};\n\nexport { useFullscreen };\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useGetDuration = (videoRef: VideoRef) => {\n const [isLoading, setIsLoading] = React.useState(false);\n const [duration, setDuration] = React.useState<number | null>(null);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n setIsLoading(true);\n\n const getDuration = () => {\n setDuration(videoRef.current?.duration ?? null);\n setIsLoading(false);\n };\n\n const handleError = () => {\n setIsLoading(false);\n };\n\n const video = videoRef.current;\n\n // Check if duration is already available\n if (video.duration && !isNaN(video.duration)) {\n setDuration(video.duration);\n setIsLoading(false);\n } else {\n // Add event listeners\n video.addEventListener(\"loadedmetadata\", getDuration);\n video.addEventListener(\"error\", handleError);\n video.addEventListener(\"loadeddata\", getDuration);\n\n return () => {\n video.removeEventListener(\"loadedmetadata\", getDuration);\n video.removeEventListener(\"error\", handleError);\n video.removeEventListener(\"loadeddata\", getDuration);\n };\n }\n }, [videoRef]);\n\n return { duration, isLoading };\n};\n","import { useEffect } from \"react\";\n\nexport const useHotKeys = (\n key: string,\n func: (event: KeyboardEvent) => void,\n enabled = true\n) => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === key) {\n event.preventDefault();\n func(event);\n }\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [key, func, enabled]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useMuteUnmute = (videoRef: VideoRef) => {\n const [isMuted, setIsMuted] = React.useState(false);\n\n const toggleMute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = !videoRef.current.muted;\n }\n }, [videoRef?.current]);\n\n const mute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = true;\n }\n }, [videoRef?.current]);\n\n const unmute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = false;\n }\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n // Set the initial state\n setIsMuted(videoRef.current.muted);\n\n const handleVolumeChange = () => {\n if (videoRef.current) {\n setIsMuted(videoRef.current.muted);\n }\n };\n\n videoRef.current.addEventListener(\"volumechange\", handleVolumeChange);\n\n return () => {\n videoRef.current?.removeEventListener(\"volumechange\", handleVolumeChange);\n };\n }, [videoRef?.current]);\n\n return { toggleMute, isMuted, mute, unmute };\n};\n","import type { VideoRef } from \"../types\";\n\nexport const usePictureInPicture = (videoRef: VideoRef) => {\n const togglePictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n\n try {\n if (document.pictureInPictureElement) {\n await document.exitPictureInPicture();\n } else {\n await video.requestPictureInPicture();\n }\n } catch (error) {\n // Fallback for browsers that don't support PiP\n const isSafari = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent\n );\n\n if (isSafari) {\n if ((video as any).webkitEnterFullscreen) {\n (video as any).webkitEnterFullscreen();\n } else if (video.requestFullscreen) {\n video.requestFullscreen();\n }\n } else {\n const videoContainer = video.closest(\n \"[data-zuude-video-wrapper]\"\n ) as HTMLElement;\n if (videoContainer) {\n if (!document.fullscreenElement) {\n await videoContainer.requestFullscreen();\n } else {\n await document.exitFullscreen();\n }\n }\n }\n }\n };\n\n const requestPictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n await video.requestPictureInPicture();\n };\n\n const exitPictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n await document.exitPictureInPicture();\n };\n\n return {\n togglePictureInPicture,\n requestPictureInPicture,\n exitPictureInPicture,\n };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const usePlayPause = (videoRef: VideoRef) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n\n const togglePlay = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.paused\n ? videoRef.current.play()\n : videoRef.current.pause();\n }\n }, [videoRef?.current]);\n\n const play = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.play();\n }\n }, [videoRef?.current]);\n\n const pause = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.pause();\n }\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n const handlePlay = () => {\n setIsPlaying(true);\n };\n const handlePause = () => {\n setIsPlaying(false);\n };\n\n setIsPlaying(!videoRef?.current.paused);\n\n if (videoRef?.current) {\n videoRef.current.addEventListener(\"play\", handlePlay);\n videoRef.current.addEventListener(\"pause\", handlePause);\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", handlePlay);\n videoRef.current?.removeEventListener(\"pause\", handlePause);\n };\n }\n }, [videoRef?.current]);\n\n return { togglePlay, isPlaying, play, pause };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useSeek = (videoRef: VideoRef, value = 10) => {\n const seekForward = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.currentTime += value;\n }\n }, [videoRef?.current]);\n\n const seekBackward = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.currentTime -= value;\n }\n }, [videoRef?.current]);\n\n return { seekForward, seekBackward };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useSpeed = (videoRef: VideoRef) => {\n const [speed, setSpeed] = React.useState(1);\n\n const onChangeSpeed = (speed: number) => {\n setSpeed(speed);\n };\n\n // Get the speed from the video element\n React.useEffect(() => {\n if (!videoRef?.current) return;\n setSpeed(videoRef.current.playbackRate);\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.playbackRate = speed;\n }, [speed, videoRef?.current]);\n\n return { speed, onChangeSpeed };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useStartAt = (videoRef: VideoRef, startAt: number) => {\n React.useEffect(() => {\n if (!videoRef?.current || !startAt) return;\n\n const video = videoRef?.current;\n if (video && startAt) {\n video.currentTime = startAt;\n }\n }, [startAt, videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types.js\";\n\nexport const useCurrentTime = (videoRef: VideoRef, interval = 10) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n const [currentTime, setCurrentTime] = React.useState(0);\n\n React.useEffect(() => {\n if (videoRef?.current && isPlaying) {\n const intervalId = setInterval(() => {\n setCurrentTime(videoRef.current?.currentTime || 0);\n }, interval);\n\n return () => clearInterval(intervalId);\n }\n }, [videoRef?.current, isPlaying]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.addEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current?.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }, [videoRef?.current]);\n\n const onTimeUpdate = (time: number) => {\n if (videoRef?.current) {\n setCurrentTime(time);\n videoRef.current.currentTime = time;\n }\n };\n\n return {\n currentTime,\n onTimeUpdate,\n };\n};\n","import { RefObject, useEffect, useState } from \"react\";\n\nconst useVideoState = (videoRef: RefObject<HTMLVideoElement | null>) => {\n const [isPlaying, setIsPlaying] = useState(false);\n const [isMuted, setIsMuted] = useState(false);\n const [isFullscreen, setIsFullscreen] = useState(false);\n\n useEffect(() => {\n const video = videoRef.current;\n\n if (video) {\n video.addEventListener(\"play\", () => setIsPlaying(true));\n video.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n video.removeEventListener(\"play\", () => setIsPlaying(true));\n video.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }\n }, [videoRef]);\n\n useEffect(() => {\n if (!videoRef?.current) return;\n\n // Set the initial state\n setIsMuted(videoRef.current.muted);\n\n const handleVolumeChange = () => {\n if (videoRef.current) {\n setIsMuted(videoRef.current.muted);\n }\n };\n\n videoRef.current.addEventListener(\"volumechange\", handleVolumeChange);\n\n return () => {\n videoRef.current?.removeEventListener(\"volumechange\", handleVolumeChange);\n };\n }, [videoRef]);\n\n useEffect(() => {\n if (!videoRef?.current) return;\n\n const handleFullscreenChange = () => {\n setIsFullscreen(!!document.fullscreenElement);\n };\n\n document.addEventListener(\"fullscreenchange\", handleFullscreenChange);\n return () =>\n document.removeEventListener(\"fullscreenchange\", handleFullscreenChange);\n }, [videoRef]);\n\n return { isPlaying, isMuted, isFullscreen };\n};\n\nexport { useVideoState };\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useVolume = (videoRef: VideoRef, initialVolume = 100) => {\n const [volume, setVolume] = React.useState(initialVolume);\n\n const onChangeVolume = (volume: number) => {\n setVolume(volume);\n };\n\n // Get the volume from the video element\n React.useEffect(() => {\n if (!videoRef?.current) return;\n setVolume(videoRef.current.volume * 100);\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.volume = volume / 100;\n }, [volume, videoRef?.current]);\n\n return { volume, onChangeVolume };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types.js\";\n\nexport const useBuffer = (videoRef: VideoRef, duration?: number) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n const [buffered, setBuffered] = React.useState(0);\n\n React.useEffect(() => {\n if (videoRef?.current && isPlaying) {\n const intervalId = setInterval(() => {\n if (videoRef.current?.buffered.length) {\n setBuffered(\n videoRef.current.buffered.end(videoRef.current.buffered.length - 1)\n );\n }\n }, 10);\n\n return () => clearInterval(intervalId);\n }\n }, [videoRef?.current, isPlaying]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.addEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current?.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }, []);\n\n return {\n buffered,\n bufferedPercentage: (buffered / (duration || 0)) * 100 || 0,\n };\n};\n","import { useEffect, useState, useCallback } from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useDownload = (videoRef: VideoRef) => {\n const [isDownloading, setIsDownloading] = useState(false);\n const [downloadProgress, setDownloadProgress] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const downloadVideo = useCallback(\n async (filename?: string) => {\n if (!videoRef?.current) {\n setError(\"Video element not found\");\n return;\n }\n\n const video = videoRef.current;\n const videoSrc = video.src || video.currentSrc;\n\n if (!videoSrc) {\n setError(\"No video source found\");\n return;\n }\n\n try {\n setIsDownloading(true);\n setError(null);\n setDownloadProgress(0);\n\n // Fetch the video file\n const response = await fetch(videoSrc);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch video: ${response.statusText}`);\n }\n\n // Get the content length for progress tracking\n const contentLength = response.headers.get(\"content-length\");\n const total = contentLength ? parseInt(contentLength, 10) : 0;\n\n // Create a readable stream to track progress\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error(\"Failed to create download stream\");\n }\n\n const chunks: BlobPart[] = [];\n let receivedLength = 0;\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) break;\n\n chunks.push(value);\n receivedLength += value.length;\n\n if (total > 0) {\n const progress = (receivedLength / total) * 100;\n setDownloadProgress(Math.round(progress));\n }\n }\n\n // Combine chunks into a single blob\n const blob = new Blob(chunks, {\n type: response.headers.get(\"content-type\") || \"video/mp4\",\n });\n\n // Create download link\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n\n // Generate filename if not provided\n const defaultFilename = filename || `video-${Date.now()}.mp4`;\n link.download = defaultFilename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n // Clean up\n URL.revokeObjectURL(url);\n\n setDownloadProgress(100);\n setIsDownloading(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Download failed\");\n setIsDownloading(false);\n setDownloadProgress(0);\n }\n },\n [videoRef]\n );\n\n // Alternative simple download method for direct video URLs\n const downloadDirect = useCallback(\n (filename?: string) => {\n if (!videoRef?.current) {\n setError(\"Video element not found\");\n return;\n }\n\n const video = videoRef.current;\n const videoSrc = video.src || video.currentSrc;\n\n if (!videoSrc) {\n setError(\"No video source found\");\n return;\n }\n\n try {\n setIsDownloading(true);\n setError(null);\n setDownloadProgress(0);\n\n const link = document.createElement(\"a\");\n link.href = videoSrc;\n link.download = filename || `video-${Date.now()}.mp4`;\n link.target = \"_blank\";\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n setIsDownloading(false);\n setDownloadProgress(100);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Download failed\");\n setIsDownloading(false);\n setDownloadProgress(0);\n }\n },\n [videoRef]\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n setIsDownloading(false);\n setDownloadProgress(0);\n setError(null);\n };\n }, []);\n\n return {\n downloadVideo,\n downloadDirect,\n isDownloading,\n downloadProgress,\n error,\n resetError: () => setError(null),\n };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useRange = (videoRef: VideoRef, range: [number, number]) => {\n React.useEffect(() => {\n if (!videoRef?.current || !range) return;\n\n const video = videoRef.current;\n\n if (video) {\n const handleTimeUpdate = () => {\n if (video.currentTime >= range[1]) {\n video.currentTime = range[0];\n } else if (video.currentTime <= range[0]) {\n video.currentTime = range[0];\n }\n };\n\n video.addEventListener(\"timeupdate\", handleTimeUpdate);\n\n return () => {\n video.removeEventListener(\"timeupdate\", handleTimeUpdate);\n };\n }\n }, [range, videoRef?.current]);\n};\n"],"mappings":"AAAA,OAAOA,MAAW,QAGX,IAAMC,EAAqB,CAChCC,EACAC,EACAC,IACG,CACHJ,EAAM,UAAU,IAAM,CACpB,GAAI,EAACE,GAAA,MAAAA,EAAU,UAAW,CAACC,EAAS,QAElB,SAAY,CAXlC,IAAAE,EAYM,GAAI,CACF,OAAMA,EAAAH,EAAS,UAAT,YAAAG,EAAkB,OAC1B,OAASC,EAAO,CAEd,GAAIA,aAAiB,OAASA,EAAM,OAAS,mBAG3C,GAFAF,GAAA,MAAAA,EAAW,mBACX,QAAQ,MAAM,iBAAiB,EAC3BF,GAAA,MAAAA,EAAU,QAAS,CACrBA,EAAS,QAAQ,MAAQ,GACzB,GAAI,CACF,MAAMA,EAAS,QAAQ,KAAK,CAC9B,OAASK,EAAY,CACnB,QAAQ,MAAMA,CAAU,CAC1B,CACF,OAEA,QAAQ,MAAMD,CAAK,CAEvB,CACF,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AAK,YAAYA,CAAI,EAE9BrB,EAAiB,EAAK,EACtBE,EAAoB,GAAG,CACzB,OAASqB,EAAK,CACZnB,EAASmB,aAAe,MAAQA,EAAI,QAAU,iBAAiB,EAC/DvB,EAAiB,EAAK,EACtBE,EAAoB,CAAC,CACvB,CACF,EACA,CAACJ,CAAQ,CACX,EAGA,OAAAJ,EAAU,IACD,IAAM,CACXM,EAAiB,EAAK,EACtBE,EAAoB,CAAC,EACrBE,EAAS,IAAI,CACf,EACC,CAAC,CAAC,EAEE,CACL,cAAAC,EACA,eAAAmB,EACA,cAAAzB,EACA,iBAAAE,EACA,MAAAE,EACA,WAAY,IAAMC,EAAS,IAAI,CACjC,CACF,ECzJA,OAAOqB,MAAW,QAGX,IAAMC,GAAW,CAACC,EAAoBC,IAA4B,CACvEH,EAAM,UAAU,IAAM,CACpB,GAAI,EAACE,GAAA,MAAAA,EAAU,UAAW,CAACC,EAAO,OAElC,IAAMC,EAAQF,EAAS,QAEvB,GAAIE,EAAO,CACT,IAAMC,EAAmB,IAAM,EACzBD,EAAM,aAAeD,EAAM,CAAC,GAErBC,EAAM,aAAeD,EAAM,CAAC,KACrCC,EAAM,YAAcD,EAAM,CAAC,EAE/B,EAEA,OAAAC,EAAM,iBAAiB,aAAcC,CAAgB,EAE9C,IAAM,CACXD,EAAM,oBAAoB,aAAcC,CAAgB,CAC1D,CACF,CACF,EAAG,CAACF,EAAOD,GAAA,YAAAA,EAAU,OAAO,CAAC,CAC/B","names":["React","useAutoplayByForce","videoRef","enabled","setError","_a","error","retryError","React","useAutoplayOnVisible","videoRef","threshold","enabled","observer","entries","entry","_a","error","React","useFullscreen","videoRef","isFullscreen","setIsFullscreen","previousStylesRef","handleFullscreenChange","isCurrentlyFullscreen","video","toggleFullscreen","isSafari","videoContainer","React","useGetDuration","videoRef","isLoading","setIsLoading","duration","setDuration","getDuration","_a","_b","handleError","video","useEffect","useHotKeys","key","func","enabled","handleKeyDown","event","React","useMuteUnmute","videoRef","isMuted","setIsMuted","toggleMute","mute","unmute","handleVolumeChange","_a","usePictureInPicture","videoRef","video","error","videoContainer","React","usePlayPause","videoRef","isPlaying","setIsPlaying","togglePlay","play","pause","handlePlay","handlePause","_a","_b","React","useSeek","videoRef","value","seekForward","seekBackward","React","useSpeed","videoRef","speed","setSpeed","onChangeSpeed","React","useStartAt","videoRef","startAt","video","React","useCurrentTime","videoRef","interval","isPlaying","setIsPlaying","currentTime","setCurrentTime","intervalId","_a","_b","time","useEffect","useState","useVideoState","videoRef","isPlaying","setIsPlaying","isMuted","setIsMuted","isFullscreen","setIsFullscreen","video","handleVolumeChange","_a","handleFullscreenChange","React","useVolume","videoRef","initialVolume","volume","setVolume","onChangeVolume","React","useBuffer","videoRef","duration","isPlaying","setIsPlaying","buffered","setBuffered","intervalId","_a","_b","useEffect","useState","useCallback","useDownload","videoRef","isDownloading","setIsDownloading","downloadProgress","setDownloadProgress","error","setError","downloadVideo","filename","_a","video","videoSrc","response","contentLength","total","reader","chunks","receivedLength","done","value","progress","blob","url","link","defaultFilename","err","downloadDirect","React","useRange","videoRef","range","video","handleTimeUpdate"]}
@@ -0,0 +1,2 @@
1
+ "use strict";var J=Object.create;var i=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var Y=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},N=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let u of X(e))!Z.call(t,u)&&u!==n&&i(t,u,{get:()=>e[u],enumerable:!(s=Q(e,u))||s.enumerable});return t};var m=(t,e,n)=>(n=t!=null?J(Y(t)):{},N(e||!t||!t.__esModule?i(n,"default",{value:t,enumerable:!0}):n,t)),f=t=>N(i({},"__esModule",{value:!0}),t);var Et={};d(Et,{useAutoplayByForce:()=>v,useAutoplayOnVisible:()=>R,useBuffer:()=>yt,useCurrentTime:()=>mt,useDownload:()=>gt,useFullscreen:()=>tt,useGetDuration:()=>rt,useHotKeys:()=>nt,useMuteUnmute:()=>et,usePictureInPicture:()=>ut,usePlayPause:()=>st,useRange:()=>ht,useSeek:()=>ct,useSpeed:()=>at,useStartAt:()=>lt,useVideoState:()=>pt,useVolume:()=>ot});module.exports=f(Et);var B=m(require("react"),1),v=(t,e,n)=>{B.default.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;(async()=>{var u;try{await((u=t.current)==null?void 0:u.play())}catch(a){if(a instanceof Error&&a.name==="NotAllowedError"){if(n==null||n("NotAllowedError"),console.error("NotAllowedError"),t!=null&&t.current){t.current.muted=!0;try{await t.current.play()}catch(c){console.error(c)}}}else console.error(a)}})()},[e,t==null?void 0:t.current])};var O=m(require("react"),1),R=(t,e,n=!0)=>{O.default.useEffect(()=>{if(!(t!=null&&t.current)||!n)return;let s=new IntersectionObserver(u=>{u.forEach(a=>{var c;t!=null&&t.current&&(a.isIntersecting?t.current.play().catch(r=>{t.current&&(t.current.pause(),t.current.muted=!0,t.current.play(),console.error(r))}):(c=t.current)==null||c.pause())})},{threshold:e!=null?e:.5});return s.observe(t==null?void 0:t.current),()=>{s.disconnect()}},[t==null?void 0:t.current])};var F=m(require("react"),1),tt=t=>{let[e,n]=F.default.useState(!1),s=F.default.useRef(null);F.default.useEffect(()=>{let a=()=>{let c=!!document.fullscreenElement;n(c);let r=t==null?void 0:t.current;r&&(c?(s.current={objectFit:r.style.objectFit||"cover",borderRadius:r.style.borderRadius||"",width:r.style.width||"",height:r.style.height||"",maxWidth:r.style.maxWidth||"",maxHeight:r.style.maxHeight||"",margin:r.style.margin||""},r.style.objectFit="contain",r.style.borderRadius="0",r.style.width="100%",r.style.height="100%",r.style.maxWidth="none",r.style.maxHeight="none",r.style.margin="0"):s.current&&(r.style.objectFit=s.current.objectFit,r.style.borderRadius=s.current.borderRadius,r.style.width=s.current.width,r.style.height=s.current.height,r.style.maxWidth=s.current.maxWidth,r.style.maxHeight=s.current.maxHeight,r.style.margin=s.current.margin,s.current=null))};return document.addEventListener("fullscreenchange",a),()=>document.removeEventListener("fullscreenchange",a)},[t]);let u=()=>{let a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),c=t==null?void 0:t.current;if(c&&a){if(c.webkitEnterFullscreen){c.webkitEnterFullscreen();return}else if(c.requestFullscreen){c.requestFullscreen();return}}let r=c==null?void 0:c.closest("[data-zuude-video-wrapper]");r&&(e?document.exitFullscreen():r.requestFullscreen())};return{isFullscreen:e!=null?e:!1,toggleFullscreen:u}};var I=m(require("react"),1),rt=t=>{let[e,n]=I.default.useState(!1),[s,u]=I.default.useState(null);return I.default.useEffect(()=>{if(!(t!=null&&t.current))return;n(!0);let a=()=>{var l,p;u((p=(l=t.current)==null?void 0:l.duration)!=null?p:null),n(!1)},c=()=>{n(!1)},r=t.current;if(r.duration&&!isNaN(r.duration))u(r.duration),n(!1);else return r.addEventListener("loadedmetadata",a),r.addEventListener("error",c),r.addEventListener("loadeddata",a),()=>{r.removeEventListener("loadedmetadata",a),r.removeEventListener("error",c),r.removeEventListener("loadeddata",a)}},[t]),{duration:s,isLoading:e}};var W=require("react"),nt=(t,e,n=!0)=>{let s=u=>{u.key===t&&(u.preventDefault(),e(u))};(0,W.useEffect)(()=>{if(n)return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s)}},[t,e,n])};var E=m(require("react"),1),et=t=>{let[e,n]=E.default.useState(!1),s=E.default.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!t.current.muted)},[t==null?void 0:t.current]),u=E.default.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!0)},[t==null?void 0:t.current]),a=E.default.useCallback(()=>{t!=null&&t.current&&(t.current.muted=!1)},[t==null?void 0:t.current]);return E.default.useEffect(()=>{if(!(t!=null&&t.current))return;n(t.current.muted);let c=()=>{t.current&&n(t.current.muted)};return t.current.addEventListener("volumechange",c),()=>{var r;(r=t.current)==null||r.removeEventListener("volumechange",c)}},[t==null?void 0:t.current]),{toggleMute:s,isMuted:e,mute:u,unmute:a}};var ut=t=>({togglePictureInPicture:async()=>{let u=t==null?void 0:t.current;if(u)try{document.pictureInPictureElement?await document.exitPictureInPicture():await u.requestPictureInPicture()}catch(a){if(/^((?!chrome|android).)*safari/i.test(navigator.userAgent))u.webkitEnterFullscreen?u.webkitEnterFullscreen():u.requestFullscreen&&u.requestFullscreen();else{let r=u.closest("[data-zuude-video-wrapper]");r&&(document.fullscreenElement?await document.exitFullscreen():await r.requestFullscreen())}}},requestPictureInPicture:async()=>{let u=t==null?void 0:t.current;u&&await u.requestPictureInPicture()},exitPictureInPicture:async()=>{t!=null&&t.current&&await document.exitPictureInPicture()}});var b=m(require("react"),1),st=t=>{let[e,n]=b.default.useState(!1),s=b.default.useCallback(()=>{t!=null&&t.current&&(t.current.paused?t.current.play():t.current.pause())},[t==null?void 0:t.current]),u=b.default.useCallback(()=>{t!=null&&t.current&&t.current.play()},[t==null?void 0:t.current]),a=b.default.useCallback(()=>{t!=null&&t.current&&t.current.pause()},[t==null?void 0:t.current]);return b.default.useEffect(()=>{if(!(t!=null&&t.current))return;let c=()=>{n(!0)},r=()=>{n(!1)};if(n(!(t!=null&&t.current.paused)),t!=null&&t.current)return t.current.addEventListener("play",c),t.current.addEventListener("pause",r),()=>{var l,p;(l=t.current)==null||l.removeEventListener("play",c),(p=t.current)==null||p.removeEventListener("pause",r)}},[t==null?void 0:t.current]),{togglePlay:s,isPlaying:e,play:u,pause:a}};var C=m(require("react"),1),ct=(t,e=10)=>{let n=C.default.useCallback(()=>{t!=null&&t.current&&(t.current.currentTime+=e)},[t==null?void 0:t.current]),s=C.default.useCallback(()=>{t!=null&&t.current&&(t.current.currentTime-=e)},[t==null?void 0:t.current]);return{seekForward:n,seekBackward:s}};var k=m(require("react"),1),at=t=>{let[e,n]=k.default.useState(1),s=u=>{n(u)};return k.default.useEffect(()=>{t!=null&&t.current&&n(t.current.playbackRate)},[t==null?void 0:t.current]),k.default.useEffect(()=>{t!=null&&t.current&&(t.current.playbackRate=e)},[e,t==null?void 0:t.current]),{speed:e,onChangeSpeed:s}};var A=m(require("react"),1),lt=(t,e)=>{A.default.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;let n=t==null?void 0:t.current;n&&e&&(n.currentTime=e)},[e,t==null?void 0:t.current])};var V=m(require("react"),1),mt=(t,e=10)=>{let[n,s]=V.default.useState(!1),[u,a]=V.default.useState(0);return V.default.useEffect(()=>{if(t!=null&&t.current&&n){let r=setInterval(()=>{var l;a(((l=t.current)==null?void 0:l.currentTime)||0)},e);return()=>clearInterval(r)}},[t==null?void 0:t.current,n]),V.default.useEffect(()=>{if(!(t!=null&&t.current))return;let r=t.current,l=()=>s(!0),p=()=>s(!1);return r.addEventListener("play",l),r.addEventListener("pause",p),()=>{r.removeEventListener("play",l),r.removeEventListener("pause",p)}},[t==null?void 0:t.current]),{currentTime:u,onTimeUpdate:r=>{t!=null&&t.current&&(a(r),t.current.currentTime=r)}}};var h=require("react"),pt=t=>{let[e,n]=(0,h.useState)(!1),[s,u]=(0,h.useState)(!1),[a,c]=(0,h.useState)(!1);return(0,h.useEffect)(()=>{let r=t.current;if(r)return r.addEventListener("play",()=>n(!0)),r.addEventListener("pause",()=>n(!1)),()=>{r.removeEventListener("play",()=>n(!0)),r.removeEventListener("pause",()=>n(!1))}},[t]),(0,h.useEffect)(()=>{if(!(t!=null&&t.current))return;u(t.current.muted);let r=()=>{t.current&&u(t.current.muted)};return t.current.addEventListener("volumechange",r),()=>{var l;(l=t.current)==null||l.removeEventListener("volumechange",r)}},[t]),(0,h.useEffect)(()=>{if(!(t!=null&&t.current))return;let r=()=>{c(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",r),()=>document.removeEventListener("fullscreenchange",r)},[t]),{isPlaying:e,isMuted:s,isFullscreen:a}};var S=m(require("react"),1),ot=(t,e=100)=>{let[n,s]=S.default.useState(e),u=a=>{s(a)};return S.default.useEffect(()=>{t!=null&&t.current&&s(t.current.volume*100)},[t==null?void 0:t.current]),S.default.useEffect(()=>{t!=null&&t.current&&(t.current.volume=n/100)},[n,t==null?void 0:t.current]),{volume:n,onChangeVolume:u}};var P=m(require("react"),1),yt=(t,e)=>{let[n,s]=P.default.useState(!1),[u,a]=P.default.useState(0);return P.default.useEffect(()=>{if(t!=null&&t.current&&n){let c=setInterval(()=>{var r;(r=t.current)!=null&&r.buffered.length&&a(t.current.buffered.end(t.current.buffered.length-1))},10);return()=>clearInterval(c)}},[t==null?void 0:t.current,n]),P.default.useEffect(()=>{if(t!=null&&t.current)return t.current.addEventListener("play",()=>s(!0)),t.current.addEventListener("pause",()=>s(!1)),()=>{var c,r;(c=t.current)==null||c.removeEventListener("play",()=>s(!0)),(r=t.current)==null||r.removeEventListener("pause",()=>s(!1))}},[]),{buffered:u,bufferedPercentage:u/(e||0)*100||0}};var y=require("react"),gt=t=>{let[e,n]=(0,y.useState)(!1),[s,u]=(0,y.useState)(0),[a,c]=(0,y.useState)(null),r=(0,y.useCallback)(async p=>{var o;if(!(t!=null&&t.current)){c("Video element not found");return}let x=t.current,w=x.src||x.currentSrc;if(!w){c("No video source found");return}try{n(!0),c(null),u(0);let g=await fetch(w);if(!g.ok)throw new Error(`Failed to fetch video: ${g.statusText}`);let T=g.headers.get("content-length"),D=T?parseInt(T,10):0,j=(o=g.body)==null?void 0:o.getReader();if(!j)throw new Error("Failed to create download stream");let q=[],H=0;for(;;){let{done:G,value:U}=await j.read();if(G)break;if(q.push(U),H+=U.length,D>0){let _=H/D*100;u(Math.round(_))}}let $=new Blob(q,{type:g.headers.get("content-type")||"video/mp4"}),M=URL.createObjectURL($),L=document.createElement("a");L.href=M;let z=p||`video-${Date.now()}.mp4`;L.download=z,document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(M),u(100),n(!1)}catch(g){c(g instanceof Error?g.message:"Download failed"),n(!1),u(0)}},[t]),l=(0,y.useCallback)(p=>{if(!(t!=null&&t.current)){c("Video element not found");return}let x=t.current,w=x.src||x.currentSrc;if(!w){c("No video source found");return}try{n(!0),c(null),u(0);let o=document.createElement("a");o.href=w,o.download=p||`video-${Date.now()}.mp4`,o.target="_blank",document.body.appendChild(o),o.click(),document.body.removeChild(o),n(!1),u(100)}catch(o){c(o instanceof Error?o.message:"Download failed"),n(!1),u(0)}},[t]);return(0,y.useEffect)(()=>()=>{n(!1),u(0),c(null)},[]),{downloadVideo:r,downloadDirect:l,isDownloading:e,downloadProgress:s,error:a,resetError:()=>c(null)}};var K=m(require("react"),1),ht=(t,e)=>{K.default.useEffect(()=>{if(!(t!=null&&t.current)||!e)return;let n=t.current;if(n){let s=()=>{(n.currentTime>=e[1]||n.currentTime<=e[0])&&(n.currentTime=e[0])};return n.addEventListener("timeupdate",s),()=>{n.removeEventListener("timeupdate",s)}}},[e,t==null?void 0:t.current])};0&&(module.exports={useAutoplayByForce,useAutoplayOnVisible,useBuffer,useCurrentTime,useDownload,useFullscreen,useGetDuration,useHotKeys,useMuteUnmute,usePictureInPicture,usePlayPause,useRange,useSeek,useSpeed,useStartAt,useVideoState,useVolume});
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/index.ts","../../src/hooks/use-autoplay-by-force.tsx","../../src/hooks/use-autoplay-on-visible.tsx","../../src/hooks/use-fullscreen.tsx","../../src/hooks/use-get-duration.tsx","../../src/hooks/use-hot-keys.tsx","../../src/hooks/use-mute-unmute.tsx","../../src/hooks/use-picture-in-picture.tsx","../../src/hooks/use-play-pause.tsx","../../src/hooks/use-seek.tsx","../../src/hooks/use-speed.tsx","../../src/hooks/use-start-at.tsx","../../src/hooks/use-current-time.tsx","../../src/hooks/use-video-state.tsx","../../src/hooks/use-volume.tsx","../../src/hooks/use-buffer.tsx","../../src/hooks/use-download.tsx","../../src/hooks/use-range.tsx"],"sourcesContent":["export * from \"./use-autoplay-by-force\";\nexport * from \"./use-autoplay-on-visible\";\nexport * from \"./use-fullscreen\";\nexport * from \"./use-get-duration\";\nexport * from \"./use-hot-keys\";\nexport * from \"./use-mute-unmute\";\nexport * from \"./use-picture-in-picture\";\nexport * from \"./use-play-pause\";\nexport * from \"./use-seek\";\nexport * from \"./use-speed\";\nexport * from \"./use-start-at\";\nexport * from \"./use-current-time\";\nexport * from \"./use-video-state\";\nexport * from \"./use-volume\";\nexport * from \"./use-buffer\";\nexport * from \"./use-download\";\nexport * from \"./use-range\";\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useAutoplayByForce = (\n videoRef: VideoRef,\n enabled: boolean,\n setError?: (error: string | null) => void\n) => {\n React.useEffect(() => {\n if (!videoRef?.current || !enabled) return;\n\n const playVideo = async () => {\n try {\n await videoRef.current?.play();\n } catch (error) {\n // If autoplay fails, try muting and playing again\n if (error instanceof Error && error.name === \"NotAllowedError\") {\n setError?.(\"NotAllowedError\");\n console.error(\"NotAllowedError\");\n if (videoRef?.current) {\n videoRef.current.muted = true;\n try {\n await videoRef.current.play();\n } catch (retryError) {\n console.error(retryError);\n }\n }\n } else {\n console.error(error);\n }\n }\n };\n\n playVideo();\n }, [enabled, videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useAutoplayOnVisible = (\n videoRef: VideoRef,\n threshold: number | undefined,\n enabled = true\n) => {\n React.useEffect(() => {\n if (!videoRef?.current || !enabled) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n entries.forEach((entry) => {\n if (!videoRef?.current) return;\n\n if (entry.isIntersecting) {\n videoRef.current.play().catch((error) => {\n if (!videoRef.current) return;\n\n videoRef.current.pause();\n videoRef.current.muted = true;\n videoRef.current.play();\n console.error(error);\n });\n } else {\n videoRef.current?.pause();\n }\n });\n },\n { threshold: threshold ?? 0.5 }\n );\n\n observer.observe(videoRef?.current);\n\n return () => {\n observer.disconnect();\n };\n }, [videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nconst useFullscreen = (videoRef: VideoRef) => {\n const [isFullscreen, setIsFullscreen] = React.useState(false);\n const previousStylesRef = React.useRef<{\n objectFit: string;\n borderRadius: string;\n width: string;\n height: string;\n maxWidth: string;\n maxHeight: string;\n margin: string;\n } | null>(null);\n\n React.useEffect(() => {\n const handleFullscreenChange = () => {\n const isCurrentlyFullscreen = !!document.fullscreenElement;\n setIsFullscreen(isCurrentlyFullscreen);\n\n // Apply styles based on fullscreen state\n const video = videoRef?.current;\n if (video) {\n if (isCurrentlyFullscreen) {\n // Store previous styles before entering fullscreen\n previousStylesRef.current = {\n objectFit: video.style.objectFit || \"cover\",\n borderRadius: video.style.borderRadius || \"\",\n width: video.style.width || \"\",\n height: video.style.height || \"\",\n maxWidth: video.style.maxWidth || \"\",\n maxHeight: video.style.maxHeight || \"\",\n margin: video.style.margin || \"\",\n };\n // Apply fullscreen styles\n video.style.objectFit = \"contain\";\n video.style.borderRadius = \"0\";\n video.style.width = \"100%\";\n video.style.height = \"100%\";\n video.style.maxWidth = \"none\";\n video.style.maxHeight = \"none\";\n video.style.margin = \"0\";\n } else {\n // Restore previous styles when exiting fullscreen\n if (previousStylesRef.current) {\n video.style.objectFit = previousStylesRef.current.objectFit;\n video.style.borderRadius = previousStylesRef.current.borderRadius;\n video.style.width = previousStylesRef.current.width;\n video.style.height = previousStylesRef.current.height;\n video.style.maxWidth = previousStylesRef.current.maxWidth;\n video.style.maxHeight = previousStylesRef.current.maxHeight;\n video.style.margin = previousStylesRef.current.margin;\n previousStylesRef.current = null;\n }\n }\n }\n };\n\n document.addEventListener(\"fullscreenchange\", handleFullscreenChange);\n return () =>\n document.removeEventListener(\"fullscreenchange\", handleFullscreenChange);\n }, [videoRef]);\n\n const toggleFullscreen = () => {\n const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\n const video = videoRef?.current;\n\n if (video && isSafari) {\n if ((video as any).webkitEnterFullscreen) {\n (video as any).webkitEnterFullscreen();\n return;\n } else if (video.requestFullscreen) {\n video.requestFullscreen();\n return;\n }\n }\n\n const videoContainer = video?.closest(\n \"[data-zuude-video-wrapper]\"\n ) as HTMLElement;\n\n if (videoContainer) {\n if (!isFullscreen) {\n videoContainer.requestFullscreen();\n } else {\n document.exitFullscreen();\n }\n }\n };\n\n return { isFullscreen: isFullscreen ?? false, toggleFullscreen };\n};\n\nexport { useFullscreen };\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useGetDuration = (videoRef: VideoRef) => {\n const [isLoading, setIsLoading] = React.useState(false);\n const [duration, setDuration] = React.useState<number | null>(null);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n setIsLoading(true);\n\n const getDuration = () => {\n setDuration(videoRef.current?.duration ?? null);\n setIsLoading(false);\n };\n\n const handleError = () => {\n setIsLoading(false);\n };\n\n const video = videoRef.current;\n\n // Check if duration is already available\n if (video.duration && !isNaN(video.duration)) {\n setDuration(video.duration);\n setIsLoading(false);\n } else {\n // Add event listeners\n video.addEventListener(\"loadedmetadata\", getDuration);\n video.addEventListener(\"error\", handleError);\n video.addEventListener(\"loadeddata\", getDuration);\n\n return () => {\n video.removeEventListener(\"loadedmetadata\", getDuration);\n video.removeEventListener(\"error\", handleError);\n video.removeEventListener(\"loadeddata\", getDuration);\n };\n }\n }, [videoRef]);\n\n return { duration, isLoading };\n};\n","import { useEffect } from \"react\";\n\nexport const useHotKeys = (\n key: string,\n func: (event: KeyboardEvent) => void,\n enabled = true\n) => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === key) {\n event.preventDefault();\n func(event);\n }\n };\n\n useEffect(() => {\n if (!enabled) return;\n\n document.addEventListener(\"keydown\", handleKeyDown);\n\n return () => {\n document.removeEventListener(\"keydown\", handleKeyDown);\n };\n }, [key, func, enabled]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useMuteUnmute = (videoRef: VideoRef) => {\n const [isMuted, setIsMuted] = React.useState(false);\n\n const toggleMute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = !videoRef.current.muted;\n }\n }, [videoRef?.current]);\n\n const mute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = true;\n }\n }, [videoRef?.current]);\n\n const unmute = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.muted = false;\n }\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n // Set the initial state\n setIsMuted(videoRef.current.muted);\n\n const handleVolumeChange = () => {\n if (videoRef.current) {\n setIsMuted(videoRef.current.muted);\n }\n };\n\n videoRef.current.addEventListener(\"volumechange\", handleVolumeChange);\n\n return () => {\n videoRef.current?.removeEventListener(\"volumechange\", handleVolumeChange);\n };\n }, [videoRef?.current]);\n\n return { toggleMute, isMuted, mute, unmute };\n};\n","import type { VideoRef } from \"../types\";\n\nexport const usePictureInPicture = (videoRef: VideoRef) => {\n const togglePictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n\n try {\n if (document.pictureInPictureElement) {\n await document.exitPictureInPicture();\n } else {\n await video.requestPictureInPicture();\n }\n } catch (error) {\n // Fallback for browsers that don't support PiP\n const isSafari = /^((?!chrome|android).)*safari/i.test(\n navigator.userAgent\n );\n\n if (isSafari) {\n if ((video as any).webkitEnterFullscreen) {\n (video as any).webkitEnterFullscreen();\n } else if (video.requestFullscreen) {\n video.requestFullscreen();\n }\n } else {\n const videoContainer = video.closest(\n \"[data-zuude-video-wrapper]\"\n ) as HTMLElement;\n if (videoContainer) {\n if (!document.fullscreenElement) {\n await videoContainer.requestFullscreen();\n } else {\n await document.exitFullscreen();\n }\n }\n }\n }\n };\n\n const requestPictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n await video.requestPictureInPicture();\n };\n\n const exitPictureInPicture = async () => {\n const video = videoRef?.current;\n if (!video) return;\n await document.exitPictureInPicture();\n };\n\n return {\n togglePictureInPicture,\n requestPictureInPicture,\n exitPictureInPicture,\n };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const usePlayPause = (videoRef: VideoRef) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n\n const togglePlay = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.paused\n ? videoRef.current.play()\n : videoRef.current.pause();\n }\n }, [videoRef?.current]);\n\n const play = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.play();\n }\n }, [videoRef?.current]);\n\n const pause = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.pause();\n }\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n const handlePlay = () => {\n setIsPlaying(true);\n };\n const handlePause = () => {\n setIsPlaying(false);\n };\n\n setIsPlaying(!videoRef?.current.paused);\n\n if (videoRef?.current) {\n videoRef.current.addEventListener(\"play\", handlePlay);\n videoRef.current.addEventListener(\"pause\", handlePause);\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", handlePlay);\n videoRef.current?.removeEventListener(\"pause\", handlePause);\n };\n }\n }, [videoRef?.current]);\n\n return { togglePlay, isPlaying, play, pause };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useSeek = (videoRef: VideoRef, value = 10) => {\n const seekForward = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.currentTime += value;\n }\n }, [videoRef?.current]);\n\n const seekBackward = React.useCallback(() => {\n if (videoRef?.current) {\n videoRef.current.currentTime -= value;\n }\n }, [videoRef?.current]);\n\n return { seekForward, seekBackward };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useSpeed = (videoRef: VideoRef) => {\n const [speed, setSpeed] = React.useState(1);\n\n const onChangeSpeed = (speed: number) => {\n setSpeed(speed);\n };\n\n // Get the speed from the video element\n React.useEffect(() => {\n if (!videoRef?.current) return;\n setSpeed(videoRef.current.playbackRate);\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.playbackRate = speed;\n }, [speed, videoRef?.current]);\n\n return { speed, onChangeSpeed };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useStartAt = (videoRef: VideoRef, startAt: number) => {\n React.useEffect(() => {\n if (!videoRef?.current || !startAt) return;\n\n const video = videoRef?.current;\n if (video && startAt) {\n video.currentTime = startAt;\n }\n }, [startAt, videoRef?.current]);\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types.js\";\n\nexport const useCurrentTime = (videoRef: VideoRef, interval = 10) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n const [currentTime, setCurrentTime] = React.useState(0);\n\n React.useEffect(() => {\n if (videoRef?.current && isPlaying) {\n const intervalId = setInterval(() => {\n setCurrentTime(videoRef.current?.currentTime || 0);\n }, interval);\n\n return () => clearInterval(intervalId);\n }\n }, [videoRef?.current, isPlaying]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n const video = videoRef.current;\n\n // Store handlers in variables for proper cleanup (critical for Safari memory safety)\n const handlePlay = () => setIsPlaying(true);\n const handlePause = () => setIsPlaying(false);\n\n video.addEventListener(\"play\", handlePlay);\n video.addEventListener(\"pause\", handlePause);\n\n return () => {\n video.removeEventListener(\"play\", handlePlay);\n video.removeEventListener(\"pause\", handlePause);\n };\n }, [videoRef?.current]);\n\n const onTimeUpdate = (time: number) => {\n if (videoRef?.current) {\n setCurrentTime(time);\n videoRef.current.currentTime = time;\n }\n };\n\n return {\n currentTime,\n onTimeUpdate,\n };\n};\n","import { RefObject, useEffect, useState } from \"react\";\n\nconst useVideoState = (videoRef: RefObject<HTMLVideoElement | null>) => {\n const [isPlaying, setIsPlaying] = useState(false);\n const [isMuted, setIsMuted] = useState(false);\n const [isFullscreen, setIsFullscreen] = useState(false);\n\n useEffect(() => {\n const video = videoRef.current;\n\n if (video) {\n video.addEventListener(\"play\", () => setIsPlaying(true));\n video.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n video.removeEventListener(\"play\", () => setIsPlaying(true));\n video.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }\n }, [videoRef]);\n\n useEffect(() => {\n if (!videoRef?.current) return;\n\n // Set the initial state\n setIsMuted(videoRef.current.muted);\n\n const handleVolumeChange = () => {\n if (videoRef.current) {\n setIsMuted(videoRef.current.muted);\n }\n };\n\n videoRef.current.addEventListener(\"volumechange\", handleVolumeChange);\n\n return () => {\n videoRef.current?.removeEventListener(\"volumechange\", handleVolumeChange);\n };\n }, [videoRef]);\n\n useEffect(() => {\n if (!videoRef?.current) return;\n\n const handleFullscreenChange = () => {\n setIsFullscreen(!!document.fullscreenElement);\n };\n\n document.addEventListener(\"fullscreenchange\", handleFullscreenChange);\n return () =>\n document.removeEventListener(\"fullscreenchange\", handleFullscreenChange);\n }, [videoRef]);\n\n return { isPlaying, isMuted, isFullscreen };\n};\n\nexport { useVideoState };\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useVolume = (videoRef: VideoRef, initialVolume = 100) => {\n const [volume, setVolume] = React.useState(initialVolume);\n\n const onChangeVolume = (volume: number) => {\n setVolume(volume);\n };\n\n // Get the volume from the video element\n React.useEffect(() => {\n if (!videoRef?.current) return;\n setVolume(videoRef.current.volume * 100);\n }, [videoRef?.current]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.volume = volume / 100;\n }, [volume, videoRef?.current]);\n\n return { volume, onChangeVolume };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types.js\";\n\nexport const useBuffer = (videoRef: VideoRef, duration?: number) => {\n const [isPlaying, setIsPlaying] = React.useState(false);\n const [buffered, setBuffered] = React.useState(0);\n\n React.useEffect(() => {\n if (videoRef?.current && isPlaying) {\n const intervalId = setInterval(() => {\n if (videoRef.current?.buffered.length) {\n setBuffered(\n videoRef.current.buffered.end(videoRef.current.buffered.length - 1)\n );\n }\n }, 10);\n\n return () => clearInterval(intervalId);\n }\n }, [videoRef?.current, isPlaying]);\n\n React.useEffect(() => {\n if (!videoRef?.current) return;\n\n videoRef.current.addEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current.addEventListener(\"pause\", () => setIsPlaying(false));\n\n return () => {\n videoRef.current?.removeEventListener(\"play\", () => setIsPlaying(true));\n videoRef.current?.removeEventListener(\"pause\", () => setIsPlaying(false));\n };\n }, []);\n\n return {\n buffered,\n bufferedPercentage: (buffered / (duration || 0)) * 100 || 0,\n };\n};\n","import { useEffect, useState, useCallback } from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useDownload = (videoRef: VideoRef) => {\n const [isDownloading, setIsDownloading] = useState(false);\n const [downloadProgress, setDownloadProgress] = useState(0);\n const [error, setError] = useState<string | null>(null);\n\n const downloadVideo = useCallback(\n async (filename?: string) => {\n if (!videoRef?.current) {\n setError(\"Video element not found\");\n return;\n }\n\n const video = videoRef.current;\n const videoSrc = video.src || video.currentSrc;\n\n if (!videoSrc) {\n setError(\"No video source found\");\n return;\n }\n\n try {\n setIsDownloading(true);\n setError(null);\n setDownloadProgress(0);\n\n // Fetch the video file\n const response = await fetch(videoSrc);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch video: ${response.statusText}`);\n }\n\n // Get the content length for progress tracking\n const contentLength = response.headers.get(\"content-length\");\n const total = contentLength ? parseInt(contentLength, 10) : 0;\n\n // Create a readable stream to track progress\n const reader = response.body?.getReader();\n if (!reader) {\n throw new Error(\"Failed to create download stream\");\n }\n\n const chunks: BlobPart[] = [];\n let receivedLength = 0;\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) break;\n\n chunks.push(value);\n receivedLength += value.length;\n\n if (total > 0) {\n const progress = (receivedLength / total) * 100;\n setDownloadProgress(Math.round(progress));\n }\n }\n\n // Combine chunks into a single blob\n const blob = new Blob(chunks, {\n type: response.headers.get(\"content-type\") || \"video/mp4\",\n });\n\n // Create download link\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n\n // Generate filename if not provided\n const defaultFilename = filename || `video-${Date.now()}.mp4`;\n link.download = defaultFilename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n // Clean up\n URL.revokeObjectURL(url);\n\n setDownloadProgress(100);\n setIsDownloading(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Download failed\");\n setIsDownloading(false);\n setDownloadProgress(0);\n }\n },\n [videoRef]\n );\n\n // Alternative simple download method for direct video URLs\n const downloadDirect = useCallback(\n (filename?: string) => {\n if (!videoRef?.current) {\n setError(\"Video element not found\");\n return;\n }\n\n const video = videoRef.current;\n const videoSrc = video.src || video.currentSrc;\n\n if (!videoSrc) {\n setError(\"No video source found\");\n return;\n }\n\n try {\n setIsDownloading(true);\n setError(null);\n setDownloadProgress(0);\n\n const link = document.createElement(\"a\");\n link.href = videoSrc;\n link.download = filename || `video-${Date.now()}.mp4`;\n link.target = \"_blank\";\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n setIsDownloading(false);\n setDownloadProgress(100);\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Download failed\");\n setIsDownloading(false);\n setDownloadProgress(0);\n }\n },\n [videoRef]\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n setIsDownloading(false);\n setDownloadProgress(0);\n setError(null);\n };\n }, []);\n\n return {\n downloadVideo,\n downloadDirect,\n isDownloading,\n downloadProgress,\n error,\n resetError: () => setError(null),\n };\n};\n","import React from \"react\";\nimport type { VideoRef } from \"../types\";\n\nexport const useRange = (videoRef: VideoRef, range: [number, number]) => {\n React.useEffect(() => {\n if (!videoRef?.current || !range) return;\n\n const video = videoRef.current;\n\n if (video) {\n const handleTimeUpdate = () => {\n if (video.currentTime >= range[1]) {\n video.currentTime = range[0];\n } else if (video.currentTime <= range[0]) {\n video.currentTime = range[0];\n }\n };\n\n video.addEventListener(\"timeupdate\", handleTimeUpdate);\n\n return () => {\n video.removeEventListener(\"timeupdate\", handleTimeUpdate);\n };\n }\n }, [range, videoRef?.current]);\n};\n"],"mappings":"0jBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,wBAAAE,EAAA,yBAAAC,EAAA,cAAAC,GAAA,mBAAAC,GAAA,gBAAAC,GAAA,kBAAA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EAACF,GAAA,MAAAA,EAAU,UAAW,CAACC,EAAO,OAElC,IAAME,EAAQH,EAAS,QAEvB,GAAIG,EAAO,CACT,IAAMC,EAAmB,IAAM,EACzBD,EAAM,aAAeF,EAAM,CAAC,GAErBE,EAAM,aAAeF,EAAM,CAAC,KACrCE,EAAM,YAAcF,EAAM,CAAC,EAE/B,EAEA,OAAAE,EAAM,iBAAiB,aAAcC,CAAgB,EAE9C,IAAM,CACXD,EAAM,oBAAoB,aAAcC,CAAgB,CAC1D,CACF,CACF,EAAG,CAACH,EAAOD,GAAA,YAAAA,EAAU,OAAO,CAAC,CAC/B","names":["hooks_exports","__export","useAutoplayByForce","useAutoplayOnVisible","useBuffer","useCurrentTime","useDownload","useFullscreen","useGetDuration","useHotKeys","useMuteUnmute","usePictureInPicture","usePlayPause","useRange","useSeek","useSpeed","useStartAt","useVideoState","useVolume","__toCommonJS","import_react","useAutoplayByForce","videoRef","enabled","setError","React","_a","error","retryError","import_react","useAutoplayOnVisible","videoRef","threshold","enabled","React","observer","entries","entry","_a","error","import_react","useFullscreen","videoRef","isFullscreen","setIsFullscreen","React","previousStylesRef","handleFullscreenChange","isCurrentlyFullscreen","video","toggleFullscreen","isSafari","videoContainer","import_react","useGetDuration","videoRef","isLoading","setIsLoading","React","duration","setDuration","getDuration","_a","_b","handleError","video","import_react","useHotKeys","key","func","enabled","handleKeyDown","event","import_react","useMuteUnmute","videoRef","isMuted","setIsMuted","React","toggleMute","mute","unmute","handleVolumeChange","_a","usePictureInPicture","videoRef","video","error","videoContainer","import_react","usePlayPause","videoRef","isPlaying","setIsPlaying","React","togglePlay","play","pause","handlePlay","handlePause","_a","_b","import_react","useSeek","videoRef","value","seekForward","React","seekBackward","import_react","useSpeed","videoRef","speed","setSpeed","React","onChangeSpeed","import_react","useStartAt","videoRef","startAt","React","video","import_react","useCurrentTime","videoRef","interval","isPlaying","setIsPlaying","React","currentTime","setCurrentTime","intervalId","_a","video","handlePlay","handlePause","time","import_react","useVideoState","videoRef","isPlaying","setIsPlaying","isMuted","setIsMuted","isFullscreen","setIsFullscreen","video","handleVolumeChange","_a","handleFullscreenChange","import_react","useVolume","videoRef","initialVolume","volume","setVolume","React","onChangeVolume","import_react","useBuffer","videoRef","duration","isPlaying","setIsPlaying","React","buffered","setBuffered","intervalId","_a","_b","import_react","useDownload","videoRef","isDownloading","setIsDownloading","downloadProgress","setDownloadProgress","error","setError","downloadVideo","filename","_a","video","videoSrc","response","contentLength","total","reader","chunks","receivedLength","done","value","progress","blob","url","link","defaultFilename","err","downloadDirect","import_react","useRange","videoRef","range","React","video","handleTimeUpdate"]}