Skip to content

armgit / clipy

Public Imported from GitHub
0

The AI-native screen recorder. Record your screen and talk; the people you share it with and your AI agents both get it.

461 B
Raw Blame
import type { WebcamDeviceDto } from "./bridge";

const OBS_CAMERA_NAME = /^obs(?:[ -]virtual)?[ -]camera$/i;

export function preferredWebcamDeviceId(
  devices: WebcamDeviceDto[],
  currentDeviceId: string | null,
): string | null {
  if (currentDeviceId && devices.some((device) => device.id === currentDeviceId)) {
    return currentDeviceId;
  }
  return devices.find((device) => !OBS_CAMERA_NAME.test(device.name.trim()))?.id ?? devices[0]?.id ?? null;
}