partially fix double-playing

This commit is contained in:
Samuel Newman
2024-07-26 16:14:54 +01:00
parent c1e19e4fde
commit f136bbb719
@@ -113,6 +113,7 @@ export function VideoPlayer({
}
return () => {
pause()
setFocused(false)
}
}, [active, play, pause])
@@ -176,6 +177,7 @@ function useVideoUtils(ref: React.RefObject<HTMLVideoElement>) {
if (ref.current.readyState >= HTMLMediaElement.HAVE_ENOUGH_DATA) {
ref.current.play()
} else {
// TODO: find different solution. can sometimes cause double-playing
ref.current.addEventListener('canplay', () => {
ref.current?.play()
})