fix: track preview still playing after changing tab

This commit is contained in:
Roberto Tonino 2020-10-13 22:53:19 +02:00
parent 97764b8335
commit 36d5484b3a
3 changed files with 9 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,6 @@
</template>
<script>
// import $ from 'jquery'
import EventBus from '@/utils/EventBus'
import { adjustVolume } from '@/utils/adjust-volume'
@ -17,8 +16,12 @@ export default {
mounted() {
this.$refs.preview.volume = 1
this.$router.beforeEach((to, from, next) => {
this.stopStackedTabsPreview()
next()
})
EventBus.$on('trackPreview:playPausePreview', this.playPausePreview)
EventBus.$on('trackPreview:stopStackedTabsPreview', this.stopStackedTabsPreview)
EventBus.$on('trackPreview:previewMouseEnter', this.previewMouseEnter)
EventBus.$on('trackPreview:previewMouseLeave', this.previewMouseLeave)
},
@ -116,7 +119,8 @@ export default {
if (controls.length === 0) return
await adjustVolume(this.$refs.preview, 0, { duration: 800 })
await adjustVolume(this.$refs.preview, 0, { duration: 250 })
this.$refs.preview.pause()
this.previewStopped = true

View File

@ -151,8 +151,6 @@ router.beforeEach((to, from, next) => {
socket.emit('getTracklist', getTracklistParams)
}
EventBus.$emit('trackPreview:stopStackedTabsPreview')
next()
})