Get absolute path and filename from VideoView object
Just started writing java / android and I am trying to use android.widget.VideoView.
I set the video by using the setVideoPath('/path/filename') method, but can't seem to figure out how to get the path on an existing object?
I'm using methods such as 'getDuration()', and 'getCurrentPosition()' and they work great.. but where is a getPath method?
Thanks in advance.
Asked by: Carlos905 | Posted: 25-01-2022
Answer 1
I think that is not possible. The idea is, after you call setVideoPath(), the MediaPlayer underneath is in "initialized" state and is no longer interested in the exact path. You should keep this information (what is the exact file you are playing) elsewhere.
Answered by: Walter969 | Posted: 26-02-2022Answer 2
Actually, you can get the path if you override setVideoURI. Check this answer: https://stackoverflow.com/a/12360508/219321
Answered by: Julian901 | Posted: 26-02-2022Similar questions
overlay - Put any View over a VideoView in Android
It is possible to put any view over a VideoView? (I.e. put the control buttons over the video, like in vimeo). I'm trying to do it using FrameLayout, but I have not found the way, and I'm still not sure if what I'm trying to do something that's is simply not possible.
listener - Android VideoView - Detect point of time in video
I am using a VideoView to display a video. I am using setOnPreparedListener and setOnCompletionListener to do stuff before and after the video starts and ends.
I was wondering how I could go about detecting some point of time in the video. For eg, say I want to write log to a file when the video has played for 10s. How can I detect the 10s mark?
Thanks
Chris
Issue with videoview on Android 2.1
i am trying to play a video via streaming in my android application. Video playing functionality works good but whenever changes the orientation of the phone...a white screen comes over the video view and audio keeps playing. And after turning back to original orientation, video starts playing normally..(with proper video and audio.).
Please help.. what should i do??
thanks...
Android VideoView plays 2 videos at the same time
I am trying to play a videoview on top of another video view. The first video view is paused, while the second is playing. It appears to work but no second video appears on the screen (though I hear the audio and see the controls that would normally appear on top). I am assuming this is some sort of order issue. Any thoughts. By the way, I have no problem displaying other views on top of the main video vie...
VideoView problem in 2.1 Emulator of Android?
I am using the code available here VideoView Example. This code runs properly on Android emulator 1.6 but not on 2.1.
In 2.1 it only plays the audio and not video. I have gone through several other threads where this issue has been mentioned. I will like to know whether this problem is...
Android VideoView resume and seekTo
I am playing a Video using a VideoView in my app. On the click of a button, it records the current position of the video, and the app opens up the browser with some url. On pressing the back button, the app comes back to video app and resumes the video from where it left off.
I looked at the Android Activity lifecycle and saw that onStart() method gets called once the video activity comes to the foreground. So I am...
android - 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, only the images will display. No matter what I try I get various errors when trying to load and display the media stored under the applicationcontext.getFilesDir().
Is the...
Android VideoView save RTSP stream
I'm playing on my Android Nexus One some videos of a few cisco cameras using a VideoView. While this works fine, I'm unsure if it's possible to save the movie to a file.
I'm opening an URL like rtsp://192.168.1.22:554/live.sdp
How can I save it to the SDcard ? Handle it like a file maybe ... Is that possible ?
android - Show a TextView in front of a VideoView?
Is there a way to show a TextView in front of a VideoView?
Playing a video in VideoView in Android
I can't figure out why I'm not able to play the video in my VideoView. All I'm getting for a message is:
Cannot Play Video : Sorry, this video cannot be played.
I created an SD card for my emulator as well. Do I need to place my SD card in a particular folder in my SDK? Please comment.
Here's the layout:
<?xml version="1.0" encoding="utf-8"?>
<...
Still can't find your answer? Check out these communities...
Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android