Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Android / repeat until with timer and playmusic

Author
Message
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 3rd Mar 2012 23:22 Edited at: 3rd Mar 2012 23:24
I created an app I want to publish to the app store...
(for the Acer Iconia)

However it is unstable;
Sometimes it quits by itself and many times it won't restart from the android desktop until after a few trys; after you ran it the first time.

My question is; is there known problems that do this?

I am pausing and resuming the music alot; and I know there is a bug with stopmusic and resuming play with playmusic (so I switched to pause and play);(note: I am not pausing and resuming the music in a repeat/until loop)

But I am also using

sometimes in a loop

I am guessing that these false restarts have something to do with memory problems;
Is timer() or playmusic known to cause these problems???

Tks

Im hoping that the next release will fix these problems?
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 7th Mar 2012 09:40 Edited at: 5th Jul 2012 12:39
I took out the music
seems to be a bit more stable now.
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 25th Apr 2012 05:56
I've been running into problems with music in general on Android.

With just a simple call to PlayMusic ( 1 ) it will play the music and loop it just fine on Windows and also on Android 2.3 ( Google Nexus One and the Samsung Captivate are my test devices ). However, it will play only one loop and stop on Android 4.0+ ( Testing devices are the Motorola Xoom and ASUS Transformer TF101 ).

Reference Android 4.0 I put in a logic check, just to test something.


After the first loop (where it normally stops) it will now freeze the application.

Any insight as to the interface AppGameKit Music methods use on Android? (This is the one drawback of closed source libraries lol)
chrisnob
11
Years of Service
User Offline
Joined: 3rd May 2012
Location: Leeds - UK
Posted: 28th Jun 2012 01:09
Hi Victordavion,

Did you get anywhere with your music problem?

I am experiencing the same issues on Android 4 and it's lead to a bad review in Google Play. :-(

My application includes three MP3 music files and loops them during game play. Every time the user starts a new game I move on to the next track as well.

Everything works fine on Android 2, Android 3 but on Android 4 the application crashes whenever the last track is played.


Thanks,

Chris
--
chrisnob
11
Years of Service
User Offline
Joined: 3rd May 2012
Location: Leeds - UK
Posted: 28th Jun 2012 02:14
I may have a potential work around for the music playing issues on Android 4.

Through lots of hacking around I have found if you call StopMusic() before the current music has stopped playing the freezing stops.

The freezing seems to happen if you let any music play until it finishes. This includes trying to loop music using the PlayMusic().

I am planning to use a timer to stop the music playing before playing the next one.

I hope that helps.
victordavion
12
Years of Service
User Offline
Joined: 3rd Jan 2012
Location:
Posted: 22nd Jul 2012 07:19
Thanks for that! Seems to help. I hope they fix it at some point. Still broken as of v1076.
Auger
12
Years of Service
User Offline
Joined: 21st Aug 2011
Location: Out There
Posted: 9th Aug 2012 08:15
Yep, just ran into this problem myself. Once the song finishes playing it won't loop in 4.0 and my app will freeze. I'll try and stop the music before had see if that helps.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Aug 2012 16:18
I reran some tests after I got my new Android devices (one is 3.2 and the other is 4.1). The PlayMusic with loop definitely hung the 4.1 device.

It is a reported bug (http://code.google.com/p/agk/issues/detail?id=272#makechanges) and has been confirmed as such by the TGC AppGameKit Community Testers (http://www.tgcct.triassicassociates.com/issues.php).

Cheers,
Ancient Lady
AGK Community Tester
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 15th Aug 2012 15:28
Now that I have a 4.1 device to test on I've managed to track down this bug and fix it. The fix will be in the next update.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Aug 2012 16:02
Excellent!

Now we need someone with an iOS 6 device to test reported bugs.

Cheers,
Ancient Lady
AGK Community Tester
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Aug 2012 00:43 Edited at: 31st Aug 2012 00:47
How are we supposed to be officially feeding back on (android) player issues?
Great to see the music loop thing noted for fixing, but anyone had the app switching corruption (edge lines on sprites)

Oh yea, and it forgets the forced landscape instructions and happily (or not so happily) allows itself to be rotated after app switching (3.2.1)

Is it worth me keeping my XOOM on 3.2.1 for compatability?

nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 31st Aug 2012 00:55
There's also some problem with the routine that reloads my level from a file on android 4.x which doesn't happen on 3.2

Has this been reported? I can't get more details because it wasn't my 4.x device.

Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 7th Sep 2012 00:36
I have a samsung galaxy S3 runing 4.1 - and I was having the same problem with the music but mine is selective - the title music loops, however on the phone it hangs the device. Oddly, if you pass the title screen before the music loops, and move onto the next part speech is played using MP3 - and a repeat:until loop waits until the music isn't playing and wasn't having any issues. Investigation needed then.

Now, I'm pretty good with DBPro, and had a very similar problem there, and a similar solution seems to work ok. Play your track, but do not loop it. Do a simple check in your code to see if the music is playing, and if it's not play it again. Now the crucial part - you must sync before and after the play music command (possibly just before actually, didn't test that).

So


would then become



This should fix the problem. I can't say for sure, but in DBPro I remember something about the engine needing a sync (although it also had fastsync) to recognise the music had stopped before it would play another, and I'm assuming that herein lies the android 4. problem for whatever reason. It's easy enough to include an additional sync, or do this check at the end of your code loop after your main sync command.

Anyway, this fix works perfectly for me, so let me know if it works for you guys too.
Santman
12
Years of Service
User Offline
Joined: 15th Sep 2011
Location: Inverness
Posted: 7th Sep 2012 00:44
I just checked, and syncing before the second play command is sufficient. So in essence, the problem is the check to see if the music is playing is occuring in realtime, however the command to play more needs a sync to work so the engine picks this up too.

So, try syncing before the command, or setting a flag to play the music on the next loop of the code if you don't want the extra sync, and see if the problem goes away again.

Login to post a reply

Server time is: 2024-04-25 09:47:13
Your offset time is: 2024-04-25 09:47:13