Stop the video on last frame - android

I am using VideoView to play a video and have some difficulties to stop it and keep the last frame after video finishes playing. Currently I am stuck with black last frame after video ends.
Is there a way to accomplish that? Thank you.

To get the last frame of a video you can skip to its end by using:
video.seekTo(video.getDuration());

Related

Method seekToMillis() does not work properly when video not loading

I'm using Youtube Player API as a player and I'm trying to use seekToMillis method to skip to the end of video. My problem is when video not fully loading and I apply seekToMillis by the number of total video's duration, a seekbar just move to the end of possible loading not the end of the video. For example, if the video is 3 minutes and it has load around 1:50 minutes. So when I apply seekToMillis, a seekbar will move to video at 1:50 minutes not 3. I want it move to the end of video.
How can I solve this problem? or can I just force a player to end the video in other way?
Thank you in advance and sorry for my language.

No video, only sound with VideoView

When I play a video file using a VideoView on Android, I can hear the sound fine, but the video does not show.
So, when I use :
myVideoView.setZOrderOnTop(true);
then the video shows fine, however, then my TextView is behind the VideoView and I need it to be in front.
Therefore, I either need a solution so that the video is played without using setZOrderOnTop, or I need a way to get the text in front of the video while using setZOrderOnTop.
videoView.setBackgroundColor(Color.TRANSPARENT);

Android - VideoView shows thumbnail of previous video

I made a video player based on VideoView widget. The videos are loaded from internet.
Everything works fine, except one little thing.
I open a video, and while it is playing I click the "Next" button to advance to the next video. And the issue is that while the next video is loading, it shows me the thumbnail of previous video.
I would like to not display any thumbnail, or at least the thumbnail of currently loading video, but deffinetly NOT the thumbnail of previous video.
So, is there a method like "flush()", or something like this to clear the videovideo and not show the thumbn. of previous video? Or at least why does it happen?
To get rid off that thumbnail, it was necessary to re-creating the VideoView when clicking Next/Prev buttons. Maybe not one of the best solution, but at least it solved the issue.

Android playing video with the camera surfaceview in background

Hello
i have a surfaceview and a videview in a framlayout. if i start the video in oncreate, i see all perfectly, the video playing while the camera plays in background.
but if i start the video after oncreate, for example in onpreviewframe, i can only hear the video, but it's like behind the camera, and all i see is the camera view.
any help?
You Need to Merge both layouts... see the Example.

Android Show image while video is buffering?

I have an app that displays a video using VideoView. The layout consists of a Clock and a VideoView laid out in a simple vertical LinearLayout.
Here's my code snippet that I use:
VideoView mVideoView = new VideoView(this);
mVideoView.setVideoPath(myVideoURL);
mVideoView.requestFocus();
mVideoView.start();
Since the buffering of the video takes about 8-10 seconds, the layout comes up with the Clock, but the VideoView stays blank. What I want to achieve is this:
-- Display an ImageView for the 10s while the video is buffering
-- Detect when the video is ready to be played (onPrepared?)
-- Show the Clock and VideoView and start the Video
Anyone have pointers on how to go about this?
Thanks
Chris
MediaPlayer will let you register an OnPreparedListener callback which you can use to determine when the video is ready to be started. So you would show your ImageView instead of your VideoView first, then when your callback gets called, change to the VideoView and start playing.

Categories

Resources