用p2p在这里苦苦挣扎。有人可以为我澄清这一点......我正在阅读的所有内容都不一致,包括adobe文档。
要发布p2p,您需要:
var nc:NetConnection = new NetConnection();
var ns:NetStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
ns.attachCamera(cam);
ns.attachAudio(mic);
groupSpecifier = new GroupSpecifier("fms.mygroup");
groupSpecifier.multicastEnabled = true;
groupSpecifier.postingEnabled = true;
groupSpecifier.serverChannelEnabled = true;
group = new NetGroup(nc,groupSpecifier.groupspecWithAuthorizations());
group.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
ns.publish("stream");
那我应该发布它。是吗?
然后查看直播:
var v2:Video = new Video();
var ns2:NetStream = new NetStream(nc,myPeerID);
ns2.addEventListener(NetStatusEvent.NET_STATUS,onPublish);
ns2.client = this;
ns2.play(userName);
v2.attachNetStream(ns2);
c.addChild(v2);
myPeerID是唯一的但我看不到流。所以这是我的问题:
1)由于某种原因,我有可能看不到自己的流吗?
2)对于观看...也许它没有看到流,因为我没有说任何关于groupSpecifier的内容。虽然我确实将groupSpecifier附加到了nc,所以不会全部设置因为我已经这样做了吗?我只是想,也许我没有联系到同一个小组。
3)我按照它说的做了配置多流html页面。然后我将manifest.f4m放在服务器上,就像它说的那样。我是否需要参考我的流名称中的任何内容?我看到一篇文章给出了我可以在FMLE中使用的查询字符串。我想也许我需要将它用作我的流名称?
4)用于在netStream连接中查看...有些人将它作为第二个参数的peerID,而其他人将它作为groupSpecifier.groupspecWithAuthorizations()。它应该是peerID,因为我需要说我想查看那个人,它知道要连接哪个组,因为我在nc中执行了GroupSpecifier时指定了。
5)发布.... ns.publish(“stream”)中的流名称是什么意思?它可能是马还是驴?如果基于groupSpecifier应该知道要连接到哪个组,为什么还要指定任何内容?是因为你可以连接到一个“组”,在那个组中你可以连接到更好的“驴”网络流?
答案 0 :(得分:1)
2)您发布时NetStream
超过NetConnection
而非NetStream
超过NetGroup
,因此直接发布时您根本不需要NetGroup
到与NetStream(nc, peerId)
当您使用NetStream(nc, NetStream.DIRECT_CONNECTIONS)
时,不会发布NetGroup
,因此您需要与NetStream(nc, peerID)
如果您使用NetStream(nc, gs.groupspecWithAuthorizations())
,则可以使用NetStream(nc, gs.groupspecWithAuthorizations())
您需要选择通过NetStream @ DIRECT_CONNECTIONS或NetStream @ NetGroup发布
4a)参数peerId用于NetStream @ DIRECT_CONNECTIONS
4b)参数gs.groupspecWithAuthorizations()适用于NetStream @ NetGroup
5)是的它确实:)你需要发布和播放相同的字符串,它是流的标识:ns.publish("StreamName")
然后是ns2.play("StreamName")