ReplayKit Video output doesn't handle interface orientation change/rotation

If we start recording using ReplayKit, either with live streaming, or old-fashioned video recording, if we rotate the screen during recording (and our ViewController handles the rotation and lays out properly), the outputted video is compressed to the wrong aspect ratio and doesn't black-bar or change shape.


Is this intentional? Is there any way to overcome it?

Replies

Hi g_pass,

I'm having the same issue here. Did you find a solution?

By chance, I was solving the same issue few days ago. As for "intentional" - I believe so. ReplayKit captures the screen, so it always gives us same frame containing all the screen pixels, no matter what device orientation is. I’d say that it handles interface rotation all right - animations arę captured, after all. What it does’t handle is device rotation. Come to think of it, this is actually correct. Because ReplayKit doesnt know final desired video resolution, it could be only adding black bars at expense of image quality (downsampling) or it could rotate image (in effect changing the resolution). So I think proper solution is to rotate the image on your own. Image buffers from ReplayKit have orientation property attached, and one can use that. As for rotation itself, it can be done using Accelerate framework as in my answer here: https://forums.developer.apple.com/thread/91960 Regards Michal