Adobe
Products
Creative Suite
Photoshop Family
Acrobat Family
Flash Platform
Digital Marketing Suite
Digital Publishing Suite
More products
Solutions
Digital marketing solutions
Digital media solutions
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Store
Adobe Store for home and home office
Education Store for students, educators, and staff
Business Store for small and medium businesses
Other ways to buy
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections   Search  
Solutions Company
Help Learning
Sign in Welcome, My orders My Adobe
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Flash Media Server Developer Center /

Using peer-to-peer applications on the Adobe Flash Platform

by Tom Krcha

Tom Krcha
  • Adobe
  • flashrealtime.com

Content

  • Comparing Cirrus and LiveCycle Collaboration Service
  • Customer success (OddCast.com)
  • Exploring RTMFP connection routines between LCCS and Cirrus P2P connection routines
  • Where to go from here

Created

17 November 2009

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
Flash Media Server LiveCycle networking P2P RTMFP RTMP

Requirements

User level

Intermediate

Adobe offers two different services for building and managing peer-to-peer (P2P) applications: Adobe Cirrus (previously codenamed Stratus) and Adobe LiveCycle Collaboration Service. The two serve different purposes. Cirrus is a service on Adobe Labs that allows you to preview the latest prerelease capabilities of Flash. LiveCycle Collaboration Service is a commercially supported service with an easy-to-use development framework.

This article will help you understand the two different platforms and teach you how to migrate applications you have developed on Cirrus to a commercial service with LiveCycle Collaboration Service (LCCS).

Note: The Cirrus service discussed in this article is not to be confused with the "Cirrus" code name for Adobe Flash Builder for Force.com – Developer Preview, which is a development tool for building cloud-based RIAs.

Comparing Cirrus and LiveCycle Collaboration Service

The basic differences between using Adobe Cirrus (a P2P rendezvous service) and LiveCycle Collaboration Service boil down to control and support. With Cirrus, you have limited control over managing your P2P applications from the server, because the service is solely a rendezvous service responsible for helping applications running in Adobe Flash Player connect with one another. Moreover, because it is an Adobe Labs technology, Cirrus will always have the latest pre-release capabilities of Adobe Flash built in. Our goal with Cirrus is to provide you with access to these new features so we can collect your collective feedback. Cirrus is for non-commercial use only.

Adobe LiveCycle Collaboration Service is a commercial service that provides an easy-to-use development model supported by Adobe's hosted service. It includes a framework to se P2P—so you don't have to care whether it's using P2P or hub-and-spoke communication. Together with this, it has automatic failover from P2P to hub-and-spoke for clients who don't have a UDP-enabled network.

Advantages of Cirrus

  • Showcases future Flash media technology to enable you to test-drive emerging technologies (like Groups and Multicast in Flash Player 10.1, announced at Adobe MAX 2009)
  • Lets you start exploring the benefits of P2P on the Flash Platform
  • Enables you to send audio, video, and byte data through P2P over UDP (UDP protocol is lossy and is widely used across VoIP and video services)
  • Available for free on Adobe Labs for non-commercial usage

