Reputation: 199
I want to know how to get the value of video's height, width and duration. If its image i can change the Uri
to bitmap and just use imgUri.Height
but how about the video? I drop the file to the MediaElement and it play automaticaly with this code.
Uri videoUri = new Uri(videofile);
Video_MediaElement.Source = videoUri;
Video_MediaElement.Play();
that code works to shows video in MediaElement but i have no clue at all at getting Height, Width and also the Duration. How can i get that values?
Upvotes: 2
Views: 5482
Reputation: 59
resulation.Text = mediaelement.NaturalVideoWidth.ToString()+"x" +mediaelement.NaturalVideoHeight.ToString() +" px" ;
Its like:
1080x720px
Upvotes: 4
Reputation: 1107
Try following.
mediaElement.NaturalDuration //to get video duration
mediaElement.NaturalVideoHeight //to get video height
mediaElement.NaturalVideoWidth //to get video width
Upvotes: 1