Having a problem keeping a connection alive Flv Player
Code:
var myNetconnection;
var myStream;
var myStreamDuration;
var stopped=false;
var lastDelta=0;
loadVideo = function (videoUrl)
{
myNetconnection = new NetConnection();
myNetconnection.connect(null);
myStream = new NetStream(myNetconnection);
myStream.setBufferTime(0.1);
my_video.attachVideo(myStream);
myStream.play(videoUrl);
myNetconnection.addHeader('keep-alive',true);
myStreamDuration=0;
_root.vurl=videoUrl;
myStream.onStatus = function(info)
{
trace("info="+info.code);
if (info.code == "NetStream.Buffer.Full")
{
myNetconnection.connect(null);
myStream.setBufferTime(100);
}
if (info.code == "NetStream.Play.Stop")
{
myStream.setBufferTime(0.5);
}
if (info.code == "NetStream.Buffer.Flush")
{
}
if (info.code == "NetStream.Buffer.Empty")
{
}
}
myStream.onMetaData = function(obj)
{
myStreamDuration=obj.duration;
trace("metadata duration="+myStreamDuration);
}
j =1;
this.onEnterFrame = function()
{
j++;
all.text = j++;
//MyVideo.progressInterval = 001;
//myStream.play(videoUrl);
//var listenerObject:Object = new Object();
//listenerObject.progress = function(eventObject:Object):Void {
thisloaded.text= myStream.bytesLoaded;
thistotal.text= myStream.bytesTotal;
//}
//MyVideo.addEventListener("progress", listenerObject);
};
};
loadVideo("http://wiistream.com/users/100002957030150/videos/f241b7020773f834f5462ade6afe1965.wsm");
//loadVideo("loopsampleNoMeta.flv");
I attached the file im woking on but im new at making players, how can i keep the connection alive?
as you see it tells me total and it only gets some and then it stops testflvplayer.fla
Lets say, i make my own refresh system running in the back ground set on a timer. say at timer 3000 it flips from frame one to frame two and reloads and gets a new connection, and at timer 3000 page two flips to page one to get a new connections and loads the data again.. it will flip back and forth in the back ground.
but on another layer frame one is the player. i wonder if that will work..
I haven't giving a look to your fla, but replying to your last post, you don't have to go to another frame to refresh it. Just make the timer likes this
PHP Code:
function Timer(){
YourFLVComponentOrMovieCLipName.stop();
YourFLVComponentOrMovieCLipName.play();
}
var timing=setInterval (Timer, 3000);
That will make a timer of 3 seconds (3000 milliseconds), then when reaching 3000 i, it will stop the flv player, and play it. Hope this work for you.