?
Solved

Sync main Flash timeline with cue points in Flash video

Posted on 2008-11-13
11
Medium Priority
?
671 Views
Last Modified: 2013-11-11
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?
0
Comment
Question by:slovisa
  • 6
  • 5
11 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22974008
my_FLVPlybk.playheadTime - should tell you where the playhead is.

FLVPlayback.playing will tell you if its playing or not.
0
 
LVL 4

Author Comment

by:slovisa
ID: 22979864
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
 
LVL 39

Expert Comment

by:blue-genie
ID: 22983480
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:slovisa
ID: 22985931
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
 
LVL 39

Expert Comment

by:blue-genie
ID: 22991806
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
 
LVL 4

Author Comment

by:slovisa
ID: 23006713
Sure thing. Thanks for your help!
video-sync.fla.zip
0
 
LVL 4

Author Comment

by:slovisa
ID: 23056665
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
 
LVL 39

Accepted Solution

by:
blue-genie earned 2000 total points
ID: 23075482
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
 
LVL 4

Author Comment

by:slovisa
ID: 23083558
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
 
LVL 39

Expert Comment

by:blue-genie
ID: 23742224
did you come right or are you just giving up now?
0
 
LVL 4

Author Comment

by:slovisa
ID: 23745165
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question