Audio Resume help

I have been using the new audio api's without issue...except for one scenario.

When my app suspends the audio stops...but does not restart on resuming the app.

I have tried numerous ideas...but can not get this.

Here is my current code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
elseif event.type == "applicationSuspend" then
  
     if backgroundMusicChannel then     
     audio.pause(backgroundMusicChannel) end
     
     --audio.stop(backgroundMusicChannel)
     --audio.dispose(backgroundMusic)
     print("Suspend")
     
  elseif event.type == "applicationResume" then
  
     print("Resume")
     audio.resume(backgroundMusicChannel)
 
     --backgroundMusic = audio.loadStream("audio_background.mp3")
     --backgroundMusicChannel = audio.play(backgroundMusic, {channel=2, loops=-1, fadein=1000})

I think this is a Corona bug. I'm looking at our iOS code right now and I think we fire the Lua callback before we resume the Corona engine. This will result in your audio calls becoming no-ops.

As a workaround, you might be able to set a timer event to fire shortly after the callback (though it might not work since Corona is suspended) and then resume your audio.

If you could file a bug and tell us which platforms this is broken on (e.g. iOS, Mac, Windows, Android), it would help us along.

Thanks ewing for the quick response!

I am developing for Android using Windows. I would be glad to file a bug...is there a link for filing bugs...probably a dumb question, but I am new to this.

Thanks,
Paul

Quick update, I tried the "timer" workaround...and assuming I did it correctly....still no luck.

Audio stops on suspend, but does not start again on resume.

Here is my code for reference:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  elseif event.type == "applicationSuspend" then
  
     if backgroundMusicChannel then audio.pause(backgroundMusicChannel) end
     --audio.stop(backgroundMusicChannel)
     --audio.dispose(backgroundMusic)
     --shutdown()
     print("Suspend")
     
  elseif event.type == "applicationResume" then
  
     print("Resume")
     
     hope2 = timer.performWithDelay(3000,function() 
                                               timer.cancel(hope2)
                                               hope2=nil
                                               audio.resume(backgroundMusicChannel)
                                           end)     
     
     --audio.resume(backgroundMusicChannel)
     --backgroundMusic = audio.loadStream("audio_background.mp3")
     --backgroundMusicChannel = audio.play(backgroundMusic, {channel=2, loops=-1, fadein=1000})
     
  else

hi, any news on this "bug"?

khanh.dq
I have not heard anything more about this bug. Hope it if fixed soon...I tried several workarounds, but no luck.

BTW, I saw you rated my game (http://bit.ly/kSX8go) over the weekend. I hope you liked it, but did read your comment about difficulty.

Nearly all reviews have been very positive, but several other people mentioned that as well...I appreciate you taking time to check it out.

Based on that, I released an updated over weekend...and that user feedback item was at the top of the list.

What's in this version:
** Adjusted difficulty levels, based on user feedback
** Performance improvements
** New "free" icon, to distinguish paid from free if both installed
** Increased Color Palette size and buttons, to make play easier on phones
** Fixed bug with game exiting when hitting menu button on scores and help.

Also, do you have any games out...I would check them out if so.

This should be fixed in today's daily build.

>Also, do you have any games out...I would check them out if so.
We are rubycell, a small company from Vietnam.

I have published several games:
https://market.android.com/search?q=rubycell&so=1&c=apps

Btw, I cannot play your game. It should start with esier level (with very basic colors).

@ewing It's OK now. Thank you.

@khanh.dq,

You might want to install the update (1.1), and try it again.

That version has several enhancements, one of which is "Adjusted difficulty levels, based on user feedback".

After making that change, it starts off easier. Feedback has been positive from that change.

Enjoy!

Well, I just did a build with the latest daily build, and the audio problem is fixed...great!

However, when testing on all my devices...any apps compiled with daily build 544 to the current(551)...will not run on honeycomb.

It works perfectly on my phones with those daily builds, but on my tablets (have 2, HC 3.0 and HC 3.1)...when you launch the game...it attempts to load for about 1 second, then goes back to the home screen. You never see anything game related....just black for a second (normal), then back to homescreen.

I do not think it is the actual games, since I tried building several different games, and all the same on honeycomb...and they all play fine on phones. Also, when reverting back to daily build 540, all is good.

I really need the later daily builds though...for this audio fix. Guess I will open a bug ticket.

Anyone else notice the same thing?

Anyone else having issues with any daily build after .540 not running on honeycomb tablets (mentioned above)?

No matter what app I build (mine, demos, etc) after .540....they will install fine on my honeycomb tablet, but when attempting to run...the screen goes black (like it is loading), then just returns to the os.

Anyone else? I have tried all the 540+ daily builds...and same thing.

I can confirm the issue has been fixed!!

views:1793 update:2011/10/7 17:24:19
corona forums © 2003-2011