@gradio/video 0.20.9 → 0.21.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,26 @@
1
1
  # @gradio/video
2
2
 
3
+ ## 0.21.0
4
+
5
+ ### Features
6
+
7
+ - [#13526](https://github.com/gradio-app/gradio/pull/13526) [`53cb4ca`](https://github.com/gradio-app/gradio/commit/53cb4cae1ec3521e9170d12867253516413ba37a) - Run `pnpm lint` and `pnpm ts:check` on CI. Thanks @abidlabs!
8
+
9
+ ### Dependency updates
10
+
11
+ - @gradio/atoms@0.25.0
12
+ - @gradio/statustracker@0.15.0
13
+ - @gradio/utils@0.13.0
14
+ - @gradio/client@2.3.0
15
+ - @gradio/upload@0.18.0
16
+ - @gradio/image@0.27.0
17
+
18
+ ## 0.20.9
19
+
20
+ ### Dependency updates
21
+
22
+ - @gradio/client@2.2.2
23
+
3
24
  ## 0.20.9
4
25
 
5
26
  ### Fixes
@@ -56,24 +56,6 @@
56
56
  }}
57
57
  {template}
58
58
  />
59
- <Story
60
- name="Static video with vertical video"
61
- args={{
62
- value: {
63
- path: video_sample,
64
- url: video_sample,
65
- orig_name: "video_sample.mp4"
66
- },
67
- label: "world video",
68
- show_label: true,
69
- buttons: [],
70
- interactive: false,
71
- height: 200,
72
- width: 400,
73
- webcam_options: { mirror: true, constraints: null }
74
- }}
75
- {template}
76
- />
77
59
  <Story
78
60
  name="Upload video"
79
61
  args={{
@@ -88,25 +70,6 @@
88
70
  }}
89
71
  {template}
90
72
  />
91
- <Story
92
- name="Upload video with download button"
93
- args={{
94
- label: "world video",
95
- show_label: true,
96
- interactive: true,
97
- sources: ["upload", "webcam"],
98
- buttons: ["download"],
99
- width: 400,
100
- height: 400,
101
- value: {
102
- path: video_sample,
103
- url: video_sample,
104
- orig_name: "video_sample.mp4"
105
- },
106
- webcam_options: { mirror: true, constraints: null }
107
- }}
108
- {template}
109
- />
110
73
  <Story
111
74
  name="Trim video"
