Last active
August 17, 2020 03:04
-
-
Save cpv123/5ee56acb4d03f4324f16df72463e69e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JitsiView extends React.Component { | |
componentDidMount() { | |
this.initJitsi(); | |
} | |
componentWillUnmount() { | |
if (this.api) { | |
this.api.dispose(); | |
} | |
} | |
initiJitsi = () => { | |
const { roomConfig, userConfig } = this.props; | |
// Prepare config for the Jitsi Meet API | |
const options = { | |
roomName: roomConfig.name, | |
parentNode: document.querySelector('#jitsi-mount'), | |
}; | |
if (!window.JitsiMeetExternalAPI) { | |
global.error('JitsiMeetExternalAPI not found'); | |
return; | |
} | |
this.api = new window.JitsiMeetExternalAPI(JITSI_DOMAIN, options); | |
this.api.addEventListener('videoConferenceJoined', () => { | |
// Give the user a display name that other participants will see | |
// and give the conference a subject for all to see | |
this.api.executeCommands({ | |
displayName: userConfig.displayName, | |
subject: roomConfig.subject, | |
}); | |
}); | |
this.api.addEventListener('videoConferenceLeft', () => { ... }); | |
}; | |
render() { | |
return ( | |
<JitsiViewWrapper> | |
<div id="jitsi-mount" /> | |
</JitsiViewWrapper> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment