From ce711f40c2e73797ae7d3b0d6f4fd28dcc57b930 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Tue, 2 May 2023 17:04:57 +0200 Subject: [PATCH] fix(player): fix autopause on tabs --- frontend/app/components/Session/WebPlayer.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index 6eed3e2f5..6c8785dff 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -69,10 +69,10 @@ function WebPlayer(props: any) { } }, [session.events, session.errors, contextValue.player]) - const { ready: isPlayerReady, firstVisualEvent: visualOffset, messagesProcessed } = contextValue.store?.get() || {} + const { firstVisualEvent: visualOffset, messagesProcessed } = contextValue.store?.get() || {} React.useEffect(() => { - if (showNoteModal || activeTab !== '') { + if (showNoteModal) { contextValue.player.pause() } @@ -93,6 +93,12 @@ function WebPlayer(props: any) { } }, [activeTab, showNoteModal, visualOffset, messagesProcessed]) + React.useEffect(() => { + if (activeTab === 'Click Map') { + contextValue.player?.pause() + } + }, [activeTab]) + // LAYOUT (TODO: local layout state - useContext or something..) useEffect( () => () => {