Skip to main content
Webshark2000
Known Participant
February 8, 2010
Answered

How can I save a video's position using the FLVPlayback component

  • February 8, 2010
  • 2 replies
  • 922 views

I've got a video I'd like people to be able to navigate away from in my project, but resume where it left off if they come back to it.  I would think I could do this by just saving its current position when they exit that frame as a variable and then using .seek() to go back to that spot if/when they return.

The only problem is that I can't find any script to capture the current position.  I tried .time, but it gives me an error.

This topic has been closed for replies.
Correct answer kglad

use the playheadUpdate listener's eventobject's playheadTime property:

var flvUpdateObj:Object = new Object();
flvUpdateObj.playheadUpdate = function(eobj:Object):Void {
    trace(playheadupdate"+eobj.target+": "+eobj.playheadTime);
};

yourcomponent.playheadUpdateInterval = 500;
yourcomponent.addEventListener("playheadUpdate", flvUpdateObj);

2 replies

February 8, 2010

I believe playheadTime should do what you need. Check the Help for the FLV playback component...


kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
February 8, 2010

use the playheadUpdate listener's eventobject's playheadTime property:

var flvUpdateObj:Object = new Object();
flvUpdateObj.playheadUpdate = function(eobj:Object):Void {
    trace(playheadupdate"+eobj.target+": "+eobj.playheadTime);
};

yourcomponent.playheadUpdateInterval = 500;
yourcomponent.addEventListener("playheadUpdate", flvUpdateObj);

Webshark2000
Known Participant
February 8, 2010

Thanks kglad, that's exactly what I needed.


kglad
Community Expert
Community Expert
February 8, 2010

actually, that's helpful only if you were using as2.  in as3, it's easier:

use the flvplayback's playheadTime property:

trace(yourcomponent.playheadTime);

// you'll need to save that (using sharedobject) periodically so you might want to use a VideoEvent.PLAYHEAD_UPDATE event.