Ad
IPhone (SDK 2.2): Adusting Playback Volume While NOT Actively Playing Music W/ AVFoundation?
So I have an app which plays many short sound clips. I need to know when the sounds are finished playing, and I need to use mp3s, so I'm using AVFoundation for the sound playback.
When a sound is actively playing, and the user uses the hardware volume buttons, the playback volume changes. Problem is, the app is NOT constantly playing sounds, and when it's not, and the hardware buttons are used, the RINGER volume gets adjusted instead.
How do I set it up so, as long as the app is running, the user can adjust the playback volume?
Thanks!
Ad
Answer
Turns out this can be accomplished by allocating an AVAudioPlayer
with any valid sound file and calling the prepareToPlay
method, without ever calling the play
method.
Works perfectly.
Ad
source: stackoverflow.com
Related Questions
- → Web App Image Rotate Issue
- → Website not loading on AT&T LTE; all other carriers and wifi work fine
- → Disable wheel selector on iOS Safari?
- → Opening Image File from JavaScript (doesn't work on mobile phones)
- → React router & Phonegap - First page not found
- → unable to add photo from iphone to canvas
- → What's the best practice for having a Laravel application serve both the browser-based application, and act as an API for the iPhone and Android app?
- → Wordpress mobile nav menu: menu appears on click on iPhone and other mobile devices, but not iPad
- → How to save the response From My server , and How can i access That data
- → Communication between iPhone app and AWS server
- → NSDateFormatterStyle.MediumStyle doesn't show in iPhone
- → Could not find Developer Disk Image - Xcode 7.2 & iOS 9.2
- → String encryption in Objective-C decrypt in C#
Ad