From 8f8bb1ae28c96d22ceca725c6350df1747dc62ab Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Thu, 26 Jan 2023 22:20:02 -0500 Subject: [PATCH] Fix pip exception on Android (#232) --- lib/screens/channel/video/video_store.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/screens/channel/video/video_store.dart b/lib/screens/channel/video/video_store.dart index 8628d636..212d6ed9 100644 --- a/lib/screens/channel/video/video_store.dart +++ b/lib/screens/channel/video/video_store.dart @@ -232,7 +232,11 @@ abstract class VideoStoreBase with Store { @action void dispose() { // Disable auto PiP when leaving so that we don't enter PiP on other screens. - if (Platform.isAndroid) pip.setAutoPipMode(autoEnter: false); + if (Platform.isAndroid) { + SimplePip.isAutoPipAvailable.then((isAutoPipAvailable) { + if (isAutoPipAvailable) pip.setAutoPipMode(autoEnter: false); + }); + } // Not ideal, but seems like the only way of disposing of the video properly. // Will both prevent the video from continuing to play when dismissed and closes PiP on iOS.