Skip to content

Commit

Permalink
Dispatch stop_recording event in Audio (#5459)
Browse files Browse the repository at this point in the history
* add stop recording event dispatch

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
hannahblair and gradio-pr-bot committed Sep 11, 2023
1 parent 3e1e8fc commit bd2fda7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .changeset/heavy-rats-grow.md
@@ -0,0 +1,6 @@
---
"@gradio/audio": patch
"gradio": patch
---

fix:Dispatch `stop_recording` event in Audio
11 changes: 6 additions & 5 deletions js/audio/interactive/Audio.svelte
Expand Up @@ -53,7 +53,7 @@
function get_modules(): void {
module_promises = [
import("extendable-media-recorder"),
import("extendable-media-recorder-wav-encoder")
import("extendable-media-recorder-wav-encoder"),
];
}
Expand Down Expand Up @@ -93,7 +93,7 @@
let _audio_blob = new Blob(blobs, { type: "audio/wav" });
value = {
data: await blob_to_data_url(_audio_blob),
name: "audio.wav"
name: "audio.wav",
};
dispatch(event, value);
};
Expand Down Expand Up @@ -188,6 +188,7 @@
recorder.stop();
if (streaming) {
recording = false;
dispatch("stop_recording");
if (pending) {
submit_pending_stream_on_pending_end = true;
}
Expand All @@ -202,7 +203,7 @@
}
function handle_change({
detail: { values }
detail: { values },
}: {
detail: { values: [number, number] };
}): void {
Expand All @@ -212,14 +213,14 @@
data: value.data,
name,
crop_min: values[0],
crop_max: values[1]
crop_max: values[1],
});
dispatch("edit");
}
function handle_load({
detail
detail,
}: {
detail: {
data: string;
Expand Down

0 comments on commit bd2fda7

Please sign in to comment.