带有 groupSpecifier 的 netStream 不发送处理程序,FLEX

发布于 2024-10-03 08:05:54 字数 1707 浏览 1 评论 0原文

我有一个用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2024-10-10 08:05:54

答案很简单。

您需要使用以下内容启动视频:

netVideo.publish("channel");

NetStream.send() 用于在接收方 NetStream.client 对象上调用回调方法。

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

Answer is prosaically simple.

You need to start video with:

netVideo.publish("channel");

NetStream.send() is for invoking callback method on receiver NetStream.client object.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文