Skip to content

Instantly share code, notes, and snippets.

@digitallysavvy
Last active July 15, 2019 21:25
Show Gist options
  • Save digitallysavvy/3dd5832dc0676f8962cf4f4e4b1be5cb to your computer and use it in GitHub Desktop.
Save digitallysavvy/3dd5832dc0676f8962cf4f4e4b1be5cb to your computer and use it in GitHub Desktop.
private void OnJoinChannelSuccess (string channelName, uint uid, int elapsed)
{
Debug.Log("Successfully joined channel: " + channelName + " with id: " + uid);
}
private void OnUserJoined (uint uid, int elapsed)
{
Debug.Log("New user has joined channel with id: " + uid);
// add remote stream to scene
// create game object
GameObject go = GameObject.CreatePrimitive(PrimitiveType.Plane);
go.name = uid.ToString();
// configure video surface
VideoSurface o = go.AddComponent<VideoSurface>();
o.SetForUser(uid);
o.mAdjustTransfrom += OnTransformDelegate;
o.SetEnable(true);
o.transform.Rotate(-90.0f, 0.0f, 0.0f);
float r = Random.Range(-5.0f, 5.0f);
o.transform.position = new Vector3(0f, r, 0f);
o.transform.localScale = new Vector3(0.5f, 0.5f, 1.0f);
mRemotePeer = uid;
}
private void OnUserOffline (uint uid, USER_OFFLINE_REASON reason)
{
Debug.Log("User with id: " + uid + " has left the channel");
// remove the game object from the scene
GameObject go = GameObject.Find(uid.ToString());
if(!ReferenceEquals(go, null))
{
Destroy(go);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment