How to trigger an AC2 event using FLV instance timecode.

James_Avery
James_Avery used Ask the Experts™
on
I have a flash doc with some instances of FLVs. These FLVs are already encoded and do not contain cue point info.

I need to be able to trigger an AC2 function like: ' this.gotoAndPlay(2); ' when it gets to a certain point on the timecode in my flv instance.

For example, when it get to 15 seconds into my video, run ' instanceName.gotoAndPlay(2); '.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You can do something like:
var tmr=setInterval(checkTime,100);
myVideoPlayer.playheadUpdateInterval=100;
function checkTime()
{
  if (int(myVideoPlayer.playheadTime)==5)
  {
    doMyFunc();
    clearInterval(checkTime);
  }
}

Author

Commented:
Thank you so much.. so lets say I want doMyFunc(); to run at 0:15 in the video.  How would I code that? It appears as if your code is based off of a 1-100 range, but my videos are all different lengths.
I actually have it set to check the time ever 100 milliseconds, since you cant do a straight time because of buffering/lag etc.  Just change this line:
if (int(myVideoPlayer.playheadTime)==5)

to
if (int(myVideoPlayer.playheadTime)==15)
and it will trigger the function , also change clearInterval(checkTime); to clearInterval(tmr);  I messed that one up, kind of tired :)

 

Author

Commented:
How about if I have multiple cuepoints I need on 1 flv clip?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial