Playback video in slow motion in android

不羁的心 提交于 2019-11-30 10:02:56

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(new MediaPlayer.OnPreparedListener() {
                @Override
                public void onPrepared(MediaPlayer mp) {
                    //works only from api 23
                    PlaybackParams myPlayBackParams = new PlaybackParams();
                    myPlayBackParams.setSpeed(0.5f); //here set speed eg. 0.5 for slow 2 for fast mode
                    mp.setPlaybackParams(myPlayBackParams);

                    videoview.start();//start your video.
                }
        });
Maruku

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!