flash camp chennai - p2p with flash player 10.1
DESCRIPTION
TRANSCRIPT
![Page 1: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/1.jpg)
Peter Elst – Project CocoonP2P in Flash Player 10.1
![Page 2: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/2.jpg)
Who am I?
Founding Partner – Project Cocoon Adobe Community Professional Adobe Certified Instructor Author "Object-Oriented ActionScript 3.0"
![Page 3: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/3.jpg)
What is P2P? Technical walkthrough in Flash Player 10.1 Use cases for P2P and mobile devices Introducing Cocoon P2P Examples Questions & answers
What will we cover?
![Page 4: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/4.jpg)
P2P lets devices directly communicate Clients connect once to a server, from there on data
goes between them Huge decrease in server bandwidth requirements You can do local P2P on the same network without
requiring any server (!)
What is P2P?
![Page 5: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/5.jpg)
Centralized communication Single point of failure Bandwidth requirement increases per new client
connected Not extremely scalable
Traditional network
![Page 6: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/6.jpg)
Decentralized communication More robust network setup Adding clients makes network faster Scalable solution for
multi-user applications
P2P network
![Page 7: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/7.jpg)
Create a NetConnection instance Connect to RTMFP server instance Create a GroupSpecifier and NetGroup instance Setup NetGroup properties and permissions Listen for neighbor connect and disconnect events Post messages to the NetGroup or route it through
nearest neighbor Handle file chunks for object-replication ...
How does it work?
![Page 8: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/8.jpg)
AIR for Android allows us to run desktop AIR files and take advantage of additional mobile specific features such as the accelerometer, geolocation,...
Almost - but not all - desktop APIs are supported Its a lot of fun to develop for!
AIR for Android
![Page 9: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/9.jpg)
if(Accelerometer.isSupported){ var acc:Accelerometer = new Accelerometer(); acc.setRequestedUpdateInterval(500); acc.addEventListener(AccelerometerEvent.UPDATE, update);}
private function update(evt:AccelerometerEvent):void { trace("x acceleration: "+evt.accelerationX); trace("y acceleration: "+evt.accelerationY); trace("z acceleration: "+evt.accelerationZ);}
Accelerometer
![Page 10: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/10.jpg)
if(Geolocation.isSupported){ var geo:Geolocation = new Geolocation(); geo.setRequestedUpdateInterval(10000); geo.addEventListener(GeolocationEvent.UPDATE, update);}
private function update(evt:GeolocationEvent):void { trace("latitude: "+evt.latitude); trace("longitude: "+evt.longitude); trace("speed: "+evt.speed);}
Geolocation
![Page 11: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/11.jpg)
Packager for iPhone compiles AIR applicationsto native iOS binaries
Apple recently started allowing third party cross-compiled applications back into the app store
Compiled binaries generally have a larger file size
Packager for iPhone
![Page 12: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/12.jpg)
Device turns into a universal game controller Data can be synchronized, stored on the device Single or multi-player, everyone carries a phone
so can join in
Use case: Games
![Page 13: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/13.jpg)
Students can connect to a class whiteboard Solve problems individually or as a group Get real-time information on how students perform
Use case: E-Learning
![Page 14: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/14.jpg)
Cocoon P2P
No need to get intimidated by the learning curve Cocoon P2P focuses on local network P2P Early support for file sharing (object-replication),
video streaming and accelerometer Incredibly easy to use
cocoon-p2p.googlecode.com (beta later this month)
![Page 15: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/15.jpg)
Device Discovery
![Page 16: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/16.jpg)
Device Discovery
<p2p:LocalNetworkDiscovery id="channel" />
<s:List dataProvider="{channel.clients}" labelField="clientName" />
Thats really all you need!
![Page 17: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/17.jpg)
Chatroom
![Page 18: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/18.jpg)
Chatroom
<p2p:LocalDeviceDiscovery id="discovery" clientAdded="onClientAdded(event)" clientRemoved="onClientRemoved(event)" dataReceived="onDataReceived(event)" loopback="true" />
![Page 19: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/19.jpg)
Photo sharing
![Page 20: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/20.jpg)
Photo sharing
<p2p:LocalDeviceDiscovery id="discovery" dataReceived="onDataReceived(event)" fileComplete="onFileComplete(event)" />
![Page 21: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/21.jpg)
Multi-player game
![Page 22: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/22.jpg)
Multi-player game
<p2p:LocalDeviceDiscovery id="discovery" accelerometerInterval="300" accelerometerUpdate="onAccelerate(event)" />
![Page 23: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/23.jpg)
Video streaming
![Page 24: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/24.jpg)
Video streaming
<p2p:LocalDeviceDiscovery id="discovery" videostream="{cam}" />
![Page 25: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/25.jpg)
Does it require AIR?
Short answer, no! P2P is available as part of Flash Player 10.1 User can control whether to allow Peer-assisted
networking for a site AIR has a less restrictive sandbox to worry about
![Page 26: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/26.jpg)
Summary
P2P support is available on all devices running Flash Player 10.1 or later
There is no server required between local devices on the same network
Mobile devices can be used as additional input or controllers for applications
![Page 27: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/27.jpg)
27
Questions?
![Page 28: Flash Camp Chennai - P2P with Flash Player 10.1](https://reader033.vdocuments.net/reader033/viewer/2022061221/54bdb38d4a7959a4658b4632/html5/thumbnails/28.jpg)
28
Thanks! நன்றி�! e-mail [email protected] www.project-cocoon.comblog www.peterelst.comtwitter @peterelst