B btbb Member Licensed User Longtime User Oct 5, 2012 #1 Hello all! I'm currently working on a app that streams mp4 files. But i need some info about it before loading it. Is it possible to get width and height of a video file (in this case mp4) from a file that is on the web? /btbb
Hello all! I'm currently working on a app that streams mp4 files. But i need some info about it before loading it. Is it possible to get width and height of a video file (in this case mp4) from a file that is on the web? /btbb
B btbb Member Licensed User Longtime User Oct 5, 2012 #2 There seems to be a way, but how do i do this in B4A? ---------------------------->-------------------- MetadataRetriever metaRetriever = new MetadataRetriever(); metaRetriever.setDatasource(/* file descriptor or file path goes here */); String height = metaRetriever.extractMetadata(METADATA_KEY_VIDEO_HEIGHT); String width = metaRetriever.extractMetadata(METADATA_KEY_VIDEO_WIDTH); --------------------------->--------------------- /btbb Upvote 0
There seems to be a way, but how do i do this in B4A? ---------------------------->-------------------- MetadataRetriever metaRetriever = new MetadataRetriever(); metaRetriever.setDatasource(/* file descriptor or file path goes here */); String height = metaRetriever.extractMetadata(METADATA_KEY_VIDEO_HEIGHT); String width = metaRetriever.extractMetadata(METADATA_KEY_VIDEO_WIDTH); --------------------------->--------------------- /btbb
Erel B4X founder Staff member Licensed User Longtime User Oct 7, 2012 #3 There is no such class in Android SDK. Are you streaming the video from your site? Upvote 0
B btbb Member Licensed User Longtime User Oct 7, 2012 #4 No, i'm not streaming from my own site. Then it would have been easy. I see that it is possible to get playing videowidth and videoheight with vitamio but i can't use it in my app. I need to know width and height to be able to center the video image when playing. (on screen) Don't know if it is possible without knowing width and height of videostream. /btbb Upvote 0
No, i'm not streaming from my own site. Then it would have been easy. I see that it is possible to get playing videowidth and videoheight with vitamio but i can't use it in my app. I need to know width and height to be able to center the video image when playing. (on screen) Don't know if it is possible without knowing width and height of videostream. /btbb
JdV Active Member Licensed User Longtime User Jul 24, 2014 #5 Hi Was a solution found for this? Is it possible to read a video file's resolution by using any of the file methods? Regards Joe Upvote 0
Hi Was a solution found for this? Is it possible to read a video file's resolution by using any of the file methods? Regards Joe
JdV Active Member Licensed User Longtime User Jul 25, 2014 #6 Further to my comment above a solution was found in this thread: http://www.b4x.com/android/forum/threads/center-video-with-videoview-solved.40419/ I have written the attached program which allows a user to navigate to a video file and display its height and width in a MsgBox. (Requires the Reflection and Dialogs libraries). More details on the info that can be retrieved using the Android MediaMetadataRetriever class can be found here: http://developer.android.com/refere...adataRetriever.html#METADATA_KEY_VIDEO_HEIGHT The MediaBrowser library by Informatix does much the same thing: http://www.b4x.com/android/forum/threads/lib-mediabrowser.19121/#content Regards Joe Attachments VideoResolution.zip VideoResolution.zip 6.7 KB · Views: 474 Upvote 0
Further to my comment above a solution was found in this thread: http://www.b4x.com/android/forum/threads/center-video-with-videoview-solved.40419/ I have written the attached program which allows a user to navigate to a video file and display its height and width in a MsgBox. (Requires the Reflection and Dialogs libraries). More details on the info that can be retrieved using the Android MediaMetadataRetriever class can be found here: http://developer.android.com/refere...adataRetriever.html#METADATA_KEY_VIDEO_HEIGHT The MediaBrowser library by Informatix does much the same thing: http://www.b4x.com/android/forum/threads/lib-mediabrowser.19121/#content Regards Joe