From 6b2483c331115d6b9a60548e0188eec5b168d916 Mon Sep 17 00:00:00 2001 From: Sergey Minakov Date: Thu, 8 Oct 2020 14:30:53 +0300 Subject: [PATCH] iOS: fix native video Fixed view not being displayed. Fixed view orientation change. --- platform/iphone/native_video_view.m | 6 ++++++ platform/iphone/view_controller.mm | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/platform/iphone/native_video_view.m b/platform/iphone/native_video_view.m index a4e9f209f082..1193946f2bb9 100644 --- a/platform/iphone/native_video_view.m +++ b/platform/iphone/native_video_view.m @@ -71,6 +71,12 @@ [self observeVideoAudio]; } +- (void)layoutSubviews { + [super layoutSubviews]; + + self.avPlayerLayer.frame = self.bounds; +} + - (void)observeVideoAudio { printf("******** adding observer for sound routing changes\n"); [[NSNotificationCenter defaultCenter] diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index fb25041779e6..67803a4a4356 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -208,8 +208,11 @@ } else { // Create autoresizing view for video playback. GodotNativeVideoView *videoView = [[GodotNativeVideoView alloc] initWithFrame:self.view.bounds]; - videoView.autoresizingMask = UIViewAutoresizingFlexibleWidth & UIViewAutoresizingFlexibleHeight; + videoView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self.view addSubview:videoView]; + + self.videoView = videoView; + return [self.videoView playVideoAtPath:filePath volume:videoVolume audio:audioTrack subtitle:subtitleTrack]; } }