How to destroy azure call instance?

Vashram Berani 0 Reputation points
2024-07-22T13:52:20.74+00:00

I have implemented the Azure video call 1:1 users, and it's working fine the first time, But if the user disconnects the call and call again then it's through an error as shown below in the screenshot

User's image

Code for joining room

const callAzurClient = new CallClient();
let tokenCredential = new AzureCommunicationTokenCredential(accessToken);
callAgent.current = await callAzurClient.createCallAgent(tokenCredential);
deviceManager.current = await callAzurClient.getDeviceManager();

const camera = selectedCamera ? selectedCamera : (await deviceManager.current.getCameras())?.[0];

const localVideoStream_ = localVideoStream ? localVideoStream : await createLocalVideoStreamCommon(camera);

const videoOptions = localVideoStream_ ? { localVideoStreams: [localVideoStream_] } : undefined;
        
const roomCallLocator = { roomId: roomId };
call.current = callAgent.current.join(roomCallLocator, { videoOptions });

It's through error while calling a second time.

Is there any way to destroy previously created instances?

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
847 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.