I think it's something to do with the end of the music being missed for the repeat - maybe looking for an exact number when it was missed because it may increment fractionally? (that migth explain why its different on some devices - the floating point might operate in a slightly different way?) - Doesn't explain why the completed event always works though.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
No - use the routine I showed you - using the complete event - that works for me.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
@SinisterSoft - Okay if I just use your code as it is and run it, it plays and repeats fine. If I modify it (adding the "self." to everything) and place it into a class, it plays once and then I get the "nil value" error when the Event.COMPLETE event fires.
@antix, in your test code, don't it miss self in third parameter of addEventListener in self.playingMusic:addEventListener(Event.COMPLETE,self.restartMusic,self)
@antix, it depends wether you already figured out or not :P As in C++, first parameter to every (non static) class method is the instance on which to perform the method (aka self (or this in C++)). This is implicit when you call instance:method(), but event handler code won't know... The ':' function call syntax really means 'implicitly add instance as first parameter to the call'. instance:method() is the same as instance.method(instance).
I think it's a problem with the actual media player within Android - that's why it's different per device model/mp3 file. It only affects MP3 files as far as I know.
The solution is use the completed event to get it working again.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Hey guys, I'm back on this chestnut again. It bugs me a little more for every game I release; there is a small gap when looping mp3 files on Android. Any workaround for this, or should I just stop whinging?
Make sure there is no blank sound at the end of the mp3.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!). https://deluxepixel.com
Comments
https://deluxepixel.com
Honestly I know very little on how sounds are handled in Gideros, but I think on Android mp3 files are played via media player:
https://github.com/gideros/gideros/blob/master/android/GiderosAndroidPlayer/src/com/giderosmobile/android/player/GGMediaPlayerManager.java
So need to make sure this is a mp3 specific problem
https://github.com/gideros/gideros/tree/master/libgid/src
Likes: SinisterSoft
In the meantime I suppose I will just convert my MP3 files to WAV files and have a bloated app
https://deluxepixel.com
Likes: SinisterSoft
self.playingMusic:addEventListener(Event.COMPLETE,self.restartMusic,self)
Likes: SinisterSoft, antix
Likes: SinisterSoft
As in C++, first parameter to every (non static) class method is the instance on which to perform the method (aka self (or this in C++)). This is implicit when you call instance:method(), but event handler code won't know...
The ':' function call syntax really means 'implicitly add instance as first parameter to the call'. instance:method() is the same as instance.method(instance).
Likes: antix
Likes: SinisterSoft, antix
'self.playingMusic:addEventListener(Event.COMPLETE,self.restartMusic,self)' thing
The solution is use the completed event to get it working again.
Likes: ChrisF, antix
https://deluxepixel.com
Make sure there is no blank sound at the end of the mp3.
https://deluxepixel.com
Likes: SinisterSoft
Likes: totebo
https://deluxepixel.com