We know as to connect and to know if our connection perfectly this working, we will see then as to publish ours they cam for the Internet .
Initiating with the call of they webcam:
-
var teste_cam:Camera = Camera.get();
-
aovivo.attachVideo(teste_cam);
We go to modify ours codigo, the connection now will be inside of a function: Inside of the function doConnect we will initiate conexao with the FlashCom server
-
function doConnect() {
-
client_nc = new NetConnection();
-
client_nc.onStatus = function(info) {
-
trace("Level: "+info.level+" Code: "+info.code);
-
txt_status.text = "Level: "+info.level+" Code: "+info.code;
-
};
-
//client_nc.connect("rtmp://dominio");
-
client_nc.connect("rtmp:/cam");
-
}
Made this, we will initiate another function to publish the images of cam for the FlashCom
-
function publishMe() {
-
out_ns = new NetStream(_root.client_nc);
-
out_ns.attachVideo(teste_cam);
-
out_ns.publish("myTestStream");
-
}
Finishing with the function that dara play to visualize cam it way stream:
-
function playMe() {
-
in_ns = new NetStream(_root.client_nc);
-
Published_video.attachVideo(in_ns);
-
in_ns.play("myTestStream");
-
}
Now it is enough to call each function:
-
// Connect to the server
-
doConnect();
-
// Publish the live stream
-
publishMe();
-
// Play back the stream from the server
-
playMe();
the code:
-
var teste_cam:Camera = Camera.get();
-
aovivo.attachVideo(teste_cam);
-
/////////////////
-
function doConnect() {
-
client_nc = new NetConnection();
-
client_nc.onStatus = function(info) {
-
trace("Level: "+info.level+" Code: "+info.code);
-
txt_status.text = "Level: "+info.level+" Code: "+info.code;
-
};
-
//client_nc.connect("rtmp://dominio");
-
client_nc.connect("rtmp:/cam");
-
}
-
function publishMe() {
-
out_ns = new NetStream(_root.client_nc);
-
out_ns.attachVideo(teste_cam);
-
out_ns.publish("myTestStream");
-
}
-
function playMe() {
-
in_ns = new NetStream(_root.client_nc);
-
Published_video.attachVideo(in_ns);
-
in_ns.play("myTestStream");
-
}
-
// Connect to the server
-
doConnect();
-
// Publish the live stream
-
publishMe();
-
// Play back the stream from the server
-
playMe();
Remembering that it was created two movieclips of the video type with the respective names of instances “aovivo�? and “Published_video�?. Swf publishes its to see the result.
This example this example it is in help of the FlashCom.
Flash Media Server Developer Center
http://www.macromedia.com/devnet/flashmediaserver/
FlashComGuru
http://www.flashcomguru.com/
FlashCom.com.br
http://www.flashcom.com.br/
Flash Media Server Fun
http://www.fczone.com/
