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

Similar documents
Announcements. Today s Topics

CS193p Spring 2010 Wednesday, May 26, 2010

Announcements. Today s Topics

ITP 342 Mobile App Dev. Audio

AVAudioRecorder & System Sound Services

ITP 342 Mobile App Dev. Audio

} override func didreceivememorywarning() { 26 super.didreceivememorywarning() 27 } 28 } Pause Stop

Multimedia. Mobile Application Development in ios School of EECS Washington State University Instructor: Larry Holder

Enabling Your App for CarPlay

ipod classic User Guide

Beginning iphone. Games Development. Apress. Peter Bakhirev. Ian Marsh. Scott Penberthy Ben Britten Smith. Eric Wing. PJ Cabrera

iphone FOURTH EDITION Brad Miser

Media Playback and Recording. CS193W - Spring Lecture 3

HKUST. CSIT 6910A Report. iband - Musical Instrument App on Mobile Devices. Student: QIAN Li. Supervisor: Prof. David Rossiter

CS193p Spring 2010 Wednesday, March 31, 2010

ipod nano User Guide

Stanford CS193p. Developing Applications for ios Fall Stanford CS193p. Fall 2013

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

Connecting your smartphone or tablet to the HDD AUDIO PLAYER through a Wi-Fi (wireless LAN) network [6]

Introducing the Photos Frameworks

John Ray. Sams Teach Yourself. iphone. Application Development. Second Edition. S^/MS 800 East 96th Street, Indianapolis, Indiana, USA

ipod nano User Guide

Index. Symbols. 24-hour clock, enabling/disabling,

iphone User Guide For iphone OS 3.1 Software SoftView Exhibit Kyocera Corp. v. SoftView LLC IPR

How to configure your Triton Player

Connecting your smartphone or tablet to the HDD AUDIO PLAYER through a Wi- Fi (wireless LAN) network [6]

iphone Programming Touch, Sound, and More! Norman McEntire Founder Servin Flashlight CodeTour TouchCount CodeTour

Helium Remote for ios Version 1.4 User Manual

ITP 342 Mobile App Development. Data Persistence

Parallels Toolbox for Windows User's Guide

AUDIO VIDEO & NAVIGATION SYSTEM OWNER S MANUAL

ADDING MUSIC TO YOUR itunes LIBRARY

ios in Practice MANNING BEAR CAHILL Shelter Island

Listening to Music and Other Audio Files

Getting to know your ipad exploring the settings, App store, Mail

Stanford CS193p. Developing Applications for ios. Fall Stanford CS193p. Fall 2011

Localizing with Xcode 6

CS378 -Mobile Computing. Audio

To return to map view, tap the inset. Chapter 15 Maps

Delivering an Exceptional Audio Experience

ipod shuffle User Guide

How To Add Songs To Ipod Without Syncing >>>CLICK HERE<<<

Contents in Detail. Introduction... xxiii How This Book Is Organized... xxiv. Part 1: Getting Started

Completing the Multimedia Architecture

Manual Does Ipod Shuffle 2nd Generation Have Voice Over

Instructions Put Movies Ipod Classic Without Itunes >>>CLICK HERE<<<

AT&T Advertising SDK Developer Guide for ios

Itunes download 10.5

Streaming Media. Advanced Audio. Erik Noreke Standardization Consultant Chair, OpenSL ES. Copyright Khronos Group, Page 1

How To Setup Bluetooth Iphone 4s Ringtone To Songs As Your >>>CLICK HERE<<<

CarPlay Navigation App Programming Guide. September 28, 2018

Manage Music Iphone 5

Chapter 1 4 ipod Basics 5 ipod at a Glance 5 Using ipod Controls 7 Disabling ipod Controls 8 Using ipod Menus 9 Connecting and Disconnecting ipod

Mobile App Development. ios Platform

How To Manually Sync Songs To Iphone 5 With Itunes

Introducing MusicKit. Media #WWDC17. Tim Parthemore, MusicKit Services Joel Lopes Da Silva, ios Music

