-1

I'm developing an application and I want to make one single connection for video (netstream) and chat (sharedObject).

I have one connection for each but I have limited connection available in the server so I need to make a single connection to handle the video net stream and chat sharedObject.

I use these URLs to connect:

private var serverWebcamURL:String = "rtmp://myserverIP/live";
private var serverChatURL:String = "rtmp://myserverIP/multicast/chat";

What do i have to do to make this work?

theB
  • 6,450
  • 1
  • 28
  • 38

2 Answers2

1

You could use NetStream for all of those unless it's a 'group' chat. If it's a group chat, you need shared objects, if it's a one on one chat, you can use NetStream. It would be something like this:

var connection:NetConnection = new NetConnection();
connection.connect(yourServerIp);
var stream:NetStream = new NetStream(connection);
stream.receiveAudio(true);
stream.receiveVideo(true);
stream.attachAudio(Microphone.getMicrophone());
stream.attachVideo(Camera.getCamera());
stream.client = this; // Yous should look this up.  This is for client to client communication using a 'handler' within this class
stream.publish('media');
stream.play('media');

And from this, you can chat to each other using a message function like this:

private function message(someMessage:String):void
{
// do something
}

Now you just need the client to be able to send a message like so:

stream.send('message', yourMessage);

Hope this helps.

J_A_X
  • 12,857
  • 1
  • 25
  • 31
  • Yes, it's a 'group' chat, so I need to use shared objects. The problem is that I don't know how to use just one NetConnection to handle the NetStream and the SharedObject. Thank You – Dario Santos Apr 13 '11 at 20:53
0

You could use cuePoints instead of sharedObject for the chat and then use the same connection for everything. I only use Red5, I don't know if it's possible with FMS...

Kodiak
  • 5,978
  • 17
  • 35