views:

194

answers:

2

Hi i embed a video in my html page and i want to hide div after complete the video. and a specific time.my video time is 12 sec. I am using this function

$('#fvideo').fadeOut(12000);

and html code.

    <div id="fvideo" class="video"> 
flash video
    </div>

UPDATE

actually what i want is that

  • flash video fadeOut time should start after buffering completely.

    or

  • is there any way to fadeout that div( containing flash video) after buffering and running(once) successfully.

+1  A: 

To hide a div when a flash video if finished you need to define a flash var to send a value for that so the js can pick it up.

I dont recommend you to use a 12sec settimeout for this as you never know what happens in people's browser. they might have low speed connection and face extra seconds loading the video. then it would hide before they finish watching.

if you are more of a js guy than action script you might want to consider using plugins like soundmanager 2 where they have flash gateway apis which allows you to open flash videos called from jquery...

those apis already have done this kinda work for you. so they would have call back function for loading the video...something like onFinishPaying : function() {... bla}

you can find it here

and here is the basic video setup sample code

XGreen
yes you right when i use this on server than this have disappear before render video.
kc rajput
use soundmanager mate. its easy and solid. and gives you loads of options to manipulate the dom around you audio and video events only from javascript
XGreen
i updated my question, please see n give me perfect solution. Thank U
kc rajput
As i said before for doing all this you need a way of communicating between flash and java script. you have to either do it manually through defining flahvars with action script so they send out a signals to your js to take actions accordingly. however many of these options are already defined if you use soundmanager. that is your perfect solution
XGreen
i found another nice one for you with loads of video options you can have with jqueryhttp://flowplayer.org/documentation/api/index.htmlread that link and what you want is as easy as for example:flowplayer().setVolume(50).seek(40).onFinish( function(){$(this).fadeOut();});
XGreen
believe me what i am suggesting is the easiest. Looking into catching the event of finished buffer time from action script and passing it into javascript will waste you whole day. and might not even happen with your player.
XGreen
A: 

Use settimeout functionality.

setTimeout( "document.getElementById('fvideo').style.display:none", 1200 );

Check Here

Salil
i updated my question, please see n give me perfect solution. Thank U
kc rajput
-1. #1 Never use astring as the first argument of setTimeout or setInterval. Eval is evil. Crockford is our god. http://javascript.crockford.com/code.html#bonus#2 Why not use jQuery?
Vincent