From d5a0420f74f87cad349b50551e349f145b6b9344 Mon Sep 17 00:00:00 2001 From: Thomas Petersen <67438283+Greenlandicsmiley@users.noreply.github.com> Date: Mon, 16 Jan 2023 16:34:05 -0300 Subject: [PATCH] Attempt to fix certain ping sound issues on Arch Linux (#4285) --- src/controllers/notifications/NotificationController.cpp | 5 ++++- src/messages/SharedMessageBuilder.cpp | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 1205e44b5..2028c9839 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -106,12 +106,15 @@ void NotificationController::playSound() getSettings()->notificationPathSound.getValue()) : QUrl("qrc:/sounds/ping2.wav"); - if (currentPlayerUrl != highlightSoundUrl) + // Set media if the highlight sound url has changed, or if media is buffered + if (currentPlayerUrl != highlightSoundUrl || + player->mediaStatus() == QMediaPlayer::BufferedMedia) { player->setMedia(highlightSoundUrl); currentPlayerUrl = highlightSoundUrl; } + player->play(); } diff --git a/src/messages/SharedMessageBuilder.cpp b/src/messages/SharedMessageBuilder.cpp index c428375d3..426ead827 100644 --- a/src/messages/SharedMessageBuilder.cpp +++ b/src/messages/SharedMessageBuilder.cpp @@ -234,8 +234,9 @@ void SharedMessageBuilder::triggerHighlights() { if (auto player = getPlayer()) { - // update the media player url if necessary - if (currentPlayerUrl != this->highlightSoundUrl_) + // Set media if the highlight sound url has changed, or if media is buffered + if (currentPlayerUrl != this->highlightSoundUrl_ || + player->mediaStatus() == QMediaPlayer::BufferedMedia) { player->setMedia(this->highlightSoundUrl_);