Showing newest 7 of 10 posts from June 2009. Show older posts
Showing newest 7 of 10 posts from June 2009. Show older posts

Friday, June 26, 2009

What streaming protocols do Red5, FMS, and Wowza support?

In case you were wondering, as I was, what the state of the various servers are with regard to the various streaming protocols, here is a list of the streaming protocols supported by the popular media servers as of June 2009:




For quick reference, here is a short explanation of the RTMP variants:
  • rtmp, the basic tcp-based streaming transport
  • rtmpt, rtmp tunneled over http
  • rtmps, rtmpt over ssl
  • rtmpe, adobe's custom ssl-like encryption
  • rtmpte, rtmpe with adobe encryption
  • rtmfp, udp based peer to peer protocol, actually completely different.

Saturday, June 20, 2009

Developing Your First Red5 Application

Background


Creating the most basic of server applications in Red5 is pretty easy. In fact, we're not going to write any code at all. We're going to take advantage of the Red5 Application Generation built into the Red5 Plugin to do all the work for us.

Prerequisites


You will need the complete Red5 user development environment.

Generating your project


Let's get started.

  1. Launch Eclipse. You should be in the Java EE perspective, and the Project Explorer view should be opened.
  2. Right click in the Project Explorer view and choose New -> Dynamic Web Project

  3. In the New Dynamic Web Project panel, enter a Project Name of "SimpleRed5Project".
  4. In the Configuration section, click on the Modify button
  5. In the Project Facets panel that appears, check the box next to Red5 Application Generation, then click the OK button.
  6. Click on the Finish button
  7. In the Package Explorer view you should now see two new projects: SimpleRed5Project and SimpleRed5ProjectClient. Believe it or not, but these are fully functional server and client applications! As far as development is concerned, we're done. Let's take a quick look at what was just generated.

What was generated


We have two projects, SimpleRed5Project and SimpleRed5ProjectClient. Examine the SimpleRed5Project server-side project first. Navigate through the project tree to familiarize yourself with the layout.


In the server project, the main things you should focus on are Application.java, which is the core of our new server application, and the contents of WEB-INF. Application.java is actually more complicated than it needs to be for a trivial example. If you wanted to, you could not define any methods at all. Merely extending ApplicationAdapter would be sufficient to have a working -- and quite useful -- server application.

Under WEB-INF you'll see files: red5-web.properties, red5-web.xml, and web.xml. If you've done Tomcat work before then web.xml should look vaguely familiar. The file red5-web.xml is where the Spring configuration for our application is located.

Over in the SimpleRed5ProjectClient project, there is a single source file for the application. If you're familiar with Flex client development then this should be easy to understand, even if you haven't used the NetConnection API before. If you are new to Flex and/or AS3, you should familiarize yourself with Flex after finishing this guide.

In the future you'll learn what each part of these files mean. For now it will be more fulfilling to see the projects in action, so let's give this a test.

Testing your projects

  1. First, we need to deploy your application to the Red5 server instance. Select the SimpleRed5Project project, right click on it, and choose Debug as -> Debug on Server
  2. Since this is the first time running the server application, Eclipse will prompt us under which server runtime we wish to run the application. Let's choose the Red5 Server Runtime and check the box next to "Always use this server when running this project", and then click the Finish button.
  3. Eclipse should then deploy your application to Red5 and start up the server. Remember, if you can an error message that the port is already in use, don't panic. Just stop the server (even it appears stopped) and try to do a debug run of the application again.
  4. Once the server application is running, the Server view should look like this:

  5. In the Project Explorer view, right click on the SimpleRed5ProjectClient, and choose Debug As -> Flex Application
  6. Eclipse should launch your default web browser, and if things went right you should see the following Alert dialog:
That's all there is to it. Now that you can generate Red5 server and client applications, you're ready to start learning what you can do with it.

Creating a Red5 User Development Environment

Background

Red5 is a hard product to describe because while its main target market is fairly well defined, its capabilities are numerous because of the powerful open source technologies its built on. It's probably most accurate to describe it as packaged server stack whose main goal is to provide remote services for Flash and Flex clients. The main services implement the server-side of the Flash remoting and streaming APIs, but through these nearly any type of service can be exposed to the client.

Notes

This article is intended to get you setup with an environment in which you can develop applications - both server and client side - for the Red5 application server. It is NOT meant to set you up to make modifications to the Red5 server code itself, although there are only a few additional steps you need in order to do that.

It is assumed that you will want to write server applications in Java and client applications in Flex using the Flex Builder plugin for Eclipse.. There are other options; you could write server code in a number of scripting languages that run in the JVM, and you could write client applications in Flash using AS2 or AS3 or the open source Flex SDK. These other options are not covered by this guide.

