diff --git a/src/assets/icons/replay.svg b/src/assets/icons/replay.svg
new file mode 100644
index 0000000000..2998bac9d8
--- /dev/null
+++ b/src/assets/icons/replay.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/components/AudioTrack/AudioController.vue b/src/components/AudioTrack/AudioController.vue
index 069a50291c..819ecdd861 100644
--- a/src/components/AudioTrack/AudioController.vue
+++ b/src/components/AudioTrack/AudioController.vue
@@ -61,7 +61,7 @@ export default {
status: {
type: String,
required: true,
- validator: (val) => ['playing', 'paused'].includes(val),
+ validator: (val) => ['playing', 'paused', 'played'].includes(val),
},
/**
* the CSS classes to apply on the waveform; This can take any form
@@ -84,9 +84,14 @@ export default {
// Sync status from parent to player and store
watch(
() => props.status,
- (status) => {
+ (status, prevStatus) => {
if (!audioEl.value) return
+ if (prevStatus === 'played' && status === 'playing') {
+ // If going from played to playing, then reset the time to the beginning. Let the regular logic handle actually triggering the playing of the audio
+ audioEl.value.currentTime = 0
+ }
+
switch (status) {
case 'playing':
audioEl.value.play()
@@ -146,6 +151,10 @@ export default {
currentTime.value = audioEl.value.currentTime
duration.value = audioEl.value.duration
+
+ if (currentTime.value >= duration.value) {
+ emit('finished')
+ }
}
const updateTimeLoop = () => {
updateTime()
@@ -169,6 +178,7 @@ export default {
if (audioEl.value && duration.value) {
audioEl.value.currentTime = duration.value * frac
updateTime()
+ emit('seeked')
}
}
diff --git a/src/components/AudioTrack/AudioTrack.vue b/src/components/AudioTrack/AudioTrack.vue
index 075eb63287..deae52c727 100644
--- a/src/components/AudioTrack/AudioTrack.vue
+++ b/src/components/AudioTrack/AudioTrack.vue
@@ -16,6 +16,8 @@
v-bind="controllerProps"
:audio="audio"
@ready="handleReady"
+ @finished="status = 'played'"
+ @seeked="handleSeeked"
/>
@@ -87,6 +89,12 @@ export default {
const status = ref('paused')
+ const handleSeeked = () => {
+ if (status.value === 'played') {
+ status.value = 'paused'
+ }
+ }
+
/* Metadata readiness */
const isReady = ref(false)
@@ -104,6 +112,7 @@ export default {
return {
status,
+ handleSeeked,
isReady,
handleReady,
diff --git a/src/components/AudioTrack/PlayPause.vue b/src/components/AudioTrack/PlayPause.vue
index 7d1fb98b10..1bd9719375 100644
--- a/src/components/AudioTrack/PlayPause.vue
+++ b/src/components/AudioTrack/PlayPause.vue
@@ -12,8 +12,7 @@
aria-hidden="true"
focusable="false"
>
-
-
+
@@ -21,6 +20,27 @@