Created
April 3, 2020 18:14
-
-
Save icywind/8b0013554bdd535df322018dba7aa6c7 to your computer and use it in GitHub Desktop.
Joining a channel in AR Client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void join(string channel) | |
{ | |
Debug.Log("calling join (channel = " + channel + ")"); | |
if (mRtcEngine == null) | |
return; | |
// set callbacks (optional) | |
mRtcEngine.OnJoinChannelSuccess = onJoinChannelSuccess; | |
mRtcEngine.OnUserJoined = onUserJoined; | |
mRtcEngine.OnUserOffline = onUserOffline; | |
// enable video | |
mRtcEngine.EnableVideo(); | |
// allow camera output callback | |
mRtcEngine.EnableVideoObserver(); | |
//mRtcEngine.EnableLocalVideo(false); | |
CameraCapturerConfiguration config = new CameraCapturerConfiguration(); | |
config.preference = CAPTURER_OUTPUT_PREFERENCE.CAPTURER_OUTPUT_PREFERENCE_AUTO; | |
config.cameraDirection = CAMERA_DIRECTION.CAMERA_REAR; | |
mRtcEngine.SetCameraCapturerConfiguration(config); | |
mRtcEngine.SetExternalVideoSource(true, false); | |
// join channel | |
mRtcEngine.JoinChannel(channel, null, 0); | |
// Optional: if a data stream is required, here is a good place to create it | |
int streamID = mRtcEngine.CreateDataStream(true, true); | |
Debug.Log("initializeEngine done, data stream id = " + streamID); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment