By default or so I’ve been told, the Flash Player will try various ports when attempting to connect to a resource. In Red5, RTMP is supported out-of-the-box on the default RTMP port of 1935 and HTTP is setup on 5080. A “special” server is started on 8088 as well to handle RTMPT only requests, but this requires that you set your request url as “rtmpt://myserver:8088/myapp/” which can be confusing and completely ignores the Flash Player port probing. So I offer this solution, allowing you to setup HTTP on port 80 and RTMPT on port 80 as well. Since Red5 includes a servlet container (Tomcat by default), you have a full-fledged HTTP server and servlet engine built-in; allowing a servlet to answer the RTMPT requests.
The first file we need to modify is the server properties file located in the conf directory:
red5/conf/red5.properties
The last file to modify will be your web application configuration or “web.xml” file. The web application configuration file will be located here: red5/webapps/myapp/WEB-INF/web.xml if your application name is “myapp”. Add these entries:
<servlet>
<servlet-name>rtmpt</servlet-name>
<servlet-class>org.red5.server.net.rtmpt.RTMPTServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/fcs/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/open/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/close/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/send/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/idle/*</url-pattern>
</servlet-mapping>
Informational links about FlashPlayer and ports:
HTTP Tunneling protocols
Tags: Actionscript, flash player, fms, http, Red5, rtmpt, tomcat, webapp
RTMPTServlet requires handler and connectionManager to be set from Spring context. But how it’s wired in web.xml?
I have change http.port, and modify the web.xml in myapp/WEBINF folder.
Red5 start, but streaming doesn’t work (working good in the 8088 port).
Is there anything else to do?
Thanks. This works, well. I had to change the XML to this, though:
rtmpt
org.red5.server.net.rtmpt.RTMPTServlet
1
rtmpt
/fcs/*
rtmpt
/open/*
rtmpt
>/close/*
rtmpt
>/send/*
rtmpt
>/idle/*
Probably got munged in cutting and pasting?
Yup. Got munged.
<servlet>
<servlet-name>rtmpt</servlet-name>
<servlet-class>org.red5.server.net.rtmpt.RTMPTServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/fcs/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>/open/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>>/close/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>>/send/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>rtmpt</servlet-name>
<url-pattern>>/idle/*</url-pattern>
</servlet-mapping>
Dear Paul!
Sorry for disturbance, but I totally stucked at building my video streaming Red5 application. This is the reason why I ask for your help. My problem is about event handling: I try catch and handle, when flash applet pauses the video play. In theory the applet sends a pause notification to the application on the server, what I can handle, but anyhow I log, and try to discover the flow of the event, I can’t see. I found ACTION_PAUSE and others, but I couldn’t find the part where a handler method will called automagically. I read a lot of things in documentation, and google, but I saw just actionscript example, there was nothing worthwhile about server’s pause handling (or I just didn’t find it
). Please write the method in some sentence, how I can handle this event, and events like this.
Thank you!
Hi all,
I’m newbie withr red5 but I think that this article is more interesting.
first step. I understand that if you change http.port = 80 you see red5 index page in http://myserver/ and if you have red5/webapps/myapp/streams/video.flv and red5/webapps/myapp/WEB-INF/web.xml with your change, it run in
rtmp://myserver/myapp/video.flv. it isn’t?
second step. I would like undertstand if red5 streams a flv video only rtmp://myserver/myapp/video.flv or also, http://myserver/myapp/video.flv.
is http://myserver/myapp/video.flv url only a dream or is it possible?
Thank you!
[...] Reference: webmultimediale.org, gregoire.org [...]
[...] followed Mondain’s post to set up Red5 with RTMPT over port 80 and it mostly [...]