Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'll try my best to make the answer clearly.</p> <p><strong>1)</strong> When you connect to the server, how do you make it record audio from flash client?</p> <p>First of all, you need to know the connection between server and client used protocol like <a href="http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol" rel="nofollow">RTMP</a>. So in the server side, we need to setup our address like <code>rtmp://127.0.0.1/demoServer</code>(in red5 demoServer is your app name). Next in the Flash side, we can connect server by <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetConnection.html" rel="nofollow">NetConnection</a>:</p> <pre><code> import flash.net.NetConnection; public var nc:NetConnection; nc = new NetConnection(); nc.connect("rtmp://127.0.0.1/demoServer"); </code></pre> <p>I could definitely tell you, the 80% work are in the Flash-Client side. In order to capture voice, we need setup our <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Microphone.html" rel="nofollow">Microphone</a>:</p> <pre><code> import flash.media.Microphone; public var mic:Microphone; mic = Microphone.getMicrophone(); </code></pre> <p>After that we need a pipe to transport voice captured form microphone. Fortunately we have <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html" rel="nofollow">NetStream</a>:</p> <pre><code> import flash.net.NetStream; private var stream:NetStream; var sm:NetStream=new NetStream(nc); stream.attachAudio(mic); </code></pre> <p>The connection just like building a bridge so that stream can carry stuff form client to server. OK, the last thing wo need to do is <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#publish%28%29" rel="nofollow">publish</a>:</p> <pre><code> stream.publish("some name","record"); </code></pre> <p>Now, you can see a .flv file named <code>some name</code> in the server side. This file will get bigger if you have opened microphone.</p> <p><strong>2)</strong> After 30 secs, how do you stop recording and save file in a specific folder on a server?</p> <p>Create a 30 secs timer that begins at recording. Closing the stream When time out:</p> <pre><code> import flash.utils.Timer; t = new Timer(1000, 30); t.addEventListener(TimerEvent.TIMER_COMPLETE, timerComplete); private function timerComplete(event:TimerEvent):void{ //close the stream stream.close(); mic.setSilenceLevel(0); } </code></pre> <p>By default, red5 will save file in <code>\webapps\dictRed5Server\streams</code>. If you want to change this, check this <a href="http://www.red5tutorials.net/index.php/Tutorials%3aStreaming_from_custom_directories" rel="nofollow">guide</a>.</p> <p><strong>3)</strong> How do I move this file to the server's HTTP folder, so that I could access it from homepage after that?</p> <p>Red5 can work together with apache tomcat and you can use a flv player to play those records.</p> <p>I hope above snippets can help you. I suggest to you that can install red5 and run some demos and google what you do not understand.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload