diff --git a/src/renderer/layouts/PlayerBar.vue b/src/renderer/layouts/PlayerBar.vue
index f3c736f..98789c7 100644
--- a/src/renderer/layouts/PlayerBar.vue
+++ b/src/renderer/layouts/PlayerBar.vue
@@ -8,6 +8,12 @@
+
@@ -29,9 +35,11 @@ export default {
responsive: true
})
this.wavesurfer.load('/static/demo/music.mp3')
- this.wavesurfer.on('ready', function () {
- // wavesurfer.play()
- })
+ },
+ data () {
+ return {
+ isPlaying: false
+ }
},
methods: {
onArtworkLoad () {
@@ -39,6 +47,14 @@ export default {
color(img.src, (_, color) => {
this.wavesurfer.setProgressColor(`#${color}`)
})
+ },
+ togglePlay () {
+ if (this.isPlaying) {
+ this.wavesurfer.pause()
+ } else {
+ this.wavesurfer.play()
+ }
+ this.isPlaying = typeof this.wavesurfer === 'undefined' ? false : this.wavesurfer.isPlaying()
}
}
}