Attempt to fix certain ping sound issues on Arch Linux (#4285)

This commit is contained in:
Thomas Petersen 2023-01-16 16:34:05 -03:00 committed by GitHub
parent 9255374720
commit d5a0420f74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -106,12 +106,15 @@ void NotificationController::playSound()
getSettings()->notificationPathSound.getValue()) getSettings()->notificationPathSound.getValue())
: QUrl("qrc:/sounds/ping2.wav"); : 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); player->setMedia(highlightSoundUrl);
currentPlayerUrl = highlightSoundUrl; currentPlayerUrl = highlightSoundUrl;
} }
player->play(); player->play();
} }

View file

@ -234,8 +234,9 @@ void SharedMessageBuilder::triggerHighlights()
{ {
if (auto player = getPlayer()) if (auto player = getPlayer())
{ {
// update the media player url if necessary // Set media if the highlight sound url has changed, or if media is buffered
if (currentPlayerUrl != this->highlightSoundUrl_) if (currentPlayerUrl != this->highlightSoundUrl_ ||
player->mediaStatus() == QMediaPlayer::BufferedMedia)
{ {
player->setMedia(this->highlightSoundUrl_); player->setMedia(this->highlightSoundUrl_);