CS378 -Mobile Computing. Audio

Similar documents
CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

Homework 4 - MediaPlayer and Service

Multimedia Support Classes Playing Audio Watching Video Recording Audio

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

Smart Pianist FAQ. Availability of certain functions differs depending on the connected instrument.

Smart Pianist FAQ. Availability of certain functions differs depending on the connected instrument.

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

Introduction to Mobile Application Development Using Android Week Four Video Lectures

CS371m - Mobile Computing. Nifty Stuff

In this Class Mark shows you how to put applications into packages and how to run them through the command line.

Android Fundamentals - Part 1

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

Getting Started Movies MediaPlayer is required to use Maestro for movies. Note: Live Search: Main Movie Menu List / Cover View: Sort:

Android Application Development

Services are software components designed specifically to perform long background operations.

CS378 -Mobile Computing. What's Next?

States of Activities. Active Pause Stop Inactive

Understanding Application

Mobile Application Development

Media Player & S! Applications

Mul$media Support in Android

Application Fundamentals

I. CREATING YOUR SOUNDCLOUD ACCOUNT

Music Player & S! Appli

Media Player & S! Applications

Managing Meeting Recordings

Digital Audio Basics

S1 Smart Watch APPS GUIDE. Models: S1, S1C & S1 PLUS

S1 Smart Watch APPS GUIDE. Models: S1, S1C & S1 PLUS

Music Player & S! Appli

Minds-on: Android. Session 2

Announcements. Today s Topics

Insider Tips for using Music Station & Qmusic

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Mul$media Techniques in Android. Some of the informa$on in this sec$on is adapted from WiseAndroid.com

Always there to help you. Register your product and get support at BT3600. Question? Contact Philips.

My Digital Downloader Instruction Guide *MAC*

Media Player. Media Player Downloading Music/Movies

Preferred Computer Settings for a PC using Windows 7 or 8 with JRiver Media Engine 20.xx

Media Player & S! Applications

Lecture 2 Android SDK

English SCHUBERTH SC1. User s Guide.

Blaze Audio Karaoke Sing-n-Burn

My Digital Downloader Instruction Guide *WINDOWS*

Solving Audio Subsystem Challenges Using a Crossfade/Level Controller Algorithm in Portable Media Applications

Top 5 Best itunes Alternatives for Playing Music on Mac Posted by Nick Orin on June 28, :34:12 PM.

User Manual PBMSPG120CM

User manual. Register your product and get support at Portable speaker SB500

ES E 3 3 L a L b 5 Android development

User manual. Portable speaker. Register your product and get support at SB500

A18 User Manual. Please contact us via when anything comes to your mind, we urge

Description: Features: WTR010-SD module

CS 193A. Activity state and preferences

How to operate the Memory Stick player

GETTING STARTED WITH DJCONTROL INSTINCT AND DJUCED UK US

BT6700. User manual. Register your product and get support at

Using Declarative Models in Multi-device Smart Space

CS193P - Lecture 16. iphone Application Development. Audio APIs Video Playback Displaying Web Content Settings

Table of Contents. 3 Troubleshooting. 1 Getting Started. 4 Appendix. 2 Operating. Table of Contents Troubleshooting

CS378 -Mobile Computing. Services and Broadcast Receivers

SoundBridge Helpful Tips. For customers who want to use Roku SoundBridge with the SlimServer music server

Cassette2CD Wizard 2.05 User's Manual

Versa Mix. User Guide and Reference Manual Charter Street Los Angeles Ca /07

Android Programming Lecture 2 9/7/2011

BackBeat FIT 350 Series. User Guide

DMP-200 Digital Media Player Users Guide

Media Player Overview Saving Music/Video Using Media Player

-12MB BLUETOOTH HEADSET PRODUCT MANUAL AROUND-EAR WITH MICROPHONE

Important tips. N91 and N91 8GB common. File Management. Nokia PC Suite (especially Nokia Audio Manager)

Is there anything I should bear in mind when pairing my

Freegal emusic PC user guide

Mobile Application Programing: Android. View Persistence

User manual BT7900. Register your product and get support at

User manual. Always there to help you. GoGEAR. Question? Contact Philips SA4DOT02 SA4DOT04 SA4DOT08

Two-way Audio IP Cam w/night-vision Software User Guide

User manual. Always there to help you. GoGEAR SA5DOT02 SA5DOT04 SA5DOT08. Question? Contact Philips

Always there to help you. Register your product and get support at BT7500B. Question? Contact Philips.

Operating Instructions

CS378 -Mobile Computing. Persistence

HIGH POWER STREET DANCE BOOMBOX

ABook Reader Instruction Manual

EO-MN910. User Manual. English (USA). 12/2014. Rev.1.0.

BackBeat 100 Series. User Guide

Always there to help you. Register your product and get support at BT3500. Question? Contact Philips.

