Play Audio on window change

I been playing around with VisionOS and currently trying to play with Audio, but somehow following the steps in wwdc isn't working for me.

what I'm trying to do is to play audio when you navigate to a certain view.

Currently in wwdc, they're doing this to programmatically set up audio

        let audioSource = Entity()

        audioSource.spatialAudio = SpatialAudioComponent(directivity: .beam(focus: 0.75))
        audioSource.orientation = .init(angle: .pi, axis: [0, 1 , 0])

        if let audio = try? await AudioFileResource(named: "audioFile",
                                                    configuration: .init(shouldLoop: true)) {

            
        }

But I'm getting these errors and cannot proceed

'AudioFileResource' cannot be constructed because it has no accessible initializers

I couldn't quite follow on how to do it from Reality Composer pro either.. therefore I'm stuck.

Any help is really appreciated.

Play Audio on window change
 
 
Q