P2P with Flash Player 10.1

2,230 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,230
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
20
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

P2P with Flash Player 10.1

  1. 1. P2P in Flash Player 10.1<br />Peter Elst – Project Cocoon<br />
  2. 2. Who am I?<br /><ul><li>Founding Partner – Project Cocoon
  3. 3. Adobe Community Professional
  4. 4. Adobe Certified Instructor
  5. 5. Author "Object-Oriented ActionScript 3.0"</li></li></ul><li><ul><li>What is P2P?
  6. 6. Technical walkthrough in Flash Player 10.1
  7. 7. Use cases for P2P and mobile devices
  8. 8. Introducing Cocoon P2P
  9. 9. Examples
  10. 10. Questions & answers</li></ul>What will we cover?<br />
  11. 11. What is P2P?<br /><ul><li>P2P lets devices directly communicate
  12. 12. Clients connect once to a server, from there on data goes between them
  13. 13. Huge decrease in server bandwidth requirements
  14. 14. You can do local P2P on the same network without requiring any server (!)</li></li></ul><li><ul><li>Centralized communication
  15. 15. Single point of failure
  16. 16. Bandwidth requirement increases per new client connected
  17. 17. Not extremely scalable</li></ul>Traditional network<br />
  18. 18. <ul><li>Decentralized communication
  19. 19. More robust network setup
  20. 20. Adding clients makes network faster
  21. 21. Scalable solution for multi-user applications</li></ul>P2P network<br />
  22. 22. How does it work?<br /><ul><li>Create a NetConnection instance
  23. 23. Connect to RTMFP server instance
  24. 24. Create a GroupSpecifier and NetGroup instance
  25. 25. Setup NetGroup properties and permissions
  26. 26. Listen for neighbor connect and disconnect events
  27. 27. Post messages to the NetGroup or route it through nearest neighbor
  28. 28. Handle file chunks for object-replication
  29. 29. ...</li></li></ul><li>AIR for Android<br /><ul><li>AIR for Android allows us to run desktop AIR files and take advantage of additional mobile specific features such as the accelerometer, geolocation,...
  30. 30. Almost - but not all - desktop APIs are supported
  31. 31. Its a lot of fun to develop for!</li></li></ul><li>Accelerometer<br />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);}<br />
  32. 32. Geolocation<br />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);}<br />
  33. 33. Packager for iPhone<br /><ul><li>Packager for iPhone compiles AIR applicationsto native iOS binaries
  34. 34. Apple recently started allowing third party cross-compiled applications back into the app store
  35. 35. Compiled binaries generally have a larger file size</li></li></ul><li><ul><li>Device turns into a universal game controller
  36. 36. Data can be synchronized, stored on the device
  37. 37. Single or multi-player, everyone carries a phone so can join in</li></ul>Use case: Games<br />
  38. 38. <ul><li>Students can connect to a class whiteboard
  39. 39. Solve problems individually or as a group
  40. 40. Get real-time information on how students perform</li></ul>Use case: E-Learning<br />
  41. 41. Cocoon P2P<br /><ul><li>No need to get intimidated by the learning curve
  42. 42. Cocoon P2P focuses on local network P2P
  43. 43. Early support for file sharing (object-replication), video streaming and accelerometer
  44. 44. Incredibly easy to use</li></ul> cocoon-p2p.googlecode.com (beta later this month)<br />
  45. 45. Device Discovery<br />
  46. 46. Device Discovery<br /><p2p:LocalNetworkDiscovery id="channel" /><s:ListdataProvider="{channel.clients}" labelField="clientName" /><br />Thats really all you need!<br />
  47. 47. Chatroom<br />
  48. 48. Chatroom<br /><p2p:LocalDeviceDiscovery id="discovery" clientAdded="onClientAdded(event)" clientRemoved="onClientRemoved(event)" dataReceived="onDataReceived(event)" loopback="true" /><br />
  49. 49. Photo sharing<br />
  50. 50. Photo sharing<br /><p2p:LocalDeviceDiscovery id="discovery" dataReceived="onDataReceived(event)" fileComplete="onFileComplete(event)" /><br />
  51. 51. Multi-player game<br />
  52. 52. Multi-player game<br /><p2p:LocalDeviceDiscovery id="discovery" accelerometerInterval="300" accelerometerUpdate="onAccelerate(event)" /><br />
  53. 53. Video streaming<br />
  54. 54. Video streaming<br /><p2p:LocalDeviceDiscovery id="discovery" videostream="{cam}" /><br />
  55. 55. Does it require AIR? <br /><ul><li>Short answer, no!
  56. 56. P2P is available as part of Flash Player 10.1
  57. 57. User can control whether to allow Peer-assisted networking for a site
  58. 58. AIR has a less restrictive sandbox to worry about</li></li></ul><li>Summary<br /><ul><li>P2P support is available on all devices running Flash Player 10.1 or later
  59. 59. There is no server required between local devices on the same network
  60. 60. Mobile devices can be used as additional input or controllers for applications</li></li></ul><li>27<br />Questions?<br />
  61. 61. 28<br />Thanks! நன்றி! <br />e-mail peter@project-cocoon.comwebsite www.project-cocoon.comblog www.peterelst.comtwitter @peterelst<br />

×