Mindspace
asked on
How to preload multiple FLVs for smooth playback?
I am attaching a snippet of code that I am using to display multiple flvs. However, what I can't figure out is how to preload the 2nd while the first is playing.
Any support would be greatly appreciated!
Any support would be greatly appreciated!
var vidConnection:NetConnection = new NetConnection;
vidConnection.connect(null);
var vidStream:NetStream = new NetStream(vidConnection);
var video:Video = new Video(350,288);
var video2:Video = new Video(380,530);
var infoClient:Object = new Object();
var container:Sprite = new Sprite();
infoClient.onMetaData = onMetaData;
infoClient.onCuePoint = onCuePoint;
vidStream.client = infoClient;
vidStream.bufferTime = 20;
video.attachNetStream(vidStream);
addChild(container);
container.addChild(video);
vidStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
vidStream.play("myflv.flv");
function onMetaData(info:Object):void
{
}
function onCuePoint(info:Object):void
{
}
function netStatusHandler(event:NetStatusEvent):void
{
try
{
switch (event.info.code)
{
case "NetStream.Play.Stop":
container.removeChild(video);
video2.width = 380;
video2.height = 530;
video2.attachNetStream(vidStream);
container.addChild(video2);
vidStream.play("myflv2.flv");
break;
}
}
catch (error:TypeError)
{
// Ignore any errors.
}
}
ASKER
Thanks for your comment. This actually won't be in a web page, so I'll need to find a solution that is based on AS3.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I have found this link about preloading flv files. Maybe this can help you.
http://www.askapache.com/htaccess/preload-and-cache-flash-flv-files.html
greetz,
walter