Skip to content

Latest commit

 

History

History
186 lines (137 loc) · 8.68 KB

README.md

File metadata and controls

186 lines (137 loc) · 8.68 KB

Jitsi Meet React Component

license built with typescript

An unofficial React component which wraps the standard Jitsi Meet JS API. It is written in Typescript to help you configure the library with ease, and get your super important meetings up and going, in a blink of an eye🌪.

Install

npm install react-jitsi --save

Usage

Basic

The easiest way for you to create a meeting is by simply including the React Jitsi component in your app.

import React, { useState } from 'react'
import Jitsi from 'react-jitsi'

export const App = () => (
  <>
    <h2>My First Meeting!</h2>
    <Jitsi />
  </>
)

However, this is not recommended, as it will create and join a random room (ex. hp6y791054a), which is possibly not unique.

Basic, but better

We advise you to create a meeting specifying at least a room name (that you know is unique) and the user's display name.

import React, { useState } from 'react'
import Jitsi from 'react-jitsi'

const roomName = 'my-super-secret-meeting-123e4567-e89b-12d3-a456-426655440000'
const userFullName = 'Joseph Strawberry'

export const App = () => (
  <>
    <h2>My First Meeting!</h2>
    <Jitsi roomName={roomName} displayName={userFullName} />
  </>
)

A more complete example

import React, { useState } from 'react'
import Jitsi from 'react-jitsi'
import Loader from './components/Loader'

export const App = () => {

  const [displayName, setDisplayName] = useState('')
  const [roomName, setRoomName] = useState('')
  const [password, setPassword] = useState('')
  const [onCall, setOnCall] = useState(false)

  return onCall
    ? (
      <Jitsi
        roomName={roomName}
        displayName={displayName}
        password={password}
        loadingComponent={Loader}
        onAPILoad={JitsiMeetAPI => console.log('Good Morning everyone!')}
      />)
    : (
      <>
        <h1>Create a Meeting</h1>
        <input type='text' placeholder='Room name' value={roomName} onChange={e => setRoomName(e.target.value)} />
        <input type='text' placeholder='Your name' value={displayName} onChange={e => setDisplayName(e.target.value)} />
        <button onClick={() => setOnCall(true)}> Let&apos;s start!</button>
      </>
    )

}

Custom styles

The Jitsi Meet conference iframe is wrapped by two containers

<div id='react-jitsi-container' style={...}>
  <Loader/>
  <div id='react-jitsi-frame' style={...}>
    <iframe>
  </div>
</div>

You can specify custom styles for each container in two ways:

  • Using CSS, through the #react-jitsi-container and #react-jitsi-frame selectors
  • Using inline styling, through the containerStyle and frameStyle props

For example

<Jitsi containerStyle={{ width: '1200px', height: '800px' }}>

Conference Configuration

Configuration over both the conference core settings (such as startAudioOnly option) and the interface settings (such as filmStripOnly option) can be passed through the config and interfaceConfig props.

For example

<Jitsi
  config={{ startAudioOnly: true }}
  interfaceConfig={{ filmStripOnly: true }}>

Available props

Prop Required Description Default
containerStyle no Object containing main container styles (see above for details) { width:'800px', height: '400px' }
frameStyle no Object containing frame container styles (see above for details) { display: loading?'none' : 'block',width: '100%',height: '100% }'
loadingComponent no Component shown until the Jitsi Meet video conference is not started <div>Loading meeting...</div>
onAPILoad no Callback function invoked with Jitsi Meet API object when the library is loaded
onIframeLoad no Callback function invoked when the conference iframe is loaded
domain no Domain used to build the conference URL meet.jit.si
roomName no Name of the room to join A random string
password no Password to set for the meeting room
displayName no Participant's name
config no Overrides for the default meeting settings
interfaceConfig no Overrides for default meeting interface options
noSSL no Boolean indicating if the server should be contacted using HTTP or HTTPS true
jwt no JWT token to pass to the domain
devices no A map containing information about the initial devices that will be used in the call.
userInfo no Object containing information about the participant opening the meeting

Controlling the Conference

The Jitsi Meet API exposes several methods which allow great control over the conference. Such methods can be accessed through the api object passed as an argument to the callback specified in the onAPILoad prop.

For example, to retrieve the device list:

import React, { useState } from 'react'
import Jitsi from 'react-jitsi'

const handleAPI = (JitsiMeetAPI) => {
  JitsiMeetAPI.executeCommand('toggleVideo')
}

export const App = () => (
  <>
    <h2>My First Meeting!</h2>
    <Jitsi onAPILoad={handleAPI} password={password} />
  </>
)

Contributing

We love contributions from everyone. If you have any bug to report, open an issue. If want to submit a fix, or any kind of improvement, create a pull request here on Github.

Organizations and projects using this component


Dascuola.it


Westudents.it

If you are using this component in your organization/project and would like to be shown in the above list, send us an email!


MIT License.