PDA

View Full Version : server stream


circumflex
07-17-2003, 11:45 AM
Hi!

I set up a stream object on the server using:

application.myStream = Stream.get("foo");
if (application.myStream){
application.myStream.play("sample_video");
}


Now i have no idea how to access the stream at the client side.
I understand the NetStream object opens a own streaming connection... right?
With NetStream I can do that:

nc = new NetConnection();
nc.onStatus = function(info) {
startStreamSubscribe();
};
startStreamSubscribe = function () {
sub_ns = new NetStream(nc);
sub_ns.setBufferTime(20);
my_video.attachVideo(sub_ns);
sub_ns.play("sample_video");
};
nc.connect("rtmp://server/app_test");


But when a new user connect to the app he should not see the video from the beginning! So i have to set up a stream that constantly streams from the server again and again...

Puhhh, it's heavy stuff for an autodidact... :)

Regands

circumflex

circumflex
07-19-2003, 01:04 PM
Here it is... :)

On server side i started a stream with the video "sample_video.flv":


application.onAppStart = function() {
application.videoStream = Stream.get("my_video");
if (application.videoStream) {
application.videoStream.play("sample_video", 0, -1);
}
};



Now i can see the stream:


nc = new NetConnection();
nc.onStatus = function(info) {
if (info.code == "NetConnection.Connect.Success") {
startStreamSubscribe();
} else {
trace("connection failed");
}
};
startStreamSubscribe = function () {
sub_ns = new NetStream(nc);
sub_ns.setBufferTime(10);
_root.container.attachVideo(sub_ns);
sub_ns.play("my_video");
};
nc.connect("rtmp://server/app");


I forgot to place an emedded video on the stage and name it "container".
That's it... :)

The stream does not start from it's beginning when i press browsers reload button. cool.

The next goal is to loop the stream!!

Anybody an idea?


greetings

circumflex