Prevent Element appearing in system media controls
Use WebAudio API to play notification sound, so that it won't appear in system media control.
For now, if I leave element web in the background, it would have an <audio> element for playing notification sound, and there will be an entry in system media controls, making it impossible to control other music with media keys on the keyboard. This pr aims to fix that.
Before:
After:
Checklist
- [ ] Tests written for new code (and old code if feasible)
- [x] Linter and other CI checks pass
- [x] Sign-off given on the changes (see CONTRIBUTING.md)
Signed-off-by: 许煜恒 [email protected]
Type: defect
Here's what your changelog entry will look like:
🐛 Bug Fixes
- Prevent Element appearing in system media controls (#10995). Contributed by @SuperKenVery.
Ah, it seems that the latest commit of develop branch is broken... The page won't start on my machine. So I based my work on an earlier commit.
Corresponding element-web pr: https://github.com/vector-im/element-web/pull/25477
TODOs are now done 😄
It seems that Jest doesn't support WebAudio API, which means it won't be possible for me to pass the tests 🤣
https://github.com/jsdom/jsdom/issues/2900#issuecomment-599795854
Phew, now I've got (almost, see below) all <audio> tags removed and use WebAudioAPI, and the sounds work normally.
However, as I'm not familiar with the project, there's probably more to be cleaned up or even my code can be organized better... Tell me if any!
There's still one <audio id="remoteAudio"></audio>. I'm not sure what it does, and it seems that it's only used in tests, so I don't know what to do with it. However it's never played so I think even leaving it there wouldn't be a problem.
Does this also fix https://github.com/vector-im/element-web/issues/18643?
Does this also fix vector-im/element-web#18643?
I believe so, it should also fix that issue. Actually I'm doing this because of that issue 🤣 But I didn't find that one and just filed a pr 😃
This looks sane but needs some mocks created to pass tests, are you interested in getting this over the line?
I have zero experience in writing UI tests and mocks, and unfortunately I’m quite busy recently so :( No quite interested, sorry😮💨在 2024年6月21日,上午12:28,Michael Telatynski @.***> 写道: This looks sane but needs some mocks created to pass tests, are you interested in getting this over the line?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
I think we'll close this for now as it will need to pass the testing bar to get merged. If someone else wants to pick it up, they can always open a fresh PR. Ideally it would convert the various uses of audio separately to make smaller PRs. It will obviously need serious testing.
This is on my plate to get over the line