Itunes Manually Transfer Ipod Music To Library Mac Software

itunes What Is It? What Does it Do?

Variations Mobile: Developing an ios Audio Streaming App. September 2011 IU Statewide IT Conference. Mark Notess Sarah Schmiechen

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

Manually Add Ringtones To Iphone 4 Without Itunes Mac

COPYRIGHTED MATERIAL. chapter 1. How Do I Configure My iphone? 2

Chapter 1 4 ipod Basics 5 ipod at a Glance 5 Using ipod Controls 7 Disabling ipod Controls 8 Using ipod Menus 9 Connecting and Disconnecting ipod

How To Change Ipod To Manually Manage Music Without Erasing

ios Application Development Course Details

Science. Computer Science

Cisco StadiumVision Mobile API for Apple ios

Google Home. List of Basic Commands

How To Switch The Ipod To Manual Update And Enable Disk Use

Using RSS Feeds for Distributing Videos. Dr. Rick Jerz St. Ambrose University Davenport, Iowa

ITunes. itunes works with Windows 2000, XP, Windows Server 2003, Mac OS X and it also works on a few cellular phones.

ITP 342 Mobile App Development. Data Persistence

UVO SYSTEM USER'S MANUAL

Cloud music itunes iphone for free 9.2. Cloud music itunes iphone for free 9.2.zip

Hello! ios Development

I DO NOT OWN ITUNES OR ANYTHING IN THE THUMBNAIL THIS IS ALL OWNED BY APPLE.

DOWNLOAD PDF WINDOWS MEDIA CENTER WIZARDRY

Helium Streamer for ios Version 2.0 User Manual

ipod nano Features Guide

CopyTrans Manager User Guide

InfraWare Mobile. for ios. Published October 06, 2015

Can the app be installed on the device? Does the app behave as designed/desired if there is an incoming SMS?

Developing Applications for ios

Manual Does Ipod Shuffle 4th Generation Hold Play Button

ipodt & itunes FOR DUMHIE&* 10th edition by Tony Bove WILEY John Wiley & Sons, Inc.

StreamPlayer Generation III SE

Quick Setup Guide. Date: October 27, Document version: v 1.0.1

Super UA Q&A 2015/03/16

TEAC HR Audio Player. Music Playback Software for TEAC USB AUDIO DAC Devices OWNER S MANUAL

Welcome Operation Installation... 3 Scope of function... 3 Pre-requirements... 3 Number of clients... 4 Version number...

What Do I Really Need to Know about itunes? COPYRIGHTED MATERIAL

Downloading an Overdrive Audiobook to a PC

2017 NMUG CLASSES MANAGING THE IPHONE AND IPAD IN IOS 10

memory product Doesn t play videos like the ipod Comes in 2, 4, and 8 Cost ranges from $135 to $225

Music Player & S! Appli

Patron Assistance: Become an OverDrive Specialist.

Taking Your ipad 2. to the Max. Michael Grothai. Erica Sadun. Steve Sande

AVAudioPlayer. avtouch Application

Manually Sync Ipod Touch Music To Pc Transfer 2012

How to Use Skype & Pamela Software to Record Your Podcast

Transcription:

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

Today s Topics Audio APIs Video Playback Settings Bundles 2

Audio Playback 3

Uses for Audio Sound effects button clicks alert sounds short sounds accompanying user actions Arbitrary length sounds (music, podcasts, spoken content) Streamed content from web services Recording audio 4

How to do it? Could be complex: Potentially multiple simultaneous sources Numerous possible outputs Dynamic events, often out of user s control Different priorities for seemingly similar actions The OS manages the sound system You can ask for behavior, but the OS has control 5

CoreAudio High level, easy to use System Sound API - short sounds AVAudioPlayer class - ObjC, simple API Lower level, takes more effort but much more control Audio Toolbox - recording and playback, streaming, full control Audio Units - processing audio OpenAL - 3D positional sound Which one you use depends on what you re trying to do Many of you are fine with System Sounds and AVAudioPlayer 6

