I am working in a react native music app.I use react-native-video
in this case to play songs,and in playInBackground
prop I change it conditionally based on user status subscription, If this user bought a full package, I change it to true that's mean play songs in the background if false don't play it in the background.
But the problem with iOS app it when i want to enable Audio in the background should i add this to info.Plist
<key>UIBackgroundModes</key><array><string>audio</string></array>
So in my case, every user can play a song in the background!So how can I handle it and control play song in the background based on user status?
Code Snippet:
<Video ref={ref => { this.player = ref; }} source={{ uri: this.props.songs[this.props.currentIndex].url, }} paused={this.props.isPause} playInBackground={this.props.isPaid} // refere to user subscribtion. "Paid = true / Unpaid = false" playWhenInactive={true} onLoad={this.onLoad} onProgress={this.onProgress.bind(this)} onEnd={this.onEnd} controls={false} />