# Activate, deactivate and change camera

**URL:** <https://devforum.zoom.us/t/activate-deactivate-and-change-camera/110136>\
**Category:** Web\
**Created:** [May 16, 2024, 6:57pm UTC](https://devforum.zoom.us/t/activate-deactivate-and-change-camera/110136 "2024-05-16T18:57:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saulotarsobc](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/saulotarsobc/32/53583_2.png) [@saulotarsobc](https://devforum.zoom.us/u/saulotarsobc)\
**Post date:** [May 16, 2024, 6:57pm UTC](https://devforum.zoom.us/t/activate-deactivate-and-change-camera/110136/1 "2024-05-16T18:57:14Z")

</div>

**Activate, deactivate and change camera.**

I would like to know if ZoomMtg provides any method to interact with the interface camera.:

- Enable camera
- Disable camear
- List devices availables
- Select camera device

I’m developing a web app and this method would help a lot to automate some things in our meetings.

 ![saulo-costa](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/e/e/eed4c8ea52da484376ad7da4b27152488843c82d.jpeg)

---

<div class="post-metadata">

**Author:** ![saulotarsobc](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/saulotarsobc/32/53583_2.png) [@saulotarsobc](https://devforum.zoom.us/u/saulotarsobc)\
**Post date:** [May 18, 2024, 3:33am UTC](https://devforum.zoom.us/t/activate-deactivate-and-change-camera/110136/2 "2024-05-18T03:33:30Z")

</div>

> As a palliative (or definitive) solution, I am using JS to manipulate the browser’s DOM and list and select devices.

## For get devices camera list

```js
function getCameraDevices(){
    let devicesList = []
    let menuEl = document.querySelector(".dark-dropdown.video-option-menu__pop-menu.custom-dropdown-menu.dropdown-menu");
    for (let i = 0; i < menuEl.children.length; i++) {
        const child = menuEl.children[i];
        if (child.classList.contains("common-ui-component__dropdown-divider")) break;
        child.tagName.toLowerCase() === 'a' && devicesList.push({name: child.text, id: i});
    }
    return devicesList;
}

```

## Or … 🤪 🤪 🤪 🤪

```ts
function getCameraDevices() {
  try {
    let devicesList: any = [];
    let menuEl = document.querySelector(".dark-dropdown.video-option-menu__pop-menu.custom-dropdown-menu.dropdown-menu") as HTMLElement;
    for (let i = 0; i < menuEl.children.length; i++) {
      const child: any = menuEl.children[i];
      if (child.classList.contains("common-ui-component__dropdown-divider"))
        break;
      child.tagName.toLowerCase() === "a" && devicesList.push({ name: child.text, id: i });
    }
    return devicesList;
  } catch (error) {
    try {
      (document.querySelector("#foot-bar > div:nth-child(1) > div:nth-child(2) div button") as HTMLElement).click();
    } catch (error) {
      console.log(error);
      return [];
    }
    console.log(error);
    return [];
  }
}

```

## For select de camera

```js
case "sw-cam":
  document.querySelector(".dark-dropdown.video-option-menu__pop-menu.custom-dropdown-menu.dropdown-menu").children[data.id].click();
  break;

```

> But if the lib has one I’ll be happy 🙂

---

<div class="post-metadata">

**Author:** ![saulotarsobc](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/saulotarsobc/32/53583_2.png) [@saulotarsobc](https://devforum.zoom.us/u/saulotarsobc)\
**Post date:** [May 31, 2024, 7:24pm UTC](https://devforum.zoom.us/t/activate-deactivate-and-change-camera/110136/3 "2024-05-31T19:24:01Z")

</div>

```js
console.log('News?')

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [July 1, 2024, 5:24am UTC](https://devforum.zoom.us/t/activate-deactivate-and-change-camera/110136/4 "2024-07-01T05:24:16Z")

</div>

Closed on July 1, 2024, 5:24am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
