1

I'm using Azure Communication Services (ACS) in a React app to implement video calling and screen sharing.

Calling and camera video functionality is working fine. But when I try to start screen sharing using call.startScreenSharing(), I get a CallingCommunicationError with code 500.

Here’s the relevant code:

const StartScreenShare = async () => {
  if (call) {
    console.log("Starting screen share attempt...", call);
    console.log("Call state:", call.state);
    console.log("Connection state:", callAgent);

    try {
      await call.startScreenSharing();
      console.log("Screen sharing started successfully");

    } catch (error) {
      console.error("Error starting screen sharing:", error);
      console.error("Screen sharing error details:", {
        message: error.message,
        code: error.code,
        name: error.name,
        stack: error.stack
      });
    }
  }
};

And this is the error I get:

CallingCommunicationError: Failed to start video, unknown error. Please try again. If the issue persists, contact Azure Communication Services support.
code: 500
name: "CallingCommunicationError"

What I've Checked:

• I’m using the latest ACS SDK (@azure/communication-calling)

• Browser is Chrome (latest) and supports getDisplayMedia

• Screen sharing permission is set to "Ask" or "Allow"

• The call object is properly initialized and stable

• Camera-based video is working (local and remote streams are visible)

• I’m not already sharing a screen when calling startScreenSharing()

• call.state is "Connected" when I attempt startScreenSharing()

My Questions:

1. What could be causing this 500 error from startScreenSharing()?

2. Are there known issues when calling startScreenSharing() after starting camera video?

3. Is there a better way to debug what startScreenSharing() is trying to do internally?

4. Do I need to stop video or use a specific stream configuration before sharing screen?

Environment:

• ACS SDK: @azure/communication-calling (latest)

• Framework: React.js

• Browser: Chrome

• OS: Windows 10

Any insights or fixes would be greatly appreciated. Thanks Let me know if you'd also like to include logs like call.state or callAgent info, I can help with how to format that too.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.