Prerequisites

  1. You should have Java 5 installed and configured as your default JVM.
  2. You should have Java 6 available to you (requires 64-bit Mac OS X 10.5 or higher, Windows etc.)

Installation & Configuration

  1. Install Eclipse 3.4.2 JEE edition. We'll be using Eclipse + the Flex Builder plugin rather than the standalone Flex Builder since it comes with more of the plugins we need by default. If you already have the standalone Flex Builder, it doesn't hurt to install Eclipse somewhere else.
  2. Install Subclipse 1.6. Subclipse will let us check out code from source code repositories on the 'net.
  3. Install the Flex Builder plugin for Eclipse.
  4. Install the Red5 Server.
  5. Install the Red5 plugin for Eclipse.
  6. Set your default JVM to Java 6 (Mac OS X instructions).
  7. Configure the Red5 plugin.

Friday, June 19, 2009

Configuring the Red5 Plugin for Eclipse

Prerequisites

  1. Eclipse 3.4.2 installed
  2. Red5 plugin 0.2 installed
  3. Red5 server installed
  4. Java 6, as the default JVM on your system. If you cannot make it the default, you can still run Red5 on your system so long as you modify the startup and shutdown scripts to use Java 6.

Notes


If you are following the instructions to setup a Red5 User Development Environment, at this point you have the plugin installed, but you still need to configure it to use your particular Red5 server.

Configuration

  1. Launch Eclipse.
  2. From the Java EE perspective, choose the Servers view. If you can't find the view, open it with Window -> Show View -> Servers.
  3. Since we haven't added any servers yet, the view is blank. Right click on the background of the Server view and choose New -> Server.

  4. In the New Server dialog box that appears, scroll down in the server type list to Infrared5 and expand it by clicking on the triangle to the left of it. Select "Red5 Server Runtime" and click Next.
  5. On the next panel, we immediately see an error message: "Missing classpath entry /Applications/Red5/red5.jar".
    If you see this, great! It means you're following along with the instructions. What we want to do first is select the correct JRE to run Red5 under. From the JRE pulldown, choose JVM 1.6. [If there is no option for JVM 1.6, one of four things is true: (a) your system is not up to date (this requires OS X 10.5 + updates) (b) your system doesn't support Java 6 (requires a 64bit cpu), (c) you aren't running Mac OS X and should be using different directions, or (d) you should select the link above the JRE pulldown for "Installed JRE preferences" to create an entry for Java 6. ]
  6. On the same panel we now have to replace the /Applications/Red5 directory with the correct path to the Red5 server folder. Following the guide to Installing Red5 Server, the new value should be /Applications/red5-0.8.0. After making the change, click the Next button.

  7. On the next panel we're faced with another error. Luckily the answer is to do the same thing we did in the last step: replace /Applications/Red5 with the location we installed Red5 in. When you're done, click the Finish button.


  8. You should see a shiny new "Red5 Server Runtime at localhost" entry in the Servers view.
  9. Congratulations! You now have the Red5 Plugin configured and your server should be ready to use.

Testing your installation


You can now start and stop the server from the "Server" view in the Java EE perspective by right clicking on the Red5 Server Runtime and choosing Start (or Debug) and Stop. In the future, once you've configured your applications to run on the server, any changes you make to your server applications should automatically publish to your Red5 installation folder. In most cases the webapp(s) will be reloaded automatically and you can run your client applications to test them.

To start your server, right click on the "Red5 Server Runtime" and choose Start. (If you get an error message that the port is in use, Stop the server, then choose Start again). You should see some log messages scroll by in the Console view:



Followed by Eclipse returning to the Servers view and showing the server with a status of "Synchronized".



If you made it this far, wonderful! It looks like your server is now running from Eclipse. You're now ready to develop server-side applications in Red5!

Installing the Red5Plugin on Mac OS X

Background

The Red5Plugin is an Eclipse plugin to facilitate developing Red5 applications. Once configured correctly, it enables you to start and stop the server easily and create projects from templates.

