You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by atauri <da...@gmail.com> on 2013/05/06 10:34:20 UTC

microphone issue

Hi, I am triyng to send live audio to wowza media server but I have a
problem with the michophe. The mic is recognized and seems to be started
but activityLevel event is never launched.
I've read the the user must be asked to allow it or not but I don not get
that questuion :-?
I´ve tried on air for desktop and android...
Here is a piece of my code . Any help will be thanked a lot
    <fx:Script>
        <![CDATA[

            import flash.events.ActivityEvent;
            import flash.events.StatusEvent;
            import flash.media.Microphone;

            var myMic:Microphone;
            var nc:NetConnection;
            var ns:NetStream

            function ini():void{


                var deviceArray:Array = Microphone.names;
                trace("Available sound input devices:");
                for (var i:int = 0; i < deviceArray.length; i++)
                {
                    trace(" " + deviceArray[i]);
                }



            //inicializar microfono
                myMic = Microphone.getMicrophone();
                myMic.setSilenceLevel(0);
                myMic.rate = 11;
                myMic.gain = 50; // increase this to boost the microphone
audio
                myMic.codec = SoundCodec.SPEEX;
                myMic.encodeQuality = 5;
                myMic.framesPerPacket = 2;
                myMic.setLoopBack(true);
                trace("mic inicializado:"+myMic.name);
                myMic.addEventListener(ActivityEvent.ACTIVITY,
this.onMicActivity);
                myMic.addEventListener(StatusEvent.STATUS,
this.onMicStatus);

            //Crear conexion
                nc = new NetConnection(); // create a new network connection
                nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
// netStatus method will be notified on network connection events.
                nc.connect("rtmp://localhost/liveradio"); // adjust the url
based on your setup. (elpuerto??)
                trace("conectar");

            }
            function onMicActivity(event:ActivityEvent):void
            {
                trace("activating=" + event.activating + ", activityLevel="
+
                    myMic.activityLevel);
            }

            function onMicStatus(event:StatusEvent):void
            {
                trace("status: level=" + event.level + ", code=" +
event.code);
            }

-- 
 ¿ Te gustan las *Abejas* y la *Tecnología* ? Sígueme en
Twitter<http://twitter.com/apilink><http://twitter.com/apilink>

  (\__/)
  (='.'=)   This is Bunny. Copy and paste bunny into your
  (")_(")   signature to help him gain world domination.