Merge pull request #41 from nikandlv/development

Added and consumed player currently playing state
master
Nikan Dalvand 2019-07-31 23:57:30 +04:30 committed by GitHub
commit 78649ee0c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 7 deletions

View File

@ -1,10 +1,10 @@
<template>
<section>
<section class="player">
<img @load="onArtworkLoad" class="artwork" src="/static/demo/yellow.jpeg" />
<img @load="onArtworkLoad" class="artwork" :src="currentlyPlaying.artwork" />
<div>
<p class="title">Yellow</p>
<p class="artist">Rich Brian</p>
<p class="title">{{currentlyPlaying.title}}</p>
<p class="artist">{{currentlyPlaying.artist}}</p>
</div>
<div class="visualizer">
<div id="visualizer"></div>
@ -61,7 +61,7 @@ export default {
isFullscreen: false
}
},
computed: mapGetters(['fullscreenStatus']),
computed: mapGetters(['fullscreenStatus', 'currentlyPlaying']),
mounted () {
let progress = this.$el.getElementsByClassName('progress')[0]
this.wavesurfer = WaveSurfer.create({
@ -90,7 +90,7 @@ export default {
})
]
})
this.wavesurfer.load('/static/demo/music.mp3')
this.wavesurfer.load(this.currentlyPlaying.stream)
this.wavesurfer.on('ready', () => {
this.duration = formatSeconds(this.getDuration())
this.wavesurfer.container.style['height'] = '100%'

View File

@ -1,9 +1,17 @@
const state = {
fullscreen_mode: false
fullscreen_mode: false,
currently_playing: {
id: 8,
title: 'Yellow',
artist: 'Rich Brian',
artwork: '/static/demo/yellow.jpeg',
stream: '/static/demo/music.mp3'
}
}
const getters = {
fullscreenStatus: (state) => state.fullscreen_mode
fullscreenStatus: (state) => state.fullscreen_mode,
currentlyPlaying: (state) => state.currently_playing
}
const mutations = {