Prerequisites

  • A Red5 server installation, version 0.8 (final release)
  • An Eclipse installation, version 3.4.2
  • Java 5 for installation. For now, this should be your default JVM.
  • After the installation is complete, you will need Java 6 to run Red5. (For Mac OS X systems, you will need to be running 10.5 and be up to date in order to use Java 6. Note that Java 6 requires a 64-bit processor on the Intel platform. The early intel iMac and the MacBook used 32-bit Core processors, so you can't run Java 6 if you have one of these. It's supposedly possible to run Red5 under Java 5, but you're on your own for that).

Installation

To install the Red5 eclipse plugin, you were previously able to follow these directions:

http://jira.red5.org/confluence/display/tools/Installation

However, the Red5 team is in the process of converting their jira/confluence installation to trac, which means the instructions are currently offline (as of this writing).

In the meantime, the following instructions should get you started with the plugin.

  1. First, launch Eclipse if it isn't already running.

  2. The plugin is installed like any other Eclipse update through the Software Updates menu. Go to Help -> Software Updates

  3. Click on the Available Software tab
  4. Click on the Add Site button
  5. For the location, enter http://www.red5.org/projects/red5plugin/update_0.2.x/. If this doesn't work, you can try http://209.20.83.79/projects/red5plugin/update_0.2.x/, which is an alternative location set up by the Red5 team when the main site was previously offline. Then click OK.

  6. Select the features made available by this update site "Red5 Feature"
  7. Click the Install button

  8. At the following screen, confirm the feature by clicking Next.
  9. Agree to the license agreement and click Finish.

  10. You are now prompted to restart Eclipse. This is a good idea, so choose Yes.
  11. Congratulations! You now have the plugin installed. However, there is still some work left to do before you can use the server from within Eclipse. That will be covered in a followup article.

Thursday, June 18, 2009

Installing the Red5 Server on Mac OS X

Notes


The following instructions were written with a Mac OS X system in mind. If you are using a different system the instructions will vary slightly.

These instructions were written while the Red5 wiki was offline and the regular download location unavailable, so the screenshots will show the IP address rather than a DNS name.

Prerequisites


  1. Java 6, to run Red5. If you are a Mac OS X user on the Intel platform, if you have a 64bit cpu and are running 10.5 (Leopard) or higher and are up to date, you should already have this.
  2. Java 5, as your default JVM if you are going to be installing the Red5Plugin for Eclipse next.

Installation

  1. Go over to the Red5 project page at google code: http://code.google.com/p/red5/
  2. Ignore the "Latest Official Release" link, as it currently 404s.
  3. Instead, under the "Installers" heading click on the link for "Tarball" and save the .tar.gz file.
  4. Locate the red5-0.8.0.tar.gz file you just downloaded (probably on your Desktop or in your Downloads folder).

  5. Double click on the file. Archive Utility should launch and uncompress the archive.

  6. There should now be a red-0.8.0 folder in the same folder as the archive:
  7. Move this folder to your /Applications directory
  8. Congratulations! It really was that simple. If you plan on using the Red5 Plugin for Eclipse, its best not to try to launch the server just yet and instead move on to installation of the plugin.

Wednesday, June 17, 2009

Installing the Flex Builder Plugin 3.x Walkthrough

Background


To develop client-side applications in Flex, the best tool to use is Flex Builder. Flex Builder is available as either a standalone application or an Eclipse plugin. In this walkthrough we'll be installing the plugin version.

The following walkthrough was written for Mac OS X. The instructions should work with minor modifications on Windows and other platforms.

Prerequisites

  1. Java 5, set as your default JVM (The current Flex Builder plugin does not install correctly when Java 6 is the default).
  2. Eclipse 3.4.2

Installation

  1. Head over to the Flex Builder download page and download the Flex Builder plugin for Eclipse. Make sure you grab the Eclipse plugin version - not the first option - to avoid having to download two large files instead of one!

    Note that for Flex 4, Flex Builder has been renamed Flash Builder, so the download page and links will likely be different.
  2. If you are on Mac OS X, you just download a disk image. Mount the disk image.
  3. Now run the installer. It should be named FB_Plugin_Mac_Installer.
  4. Mac OS X will warn you that this application was downloaded from the Internet. That's OK, so click Open.
  5. The installer will prompt you for your language. Select what you want to use click OK.
  6. Click next at the Introduction panel
  7. Select the radio button next to "I accept" and click Next
  8. At the Choose Install Folder panel, you can accept the default location. In my case I already have Flex Builder installed, so I will choose an alternative location named "Adobe Flex Builder 3 Plug-in Test". Then click Next.
  9. At the Choose Eclipse Folder panel, click the Choose button and navigate to your Eclipse folder. In the "Installing Eclipse 3.4.2" walkthrough we installed into /Applications/eclipse-3.4.2, so I've selected this folder. Then click Next.
  10. At the Additional Installations panel, it is suggested that you also install JSEclipse if you will be doing any JavaScript development (e.g. an HTML-based AIR application). After you've made your decision, click Next.
  11. Now the installer will ask that you close all browser windows so that it can install the Flash debugging player during the install process. You'll probably be OK on your own past this point, but you can take notes before you quit if you want to. When you're ready, close any browser windows, return to the installer, and click OK.
  12. You should now see the Pre-Installation Summary panel. Click Install.
  13. When the installation is complete, you should see the following Install Complete panel.
  14. Congratulations! You've now installed the Flex Builder plugin for Eclipse.