Hi, i've got a problem with my flash recorder. I've made a recorder with Flex using Red5.
If I record something in Windows, the flv file is recorded and the quality is good, but if I try to record it with Linux (Debian Sarge) the FLV file is created and recorded, but when I play it the voice is so acute, like a Smurf. I can't find the problem, i try to record with diferent linux versions and computers, but the problem persists. Somebody have any idea? Thanks. The MXML code: --------------------------------------------------------------------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()" width="323" height="160"> <mx:Script> <![CDATA[ [Bindable] private var labelString:String; import flash.media.*; import flash.net.*; import flash.events.*; import flash.utils.*; import flash.net.navigateToURL; import flash.external.*; NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0; SharedObject.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0; private var client_nc:NetConnection; private var out_ns:NetStream; private var in_ns:NetStream; private var my_mic:Microphone; private var audio_pause:Boolean; private var rec_so:SharedObject; private var anyContent:Boolean; private var audioDir:String; private var red5Host:String; private var red5Port:String; public function updateInfo(time:uint):void { if (ExternalInterface.available) { ExternalInterface.call("updateInfo", time); } } public function setAudioFilename(audioFilename:String):void { if (ExternalInterface.available) { ExternalInterface.call("setAudioFilename", audioFilename); } } public function checkBlankAudio():Boolean { if ((ExternalInterface.available) && (anyContent)) { return true; } else { return false; } } public function init():void { ExternalInterface.addCallback("noAudio",checkBlankAudio); audioDir = Application.application.parameters.audioDir; red5Host = Application.application.parameters.red5Host; red5Port = Application.application.parameters.red5Port; anyContent = false; // Create a connection client_nc = new NetConnection(); // Connect to the application client_nc.connect("rtmp://" + red5Host + ":" + red5Port + "/recording"); // add listener for the netStatus events client_nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus); client_nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, netSecurityError); // Create a remote shared object rec_so = SharedObject.getRemote("recordings", client_nc.uri, false); // Connect to the shared object rec_so.connect(client_nc); audio_pause = false; NetStream.prototype.onMetaData = function(obj){} } private function netStatus(event:NetStatusEvent):void { trace("netStatus: " + event); var info:Object = event.info; trace(info.code); switch(info.code) { case "NetConnection.Connect.Success": // Close and recreate streams if (in_ns) in_ns.close(); if (out_ns) out_ns.close(); in_ns = new NetStream(client_nc); out_ns = new NetStream(client_nc); in_ns.addEventListener(NetStatusEvent.NET_STATUS, inStreamState); break; case "NetConnection.Connect.Closed": if (in_ns) in_ns.close(); if (out_ns) out_ns.close(); break; } } private function inStreamState(event:NetStatusEvent):void{ var info:Object = event.info; // NetStream.Pause.Notify //if ((info.code == "NetStream.Play.Stop") || (info.code == "NetStream.Play.Start")) if (info.code == "NetStream.Play.Stop") //if (info.code == "NetStream.Buffer.Flush") { RecStop_btn.enabled = true; RecStop_btn.label = "Rec"; PlayPause_btn.enabled = true; PlayPause_btn.label = "Play"; audio_pause = false; } } private function netSecurityError(event:SecurityErrorEvent):void { trace("netSecurityError: " + event); } private function playAudio():void { if (audio_pause) { in_ns.resume(); estat.text = "*Playing..."; audio_pause = false; } else { // Play the recording estat.text = "Playing..."; if (in_ns) in_ns.close(); in_ns = new NetStream(client_nc); in_ns.addEventListener(NetStatusEvent.NET_STATUS, inStreamState); in_ns.play(rec_so.data.filename); estat.text = "Playing..."; } // It's not possible recording or save while audio is playing PlayPause_btn.enabled = true; PlayPause_btn.label = "Pause"; RecStop_btn.enabled = true; RecStop_btn.label = "Stop"; } private function pauseAudio():void { //in_ns.togglePause(); in_ns.pause(); estat.text = "Paused"; audio_pause = true; // It's possible recording or save while audio is paused RecStop_btn.enabled = true; RecStop_btn.label = "Rec"; PlayPause_btn.enabled = true; PlayPause_btn.label = "Play"; } private function recAudio():void { var d:Date = new Date(); estat.text = "Recording..." anyContent = true; // Start publishing the audio output as a recorded stream my_mic = Microphone.getMicrophone(); out_ns.attachAudio(my_mic); var audioFilename:String = "audio-"+d.getTime().toString(); setAudioFilename(audioFilename); rec_so.data.filename = audioDir + "/" + audioFilename; // Publish the stream out_ns.publish(rec_so.data.filename, "record"); // It's not possible playing audio while recording RecStop_btn.enabled = true; RecStop_btn.label = "Stop"; PlayPause_btn.enabled = false; PlayPause_btn.label = "Play"; } private function stopAudio():void { updateInfo (out_ns.time); estat.text = "Stopped "; // Close output stream out_ns.close(); // bytes // estat.text = "Stopped" // It's not possible playing audio while recording RecStop_btn.enabled = true; RecStop_btn.label = "Rec"; PlayPause_btn.enabled = true; PlayPause_btn.label = "Play"; } private function recStopAudio():void { if (RecStop_btn.label == "Rec") recAudio(); else stopAudio(); } private function playPauseAudio():void{ estat.text = 'playPauseAudio' + PlayPause_btn.label; switch (PlayPause_btn.label) { case "Play" : playAudio(); break; case "Pause" : pauseAudio(); break; } } ]]> </mx:Script> <mx:Panel x="0" y="0" width="323" height="160" layout="absolute" title="Reproductor"> <mx:Button x="10" y="83" label="Rec" click="recStopAudio();" id="RecStop_btn" width="65" fillColors="[#ca0000, #ffffff]"/> <mx:Button x="82" y="83" label="Play" click="playPauseAudio();" id="PlayPause_btn" width="65" fillColors="[#008080, #ffffff]"/> <mx:Label x="28" y="23" text="Estat:" width="47" fontWeight="bold" fontStyle="italic"/> <mx:Label x="75.5" y="23" id="estat" width="152"/> <mx:Image x="259" y="4" width="37" height="36" alpha="1.0"> <mx:source>woices_i.png</mx:source> </mx:Image> <mx:Label x="28" y="43" text="NetStream:" width="73" fontWeight="bold" fontStyle="italic"/> <mx:Label x="99" y="43" id="notify" width="152"/> </mx:Panel> </mx:Application> --------------------------------------------------------------------------------------------------------------------------------- _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
