« Return to Thread: Audio Problem

Re: Audio Problem

by Dominick Accattato-2 :: Rate this Message:

Reply to Author | View in Thread

You can try the following:

1. speak directly in the mic and wait 30 seconds.  Check the file size and you will notice that it does not show 0kb.
2. start the application but do not make a noise.  Wait 30 seconds.  The file size will be 0kb. 

Flash doesn't send any data until it hears the first bit of audio.  Let me know if you find similar results.


On Mon, Jul 6, 2009 at 6:24 PM, Svacha <sketisculpter@...> wrote:

Hi.  I am testing a very simple audio component built in Flex and am running
into an issue with the recording stopping too soon.  Sometimes the recorded
audio is blank (0 kb) other times it cuts out portions of the audio or stops
prematurely.  I am testing on a MacBook, running Red5 v. 0.7  Can anyone
provide any insight on what might be causing this?  Here is the Flex code:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="215"
height="138" creationComplete="init()">
<mx:Script>
       <![CDATA[
               import flash.media.Microphone;
               import flash.events.ActivityEvent;

               private var connection:NetConnection;
               private var stream:NetStream;

               private function init():void
               {
                       connection = new NetConnection();
                       NetConnection.prototype.onBWDone = function(args) {
                       }

                       connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                       connection.connect("rtmp://localhost/oflaDemo");
               }

      private function netStatusHandler(event:NetStatusEvent):void {
           switch (event.info.code) {
               case "NetConnection.Connect.Success":
                                       recButton.enabled = true;
               break;
           }
       }

               private function recordAudio():void
               {
                       var mic:Microphone = Microphone.getMicrophone();
                       mic.setLoopBack(false);
                       mic.rate = 44;

                       stream = new NetStream(connection);
                       stream.attachAudio(Microphone.getMicrophone());
                       stream.publish("Earshow_" + Math.random(), "record");

                       recButton.enabled = false;

                       stopButton.enabled = true;
               }

               private function stopRec():void
               {
                       stream.close();

                       recButton.enabled = true;

                       stopButton.enabled = false;
               }
       ]]>
</mx:Script>
<mx:Button  x="10" y="10" label="Record" id="recButton"
click="recordAudio()" enabled="false"/>
<mx:Button  x="84" y="10" label="Stop" id="stopButton" click="stopRec()"
enabled="false"/>
</mx:Canvas>

--
View this message in context: http://www.nabble.com/Audio-Problem-tp24363897p24363897.html
Sent from the Red5 - English mailing list archive at Nabble.com.


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org


_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org

 « Return to Thread: Audio Problem