Advantages of LiveCycle Collaboration Service

  • Includes a prebuilt framework and hosted service
  • Provides easy-to-use Flex and Flash components (adding collaboration features to your app has never been easier)
  • Offers a commercial option to deploy P2P based solutions
  • Makes it easy to enable P2P by setting protocol="rtmfp" on ConnectSession or ConnectSessionContainer (even if you don't have a UDP-enabled network, it will try and then fall back to RTMPS)
  • Hides the details of its P2P implementation from the developer; you don't have to care about anything regarding P2P implementation details in order to use it
  • Always uses P2P when possible to help you reduce costs, as long as all people in the same room have a UDP-enabled network
  • Automatically switches all participants to hub-and-spoke communication via LiveCycle Collaboration Service infrastructure (in this case Flash Media Server RTMP/T) if someone in the room does not have a UDP enabled network (an auto-check function monitors room participants' network capabilities)
  • Provides usage monitoring and charts
  • Allows you to pay as you go for the service (just redeem credit for your account on the fly using a credit card)
  • Data transfer is free when P2P is available

LiveCycle Collaboration Service is very efficient when using P2P and uses it whenever possible. Together with this, it has automatic failover to hub-and-spoke when P2P is unavailable. On the other hand, when using LiveCycle Collaboration Service, only audio and video streams are sent using P2P—no byte/text data. In a video chat scenario, audio and video streams are transferred using P2P when possible, but text chat, whiteboard, or mouse position data are sent using hub-and-spoke.

This is the main difference between LiveCycle Collaboration Service and Cirrus in the area of data transfer:

  • Content management: For a case such as a whiteboard, if two people edit at the same time, there needs to be a point of contention resolution.
  • Security: Data messaging through LCCS is done in such a way that read/write permissions for various data streams can be managed. Clients cannot be the authoritative source of such management because someone may gain access to client-side routines. LiveCycle Collaboration Service provides management because developers don't have access to modify anything in the service cloud.
  • State awareness: When a client enters a collaborative environment as a participant, the client often needs to have access to the state of the environment before it arrives. For example, if I come in late to a whiteboarding session, I want to see what was already drawn. If data only comes from the client, then someone would need to rebroadcast the old shapes. LCCS becomes the repository for the state of the app and can update incoming clients automatically.
  • Low latency: Even with hub-and-spoke, data messaging distribution is fast (sub-100ms).

Use LiveCycle Collaboration Service if you need an easy-to-use, tested implementation with failover, support, and monitoring with a commercial service. LCCS will let you use guaranteed P2P commercially in your product.

In addition to Cirrus and LiveCycle Collaboration Service, the RTMFP protocol will also be available in a future release of Flash Media Server.

Customer success (OddCast.com)

OddCast, which provides and builds VoIP solutions on the Adobe Flash Platform, recently switched from Cirrus to LiveCycle Collaboration Service. As David Segal, Team Leader, Front-End Development, explained it:

The main reason we switched from Status to LCCS was we needed to make our application commercially available to our customers. Our goal was to create a P2P tool to connect small businesses with their clients using voice and text chat. I found LCCS to be a comprehensive, feature-rich set of tools for P2P communication. In comparison to Cirrus, I found working with the LCCS framework to be a huge upgrade both in terms of its feature set and its ease of implementation. Much of the code I had written to manage NetStreams with Status became redundant with the LCCS framework, as it was already built-in. I ended up with a more readable, usable, and easily expandable application. In addition, the admin tool is a nice addition that has been quite helpful for debugging and monitoring usage of the service.

Figure 1 depicts two aspects of the SitePal Communication Center. The two browser windows at the top of the image are the client-facing apps (SWFs). They can be embedded in the web pages of any of OddCast's clients and allow visitors of the site to voice- or text-chat with the site owner or his/her help desk. On the bottom right is the AIR application that the site owner runs to receive the connections from the SWFs above, as well as monitor traffic and usage of the site.

SitePal Communication Center
Figure 1. SitePal Communication Center

Exploring RTMFP connection routines between LCCS and Cirrus P2P connection routines

Given the differences between Cirrus and LiveCycle Collaboration Service and the different levels of control they offer the developer, connecting to these services for P2P applications is also very different. Following are two examples of different connection routines between LCCS and Cirrus. You can use these examples if you choose to migrate from Cirrus to LCCS.

LiveCycle Collaboration Service

Following is an example based on Adobe Flex 3 of a full-featured video chat application for multiple participants:

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768" xmlns:rtc="AfcsNameSpace"> <rtc:AdobeHSAuthenticator id="auth" userName="SOME-USERNAME" protocol="rtmfp" /> <rtc:ConnectSessionContainer authenticator="{auth}" width="100%" height="100%" id="session" roomURL="http://connectnow.acrobat.com/YOUR-ACCOUNT/YOUR-ROOM"> <rtc:WebCamera x="10" y="10"/> <rtc:AudioPublisher /> <rtc:AudioSubscriber /> <rtc:SimpleChat x="10" y="218" width="250"/> </rtc:ConnectSessionContainer> </mx:Application>

For more information about LiveCycle Collaboration Service, see the Flash Platform Collaboration Services page. Sign up for a developer account at afcs.acrobat.com.

Cirrus

Here is an example based on Adobe Flash Builder 4 illustrating a similar, basic video chat for two people. Notice in this example that you need to transfer P2P fingerprints manually. Automatic fingerprint exchange needs server-side scripting and database, and the app gets even more complicated (and it's not available with Cirrus). However, you have full control over the connection routine implementation at the ActionScript level:

<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" minWidth="1024" minHeight="768"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ /** * * P2P * */ public const SERVER_ADDRESS:String = "rtmfp://stratus.adobe.com/"; public const DEVELOPER_KEY:String = "YOUR-DEVELOPER-KEY"; private var conn:NetConnection; private var streamOut:NetStream; private var streamIn:NetStream; [Bindable] private var myPeerID:String; private var farID:String; public function connect():void{ conn = new NetConnection(); conn.addEventListener(NetStatusEvent.NET_STATUS,connStatus); conn.addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyncErr); conn.connect(SERVER_ADDRESS+DEVELOPER_KEY); } private function connStatus(event:NetStatusEvent):void{ trace(event.info.code); txtStatus.text = event.info.code; if(event.info.code=="NetConnection.Connect.Success"){ myPeerID = conn.nearID; initOutStream(); } } private function asyncErr(event:AsyncErrorEvent):void{ } private function initOutStream():void{ trace("initOutStream"); streamOut = new NetStream(conn,NetStream.DIRECT_CONNECTIONS); streamOut.addEventListener(NetStatusEvent.NET_STATUS,streamStatus); streamOut.publish("media"); // CAMERA var cam:Camera = Camera.getCamera(); camOut.videoObject.attachCamera(cam); streamOut.attachCamera(cam); streamOut.attachAudio(Microphone.getMicrophone()); var streamOutClient:Object = new Object(); streamOutClient.onPeerConnect = function(farStream:NetStream):Boolean{ // initInStream(farStream.farID); return true; } } private function initInStream(farID:String):void{ trace("initInStream: ") streamIn = new NetStream(conn,farID); streamIn.addEventListener(NetStatusEvent.NET_STATUS,streamStatus); streamIn.play("media"); streamIn.client = this; camIn.videoObject.attachNetStream(streamIn); } private function streamStatus(event:NetStatusEvent):void{ trace("streamStatus: "+event.info.code); } public function receiveMessage(msg:String):void{ trace("receiveMessage: "+msg) txtHistory.text = msg+"\n"+txtHistory.text; } public function sendMessage(msg:String):void{ streamOut.send("receiveMessage",msg); receiveMessage(msg); } protected function btnSend_clickHandler(event:MouseEvent):void{ trace("sendMessage: "+txtMessage.text) sendMessage(txtMessage.text); } ]]> </fx:Script> <s:TextInput x="10" y="10" width="201" id="txtStatus"/> <s:TextInput x="10" y="40" width="201" id="txtStatusStream"/> <s:TextInput x="9" y="151" width="157" id="txtFarPeerID"/> <s:TextInput x="9" y="124" width="250" id="txtMyPeerID" text="{myPeerID}"/> <s:Button x="10" y="75" label="Connect" click="connect()" id="btnConnect"/> <s:Button x="174" y="152" label="initInStream" click="initInStream(txtFarPeerID.text)" id="btnConnect0"/> <s:TextArea x="9" y="181" width="285" height="160" id="txtHistory"/> <s:Button x="232" y="351" label="Send" id="btnSend" click="btnSend_clickHandler(event)" width="62"/> <s:TextInput x="9" y="349" id="txtMessage" width="215" enter="{btnSend_clickHandler(null)}"/> <s:VideoElement id="camOut" width="141" height="112" x="221" y="8"/> <s:VideoElement id="camIn" width="141" height="112" x="365" y="8"/> </s:Application>

Where to go from here

Dive deeper into P2P by visiting the following resources:

Cirrus

  • Visit the Cirrus technology page on Adobe Labs
  • Read the article, Cirrus service for developing end-to-end applications using RTMFP in Flash Player 10, by Jozsef Vass in the Flash Player Developer Center
  • Read my blog post about the multicast features in Flash Player 10.1
  • Read my blog post to learn about deploying P2P apps on Facebook

LiveCycle Collaboration Service

  • Learn more about Adobe LiveCycle Collaboration Service
  • Sign up for a free account now on the LCCS developer portal
  • Visit the LiveCycle Collaboration Service community forums
  • Learn more about LiveCycle Collaboration Service pricing

General peer-to-peer

  • Watch my video tutorial that explains the basics of working with peer-to-peer in Flash Player 10
  • Watch Matthew Kaufman's session from the Adobe MAX 2009 conference: P2P on the Flash Platform with RTMFP

More Like This

  • Best practices for real-time collaboration using Flash Media Server
  • Beginning Flash Media Server 4.5 – Part 5: Streaming with OSMF players

Tutorials & Samples

Tutorials

  • OSMF video player for AIR for TV using Flash Professional
  • OSMF video player for AIR for TV using Flash Builder
  • Capture, encode, and stream live multi-bitrate video over HTTP to Flash and iOS

Samples

  • Best practices for real-time collaboration using Flash Media Server
  • Understanding live DVR – Part 2: Using DVRCast with Flash Media Live Encoder 3
  • Understanding live DVR – Part 1: Implementing a live DVR player

Flash Media Server Forum

More
06/24/2011 Is it possible to use Video Phone (Cirrus Sample Application) with FMS4?
10/06/2011 RTMFP with Flash Media Server
02/03/2012 server side script changes while migrate from FMS3.5 to FMS4.5
01/26/2012 HI,MASTER How to limit illegal unusual request for data

Flash Media Server Cookbook

More
10/11/2011 Install Facebook Fanpage using a Flash template
06/02/2011 Converting video into Flash compatible format
06/02/2011 What's New in Adobe Media Encoder CS5.5?
06/02/2011 Enabling accurate seeking in video

Products

  • Creative Suite
  • Photoshop Family
  • Acrobat Family
  • Flash Platform
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Mobile apps

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • Adobe Store
  • For students and educators
  • For small and medium businesses
  • For enterprises
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • Pacific - English
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy (updated 07-14-2009).

Ad Choices

Reviewed by TRUSTe: site privacy statement