PDA

View Full Version : Please Help! onMetadata doesn't work with local file?


viswhiz
06-10-2008, 06:27 AM
Thanks for reading. I have a very annoying problem with onMetadata in AS3. I can't seem to read duration of FLV/MP4 that I am loading locally (from local harddrive).

The code:

var mediadata:Object = new Object();
mediadata.onMetaData = onMetaDataHandler;
stream_ns.client = mediadata;

function onMetaDataHandler(meta:Object):void {
totaltime = meta.info.duration;
trace("totaltime: "+String(totaltime));
}

stream_ns is a Netstream object.

The FLV/MP4 movies are playing just fine, and the "stream_ns.time" property is working just fine, but the "totaltime" variable is always 0 (zero). The function "onMetaDataHandler" was never called (no trace on that). The FLV that I have was created with Flash Video Encoder (it embeds metadata, right?).

I'm not using any components.

Anyone has any problem detecting video duration from local files?

Thanks in advance!