PDA

View Full Version : NetStream Question


RyuuJin Silver
04-02-2008, 08:10 PM
So I have a video that is using NetStream and all that jazz to play the flv. Is there a way I can restrict the video from play until say, 20% of it is loaded?

Here is my code so far.



var video:Video = new Video(600, 300);
addChild(video);

video.x = 10;
video.y = 10;

VideoMask.cacheAsBitmap = true;
video.mask = VideoMask;

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

var ns:NetStream = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onStatusEvent);

function onStatusEvent(stat:Object):void
{
trace("MOVIE LOADED");
}

var meta:Object = new Object();
meta.onMetaData = function(meta:Object)
{

}

ns.client = meta;

video.attachNetStream(ns);

ns.play("assets/content/video/FormativeDemoReel.flv");

nikefido
04-03-2008, 01:31 AM
should be something like:


var bufferProgressRatio:Number = ns.bufferLength/ns.bufferTime; //ratio of buffer progress
//or

var percentLoaded:Number = ns.bytesLoaded/ns.bytesTotal;


those should be properties of the NetStream (my source isn't clear if you have to use contentLoaderInfo and a PROGRESS event).