Skip to content

Commit 865f8d0

Browse files
Defined rate property setter to be able to use checkTouchLocked with it
1 parent c2f7795 commit 865f8d0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/sound/html5/HTML5AudioSound.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,21 @@ Object.defineProperty(HTML5AudioSound.prototype, 'volume', {
320320
this.emit('volume', this, value);
321321
}
322322
});
323+
/**
324+
* Playback rate.
325+
*
326+
* @name Phaser.Sound.HTML5AudioSound#rate
327+
* @property {number} rate
328+
*/
329+
Object.defineProperty(HTML5AudioSound.prototype, 'rate', {
330+
set: function (value) {
331+
this.currentConfig.rate = value;
332+
if (this.checkTouchLocked('property', 'rate', value)) {
333+
return;
334+
}
335+
Object.getOwnPropertyDescriptor(BaseSound.prototype, 'rate').set.call(this, value);
336+
}
337+
});
323338
/**
324339
* Current position of playing sound.
325340
*

0 commit comments

Comments
 (0)