Skip to main content
Participant
May 4, 2009
Question

microphone sound recording,saving,playing flv file is saved but not working

  • May 4, 2009
  • 1 reply
  • 696 views

Please help me,

          While recording the flv is saved inside applications/stream/samples/audio.flv. But it is not working properly.

Mycode

stop();   
 
      var count:Number          = 0;
 
      var timestamp:Date    = new Date();
 
      var nc:NetConnection       = new NetConnection();
      nc.connect("rtmp://localhost/audiotest/samples");
      var ns:NetStream          = new NetStream(nc);
        ns.setBufferTime(2);
      var mic:Microphone    = Microphone.get();
      mic.setRate(22);

      ns.attachAudio(mic);
      ns.onStatus = function($info:Object):Void
      {
          trace($info.code);
      };
      // record the audio to the stream
      function recordAudio():Void
      {
          var fileName:String = String(timestamp.getTime() + (count++));
       ns.publish(fileName, "record");
      }
      // stop the recording of audio to the stream
      function stopRecordingAudio():Void
      {
          ns.publish(false);
      }
      
      // plays back the audio that was recorded
      function playRecordedAudio():Void
      {
          ns.play(currentFileName);
      }
      
      // record button
      recordBtn_mc.onRelease = function():Void
      {
          recordAudio();
      };
      
      // stop button
      stopBtn_mc.onRelease = function():Void
      {
          stopRecordingAudio();
      };
      
      // play button
      playBtn_mc.onRelease = function():Void
      {
          playRecordedAudio();
      };

    This topic has been closed for replies.

    1 reply

    ghost31379
    Inspiring
    May 4, 2009

    Try changing the fileName:String to a simpler string name like "myAudio"....then try playing it.....if it works doing that....then the issue is with you converting that date variable to a string.......and if thats the problem try converting the value with   .toString() seperately and adding