new fixes for playback
This commit is contained in:
parent
4bb9a8bfd3
commit
f2315e91cb
@ -101,8 +101,12 @@ export function useReversePlayback(
|
|||||||
cleanupFnsRef.current.forEach((fn) => fn());
|
cleanupFnsRef.current.forEach((fn) => fn());
|
||||||
cleanupFnsRef.current = [];
|
cleanupFnsRef.current = [];
|
||||||
const video = options.videoRef.current;
|
const video = options.videoRef.current;
|
||||||
if (video && video.playbackRate !== 1) {
|
if (video) {
|
||||||
video.playbackRate = 1;
|
if (video.playbackRate !== 1) {
|
||||||
|
video.playbackRate = 1;
|
||||||
|
}
|
||||||
|
// Ensure video visibility is restored
|
||||||
|
video.style.opacity = '1';
|
||||||
}
|
}
|
||||||
}, [options.videoRef]);
|
}, [options.videoRef]);
|
||||||
|
|
||||||
@ -202,6 +206,8 @@ export function useReversePlayback(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const beginFrameStepping = () => {
|
const beginFrameStepping = () => {
|
||||||
|
// Restore visibility now that we're at the correct frame
|
||||||
|
video.style.opacity = '1';
|
||||||
video.pause();
|
video.pause();
|
||||||
let lastFrameTime = performance.now();
|
let lastFrameTime = performance.now();
|
||||||
let stepCount = 0;
|
let stepCount = 0;
|
||||||
@ -367,10 +373,12 @@ export function useReversePlayback(
|
|||||||
() => video.removeEventListener('ended', onEnded),
|
() => video.removeEventListener('ended', onEnded),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Start playback to trigger buffering, but from near the end
|
// Start playback to trigger buffering
|
||||||
// to avoid showing frame 0 (which would flash the target page)
|
// Hide video via direct DOM manipulation to avoid flash
|
||||||
|
// (React state update is async, so isBuffering won't hide it in time)
|
||||||
video.muted = true;
|
video.muted = true;
|
||||||
video.currentTime = actualDuration - 0.1;
|
video.style.opacity = '0';
|
||||||
|
video.currentTime = 0;
|
||||||
video.play().catch(() => undefined);
|
video.play().catch(() => undefined);
|
||||||
|
|
||||||
// Fallback timeout
|
// Fallback timeout
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user