@gradio/image 0.20.0 → 0.20.1

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,19 @@
1
1
  # @gradio/image
2
2
 
3
+ ## 0.20.1
4
+
5
+ ### Fixes
6
+
7
+ - [#10327](https://github.com/gradio-app/gradio/pull/10327) [`e0cb47f`](https://github.com/gradio-app/gradio/commit/e0cb47f0c5040049fb942a381c0335de4bf77d67) - Fix webcam. Thanks @Col0ring!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.13.1
12
+ - @gradio/statustracker@0.10.1
13
+ - @gradio/client@1.10.0
14
+ - @gradio/icons@0.10.0
15
+ - @gradio/upload@0.14.5
16
+
3
17
  ## 0.20.0
4
18
 
5
19
  ### Features
@@ -177,14 +177,18 @@ function take_recording() {
177
177
  recording = !recording;
178
178
  }
179
179
  let webcam_accessed = false;
180
- function record_video_or_photo() {
180
+ function record_video_or_photo({
181
+ destroy
182
+ } = {}) {
181
183
  if (mode === "image" && streaming) {
182
184
  recording = !recording;
183
185
  }
184
- if (mode === "image") {
185
- take_picture();
186
- } else {
187
- take_recording();
186
+ if (!destroy) {
187
+ if (mode === "image") {
188
+ take_picture();
189
+ } else {
190
+ take_recording();
191
+ }
188
192
  }
189
193
  if (!recording && stream) {
190
194
  dispatch("close_stream");
@@ -219,7 +223,7 @@ function handle_click_outside(event) {
219
223
  onDestroy(() => {
220
224
  if (typeof window === "undefined")
221
225
  return;
222
- record_video_or_photo();
226
+ record_video_or_photo({ destroy: true });
223
227
  stream?.getTracks().forEach((track) => track.stop());
224
228
  });
225
229
  </script>
@@ -249,7 +253,7 @@ onDestroy(() => {
249
253
  {:else}
250
254
  <div class="button-wrap">
251
255
  <button
252
- on:click={record_video_or_photo}
256
+ on:click={() => record_video_or_photo()}
253
257
  aria-label={mode === "image" ? "capture photo" : "start recording"}
254
258
  >
255
259
  {#if mode === "video" || streaming}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/image",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -10,13 +10,13 @@
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.13.0",
14
- "@gradio/client": "^1.9.0",
15
- "@gradio/statustracker": "^0.10.0",
16
- "@gradio/icons": "^0.9.0",
13
+ "@gradio/atoms": "^0.13.1",
14
+ "@gradio/icons": "^0.10.0",
15
+ "@gradio/client": "^1.10.0",
16
+ "@gradio/statustracker": "^0.10.1",
17
+ "@gradio/upload": "^0.14.5",
17
18
  "@gradio/utils": "^0.10.0",
18
- "@gradio/wasm": "^0.16.0",
19
- "@gradio/upload": "^0.14.4"
19
+ "@gradio/wasm": "^0.16.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@gradio/preview": "^0.13.0"
@@ -225,15 +225,21 @@
225
225
 
226
226
  let webcam_accessed = false;
227
227
 
228
- function record_video_or_photo(): void {
228
+ function record_video_or_photo({
229
+ destroy
230
+ }: { destroy?: boolean } = {}): void {
229
231
  if (mode === "image" && streaming) {
230
232
  recording = !recording;
231
233
  }
232
- if (mode === "image") {
233
- take_picture();
234
- } else {
235
- take_recording();
234
+
235
+ if (!destroy) {
236
+ if (mode === "image") {
237
+ take_picture();
238
+ } else {
239
+ take_recording();
240
+ }
236
241
  }
242
+
237
243
  if (!recording && stream) {
238
244
  dispatch("close_stream");
239
245
  stream.getTracks().forEach((track) => track.stop());
@@ -276,7 +282,7 @@
276
282
 
277
283
  onDestroy(() => {
278
284
  if (typeof window === "undefined") return;
279
- record_video_or_photo();
285
+ record_video_or_photo({ destroy: true });
280
286
  stream?.getTracks().forEach((track) => track.stop());
281
287
  });
282
288
  </script>
@@ -306,7 +312,7 @@
306
312
  {:else}
307
313
  <div class="button-wrap">
308
314
  <button
309
- on:click={record_video_or_photo}
315
+ on:click={() => record_video_or_photo()}
310
316
  aria-label={mode === "image" ? "capture photo" : "start recording"}
311
317
  >
312
318
  {#if mode === "video" || streaming}