In this video I am going to show you the basics of starting your first Red5 java application and we will use Flex to talk to the server and the server will keep track of a list of users that are logged in to the application. As soon as a user closes there browser or leaves the applications page the user will be removed from the applications list of users. This is really helpful for building applications where users are interacting with other users. This could be a Chat or Video application or even an online game where users can play against each other.
Before you can start you will need a couple of things installed. Eclipse with Flex Builder plugin, The Java EE development environment, and finally the Red5 Server Plugin for Eclipse. In the video I will explain a little bit about why you need this setup and where to go to get it but I will not cover installation at all.
I hope you guys enjoy and let me know if you have any questions.
Also included is the source files. Red5Tut.zip Red5TutClient.zip


Groovymag
hi
I finally managed to get the red5plugin working under winxp thanks to red5 mailing list : not as easy as macosx !
http://robsilverton.wordpress.com/2008/10/13/getting-up-and-nearly-running-with-the-red5-eclipse-plug-in/#comment-163
Now your application is working on my computer and thanks to your screencast, i understand all the code ! great work
jérôme
@g Thanks for the kind words. I have heard a lot of issues with getting things working on XP. OS X seams to be the way to go. I just wish that they would put out new releases to OS X at the same time as everything else.
Look for a new tutorial soon. I have learned some new stuff that will make the above tutorial work even better.
[...] Eclipse, though not the server itself, and not one of my own making. My attention was directed to this helpful post in which a video describes the basic process for setting up a Red5 project using the Eclipse [...]
[...] by the Plug-in doesn’t work when deployed on my PC, I’ve had to adapt the source of a simple example that was written on a [...]
[...] code automatically with the plugin, and started playing with simple examples that had been published on a mac. As you can imagine I was quite disappointed by this [...]
[...] recommend watching this video for instructions on how to create your first Red5 project, though you may want to skip the first 5 [...]
Hey Matthew,
Great video! Thanks for being so generous with your time. Looking forward to next in series.
Hey Matthew!
Great tutorial
I strongly encourage you to some more on the Red5 things, I’m just getting started developing Red5 apps and your tutorial really gave me a push!
Thanks
/ Reinholdt
@Reinholdt Thanks for the comment. I plan on updating this soon. Hoping by the end of Jan, so keep a look out!
dear matthew,
thanks for your great tutorial but i found some problem here.
i’m very much n00b at red5. and i’m using ubuntu intrepid and my red5 server is in /usr/lib/red5 , and the webroot folder is in /usr/lib/red5/webapps. i want to ask you how i make a put you tutorial source at webapps folder and when i run http://MyRed5Server:5080/ i keep getting error 404. i tried to download or follow other tutorial and when i put the folder at the webapps folder again i get the error 404. please tell me how to make this right.
thanks your very much for your video tutorial, it’s make me understand how red5 works. and hope you upload another great one.
@paktua I am glad that you found the tutorial helpful. I have learned a lot more about Red 5 in the last few months and plan on posting more vids soon.
As for your question I am sorry to say that I am not the guy to answer your question. I can get Red5 running on my local osx install and the production server linux stuff I leave up to my systems guy at work. I hope to learn more and know how to do all that soon but for now I am afraid the best thing you could do is post your question on the Red5 mailing list.
dear matthew
i’ve figure how solve my problem now (at lease i can browse the folder )! but again i’m facing a problem, i can’t follow your tutorial because i’m not using red5 plugin for eclipse,so i have some question :
1.how i put your tutorial that have a different structure like the usual red5 app in my server. like i know usually red5 app just have WEB-INF inside it not like your.
2.in my case the server and the client is at different computer. so i reach my server like this http://MyServerIp:5080/simpleapp , and how i reach it at the client , is it like rmtp://MyServerIp:5080/simpleapp or rmtp://MyServerIp/simpleapp. because both of it is not work.
and i’m sorry i keep on bugging you, because i dont met other people who understand newbie like me. i’m really sorry, and thank you very much man..
@paktua If you look above in the tutorial I have posted a link to download the compiled Red5 App from the tutorial. If you download and unzip and place in your apps directory it should work just fine.
Let me know. Thanks!
it works!! wow. this the first time red5 app work on my server. i’m really glad. thank you so much.
by the way, when you’ll post the next tutorial? i can’t wait
, err.if you don’t mind, would you post how to make a video conference.
again thank you so much matthew
Hey Mathew, this tutorial has really pushed me in the right direction, and I’ve gotten a basic one on one video chat working. However, it has only been able to work using localhost for the rtmp url. Say I have two computers (which I do) on the same network, one of them running red5. rtmp://localhost/myapp works fine, but I want to take it a step further and have another computer talk to red5 on the other. I put in rtmp://192.168.1.134:1935/myapp (which should be correct with the port 1935), and I get the error “Netconnection.Connect.InvalidApp”. To try and test the port, I use http://red5.nl/archives/port-tester. I tried using it with myapp, all ports failed. But just to see if it wasn’t my actual network connection, I used oflaDemo to test, and port 1935 was working correctly. I’m guessing that there is something else I need to set, but i haven’t a clue what at this time.
I’m using red5 v0.7 with the eclipse red5plugin v0.1 (just like in your tutorial).
On another note, when I compile and run with eclipse, I don’t get that webpage that comes up in eclipse, I just get HTTP ERROR:404 NOT_FOUND. I wonder if this could be the source of the problem.
fxkill,
Thanks for checking out my tutorial. First up let me address your last paragraph. The 404 is a common issue that comes up and I will say that it is not really that reliable. I have gotten the 404 before and I am able to connect to the app just fine witch is all we really care about anyway.
As for your other testing situation. I have done exactly what you where saying in my local testing before. I am not sure if you are on a Mac or not but if you are you have to go into your sys preferences and make sure that your system is set up in your network and your firewall is not blocking traffic I guess. This may be causing the issue.
Something that does seam out of place to me is the port number. In my testing I always got the machine’s ip and just pointed it to that using the rtmp prefix ( rtmp://192.168.1.134/myapp ) should work just fine.
I found out what I needed to change to get the ports working over a network. Within the document “red5-web.properties” in your src folder of your project, you need to change or add the servers ip address to webapp.virtualHosts. (you can also put in a web domain http://www.myfakewebsite.com)
eg.
webapp.contextPath=/myapp
webapp.virtualHosts=localhost, 127.0.0.1, 192.168.1.148
Compile it, works fine.
On one other note that had me running in circles using this tutorial as a starting point, you must pass a string value along with your connect.connect();
eg.
//does not work, server will reject you
connect.connect(“rtmp://localhost/red5tutorial”);
//works, connection to server will succeed
var user:String = “fxkill”;
connect.connect(“rtmp://localhost/red5tutorial”, user);
dear matthew,
i try to combine your script to get users webcam, a have a function to get the camera, and the databprovider is the user list, (mylist).
so what my problem is, when i try to get the camera from the user, the first user get only his cam, and the second one, will get two cam window, but both of it, shows the image from the second user camera,
i figure that in your code , the user list is not synchronize to the all user, the last get the full list, and the first is only get his username,is that the way it is ?
and what i want to ask is, how i synchronize the username list, because i need to get and send different camera to all user.
thank you
Matthew,
Great tutorial It really helped me in getting the Red5 plugin installed in eclipse. I’d be interested in seeing a simple how to for a video streaming app. I know the red5 demos has simple subscriber – but how would I do someting like tht from scratch? Any pointers would be helpful – I don’t really know flash or flex – just starting out (I do know java though).
@letapjar
So glad the tutorial could help you out. I do plan on doing another demo soon. As for any pointers…. If you know Java then Actionscript3 is not going to be a huge change for you at all in my openion. The look and feel a lot alike.
As for learning Red5 well that is always a challenge as for learning Red5… It is not a well documented server. They do have Java docs for the server but it does take some figuring out. My suggestion is you will just have to dig in and get your hands dirty and learn by trial and error. Also the Red5 mailing list is pretty helpful sometimes.
Matt,
Tremendously grateful that you took the time to do this…am chomping at the bit for the streaming installment. I set it up in my environment and most is good, but I’m hoping you might know why I can connect and I see the call invoked on the client, but when I call “getUserList” I get no response at all…not even a fault. I’m using WebORB, so it’s not apples to apples, but thought it was worth asking… Thanks again.
Just a quick follow up because I got it working…
All I had to do was add the object encoding:
connection.objectEncoding = ObjectEncoding.AMF0;
…and the server-side script was returned.
I simply cannot thank you enough for taking the time to do this.
Steven, Tanks so much for your kind words. I really enjoy sharing what I figure out when using Red5. I know a lot of you have been asking that I hurry up and do another Red5 tutorial. I promise that it is coming. I think I will get something added by the end of June.
Hang in there and please if you have something you would like to see done, drop me a line I will consider all requests.
Hi mr walace… you work is superb.. am totally impressed and would like to learn more about red5. am new to it…but have set up a few stuffs, simple enough. just wanted to know one thing… how do you secure a red5 application to accept connections from specific domains only ?
securing Red5 in this way does not really require any configuration to Red5. Rather I would suggest you think about using a crossdomain.xml policy. See the following link for more info. http://www.nabble.com/red5-security-crossdomain.xml-td22672006.html
Something else that I would suggest is remove any applications from the Red5 server that you are not using such as some of the demos and also when a user connects to your server I would also suggest that the Application requier some variables to be passed along with the connection such as user name and a session id or something that you can have Red5 check and authenticate against a database. If the variables don’t get passed then you can disconnect the user from the app.
sir … here is my application:
http://flashvisions.com/red5-showcase/voice-box-a-free-to-use-voice-sharing-application/
How would you suggest going for conn.getHost() / getRemoteHost() … or just crossdomain will do ?
Hey,
Great tutorials. I have used red 5 before years ago. I installed the red 5 plug in no problems back in the day. Im trying to intall the red 5 plug in with FDT 3 on a mac book pro. The plug in seems to be installed , but i can’t get it to work. Im getting a null pointer exception :
Could not publish to the server.
java.lang.NullPointerException
I havent been able to figure it out yet? I do know a little java and no real stranger to setting this all up. I am on a mac book pro. Do you have any suggestions?
@ludakris4 – wish I could be more helpful. Only thing I can tell you is I have found better success getting it up and running using straight up Eclipse and then install all the plugins that I need such as FDT, Flex, and Red5.
@Matthew::::Thanks, yeah, i’m struggling with it now. Im building a red 5 app, it would save me time if i can get this plug in installed. I have the FDT standalone, i bought a while ago. I have no idea where im going wrong with it.It doesnt copy the files to the server, or the server just doesnt start.
@ludakris4 – yeah I have never gotten the Red5 plugin working with a stand alone FDT or Flex Builder. They are missing to many things that the Red5 plugin needs. Lot of Java developer stuff that comes the Eclipse that the other stand alone IDE’s tend to leave out of their installations of Eclipse
@Matthew::::I guess i’ll try it with Eclipse Classic. I ran an update on my FDT standalone , to install stuff from the europa site, i thought it might work. Now its jsut says it’s not copying the files to the server. Its not seeing the red5.jar for some reason..