Get Swift4 SCNScene 30 snapshots per second and draw them smoothly on external screen in UIImageView

198 views Asked by At

I have one little problem, maybe wrong approach. I created an ipad app (swift4) with SCNView, it works great, all transformations, lights, gestures... But I would like to display this scene on an external screen, connected by air play, not just to duplicate what i see on ipad. The SCNView is in UIView with another ui elements, that i don't want to display on external screen. How to get it work with smooth transformations on both screens? I have tried to clone scene nodes, but it did't work (maybe wrong code), another solution was to create new SCNView and load new scene, but then i don't know how to detect gestures to get the same transformations as on the main ipad display, and i think it costs more gpu calculations. Last solution was to snapshot the view and on an external screen display just the image, but again, i don't know how to listen to gestures or camera movements and make it smooth. Do you have few minutes to write me an example with the solution? With proper way, listeners on SCNView or different approach? I will be very grateful to you!

2

There are 2 answers

0
Juan Pedro Lozano On

I may don't have the solution but I think is very possible to setup Airplay just for stream what you want, hidding UI elements.

Duplication or buffering frames to video seems such expensive approach but not that crazy... just check how ARKit does it.

0
Heisenbug On

If you don't want to use AirPlay you may try ReplayKit. It allows you to stream your screen content and you can create TV app that will display it.