112
75
  args={{
package/Video.test.ts CHANGED
@@ -37,7 +37,7 @@ vi.mock("@ffmpeg/util", () => ({
37
37
  }));
38
38
 
39
39
  import Video from "./Index.svelte";
40
- import type { LoadingStatus } from "@gradio/statustracker";
40
+ import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
41
41
 
42
42
  const loading_status: LoadingStatus = {
43
43
  eta: 0,
@@ -51,7 +51,7 @@
51
51
  handle_change = () => {},
52
52
  handle_reset_value = () => {},
53
53
  upload,
54
- is_stream = undefined,
54
+ is_stream = false,
55
55
  i18n,
56
56
  show_download_button = false,
57
57
  value = null,
@@ -189,7 +189,11 @@
189
189
  });
190
190
 
191
191
  $effect(() => {
192
- if (playback_position !== time && video) {
192
+ if (
193
+ playback_position !== undefined &&
194
+ playback_position !== time &&
195
+ video
196
+ ) {
193
197
  video.currentTime = playback_position;
194
198
  }
195
199
  });
@@ -33,6 +33,7 @@
33
33
  onloadedmetadata?: () => void;
34
34
  "data-testid"?: string;
35
35
  children?: Snippet;
36
+ [key: string]: any;
36
37
  }
37
38
 
38
39
  let {
@@ -28,6 +28,7 @@ interface Props {
28
28
  onloadedmetadata?: () => void;
29
29
  "data-testid"?: string;
30
30
  children?: Snippet;
31
+ [key: string]: any;
31
32
  }
32
33
  declare const Video: import("svelte").Component<Props, {}, "currentTime" | "duration" | "paused" | "node">;
33
34
  type Video = ReturnType<typeof Video>;
@@ -7,7 +7,7 @@
7
7
  }
8
8
 
9
9
  let {
10
- current_volume = $bindable(1),
10
+ current_volume = $bindable(),
11
11
  show_volume_slider = $bindable(false)
12
12
  }: Props = $props();
13
13
 
@@ -22,8 +22,8 @@
22
22
  if (!slider) return;
23
23
 
24
24
  slider.style.background = `linear-gradient(to right, white ${
25
- current_volume * 100
26
- }%, rgba(255, 255, 255, 0.3) ${current_volume * 100}%)`;
25
+ (current_volume ?? 1) * 100
26
+ }%, rgba(255, 255, 255, 0.3) ${(current_volume ?? 1) * 100}%)`;
27
27
  };
28
28
 
29
29
  $effect(() => {
@@ -40,7 +40,7 @@
40
40
  min="0"
41
41
  max="1"
42
42
  step="0.01"
43
- value={current_volume}
43
+ value={current_volume ?? 1}
44
44
  onfocusout={() => (show_volume_slider = false)}
45
45
  oninput={(e) => {
46
46
  if (e.target instanceof HTMLInputElement) {
@@ -74,7 +74,8 @@ export async function trimVideo(ffmpeg, startTime, endTime, videoElement) {
74
74
  ];
75
75
  await ffmpeg.exec(command);
76
76
  const outputData = await ffmpeg.readFile(outputName);
77
- const outputBlob = new Blob([outputData], {
77
+ const outputBytes = typeof outputData === "string" ? outputData : new Uint8Array(outputData);
78
+ const outputBlob = new Blob([outputBytes], {
78
79
  type: `video/${type}`
79
80
  });
80
81
  return outputBlob;
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { FileData } from "@gradio/client";
2
- import type { LoadingStatus } from "@gradio/statustracker";
2
+ import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
3
3
  import type { CustomButton } from "@gradio/utils";
4
4
  import type { WebcamOptions } from "./shared/utils";
5
5
  export interface VideoProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/video",
3
- "version": "0.20.9",
3
+ "version": "0.21.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -11,13 +11,13 @@
11
11
  "@ffmpeg/util": "^0.12.2",
12
12
  "hls.js": "^1.6.13",
13
13
  "mrmime": "^2.0.1",
14
- "@gradio/client": "^2.2.1",
15
- "@gradio/atoms": "^0.24.0",
16
- "@gradio/image": "^0.26.3",
14
+ "@gradio/atoms": "^0.25.0",
15
+ "@gradio/client": "^2.3.0",
17
16
  "@gradio/icons": "^0.15.1",
18
- "@gradio/statustracker": "^0.14.1",
19
- "@gradio/upload": "^0.17.10",
20
- "@gradio/utils": "^0.12.2"
17
+ "@gradio/image": "^0.27.0",
18
+ "@gradio/statustracker": "^0.15.0",
19
+ "@gradio/upload": "^0.18.0",
20
+ "@gradio/utils": "^0.13.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@gradio/preview": "^0.16.2"
@@ -51,7 +51,7 @@
51
51
  handle_change = () => {},
52
52
  handle_reset_value = () => {},
53
53
  upload,
54
- is_stream = undefined,
54
+ is_stream = false,
55
55
  i18n,
56
56
  show_download_button = false,
57
57
  value = null,
@@ -189,7 +189,11 @@
189
189
  });
190
190
 
191
191
  $effect(() => {
192
- if (playback_position !== time && video) {
192
+ if (
193
+ playback_position !== undefined &&
194
+ playback_position !== time &&
195
+ video
196
+ ) {
193
197
  video.currentTime = playback_position;
194
198
  }
195
199
  });
@@ -33,6 +33,7 @@
33
33
  onloadedmetadata?: () => void;
34
34
  "data-testid"?: string;
35
35
  children?: Snippet;
36
+ [key: string]: any;
36
37
  }
37
38
 
38
39
  let {
@@ -7,7 +7,7 @@
7
7
  }
8
8
 
9
9
  let {
10
- current_volume = $bindable(1),
10
+ current_volume = $bindable(),
11
11
  show_volume_slider = $bindable(false)
12
12
  }: Props = $props();
13
13
 
@@ -22,8 +22,8 @@
22
22
  if (!slider) return;
23
23
 
24
24
  slider.style.background = `linear-gradient(to right, white ${
25
- current_volume * 100
26
- }%, rgba(255, 255, 255, 0.3) ${current_volume * 100}%)`;
25
+ (current_volume ?? 1) * 100
26
+ }%, rgba(255, 255, 255, 0.3) ${(current_volume ?? 1) * 100}%)`;
27
27
  };
28
28
 
29
29
  $effect(() => {
@@ -40,7 +40,7 @@
40
40
  min="0"
41
41
  max="1"
42
42
  step="0.01"
43
- value={current_volume}
43
+ value={current_volume ?? 1}
44
44
  onfocusout={() => (show_volume_slider = false)}
45
45
  oninput={(e) => {
46
46
  if (e.target instanceof HTMLInputElement) {
package/shared/utils.ts CHANGED
@@ -99,7 +99,9 @@ export async function trimVideo(
99
99
 
100
100
  await ffmpeg.exec(command);
101
101
  const outputData = await ffmpeg.readFile(outputName);
102
- const outputBlob = new Blob([outputData], {
102
+ const outputBytes =
103
+ typeof outputData === "string" ? outputData : new Uint8Array(outputData);
104
+ const outputBlob = new Blob([outputBytes], {
103
105
  type: `video/${type}`
104
106
  });
105
107
 
package/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { FileData } from "@gradio/client";
2
- import type { LoadingStatus } from "@gradio/statustracker";
2
+ import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
3
3
  import type { CustomButton } from "@gradio/utils";
4
4
  import type { WebcamOptions } from "./shared/utils";
5
5