mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-27 11:24:43 +00:00
fix(webui): snap playhead to last frame upon ended event in useFramePlayer
This commit is contained in:
@@ -186,8 +186,13 @@ export function useFramePlayer(
|
||||
}
|
||||
}
|
||||
|
||||
const handleEnded = () => {
|
||||
setCurrentFrame(totalFrames - 1)
|
||||
}
|
||||
|
||||
video.addEventListener('play', handlePlay)
|
||||
video.addEventListener('pause', handlePause)
|
||||
video.addEventListener('ended', handleEnded)
|
||||
|
||||
// If it's already playing when this effect runs
|
||||
if (!video.paused) {
|
||||
@@ -199,6 +204,7 @@ export function useFramePlayer(
|
||||
active = false
|
||||
video.removeEventListener('play', handlePlay)
|
||||
video.removeEventListener('pause', handlePause)
|
||||
video.removeEventListener('ended', handleEnded)
|
||||
if (rVfcId !== null) {
|
||||
const videoWithCallback = video as unknown as HtmlVideoElementWithCallback
|
||||
if (videoWithCallback.cancelVideoFrameCallback) {
|
||||
|
||||
Reference in New Issue
Block a user