Const// Basic usage with UI
import React, { useState } from 'react';
import { PreJoinPage } from 'mediasfu-reactnative-expo';
import { connectSocket } from './sockets/SocketManager';
function App() {
const [socket, setSocket] = useState(null);
const [validated, setValidated] = useState(false);
const parameters = {
imgSrc: 'https://example.com/logo.png',
showAlert: ({ message, type }) => alert(message),
updateIsLoadingModalVisible: setLoading,
connectSocket: connectSocket,
updateSocket: setSocket,
updateValidated: setValidated,
updateApiUserName: setApiUserName,
updateApiToken: setApiToken,
updateLink: setLink,
updateRoomName: setRoomName,
updateMember: setMember,
};
const credentials = {
apiUserName: 'your-api-username',
apiKey: 'your-api-key',
};
if (validated) {
return <MeetingRoom socket={socket} />;
}
return (
<PreJoinPage
parameters={parameters}
credentials={credentials}
connectMediaSFU={true}
/>
);
}
// Headless mode - programmatic room creation
const headlessOptions = {
action: 'create',
capacity: 50,
duration: 60, // minutes
eventType: 'webinar',
userName: 'Host Name',
recordingParams: {
recordingVideoParticipantsFullRoomSupport: true,
recordingAllParticipantsSupport: false,
},
};
return (
<PreJoinPage
parameters={parameters}
credentials={credentials}
returnUI={false}
noUIPreJoinOptions={headlessOptions}
/>
);
PreJoinPage - Room creation/join interface with media preview
PreJoinPage is a React Native component that provides the entry point for creating new meeting rooms or joining existing ones. It offers two modes:
Key Features:
Room Configuration Options:
UI Customization: The PreJoinPage layout and styling are fixed but can be customized by creating a custom pre-join component and using it instead of this default one.