Ensure audio waveform autoplay updates (#6546)

* prevent autoplay when autoplay is false

* tweak

* tweak

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Hannah 2023-11-22 20:52:10 +01:00 committed by GitHub
parent 1bbd6cab3f
commit a424fdbb23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
"@gradio/audio": patch
"gradio": patch
---
fix:Ensure audio waveform `autoplay` updates

View File

@ -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",

View File

@ -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", () => {