Resume after scrubbing, hide player UI faster

This commit is contained in:
hckrman101 2025-11-27 19:55:59 -05:00 committed by GitHub
parent 97c01c70b3
commit af2d1fa6b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -360,7 +360,7 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
},
nativeControlsForTouch: false,
playbackRates: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2],
inactivityTimeout: 2000,
inactivityTimeout: 700,
preload: "none",
playsinline: true,
techOrder: ["chromecast", "html5"],
@ -893,15 +893,23 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = PatchComponent(
);
}, [getPlayer, scene]);
const pausedBeforeScrubber = useRef(true);
function onScrubberScroll() {
if (started.current) {
getPlayer()?.pause();
const player = getPlayer();
if (started.current && player) {
pausedBeforeScrubber.current = player.paused();
player.pause();
}
}
function onScrubberSeek(seconds: number) {
if (started.current) {
getPlayer()?.currentTime(seconds);
const player = getPlayer();
if (started.current && player) {
player.currentTime(seconds);
if (!pausedBeforeScrubber.current) {
player.play();
}
} else {
setTime(seconds);
}