Function joinRoomOnMediaSFU

Asynchronously joins a room on MediaSFU.

This function sends a POST request to the MediaSFU API to join an existing room. It validates the provided credentials and constructs the appropriate API endpoint, including support for the Community Edition via a custom localLink.

Throws an error if the request fails or if the provided credentials are invalid.

const response = await joinRoomOnMediaSFU({
payload: {
action: 'join',
meetingID: '123456',
userName: 'user123',
},
apiUserName: 'yourAPIUSERNAME',
apiKey: 'yourAPIKEY',
localLink: 'http://localhost:3000', // Optional for Community Edition
});

if (response.success) {
console.log('Joined room:', response.data);
} else {
console.error('Failed to join room:', response.data?.error);
}