Hacker News new | ask | show | jobs
by azmenak 3296 days ago
We use keyboard controls in our app (vidhub.co) to control media, looks like a Safari 11 user will no longer be able to just hit a key to start a video if Safari's "automatic inference engine" chooses to block us.
3 comments

If it were up to me, they'd remove that ability altogether. Websites that screw with the keyboard are a huge pet peeve of mine.
A "keypress" event counts as a user gesture, so as long as your code looks like:

document.addEventListener('keypress', event => { if (event.key === 'space') video.play(); });

...then everything should just work fine.

I believe you can disable the restriction for particular sites if required.