·您当前的位置:首页 > 技术教程 > AS2与AS3技术 >

[FMS]运用as3开发RTMFP协议的P2P程序(基础篇)(3)

时间:2014-01-02 17:05未知
Stratus service Stratus 服务器 Flash Player instances must connect to the Adobe Stratus service (using rtmfp://stratus.adobe.com) in order to communicate with one another. Stratus is a hosted rendezv

Stratus service  Stratus 服务器

Flash Player instances must connect to the Adobe Stratus service (using rtmfp://stratus.adobe.com) in order to communicate with one another. Stratus is a hosted rendezvous service that helps Flash Player instances contact one another even if they are located behind NATs. Although connecting to Stratus service is very similar to connecting to Flash Media Server, Stratus does not provide any of the typical Flash Media Server features (media relay, shared objects, remoting, etc.). Flash Player endpoints must stay connected to Adobe Stratus during the entire time of communication. In order to access Stratus, you will need a developer key that is generated when you create your Adobe Developer ID.

Flash Player实例必须连接到Adobe Stratus service(使 用rtmfp : / / stratus.adobe.com ) ,用以彼此的通讯。 Stratus是提供会合服务的主机,帮助Flash Player实例间的互相联系,即使它们位于NATs的后面。虽然连接到Stratus服务非常相似连接到Flash Media Server,Stratus没有提供任何Flash Media Server 典型的功能(媒体中继,共享对象,远程等)。 Flash Player客户端必须保持在整个通讯期间一直与Adobe Stratus连接。为了获得Stratus,您将需要您从Adobe公司申请来的开发密钥。

RTMFP support is being planned for future version of Flash Media Server (no release date). With Flash Media Server, it will be possible to enable communications between Flash Player 9 or earlier clients (using RTMP) and Flash Player 10 clients (using RTMFP).

RTMFP支持正在计划添加到未来版本的Flash Media Server(无发行日期) 。这样Flash Media Server,将有可能同Flash Player 9或更早的客户(使用RTMP )通信和Flash Player 10个客户端(使用RTMFP ) 通信。

Security  安全

RTMFP provides secure communications between endpoints. It uses a 128-bit AES with the key negotiated using the Diffie-Hellmann key exchange method. However, it does not provide strong endpoint authentication such as SSL or RTMPS. To aid endpoint authentication, RTMFP and ActionScript expose secure nonces to application developers. These nonces are available at both communicating Flash Player endpoints and are guaranteed to match. By verifying these nonces, end users can ensure that there is no man-in-the-middle attack. These nonces can also be used to develop key continuity mechanism.

RTMFP 提供终端设备之间的安全通信。它的密钥采用128位AES谈判使用Diffie-Hellmann密钥交换方法。不过,这并不提供强大的终端认证,如 SSL或RTMPS 。为了帮助端点认证, RTMFP和ActionScript揭露给应用开发者secure nonces。这些nonces可在双方沟通的Flash Player的终点,并保证比赛。通过核实这些nonces ,最终用户可以确保没有人在中间攻击。这些nonces还可以用来开发关键的连续性机制。

It is important to note that Flash Player only enables sending media from your microphone and webcam devices to other Flash Player endpoints that subscribe to your media streams. Flash Player does not relay data on behalf of any other Flash Player endpoints (such as in a multicast scenario).

重要的是要注意到, Flash播放器不仅从您的麦克风和摄像头设备发送媒体,其他的Flash Player端点订阅您的媒体流。代表Flash播放器并不中继任何其他Flash Player的端点数据(如在一个多播的情况) 。

For more information on RTMFP, please read the FAQ on Adobe Labs:

对于更多关于RTMFP的信息,请阅读Adobe Labs 上的帮助:

Real‐Time Media Flow Protocol FAQ (PDF, 166K)
ActionScript 3.0 API supporting RTMFP
ActionScript 3.0 API 支持 RTMFP
There is a new ActionScript 3.0 API in Flash Player 10 to support RTMFP. Connecting to the Stratus service and creating end-to-end media streams are analogous to working with Flash Media Server. Please note that you must use ActionScript 3.0 with either Flash Professional CS4 or Flex Builder 3 targeting Flash Player 10 or AIR 1.5.

有一个新版本的ActionScript 3.0API支持Flash Player 10的RTMFP 。连接到Stratus错服务和创造端到端媒体流的方法类似于Flash Media Server的工作方法。请注意,您必须使用的ActionScript 3.0或者Flash Professional CS4或Flex Builder 3 构建目标于Flash Player 10或AIR 1.5 。

As I mentioned before, first you must connect to the Adobe Stratus service:

正如我前面提到的,首先你必须连接到Adobe公司Stratus的服务:

private const StratusAddress:String = "rtmfp://stratus.adobe.com";private const DeveloperKey:String = "your-developer-key";private var netConnection:NetConnection; netConnection = new NetConnection();netConnection.addEventListener(NetStatusEvent.NET_STATUS,netConnectionHandler);netConnection.connect(StratusAddress + "/" + DeveloperKey);The developer key is issued when you sign up for an Adobe Developer Connection account and is available on the Adobe Stratus beta service site.

开发者钥匙是你通过登陆你的Adobe公司开发者帐户申请得到,这个申请在Adobe Stratus beta服务的网站。

Upon successful connection to Stratus, you get a NetConnection.Connect.Success event. There could be several reason for connection failure. If you provide an invalid developer key or incorrectly specify Stratus address, you'll receive NetConnection.Connect.Failed. If your firewall blocks outgoing UDP traffic, you'll receive the NetConnection.Connect.Failed event after a 90-second timeout.

在成功连接到Stratus,你得到NetConnection.Connect.Success事件。失败可能有几个方面的原因。如果您提供了一 个无效的开发者或不正确的钥匙指定地址,您将收到NetConnection.Connect.Failed 。如果你的防火墙阻挡即将发送的UDP通信,您会收到的NetConnection.Connect.Failed事件后, 90秒超时。

After successfully establishing a connection to the Stratus service, you are assigned a unique 256-bit peer ID (NetConnection.nearID). Other Flash Player endpoints must know this peer ID in order to receive your published audio/video streams. It is out of the scope of Flash Player or the Stratus service how these peer IDs are exchanged among Flash Player endpoints. For exchanging peer IDs, you may use an XMPP service or a simple web service, as the Video Phone sample application does.

在成功建立连接的Stratus服务中,您被分配一个独特的256位peer ID( NetConnection.nearID ) 。其他Flash Player的端点必须知道这个peer ID,以便收到您发表的音频/视频流。Flash Player或Stratus的服务是如何将这些ID在需要通讯的Flash Player客户端内传递,不在文章讨论范围内。对于交换ID ,你可以使用一个XMPP协议的服务或一个简单的网络服务,如视频电话样本应用程序。

Direct communications between Flash Player instances is conducted using unidirectional NetStream channels. That is, if you want two-way voice conversation, each Flash Player endpoint must create a sending NetStream and a receiving NetStream.

Flash Player实例直接通讯使用单向网流渠道。也就是说,如果你想双向语音交谈,每个Flash Player的端点必须建立一个发送NetStream和接收NetStream。

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器