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.
Related
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());
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);
I would like to append several video files from the camera through mp4parser.
Unfortunately, in the same fragment, despite the fact that I try to change the OrientationHint of the media recorder when changing camera, only the first one seems to work (ie. if I start with the front camera, the videos with the back camera are reversed and vice versa).
To solve this problem, I tried to rotate the video that are in the wrong direction and that works (with the method of setMatrix mp4parser, the new files are in good direction). But when I want to append the files, (all in the right direction) I get the same result as if I had not rotated the videos, as if it could have only one orientation videos for my final component video.
Do you have a solution for this?
Thanks
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.
Basically, what I want to do in my application is displaying a video.
The best tool to achieve this goal seem to be a VideoView.
So I used this code:
<VideoView android:id="#+id/videoview" android:layout_width="50dip" android:layout_height="50dip"></VideoView>
and in my Activity:
VideoView videoHolder = (VideoView)findViewById(R.id.videoview);
videoHolder.setMediaController(new MediaController(this));
videoHolder.setVideoURI(Uri.parse("android.resource://com.blabla.blabla/" + R.raw.blabla));
videoHolder.requestFocus();
videoHolder.start();
and that do the trick.
Unfortunately, I was expecting having a preview (thumbnail) of the video in my layout by default
So , I removed the videoHolder.start(); command, but I can only get a blackscreen. The video start when tapping on an invisible zone...
First question
Is that possible to display a preview of the video in the VideoView before starting it?
Second question
I wuld like to display the video on Fullscreen when double tapping the webview, How can I achieve this?
Thank a lot for any help / link / suggestion
Yes, you can get video thumbnails using ThumbnailUtils:
Bitmap thumb = ThumbnailUtils.createVideoThumbnail(path,
MediaStore.Images.Thumbnails.MINI_KIND);
I haven't really seen apps toggle into fullscreen before. I'm actually not sure if it can be done (especially for a VideoView). However, you might have some luck with one of these methods:
Holding the VideoView in a FrameLayout and then changing its layout parameters.
Overlaying the VideoView via Window#addContentView.
Hiding (via Visibility.GONE) your other views and allowing the VideoView to expand its layout area.
You can use VideoView.seekTo(milliseconds) as an alternative, let say 1 second (1000 milliseconds). Provided that the video clip after 1 second does have an image, like some videos starts from blank screen then "fade-in" (lack of better word) to a scene would more often gives you a black screen with 1 second. You can call this under VideoView.onPrepared(). This one i use when the video is on a web server.