Persist volume

pull/52/head
Akhil Gupta 4 years ago
parent 099a443394
commit 1062027f39

@ -842,12 +842,24 @@ div#large-visualization{
}); });
}, },
mounted(){ mounted(){
let volume=50;
if(localStorage?.playerVolume){
volume=parseInt(localStorage.playerVolume)
}
Amplitude.init({ Amplitude.init({
"songs": this.songs, "songs": this.songs,
"start_song":0, "start_song":0,
"autoplay": true, "autoplay": true,
"volume":volume,
"callbacks": { "callbacks": {
'volumechange':function(){
volume=Amplitude.getVolume();
if(localStorage){
localStorage.playerVolume= volume.toString();
}
},
'play': function(){ 'play': function(){
document.getElementById('album-art').style.visibility = 'hidden'; document.getElementById('album-art').style.visibility = 'hidden';
document.getElementById('large-visualization').style.visibility = 'visible'; document.getElementById('large-visualization').style.visibility = 'visible';

Loading…
Cancel
Save