avaudiosession

Updated to Xcode 10.1 on Mojave and now my app always asks to use the microphone

♀尐吖头ヾ 提交于 2019-11-30 14:41:53
问题 I am running a AVAudioSession which I suspect is activating the microphone request, but I only use it for sounds and music. When running Xcode 10.1 Simulator on macOS Mojave , why does it activate a request to access the microphone? I haven't written a single line to even ask access to it. My app doesn't need access to it nor do I want it to. Here's the code to play the music: AVAudioSession *title = [AVAudioSession sharedInstance]; [title setCategory:AVAudioSessionCategoryAmbient error:nil];

AVAudioSession Interruptions

狂风中的少年 提交于 2019-11-30 12:30:16
So in my app, running on iOS 6, everything seems to work fine with audio. I use the old C API format to catch interruptions using a callback; setting up via: AudioSessionInitialize(NULL, NULL, interruptionListenerCallback, (__bridge void *)self) and it was great. Using iOS 7 SDK though, it seems that my interruption callback is never called when the device receives calls or an alarm goes off. After some looking around, I heard that the old C api were deprecated and that you should move to the newer AVAudioSession functions. More reading revealed that the AVAudioSession delegate is deprecated

what are the formats supported in AVAudioRecorder for recording sound?

两盒软妹~` 提交于 2019-11-30 12:21:11
问题 I have found a list of the different values (Audio Data Format) at http://developer.apple.com/library/ios/#documentation/MusicAudio/Reference/CoreAudioDataTypesRef/Reference/reference.html#//apple_ref/doc/uid/TP40004488 Audio Data Format Identifiers Identifiers for audio data formats, used in the AudioStreamBasicDescription structure. kAudioFormatLinearPCM = 'lpcm', kAudioFormatAC3 = 'ac-3', kAudioFormat60958AC3 = 'cac3', kAudioFormatAppleIMA4 = 'ima4', kAudioFormatMPEG4AAC = 'aac ',

Updated to Xcode 10.1 on Mojave and now my app always asks to use the microphone

廉价感情. 提交于 2019-11-30 11:25:30
I am running a AVAudioSession which I suspect is activating the microphone request, but I only use it for sounds and music. When running Xcode 10.1 Simulator on macOS Mojave , why does it activate a request to access the microphone? I haven't written a single line to even ask access to it. My app doesn't need access to it nor do I want it to. Here's the code to play the music: AVAudioSession *title = [AVAudioSession sharedInstance]; [title setCategory:AVAudioSessionCategoryAmbient error:nil]; [title setActive:YES error:nil]; //MUSIC NSString *path = [[NSBundle mainBundle] pathForResource:@

how to show seek track duration on control center

北慕城南 提交于 2019-11-30 11:09:55
问题 How do i pass the song info such as song name and track duration to control center. Player plays music fine and the play and pause control works fine though. Playing with apple's music app Playing with my app with the code below, how to pass song information in order to display it ? //AppDelegate -(void)setupAudio { // Set AVAudioSession NSError *sessionError = nil; [[AVAudioSession sharedInstance] setDelegate:self]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback

iOS - AVAudioSession Route Change Notification in background

杀马特。学长 韩版系。学妹 提交于 2019-11-30 08:13:59
问题 Despite many posts on the subject (AVPlayer & AVAudioSession, Setting the AVAudioSession category in AppDelegate.m, AvAudioSession won't work in iOS7?), I could not solve this specific issue in iOS 7: - I want to receive AVAudioSession Route Change notifications while in the background - my app is not playing any music at any point, and should not interfere with other apps playing sound The setup: - audio enabled in p-list UIBackgroundModes - in the main controller: // AUDIO AVAudioSession

Alternative to deprecated AudioSessionGetProperty, for iOS 7

你。 提交于 2019-11-30 06:37:11
I am using AudioSessionGetProperty to check 'audioIsAlreadyPlaying'. Xcode says: 'AudioSessionGetProperty' is deprecated: first deprecated in iOS 7.0 Please could someone tell me what I should use instead, to get the audioIsAlreadyPlaying property. AudioSessionGetProperty(kAudioSessionProperty_OtherAudioIsPlaying, &propertySize, &audioIsAlreadyPlaying); return audioIsAlreadyPlaying; Trying using the AVAudioSession 's otherAudioPlaying property on iOS 6.0 or higher. [[AVAudioSession sharedInstance] isOtherAudioPlaying] The AVAudioSession class replaces deprecated AudioSession APIs. For what you

AVAudioRecorder not recording in background after audio session interruption ended

筅森魡賤 提交于 2019-11-30 05:10:58
I am recording audio in my app, both in foreground and in background. I also handle AVAudioSessionInterruptionNotification to stop recording when interruption begins and start again when it ends. Although in foreground it works as expected, when app is recording in background and I receive a call it doesn't start again recording after call ends. My code is the following: - (void)p_handleAudioSessionInterruptionNotification:(NSNotification *)notification { NSUInteger interruptionType = [[[notification userInfo] objectForKey:AVAudioSessionInterruptionTypeKey] unsignedIntegerValue]; if

AVAudioSessionDelegate called at endInterruption, but beginInterruption not called

独自空忆成欢 提交于 2019-11-30 05:04:05
I'm setting up an AVAudioSession when the app launches and setting the delegate to the appDelegate. Everything seems to be working (playback, etc) except that beginInterruption on the delegate is not being called when the phone receives a call. When the call ends endInterruption is being called though. The only thought I have is that the audio player code I'm using used to be based on AVAudioPlayer, but is now using AVPlayer. The callbacks for the AVAudioPlayer delegate for handling interrupts are still in there, but it seems odd that they would conflict in any way. Looking at the header, in

iOS8 AVAudioSession setActive error

半城伤御伤魂 提交于 2019-11-30 04:41:04
I'm testing my app in XCode 6 and find an issue with AVAudioSession in iOS8. When I call [[AVAudioSession sharedInstance] setActive:NO error:nil]; I get the following error message: AVAudioSession.mm:623: -[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or paused prior to deactivating the audio session. In AVAudioSession.h, it says Note that this method will throw an exception in apps linked on or after iOS 8 if the session is set inactive while it has running or paused I/O (e.g. audio queues, players, recorders,