AudioSource loop has audible gap in Webgl Player

Tested on Firefox 72.0.1 (64-bit) (Windows)
Build using Unity 2019.2.17f1

See attached project for reproduction.

Steps to reproduce

  • Open Unity project, open ‘ReproScene’, run in editor. Observe the audio looping correctly.
  • Build And Run for WebGL, Observe a gap when looping the audio.

With some sounds this is more noticeable than with others.
I’m not sure how to proceed from here.
Any advice?

Greetings,
Dries

5373609–543999–WebGL_AudioLoop_Repro.zip (478 KB)

Did you ever find a solution?

Landed a fix to this issue in our trunk repository yesterday. It will be in for certain in 2021.1. Not yet sure how far we will be able to backport it, but trying to push it as far back as possible.

To manually workaround, find file Audio.js inside the Unity installation directory, and modify the code from

JS_Sound_SetLoopPoints: function (channelInstance, loopStart, loopEnd)
{
    if (WEBAudio.audioWebEnabled == 0)
        return;
    var channel = WEBAudio.audioInstances[channelInstance];
    channel.source.loopStart = loopStart;
    channel.source.loopEnd = loopEnd;
},

to

JS_Sound_SetLoopPoints: function (channelInstance, loopStart, loopEnd)
{
    if (WEBAudio.audioWebEnabled == 0)
        return;
    var channel = WEBAudio.audioInstances[channelInstance];
    channel.source.loopStart = loopStart - 2112/44100;
    channel.source.loopEnd = loopEnd - 2112/44100;
},

Does that help?