Fix preview getting wrong update time (#10534)

* Fix preview getting wrong update time

* remove dead logic

* Cleanup

* Fix case where multiple previews play at the same time

* Fix typing
This commit is contained in:
Nicolas Mowen
2024-03-19 07:34:49 -06:00
committed by GitHub
parent 5c3925ab50
commit ccdf9a2f0a
4 changed files with 32 additions and 26 deletions

View File

@@ -120,13 +120,13 @@ export default function DynamicVideoPlayer({
const onTimeUpdate = useCallback(
(time: number) => {
if (!controller || !onTimestampUpdate || time == 0) {
if (isScrubbing || !controller || !onTimestampUpdate || time == 0) {
return;
}
onTimestampUpdate(controller.getProgress(time));
},
[controller, onTimestampUpdate],
[controller, onTimestampUpdate, isScrubbing],
);
// state of playback player
@@ -176,7 +176,13 @@ export default function DynamicVideoPlayer({
onTimeUpdate={onTimeUpdate}
onPlayerLoaded={onPlayerLoaded}
onClipEnded={onClipEnded}
onPlaying={() => setIsLoading(false)}
onPlaying={() => {
if (isScrubbing) {
playerRef.current?.pause();
}
setIsLoading(false);
}}
>
{config && focusedItem && (
<TimelineEventOverlay