- 浏览: 516872 次
- 性别:
- 来自: 深圳
-
文章分类
最新评论
-
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 3389最近去一家台企面 ... -
Windows环境下配置+运行red5源码+AS3连接red5简单示例
2010-04-19 13:39 5205Windows环境下配置+运行red5源码+AS3连接red5 ... -
使用aperture框架让AS3与C++通信,执行本地代码
2010-04-08 16:48 3289我们都知道,AIR的效果是非常出色的,这也是大家喜欢她的原因, ... -
SQLITE入门至精通
2010-04-07 11:13 3066关键 ... -
教你解析FLEX JSON中的一个问题 关于键值 和键
2010-04-01 15:25 2355字符串:message = ' "param&quo ... -
air写文件保存在安装目录
2010-03-31 15:46 3258AIR中..保存文件我们般会像下面这样操作 var f ... -
弱弱的一个小问题,bitmapdata pngencoder base64 bytearray
2010-03-31 14:16 1185好久没写东东了,呵呵。随便写点点。关于bitmapdata如何 ... -
FLASH教程:SWF间的双向通信
2010-03-02 18:23 1407假设有一个主 SWf 名为 m ... -
如何把as文件生成swf格式文件
2010-03-02 18:22 5338一,从http://opensource.adobe.com/ ... -
Flex数据交互方法 :httpservice, webservice, RemoteObject, socket
2010-02-27 17:06 1977【转载】 文章分类:Flash编程 http://h ... -
理解Flash Player 9垃圾回收机制
2010-02-02 18:27 1117理解Flash Player 9垃圾回 ... -
BlazeDS入门教程-很详细-赞原创作者一个
2010-01-11 23:51 1765什么是BlazeDS呢?BlazeDS是一个基于服务器的Ja ... -
一些漂亮的Flex主题下载
2010-01-11 10:31 6211一些漂亮的Flex主题下载1Digg meWindows Cl ... -
ActionScript 3.0著名开源库 大集合
2009-12-29 17:26 2080这篇文章开始于对Adrian ... -
Flex 读取XML配置文件总结
2009-11-19 11:45 2018在Flex中我 ... -
一个list定义组件,网上找了很久没有,自己做了一个。
2009-10-29 11:55 1281一个list定义组件,网上找了很久没有,自己做了一个。希望对大 ... -
如何使用Flex RemoteObject components 与JAVA交互
2009-10-08 18:04 53492008-12-25 | 22:53分类:前端开发 ... -
flex 在线录制视频语音
2009-09-12 17:45 3691<?xml version="1.0" ... -
flex 蒙板 遮罩
2009-09-11 17:09 3896方法一 <mx:Image source=&q ... -
如何自定义FLEX3的loading进度条
2009-09-05 10:17 1772第一种:修改下载进度的文字为中文 建立扩展至 mx.prel ...
相关推荐
Adobe Stratus是一个由Adobe公司提供的免费服务,它利用Flash Player的实时通信技术(RTMFP)来实现点对点(P2P)的数据传输。在本文中,我们将深入探讨如何结合Adobe Stratus、PHP和MySQL来创建一个语音视频聊天...
1. **P2P连接**:通过RTMFP协议,用户可以直接与其他用户建立连接,实现视频和音频流的点对点传输。这减少了服务器的压力,并且在用户之间有良好网络连接的情况下,可以提供更流畅的体验。 2. **实时通信**:RTMFP...
内容概要:本文详细介绍了如何利用威纶通触摸屏及其配套软件EasyBuilder Pro构建一个水箱液位控制的PID仿真程序。主要内容涵盖触摸屏界面设计、PID算法实现、通信配置以及仿真模型搭建等方面。文中不仅提供了具体的代码示例,还分享了许多调试经验和优化技巧,如抗积分饱和处理、通信同步设置等。此外,作者还强调了实际应用中的注意事项,例如参数范围限制、突发情况模拟等。 适合人群:从事工业自动化领域的工程师和技术人员,尤其是对PID控制器有一定了解并希望深入掌握其实际应用的人群。 使用场景及目标:适用于需要进行水箱液位控制系统设计、调试和优化的工作环境。主要目标是帮助读者理解和掌握PID控制的基本原理及其在实际工程项目中的具体实现方法。 其他说明:附带完整的工程文件可供下载,便于读者快速上手实践。文中提到的所有代码片段均经过实际验证,确保可靠性和实用性。
内容概要:《2024年中国城市低空经济发展指数报告》由36氪研究院发布,指出低空经济作为新质生产力的代表,已成为中国经济新的增长点。报告从发展环境、资金投入、创新能力、基础支撑和发展成效五个维度构建了综合指数评价体系,评估了全国重点城市的低空经济发展状况。北京和深圳在总指数中名列前茅,分别以91.26和84.53的得分领先,展现出强大的资金投入、创新能力和基础支撑。低空经济主要涉及无人机、eVTOL(电动垂直起降飞行器)和直升机等产品,广泛应用于农业、物流、交通、应急救援等领域。政策支持、市场需求和技术进步共同推动了低空经济的快速发展,预计到2026年市场规模将突破万亿元。 适用人群:对低空经济发展感兴趣的政策制定者、投资者、企业和研究人员。 使用场景及目标:①了解低空经济的定义、分类和发展驱动力;②掌握低空经济的主要应用场景和市场规模预测;③评估各城市在低空经济发展中的表现和潜力;④为政策制定、投资决策和企业发展提供参考依据。 其他说明:报告强调了政策监管、产业生态建设和区域融合错位的重要性,提出了加强法律法规建设、人才储备和基础设施建设等建议。低空经济正加速向网络化、智能化、规模化和集聚化方向发展,各地应找准自身比较优势,实现差异化发展。
内容概要:本文详细介绍了多智能体协同编队控制的技术原理及其Python实现。首先通过生动形象的例子解释了编队控制的核心概念,如一致性算法、虚拟结构法、预测补偿等。接着深入探讨了编队形状的设计方法,包括如何利用虚拟结构法生成特定编队形状,并讨论了通信质量和参数调试的重要性。此外,还涉及了避障策略、动态权重分配以及故障检测等实际应用中的挑战和解决方案。最后,通过具体实例展示了如何将理论应用于实际项目中,如无人机编队表演、自动驾驶车队等。 适用人群:对多智能体系统、编队控制感兴趣的科研人员、工程师及高校师生。 使用场景及目标:适用于研究和开发多智能体协同编队控制系统的场景,旨在帮助读者理解并掌握相关技术和实现方法,提高系统的稳定性和可靠性。 其他说明:文中不仅提供了详细的代码示例,还分享了许多实践经验和技术细节,有助于读者更好地理解和应用这些技术。同时强调了参数调试、通信质量、预测补偿等方面的关键因素对于系统性能的影响。
内容概要:本文详细介绍了名为'MPC_ACC_2020-master'的四旋翼飞行器模型预测跟踪控制器(Matlab实现)。四旋翼飞行器由于其高度非线性和强耦合特性,在复杂环境中难以实现精准控制。模型预测控制(MPC)通过预测未来状态并在每一步进行在线优化,解决了这一难题。文中展示了关键代码片段,解释了系统参数定义、初始化、预测模型构建、成本函数构建、优化求解及控制输入的应用。此外,还探讨了MPC_ACC_2020-master如何通过精心设计的成本函数和优化算法确保四旋翼飞行器状态收敛到设定点。 适合人群:从事飞行器控制领域的研究人员和技术爱好者,尤其是对模型预测控制感兴趣的开发者。 使用场景及目标:适用于四旋翼飞行器的轨迹跟踪任务,旨在提高飞行器在复杂环境下的稳定性与准确性。具体应用场景包括但不限于无人机竞速、自动巡航、物流配送等。 其他说明:尽管该项目主要用于科研目的,但其简洁高效的代码结构也为实际工程应用提供了良好借鉴。同时,项目中存在一些待改进之处,如状态估计部分未考虑真实情况下的噪声干扰,后续版本计划移植到C++并集成进ROS系统。
内容概要:本文探讨了基于MATLAB2020b平台,采用CNN-LSTM模型结合人工大猩猩部队(GTO)算法进行电力负荷预测的方法。首先介绍了CNN-LSTM模型的基本结构及其在处理多变量输入(如历史负荷和气象数据)方面的优势。随后详细解释了如何通过GTO算法优化超参数选择,提高模型预测精度。文中展示了具体的MATLAB代码示例,包括数据预处理、网络层搭建、训练选项设定等方面的内容,并分享了一些实践经验和技术细节。此外,还讨论了模型的实际应用效果,特别是在某省级电网数据上的测试结果。 适合人群:从事电力系统数据分析的研究人员、工程师,以及对深度学习应用于时间序列预测感兴趣的开发者。 使用场景及目标:适用于需要精确预测未来电力负荷的情况,旨在帮助电力公司更好地规划发电计划,优化资源配置,保障电网安全稳定运行。通过本研究可以学习到如何构建高效的CNN-LSTM模型,并掌握利用GTO算法进行超参数优化的具体步骤。 其他说明:文中提到的一些技巧和注意事项有助于避免常见错误,提高模型性能。例如,合理的数据预处理方式、适当的超参数范围设定等都能显著改善最终的预测效果。
数据集一个高质量的医学图像数据集,专门用于脑肿瘤的检测和分类研究以下是关于这个数据集的详细介绍:该数据集包含5249张脑部MRI图像,分为训练集和验证集。每张图像都标注了边界框(Bounding Boxes),并按照脑肿瘤的类型分为四个类别:胶质瘤(Glioma)、脑膜瘤(Meningioma)、无肿瘤(No Tumor)和垂体瘤(Pituitary)。这些图像涵盖了不同的MRI扫描角度,包括矢状面、轴面和冠状面,能够全面覆盖脑部解剖结构,为模型训练提供了丰富多样的数据基础。高质量标注:边界框是通过LabelImg工具手动标注的,标注过程严谨,确保了标注的准确性和可靠性。多角度覆盖:图像从不同的MRI扫描角度拍摄,包括矢状面、轴面和冠状面,能够全面覆盖脑部解剖结构。数据清洗与筛选:数据集在创建过程中经过了彻底的清洗,去除了噪声、错误标注和质量不佳的图像,保证了数据的高质量。该数据集非常适合用于训练和验证深度学习模型,以实现脑肿瘤的检测和分类。它为开发医学图像处理中的计算机视觉应用提供了坚实的基础,能够帮助研究人员和开发人员构建更准确、更可靠的脑肿瘤诊断系统。这个数据集为脑肿瘤检测和分类的研究提供了宝贵的资源,能够帮助研究人员开发出更准确、更高效的诊断工具,从而为脑肿瘤患者的早期诊断和治疗规划提供支持。
内容概要:本文详细介绍了STM32F103的CAN通讯和IAP升级Bootloader的源码实现及其硬件设计。首先,针对CAN通讯部分,文章深入探讨了CAN外设的初始化配置,包括波特率、位时间、过滤器等重要参数的设置方法,并提供了一段完整的初始化代码示例。接着,对于IAP升级Bootloader,文中讲解了通过CAN总线接收HEX文件并写入Flash的具体实现步骤,以及如何安全地从Bootloader跳转到应用程序。此外,文章还附上了原理图和PCB文件,有助于理解和优化硬件设计。最后,作者分享了一些实用的调试技巧和注意事项,如终端电阻的正确使用、CRC校验的应用等。 适合人群:嵌入式系统开发者、硬件工程师、从事STM32开发的技术人员。 使用场景及目标:适用于正在开发STM32相关项目的工程师,尤其是那些需要实现CAN通讯和固件在线升级功能的人群。通过学习本文提供的源码和技术要点,可以帮助他们快速掌握相关技能,提高开发效率。 其他说明:本文不仅提供了详细的代码示例,还包含了丰富的实践经验分享,能够帮助读者更好地理解和解决实际开发中遇到的问题。
工具集语音、监控、摄像头、画笔等功能于一体!清晰语音录入,确保声画同步;监控级画面录制,操作细节无遗漏;摄像头多视角呈现,让内容更生动。录制时,画笔可标注重点,快速传递关键信息。自带视频播放,无需第三方;快捷键操作便捷,录制高效。强大解码器兼容多格式,不同设备随心播放。无论是教学、办公还是创作
内容概要:本文详细介绍了西门子S7-1500 PLC在制药厂洁净空调建筑管理系统(BMS)中的应用案例。重点讨论了硬件配置(1500 CPU + ET200SP分布式IO)、温湿度控制策略(串级PID、分程调节)、以及具体的编程实现(SCL语言)。文中分享了多个技术细节,如PT100温度采集、PID控制算法优化、报警管理和HMI界面设计等。此外,作者还提到了一些调试过程中遇到的问题及其解决方案,如PID_Compact块的手动模式设定值跳变问题、博图V15.1的兼容性问题等。 适合人群:从事工业自动化领域的工程师和技术人员,特别是那些对PLC编程、温湿度控制和洁净空调系统感兴趣的读者。 使用场景及目标:适用于制药厂或其他对温湿度控制要求严格的行业。主要目标是确保洁净空调系统的高效运行,将温湿度波动控制在极小范围内,保障生产环境的安全性和稳定性。 其他说明:本文不仅提供了详细的编程代码和硬件配置指南,还分享了许多实践经验,帮助读者更好地理解和应用相关技术。同时,强调了在实际项目中需要注意的关键点和潜在问题。
2025年6G近场技术白皮书2.0.pdf
少儿编程scratch项目源代码文件案例素材-Frogeon.zip
2025年感知技术十大趋势深度分析报告.pdf
内容概要:本文详细介绍了一种用于解决车间调度问题的遗传算法(Matlab实现),即JSPGA。文章首先介绍了遗传算法的基本概念及其在车间调度问题中的应用场景。接着,作者展示了完整的Matlab源码,包括参数设置、种群初始化、选择、交叉、变异、适应度计算以及结果输出等模块。文中还特别强调了适应度计算方法的选择,采用了最大完工时间的倒数作为适应度值,并通过三维甘特图和迭代曲线直观展示算法性能。此外,文章提供了多个调参技巧和改进方向,帮助读者更好地理解和应用该算法。 适合人群:对遗传算法感兴趣的研究人员、工程师以及希望深入理解车间调度问题求解方法的技术爱好者。 使用场景及目标:适用于需要优化多台机器、多个工件加工顺序与分配的实际工业生产环境。主要目标是通过遗传算法找到最优或近似最优的调度方案,从而减少最大完工时间,提高生产效率。 其他说明:文章不仅提供了详细的理论解释和技术细节,还包括了大量实用的代码片段和图表,使读者能够轻松复现实验结果。同时,作者还分享了一些个人经验和建议,为后续研究提供了有价值的参考。
内容概要:本文深入探讨了永磁同步电机(PMSM)的最大转矩电流比(MTPA)控制算法,并详细介绍了基于Simulink的仿真模型设计。首先,文章阐述了PMSM的数学模型,包括电压方程和磁链方程,这是理解控制算法的基础。接着,解释了矢量控制原理,通过将定子电流分解为励磁电流和转矩电流分量,实现对电机的有效控制。随后,重点讨论了MTPA控制的目标和方法,即在限定电流条件下最大化转矩输出。此外,文章还涉及了前馈补偿、弱磁控制和SVPWM调制等关键技术,提供了具体的实现代码和仿真思路。最后,通过一系列实验验证了各控制策略的效果。 适合人群:从事电机控制系统设计的研究人员和技术人员,尤其是对永磁同步电机和Simulink仿真感兴趣的工程师。 使用场景及目标:适用于希望深入了解PMSM控制算法并在Simulink环境中进行仿真的技术人员。主要目标是掌握MTPA控制的核心原理,学会构建高效的仿真模型,优化电机性能。 其他说明:文中不仅提供了详细的理论推导,还有丰富的代码示例和实践经验,有助于读者快速理解和应用相关技术。同时,强调了实际工程中常见的问题及解决方案,如负载扰动、弱磁控制和SVPWM调制等。
内容概要:本文详细介绍了三机并联的风光储混合系统在Matlab中的仿真方法及其关键技术。首先,针对光伏阵列模型,讨论了其核心二极管方程以及MPPT(最大功率点跟踪)算法的应用,强调了环境参数对输出特性的影响。接着,探讨了永磁同步风机的矢量控制,尤其是转速追踪和MPPT控制策略。对于混合储能系统,则深入讲解了超级电容和蓄电池的充放电策略,以及它们之间的协调机制。此外,还涉及了PQ控制的具体实现,包括双闭环结构的设计和锁相环的优化。最后,提供了仿真过程中常见的问题及解决方案,如求解器选择、参数敏感性和系统稳定性等。 适合人群:从事电力电子、新能源系统设计与仿真的工程师和技术人员,以及相关专业的研究生。 使用场景及目标:适用于希望深入了解风光储混合系统工作原理的研究人员,旨在帮助他们掌握Matlab仿真技巧,提高系统设计和优化的能力。 其他说明:文中不仅提供了详细的理论推导和代码示例,还分享了许多实践经验,有助于读者更好地理解和应用所学知识。
本书由国际发展研究中心(IDRC)和东南亚研究院(ISEAS)联合出版,旨在探讨亚洲背景下电子商务的发展与实践。IDRC自1970年起,致力于通过科学技术解决发展中国家的社会、经济和环境问题。书中详细介绍了IDRC的ICT4D项目,以及如何通过项目如Acacia、泛亚网络和泛美项目,在非洲、亚洲和拉丁美洲推动信息通信技术(ICTs)的影响力。特别强调了IDRC在弥合数字鸿沟方面所作出的贡献,如美洲连通性研究所和非洲连通性项目。ISEAS作为东南亚区域研究中心,专注于研究该地区的发展趋势,其出版物广泛传播东南亚的研究成果。本书还收录了电子商务在亚洲不同国家的具体案例研究,包括小型工匠和开发组织的电子商务行动研究、通过互联网直接营销手工艺品、电子营销人员的创新方法以及越南电子商务发展的政策影响。
2025工业5G终端设备发展报告.pdf
内容概要:本文档《Java经典面试笔试题及答案.docx》涵盖了广泛的Java基础知识和技术要点,通过一系列面试题的形式,深入浅出地讲解了Java的核心概念。文档内容包括但不限于:变量的声明与定义、对象序列化、值传递与引用传递、接口与抽象类的区别、继承的意义、方法重载的优势、集合框架的结构、异常处理机制、线程同步、泛型的应用、多态的概念、输入输出流的使用、JVM的工作原理等。此外,还涉及了诸如线程、GUI事件处理、类与接口的设计原则等高级主题。文档不仅解释了各个知识点的基本概念,还提供了实际应用场景中的注意事项和最佳实践。 适合人群:具备一定Java编程基础的学习者或开发者,特别是准备参加Java相关岗位面试的求职者。 使用场景及目标:①帮助读者巩固Java基础知识,提升对Java核心技术的理解;②为面试做准备,提供常见面试题及其详细解答;③指导开发者在实际项目中应用Java的最佳实践,优化代码质量和性能。 其他说明:文档内容详实,涵盖了Java开发中的多个方面,从基础语法到高级特性均有涉及。建议读者在学习过程中结合实际编程练习,加深对各个知识点的理解和掌握。同时,对于复杂的概念和技术,可以通过查阅官方文档或参考书籍进一步学习。