西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 10 Multimedia

Recap:Android Components Application=Set of Android Components Activity Ul Component typically correspo one screen. BroadcastReceiver Responds to notifications or statu changes.Can wake up your proc Intent Service Faceless task that runs in th background. ContentProvider Enable applications to share
Recap: Android Components Application= Set of Android Components • UI Component typically corresponding to Activity one screen. • Responds to notifications or status changes. Can wake up your process. BroadcastReceiver • Faceless task that runs in the background. Service ContentProvider • Enable applications to share data. Intent

Android Programming Lecture 10 Multimedia
Android Programming Lecture 10 Multimedia

APPLICATIONS Home Contacts Phone Browser APPLICATION FRAMEWORK Activity Window Content View Manager Manager Providers System Package Telephony Resource Location Notification Manager Manager Providers System System ANDROID RUNTIME Surface Media SQLite Manager Framework Core Libraries OpenGLES FreeType WebKit Dalvik Virtual Machine SGL SSL libe LINUX KERNEL Display Camera Flash Memory Binder (IPC) Driver Driver Driver Driver Keypad Driver WiFi Dirver Audio Power Drivers Management 3
3

Operating System Multimedia Framework Audio Video MP3 。H.263 MIDI ·H.264AVC ·PCM/WAVE ·MPEG-4 ·AAC LC etc... etc... Software Hardware Codec The Android multimedia framework includes support for playing variety of common media types,so that you can easily integrate audio,video and images into your applications
4 The Android multimedia framework includes support for playing variety of common media types, so that you can easily integrate audio, video and images into your applications. Audio • MP3 • MIDI • PCM/WAVE • AAC LC • etc… Video • H.263 • H.264 AVC • MPEG-4 • etc…

Media Playback Android multimedia framework includes support for playing variety of common media types,so that you can easily integrate audio,video and images into your applications. You can play audio or video from media files stored in your application's resources (raw TECSUN e360- resources),from standalone files in the file system,or from a data stream arriving over a network connection,all using MediaPlayer class
Media Playback 5 • Android multimedia framework includes support for playing variety of common media types, so that you can easily integrate audio, video and images into your applications. • You can play audio or video from media files stored in your application’s resources (raw resources), from standalone files in the file system, or from a data stream arriving over a network connection, all using MediaPlayer class

Media Playback Guide ● http://developer.android.com/guide/topics/media/mediapl ayer.html
Media Playback Guide • http://developer.android.com/guide/topics/media/mediapl ayer.html 6

Media Player One of the most important components of the media framework is the MediaPlayer class.An object of this class can fetch,decode, and play both audio and video with minimal setup.It supports several different media sources such as: o Local resources o Internal URIs,such as one you might obtain from a Content Resolver o External URIs(streaming) Supported Media Formats are: o RTSP(RTP,SDP) o HTTP/HTTPS progressive streaming TECSUN 口oo口当 10360- o HTTP/HTTPS live streaming o 3GPP o MPEG-4 o MP3
Media Player • One of the most important components of the media framework is the MediaPlayer class. An object of this class can fetch, decode, and play both audio and video with minimal setup. It supports several different media sources such as: o Local resources o Internal URIs, such as one you might obtain from a Content Resolver o External URIs (streaming) • Supported Media Formats are: o RTSP (RTP, SDP) o HTTP/HTTPS progressive streaming o HTTP/HTTPS live streaming o 3GPP o MPEG-4 o MP3 7

Step 1:Create the raw folder in the project and put the media file into the folder Step 2:Configure the media player object ServiceAndMediaPlayer ·售sc to start the media playback com.example.serviceandmediaplayer gen [Generated Java Files] D☐Android4.4w /Create an instance of MediaPlayer and load the music Android Private Libraries MediaPlayermediaPlayerMediaPlayer.create(this, Android Dependencies 凸assets R.raw.music)j bin /Start the media playback D邑bs mediaPlayer.start(); ·是res drawable-hdpi drawable-ldpi drawable-mdpi To replay the media,call reset()and drawable-xhdpi drawable-xxhdpi prepare() raw To pause,call pause() music.mp3 values ·To stop,call stop() values-v11 evalues-v14 AndroidManifest.xml ic_launcher-web.png MediaPlayer class reference: clint.xml http://developer.android.com/reference/android/media/Media proguard-project.txt 目project.properties Player.html
8 // Create an instance of MediaPlayer and load the music MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.music); // Start the media playback mediaPlayer.start(); Step 1: Create the raw folder in the project and put the media file into the folder Step 2: Configure the media player object to start the media playback • To replay the media, call reset() and prepare() • To pause, call pause() • To stop, call stop() MediaPlayer class reference: http://developer.android.com/reference/android/media/Media Player.html

