Reputation: 63
I'm using MediaPlayer to play back some videos in an Android application, and they are noticeably faster on my device as when viewed on a computer.
Is there any way to control the playback speed of these videos in order to slow them down?
Upvotes: 6
Views: 7258
Reputation: 1582
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 this SO question.
Upvotes: 9