Link to home
Start Free TrialLog in
Avatar of sunnymock
sunnymock

asked on

Embedding a video using dimesions of frame

Hi, Im trying to embed a quicktime video with the same dimensions as the frame that it is being displayed in. I've been trying to use a javascript function to return the frame size when called by the embedded video tag. I say that the width = Width() and the Width() function just returns the frame width. I put a button that creates an alert box that shows the dimensions of the frame and it works fine. All the embedded video does is play in something like 100x100. I use firefox
<html>
<head>
 
 
</head>
 
<body>
<script type="text/javascript">
function Height()
{
return document.body.clientHeight;
}
 
function Width()
{
return document.body.clientWidth;
}
</script>
<center>
<form>
<input type="button" onClick="alert(Height() + 'x' + Width());" value="Dimensions">
</form>
</center>
<br>
<br>
<embed src="9-tsr_720p.mov" width="Width()" height="Height()" scale="aspect" controller = "false">
 
</body>
 
</html>

Open in new window

Avatar of v2Media
v2Media
Flag of Australia image

try

<embed src="9-tsr_720p.mov" width="javascript:Width()" height="javascript:Height()" scale="aspect" controller = "false">
Avatar of sunnymock
sunnymock

ASKER

It doesn't work :(. I'm wondering if the embed thing gets called before the frame dimensions don't exist when the embedding takes place. Does it? I just need a way to make the video the same size as the frame. I use the latest firefox.
ASKER CERTIFIED SOLUTION
Avatar of sunnymock
sunnymock

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Even better, I found code online that resizes images according to frame size. It doesn't use the right aspect ratio but once you use the scale = "aspect", the video is the right size.
http://www.vbforums.com/archive/index.php/t-208380.html

<html>
<head>
<script type="text/javascript">
function window_onresize() 
{
myVideo.height = window.document.body.clientHeight
myVideo.width = window.document.body.clientWidth
}
</script>
</head>
 
<body onload="return window_onresize()" onresize="return window_onresize()">
 
<center>
<form>
<embed id="myVideo" src="9-tsr_720p.mov" scale="aspect" controller="false">
</form>
</center>
 
</body>
</html>

Open in new window