# toggleVideo()

Toggles user's camera state.

If the camera is currently enabled, then it will be disabled. And vice-versa -> if the camera is currently disabled, then it will be enabled. There is also an optional param to set a concrete target camera state, but you may use [disableVideo()](/reference/sdk/methods/disablevideo.md) and [enableVideo()](/reference/sdk/methods/enablevideo.md) to achieve similar functionality.

```javascript
//This will toggle the camera state
sambaFrame.toggleVideo();

//This will enable the camera, equivalent to sambaFrame.enableVideo();
sambaFrame.toggleVideo(true); 

//This will disable the camera, equivalent to sambaFrame.disableVideo();
sambaFrame.toggleVideo(false);
```

**Sample use case**: \
Have a custom toolbar in your integration and want user to control camera from it.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalsamba.com/reference/sdk/methods/togglevideo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
