-
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..
-
Designer, Programmer, Musician
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.
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
Designer, Programmer, Musician
*PLEASE IGNORE MY PREVIOUS POST, I COULDN"T EDIT IT AND IT HAS A FLAW*
PHP Code:
function timer(){ YourFLVComponentOrMovieCLipName.stop(); YourFLVComponentOrMovieCLipName.play();
} var timing=setInterval (timer, 3000);
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|