MediaSFU Shared
    Preparing search index...

    Function switchCamera

    • Switch to a different camera.

      Pairs with listMediaDevices() / getSelectedDevices(), which could previously only report devices with no way to act on them.

      Goes through the SDK's own switchUserVideo, so the producer track is replaced on the existing transport — remote viewers see the new camera without the call renegotiating — and host restrictions still apply. A refusal (blocked by the host, audio-only event) is returned as ok: false with the reason rather than resolving silently.

      Parameters

      Returns Promise<HeadlessActionResult>

      const { video } = await listMediaDevices();
      await switchCamera({ parameters, deviceId: video[1].deviceId });