Good morning,
I am writing an iMessage Extension which uses a capture session. I am displaying images from camera in the extension through didOutputSampleBuffer. I am using a custom view that is Metal backed to display the images.
The sample buffers all come with the same orientation, whatever the phone orientation.
In the main application, I use the [UIApplication sharedApplication].statusBarOrientation to correct the image orientation and display it correctly.
However, in the Extension, sharedApplication is not available.
How can I correct the orientation of the sample buffer depending on the phone orientation in the iMessage Extension?
I have made a hack using the gyroscope, but I'd rather find another solution. Could AVCaptureVideoDataOutput automatically adjust the orientation? Or the orientation to be passed in the sample buffer metadata?
Also, in the extension, I am only getting UIDevieOrientationUnknown through [UIDevice currentDevice].orientation.
Thank you.