Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Avoid pausing audio when is loading (#1643)

Ramadan Omar7428b6f0bf7c
diff --git a/src/components/VAudioTrack/VPlayPause.vue b/src/components/VAudioTrack/VPlayPause.vue
index c953a1efe..fc030fa62 100644
--- a/src/components/VAudioTrack/VPlayPause.vue
+++ b/src/components/VAudioTrack/VPlayPause.vue
@@ -89,6 +89,7 @@ export default defineComponent({
setup(props, { emit }) {
const isPlaying = computed(() => props.status === 'playing')
const isLoading = computed(() => props.status === 'loading')
+ const isPaused = computed(() => props.status === 'paused')
/**
* Get the button label based on the current status of the player.
*/
@@ -109,8 +110,13 @@ export default defineComponent({
})
const handleClick = () => {
- emit('toggle', isPlaying.value || isLoading.value ? 'paused' : 'playing')
+ if (isPlaying.value) {
+ emit('toggle', 'paused')
+ } else if (isPaused.value) {
+ emit('toggle', 'playing')
+ }
}
+
return {
label,
icon,