Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VideoView/MediaPlayer stop on last frame

Tags:

android

video

is it possible to stop a video on its last frame? I am using the code below:

VideoView video = (VideoView) findViewById(R.id.menu_video);

final String uriPath = "android.resource://com.my.project/raw/myvideo"

Uri uri = Uri.parse(uriPath);
video.setVideoURI(uri);

I've tried to load the video from the sd card, to pause it in a completion listener and to find out something in the web... Now I am thinking about hiding it and using an ImageView as "fake" last Frame. Does anyone know a better solution?

like image 551
Chris Avatar asked Nov 14 '22 11:11

Chris


1 Answers

To get the last frame of a video you can skip to its end by using:

video.seekTo(video.getDuration());
like image 126
Chris Avatar answered Nov 16 '22 02:11

Chris