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

[Earwurm] Investigate if we can improve unlock() with synthetic event #25

Open
beefchimi opened this issue Feb 27, 2023 · 0 comments
Open
Labels
🧐 Question Further information is requested

Comments

@beefchimi
Copy link
Owner

Right now, our .unlock() feature simply queues up an AudioContext state change and performs the "unlock" once a user interaction is detected in the document.

Can we take this one step further and dispatch our own event?

const clickEvent = new Event('click');
document.dispatchEvent(clickEvent);

This would allow autoplay functionality on page load, rather than until the user has done something.

I will try exploring this here:
https://codesandbox.io/s/earwurm-auto-unlock-3shm7k?file=/src/App.tsx

@beefchimi beefchimi added the 🧐 Question Further information is requested label Feb 27, 2023
@beefchimi beefchimi self-assigned this Feb 27, 2023
@beefchimi beefchimi removed their assignment Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧐 Question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant