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 = mp.getVideoWidth();
int height = mp.getVideoHeight();
but it returns 0 for width and height, because VideoSizeChangedEvent didn't fire yet. How can I get width and height of video?
UPD: I need API version 7
try with this code and let me know if any issues..
This set of utilities to work with the Size abstraction in Android.
It contains an class SizeFromVideoFile.java You can use it like this:
This works in API level 10 and up:
try this to query from system content provider. It will return some useful info of the Videos(local files)
API level 7 solution:
This worked for me