Conversation
This reverts commit 59a6377.
| // GH#12258: We learned that if you leave the MediaPlayer open, and | ||
| // press the media keys (like play/pause), then the OS will _replay the | ||
| // bell_. So we have to re-create the MediaPlayer each time we want to | ||
| // play the bell, to make sure a subsequent play doesn't come through | ||
| // and reactivate the old one. |
There was a problem hiding this comment.
Isn't this kinda BODGY and we should upstream the request for this? AFAIK MediaPlayer is THE way to be playing sounds/media now and not some legacy API so it should offer a way of not having it get captured by the media overlay controls.
| // We need to make sure clear out the current track | ||
| // that's being played, again, so that the system can't | ||
| // come through and replay it. In testing, we needed to | ||
| // do this, closing the MediaPlayer alone wasn't good |
src/cascadia/TerminalApp/Pane.cpp
Outdated
| winrt::fire_and_forget Pane::_playBellSound(winrt::Windows::Foundation::Uri uri) | ||
| { | ||
| auto weakThis{ shared_from_this() }; | ||
| std::weak_ptr<Pane> weakThis{ shared_from_this() }; |
There was a problem hiding this comment.
gods I coulda swore that didn't compile
|
|
||
| // This lambda will clean up the bell player when we're done with it. | ||
| std::weak_ptr<Pane> weakThis2{ shared_from_this() }; | ||
| _mediaEndedRevoker = _bellPlayer.MediaEnded(winrt::auto_revoke, [weakThis2](auto&&, auto&&) { |
There was a problem hiding this comment.
what series of callbacks do we get for multiple bells?
There was a problem hiding this comment.
If you bell while another is playing (in this pane), we'll stop the first bell and replace it with the second one, and only get MediaEnded when the last bell in that pane comes to an end.
|
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
Sorry for combining two fixes in one PR. I can separate if need be.
"bellSound": nulldidn't work. This one was easier, and is atomically in bcc2ca0. Basically, we would deserialize that as an array with a single empty string in it, which we'd try to then play. I think it's more idomatic to have that deserialized as an empty array, which correctly falls back to playing the default sound.no.mp4for this since that's like, 17s long