Skip to content

Commit

Permalink
Remove ensurePlaying() from timeupdate listener
Browse files Browse the repository at this point in the history
The ensurePlaying() call was removed from the timeupdate listener due to unnecessary API calls, which could trigger before previous calls completed.

This functionality isn't required in timeupdate, as listening to playing and pause events suffices. An edge case where the video is played before the script upload finishes has also been addressed to ensure proper handling.
  • Loading branch information
dumdum7 authored Dec 29, 2024
1 parent d5d9edc commit 35d6ed1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({
interactiveReady.current = false;
uploadScript(scene.paths.funscript || "").then(() => {
interactiveReady.current = true;
// if video is already playing when upload finishes, trigger script play
const player = getPlayer();
if (player && !player.paused())
interactiveClient.play(player.currentTime());
});
}
}, [
Expand Down Expand Up @@ -514,9 +518,6 @@ export const ScenePlayer: React.FC<IScenePlayerProps> = ({

function timeupdate(this: VideoJsPlayer) {
if (this.paused()) return;
if (scene.interactive && interactiveReady.current) {
interactiveClient.ensurePlaying(this.currentTime());
}
setTime(this.currentTime());
}

Expand Down

0 comments on commit 35d6ed1

Please sign in to comment.