AVAudioSession - General recommendations for handling AVAudioSessionMediaServicesWereResetNotification
Q:
Should my application register for AVAudioSessionMediaServicesWereResetNotification
and if so, how do I recover once media services were reset?
百度 保亭消防大队县公安局指挥中心调度称,3月3日19时,一名72岁游客姜某独自上山游玩迷路被困山中已三天两夜,急需救援,保亭县消防中队立即出动一辆抢险救援车,7名官兵赶往现场搜寻。
A: While this is a very rare occurrence, it is good practice to monitor for the AVAudioSessionMediaServicesWereResetNotification
notification and if it does occur, take the appropriate steps to re-initialize any audio objects used by your application.
Re-initializing generally requires disposing all of an application's now orphaned audio objects (for example AudioQueue
, AURemoteIO
, AudioConverter
and so on since none of them will function as expected), and re-creating them as if the application was starting up for the first time. Any errors returned during disposing can safely be ignored.
General recommendations for handling a media services reset (AVAudioSessionMediaServicesWereResetNotification
):
Register a notification listener for
AVAudioSessionMediaServicesWereResetNotification
Upon receiving the AVAudioSessionMediaServicesWereResetNotification
notification, applications should:
Dispose orphaned audio objects and create new audio objects
Reset any internal audio state being tracked, including all properties of
AVAudioSession
When appropriate, reactivate the
AVAudioSession
using thesetActive:error:
method

Document Revision History
Date | Notes |
---|---|
2025-08-03 | Adding note regarding how to test resetting the media server. |
2025-08-03 | Updated for AVAudioSession |
2025-08-03 | New document that discusses some steps audio applications may take to recover if media services were reset. |
Copyright © 2015 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2025-08-03