I'm tring to implement a dual buffering strategy. (Flash
Media Server 3, Flash Player 9 and Actionscript 3)
I have a simple player with FLVComponent, a standard skin
using the vod application.
I put in the first frame the following code:
videoPlayer.bufferTime = 8;
videoPlayer.source = root.loaderInfo.parameters.url; (I use
the variable url to pass the video name)
I read your article but I don't know how to use the code. I
tried to copy and past below my to lines and didn't work.
Please help me.
Thanks,
Thiago Prado
function initConnection() {
// Create a NetConnection
nc = new NetConnection();
// Define onStatus event handler
nc.onStatus = function(info) {
trace("Level: "+info.level+" Code: "+info.code);
// Initialize the stream after the connection is successful
if (info.code == "NetConnection.Connect.Success") {
trace("--- connected to: " + this.uri);
startStream(); //Inizialize the stream
}
};
// try to connect, to be changed with your app path
nc.connect("rtmp://localhost/vod");
}
function startStream() {
//Define stream and buffers parameters
stream_name="test_stream"; //your stream - How can I pass my
variable url to stream_name?
startBufferLength=2; //keep this in the range 2-4+
expandedBufferLength=15; //arbitrarily high
// create a netstream
ns = new NetStream(nc);
// Define onStatus event handler
ns.onStatus = function(infoObject:Object) {
if (infoObject["code"]=="NetStream.Buffer.Full"){
ns.setBufferTime(expandedBufferLength);
trace("set expanded buffer");
}
if (infoObject["code"]=="NetStream.Buffer.Empty"){
ns.setBufferTime(startBufferLength);
trace("set start buffer");
}
}
// attach the NetStream to a video object
// change from videoObj to your istance name if needed
videoObj.attachVideo(ns);
ns.setBufferTime(startBufferLength);
ns.play(stream_name, 0);
}
initConnection();
stop();