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.