Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sounds not playing in Google Chrome in exported game #972

Closed
Serious07 opened this issue Dec 8, 2019 · 4 comments · Fixed by #1067
Closed

Sounds not playing in Google Chrome in exported game #972

Serious07 opened this issue Dec 8, 2019 · 4 comments · Fixed by #1067
Labels

Comments

@Serious07
Copy link

Google Chrome version: 78.0.3904.108 64bit
TIC-80 version: 0.70.6

Game source code: https://t.co/Awm6oA7gEz?amp=1
Game url loaded on web server: https://gregtechrus.ru/SpaceInvaders/

Reproduce steps:

  1. load Lesson25
  2. export
  3. upload to server
  4. reload web page with game
  5. no sounds in game

Error in Google Chrome:
https://imgur.com/UQaslKV

@nesbox nesbox added this to the 0.80.0 milestone Dec 8, 2019
@nesbox nesbox added the bug label Dec 8, 2019
@stefandevai
Copy link
Contributor

stefandevai commented Apr 29, 2020

This happens because Chrome has changed its default behavior with autoplay sounds to avoid sounds playing without the user consent in some websites.

And that's what the warning says, to create an audio context in Chrome you have to do it after a user gesture (user click, touch, button, etc.). That's how it's done in games uploaded to the TIC-80's official website, for example, you have to click on the cover image in order to play the game.

Right now sites in which you can upload your game (like itch.io) add a cover by default, so I'm not sure if adding a default cover on the generated HTML would have an impact on that. What do you think @nesbox ?

As a workaround, you can replace your generated HTML file with this one and a cover element should be added as in here. Then the game will only run after you click on the cover.

@nesbox
Copy link
Owner

nesbox commented Apr 29, 2020

I think the idea with cover is great, will try to use your workaround.
Thank you :)

@stefandevai
Copy link
Contributor

@nesbox, have you started working on this issue? If not, I have some free time right now, I could do it :)

@nesbox
Copy link
Owner

nesbox commented Apr 30, 2020

I'm not started :) pls do it if you have time.
As I see you just need to update this file build/html/embed.html.
Thank you for your help.

@nesbox nesbox removed this from the 0.80.0 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants