CC3.1.1 Bug Audio plays double on first time


My project targets web

The following situation is happening: Even if the player touch or clicks in the game frame the first button that he interacts to does not play the audio and then the second button plays the audio two times.

After that the audio plays nicely. It’s just the first audio.

I tried creating a “Click to start” screen before any audio is needed to force the player to interact with the game, but even with that I’m still experiencing this first button no audio plays and second button plays audio twice.

Is this a Cocos bug or is this something about the browser?


did you register the touch event with Node.EventType.TouchEnd ?
please try Node.EventType.TouchStart

I’m using Button.EventType.CLICK, just tried Node.EventType.TouchStart and had the same problem

Hello, here is a video demonstrating the problem

The top button just play the audio in this simple way for testing:

The second button goes through a custom audio manager with key->clip, but the hook is like this:


    onLoad() {        
        this.node.on(Button.EventType.CLICK, this.onclick, this);

    onclick() {
        if (this.key)

In AudioManager.ts the playByKey just finds the clip and at the end call this:

    public playOneShot(clip: AudioClip, volumeScale = 1) {
        if (!this.isAudioEnabled)
        if (!clip)
        if (this.source)
            this.source.playOneShot(clip, volumeScale);
            logger.log(`ERROR: AudioSource is null`);

Hope that these extra info help