Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

WebGL Download and Play Audio with UnityWebRequestMultimedia.GetAudioClip

Discussion in 'WebGL' started by achias, Feb 19, 2021.

  1. achias

    achias

    Joined:
    Mar 1, 2017
    Posts:
    3
    I have been trying to stream audio and video at the same time over Unity WebGL application. By trial and error; I have discovered that I need to play the videos with URL and *.Prepare() call. Yet this seems not possible for Audio. So I wrote a script that gets the audio files with the help of UnityWebRequestMultimedia and sets it. I have tried with ogg, wav, mp3 and I wasn't able to play any.


    So is there limitation over this approach on WebGL or should I use another approach to able to play "streamed" audio files on WebGL.

    Thank you.
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    940
    Currently the audio backend indeed does not support Streaming audio clips. I have marked this for investigation in the roadmap in the future. For now, you can look into implementing this via calling out to JavaScript and creating a new Audio tag there with a url option.
     
  3. franadoriv

    franadoriv

    Joined:
    Oct 5, 2015
    Posts:
    5
    Excuse me, any notice on this?

    Just as info, if i use AudioType.AUDIOQUEUE i can stream ogg files over webgl. However, only the first load work, the next GetAudioClip call will cause an FMOD error of type 30
     
    Last edited: Sep 4, 2021
  4. darklord849

    darklord849

    Joined:
    Jan 11, 2018
    Posts:
    6
    is there any solution to this?
    the problem with this solution is that we wont be able to use spatial sound .