Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question UnityWebRequest OGG for WebGL

Discussion in 'Audio & Video' started by rchapman, Jan 30, 2021.

  1. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    106
    Getting this while trying to play an OGG file from an external source in WebGL:

    Streaming of 'ogg' on this platform is not supported

    There are several hits searching for this, but no official word on whether this should be supported or if there's an "official" workaround. OGG is supported by the browser so, if I read correctly, it should also be supported by WebGL. The code works in editor, mobile (including VR), and standalone PC builds.

    Switching to MP3 is not viable given that MP3 isn't supported on PC. We want to have one set of assets and not have to encode differently for different platforms. We've tried several different ways to load (WWW, UnityWebRequest, UnityWebRequestMultimedia.GetAudioClip, etc.) We'll keep experimenting, but it would be good to have some idea of what the best practice is here.
     
  2. VirtualMaestro

    VirtualMaestro

    Joined:
    Jul 2, 2014
    Posts:
    22
    Have you found a solution?)
    We have a similar issue.
    What is ridiculous is that browsers (as you said) support Ogg.
    Even more, the documentation says that ACC isn't supported, but on our WebGL project, we use an AAC container with ACC AudioType (with UnityWebRequestMultimedia), but on PC, it doesn't work.
    Unity version 2022.3.24
    If you hear us, Unity, please do some standardization for all platforms.
     
    SeventhString likes this.
  3. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    106
    No solution from Unity, we are decoding the OGG files ourselves using NAudio.
     
  4. SeventhString

    SeventhString

    Unity Technologies

    Joined:
    Jan 12, 2023
    Posts:
    454
    The main reason why OGG is not the de facto format on WebGL is because it is not fully supported by Safari. The MP4/AAC is the best compromise that was identified for this platform.