7

I am unable to get react-native-video to play mp4 files in the background, It will play mp3s and audio files but it refuses to continue playing the video. I have set the background modes in xcode to on with the audio, airplay and picture in picture selected as well as passing these props in as well

playInBackground={true}
playWhenInactive={true}
ignoreSilentSwitch={'ignore'}

is there additional configuration required when its a video and not just audio?

Thomas Yancey
  • 391
  • 4
  • 7

1 Answers1

6

Try the code below:

<Video
    source={{uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4'}}
    style={{ width: 400, height: 400}}
    muted={false}
    repeat={false}
    resizeMode={"cover"}
    volume={1.0}
    rate={1.0}
    ignoreSilentSwitch={"ignore"}
    playWhenInactive={true}
    playInBackground={true}
  />

Run your project from Xcode after doing the step below not just from React-Native packager.

Set the Capabilities in Xcode:

enter image description here

Sateesh Yemireddi
  • 4,289
  • 1
  • 20
  • 37