Partially implemented next/previous buttons

pull/45/head
Nikan Dalvand 2019-08-02 00:41:46 +04:30
parent c7c9ef5184
commit 43d2f9d15d
3 changed files with 83 additions and 76 deletions

View File

@ -63,7 +63,10 @@ export default {
}, },
computed: mapGetters(['fullscreenStatus', 'currentlyPlaying', 'playerQueue']), computed: mapGetters(['fullscreenStatus', 'currentlyPlaying', 'playerQueue']),
mounted () { mounted () {
console.log(this.currentlyPlaying) this.drawVisualizer()
},
methods: {
drawVisualizer () {
let progress = this.$el.getElementsByClassName('progress')[0] let progress = this.$el.getElementsByClassName('progress')[0]
this.wavesurfer = WaveSurfer.create({ this.wavesurfer = WaveSurfer.create({
container: '#visualizer', container: '#visualizer',
@ -133,7 +136,6 @@ export default {
currentWidth = progressWave.style.width currentWidth = progressWave.style.width
}) })
}, },
methods: {
onArtworkLoad () { onArtworkLoad () {
let img = this.$el.getElementsByTagName('img')[0] let img = this.$el.getElementsByTagName('img')[0]
let controlIcons = this.$el.getElementsByClassName('control-buttons')[0].children let controlIcons = this.$el.getElementsByClassName('control-buttons')[0].children
@ -167,9 +169,11 @@ export default {
}, },
playNext () { playNext () {
this.playQueueItem(this.currentlyPlaying + 1) this.playQueueItem(this.currentlyPlaying + 1)
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream)
}, },
playPrevious () { playPrevious () {
this.playQueueItem(this.currentlyPlaying - 1) this.playQueueItem(this.currentlyPlaying - 1)
this.wavesurfer.load(this.playerQueue[this.currentlyPlaying].stream)
}, },
play () { play () {
this.wavesurfer.play() this.wavesurfer.play()

View File

@ -2,11 +2,14 @@ import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import { createPersistedState, createSharedMutations } from 'vuex-electron' import { createPersistedState, createSharedMutations } from 'vuex-electron'
import Store from 'electron-store'
import modules from './modules' import modules from './modules'
let clear = false
if (clear) {
const store = new Store({ name: 'vuex' })
store.clear()
}
Vue.use(Vuex) Vue.use(Vuex)
export default new Vuex.Store({ export default new Vuex.Store({
modules, modules,
plugins: [ plugins: [

View File

@ -18,10 +18,10 @@ const state = {
}, },
{ {
id: 8, id: 8,
title: 'Yellow', title: 'Ali sorena',
artist: 'Rich Brian', artist: 'Negar',
artwork: '/static/demo/clever.jpg', artwork: 'http://sakhamusic.ir/wp-content/uploads/2016/03/Ali-Sorena-%E2%80%93-Negar.jpg',
stream: '/static/demo/music.mp3' stream: 'http://dl.sakhamusic.ir/94/esfand/09/03%20Negar%20(Prod.%20Ehsan%20Ziya)_2.mp3'
} }
] ]
} }