Friday, May 01, 2009

Red5 and Java RTMPClient Problems

One more day passed and I am still struggling with Java RTMPClient to make it properly work with Red5. Started with red5 v0.6.2 and checked up to v0.8 but the problem is still there. I did not get success passing parameters to connect method.
The connect method is working without any parameters, i.e. connect(String server, int port, String application, IPendingServiceCallback connectCallback) and what I need is connect(String server, int port, Map connectionParams, IPendingServiceCallback connectCallback). When i am passing a HashMap to connect method, i am not able to get any parameters on the server side. Inside connect method in Red5, the params[] is of size 0. It's really frustating. It means, i am not able to validate the user before connecting it to Red5. It means, anonymous connection can be made to application and then reject or accept them later accordingly.
Ok, so i thought, i will do this way, but here my problem does not ends. What i am doing now is accepting connection to each user and in callback function, i am sending user credentials from Java client and if those credentials are not correct, i am rejecting this client.
Now once the client is accepted and i have to invoke couple of methods on server. The problem starts again. Invoke() function does not work as expected. It's working only from within the connectCallback block.

public void resultReceived( IPendingServiceCall call ) {
// If you call invoke() from here. it works.
}

It means, I call invoke methods from within this block and not from outside of this block. Then I Googled and found many people facing the same problem. The only working solution was http://www.nabble.com/Re%3A-RTMPClient.invoke%28%29-p15075904.html

