RTFMP - 远程流未显示
我正在尝试创建双向视频聊天。您自己的网络摄像头显示得很好,但另一个则不然。我以此页面为例: http://www.adobe.com/devnet /flashmediaserver/articles/p2p_apps_cirrus_lccs.html
按照页面上的步骤操作似乎对我不起作用。我通过 PHP 交换对等 ID。我让 Flash 访问一个页面,该页面使用 POST 请求将对等 ID 存储在数据库中。为了获取合作伙伴的对等 ID,我使用 PHP 会话,它存储您和合作伙伴的 ID。然后,我可以使用这些变量访问另一个 PHP 页面,该页面与合作伙伴的对等 ID 相呼应。两者都和数据库中的一样,所以没有问题。
NetConnection:
Connection = new NetConnection();
Connection.addEventListener(NetStatusEvent.NET_STATUS, CheckConnect);
Connection.connect(RTFMP + DevKey);
这就是我设置您自己的网络摄像头及其 NetStream 的方式:
StreamOut = new NetStream(Connection, NetStream.DIRECT_CONNECTIONS);
var SelfCam:DynamicStreamingVideoSource = new DynamicStreamingVideoSource();
var VideoItems:Vector.<DynamicStreamingVideoItem>;
VideoItems = new Vector.<DynamicStreamingVideoItem>();
VideoItems[0] = new DynamicStreamingVideoItem();
SelfCam.host = "";
SelfCam.streamType = StreamType.LIVE;
SelfCam.streamItems = VideoItems;
Self.source = SelfCam;
var Cam:Camera = Camera.getCamera();
var Mic:Microphone = Microphone.getMicrophone();
Cam.setMode(380, 255, 15);
Cam.setQuality(0, 80);
Self.videoObject.attachCamera(Cam);
StreamOut.attachAudio(Mic);
StreamOut.attachCamera(Cam);
StreamOut.publish("vids");
这就是我接收发布的流“vids”的方式:
StreamIn = new NetStream(Connection, OtherID);
StreamIn.play("vids");
StreamIn.client = this;
Other.videoObject.attachNetStream(StreamIn);
Other 和 Self 对象的类型为
我确信这一定是非常简单的事情,但我似乎无法指出它。
I'm trying to create a 2-way videochat. Your own webcam shows perfectly fine, but the other doesn't. I used this page as an example: http://www.adobe.com/devnet/flashmediaserver/articles/p2p_apps_cirrus_lccs.html
Following the steps on the page doesn't seem to work for me. I exchange the peer IDs via PHP. I make my Flash visit a page, which stores the peer ID in the database using a POST request. To fetch the peer ID of the partner, I use PHP sessions, which store both your ID, and that of your partner. I can then use these variables to visit another PHP page, which echoes the partner's peer ID. Both are the same as in the database, so there's nothing wrong with that.
The NetConnection:
Connection = new NetConnection();
Connection.addEventListener(NetStatusEvent.NET_STATUS, CheckConnect);
Connection.connect(RTFMP + DevKey);
This is how I set up your own webcam plus its NetStream:
StreamOut = new NetStream(Connection, NetStream.DIRECT_CONNECTIONS);
var SelfCam:DynamicStreamingVideoSource = new DynamicStreamingVideoSource();
var VideoItems:Vector.<DynamicStreamingVideoItem>;
VideoItems = new Vector.<DynamicStreamingVideoItem>();
VideoItems[0] = new DynamicStreamingVideoItem();
SelfCam.host = "";
SelfCam.streamType = StreamType.LIVE;
SelfCam.streamItems = VideoItems;
Self.source = SelfCam;
var Cam:Camera = Camera.getCamera();
var Mic:Microphone = Microphone.getMicrophone();
Cam.setMode(380, 255, 15);
Cam.setQuality(0, 80);
Self.videoObject.attachCamera(Cam);
StreamOut.attachAudio(Mic);
StreamOut.attachCamera(Cam);
StreamOut.publish("vids");
And this is how I receive the published stream "vids":
StreamIn = new NetStream(Connection, OtherID);
StreamIn.play("vids");
StreamIn.client = this;
Other.videoObject.attachNetStream(StreamIn);
The Other and Self objects are of type <s:VideoDisplay>.
I'm sure it must be something pretty damn simple, but I can't seem to lay my finger on it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系,我必须使用 mx:VideoDisplay 而不是 s:VideoDisplay。
Never mind, I had to use mx:VideoDisplay rather than s:VideoDisplay.