Skip to content

Sometimes user needs to click on the canvas to start the emulation (Autoplay policy?) #41

Answered by arianrhodsandlot
gitGalu asked this question in Q&A
Discussion options

You must be logged in to vote

I assume this isn't a bug but rather a browser security measure against autoplay

You are right :) We cannot bypass it.

Is it possible to detect this situation

Unfortunately we can't detect whether is this happening. And different browsers on different platforms have different limitations about the time between user actions and autoplay of media.

Basically, there are two ways to deal with this problem.

  • Separate the fetching process of ROM/core files from the launching call, so when the user clicks something, we can guarantee that the related files have already been loaded.
    Example:

    let rom
    async function loadRom() {
      const response = await fetch('/path/to/rom')
      rom = await response.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gitGalu
Comment options

Answer selected by gitGalu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants