« Return to Thread: Audio Problem
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
« Return to Thread: Audio Problem
| Free embeddable forum powered by Nabble | Forum Help |