Skip to content

Commit 51ecad6

Browse files
committed
Clamp volume
Fixes 'IndexSizeError: The index is not in the allowed range'
1 parent b5caa27 commit 51ecad6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
var BaseSound = require('../BaseSound');
99
var Class = require('../../utils/Class');
1010
var Events = require('../events');
11+
var Clamp = require('../../math/Clamp');
1112

1213
/**
1314
* @classdesc
@@ -552,7 +553,7 @@ var HTML5AudioSound = new Class({
552553
{
553554
if (this.audio)
554555
{
555-
this.audio.volume = this.currentConfig.volume * this.manager.volume;
556+
this.audio.volume = Clamp(this.currentConfig.volume * this.manager.volume, 0, 1);
556557
}
557558
},
558559

0 commit comments

Comments
 (0)