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

How to stop video playing in VideoView programmatically in android?

I am using VideoView for playing video,I would like to stop the playing video completely.Please help me on this for solving it.Thanks.
Karthik
  • 4,943
  • 19
  • 53
  • 86
18
votes
2 answers

Android Media Controller stuck at a position when scrolled in list view?

I have a list of cards using Recycler View of android. I am showing some text and below it video view. The list was scrolling well with playing video smoothly until I enabled controls using setMediaControll(). After enabling this video media…
Prashant
  • 4,474
  • 8
  • 34
  • 82
18
votes
4 answers

Navigation Drawer and VideoView in android

I am using a navigation drawer plus a tablayout. I have a video in my tab which was not visible at first, but I can hear the sound. Once I set video_view.setZOrderOnTop(true); and I can also see the video, but this causes an issue with navigation…
Atula
  • 2,177
  • 2
  • 12
  • 28
18
votes
1 answer

Using VideoView, how to remove "can't play this video" alert message?

Our app plays a set of videos, sometimes we are getting can't play this video alert message. We are either playing video from sd card or streaming if that video is not yet downloaded. Mostly, error arises while streaming with slow internet…
Sreedhu Madhu
  • 2,480
  • 2
  • 30
  • 40
17
votes
3 answers

Android loading animation before VideoView start

I don't find any solution to show a loading animation (or just an imageView) before a VideoView start to play : during the video is buffering. Does anyone have a clue ? Thanks.
magiccyril
  • 657
  • 1
  • 6
  • 14
17
votes
2 answers

java.lang.StringIndexOutOfBoundsException while playing video in videoView : Android v 4.2.1

I am getting this crash when I play video on videoView in Android version 4.2.1. I found this out specifically on Micromax Canvas A210 device. It is not showing any message where the error is occurring. Is this a bug or something wrong in…
user3513843
16
votes
2 answers

Android VideoView how to scale as ImageView scale type fitXY?

I put an ImageView and a VideoView in a RelativeLayout. The ImageView can be scaled to fill the whole layout by scaleType="fitXY". However, there is no similar scale attribute for the VideoView. By the way, I hide the video control by set…
Jones
  • 307
  • 1
  • 4
  • 11
16
votes
1 answer

Mechanism for apps to display their image content in native 4k

As I understand that currently UHD video content is streamed on 4k TV mostly using HEVC codec. I want to understand how can apps which have UHD image content can display their image content in native 4K? What I am exactly looking for is rendering…
Sushil
  • 8,250
  • 3
  • 39
  • 71
16
votes
2 answers

How to show progress bar until video play in live stream Android?

i am working on an application where i need to play video from a remote server as live stream. which is done by me successfully. i managed every thing in my app. but when video is loading i need to show a progress dialog over VideoView. i tried…
user2118554
15
votes
4 answers

Rotating an android VideoView

My application offers only Portrait mode. In a portrait activity I have a fullscreen VideoView. What I want to do is rotate the VideoView ( the actual video, videobuffer) 90 degrees at Landscape mode. Enabling activity to be on Lanscape mode is not…
weakwire
  • 9,284
  • 8
  • 53
  • 78
15
votes
1 answer

VideoView doesn't start when invisible

I have an AsyncTask, where I hide a video view, start the video playback, and show the video view when the video is playing. But the video would just not start when the video view is set to invisible, the async task keeps hanging in onBackground.…
15
votes
6 answers

Detect if a VideoVIew is buffering

Does anyone know if it's possible to detect when a VideoView is buffering? I want to show a ProgressDialog when the video is buffering. So far I tried using a OnPreparedListener, but that only works when the video is first loaded. If a video is…
tonyc
  • 832
  • 2
  • 11
  • 23
15
votes
6 answers

I want to play a video from my assets or raw folder

I want to play a video from my assets or raw folder in my app in Android using VideoView I am getting the error as video cannot be played please anyone give me a solution. Here is the code I used VideoView vd = (VideoView)findViewById(R.id.Video); …
James
  • 13,891
  • 26
  • 68
  • 93
15
votes
5 answers

Disable Android's VideoView requestAudioFocus when playing a video?

I'm building an app that records and plays back video. I would like to do so without affecting background music playback, i.e. if I begin playing a video, I do not want to pause other apps' audio. However, on Lollipop, Android's VideoView class…
diana
  • 151
  • 1
  • 5
15
votes
1 answer

Compress Videos using FFMPEG and JNI

I want to create an android application which can locate a video file (which is more than 300 mb) and compress it to lower size mp4 file. i already tried to do it with this This tutorial is a very effective since you 're compressing a small size…
Mr.G
  • 1,275
  • 1
  • 18
  • 48