Audio do not work online
francot514

Hi, im new to forums and have created some test for the wade engine, and have added sounds to the game, but when i upload it to my website, i can run game but sounds are not playing, and locally runs normal

All 14 Comments
Gio

Hi

 

Your description of the problem seems to suggest that the game runs without waiting for the files to finish loading - it would work locally as the loading would be almost instantaneous.

 

I need some context here... are you using the editor and adding sounds in the scene properties or are you using WADE as a library, in which case how are you loading and playing sounds?

francot514

Yes, im using the web editor, and adding sounds to the content normally, have tried wav, mp3 and ogg, what do you mean:

 

seems to suggest that the game runs without waiting for the files to finish loading

 

How will be need to load or preload the game audio, becuase graphics do not have that problem...

Gio

Just to be sure, are you actually doing it as shown in this picture? (I would also select "WebAudio Only" at the top to make your life easier, though basically that means no audio on Internet Explorer):

 

audio.png

francot514

Ok, when i do that adding audio to scene and using web only option, the game will not load, black screen instead.( Tested on firefox, chrome and explorer) And when i not add audio that way, game load but no audio playing, i have used booth commands playAudio and playAudioifAvaliable..

Gio
Have you checked the console andand does it say anything about any errors?
francot514

What you mean the console no give me error, becuase it show locally errors, i run it normal, even adding that stuff, ill clarify you:

 

-Adding audio to scene and use web only audio options give me black screen when loading page uploaded to my website.

 

-Not adding audio to scene (using code playaudio) give me no audio when loading page from website.

 

Thats the most important if only works locally no have sense, becuase uploaded to internet it do not load audio, may i need to use the download version of editor?? or plugin requiered for wade engine in firefox, chrome??

Gio

I meant that after uploading it to your website and going to your website, you could open the Javascript Console (see picture below to see how to do it in Chrome). If things don't work, there will be something written in the console.

 

Do you want to give me a link to your site so I can check it?

 

jsconsole.png

francot514

The only error i got is this

Gio

OK well, I was hoping to see some errors related to audio files not found, or something like that. Do you mind sharing a link to your website? It's difficult to tell what's going on without seeing it. You can send me a private message if you prefer.

francot514

No problem ill send you link via private message, but how you will know which error it is, now i get a error of missing audio mp3, but im not using any mp3, istead ogg files... check message

deptraidatai

hi Gio, 

My name Jojo, and I got the same problem with him, please check my game http://www.findingdorygames.com/wp-content/games/uploads/Finding-Dory-Spot-6-Differences/index.html i got some error 

"Use of the Application Cache is deprecated on insecure origins. Support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
wade.js:51 The deviceorientation event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
wade.js:51 The devicemotion event is deprecated on insecure origins, and support will be removed in the future. You should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.
wade.js:359 Warning: Trying to get audio WaterLapping_02.ogg without loading it first
wade.js:326 Uncaught TypeError: Failed to set the 'buffer' property on 'AudioBufferSourceNode': The provided value is not of type 'AudioBuffer'.Wade.playAudio @ wade.js:326App @ VM546:21Wade.instanceApp @ wade.js:330(anonymous function) @ wade.js:34l @ jquery-2.0.3.min.js:4c.fireWith @ jquery-2.0.3.min.js:4k @ jquery-2.0.3.min.js:6(anonymous function) @ jquery-2.0.3.min.js:6"

 

Could you please help me how to fix it :(

 

I use the code

if (wade.app.mySound)
    {    
        wade.stopAudio(wade.app.mySound);
        
    }
        wade.app.mySound = wade.playAudio('WaterLapping_02.ogg',true);
        

in app.js to control the background sound

and 2 buttons to mute/unmute the sound with the codes

for unmute button functioin onClick

wade.app.mySound = wade.playAudio('WaterLapping_02.ogg');
this.getSprite(0).setVisible(false);
wade.getSceneObject('mute').setVisible(true);

 

for unmute button functioin onClick

wade.app.mySound = wade.playAudio('WaterLapping_02.ogg');
this.getSprite(0).setVisible(false);
wade.getSceneObject('mute').setVisible(true);

 

for mute button functioin onClick

wade.stopAudio(wade.app.mySound);
this.getSprite(0).setVisible(false);
wade.getSceneObject('unmute').setVisible(true);

 

Please help to review, if there are anything went wrong :(

deptraidatai

note that the game work well on Wade Online Editor

Gio

Hi

Well, I think it's what it says in those error messages, the key one is:

wade.js:359 Warning: Trying to get audio WaterLapping_02.ogg without loading it first

So it would seem that you're playing the sound before it's finished loading. Clicking the "WebAudio Only" button as shown above would force all the sounds to go through the WebAudio API, which will cause the game to load all audio files before deciding that the scene is fully loaded. So it would fix your problem. As a side effect, audio will not work in Internet Explorer (but will work in MS Edge).

I would advise using wade.playAudioIfAvailable() instead of playAudio, so if the audio files failed to load (on IE or on old systems such as iOS 5) it would not give you an error, but it would just ignore the problem.

 

deptraidatai

Thank for your quick response and support me, i changed the code as your guide and it worked finding dory games spot 6 differences , thanks so much Gio. I'm just a newbie in the making game and your site help me much. Hope many people will use your site to make nice games (y) Cheers

Post a reply
Add Attachment
Submit Reply
Login to Reply