Forum Xamarin.Forms

How to get width/height dimensions of video selected by Xam.Plugin.Media?

BoscoBosco USUniversity ✭✭

I have a mobile app that uses the Xam.Plugin.Media to select existing photos/videos on a device, or take photos/video with the device. Once I have the image/video file, I need to determine the width/height of the image/video.

I already have working C# code that allows me to get the image dimensions by examining the first 1024 bytes of the image file, so I'm all good for photos.

HOW can I find out the dimensions (resolution) of the video in the video file? Is there another plugin that reads metadata from a video file?

This needs to work on iOS and Android.

Tagged:

Answers

  • Hi @Bosco

    Can you show me your working code to get image dimensions?
    Thanks.

  • BoscoBosco USUniversity ✭✭

    This is based on some code I found on StackOverflow. Hope it works for you.

    This code comes straight from a console application. If you want to use it in a Xamarin PCL project, you need to un-comment a few lines in the constructor, and add the ModernHttpClient NuGet package.

  • BoscoBosco USUniversity ✭✭

    @PassionateCreative This is based on some code I found on StackOverflow. Hope it works for you.

    This code comes straight from a console application. If you want to use it in a Xamarin PCL project, you need to un-comment a few lines in the constructor, and add the ModernHttpClient NuGet package.

Sign In or Register to comment.