fix: track preview still playing after changing tab
This commit is contained in:
parent
97764b8335
commit
36d5484b3a
File diff suppressed because one or more lines are too long
@ -5,7 +5,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import $ from 'jquery'
|
|
||||||
import EventBus from '@/utils/EventBus'
|
import EventBus from '@/utils/EventBus'
|
||||||
|
|
||||||
import { adjustVolume } from '@/utils/adjust-volume'
|
import { adjustVolume } from '@/utils/adjust-volume'
|
||||||
@ -17,8 +16,12 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.$refs.preview.volume = 1
|
this.$refs.preview.volume = 1
|
||||||
|
|
||||||
|
this.$router.beforeEach((to, from, next) => {
|
||||||
|
this.stopStackedTabsPreview()
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
EventBus.$on('trackPreview:playPausePreview', this.playPausePreview)
|
EventBus.$on('trackPreview:playPausePreview', this.playPausePreview)
|
||||||
EventBus.$on('trackPreview:stopStackedTabsPreview', this.stopStackedTabsPreview)
|
|
||||||
EventBus.$on('trackPreview:previewMouseEnter', this.previewMouseEnter)
|
EventBus.$on('trackPreview:previewMouseEnter', this.previewMouseEnter)
|
||||||
EventBus.$on('trackPreview:previewMouseLeave', this.previewMouseLeave)
|
EventBus.$on('trackPreview:previewMouseLeave', this.previewMouseLeave)
|
||||||
},
|
},
|
||||||
@ -116,7 +119,8 @@ export default {
|
|||||||
|
|
||||||
if (controls.length === 0) return
|
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
|
this.previewStopped = true
|
||||||
|
|
||||||
|
@ -151,8 +151,6 @@ router.beforeEach((to, from, next) => {
|
|||||||
socket.emit('getTracklist', getTracklistParams)
|
socket.emit('getTracklist', getTracklistParams)
|
||||||
}
|
}
|
||||||
|
|
||||||
EventBus.$emit('trackPreview:stopStackedTabsPreview')
|
|
||||||
|
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user