Avatar SDK

Avatar SDK in 3D

Join Room

Join room with following data

// User's model
const user = {
  id: userData.id,
  photoUrl: userData.photoUrl,
  bodyImageUrl: userData.bodyImageUrl,
  animations: userData.animations,
  type: UserType[userData.type as keyof typeof UserType], // userData.type is string
  name: userData.name,
  video: false,
  audio: false 
}

// sdk root contentWindows
viewer.users.setUser(user)

PhotoUrl: user's profile image

BodyImageUrl: user's body image

animations: animation list files, which is dictionary

type: host, participant, audience, which is string

video, audio: user's default enable microphone or video

Set Media Input

User enable or disable the video and microphone

// Those are toggle functions
viewer.users.enableMicrophone()
viewer.users.enableVideo()

CUID room users

Please count audience and participants to get room number

Member count = audience number + participants number

// MemberJoin 
case ViewerSdkCmd.memberjoin:
  audiencesStore.addUser(body); // body is user model, included id
  participantsStore.addUser(body);
  break;

Update room's users video or microphone states, however state about "user is speaking now TBD.

// MemberUpdated
case ViewerSdkCmd.memberupdated:
  audiencesStore.updateUser(body); // body is user model, included id
  participantsStore.updateUser(body);
  break;

Remove user from store by user's id

// MemberLeave
case ViewerSdkCmd.memberleave:
  const memberId = body['memberId'];
  audiencesStore.removeUser(memberId); 
  participantsStore.removeUser(memberId);
  break;

Update user own avatar in 3D

User avatar first mode or third mode switch

// This is toggle function
viewer.users.enableAvatarMode()

User control and play avatar's animation

// This is toggle function
viewer.users.setAvatarAnimation({
  'id': id,
  'animation': animationName
})

User Sync, and follow

  1. Send Invite Sync requests

  2. Follow User

  3. UnFollow User

Last updated