I've tried this code below in a labelFunction for a dataGrid column where the
datafield is "sourcePath" (the path to the flv file)
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
var resultDur:String;
var client:Object = new Object();
client.onMetaData =
function(metadata:Object):void {
resultDur = metadata.duration;
trace(resultDur.toString());
}
ns.client = client;
ns.play(sourcePath);
return ns.client.onMetaData.toString;
This is where I am unsure if the above function will work, so far I am getting
[object Object] as the return value. I am not sure if I am not getting
anything from the function because my code is off or I need to assign a video
object to get the netsteam to call the onMetadata event.
Thanks,
Hoyt
--- In [email protected], "hoytlee2000" <hoytlee2...@...> wrote:
>
> Hello,
>
> I've seen all the examples on getting duration information from an flv file
> using the netstream function, but they all require you to play the flv first.
>
> I was wondering if you could get the info without having to play the flv file.
>
> The situation I have is I am ingesting an xml file with a list of flv files
> in a directory. I want to display that list of files in a datagrid with the
> duration in another column. So I want to use a labelfunction that will read
> the flv file and then calculate the duration.
>
> However I am concerned that the examples I have seen to retrieve this
> metadata requires me to play each video to get the data which might be too
> slow. Is there a different approach to this?
>
> I would do this once and after getting the duration I would write it back
> into the xml file but the flvs in the directory keep changing. Any ideas or
> hints would be appreciated.
>
> thanks,
> Hoyt
>