Skip to main content

useRoomState

Use conference start. Usefull for:

  • Get incoming tracks from participants
  • Know the connection state
/src/App.js
import { useRoom, useRoomState } from 'react-jitsi-hooks'
const App = () => {
// Connect to the conference
useRoom({ roomName: 'helloworld' });
const { remoteTracks } = useRoomState();
return <div>
{remoteTracks && <div>{Object.keys(remoteTracks).length} participants</div>}
</div>;
}

Parameters#

No parameters.

Returns#

connection:JitsiMeetJS.JitsiConnection#

connectionState:string#

The state of the conference connection. Can be :

  • "connected": the conference is connected
  • "failure": the conference had trouble connecting
  • undefined: the conference connection is pending, or inactive (if useRoom was not called)

remoteTracks:Record<string, TrackRecord[]>#

A key-value pair where the key is the participant unique identifier, and the value the tracks they streams.

The streamed track is a TrackRecord:

  • _id:string โ€“ The device id.
  • jitsi:JitsiTrack โ€“ The jitsi track record. See JitsiTrack
  • type:string โ€“ "audio" or "video"
  • isMuted:boolean โ€“ if the track is muted. Same as .jitsi.isMuted() function.
  • isStopped:boolean โ€“ if the track is in a stopped state.