Skip to content

Commit

Permalink
Added min_volume option (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkih committed May 7, 2019
1 parent 6dd097b commit eb09ce7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/components/mediaControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ class MiniMediaPlayerMediaControls extends LitElement {
return !this.config.hide.shuffle && this.player.supportsShuffle;
}

get maxVol() {
return this.config.max_volume || 100;
}

get minVol() {
return this.config.min_volume || 0;
}

render() {
const { hide } = this.config;
return html`
Expand Down Expand Up @@ -63,7 +71,7 @@ class MiniMediaPlayerMediaControls extends LitElement {
@change=${this.handleVolumeChange}
@click=${e => e.stopPropagation()}
?disabled=${muted}
min='0' max=${this.config.max_volume}
min=${this.minVol} max=${this.maxVol}
value=${this.player.vol * 100}
dir=${'ltr'}
ignore-bar-touch pin>
Expand Down
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class MiniMediaPlayer extends LitElement {
},
};
conf.max_volume = Number(conf.max_volume) || 100;
conf.min_volume = Number(conf.min_volume) || 0;
conf.collapse = (conf.hide.controls || conf.hide.volume);
conf.info = conf.collapse && conf.info !== 'scroll' ? 'short' : conf.info;
conf.flow = (conf.hide.icon && conf.hide.name && conf.hide.info);
Expand Down

0 comments on commit eb09ce7

Please sign in to comment.