From 431774d044bfab0468b4027ad6730a231066fad8 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Fri, 8 Mar 2024 15:48:11 -0700 Subject: [PATCH] Get autoplay working right --- web/src/components/player/DynamicVideoPlayer.tsx | 4 ++++ web/src/views/events/RecordingView.tsx | 2 ++ 2 files changed, 6 insertions(+) diff --git a/web/src/components/player/DynamicVideoPlayer.tsx b/web/src/components/player/DynamicVideoPlayer.tsx index 5a90fd65e..13911d8c3 100644 --- a/web/src/components/player/DynamicVideoPlayer.tsx +++ b/web/src/components/player/DynamicVideoPlayer.tsx @@ -328,6 +328,10 @@ export class DynamicVideoController { } } + autoPlay(play: boolean) { + this.playerController.autoplay(play); + } + seekToTimestamp(time: number, play: boolean = false) { if (this.playerMode != "playback") { this.playerMode = "playback"; diff --git a/web/src/views/events/RecordingView.tsx b/web/src/views/events/RecordingView.tsx index 2af834cd6..89dff8b40 100644 --- a/web/src/views/events/RecordingView.tsx +++ b/web/src/views/events/RecordingView.tsx @@ -119,7 +119,9 @@ export function DesktopRecordingView({ const newController = videoPlayersRef.current[newCam]; lastController.onPlayerTimeUpdate(null); lastController.onClipChangedEvent(null); + lastController.autoPlay(false); lastController.scrubToTimestamp(currentTime); + newController.autoPlay(true); newController.onCanPlay(() => { newController.seekToTimestamp(currentTime, true); newController.onCanPlay(null);