Skip to content

Commit

Permalink
Merge pull request #160 from rtritto/use-volume-precision
Browse files Browse the repository at this point in the history
Use precision to volume value
  • Loading branch information
yoriiis authored Feb 23, 2025
2 parents 051c53c + df757d0 commit e3c1af6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/vlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class Vlitejs {
increaseVolume() {
this.player.isMuted && this.player.unMute()
this.player.getVolume().then((volume: number) => {
this.player.setVolume(Math.min(volume + this.options.volumeStep, 1))
this.player.setVolume(Math.min(Math.round((volume + this.options.volumeStep) * 10) / 10, 1))
})
}

Expand All @@ -343,7 +343,7 @@ class Vlitejs {
*/
decreaseVolume() {
this.player.getVolume().then((volume: number) => {
this.player.setVolume(Math.max(volume - this.options.volumeStep, 0))
this.player.setVolume(Math.max(Math.round((volume - this.options.volumeStep) * 10) / 10, 0))
})
}

Expand Down

0 comments on commit e3c1af6

Please sign in to comment.