NID- 7006A. Memory Powered by Android TM OS 4.1

AT-LP2D-USB Turntable. Software Guide

2.8" QUICK START GUIDE 4044V. rd ④. Removing or installing the back cover. Removing or installing battery. Charging the battery.

BackBeat FIT 300 Series. User Guide

Media Player & S! Applications

GETTING STARTED WITH DJCONTROL COMPACT AND DJUCED 18

ANDROID APPS (NOW WITH JELLY BEANS!) Jordan Jozwiak November 11, 2012

CS 4518 Mobile and Ubiquitous Computing Lecture 5: Rotating Device, Saving Data, Intents and Fragments Emmanuel Agu

User manual. Always there to help you. GoGEAR. Question? Contact Philips SA4DOT02 SA4DOT04 SA4DOT08

DESIGN OF AN MP3 SYSTEM

Android Basics Nanodegree Syllabus

Register your product and get support at. AS111. User manual

User manual BT3900. Register your product and get support at

CS 528 Mobile and Ubiquitous Computing Lecture 4a: Playing Sound and Video Emmanuel Agu

Firmware User Manual. Firmware version v1.0. Suitable for Product Series: Touch Panel PC Panel PC Box PC. QD-FW_Manual_v1.0

Transcription:

CS378 -Mobile Computing Audio

Android Audio Use the MediaPlayer class Common Audio Formats supported: MP3, MIDI (.mid and others), Vorbis(.ogg), WAVE (.wav) and others Sources of audio local resources (part of app) internal URIs (Content Provider for other audio available) External URLs (streaming) 2

MediaPlayer Playback control of MediaPlayermanaged as a state machine Idle Initialized Preparing Prepared Started Paused Playback Complete Stopped End Invalid state transitions result in errors 3

MediaPlayerState Diagram Single arrows are synchronous transitions Double arrows are asynchronous transitions 4

Simple Sound Demo App audio files local to app placed in res/raw CAUTION large sound files difficult to install on emulator: http://tinyurl.com/3pwljfj better success with dev phones / actual devices 5

Playing Local Audio To play audio local to the app use the MediaPlayer.createconvenience method when complete MediaPlayer in the prepared state start MediaPlayer approach: build listeners for each button to call the playsoundmethod with appropriate song id when clicked 6

Simple Approach button ids ids for sound files 7

playsoundmethod okay for short sounds downsides: plays to completion multiple sounds play at same time (desirable in some cases) audio continues to play when app paused 8

Changing Behavior Add instance variable for MediaPlayer If playing stop and release before creating new Player 9

Cleaning Up Current version does not end well Audio continues to play if back button pressed and even if home button pressed! Activity Life Cycle on pause we should stop MediaPlayer and release 10

stopplayermethod Connect app stop button to stopplayer could use XML onclickand add View parameter or set up listener ourselves in buildlisteners method 11

onpause() should call the stopplayer method what happens if activity resumed? onpause 12

Saving State Resume music where we left off if paused or activity destroyed due to orientation change 13

Saving MediaPlayer State Not a lot of data so used the SharedPreferences 14

Restarting Audio In oncreatecheck if audio was interrupted recreate player with same id and move to correct position Can write data to shared preferences or bundle (onsaveinstancestate) and pull out in oncreate Possible fix for orientation changes in app manifest file under activity field android:configchanges="orientation" - But now we are responsible for orientation changes - http://developer.android.com/guide/topics/resources/runtimechanges.html#handlingthechange 15

Playing Audio from Phone If audio is on device / system, but not local to app use a URI Obtain URIs of Music via a Content resolver Example of simply listing URIs to the logcat 16

Retrieving Music URIs 17

MediaPlayerand System Audio After URI retrieved can play audio with MediaPlayer this approach requires calling prepare yourself no convenience method 18

Playing Audio Via Local URI id obtained via approach from showcontentmethod 19

Other Audio Other audio for ringtones, notifications, and alarms can be accessed via a RingtoneManager Obtain URIs and play with media player from DDMS: 20

Listing Other Audio 21

Playing Other Audio Once the URI is obtained, playing other audio is same as playing song 22

Playing Audio from Remote URL Straightforward given the URL 23

Completion of Audio If action required when audio done playing implement the MediaPlayer.onCompletionListener interface could make activity the listener 24

Looping to loop sound (play over and over) simply set the isloopingmethod of the MediaPlayerto true 25

SoundPool Another Android class 26

Using SoundPool Great for applications with a number of short sound samples maxstreamsparameter sets maximum number of sounds that can be played at once via this SoundPool If max is exceeded stream with lowest priority stopped and then by age (oldest) with lowest priority 27

SoundPoolplay 28

Looping of sounds: Using SoundPool 0 no looping -1 loop forever >0, play that many times frequency (speed) can be changed range from 0.5 to 2.0 0.5 twice as long to play 2.0 half as long to play 29