jitsi-roomsv2/frontend/src/components/jitsi/JitsiEntrypoint.tsx

57 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-04-10 23:28:28 +02:00
import { JitsiMeeting } from '@jitsi/react-sdk'
import { JITSI_DOMAIN } from '../../background/constants'
import { UserInfo } from './types'
import curry from 'just-curry-it'
2023-02-07 20:31:07 +01:00
import {
2023-04-10 23:28:28 +02:00
ConferenceData,
displayNameChangeListener,
displayNameChangeListenerWrapper,
videoConferenceJoinedListener,
} from '../../background/jitsi/eventListeners'
import useJitsiEventCapture from '../../hooks/useJitsiEventCapture'
2023-01-07 19:06:04 +01:00
2023-01-10 19:00:20 +01:00
interface Props {
2023-04-10 23:28:28 +02:00
roomName: string
userInfo: UserInfo
conferenceData: ConferenceData | undefined
setConferenceData: (newData: ConferenceData) => void
2023-01-10 19:00:20 +01:00
}
2023-04-10 23:28:28 +02:00
function JitsiEntrypoint({ roomName, userInfo, conferenceData, setConferenceData }: Props) {
const { setDisplayNameChangeEvent } = useJitsiEventCapture(
curry(displayNameChangeListener)(conferenceData)(setConferenceData)
)
2023-02-12 15:28:53 +01:00
2023-04-10 23:28:28 +02:00
return (
<JitsiMeeting
domain={JITSI_DOMAIN}
roomName={roomName}
configOverwrite={{
2023-05-09 19:26:38 +02:00
startWithAudioMuted: false,
2023-04-10 23:28:28 +02:00
disableModeratorIndicator: true,
startScreenSharing: true,
enableEmailInStats: false,
prejoinConfig: { enabled: false },
}}
interfaceConfigOverwrite={{}}
userInfo={userInfo}
onApiReady={(externalApi) => {
externalApi.addEventListener(
'videoConferenceJoined',
curry(videoConferenceJoinedListener)(setConferenceData)
)
externalApi.addEventListener(
'displayNameChange',
curry(displayNameChangeListenerWrapper)(setDisplayNameChangeEvent)
)
}}
getIFrameRef={(iframeRef) => {
iframeRef.style.height = '100%'
iframeRef.style.width = '100%'
}}
/>
)
2023-01-07 19:06:04 +01:00
}
2023-04-10 23:28:28 +02:00
export default JitsiEntrypoint