I've been fighting some sound issues with my WebGL build for the past few days to no avail. The sound works in the editor, works in the browser when ran in Firefox locally, however when zipped and ran from our hosted site via a learning management system, the sound does not work. I have tried via Chrome and Firefox both. I have tried using AAC, WAV, MP3 and OGG files. The first three produce browser errors. The OGG does not error out but also does not make any sound. Incidentally the OGG doesn't work when ran locally.. My relevant code is... Code (CSharp): public IEnumerator LoadSound(string loadSound) { path = Application.streamingAssetsPath + "/Lessons/Sounds/"; //Download using (UnityWebRequest loadedSound = UnityWebRequestMultimedia.GetAudioClip(path + loadSound + ".aac", AudioType.ACC)) { // Wait for import to complete yield return loadedSound.SendWebRequest(); if (loadedSound.isDone) { returnSound = DownloadHandlerAudioClip.GetContent(loadedSound); } audioSource.clip = returnSound; audioSource.Play(); } } The audioSource is a public variable that I drug the reference into the component to establish. The path I know works because I have another function almost identical to this one that loads images and there are no problems with the image portion of my application. Only other odd bit is that I'm loading the sounds via the streamingassets folder externally at runtime. I'm doing this exact thing with the images as well, which works for those. If anyone has any ideas, I'd really appreciate them Also, I am calling this code from a button activated by the user, so when they click it, it loads and is supposed to play the audio clip.
If it works in firefox locally, then the issue is with your LMS. There's not enough info here to know for sure but if I had to guess I'd say you need to whitelist the audio file mime types on the server. You can check if they are being blocked on download with a browser addon like firebug. Good luck!
Thanks for the reply, I will dig into audio types as soon as I can back to that issue! I tried asking SABA but they passed it off as something else.
What a headache. Haha Development Build with Exceptions enabled gives me this from the web console... exception thrown: TypeError: sound is undefined,_JS_Sound_GetLoadState@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286:3212:6 __ZN4FMOD5Sound12getOpenStateEP14FMOD_OPENSTATEPjPbS4_@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[3332]:0x1b0293 __ZN11SoundHandle8Instance15UpdateLoadStateEv@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[3295]:0x1ac953 __ZN12SoundManager6UpdateEv@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[3287]:0x1ab7c0 __ZN11AudioModule6UpdateEv@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[3879]:0x1dcf52 __ZZL31InitializeAudioManagerCallbacksvEN36PostLateUpdateUpdateAudioRegistrator7ForwardEv@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[3874]:0x1dce64 __Z17ExecutePlayerLoopP22NativePlayerLoopSystem@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[10403]:0x40941c __Z17ExecutePlayerLoopP22NativePlayerLoopSystem@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[10403]:0x409431 __Z10PlayerLoopv@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[10397]:0x408702 __ZL8MainLoopv@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[10383]:0x406a11 dynCall_v@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286 line 1149 > WebAssembly.instantiate:wasm-function[83417]:0x175929c UnityLoader["1c9793064a4618150a46e7fc5945a82c"]/Module.dynCall_v@blob:https://sabacloud.com/ae91220d-795e-477f-b356-5abc37cab286:27683:36