Playing Short Sounds short means less than 5 seconds Very simple API, but has restrictions No looping No volume control Immediate playback Limited set of formats Linear PCM or IMA4.caf,.aif or.wav file 7

Playing Short Sounds Two step process Register the sound, get a sound ID in return Play the sound Optionally can get callback when sound finishes playing NSURL *fileurl =... // url to a file SystemSoundID myid; // First register the sound AudioServicesCreateSystemSoundID ((CFURLRef)fileURL, &myid); // Then you can play the sound AudioServicesPlaySystemSound (myid); 8

Playing Short Sounds Clean up Dispose of sound ID when you re done Or if you get a memory warning SystemSoundID myid; // dispose of the previously registered sound AudioServicesDisposeSystemSoundID (myid); 9

Feel the vibration System sound API allows for triggering the phone s vibration Use the special system sound ID ksystemsoundid_vibrate Does nothing on ipod touch - (void)vibrate { } // trigger the phone s vibration AudioServicesPlaySystemSound (ksystemsoundid_vibrate); 10

Converting Sounds Command line utility to convert sounds /usr/bin/afconvert Supports wide variety of input and output formats See man page for details Easily convert sounds to System Sounds formats /usr/bin/afconvert -f aiff -d BEI16 input.mp3 output.aif 11

AVAudioPlayer Play longer sounds (> 5 seconds) Locally stored files or in-memory (no network streaming) Can loop, seek, play, pause Provides metering Play multiple sounds simultaneously Cocoa-style API Initialize with file URL or data Allows for delegate Supports many more formats Everything the AudioFile API supports 12

AVAudioPlayer Create from file URL or data AVAudioPlayer *player; NSString *path = [[NSBundle mainbundle] pathforresource...]; NSURL *url = [NSURL fileurlwithpath:path]; player = [[AVAudioPlayer alloc] initwithcontentsofurl:url]; Simple methods for starting/stopping if (!player.playing) { [player play]; } else { [player pause]; } 13

AVAudioPlayerDelegate Told when playback finishes Informed of audio decode errors Given hooks for handling interruptions Incoming phone calls 14

Audio Sessions OS needs to know what you re doing with audio Start playing a game or listening to a podcast, then lock the device...what should happen? If you re playing a shoot em up game and flip the ringer/silent switch to silent...what should happen? Audio Sessions are a way for you to express your audio intent Categories defined to clarify Ambient sound Media playback Recording Playback and record 15

Default Sessions Apps get default session which will mute other sounds when you play yours (e.g. ipod audio) respect the ring/silent switch mute audio when user locks device For many apps this is fine, but may not be for yours If so, you need to use Audio Session APIs 16

Demo Audio 17

Audio Queue Audio File Stream Services & Audio Queue Services Supports wider variety of formats Finer grained control over playback Streaming audio over network Allows queueing of consecutive buffers for seamless playback Callback functions for reusing buffers 18

Audio Units For serious audio processing Graph-based audio Rate conversion Audio Effects Mixing multiple streams Very, very powerful. Same as on Mac OS X 19

OpenAL High level, cross-platform API for 3D audio mixing Great for games Mimics OpenGL conventions Models audio in 3D space Buffers: Container for Audio Sources: 3D point emitting Audio Listener: Position where Sources are heard More Information: http://www.openal.org/ 20

Audio Playback 21

AVAudioRecorder Easy way to record audio input Specify a URL for writing -record; -recordforduration: Provides metering (Peak and Average) Specify settings for: Audio Format Sample Rate Conversion Encoding format 22

AVAudioRecorder Create from file URL or data AVAudioRecorder *recorder; NSError *error = nil; recorder = [[AVAudioRecorder alloc] initwithurl:url settings:nil error:&error]; Simple methods for recording/pausing if (!recorder.recording) { [recorder record]; } else { [recorder pause]; } 23

