Sorry guys, I am back to the troublesome cordova media plugin again! Now I got a new problem of playing multiple sounds using the media plugin in intel xdk. I have a background music loop playing in the app. I also have another sound of some kind for object moving in the app. However, the two sounds interfere with each other when they are playing at the same time. I mean the sound for object moving played initially when the background music was loop playing at the same time, but it then stopped after a while and no more play while the background music is still on. It seems it is a bug in cordova media plugin. Is there any walkaround to overcome the problem? I googled a lot and only got a negative response from the internet. Thanks a lot for any help.
Try following this link. I think it has chunks of code for game where multiple music and sounds are played. So this should be helpful.
or see if you can us ethis web audio library
You want them to play at the same time and now they don't?
A few things to consider:
- According to their documentation, Android and iOS allow two sounds being played simultaneously. Windows and Blackberry (a few devices) do not.
- Make sure you are not using the same media object for the second sound
- It could be a device issue. Do try it on another device to confirm.
- A popular alternative to Cordova media plugin esp when targeting concurrency is: https://github.com/floatinghotpot/cordova-plugin-nativeaudio
Hi, after several hours research and testing, I found cordorva-plugin-nativeaudio from floatinghotpot can meet my requirement. It enables low latency and polyphony. I switched to this wonderful plugin and it is working perfectly on my android phone. Thanks a lot to all for helps.