Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
abidlabs committed Jan 24, 2025
1 parent 3c365c5 commit 2652006
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
6 changes: 3 additions & 3 deletions gradio/components/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class WaveformOptions:
waveform_color: The color (as a hex string or valid CSS color) of the full waveform representing the amplitude of the audio. Defaults to a light gray color.
waveform_progress_color: The color (as a hex string or valid CSS color) that the waveform fills with to as the audio plays. Defaults to the accent color.
trim_region_color: The color (as a hex string or valid CSS color) of the trim region. Defaults to the accent color.
show_recording_waveform: If True, shows a waveform when recording audio or playing audio. If False, uses the default browser audio players.
show_controls: Deprecated. Use `show_recording_waveform` instead.
show_recording_waveform: If True, shows a waveform when recording audio or playing audio. If False, uses the default browser audio players. For streamed audio, the default browser audio player is always used.
show_controls: Deprecated and has no effect. Use `show_recording_waveform` instead.
skip_length: The percentage (between 0 and 100) of the audio to skip when clicking on the skip forward / skip backward buttons.
sample_rate: The output sample rate (in Hz) of the audio after editing.
"""
Expand Down Expand Up @@ -193,7 +193,7 @@ def __init__(
self.waveform_options = waveform_options
if self.waveform_options.show_controls is not False:
warnings.warn(
"The `show_controls` parameter is deprecated. Use `show_recording_waveform` instead."
"The `show_controls` parameter is deprecated and will be removed in a future release. Use `show_recording_waveform` instead."
)
self.min_length = min_length
self.max_length = max_length
Expand Down
1 change: 0 additions & 1 deletion js/audio/Audio.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
},
waveform_options: {
show_recording_waveform: false,
show_controls: true
},
label: "Audio Player"
}}
Expand Down
1 change: 0 additions & 1 deletion js/audio/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
export let editable = true;
export let waveform_options: WaveformOptions = {
show_recording_waveform: true,
show_controls: false
};
export let pending: boolean;
export let streaming: boolean;
Expand Down
9 changes: 3 additions & 6 deletions js/audio/player/AudioPlayer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
load: undefined;
}>();
$: use_default_controls = waveform_options.show_controls || value?.is_stream;
$: use_waveform =
waveform_options.show_recording_waveform && !value?.is_stream;
Expand All @@ -70,7 +69,7 @@
});
};
$: if (!value?.is_stream && container !== undefined && container !== null) {
$: if (use_waveform && container !== undefined && container !== null) {
if (waveform !== undefined) waveform.destroy();
container.innerHTML = "";
create_waveform();
Expand Down Expand Up @@ -143,10 +142,8 @@
if (!resolved_src || value?.is_stream) return;
if (waveform_options.show_recording_waveform) {
waveform?.load(resolved_src);
} else if (waveform_options.show_controls) {
if (audio_player) {
audio_player.src = resolved_src;
}
} else if (audio_player) {
audio_player.src = resolved_src;
}
});
}
Expand Down
1 change: 0 additions & 1 deletion js/audio/static/StaticAudio.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
export let waveform_settings: Record<string, any> = {};
export let waveform_options: WaveformOptions = {
show_recording_waveform: true,
show_controls: false
};
export let editable = true;
export let loop: boolean;
Expand Down
1 change: 0 additions & 1 deletion js/multimodaltextbox/shared/MultimodalTextbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
export let waveform_settings: Record<string, any>;
export let waveform_options: WaveformOptions = {
show_recording_waveform: true,
show_controls: false
};
export let sources: ["microphone" | "upload"] = ["upload"];
export let active_source: "microphone" | null = null;
Expand Down

0 comments on commit 2652006

Please sign in to comment.