Search Unity

Audio Audio initiated via Playable Director not playing in WebGL

Discussion in 'Audio & Video' started by Tmaze311, Feb 28, 2024.

  1. Tmaze311

    Tmaze311

    Joined:
    Oct 18, 2022
    Posts:
    3
    I'm working on a project where all audio is functioning in the editor and in play mode. When I publish to WebGL, all audio that is initiated via a script seems to be functioning, but any audio that is initiated via a Playable Director is not working in WebGL. Note that the Playable Director elements other than audio function correctly, but the audio is not playing in WebGL.

    I've tried setting the priority of the Playable Director Audio very high compared to other audio detected by the listener, but that didn't seem to affect anything.

    Does anyone have any tips or advice on how to rectify?
     
  2. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    416
    You could try checking the AudioClip.loadState before playing it, maybe you will need to wait for it.
     
  3. Tmaze311

    Tmaze311

    Joined:
    Oct 18, 2022
    Posts:
    3
    So I checked my load state in Unity editor and the audioclip is loaded on start and plays successfully. I even tried selecting Load audio in background for all my audioclips and reuploading to unityPlay and it didn't rectify the issue. Any other thoughts or anything that might be useful for me to provide to troubleshoot?
     
  4. Tmaze311

    Tmaze311

    Joined:
    Oct 18, 2022
    Posts:
    3
    So I was able to get audio in the playable director timeline to play after setting the load type for the audioClip to Streaming. However now I'm running into an issue where it is only playing some audio and subject to delayed starts in WebGL even though it's functioning fine in Editor. I'm wondering if it's a limitation of WebGL and how much audio data can stream at a given time.

    Do you know if that's possibly the case or if there's something else I might be missing?