8000 added checks to playback control methods for BaseSound class · ITCSsDeveloper/phaser@40c4b9f · GitHub
Skip to content

Commit 40c4b9f

Browse files
added checks to playback control methods for BaseSound class
1 parent 720d2a9 commit 40c4b9f

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

v3/src/sound/BaseSound.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,19 +161,28 @@ var BaseSound = new Class({
161161
return this;
162162
},
163163
pause: function () {
164+
if (this.isPaused) {
165+
return false;
166+
}
164167
this.isPlaying = false;
165168
this.isPaused = true;
166-
return this;
169+
return true;
167170
},
168171
resume: function () {
172+
if (!this.isPaused) {
173+
return false;
174+
}
169175
this.isPlaying = true;
170176
this.isPaused = false;
171-
return this;
177+
return true;
172178
},
173179
stop: function () {
180+
if (!this.isPlaying) {
181+
return false;
182+
}
174183
this.isPlaying = false;
175184
this.isPaused = false;
176-
return this;
185+
return true;
177186
},
178187
applyConfig: function () {
179188
this.mute = this.currentConfig.mute;

0 commit comments

Comments
 (0)