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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

external audio in webgl

Discussion in 'WebGL' started by jimjim, Jun 1, 2015.

  1. jimjim

    jimjim

    Joined:
    Nov 11, 2009
    Posts:
    127
    Is there anyway to get external audio working in webgl?

    I am trying to use the www to access external audio. I get an error in my code on this line:
    Code (CSharp):
    1. AudioClip clip = download.GetAudioClip(true);
    The error in my Javascript console says: "Streaming of 'ogg' on this platform is not supported". but i have set streaming audio to false.

    Any help appeciated
     
    Last edited: Jun 1, 2015
  2. jimjim

    jimjim

    Joined:
    Nov 11, 2009
    Posts:
    127
    The solution i found was to:
    - Use mp3 audio for external/internal audio
    - Use the www class to find the audio at its path on the network. For example /Audio/
    - Store the sound in a array before play.
    - Wait after storing it for a few seconds.
    - Then use Play() to play audio
    - Using internal audio works much the same, but i have stored them in my resources folder and used 'Resources.Load' to store them and play them
     
    HuntKp likes this.
  3. HuntKp

    HuntKp

    Joined:
    Jun 1, 2015
    Posts:
    2
    Thanks, that solves my problem too.