Accessing dimensions (width/height) from a VideoPlayer source URL

Viewed 5330

I am working on a Unity project that requires me to download a video file (mp4 format) and play it using the VideoPlayer component. Because the file is downloaded at runtime, I effectively have to "stream" it via a url to its downloaded location, as opposed to loading it as a VideoClip.

To accurately size the target RenderTexture and GameObject the video will be playing to, I need the dimensions of the video file itself. Because it is not a VideoClip I cannot use:

VideoClip clip = videoPlayer.clip;
float videoWidth = clip.width;
float videoHeight = clip.height;

Because I am using a source URL as opposed to a VideoClip, this will return null.

Can I get the video dimensions directly from the file somehow?

1 Answers
Related