AVAudioRecorderDelegate Delegate methods closely match methods for AVAudioPlayer Told when recording finishes Informed of audio encode errors Given hooks for handling interruptions Incoming phone calls 24

Audio Toolbox Recording audio Audio Queue Services (in a nutshell) Create a queue Define a callback function to receive recorded audio data Start the queue Receive callbacks with recorded data, you have to store it Stop the queue See the SpeakHere example project in iphone Dev Center for more details 25

Media Player 26

MediaPlayer Framework Tell ipod app to play music Access to entire music library for playback, not processing Easy access through MPMediaPickerController Deeper access through Query APIs 27

MPMediaPickerController Initialization APIs - (id)init; - (id)initwithmediatypes:(mpmediatype)mediatypes; { Music, Podcasts, AudioBooks, Any } @property (BOOL) allowspickingmultipleitems; @property (MPMediaType) mediatypes; @property (NSString *)prompt; Delegate methods include: mediapicker: didpickmediaitems: mediapickerdidcancel: 28

MPMediaItemCollection Represents an array of MPMediaItems Represents Playlists, Albums, Genius Mixes, etc. @property (NSArray *) items; @property (NSUInteger) count; @property (MPMediaItem *) representativeitem; @property (MPMediaType) mediatypes; 29

MPMediaItem Each MPMediaItem represents one track Property-based metadata Title Artist Genre Track Number Lyrics etc... 30

Media Player Classes MPMediaLibrary MPMediaQuery MPMediaPredicate MPMediaPropertyPredicate MPMediaItemArtwork etc... 31

Video Playback 32

Playing Video Uses for Video: Provide cut-scene animation in a game Stream content from web sites Play local movies Play videos from application bundle or remote URL Always full screen Configurable scaling modes Optional controls Supports:.mov,.mp4,.m4v,.3gp 33

MPMoviePlayerController - (id)initwithcontenturl:(nsurl *)url; - (void)play; - (void)stop; Properties include: backgroundcolor - including clear scalingmode - aspect fit, aspect fill, fill, no scaling moviecontrolmode - default, volume only, hidden Notifications tell you: movie is ready to start playing (may take time to preload) movie playback finished scaling mode changed 34

Demo Video 35

Video Editing 36

Editing Video Why Edit Video? Record and post to YouTube Make a video editor! Record videos using Image Picker Controller Supports same formats as playback 37

UIVideoEditorController + (BOOL)canEditVideoAtPath:(NSString *)path; @property (NSTimeInterval) videomaximumduration; @property (NSString *) videopath; @property (UIImagePickerControllerQualityType) videoquality; Delegate methods include: videoeditorcontroller:didsaveeditedvideotopath: videoeditorcontrollerdidcancel: videoeditorcontroller:didfailwitherror: 38

Settings 39

Application Settings Many apps have settings for users to customize things Apple very consciously limits the number of settings Focus on the settings that appeal to the widest audience Avoid throwing in every switch just because Settings are not free they have a cost which shouldn t be underestimated Once decided what settings you need, where do they go? 40

Settings UI Apple Human Interface Guidelines makes 2 recommendations Put in Settings application Default behavior overrides Infrequently set options Examples: Mail account information, Safari search provider Keep in your application Configuration options Frequently changed options Examples: Stock symbols, Map/Satellite/Hybrid in Maps 41

Settings UI To put things in Settings, create a Settings bundle For in-app, frequently put on back of main view Use info button, Utility Application template in Xcode Stocks, Weather are examples 42

Settings Bundles Added as a new file in Xcode project Actually a wrapper containing plist defining settings layout localized resources for strings Modify root plist to contain specifiers for each setting data driven, but can do a lot of stuff including hierarchies 43

Preference Specifiers Each item specifies one element in the settings UI Specifiers have a type Title TextField ToggleSwitch Slider MultiValue Group ChildPane Each type has specific keys for details Check the documentation for specifics of each one 44

Demo Settings Bundle 45

Questions? 46