带有 groupSpecifier 的 netStream 不发送处理程序,FLEX
我有一个用 FLEX 构建的简单视频/聊天应用程序。我为不同的功能创建了 groupSpecifier、netGroup 和 NetStream。
NetGroup主要用于消息传递(Posting)和跟踪进入的用户。
NetStream 用于(或将用于)为同一组下的每个人控制一些功能,例如“开始视频、停止视频”。
我将在这里发布最重要的功能。第一个是setupGroup。
private function setupGroup():void{
var groupspec:GroupSpecifier = new GroupSpecifier("vid"+GROUP_ID+"_sid_"+SESSION_ID);
groupspec.serverChannelEnabled = true;
groupspec.postingEnabled = true;
groupspec.multicastEnabled = true;
groupspec.ipMulticastMemberUpdatesEnabled = true;
trace("Groupspec: "+groupspec.groupspecWithoutAuthorizations());
netGroup = new NetGroup(nc,groupspec.groupspecWithoutAuthorizations());
netGroup.addEventListener(NetStatusEvent.NET_STATUS,netStatus);
netVideo = new NetStream(nc,groupspec.groupspecWithoutAuthorizations());
netVideo.addEventListener(NetStatusEvent.NET_STATUS,netStatus);
user = "user"+Math.round(Math.random()*10000);
}
第二个是 sendMessage
private function sendMessage():void{
var message:Object = new Object();
message.sender = netGroup.convertPeerIDToGroupAddress(nc.nearID);
message.user = txtUser.text;
message.text = txtMessage.text;
netGroup.post(message);
receiveMessage(message);
txtMessage.text = "";
}
然后是 startVideo
private function startVideo():void{
netVideo.send("publishVideo");
ns.togglePause();
}
还有另一个名为“publishVideo”的函数,我希望组中的其他成员能够调用该函数,但这并没有发生。此代码的大部分直接来自 Tom 从 http://www.flashrealtime.com 提供的示例。任何帮助/建议将不胜感激!
ps 由于延迟,我没有使用组对象复制。
I have a simple video/chat application built in FLEX. I've created a groupSpecifier, netGroup and a NetStream for the different functionalities.
NetGroup is mainly used for the messaging (Posting) and keeping track of the users who enter.
NetStream is (or would be used) to control some functions like "start video, stop video" for everyone under the same group.
The most important functions I will post on here. The first is setupGroup.
private function setupGroup():void{
var groupspec:GroupSpecifier = new GroupSpecifier("vid"+GROUP_ID+"_sid_"+SESSION_ID);
groupspec.serverChannelEnabled = true;
groupspec.postingEnabled = true;
groupspec.multicastEnabled = true;
groupspec.ipMulticastMemberUpdatesEnabled = true;
trace("Groupspec: "+groupspec.groupspecWithoutAuthorizations());
netGroup = new NetGroup(nc,groupspec.groupspecWithoutAuthorizations());
netGroup.addEventListener(NetStatusEvent.NET_STATUS,netStatus);
netVideo = new NetStream(nc,groupspec.groupspecWithoutAuthorizations());
netVideo.addEventListener(NetStatusEvent.NET_STATUS,netStatus);
user = "user"+Math.round(Math.random()*10000);
}
The second is sendMessage
private function sendMessage():void{
var message:Object = new Object();
message.sender = netGroup.convertPeerIDToGroupAddress(nc.nearID);
message.user = txtUser.text;
message.text = txtMessage.text;
netGroup.post(message);
receiveMessage(message);
txtMessage.text = "";
}
And then startVideo
private function startVideo():void{
netVideo.send("publishVideo");
ns.togglePause();
}
There is another function called "publishVideo" which I hope would be called for the rest of the members in the group, but this is not happening. Most of this code is straight from the example Tom has provided from http://www.flashrealtime.com. Any help / suggestions would be appreciated!
p.s. I am not using group object replication because of the latency.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案很简单。
您需要使用以下内容启动视频:
NetStream.send()
用于在接收方NetStream.client
对象上调用回调方法。http://www.flashrealtime.com/multicast-explained-flash-101- p2p/
Answer is prosaically simple.
You need to start video with:
NetStream.send()
is for invoking callback method on receiverNetStream.client
object.http://www.flashrealtime.com/multicast-explained-flash-101-p2p/