Problem on Android devices with looping sounds using the playBackgroundMusic method in Cocos2d-x CocosDenshion

I use the method playBackgroundMusic()to play my music files.
I set the loop parameter to true. I tried the following formats:

  • .wav
  • .ogg
  • .mp3
  • .mp4
  • .m4a

The problem is that the file is looping, but it is not looping on Android devices.
It works fine on iphone anf ipad.

Each time the end of the file ends, a small space appears, and then it plays again.
The gap is about one second, but still noticeable.

I tried 5-6 different sounds, and also changed the formats. No luck!

I also created the Tests project, which comes with the cocos2d-x library, on my Android device and played the CocosDenshion test.
It seems that even this has a seamless loop problem.

Has anyone tried this?
I would really appreciate if any of them came up with their idea. :)

If I use playEffect(), then the audio loops, but I do not want to use playEffect to play music files.

NOTE. - I am using the version cocos2d-x 1.0.1-x-0.11.0.
Which is the last.

+5
source share
1 answer

I am new to stackoverflow. I am using cocos2d-x 3.1 and the following code works fine:

CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("music.ogg", true);

cocos2d-x. ,

+1

All Articles