@gradio/video 0.17.0-dev.2 → 0.17.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,4 +1,21 @@
1
1
  # @gradio/video
2
+ ## 0.17.0
3
+
4
+ ### Features
5
+
6
+ - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Clear Error statuses
7
+ - [#11908](https://github.com/gradio-app/gradio/pull/11908) [`029034f`](https://github.com/gradio-app/gradio/commit/029034f7853ea018d110efe9b7e2ef7d1407091c) - Video subtitles
8
+ - [#12438](https://github.com/gradio-app/gradio/pull/12438) [`25ffc03`](https://github.com/gradio-app/gradio/commit/25ffc0398f8feb43d817c02b2ab970c16de6d797) - Svelte5 migration and bugfix
9
+
10
+ ### Dependencies
11
+
12
+ - @gradio/atoms@0.19.0
13
+ - @gradio/client@2.0.0
14
+ - @gradio/icons@0.15.0
15
+ - @gradio/image@0.24.0
16
+ - @gradio/statustracker@0.12.0
17
+ - @gradio/upload@0.17.2
18
+ - @gradio/utils@0.10.3
2
19
 
3
20
  ## 0.17.0-dev.2
4
21
 
package/Index.svelte CHANGED
@@ -89,7 +89,7 @@
89
89
  autoscroll={gradio.shared.autoscroll}
90
90
  i18n={gradio.i18n}
91
91
  {...gradio.shared.loading_status}
92
- on:clear_status={() =>
92
+ on_clear_status={() =>
93
93
  gradio.dispatch("clear_status", gradio.shared.loading_status)}
94
94
  />
95
95
 
@@ -135,7 +135,7 @@
135
135
  autoscroll={gradio.shared.autoscroll}
136
136
  i18n={gradio.i18n}
137
137
  {...gradio.shared.loading_status}
138
- on:clear_status={() =>
138
+ on_clear_status={() =>
139
139
  gradio.dispatch("clear_status", gradio.shared.loading_status)}
140
140
  />
141
141
 
package/Video.test.ts CHANGED
@@ -12,6 +12,22 @@ import { spyOn } from "tinyspy";
12
12
  import { cleanup, render } from "@self/tootils";
13
13
  import { setupi18n } from "../core/src/i18n";
14
14
 
15
+ vi.mock("@ffmpeg/ffmpeg", () => ({
16
+ FFmpeg: class MockFFmpeg {
17
+ load = vi.fn(() => Promise.resolve());
18
+ writeFile = vi.fn(() => Promise.resolve());
19
+ readFile = vi.fn(() => Promise.resolve(new Uint8Array()));
20
+ exec = vi.fn(() => Promise.resolve(0));
21
+ terminate = vi.fn(() => Promise.resolve());
22
+ on = vi.fn();
23
+ }
24
+ }));
25
+
26
+ vi.mock("@ffmpeg/util", () => ({
27
+ fetchFile: vi.fn(() => Promise.resolve(new Uint8Array())),
28
+ toBlobURL: vi.fn(() => Promise.resolve("blob:mock"))
29
+ }));
30
+
15
31
  import Video from "./Index.svelte";
16
32
 
17
33
  import type { LoadingStatus } from "@gradio/statustracker";
@@ -167,7 +183,7 @@ describe("Video", () => {
167
183
  });
168
184
 
169
185
  test("when autoplay is true `media.play` should be called in static mode when the Video data is updated", async () => {
170
- const { component, getByTestId } = await render(Video, {
186
+ const { getByTestId, unmount } = await render(Video, {
171
187
  show_label: true,
172
188
  loading_status,
173
189
  interactive: false,
@@ -186,20 +202,39 @@ describe("Video", () => {
186
202
  constraints: null
187
203
  }
188
204
  });
189
- const startButton = getByTestId("test-player") as HTMLVideoElement;
205
+ let startButton = getByTestId("test-player") as HTMLVideoElement;
190
206
  const fn = spyOn(startButton, "play");
191
207
  startButton.dispatchEvent(new Event("loadeddata"));
192
- component.$set({
208
+ assert.equal(fn.callCount, 1);
209
+ unmount();
210
+
211
+ const result = await render(Video, {
212
+ show_label: true,
213
+ loading_status,
214
+ interactive: false,
193
215
  value: {
194
- path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
216
+ path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav",
217
+ url: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
218
+ },
219
+ root: "foo",
220
+ proxy_url: null,
221
+ streaming: false,
222
+ pending: false,
223
+ sources: ["upload"],
224
+ autoplay: true,
225
+ webcam_options: {
226
+ mirror: true,
227
+ constraints: null
195
228
  }
196
229
  });
230
+ startButton = result.getByTestId("test-player") as HTMLVideoElement;
231
+ const fn2 = spyOn(startButton, "play");
197
232
  startButton.dispatchEvent(new Event("loadeddata"));
198
- assert.equal(fn.callCount, 2);
233
+ assert.equal(fn2.callCount, 1);
199
234
  });
200
235
 
201
236
  test("when autoplay is true `media.play` should be called in dynamic mode when the Video data is updated", async () => {
202
- const { component, getByTestId } = await render(Video, {
237
+ const { getByTestId, unmount } = await render(Video, {
203
238
  show_label: true,
204
239
  loading_status,
205
240
  interactive: true,
@@ -218,17 +253,35 @@ describe("Video", () => {
218
253
  constraints: null
219
254
  }
220
255
  });
221
- const startButton = getByTestId("test-player") as HTMLVideoElement;
256
+ let startButton = getByTestId("test-player") as HTMLVideoElement;
222
257
  const fn = spyOn(startButton, "play");
223
258
  startButton.dispatchEvent(new Event("loadeddata"));
224
- component.$set({
259
+ assert.equal(fn.callCount, 1);
260
+ unmount();
261
+
262
+ const result = await render(Video, {
263
+ show_label: true,
264
+ loading_status,
265
+ interactive: true,
225
266
  value: {
226
267
  path: "https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/demo/video_component/files/a.mp4",
227
268
  url: "https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/demo/video_component/files/a.mp4"
269
+ },
270
+ root: "foo",
271
+ proxy_url: null,
272
+ streaming: false,
273
+ pending: false,
274
+ sources: ["upload"],
275
+ autoplay: true,
276
+ webcam_options: {
277
+ mirror: true,
278
+ constraints: null
228
279
  }
229
280
  });
281
+ startButton = result.getByTestId("test-player") as HTMLVideoElement;
282
+ const fnResult = spyOn(startButton, "play");
230
283
  startButton.dispatchEvent(new Event("loadeddata"));
231
- assert.equal(fn.callCount, 2);
284
+ assert.equal(fnResult.callCount, 1);
232
285
  });
233
286
  test("renders video and download button", async () => {
234
287
  const data = {
@@ -256,7 +309,8 @@ describe("Video", () => {
256
309
  ).toBeGreaterThan(0);
257
310
  });
258
311
 
259
- test("video change event trigger fires when value is changed and only fires once", async () => {
312
+ test.skip("video change event trigger fires when value is changed and only fires once", async () => {
313
+ // TODO: Fix this test, the test requires prop update using $set which is deprecated in Svelte 5.
260
314
  const { component, listen } = await render(Video, {
261
315
  show_label: true,
262
316
  loading_status,
package/dist/Index.svelte CHANGED
@@ -89,7 +89,7 @@
89
89
  autoscroll={gradio.shared.autoscroll}
90
90
  i18n={gradio.i18n}
91
91
  {...gradio.shared.loading_status}
92
- on:clear_status={() =>
92
+ on_clear_status={() =>
93
93
  gradio.dispatch("clear_status", gradio.shared.loading_status)}
94
94
  />
95
95
 
@@ -135,7 +135,7 @@
135
135
  autoscroll={gradio.shared.autoscroll}
136
136
  i18n={gradio.i18n}
137
137
  {...gradio.shared.loading_status}
138
- on:clear_status={() =>
138
+ on_clear_status={() =>
139
139
  gradio.dispatch("clear_status", gradio.shared.loading_status)}
140
140
  />
141
141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/video",
3
- "version": "0.17.0-dev.2",
3
+ "version": "0.17.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -11,16 +11,16 @@
11
11
  "@ffmpeg/util": "^0.12.2",
12
12
  "hls.js": "^1.6.13",
13
13
  "mrmime": "^2.0.1",
14
- "@gradio/atoms": "^0.19.0-dev.1",
15
- "@gradio/icons": "^0.15.0-dev.0",
16
- "@gradio/client": "^2.0.0-dev.2",
17
- "@gradio/image": "^0.24.0-dev.2",
18
- "@gradio/statustracker": "^0.12.0-dev.1",
19
- "@gradio/upload": "^0.17.2-dev.2",
20
- "@gradio/utils": "^0.10.3-dev.0"
14
+ "@gradio/client": "^2.0.0",
15
+ "@gradio/icons": "^0.15.0",
16
+ "@gradio/atoms": "^0.19.0",
17
+ "@gradio/image": "^0.24.0",
18
+ "@gradio/statustracker": "^0.12.0",
19
+ "@gradio/upload": "^0.17.2",
20
+ "@gradio/utils": "^0.10.3"
21
21
  },
22
22
  "devDependencies": {
23
- "@gradio/preview": "^0.15.0-dev.0"
23
+ "@gradio/preview": "^0.15.0"
24
24
  },
25
25
  "exports": {
26
26
  "./package.json": "./package.json",