@gradio/video 0.20.8 → 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 +34 -0
- package/Video.stories.svelte +0 -37
- package/Video.test.ts +1 -1
- package/dist/shared/Player.svelte +6 -2
- package/dist/shared/Video.svelte +1 -0
- package/dist/shared/Video.svelte.d.ts +1 -0
- package/dist/shared/VolumeControl.svelte +4 -4
- package/dist/shared/utils.js +4 -2
- package/dist/types.d.ts +1 -1
- package/package.json +7 -7
- package/shared/Player.svelte +6 -2
- package/shared/Video.svelte +1 -0
- package/shared/VolumeControl.svelte +4 -4
- package/shared/utils.ts +6 -2
- package/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
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
|
+
|
|
24
|
+
## 0.20.9
|
|
25
|
+
|
|
26
|
+
### Fixes
|
|
27
|
+
|
|
28
|
+
- [#13463](https://github.com/gradio-app/gradio/pull/13463) [`58088ad`](https://github.com/gradio-app/gradio/commit/58088ad1d75eee0f93ba1c02f427ee04f60847b4) - Self-host frontend assets so that Gradio works offline!. Thanks @abidlabs!
|
|
29
|
+
|
|
30
|
+
## 0.20.8
|
|
31
|
+
|
|
32
|
+
### Dependency updates
|
|
33
|
+
|
|
34
|
+
- @gradio/client@2.2.1
|
|
35
|
+
- @gradio/upload@0.17.10
|
|
36
|
+
|
|
3
37
|
## 0.20.8
|
|
4
38
|
|
|
5
39
|
### Dependency updates
|
package/Video.stories.svelte
CHANGED
|
@@ -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 =
|
|
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 (
|
|
192
|
+
if (
|
|
193
|
+
playback_position !== undefined &&
|
|
194
|
+
playback_position !== time &&
|
|
195
|
+
video
|
|
196
|
+
) {
|
|
193
197
|
video.currentTime = playback_position;
|
|
194
198
|
}
|
|
195
199
|
});
|
package/dist/shared/Video.svelte
CHANGED
|
@@ -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(
|
|
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/dist/shared/utils.js
CHANGED
|
@@ -33,7 +33,8 @@ export function loaded(node, { autoplay }) {
|
|
|
33
33
|
}
|
|
34
34
|
export default async function loadFfmpeg() {
|
|
35
35
|
const ffmpeg = new FFmpeg();
|
|
36
|
-
const
|
|
36
|
+
const root = (typeof window !== "undefined" && window.gradio_config?.root) || "";
|
|
37
|
+
const baseURL = `${root}/static/ffmpeg`;
|
|
37
38
|
await ffmpeg.load({
|
|
38
39
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
|
39
40
|
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, "application/wasm")
|
|
@@ -73,7 +74,8 @@ export async function trimVideo(ffmpeg, startTime, endTime, videoElement) {
|
|
|
73
74
|
];
|
|
74
75
|
await ffmpeg.exec(command);
|
|
75
76
|
const outputData = await ffmpeg.readFile(outputName);
|
|
76
|
-
const
|
|
77
|
+
const outputBytes = typeof outputData === "string" ? outputData : new Uint8Array(outputData);
|
|
78
|
+
const outputBlob = new Blob([outputBytes], {
|
|
77
79
|
type: `video/${type}`
|
|
78
80
|
});
|
|
79
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.
|
|
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/
|
|
15
|
-
"@gradio/
|
|
14
|
+
"@gradio/atoms": "^0.25.0",
|
|
15
|
+
"@gradio/client": "^2.3.0",
|
|
16
16
|
"@gradio/icons": "^0.15.1",
|
|
17
|
-
"@gradio/image": "^0.
|
|
18
|
-
"@gradio/
|
|
19
|
-
"@gradio/
|
|
20
|
-
"@gradio/utils": "^0.
|
|
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"
|
package/shared/Player.svelte
CHANGED
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
handle_change = () => {},
|
|
52
52
|
handle_reset_value = () => {},
|
|
53
53
|
upload,
|
|
54
|
-
is_stream =
|
|
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 (
|
|
192
|
+
if (
|
|
193
|
+
playback_position !== undefined &&
|
|
194
|
+
playback_position !== time &&
|
|
195
|
+
video
|
|
196
|
+
) {
|
|
193
197
|
video.currentTime = playback_position;
|
|
194
198
|
}
|
|
195
199
|
});
|
package/shared/Video.svelte
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
|
-
current_volume = $bindable(
|
|
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
|
@@ -41,7 +41,9 @@ export function loaded(
|
|
|
41
41
|
|
|
42
42
|
export default async function loadFfmpeg(): Promise<FFmpeg> {
|
|
43
43
|
const ffmpeg = new FFmpeg();
|
|
44
|
-
const
|
|
44
|
+
const root =
|
|
45
|
+
(typeof window !== "undefined" && window.gradio_config?.root) || "";
|
|
46
|
+
const baseURL = `${root}/static/ffmpeg`;
|
|
45
47
|
|
|
46
48
|
await ffmpeg.load({
|
|
47
49
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
|
@@ -97,7 +99,9 @@ export async function trimVideo(
|
|
|
97
99
|
|
|
98
100
|
await ffmpeg.exec(command);
|
|
99
101
|
const outputData = await ffmpeg.readFile(outputName);
|
|
100
|
-
const
|
|
102
|
+
const outputBytes =
|
|
103
|
+
typeof outputData === "string" ? outputData : new Uint8Array(outputData);
|
|
104
|
+
const outputBlob = new Blob([outputBytes], {
|
|
101
105
|
type: `video/${type}`
|
|
102
106
|
});
|
|
103
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
|
|