export function makeReselects()

in src/providers/AVObserver.ts [57:81]


export function makeReselects(chime: ChimeSdkWrapper): {
  reselectVideo: () => Promise<void>,
  reselectAudio: () => Promise<void>
} {
  const reselectVideo = async () => {
    if (!chime || !chime.currentVideoInputDevice) {
      return;
    }
    await chime.audioVideo?.chooseVideoInputDevice(chime.currentVideoInputDevice.value);
  };

  const reselectAudio = async () => {
    if (!chime || !chime.currentAudioInputDevice) {
      return;
    }

    console.log('Re-selecting current audio:', chime.currentAudioInputDevice);
    await chime.audioVideo?.chooseAudioInputDevice(chime.currentAudioInputDevice.value);
  };

  return {
    reselectAudio,
    reselectVideo,
  };
}