1

hello I want to save a loaded sound in FMS .

    public function Record()
    {
        nc.connect("rtmp://192.168.1.2:1935/videoRecorder");
        nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
        play_btn.visible = stop_btn.visible = start_btn.visible = false;
    }


    function netStatusHandler(event:NetStatusEvent):void
    {
        t1_txt.text = event.info.code;
        trace(event.info.code);
        switch (event.info.code)
        {
            case "NetConnection.Connect.Success" :
                connectStream();

                break;
            case "NetStream.Play.StreamNotFound" :
                //trace("Stream not found: " + videoURL);
                break;
        }
    }

    function connectStream()
    {
        ns = new NetStream(nc);
        var mic:Microphone = Microphone.getMicrophone();
        var cam:Camera = Camera.getCamera();
        if (cam)
        {
            cam.setMode(400,300,15,false);
            cam.setQuality(0,100);
            ns.attachAudio(mic);
            ns.attachCamera(cam);
            video.attachCamera(cam);
            video.height = 300;
            video.width = 400;
            addChild(video);
            start_btn.visible = true;
            start_btn.addEventListener(MouseEvent.MOUSE_UP,startRecord);
        }
        else
        {
            t1_txt.text = "No camera attached";
        }
    }

This is my code. But i need to save my loaded sound insted of mic . Is it possible?

harilalkm
  • 11
  • 2

1 Answers1

0

There is no way to attach a Sound to a NetStream. You can solve your issue in the following way:

  • remove the attachAudio part from your code
  • when the video recording is completed, use a web or FTP server to upload the sound file to FMS (there are no other ways to upload files to FMS).
  • play back the audio and the video at the same time (or you can mix them with FFMPEG)

Cheers

Tamas Gronas

Tamas Gronas
  • 573
  • 3
  • 8