6

On android when I navigate to another screen (using stack navigator or bottom tab navigator ) the video (using react-native-video) is paused, or even unmounted because when i get back to the video it starts again from the beginning of the media (can't resume the video except with the seek method). But on iOS, when I navigate away to another screen (with no video), the video is still playing in the background.

This is the behavior I would like (on iOS) as I want to resume video when going back to the video screens (I handle pause/play with on focus/blur events in react navigation).

Is there anyway to have the same behavior on android ?

I use react-native-video v 5.1.1 and react-navigation 4.4.4

I made a reproductible demo code available here : repro

Running this on android : when navigating to another screen, the video stops

Running this on iOS : when navigating to another screen, the video keeps playing (that's what I want)

I tried playing around with all the Video props but it didn' work.

qhoarau
  • 61
  • 1

1 Answers1

1

In Stack navigation you need to set the screen options prop to {detachePreviousScreen:false}

https://reactnavigation.org/docs/stack-navigator/#detachpreviousscreen

Sooraj k
  • 11
  • 3
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 16 '23 at 09:29