Unable to play .aivu with VideoPlayerComponent

I’m trying to play an Apple Immersive video in the .aivu format using VideoPlayerComponent using the official documentation found here: https://developer.apple.com/documentation/RealityKit/VideoPlayerComponent

Here is a simplified version of the code I'm running in another application:

import SwiftUI
import RealityKit
import AVFoundation

struct ImmersiveView: View {
    var body: some View {
        RealityView { content in
            let player = AVPlayer(url: Bundle.main.url(forResource: "Apple_Immersive_Video_Beach", withExtension: "aivu")!)
            let videoEntity = Entity()
            var videoPlayerComponent = VideoPlayerComponent(avPlayer: player)
            videoPlayerComponent.desiredImmersiveViewingMode = .full
            videoPlayerComponent.desiredViewingMode = .stereo
            player.play()
            videoEntity.components.set(videoPlayerComponent)
            content.add(videoEntity)
        }
    }
}

Full code is here: https://github.com/tomkrikorian/AIVU-VideoPlayerComponentIssueSample

But the video does not play in my project even though the file is correct (It can be played in Apple Immersive Video Utility) and I’m getting this error when the app crashes:

App VideoPlayer+Component Caption: onComponentDidUpdate Media Type is invalid
Domain=SpatialAudioServicesErrorDomain Code=2020631397 "xpc error" UserInfo={NSLocalizedDescription=xpc error}
CA_UISoundClient.cpp:436   Got error -4 attempting to SetIntendedSpatialAudioExperience
[0x101257490|InputElement #0|Initialize] Number of channels = 0 in AudioChannelLayout does not match number of channels = 2 in stream format.

Video I’m using is the official sample that can be found here but tried several different files shot from my clients and the same error are displayed so the issue is definitely not the files but on the RealityKit side of things: https://developer.apple.com/documentation/immersivemediasupport/authoring-apple-immersive-video

Steps to reproduce the issue: - Open AIVUPlayerSample project and run. Look at the logs.

  • All code can be found in ImmersiveView.swift
  • Sample file is included in the project

Expected results: If I followed the documentation and samples provided, I should see my video played in full immersive mode inside my ImmersiveSpace.

Am i doing something wrong in the code? I'm basically following the documentation here.

Feedback ticket: FB19971306

So it nows run on device for some reason (same code I posted) but this doesn't work at all in the simulator. It should be added to the documentation that it's not supported there.

And maybe a way to check for support on the current platform?

@tom_krikorian Thank you for filing the above feedback, and for sharing this additional clarifying context.

You can monitor status in Feedback Assistant. There, you can track if the report is still being investigated, has a potential identifiable fix, or has been resolved in another way.

For more details on when you'll see updates to your report, please see What to expect after submission.

Best, Steve

Is there any workaround to make it work in the simulator by any chance?

Unable to play .aivu with VideoPlayerComponent
 
 
Q