Skip to content

Instantly share code, notes, and snippets.

@icywind
Created April 3, 2020 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icywind/8b0013554bdd535df322018dba7aa6c7 to your computer and use it in GitHub Desktop.
Save icywind/8b0013554bdd535df322018dba7aa6c7 to your computer and use it in GitHub Desktop.
Joining a channel in AR Client
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