diff options
author | Yoann Lopes <yoann.lopes@digia.com> | 2014-05-21 13:40:42 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@digia.com> | 2014-07-16 14:59:06 +0200 |
commit | 2bc7a39a0d01498567aef958908b4bdba4071c8f (patch) | |
tree | 1696078e1323571c1a149945f9878ab1829e3003 | |
parent | a7d10a265aea417ed80f9cf90545b4c3b6cd8866 (diff) | |
download | qtmultimedia-2bc7a39a0d01498567aef958908b4bdba4071c8f.tar.gz |
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>
-rw-r--r-- | src/plugins/coreaudio/coreaudiosessionmanager.mm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/coreaudio/coreaudiosessionmanager.mm b/src/plugins/coreaudio/coreaudiosessionmanager.mm index 04c8b6ed4..6a8e97f4a 100644 --- a/src/plugins/coreaudio/coreaudiosessionmanager.mm +++ b/src/plugins/coreaudio/coreaudiosessionmanager.mm @@ -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() |