Skip to main content
wfzen
Inspiring
March 28, 2017
Question

start an MP4 from a defined seconds and end in another

  • March 28, 2017
  • 2 replies
  • 861 views

If I have XML like this:

<videoTime start="35" end="111"></videoTime>

How can I have the SWF reads the time and play at 35 seconds and stops at 111 seconds?

Thanks,

This topic has been closed for replies.

2 replies

kglad
Community Expert
Community Expert
March 28, 2017

are you using an flvplayback component to play your video?  the netstream class?  something else?

wfzen
wfzenAuthor
Inspiring
March 28, 2017

Thank you, Kglad and Colin. I've not decided as I'm converting from AS2. It's custom UI so I think netstream is more likely.

Thanks,

kglad
Community Expert
Community Expert
March 28, 2017

you play the steam and then immediately pause it.  repeatedly check the bytesLoaded (though bufferLength should be better, but i've had problems with it in the past) and when enough data is loaded use the seek method to start play at 35 seconds.

you can use a timer like the above to stop play (or use a a loop and repeatedly check the netstream's time property).

kglad
Community Expert
Community Expert
March 28, 2017

use actionscript.

var s:Sound = YourSound();

var sc:SoundChannel = s.play(35000);

var t:Timer=new Timer(111,1);

t.addEventListener(TimerEvent.TIMER,sF);

t.start();

function sF(e:TimerEvent):void{

sc.stop();

}

Colin Holgate
Inspiring
March 28, 2017

That would be the answer for MP3. The question was about MP4.

kglad
Community Expert
Community Expert
March 28, 2017

oops.