Just happened to bump on a site today, that offers RTMP api for J2ME. The Api lets J2ME play back streaming video /audio from RTMP servers. The best part is that it even allows publishing from camera/mic to RTMP server. That is something flash lite is really missing on. Although the Api is really priced high, but i guess its worth it. Here is the developer’s guide page, that demonstrates the code. I guess Adobe should notice that.
In this tutorial we see how to connect to a mysql database, regardless of whether you have access to JDBC adapter on your Red5 running server. Definitely JDBC would be faster, but this method will get you across just fine in any Red5 project involving databases.
Since we wont be using Java way of connecting to mysql, i pick php as the delegate for that. so our communication will be like this:
JAVA -> PHP -> MYSQL
MYSQL -> PHP -> JAVA
As you would know red5 is a media server package, which runs on top or other server cores like Tomcat and Jetty. There are few minor differences , hence in the way both compilations handle events and behaviors. The one we will be talking about here is specifically the “appStop” event. The “appStop” is suppose to fire off whenever the application stops/shuts down. The anomaly here is that on a tomcat based red5 compilations (which is the default one) the “appStop” does not fire up. This is because the is no straight forward ”hook” / “point of entry” to determine when the server core stops. Hence we need to create a “Shutdown Hook” to handle the server/application shutdown by ourself.
The best way to do this is to create a internal / private class in your Application class source. Sample:
class ShutdownHook extends Thread
public ShutdownHook(Application app)
this.app = app;
public void run()
// do something here
Next we relate it to our Application class by the “addShutdownHook” method. This method is not something for red5 only. Its the most common way to intercept and handle your java application shutdown. So in the Application class appStart() method we can add:
We add it to the appStart() method to make sure it is called only once.
Note how we pass the reference to the Application class itself to the constructor “ShutdownHook”. Now by defining the properties as “protected” or “public” you can access then when the application/server is shutting down and do any cleanup jobs that you may have.
I have always found it very difficult to understand and build java applications. Hence i always used to run away from the sound of it. But believe it or not now i find, a person who has worked well with flash/flex will find java to be very understandable. You can say flash added a expression to java over the few years. So anyway to quench my thirst i decided to work on a java GUI application this week. And here it is – ”SwfMetaDataInjector”. Flash has supported metadata even before Google / Yahoo started indexing swfs wit their special algorithms. This meta data is stored as a markup, in RDF (Resource Description Framework) format. To know more about this you can read a very intuitive article by Robert Reinhardt
SwfMetaDataInjector lets you write back meta information into swf files even without their fla sources. currently it supports swfs published for flash player 8 and below. i hope to do better with it over time. The application will require you to have the latest java runtime. I this works out forthcoming versions will have batch processing capabilities and better UI. Currently this application is at version 0.01 .
You can download the application here