Merge pull request #139 from jcass77/fix/volume_slider

Fix mute/unmute feature
This commit is contained in:
John Cass 2016-01-27 00:01:58 +02:00
commit c5d1bd2e2c
7 changed files with 22 additions and 24 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.
- Use standard Mopidy mixer methods to mute / un-mute playback.
v2.0.0 (26-3-2015)
------------------

View File

@ -174,6 +174,7 @@
* Volume Slider
***********************/
#mutebt {
color: white;
float: left;
margin-left: 8px;
margin-top: 8px;
@ -551,7 +552,7 @@ a {
max-height:90%;
}
.nowPlaying-artistInfo {
font-size: 12px;
font-size: 12px;
}
.nowPlaying-artistInfo h4{
margin: 0px;

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="toggleMute(); return false;"><span title="Toggle mute"><i id="mutebt" class="fa fa-volume-up"></i></span></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

@ -408,18 +408,15 @@ function setPosition(pos) {
*/
function setVolume(value) {
var oldval = initgui;
initgui = true;
$("#volumeslider").val(value).slider('refresh');
initgui = oldval;
if ($("#volumeslider").val() != value) {
$("#volumeslider").val(value).slider('refresh');
}
}
function doVolume(value) {
if (!initgui) {
volumeChanging = value;
clearInterval(volumeTimer);
volumeTimer = setTimeout(triggerVolume, 500);
}
volumeChanging = value;
clearInterval(volumeTimer);
volumeTimer = setTimeout(triggerVolume, 500);
}
function triggerVolume() {
@ -427,18 +424,15 @@ function triggerVolume() {
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();
} else {
$("#mutebt").attr('src', 'images/icons/volume_24x18.png');
mopidy.playback.setVolume(muteVolume).then();
muteVolume = -1;
}
function toggleMute() {
mopidy.mixer.getMute().then(function(mute) {
mopidy.mixer.setMute(!mute);
if (mute) {
$("#mutebt").attr('class', 'fa fa-volume-up');
} else {
$("#mutebt").attr('class', 'fa fa-volume-off');
}
});
}
/*******

View File

@ -1,6 +1,6 @@
CACHE MANIFEST
# 2016-01-24:v1
# 2016-01-26:v1
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