Skip to content

Commit

Permalink
Ensure audio waveform autoplay updates (#6546)
Browse files Browse the repository at this point in the history
* prevent autoplay when autoplay is false

* tweak

* tweak

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
hannahblair and gradio-pr-bot committed Nov 22, 2023
1 parent 1bbd6ca commit a424fdb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/huge-schools-bake.md
@@ -0,0 +1,6 @@
---
"@gradio/audio": patch
"gradio": patch
---

fix:Ensure audio waveform `autoplay` updates
4 changes: 3 additions & 1 deletion js/audio/Index.svelte
Expand Up @@ -88,7 +88,9 @@
active_source = sources[0];
}
const waveform_settings = {
let waveform_settings: Record<string, any>;
$: waveform_settings = {
height: 50,
waveColor: waveform_options.waveform_color || "#9ca3af",
progressColor: waveform_options.waveform_progress_color || "#f97316",
Expand Down
6 changes: 5 additions & 1 deletion js/audio/player/AudioPlayer.svelte
Expand Up @@ -80,7 +80,11 @@
);
$: waveform?.on("ready", () => {
if (waveform_settings.autoplay) waveform?.play();
if (!waveform_settings.autoplay) {
waveform?.stop();
} else {
waveform?.play();
}
});
$: waveform?.on("finish", () => {
Expand Down

0 comments on commit a424fdb

Please sign in to comment.