Very strange problem.
My code already works on iOS, Android and Mac.
With my game now updated to Cocos2d-x 3.9, using the win8.1-universal project (win32 project creates an executable that doesn’t run!!!).
Run my game…music plays
(quit game)
Run my game again…assert!!!
The game will NOT play music until I rename the audio file or rename the folder it’s in (eg. Resources/Audio/music.wav to Resources/WTF/music.wav), obviously I rename the filename/path within the code to reflect this change.
After renaming, it’ll run once, then everytime after…assert!!!
The assert is this one:
long FileUtils::getFileSize(const std::string &filepath)
{
CCASSERT(false, "getFileSize should be override by platform FileUtils");
return 0;
}
Someone else obviously has exactly the same issue here:
Also, I’ve checked that the file (& paths) have been copied across by VS into the “proj.win8.1-universal/Debug/mygame.Windows/AppX/Assets/Resources/” folder.
I also have the same issue! It doens’t work either on Windows 10 or Windows Phone.
If you rename the file and open renamed - it plays ok. If you try to play file after you launch the app for the second time - it fails.
If you stop/start the same music file during one session - it plays ok.
Can anyone help, please?
p.s. I have discovered that if you take background.mp3 from cpp-tests it works fine. It maybe file length or type or something else in mp3.
Shame that it doesn’t work on the actual phone too.
I’ve added a Windows Phone to my Christmas list so I could test my game properly.
Also occurs after I converted my mp3 to a wav.
I now have a negative rating on Stackoverflow because I asked “did you find a solution?”.
Whilst I realise Stackoverflow isn’t a discussion board, I couldn’t see what else I could have done. Creating a new post would’ve just been a duplicate and got me marked down too.
Come on Cocos2d-x guys, can we have this looked into?
I’ve got it working by trimming sound file to 30 sec or less. 31 sec doesn’t work, 29 works. I don’t know the actual reason, but maybe something to do with buffer length?