Search code examples
androidmedia-playersoundpool

Background music length and speed


For my Android app I would like background music. It doesn't have to go across activities so services do not matter.

Soundpool seems to stop playing the .ogg or .mp3 after about 6 seconds MediaPlayer doesn't have the ability to change the speed (rate) of the music

What I would like to do is to allow the user to change the speed of the background music as it is playing. It would seem like SoundPool can do this but its hard to tell since it only plays for a few seconds.

Any suggestions for how to do this?


Solution

  • SoundPool is bad with wav files, with mp3 I didn't have problems...

        public final int play (int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate) 
    

    float rate - value of 0.5 means playback at half speed, can be 0.5-2.... I think you ought to use SoundPool... As for me, I appreciate Mediaplayer...