13 lines
295 B
TypeScript
13 lines
295 B
TypeScript
|
|
export const getVideoConstraints = (
|
||
|
|
prevConstraints: MediaTrackConstraints,
|
||
|
|
isMobile: boolean,
|
||
|
|
defaultCamera?: string,
|
||
|
|
deviceId?: string,
|
||
|
|
) => {
|
||
|
|
return {
|
||
|
|
...prevConstraints,
|
||
|
|
...(deviceId && { deviceId }),
|
||
|
|
...(isMobile && { facingMode: { ideal: defaultCamera } }),
|
||
|
|
};
|
||
|
|
};
|