partially fix double-playing
This commit is contained in:
@@ -113,6 +113,7 @@ export function VideoPlayer({
|
|||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
pause()
|
pause()
|
||||||
|
setFocused(false)
|
||||||
}
|
}
|
||||||
}, [active, play, pause])
|
}, [active, play, pause])
|
||||||
|
|
||||||
@@ -176,6 +177,7 @@ function useVideoUtils(ref: React.RefObject<HTMLVideoElement>) {
|
|||||||
if (ref.current.readyState >= HTMLMediaElement.HAVE_ENOUGH_DATA) {
|
if (ref.current.readyState >= HTMLMediaElement.HAVE_ENOUGH_DATA) {
|
||||||
ref.current.play()
|
ref.current.play()
|
||||||
} else {
|
} else {
|
||||||
|
// TODO: find different solution. can sometimes cause double-playing
|
||||||
ref.current.addEventListener('canplay', () => {
|
ref.current.addEventListener('canplay', () => {
|
||||||
ref.current?.play()
|
ref.current?.play()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user