@gradio/video 0.2.1 → 0.2.3

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,20 @@
1
1
  # @gradio/video
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Fixes
6
+
7
+ - [#6766](https://github.com/gradio-app/gradio/pull/6766) [`73268ee`](https://github.com/gradio-app/gradio/commit/73268ee2e39f23ebdd1e927cb49b8d79c4b9a144) - Improve source selection UX. Thanks [@hannahblair](https://github.com/hannahblair)!
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`245d58e`](https://github.com/gradio-app/gradio/commit/245d58eff788e8d44a59d37a2d9b26d0f08a62b4)]:
14
+ - @gradio/client@0.9.2
15
+ - @gradio/image@0.5.2
16
+ - @gradio/upload@0.5.5
17
+
3
18
  ## 0.2.1
4
19
 
5
20
  ### Patch Changes
@@ -254,4 +269,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
254
269
  - @gradio/image@0.1.0
255
270
  - @gradio/utils@0.0.2
256
271
  - @gradio/atoms@0.0.2
257
- - @gradio/upload@0.0.2
272
+ - @gradio/upload@0.0.2
package/Index.svelte CHANGED
@@ -73,12 +73,8 @@
73
73
  value = initial_value;
74
74
  };
75
75
 
76
- $: if (sources) {
77
- if (sources.length > 1) {
78
- active_source = "upload";
79
- } else {
80
- active_source = sources[0];
81
- }
76
+ $: if (sources && !active_source) {
77
+ active_source = sources[0];
82
78
  }
83
79
 
84
80
  $: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/video",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -9,14 +9,14 @@
9
9
  "dependencies": {
10
10
  "@ffmpeg/ffmpeg": "^0.12.7",
11
11
  "@ffmpeg/util": "^0.12.1",
12
- "@gradio/atoms": "^0.4.0",
13
- "@gradio/client": "^0.9.1",
14
- "@gradio/image": "^0.5.1",
15
- "@gradio/upload": "^0.5.4",
12
+ "@gradio/atoms": "^0.4.1",
16
13
  "@gradio/icons": "^0.3.2",
17
- "@gradio/wasm": "^0.4.0",
14
+ "@gradio/client": "^0.9.3",
15
+ "@gradio/image": "^0.5.3",
16
+ "@gradio/statustracker": "^0.4.3",
18
17
  "@gradio/utils": "^0.2.0",
19
- "@gradio/statustracker": "^0.4.2"
18
+ "@gradio/upload": "^0.5.6",
19
+ "@gradio/wasm": "^0.4.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "mrmime": "^1.0.1"
@@ -62,59 +62,62 @@
62
62
  </script>
63
63
 
64
64
  <BlockLabel {show_label} Icon={Video} label={label || "Video"} />
65
- {#if value === null || value.url === undefined}
66
- {#if active_source === "upload"}
67
- <Upload
68
- bind:dragging
69
- filetype="video/x-m4v,video/*"
70
- on:load={handle_load}
71
- on:error={({ detail }) => dispatch("error", detail)}
72
- {root}
73
- include_sources={sources.length > 1}
74
- >
75
- <slot />
76
- </Upload>
77
- {:else if active_source === "webcam"}
78
- <Webcam
79
- {mirror_webcam}
80
- {include_audio}
81
- mode="video"
82
- on:error
83
- on:capture={() => dispatch("change")}
84
- on:start_recording
85
- on:stop_recording
86
- {i18n}
87
- />
88
- {/if}
89
- {:else}
90
- <ModifyUpload {i18n} on:clear={handle_clear} />
91
- {#if playable()}
92
- {#key value?.url}
93
- <Player
94
- {root}
95
- interactive
96
- {autoplay}
97
- src={value.url}
98
- subtitle={subtitle?.url}
99
- on:play
100
- on:pause
101
- on:stop
102
- on:end
103
- mirror={mirror_webcam && active_source === "webcam"}
104
- {label}
105
- {handle_change}
106
- {handle_reset_value}
107
- />
108
- {/key}
109
- {:else if value.size}
110
- <div class="file-name">{value.orig_name || value.url}</div>
111
- <div class="file-size">
112
- {prettyBytes(value.size)}
65
+ <div data-testid="video" class="video-container">
66
+ {#if value === null || value.url === undefined}
67
+ <div class="upload-container">
68
+ {#if active_source === "upload"}
69
+ <Upload
70
+ bind:dragging
71
+ filetype="video/x-m4v,video/*"
72
+ on:load={handle_load}
73
+ on:error={({ detail }) => dispatch("error", detail)}
74
+ {root}
75
+ >
76
+ <slot />
77
+ </Upload>
78
+ {:else if active_source === "webcam"}
79
+ <Webcam
80
+ {mirror_webcam}
81
+ {include_audio}
82
+ mode="video"
83
+ on:error
84
+ on:capture={() => dispatch("change")}
85
+ on:start_recording
86
+ on:stop_recording
87
+ {i18n}
88
+ />
89
+ {/if}
113
90
  </div>
91
+ {:else}
92
+ <ModifyUpload {i18n} on:clear={handle_clear} />
93
+ {#if playable()}
94
+ {#key value?.url}
95
+ <Player
96
+ {root}
97
+ interactive
98
+ {autoplay}
99
+ src={value.url}
100
+ subtitle={subtitle?.url}
101
+ on:play
102
+ on:pause
103
+ on:stop
104
+ on:end
105
+ mirror={mirror_webcam && active_source === "webcam"}
106
+ {label}
107
+ {handle_change}
108
+ {handle_reset_value}
109
+ />
110
+ {/key}
111
+ {:else if value.size}
112
+ <div class="file-name">{value.orig_name || value.url}</div>
113
+ <div class="file-size">
114
+ {prettyBytes(value.size)}
115
+ </div>
116
+ {/if}
114
117
  {/if}
115
- {/if}
116
118
 
117
- <SelectSource {sources} bind:active_source {handle_clear} />
119
+ <SelectSource {sources} bind:active_source {handle_clear} />
120
+ </div>
118
121
 
119
122
  <style>
120
123
  .file-name {
@@ -127,4 +130,16 @@
127
130
  padding: var(--size-2);
128
131
  font-size: var(--text-xl);
129
132
  }
133
+
134
+ .upload-container {
135
+ height: 100%;
136
+ }
137
+
138
+ .video-container {
139
+ display: flex;
140
+ height: 100%;
141
+ flex-direction: column;
142
+ justify-content: center;
143
+ align-items: center;
144
+ }
130
145
  </style>