Play Audio on Background Mode
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Play Audio on Background Mode
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.
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
Hi Armenuhi,
in the standalone builder settings for iOS check "Background Audio (experimental)"!
Not sure if this is also available for Android.
Best
Klaus
in the standalone builder settings for iOS check "Background Audio (experimental)"!
Not sure if this is also available for Android.
Best
Klaus
Re: Play Audio on Background Mode
Thanks Klaus for the answer, I already tried this option, but it did not work.
Re: Play Audio on Background Mode
Hm, it is "experimental"!
If it does not work, I would create a bug report here: http://quality.runrev.com
If it does not work, I would create a bug report here: http://quality.runrev.com
Re: Play Audio on Background Mode
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
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
I do not develop for mobile, so you should report this bug!
Re: Play Audio on Background Mode
Ok.
Thanks
Thanks
-
- Posts: 44
- Joined: Thu Jul 24, 2014 8:55 pm
Re: Play Audio on Background Mode
any Updates on this topic?Armenhui wrote:Ok.
Thanks
-
- Posts: 15
- Joined: Tue Apr 04, 2017 8:02 am
Re: Play Audio on Background Mode
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:
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.
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
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.
-
- Livecode Staff Member
- Posts: 818
- Joined: Fri Feb 06, 2015 4:03 pm
Re: Play Audio on Background Mode
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
--
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
--