Comunidad de diseño web y desarrollo en internet online

Problema Mostrando camara

Citar            
MensajeEscrito el 30 May 2011 03:48 pm
Hola, estoy desarrollando una videoconferencia en AS3 y Flash cs4, y en mi MovieClip, he puesto un FLVPlayback sin ningun skin. Las propiedades que le he puesto son las siguientes:
autoplay=true, isLive=true.
En cuanto al código he puesto lo siguiente:

Código ActionScript :

private function viewLocalCam():void
      {
         netStream = new NetStream(myNetConnection);
         netStream.client = this;
         
         camera1 = Camera.getCamera("0"); // Take camera
         
         mic1 = Microphone.getMicrophone(); // Take microphone
         
         //comprove that we have a cam connected
         if (camera1 != null)
         {
            camera1.setMode(640,480,20);
            camera1.setKeyFrameInterval(5);
            camera1.setMotionLevel(100);
            camera1.setLoopback(false);
            netStream.attachCamera(camera1); //add camera to streaming video
            video_mc.myVideo.source(camera1); 
         }
         else
         {
            trace("No hi ha la webcam principal");
         }
         
         //comprove that we have microphone connected
         if (mic1 != null)
         {
            mic1.setLoopBack(false);
            mic1.setUseEchoSuppression(true);
            mic1.setSilenceLevel(0, 10000);
            mic1.rate = 22;
            netStream.attachAudio(mic1);
         }
         else
         {
            trace("No hi ha cap micròfon conectat");
         }
         
         netStream.receiveAudio(true);//we want to recieve audio
         netStream.publish(Singleton.getInstance().role);//publish user
      }


Me da error en la linea: "video_mc.myVideo.source(camera1); ", dándome el siguiente error: "Error #1006: value no es una función."

Alguien sabe como puedo solucionarlo? Por si no me he explicado bien, lo que quiero hacer es mostrar la imagen capturada por la cámara web y mostrarlo en mi aplicación.


Muchas gracias

Por Palacio

Claber

198 de clabLevel



 

firefox
Citar            
MensajeEscrito el 30 May 2011 05:42 pm
Este código que encontraste no es para un FLVPlayback, sino para un objeto video. Tienes que poner un objeto video en tu librería (dándole click en el extremo superior de la biblioteca y seleccionando camara del desplegable), luego lo arrastras al escenario y busca en el código que no posteaste si dice algo así>

myVideo.attachNetStream(netStream)

Si no lo encuentras, ponle nombre de instancia myVideo y agrégalo para que la imagen aparezca en el objeto Video

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 31 May 2011 08:32 am
Muchas gracias Jorge, he conseguido ver la imagen capturada por mi Webcam. Ahora necesito enviar esta imagen y recibirla en otro Video. He hecho lo siguiente:

Código ActionScript :

private function viewLocalCam():void
{
   netLocalStream = new NetStream(MyNetConnection);
   netLocalStream.client = this;
   camera1 = Camera.getCamera("0"); // Take camera
         
   mic1 = Microphone.getMicrophone(); // Take microphone
         
   //check that we have a cam connected
   if (camera1 != null)
   {
      camera1.setMode(640,480,20);
      camera1.setKeyFrameInterval(5);
      camera1.setMotionLevel(100);
      camera1.setLoopback(false);
      netLocalStream.attachCamera(camera1); //add camera to streaming video
      myVideo.attachCamera(camera1);
       }
       if (mic1 != null)
       {
      mic1.setLoopBack(false);
      mic1.setUseEchoSuppression(true);
      mic1.setSilenceLevel(0, 10000);
      mic1.rate = 22;
      netLocalStream.attachAudio(mic1);
   }
        netLocalStream.receiveAudio(true);//we want to recieve audio
   netLocalStream.publish(myChannel);//publish user
}
private function viewRemoteCam():void
{
   //connect the user to the streaming video
   netRemoteStream = new NetStream(Singleton.getInstance().nc);
   otherVideo.attachNetStream(netRemoteStream);
   netRemoteStream.play(red5Url + "/fitcDemo/" + myChannel);
}


Pero cuando llamo a "viewRemoteCam()" no veo nada. Que estoy haciendo mal?

Muchas gracias

Por Palacio

Claber

198 de clabLevel



 

firefox
Citar            
MensajeEscrito el 31 May 2011 10:37 am
¿La aplicación se conecta a fitcDemo, es decir MyNetConnection se ha conectado a esa aplicación? ¿Has definido el valor de myChannel? Agregale un callback a netRemoteStream para ver si te da alguna pista

Código ActionScript :

netRemoteStream.addEventListener(NetStatusEvent.NET_STATUS , onStatus)
function onStatus(evt:Event){
   trace(evt.info)
}


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 31 May 2011 11:12 am
Hola, respondiendo a tus preguntas, Sí que me conecto a fitcDemo, ya que tengo un trace con lo siguiente: "NetConnection.Connect.Success", "myChannel" es un string que vale "TEST" y al callback del "netRemoteStream" me entra 2 veces dándome la siguiente salida:
"[object Object]" y "[object Object]"

Alguna idea?

Por Palacio

Claber

198 de clabLevel



 

firefox
Citar            
MensajeEscrito el 31 May 2011 11:22 am
Por si sirve de ayuda decir que estoy apuntando a un servidor RED5 y a continuación adjunto el código donde creo la conexión:

Código ActionScript :

public function createConection():void
{
   // create a new connection
   MyNetConnection= new NetConnection();
   // associate the event status change of the connection
   MyNetConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
   MyNetConnection.connect("rtmp://" + Red5StreamHostURL + "/fitcDemo", myChannel, myChannel);
   MyNetConnection.client = this;
}
private function netStatus(event:NetStatusEvent):void 
{
   var info:Object = event.info;
   switch (info.code) 
   {
      case "NetConnection.Connect.Success" :
         trace("NetConnection.Connect.Success");
         viewLocalCam();
         break;
      case "NetConnection.Connect.Closed" :
         // do something?
         trace("NetConnection.Connect.Closed");
         break;
      case "NetConnection.Connect.Failed" :
         // do something?
         trace("NetConnection.Connect.Failed");
         break;
      case "NetConnection.Connect.Rejected" :
                   // do something?
             trace("NetConnection.Connect.Rejected");
             break;
   }
}

Por Palacio

Claber

198 de clabLevel



 

firefox
Citar            
MensajeEscrito el 31 May 2011 11:27 am
Entonces traza evt.info.code y evt.info.message (creo que ahí venía la info, sino revisa la ayuda)

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.