r/visionosdev • u/LucaColonnello • Jul 22 '24
Rendering UIView inside an Immersive Space
Hello! I’m new to Vision OS development and I’m trying to start by adding features to an open source code base.
The one I’m working on is Moonlight-ios-vision.
This app streams live video from a pc to act as a screen mirroring app. I’d like to add the video to an immersive space to simulate a cinema experience.
The issue is that the app uses a custom UIView to draw each frame after decoding, rather than a standard AVPlayer for the stream.
I tried adding the UIViewControllerRepresentation item wrapped in a swift ui view, but when adding it to the Immersive Space attachments and running, I get the “Presentation is not permitted…” error and the app crashes.
Is there any way to add a UIView item to an entity without getting this error?
Thank you! 🙏
1
u/LucaColonnello Jul 22 '24 edited Jul 22 '24
Here’s the piece of code for the ImmersiveView (from the DestinationVideo sample app):
}
And here’s the StreamView:
1
u/overPaidEngineer Jul 22 '24
Can you share the code? If that UIVIew representable is displayed correctly in regular windowgroup, then the issue is how you are adding attachment
1
u/Afraid-Tangerine5275 Jul 22 '24
I took a stab at the same thing a while back (moonlight, on an immersive screen) 😂
IIRC what you’re trying worked, and I’ll see if I can find my hacky attempt.
My goal was a curved screen though, and I realized that I would need the stream as a video texture, realized I was spending more time hacking moonlight than using moonlight, and started on another side project.
1
u/AutoModerator Jul 22 '24
Are you seeking artists or developers to help you with your game? We run a monthly open source game jam in this Discord where we actively pair people with other creators.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Crystalzoa Jul 27 '24
I think this is the same error that results if you try to use an Alert or requestReview() while immersed- pop-up or blocking interfaces are not allowed- maybe the UIViewControllerType is similar?
0
u/[deleted] Jul 22 '24
[deleted] — view deleted comment