@gradio/video 0.1.0-beta.6 → 0.1.0-beta.9
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 -4
- package/Index.svelte +40 -8
- package/README.md +38 -6
- package/Video.test.ts +72 -89
- package/index.ts +7 -0
- package/package.json +13 -11
- package/shared/InteractiveVideo.svelte +80 -21
- package/shared/Player.svelte +28 -1
- package/shared/Video.svelte +56 -0
- package/shared/VideoControls.svelte +214 -0
- package/shared/VideoPreview.svelte +16 -12
- package/shared/VideoTimeline.svelte +270 -0
- package/shared/utils.ts +107 -2
- package/shared/StaticVideo.svelte +0 -70
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,48 @@
|
|
1
1
|
# @gradio/video
|
2
2
|
|
3
|
+
## 0.1.0-beta.9
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- [#6143](https://github.com/gradio-app/gradio/pull/6143) [`e4f7b4b40`](https://github.com/gradio-app/gradio/commit/e4f7b4b409323b01aa01b39e15ce6139e29aa073) - fix circular dependency with client + upload. Thanks [@pngwn](https://github.com/pngwn)!
|
8
|
+
- [#6136](https://github.com/gradio-app/gradio/pull/6136) [`667802a6c`](https://github.com/gradio-app/gradio/commit/667802a6cdbfb2ce454a3be5a78e0990b194548a) - JS Component Documentation. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
9
|
+
- [#6094](https://github.com/gradio-app/gradio/pull/6094) [`c476bd5a5`](https://github.com/gradio-app/gradio/commit/c476bd5a5b70836163b9c69bf4bfe068b17fbe13) - Image v4. Thanks [@pngwn](https://github.com/pngwn)!
|
10
|
+
- [#6149](https://github.com/gradio-app/gradio/pull/6149) [`90318b1dd`](https://github.com/gradio-app/gradio/commit/90318b1dd118ae08a695a50e7c556226234ab6dc) - swap `mode` on the frontned to `interactive` to match the backend. Thanks [@pngwn](https://github.com/pngwn)!
|
11
|
+
- [#6118](https://github.com/gradio-app/gradio/pull/6118) [`88bccfdba`](https://github.com/gradio-app/gradio/commit/88bccfdba3df2df4b2747ea5d649ed528047cf50) - Improve Video Component. Thanks [@hannahblair](https://github.com/hannahblair)!
|
12
|
+
- [#6140](https://github.com/gradio-app/gradio/pull/6140) [`71bf2702c`](https://github.com/gradio-app/gradio/commit/71bf2702cd5b810c89e2e53452532650acdcfb87) - Fix video. Thanks [@abidlabs](https://github.com/abidlabs)!
|
13
|
+
|
14
|
+
## 0.1.0-beta.8
|
15
|
+
|
16
|
+
### Features
|
17
|
+
|
18
|
+
- [#6016](https://github.com/gradio-app/gradio/pull/6016) [`83e947676`](https://github.com/gradio-app/gradio/commit/83e947676d327ca2ab6ae2a2d710c78961c771a0) - Format js in v4 branch. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
19
|
+
|
20
|
+
### Fixes
|
21
|
+
|
22
|
+
- [#6067](https://github.com/gradio-app/gradio/pull/6067) [`bf38e5f06`](https://github.com/gradio-app/gradio/commit/bf38e5f06a7039be913614901c308794fea83ae0) - remove dupe component. Thanks [@pngwn](https://github.com/pngwn)!
|
23
|
+
- [#6046](https://github.com/gradio-app/gradio/pull/6046) [`dbb7de5e0`](https://github.com/gradio-app/gradio/commit/dbb7de5e02c53fee05889d696d764d212cb96c74) - fix tests. Thanks [@pngwn](https://github.com/pngwn)!
|
24
|
+
|
25
|
+
## 0.1.0-beta.7
|
26
|
+
|
27
|
+
### Patch Changes
|
28
|
+
|
29
|
+
- Updated dependencies [[`174b73619`](https://github.com/gradio-app/gradio/commit/174b736194756e23f51bbaf6f850bac5f1ca95b5), [`5fbda0bd2`](https://github.com/gradio-app/gradio/commit/5fbda0bd2b2bbb2282249b8875d54acf87cd7e84)]:
|
30
|
+
- @gradio/wasm@0.2.0-beta.1
|
31
|
+
- @gradio/image@0.3.0-beta.7
|
32
|
+
|
3
33
|
## 0.1.0-beta.6
|
4
34
|
|
5
35
|
### Features
|
6
36
|
|
7
|
-
- [#5960](https://github.com/gradio-app/gradio/pull/5960) [`319c30f3f`](https://github.com/gradio-app/gradio/commit/319c30f3fccf23bfe1da6c9b132a6a99d59652f7) - rererefactor frontend files.
|
8
|
-
- [#5938](https://github.com/gradio-app/gradio/pull/5938) [`13ed8a485`](https://github.com/gradio-app/gradio/commit/13ed8a485d5e31d7d75af87fe8654b661edcca93) - V4: Use beta release versions for '@gradio' packages.
|
37
|
+
- [#5960](https://github.com/gradio-app/gradio/pull/5960) [`319c30f3f`](https://github.com/gradio-app/gradio/commit/319c30f3fccf23bfe1da6c9b132a6a99d59652f7) - rererefactor frontend files. Thanks [@pngwn](https://github.com/pngwn)!
|
38
|
+
- [#5938](https://github.com/gradio-app/gradio/pull/5938) [`13ed8a485`](https://github.com/gradio-app/gradio/commit/13ed8a485d5e31d7d75af87fe8654b661edcca93) - V4: Use beta release versions for '@gradio' packages. Thanks [@freddyaboulton](https://github.com/freddyaboulton)!
|
9
39
|
|
10
40
|
## 0.1.0
|
11
41
|
|
12
42
|
### Features
|
13
43
|
|
14
|
-
- [#5627](https://github.com/gradio-app/gradio/pull/5627) [`b67115e8e`](https://github.com/gradio-app/gradio/commit/b67115e8e6e489fffd5271ea830211863241ddc5) - Lite: Make the Examples component display media files using pseudo HTTP requests to the Wasm server.
|
15
|
-
- [#5934](https://github.com/gradio-app/gradio/pull/5934) [`8d909624f`](https://github.com/gradio-app/gradio/commit/8d909624f61a49536e3c0f71cb2d9efe91216219) - Fix styling issues with Audio, Image and Video components.
|
44
|
+
- [#5627](https://github.com/gradio-app/gradio/pull/5627) [`b67115e8e`](https://github.com/gradio-app/gradio/commit/b67115e8e6e489fffd5271ea830211863241ddc5) - Lite: Make the Examples component display media files using pseudo HTTP requests to the Wasm server. Thanks [@whitphx](https://github.com/whitphx)!
|
45
|
+
- [#5934](https://github.com/gradio-app/gradio/pull/5934) [`8d909624f`](https://github.com/gradio-app/gradio/commit/8d909624f61a49536e3c0f71cb2d9efe91216219) - Fix styling issues with Audio, Image and Video components. Thanks [@aliabd](https://github.com/aliabd)!
|
16
46
|
|
17
47
|
## 0.0.11
|
18
48
|
|
package/Index.svelte
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
<script lang="ts">
|
4
4
|
import type { Gradio, ShareData } from "@gradio/utils";
|
5
|
-
|
6
|
-
import { normalise_file } from "@gradio/
|
5
|
+
|
6
|
+
import { normalise_file, type FileData } from "@gradio/client";
|
7
7
|
import { Block, UploadText } from "@gradio/atoms";
|
8
8
|
import StaticVideo from "./shared/VideoPreview.svelte";
|
9
9
|
import Video from "./shared/InteractiveVideo.svelte";
|
@@ -18,7 +18,11 @@
|
|
18
18
|
let old_value: { video: FileData; subtitles: FileData | null } | null = null;
|
19
19
|
|
20
20
|
export let label: string;
|
21
|
-
export let
|
21
|
+
export let sources:
|
22
|
+
| ["webcam"]
|
23
|
+
| ["upload"]
|
24
|
+
| ["webcam", "upload"]
|
25
|
+
| ["upload", "webcam"];
|
22
26
|
export let root: string;
|
23
27
|
export let root_url: null | string;
|
24
28
|
export let show_label: boolean;
|
@@ -44,13 +48,38 @@
|
|
44
48
|
share: ShareData;
|
45
49
|
error: string;
|
46
50
|
}>;
|
47
|
-
export let
|
51
|
+
export let interactive: boolean;
|
48
52
|
export let mirror_webcam: boolean;
|
49
53
|
export let include_audio: boolean;
|
50
54
|
|
51
55
|
let _video: FileData | null = null;
|
52
56
|
let _subtitle: FileData | null = null;
|
53
57
|
|
58
|
+
let active_source: "webcam" | "upload";
|
59
|
+
|
60
|
+
let initial_value: { video: FileData; subtitles: FileData | null } | null =
|
61
|
+
value;
|
62
|
+
|
63
|
+
$: if (value && initial_value === null) {
|
64
|
+
initial_value = value;
|
65
|
+
}
|
66
|
+
|
67
|
+
const handle_reset_value = (): void => {
|
68
|
+
if (initial_value === null || value === initial_value) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
|
72
|
+
value = initial_value;
|
73
|
+
};
|
74
|
+
|
75
|
+
$: if (sources) {
|
76
|
+
if (sources.length > 1) {
|
77
|
+
active_source = "upload";
|
78
|
+
} else {
|
79
|
+
active_source = sources[0];
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
54
83
|
$: {
|
55
84
|
if (value != null) {
|
56
85
|
_video = normalise_file(value.video, root, root_url);
|
@@ -82,10 +111,10 @@
|
|
82
111
|
}
|
83
112
|
</script>
|
84
113
|
|
85
|
-
{#if
|
114
|
+
{#if !interactive}
|
86
115
|
<Block
|
87
116
|
{visible}
|
88
|
-
variant={value === null &&
|
117
|
+
variant={value === null && active_source === "upload" ? "dashed" : "solid"}
|
89
118
|
border_mode={dragging ? "focus" : "base"}
|
90
119
|
padding={false}
|
91
120
|
{elem_id}
|
@@ -110,6 +139,7 @@
|
|
110
139
|
{show_label}
|
111
140
|
{autoplay}
|
112
141
|
{show_share_button}
|
142
|
+
show_download_button={true}
|
113
143
|
on:play={() => gradio.dispatch("play")}
|
114
144
|
on:pause={() => gradio.dispatch("pause")}
|
115
145
|
on:stop={() => gradio.dispatch("stop")}
|
@@ -122,7 +152,7 @@
|
|
122
152
|
{:else}
|
123
153
|
<Block
|
124
154
|
{visible}
|
125
|
-
variant={value === null &&
|
155
|
+
variant={value === null && active_source === "upload" ? "dashed" : "solid"}
|
126
156
|
border_mode={dragging ? "focus" : "base"}
|
127
157
|
padding={false}
|
128
158
|
{elem_id}
|
@@ -152,11 +182,13 @@
|
|
152
182
|
}}
|
153
183
|
{label}
|
154
184
|
{show_label}
|
155
|
-
{
|
185
|
+
{sources}
|
186
|
+
{active_source}
|
156
187
|
{mirror_webcam}
|
157
188
|
{include_audio}
|
158
189
|
{autoplay}
|
159
190
|
{root}
|
191
|
+
{handle_reset_value}
|
160
192
|
on:clear={() => gradio.dispatch("clear")}
|
161
193
|
on:play={() => gradio.dispatch("play")}
|
162
194
|
on:pause={() => gradio.dispatch("pause")}
|
package/README.md
CHANGED
@@ -1,11 +1,43 @@
|
|
1
|
-
# `@gradio/
|
1
|
+
# `@gradio/video`
|
2
2
|
|
3
|
-
```
|
3
|
+
```javascript
|
4
4
|
<script>
|
5
|
-
import {
|
5
|
+
import { BaseInteractiveVideo, BaseStaticVideo, BasePlayer } from "@gradio/button";
|
6
|
+
import type { FileData } from "@gradio/upload";
|
7
|
+
import type { Gradio } from "@gradio/utils";
|
8
|
+
export let _video: FileData;
|
6
9
|
</script>
|
7
10
|
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
+
<StaticVideo
|
12
|
+
value={_video}
|
13
|
+
{label}
|
14
|
+
{show_label}
|
15
|
+
{autoplay}
|
16
|
+
{show_share_button}
|
17
|
+
i18n={gradio.i18n}
|
18
|
+
/>
|
19
|
+
|
20
|
+
<Video
|
21
|
+
value={_video}
|
22
|
+
{label}
|
23
|
+
{show_label}
|
24
|
+
source={"upload"}
|
25
|
+
{mirror_webcam}
|
26
|
+
{include_audio}
|
27
|
+
{autoplay}
|
28
|
+
i18n={gradio.i18n}
|
29
|
+
>
|
30
|
+
<p>Upload Video Here</p>
|
31
|
+
</Video>
|
32
|
+
|
33
|
+
<BasePlayer
|
34
|
+
src={value.data}
|
35
|
+
{autoplay}
|
36
|
+
on:play
|
37
|
+
on:pause
|
38
|
+
on:stop
|
39
|
+
on:end
|
40
|
+
mirror={false}
|
41
|
+
{label}
|
42
|
+
/>
|
11
43
|
```
|
package/Video.test.ts
CHANGED
@@ -12,8 +12,7 @@ import { spy, spyOn } from "tinyspy";
|
|
12
12
|
import { cleanup, render } from "@gradio/tootils";
|
13
13
|
import { setupi18n } from "../app/src/i18n";
|
14
14
|
|
15
|
-
import
|
16
|
-
import StaticVideo from "./static";
|
15
|
+
import Video from "./Index.svelte";
|
17
16
|
|
18
17
|
import type { LoadingStatus } from "@gradio/statustracker";
|
19
18
|
|
@@ -37,23 +36,22 @@ describe("Video", () => {
|
|
37
36
|
afterEach(() => cleanup());
|
38
37
|
|
39
38
|
test("renders provided value and label", async () => {
|
40
|
-
const { getByTestId, queryAllByText } = await render(
|
39
|
+
const { getByTestId, queryAllByText } = await render(Video, {
|
41
40
|
show_label: true,
|
42
41
|
loading_status,
|
43
|
-
value:
|
44
|
-
{
|
45
|
-
|
46
|
-
data: null,
|
47
|
-
is_file: true
|
42
|
+
value: {
|
43
|
+
video: {
|
44
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
48
45
|
}
|
49
|
-
|
46
|
+
},
|
50
47
|
label: "Test Label",
|
51
48
|
root: "foo",
|
52
49
|
root_url: null,
|
53
50
|
streaming: false,
|
54
51
|
pending: false,
|
55
52
|
name: "bar",
|
56
|
-
|
53
|
+
sources: ["upload"],
|
54
|
+
interactive: true
|
57
55
|
});
|
58
56
|
let vid = getByTestId("Test Label-player") as HTMLVideoElement;
|
59
57
|
assert.equal(
|
@@ -64,13 +62,13 @@ describe("Video", () => {
|
|
64
62
|
});
|
65
63
|
|
66
64
|
test("hides label", async () => {
|
67
|
-
const { queryAllByText } = await render(
|
65
|
+
const { queryAllByText } = await render(Video, {
|
68
66
|
show_label: false,
|
69
67
|
loading_status,
|
70
68
|
value: {
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
video: {
|
70
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
71
|
+
}
|
74
72
|
},
|
75
73
|
label: "Video Component",
|
76
74
|
root: "foo",
|
@@ -78,28 +76,28 @@ describe("Video", () => {
|
|
78
76
|
streaming: false,
|
79
77
|
pending: false,
|
80
78
|
name: "bar",
|
81
|
-
|
79
|
+
sources: ["upload"],
|
80
|
+
interactive: true
|
82
81
|
});
|
83
82
|
assert.equal(queryAllByText("Video Component").length, 1);
|
84
83
|
});
|
85
84
|
|
86
85
|
test("static Video sets value", async () => {
|
87
|
-
const { getByTestId } = await render(
|
86
|
+
const { getByTestId } = await render(Video, {
|
88
87
|
show_label: true,
|
89
88
|
loading_status,
|
90
|
-
value:
|
91
|
-
{
|
92
|
-
|
93
|
-
data: null,
|
94
|
-
is_file: true
|
89
|
+
value: {
|
90
|
+
video: {
|
91
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
95
92
|
}
|
96
|
-
|
93
|
+
},
|
97
94
|
root: "foo",
|
98
95
|
root_url: null,
|
99
96
|
streaming: false,
|
100
97
|
pending: false,
|
101
98
|
name: "bar",
|
102
|
-
|
99
|
+
sources: ["upload"],
|
100
|
+
mode: "static"
|
103
101
|
});
|
104
102
|
let vid = getByTestId("test-player") as HTMLVideoElement;
|
105
103
|
assert.equal(
|
@@ -109,22 +107,20 @@ describe("Video", () => {
|
|
109
107
|
});
|
110
108
|
|
111
109
|
test("when autoplay is true `media.play` should be called in static mode", async () => {
|
112
|
-
const { getByTestId } = await render(
|
110
|
+
const { getByTestId } = await render(Video, {
|
113
111
|
show_label: true,
|
114
112
|
loading_status,
|
115
|
-
|
116
|
-
value:
|
117
|
-
{
|
118
|
-
|
119
|
-
data: null,
|
120
|
-
is_file: true
|
113
|
+
interactive: false,
|
114
|
+
value: {
|
115
|
+
video: {
|
116
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
121
117
|
}
|
122
|
-
|
118
|
+
},
|
123
119
|
root: "foo",
|
124
120
|
root_url: null,
|
125
121
|
streaming: false,
|
126
122
|
pending: false,
|
127
|
-
|
123
|
+
sources: ["upload"],
|
128
124
|
autoplay: true
|
129
125
|
});
|
130
126
|
const startButton = getByTestId("test-player") as HTMLVideoElement;
|
@@ -134,21 +130,19 @@ describe("Video", () => {
|
|
134
130
|
});
|
135
131
|
|
136
132
|
test("when autoplay is true `media.play` should be called in dynamic mode", async () => {
|
137
|
-
const { getByTestId } = await render(
|
133
|
+
const { getByTestId } = await render(Video, {
|
138
134
|
show_label: true,
|
139
135
|
loading_status,
|
140
|
-
value:
|
141
|
-
{
|
142
|
-
|
143
|
-
data: null,
|
144
|
-
is_file: true
|
136
|
+
value: {
|
137
|
+
video: {
|
138
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
145
139
|
}
|
146
|
-
|
140
|
+
},
|
147
141
|
root: "foo",
|
148
142
|
root_url: null,
|
149
143
|
streaming: false,
|
150
144
|
pending: false,
|
151
|
-
|
145
|
+
sources: ["upload"],
|
152
146
|
autoplay: true
|
153
147
|
});
|
154
148
|
const startButton = getByTestId("test-player") as HTMLVideoElement;
|
@@ -158,116 +152,107 @@ describe("Video", () => {
|
|
158
152
|
});
|
159
153
|
|
160
154
|
test("when autoplay is true `media.play` should be called in static mode when the Video data is updated", async () => {
|
161
|
-
const { component, getByTestId } = await render(
|
155
|
+
const { component, getByTestId } = await render(Video, {
|
162
156
|
show_label: true,
|
163
157
|
loading_status,
|
164
|
-
|
165
|
-
value:
|
166
|
-
{
|
167
|
-
|
168
|
-
data: null,
|
169
|
-
is_file: true
|
158
|
+
interactive: false,
|
159
|
+
value: {
|
160
|
+
video: {
|
161
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
170
162
|
}
|
171
|
-
|
163
|
+
},
|
172
164
|
root: "foo",
|
173
165
|
root_url: null,
|
174
166
|
streaming: false,
|
175
167
|
pending: false,
|
176
|
-
|
168
|
+
sources: ["upload"],
|
177
169
|
autoplay: true
|
178
170
|
});
|
179
171
|
const startButton = getByTestId("test-player") as HTMLVideoElement;
|
180
172
|
const fn = spyOn(startButton, "play");
|
181
173
|
startButton.dispatchEvent(new Event("loadeddata"));
|
182
174
|
component.$set({
|
183
|
-
value:
|
184
|
-
{
|
185
|
-
|
186
|
-
data: null,
|
187
|
-
is_file: true
|
175
|
+
value: {
|
176
|
+
video: {
|
177
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
188
178
|
}
|
189
|
-
|
179
|
+
}
|
190
180
|
});
|
191
181
|
startButton.dispatchEvent(new Event("loadeddata"));
|
192
182
|
assert.equal(fn.callCount, 2);
|
193
183
|
});
|
194
184
|
|
195
185
|
test("when autoplay is true `media.play` should be called in dynamic mode when the Video data is updated", async () => {
|
196
|
-
const { component, getByTestId } = await render(
|
186
|
+
const { component, getByTestId } = await render(Video, {
|
197
187
|
show_label: true,
|
198
188
|
loading_status,
|
199
|
-
|
200
|
-
value:
|
201
|
-
{
|
202
|
-
|
203
|
-
data: null,
|
204
|
-
is_file: true
|
189
|
+
interactive: true,
|
190
|
+
value: {
|
191
|
+
video: {
|
192
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
205
193
|
}
|
206
|
-
|
194
|
+
},
|
207
195
|
root: "foo",
|
208
196
|
root_url: null,
|
209
197
|
streaming: false,
|
210
198
|
pending: false,
|
211
|
-
|
199
|
+
sources: ["upload"],
|
212
200
|
autoplay: true
|
213
201
|
});
|
214
202
|
const startButton = getByTestId("test-player") as HTMLVideoElement;
|
215
203
|
const fn = spyOn(startButton, "play");
|
216
204
|
startButton.dispatchEvent(new Event("loadeddata"));
|
217
205
|
component.$set({
|
218
|
-
value:
|
219
|
-
{
|
220
|
-
|
221
|
-
data: null,
|
222
|
-
is_file: true
|
206
|
+
value: {
|
207
|
+
video: {
|
208
|
+
path: "https://gradio-builds.s3.amazonaws.com/demo-files/audio_sample.wav"
|
223
209
|
}
|
224
|
-
|
210
|
+
}
|
225
211
|
});
|
226
212
|
startButton.dispatchEvent(new Event("loadeddata"));
|
227
213
|
assert.equal(fn.callCount, 2);
|
228
214
|
});
|
229
215
|
test("renders video and download button", async () => {
|
230
|
-
const data =
|
231
|
-
{
|
232
|
-
|
233
|
-
|
234
|
-
|
216
|
+
const data = {
|
217
|
+
video: {
|
218
|
+
path: "https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/demo/video_component/files/a.mp4"
|
219
|
+
},
|
220
|
+
subtitles: {
|
221
|
+
path: "https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/demo/video_component/files/a.mp4"
|
235
222
|
}
|
236
|
-
|
237
|
-
const results = await render(
|
238
|
-
|
223
|
+
};
|
224
|
+
const results = await render(Video, {
|
225
|
+
interactive: false,
|
239
226
|
label: "video",
|
240
227
|
show_label: true,
|
241
228
|
value: data,
|
242
|
-
root: "
|
229
|
+
root: "https://localhost:8000"
|
243
230
|
});
|
244
231
|
|
245
232
|
const downloadButton = results.getAllByTestId("download-div")[0];
|
246
233
|
expect(
|
247
234
|
downloadButton.getElementsByTagName("a")[0].getAttribute("href")
|
248
|
-
).toBe(data
|
235
|
+
).toBe(data.video.path);
|
249
236
|
expect(
|
250
237
|
downloadButton.getElementsByTagName("button").length
|
251
238
|
).toBeGreaterThan(0);
|
252
239
|
});
|
253
240
|
|
254
241
|
test("video change event trigger fires when value is changed and only fires once", async () => {
|
255
|
-
const { component, listen } = await render(
|
242
|
+
const { component, listen } = await render(Video, {
|
256
243
|
show_label: true,
|
257
244
|
loading_status,
|
258
|
-
|
245
|
+
interactive: true,
|
259
246
|
value: [
|
260
247
|
{
|
261
|
-
|
262
|
-
data: null,
|
263
|
-
is_file: true
|
248
|
+
path: "https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/demo/video_component/files/a.mp4"
|
264
249
|
}
|
265
250
|
],
|
266
251
|
root: "foo",
|
267
252
|
root_url: null,
|
268
253
|
streaming: false,
|
269
254
|
pending: false,
|
270
|
-
|
255
|
+
sources: ["upload"],
|
271
256
|
autoplay: true
|
272
257
|
});
|
273
258
|
|
@@ -275,9 +260,7 @@ describe("Video", () => {
|
|
275
260
|
|
276
261
|
(component.value = [
|
277
262
|
{
|
278
|
-
|
279
|
-
data: null,
|
280
|
-
is_file: true
|
263
|
+
path: "https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/demo/video_component/files/b.mp4"
|
281
264
|
}
|
282
265
|
]),
|
283
266
|
assert.equal(mock.callCount, 1);
|
package/index.ts
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
export { default as BaseInteractiveVideo } from "./shared/InteractiveVideo.svelte";
|
2
|
+
export { default as BaseStaticVideo } from "./shared/VideoPreview.svelte";
|
3
|
+
export { default as BasePlayer } from "./shared/Player.svelte";
|
4
|
+
export { prettyBytes, playable, loaded } from "./shared/utils";
|
5
|
+
export { default as BaseExample } from "./Example.svelte";
|
6
|
+
import { default as Index } from "./Index.svelte";
|
7
|
+
export default Index;
|
package/package.json
CHANGED
@@ -1,24 +1,26 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/video",
|
3
|
-
"version": "0.1.0-beta.
|
3
|
+
"version": "0.1.0-beta.9",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
7
7
|
"license": "ISC",
|
8
8
|
"private": false,
|
9
9
|
"dependencies": {
|
10
|
-
"@gradio/atoms": "^0.2.0-beta.
|
11
|
-
"@gradio/
|
12
|
-
"@gradio/
|
13
|
-
"@gradio/
|
14
|
-
"@gradio/
|
15
|
-
"@gradio/
|
16
|
-
"@gradio/
|
10
|
+
"@gradio/atoms": "^0.2.0-beta.6",
|
11
|
+
"@gradio/client": "^0.7.0-beta.1",
|
12
|
+
"@gradio/icons": "^0.2.0-beta.3",
|
13
|
+
"@gradio/image": "^0.3.0-beta.9",
|
14
|
+
"@gradio/statustracker": "^0.3.0-beta.8",
|
15
|
+
"@gradio/upload": "^0.3.0-beta.6",
|
16
|
+
"@gradio/utils": "^0.2.0-beta.6",
|
17
|
+
"@gradio/wasm": "^0.2.0-beta.2"
|
17
18
|
},
|
18
|
-
"main_changeset": true,
|
19
19
|
"exports": {
|
20
|
-
".": "./
|
20
|
+
".": "./index.ts",
|
21
21
|
"./example": "./Example.svelte",
|
22
22
|
"./package.json": "./package.json"
|
23
|
-
}
|
23
|
+
},
|
24
|
+
"main": "index.ts",
|
25
|
+
"main_changeset": true
|
24
26
|
}
|