Setting Up Flash Media Server Developer Edition For Newbs

A couple of weeks ago I had the honor of doing a little Flash Media Server work for the first time in my life. I had never worked with FMS nor did I know a lick about it, but I Googled it to a frenzy and found some useful little things. Without having access to Flash Media Server, which will cost you an arm and a leg, you can download the free developer edition to test your stuff locally. I normally work on a Mac but I had to do this on my PC laptop as I'm not very good with server-side stuff and I don't know how to run FMS developer edition on the Mac. Keep in mind, this is for newbies only and probably not the way that an FMS pro would set up their work, but this served me well in my trials and tribulations.

Anyway, you can grab the developer edition here. After you've got it downloaded, go ahead and go through the installation. The default installation directory is located at C:\Program Files\Macromedia\Flash Media Server 2. In there you will find an applications folder which is where all your projects will sit (and by projects I mean your .FLV file streams as you can put your working FLA anywhere on your computer).

The first thing you should do is create a folder inside of the applications folder that will hold your videos. I cleverly titled mine "videos". Inside of the videos folder, lets create a "streams" folder. This streams folder is the key as this is where your files will sit. Without this folder, nothing will function properly. GUARD IT WITH YOUR LIFE! Inside of the streams folder, I then created a folder for my actual streams to go into. I named mine "fmstest". Finally, in the fmstest folder, I have my FLV file, let's call it "dance.flv".

Now, to play this file, you'll need to establish a connection to the server. You'd do so like this:

Actionscript:
  1. var nc:NetConnection = new NetConnection();
  2. var ns:NetStream = new NetStream(nc);
  3.  
  4. vid.attachVideo(ns);
  5.  
  6. nc.onStatus = function($info:Object):Void
  7. {
  8.     if ($info.code == "NetConnection.Connect.Success")
  9.     {
  10.         playStream();
  11.     }
  12. };
  13.  
  14. function playStream():Void
  15. {
  16.     ns.play("dance");
  17. }
  18.  
  19. nc.connect("rtmp://localhost/videos/fmstest");

We have a couple of things to note here. The first thing to make sure of is that you have a video object on the stage with an instance name of "vid". This is the object we'll use to load our movie into.

The second is to note the path that you're connecting to in the NetConnection. I'm using localhost because we are running this locally, but you would replace this with whatever the IP or address would be to your server. Also in the path, notice that I do not define my applications folder. FMS will know that your files are in the applications folder by default. Lastly, the path avoids the streams folder. I've still yet to figure out why you don't need to define the streams folder in the connection path, but that's how it works and I wasn't about to question it. 🙂

Also note that when you write the filename of the file you are going to play, you do not add the .flv extension. Again, something that works and I have no explanation for.

This is the barebones that you need to run the video locally through FMS. I also found this Flash Media Server Eclipse plugin but I found it after I had finished up my FMS experiments and have yet to use it so use at your own risk.

I really wish I could offer more help on FMS but unfortunately my knowledge is limited to only the tests I have run. If you'd like some more information, two resources to research that were vital in my own experiments would be the "Ask an FMS Guru" series and FlashComGuru. Good luck!

If you found this post useful, please consider leaving a comment, subscribing to the feed, or making a small donation.

1 Comment

[...] assumes that you have an "audiotest" folder in your "applications" folder in FMS (refer to the tip here to see how to set up your file structure). Inside of that folder you have your "streams" folder and [...]

Leave a comment

(required)

(required)