• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 No sounds at all when exporting to HTML5

S

Shy Lev-Ari

Guest
So I just bought the HTML5 license..

...and OMG my game is so bad. So many bugs ahhhhhhh.

First item on the list - no sound, at all. What is going on?
 
You're probably going to have to give us a bit more info. How are you trying to play your sounds? Have you added them to the IDE and can you play them through the preview in the IDE? Maybe some of your other bugs are causing problems affecting the sounds?

More info please.
 

Cowlord

Member
There are problems with audio in HTML5. Go into the compression settings or whatever it is called and try every setting until one works.
 

chmod777

Member
More and more browsers (including desktops) require a user interaction (click or touch) before audio can be played as expected, so that might be the issue.
 
S

Shy Lev-Ari

Guest
More and more browsers (including desktops) require a user interaction (click or touch) before audio can be played as expected, so that might be the issue.
Holy meatballs! That was it..
I "clicked" and.. sound. What the what?!

Ok so my game is keyboard only.. Do i do an ugly "click to start"? can i emulate a mouse click with the keyboard? Is there a setting i need to turn on?

BTW I'm test running the game (clicking the PLAY button, building for HTML5, which opens my chrome in a new tab)
 

Kyon

Member
Holy meatballs! That was it..
I "clicked" and.. sound. What the what?!

Ok so my game is keyboard only.. Do i do an ugly "click to start"? can i emulate a mouse click with the keyboard? Is there a setting i need to turn on?

BTW I'm test running the game (clicking the PLAY button, building for HTML5, which opens my chrome in a new tab)
On your site it should load the game a few frames after loading the page.
Browsers don't like sound to be played directly when someone opens a page. You can't edit this within gamemaker.
Maybe make a "Play" button or something in your game, that could fix it.
Or what I said before, load it a second later or so, might work.
 
S

Shy Lev-Ari

Guest
On your site it should load the game a few frames after loading the page.
Browsers don't like sound to be played directly when someone opens a page. You can't edit this within gamemaker.
Maybe make a "Play" button or something in your game, that could fix it.
Or what I said before, load it a second later or so, might work.
I plan on uploading it to GameJolt and/or NewGround. Do they do what you say? Do you recommend other such places? I don't have a website of my own I ca upload this too.
 

chmod777

Member
The "Play" button is certainly the best option.
But you can try to add this piece of code in an extension (not tested but this might work):
Code:
document.addEventListener("keyup", function() {
   if(window.AudioContext && g_WebAudioContext && g_WebAudioContext.state == "suspended") {
       g_WebAudioContext.resume();
   }
}, false);
 
S

Shy Lev-Ari

Guest
The "Play" button is certainly the best option.
But you can try to add this piece of code in an extension (not tested but this might work):
Code:
document.addEventListener("keyup", function() {
   if(window.AudioContext && g_WebAudioContext && g_WebAudioContext.state == "suspended") {
       g_WebAudioContext.resume();
   }
}, false);

Umm I've never used extensions before. Tried to jus t "create new extension' and copy paste it, but doesn't seem to be formated that way. What do I do with this code please? :)
 

chmod777

Member
You need to create a .js file from a text editor like Notepad++ with the above code inside. Then you just have to create an extension in GameMaker and adds the JS file in it.
 
S

Shy Lev-Ari

Guest
You need to create a .js file from a text editor like Notepad++ with the above code inside. Then you just have to create an extension in GameMaker and adds the JS file in it.
haha yes! almost :)

Audio is working, only after the second keystroke is released (any key stroke).

Tried adding a simulated keystroek, but it didn't help.

I have a "splash" screen with no sound, and it then moves to a second room with the menu. There is supposed to be music playing right away, but it doesn't at all (untill you return to the main menu from the main game room, i.e. when you go "bac" one room, and the room of the menu retsrats).

If this is the best we can do, i'll take it. I hope it is not, but I don't understand the JS code to alter it :)
 
Top