Skip to content

Commit

Permalink
Fix render mode for AgoraView
Browse files Browse the repository at this point in the history
this fix the issue that sometimes wrong render mode are set when the UI is changed
  • Loading branch information
leethree authored Apr 9, 2020
1 parent 2477455 commit 0cdb398
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions ios/RCTAgora/RCTAgoraVideoView.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ - (void)setRenderMode:(NSInteger)renderMode {

- (void)setShowLocalVideo:(BOOL)showLocalVideo {
_showLocalVideo = showLocalVideo;
AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
if (_showLocalVideo) {
AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
canvas.uid = [AgoraConst share].localUid;
canvas.view = self;
canvas.renderMode = _renderMode;
Expand All @@ -38,22 +38,23 @@ - (void)setShowLocalVideo:(BOOL)showLocalVideo {

-(void)setRemoteUid:(NSUInteger)remoteUid {
_remoteUid = remoteUid;
AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
if (_remoteUid != 0) {
AgoraRtcVideoCanvas *canvas = [[AgoraRtcVideoCanvas alloc] init];
canvas.uid = _remoteUid;
canvas.view = self;
canvas.renderMode = _renderMode;
[_rtcEngine setupRemoteVideo:canvas];
return;
}
}

-(void) willMoveToSuperview:(UIView *)newSuperview {
[super willMoveToSuperview:newSuperview];
if (_remoteUid > 0) {
[_rtcEngine setRemoteRenderMode:_remoteUid mode:_renderMode];
} else {
[_rtcEngine setLocalRenderMode:_renderMode];
-(void) didMoveToWindow {
[super didMoveToWindow];
if (self.window != nil) {
if (_remoteUid > 0) {
[_rtcEngine setRemoteRenderMode:_remoteUid mode:_renderMode];
} else {
[_rtcEngine setLocalRenderMode:_renderMode];
}
}
}

Expand Down

0 comments on commit 0cdb398

Please sign in to comment.