`
hehailin1986_163.com
  • 浏览: 154385 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Stratus service for developing end2end applications using RTMFP in Flash Play 10

阅读更多

仅个人学习之用

http://www.adobe.com/devnet/flashplayer/articles/rtmfp_stratus_app.html

Reference Site:http://labs.adobe.com/technologies/cirrus/
YOU CAN GETTING START FROM THE LINKS ON THE BOTTOM "Getting Started", LIKE "Review the RTMFP groups overview"

 

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.

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.

In order to use RTMFP, Flash Player endpoints must connect to an RTMFP-capable server, such as the Adobe Stratus beta service or upcoming Flash Media Server 4. 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.

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.

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

Benefits of 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).

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).

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

  • 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 theNetStream.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.
  • 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.
  • 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.

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.

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):

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.

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.

Stratus service

Flash Player instances must connect to the Adobe Stratus service (usingrtmfp://stratus.rtmfp.net) 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.

RTMFP support will be available in Flash Media Server 4. 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).

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.

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.

ActionScript 3 API supporting RTMFP

There is a new ActionScript 3 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 with either Flash Professional (CS4 or later) or Flash Builder 4 targeting Flash Player 10 or AIR 1.5.

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

private const StratusAddress:String = "rtmfp://stratus.rtmfp.net"; 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.

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.

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.

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

First, create a sending 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());

This means that 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.

Note: Audio/video is not sent out until another Flash Player endpoint subscribes to your mediastream.

Now, create the receiving NetStream:

private var recvStream:NetStream; recvStream = new NetStream(netConnection, id_of_publishing_client); recvStream.addEventListener(NetStatusEvent.NET_STATUS, netStreamHandler); recvStream.play("media");

At this point, you hear audio and you can create a 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.

Advanced topics

The publisher has fine control over which endpoint can receive its published stream. When a subscriber attempts to receive a published stream, the 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:

var o:Object = new Object(); o.onPeerConnect = function(subscriberStream:NetStream):Boolean { if (accept) { return true; } else { return false; } } sendStream.client = o;

On the publisher side, the 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()

The NetConnection.maxPeerConnections property specifiesthe number of peer streams that are allowed to connect to the publisher. Thedefault value is set to 8 but, in practice, depending on your application, youmust consider that most ISPs provide asymmetric Internet access. Figure 1illustrates the direct communication among three instances of Flash Player. Each FlashPlayer 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.

End-to-end connections using the Stratus service
Figure 1. End-to-end connections using the Stratus service

The 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.

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.

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.

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 specifyWebServiceUrl in VideoPhoneLabs.mxml. You should override the AbstractIdManagerclass to implement your own peer ID exchange mechanism—using, for example, XMPP, Google Apps, or the Facebook framework.

The following steps are necessary to build a Video Phone sample application (for more details, please see ReadMe.txt included in the package):

  1. Host a web service for the peer ID exchange using the provided reg.cgi Python script.
  2. Create a new Flex project in Flash Builder 4.
  3. Add the source files from the package (VideoPhoneLabs.mxml, AbstractIdManager.as, HttpIdManager.as, IdManagerError.as, and IdManagerEvent.as) to the project src folder.
  4. Specify your Stratus developer key in DeveloperKey in VideoPhoneLabs.mxml.
  5. Specify the URL for the web service in WebServiceUrl in VideoPhoneLabs.mxml.

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 theNetStream.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 theNetStream.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.

Where to go from here

In this article, I presented some of the most exciting features of the new RTMFP protocol along with an overview of the new ActionScript 3 API. After reading this article, you should have a good understanding of how to use this revolutionary protocol. I hope you will be developing blockbuster applications using the end-to-end and advanced media capabilities of Flash Player 10 and AIR 1.5.

 

分享到:
评论

相关推荐

    Adobe Stratus P2p Demo

    Adobe Stratus P2P Demo是一个基于Adobe Flash Player技术的点对点(Peer-to-Peer, 简称P2P)通信示例。这个DEMO旨在展示如何利用Adobe的Stratus服务实现用户间的实时视频和音频共享,无需通过服务器中转,从而降低...

    Adobe Stratus 与 php + Mysql 实现p2p的语音视频聊天

    Adobe Stratus是一个由Adobe公司提供的免费服务,它利用Flash Player的实时通信技术(RTMFP)来实现点对点(P2P)的数据传输。在本文中,我们将深入探讨如何结合Adobe Stratus、PHP和MySQL来创建一个语音视频聊天...

    Stratus ftServer 最可靠的计算机系统

    Stratus ftServer是一款由Stratus Technologies, Inc设计的高级计算机系统,它以其无可匹敌的稳定性和容错能力成为IT领域的佼佼者。这款产品基于Intel的IA架构,结合Intel Xeon多核处理器的高性能计算能力,为用户...

    Stratus简化边缘计算方案.zip

    2. **实时处理与低延迟**:边缘计算减少了数据传输到云端的时间,使得对实时性要求高的应用(如自动驾驶、远程医疗)能够快速响应,提高安全性和效率。 3. **数据安全与隐私**:由于数据在本地处理,减少了数据在...

    ifix3.5 软件手册 中英文

    Enhancements for Terminal Server Applications Application Project Management Tools Handheld Screen Size Support in the Create Picture Wizard OPC Enhancements Microsoft Windows Server 2003 ...

    Python库 | stratus-0.0.23.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:stratus-0.0.23.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    基于Adobe Stratus P2P HoolChat群聊应用

    Adobe Stratus是一款由Adobe公司开发的免费开源工具,它基于Peer-to-Peer(P2P)技术,专门用于实现实时的、低延迟的通信服务,如视频聊天、语音通话和多人在线互动应用。HoolChat群聊应用是利用Adobe Stratus技术...

    Stratus-Android:Stratus Android应用程序

    Stratus-Android是一款专为Android平台设计的应用程序,其核心功能是实现实时语音到词云的分析。在深入探讨这个项目之前,我们先要理解什么是词云。词云(Word Cloud)是一种可视化工具,它将文本数据中的关键词以...

    Stratus容错服务器在钢铁企业MES中的应用研究_MES_管理信息化_2067.doc

    Stratus容错服务器在钢铁企业的制造执行系统(MES)中扮演着至关重要的角色。MES作为企业战略与实际生产之间的桥梁,旨在解决钢铁企业生产管理中信息传递不及时、不完整和生产与管理脱节的问题。它通过连接现场控制...

    flexp2p视频聊天

    FlexP2P视频聊天是一种基于Adobe Flex技术和P2P(Peer-to-Peer)通信的实时多媒体聊天应用。Flex是Adobe开发的一种开源框架,主要用于构建富互联网应用程序(RIA),它允许开发者使用ActionScript语言创建交互性强、...

    Struts action 国际化 in18

    在探讨“Struts action 国际化 in18”这一主题时,我们首先需要理解Struts框架、国际化(Internationalization,通常缩写为i18n)的基本概念以及如何在Struts行动(Action)中实现国际化。 ### Struts框架简介 ...

    基于Stratus服务器的虚拟化系统在海洋石油平台中的应用.pdf

    标题中的“基于Stratus服务器的虚拟化系统在海洋石油平台中的应用”主要涉及的是如何利用Stratus公司的ftServer系列硬容错服务器以及虚拟化技术,提高海洋石油平台中央控制系统的稳定性和安全性。这一应用旨在解决老...

    PyPI 官网下载 | stratus-api-events-0.0.3.tar.gz

    标题中的"PyPI 官网下载 | stratus-api-events-0.0.3.tar.gz"表明这是一个在Python Package Index(PyPI)上发布的开源软件包。PyPI是Python社区广泛使用的资源库,开发者可以在这里发布自己的Python库,供其他用户...

    Stratus-crx插件

    语言:English (UK) 在文本中标识ATT&CK企业技术的单词指示符。 网页上正在描述一个简单,轻巧的Chrome扩展程序,该扩展程序可识别表示ATT&CK技术的语言。 威胁情报分析师和希望采用Mitre的ATT&CK框架的人员的理想...

    Stratus美国容错隆重推出业界首台四核容错服务器 为Windows及Linux关键业务应用提供可靠及高效的运作保障.pdf

    Stratus Technologies发布的第四代ft Server 6200系列容错服务器是业界首台采用Intel Xeon四核处理器的容错服务器,专为Windows和Linux的关键业务应用设计,旨在提供高度稳定性和效率。这款服务器在Continuous ...

    Stratus-Web:Stratus 的 Web 界面和 API

    Stratus-Web 是一个专为 Stratus 平台设计的 Web 界面和应用程序接口(API),它提供了用户友好的图形界面以及与 Stratus 平台进行交互的编程能力。Stratus 平台可能是一个云服务或分布式系统,用于处理各种任务,如...

    ftServer260045006300 win2003 安装与配置.doc

    * Stratus ActiveService Network Configuration Guide (R072):解释如何将 ftServer 系统配置为 Stratus ActiveService Network。 * Stratus ftServer Systems: PCI Adapter Guide (R461):描述 ftServer 系统支持...

    NEC携手Stratus共同开发Linux容错服务器.pdf

    标题和描述中提到的是NEC(日本电气株式会社)与Stratus共同合作开发Linux容错服务器的事件。这个合作旨在提升服务器的稳定性和可用性,特别是在关键业务应用中的表现。Linux操作系统因其开源、成本效益高以及灵活性...

    【WordPress主题】2022年最新版完整功能demo+插件v4.1.3.zip

    Stratus - App, SaaS & Software Startup Tech Theme Stratus - App,SaaS&Software Startup Tech Tech主题" ---------- 泰森云每天更新发布最新WordPress主题、HTML主题、WordPress插件、shopify主题、opencart...

Global site tag (gtag.js) - Google Analytics