Is it possible to allow a Corona app to keep the users iPod music or Pandora music playing in the background while using the app?
Thanks for any help. [import]uid: 90878 topic_id: 33359 reply_id: 333359[/import]
Is it possible to allow a Corona app to keep the users iPod music or Pandora music playing in the background while using the app?
Thanks for any help. [import]uid: 90878 topic_id: 33359 reply_id: 333359[/import]
There is a way to do this on iOS only, but it is very limited and not really something we support. You accomplish this setting specific flags in build.settings/plist and see what you can get away with. Also, tead the Audio Notes page and follow the link to the (advanced) Audio Session APIs and read forum thread.
[import]uid: 7563 topic_id: 33359 reply_id: 132487[/import]
Add this code:
if audio.supportsSessionProperty == true then
print("supportsSessionProperty is true")
audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode)
end
-- Store whether other audio is playing. It's important to do this once and store the result now, as referring to audio.OtherAudioIsPlaying later gives misleading results, since at that point the app itself may be playing audio
local isOtherAudioPlaying = false
if audio.supportsSessionProperty == true then
print("supportsSessionProperty is true")
if not(audio.getSessionProperty(audio.OtherAudioIsPlaying) == 0) then
print("I think there is other Audio Playing")
isOtherAudioPlaying = true
end
end
Here is some more information about it:
http://developer.coronalabs.com/forum/2011/06/05/new-audiosession-properties
[import]uid: 199310 topic_id: 33359 reply_id: 132490[/import]
There is a way to do this on iOS only, but it is very limited and not really something we support. You accomplish this setting specific flags in build.settings/plist and see what you can get away with. Also, tead the Audio Notes page and follow the link to the (advanced) Audio Session APIs and read forum thread.
[import]uid: 7563 topic_id: 33359 reply_id: 132487[/import]
Add this code:
if audio.supportsSessionProperty == true then
print("supportsSessionProperty is true")
audio.setSessionProperty(audio.MixMode, audio.AmbientMixMode)
end
-- Store whether other audio is playing. It's important to do this once and store the result now, as referring to audio.OtherAudioIsPlaying later gives misleading results, since at that point the app itself may be playing audio
local isOtherAudioPlaying = false
if audio.supportsSessionProperty == true then
print("supportsSessionProperty is true")
if not(audio.getSessionProperty(audio.OtherAudioIsPlaying) == 0) then
print("I think there is other Audio Playing")
isOtherAudioPlaying = true
end
end
Here is some more information about it:
http://developer.coronalabs.com/forum/2011/06/05/new-audiosession-properties
[import]uid: 199310 topic_id: 33359 reply_id: 132490[/import]