@gradio/video 0.17.0 → 0.18.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,17 @@
1
1
  # @gradio/video
2
+
3
+ ## 0.18.0
4
+
5
+ ### Features
6
+
7
+ - [#12504](https://github.com/gradio-app/gradio/pull/12504) [`4476400`](https://github.com/gradio-app/gradio/commit/44764009dfebecf894298efe80366e42578ea65d) - Add `playback_position` to gr.Audio and gr.Video, which can be updated and read. Thanks @aliabid94!
8
+
9
+ ## 0.17.0
10
+
11
+ ### Dependency updates
12
+
13
+ - @gradio/utils@0.10.4
14
+
2
15
  ## 0.17.0
3
16
 
4
17
  ### Features
package/Index.svelte CHANGED
@@ -104,6 +104,7 @@
104
104
  show_download_button={(gradio.props.buttons || ["download"]).includes(
105
105
  "download"
106
106
  )}
107
+ bind:playback_position={gradio.props.playback_position}
107
108
  on:play={() => gradio.dispatch("play")}
108
109
  on:pause={() => gradio.dispatch("pause")}
109
110
  on:stop={() => gradio.dispatch("stop")}
@@ -158,6 +159,7 @@
158
159
  root={gradio.shared.root}
159
160
  loop={gradio.props.loop}
160
161
  {handle_reset_value}
162
+ bind:playback_position={gradio.props.playback_position}
161
163
  on:clear={() => {
162
164
  gradio.props.value = null;
163
165
  gradio.dispatch("clear");
package/dist/Index.svelte CHANGED
@@ -104,6 +104,7 @@
104
104
  show_download_button={(gradio.props.buttons || ["download"]).includes(
105
105
  "download"
106
106
  )}
107
+ bind:playback_position={gradio.props.playback_position}
107
108
  on:play={() => gradio.dispatch("play")}
108
109
  on:pause={() => gradio.dispatch("pause")}
109
110
  on:stop={() => gradio.dispatch("stop")}
@@ -158,6 +159,7 @@
158
159
  root={gradio.shared.root}
159
160
  loop={gradio.props.loop}
160
161
  {handle_reset_value}
162
+ bind:playback_position={gradio.props.playback_position}
161
163
  on:clear={() => {
162
164
  gradio.props.value = null;
163
165
  gradio.dispatch("clear");
@@ -34,6 +34,7 @@
34
34
  export let loop: boolean;
35
35
  export let uploading = false;
36
36
  export let upload_promise: Promise<any> | null = null;
37
+ export let playback_position = 0;
37
38
 
38
39
  let has_change_history = false;
39
40
 
@@ -139,6 +140,7 @@
139
140
  {show_download_button}
140
141
  {handle_clear}
141
142
  {has_change_history}
143
+ bind:playback_position
142
144
  />
143
145
  {/key}
144
146
  {:else if value.size}
@@ -39,6 +39,7 @@ declare const InteractiveVideo: $$__sveltets_2_IsomorphicComponent<$$__sveltets_
39
39
  loop: boolean;
40
40
  uploading?: boolean;
41
41
  upload_promise?: Promise<any> | null;
42
+ playback_position?: number;
42
43
  }, {
43
44
  default: {};
44
45
  }>, {
@@ -25,6 +25,7 @@
25
25
  export let value: FileData | null = null;
26
26
  export let handle_clear: () => void = () => {};
27
27
  export let has_change_history = false;
28
+ export let playback_position = 0;
28
29
 
29
30
  const dispatch = createEventDispatcher<{
30
31
  play: undefined;
@@ -100,6 +101,10 @@
100
101
 
101
102
  $: time = time || 0;
102
103
  $: duration = duration || 0;
104
+ $: playback_position = time;
105
+ $: if (playback_position !== time && video) {
106
+ video.currentTime = playback_position;
107
+ }
103
108
  </script>
104
109
 
105
110
  <div class="wrap">
@@ -31,6 +31,7 @@ declare const Player: $$__sveltets_2_IsomorphicComponent<{
31
31
  value?: FileData | null;
32
32
  handle_clear?: () => void;
33
33
  has_change_history?: boolean;
34
+ playback_position?: number;
34
35
  }, {
35
36
  play: CustomEvent<any>;
36
37
  pause: CustomEvent<any>;
@@ -26,6 +26,7 @@
26
26
  export let i18n: I18nFormatter;
27
27
  export let upload: Client["upload"];
28
28
  export let display_icon_button_wrapper_top_corner = false;
29
+ export let playback_position = 0;
29
30
 
30
31
  let old_value: FileData | null = null;
31
32
  let old_subtitle: FileData | null = null;
@@ -84,6 +85,7 @@
84
85
  interactive={false}
85
86
  {upload}
86
87
  {i18n}
88
+ bind:playback_position
87
89
  />
88
90
  {/key}
89
91
  <div data-testid="download-div">
@@ -25,6 +25,7 @@ declare const VideoPreview: $$__sveltets_2_IsomorphicComponent<{
25
25
  i18n: I18nFormatter;
26
26
  upload: Client["upload"];
27
27
  display_icon_button_wrapper_top_corner?: boolean;
28
+ playback_position?: number;
28
29
  }, {
29
30
  play: CustomEvent<any>;
30
31
  pause: CustomEvent<any>;
package/dist/types.d.ts CHANGED
@@ -13,6 +13,7 @@ export interface VideoProps {
13
13
  loop: boolean;
14
14
  webcam_constraints: object;
15
15
  subtitles: FileData | null;
16
+ playback_position: number;
16
17
  }
17
18
  export interface VideoEvents {
18
19
  change: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/video",
3
- "version": "0.17.0",
3
+ "version": "0.18.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/client": "^2.0.0",
15
14
  "@gradio/icons": "^0.15.0",
15
+ "@gradio/client": "^2.0.0",
16
16
  "@gradio/atoms": "^0.19.0",
17
17
  "@gradio/image": "^0.24.0",
18
- "@gradio/statustracker": "^0.12.0",
18
+ "@gradio/utils": "^0.10.4",
19
19
  "@gradio/upload": "^0.17.2",
20
- "@gradio/utils": "^0.10.3"
20
+ "@gradio/statustracker": "^0.12.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@gradio/preview": "^0.15.0"
23
+ "@gradio/preview": "^0.15.1"
24
24
  },
25
25
  "exports": {
26
26
  "./package.json": "./package.json",
@@ -34,6 +34,7 @@
34
34
  export let loop: boolean;
35
35
  export let uploading = false;
36
36
  export let upload_promise: Promise<any> | null = null;
37
+ export let playback_position = 0;
37
38
 
38
39
  let has_change_history = false;
39
40
 
@@ -139,6 +140,7 @@
139
140
  {show_download_button}
140
141
  {handle_clear}
141
142
  {has_change_history}
143
+ bind:playback_position
142
144
  />
143
145
  {/key}
144
146
  {:else if value.size}
@@ -25,6 +25,7 @@
25
25
  export let value: FileData | null = null;
26
26
  export let handle_clear: () => void = () => {};
27
27
  export let has_change_history = false;
28
+ export let playback_position = 0;
28
29
 
29
30
  const dispatch = createEventDispatcher<{
30
31
  play: undefined;
@@ -100,6 +101,10 @@
100
101
 
101
102
  $: time = time || 0;
102
103
  $: duration = duration || 0;
104
+ $: playback_position = time;
105
+ $: if (playback_position !== time && video) {
106
+ video.currentTime = playback_position;
107
+ }
103
108
  </script>
104
109
 
105
110
  <div class="wrap">
@@ -26,6 +26,7 @@
26
26
  export let i18n: I18nFormatter;
27
27
  export let upload: Client["upload"];
28
28
  export let display_icon_button_wrapper_top_corner = false;
29
+ export let playback_position = 0;
29
30
 
30
31
  let old_value: FileData | null = null;
31
32
  let old_subtitle: FileData | null = null;
@@ -84,6 +85,7 @@
84
85
  interactive={false}
85
86
  {upload}
86
87
  {i18n}
88
+ bind:playback_position
87
89
  />
88
90
  {/key}
89
91
  <div data-testid="download-div">
package/types.ts CHANGED
@@ -18,6 +18,7 @@ export interface VideoProps {
18
18
  loop: boolean;
19
19
  webcam_constraints: object;
20
20
  subtitles: FileData | null;
21
+ playback_position: number;
21
22
  }
22
23
 
23
24
  export interface VideoEvents {