avaudiosession

Access to microphone for recording via code, iOS

你。 提交于 2019-12-11 20:21:48
问题 In my App am using AVAudioRecorder for recording. There is no problem regarding the recording. When I play my app for the first time, the problem is that an alertview pop ups, regarding allow/dis allow the microphone to be used. I want to have 1) control over this default alertview, so that my recording and timer (a label that is used to show the seconds, audio recorded) starts only when I click on Allow microphone, OR 2) need to set microphones available for the app, so that It doesn't

Pausing/muting background music in iOS

拟墨画扇 提交于 2019-12-11 16:52:21
问题 I've got an app that uses text-to-speech to occasionally give verbal cues to the user. Currently I've set it up so the TTS mixes over any music that's playing in another app. Is there any way I could temporarily pause/mute music that's playing in another app while a verbal cue plays? 回答1: You can use MPMusicPlayerController class and it's static method iPodMusicPlayer to get instance of the system (Music app) MPMusicPlayerController object. Then you can pause , play or anything else. The main

iOS: Siri not available does not return AVAudioSessionInterruptionOptionShouldResume

孤者浪人 提交于 2019-12-11 13:24:53
问题 I have iOS app that handles audiosession interrupts with: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(AudioInterrupt:) name:AVAudioSessionInterruptionNotification object: NULL]; and in AudioInterrupt: - (void)AudioInterrupt:(NSNotification*)notification { NSDictionary *interuptionDict = notification.userInfo; // get the AVAudioSessionInterruptionTypeKey enum from the dictionary NSInteger interuptionType = [[interuptionDict valueForKey

IPhone audio: Volume faint ( but okay with headphones )

◇◆丶佛笑我妖孽 提交于 2019-12-11 07:45:38
问题 I'm getting unexpected audio behaviour: problem -- iPhone device volume is very faint, but if I plug in headphones the volume is perfect firstly, start app on iPhone the with nothing plugged in. Audio works, but it is so faint, really as if it was on minimum volume. but it is on maximum volume. now I plug in headphones. full volume. great! unplug headphones. Go to (2) It doesn't matter whether I start with the headphones plugged in or not. It seems to be an unrelated problem EDIT: this

AVAudioSession category not working as documentation dictates

混江龙づ霸主 提交于 2019-12-11 04:45:21
问题 I have an iOS app that has some audio feedback in certain places, but I want any other music the user has playing in the background to be allowed to play over this. In addition, I want the audio in my app to respect the mute switch. According to the developer documentation, this functionality should all be enabled by the AVAudioSession ambient category. This is the code I'm using: if (!hasInitialisedAudioSession) { AVAudioSession *session = [AVAudioSession sharedInstance]; [session

System sound becomes louder when AVAudioPlayer is initiated

那年仲夏 提交于 2019-12-11 04:27:00
问题 I've found 1 question on SO about the same issue and it remains unanswered. AVAudioPlayer affects system sounds AVAudioSessionCategoryAmbient is not the answer as that only allows the app to play its audio simultaneously with another app's audio, that's not it. I play sound effects such as button clicking sounds etc with SystemSound and background music with AVAudioPlayer. When AVAudioPlayer starts while SystemSound is being played, that particular system sound becomes like 5 times louder all

iOS play video without audio session

こ雲淡風輕ζ 提交于 2019-12-11 02:27:56
问题 I am trying to play a short video in my app using either a MPMoviePlayerController or an AVPlayer . The problem is (since my video doesn't have any sound) that I do not want to interfere with the sounds being played by other apps in the background. I tried to play with AVAudioSession : AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryAmbient withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil]; [audioSession setActive

Error Domain=NSOSStatusErrorDomain Code=560030580 “The operation couldn’t be completed. (OSStatus error 560030580.)”

人走茶凉 提交于 2019-12-10 15:04:51
问题 I was using AVPlayer to play online mp3 stream ! When I pause the player [AVPlayer pause]; AVAudioSession *session = [AVAudioSession sharedInstance]; session.delegate = nil; NSError *error = nil; [session setActive:NO error:&error]; NSLog([error description]); I met the error , Error Domain=NSOSStatusErrorDomain Code=560030580 "The operation couldn’t be completed. (OSStatus error 560030580.)" Can anyone tell me why and how to resolve it? Thank you very much!! 回答1: I encounter this problem too

Changing setPreferredIOBufferDuration at Runtime results in Core Audio Error -50

故事扮演 提交于 2019-12-10 12:07:19
问题 I am writing an Audio Unit (remote IO) based app that displays waveforms at a given buffer size. The app initially starts off with a preferred buffer size of 0.0001 which results in very small buffer frame sizes (i think its 14 frames). Than at runtime I have a UI element that allows switching buffer frame sizes via AVAudioSession 's method setPreferredIOBufferDuration:Error: . Here is the code where the first two cases change from a smaller to a larger sized buffer. 3-5 are not specified yet

How can I fix “Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value” in Swift [duplicate]

ぐ巨炮叔叔 提交于 2019-12-10 12:00:44
问题 This question already has answers here : What does “Fatal error: Unexpectedly found nil while unwrapping an Optional value” mean? (11 answers) Closed last year . I am trying to add music to a game I created. But I am getting the error: "Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional value. I found another post on Stack Overflow (What does "fatal error: unexpectedly found nil while unwrapping an Optional value" mean?), but I do not understand how this applies to my