Fix mute/unmute functionality: now also works if user unmutes by sliding volume manually.

This commit is contained in:
jcass 2016-01-24 21:29:32 +02:00
parent c9cec74f35
commit fb3f8dda3f
6 changed files with 20 additions and 8 deletions

View File

@ -63,6 +63,7 @@ v2.0.1 (UNRELEASED)
- Increase volume slider handle by 30% to make it easier to grab on mobile devices
- Add application cache manifest file for quicker loads and to allow client devices to detect when local caches should be invalidated.
- Fix vertical alignment of playback control buttons in footer.
- Swop mute/unmute icons and apply fix to restore volume levels after unmute.
v2.0.0 (26-3-2015)
------------------

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

View File

@ -117,7 +117,7 @@
</li>
<li id="" data-icon="false">
<div><!-- slider for volume -->
<a href="#" onclick="doMute(); return false;"><i class="fa fa-volume-up" id="mutebt"></i></a>
<a href="#" onclick="doMute(); return false;"><i class="fa fa-volume-off" id="mutebt"></i></a>
<label for="volumeslider" class="ui-hidden-accessible">Volume</label>
<input id="volumeslider" data-highlight="true" name="volumeslider" data-mini="true" type="range" min="0"
value="0" max="100" onchange="doVolume(this.value);"/>

View File

@ -423,19 +423,28 @@ function doVolume(value) {
}
function triggerVolume() {
mopidy.playback.setVolume(parseInt(volumeChanging));
if (volumeChanging > 0) {
$("#mutebt").attr('class', 'fa fa-volume-off');
muteVolume = -1;
} else {
$("#mutebt").attr('class', 'fa fa-volume-up');
muteVolume = currentVolume;
}
mopidy.playback.setVolume(parseInt(volumeChanging)).then();
currentVolume = volumeChanging
volumeChanging = 0;
}
function doMute() {
//only emit the event, not the status
if (muteVolume == -1) {
$("#mutebt").attr('src', 'images/icons/volume_mute_24x18.png');
muteVolume = currentVolume;
mopidy.playback.setVolume(0).then();
$("#mutebt").attr('class', 'fa fa-volume-up');
volumeChanging = 0;
triggerVolume();
} else {
$("#mutebt").attr('src', 'images/icons/volume_24x18.png');
mopidy.playback.setVolume(muteVolume).then();
$("#mutebt").attr('class', 'fa fa-volume-off');
volumeChanging = muteVolume;
triggerVolume();
muteVolume = -1;
}

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# 2016-01-24:v1
# 2016-01-24:v2
CACHE:
index.html
@ -41,6 +41,8 @@ images/icons/musicbox32.png
images/icons/musicbox57.png
images/icons/musicbox72.png
images/icons/musicbox114.png
images/icons/play_alt_12x12.png
images/icons/play_alt_16x16.png
images/default_cover.png
images/empty.png