/    Sign up×
Community /Pin to ProfileBookmark

Run Function at end of QT movie

-Hi

I have quicktimes embeded in my portfolio site, and want a javascript function to be called when the movie finishes.

after an embed tag is placed:

[B]<embed[/B] src=”‘ + urlInfo + ‘” width=”‘ + aspectW + ‘” height=”‘ + aspectH + ‘” bgcolor=”000000″‘ + ‘ href=”<‘ + fname + ‘> T<quicktimeplayer> E<autoplay=True>” [B]name=”moviename” id=”moviename”[/B] cache=”true” targetcache=”true” [B]enablejavascript=”true”[/B] [B]postdomevents=”true”[/B] onClick=”Stop();”‘ + ‘ kioskmode=”true”‘ + ‘ class=”vidplay” autoplay=”true” controller=”true” type=”video/quicktime” scale=”aspect” pluginspage=”http://www.apple.com/quicktime/download/“> </embed>’;

I define a variable, movie, and add an event listener to the quicktime:

[B]movie = document.moviename;
RegisterListener(qt_ended, moviename, moviename, playlistChange);[/B]

the RegisterListener function is written as such:

[B]function RegisterListener(eventName, objID, embedID, listenerFcn) {
alert(‘register listener’);

var obj = document.getElementById(objID);

if ( !obj ) {

obj = document.getElementById(embedID);

}

if ( obj ) {

myAddListener(obj, eventName, listenerFcn, false);

}

}[/B]

and the myAddListener function is as such:
[B]
function myAddListener(obj, evt, handler, captures) {
alert(‘add listener’);

if ( document.addEventListener ) {

obj.addEventListener(evt, handler, captures);

} else {

// IE

obj.attachEvent(‘on’ + evt, handler);

}

}[/B]

using alert() functions, it seems that the RegisterListener function and following myAddListener function are never being called.

I have linked my page to the AC_QuickTime.js file I downloaded from apple.

Any ideas as to what I am doing wrong would be appreciated

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @bbq9000 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...