2017-08-25 00:37:21 +00:00
|
|
|
<template>
|
|
|
|
<div id="remoteController">
|
|
|
|
<p class="collapse">
|
|
|
|
<i class="fa fa-angle-down"></i>
|
|
|
|
</p>
|
|
|
|
<div class="details" v-if="song">
|
|
|
|
<div class="translucent" :style="{ backgroundImage: 'url('+song.album.cover+')' }"></div>
|
2017-08-26 21:43:06 +00:00
|
|
|
<div class="cover">
|
|
|
|
<img :src="song.album.cover" alt="song.album.cover">
|
|
|
|
</div>
|
2017-08-25 00:37:21 +00:00
|
|
|
<div class="info">
|
|
|
|
<div class="wrap">
|
|
|
|
<p class="title text">{{ song.title }}</p>
|
|
|
|
<p class="artist text">{{ song.artist.name }}</p>
|
|
|
|
<p class="album text">{{ song.album.name }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<footer>
|
2017-08-26 21:43:06 +00:00
|
|
|
<a class="favorite" @click.prevent="toggleFavorite">
|
|
|
|
<i class="fa fa-heart yep" v-if="song && song.liked"></i>
|
2017-08-25 00:37:21 +00:00
|
|
|
<i class="fa fa-heart-o" v-else></i>
|
2017-08-26 21:43:06 +00:00
|
|
|
</a>
|
|
|
|
<a class="prev" @click="playPrev">
|
2017-08-25 00:37:21 +00:00
|
|
|
<i class="fa fa-step-backward"></i>
|
2017-08-26 21:43:06 +00:00
|
|
|
</a>
|
|
|
|
<a class="play-pause" @click.prevent="togglePlayback">
|
2017-08-25 00:37:21 +00:00
|
|
|
<i class="fa fa-pause" v-if="playing"></i>
|
|
|
|
<i class="fa fa-play" v-else></i>
|
2017-08-26 21:43:06 +00:00
|
|
|
</a>
|
|
|
|
<a class="next" @click="playNext">
|
2017-08-25 00:37:21 +00:00
|
|
|
<i class="fa fa-step-forward"></i>
|
2017-08-26 21:43:06 +00:00
|
|
|
</a>
|
|
|
|
<a class="volume">
|
2017-08-25 00:37:21 +00:00
|
|
|
<i class="fa fa-volume-up"></i>
|
2017-08-26 21:43:06 +00:00
|
|
|
</a>
|
2017-08-25 00:37:21 +00:00
|
|
|
</footer>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { socket } from '../services'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
song: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2017-08-26 21:43:06 +00:00
|
|
|
toggleFavorite () {
|
|
|
|
if (!this.song) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.song.liked = !this.song.liked
|
|
|
|
socket.broadcast('favorite:toggle')
|
|
|
|
},
|
|
|
|
|
2017-08-25 00:37:21 +00:00
|
|
|
togglePlayback () {
|
|
|
|
if (this.song) {
|
2017-08-26 21:43:06 +00:00
|
|
|
this.song.playbackState = this.song.playbackState === 'playing' ? 'paused' : 'playing'
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
socket.broadcast('playback:toggle')
|
|
|
|
},
|
|
|
|
|
|
|
|
playNext () {
|
|
|
|
socket.broadcast('playback:next')
|
|
|
|
},
|
|
|
|
|
|
|
|
playPrev () {
|
|
|
|
socket.broadcast('playback:prev')
|
|
|
|
},
|
|
|
|
|
2017-08-26 21:43:06 +00:00
|
|
|
getStatus() {
|
|
|
|
socket.broadcast('song:getcurrent')
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
playing () {
|
|
|
|
return this.song && this.song.playbackState === 'playing'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2017-08-26 21:43:06 +00:00
|
|
|
mounted () {
|
2017-08-25 00:37:21 +00:00
|
|
|
socket.listen('song:played', ({ song }) => {
|
|
|
|
this.song = song
|
2017-08-26 21:43:06 +00:00
|
|
|
}).listen('song:current', ({ song }) => {
|
|
|
|
console.log('receiving')
|
|
|
|
this.song = song
|
2017-08-25 00:37:21 +00:00
|
|
|
})
|
2017-08-26 21:43:06 +00:00
|
|
|
|
|
|
|
this.getStatus()
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "resources/assets/sass/partials/_vars.scss";
|
|
|
|
@import "resources/assets/sass/partials/_mixins.scss";
|
|
|
|
@import "resources/assets/sass/partials/_shared.scss";
|
|
|
|
|
|
|
|
#remoteController {
|
|
|
|
background: $colorMainBgr;
|
|
|
|
position: fixed;
|
|
|
|
z-index: 9999;
|
|
|
|
width: 100vw;
|
2017-08-26 21:43:06 +00:00
|
|
|
height: 100%;
|
2017-08-25 00:37:21 +00:00
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: space-between;
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
.collapse {
|
|
|
|
height: 12vmin;
|
|
|
|
line-height: 12vmin;
|
|
|
|
font-size: 5vmin;
|
|
|
|
}
|
|
|
|
|
|
|
|
.details {
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
.info {
|
|
|
|
width: 100%;
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2017-08-26 21:43:06 +00:00
|
|
|
justify-content: space-around;
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.cover {
|
2017-08-26 21:43:06 +00:00
|
|
|
margin: 0 auto;
|
|
|
|
width: calc(70vw);
|
|
|
|
height: calc(70vw);
|
|
|
|
border-radius: 50%;
|
|
|
|
border: 2px solid #fff;
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
|
|
img {
|
|
|
|
width: calc(70vw);
|
|
|
|
height: auto;
|
|
|
|
}
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.text {
|
|
|
|
max-width: 90%;
|
|
|
|
margin: 0 auto;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
line-height: 1.3;
|
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
font-size: 6vmin;
|
|
|
|
font-weight: bold;
|
2017-08-26 21:43:06 +00:00
|
|
|
margin: 0 auto 10px;
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.artist {
|
2017-08-26 21:43:06 +00:00
|
|
|
font-size: 5vmin;
|
2017-08-25 00:37:21 +00:00
|
|
|
margin: 0 auto 6px;
|
|
|
|
font-weight: 100;
|
|
|
|
opacity: .5;
|
|
|
|
}
|
|
|
|
|
|
|
|
.album {
|
2017-08-26 21:43:06 +00:00
|
|
|
font-size: 4vmin;
|
2017-08-25 00:37:21 +00:00
|
|
|
font-weight: 100;
|
|
|
|
opacity: .5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.translucent {
|
2017-08-26 21:43:06 +00:00
|
|
|
position: absolute;
|
2017-08-25 00:37:21 +00:00
|
|
|
top: -20px;
|
|
|
|
left: -20px;
|
|
|
|
right: -20px;
|
|
|
|
bottom: -20px;
|
|
|
|
filter: blur(20px);
|
2017-08-26 21:43:06 +00:00
|
|
|
opacity: .3;
|
|
|
|
z-index: -1;
|
2017-08-25 00:37:21 +00:00
|
|
|
overflow: hidden;
|
|
|
|
background-size: cover;
|
|
|
|
background-position: center;
|
|
|
|
transform: translateZ(0);
|
|
|
|
backface-visibility: hidden;
|
|
|
|
perspective: 1000;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
footer {
|
2017-08-26 21:43:06 +00:00
|
|
|
height: 18vh;
|
2017-08-25 00:37:21 +00:00
|
|
|
display: flex;
|
2017-08-26 21:43:06 +00:00
|
|
|
justify-content: space-around;
|
2017-08-25 00:37:21 +00:00
|
|
|
align-items: center;
|
|
|
|
border-top: 1px solid rgba(255, 255, 255, .1);
|
|
|
|
font-size: 5vmin;
|
|
|
|
|
2017-08-26 21:43:06 +00:00
|
|
|
a {
|
|
|
|
color: #fff;
|
|
|
|
|
|
|
|
&:active {
|
|
|
|
opacity: .8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.favorite {
|
|
|
|
.yep {
|
|
|
|
color: #bf2043;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-25 00:37:21 +00:00
|
|
|
.prev, .next {
|
|
|
|
font-size: 6vmin;
|
|
|
|
}
|
|
|
|
|
|
|
|
.play-pause {
|
|
|
|
display: inline-block;
|
|
|
|
width: 16vmin;
|
|
|
|
height: 16vmin;
|
|
|
|
border: 1px solid #fff;
|
|
|
|
border-radius: 50%;
|
|
|
|
line-height: 16vmin;
|
|
|
|
font-size: 7vmin;
|
2017-08-26 21:43:06 +00:00
|
|
|
|
|
|
|
&.fa-play {
|
|
|
|
margin-left: 4px;
|
|
|
|
}
|
2017-08-25 00:37:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|