# Allow only one sound to play until complete

**URL:** <https://phaser.discourse.group/t/allow-only-one-sound-to-play-until-complete/1530>\
**Category:** Phaser 3\
**Created:** [March 5, 2019, 4:16pm UTC](https://phaser.discourse.group/t/allow-only-one-sound-to-play-until-complete/1530 "2019-03-05T16:16:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamesSkemp](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jamesskemp/32/47_2.png) [@JamesSkemp](https://phaser.discourse.group/u/JamesSkemp)\
**Post date:** [March 5, 2019, 4:16pm UTC](https://phaser.discourse.group/t/allow-only-one-sound-to-play-until-complete/1530/1 "2019-03-05T16:16:24Z")

</div>

I’m working on an app that allows sounds to play when certain objects are selected. Phaser 3.16.2. While the audio plays fine, I’m not getting a notification that it has stopped.

```
public playSong(): void {
	if (!this.soundPlaying) {
		this.soundPlaying = true;
		const song = this.sound.add("song_1");
		// These both display an accurate number
		console.log(song.duration);
		console.log(song.totalDuration);
		song.on("ended", (sound) => {
			// None of the following triggers
			console.log("ended");
			this.soundPlaying = false;
			setTimeout(() => {
				this.sys.game.destroy(true);
			});
		});
		console.log("Play Song");
		song.play();
	}
}

```

Some code based upon [http://labs.phaser.io/edit.html?src=src\audio\Web%20Audio\Reuse%20AudioContext.js](http://labs.phaser.io/edit.html?src=src%5Caudio%5CWeb%20Audio%5CReuse%20AudioContext.js)

There’s approximately 30 sounds I might be playing, so I’m trying not to create a property on the scene for each sound.

What am I missing?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 5, 2019, 5:19pm UTC](https://phaser.discourse.group/t/allow-only-one-sound-to-play-until-complete/1530/2 "2019-03-05T17:19:51Z")

</div>

[https://photonstorm.github.io/phaser3-docs/Phaser.Sound.Events.html#event:COMPLETE](https://photonstorm.github.io/phaser3-docs/Phaser.Sound.Events.html#event:COMPLETE)

---

<div class="post-metadata">

**Author:** ![JamesSkemp](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jamesskemp/32/47_2.png) [@JamesSkemp](https://phaser.discourse.group/u/JamesSkemp)\
**Post date:** [March 5, 2019, 8:46pm UTC](https://phaser.discourse.group/t/allow-only-one-sound-to-play-until-complete/1530/3 "2019-03-05T20:46:56Z")

</div>

Duh.

So given that it works in the example, is this just part of what Rich did in 3.16 around events, and the labs example needs to be updated (now that I’m looking at the console, it is running 3.15)?

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 5, 2019, 9:07pm UTC](https://phaser.discourse.group/t/allow-only-one-sound-to-play-until-complete/1530/4 "2019-03-05T21:07:08Z")

</div>

Yes, it was renamed in v3.16.
