通过Stratus 服务器在Flash Player中使用RTMFP 开发 点对点应用(一)

作者:Jozsef Vass   译者:巴巴鲁 (请转载时注明和改编时出处,谢谢)

这次翻译篇比较长,也比较有用的文章,也很重要的文章,算是元旦给FLASH FUNS的礼物吧!

Adobe Flash Player 10 and Adobe AIR 1.5 introduce a new communications
protocol, Real-Time Media Flow Protocol (RTMFP), whose low latency, end-to-end
peering capability, security, and scalability make it especially well suited
for developing real-time collaboration applications by not only providing
superior user experience but also reducing operators’ costs.

Adobe Flash Player 10 Adobe AIR
1.5
引入了一个新的通讯协议,Real-Time Media Flow Protocol (RTMFP)
其低延迟,端到端的对等功能,安全性和可扩展性使它特别适合开发实时协作应用,不仅提供卓越的用户体验,而且运营商降低成本。

Earlier versions of Flash Player use Real-Time
Messaging Protocol
(RTMP) and require Adobe Flash Media Server (FMS) for
interactive collaboration applications (such as Adobe Acrobat Connect Pro) or
audio/video streaming. While RTMP is an excellent choice for streaming media,
shared objects, or remoting, it has limited ability of meeting real-time
requirements of interactive audio and video communications.

早前的Flash Player 版本使用Real-Time
Messaging Protocol
(RTMP)
需要Adobe Flash Media
Server (FMS)
提供合作应用(例如 Adobe
Acrobat Connect Pro)
或者音频视频流。RTMPstreaming media, shared objects, remoting连接的卓越选择,
它满足实时性要求的交互式音频和视频通信的能力有限。

In order to use RTMFP, Flash Player endpoints must connect to an
RTMFP-capable server, such as the
Adobe
Stratus beta
service or a future version of FMS. Stratus is a hosted
rendezvous service that aids establishing communications between Flash Player
endpoints. Unlike FMS, Stratus does not support media relay, shared objects,
scripting, etc. So by using Stratus, you can develop applications only where
Flash Player endpoints are directly communicating with one another.

为了能够使用RTMFPFlash Player 客户端必须连接到一个支持RTMFP协议的服务器,例如Adobe
Stratus beta
服务器或者是新版本的FMSStratus
是一台用于Flash Player 客户端间通信的主机。不同于FMS,
Stratus
不支持视频转播,shared objects,脚本,等。
因此,使用Stratus,只可以开发Flash Player的客户端直接相互交流的应用程序。

Flash Player is already the market leader in online video distribution
over the web. With the introduction of RTMFP and advanced media compression
technologies, Flash Player 10 is well positioned as the leader in real-time
communications as well.

Flash Player 已经在web视频领域占有重要的市场份额。由于采用RTMFP和先进的媒体压缩技术,将有利于Flash Player 10处于实时通信的领先地位。

In this article, I first highlight the benefits of using RTMFP in
real-time communications applications. Second, I describe the new ActionScript
3.0 API for managing direct end-to-end RTMFP connections. Finally, I present
our VideoPhone sample application.

在这篇文章中,我首先强调在即时通讯领域使用RTMFP的优势。其次,我将要介绍直接管理点对点RTMFP管理所对应的新的ActionScript 3.0 API。最后,我介绍我们的VideoPhone应用实例。

Requirements

要求

In order to make the most of this article, you need the following software
and files:

为了使用文中的文件,你需要以下软件和文件:

Flex Builder 3

Note: Please follow the instructions
in
Introducing
Flex SDK 3.2 and Flex Builder 3.0.2
to install Flex Builder 3.0.2. This
also includes Flex SDK 3.2, which is required to build applications targeting
Flash Player 10. Although you may also use Adobe Flash Professional CS4 for
development, this article instructs how to build a sample application using
Flex Builder 3.

注意:请按照Introducing
Flex SDK 3.2 and Flex Builder 3.0.2
指南中的方法去安装Flex
Builder 3.0.2.
这里面包括Flex SDK 3.2, 这是为了建立 Flash Player 10应用。尽管你也可以使用Adobe Flash
Professional CS4
作为开发工具,但这篇文件指导你如果使用Flex Builder 3建立一个简单的应用.

Flash Player 10

Sample files:

Prerequisite knowledge

预备知识

Familiarity with ActionScript 3.0 and Flex Builder is required.

熟悉ActionScript 3.0 Flex Builder 是必要的。

Benefits of RTMFP

RTMFP的好处

Real-Time Media Flow Protocol (RTMFP) is a new communications protocol
introduced in Flash Player 10 and also available in AIR 1.5. One of its major
differentiators from Real-Time Messaging Protocol (RTMP), which is based on the
Transmission Control Protocol (TCP) and exclusively used in previous versions
of Flash Player, is that RTMFP is built on User Datagram Protocol (UDP).

Real-Time Media Flow Protocol (RTMFP)是一个引入到Flash Player 10 in AIR 1.5新的通讯协议。同Real-Time Messaging Protocol (RTMP)的主要不同点之一是,RTMP基于传输控制协议 (TCP) 和 先前版本的Flash PlayerRTMFP建立在 User Datagram Protocol (UDP)协议.

While TCP provides reliable data delivery (well applicable for file
transfer, e-mail, etc.), it does not provide any end-to-end delay guarantees.
Reliable data transmission in TCP is achieved by re-transmission of lost data,
which introduces latency. Because minimizing end-to-end delay is one of the
most important goals in real-time communications (a few hundred milliseconds’
delay may render a conversation unusable), TCP is not well suited for this
purpose. Transmission error resilience and recovery form an integral part of
most advanced audio and video compression techniques—such as Speex audio and
H.264 video codec, both available in Flash Player 10. Reliable delivery
provided by TCP is therefore not needed. As a result, UDP, which provides an
efficient and rapid data delivery, is popularly used in real-time collaboration
applications where minimizing end-to-end delay is of paramount importance.
Another advantage of UDP over TCP that it enables end-to-end peering—that is,
direct data transmission between two clients located behind network address
translators (NATs).

TCP提供了可靠的数据传输(也适用于文件传输,电子邮件等) ,它没有提供任何端到端延迟保证。可靠的数据传输的TCP实现了重新传输丢失的数据,其中包括了延迟。由于尽量减少端到端延迟是实时通信 (几百毫秒的延迟可能使一个会话不可用)中最重要的一个目标,TCP是不适合用于这一目的。传输错误复原和恢复不可分割的组成部分,最先进的音频和视频压缩技术,如Speex音频和H.264视频编解码器,可同时在Flash Player 10 因此,可靠的交付所提供的TCP没有必要的。因此, UDP连接,它提供了一个高效,快速的数据传输,是普遍使用的实时协作应用,尽量减少端到端延迟是至关重要的。另一个优势在于 UDP连接,它使端到端的对等,也就是说,数据直接的传输客户之间后面网络地址转换( NAT ) 。

When compared to RTMP, RTMFP provides the following advantages for
real-time communications:

当同RTMP做对比,RTMFP提供下列高级的即时通讯:

  • Low latency: Since RTMFP is built on top of UDP, it provides
    minimal latency for real-time communications. It is important to note that
    RTMFP provides both reliable and unreliable service. When sending data
    between two Flash Player instances (for example, using the
    NetStream.send() method), reliable data transmission is used. When sending
    Speex audio between two Flash Player instances, unreliable delivery is
    used, providing the smallest possible latency.
  • 低延迟:一但RTMFP建立起了UDP,它将给即时通讯提供最小的延迟。重要的是要注意RTMFP提供了可靠和不可靠的服务。当在两个Flash Player 实例之间发送数据的时候(例如,使用NetStream.send()方法),可靠的数据传输被使用。当在两个Flash Player 实例之间发送Speex 音频的时候,不可靠的交互方式被使用,以提供最小的延迟。
  • End-to-end
    media delivery:
    Media is
    sent directly between two Flash Player instances without routing through a
    central relay server. When compared to RTMP, where all data is sent
    through Flash Media Server, RTMFP not only further reduces end-to-end
    delay, but also eliminates costs associated with a central data relay,
    thus lending itself to extremely scalable deployments.
  • 点对点媒体传输:媒体直接发送给两个Flash Player的情况下,不通过路由,而是通过一个中央中继服务器。当同RTMP相比发现,在所有通过Flash
    Media Server
    传送的数据, RTMFP不仅进一步降低了端到端的延迟,而且也消除了中央数据中继的相关开销,因此,有助于自身的可扩展性部署。
  • Data
    prioritization:
    Audio is
    transmitted with higher priority than video and non-time critical data
    (such as instant message, etc.). This can significantly enhance user
    experience over a bandwidth constrained communications channel.

  • 数据的优先次序:音频传输具有较高优先于视频和非时间关键数据(如即时信息等) 。这可以通过带宽通信通道的限制大大提高在用户体验。

