# FMS save stream in FMS directory

**URL:** <https://forum.kirupa.com/t/fms-save-stream-in-fms-directory/325909>\
**Category:** flash\
**Created:** [November 11, 2011, 10:53am UTC](https://forum.kirupa.com/t/fms-save-stream-in-fms-directory/325909 "2011-11-11T10:53:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fikontrollet](https://avatars.discourse-cdn.com/v4/letter/f/35a633/32.png) [@fikontrollet](https://forum.kirupa.com/u/fikontrollet)\
**Post date:** [November 11, 2011, 10:53am UTC](https://forum.kirupa.com/t/fms-save-stream-in-fms-directory/325909/1 "2011-11-11T10:53:48Z")

</div>

Hey  
Figured it was about time i learned FMS and already i have gotten myself into quite a mess.  
What i’m trying to do is record video and audio and store it on my FMS.

I can see my client conneced to the server. I can see the bandwidth going up and i can see the stream in the Administration Console. However, when I close the stream, nothing is saved.  
Could someone point me in the right direction?

What my console looks like and my code:  
(the name set in publish is Math.random(), hence the funny name)  
EDIT: sorry for the messy code, the form messed up everything.

```php

private var $start:Sprite;       
private var $stop:Sprite;                
private var $nc:NetConnection;       
private var $ns:NetStream;                

public function Main() {            
this.stage.scaleMode = StageScaleMode.NO_SCALE; this.stage.align = StageAlign.TOP_LEFT;                       
this.$nc = new NetConnection(); this.$nc.addEventListener(NetStatusEvent.NET_STATUS,onConnectionStatus);           
this.$nc.connect("rtmp://localhost:1935/RecordStream/");        
}
private function onConnectionStatus(e : NetStatusEvent) : void {
if(!this.$nc.connected) return;                        
this.$start = new Sprite();           
this.$start.graphics.beginFill(0x00ff00);
this.$start.graphics.drawRect(0, 0, 40, 20);           
this.$start.graphics.endFill();            
this.$start.addEventListener(MouseEvent.CLICK, this.onStart)           
this.addChild(this.$start);                        
this.$stop = new Sprite();            
this.$stop.graphics.beginFill(0xff0000);            
this.$stop.graphics.drawRect(40, 0, 40, 20);            
this.$stop.graphics.endFill();            
this.$stop.addEventListener(MouseEvent.CLICK, this.onStop);        
this.addChild(this.$stop);                       
this.$ns = new NetStream(this.$nc);            
this.$ns.addEventListener(NetStatusEvent.NET_STATUS, this.onStreamStatus);

var mic:Microphone = Microphone.getMicrophone();            
var cam:Camera = Camera.getCamera();            
this.$ns.attachAudio(mic);            
this.$ns.attachCamera(cam);                
}
private function onStreamStatus(e : NetStatusEvent) : void {            
trace(e.info.code);        
}
private function onStart(e : MouseEvent) : void {
trace(" - start");            
this.$ns.publish((Math.random().toString()), "record");        
}        
private function onStop(e : MouseEvent) : void {            
trace(" - stop");            
this.$ns.close();        
}

```
