Getting a video object's width and height

I have embeded a video like this:

<div class="videoDiv" id="showDis">
<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" id="MediaPlayer1">
	<param name="url" value="http://mysite/myvideo.wmv"">
	<param name="src" value="http://mysite/myvideo.wmv"">
	<param name="showcontrols" value="true">
	<param name="autostart" value="true">  <!--[if !IE]>-->
	<object type="video/x-ms-wmv" data="http://mysite/myvideo.wmv"">
		<param name="src" value="http://mysite/myvideo.wmv"">
		<param name="autostart" value="true">
		<param name="controller" value="true">
	</object>  <!--<![endif]-->
</object>
</div>

I would like to retrieve the video’s width and height (resolution), for example: 640x480

how can I do that via JavaScript?

this is what I tried:


var objPlayer = document.MediaPlayer1;

alert(objPlayer.offsetWidth);
alert(objPlayer.width);


alert(document.getElementById('showDis').style.width);
alert(document.getElementById('showDis').style.offsetWidth);

nothing gives me the real value.

even looked here: http://msdn.microsoft.com/en-us/library/dd563945(v=VS.85).aspx but couldn’t find anything relevant

isn’t there anybody that can try to answer this?

Is there anything that prevents you from knowing the width/height of the video beforehand?

I’m sure you could use something like PHP-MP4info or [URL=“http://getid3.sourceforge.net/”]getID3 to find the width/height on the server side if required.

Additionally, if you’re always expecting videos to be in a particular aspect ratio (e.g. 16:9) then you could simply specify a width/height that matches that aspect ratio and the browser should resize everything accordingly.

the videos are not hosted on my server and I have no way to know the width/height before hand.
and no, i don’t access to server side so I can’t use PHP or Perl
because of the above this is such a big problem and I can only rely on JavaScript+html+css