Skip to content

Commit 98700ff

Browse files
Updating play method to return boolean indicating if play call was done successfully
1 parent 15562a7 commit 98700ff

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/sound/webaudio/WebAudioSound.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,17 @@ var WebAudioSound = new Class({
125125
* @method Phaser.Sound.WebAudioSound#play
126126
* @param {string} [markerName=''] - If you want to play a marker then provide the marker name here, otherwise omit it to play the full sound.
127127
* @param {ISoundConfig} [config] - Optional sound config object to be applied to this marker or entire sound if no marker name is provided. It gets memorized for future plays of current section of the sound.
128-
* @returns {Phaser.Sound.WebAudioSound | null} This sound instance or 'null' if an error occurred.
128+
* @returns {boolean} Whether the sound started playing successfully.
129129
*/
130130
play: function (markerName, config) {
131131
if (!BaseSound.prototype.play.call(this, markerName, config)) {
132-
return null;
132+
return false;
133133
}
134134
// \/\/\/ isPlaying = true, isPaused = false \/\/\/
135135
this.stopAndRemoveBufferSource();
136136
this.createAndStartBufferSource();
137137
this.events.dispatch(new SoundEvent(this, 'SOUND_PLAY'));
138-
return this;
138+
return true;
139139
},
140140
/**
141141
* Pauses the sound.

0 commit comments

Comments
 (0)