mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 17:33:09 +02:00
Remember the media playback volume (#4089)
* Remember the media playback volume * fix
This commit is contained in:
parent
217e4ee39c
commit
64c1075b06
3 changed files with 21 additions and 4 deletions
|
@ -11,6 +11,7 @@
|
||||||
:title="media.name"
|
:title="media.name"
|
||||||
controls
|
controls
|
||||||
ref="audio"
|
ref="audio"
|
||||||
|
@volumechange="volumechange"
|
||||||
preload="metadata" />
|
preload="metadata" />
|
||||||
</div>
|
</div>
|
||||||
<a class="download" v-else
|
<a class="download" v-else
|
||||||
|
@ -40,7 +41,17 @@ export default Vue.extend({
|
||||||
return {
|
return {
|
||||||
hide: true
|
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>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-media-video-dialog">
|
<div class="mk-media-video-dialog">
|
||||||
<div class="bg" @click="close"></div>
|
<div class="bg" @click="close"></div>
|
||||||
<video :src="video.url" :title="video.name" controls autoplay ref="video"/>
|
<video :src="video.url" :title="video.name" controls autoplay ref="video" @volumechange="volumechange"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@ export default Vue.extend({
|
||||||
duration: 100,
|
duration: 100,
|
||||||
easing: 'linear'
|
easing: 'linear'
|
||||||
});
|
});
|
||||||
const videoTag = this.$refs.video as HTMLVideoElement
|
const videoTag = this.$refs.video as HTMLVideoElement;
|
||||||
if (this.start) videoTag.currentTime = this.start
|
if (this.start) videoTag.currentTime = this.start
|
||||||
|
videoTag.volume = this.$store.state.device.mediaVolume;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
close() {
|
close() {
|
||||||
|
@ -30,7 +31,11 @@ export default Vue.extend({
|
||||||
easing: 'linear',
|
easing: 'linear',
|
||||||
complete: () => this.destroyDom()
|
complete: () => this.destroyDom()
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
volumechange() {
|
||||||
|
const videoTag = this.$refs.video as HTMLVideoElement;
|
||||||
|
this.$store.commit('device/set', { key: 'mediaVolume', value: videoTag.volume });
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -56,6 +56,7 @@ const defaultDeviceSettings = {
|
||||||
themes: [],
|
themes: [],
|
||||||
enableSounds: true,
|
enableSounds: true,
|
||||||
soundVolume: 0.5,
|
soundVolume: 0.5,
|
||||||
|
mediaVolume: 0.5,
|
||||||
lang: null,
|
lang: null,
|
||||||
preventUpdate: false,
|
preventUpdate: false,
|
||||||
debug: false,
|
debug: false,
|
||||||
|
|
Loading…
Reference in a new issue