views:

60

answers:

1

Adobe Flash Builder: How to make a function to play video starting from one second and ending in another? So I havein MXML simple video player tag. I need some function to play that video from second X to second Y and pause it. How to do such thing?

BTW: we asume file is embeded into SWF.

A: 

using FMS? not using FMS? With FMS you would pass in netstream.play(file, start, duration); If not using FMS, the conventional method (which is pretty awful) is to do something similar to:

stream.play(file);
stream.pause();

// wait for the time to be available, and then play

stream.seek(start);
stream.resume();

// listen for the end and then
stop();

If you have access to change your webserver, there are better plugins to handle on-demand seeking, take a look at:

Apache mod_flvx: http://journal.paul.querna.org/articles/2006/07/11/mod_flvx/ Nginx h264 module: http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Nginx-Version2

or just google mod h264 and/or mod flv and your web server

Daniel Hai
not using FMS. we asume file is embeded into SWF (which is pretty awful but is normal for my project)
Blender
yikes. Well if it's embedded I'm not sure how to access the video frames, I'm assuming Flash converts them into a long timeline, which at that point you'd have to read the framerate from loader.contentLoaderInfo.frameRate and numFrames to calculate your own timestamps .... Then a simple gotoAndPlay / gotoAndStop would work ....
Daniel Hai