Skip to content

Instantly share code, notes, and snippets.

@icywind
Created August 20, 2020 00:56
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/d50528dc216eca75508c20833815e79a to your computer and use it in GitHub Desktop.
Save icywind/d50528dc216eca75508c20833815e79a to your computer and use it in GitHub Desktop.
void OnJoinChannelSuccessHandler(string channelName, uint uid, int elapsed)
{
// can add other logics here, for now just print to the log
Debug.LogFormat("Joined channel {0} successful, my uid = {1}", channelName, uid);
}
void OnLeaveChannelHandler(RtcStats stats)
{
myView.SetEnable(false);
if (remoteView != null)
{
remoteView.SetEnable(false);
}
}
void OnUserJoined(uint uid, int elapsed)
{
GameObject go = GameObject.Find("RemoteView");
if (remoteView == null)
{
remoteView = go.AddComponent<VideoSurface>();
}
remoteView.SetForUser(uid);
remoteView.SetEnable(true);
remoteView.SetVideoSurfaceType(AgoraVideoSurfaceType.RawImage);
remoteView.SetGameFps(30);
}
void OnUserOffline(uint uid, USER_OFFLINE_REASON reason)
{
remoteView.SetEnable(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment