@gradio/video 0.14.24 → 0.15.1

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,44 @@
1
1
  # @gradio/video
2
2
 
3
+ ## 0.15.1
4
+
5
+ ### Dependency updates
6
+
7
+ - @gradio/client@1.18.0
8
+ - @gradio/icons@0.14.0
9
+ - @gradio/atoms@0.17.0
10
+ - @gradio/statustracker@0.11.0
11
+ - @gradio/upload@0.16.17
12
+ - @gradio/image@0.22.18
13
+
14
+ ## 0.15.0
15
+
16
+ ### Dependency updates
17
+
18
+ - @gradio/statustracker@0.10.18
19
+
20
+ ## 0.15.0
21
+
22
+ ### Dependency updates
23
+
24
+ - @gradio/icons@0.13.1
25
+ - @gradio/upload@0.16.16
26
+
27
+ ## 0.15.0
28
+
29
+ ### Features
30
+
31
+ - [#11721](https://github.com/gradio-app/gradio/pull/11721) [`58d9d9e`](https://github.com/gradio-app/gradio/commit/58d9d9e98194dada5267ac1599063cf21723cbde) - Remove dupe maximise/maximize icon. Thanks @hannahblair!
32
+
33
+ ### Dependency updates
34
+
35
+ - @gradio/statustracker@0.10.17
36
+ - @gradio/atoms@0.16.5
37
+ - @gradio/client@1.17.1
38
+ - @gradio/icons@0.13.0
39
+ - @gradio/upload@0.16.15
40
+ - @gradio/image@0.22.17
41
+
3
42
  ## 0.14.24
4
43
 
5
44
  ### Dependency updates
@@ -3,7 +3,7 @@ import { type FileData } from "@gradio/client";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  type: "gallery" | "table";
6
- selected?: boolean | undefined;
6
+ selected?: boolean;
7
7
  value: {
8
8
  video: FileData;
9
9
  subtitles: FileData | null;
@@ -14,6 +14,8 @@ declare const __propDef: {
14
14
  [evt: string]: CustomEvent<any>;
15
15
  };
16
16
  slots: {};
17
+ exports?: {} | undefined;
18
+ bindings?: string | undefined;
17
19
  };
18
20
  export type ExampleProps = typeof __propDef.props;
19
21
  export type ExampleEvents = typeof __propDef.events;
package/dist/Index.svelte CHANGED
@@ -29,26 +29,23 @@ export let include_audio;
29
29
  export let loop = false;
30
30
  export let input_ready;
31
31
  let uploading = false;
32
- $:
33
- input_ready = !uploading;
32
+ $: input_ready = !uploading;
34
33
  let _video = null;
35
34
  let _subtitle = null;
36
35
  let active_source;
37
36
  let initial_value = value;
38
- $:
39
- if (value && initial_value === null) {
40
- initial_value = value;
41
- }
37
+ $: if (value && initial_value === null) {
38
+ initial_value = value;
39
+ }
42
40
  const handle_reset_value = () => {
43
41
  if (initial_value === null || value === initial_value) {
44
42
  return;
45
43
  }
46
44
  value = initial_value;
47
45
  };
48
- $:
49
- if (sources && !active_source) {
50
- active_source = sources[0];
51
- }
46
+ $: if (sources && !active_source) {
47
+ active_source = sources[0];
48
+ }
52
49
  $: {
53
50
  if (value != null) {
54
51
  _video = value.video;
@@ -5,13 +5,13 @@ import type { LoadingStatus } from "@gradio/statustracker";
5
5
  import type { WebcamOptions } from "./shared/utils";
6
6
  declare const __propDef: {
7
7
  props: {
8
- elem_id?: string | undefined;
9
- elem_classes?: string[] | undefined;
10
- visible?: boolean | undefined;
11
- value?: ({
8
+ elem_id?: string;
9
+ elem_classes?: string[];
10
+ visible?: boolean;
11
+ value?: {
12
12
  video: FileData;
13
13
  subtitles: FileData | null;
14
- } | null) | undefined;
14
+ } | null;
15
15
  label: string;
16
16
  sources: ["webcam"] | ["upload"] | ["webcam", "upload"] | ["upload", "webcam"];
17
17
  root: string;
@@ -19,11 +19,11 @@ declare const __propDef: {
19
19
  loading_status: LoadingStatus;
20
20
  height: number | undefined;
21
21
  width: number | undefined;
22
- container?: boolean | undefined;
23
- scale?: (number | null) | undefined;
22
+ container?: boolean;
23
+ scale?: number | null;
24
24
  min_width?: number | undefined;
25
- autoplay?: boolean | undefined;
26
- show_share_button?: boolean | undefined;
25
+ autoplay?: boolean;
26
+ show_share_button?: boolean;
27
27
  show_download_button: boolean;
28
28
  gradio: Gradio<{
29
29
  change: never;
@@ -43,13 +43,15 @@ declare const __propDef: {
43
43
  interactive: boolean;
44
44
  webcam_options: WebcamOptions;
45
45
  include_audio: boolean;
46
- loop?: boolean | undefined;
46
+ loop?: boolean;
47
47
  input_ready: boolean;
48
48
  };
49
49
  events: {
50
50
  [evt: string]: CustomEvent<any>;
51
51
  };
52
52
  slots: {};
53
+ exports?: {} | undefined;
54
+ bindings?: string | undefined;
53
55
  };
54
56
  export type IndexProps = typeof __propDef.props;
55
57
  export type IndexEvents = typeof __propDef.events;
@@ -47,8 +47,7 @@ function handle_capture({
47
47
  dispatch("change", detail);
48
48
  }
49
49
  let dragging = false;
50
- $:
51
- dispatch("drag", dragging);
50
+ $: dispatch("drag", dragging);
52
51
  </script>
53
52
 
54
53
  <BlockLabel {show_label} Icon={Video} label={label || "Video"} />
@@ -4,24 +4,24 @@ import type { WebcamOptions } from "./utils";
4
4
  import type { I18nFormatter } from "@gradio/utils";
5
5
  declare const __propDef: {
6
6
  props: {
7
- value?: (FileData | null) | undefined;
8
- subtitle?: (FileData | null) | undefined;
9
- sources?: (["webcam"] | ["upload"] | ["webcam", "upload"] | ["upload", "webcam"]) | undefined;
7
+ value?: FileData | null;
8
+ subtitle?: FileData | null;
9
+ sources?: ["webcam"] | ["upload"] | ["webcam", "upload"] | ["upload", "webcam"];
10
10
  label?: string | undefined;
11
- show_download_button?: boolean | undefined;
12
- show_label?: boolean | undefined;
11
+ show_download_button?: boolean;
12
+ show_label?: boolean;
13
13
  webcam_options: WebcamOptions;
14
14
  include_audio: boolean;
15
15
  autoplay: boolean;
16
16
  root: string;
17
17
  i18n: I18nFormatter;
18
- active_source?: ("webcam" | "upload") | undefined;
19
- handle_reset_value?: (() => void) | undefined;
20
- max_file_size?: (number | null) | undefined;
18
+ active_source?: "webcam" | "upload";
19
+ handle_reset_value?: () => void;
20
+ max_file_size?: number | null;
21
21
  upload: Client["upload"];
22
22
  stream_handler: Client["stream"];
23
23
  loop: boolean;
24
- uploading?: boolean | undefined;
24
+ uploading?: boolean;
25
25
  };
26
26
  events: {
27
27
  error: CustomEvent<any>;
@@ -41,6 +41,8 @@ declare const __propDef: {
41
41
  slots: {
42
42
  default: {};
43
43
  };
44
+ exports?: {} | undefined;
45
+ bindings?: string | undefined;
44
46
  };
45
47
  export type InteractiveVideoProps = typeof __propDef.props;
46
48
  export type InteractiveVideoEvents = typeof __propDef.events;
@@ -1,5 +1,5 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
- import { Play, Pause, Maximise, Undo } from "@gradio/icons";
2
+ import { Play, Pause, Maximize, Undo } from "@gradio/icons";
3
3
  import Video from "./Video.svelte";
4
4
  import VideoControls from "./VideoControls.svelte";
5
5
  import { prepare_files } from "@gradio/client";
@@ -31,14 +31,12 @@ let paused = true;
31
31
  let video;
32
32
  let processingVideo = false;
33
33
  function handleMove(e) {
34
- if (!duration)
35
- return;
34
+ if (!duration) return;
36
35
  if (e.type === "click") {
37
36
  handle_click(e);
38
37
  return;
39
38
  }
40
- if (e.type !== "touchmove" && !(e.buttons & 1))
41
- return;
39
+ if (e.type !== "touchmove" && !(e.buttons & 1)) return;
42
40
  const clientX = e.type === "touchmove" ? e.touches[0].clientX : e.clientX;
43
41
  const { left, right } = e.currentTarget.getBoundingClientRect();
44
42
  time = duration * (clientX - left) / (right - left);
@@ -48,8 +46,7 @@ async function play_pause() {
48
46
  const isPlaying = video.currentTime > 0 && !video.paused && !video.ended && video.readyState > video.HAVE_CURRENT_DATA;
49
47
  if (!isPlaying) {
50
48
  await video.play();
51
- } else
52
- video.pause();
49
+ } else video.pause();
53
50
  }
54
51
  }
55
52
  function handle_click(e) {
@@ -69,10 +66,8 @@ const handle_trim_video = async (videoBlob) => {
69
66
  function open_full_screen() {
70
67
  video.requestFullscreen();
71
68
  }
72
- $:
73
- time = time || 0;
74
- $:
75
- duration = duration || 0;
69
+ $: time = time || 0;
70
+ $: duration = duration || 0;
76
71
  </script>
77
72
 
78
73
  <div class="wrap">
@@ -141,7 +136,7 @@ $:
141
136
  on:click={open_full_screen}
142
137
  on:keypress={open_full_screen}
143
138
  >
144
- <Maximise />
139
+ <Maximize />
145
140
  </div>
146
141
  </div>
147
142
  </div>
@@ -3,23 +3,23 @@ import type { FileData, Client } from "@gradio/client";
3
3
  import type { I18nFormatter } from "@gradio/utils";
4
4
  declare const __propDef: {
5
5
  props: {
6
- root?: string | undefined;
6
+ root?: string;
7
7
  src: string;
8
- subtitle?: (string | null) | undefined;
8
+ subtitle?: string | null;
9
9
  mirror: boolean;
10
10
  autoplay: boolean;
11
11
  loop: boolean;
12
- label?: string | undefined;
13
- interactive?: boolean | undefined;
14
- handle_change?: ((video: FileData) => void) | undefined;
15
- handle_reset_value?: (() => void) | undefined;
12
+ label?: string;
13
+ interactive?: boolean;
14
+ handle_change?: (video: FileData) => void;
15
+ handle_reset_value?: () => void;
16
16
  upload: Client["upload"];
17
17
  is_stream: boolean | undefined;
18
18
  i18n: I18nFormatter;
19
- show_download_button?: boolean | undefined;
20
- value?: (FileData | null) | undefined;
21
- handle_clear?: (() => void) | undefined;
22
- has_change_history?: boolean | undefined;
19
+ show_download_button?: boolean;
20
+ value?: FileData | null;
21
+ handle_clear?: () => void;
22
+ has_change_history?: boolean;
23
23
  };
24
24
  events: {
25
25
  play: CustomEvent<any>;
@@ -35,6 +35,8 @@ declare const __propDef: {
35
35
  [evt: string]: CustomEvent<any>;
36
36
  };
37
37
  slots: {};
38
+ exports?: {} | undefined;
39
+ bindings?: string | undefined;
38
40
  };
39
41
  export type PlayerProps = typeof __propDef.props;
40
42
  export type PlayerEvents = typeof __propDef.events;
@@ -30,8 +30,7 @@ $: {
30
30
  }
31
31
  const dispatch = createEventDispatcher();
32
32
  function load_stream(src2, is_stream2, node2) {
33
- if (!src2 || !is_stream2)
34
- return;
33
+ if (!src2 || !is_stream2) return;
35
34
  if (Hls.isSupported() && !stream_active) {
36
35
  const hls = new Hls({
37
36
  maxBufferLength: 1,
@@ -70,12 +69,10 @@ function load_stream(src2, is_stream2, node2) {
70
69
  stream_active = true;
71
70
  }
72
71
  }
73
- $:
74
- src, stream_active = false;
75
- $:
76
- if (node && src && is_stream) {
77
- load_stream(src, is_stream, node);
78
- }
72
+ $: src, stream_active = false;
73
+ $: if (node && src && is_stream) {
74
+ load_stream(src, is_stream, node);
75
+ }
79
76
  </script>
80
77
 
81
78
  <!--
@@ -27,6 +27,8 @@ declare const __propDef: {
27
27
  slots: {
28
28
  default: {};
29
29
  };
30
+ exports?: undefined;
31
+ bindings?: undefined;
30
32
  };
31
33
  export type VideoProps = typeof __propDef.props;
32
34
  export type VideoEvents = typeof __propDef.events;
@@ -24,9 +24,8 @@ let ffmpeg;
24
24
  onMount(async () => {
25
25
  ffmpeg = await loadFfmpeg();
26
26
  });
27
- $:
28
- if (mode === "edit" && trimmedDuration === null && videoElement)
29
- trimmedDuration = videoElement.duration;
27
+ $: if (mode === "edit" && trimmedDuration === null && videoElement)
28
+ trimmedDuration = videoElement.duration;
30
29
  let trimmedDuration = null;
31
30
  let dragStart = 0;
32
31
  let dragEnd = 0;
@@ -3,22 +3,24 @@ import type { FileData } from "@gradio/client";
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  videoElement: HTMLVideoElement;
6
- showRedo?: boolean | undefined;
7
- interactive?: boolean | undefined;
8
- mode?: string | undefined;
6
+ showRedo?: boolean;
7
+ interactive?: boolean;
8
+ mode?: string;
9
9
  handle_reset_value: () => void;
10
10
  handle_trim_video: (videoBlob: Blob) => void;
11
- processingVideo?: boolean | undefined;
11
+ processingVideo?: boolean;
12
12
  i18n: (key: string) => string;
13
- value?: (FileData | null) | undefined;
14
- show_download_button?: boolean | undefined;
15
- handle_clear?: (() => void) | undefined;
16
- has_change_history?: boolean | undefined;
13
+ value?: FileData | null;
14
+ show_download_button?: boolean;
15
+ handle_clear?: () => void;
16
+ has_change_history?: boolean;
17
17
  };
18
18
  events: {
19
19
  [evt: string]: CustomEvent<any>;
20
20
  };
21
21
  slots: {};
22
+ exports?: {} | undefined;
23
+ bindings?: string | undefined;
22
24
  };
23
25
  export type VideoControlsProps = typeof __propDef.props;
24
26
  export type VideoControlsEvents = typeof __propDef.events;
@@ -24,8 +24,7 @@ export let display_icon_button_wrapper_top_corner = false;
24
24
  let old_value = null;
25
25
  let old_subtitle = null;
26
26
  const dispatch = createEventDispatcher();
27
- $:
28
- value && dispatch("change", value);
27
+ $: value && dispatch("change", value);
29
28
  afterUpdate(async () => {
30
29
  if (value !== old_value && subtitle !== old_subtitle && old_subtitle !== null) {
31
30
  old_value = value;
@@ -3,17 +3,17 @@ import type { FileData, Client } from "@gradio/client";
3
3
  import type { I18nFormatter } from "js/core/src/gradio_helper";
4
4
  declare const __propDef: {
5
5
  props: {
6
- value?: (FileData | null) | undefined;
7
- subtitle?: (FileData | null) | undefined;
6
+ value?: FileData | null;
7
+ subtitle?: FileData | null;
8
8
  label?: string | undefined;
9
- show_label?: boolean | undefined;
9
+ show_label?: boolean;
10
10
  autoplay: boolean;
11
- show_share_button?: boolean | undefined;
12
- show_download_button?: boolean | undefined;
11
+ show_share_button?: boolean;
12
+ show_download_button?: boolean;
13
13
  loop: boolean;
14
14
  i18n: I18nFormatter;
15
15
  upload: Client["upload"];
16
- display_icon_button_wrapper_top_corner?: boolean | undefined;
16
+ display_icon_button_wrapper_top_corner?: boolean;
17
17
  };
18
18
  events: {
19
19
  play: CustomEvent<any>;
@@ -28,6 +28,8 @@ declare const __propDef: {
28
28
  [evt: string]: CustomEvent<any>;
29
29
  };
30
30
  slots: {};
31
+ exports?: {} | undefined;
32
+ bindings?: string | undefined;
31
33
  };
32
34
  export type VideoPreviewProps = typeof __propDef.props;
33
35
  export type VideoPreviewEvents = typeof __propDef.events;
@@ -14,16 +14,14 @@ let dragging = null;
14
14
  const startDragging = (side) => {
15
15
  dragging = side;
16
16
  };
17
- $:
18
- loadingTimeline = thumbnails.length !== numberOfThumbnails;
17
+ $: loadingTimeline = thumbnails.length !== numberOfThumbnails;
19
18
  const stopDragging = () => {
20
19
  dragging = null;
21
20
  };
22
21
  const drag = (event, distance) => {
23
22
  if (dragging) {
24
23
  const timeline = document.getElementById("timeline");
25
- if (!timeline)
26
- return;
24
+ if (!timeline) return;
27
25
  const rect = timeline.getBoundingClientRect();
28
26
  let newPercentage = (event.clientX - rect.left) / rect.width * 100;
29
27
  if (distance) {
@@ -63,8 +61,7 @@ const moveHandle = (e) => {
63
61
  const generateThumbnail = () => {
64
62
  const canvas = document.createElement("canvas");
65
63
  const ctx = canvas.getContext("2d");
66
- if (!ctx)
67
- return;
64
+ if (!ctx) return;
68
65
  canvas.width = videoElement.videoWidth;
69
66
  canvas.height = videoElement.videoHeight;
70
67
  ctx.drawImage(videoElement, 0, 0, canvas.width, canvas.height);
@@ -11,6 +11,8 @@ declare const __propDef: {
11
11
  [evt: string]: CustomEvent<any>;
12
12
  };
13
13
  slots: {};
14
+ exports?: {} | undefined;
15
+ bindings?: string | undefined;
14
16
  };
15
17
  export type VideoTimelineProps = typeof __propDef.props;
16
18
  export type VideoTimelineEvents = typeof __propDef.events;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/video",
3
- "version": "0.14.24",
3
+ "version": "0.15.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -11,13 +11,13 @@
11
11
  "@ffmpeg/util": "^0.12.1",
12
12
  "hls.js": "^1.5.13",
13
13
  "mrmime": "^2.0.0",
14
- "@gradio/atoms": "^0.16.4",
15
- "@gradio/statustracker": "^0.10.16",
16
- "@gradio/upload": "^0.16.14",
17
- "@gradio/icons": "^0.12.0",
14
+ "@gradio/icons": "^0.14.0",
15
+ "@gradio/client": "^1.18.0",
16
+ "@gradio/statustracker": "^0.11.0",
17
+ "@gradio/image": "^0.22.18",
18
+ "@gradio/atoms": "^0.17.0",
19
+ "@gradio/upload": "^0.16.17",
18
20
  "@gradio/utils": "^0.10.2",
19
- "@gradio/image": "^0.22.16",
20
- "@gradio/client": "^1.17.0",
21
21
  "@gradio/wasm": "^0.18.1"
22
22
  },
23
23
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { createEventDispatcher } from "svelte";
3
- import { Play, Pause, Maximise, Undo } from "@gradio/icons";
3
+ import { Play, Pause, Maximize, Undo } from "@gradio/icons";
4
4
  import Video from "./Video.svelte";
5
5
  import VideoControls from "./VideoControls.svelte";
6
6
  import type { FileData, Client } from "@gradio/client";
@@ -168,7 +168,7 @@
168
168
  on:click={open_full_screen}
169
169
  on:keypress={open_full_screen}
170
170
  >
171
- <Maximise />
171
+ <Maximize />
172
172
  </div>
173
173
  </div>
174
174
  </div>