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> Code (markup): 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); Code (markup): 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
Nothing in your code contains that information, if it did you could put an id on that param and use getAttribute('height').
nothing in my code contains that information because I don't know that information before hand.the video is from a source that gives a different video size every time.
.offsetWidth is not an object of .style use this instead.. alert(document.getElementById('showDis').offsetWidth); Code (markup):