mastering_the_android_media_framework

上传人:luoxia****01801 文档编号:69732158 上传时间:2019-01-14 格式:PDF 页数:56 大小:353.81KB
返回 下载 相关 举报
mastering_the_android_media_framework_第1页
第1页 / 共56页
mastering_the_android_media_framework_第2页
第2页 / 共56页
mastering_the_android_media_framework_第3页
第3页 / 共56页
mastering_the_android_media_framework_第4页
第4页 / 共56页
mastering_the_android_media_framework_第5页
第5页 / 共56页
点击查看更多>>
资源描述

《mastering_the_android_media_framework》由会员分享,可在线阅读,更多相关《mastering_the_android_media_framework(56页珍藏版)》请在金锄头文库上搜索。

1、 Noisy Androids Mastering the Android Media Framework Dave Sparks 27-May-2009 3 Agenda Frank Lloyd Android: Media Framework architecture Sweet Android: Whats new in Cupcake V1.5? Busted Android: Common problems Curious Android: Q import android.media.AudioManager; . public void onCreate(Bundle icicl

2、e) super.onCreate(icicle); setVolumeControlStream(AudioManager.STREAM_MUSIC); . 30 Problem: Unable to play file from resource? MediaPlayer mp = new MediaPlayer(); try mp.setDataSource(“res:com.myapp.raw.test”); mp.prepare(); catch (IOException e) Log.e(“Error ” + e.print() + “ opening media player”)

3、; 31 Solution: Use AssetFileDescriptor AssetFileDescriptor afd = context.getResources().openRawResourceFd(resId); set.DataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength(); afd.close(); 32 Problem: Out of MediaPlayers! MediaPlayer mpArray = new Object50; for (int i = 0; i 50; i+)

4、 MediaPlayer mp = MediaPlayer.create(soundNamei); mp.prepare(); mpArrayi = mp; 33 Solution: Reuse MediaPlayer Call release() and set to null Or call reset(), then setDataSource() Limit to 2 or 3 maximum 34 Problem: CPU Overloaded MediaPlayer sound1 = new MediaPlayer(); MediaPlayer sound2 = new Media

5、Player(); MediaPlayer sound3 = new MediaPlayer(); / call setDataSource, prepare, etc. . / later on. sound1.start(); sound2.start(); sound3.start(); . / CPU is bogging down here. 35 Solution: Use SoundPool import android.media.SoundPool; import android.media.AudioSystem; Context context = getApplicat

6、ionContext(); sp = new SoundPool(maxStreams, AudioSystem.STREAM_MUSIC, 0); int snd1 = sp.load(context, res.Raw.pow); int snd2 = sp.load(context, res.Raw.blam); int snd2 = sp.load(context, res.Raw.biff); . sp.play(snd1, leftVol, rightVol, priority, loop, rate); . sp.play(snd2, leftVol, rightVol, prio

7、rity, loop, rate); . sp.play(snd3, leftVol, rightVol, priority, loop, rate); Q map.setCenter(new GLatLng(37.442, -122.142), 13); var bounds = map.getBounds(); var lngSpan = northEast.lng() - southWest.lng(); var latSpan = northEast.lat() - southWest.lat(); for (var i = 0; i 10; i+) var point = new G

8、LatLng(southWest.lat() + latSpan * Math.random(), southWest.lng() + lngSpan * Math.random(); map.addOverlay(new GMarker(point); 49 Color Palette Primary Neutral Picker R 0 G 102 B 204 R 125 G 125 B 125 R 0 G 138 B 53 R 255 G 0 B 0 R 255 G 211 B 25 50 Graphic Element Styles and Arrows 51 Pie Chart Ex

9、ample Chart title or subtitle placeholder Google 48% MSN 19% Yahoo 33% Source: Insight Express Survey of 1000 home Internet users (June 2004) 52 Column Chart Example Chart is positioned to the left of the text box aligned to left guide Depending on size of chart and amount of text content, positioni

10、ng of text box may vary Font size can be decreased Source: Insight Express Survey of 1000 home Internet users (June 2004) 0 12.5 25.0 37.5 50.0 GoogleYahooMSN Chart title or subtitle placeholder 53 Line Chart Example 0% 225% 450% 675% 900% 123456789101112 Chart is positioned to the left of the text

11、box aligned to left guide Depending on size of chart and amount of text content, positioning of text box may vary Font size can be decreased Source: Insight Express Survey of 1000 home Internet users (June 2004) Chart title or subtitle placeholder 54 Attract Customers Build Customer Loyalty Develop

12、New Revenue Streams Monetize Your Digital Assets Monetize Your Digital Assets WebSearch AdSense for Search AdSense for Content Matrix Example Chart title or subtitle placeholder Segue Slide “The perfect search engine would understand exactly what you mean and give back exactly what you want.” Larry Page, Google Co-Founder

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 外语文库 > 英语读物

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号