From 2652006cacc4842fbf6481419ae43b1e61b4e0ee Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Thu, 23 Jan 2025 18:13:52 -0800 Subject: [PATCH] changes --- gradio/components/audio.py | 6 +++--- js/audio/Audio.stories.svelte | 1 - js/audio/Index.svelte | 1 - js/audio/player/AudioPlayer.svelte | 9 +++------ js/audio/static/StaticAudio.svelte | 1 - js/multimodaltextbox/shared/MultimodalTextbox.svelte | 1 - 6 files changed, 6 insertions(+), 13 deletions(-) diff --git a/gradio/components/audio.py b/gradio/components/audio.py index f1f966954c687..2445181c00a43 100644 --- a/gradio/components/audio.py +++ b/gradio/components/audio.py @@ -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. """ @@ -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 diff --git a/js/audio/Audio.stories.svelte b/js/audio/Audio.stories.svelte index c8793b36b0fea..abaf6271f744c 100644 --- a/js/audio/Audio.stories.svelte +++ b/js/audio/Audio.stories.svelte @@ -43,7 +43,6 @@ }, waveform_options: { show_recording_waveform: false, - show_controls: true }, label: "Audio Player" }} diff --git a/js/audio/Index.svelte b/js/audio/Index.svelte index 8cc9629addbfa..d2840cc614e94 100644 --- a/js/audio/Index.svelte +++ b/js/audio/Index.svelte @@ -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; diff --git a/js/audio/player/AudioPlayer.svelte b/js/audio/player/AudioPlayer.svelte index cf4522ae2e494..98688eccd0664 100644 --- a/js/audio/player/AudioPlayer.svelte +++ b/js/audio/player/AudioPlayer.svelte @@ -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; @@ -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(); @@ -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; } }); } diff --git a/js/audio/static/StaticAudio.svelte b/js/audio/static/StaticAudio.svelte index bb5b8cbeacf55..4a6ea17436eec 100644 --- a/js/audio/static/StaticAudio.svelte +++ b/js/audio/static/StaticAudio.svelte @@ -24,7 +24,6 @@ export let waveform_settings: Record = {}; export let waveform_options: WaveformOptions = { show_recording_waveform: true, - show_controls: false }; export let editable = true; export let loop: boolean; diff --git a/js/multimodaltextbox/shared/MultimodalTextbox.svelte b/js/multimodaltextbox/shared/MultimodalTextbox.svelte index c26b5daf0479c..b32f1aae5a46d 100644 --- a/js/multimodaltextbox/shared/MultimodalTextbox.svelte +++ b/js/multimodaltextbox/shared/MultimodalTextbox.svelte @@ -56,7 +56,6 @@ export let waveform_settings: Record; 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;