- 浏览: 500030 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
michao:
大哥,还有aperture.exe吗? 发我一份,找不到呀,m ...
使用aperture框架让AS3与C++通信,执行本地代码 -
Aaron-Joe-William:
文件被删除了。下不了。
SQLite 数据库加密的一种解决方案 -
hanmiao:
樓主的文章不就是來自IBM Developers里的http: ...
mina 入门 -
howesen:
断包与粘包问题,需要处理下就好了
mina接收数据不全(2) -
sniciq:
git clone --recursive git://git ...
ESB学习笔记(Spring Integration实战)
作者: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) 或者音频视频流。RTMP 是streaming 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.
为了能够使用RTMFP ,Flash Player 客户端必须连接到一个支持RTMFP 协议的服务器,例如Adobe Stratus beta 服务器或者是新版本的FMS 。Stratus 是一台用于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:
- stratus_article_assets.zip (ZIP, 13K)
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 Player ,RTMFP 建立在 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 Player 和Stratus (如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 通信的用,可能和你对应端的防火墙不能够允许通过。当一个端点设在一个所谓的 “ 对称的防火墙, ” 的后面,端到端的通信可能是不可以实现。 (对于多种防火墙,请进入维基百科参阅 网络地址转换 。 )在这种情况下,你可以使用转代理援助你防火墙穿越。
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
)
通信。
安全
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
上的帮助:
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
的服务:
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
在成功连接到
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 (
在成功建立连接的
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
Flash Player
实例直接通讯使用单向网流渠道。也就是说,如果你想双向语音交谈,每个
Flash Player
的端点必须建立一个发送
First, create a sending
首先创建一个发送 This means that
这意味着,媒体作为一个端到端的流发布。由于Stratus
不能中继媒体,您只可以发布端到端的流。从您的设置管理器选择本地默认设备发出的流媒体将包括音频和视频。
Note:
Audio/video is not sent out until another Flash Player
endpoint subscribes to your
注:音频
/
视频无法发送,直到另一
Flash
Player
的客户端订阅您的媒体流。
Now, create the receiving
现在,创建接收 At this point, you hear audio and
you can create a
在这一点上,你听到声音,你可以创建一个视频对象显示视频。为了创造接收
高级主题
The publisher has fine control over
which endpoint can receive its published stream. When a subscriber attempts to
receive a published stream, the
发布者有良好的控制权而接收端可以接收其发布的流。当一个用户试图获得发布的流时,onPeerConnect
()方法被调用(默认简单执行返回true
)对发布的 On the publisher side, the 在发布方,
NetStream.peerStreams
属性中拥有所有订阅发布的实例。例如,使用
sendStream.send
()将发送相同的数据到所有用户。您可以使用下面的方法将信息发送到一个特定的用户:
The
NetConnection.maxPeerConnections
属性指定被允许连接发布者的peer
流的数量。默认值是设定为8
但在实践中,这取决于您的应用程序时,必须考虑到大多数互联网服务供应商提供非对称互联网接入服务的许可。图1
说明了直接和三个Flash Player
的实例通讯 。每个Flash Player
客户端发送和接收两个流,建立一个完全连接网格。从互联网下载的能力普遍高于上传的能力,你必须要格外小心,不要超负荷用户终端的上行能力。
Figure 1.
End-to-end connections using the Stratus service
图1
使用Stratus
服务点对点连接
The
NetConnection.unconnectedPeerStreams
属性是一个没有相关发布的
NetStreams
数组。当一个发部流同一个订阅流相互竞争时,订阅
Exploring the Video Phone sample application
探索视频电话示例应用程序
We have developed a sample
video phone application
for illustrating how to use end-to-end capabilities
of Flash Player 10. It is also available as part of this article.
我们已经开发了一个视频电话示例
,说明如何使用Flash Player 10
的端到端能力 。它也可作为部分文章。
The Video Phone sample application relies on a simple HTTP service to
exchange the Flash Player peer ID. The script is provided as part of the
package (reg.cgi). This web service does not provide any user authentication.
After Flash Player successfully connects to Stratus, it registers its peer ID
with the web service. When making a call, the Video Phone caller uses this web
service to look up recipient's peer ID.
该视频电话示例应用程序依赖于一个用于交流Flash Player peer ID
简单的HTTP
服务。提供的一部分该脚本,封装在( reg.cgi
) 。这种网络服务不提供任何用户认证。在Flash
播放器成功地连接到Stratus
,但其peer ID
的网络服务。当创建一个呼叫电话时,视频电话呼叫使用此网络服务来查找收件人的peer
ID
。
Adobe runs this web service exclusively for the hosted Video Phone sample.
When you build your own Video Phone sample, you must run your own web service
and specify WebServiceUrl in VideoPhoneLabs.mxml. You should override the
AbstractIdManager class to implement your own peer ID exchange mechanism—using,
for example, XMPP, Google Apps, or the Facebook framework.
Adobe
公司运行这一网络服务专门提供视频电话样本。当您建立自己的视频电话样本,则必须运行您自己的网络服务,并在 VideoPhoneLabs.mxml
指定WebServiceUrl
。您应该使用自己重写的AbstractIdManager
类来执行自己的peer ID
身份证交流机制,例如, XMPP
协议,谷歌应用服务,或Facebook
的框架。
The following steps are necessary to build a Video Phone sample
application (for more details, please see ReadMe.txt included in the package):
下列是建立一个视频电话示例应用程序的必要步骤(更多详情,请参阅ReadMe.txt
包中包含) :
1.
Host a web service
for the peer ID exchange using the provided reg.cgi Python script.
1.
使用主机网络服务提供的
peer ID
的
reg.cgi
Python
脚本。 2.
Update to Flex
Builder 3.0.2 to target Flash Player 10 or AIR 1.5.
2.
更新的Flex Builder 3.0.2
配置,
并对应开发于Flash Player 10
或AIR 1.5
环境下。
3.
Create a new Flex
project.
3.
创建一个新的 Flex
项目。
4.
Add the source
files from the package (VideoPhoneLabs.mxml, AbstractIdManager.as,
HttpIdManager.as, IdManagerError.as, and IdManagerEvent.as) to the project src
folder.
4.
添加源文件的包(
VideoPhoneLabs.mxml
,
AbstractIdManager.as
,
HttpIdManager.as
,
IdManagerError.as
,并
IdManagerEvent.as
)的项目源文件夹中。
5.
Configure your
project with Flex SDK 3.2 and target Flash Player 10 or AIR 1.5.
5.
调试你的项目配制为Flex
SDK 3.2
同时发布对象为Flash Player 10
或 AIR 1.5.
6.
Specify your
Stratus developer key in DeveloperKey in.
6.
在VideoPhoneLabs.mxml
文件中替换DeveloperKey
为您的Stratus
开发密钥。
7.
Specify the URL
for the web service in WebServiceUrl in.
7.
在VideoPhoneLabs.mxml
文件中替换WebServiceUrl
为指定的web service
。
The Video Phone sample application uses the phone model. The call
establishment procedure is implemented using end-to-end NetStream.send()
messages. Since you can use the NetStream.send() method only on an established
NetStream, Video Phone publishes a so-called "listener stream" (with
a fixed name) to which other Flash Player endpoints can connect. When client A
(the caller) wishes to communicate with client B (A calls B), he or she
subscribes to client B's listener stream. At this point, client B is notified
of the peer ID of the caller (using the onPeerConnect() method) and subscribes
to client A's media stream. Through this media stream, client A notifies client
B about his or her user-friendly name (using the NetStream.send() method),
which is presented to the user to either accept or reject the call. If the call
is accepted, client B publishes the media stream and two-way communications is
established.
该视频电话示例应用程序使用的手机模型。呼叫建立程序执行是使用端到端 NetStream.send
()的信息。既然你可以使用NetStream.send
( )方法只对指定的NetStream
,视频电话发表其他Flash Player
客户端可以连接的所谓的<spa
Security
ActionScript 3.0 API supporting
RTMFP
ActionScript 3.0 API
支持 RTMFP
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);
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.
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.
NetStream
channels. That is, if you want two-way voice conversation, each Flash Player
endpoint must create a sending
NetStream
and a receiving
NetStream
.
NetStream
和接收
NetStream
。
NetStream
:
NetStream
:
private var sendStream:NetStream;
sendStream = new NetStream(netConnection, NetStream.DIRECT_CONNECTIONS);
sendStream.addEventListener(NetStatusEvent.NET_STATUS,netStreamHandler);
sendStream.publish("media");
sendStream.attachAudio(Microphone.getMicrophone());
sendStream.attachCamera(Camera.getCamera());
media
is published as an end-to-end stream. Since Stratus cannot relay media, you can
publish only end-to-end streams. This stream will include both audio and video
from your local default devices chosen by the Settings Manager.
media
stream.
NetStream
:
NetStream
:
private var recvStream:NetStream;
recvStream = new NetStream(netConnection, id_of_publishing_client);
recvStream.addEventListener(NetStatusEvent.NET_STATUS, netStreamHandler);
recvStream.play("media");
Video
object to display video. In order to create the
receiving
NetStream
,
you must know the 256-bit peer ID of the publisher (
id_of_publishing_client
).
In order to receive audio/video, you must know the name of the stream being
published.
NetStream
,您必须知道发布者的
256
位
peer ID
(发布客户端的
id_
)
。为了接收音频
/
视频,您必须知道被发布出来的流的名字。
Advanced topics
onPeerConnect()
method is invoked
(default implementation simply returns
true
) on the published
NetStream
.
The publisher could disallow certain Flash Player endpoints to receive its
media:
NetStream
。发布者可以禁止某些Flash Player
的终端接收媒体:
var o:Object = new Object();
o.onPeerConnect = function(subscriberStream:NetStream):Boolean
{
if (accept)
{
return true;
}
else
{
return false;
}
}
sendStream.client = o;
NetStream.peerStreams
property holds all the subscribing instances of the publishing NetStream
.
For example, using sendStream.send()
will send the same data to all
subscribers. You can use the following to send information to a specific
subscriber:
sendStream.peerStreams[i].send()
NetConnection.maxPeerConnections
property specifies the number of peer streams that are allowed to connect to
the publisher. The default value is set to 8 but, in practice, depending on
your application, you must consider that most ISPs provide asymmetric Internet
access. Figure 1 illustrates the direct communication among three instances of
Flash Player. Each Flash Player endpoint sends and receives two streams,
creating a fully connected mesh. Since Internet download capacity is generally
much higher than upload capacity, you must be extra careful not to overload the
end-user's uplink.
NetConnection.unconnectedPeerStreams
property is an array of
NetStreams
that are not associated with a publishing
NetStream
yet. When a publishing stream matches a subscribing stream name, the
subscribing
NetStream
is moved from this array to the publishing
NetStream.peerStreams
array.
NetStream
从
NetStream.peerStreams
的数组中移除。
发表评论
-
十个Flex/Air疑难杂症及解决方案简略
2010-05-31 17:17 3294最近去一家台企面 ... -
Windows环境下配置+运行red5源码+AS3连接red5简单示例
2010-04-19 13:39 5145Windows环境下配置+运行red5源码+AS3连接red5 ... -
使用aperture框架让AS3与C++通信,执行本地代码
2010-04-08 16:48 3193我们都知道,AIR的效果是非常出色的,这也是大家喜欢她的原因, ... -
SQLITE入门至精通
2010-04-07 11:13 2960关键 ... -
教你解析FLEX JSON中的一个问题 关于键值 和键
2010-04-01 15:25 2265字符串:message = ' "param&quo ... -
air写文件保存在安装目录
2010-03-31 15:46 3173AIR中..保存文件我们般会像下面这样操作 var f ... -
弱弱的一个小问题,bitmapdata pngencoder base64 bytearray
2010-03-31 14:16 1114好久没写东东了,呵呵。随便写点点。关于bitmapdata如何 ... -
FLASH教程:SWF间的双向通信
2010-03-02 18:23 1314假设有一个主 SWf 名为 m ... -
如何把as文件生成swf格式文件
2010-03-02 18:22 5197一,从http://opensource.adobe.com/ ... -
Flex数据交互方法 :httpservice, webservice, RemoteObject, socket
2010-02-27 17:06 1879【转载】 文章分类:Flash编程 http://h ... -
理解Flash Player 9垃圾回收机制
2010-02-02 18:27 1035理解Flash Player 9垃圾回 ... -
BlazeDS入门教程-很详细-赞原创作者一个
2010-01-11 23:51 1678什么是BlazeDS呢?BlazeDS是一个基于服务器的Ja ... -
一些漂亮的Flex主题下载
2010-01-11 10:31 6112一些漂亮的Flex主题下载1Digg meWindows Cl ... -
ActionScript 3.0著名开源库 大集合
2009-12-29 17:26 1986这篇文章开始于对Adrian ... -
Flex 读取XML配置文件总结
2009-11-19 11:45 1943在Flex中我 ... -
一个list定义组件,网上找了很久没有,自己做了一个。
2009-10-29 11:55 1192一个list定义组件,网上找了很久没有,自己做了一个。希望对大 ... -
如何使用Flex RemoteObject components 与JAVA交互
2009-10-08 18:04 52372008-12-25 | 22:53分类:前端开发 ... -
flex 在线录制视频语音
2009-09-12 17:45 3562<?xml version="1.0" ... -
flex 蒙板 遮罩
2009-09-11 17:09 3838方法一 <mx:Image source=&q ... -
如何自定义FLEX3的loading进度条
2009-09-05 10:17 1712第一种:修改下载进度的文字为中文 建立扩展至 mx.prel ...
相关推荐
基于Stratus服务器的虚拟化系统在海洋石油平台中的应用.pdf
Stratus容错服务器在钢铁企业MES中的应用研究_MES_管理信息化0引言 钢铁企业MES是从企业经营战略到具体实施之间的一道桥梁,它针对钢铁企业生产运行、生产控制与管理信息不及时、不完全、生产与管理脱节、生产指挥...
NEC携手Stratus共同开发Linux容错服务器.pdf
Adobe Stratus P2p Demo 点对点示例 本人基于Adobe flash player 10.1 P2P的测试DEMO
Stratus美国容错隆重推出业界首台四核容错服务器 为Windows及Linux关键业务应用提供可靠及高效的运作保障.pdf
基于Adobe Stratus P2P HoolChat群聊应用
层云 实时语音到词云分析
描述了使用Cadence Stratus HLS工具设计和实现双精度浮点乘法部件,探索新设计方法学在关键路径延时调整、数据路径优化以及低功耗优化等问题的解决方法,并探讨如何将新的设计流程结合到原有项目开发中等问题。...
简单地说,容错就是当由于种种原因在系统中出现了数据、文件损坏或丢失时,系统能够自动将这些损坏或丢失的文件和数据恢复到发生事故以前的状态,使系统能够连续正常运行的一种技术。 容错服务器的介绍全文共20页,...
The first high-level synthesis platform for use across your entire SoC design, Stratus High-Level Synthesis (HLS) delivers up to 10X better productivity than traditional RTL design. Based on more than...
ftServer采用Stratus Technologies,Inc(美国容错技术公司)30年的可靠性设计技术,在Intel的IA架构上推出的具有无可匹敌的稳定性的计算机运行平台。同时得益于Intel Xeon多核芯片技术的强大处理能力,保障用户对...
了解更多关于边缘计算的信息,并听取一些最睿智的自动化工程师的意见。 请下载 Stratus 为工程师提供的简化边缘计算解决方案。
资源分类:Python库 所属语言:Python 资源全名:stratus-0.0.23.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
例如,也可以说它构成了一个集成了前端和后端的平台,该平台使用户可以专注于更正确地实现其应用程序的逻辑,因为它避免了必须使用api,ajax调用在两种环境之间实现通信等StratusPHP将负责通信数据和事件,这将允许...
语言:English (UK) 在文本中标识ATT&CK企业技术的单词指示符。 网页上正在描述一个简单,轻巧的...该应用程序突出显示与预定义正则表达式的匹配项(可能表示技术描述),并在弹出窗口中显示摘要。 目前在阿尔法。
Stratus Sound是一个单页面的全堆栈Web应用程序,用于流传输和共享音乐。 它使用Ruby on Rails,后端使用PostgreSQL数据库,前端使用React.js和Redux。 特征 使用RESTful API上传,编辑,删除和查看曲目 创建歌曲并...
通过利用API,sipdesk扩展程序将搜索任何内部数据库并在新窗口中显示结果,sipdesk应用程序还可以识别在其中显示的任何电话号码。 Google Chrome浏览器并将其转换为可点击的链接,以实现无缝点击拨号。
这个是一个关于stratus容错服务器的资源文件
Adobe Stratus 与 php + Mysql 实现p2p的语音视频聊天