Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rc/3.0.1 #252

Merged
merged 12 commits into from
Aug 4, 2020
Prev Previous commit
Next Next commit
- fix multiple channel render bug
- remove `Types` from export, you can import enum or class by `import {} from 'react-native-agora'`
  • Loading branch information
LichKing-2234 committed Jul 30, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 6eec86f5da51eff544322e7f6733de5ad0302849
41 changes: 27 additions & 14 deletions RtcSurfaceView.swift
Original file line number Diff line number Diff line change
@@ -18,34 +18,47 @@ class RtcSurfaceView: UIView {
}()
private weak var channel: AgoraRtcChannel?

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

func setChannel(_ engine: AgoraRtcEngineKit, _ channel: AgoraRtcChannel?) {
func setData(_ engine: AgoraRtcEngineKit, _ channel: AgoraRtcChannel?, _ uid: Int) {
resetVideoCanvas(engine)

self.channel = channel
canvas.channelId = channel?.getId()
canvas.uid = UInt(uid)
setupVideoCanvas(engine)
}

private 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)
}
}

func setMirrorMode(_ engine: AgoraRtcEngineKit, _ mirrorMode: Int) {
canvas.mirrorMode = AgoraVideoMirrorMode(rawValue: UInt(mirrorMode))!
setupRenderMode(engine)
}

func setUid(_ engine: AgoraRtcEngineKit, _ uid: Int) {
canvas.uid = UInt(uid)

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)
}

func setMirrorMode(_ engine: AgoraRtcEngineKit, _ mirrorMode: Int) {
canvas.mirrorMode = AgoraVideoMirrorMode(rawValue: UInt(mirrorMode))!
setupRenderMode(engine)
}

private func setupRenderMode(_ engine: AgoraRtcEngineKit) {
if canvas.uid == 0 {