CoreAudio: make sure audio stops playing when the device is muted.
The audio session's category was set to Playback, which implies that audio is still audible even after setting the device to silent mode or locking the screen. This shouldn't be the default behavior. We now set it to Ambient, which preserves mixing with other apps but makes sure sound is turned off when it should. Task-number: QTBUG-39036 Change-Id: Ic36668d73f3179dc38b41023e380e15f8c8517e0 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
@@ -216,8 +216,9 @@ CoreAudioSessionManager::CoreAudioSessionManager() :
|
||||
{
|
||||
m_sessionObserver = [[CoreAudioSessionObserver alloc] initWithAudioSessionManager:this];
|
||||
setActive(true);
|
||||
//set default category to just Playback and only switch if we need more permissions
|
||||
setCategory(CoreAudioSessionManager::Playback, CoreAudioSessionManager::MixWithOthers);
|
||||
// Set default category to Ambient (implies MixWithOthers). This makes sure audio stops playing
|
||||
// if the screen is locked or if the Silent switch is toggled.
|
||||
setCategory(CoreAudioSessionManager::Ambient, CoreAudioSessionManager::None);
|
||||
}
|
||||
|
||||
CoreAudioSessionManager::~CoreAudioSessionManager()
|
||||
|
||||
Reference in New Issue
Block a user