make code

This commit is contained in:
freddyaboulton
2024-10-22 16:24:21 -07:00
parent cff6073df0
commit e7f3e63c79
20 changed files with 427 additions and 156 deletions

View File

@@ -18,15 +18,16 @@ export function set_local_stream(
export async function get_video_stream(
include_audio: boolean,
video_source: HTMLVideoElement,
device_id?: string
device_id?: string,
track_constraints?: MediaTrackConstraints,
): Promise<MediaStream> {
const size = {
const fallback_constraints = track_constraints || {
width: { ideal: 500 },
height: { ideal: 500 }
};
const constraints = {
video: device_id ? { deviceId: { exact: device_id }, ...size } : size,
video: device_id ? { deviceId: { exact: device_id }, ...fallback_constraints } : fallback_constraints,
audio: include_audio
};