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

IOS Audio Context touch event #4677

Open
marklundin opened this issue Sep 28, 2022 · 2 comments
Open

IOS Audio Context touch event #4677

marklundin opened this issue Sep 28, 2022 · 2 comments
Assignees

Comments

@marklundin
Copy link
Member

IOS does not seems to recognize a touch drag as a valid interaction to start the audio context. In this example the box has a script which plays audio on mouse click, however if you begin with a touch drag and then click on the box the audio will not play, and no audio can be be played after. The Sound Manager becomes stuck a state where it cannot resume the audio context.

Demo:
This project has a box with a script that plays a sound when you click on it.

  1. Touch drag anywhere on the screen
  2. Click on the box - > No Audio

What should happen:

  1. Touch drag
  2. Click the box -> audio plays
@marklundin
Copy link
Member Author

FYI, it seems you can workaround this by using the following, however there's potentially some side effects to this...

const updateUnlockingState = _ => {
    if(pc.app.soundManager._unlocked) window.removeEventListener('touchstart', updateUnlockingState )
    pc.app.soundManager._unlocking = false;
};

window.addEventListener('touchstart', updateUnlockingState, true );

@slimbuck
Copy link
Member

Hi @marklundin, this was hopefully fixed in #4789.

Please could you confirm with the next engine release?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants