This class provides an Objective-C alternative to many features from the C-based Audio Session Services.
Questions tagged [avaudiosession]
1047 questions
15
votes
2 answers
Implementing and Troubleshooting Background Audio in iOS
There are a lot of questions relating to background music playback in iOS on StackOverflow. None fully explore all edge cases, the aim of
this question is to be the final word in background audio question on
iOS
Definitions & Assumptions
All…

Richard Stelling
- 25,607
- 27
- 108
- 188
14
votes
2 answers
Upload audio clip realtime while its recording?
How to upload audio clip realtime to a server while its recording? Basically my requirement is upload an audio clip as chucks/packets while its recording.
I already did the recording part with using IQAudioRecorderController…

smartsanja
- 4,413
- 9
- 58
- 106
14
votes
4 answers
Hide Red Recording Status Bar In iOS App When Not Recording
I can't get the red "Recording" status bar to hide in my app when the app is in the background and not recording.
I happen to be using The Amazing Audio Engine, but I think this question could be tackled knowledge of that library. It gets setup…

bendytree
- 13,095
- 11
- 75
- 91
14
votes
1 answer
How to reduce recording noise when recording with audio sessions?
I got some recording code working, but the recorded audio (from the iPod touch internal microphone) is very noisy.
This is my configuration:
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
NSError *err = nil;
…

Proud Member
- 40,078
- 47
- 146
- 231
13
votes
3 answers
The Mute Button Won't Mute AVAudioPlayer
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…

Di Wu
- 6,436
- 3
- 35
- 51
13
votes
2 answers
Listen to volume button presses the correct way (iOS 15)
I have used
NotificationCenter.default.addObserver(self, selector: #selector(volumeChanged(_:)), name: NSNotification.Name(rawValue: "AVSystemController_SystemVolumeDidChangeNotification"), object: nil)
in the past to listen to volume control…

aaaav
- 151
- 9
13
votes
2 answers
AVAudioRecorder currentTime giving bad values
I have a setup as follows, testing on an iPhone 5s with iOS 10.3, both in and out of debug.
An AVAudioRecorder fires record(forDuration: 5.0)
A CADisplayLink watches the levels of the recorder (the recorder is meteringEnabled), synchronizing an…

Badam Baplan
- 270
- 2
- 12
13
votes
3 answers
AVAudioSession error: Deactivating an audio session that has running I/O
2017-02-24 14:56:44.280 PropertyManager[10172:5336578] 14:56:44.280 ERROR: [0x1a0a24000] AVAudioSession.mm:692: -[AVAudioSession setActive:withOptions:error:]: Deactivating an audio session that has running I/O. All I/O should be stopped or…

xuyafei
- 139
- 1
- 1
- 4
13
votes
1 answer
Using Spotify/background music with camera open
I have an app that needs to have:
Background music playing while using the app (eg. spotify)
Background music playing while watching movie from AVPlayer
Stop the music when recording a video
Like Snapchat, the camera-viewcontroller is part of a…

Morten Stulen
- 1,243
- 1
- 14
- 26
13
votes
2 answers
AVAudioSession AVAudioSessionCategoryPlayAndRecord glitch
I would like to record videos with audio using AVCaptureSession. For this I need the AudioSessionCategory AVAudioSessionCategoryPlayAndRecord, since my app also plays back video with sound.
I want audio to be audible from the default speaker and I…

Jorn van Dijk
- 1,973
- 1
- 15
- 23
13
votes
4 answers
requestRecordPermission does nothing
Since the update of iOS 7 there has been some changes with recording applications.
I have an app that used to work with iOS 5 and 6, but when I tried to run it on iOS 7 - recording didn't respond.
I checked the internet and saw there's a new method…

Kevin Hury
- 145
- 1
- 7
13
votes
3 answers
How to enable audio scrubber in iOS Lock Screen control panel?
I have the following dictionary for MPNowPlayingInfoCenter
@{MPMediaItemPropertyAlbumTitle: @"First Title",
MPMediaItemPropertyArtwork: [[MPMediaItemArtwork alloc] initWithImage:[UIImage…

Ashish Awaghad
- 2,822
- 3
- 24
- 33
13
votes
4 answers
Cocos2D 2.1: "Delegate" deprecated in iOS 6. How do I set the delegate for this AVAudioSession?
Started a Cocos2D 2.1 template (with no physics engine) in Xcode 4.5, targeted for iOS 6 and iPad. In the CDAudioManager.m file, the following code...
AVAudioSession* session = [AVAudioSession sharedInstance];
session.delegate = self; // Which is…

baptzmoffire
- 589
- 2
- 4
- 20
12
votes
2 answers
AVAudioSession - How to switch between speaker and headphones output
I'm trying to mimic behaviour as in Phone app during calling. You can easily switch output sources from/to speaker or headphones.
I know I can force speaker as an output when headphones are connected by calling:
try!…

msmialko
- 1,439
- 2
- 20
- 35
12
votes
1 answer
How to set audioSession category for iOS 9?
How does one access the old API for setting audioSession categories? I have an old iPad that I use a video app on that is stuck at iOS 9.3. I'm using Xcode 10. I think it's just method i need here but I'm not sure how to find it.
func…

aaronium112
- 2,992
- 4
- 35
- 50