From 1062027f39a21a83efd767f544ed43eb192e6e53 Mon Sep 17 00:00:00 2001 From: Akhil Gupta Date: Mon, 8 Feb 2021 12:48:52 +0530 Subject: [PATCH] Persist volume --- client/player.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/player.html b/client/player.html index e74ce72..c386927 100644 --- a/client/player.html +++ b/client/player.html @@ -842,12 +842,24 @@ div#large-visualization{ }); }, mounted(){ + let volume=50; + + if(localStorage?.playerVolume){ + volume=parseInt(localStorage.playerVolume) + } Amplitude.init({ "songs": this.songs, "start_song":0, "autoplay": true, + "volume":volume, "callbacks": { + 'volumechange':function(){ + volume=Amplitude.getVolume(); + if(localStorage){ + localStorage.playerVolume= volume.toString(); + } + }, 'play': function(){ document.getElementById('album-art').style.visibility = 'hidden'; document.getElementById('large-visualization').style.visibility = 'visible';