Activate, deactivate and change camera

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.

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

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 … :crazy_face: :crazy_face: :crazy_face: :crazy_face:

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

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 :slight_smile: