Frage

I'm doing P2P for my chat room. I can use Cirrus and transfer audio cum video well from 1 user to another. This is 1-to-1 transfer.

However, now, the scenario is a little bit different. I need to do 1-to-multiple transfer.

User1 publishes a NetStream which contains live webcam video of himself. User2, User3,... want to view the webcam of User1.

User1_Stream = new NetStream(...);
User1_Stream.publish("user1-stream");

//only 1 of these users below can see the webcam of User1
User2_Stream = new NetStream(...,User1_Connection.nearID);
User2_Stream.play("user1-stream");

User3_Stream = new NetStream(...,User1_Connection.nearID);
User3_Stream.play("user1-stream");

User4_Stream = new NetStream(...,User1_Connection.nearID);
User5_Stream.play("user1-stream");
...

How to make all users be able to see the webcam of User1?

War es hilfreich?

Lösung

It's not possible to open sending stream as NetStream.DIRECT_CONNECTIONS and then send to multiple receivers. Must do a multicasting:

http://www.flashrealtime.com/multicast-explained-flash-101-p2p/

Note that right after creating sending stream or receiving stream, it's not allowed to call "publish" and "play" right the way. Wait for 'NetStream.Connect.Success' before calling to these methods.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top