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

sunnymockAsked:
Who is Participating?
 
sunnymockAuthor Commented:
After much struggling, a friend took a couple minutes after looking at it and solved it.
<html>
<head>
<script type="text/javascript">
function Height()
{
return document.body.clientHeight;
}
 
function Width()
{
return document.body.clientWidth;
}
function AspectRatio(height, width)
{
	return height/width;
}
</script>
</head>
<body>
<center>
<form>
<script>
var h=Height();
var w=Width();
document.write('<embed src=\"9-tsr_720p.mov\" width=' + w + ' height=' + h + ' scale=\"aspect\" controller=\"false\">');
</script>
</form>
</center>
</body>
</html>

Open in new window

0
 
v2MediaCommented:
try

<embed src="9-tsr_720p.mov" width="javascript:Width()" height="javascript:Height()" scale="aspect" controller = "false">
0
 
sunnymockAuthor Commented:
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.
0
 
sunnymockAuthor Commented:
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

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.