cocos2d-x v3.12 Android build: Animations and sound are fine when playing audio files.
cocos2d-x v3.13.1 and 3.14 Android build: Animations freeze when trying to play any audio file (very small files), and no sound is played. Sometimes I can hear the start of one of one of the audio files, but then the game freezes and no more sound is played.
It works correctly when compiled for Windows in 3.12, 3.13.1 and 3.14, so it’s a specific issue with the Android code in 3.13.1 and 3.14.
Tested on Nexus 6P with Android 7.1.1.
[EDIT]
I’m seeing strange errors in the log:
01-10 14:49:22.818 15961 15988 V AudioPlayerProvider: FileInfo (0xecd7f9d8), Waitup preload (assets/SpecialSound.ogg) …
01-10 14:49:22.818 15961 15988 E AudioPlayerProvider: FileInfo (0xecd7f9d8), preloadEffect (assets/SpecialSound.ogg) failed
01-10 14:49:22.818 15961 15988 V AudioPlayerProvider: getAudioPlayer, 199 return nullptr
01-10 14:49:22.818 15961 15988 E cocos2d-x debug info: Oops, player is null …
01-10 14:49:26.519 15961 15988 V cocos2d-x debug info: play2d, _audioPlayers.size=0
01-10 14:49:26.520 15961 15988 V AudioPlayerProvider: (assets/SpecialSound.ogg) file size: 4797
01-10 14:49:26.520 15961 15988 V AudioPlayerProvider: audio (assets/SpecialSound.ogg) is being preloaded, add to callback vector!
01-10 14:49:26.520 15961 15988 V AudioPlayerProvider: FileInfo (0xecd7f9d8), Waiting preload (assets/SpecialSound.ogg) to finish …
If anyone has come across this issue before, then please do let me know, because I’m at a loss here why this started happening all of the sudden. This issue only happens on the Android build.
MP3 requires a licensing fee to use (yes I realise it’s for games with distribution over 5000 units, but regardless). For the time being I would prefer to avoid using MP3 format unless absolutely required.
I’ll make a test case first to see if I can reproduce it outside of my game, and then if that happens I’ll create the github issue and upload the OGG audio file along with the log file.
For anyone interested, I’ve found that AAC format files (MP4) work fine with Cocos2d-x 3.14, and they don’t require licensing fees as MP3s do. I’ll be using them for my projects, since the broken OGG support isn’t such a big deal for me personally.
That’s not good. Turns out AAC format doesn’t work on Windows either (at least it’s not working for me). Will have to look into an alternative 3rd party sound engine if the cocos2d-x one doesn’t work as intended.
Yes
I am sure this was the same issue, but this seems to be fixed in version 3.15 since we updated and we don’t have this bug anymore. The log was pretty the same.
This is a part of our log.
05-17 13:55:15.670 9261 9286 V cocos2d-x debug info: play2d, _audioPlayers.size=1
05-17 13:55:15.670 9261 9286 V AudioPlayerProvider: (assets/KR4_Android/Sounds/Fx/Commons/kr4_selection.ogg) file size: 5787
05-17 13:55:15.670 9261 9286 V AudioPlayerProvider: audio (assets/KR4_Android/Sounds/Fx/Commons/kr4_selection.ogg) is being preloaded, add to callback vector!
05-17 13:55:15.670 9261 9286 V AudioPlayerProvider: FileInfo (0xc99df960), Waiting preload (assets/KR4_Android/Sounds/Fx/Commons/kr4_selection.ogg) to finish ...
05-17 13:55:17.670 9261 9286 V AudioPlayerProvider: FileInfo (0xc99df960), Waitup preload (assets/KR4_Android/Sounds/Fx/Commons/kr4_selection.ogg) ...
05-17 13:55:17.670 9261 9286 E AudioPlayerProvider: FileInfo (0xc99df960), preloadEffect (assets/KR4_Android/Sounds/Fx/Commons/kr4_selection.ogg) failed