'MEMixerChannel.cpp:1577 Spatialization not supported on this platform (err=-4)

I'm playing a sound in my watch only app, but every time the sound plays the debugger shows an error: "MEMixerChannel.cpp:1577 Spatialization not supported on this platform (err=-4)"

Anyone have an idea why ? Is it because I'm developing for WatchOS ?

The manager responsible for playing the sound:

import Foundation
import AVFoundation

final class SoundManager {
    
    var player: AVAudioPlayer?
    
    func playSound(name: String, volume: Float = 1.0) {
        if let url = Bundle.main.url(forResource: name, withExtension: "aif") {
            
            do {
                player = try AVAudioPlayer(contentsOf: url)
                player?.prepareToPlay()
                player?.setVolume(volume, fadeDuration: 0.5)
            } catch {
                print("Error getting the audio file: \(error.localizedDescription)")
            }
        }
        
        player?.play()
    }
}


Solution 1:[1]

It is because you are developing for Apple Watch.

If you look at the "Spatialization Algorithms" on the developer site you will see that WatchOS is not included in the "Availability" for any of the cases.

https://developer.apple.com/documentation/audiounit/audio_unit_properties/spatialization_algorithms

More detailed ways of playing audio allow you to remove that option but regular AVPlayer doesn't seem to have anything.

https://developer.apple.com/documentation/arkit/usdz_schemas_for_ar/actions_and_triggers/audioaction/auralmode

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 lorem ipsum