ACS - ROOM - Enable/Disable videoLocalStream for others participants

Alexandre Gurgel 60 Reputation points
2024-04-18T22:28:38.2933333+00:00

I using this for enable and disable video for other participants

await call.stopVideo(videoLocalMediaStream)
await call.startVideo(videoLocalMediaStream)

But doesn't work. How should I do this?

P.S.: I want to disable my camera so another participant can't see

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
680 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 16,101 Reputation points
    2024-04-19T22:37:32.73+00:00

    Hi @Alexandre Gurgel you are on the right track. If you want to disable your camera so that other participants can’t see you, you should be able to do so by stopping your local video stream.

    You need to use LocalVideoStream and not videoLocalMediaStream. Please read this ACS documentation for more details

    User's image

    Here’s how you can do it:

    
    // Assuming `call` is your Call object and `localVideoStream` is your LocalVideoStream object
    
    // To stop sending your video stream
    await call.stopVideo(localVideoStream);
    
    // To start sending your video stream again
    await call.startVideo(localVideoStream);
    

    Please make sure that localVideoStream is correctly initialized and the call is established before you try to stop or start the video. If you’re still facing issues, there might be a problem with the setup of the Call or LocalVideoStream objects, or there might be a problem with the permissions for the camera.

    Hope that helps.

    Best,

    Grace