Coder Social home page Coder Social logo

gatteo / react-jitsi Goto Github PK

View Code? Open in Web Editor NEW
108.0 5.0 39.0 1.7 MB

React and Typescript component to include Jitsi Meet with ease

License: MIT License

JavaScript 1.93% TypeScript 88.85% HTML 1.51% CSS 7.70%
jitsi-meet jitsi-typescript react-jitsi jitsi-react react typescript conference video-conferencing jitsi

react-jitsi's Introduction

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.

react-jitsi's People

Contributors

coreyladovsky avatar dependabot[bot] avatar gatteo avatar n3ztho avatar ndrkltsk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-jitsi's Issues

Failed to execute 'observe' on 'PressureObserver'

When launching with default domain (meet.jit.si), I received the following error in the browser console. It did not happen before (months ago). Just wonder if any one else has encountered this. Thanks!

[features/base/app] CPU pressure observer failed to start DOMException: Failed to execute 'observe' on 'PressureObserver': Access to the feature "compute pressure" is disallowed by permissions policy.
    at https://web-cdn.jitsi.net/meetjitsi_7542.4367/libs/app.bundle.min.js?v=7542.4367:85:316491
    ...
    at https://web-cdn.jitsi.net/meetjitsi_7542.4367/libs/app.bundle.min.js?v=7542.4367:85:267711
    at Object.dispatch (https://web-cdn.jitsi.net/meetjitsi_7542.4367/libs/app.bundle.min.js?v=7542.4367:85:161048)
    at APP.componentDidMount (https://web-cdn.jitsi.net/meetjitsi_7542.4367/libs/app.bundle.min.js?v=7542.4367:85:265986)
    at async APP.componentDidMount (https://web-cdn.jitsi.net/meetjitsi_7542.4367/libs/app.bundle.min.js?v=7542.4367:85:267135)

Component not working on mobile browser

Here is my Jisti component

                  <Jitsi
                    containerStyle={{
                      display: "flex",
                      alignItems: "center",
                      justifyContent: "center",
                      width: "100%",
                    }}
                    domain="meet.jit.si"
                    roomName={props.roomName}
                    displayName={"Conference connect"}
                    loadingComponent={videoCallPreloader}
                    interfaceConfig={{
                      HIDE_INVITE_MORE_HEADER: true,
                      TOOLBAR_BUTTONS: [
                        "microphone",
                        "camera",
                        "closedcaptions",
                        "desktop",
                        "fullscreen",
                        "hangup",
                        "chat",
                      ],
                      SHOW_PROMOTIONAL_CLOSE_PAGE: false,
                    }}
                    interfaceConfigOverwrite={{
                      MOBILE_APP_PROMO: false,
                    }}
                    configOverwrite={{
                      disableDeepLinking: true,
                    }}
                  />

Even after config overwrite, component is not working on mobile browser .

startRecording external api not working

@gatteo Start recording button in toolbar starts the recording but when I am trying to startRecording using the external api its not working.

Can you please help.

api.executeCommand('startRecording', { mode: 'file' });

Where are the phone numbers being generated in jitsi-meet

Hello there,
I’ve installed "react-jitsi" npm package in my react application and I want to know "where are the phone numbers being generated from and who is paying for the cost of those numbers?"
Would you please provide me above detail it is very helpful to me and also please tell if “phone numbers being generated” then how can I do with "react-jitsi" npm package
Looking forward to your replay
Thanks

Required fields for interface options

Is there a reason that the following fields are required?

TOOLBAR_BUTTONS: (

SETTINGS_SECTIONS: ('devices' | 'language' | 'moderator' | 'profile' | 'calendar')[];

BRAND_WATERMARK_LINK: '';

OPTIMAL_BROWSERS: ('chrome' | 'chromium' | 'edge' | 'electron' | 'firefox' | 'nwjs' | 'opera' | 'safari')[];

UNSUPPORTED_BROWSERS: ('chrome' | 'chromium' | 'edge' | 'electron' | 'firefox' | 'nwjs' | 'opera' | 'safari')[];

ENFORCE_NOTIFICATION_AUTO_DISMISS_TIMEOUT: 15000;

If I try and use the interfaceConfig prop the compiler will error saying that the above types are missing. All the types in this interface should probably be optional so that you can override only what you want to.

Thanks!

interfaceConfig not working

Hi,

I am setting both SHOW_PROMOTIONAL_CLOSE_PAGE and SHOW_JITSI_WATERMARK to false, in interfaceConfig but nothing is happening.

Am I missing something or there is some issue.

cannot start mic/webcam

hi there, I followed along with the instructions where I basically copy-pasted the component, but for some reason the microphone, webcam don't work at all and when I toggle the icons it throws this error
image

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

const App = () => {

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

  return (
    onCall ? (
      <div className='main'>
        <Jitsi
          roomName={roomName}
          displayName={displayName}
          password={password}
          // loadingComponent={Loader}
          containerStyle={{
            width: '100%',
            height: '100vh',
            display: 'flex',
            alignItems: 'center',
            justifyContent: 'center'
          }}
        />
      </div>)
      : (
        <>
          <h1>Crate a Meeting</h1>
          <input type='text' placeholder='Your name' value={displayName} onChange={e => setDisplayName(e.target.value)} />
          <input type='text' placeholder='Password' value={password} onChange={e => setPassword(e.target.value)} />
          <input type='text' placeholder='Room name' value={roomName} onChange={e => setRoomName(e.target.value)} />
          <button onClick={() => setOnCall(true)}> Let&apos;s start!</button>
        </>

      ));

}
export default App;

also, do I need to host my own server?

Watermark Issue

I was successfully hiding the watermark by configuring the SHOW_JITSI_WATERMARK: false and SHOW_WATERMARK_FOR_GUESTS: false in the interfaceConfig attribute. However, the watermark shows again these days without any configuration changed.

Wondering if anyone can advise the next step.

Thanks.

Lock failed on jitsi-call

Hello there

Whenever I use <Jitsi password={"Test@1234"} /> and also I've tried
<Jitsi onAPILoad={handleAPI} />

const handleAPI = (JitsiMeetAPI) => {
setTimeout(() => {
JitsiMeetAPI.executeCommand('password', 'Test@1234');
}, 1000);
}

I’ve setup jitsi-meet using docker container on my self hosted domain, it gives an error saying lock failed, while if I change the domain to meet.jit.si is works perfectly.

My displayName set successfully but the password is not set, it throws the following error
please-check-jitsi-meet-lock-error-image
After dismissing this error jitsi says the "moderator rights granted to AjayB" message and I’m already the first moderator and participant in this call.
Please help to find some solution to this issue, it will replay helpful to me and other developers also

I've already posted the same error in community.jitsi.org and the link is below
https://community.jitsi.org/t/lock-failed-on-jitsimeetexternalapi/32060/8
Thanks

CONFERENCE FAILED: conference.authenticationRequired

throwing this error, i didn't find solution
<Jitsi
roomName={roomName}
displayName={displayName}
password={password}
config={{ startWithAudioMuted: true, startWithVideoMuted: true }}
interfaceConfig={{ filmStripOnly: false }}
containerStyle={{ width: '100%', height: '100%' }}
onAPILoad={handleAPI}
domain={process.env.REACT_APP_JITSI_SERVER}
/>
i m using react-jitsi library

how to enable cc ( closed captions )

here is my config =

              config={{
                prejoinPageEnabled: false,
                disableDeepLinking: true,
                transcribingEnabled: true
              }}

              interfaceConfig={{
                APP_NAME: 'Cotes Chat',
                DISABLE_TRANSCRIPTION_SUBTITLES: false,
                LANG_DETECTION: true,
                TOOLBAR_BUTTONS: ['microphone', 'camera', 'closedcaptions', 'desktop', 'fullscreen',
                'fodeviceselection', 'hangup', 'profile', 'info', 'chat', 'recording',
                'livestreaming', 'etherpad', 'sharedvideo', 'settings', 'raisehand',
                'videoquality', 'filmstrip', 'invite', 'feedback', 'stats', 'shortcuts',
                'tileview', 'videobackgroundblur', 'download', 'help', 'mute-everyone'],
                TOOLBAR_ALWAYS_VISIBLE: true
              }}

Youtube Share doesn't work for participants in Chrome

I'm researching this issue for my own implementation but it seems to affect yours as well.

The youtube iframe and the jitsi iframe are not playing nicely with security it seems.
The youtube video plays fine for the person that shares it, but it won't play for others if they are in Chrome.

Sometimes there is no error, but when there is, it is something similar to: Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://www.youtube.com') does not match the recipient window's origin ('https://meet.jit.si').

I'm in desperate need of a solution, so if I find one, I will share it with you. Cheers.

Promotional Page displaying even after setting SHOW_PROMOTIONAL_CLOSE_PAGE: false,

The promotional page of Jisti is shown after call ends even though I have set SHOW_PROMOTIONAL_CLOSE_PAGE: false, in the interfaceConfig.
Here is the code

                   <Jitsi
                    containerStyle={{
                      display: "flex",
                      alignItems: "center",
                      justifyContent: "center",
                      width: "100%",
                    }}
                    domain="meet.jit.si"
                    roomName={props.roomName}
                    displayName={"Conference connect"}
                    loadingComponent={videoCallPreloader}
                    onAPILoad={handleOnload}
                    interfaceConfig={{
                      HIDE_INVITE_MORE_HEADER: true,
                      TOOLBAR_BUTTONS: [
                        "microphone",
                        "camera",
                        "closedcaptions",
                        "desktop",
                        "fullscreen",
                        "hangup",
                        "chat",
                      ],
                      SHOW_PROMOTIONAL_CLOSE_PAGE: false,
                    }}
                    config={{
                      defaultLanguage: "es",
                      disableDeepLinking: true,
                      prejoinPageEnabled: false,
                    }}
                  />

Share Youtube video not working

When sharing a YouTube video using the "Share Youtube video" feature, users on Chrome (90% of our user base) are not seeing the video being played.

Jitsi Component gets stuck in Loading randomly

I noticed this happening when I was connecting to a chat using my own instance of Jitsi server.

It seems this component will wait infinitely on loading. Is it possible to add a timeout to attempt reload when it timesout for maybe 5 secs?

Or is there a way to detect when the connection is made so I can stop the timeout when loaded?

Testing react-jitsi example on Meteorjs 2.0

Thank you @gatteo for the great and useful library!

I am currently trying to integrate jitsi meet in a meteorjs app (build with blaze).
The first step is to successfully do a standalone test with the example code of react-jitsi.

I tried to test the react-jitsi example in meteorjs 2.0 without success. I followed the following steps:

  1. Download the sample code of react-jitsi
  2. Create meteorjs app with the command: meteor create react-jitsi
  3. install app dependencies in root directory of the app with the command: meteor npm install
  4. Start the app with te command: meteor (I get a error)
  5. The following error is displayed in the meteorjs console:
    Exception from task TypeError: _objectSpread is not a function
    I20210202-13:40:40.536(1)? at Function.Log. [as error] (packages/logging/logging.js:173:8)
    I20210202-13:40:40.536(1)? at packages/webapp/webapp_server.js:635:13
    I20210202-13:40:40.537(1)? at runWithEnvironment (packages/meteor.js:1286:24)
    I20210202-13:40:40.537(1)? at Object.task (packages/meteor.js:1299:14)
    I20210202-13:40:40.538(1)? at Meteor._SynchronousQueue.SQp._run (packages/meteor.js:917:16)
    I20210202-13:40:40.538(1)? at packages/meteor.js:894:12
    W20210202-13:40:40.543(1)? (STDERR) /home/user/.meteor/packages/meteor-tool/.2.0.0.4luyuf.eesr5++os.osx.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:313
    W20210202-13:40:40.544(1)? (STDERR) throw(ex);

My question: Please, do you have a idea on what is wrong?

countryNotSupported: "We do not support this destination yet."

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


 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}
        onAPILoad={JitsiMeetAPI => console.log('Good Morning everyone!')}
      />)
    : (
      <>
        <h1>Crate 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>
      </>
    )

}

export default App;

where to add country region my country is INDIA or any other country how to add like countryCode: nl

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.