Page 1 of 1

Play Audio on Background Mode

Posted: Wed Sep 28, 2016 8:20 am
by Armenhui
Hi every one.

I want to know can I play audio in background mode on LiveCode (iOS and Android platforms) ?

I mean continue playing audio when the app goes to suspend mode.

Re: Play Audio on Background Mode

Posted: Wed Sep 28, 2016 10:51 am
by Klaus
Hi Armenuhi,

in the standalone builder settings for iOS check "Background Audio (experimental)"! 8)
Not sure if this is also available for Android.


Best

Klaus

Re: Play Audio on Background Mode

Posted: Wed Sep 28, 2016 12:15 pm
by Armenhui
Thanks Klaus for the answer, I already tried this option, but it did not work.

Re: Play Audio on Background Mode

Posted: Wed Sep 28, 2016 12:43 pm
by Klaus
Hm, it is "experimental"! :D
If it does not work, I would create a bug report here: http://quality.runrev.com

Re: Play Audio on Background Mode

Posted: Wed Sep 28, 2016 1:11 pm
by Armenhui
I used LiveCode 8.1.0 stable version, and mobilePlaySoundOnChannel command

I even ticked the Background Audio (experimental) option in the standalone settings. But it still did not work.

If you are going to send a bug report please just send me the link so I can follow the updates. As we need this functionality as soon as possible.

Or if you want I can file a bug report myself.

Thanks
Armenuhi

Re: Play Audio on Background Mode

Posted: Wed Sep 28, 2016 1:59 pm
by Klaus
I do not develop for mobile, so you should report this bug!

Re: Play Audio on Background Mode

Posted: Wed Sep 28, 2016 2:43 pm
by Armenhui
Ok.

Thanks

Re: Play Audio on Background Mode

Posted: Thu Nov 24, 2016 10:09 pm
by joseggarza
Armenhui wrote:Ok.

Thanks
any Updates on this topic?

Re: Play Audio on Background Mode

Posted: Tue May 16, 2017 9:03 am
by mattyj2001
I've been tearing my hair out on this one for a while. I think I figured it out.

According to the comments on a LiveCode lesson named "How do I play sounds on an iOS device?" (forums won't allow me to post a link...) you should be able to set iphoneSetAudioCategory to "playback". I found this doesn't work at all.

What does work is using mergAV to do the same thing. Be sure to include mergAV in your standalone's inclusions and check the 'Background audio (experimental)' box on your iOS Standalone app settings:

Code: Select all

   mergAVAudioSessionSetCategory "playback"
   put specialFolderPath("engine") & "/sound/alert.mp3" into tSound
   play tSound
I also found that mobilePlaySoundOnChannel doesn't work in this context, either, you have to use 'play'.

This will allow your sound to continue playing when your app moves to the background our the mute switch is activated. Also works if the phone is locked during play. Neat!

What I can't figure out, and no docs I can find say anything about it, is if you can start the sound while the app is in the background. The above only allows it to continue playing once it's started.

Re: Play Audio on Background Mode

Posted: Sun Jun 04, 2017 10:38 am
by LiveCode_Panos
Hi all,

The fact that setting the iphoneSetAudioCategory to "playback" doesn't work in LC 7+ is a bug, and it will be fixed in LC 8.1.5 RC-1:

https://github.com/livecode/livecode/pull/5446

Best,
Panos
--