Ready to use – Red5 streamer application

Following Red5 Developer series from Dominick Accattato, and a neat explaination from Red5.org on CustomFilenameGenerator, Here is a ready to use, fully capable pre-compiled Red5 application for anyone who wishes to set up Flash streaming with Red5 , but does not know where to start.

The application is tested on Red5 0.8. to use it in 0.9 you may have to remove the bandwidth-setting code in main Application class and recompile it.

How to configure Stream/Record paths:


1. Edit the file file red5-web.xml in the WEB-INF directory

2. Move down to the “streamFilenameGenerator” bean definition and adjust values of recordPath and playbackPath as you wish.

3. To use absolute paths, set “absolutePath” property as true.

Downloads:

Customstreamer_deployable_0.8

CustomStreamer_source_0.8

# Update : Customstreamer for Red5 0.9:

Customstreamer_deployable_0.9

CustomStreamer_source_0.9

# Update : Customstreamer for Red5 0.7: [Updated June 17 2010]

Customstreamer_deployable_0.7

*Try out the new Red5 application generator HERE

Note:  To compile source, use eclipse J2ee build.

Evangelize Flash platform – Must read for Flash haters !!

You may be a flash developer or a  flash hater or an evangelist, or a regular person who has nothing to do with flash whatsoever. I am sharing this , as i see too much of  “Flash must die !” on the web. From Apple to Microsoft to every other guy, who possibly can, is taking a stone at Adobe Flash. From being called “buggy” to “dying technology” its taking it all, without complain.Dear reader , please take 5 minutes to read this first and then get back to what you were doing. Every second is a character , a minute makes a word and few words makes it your day.

(more…)

Connecting Red5 and Amf-php

Its been a long goal for me to connect Red5 to amfphp. You will see frequent needs of interacting with MySQL database from red5. Many people suggest using JDBC. Although thats  valid suggestion, its more of a headache for a non Java developer and the server administrator. Many people also suggest using flash to amfphp direct., but mind it thats the most incorrect way of doing things, when you want it secure.

Here is how you actually get Java to talk to php, the modern style :).  First anf foremost grab a copy of amfphp 1.2 from Sourceforge. Note: download amfphp 1.2,  as amfphp 1.9 is not compatible with red5’s amf decoding.

Step 1.  Setup the amfphp gateway at your server root. Like so:

http://localhost/amfphp

See video on setting up amfphp

Step 2. Download and install red5, then setup a new application using red5plugin in eclipse. (i wont discuss how to setup red5 application here. you can refer to external links for that. Mainly: Red5 developer series videos)

Step 3.  Create a new amfphp service class like this and save as Red5Service.php in services folder of amfphp.

<?php
class Red5Service
{

function  Red5Service()
{
$this->methodTable = array(
"login" => array(
"description" => "login user -> returns true/false",
"access" => "remote",
"arguments" => array ("username","password")
),
"logout" => array(
"description" => "logout user -> returns nothing",
"access" => "remote",
"arguments" => array ("username")
)  
);
}  

function login($username,$password)
{
return true;
}

function logout($username)
{
return;
}
}
?>

Step 4. In your red5 application, connect method  place a call to your amfphp service,  as shown below:

/** {@inheritDoc} */
@Override
public boolean connect(IConnection conn, IScope scope, Object[] params)
{
try
{
RemotingClient client = new RemotingClient("http://localhost/amfphp/gateway.php");
Object[] args = new Object[]{'rajdeep','xyz123'};
Object result = client.invokeMethod("Red5Service.login", args);

if(!result.equals(true)) return false; 
}
catch (IOException e)
{
return false;
}
return true;   
}

As you will see when a user connects to red5 application, the connect handler makes a connection to amfphp gateway and sends the parameters ‘rajdeep’ and ‘xyz123’ as arguments. the amf service can then do its own computations as you want it to and return a boolean expression – true/false at the end. If the java RemotingClient receives a true it lets the connect method accepts the connection else reject it. Also note the try catch block.  also since we dont know what network situations may prevail, so need to be sure that if red5 cannot connect to amfphp it will reject the client connection anyways.

Thats all  for the basics to make things hotter try experimenting with params sent to red5 from flash and the database stuff 🙂

RIA on mobiles – reality bite

Flash player on mobile devices is finally showing signs of fruits.  For many of those who wanted to doubted the future of flash, the implementations of Flash player 10.1 will be a eye opener.  Dave Zuverink has written a  nice article on the Adobe  Dev Net that explains designing RIA for mobile devices. Dave Zuverink currently leads the development efforts of slider framework at Adobe. With the forthcoming of powerful hardware as the snap dragon chip, and the evolution of Flash player 10.1 in browser and mobile AIR, looks like every phone will be more capable than iPhone in a the near future.