I am currently working on a music app in react-native and I am using react-native video to render my audio. Here's the issue that I am facing:
I pause the audio from the app then I receive a call, then the music resumes automatically even when the app is in the background for hours and I get this log in the XCode for missing entitlements.
[MRNowPlaying] Ignoring setPlaybackState because application does not contain entitlement com.apple.mediaremote.set-playback-state for platform
Here's my code:
<Video
source={{
uri: audio,
}}
volume={playerVolume}
onLoadStart={() => {
setLoadingPlayer(true);
}}
ref={homePlayerRef}
paused={!playHomeAudio || !playingM || activeIndex !== index}
onLoad={(data: any) => {
setDuration(data.duration);
}}
onEnd={onEndInHome}
// playInBackground={true}
// playWhenInactive={true}
/>
Here's what I have tried:
I created a new Entitlement.plist file and added a key for com.apple.mediaremote.set-playback-state
as Boolean with the value 0. But no change in the result.
Also, I tried to create an App.entitlements file with
<key>com.apple.mediaremote.set-playback-state</key>
<true/>
Thanks in advance.