I was able to resolve this issue.
The problem was related to the participant role in the Azure Communication Services (ACS) Rooms setup.
Initially, I was setting every participant’s role as Attendee
, even for the user who was supposed to share the screen. When I checked the call.role
, it was showing "Attendee"
— but that user was actually the admin of the meeting.
Here's the faulty part of the code:
`
import { RoomsClient } from '@azure/communication-rooms';
const roomsClient = new RoomsClient(getConnectionStringUrl());
export async function addParticipant(acsRoomId, userId) {
try {
const response = await roomsClient.addOrUpdateParticipants(acsRoomId, [
{
id: { communicationUserId: userId },
role: 'Attendee',
},
]);
console.log('Participant added as Attendee');
} catch (error) {
console.log('--error', error);
}
}
To fix it, I created a separate function for the admin user and set their role as Presenter
instead:
`
export async function addAdmin(acsRoomId, userId) {
try {
const response = await roomsClient.addOrUpdateParticipants(acsRoomId, [
{
id: { communicationUserId: userId },
role: 'Presenter',
},
]);
console.log('Participant added as Presenter');
} catch (error) {
console.log('--error', error);
}
}
After updating the role to Presenter
, screen sharing started working correctly using call.startScreenSharing()
.
If you're facing a similar CallingCommunicationError: Failed to start video, unknown error
when using startScreenSharing()
, make sure the user attempting to share their screen has the Presenter
role in the ACS room. The Attendee
role doesn't have permission to start screen sharing.
Hope this helps someone else facing the same issue! If anyone have some issue feel free to ask.