Skip to main content
added 2 characters in body
Source Link
Guye Incognito
  • 391
  • 1
  • 5
  • 19

I have an audioSource in which loop is set to true. I am starting it playing by calling playdelayed()

In the editor its plays fine. In a webgl build it does not loop. It just plays once.

Also in firefox it does not start playing at the correct time, it is a good fraction of a second off.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayDelayed(Intro.clip.length);
}

PlayScheduled has exactly the same effect.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayScheduled(AudioSettings.dspTime + Intro.clip.length);
}

Also in firefox it does not start playing atPlay(ulong) has the correct time, it is a good fraction of a second off.same effect

public override void MatchStarted()
{
    Intro.Play();
    Loop.Play((ulong)(44100 * Intro.clip.length));
}

I'm posting this here seeking workarounds. Any suggestions? As you can see from my code, my use case is a piece of music with an intro and a loop.

...

ps. I have seen some posts saying that if the bitrate is not 44.1 KHz this can cause looping issues on WebGl. The audio file in question is set to override the bitrate to 44.1 in its import settings.

I have an audioSource in which loop is set to true. I am starting it playing by calling playdelayed()

In the editor its plays fine. In a webgl build it does not loop. It just plays once.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayDelayed(Intro.clip.length);
}

PlayScheduled has exactly the same effect.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayScheduled(AudioSettings.dspTime + Intro.clip.length);
}

Also in firefox it does not start playing at the correct time, it is a good fraction of a second off.

I'm posting this here seeking workarounds. Any suggestions? As you can see from my code, my use case is a piece of music with an intro and a loop.

...

ps. I have seen some posts saying that if the bitrate is not 44.1 KHz this can cause looping issues on WebGl. The audio file in question is set to override the bitrate to 44.1 in its import settings.

I have an audioSource in which loop is set to true. I am starting it playing by calling playdelayed()

In the editor its plays fine. In a webgl build it does not loop. It just plays once.

Also in firefox it does not start playing at the correct time, it is a good fraction of a second off.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayDelayed(Intro.clip.length);
}

PlayScheduled has exactly the same effect.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayScheduled(AudioSettings.dspTime + Intro.clip.length);
}

Play(ulong) has the same effect

public override void MatchStarted()
{
    Intro.Play();
    Loop.Play((ulong)(44100 * Intro.clip.length));
}

I'm posting this here seeking workarounds. Any suggestions? As you can see from my code, my use case is a piece of music with an intro and a loop.

...

ps. I have seen some posts saying that if the bitrate is not 44.1 KHz this can cause looping issues on WebGl. The audio file in question is set to override the bitrate to 44.1 in its import settings.

Source Link
Guye Incognito
  • 391
  • 1
  • 5
  • 19

Unity WebGL audio not looping when started with playdelayed()

I have an audioSource in which loop is set to true. I am starting it playing by calling playdelayed()

In the editor its plays fine. In a webgl build it does not loop. It just plays once.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayDelayed(Intro.clip.length);
}

PlayScheduled has exactly the same effect.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayScheduled(AudioSettings.dspTime + Intro.clip.length);
}

Also in firefox it does not start playing at the correct time, it is a good fraction of a second off.

I'm posting this here seeking workarounds. Any suggestions? As you can see from my code, my use case is a piece of music with an intro and a loop.

...

ps. I have seen some posts saying that if the bitrate is not 44.1 KHz this can cause looping issues on WebGl. The audio file in question is set to override the bitrate to 44.1 in its import settings.