Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In iOS 15, 'throwing -10878' occurs many times when connecting AVAudioPlayerNode to mainMixerNode

I encountered a problem when executing the following code on iOS 15. This occurs on both a simulator and a real device. In addition, this doesn't occur on iOS 14.

import AVFoundation

class MyAudio {
    let audioEngine: AVAudioEngine
    let audioFile: AVAudioFile
    let playerNode: AVAudioPlayerNode

    init() {
        audioFile = try! AVAudioFile(forReading: Bundle.main.url(forResource: "sound", withExtension: "mp3")!)
        audioEngine = AVAudioEngine()
        playerNode = AVAudioPlayerNode()
        audioEngine.attach(playerNode)
        audioEngine.connect(playerNode, to: audioEngine.mainMixerNode, format: audioFile.processingFormat)

        do {
            try audioEngine.start()
            playerNode.play()
        } catch {
            print(error.localizedDescription)
        }
    }
}

It will print these outputs.

2021-10-02 17:29:14.534934+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.537588+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.537895+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.538194+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.538512+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.538822+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.539127+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.539434+0900 audio-sample-2021-10-02[11337:353838] throwing -10878
2021-10-02 17:29:14.539789+0900 audio-sample-2021-10-02[11337:353838] throwing -10878

Although these errors occur, the sounds can be played without any crashes. However, it consumes a lot of time for initializing than usual. Is there any way for resolving this problem?

like image 560
semisagi Avatar asked Oct 02 '21 07:10

semisagi


People also ask

What are the most common iOS 15 issues?

Another issue that has seemingly haunted many iOS 15 users is the random app crashing problem. While some apps tend to crash out right after the launch, others crash while in use. From what I can tell based on my experience, this issue can be sorted out by simply updating the apps.

Why is iOS 15 so buggy?

While it’s usual to expect unexpected issues in a new software update, very few had imagined that iOS 15 would be so buggy after rigorous beta testing. Certainly not to this magnitude! Alarmed by several persistent issues, Apple had to rush with a minor update mostly focused on bug fixes. Still, problems are far from over.

Why can’t I see the iOS 15 update on my Device?

If you don’t see the iOS 15 or iPadOS 15 update at all, it may be because the device does not have internet service, or because the device is not compatible with iOS 15 or iPadOS 15. Be sure to check iOS 15 compatibility and iPadOS 15 compatibility to make sure your device can run the new system software. 3.

Why do my apps keep crashing on iOS 15?

App Crashing Issue in iOS 15 Another issue that has seemingly haunted many iOS 15 users is the random app crashing problem. While some apps tend to crash out right after the launch, others crash while in use. From what I can tell based on my experience, this issue can be sorted out by simply updating the apps.


1 Answers

To fix this issue change to:

audioEngine.connect(playerNode, to: audioEngine.outputNode, format: audioFile.processingFormat)
like image 143
Vitaliy69 Avatar answered Oct 10 '22 09:10

Vitaliy69