0

I have a hybrid app developed using Xamarin, using a library I created to mimic just the aspects of MVC I needed, such that I can almost share the same .cshtml files, and model and controller libraries as my web site. It's a language study app, and one part of it is a media player for playing audio lesson files, implemented in HTML 5 and JavaScript. On Android, when I put the phone to sleep, the audio will continue. In IOS, it will fade to silence right-way.

Is there a way to keep the audio playing in sleep mode?

Thanks.

jtsoftware
  • 521
  • 3
  • 14
  • On iOS if you want to play audios on background state, you should enable the background mode. – Ax1le Apr 13 '18 at 09:20

1 Answers1

0

Some searching revealed the following useful page: https://learn.microsoft.com/en-us/xamarin/ios/app-fundamentals/backgrounding/ios-backgrounding-walkthroughs/location-walkthrough

Since I'm using Visual Studio on a PC, I had to add the following to my info.plist:

  <key>UIBackgroundModes</key>
  <array>
    <string>audio</string>
  </array>

Note the "audio" value as opposed to "location" used in the example.

jtsoftware
  • 521
  • 3
  • 14