开发者

Flash actionscript 3 find where a video passed to play later from where it is passed

Is it possible to find the position where a video passed / stopped. So when later loaded need to play from where it previously passed / stopped. I am using flash 开发者_如何学CFLVPlayBack component.


Couldn't you listen for the playheadUpdate event dispatched automatically from the FLVPlayBack component? I've not used that component in years (prefer writing from scratch), but I believe something like this should do the trick (not tested; written off top of my head):

private var currentTime:Number = 0;

myFLVPlaybackComponent.addEventListener(VideoEvent.PLAYHEAD_UPDATE, playheadUpdated);

private function playheadUpdated(evt:VideoEvent):void {
    currentTime = evt.playheadTime;
}

// next time you want to begin playback, use this (though you may need to convert seconds
// to milliseconds or vice versa, depending on return format, or use seekSeconds())
myFLVPlaybackComponent.seek(currentTime);

If you don't have direct control over the playback starting again (in the case of the user hitting the component's 'play' button before you have a chance to tell it to seek()), maybe you can listen for the playingStateEntered event, and if currentTime > 0 (basically, if it's been set previously), immediately seek() to currentTime.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