Events

useEventListener(eventName: string , callback: () ⇒ void)

// Usage:
useEventListener("event-name", () => {
	// Write your logic here
	console.log("event-name")
})
 
// Example:
useEventListener("lobby:joined", () => {
	// Write your logic here
	console.log("lobby:joined")
})

We provide a robust event system that allows you to listen for specific events and execute callback functions based on them. Below is a list of events available within the SDK:

Event NameDescription
app:initializedtriggers when the app is successfully initialized after calling @initialize() method
lobby:failedtriggers when @joinLobby() method fails,reason for failing can be found in @error
lobby:metadatatriggers when @joinLobby() method succeeds and presents you with the metadata of peers inside the room
app:cam-ontriggers when Camera has successfully loaded after calling @fetchVideoStream()
app:cam-offtriggers when Video Stream has successfully stopped after calling @stopVideoStream()
app:mic-ontriggers when Mic has successfully loaded after calling @fetchAudioStream()
app:mic-offtriggers when Audio Stream has successfully stopped after calling @stopAudioStream()
room:joinedtriggers when room is successfully joined after calling the @joinRoom() method
room:failedtriggers when @joinRoom() method fails, reason for failing can be found in @error
room:cam-produce-starttriggers when the user starts producing cam stream in the room
room:cam-produce-stoptriggers when the user stops producing cam stream in the room
room:mic-produce-starttriggers when the user starts producing mic stream in the room
room:mic-produce-stoptriggers when the user stops producing mic stream in the room
room:me-role-updatetriggers when the current user role is updated in the room
room:me-name-updatetriggers when the current user name is updated in the room
room:me-lefttriggers when the current user leaves the room
room:peer-joinedtriggers when a new participant joins the room, the @peerIds[] array gets updated when this happens
room:peer-lefttriggers when a participant leaves the room, the @peerIds[] array gets updated when this happens
room:peer-produce-starttriggers when peer in the room starts producing mic or cam stream
room:peer-produce-stoptriggers when peer in the room stops producing mic or cam stream
room:peer-role-updatetriggers when peer's role is updated in the room
room:peer-name-updatetriggers when peer's name is updated in the room
room:peer-kickedtriggers when peer is kicked out from the room
room:peer-avatar-updatetriggers when peer updates it's avatar in the room
room:data-receivedtrigger when data is received from peer in the room, @data will contain the data received
room:recording-startedtriggers when a recording has started in the room, @inProgress will turn to true
room:recording-stoppedtriggers when a recording has stopped in the room, @inProgress will turn to false
room:recording-datatriggers when a recording has stopped and the data is available, this event will return the recording data
room:livestream-startedtriggers when a livestream has started in the room, @inProgress will turn to true
room:livestream-stoppedtriggers when the livestream has started in the room, @inProgress will turn to false

App states

The following are the four app states that your app can be in at any given point:

  1. IDLE: The client has not been initialized yet, so no methods can be invoked at this stage.
  2. INIT: The client has been initialized and is ready for you to invoke the joinLobby() method.
  3. LOBBY: The user has joined the lobby and is ready to join a room or perform other lobby-related actions.
  4. ROOM: The user has entered the meeting room and is ready has access to meeting-room controls.
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.