Video plays in background in iOS

I am trying to create an app similar to one above.

Home screen has a video feed.
When I move away from Home screen to other screens, the video keeps on playing in background. This happens only in iOS. In Android, the video stops.

Am I doing something wrong?

Hey @riteshpa,

Depending on your code, this may be expected behavior. If you’re navigating and the screen containing the video component is not unmounted it would continue to play. Hard to say without seeing code and how you’re handling it.

Cheers,
Adam

Thanks @adamjnav

I’ve shared link of source code. I’ve used createBottomTabNavigator

When I navigate from one tab to another, video which was playing in tab one continues to play. Will the component not get unmounted automatically when I move to another tab?

That’s correct. The component rendered by the tabnavigator in an initial route will not unmount until the tabnavigator itself is unmounted so the video is expected to continue to play. You could use a focus listener to toggle the video status.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.