I'm streaming an online or localy downloaded mp4 video via AVPlayer component. Some mp4 files have wrong orientation, but EXIF metadata says how video should be rotated when played. However, AVPlayer doesn't seem to respect that.
Is there any way to make AVPlayer respect EXIF metadata and rotate video accordingly.
[asset.tracks[0] preferredTransform]
gives transform on how video should be rotated, but if applied to UIView or CALayer then it's still not properly rotated.
On the other hand, Android and web client play same videos correctly meaning that there's nothing wrong with video files.
AVPlayer already respects EXIF metadata when playing video. It was video file that was 'broken'. It was already in proper rotation but EXIF-Rotation metadata had wrong value, thus causing AVPlayer to play video in wrong orientation for user.
Later, I find out that thsoe Android players which DO respect EXIF-Metadata, also play video in wrong orientation. And the web client's video player doesn't take EXIF metadata into account so it played video in proper orientation for the user.