summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Minakov <naithar@icloud.com>2020-10-08 14:30:53 +0300
committerSergey Minakov <naithar@icloud.com>2020-10-08 14:30:53 +0300
commit6b2483c331115d6b9a60548e0188eec5b168d916 (patch)
treedf129c4b81a5b35eeb4b25a4a25a78a2778ce7c2
parent8be6db951d8f46197160a9e86868a729f74fc36f (diff)
iOS: fix native video
Fixed view not being displayed. Fixed view orientation change.
-rw-r--r--platform/iphone/native_video_view.m6
-rw-r--r--platform/iphone/view_controller.mm5
2 files changed, 10 insertions, 1 deletions
diff --git a/platform/iphone/native_video_view.m b/platform/iphone/native_video_view.m
index a4e9f209f0..1193946f2b 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 fb25041779..67803a4a43 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];
}
}