2 Replies Latest reply on Dec 26, 2011 9:52 PM by Burnt_Li

    With the function "getEnhancedMicrophone",play will go wrong?

    Burnt_Li

      I want to write a program can pull the rtmp stream from FMS or push to FMS,something like video conference system.

      At first,the program play normally.

      But when I use the function "getEnhancedMicrophone" to get a microphone,it will go wrong.

      The voice pauses from time to time.

      Actually,I only get the microphone and havn't used it.

       

      Here is part of my codes:

       

       

                     import mx.controls.Alert;

       

                                    private var nc:NetConnection;

                                    private var ns:NetStream;

                                    private var video_Pull:Video=new Video();

                                    private var pullStreamName:String="c01";

       

                                    private var mic:Microphone=new Microphone();

       

                                    private function init():void

                                    {

                                              nc = new NetConnection();

                                              nc.objectEncoding = ObjectEncoding.AMF0;

                                              nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);

                                              nc.client=this;

       

                                              nc.connect("rtmp://localhost/live");

       

                                              //add this line will go wrong

                                              //mic=Microphone.getEnhancedMicrophone();

                                    }

       

                                    public function onBWDone():void{};

       

                                    private function netStatusHandler(evt:NetStatusEvent):void

                                    {

                                              if(evt.info.code=="NetConnection.Connect.Success")

                                                        pullRTMP(nc,ns,video_Pull,vd_Main,pullStreamName);

                                              else

                                                        Alert.show(evt.info.code);

                                    }

       

                                    private function pullRTMP(netConnect:NetConnection,netStream:NetStream,video:Video,videoDisplay:VideoDispl ay,streamName:String):void

                                    {

                                              netStream = new NetStream(netConnect,"connectToFMS");

                                              video.attachNetStream(netStream);

                                              video.smoothing=true;

                                              video.width=videoDisplay.width;

                                              video.height=videoDisplay.height;

                                              videoDisplay.addChild(video);

                                              netStream.play(streamName);

       

                                              var clientobj:Object=new Object();

                                              clientobj.onMetaData=function():void{}

                                              netStream.client=clientobj;

                                    }

       

       

      I use Flash Builder 4.5 and Air 3.1.

      This problem had puzzled me few days,someone for help?

       

      Thanks for replies!