diff --git a/src/more-infos/more-info-media_player.html b/src/more-infos/more-info-media_player.html index 2ba1b51b91..776f520cd3 100644 --- a/src/more-infos/more-info-media_player.html +++ b/src/more-infos/more-info-media_player.html @@ -12,7 +12,7 @@ color: var(--accent-color); } - .volume { + .volume .volume_buttons { margin-bottom: 8px; max-height: 0px; @@ -43,8 +43,18 @@ +
+ + + +
this.fire('iron-resize'), 500); @@ -102,6 +116,10 @@ export default new Polymer({ return isMuted ? 'mdi:volume-off' : 'mdi:volume-high'; }, + computeHideVolumeButtons(isOff, supportsVolumeButtons) { + return !supportsVolumeButtons || isOff; + }, + computePlaybackControlIcon() { if (this.isPlaying) { return this.supportsPause ? 'mdi:pause' : 'mdi:stop'; @@ -136,6 +154,24 @@ export default new Polymer({ this.callService('volume_mute', { is_volume_muted: !this.isMuted }); }, + handleVolumeUp(ev) { + var obj = this.$.volumeUp; + this.handleVolumeWorker('volume_up', obj, true); + }, + + handleVolumeDown(ev) { + var obj = this.$.volumeDown; + this.handleVolumeWorker('volume_down', obj, true); + }, + + handleVolumeWorker(service, obj, force) { + if (force || (obj != undefined && obj.pointerDown)) { + this.callService(service); + var _this = this; + setTimeout(function(){ _this.handleVolumeWorker(service, obj, false); }, 500); + } + }, + volumeSliderChanged(ev) { const volPercentage = parseFloat(ev.target.value); const vol = volPercentage > 0 ? volPercentage / 100 : 0;