How to loop a sound without gaps in Android?

前端 未结 4 568
既然无缘
既然无缘 2020-12-06 04:46

I want to loop a sound without gaps in android. I tried to use the code mediaplayer.setLooping(true) to loop the sound, but there is always a little pause when

4条回答
  •  再見小時候
    2020-12-06 05:20

    Also worth noting is that gapless playback was added with Jelly Bean (API level 16). It allows you to set a secondary mediaplayer that should be used for playing a next audio stream, as long as the primary player hasn't finished playing the current audio yet. This could potentially be used to create a gapless 'loop' too.

    public void setNextMediaPlayer (MediaPlayer next)

    Obviously this won't be of much help for most of the market (currently < 3% of the devices is running JB), but nevertheless worth mentioning.

提交回复
热议问题