Sync main Flash timeline with cue points in Flash video

I have a Flash video with a cue point at the beginning (vidStart) and a cue point at the end (vidEnd). The main timeline starts with a static graphic over the video; when the user clicks Play, a listener object hears "vidStart" and moves to frame 2 of the main timeline, where the graphic no longer covers the video.

At the end of the video, the listener object hears "vidEnd" and advances to frame 3 of the main timeline, where there is another static graphic and some buttons. So far so good.

THE PROBLEM --- I need to use a Flash Video Playback component that includes the SEEK function, but using seek causes Flash to lose track of where the video is and what graphic should be displayed. I need to be able to track where the playhead is, or at least whether the video is playing or not, so Flash knows what graphics should be shown at the point to which the user seeked. sought. whatever. :)  Any ideas?
LVL 4
slovisaAsked:
Who is Participating?
 
blue-genieCommented:
ok if i run your file - i see th graphic, and click play, but there's no play btn. when i look at the file is see there's playback component. but for some reason that isn't showing.

ok, first of all you have the onEnterframe checking the playhead time then going to frame 2, that's duplicating efforts for vidstart cuepoint is it not?

then you have the listener code duplicated in all the frames -  not necessary.

then. you said >> I need to use a Flash Video Playback component that includes the SEEK function,

just to make sure we're on the same page, are you referring to the scrubbing or seeking?
am

then in terms of just checking whether the video is playing ....

var stateObject:Object = new Object();
stateObject.stateChange = function(eventObject:Object):Void {
      if (!myVideo.playing) {
            trace(myVideo.playheadTime);
      }
};
myVideo.addEventListener("stateChange", stateObject);

this says if the video is not playing tell me where the playhead is then you can redirect to frames accodingly.

blu.
0
 
blue-genieCommented:
my_FLVPlybk.playheadTime - should tell you where the playhead is.

FLVPlayback.playing will tell you if its playing or not.
0
 
slovisaAuthor Commented:
So each frame could use an onEnterFrame command to evaluate the playheadTime and move the main timeline as necessary - is that the most efficient way to do it?

E.G.
onEnterFrame = function() {
      if (myVideo.playheadTime < myVideo.totalTime){
      _root.gotoAndStop(2);
      }
};

If you have multiple captions for one video, I assume you could also create a "if playheadTime is > thisTime but < thisTime, gotoAndStop(#)?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
blue-genieCommented:
i'm not understanding why you'd need an onEnter frame - using listeners are more efficient.
you've got different movies in different flvplayback instances right?
0
 
slovisaAuthor Commented:
Me either. :) But then, listeners are relatively new territory for me.

For some reason, only the keyframe commands have been working with the listener. The playheadTime commands work in an onEnterFrame, but not in the listener. (Can one listener listen for both? Doesn't seem to work even if I separate them. Here are the two methods I'm attempting...maybe you can see where I've gone wrong.


var listenerObject:Object = new Object();
listenerObject.playheadTime = function(eventObject:Object):Void {
	if (myVideo.playheadTime > 0.5){
	_root.gotoAndStop(2);
	}
    if (myVideo.playheadTime == myVideo.totalTime){
	_root.gotoAndStop(3);
	}
};
myVideo.addEventListener("playheadTime", listenerObject);
 
//AND/OR***(keyframes work during normal play, but NOT if user SEEKS)***
 
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
	if ( eventObject.info.name == "vidStart"){
        _root.gotoAndStop(2);
	}
    if ( eventObject.info.name == "vidEnd"){
        _root.gotoAndStop(3);
	}
};
myVideo.addEventListener("cuePoint", listenerObject);

Open in new window

0
 
blue-genieCommented:
can u upload your fla (put a .txt extension after the .fla)
 i'll use my own videos.

my brain works better when i can see the thing.
0
 
slovisaAuthor Commented:
Sure thing. Thanks for your help!
video-sync.fla.zip
0
 
slovisaAuthor Commented:
So far, onEnterFrame is the only way I've gotten it to work, but the points are still available if there's a more efficient solution out there?
0
 
slovisaAuthor Commented:
Hi Blue. I guess I'm not following you - or at least not able to execute the listener correctly. If I use your code above and then create conditional statements based on the video's timeline, it still doesn't behave correctly. Or to be more accurate, it SOMETIMES behaves correctly, which is maddening, since it seems like black & white math...

I do mean scrub, rather than seek to a point: The user can scrub the video any time - if it's not at the end, I need to be in one frame; if it IS at the end, I need to go to the next frame, where there's text and a button overlaying the player.
0
 
blue-genieCommented:
did you come right or are you just giving up now?
0
 
slovisaAuthor Commented:
Just giving up. I'm sure you're pointing to the right answer, but I haven't been able to get it to work properly.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.