Example
The following example shows how streams can be chained between servers:
application.myRemoteConn = new NetConnection();
application.myRemoteConn.onStatus = function(info){
trace("Connection to remote server status " + info.code + "\n");
// Tell all the clients.
for (var i = 0; i < application.clients.length; i++){
application.clients[i].call("onServerStatus", null,
info.code, info.description);
}
};
// Use the NetConnection object to connect to a remote server.
application.myRemoteConn.connect(rtmp://movie.com/movieApp);
// Setup the server stream.
application.myStream = Stream.get("foo");
if (application.myStream){
application.myStream.play("Movie1", 0, -1, true,
application.myRemoteConn);
}
The following example shows
and recorded streams:
// Set up the server stream.
application.myStream = Stream.get("foo");
if (application.myStream){
// This server stream plays "Live1",
// "Record1", and "Live2" for 5 seconds each.
application.myStream.play("Live1", -1, 5);
application.myStream.play("Record1", 0, 5, false);
application.myStream.play("Live2", -1, 5, false);
}
The following example combines different streams into a recorded stream:
// Set up the server stream.
application.myStream = Stream.get("foo");
if (application.myStream){
// Like the previous example, this server stream
// plays "Live1", "Record1", and "Live2"
// for 5 seconds each. But this time,
// all the data will be recorded to a recorded stream "foo".
application.myStream.record();
application.myStream.play("Live1", -1, 5);
application.myStream.play("Record1", 0, 5, false);
application.myStream.play("Live2", -1, 5, false);
}
The following example uses
application.myStream.play(false);
154
Server-Side ActionScript Language Reference
is used as a hub to switch between live streams
Stream.play
to stop playing the stream
Stream.play
:
foo
Need help?
Do you have a question about the FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE and is the answer not in the manual?