AVFoundation Issue
(AVFoundationErrorDomain Code=-11819)
Why does this problem occur AVAudioSessionMediaServicesWereReset
when I use AVPlayer?
Error Message
AVPlayerItem:<AVPlayerItem: 0x28189fb90, asset = <AVURLAsset: 0x281a8f9c0, URL = file:///var/containers/Bundle/Application/6E4AFF9A-7276-4C59-B6F8-6E9E81F91720/LingoDarwin.app/DarwinResources.bundle/coin.mp3>> with error: Error Domain=AVFoundationErrorDomain Code=-11819}
Detail
From the description information, the internal error is related to MediaService, 1 is AudioSession, and 2 is averror reset. There is a certain correlation
The investigation found that the high probability is that the occurrence of problem 2 causes the problem of 1. So question 2 needs to be checked and solved first
According to the feedback from 126185, the scene of averrormediaserviceswerereset is generally online resources, and the delay will recur in about 400ms. And Darwin reports all errors are local file resources
Media Server Reset
AVAudioSessionMediaServicesWereResetNotification
The media server provides audio and other multimedia functions through a shared server process. Although rare, the media server can be reset while your application is active. Register for the AVAudioSessionMediaServicesWereResetNotification notification to monitor the media server reset. After receiving the notification, your app needs to do the following:
Process isolated audio objects (such as players, recorders, converters, or audio queues) and create new objects
Reset any tracked internal audio state, including all attributes of AVAudioSession
When appropriate, use the setActive: error: method to reactivate the AVAudioSession instance