问题
I have a couple of apps in which I use soundpool to loop the sound of a ticking clock, this works fine in all previous versions of android but after upgrading to android 4.3 the sound no longer loops but just plays once. I know I can use MediaPlayer to loop it instead but this doesn't sound as good. Is there an easy work around for this, will android fix the bug, or do I have to make do with MediaPlayer.
回答1:
Check this link. https://code.google.com/p/android/issues/detail?id=58113 Soundpool stopped working in 4.3
回答2:
When calling SoundPool.play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate) I set the rate to 0.99f instead of 1, actually anything but 1 appears to work. It loops as expected on android 5.0.1. If rate set to 1 it loops about twice then it stops. I had the same loop problem, however it works on android 4.3 but not 5.0.1 when using rate 1.
来源:https://stackoverflow.com/questions/17971458/soundpool-not-looping-in-android-4-3