Testing Webcam with Flash Communication Server/Flash Media Server

The Flash Media Server/Flash Communication Server is a server of stream developed by Macromedia, with it can be developed applicatory of the most varied as complex videoconferences , chats, stream of audio, video and what more the imagination to allow. We will see with the time as to develop a complex application and robust using the FMS/FCS, however, I go to look for to show as to make this without using the ready components of the Flash.

Installing and creating its first application in FlahCom
Having the FMS/FCS installed correctly in its machine or the server, we go to test connection and to create small applicatory that will test its they webcam

Opens a new document in the Flash, presses F11 to open the library, later inserts a new item in the library (New Video) as in the image below:

Inserindo novo video

It drags this item for palco of the Flash, gives the name of instance “live�?. presses F9 to open the window of Actions.
Create one variavel for connection.

[as]var teste_nc:NetConnection = new NetConnection();[/as]

Testing the connection.

[as]teste_nc.onStatus = function(info) {
trace(“Level: “+info.level+” Code: “+info.code);

Connecting the server FMS/FCS

[as]teste_nc.connect(“rtmp://doman”);//for localhost use rtmp:/aplication[/as]

Getting images of webcam

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

Insert the images of webcam in instance of video create


The code:

[as]var teste_nc:NetConnection = new NetConnection();
teste_nc.onStatus = function(info) {
trace(“Level: “+info.level+” Code: “+info.code);
teste_nc.connect(“rtmp://dominio”);//para localhost use
var teste_cam:Camera = Camera.get();

Test the swf(ctrl+enter) if everything will be certain swf will ask to it if it will be able to have access its webcam, accepting you will see its webcam functioning.

see the test

***UPDATE*** 18/02/2006
When you use the method “Camera.get();” automatically the Flash Player shows to the user the option to allow or to deny the access of the flash they webcam it. In this we can know if the access or was allowed not using the function onStatus later as in the following example:

[as]var client_cam = Camera.get();
client_cam.onStatus = function(infoObj:Object) {
switch (infoObj.code) {
case ‘Camera.Muted’ :
trace(“Camera deny”);
case ‘Camera.Unmuted’ :
trace(“Camera access”);

Flash Media Server Developer Center



Was this article helpful? feel free to make a donation and help keep the blog in the air
Flash, Flash Media Server

Leave a Reply