cocos2d / cocos2d-x

Cocos2d-x is a suite of open-source, cross-platform, game-development tools utilized by millions of developers across the globe. Its core has evolved to serve as the foundation for Cocos Creator 1.x & 2.x.
https://www.cocos.com/en/cocos2d-x
18.28k stars 7.05k forks source link

AudioEngine::play2d always returns a valid ID even if audio format is not supported #17226

Open rh101 opened 7 years ago

rh101 commented 7 years ago

Steps to Reproduce:

When AudioEngine::play2d is called, it always returns a valid ID even if the audio file format is not supported on that platform (such as AAC/M4A format on Windows). If the audio format is not supported, the audio player instance is removed, then the sound finishedCallback is never actually called.

If the game code gets a valid ID from play2d, then it expects the sound finished callback to be triggered, but if the sound was not actually played, then the game will be stuck waiting for an event that will never happen.

If AudioEngine::play2d instead returned AudioEngine::INVALID_AUDIO_ID if an unsupported audio format is used, then that would solve the problem completely.

dumganhar commented 7 years ago

@rh101, thanks for your feedback, I will check this issue. Mark it in the v3.15. :)

rh101 commented 7 years ago

@dumganhar I appreciate that, thank you!

dumganhar commented 7 years ago

@rh101 This issue isn't as easy as it seems to be, mark it in next milestone. I will continue to investigate.

rh101 commented 7 years ago

@dumganhar For me personally this is not an issue any more, since your work on the OGG playback has solved the issue of using OGG files, which seem to work with all platforms, so I'm using that format again. If I'm the only one who has mentioned this specific issue, and no-one else cares about it, then there is no rush at all to get it sorted.