From 43569748aed96f487dc0122e992a67ed9db28f99 Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Thu, 7 Jan 2021 11:04:21 +0530 Subject: [PATCH] videos: save last volume --- src/components/WatchVideo.vue | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index ff988d4c..fdff36d4 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -161,8 +161,13 @@ export default { const noPrevPlayer = !this.player; - if (noPrevPlayer) + if (noPrevPlayer) { this.player = videojs(this.$refs.player, options); + if (localStorage) + this.player.volume( + localStorage.getItem("volume") || 1 + ); + } this.player.hotkeys({ volumeStep: 0.1, @@ -264,6 +269,11 @@ export default { this.player.on("volumechange", () => { this.audioplayer.volume = this.player.volume(); + if (localStorage) + localStorage.setItem( + "volume", + this.player.volume() + ); }); this.player.on("ended", () => {