From b21ce03c085f814182ba073e910fa01198ac929c Mon Sep 17 00:00:00 2001 From: Vit Horacek <36083550+mountiny@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:24:16 +0000 Subject: [PATCH] Merge pull request #37007 from software-mansion-labs/video-player-followups/fix-crashing [CP Staging] Fix - App crashes when scrubbing through an mp4 file on attachment upload preview (cherry picked from commit 437d75c3b046400e65341892105712b920c682d1) --- src/components/VideoPlayerContexts/PlaybackContext.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/VideoPlayerContexts/PlaybackContext.js b/src/components/VideoPlayerContexts/PlaybackContext.js index b77068f3aea2..8cf09f81c614 100644 --- a/src/components/VideoPlayerContexts/PlaybackContext.js +++ b/src/components/VideoPlayerContexts/PlaybackContext.js @@ -67,6 +67,9 @@ function PlaybackContextProvider({children}) { const checkVideoPlaying = useCallback( (statusCallback) => { + if (!(currentVideoPlayerRef && currentVideoPlayerRef.current && currentVideoPlayerRef.current.getStatusAsync)) { + return; + } currentVideoPlayerRef.current.getStatusAsync().then((status) => { statusCallback(status.isPlaying); });