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

sound opt-in #112

Merged
merged 2 commits into from
Feb 15, 2021
Merged

sound opt-in #112

merged 2 commits into from
Feb 15, 2021

Conversation

leastbad
Copy link
Contributor

It seems as though I was over-zealous in my enthusiasm for the play_sound operation; the bootstrap code interferes with strict CSPs and hijacks the audio context on a Mac.

This PR introduces a requirement that developers who wish to use the play_sound operation must place a data-unlock-audio attribute on their body tag. Otherwise, the operation will be a NOOP.

Fixes #111

Copy link
Contributor

@hopsoft hopsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like cleanup for ended is incorrect. Shouldn't it be?

document.audio.removeEventListener('ended', ended)

@leastbad
Copy link
Contributor Author

Nice catch.

@leastbad leastbad merged commit 042df29 into stimulusreflex:master Feb 15, 2021
@leastbad leastbad deleted the sound_opt-in branch February 15, 2021 21:05
nhocki added a commit to nhocki/cable_ready that referenced this pull request Apr 16, 2021
Audio was made opt-in in stimulusreflex#112 but this breaks the current default by
disabling audio. This commit changes it back to the current default (on)
but allows people to turn it off by adding the `data-lock-audio`
attribute.
@thewatts thewatts mentioned this pull request Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

play_sound operation hijacks sound controls
2 participants