{
@@ -164,7 +167,7 @@
async function record() {
recording = true;
-
+ dispatch("start_recording");
if (!inited) await prepare_audio();
header = undefined;
if (streaming) {
@@ -181,6 +184,7 @@
});
const stop = async () => {
+ dispatch("stop_recording");
recorder.stop();
if (streaming) {
recording = false;
@@ -250,6 +254,11 @@
dispatch("upload", detail);
}
+ function handle_ended() {
+ dispatch("stop");
+ dispatch("end");
+ }
+
export let dragging = false;
$: dispatch("drag", dragging);
@@ -306,7 +315,7 @@
src={value.data}
on:play
on:pause
- on:ended
+ on:ended={handle_ended}
/>
{#if mode === "edit" && player?.duration}
diff --git a/js/audio/src/StaticAudio.svelte b/js/audio/src/StaticAudio.svelte
index ee5f8322ff..2fd5c1870b 100644
--- a/js/audio/src/StaticAudio.svelte
+++ b/js/audio/src/StaticAudio.svelte
@@ -22,7 +22,8 @@
change: AudioData;
play: undefined;
pause: undefined;
- ended: undefined;
+ end: undefined;
+ stop: undefined;
}>();
$: value &&
@@ -30,6 +31,11 @@
name: name,
data: value?.data
});
+
+ function handle_ended() {
+ dispatch("stop");
+ dispatch("end");
+ }
@@ -44,7 +50,7 @@
src={value.data}
on:play
on:pause
- on:ended
+ on:ended={handle_ended}
/>
{/if}
diff --git a/js/image/src/Webcam.svelte b/js/image/src/Webcam.svelte
index a4df59790a..b7ee685ba0 100644
--- a/js/image/src/Webcam.svelte
+++ b/js/image/src/Webcam.svelte
@@ -1,6 +1,7 @@
@@ -79,7 +125,7 @@
on:click={play_pause}
on:play
on:pause
- on:ended
+ on:ended={handle_end}
bind:currentTime={time}
bind:duration
bind:paused
diff --git a/js/video/src/StaticVideo.svelte b/js/video/src/StaticVideo.svelte
index ad48c51dd4..69b3bdff27 100644
--- a/js/video/src/StaticVideo.svelte
+++ b/js/video/src/StaticVideo.svelte
@@ -1,10 +1,5 @@