embed video in webpage

Tag: video-streaming Author: powerliang66 Date: 2011-04-12

I am embeding a wmv video in a page. Page contains a video and nothing else. I am using javascript to show an animation while video downloads. But that image appears only for a sec and then disappears. Here is code.

<script type="text/javascript">
function hideanimation()
    document.getElementById('loading').style.display = 'none';

<body bgcolor="#ffffff" style="margin:0px; padding:0px" onLoad="hideanimation()">
<div id="loading" style="z-index:10; position:absolute; width:100%; text-align:center; top:30px;">
    <img src="loading.gif" border="0">
<div align="center" style="z-index:2">
<OBJECT ID="MediaPlayer" WIDTH="320" HEIGHT="240" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="video_female.wmv">
<PARAM name="ShowControls" VALUE="false">
<param name="ShowStatusBar" value="false">
<PARAM name="ShowDisplay" VALUE="false">
<PARAM name="autostart" VALUE="true">
<EMBED TYPE="application/x-mplayer2" SRC="video.wmv" NAME="MediaPlayer"
WIDTH="320" HEIGHT="240" ShowControls="0" ShowStatusBar="0" ShowDisplay="0" autostart="1"> </EMBED>

My questions are:

1- What is best way to show a video to visitors. 2- Is there a free player that i can embed in my page and it will stream video hosted on my server? 3- How can i show animation(in abouve code) while wmv video downloads.

Best Answer

this free flash player solved my problem. I have converted vdo into flv format and used this player on my webpage. Thanks guys for replying. anyone looking for free flash player can try this.


Other Answer1

Answers for 1 and 2 = YOUTUBE/VIMEO and such sites provide the best way to host/stream video. What planet are you from?

Answer 3 Body Onload doesn't fire when you think it does, it fires when the html has loaded. Use JQUERY .ready() function, as this is more effective at dealing with this problem.


Thanks for reply. I said "video hosted on my server". Cant host on youtube or anyother streaming server. are you sure if i use document.ready this problem will solve??
I know you said that your were hosting video on your server. I also just assumed from what you had posted that there was only one video - I just couldn't see a valid reason for going through all that pain for one video in this day and age. You would only be trying to reinvent the wheel. As far as JQUERY goes I can never be 100% sure (the issue might depend on you own client settings or something) but it's just better than Body onload by a long way, and you should just try it anyway. It can't hurt!