Introduction to Introduction toFlash Runtime Mobile FeaturesFlash Runtime Mobile Features          White MasterFlash Runti...
1. Features of Flash Runtime on Mobile   Accelerometer   GPS   Camera   Stage Video   Device Speaker Control2. Worksh...
3
   The Accelerometer class dispatches events based on activity detected by the    devices motion sensor. This data repres...
var accelerometer:Accelerometer;if(Accelerometer.isSupported){    accelerometer = new Accelerometer();    accelerometer.ad...
6
7
   The Geolocation class dispatches events in response to the devices location    sensor.                                ...
var geolocation:Geolocation;if(Geolocation.isSupported){    geolocation = new Geolocation();    if(!geolocation.muted){   ...
10
11
   CameraUI        The CameraUI class allows you to capture a still image or video using the         default camera appl...
if (CameraUI.isSupported){    myCam = new CameraUI();    myCam.addEventListener(MediaEvent.COMPLETE, onComplete);    myCam...
14
15
16
   The StageVideo object uses the devices hardware acceleration capabilities, if    available, to display live or recorde...
VideoStatus.ACCELERATER   VideoStatus.SOFTWARE             最佳性能StageVideo                             使用软件解码,用GPU合成       ...
private static const FILE_NAME:String = "media/Test_original.mp4";var sv:StageVideo;var nc:NetConnection;var ns:NetStream;...
private function onStageVideoState(event:StageVideoAvailabilityEvent):void{    // Detect if StageVideo is available and de...
21
22
Ear Piece                 Speaker Phone            23
Feature summary    Enable mobile app to toggle between earpiece and speakerphone             AIR 2.7                    ...
AudioPlaybackMode   Speakerphone in       iOS Category be        Audio Output Route                    use                ...
Play_button.addEventListener(MouseEvent.CLICK, playMusic);function playMusic(e:Event):void{    SoundMixer.audioPlaybackMod...
 Microphone.isSupported Microphone.getMicrophone() Microphone.getEnhancedMicrophone() Microphone.setUseEchoSuppression...
…   Front-facing camera support   Android Market licensing integration   Captive runtime support for Android   Stagete...
NativeExtension       29
The native extensions feature enables the addition of third-party, native-codebacked ActionScript APIs to AIR applications...
   Enhance Performance        Zxing:ActionScript 2000ms, Android 10ms   Expand functions        Autofocus for camera ,...
32
33
34
35
An Android Project    Provide Native Implementation for Native ExtensionA Flex Library Project    Provide ActionScript...
Ane file    A set of Actionscript with native code implementationA Flex Mobile Project    Use the ane                 ...
38
Upcoming SlideShare
Loading in …5
×

Flash runtime on mobile

1,244 views
1,137 views

Published on

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

  • Be the first to like this

No Downloads
Views
Total views
1,244
On SlideShare
0
From Embeds
0
Number of Embeds
171
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Flash runtime on mobile

  1. 1. Introduction to Introduction toFlash Runtime Mobile FeaturesFlash Runtime Mobile Features White MasterFlash Runtime Globalization TeamFlash Runtime Globalization TeamHao Wu, Yi Zhai 1
  2. 2. 1. Features of Flash Runtime on Mobile  Accelerometer  GPS  Camera  Stage Video  Device Speaker Control2. Workshop – Native Extension 2
  3. 3. 3
  4. 4.  The Accelerometer class dispatches events based on activity detected by the devices motion sensor. This data represents the devices location or movement along a 3-dimensional axis. 4
  5. 5. var accelerometer:Accelerometer;if(Accelerometer.isSupported){ accelerometer = new Accelerometer(); accelerometer.addEventListener(AccelerometerEvent.UPDATE, updateHandler);}private function updateHandler (e:AccelerometerEvent):void{ trace(e.accelerationX); trace(e.accelerationY); trace(e.accelerationZ); trace(e.timestamp)} 5
  6. 6. 6
  7. 7. 7
  8. 8.  The Geolocation class dispatches events in response to the devices location sensor. 8
  9. 9. var geolocation:Geolocation;if(Geolocation.isSupported){ geolocation = new Geolocation(); if(!geolocation.muted){ geolocation.setRequestedUpdateInterval(10000); geolocation.addEventListener(GeolocationEvent.UPDATE,updateHandler); }}private function updateHandler(e:GeolocationEvent):void{ trace(e.longitude); trace(e.latitude); trace(e.altitude); //Other properties: heading, speed, timestamp} //horizaontalAccuracy, VerticalAccuracy, 9
  10. 10. 10
  11. 11. 11
  12. 12.  CameraUI  The CameraUI class allows you to capture a still image or video using the default camera application on a device. CameraRoll  The CameraRoll class allows you to access image data in the system media library or "camera roll." 12
  13. 13. if (CameraUI.isSupported){ myCam = new CameraUI(); myCam.addEventListener(MediaEvent.COMPLETE, onComplete); myCam.launch(MediaType.IMAGE);}if (CameraRoll.supportsBrowseForImage){ roll = new CameraRoll(); roll.addEventListener(MediaEvent.SELECT,onMediaSelect); roll.browseForImage();} 13
  14. 14. 14
  15. 15. 15
  16. 16. 16
  17. 17.  The StageVideo object uses the devices hardware acceleration capabilities, if available, to display live or recorded video in an application. Hardware acceleration capabilities are available on most devices 17
  18. 18. VideoStatus.ACCELERATER VideoStatus.SOFTWARE 最佳性能StageVideo 使用软件解码,用GPU合成 使用GPU解码并合成 最差的情况Video 使用硬件GPU解码,软件合成 使用软件解码并合成 18
  19. 19. private static const FILE_NAME:String = "media/Test_original.mp4";var sv:StageVideo;var nc:NetConnection;var ns:NetStream;nc = new NetConnection();nc.connect(null);ns = new NetStream(nc);stage.addEventListener(StageVideoAvailabilityEvent.STAGE_VIDEO_AVAILABILITY, onStageVideoState); 19
  20. 20. private function onStageVideoState(event:StageVideoAvailabilityEvent):void{ // Detect if StageVideo is available and decide what to do in toggleStageVideo toggleStageVideo(available = inited = (event.availability == StageVideoAvailability.AVAILABLE));}private function toggleStageVideo(on:Boolean):void{ sv = stage.stageVideos[0]; sv.attachNetStream(ns); ns.play(FILE_NAME);} 20
  21. 21. 21
  22. 22. 22
  23. 23. Ear Piece Speaker Phone 23
  24. 24. Feature summary  Enable mobile app to toggle between earpiece and speakerphone AIR 2.7 > AIR 3.0No way to choose two speaks Easily access different speakersAll audio play back through media Enable the VOIP telephonyspeaker Enumerate all the speakers attached to device on mobile and desktopUse cases  New Adobe Directory/Connect for Android, with VoIP feature  More AIR-based enterprise apps, integrating Flash Media Gateway 24
  25. 25. AudioPlaybackMode Speakerphone in iOS Category be Audio Output Route use used (Headphone)Media 0 MediaPlayback Device Speaker (Headphone)Media 1 MediaPlayback Device Speaker (Headphone)AudioPlaybackMode Speakerphone in use iOS Category be used Audio Output Route (Headphone)Voice 0 PlayAndRecord Phone Receiver (Headphone)Voice 1 PlayAndRecord Device Speaker 25
  26. 26. Play_button.addEventListener(MouseEvent.CLICK, playMusic);function playMusic(e:Event):void{ SoundMixer.audioPlaybackMode = “media”; SoundMixer.useSpeakerphoneForVoice = false; if(! playing) { sc = music.play(pos); playing = true; }} 26
  27. 27.  Microphone.isSupported Microphone.getMicrophone() Microphone.getEnhancedMicrophone() Microphone.setUseEchoSuppression() Microphone.setSilenceLevel(silenceLevel, timeout) SampleDataEvent.SAMPLE_DATA Microphone.activityLevel 27
  28. 28. … Front-facing camera support Android Market licensing integration Captive runtime support for Android Stagetext Flash Access on Android Mobile background app audio playback for iOS Enable HW Video decoding on various chipsets Native Extensions on Mobile 28
  29. 29. NativeExtension 29
  30. 30. The native extensions feature enables the addition of third-party, native-codebacked ActionScript APIs to AIR applications. Normal apps NativeExtension apps A actionscript Library with Native Code implementation 30
  31. 31.  Enhance Performance  Zxing:ActionScript 2000ms, Android 10ms Expand functions  Autofocus for camera , Vibration … 31
  32. 32. 32
  33. 33. 33
  34. 34. 34
  35. 35. 35
  36. 36. An Android Project Provide Native Implementation for Native ExtensionA Flex Library Project Provide ActionScript API for Native Extension 36
  37. 37. Ane file A set of Actionscript with native code implementationA Flex Mobile Project Use the ane 37
  38. 38. 38

×