Playback Video In Slow Motion In Android
- I am working on a project which needs to play video in slow motion. - I am well aware that Android doesn't provide these functionality. - I found PVPlayer Engine and libVLC whic
Solution 1:
I am late but I found a solution for API 23 and above. Android 6.0 added PlaybackParams class to control playback behavior. -
Use setPlaybackParams
method of MediaPlayer
as given below -
videoview = (VideoView)findViewById(R.id.videoview);
videoview.setVideoURI("Your Video URI");
videoview.setOnPreparedListener(newMediaPlayer.OnPreparedListener() {
@OverridepublicvoidonPrepared(MediaPlayer mp) {
//works only from api 23PlaybackParamsmyPlayBackParams=newPlaybackParams();
myPlayBackParams.setSpeed(0.5f); //here set speed eg. 0.5 for slow 2 for fast mode
mp.setPlaybackParams(myPlayBackParams);
videoview.start();//start your video.
}
});
Solution 2:
If you are searching how to embedded VLC into android, you can ref to this. and you can change the speed by calling setRate(0.5f) to libVLC for slow motion.
Post a Comment for "Playback Video In Slow Motion In Android"