Reputation: 1
I'm trying to automatically start the recording for the meeting as soon as the user joins.
@jitsi/react-native-sdk:^0.3.0
On my Web I was I am able to achieve this using the following code:
if (!recording) {
// if current user is not the first participant
jitsiAPI.stopRecording('file');
}
if (numParticipants === 1 && recording) {
// if current user is the first participant
jitsiAPI.startRecording({ mode: 'file' });
}
But on my React Native, I tried using the following to accomplish it but nothing worked out for me
jitsiMeeting.current.startRecording({ mode: 'file' });
This is the complete code
import React, { useCallback, useEffect, useRef } from 'react';
import { BackHandler } from 'react-native';
import { JitsiMeeting } from '@jitsi/react-native-sdk/index';
import config from "src/config";
import { useNavigation } from '@react-navigation/native';
const VideoCallFrame = ({ room, displayName = '', logVideoEvent, callEnded, consent }) => {
const jitsiMeeting = useRef(null);
const meetFeatureFlags = {
'add-people.enabled': false,
'calendar.enabled': false,
'call-integration.enabled': false,
'chat.enabled': false,
'close-captions.enabled': false,
'invite.enabled': false,
'android.screensharing.enabled': false,
'live-streaming.enabled': false,
'meeting-name.enabled': false,
'meeting-password.enabled': true,
'pip.enabled': true,
'kick-out.enabled': false,
'conference-timer.enabled': true,
'video-share.enabled': false,
'recording.enabled': true,
'reactions.enabled': false,
'raise-hand.enabled': true,
'tile-view.enabled': true,
'toolbox.alwaysVisible': true,
'toolbox.enabled': true,
'welcomepage.enabled': false,
};
const meetConfig = {
subject: 'Meeting Room',
};
const navigation = useNavigation();
useEffect(() => {
const backAction = () => {
jitsiMeeting.current.close();
callEnded();
navigation.navigate('mentorshipChat');
};
const backHandler = BackHandler.addEventListener(
"hardwareBackPress",
backAction
);
return () => backHandler.remove();
}, []);
const onConferenceLeft = useCallback(() => {
logVideoEvent(room.room, 'leave', '');
callEnded();
console.log("VideoCallFrame onConferenceTerminated");
}, []);
const onConferenceWillJoin = useCallback(() => {
console.log("VideoCallFrame onConferenceWillJoin");
/* Conference will join event */
}, []);
const onConferenceJoined = useCallback(() => {
console.log(`Debug Room Data: ${JSON.stringify(room)}`);
logVideoEvent(room.room, 'join', '');
console.log("VideoCallFrame onConferenceJoined");
// if (consent?.key === true) {
jitsiMeeting.current.executeCommand('startRecording', { mode: 'file' });
// }
}, []);
const onReadyToClose = useCallback(() => {
jitsiMeeting.current.close();
callEnded();
}, [navigation]);
const eventListeners = {
onReadyToClose,
onConferenceWillJoin,
onConferenceLeft,
onConferenceJoined,
};
return (
<JitsiMeeting
config={meetConfig}
eventListeners={eventListeners}
flags={meetFeatureFlags}
ref={jitsiMeeting}
style={{ flex: 1, height: '100%', width: '100%', backgroundColor: 'black' }}
room={room.room}
token={room?.token}
serverURL={config.VIDEO_SERVER_URL}
/>
);
};
export default VideoCallFrame;
I have a Jibri setup (the Jitsi server is self-hosted using jitsi-docker). Starting and stopping the recording manually works as expected. Any help to do this programmatically would be appreciated!
I tried using the following to accomplish it but it did nto worked out
jitsiMeeting.current.startRecording({ mode: 'file' });
Upvotes: 0
Views: 111