0

I have NetStream attached to video control in flash movie. I cannot understand how to jump forward or backward.

var ns:NetStream = new NetStream(nc); 
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler); 
ns.play("Video.flv"); 
vid.attachNetStream(ns);

I need somethinf like

btnSkip.addEventListener(MouseEvent.CLICK, playClicked);
function playClicked(e:MouseEvent):void {
ns.pause();
//ns.step(1000)
//ns.seek(1);
ns.resume();
}

ns.step() - doesn't work and I don't know why. ns.seek - works fine, but I don't know where is a position, there's no ns.position and no ns.fps properties to add ns.seek(ns.position+(ns.fps*3)) to skip 3 seconds forward.

el Dude
  • 5,003
  • 5
  • 28
  • 40

2 Answers2

1

This article might help you a little further: Netstream and step() or seek()?.

What are you trying to play? If it's just a static video you might be able to use the regular video objects, then you'll be able to use the playheadTime property (which might not be very accurate by the way - depending on the number of keyframes).

Good luck!

Community
  • 1
  • 1
Chris Beemster
  • 352
  • 1
  • 6
1

It is rather simple actually. Use the seek method on your netStream. To get the position use the time method and then add the offset you need

For 3 sec forward:

ns.seek(ns.time + 3);

For 3 sec backward:

ns.seek(ns.time - 3);
Future2020
  • 9,939
  • 1
  • 37
  • 51