@gradio/image 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.19.0
4
+
5
+ ### Features
6
+
7
+ - [#10098](https://github.com/gradio-app/gradio/pull/10098) [`9a6ce6f`](https://github.com/gradio-app/gradio/commit/9a6ce6f6b089d94c06da0b8620f28967f39f8383) - Refactor full screen logic to be reusable. Thanks @hannahblair!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/statustracker@0.9.7
12
+ - @gradio/upload@0.14.3
13
+ - @gradio/atoms@0.12.0
14
+
15
+ ## 0.18.0
16
+
17
+ ### Features
18
+
19
+ - [#10099](https://github.com/gradio-app/gradio/pull/10099) [`8530b6e`](https://github.com/gradio-app/gradio/commit/8530b6e2f986421adceda98f972e6b843bc03fbe) - Redesign pending bubble in Chatbot. Thanks @hannahblair!
20
+ - [#10032](https://github.com/gradio-app/gradio/pull/10032) [`e450674`](https://github.com/gradio-app/gradio/commit/e450674ce41ca28f1f37a27fb149c728593a6ddf) - add `webcam_height` and `webcam_width` to specify the resolution of the Webcam. Thanks @yinsumirage!
21
+
3
22
  ## 0.17.0
4
23
 
5
24
  ### Features
package/Index.svelte CHANGED
@@ -65,6 +65,7 @@
65
65
  export let placeholder: string | undefined = undefined;
66
66
  export let show_fullscreen_button: boolean;
67
67
  export let input_ready: boolean;
68
+ export let webcam_constraints: { [key: string]: any } | undefined = undefined;
68
69
  let uploading = false;
69
70
  $: input_ready = !uploading;
70
71
  export let gradio: Gradio<{
@@ -218,6 +219,7 @@
218
219
  {stream_every}
219
220
  bind:modify_stream={_modify_stream}
220
221
  bind:set_time_limit
222
+ {webcam_constraints}
221
223
  max_file_size={gradio.max_file_size}
222
224
  i18n={gradio.i18n}
223
225
  upload={(...args) => gradio.client.upload(...args)}
package/dist/Index.svelte CHANGED
@@ -54,6 +54,7 @@ export let mirror_webcam;
54
54
  export let placeholder = void 0;
55
55
  export let show_fullscreen_button;
56
56
  export let input_ready;
57
+ export let webcam_constraints = void 0;
57
58
  let uploading = false;
58
59
  $:
59
60
  input_ready = !uploading;
@@ -190,6 +191,7 @@ const handle_drop = (event) => {
190
191
  {stream_every}
191
192
  bind:modify_stream={_modify_stream}
192
193
  bind:set_time_limit
194
+ {webcam_constraints}
193
195
  max_file_size={gradio.max_file_size}
194
196
  i18n={gradio.i18n}
195
197
  upload={(...args) => gradio.client.upload(...args)}
@@ -38,6 +38,9 @@ declare const __propDef: {
38
38
  placeholder?: string | undefined;
39
39
  show_fullscreen_button: boolean;
40
40
  input_ready: boolean;
41
+ webcam_constraints?: {
42
+ [key: string]: any;
43
+ } | undefined;
41
44
  gradio: Gradio<{
42
45
  input: never;
43
46
  change: never;
@@ -148,6 +151,13 @@ export default class Index extends SvelteComponent<IndexProps, IndexEvents, Inde
148
151
  get input_ready(): boolean;
149
152
  /**accessor*/
150
153
  set input_ready(_: boolean);
154
+ get webcam_constraints(): {
155
+ [key: string]: any;
156
+ } | undefined;
157
+ /**accessor*/
158
+ set webcam_constraints(_: {
159
+ [key: string]: any;
160
+ } | undefined);
151
161
  get gradio(): Gradio<{
152
162
  input: never;
153
163
  change: never;
@@ -5,15 +5,13 @@ import {
5
5
  Empty,
6
6
  IconButton,
7
7
  ShareButton,
8
- IconButtonWrapper
8
+ IconButtonWrapper,
9
+ FullscreenButton
9
10
  } from "@gradio/atoms";
10
- import { Download } from "@gradio/icons";
11
+ import { Download, Image as ImageIcon } from "@gradio/icons";
11
12
  import { get_coordinates_of_clicked_image } from "./utils";
12
- import Image from "./Image.svelte";
13
+ import { Image } from "@gradio/image/shared";
13
14
  import { DownloadLink } from "@gradio/wasm/svelte";
14
- import { Maximize, Minimize } from "@gradio/icons";
15
- import { Image as ImageIcon } from "@gradio/icons";
16
- import {} from "@gradio/client";
17
15
  export let value;
18
16
  export let label = void 0;
19
17
  export let show_label;
@@ -22,6 +20,7 @@ export let selectable = false;
22
20
  export let show_share_button = false;
23
21
  export let i18n;
24
22
  export let show_fullscreen_button = true;
23
+ export let display_icon_button_wrapper_top_corner = false;
25
24
  const dispatch = createEventDispatcher();
26
25
  const handle_click = (evt) => {
27
26
  let coordinates = get_coordinates_of_clicked_image(evt);
@@ -29,21 +28,7 @@ const handle_click = (evt) => {
29
28
  dispatch("select", { index: coordinates, value: null });
30
29
  }
31
30
  };
32
- let is_full_screen = false;
33
31
  let image_container;
34
- onMount(() => {
35
- document.addEventListener("fullscreenchange", () => {
36
- is_full_screen = !!document.fullscreenElement;
37
- });
38
- });
39
- const toggle_full_screen = async () => {
40
- if (!is_full_screen) {
41
- await image_container.requestFullscreen();
42
- } else {
43
- await document.exitFullscreen();
44
- is_full_screen = !is_full_screen;
45
- }
46
- };
47
32
  </script>
48
33
 
49
34
  <BlockLabel
@@ -55,21 +40,11 @@ const toggle_full_screen = async () => {
55
40
  <Empty unpadded_box={true} size="large"><ImageIcon /></Empty>
56
41
  {:else}
57
42
  <div class="image-container" bind:this={image_container}>
58
- <IconButtonWrapper>
59
- {#if !is_full_screen && show_fullscreen_button}
60
- <IconButton
61
- Icon={Maximize}
62
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
63
- on:click={toggle_full_screen}
64
- />
65
- {/if}
66
-
67
- {#if is_full_screen && show_fullscreen_button}
68
- <IconButton
69
- Icon={Minimize}
70
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
71
- on:click={toggle_full_screen}
72
- />
43
+ <IconButtonWrapper
44
+ display_top_corner={display_icon_button_wrapper_top_corner}
45
+ >
46
+ {#if show_fullscreen_button}
47
+ <FullscreenButton container={image_container} />
73
48
  {/if}
74
49
 
75
50
  {#if show_download_button}
@@ -103,6 +78,7 @@ const toggle_full_screen = async () => {
103
78
  .image-container {
104
79
  height: 100%;
105
80
  position: relative;
81
+ min-width: var(--size-20);
106
82
  }
107
83
 
108
84
  .image-container button {
@@ -1,7 +1,7 @@
1
1
  import { SvelteComponent } from "svelte";
2
2
  import type { SelectData } from "@gradio/utils";
3
- import { type FileData } from "@gradio/client";
4
3
  import type { I18nFormatter } from "@gradio/utils";
4
+ import type { FileData } from "@gradio/client";
5
5
  declare const __propDef: {
6
6
  props: {
7
7
  value: null | FileData;
@@ -12,6 +12,7 @@ declare const __propDef: {
12
12
  show_share_button?: boolean | undefined;
13
13
  i18n: I18nFormatter;
14
14
  show_fullscreen_button?: boolean | undefined;
15
+ display_icon_button_wrapper_top_corner?: boolean | undefined;
15
16
  };
16
17
  events: {
17
18
  share: CustomEvent<import("@gradio/utils").ShareData>;
@@ -1,6 +1,7 @@
1
1
  <script>import { createEventDispatcher, tick } from "svelte";
2
2
  import { BlockLabel, IconButtonWrapper, IconButton } from "@gradio/atoms";
3
- import { Clear, Image as ImageIcon, Maximize, Minimize } from "@gradio/icons";
3
+ import { Clear, Image as ImageIcon } from "@gradio/icons";
4
+ import { FullscreenButton } from "@gradio/atoms";
4
5
  import {
5
6
  } from "@gradio/utils";
6
7
  import { get_coordinates_of_clicked_image } from "./utils";
@@ -29,6 +30,7 @@ export let show_fullscreen_button = true;
29
30
  let upload_input;
30
31
  export let uploading = false;
31
32
  export let active_source = null;
33
+ export let webcam_constraints = void 0;
32
34
  function handle_upload({ detail }) {
33
35
  if (!streaming) {
34
36
  value = detail;
@@ -87,16 +89,7 @@ async function handle_select_source(source) {
87
89
  break;
88
90
  }
89
91
  }
90
- let is_full_screen = false;
91
92
  let image_container;
92
- const toggle_full_screen = async () => {
93
- if (!is_full_screen) {
94
- await image_container.requestFullscreen();
95
- } else {
96
- await document.exitFullscreen();
97
- is_full_screen = !is_full_screen;
98
- }
99
- };
100
93
  </script>
101
94
 
102
95
  <BlockLabel {show_label} Icon={ImageIcon} label={label || "Image"} />
@@ -104,19 +97,8 @@ const toggle_full_screen = async () => {
104
97
  <div data-testid="image" class="image-container" bind:this={image_container}>
105
98
  <IconButtonWrapper>
106
99
  {#if value?.url && !active_streaming}
107
- {#if !is_full_screen && show_fullscreen_button}
108
- <IconButton
109
- Icon={Maximize}
110
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
111
- on:click={toggle_full_screen}
112
- />
113
- {/if}
114
- {#if is_full_screen && show_fullscreen_button}
115
- <IconButton
116
- Icon={Minimize}
117
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
118
- on:click={toggle_full_screen}
119
- />
100
+ {#if show_fullscreen_button}
101
+ <FullscreenButton container={image_container} />
120
102
  {/if}
121
103
  <IconButton
122
104
  Icon={Clear}
@@ -171,6 +153,7 @@ const toggle_full_screen = async () => {
171
153
  {upload}
172
154
  bind:modify_stream
173
155
  bind:set_time_limit
156
+ {webcam_constraints}
174
157
  />
175
158
  {:else if value !== null && !streaming}
176
159
  <!-- svelte-ignore a11y-click-events-have-key-events-->
@@ -23,6 +23,9 @@ declare const __propDef: {
23
23
  show_fullscreen_button?: boolean | undefined;
24
24
  uploading?: boolean | undefined;
25
25
  active_source?: ("clipboard" | "upload" | "microphone" | "webcam" | null) | undefined;
26
+ webcam_constraints?: {
27
+ [key: string]: any;
28
+ } | undefined;
26
29
  dragging?: boolean | undefined;
27
30
  };
28
31
  events: {
@@ -43,6 +43,7 @@ export let stream_every = 1;
43
43
  export let mode = "image";
44
44
  export let mirror_webcam;
45
45
  export let include_audio;
46
+ export let webcam_constraints = null;
46
47
  export let i18n;
47
48
  export let upload;
48
49
  export let value = null;
@@ -60,19 +61,22 @@ onMount(() => {
60
61
  const handle_device_change = async (event) => {
61
62
  const target = event.target;
62
63
  const device_id = target.value;
63
- await get_video_stream(include_audio, video_source, device_id).then(
64
- async (local_stream) => {
65
- stream = local_stream;
66
- selected_device = available_video_devices.find(
67
- (device) => device.deviceId === device_id
68
- ) || null;
69
- options_open = false;
70
- }
71
- );
64
+ await get_video_stream(
65
+ include_audio,
66
+ video_source,
67
+ webcam_constraints,
68
+ device_id
69
+ ).then(async (local_stream) => {
70
+ stream = local_stream;
71
+ selected_device = available_video_devices.find(
72
+ (device) => device.deviceId === device_id
73
+ ) || null;
74
+ options_open = false;
75
+ });
72
76
  };
73
77
  async function access_webcam() {
74
78
  try {
75
- get_video_stream(include_audio, video_source).then(async (local_stream) => {
79
+ get_video_stream(include_audio, video_source, webcam_constraints).then(async (local_stream) => {
76
80
  webcam_accessed = true;
77
81
  available_video_devices = await get_devices();
78
82
  stream = local_stream;
@@ -13,6 +13,9 @@ declare const __propDef: {
13
13
  mode?: ("image" | "video") | undefined;
14
14
  mirror_webcam: boolean;
15
15
  include_audio: boolean;
16
+ webcam_constraints?: ({
17
+ [key: string]: any;
18
+ } | null) | undefined;
16
19
  i18n: I18nFormatter;
17
20
  upload: Client["upload"];
18
21
  value?: FileData | null | Base64File;
@@ -1,5 +1,7 @@
1
1
  export declare function get_devices(): Promise<MediaDeviceInfo[]>;
2
2
  export declare function handle_error(error: string): void;
3
3
  export declare function set_local_stream(local_stream: MediaStream | null, video_source: HTMLVideoElement): void;
4
- export declare function get_video_stream(include_audio: boolean, video_source: HTMLVideoElement, device_id?: string): Promise<MediaStream>;
4
+ export declare function get_video_stream(include_audio: boolean, video_source: HTMLVideoElement, webcam_constraints: {
5
+ [key: string]: any;
6
+ } | null, device_id?: string): Promise<MediaStream>;
5
7
  export declare function set_available_devices(devices: MediaDeviceInfo[]): MediaDeviceInfo[];
@@ -9,14 +9,15 @@ export function set_local_stream(local_stream, video_source) {
9
9
  video_source.muted = true;
10
10
  video_source.play();
11
11
  }
12
- export async function get_video_stream(include_audio, video_source, device_id) {
13
- const size = {
14
- width: { ideal: 1920 },
15
- height: { ideal: 1440 }
16
- };
12
+ export async function get_video_stream(include_audio, video_source, webcam_constraints, device_id) {
17
13
  const constraints = {
18
- video: device_id ? { deviceId: { exact: device_id }, ...size } : size,
19
- audio: include_audio
14
+ video: device_id
15
+ ? { deviceId: { exact: device_id }, ...webcam_constraints?.video }
16
+ : webcam_constraints?.video || {
17
+ width: { ideal: 1920 },
18
+ height: { ideal: 1440 }
19
+ },
20
+ audio: include_audio && (webcam_constraints?.audio ?? true) // Defaults to true if not specified
20
21
  };
21
22
  return navigator.mediaDevices
22
23
  .getUserMedia(constraints)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,11 +10,11 @@
10
10
  "cropperjs": "^1.5.12",
11
11
  "lazy-brush": "^1.0.1",
12
12
  "resize-observer-polyfill": "^1.5.1",
13
- "@gradio/atoms": "^0.11.2",
13
+ "@gradio/atoms": "^0.12.0",
14
14
  "@gradio/client": "^1.8.0",
15
15
  "@gradio/icons": "^0.8.1",
16
- "@gradio/upload": "^0.14.2",
17
- "@gradio/statustracker": "^0.9.6",
16
+ "@gradio/statustracker": "^0.9.7",
17
+ "@gradio/upload": "^0.14.3",
18
18
  "@gradio/utils": "^0.9.0",
19
19
  "@gradio/wasm": "^0.15.0"
20
20
  },
@@ -7,17 +7,16 @@
7
7
  Empty,
8
8
  IconButton,
9
9
  ShareButton,
10
- IconButtonWrapper
10
+ IconButtonWrapper,
11
+ FullscreenButton
11
12
  } from "@gradio/atoms";
12
- import { Download } from "@gradio/icons";
13
+ import { Download, Image as ImageIcon } from "@gradio/icons";
13
14
  import { get_coordinates_of_clicked_image } from "./utils";
14
- import Image from "./Image.svelte";
15
+ import { Image } from "@gradio/image/shared";
15
16
  import { DownloadLink } from "@gradio/wasm/svelte";
16
- import { Maximize, Minimize } from "@gradio/icons";
17
17
 
18
- import { Image as ImageIcon } from "@gradio/icons";
19
- import { type FileData } from "@gradio/client";
20
18
  import type { I18nFormatter } from "@gradio/utils";
19
+ import type { FileData } from "@gradio/client";
21
20
 
22
21
  export let value: null | FileData;
23
22
  export let label: string | undefined = undefined;
@@ -27,6 +26,7 @@
27
26
  export let show_share_button = false;
28
27
  export let i18n: I18nFormatter;
29
28
  export let show_fullscreen_button = true;
29
+ export let display_icon_button_wrapper_top_corner = false;
30
30
 
31
31
  const dispatch = createEventDispatcher<{
32
32
  change: string;
@@ -40,23 +40,7 @@
40
40
  }
41
41
  };
42
42
 
43
- let is_full_screen = false;
44
43
  let image_container: HTMLElement;
45
-
46
- onMount(() => {
47
- document.addEventListener("fullscreenchange", () => {
48
- is_full_screen = !!document.fullscreenElement;
49
- });
50
- });
51
-
52
- const toggle_full_screen = async (): Promise<void> => {
53
- if (!is_full_screen) {
54
- await image_container.requestFullscreen();
55
- } else {
56
- await document.exitFullscreen();
57
- is_full_screen = !is_full_screen;
58
- }
59
- };
60
44
  </script>
61
45
 
62
46
  <BlockLabel
@@ -68,21 +52,11 @@
68
52
  <Empty unpadded_box={true} size="large"><ImageIcon /></Empty>
69
53
  {:else}
70
54
  <div class="image-container" bind:this={image_container}>
71
- <IconButtonWrapper>
72
- {#if !is_full_screen && show_fullscreen_button}
73
- <IconButton
74
- Icon={Maximize}
75
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
76
- on:click={toggle_full_screen}
77
- />
78
- {/if}
79
-
80
- {#if is_full_screen && show_fullscreen_button}
81
- <IconButton
82
- Icon={Minimize}
83
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
84
- on:click={toggle_full_screen}
85
- />
55
+ <IconButtonWrapper
56
+ display_top_corner={display_icon_button_wrapper_top_corner}
57
+ >
58
+ {#if show_fullscreen_button}
59
+ <FullscreenButton container={image_container} />
86
60
  {/if}
87
61
 
88
62
  {#if show_download_button}
@@ -116,6 +90,7 @@
116
90
  .image-container {
117
91
  height: 100%;
118
92
  position: relative;
93
+ min-width: var(--size-20);
119
94
  }
120
95
 
121
96
  .image-container button {
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
2
  import { createEventDispatcher, tick } from "svelte";
3
3
  import { BlockLabel, IconButtonWrapper, IconButton } from "@gradio/atoms";
4
- import { Clear, Image as ImageIcon, Maximize, Minimize } from "@gradio/icons";
4
+ import { Clear, Image as ImageIcon } from "@gradio/icons";
5
+ import { FullscreenButton } from "@gradio/atoms";
5
6
  import {
6
7
  type SelectData,
7
8
  type I18nFormatter,
@@ -42,6 +43,8 @@
42
43
  export let uploading = false;
43
44
  export let active_source: source_type = null;
44
45
 
46
+ export let webcam_constraints: { [key: string]: any } | undefined = undefined;
47
+
45
48
  function handle_upload({ detail }: CustomEvent<FileData>): void {
46
49
  // only trigger streaming event if streaming
47
50
  if (!streaming) {
@@ -120,17 +123,7 @@
120
123
  }
121
124
  }
122
125
 
123
- let is_full_screen = false;
124
126
  let image_container: HTMLElement;
125
-
126
- const toggle_full_screen = async (): Promise<void> => {
127
- if (!is_full_screen) {
128
- await image_container.requestFullscreen();
129
- } else {
130
- await document.exitFullscreen();
131
- is_full_screen = !is_full_screen;
132
- }
133
- };
134
127
  </script>
135
128
 
136
129
  <BlockLabel {show_label} Icon={ImageIcon} label={label || "Image"} />
@@ -138,19 +131,8 @@
138
131
  <div data-testid="image" class="image-container" bind:this={image_container}>
139
132
  <IconButtonWrapper>
140
133
  {#if value?.url && !active_streaming}
141
- {#if !is_full_screen && show_fullscreen_button}
142
- <IconButton
143
- Icon={Maximize}
144
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
145
- on:click={toggle_full_screen}
146
- />
147
- {/if}
148
- {#if is_full_screen && show_fullscreen_button}
149
- <IconButton
150
- Icon={Minimize}
151
- label={is_full_screen ? "Exit full screen" : "View in full screen"}
152
- on:click={toggle_full_screen}
153
- />
134
+ {#if show_fullscreen_button}
135
+ <FullscreenButton container={image_container} />
154
136
  {/if}
155
137
  <IconButton
156
138
  Icon={Clear}
@@ -205,6 +187,7 @@
205
187
  {upload}
206
188
  bind:modify_stream
207
189
  bind:set_time_limit
190
+ {webcam_constraints}
208
191
  />
209
192
  {:else if value !== null && !streaming}
210
193
  <!-- svelte-ignore a11y-click-events-have-key-events-->
@@ -18,6 +18,7 @@
18
18
  set_available_devices
19
19
  } from "./stream_utils";
20
20
  import type { Base64File } from "./types";
21
+ import type { int } from "babylonjs";
21
22
 
22
23
  let video_source: HTMLVideoElement;
23
24
  let available_video_devices: MediaDeviceInfo[] = [];
@@ -52,6 +53,7 @@
52
53
  export let mode: "image" | "video" = "image";
53
54
  export let mirror_webcam: boolean;
54
55
  export let include_audio: boolean;
56
+ export let webcam_constraints: { [key: string]: any } | null = null;
55
57
  export let i18n: I18nFormatter;
56
58
  export let upload: Client["upload"];
57
59
  export let value: FileData | null | Base64File = null;
@@ -80,21 +82,24 @@
80
82
  const target = event.target as HTMLInputElement;
81
83
  const device_id = target.value;
82
84
 
83
- await get_video_stream(include_audio, video_source, device_id).then(
84
- async (local_stream) => {
85
- stream = local_stream;
86
- selected_device =
87
- available_video_devices.find(
88
- (device) => device.deviceId === device_id
89
- ) || null;
90
- options_open = false;
91
- }
92
- );
85
+ await get_video_stream(
86
+ include_audio,
87
+ video_source,
88
+ webcam_constraints,
89
+ device_id
90
+ ).then(async (local_stream) => {
91
+ stream = local_stream;
92
+ selected_device =
93
+ available_video_devices.find(
94
+ (device) => device.deviceId === device_id
95
+ ) || null;
96
+ options_open = false;
97
+ });
93
98
  };
94
99
 
95
100
  async function access_webcam(): Promise<void> {
96
101
  try {
97
- get_video_stream(include_audio, video_source)
102
+ get_video_stream(include_audio, video_source, webcam_constraints)
98
103
  .then(async (local_stream) => {
99
104
  webcam_accessed = true;
100
105
  available_video_devices = await get_devices();
@@ -18,16 +18,17 @@ export function set_local_stream(
18
18
  export async function get_video_stream(
19
19
  include_audio: boolean,
20
20
  video_source: HTMLVideoElement,
21
+ webcam_constraints: { [key: string]: any } | null,
21
22
  device_id?: string
22
23
  ): Promise<MediaStream> {
23
- const size = {
24
- width: { ideal: 1920 },
25
- height: { ideal: 1440 }
26
- };
27
-
28
- const constraints = {
29
- video: device_id ? { deviceId: { exact: device_id }, ...size } : size,
30
- audio: include_audio
24
+ const constraints: MediaStreamConstraints = {
25
+ video: device_id
26
+ ? { deviceId: { exact: device_id }, ...webcam_constraints?.video }
27
+ : webcam_constraints?.video || {
28
+ width: { ideal: 1920 },
29
+ height: { ideal: 1440 }
30
+ },
31
+ audio: include_audio && (webcam_constraints?.audio ?? true) // Defaults to true if not specified
31
32
  };
32
33
 
33
34
  return navigator.mediaDevices