Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / HTML5 Chrome no audio?

Author
Message
2D Analyst
AGK Developer
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 3rd Mar 2019 16:09
I've uploaded the html codes to a server and it seems to run fine on Edge and Firefox web browser. Chrome didn't have any audio. It's on a LAMP setup. Did anyone experience any issues with Chrome?
2D Analyst
AGK Developer
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 5th Mar 2019 03:26
After debugging it on Chrome, here's the error message.


AGKPlayer.js:1 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu


Sounds like the change was made in April 2018. Not sure if the AppGameKit developers are working on fixing this?
2D Analyst
AGK Developer
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 12th Mar 2019 02:12
It looks like the app will not play audio in the home page of chrome browser, but subfolders ran fine.

ex:

www.domain.com/index.html doesn't play audio
www.domain.com/folder/index.html plays audio

Conclusion, all major web browsers works for the most part, but certain functions runs extremely slow on browser.

The memblock is one function that runs slower on browser.
GTRON
5
Years of Service
User Offline
Joined: 30th Jan 2019
Location: Netherlands
Posted: 25th Mar 2019 04:25 Edited at: 25th Mar 2019 04:35
I'm having the same issue - no audio in Safari or Chrome. No problems with Firefox or Brave browsers.

For me - it doesn't matter whether the game is in a subfolder or not.

Chrome reports an error :AGKPlayer.js:
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.

Any ideas?
GTRON
5
Years of Service
User Offline
Joined: 30th Jan 2019
Location: Netherlands
Posted: 25th Mar 2019 18:47
I've fixed this... here's how:

Modified AGKPlayer.JS

(1) The audio context is defined as variable CTX in function _alcCreateContext - I made CTX global by removing it’s declaration in this function and putting it at the top of the file.
(2) I created a function resumeAudio as follows:

Module["resumeAudio"]= function Module_resumeAudio(){
ctx.resume();
}

I place this below:
Module["requestFullScreen"] = function Module_requestFullScreen(lockPointer, resizeCanvas, vrDevice) {
Browser.requestFullScreen(lockPointer, resizeCanvas, vrDevice)
};

In the HTML that loads the javascript I created the link:

<a class="link" href="#" onclick="Module.resumeAudio()">Unmute Audio</a>

Clicking on this unmutes the audio.

This fixes the problem in all browsers.

The Next
Web Engineer
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: United Kingdom
Posted: 25th Mar 2019 19:04
This is due to new browser features that block autoplay audio if the user hasn't already interacted with the page. The above method can be used as a fix to unmute the audio after loading. Or you could also have a button on the page that when pressed loads the player javascript triggering the player to load along with the audio.
Windows 10, Intel i7 4.2 GHz, 16GB DDR4, NVIDIA RTX 2060

GTRON
5
Years of Service
User Offline
Joined: 30th Jan 2019
Location: Netherlands
Posted: 25th Mar 2019 20:27
Hi The Next,

Just to add to what you've written here - you're right about what's causing this.

Richard from support recommended that I load the player Javascript from a button press (as you've suggested) - and this solves the problem for Chrome, but not for Safari. The approach I've used above works for both.




2D Analyst
AGK Developer
20
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 26th Mar 2019 00:10
I know chrome implemented the rule about no auto audio play unless triggered by user.

GTRON does this mean you will need to change JavaScript codes each time you export to html?
GTRON
5
Years of Service
User Offline
Joined: 30th Jan 2019
Location: Netherlands
Posted: 26th Mar 2019 01:01 Edited at: 26th Mar 2019 01:01
I don't change things every time I export because I've renamed the javascript player file and I use a different HTML filename than what AppGameKit publishes to (I use INDEX.HTML to load the game and my game isn't named INDEX .

Login to post a reply

Server time is: 2024-11-23 02:19:04
Your offset time is: 2024-11-23 02:19:04