Publishing the webcam in the Internet with FlashCom/Flash Media Server

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:

[as]var teste_cam:Camera = Camera.get();
aovivo.attachVideo(teste_cam);[/as]

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

[as]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”);
}[/as]

Made this, we will initiate another function to publish the images of cam for the FlashCom

[as]function publishMe() {
out_ns = new NetStream(_root.client_nc);
out_ns.attachVideo(teste_cam);
out_ns.publish(“myTestStream”);
}[/as]

Finishing with the function that dara play to visualize cam it way stream:

[as]function playMe() {
in_ns = new NetStream(_root.client_nc);
Published_video.attachVideo(in_ns);
in_ns.play(“myTestStream”);
}
[/as]

Now it is enough to call each function:

[as]// Connect to the server
doConnect();
// Publish the live stream
publishMe();
// Play back the stream from the server
playMe();[/as]

the code:
[as]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();[/as]

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.

view app

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/

Flash, Flash Media Server, Flash Platform, Principal, RIA

Leave a Reply