浏览代码

iOS: fix native video

Fixed view not being displayed.
Fixed view orientation change.

(cherry picked from commit 6b2483c331115d6b9a60548e0188eec5b168d916)
Sergey Minakov 4 年之前
父节点
当前提交
067d015d38
共有 2 个文件被更改,包括 10 次插入1 次删除
  1. 6 0
      platform/iphone/native_video_view.m
  2. 4 1
      platform/iphone/view_controller.mm

+ 6 - 0
platform/iphone/native_video_view.m

@@ -72,6 +72,12 @@
 	[self observeVideoAudio];
 }
 
+- (void)layoutSubviews {
+	[super layoutSubviews];
+
+	self.avPlayerLayer.frame = self.bounds;
+}
+
 - (void)observeVideoAudio {
 	printf("******** adding observer for sound routing changes\n");
 	[[NSNotificationCenter defaultCenter]

+ 4 - 1
platform/iphone/view_controller.mm

@@ -209,8 +209,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];
 	}
 }