0 votes
by (2k points)
This is the game, hope somebody can help me https://www.dropbox.com/s/0l04wsjvngx37f7/TanSoloOtroMonstruo.html?dl=0

The problem is that when I try to play it on Chrome, the sound doesn't work. I'm pretty noob at this, so I was hoping somebody here could help me get over this problem.

3 Answers

+1 vote
by (159k points)
selected by
Best answer
Many modern web-browsers (especially those used on mobile devices) now require that a end-user interacts with the current web-page at least once before the web-browser will allow a media file to autoplay. The Desktop release of Chrome is now one of these web-browser.

One of the reasons for this (newish) restriction is to stop a malicious web-page being viewed on a mobile device from automatically downloading a very large media file, thus causing the web-page to hang and the needless consumption of the end-user's data allowance.

The solution to this issue is simple:
1. Make the current 'first' Passage of your story/game the 'second' passage.
2. Add a new first Passage to your story, and make it some sort of general information (welcome, credits, acknowledgements, etc..) screen.
3. Add a link from the new 'first' passage to the new 'second' passage, this way the Reader will need to interact with the web-page at least once before any autoplay media starts.
by (2k points)
Thank you, it worked
+1 vote
by (23.6k points)

Chrome sometimes prevents sound from playing automatically. Look at the same question being asked here.

+1 vote
by (63.1k points)
You can try the playWhenPossible() method instead of play() if you're still using HAL.