Beginning API 23, MediaPlayer can set playback speed using this method.
Class MediaPlayer
public void setPlaybackParams (PlaybackParams params)
Added in API
level 23Sets playback rate using PlaybackParams. Parameters params
PlaybackParams: the playback params. Throws IllegalStateException if
the internal player engine has not been initialized.
IllegalArgumentException if params is not supported.
Sample code:
MediaPlayer mp = ...; //Whatever
float speed = 0.75f;
mp.setPlaybackParams(mp.getPlaybackParams().setSpeed(speed));
For API < 23, refer to Vipul Shah’s answer above (or below).