-
-
Notifications
You must be signed in to change notification settings - Fork 243
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
Fixes WebAudio sink not playing on Safari #1765
Conversation
…ires a user interaction after a web audio stream has been requested. Signed-off-by: Dan Cunningham <dan@digitaldan.com>
This is my quick and dirty workaround for Safari being difficult. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you very much!!
I have tested this, works fine with openHAB's barking.mp3
.
Does not work with the doorbell.mp3
, my BrowserStack iOS debugger (thx @ghys) says Unhandled Promise Rejection: EncodingError: Decoding failed
, but this is related to the encoding and we can't help there.
@digitaldan Is this ready for merging? It still has WIP.
Job #851: Bundle Size — 16.25MiB (~+0.01%).Metrics (2 changes)
Total size by type (2 changes)
|
Let me clean it up a bit, i believe there are some formatting violations, plus i want to make the variable naming more consistent. I kinda just threw it together to be honest ;-) |
I have fixed the linting errors, so you need to update before cleaning up. |
When it's fixed and works, it would also be nice when the same changes are applied (in additional PRs) to HABPanel and Basic UI. Those UIs use very similar code for handling webaudio. 🙂 |
@digitaldan |
Unfortunately i'm having some trouble getting this working now on safari, i'll play a little more this afternoon. |
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
Ok, all cleaned up. My Safari issues were my own (helps to point Safari at your dev server when testing). I'll look at updating the other UI's in separate PR. |
Signed-off-by: Dan Cunningham <dan@digitaldan.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you very much!
Works fine on my iPad.
Fixes #1717. Safari (and Chrome possibly as well) requires a user interaction after a web audio stream has been requested, which means audio will not play until at least one stream has been started and then the user clicks somewhere in the web app. This implements a workaround (https://www.mattmontag.com/web/unlock-web-audio-in-safari-for-ios-and-macos) which unlocks and stores the AudioContext globally, so that after the first stream only a single interaction is required for the lifetime of that browser session. Signed-off-by: Dan Cunningham <dan@digitaldan.com> (cherry picked from commit b90cbc4)
@florian-h05 When cherry-picking commits to the patch release branches, please remember to add the "patch" label to the PR, because otherwise the fix is not picked up by the release notes script. Thanks! |
Fixes #1717.
Safari (and Chrome possibly as well) requires a user interaction after a web audio stream has been requested, which means audio will not play until at least one stream has been started and then the user clicks somewhere in the web app.
This implements a workaround (https://www.mattmontag.com/web/unlock-web-audio-in-safari-for-ios-and-macos) which unlocks and stores the AudioContext globally, so that after the first stream only a single interaction is required for the lifetime of that browser session.