koel/resources/assets/js/components/site-footer/volume.vue

60 lines
1 KiB
Vue
Raw Normal View History

2016-11-24 08:50:22 +00:00
<template>
<span class="volume control" id="volume">
<i class="fa fa-volume-up" @click.prevent="mute" v-show="!muted"/>
<i class="fa fa-volume-off" @click.prevent="unmute" v-show="muted"/>
<input type="range" id="volumeRange" max="10" step="0.1" @change="muted = false" class="plyr__volume">
</span>
</template>
<script>
2016-11-26 03:25:35 +00:00
import { playback } from '../../services'
2016-11-24 08:50:22 +00:00
export default {
2016-11-26 03:25:35 +00:00
data () {
2016-11-24 08:50:22 +00:00
return {
2016-11-26 03:25:35 +00:00
muted: false
}
2016-11-24 08:50:22 +00:00
},
methods: {
/**
* Mute the volume.
*/
2016-11-26 03:25:35 +00:00
mute () {
this.muted = true
return playback.mute()
2016-11-24 08:50:22 +00:00
},
/**
* Unmute the volume.
*/
2016-11-26 03:25:35 +00:00
unmute () {
this.muted = false
return playback.unmute()
}
}
}
2016-11-24 08:50:22 +00:00
</script>
<style lang="sass">
@import "../../../sass/partials/_vars.scss";
@import "../../../sass/partials/_mixins.scss";
#volume {
@include vertical-center();
// More tweaks
input[type=range] {
margin-top: -3px;
}
i {
width: 16px;
}
@media only screen and (max-width: 768px) {
display: none !important;
}
}
</style>