Questions tagged [android-videoview]

An Android View to manage and display a video file.

The VideoView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the video so that it can be used in any layout manager, and provides various display options such as scaling and tinting.

Methods of this class

void setVideoPath(String pth): This method will set the absolute path of the video file which is going to be play.

void setMediaController(MediaController cntlor): This method is used to set the controller for the controls of playback .

void start(): This method is used to start the playback of video file.

void pause(): This method is used to pause the current playback.

boolean canPause(): This method will tell whether video view is able to pause.

boolean canSeekForward(): This method will return true value if video view is able to seek forward.

int getDuration(): This method is used to get the total duration of video view.

boolean isPlaying(): This method will return true value if the current video view is in play state.

void resume(): This method is used to play the resumed file.

2566 questions
39
votes
17 answers

Get Real Path For Uri Android

I am developing a VideoPlayer. I convert the URI of a launched intent to a string and it gives me content://media/external...... But I need to get the real path. For example: /storage/extSdcard..... How do I do this? Here is my code if…
Timmo
  • 2,266
  • 4
  • 34
  • 54
38
votes
13 answers

VideoView to match parent height and keep aspect ratio

I have a VideoView which is set up like this:
Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
37
votes
6 answers

Android: how to play video from assets?

I am making an application in which I have to show video from assets folder in a Fragment. Can anyone help me do this? Do I need to use VideoView in XML?
user1025050
36
votes
7 answers

How to play Youtube videos in Android Video View?

I am developing an android application which requires a youtube video player embedded within it. I successfully got the RTSP video URL from the API, but while trying to load this rtsp url in my android video view, it says "Can't play this video.".…
Midhu
  • 1,647
  • 2
  • 18
  • 29
32
votes
8 answers

Full screen videoview without stretching the video

I wonder if I can get a way to let video run via videoview in full screen? I searched a lot and tried many ways such as: Apply theme in manifest: android:theme="@android:style/Theme.NoTitleBar.Fullscreen" but that does not force the video to be in…
Android Stack
  • 4,314
  • 6
  • 31
  • 49
31
votes
10 answers

VideoView onResume loses buffered portion of the video

I am having an Activity in which there is VideoView -- Streams a video from a webserver. Button -- Takes the user to the next activity to be shown. When the application starts, VideoView is made to play the Video from a webserver. Now…
31
votes
3 answers

VideoView getCurrentPosition() irregularity on Acer Iconia A200

I have an application with a VideoView in it, I set a video to play in the VideoView. At some point while the video is playing it will get paused. Then after it is paused for some time it will begin to play the video again, but seek forward to the…
FoamyGuy
  • 46,603
  • 18
  • 125
  • 156
31
votes
2 answers

Android TextureView vs VideoView Performance

I need to be able to rotate a video on screen, so I created a custom TextureView which provides a convenience layer over a MediaPlayer similar to how the current implementation of VideoView does. This Android blog post says the following about…
Alex Ross
  • 3,729
  • 3
  • 26
  • 26
30
votes
2 answers

How to hide the controls in the VideoView in Android?

I am using VideoView for playing video in my app but I would like to hide the controls in it. How can I do that? Thanks.
Karthik
  • 4,943
  • 19
  • 53
  • 86
30
votes
7 answers

Does Android support scaling Video?

Using a VideoView is it possible to set a scale factor for Android? By Default the video view resizes itself to fit the encoded resolution of the Video. Can I force Android to render a video into a smaller or larger rect?
haseman
  • 11,213
  • 8
  • 41
  • 38
29
votes
5 answers

Center Crop an Android VideoView

I am looking for something like the CENTER_CROP in ImageView.ScaleType Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension…
clocksmith
  • 6,226
  • 3
  • 32
  • 45
28
votes
7 answers

How to determine video width and height on Android

I have a video file and I want to get width and height of video. I don't want to play it, just to get size. I've tried to use MediaPlayer: MediaPlayer mp = new MediaPlayer(); mp.setDataSource(uriString); mp.prepare(); int width =…
mao
  • 1,364
  • 3
  • 14
  • 26
28
votes
4 answers

VideoView onPrepared is not called if the VideoView is invisible

I am hiding the VideoView initially and when the video is loaded I am showing the VideoView. But onPrepared is never called if the VideoView is invisible initially. However onPrepared is called properly if VideoView is visible. Is there any way to…
Abhishek V
  • 12,488
  • 6
  • 51
  • 63
28
votes
8 answers

Streaming Youtube Videos

I am writing an application to play youtube videos using streaming. First method: I am getting the RTSP URL to the video using GData APIs. Here is the code to play the RTSP url. VideoView mVideoView = new VideoView(this); …
Vinay
  • 4,743
  • 7
  • 33
  • 43
27
votes
6 answers

Play video from url in VideoView [Android]

I found a similar questions but nothing work for me. I try play video from this url: http://videocdn.bodybuilding.com/video/mp4/62000/62792m.mp4 My java code: VideoView videoView= (VideoView)findViewById(R.id.exerciseVideo); Uri uri =…
Aligator
  • 737
  • 2
  • 10
  • 23