+ All Categories
Home > Documents > Flash Camp Chennai - P2P with Flash Player 10.1

Flash Camp Chennai - P2P with Flash Player 10.1

Date post: 20-Jan-2015
Category:
Upload: ria-rui-society
View: 1,149 times
Download: 2 times
Share this document with a friend
Description:
 
Popular Tags:
28
Peter Elst – Project Cocoon P2P in Flash Player 10.1
Transcript
Page 1: Flash Camp Chennai - P2P with Flash Player 10.1

Peter Elst – Project CocoonP2P in Flash Player 10.1

Page 2: Flash Camp Chennai - P2P with Flash Player 10.1

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

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

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

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

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

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

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

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

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

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

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

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

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

Device Discovery

Page 16: Flash Camp Chennai - P2P with Flash Player 10.1

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

Chatroom

Page 18: Flash Camp Chennai - P2P with Flash Player 10.1

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

Photo sharing

Page 20: Flash Camp Chennai - P2P with Flash Player 10.1

Photo sharing

<p2p:LocalDeviceDiscovery id="discovery" dataReceived="onDataReceived(event)" fileComplete="onFileComplete(event)" />

Page 21: Flash Camp Chennai - P2P with Flash Player 10.1

Multi-player game

Page 22: Flash Camp Chennai - P2P with Flash Player 10.1

Multi-player game

<p2p:LocalDeviceDiscovery id="discovery" accelerometerInterval="300" accelerometerUpdate="onAccelerate(event)" />

Page 23: Flash Camp Chennai - P2P with Flash Player 10.1

Video streaming

Page 24: Flash Camp Chennai - P2P with Flash Player 10.1

Video streaming

<p2p:LocalDeviceDiscovery id="discovery" videostream="{cam}" />

Page 25: Flash Camp Chennai - P2P with Flash Player 10.1

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

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

27

Questions?

Page 28: Flash Camp Chennai - P2P with Flash Player 10.1

28

Thanks! நன்றி�! e-mail [email protected] www.project-cocoon.comblog www.peterelst.comtwitter @peterelst


Recommended