nativescript-audio
nativescript-audio copied to clipboard
Keep audio playing when phone is locked? (iOS)
Right now, on iOS (could be android too), if the audio is playing and then locked, the audio stops playing. Using init from url in case relevant. Is there a way to keep the audio playing when the phone is locked?
This is similar to this issue: https://github.com/nstudio/nativescript-audio/issues/19. I did not see a resolution there. Thanks.
@NL33 not possible with the current implementation, you need to run a background service and play audio through it. Media playback on android is a nightmare, I had to write a background service and a media notification in java once, and it took me at least a week before I got it working.
I haven't checked yet, but with the new androidX stuff, it might be easier to get it working in native code.
I remember that iOS was easier.
Thanks. I am hoping it is possible without going into the "long running tasks" background execution processes--that appears to be a deeper change to the app than I hope would be necessary.
I also see that @bradmartin said in #19: "The plugin should continue playing if you lock the device screen or minimize the app. " Maybe there is some other way?
I actually have the source to do background audio with this plugin. nStudio did it for a client over a year ago and the client approved merging it into the main audio
plugin (this one) so the community benefits from it. Right now it's just a lack of time merging the code and trying to minimize any major issues 😄 .
@bradmartin any updates on this?
@bradmartin It's working on iOS simulator ( stays playing on background [ even if it's locked or go to background ] but NOT on real device . I wonder why ?
Any updates of that merge @bradmartin ?