Skip to content

Commit

Permalink
Merge commit 'c8845fe04c1596fe2e7242302bf160bc671910cb' into rc/3.1.+
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Dec 15, 2020
2 parents 15038c3 + c8845fe commit 458c051
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions ios/RCTAgora/Base/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
12 changes: 8 additions & 4 deletions ios/RCTAgora/Base/RtcSurfaceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,40 @@ class RtcSurfaceView: UIView {
}()
private weak var channel: AgoraRtcChannel?

func destroy() {
canvas.view = nil
}

func setData(_ engine: AgoraRtcEngineKit, _ channel: AgoraRtcChannel?, _ uid: Int) {
self.channel = channel
canvas.channelId = channel?.getId()
canvas.uid = UInt(uid)
setupVideoCanvas(engine)
}

func resetVideoCanvas(_ engine: AgoraRtcEngineKit) {
let canvas = AgoraRtcVideoCanvas()
canvas.view = nil
canvas.renderMode = self.canvas.renderMode
canvas.channelId = self.canvas.channelId
canvas.uid = self.canvas.uid
canvas.mirrorMode = self.canvas.mirrorMode

if canvas.uid == 0 {
engine.setupLocalVideo(canvas)
} else {
engine.setupRemoteVideo(canvas)
}
}

private func setupVideoCanvas(_ engine: AgoraRtcEngineKit) {
if canvas.uid == 0 {
engine.setupLocalVideo(canvas)
} else {
engine.setupRemoteVideo(canvas)
}
}

func setRenderMode(_ engine: AgoraRtcEngineKit, _ renderMode: Int) {
canvas.renderMode = AgoraVideoRenderMode(rawValue: UInt(renderMode))!
setupRenderMode(engine)
Expand Down

0 comments on commit 458c051

Please sign in to comment.