2

我正在尝试获取一个非常基本的实时视频聊天示例以与 Flash Media Server 一起使用,但无论我多么努力,它都对我不起作用。

我正在使用此网页中的教程和代码:http: //www.derekentringer.com/blog/fms-video-chat/

我有两台服务器:一个 Web 服务器和一个媒体服务器。在媒体服务器上,我安装了 FMS,并确保端口 1935 已打开以在 Web 和媒体服务器之间进行通信。

我认为我的问题是如何设置我的 FMS 实例。在本教程中,他使用了 Influxis.com 的托管 FMS 解决方案。我正在使用我自己的安装了 FMS 的媒体服务器。有谁知道如何设置我的 FMS 实例以便我可以让它工作?

在网络服务器上,我有两个不同的文件夹(user1 和 user2),每个文件夹都有一个 html 文件和一个 swf 文件来连接网络摄像头,然后通过 rtmp 将网络摄像头的流连接到媒体服务器。

这是我在 SWF 文件上的代码。

//setup the camera and mic for streaming
mycam = Camera.get();
mycam_audio = Microphone.get();

//control the cameras mode and quality
mycam.setMode(320,240,30);
mycam.setQuality(10000,100);

//attach a live preview of the camera to the 
//video object that is setup on the stage
cam_feed.attachVideo(mycam);
cam_feed.attachAudio(mycam_audio);

//connect to the Flash Media Server
client_nc = new NetConnection();
client_nc.connect("rtmp://corpwebdevmedia1/test"); // I've tried server name and IP
cam_ns = new NetStream(client_nc);

//attach our camera video and audio to the net stream
cam_ns.attachVideo(mycam);
cam_ns.attachAudio(mycam_audio);

//publish to our Flash Media Server as a 
//live stream called user_2
cam_ns.publish("user_2", "live");
// user_1 for the other one

//bring in user_1's video/audio
in_ns = new NetStream(client_nc);
in_ns.play("user_1");  
// user_2 for the other one

//attach user_1's published audio and video
//so we can see them in the larger chat window
live_feed.attachVideo(in_ns);
live_feed.attachAudio(in_ns);

完成所有这些后,我转到本地计算机并将浏览器导航到 Web 服务器上的 html 文件。该页面在每个页面上都连接到我的相机,但它们从未连接在一起。

有什么建议么?

谢谢。

4

1 回答 1

1

我不确定这是否适用于所有相机,但至少在我开发类似的应用程序时,我遇到了同样的问题,问题的原因是两个应用程序不能共享同一个相机。

换句话说,您不能同时使用 Skype 和 Flash 播放器应用程序进行视频聊天。两个 Flash 播放器应用程序也是如此——它们不能都使用相同的相机输入。所以尝试连接另一台相机,或用两台电脑进行测试(这就是我所做的)。如果您使用单个系统进行测试,您将在音频设置方面遇到更多问题(虽然我不完全记得出了什么问题,但在尝试模拟完整的音频时尝试静音或更改音量确实有很多问题2人在一个系统上聊天)

另一个问题可能是您对两个应用程序使用相同的流名称,您是否在其中一个应用程序中切换了“user_2”和“user_1”?

于 2011-05-30T08:57:40.037 回答