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.

ActionScript

  1. var teste_nc:NetConnection = new NetConnection();

Testing the connection.

ActionScript

  1. teste_nc.onStatus = function(info) {
  2.     trace("Level: "+info.level+"   Code: "+info.code);
  3. };

Connecting the server FMS/FCS

ActionScript

  1. teste_nc.connect("rtmp://doman");//for localhost use rtmp:/aplication

Getting images of webcam

ActionScript

  1. var teste_cam:Camera = Camera.get();

Insert the images of webcam in instance of video create

ActionScript

  1. live.attachVideo(teste_cam);

The code:

ActionScript

  1. var teste_nc:NetConnection = new NetConnection();
  2. teste_nc.onStatus = function(info) {
  3.     trace("Level: "+info.level+"   Code: "+info.code);
  4. };
  5. teste_nc.connect("rtmp://dominio");//para localhost use
  6. var teste_cam:Camera = Camera.get();
  7. live.attachVideo(teste_cam);

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:

ActionScript

  1. var client_cam = Camera.get();
  2. client_cam.onStatus = function(infoObj:Object) {
  3.             switch (infoObj.code) {
  4.             case 'Camera.Muted' :
  5.                 trace("Camera deny");
  6.                 break;
  7.             case 'Camera.Unmuted' :
  8.                 trace("Camera access");
  9.                 break;
  10.             }

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, Flash Media Server, Flash Platform, Principal, RIA

4 comments


  1. Thnx alot for this tutorial.

  2. Hugo Silva

    i have install the media server and i can reach him, but have connection refuse. i don’t have licenses fr media server. can i test applications on media server …. what is the options i have
    Best regard

  3. the Flash Media Server is free for 10 connections in developer edition, try start the server ;o)

  4. Greetings

    i want to have webcamera option for one of my client’s website.

    How do i intergrate it…Can you pls help me?

    thanks and regards
    Renuka

Leave a Reply