Re: Autoclose Fancybox after video playing

773 views
Skip to first unread message

RavanH

unread,
Feb 24, 2011, 7:55:28 PM2/24/11
to fancybox
I've tried searching for such a solution but nothing simple came up...
unless you know the exact play time of the video (and disallow users
to pauze or ff/fw) because then you could add a jQuery timeout routine
to close fancybox...

But what you (and I) are looking for is a signal coming from that
video that it has reached the end... Tricky.


On 24 feb, 15:08, Luciendub <lucien...@gmail.com> wrote:
> Hello, How could the fancybox auto close after my video ends (After it
> finishes)
> I'm just beggining with script so it's a bit tricky for me
> Thank you
> Lucien

RavanH

unread,
Feb 25, 2011, 9:47:59 PM2/25/11
to fancybox
Ah, yes... there IS a whole lot possible ( see for example
http://www.permadi.com/tutorial/flashjscommand/ ) but only if that
flash movie is programmed to send/recieve/communicate with javascript.
I mean, if you are the creator of that flash movie controller, you
will know what variables are available and even if flash does not
actively sends a signal at the end, you could do some javascript
polling for that particular variable that will tell you if the movie
is still playing or not...

Do you have that knowledge? If so, then the javascript to detect the
end of the movie and close FancyBox is not too difficult anymore...

I have tried to make the suggestion from
http://stackoverflow.com/questions/1755181/detecting-end-of-flash-movie-in-javascript
but could not make it happen for a Youtube movie. I guess you will
need to fall back on the Youtube API for it. This looks like a
promessing hook: http://code.google.com/intl/nl-NL/apis/youtube/js_api_reference.html#Adding_event_listener

But basically, HOW to interact all depends on WHICH kind of flash
movie is playing in FancyBox... ( I'm not shouting here, just
stressing the point :) )


On 25 feb, 04:14, Luciendub <lucien...@gmail.com> wrote:
> Yes but I don't know if such signal is possible. In fact I know it's
> possible because I already saw that.
>
> On 24 fév, 19:55, RavanH <ravanha...@gmail.com> wrote:> I've tried searching for such a solution but nothing simple came up...

JFK

unread,
Feb 26, 2011, 11:06:10 PM2/26/11
to fancybox
it just depends on what kind of video and the API for each player
for instance, I have done it with vimeo, which provides you with an
(js) event listener to detect the end of the video
JWplayer, youtube, etc should provide a similar feature

as a hint, the best way to do it is calling the video with fancybox
via iframe

On Feb 26, 5:01 am, Luciendub <lucien...@gmail.com> wrote:
> Hum I see. I'm using VideoJs player with .mov files. Not swf files. So
> I Think it's harder.
>
> On Feb 25, 9:47 pm, RavanH <ravanha...@gmail.com> wrote:
>
> > Ah, yes... there IS a whole lot possible ( see for examplehttp://www.permadi.com/tutorial/flashjscommand/) but only if that
> > flash movie is programmed to send/recieve/communicate with javascript.
> > I mean, if you are the creator of that flash movie controller, you
> > will know what variables are available and even if flash does not
> > actively sends a signal at the end, you could do some javascript
> > polling for that particular variable that will tell you if the movie
> > is still playing or not...
>
> > Do you have that knowledge? If so, then the javascript to detect the
> > end of the movie and close FancyBox is not too difficult anymore...
>
> > I have tried to make the suggestion fromhttp://stackoverflow.com/questions/1755181/detecting-end-of-flash-mov...
> > but could not make it happen for a Youtube movie. I guess you will
> > need to fall back on the Youtube API for it. This looks like a
> > promessing hook:http://code.google.com/intl/nl-NL/apis/youtube/js_api_reference.html#...

RavanH

unread,
Feb 27, 2011, 7:56:44 AM2/27/11
to fancybox
I'm not sure... It might make it easier :)

Ask on the VideoJS forums about the possiblities ( I understand there
is some API ) to detect the end of a movie. If we have that, we should
then be able to make FancyBox respond to any video state change...


On 26 feb, 14:01, Luciendub <lucien...@gmail.com> wrote:
> Hum I see. I'm using VideoJs player with .mov files. Not swf files. So
> I Think it's harder.
>
> On Feb 25, 9:47 pm, RavanH <ravanha...@gmail.com> wrote:> Ah, yes... there IS a whole lot possible ( see for examplehttp://www.permadi.com/tutorial/flashjscommand/) but only if that
> > flash movie is programmed to send/recieve/communicate with javascript.
> > I mean, if you are the creator of that flash movie controller, you
> > will know what variables are available and even if flash does not
> > actively sends a signal at the end, you could do some javascript
> > polling for that particular variable that will tell you if the movie
> > is still playing or not...
>
> > Do you have that knowledge? If so, then the javascript to detect the
> > end of the movie and close FancyBox is not too difficult anymore...
>
> > I have tried to make the suggestion fromhttp://stackoverflow.com/questions/1755181/detecting-end-of-flash-mov...
> > but could not make it happen for a Youtube movie. I guess you will
> > need to fall back on the Youtube API for it. This looks like a
> > promessing hook:http://code.google.com/intl/nl-NL/apis/youtube/js_api_reference.html#...
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages