Open flexgrip opened 5 years ago
Just noticed that ignoreSilentSwitch
Isn’t working either. Totally mutes the audio...
So it seems to work, depending on the orientation of the moon and the price of tea in China. Sometimes xcode builds a version that works, sometimes it doesn't. I can't seem to find the culprit.
I have no idea why it works on android, then doesn't work on iOS. Then I'll build it again a few hours later with no changes and it works great. I think maybe the only difference is one build is a debug build and another is a release build in xcode? Not sure why that would matter though, they still use the same Info.plist.
I guess I'll close this.
Nope. It's definitely related to this player. What I can do is swap this out for react-native-video, then swap back to this player without doing a complete reload and it'll then play in the background. If I kill the app and restart, it won't. So I think it has something to do with the react-native-video dependency being too old or something.
Steps to reproduce:
playInBackground
works.I am assuming this is because when you kill the app and start over, it is pulling in that dependency again? Not sure.
I tried updating react-native-video in this package.json to the current latest (4.4.4). Did not work.
I'll keep chugging along and try to figure out what the deal is.
Ok. So I did some manual edits to the af package itself. My suspicion was that the props weren't being passed or implemented somehow. So I manually edited playsInBackground
and ignoreSilentSwitch
and rebuilt everything. Then it started working.
I am also using @jay0512's fork: https://github.com/jay0512/react-native-af-video-player
I'll try to figure out why the props aren't properly being passed and provide a PR to fix it. Any help would be appreciated :)
I had audio on my headphone but not the phone speakers. In my case I had turned on the hardware silent switch. Turning off did fix it. It seems the issue is with internal management of the react-native-video prop "ignoreSilentSwitch" as @flexgrip suggested.
react-native-audio repo also has listed few issues related to this and this post helped me: https://github.com/react-native-community/react-native-video/issues/874#issuecomment-369840510
Hello,
In the simulator, background audio works great. I've followed the instructions and enabled background audio in xcode, as well as set all of the props to true or 'ignore'
Since it works in the sim, I assumed I had all of the settings right. But when testing on a real iPhone 6s, hitting the home button while playing a video causes the audio to slowly mute, killing background audio.
Any ideas? I'm running the latest version of react-native-af, as well as RN 0.60.3
Thanks!