Copy link to clipboard
Copied
Hello all,
I have a FLV player on my stage linked to a .flv with embedded cue points. (added and exported in an older version of Media Encoder)
I have added the following code, which pauses the player at each of the embedded cue points
import fl.video.MetadataEvent;
player.addEventListener(MetadataEvent.CUE_POINT, fl_CuePointHandler_3);
function fl_CuePointHandler_3(event:MetadataEvent):void
{ player.pause();
}
I would dearly love the back and next buttons on the Skin to have the ability to skip to the next or previous Cue points but they seem to just skip to small increments of time instead.
I can live with custom buttons on the stage that will give the user ability to seek to the next or previous Cue points. Can any one help me with what code would go on these buttons please.
Thanks in advance. 🙂
Copy link to clipboard
Copied
you can only seek to parts of the flv that's been downloaded. other than that, there should be no problems if your seek() is correct.
what code are you using that's failing, especially when seeking to previously played (and therefore downloaded) cue points?
Copy link to clipboard
Copied
Hi Kglad, Thanks for your response.
What code should I put on a button that would skip to the previous embedded Cue Point?
Thanks
Copy link to clipboard
Copied
function prevCuePointF(e:MouseEvent):void{ // assuming mouseevent calls
player.findNearestCuePoint(player.totalTime,'all');
}
Copy link to clipboard
Copied
Hmmm, I can't seem to get this to work. Please forgive my ignorance. Am I missing something very obvious here?
My Cue Points are set to Navigation. Should they be Event?
Copy link to clipboard
Copied
that code works for all cuepoint types. if you wanted to limit it to seeking for a previous cuepoint of a particular type, you would use that type-string instead of 'all'.
but i have an error. use:
function prevCuePointF(e:MouseEvent):void{
player.findNearestCuePoint(player.playheadTime,'all');
}
Copy link to clipboard
Copied
I still can't get that to work
I've tried creating a button and pasting your new code on the button, but when clicked the button does nothing.
Copy link to clipboard
Copied
use the trace function to debug:
import fl.video.MetadataEvent
player.addEventListener(fl.video.MetadataEvent.METADATA_RECEIVED,f);
function f(e:fl.video.MetadataEvent):void{
for(var s:String in e.info){
if(e.info
is Object){for(var ss:String in e.info
){trace(ss,e.info
[ss]);}
} else {
trace(s,e.info
);}
}
}
function prevCuePointF(e:MouseEvent):void{
trace(player.playheadTime);
player.findNearestCuePoint(player.playheadTime,'all');
}
Copy link to clipboard
Copied
I'm sorry, I do appreciate your help with this, but I have no idea where to put this code and how does this make a button click take you to the previous Cue Point?
Copy link to clipboard
Copied
you have to create that button. you can do that with code or in the ide.
then add a listener to that button to call prevCuePointF:
import fl.video.MetadataEvent
yourbutton.addEventListener(MouseEvent.CLICK,prevCuePointF);
player.addEventListener(fl.video.MetadataEvent.METADATA_RECEIVED,f);
function f(e:fl.video.MetadataEvent):void{
for(var s:String in e.info){
if(e.info
is Object){for(var ss:String in e.info
){trace(ss,e.info
[ss]);}
} else {
trace(s,e.info
);}
}
}
function prevCuePointF(e:MouseEvent):void{
trace(player.playheadTime);
player.findNearestCuePoint(player.playheadTime,'all');
}
Copy link to clipboard
Copied
Hi Kglad, Button created and new code placed onto it.
When tested the time of the current location of the playhead is shown in the output panel. Which is nice.
How do we now use this information to make the button click take us to the previous cue point?
Thanks again for your help.
Copy link to clipboard
Copied
are cue points listed from the metadata listener function?
Copy link to clipboard
Copied
When you first export, it lists 0 to 9 in the output panel? This corresponds to the same number of Cue points. Is that what you mean?
Copy link to clipboard
Copied
upload your flv to a file server and post a link to it.
Copy link to clipboard
Copied
Here's a link to a zip of the files.
https://dl.dropboxusercontent.com/u/7851228/Click_Through_Test.zip
Copy link to clipboard
Copied
it looks like cue points aren't assigned properly.
Copy link to clipboard
Copied
The cue points are added using media encoder. If they aren't assigned properly then I wonder why / how they are recognised by flash?
Plus the code I used to pause the play head as it reaches each cue point works. leading me to believe there are Cue Points embedded in this FLV.
//*code to pause playhead at each cue point
import fl.video.MetadataEvent;
player.addEventListener(MetadataEvent.CUE_POINT, fl_CuePointHandler_3);
function fl_CuePointHandler_3(event:MetadataEvent):void
{ player.pause();
}
So I'm wondering what it is that I'm missing here?
Copy link to clipboard
Copied
Here a screen shot of Media encoder as you place in the Cue Points.
I wonder if it's something to do with the Parameter names? None of the tuts I've looked at mention anything about these though.
Copy link to clipboard
Copied
you're right.
use:
function prevCuePointF(e:MouseEvent):void{
player.seek(player.findNearestCuePoint(player.playheadTime,'all').time)
}
Copy link to clipboard
Copied
Hmm. I added it here: But it still doesn't work.
Should I be adding something to the Parameter names as I export the FLV?
Copy link to clipboard
Copied
you need to change prevCuePointF
Copy link to clipboard
Copied
I do? Which one and what to and also why?
Copy link to clipboard
Copied
again, use:
function prevCuePointF(e:MouseEvent):void{
player.seek(player.findNearestCuePoint(player.playheadTime,'all').time)
}
Copy link to clipboard
Copied
Thanks for your patience Kglad . It is sort of working now, although unfortunately the button will only work whilst the playhead is running, not while it's paused. Also it jumps to the closest Cue point rather than the previous one.
Part of the functionality that I need is for the playhead to pause at each cue point. Then if the user so desires a button can be clicked to go to the previous cue point.
Once again, thanks for your help with this, however in the interest of making something usable and since I'm not able to understand the AS3 I'm going to re-think the nav and come up with another plan. I can't keep looting snippets of knowledge from your brain and hoping they will work, without understanding whats going on.
Copy link to clipboard
Copied
you're welcome.
if you get desperate you can hire me to finish this for you. or you can keep getting snippets of code to help with limited problems free via the adobe forums.