• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

FLV Player button to seek to next cue point (or previous)?

Participant ,
Dec 01, 2015 Dec 01, 2015

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. 🙂

TOPICS
ActionScript

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2015 Dec 01, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 01, 2015 Dec 01, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2015 Dec 01, 2015

Copy link to clipboard

Copied

function prevCuePointF(e:MouseEvent):void{  // assuming mouseevent calls

player.findNearestCuePoint(player.totalTime,'all');

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 01, 2015 Dec 01, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2015 Dec 01, 2015

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');

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 01, 2015 Dec 01, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2015 Dec 01, 2015

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');

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 01, 2015 Dec 01, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 01, 2015 Dec 01, 2015

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');

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

are cue points listed from the metadata listener function?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

upload your flv to a file server and post a link to it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

it looks like cue points aren't assigned properly.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

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?

cuepoints.jpg

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

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.

Parameter_Names.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

you're right.

use:

function prevCuePointF(e:MouseEvent):void{

player.seek(player.findNearestCuePoint(player.playheadTime,'all').time)

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

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?

Screen Shot 2015-12-02 at 17.27.50.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

you need to change prevCuePointF

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

I do? Which one and what to and also why?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

again, use:

function prevCuePointF(e:MouseEvent):void{

player.seek(player.findNearestCuePoint(player.playheadTime,'all').time)

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 02, 2015 Dec 02, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 02, 2015 Dec 02, 2015

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines