Skip to main content

useRoom

Create or connect to a new conference.

/src/App.js
import { useRoom, useRoomState, useLocalTracks } from 'react-jitsi-hooks'
const App = () => {
// Connect to the conference
useRoom({ roomName: 'helloworld' });
// Consume room state.
const { connectionState } = useRoomState()
return <div>
{connectionState === 'connected'
? 'you are on room helloworld'
: 'not connected'
}
</div>;
}

Parameters#

(required)ย roomName:string#

The conference room name. All participants using the same roomName will meet together

(optional) initOptions?:Record#

Options passed to JitsiMeetJS.init.

  • useIPv6:boolean
  • disableAudioLevels:boolean โ€“ Enables/disables audio levels. default: true
  • disableSimulcast:boolean โ€“ Enables/disables simulcast.
  • enableWindowOnErrorHandler?:boolean โ€“ Enables/disables attaching global onerror handler (window.onerror). default: false
  • disableThirdPartyRequests:boolean - Disables third parties and the callstats API won't be included.
  • enableAnalyticsLogging:boolean โ€“ Enables/disables analytics logging. default: false
  • externalStorage:Storage โ€“ Specified how to store data. default: localStorage functions
  • callStatsCustomScriptUrl?:string - Custom url to access callstats client script
  • disableRtx?:boolean โ€“ Enables/disable the use of RTX. default: false
  • disabledCodec:string - Mime type of the code that should not be negotiated on the peerconnection.
  • preferredCodec:string - Mime type of the codec that needs to be made the preferred codec for the connection.
  • useTurnUdp?:boolean โ€“ Enables use of turn over udp for jvb. It is disabled because not very useful (if the client can use udp, it likely can connect to jvb directly over udp too; but it can be useful to still enable udp turn when an udp turn is known to be whitelisted on a network)

(optional) connectionOptions?:Record#

Options passed to JitsiMeetJS.JitsiConnection#constructor

(optional) roomOptions?:Record#

Options passed to JitsiMeetJS.JitsiConnection#initJitsiConference.