Media Player Whit this example you can play an audio file as a local raw resource from res/raw/directory: MediaPlayer mediaPlayer MediaPlayer.create(context,R.raw.sound_file_1); mediaPlayer.start ()/no need to call prepare;create(does that for you You can also load a local content through an URI Object Uri myUri =..../initialize Uri here MediaPlayer mediaPlayer new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAMMUSIC; mediaPlayer.setDataSource (getApplicationContext(),myUri); mediaPlayer.prepare(); mediaPlayer.start(); You can also play a content from a remote URL via HTTP streaming. String url=“http:/∥..";/∥your URL here MediaPlayer mediaPlayer=new MediaPlayer(); mediaPlayer.setAudioStreamType (AudioManager.STREAMMUSIC); mediaPlayer.setDataSource(url); mediaPlayer.prepare(;/might take long!(for buffering,etc) mediaPlayer.start(); 9
Media Player • Whit this example you can play an audio file as a local raw resource from res/raw/ directory: • You can also load a local content through an URI Object • You can also play a content from a remote URL via HTTP streaming. 9 MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.sound_file_1); mediaPlayer.start(); // no need to call prepare(); create() does that for you String url = "http://........"; // your URL here MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(url); mediaPlayer.prepare(); // might take long! (for buffering, etc) mediaPlayer.start(); Uri myUri = ....; // initialize Uri here MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(getApplicationContext(), myUri); mediaPlayer.prepare(); mediaPlayer.start();

Read Media Information void attachAuxEffect(int effectld) Attaches an auxiliary effect to the player. int getCurrentPosition( Gets the current playback position 060- int getDuration Gets the duration of the file. int getVideoHeight0 Returns the height of the video. int getVideoWidth 0 Returns the width of the video. boolean isLooping0 Checks whether the MediaPlayer is looping or non-looping. boolean isPlaying0 Checks whether the MediaPlayer is playing. 10
Read Media Information 10
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 9 Service and Broadcast Receiver.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 8 Multi-threading.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 7 Data Persistence.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 6 List View and Custom View.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 5 Intent.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 4 Activity, Intent and UI.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 3 File structure and Layout.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 2 Introduction to Java and Object Oriented Programming.pptx
- 西安电子科技大学:《网络计算》课程PPT教学课件(Android Programming)Lecture 1 Introduction to Network Computing(主讲:栾浩).pptx
- 《算法基础》课程教学资源(学习笔记)算法基础 课堂笔记.pdf
- 长沙理工大学:《微机原理与接口技术》课程教学资源(大纲教案)微机原理与应用授课教案(负责人:叶青,打印版).pdf
- 同济大学:《逻辑网络》课程电子教案(PPT课件)数字设计中的基本电路 Introduction to the circuits in digital design.ppt
- 同济大学:《逻辑网络》课程电子教案(PPT课件)异步时序电路分析与设计 Introduction to asynchronous circuits design.ppt
- 同济大学:《逻辑网络》课程电子教案(PPT课件)寄存器与计数器 register and counters.ppt
- 同济大学:《逻辑网络》课程电子教案(PPT课件)同步时序电路设计中的问题 Advanced design issue.ppt
- 同济大学:《逻辑网络》课程教学资源(试卷习题)考试样卷.doc
- 同济大学:《逻辑网络》课程教学资源(教学大纲)逻辑网络(英文)Logic networks.doc
- 同济大学:《逻辑网络》课程教学资源(教学大纲)逻辑网络(中文,负责人:周俊鹤).doc
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第六章 查找.ppt
- 北京化工大学:《数据结构》课程PPT教学课件(C语言描述)第五章 图.ppt
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 01 Soft Testing - Fundamentals of Testing.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 02 Testing throughout the Software Lifecycle.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 03 Static Techniques.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 04 Test Design Techniques.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 05 Test Management.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)Chapter 06 Tool Support for Testing.pptx
- 同济大学:《软件测试》课程电子教案(PPT课件)How To Do High Quality Research, Write Acceptable Papers, and Make Effective Presentations?.ppt
- 《软件测试》课程电子教案(参考资料)Standard glossary of terms used in Software Testing(Version 2.0).pdf
- 《软件测试》课程电子教案(参考资料)Certified Tester Foundation Level Syllabus Released(Version 2011).pdf
- 《软件测试》课程电子教案(参考资料)Certified Tester Foundation Level Syllabus Released(Version 2011).pdf
- 河南科技大学:信息工程学院教育技术学专业本科课程教学大纲(汇编).pdf
- 吉林大学:《人工智能》课程电子教案(PPT课件)第一章 绪论 Artificial Intelligence(AI).ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第七章 机器学习.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第三章 知识与知识表示.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第二章 人工智能的数学基础.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第五章 搜索策略.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第八章 智能决策支持系统.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第六章 专家系统.ppt
- 吉林大学:《人工智能》课程电子教案(PPT课件)第四章 经典逻辑推理.ppt
- 吉林大学:《微机原理及汇编语言》课程电子教案(PPT课件)第10章 80X86的最新技术发展.ppt