Home > Flash > Red5 – for my flex radio station

Red5 – for my flex radio station

Q. How can i use red5 to make my flex code work in FMS also in Red5.! ?

A. Follow the steps:

1. Download red5 start it stop it

2. Configure RTMP application, by making a folder called “test” in /webapps, and copy the sample echo program.

[root@example test]# tree
.
├── META-INF
│   └── MANIFEST.MF
├── streams
│   └── Flex_.flv
└── WEB-INF
├── classes
│   ├── logback-echo.xml
│   └── org
│       └── red5
│           ├── demos
│           │   └── echo
│           │       ├── Application.class
│           │       ├── ExternalizableClass.class
│           │       └── RemoteClass.class
│           └── server
│               ├── service
│               │   ├── EchoService.class
│               │   ├── EchoService$SampleObject.class
│               │   └── IEchoService.class
│               └── webapp
│                   └── echo
│                       ├── ExternalizableClass.class
│                       └── RemoteClass.class
├── lib
├── red5-web.properties
├── red5-web.xml
└── web.xml

13 directories, 14 files
[root@example test]#

3. Fix the web.xml/red5-web.xml and red5-web.properties, here is an example file contents:


@file: web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
 xmlns="http://java.sun.com/xml/ns/j2ee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
 version="2.4">

 <display-name>test</display-name>

 <context-param>
 <param-name>webAppRootKey</param-name>
 <param-value>/test</param-value>
 </context-param>

 <listener>
 <listener-class>org.red5.logging.ContextLoggingListener</listener-class>
 </listener>

 <filter>
 <filter-name>LoggerContextFilter</filter-name>
 <filter-class>org.red5.logging.LoggerContextFilter</filter-class>
 </filter>

 <filter-mapping>
 <filter-name>LoggerContextFilter</filter-name>
 <url-pattern>/*</url-pattern>
 </filter-mapping>

<security-constraint>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>/streams/*</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>

</web-app>

@file red5-web.xml

<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:lang="http://www.springframework.org/schema/lang"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
 http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-3.0.xsd">

 <bean id="placeholderConfig">
 <property name="location" value="/WEB-INF/red5-web.properties" />
 </bean>

 <bean id="web.context"
 autowire="byType" />

 <bean id="web.scope"
 init-method="register">
 <property name="server" ref="red5.server" />
 <property name="parent" ref="global.scope" />
 <property name="context" ref="web.context" />
 <property name="handler" ref="web.handler" />
 <property name="contextPath" value="${webapp.contextPath}" />
 <property name="virtualHosts" value="${webapp.virtualHosts}" />
 </bean>

 <bean id="web.handler" />

 <!-- enable support for mx:RemoteObject requests -->
 <bean id="flexMessaging.service">
 <property name="serviceInvoker" ref="global.serviceInvoker" />
 <!-- add an entry for all possible "destination" attributes of your
 mx:RemoteObject sources -->
 <property name="endpoints">
 <map>
 <entry key="Red5Echo">
 <!-- object that handles requests sent to this endpoint -->
 <ref bean="web.handler" />
 </entry>
 </map>
 </property>
 </bean>

</beans>

@file red5-web.properties

webapp.contextPath=/test
webapp.virtualHosts=*

4. restart red5, from browser run your RTMP client

Done.

Advertisements
Categories: Flash
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: