Soundpool not looping in android 4.3

笑着哭i 提交于 2019-12-01 16:38:47

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!