Resume Background Audio After Playing Sound With AVAudioPlayer
I am looking for a way to resume audio played by another application after my application plays its own sound with AVAudioPlayer. Right now, if I am listening to music and launch my application, it pauses the music, plays my sound, but doesn’t resume the background music.
Here is what i’m doing to generate the sound playback:
myChime = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"chime" ofType:@"mp3"]] error:nil]; myChime.delegate = self; [myChime play]; // Here I am looking to resume the audio that the system was playing before my application played its sound. I have seen many applications do this such as, GPS apps that speak a voice direction and then resume the music.
Solutions Collect From Internet About “Resume Background Audio After Playing Sound With AVAudioPlayer”
You need to properly implement the
AVAudioSession delegate methods. If you set the audio session to inactive, then the system will know you are done playing your sound and will resume any other audio sessions. Refer to the Audio Session Programming Guide, especially the
- How to deselect a map annotation on second tap
- iPhone App:Test the newer version of app first and after make it available for other users for download
- Saving Array to Plist file that contains Custom Objects iPhone
- Swift: How to compare two Dictionary<String, Any> structs?
- How to Dismiss a Storyboard Popover
- Where does the indexPath of dequeueReusableCellWithIdentifier:forIndexPath: get used?
- super init isn't called on all paths before returning from initializer
- What are common sources of PhoneGap with jQuery Mobile performance issues?
- Texture lookup in vertex shader behaves differently on iPad device vs iPad simulator – OpenGL ES 2.0
- Using UITableViewCell in a UITableView
- App crashed in iOS 6 when user changes Contacts access permissions
- Swift 4 JSON Decodable simplest way to decode type change
- Convert GMT time to local time
- Reset NSTextField's text to empty string — setText: doesn't work
- UICollectionView reloadData resigns first responder in section header