贴一个最近完成的FMS视频直播方案。
本套方案共分发布端和接收端两部分,现将二者功能简述如下:
发布端:
1、发布端可将本地视频流和音频流分别发布到多个不同的远端服务器上,也可发布到单台服务器上。
FMS(-=视频语音项目开发...=-)
贴一个最近完成的FMS视频直播方案。
本套方案共分发布端和接收端两部分,现将二者功能简述如下:
发布端:
1、发布端可将本地视频流和音频流分别发布到多个不同的远端服务器上,也可发布到单台服务器上。
FMS3新增了一个非常有用的功能,那就是支持ByteArray,这个功能让许多梦想成为现实,如传递自定义表情,传递文件等等。
让人激动的FP10支持的P2P:
There has been a lot of great excitement around RTMFP (Real Time Media Flow Protocol), especially because of the peer to peer (P2P) communication that is enabled in Flash Player 10 beta. This is a natural time to speculate about what cool applications you will build with new technology, so I’d like to give you some more information for you to work with.
Since I have been frequently been asked about details on this, a frequently asked questions format somehow seemed appropriate ;). For those that want to start working with RTMFP, make sure to read to the end, there is a goody for you!
Does Flash Pl
FP10支持的新协议RTMFP让P2P成为现实,下面这段文字转自http://justin.everett-church.com/
There have been some comments on other blogs about the new RTMFP protocol that is part of the Flash Player 10 beta and potential for how it will be used. Please keep in mind that while we have announced the features, we haven’t announced all of the details yet.
The new RTMFP protocol in Flash Player 10 provides an alternative to RTMP allowing customers to develop real-time communication applications with an improved user experience. Applications like chat and games are great examples of what you are likely to see make use of this technology. This new protocol has been designed for communication solu
FMS3新增了一个非常有用的侦听事件,那就是application.onPublish,利用这个事件,可以很方便的把刚刚发布的流发布到其它服务器上,从而达到偷窥MM
的目的:
使用方法如下:
application.onPublish = function(client, myStream) {
nc = new NetConnection();
nc.connect("rtmp://10.0.199.5/multiPointPub");
ns = new NetStream(nc);
ns.attach(myStream);
最近很多人都在问这个问题,我说一下大致思路。
边缘服务器的配置很简单,只要修改配置文件Vhost.xml就可以了,这个配置文件的具体路径是:FMS3安装目录\conf\conf\_defaultRoot_\_defaultVHost_\Vhost.xml,用记事本打开这个文件,作如下修改:
1、找到<Proxy>节点,修改Mode属性为remote,即:
<Mode>remote</Mode>
FMS3跟其它的Adobe产品一样,个头越来越大,吃的越来越多:
支持的操作系统:
Microsoft® Windows Server® 2003 SP1 (All 32-bit editions)
Linux® Red Hat® 4 (32-bit only)
FMS有一个非常重要的功能,那就是可以在多台服务器之间共享流.
利用这一功能,我们可以把源服务器上的流分发到其它的服务器,这些获得流的服务器同样可以作为新的源服务器使用.这个功能有点象FMS集群.
我们都知道,利用WMP插件可以获取网上的流媒体地址制作网络电视台,其实利用Flash和FMS同样也可以实现.
在一台服务器上采集电视信号,然后将采集的流PUB到IP为127.0.0.1的一个APP(假设是:tvSet)内,假设该流的名称为"cctv1",
这样,连接到该服务器的FP客户端可以很轻易地获取该流.但连接数一多,服务器可能就会负担过重,这时就要开始考虑分流.
分流的方案至少有两种,一种是利用代理服务器,一种就是我们要说的在多台服务器之间共享流了.
那怎样把流分发下去呢?
这第一台源服务器不用再做任何事情,它只负责接收和PUB电视信号好了,我们另找一台服务器,在FMS应用程序的main.asc中写入以下代码:
//程序启动时执行
application.onAppStart = function() {
this.myNC= new NetConnection();
this.myNC.onStatus = NC_onStatus;
this.myNC.connect("rtmp://第一台源服务器的地址/tvSet");
};
function NC_onStatus(info){
利用FMS集群技术可以大大减轻源服务器的负担,特别是对于Store类型的视频,从管理界上面看,在采用集群方式播放Store类型的视频时,源服务器基本没什么明显变化。
FMS集群技术的实现大致分为两种:一种是利用Adobe官方提供的配置文件进行配置,另一种是自己在Server端写代码配置。利用配置文件进行配置的优点是简单,但对于Live类应用就不太适合了;而在Server端写代码实现集群,这种方法更加灵活,更适合于Live类的应用。
具体采用哪种方法,要看实际项目的需要而定。
下面是连接数为11时的源和缘服务器的比较图:
两台服务器的CPU占用率仅达7%左右,而源服务器的带宽消耗很小,仅仅一台边缘的服务的带宽占用起伏比较大,但占用也不是太多.
注意:上面是向服务器发布LIVE流时的情形.
配置边缘服务器时要注意:
边缘服务器的Server.xml中的AutoDiscovery的Enable值应设为true,而源服务器恰恰相反。
如果在源服务器上放置了FLV,如:applications/appname/videos/streams 标签集:TAGS:边缘服务器
var fmsIP:String = "127.0.0.1";
var fmsPath:String = "rtmp://"+fmsIP+"/audioOnLine_fms/";
var myNC:NetConnection = new NetConnection();
myNC.objectEncoding = ObjectEncoding.AMF0;
myNC.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
myNC.addEventListener(SecurityErrorEvent.SECURITY_ERROR,