Remember the media playback volume (#4089)

* Remember the media playback volume

* fix
This commit is contained in:
MeiMei
2019-02-03 19:33:23 +09:00
committed by syuilo
parent 217e4ee39c
commit 64c1075b06
3 changed files with 21 additions and 4 deletions

View File

@@ -11,6 +11,7 @@
:title="media.name"
controls
ref="audio"
@volumechange="volumechange"
preload="metadata" />
</div>
<a class="download" v-else
@@ -40,7 +41,17 @@ export default Vue.extend({
return {
hide: true
};
}
},
mounted() {
const audioTag = this.$refs.audio as HTMLAudioElement;
audioTag.volume = this.$store.state.device.mediaVolume;
},
methods: {
volumechange() {
const audioTag = this.$refs.audio as HTMLAudioElement;
this.$store.commit('device/set', { key: 'mediaVolume', value: audioTag.volume });
},
},
})
</script>