Handle seek completion

This commit is contained in:
Ivan Malison 2024-12-04 12:51:28 -07:00
parent d7977241c9
commit 7a6afd52a3

View File

@ -91,6 +91,7 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
onError, onError,
onReadyForDisplay, onReadyForDisplay,
onSeek, onSeek,
onSeekComplete,
onVolumeChange, onVolumeChange,
onEnd, onEnd,
onPlaybackStateChanged, onPlaybackStateChanged,
@ -488,7 +489,16 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
}) })
} }
onSeeking={() => (isSeeking.current = true)} onSeeking={() => (isSeeking.current = true)}
onSeeked={() => (isSeeking.current = false)} onSeeked={() => {
(isSeeking.current = false)
onSeekComplete?.({
currentTime: (nativeRef.current?.currentTime || 0.0) - cropStartSeconds,
seekTime: 0.0,
target: 0.0,
})
}}
onVolumeChange={() => { onVolumeChange={() => {
if (!nativeRef.current) { if (!nativeRef.current) {
return; return;