Skip to content

Commit

Permalink
Merge branch 'master' into dev/3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
LichKing-2234 committed Dec 15, 2020
2 parents 3a55997 + c8845fe commit da3222a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
12 changes: 8 additions & 4 deletions 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 da3222a

Please sign in to comment.