-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow background audio play on iOs #1
Comments
Can you send a PR? |
Will do after finishing my tests (university is keeping me busy). |
Pull request done. |
Audio doesn't work when I switch my iPhone to silent or lock it. Any idea how to solve this issue ? |
@mehyaa @pabloacastillo my iOS users are getting pissed by this... I'm quite stuck 🙈 Any idea ? |
Can you check this if it works? In app/App_Resources/iOS/Info.plist add
You can google "UIBackgroundModes" for more details, but it might work. Best of lucks! |
@pabloacastillo thanks for your answer, I'd already tried that but no success. But the good news is I finally managed to make it work! The solution was to add this code to my iOS Delegate. And I do not use your plugin actually, but nativescript-audio. MyDelegate.prototype.applicationDidEnterBackground = function (application) {
AVAudioSession.sharedInstance().setCategoryWithOptionsError(
AVAudioSessionCategoryPlayAndRecord,
AVAudioSessionCategoryOptions.DefaultToSpeaker
);
}; |
Hi there, this port is great it just needs background audio when a iOs device is blocked or the screen turns off.
I saw the code at nstudio has been updated to run in this mode and seems to be an easy fix.
The six line change occurs in in ios/player.ts:
playFromUrl function change this:
to this:
and in playFromFile function change this:
to this:
I hope this helps someone else who has to dig around this issue.
check more information at nstudio/nativescript-audio#19
The text was updated successfully, but these errors were encountered: