How do I know that the Soundpool is ready using SDK target below 2.2?

后端 未结 2 1800
猫巷女王i
猫巷女王i 2021-01-15 02:44

This question is related to this one.

I managed to modify my code to use SoundPool instead of AudioManager. Know it works more or less.

public class          


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-15 03:13

    From what I have read if you try to play the sound right after initializing it, it won't be ready and you will get this error. You could make a loading page and just wait for a few seconds until you are sure the sound has loaded.

    Also make sure your filesize isn't over 1048576 bytes, thats the limitation for Soundpool. If you want to play background music or something i think you have to use media player.

提交回复
热议问题