Search Unity

Audio WebGL AudioSource.PlayScheduled Latency

Discussion in 'Audio & Video' started by dominator909, Dec 7, 2020.

  1. dominator909

    dominator909

    Joined:
    Oct 8, 2020
    Posts:
    8
    I am building a Guitar-Hero Style game, and I am trying to sync the notes and audio file in a WebGL build.

    -AudioSource.Play() lags a bit when you call it.

    -AudioSource.Play(delay) calling this before needed it and delaying it will still lag.

    -AudioSource.PlayScheduled(delay) is seemingly what I need for this use case. The documentation says its very percise and loads the clip prior so this latency should not be an issue. I tested this and it is true on my Windows build, but not on my WebGL build. It seems to have a similar load time as the other Play functions. Is it somehow not supported on WebGL?

    -AudioSource.Play(delay) and then checking AudioSource.isPlaying() does not work since it apprears that once I queue AudioSource.Play it returns true immediately.



    Any suggestions on how I can guarentee that the audio starts precisely on time?
     
    rostimosha likes this.