Hello fellow coders!
I’m trying to load an flv but it randomly stops… sometimes it plays until the end fine, and sometimes it stops after a few seconds.
Any tip on what could be doing that?
TIA
Code inside a function:
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
target.attachNetStream(ns);
var listener:Object = new Object();
listener.onMetaData = function(infoObject:Object){
if(infoObject.duration != null){
//trace("our video is "+infoObject.duration+" seconds long");
}
if(infoObject.height != null && infoObject.width != null){
//trace("our video is "+infoObject.height+"x"+infoObject.width+" pixels");
target.width = infoObject.width;
target.height = infoObject.height;
}
}
ns.bufferTime = 2;
ns.client = listener;
ns.play(url);