avaudiosession

iOS - AVAudioPlayer doesn't continue to next song while in background

别说谁变了你拦得住时间么 提交于 2019-12-18 01:14:30
问题 So I have an app that plays a bunch of songs while the user can flip through a comic book. I use AVAudioPlayer and I have it set up to play the songs in a set order. So when one song finishes, the next one will play. This works flawlessly when the app is open. The problem occurs when the app is in the background. I set up the app to play in the background, and that works fine. So when the user presses the home screen the music continues to play. The problem occurs when the song ends, it is

iOS check if application has access to microphone

百般思念 提交于 2019-12-17 17:55:15
问题 With the introduction of iOS 7, applications have to request microphone access when they want to record audio. How do I check if the application has access to the microphone? In the iOS 8 SDK I can use the AVAudioSessionRecordPermission enum, but how do I check this in iOS 7? Info: I don't want to request permission, I just want to check if the app has access to the microphone. (Like Location access): if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) { // Do

Detecting active AVAudioSessions on iOS device

百般思念 提交于 2019-12-17 17:29:14
问题 I'm trying to figure out if this is possible - my app activates an audio session that is initialized as: [[[AVAudioSession alloc] init] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&error]; I would like to be able to understand when an additional audio session that originated from another app or the OS is playing. I know about the ability to implement the delegate methods beginInterruption: and endInterruption but these won't get

Keep bluetooth sound when initializing AVAudioSession

若如初见. 提交于 2019-12-17 16:47:11
问题 I'm about to go crazy. I have a recording app. I'm running into a problem that when I open my app, if i'm listening to music on a bluetooth device, it gets automatically routed back to the phone internal speaker. I want everything to stay the same no matter what. Even when I start recording, if the user is listening to something on a bluetooth speaker, keep doing that. The user has headphones? Keep the music there. Just leave everything as is. This is how I'm currently initializing my session

Can my app be notified when another application starts/stops playing audio?

徘徊边缘 提交于 2019-12-13 16:26:24
问题 My iOS game has music and sound effects. I'd like to let users listen to their own music in place of the game's background music. A simple solution is to add a new menu item that disables the game's background music. However, I'd like to avoid creating a new menu item unless I can be convinced that this approach is worse for the user. My current approach: Set the audio session category to AVAudioSessionCategoryAmbient to allow mixing of game audio with iPod (or other music app) playback. In

Setting the AVAudioSession category in AppDelegate.m

一曲冷凌霜 提交于 2019-12-13 04:41:55
问题 So I hate to have to ask this question but I've spent a fair bit of time searching through Apple's documentation and Google with no avail. I'm simply trying to set the AVAudioSession category for my app ONCE, when the applicationDidFinishLaunching. I have an app that plays an audio stream and I would like it to continue playing when the app enters the background, so I'm trying to use the Playback category. Here is my code for AppDelegate.m : - (void)applicationDidFinishLaunching:

How to play audio through built-in earpiece speaker

不羁岁月 提交于 2019-12-12 09:52:46
问题 I have seen some apps like WhatsApp has a feature to play audio clips only through earpiece(phone call speaker) when the user brings up the device near to ear. Otherwise its playing via normal built-in speaker. I am using MPMoviePlayer for playing audio clips. I did go through lots of similar questions and answers on the internet, and all the answers say to set the AudioSession Category to PlayAndRecord. Thats it. I did the same, but couldn't get the exact result that I want to get. // Audio

ObjectAL automatic interruption handling error

a 夏天 提交于 2019-12-12 07:52:58
问题 I've been playing with phone calls while (SpriteKit)game running in order to test interruptions. I am using example from ObjectAL documentation called : "Using the OpenAL Objects and OALAudioTrack". So, I let the library to handle this automatically... [OALAudioSession sharedInstance ]. handleInterruptions = YES And it works but partially. For example, with simple setup with 3 sounds I get next error message : OALAudioSession activateAudioSession]: Could not activate audio session after 2

After record sound file, this can't heard in iPad Air only

前提是你 提交于 2019-12-12 06:00:41
问题 I have an app in the Apple Store with voice recording capability. I migrate to Xcode 5.0.2 and SDK 7. I have no problem with this feature in devices with iOS 6 or 7 except with iPad Air. This is my record Sound routine: +(void) startRecording:(NSString *)fileName :(NSString *)fileType { NSError* theError = nil; BOOL result = YES; // Init audio with record capability AVAudioSession *audioSession = [AVAudioSession sharedInstance]; result = [audioSession setCategory:AVAudioSessionCategoryRecord

AVAudioPlayer won't play existing file a second time

寵の児 提交于 2019-12-12 03:06:36
问题 I have searched a lot trying to figure this out - the code to me seems ok but the functionality doesn't reflect this. I have a View that is presented (its an Audio Recorder view). You can press record and it records to a file just fine (data exists in the file). I can then play the file back via the play button (the AVAudioPlayer is pointing to that file). However when I close/dismiss that view and come back to it - the file will not play when Play is tapped even though it should be exactly