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
27
votes
4 answers

VideoView seekto() function extremely inconsistent

I am trying to Seek to a particular location in a video in Android and I am completely stuck because of the inconsistencies it is showing in its behaviour. Here's a list of things I ve done VideoView.Seekto goes to 5:19 for one video, 5:17 for one…
Vrashabh Irde
  • 14,129
  • 6
  • 51
  • 103
26
votes
11 answers

Strange Behavior of Android VideoView - "Can't Play Video"

In my application,showing video from sdcard folder or new taken video from Video intent in a VideoView in different Activity by passing file path of the video selected. Now the problem is, I have tested this app in my 2 devices LG Optimus Black and…
MKJParekh
  • 34,073
  • 11
  • 87
  • 98
25
votes
8 answers

How to play video from raw folder with Android device?

Please help, How to play videos in android device from raw folder for offline mode? Successful example1: I can play the video from SDcard used the below code. Intent intent = new Intent(Intent.ACTION_VIEW); String type = "video/mp4"; Uri uri =…
Potato Hwang
  • 309
  • 1
  • 5
  • 12
25
votes
3 answers

How to keep playing video while changing to landscape mode android

I'm playing video (on VideoView) on portrait mode (not on full screen) and when I change to landscape mode the video stop. When I change it to landscape that video will appear on full screen and will keep playing. Any Suggestion?
gilush14
  • 485
  • 1
  • 9
  • 20
24
votes
2 answers

In galaxy tab , onCompletionListener of videoView is not getting called

For video view in Android, I have added some media player listener such as onPreparedListener, onCompletionListener etc. But when video get completed then onCompletionListener is not getting called. Also we observe that something…
23
votes
2 answers

Android MediaPlayer/VideoView error (1, -2147483648)

I've been having an inconsistent experience with setting a VideoView's video from a file path. VideoView myVideoView = findViewById(R.id.videoView); ... myVideoView.setVideoPath(videoFilename); ... myVideoView.start(); videoFilename is the absolute…
spitzanator
  • 1,877
  • 4
  • 19
  • 29
22
votes
2 answers

Resume playing VideoView from onResume

I have a VideoView and it is pause when I start an Email intent. When the email intent is done, I want the videoView to continue playing, however, it restarts from the beginning. @Override public void onPause() { Log.d(TAG, "onPause called"); …
heero
  • 1,941
  • 5
  • 23
  • 33
22
votes
4 answers

Android VideoView Proportional Scaling

In Android's VideoView, is there any way to achieve the same effect as ImageView.ScaleType.CENTER_CROP? That is, I want my VideoView to play the video such that it fills the entire screen without distortion. If the video aspect ratio does not…
Gus
  • 2,531
  • 4
  • 22
  • 28
21
votes
5 answers

Android VideoView: Video view is much darker in a dialog view

Hi all I have a problem with embedding a video view inside a dialog view everything works fine except that the video displayed in the Dialog is much darker that if displayed in the rest of the activity any ideas ? here is some code…
Jason Rogers
  • 19,194
  • 27
  • 79
  • 112
21
votes
14 answers

VideoView black flash before and after playing

I have a VideoView which I want to use to play a movieclip. I use it like this to play it and it works. VideoView vv = new…
vincentkriek
  • 322
  • 1
  • 2
  • 8
21
votes
13 answers

Video is not showing on VideoView but I can hear its sound

On my button click I wrote the following code for playing video from my SDCARD (mp4). video_view = (VideoView)findViewById(R.id.video_view); video_view.setVideoPath("/sdcard/myvideo.mp4"); video_view.setMediaController(new…
Dhruvil Patel
  • 2,910
  • 2
  • 22
  • 39
21
votes
1 answer

Get the mediaPlayer of the videoView in Android

Is it possible to get a reference to the mediaPlayer instance that the videoView is using, preferably right inside its ctor? If so, how? Since the videoView doesn't have as much listeners as the mediaPlayer, I would like to have the ability to reach…
android developer
  • 114,585
  • 152
  • 739
  • 1,270
19
votes
6 answers

Can a videoview play a video stored on internal storage?

I'm trying to provide my users with the ability to use either external or internal storage. I'm displaying both images and videos (of a scientific nature). When storing the media on the SD card, all is fine. But when I store the media internally,…
shellman
  • 193
  • 1
  • 1
  • 6
19
votes
2 answers

Why VideoView in android is taking too much time to load and play the video from http link?

Below is my Code : package com.example.videoplayer; import android.app.Activity; import android.app.ProgressDialog; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.Menu; import…
Praksha
  • 265
  • 1
  • 3
  • 10
19
votes
3 answers

Stretch to fill VideoView, aspect ratio of VideoView

I try to stretch video in aim to fill videoview. The target is to create view that in device look like the first pic (like it look in layout preview). Most of the answers to this questions refer to this link. I tried this but I still didn't fill…
idan
  • 1,508
  • 5
  • 29
  • 60