Question

How do I know the length of the video (external FLV video)?

I have tried several ways but the result is 0.

videonya.addEventListener(fl.video.VideoEvent.READY, onFlvPlayback_READY);

function onFlvPlayback_READY(event:fl.video.VideoEvent):void
{
    var metaDataObj:Object = videonya.metadata as Object;
    trace("metaDataObj.duration: "+metaDataObj.duration);
}

No correct solution

OTHER TIPS

The standard way of playing video and accessing metadata is this:

var nc:NetConnection = new NetConnection(); 
nc.connect(null); 

var ns:NetStream = new NetStream(nc); 
ns.client = this; 
ns.play("video.flv"); 

var vid:Video = new Video(); 
vid.attachNetStream(ns); 
addChild(vid); 

function onMetaData(infoObject:Object):void 
{ 
    var key:String; 
    for (key in infoObject) 
    { 
        trace(key + ": " + infoObject[key]); 
    } 
}

This will trace out all of the metadata codes including duration. If you just want the duration: trace(infoObject.duration); inside the onMetaData(infoObject) function, of course.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top