avaudiosession

Recording Audio on iOS Without Stopping Music Playback

◇◆丶佛笑我妖孽 提交于 2019-12-05 03:47:40
When recording audio with an AVAudioSession audio playback from the music app or others is stopped. This is described in the audio session documentation: AVAudioSessionCategoryRecord For recording audio; this category silences playback audio. Is there any way to change this behavior and do one of the following? 1) Continue playing other apps' audio and allow the phone to record the audio that is being played. 2) Resume other apps' audio once a brief recording is finished. There are notifications apps can respond to when audio interruptions begin or end. Is there something specific that must be

Is it possible to add track title to “Now Playing Controls” menu as Music app or ITunesU do?

隐身守侯 提交于 2019-12-05 01:47:29
问题 I'm, creating a player app. I've implemented 'remoteControlReceivedWithEvent:' method and could change playing state by this buttons (apple guide). But when something playing from 'Music' or 'iTunes U' apps, than there are a song title appear under remote controls. Is there any way to show there my own text from my player app? Thanks in advance. 回答1: Yes, it's done through the MPNowPlayingInfoCenter 来源: https://stackoverflow.com/questions/9384965/is-it-possible-to-add-track-title-to-now

Playing music at back ground: AVAudioSessionInterruptionNotification not fired

时光总嘲笑我的痴心妄想 提交于 2019-12-05 00:57:53
My app is playing in background well. Pause and play also works well even my app is background using the methods registered for AVAudioSessionInterruptionNotification . The problem arrives steps for the scenario: Launch my app -> goes background music from my app playing well launch apple's music app and play. AVAudioSessionInterruptionNotification fired . When i pause the music app or kill the music app. AVAudioSessionInterruptionNotification doesn't get fired Code: I am doing this in appdelegate . didfinishlaunching NSError *sessionError = nil; [[AVAudioSession sharedInstance] setCategory

Setting AVAudioSession Category has no effect on sound from WKWebView

╄→尐↘猪︶ㄣ 提交于 2019-12-04 23:09:48
问题 I can not seem to override the AVAudioSession category or port when audio is being played from a WKWebView. The same code works perfectly when using a normal UIWebView. AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&err]; I've also tried activating the sharedInstance like this, but it did not help: [session setActive: YES error: nil]; The above code has no effect on audio coming from a WKWebView. I did find some

AVAudioSession mixing with AVSpeechUtterance

邮差的信 提交于 2019-12-04 19:31:36
I have an issue where I would like to have the iPod playing music in the background and in my application I would like to have AVSpeechUtterance lower the volume of the iPod, play a string of text and then I would like to have the iPod resume playing. I have tried several things but never had AVAudioSession and AVSpeechUtterance work well together. I can get the iPod to stop, pause for a bit and then start playing again. I can see my string being passed to AVSpeechUtterance , but it does not take precedence to be played over the speaker. Here is my code: View did load: - (void)viewDidLoad { /

How to detect ear piece (speaker) availability on iOS devices?

穿精又带淫゛_ 提交于 2019-12-04 19:15:22
I want to detect specially on iPad's if there is ear piece available or not. For example - I can detect if the iOS device hasTourch or not using AVFoundation so is there any way to detect ear piece availability. 1) If you want to check if Ear piece (Receiver speaker) is available on device You can identify this by simply identifying if Device is iPhone. UIDevice.current.userInterfaceIdiom == .phone in iOS prottype AVAudioSessionPortBuiltInReceiver is there for builtInreceriver speaker. and according to apple's documentation , This is available only on iPhone device. So there is no need to

AVAudioSession / Audio Session Services switching output

假装没事ソ 提交于 2019-12-04 18:42:19
问题 Okay, I have my AVAudioSession defined with the following (yes, mix of the c and obj-c calls) Also note that the app has background mode audio, because if recording it must continue to do so while the app is in the background: [(AVAudioSession *)[AVAudioSession sharedInstance] setDelegate: self]; // Allow the app sound to continue to play when the screen is locked. [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; //Turn off automatic gain on the

Resuming execution of code after interruption while app is in background

橙三吉。 提交于 2019-12-04 10:28:51
I have spent days researching on SO and other websites for the answer to this but without any luck. Essentially, the challenge I've set for myself is to create an alarm clock app for iOS that will sound no matter where the user may be (foreground or background). This I have already accomplished by using an AVAudioPlayer instance and starting to play an empty sound file when the user sets the alarm in order for the app to keep running in the background. When it is time for the alarm to go off (ie when the NSTimer is fired) a second player, which has already been initiated and prepared to play,

AVAudioRecorder - Proper MPEG4 AAC Recording Settings

老子叫甜甜 提交于 2019-12-04 09:30:02
问题 I've got a live app with an estimated 15% of users reporting that the record feature is not working. This isn't happening on our test devices, but the reports show that the problem is that prepareToRecord is returning NO. I've had trouble finding sample settings for AAC format. Are any of my settings off? App requires iOS5 and uses ARC. AVAudioSession *audioSession = [AVAudioSession sharedInstance]; [audioSession setCategory:AVAudioSessionCategoryRecord error:nil]; NSDictionary

The Mute Button Won't Mute AVAudioPlayer

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 09:21:16
问题 I need to loop play a .caf file in my iPhone app. The AVAudioPlayer looks promising. But there's one problem. It won't stop or mute even if I pressed the mute button on the iPhone. And I understand that there would be no way to programmatically find out whether that mute button is pressed or not in iOS 5. So, what I need to know might be some properties about AVAudioPlayer or AVAudioSession. Or, perhaps, I may need to consider other libraries to loop playing my .caf file. Any idea? 回答1: I