All of these features represent tremendous benefits for real-time
communications, providing a significantly greater user experience than is
achievable with earlier versions of Flash Player.

所有这些功能代表了应用于实时通信的巨大优势,提供了一个极大的用户体验,其成就比早期版本的Flash播放器的效应更为巨大。

Firewall traversal

穿越防火墙

RTMFP is built on top of UDP, which enables direct connection between
clients even if they are located behind NATs or firewalls. In order for RTMFP
to work, your firewall must be configured to allow outgoing UDP traffic. While
this is the case with most consumer or small office/home office (
SOHO) firewalls, many corporate firewalls block UDP
traffic altogether.

RTMFP是建立在UDP连接的基础上,使客户端直接的通信,即使它们位于NATs(译者注:是一个网络协议允许客户端后面的NAT (网络地址转换) ,以找出其公共地址,类型的NAT是延迟和互联网方面的端口相关的网络地址转换,尤其本地端口。此信息是用来建立UDP连接(用户数据报协议)之间的沟通 两个主机都是延迟的NAT路由器。该议定书是指在RFC 3489)或防火墙。为了RTMFP工作,您的防火墙必须配置为允许即将发出的UDP通信。大多数的消费者或小型办公室/家庭办公室( SOHO )的防火墙是这种情况,许多企业防火墙完全阻止UDP通信。

One solution is to configure Flash Player to use a TURN proxy (Traversal
Using Relays around NAT). Flash Player supports IETF Internet Draft
draft-ietf-behave-turn-08 without authentication. If the network administrator
configures a TURN proxy that allows outgoing UDP, Flash Player can be
configured by adding the following line in mms.cfg (for more information on
Flash Player configuration and the location of mms.cfg, please read the
Adobe
Flash Player Administration Guide for Flash Player 10
):

一种解决办法是配置的Flash
Player
使用转向代理 (遍历周围可用的NAT Flash Player的支持IETF的因特网草案draft-ietf-behave-turn-08。如果网络管理员配置转向代理,允许即将发送的UDP连接, Flash播放器可以增加在mms.cfg的配置(更多的信息Flash Player的配置和位置mms.cfg
,请阅读Adobe
Flash Player的管理指南的Flash
Player 10

RTMFPTURNProxy=ip_address_or_hostname_of_TURN_proxy

Direct UDP traffic is always attempted and the TURN proxy is only used as
a backup: it is used for UDP traffic that cannot flow between Flash Player and
Stratus (in case of UDP blocking firewall) or between Flash Player endpoints.

直接UDP通信总是被尝试,转向代理只是用来作为备份:它是用于UDP通信,不能在Flash PlayerStratus (如UDP协议封锁防火墙)之间或Flash Player的端点之间流动。

Even if your firewall enables outgoing UDP traffic, it is possible that
end-to-end peering cannot be established due to a combination of firewalls.
When one endpoint is located behind a so-called "symmetric firewall,"
end-to-end communications may not be possible. (For a classification of
firewalls, please see the Network
address translation
entry on Wikipedia.) In this situation, you may use a
TURN proxy to aid firewall traversal.

即使你的防火墙使即将发送的UDP通信的用,可能和你对应端的防火墙不能够允许通过。当一个端点设在一个所谓的对称的防火墙,的后面,端到端的通信可能是不可以实现。 (对于多种防火墙,请进入维基百科参阅 网络地址转换
)在这种情况下,你可以使用转代理援助你防火墙穿越。

通过Stratus 服务器在Flash Player中使用RTMFP 开发 点对点应用(二)

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: