문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top