I am using react-native-video package to display video. Below is my code :
<Video
paused={paused}
source={{ uri: gallery.path }}
style={{ width, height: 280 }}
resizeMode="contain"
bufferConfig={{
minBufferMs: 2600,
maxBufferMs: 30000,
bufferForPlaybackMs: 2500,
bufferForPlaybackAfterRebufferMs: 2000,
}}
ref={ref}
onEnd={() => {
if (ref.current) {
ref.current.seek(0);
}
}}
/>;
This is a part of the screen under Tab Navigator and Stack Navigator. I have 2 issues:
The video does not stop when I move the app to the background. I was able to do it using
AppState
and setting paused to true whenAppState !=== "active"
. Wouldn't the player automatically stop it?When the app is moved to the background - sometimes the app restarts. This is happening non-deterministically and I can't find much logs in logcat nor does my sentry report anything.
This page is called IndividualGalleryScreen.tsx
I also have a DashboardScreen.tsx
on a different tab which has multiple such Video Elements in a FlatList.
I am not using android.largeHeap=true
Can anyone guide me on what could be the issue that app sometimes restarts when I try to get it to the foreground?
Thank you.