/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Trigger a function when an embedded video finishes playing

I am working on a page that will play through a list of videos, and I want to be able to trigger a function whenever a video is finished playing.

I am going to be playing both WMV and SWF (Flash) files. When one of the videos is finished playing, I want to be able to automatically start the next one. I know I can use the setTimeout() function to trigger those events(if I know how long each video is), but that will not work for me, because the videos will take longer to load on some peoples connections then others.

Does any one know how to do this, or if it is even possible?

Here is a link to the basic idea of what I am wanting to do:
[url]http://www.xponix.com/dynamic_scheduling/Ad%20Rotator.html[/url]

Thanks,
Erik

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoFeb 12.2007 — well, there are plenty of ways, one of which is using onPlayStateChange() for the embed object.

var s = document.getElementById('myplayer');

s.onplaystatechange = your function();
Copy linkTweet thisAlerts:
@konithomimoFeb 12.2007 — That will not always work, but in most cases it will. It mainly depends on the palyer being used.
Copy linkTweet thisAlerts:
@renderblenderauthorFeb 12.2007 — konithomimo, thank you so much! That works perfectly!
Copy linkTweet thisAlerts:
@konithomimoFeb 12.2007 — no problem.
×

Success!

Help @renderblender spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...