store last used volume and reuse it 29/20629/1
authorKevron Rees <kevron.m.rees@intel.com>
Fri, 9 May 2014 22:54:07 +0000 (15:54 -0700)
committerKevron Rees <kevron.m.rees@intel.com>
Fri, 9 May 2014 22:54:41 +0000 (15:54 -0700)
Change-Id: Ic6b7bc05558c270df9f067028ca1dc7026a6a408

css/car/components/audioPlayer/audioPlayer.js

index d569749..b322906 100644 (file)
                 }
 
                 if (AudioPlayer.volumeControlSelector !== null) {
+                    var volStart = 50;
+                    if(localStorage && localStorage.volume)
+                    {
+                        volStart = localStorage.volume;
+                    }
                     $(AudioPlayer.volumeControlSelector).noUiSlider({
                         range: [0, 100],
                         step: 1,
-                        start: 50,
+                        start: volStart,
                         handles: 1,
                         connect: "lower",
                         orientation: "horizontal",
                             AudioPlayer.setAudioVolume(volumeSlider);
                         }
                     });
-                    AudioPlayer.setAudioVolume(50);
+                    AudioPlayer.setAudioVolume(volStart);
                 }
 
                 if (AudioPlayer.timeProgressBarSelelector !== null) {
                 }
                 AudioPlayer.volume = volume;
                 AudioPlayer.player.volume =  volume / 100;
+                if(localStorage)
+                {
+                    localStorage.volume = volume;
+                }
             },
             /**
              * Updates the audio info panel (artist, album, name).