views:

30

answers:

1

Hi,

I am working on a webpage where i have to include an embedded video.The video is hosted on some other domain.I am able to embed the video and autoplay once the web page is loaded.However i have a requirement where i have to remove the div displaying the video once it is played , and in place of the video i have to now display some text. The problem is i am able to do autoplay by the autostart variable in the embed tag...but how do i know that the video has ended.The hosting company only provides an embed tag and they donot have any player apis to use. One way (or rather a workaround) that i feel is to start a eventlistener in the background and see for the total time of the video and when that time is reached remove the content.But the problem is what if the user pauses the video, then also the div would be deleted.

I am new to flash.Are there some standard variables or actions that we can pass as flashvars to a swf file to stop a running player or to know the state of the player (Note we are only getting an embed tag from the video hosting site so we donot own that code and they donot have much documenation to help me out with the code).

Thanks for your help.

+1  A: 

If you know that the content is a movie, and thus probably has a linear frame progression, you could use the Flash javascript API. Pseudocode for one possibility:

everyHalfSecond {
    currentFrame = movie.TCurrentFrame("/");
    totalFrames = movie.TotalFrames();
    if (currentFrame + 1 == totalFrames) {
        doMovieComplete() // switch out your div
    }
}

WRT your undefined object variable, that sounds like standard browser Javascript issues. To resolve that, can use your own browser-specific "getSWF" function (see getFlexApp in this blog entry for an example), or you can use something like swfobject.

Michael Brewer-Davis
Thanks for the reply.I tried this, but for the embed object when i do window.document.<objectid or name> i get an 'undefined' value.
Rajat