소스 검색

Merge pull request #42648 from naithar/fix/native_video_view

[iOS] Native video fixes
Rémi Verschelde 4 년 전
부모
커밋
4159baff6c
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

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

+ 4 - 1
platform/iphone/view_controller.mm

@@ -218,8 +218,11 @@
 	} else {
 	} else {
 		// Create autoresizing view for video playback.
 		// Create autoresizing view for video playback.
 		GodotNativeVideoView *videoView = [[GodotNativeVideoView alloc] initWithFrame:self.view.bounds];
 		GodotNativeVideoView *videoView = [[GodotNativeVideoView alloc] initWithFrame:self.view.bounds];
-		videoView.autoresizingMask = UIViewAutoresizingFlexibleWidth & UIViewAutoresizingFlexibleHeight;
+		videoView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
 		[self.view addSubview:videoView];
 		[self.view addSubview:videoView];
+
+		self.videoView = videoView;
+
 		return [self.videoView playVideoAtPath:filePath volume:videoVolume audio:audioTrack subtitle:subtitleTrack];
 		return [self.videoView playVideoAtPath:filePath volume:videoVolume audio:audioTrack subtitle:subtitleTrack];
 	}
 	}
 }
 }