Soundpool plays only first 5 secs of file. Why?

前端 未结 5 1600
独厮守ぢ
独厮守ぢ 2020-12-05 14:04

I use Soundpool in my app, so far it works good, but I do have a wav file which is 10 secs. Unfortunately, soundpool plays only the first 5 secs. How to make soundpool to pl

5条回答
  •  一整个雨季
    2020-12-05 14:37

    SoundPool designed to play short sound effects. To play music (big audio files) you need to use MediaPlayer

    // R.raw.audio_file - res/raw/audio_file.mp3
    
    mediaPlayer = MediaPlayer.create(this, R.raw.audio_file);
    mediaPlayer.start();
    

提交回复
热议问题