I’m using the UIIMagePickerController for video capture but after the capture I publish it on our servers and it turns out that the video is not properly oriented. But this problem only occurs when the user take’s video in Portrait mode in LandScape Mode everything is simply fine.
Is there any way in which I can detect in which mode video was captured and How can i rotate the video before publish so that everything works fine.
Well, you can query the
UIDevicefor@property UIDeviceOrientation orientation, and let the server know if the video was captured in landscape or portrait.You can use one of the helpful UIDeviceOrientationIsLandscape macro to do this.
To query for current orientation, just do
but watch out: (from UIDevice documentation) The value of this property always returns 0 unless orientation notifications have been enabled by calling beginGeneratingDeviceOrientationNotifications.