Flash Camp Chennai - P2P with Flash Player 10.1
Upcoming SlideShare
Loading in...5

Flash Camp Chennai - P2P with Flash Player 10.1






Total Views
Views on SlideShare
Embed Views



1 Embed 59

http://www.indiflashcamp.com 59



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Flash Camp Chennai - P2P with Flash Player 10.1 Flash Camp Chennai - P2P with Flash Player 10.1 Presentation Transcript

  • P2P in Flash Player 10.1
    Peter Elst – Project Cocoon
  • Who am I?
    • Founding Partner – Project Cocoon
    • Adobe Community Professional
    • Adobe Certified Instructor
    • Author "Object-Oriented ActionScript 3.0"
    • 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?
  • What is P2P?
    • 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 (!)
    • Centralized communication
    • Single point of failure
    • Bandwidth requirement increases per new client connected
    • Not extremely scalable
    Traditional network
    • Decentralized communication
    • More robust network setup
    • Adding clients makes network faster
    • Scalable solution for multi-user applications
    P2P network
  • How does it work?
    • 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
    • ...
  • AIR for Android
    • 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!
  • Accelerometer
    if(Accelerometer.isSupported){varacc: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);}
  • Geolocation
    if(Geolocation.isSupported){vargeo: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);}
  • Packager for iPhone
    • 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
    • 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
    • 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
  • 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)
  • Device Discovery
  • Device Discovery
    <p2p:LocalNetworkDiscovery id="channel" /><s:ListdataProvider="{channel.clients}" labelField="clientName" />
    Thats really all you need!
  • Chatroom
  • Chatroom
    <p2p:LocalDeviceDiscovery id="discovery" clientAdded="onClientAdded(event)" clientRemoved="onClientRemoved(event)" dataReceived="onDataReceived(event)" loopback="true" />
  • Photo sharing
  • Photo sharing
    <p2p:LocalDeviceDiscovery id="discovery" dataReceived="onDataReceived(event)" fileComplete="onFileComplete(event)" />
  • Multi-player game
  • Multi-player game
    <p2p:LocalDeviceDiscovery id="discovery" accelerometerInterval="300" accelerometerUpdate="onAccelerate(event)" />
  • Video streaming
  • Video streaming
    <p2p:LocalDeviceDiscovery id="discovery" videostream="{cam}" />
  • 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
  • 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
  • 27
  • 28
    Thanks! நன்றி!
    e-mail peter@project-cocoon.comwebsite www.project-cocoon.comblog www.peterelst.comtwitter @peterelst