It's bad to see not much progress on Java RTMPClient in Red5 from so long. I tested with different versions and upto latest one and everywhere it's same. I am still doing workarounds to let RTMPClient working in my application. :(

Thursday, July 24, 2008

Open Dialect, the future of Open Source Flash IDE

Open Dialect is the name of the software we are going to talk about in this post. To explain more about this software, I would like to answer few questions that everyone would be curious to know when we talk about Open Dialect the Open Source Flash IDE. The answers to these questions help you understand this software.

  • What is Open Dialect?

  • Why we are calling it the future of open source flash IDEs?

  • How is it going to serve your flash application development needs?

  • What are some of the main features of Open Dialect?

  • Is it operating system independent?

  • Does it also support the creation of Adobe AIR applications?

  • What does it need from the Flash and open source communities?

Answer 1: Open Dialect is an open source Flash IDE based on Flex. Open Dialect is written in C# using the .NET 2.0 framework (or Mono 1.9.1). The goal of the project is to create a tool that allows you to create Interactive Learning Environments that interact with System Dynamics Models over the internet. In simpler terms it allows you to easily and quickly design rich internet applications based on Flash.

Answer 2: Flash is a powerful tool used by many and having an open source and Linux compatible alternative implementation of this tool is something you can not ignore. I believe that Open Dialect is the best open source Flash IDE, and will continue to be in the future.

Answer 3: Open Dialect lets you create open source flash applications. You are able to generate Flash 9 SWFs with Open Dialect. It will allow anyone from a flash expert to a flash noob to create rich internet applications very easily and quickly. Open Dialect supports 17 different components, which respond to a wide range of user input and interaction With Open Dialect; you will be provided everything that is required to develop flash applications in an open source environment.

Answer 4: Open Dialect is packed with cool features. Some of the features are-

  • Its free and Open Source (GPL)

  • It allows quick and easy application development no matter what your level of expertise is.

  • It has an action script code wizard for beginners.

  • It also allows experts to enter code without the wizard.

  • It has a timeline to facilitate animations (and tweening is done automatically)

  • It supports something we call "Pages" which are essentially different screens in an application or slides like in PowerPoint so you can now design your applications like you design your PowerPoint’s, and transitioning between pages is simple and easy.

  • It supports the creation of Adobe AIR content.
Answer 5: Yes, Open Dialect is operating system independent. It works on Windows, Linux and can be run in OSX (with a little extra effort at this time).

Answer 6: Open Dialect as I already said is the future of open source Flash IDEs. Not only you can generate Flash 9 SWF, you can also create Adobe AIR applications for you and your client’s desktops.

Answer 7: Open Dialect can become a whole lot more exciting if it gets support from Flash, community. The software is very powerful and has a great future ahead. All it needs is the support to make it a big success. If you like Open Dialect and you think that it can make your life easier with open source flash applications, you can always take part in its development. Open Dialect especially needs support from communities for its deployment on Linux and OSX.

Very recently Open Dialect released Open Dialect 0.6.0 which has more new features as well as enhancements over existing features. Open Dialect is committed to deliver its best to the open source communities. I would request open source communities to be a part of the success of Open Dialect by providing more and more support and motivation to its development team.

More details about Open Dialect are available here. You will also be interested to read the need for a System Dynamics based Open Source, Online Interactive Learning Environment Creation Tool. You can find it here.
You can see the power of Open Dialect with the very basic demo here and http://www.t21northamerica.com/ShowerILE.html

Related Articles:-
Open Dialect -An Open Source Flash IDE Now Supports Linux
Open Dialect - Open source Flash IDE

Tuesday, July 01, 2008

Flash Files Become Searchable

The only big thing in the internet which was hidden from search engines (Google, Yahoo) was the flash (.swf) files. But according to an announcement made by Adobe Systems today, flash files are no more hidden from these search engines. Adobe is providing optimized flash player technology to Google and Yahoo to enhance indexing of .swf files by search engines.

There are millions of flash users with millions of website using flash technology to develop websites and from Search Engine Optimization point of view, it was not advisable to use flash, but now with this news, there is a clear sign of tremendous growth of flash player technology in near future.

Let see what adobe is saying.
“Until now it has been extremely challenging to search the millions of RIAs and dynamic content on the Web, so we are leading the charge in improving search of content that runs in Adobe Flash Player,” said David Wadhwani, general manager and vice president of the Platform Business Unit at Adobe. “We are initially working with Google and Yahoo! to significantly improve search of this rich content on the Web, and we intend to broaden the availability of this capability to benefit all content publishers, developers and end users.”
Google and Yahoo! both are working with Adobe in order to bring this as soon as possible in the future updates of their search engines.

Read more in the press release from Adobe.

Sunday, June 29, 2008

Simple Two-Way Audio/Video Chat Application With FMS3

In this post I will explain how to make a simple Two-Way A/V Chat Application with FMS3.

As we know that FMS3 application is the reference name we use in RTMP URL while connecting to FMS3 server. It's the folder name we create on server side. The chat application say "simplechat" will have two modules. An application can have several modules. Let's say we have two modules name Test1 and Test2. Both Test1 and Test2 will share the same FMS3 application and will connect to server. Both modules will receive the streams of each other when connect to server.

Below are the steps to start with chat application-

1: Create a new Flash File and name it to Test1.fla

2: In the Document Class text box in the Property inspector of flash document, write Test1

The simple interface of this application could be-

FMS3 Chat

3: Create an ActionScript 3.0 file and name it to Test1.as and write the following lines in it.

package
{
import flash.media.Camera;
import flash.media.Microphone;
import flash.media.Video;
import flash.events.NetStatusEvent;
import flash.display.Sprite;
import flash.net.NetConnection;
import flash.net.NetStream;

public class Test1 extends Sprite{

private var netConnection:NetConnection;
private var rtmpStr:String;
private var nsSubscribe:NetStream;
private var nsPublish:NetStream;
private var camera:Camera;
private var microphone:Microphone;
private var user1Video:Video;
private var user2Video:Video;

public function Test1 (){

rtmpStr="rtmp://localhost/simplechat"; //localhost can be replaced with your LAN IP or remote server IP points to FMS server.

attachCamera();
attachMicrophone();
attachVideoObjects();

netConnection=new NetConnection();
netConnection.addEventListener (NetStatusEvent.NET_STATUS,checkForConnection);
netConnection.connect(rtmpStr);

}

private function checkForConnection(event:NetStatusEvent):void{

event.info.code == "NetConnection.Connect.Success";

if (event.info.code){
nsPublish=new NetStream(netConnection);
nsPublish.attachAudio (microphone);
nsPublish.attachCamera (camera);
nsPublish.publish("user1","live");
nsSubscribe=new NetStream(netConnection);
nsSubscribe.play("user2");
user2Video.attachNetStream(nsSubscribe);
}
}

private function attachCamera(){

camera=Camera.getCamera();
camera.setKeyFrameInterval (9);
camera.setMode (240,180,15);
camera.setQuality (0,80);
}

private function attachMicrophone(){

microphone=Microphone.getMicrophone();
microphone.gain=80;
microphone.rate=12;
microphone.setSilenceLevel(15,2000);
}

private function attachVideoObjects(){

user1Video=new Video(camera.width,camera.height);
addChild(user1Video);
user1Video.x=25;
user1Video.y=35;
user1Video.attachCamera(camera);
user2Video=new Video(camera.width,camera.height);
addChild(user2Video);
user2Video.x=(user1Video.x+ camera.width +15);
user2Video.y=user1Video.y;
}
}
}

4: Save the Test1.as file and then publish Test1.fla to generate swf, html and JavaScript file.

5: Repeat the step 2, 3 and 4 with little change. In the Document Class text box in the Property inspector of flash document, write Test2
Now the .fla file will be named as Test2.fla and .as file will be named as Test2.as.

The changes in the Test2.as file will be-

public function Test2() in place of public function Test1()

nsPublisher.publish("user2","live"); in place of nsPublisher.publish("user1","live");

nsSubscriber.play("user1"); in place of nsSubscriber.play("user2");

6: Save the Test2.as file after these changes and publish the Test2.fla file to generate swf, html and JavaScript file.

Test the application with two users on two different computers with Mic and Camera. One user will open Test1.html file and other user will open Test2.html file and both will see each other's video as given in below picture.

Two Way Chat
This was the simplest two-way A/V chat application with FMS3. The following classes were used in this tutorial.

Camera
Microphone
Video
NetStatusEvent
Sprite
NetConnection
NetStream

You can read more about these API from the LiveDocs.

You can also extend this example to work with server side script as well.

Daily Technology Tips

Catch me at Mashable

PayPal

Sign up for PayPal and start accepting credit card payments instantly.

Blog Explosion


Bloglines

Blogrush


BlogsByCategory.com