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
104
votes
8 answers

Seamless video Loop with VideoView

I have the following code to take a video as a raw resource, start the video and loop it but I need the video to loop seamlessly as of now when it comes to an end of the clip and starts the clip again the transition between causes a flicker for a…
SamRowley
  • 3,435
  • 7
  • 48
  • 77
98
votes
4 answers

What is the difference between MediaPlayer and VideoView in Android

I was wondering if there's a difference between them when it comes to streaming videos. I know VideoView can be used for streaming and what is Mediaplayer for? As far as I know, MediaPlayer can do the same thing as VideoView right? Can anyone give…
oattie
  • 1,021
  • 2
  • 8
  • 5
91
votes
13 answers

Android MediaPlayer error (1, -2147483648)

I have two different videos which I'm trying to load into a VideoView using videoView.setVideoURI(Uri.parse(url)); The two videos, let them be video 1 and video 2, have the following specs (extracted using ffmpeg -i); in fact, they are two…
Ayberk Özgür
  • 4,986
  • 4
  • 38
  • 58
74
votes
12 answers

How to set the preview image in videoview before playing

I created an VideoView in my activity, below is the code. VideoView vvVideos = (VideoView) rootView.findViewById(R.id.videoView); MediaController mediacontroller = new MediaController(ctx); mediacontroller.setAnchorView(vvVideos); Uri video =…
Vignesh
  • 2,295
  • 7
  • 33
  • 41
72
votes
25 answers

Android VideoView black screen

I have been looking for a way to get rid of the nasty black initial screen on a VideoView before the start() method is run. I have tried with background image on the widget but it doesn't work as expected at all. I have also tried putting an image…
SergioM
  • 1,595
  • 1
  • 15
  • 27
64
votes
11 answers

Android: Why can't I give an onClickListener to a VideoView?

I have written these lines of code: mVideoView = (VideoView) findViewById(R.id.video_view); mVideoView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Log.v("LOG_TAG, click"); …
Fabian
  • 973
  • 1
  • 11
  • 14
59
votes
5 answers

Position Video Inside a VideoView

So I have extended VideoView's onMeasure to scale up the video to fit inside a fullscreen view. here is how: public void setVideoAspect(int w,int h){ wVideo=w; hVideo=h; onMeasure(w, h); } @Override protected void onMeasure (int…
DArkO
  • 15,880
  • 12
  • 60
  • 88
50
votes
11 answers

Android VideoView orientation change with buffered video

I'm trying to replicate the functionality of the latest YouTube app in the Android marketplace. When watching a video there's two separate layouts, one in portrait which provides additional info, and one in landscape which provides a full screen…
Mark G.
  • 3,176
  • 1
  • 27
  • 29
49
votes
7 answers

Videoview Pausing and resuming

I am new to android development and I am programming a game. My game has cutsceens that play before each level starts, cutsceens which are done through videoview. My problem is, that upon an application pause, the cutsceen starts from the beginning…
Athos
  • 681
  • 2
  • 7
  • 14
45
votes
6 answers

How to play .mp4 video in videoview in android?

I am working on a video player application, I want to play .mp4 video in the native video view. I am not able to play video using a URL. I am getting the error "Sorry this video cannot be played" and I am also not able to play downloaded video in…
Hiren Patel
  • 52,124
  • 21
  • 173
  • 151
44
votes
8 answers

Is it possible to place one view over another in android?

Can we place a small view over another large view? For example, I have a VideoView which is playing a file in the background. Over this, somewhere in the middle/corner, I want to place another ImageView. But in Linear/Relative Layout, views can be…
kiki
  • 13,627
  • 17
  • 49
  • 62
43
votes
4 answers

How to catch "Sorry, This video cannot be played" error on VideoView

I have a VideoView and I am streaming videos from a remote server. Most of the times It would play the videos very smoothly. But sometimes, it displays an error message "Sorry, This video cannot be played". I have a hunch that this is more on the…
emmandroid
  • 821
  • 1
  • 9
  • 19
43
votes
9 answers

how to play video from url

I am beginner in android development and try to play video from link. But it's giving error "sorry,we can't play this video". I tried so many links but for all links its show same error. My code is the following public class VideoDemo extends…
priyanka
  • 431
  • 1
  • 4
  • 3
42
votes
3 answers

Using VideoView for streaming or progressive-download video

I'm confused about how VideoView can be used to play video: from a local file, as progressive download and streaming. This example work for me (on 1.5 and 2.0 at least) by downloading the file and playing it locally. But is it necessary to download…
Sam Dutton
  • 14,775
  • 6
  • 54
  • 64
40
votes
2 answers

Android: Video View: how to play a video on a loop

I got a simple dialog box with a VideoView in it and I want to play the video in a loop. I'm currently using a quick fix //Video Loop vv.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void…
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
1
2 3
99 100