MCPcopy
hub / github.com/CapSoftware/Cap / normalizeWebcamSettings

Function normalizeWebcamSettings

apps/chrome-extension/src/shared/storage.ts:604–638  ·  view source on GitHub ↗
(
	value: unknown,
)

Source from the content-addressed store, hash-verified

602};
603
604const normalizeWebcamSettings = (
605 value: unknown,
606): ExtensionSettings["webcam"] => {
607 const webcam =
608 value && typeof value === "object"
609 ? (value as Partial<ExtensionSettings["webcam"]>)
610 : {};
611 const size =
612 typeof webcam.size === "number" && Number.isFinite(webcam.size)
613 ? webcam.size
614 : defaultSettings.webcam.size;
615 const position =
616 webcam.position === "top-left" ||
617 webcam.position === "top-right" ||
618 webcam.position === "bottom-left" ||
619 webcam.position === "bottom-right"
620 ? webcam.position
621 : defaultSettings.webcam.position;
622 const deviceId =
623 typeof webcam.deviceId === "string" && webcam.deviceId.trim().length > 0
624 ? webcam.deviceId
625 : null;
626
627 return {
628 enabled:
629 typeof webcam.enabled === "boolean"
630 ? webcam.enabled
631 : defaultSettings.webcam.enabled,
632 deviceId,
633 position,
634 size: Math.max(120, Math.min(420, size)),
635 shape: normalizeWebcamShape(webcam.shape),
636 mirror: typeof webcam.mirror === "boolean" ? webcam.mirror : false,
637 };
638};
639
640const normalizeMicrophoneSettings = (
641 value: unknown,

Callers 1

loadSettingsFunction · 0.85

Calls 1

normalizeWebcamShapeFunction · 0.85

Tested by

no test coverage detected