• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by Spogan · Aug 17, 2016 at 10:01 PM · erroraudiowebgl

"Unable to decode audio data" in webgl build

TL;DR Trying to build a WebGL project that runs in Chromium, an experimental build of chrome. The only sound compression formats that work in the build of Chromium I'm using are Vorbis, Opus, Wave, and OGA. How can I get Unity to use one of those compression formats for the build?

Hello, I'm relatively new to unity and have just started working on my first project. I'm trying to build something for WebGL and got to the point where I'm now adding sound, but I keep getting this error in my console in my browser:

Uncaught (in promise)
DOMException: Unable to decode audio data

I imported some free sound packages (links in asset store:UI sfx and casual game pack).
My build target is set to WebGL. When I go to the import settings for one of the sounds immediately after importing, there's a message in the inspector that says "The selection contains different compression formats to the default settings for the current build platform." Then, I check the box that says "Override for WebGL" and hit Apply, and then the warning message about different compression formats goes away.

Just as a test, I added an AudioSource to one of the objects in my scene, then dragged and dropped one of the sound files for which I checked the "Override for WebGL" into the AudioClip reference in the AudioSource, and checked "Play On Awake" and "Loop." When I try hitting play in the editor, I can hear the sound looping. When I build and try the project in my browser, though, I get the error above, the Unable to decode audio data one, in the console of my browser. I'm using Chromium (the experimental build of chrome) because I'm making a game that uses VR. For build template, I'm using the template found here, which is for handling the VR stuff.

For the sounds, I've tried using both .wav files and .mp3 files that I got from those free packages off of the asset store, and still none of them work.

For my webserver, I'm using mongoose.

So, does anyone know how I can do this correctly so that the sound will correctly play when built and run in a chromium? Thanks

UPDATE: So after spending some more time reading around and testing the build in other browsers, it turns out it's a problem specifically with Chromium, the experimental build of Chrome that supports WebVR. When I load the game in other browsers, the sounds play but the game doesn't run because no other browser supports both the WebVR AND the gamepad API that's needed to use the vive controllers.

I found this page that outlines what audio types are usable in Chromium, and so I've tried building the project when my sounds have a couple of different import settings. First, as I said, I've tried using the Override for WebGL setting which sets the compression format to AAC. I've also tried click the "Override for PC, Mac & Linux Standalone" instead, and from there I've tried Vorbis, PCM, and ADPCM compression formats as well. The page I linked that says which audio formats Chromium supports says it should support Vorbis, but I still get the "Unable to decode audio data" error, not matter which compression format I'm using.

SECOND UPDATE:
I found this site that tells you what audio file formats are supported on the browser you're in, and the build of Chromium that I'm using supports Vorbis and Wave. I've basically boiled down my question to: How can I get my build to have the Vorbis compression format for my audio files? I tried clicking the "Override for PC, Mac & Linux Standalone" and then selecting "Vorbis" as the compression format, but that still doesn't work. A friend suggested I try putting the audio files into the special "Resources" folder so that Unity doesn't try to compress it, which I'll try next, but I don't understand why it doesn't work when I select Vorbis when I know Vorbis works in my browser.

Comment
Radiys
Txandy
endasil_unity

People who like this

3 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

87 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why does my audio work fine in the editor but doesn't play in the WebGL build? 1 Answer

il2cpp/build/il2cpp.exe did not run properly! 5 Answers

Problem with webgl exporting, problem at IL2CPP 0 Answers

WebGL build runtime error 0 Answers

Getting errors while trying to build for WebGL 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges