We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1c4759 commit c227e3bCopy full SHA for c227e3b
src/hooks/useAudioControl.ts
@@ -185,7 +185,16 @@ export function useAudioControl(options: CreateAudioElementOptions) {
185
},
186
[audioElementRef]
187
),
188
- () => audioElementRef.current?.currentTime,
+ () => {
189
+ if (!audioElementRef.current) {
190
+ return undefined;
191
+ }
192
+
193
+ // Use `Math.round()` here because
194
+ // 1. The player UI only displays currentTime at second-level precision
195
+ // 2. Prevent too many updates (leads to crash on Safari)
196
+ return Math.round(audioElementRef.current.currentTime);
197
+ },
198
() => undefined
199
);
200
0 commit comments