fixed pingsound not playing sometimes
This commit is contained in:
@@ -143,9 +143,21 @@ bool TwitchMessageBuilder::isIgnored() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TwitchMessageBuilder::triggerHighlights()
|
inline QMediaPlayer *getPlayer()
|
||||||
|
{
|
||||||
|
if (isGuiThread())
|
||||||
{
|
{
|
||||||
static auto player = new QMediaPlayer;
|
static auto player = new QMediaPlayer;
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TwitchMessageBuilder::triggerHighlights()
|
||||||
|
{
|
||||||
static QUrl currentPlayerUrl;
|
static QUrl currentPlayerUrl;
|
||||||
|
|
||||||
if (this->historicalMessage_)
|
if (this->historicalMessage_)
|
||||||
@@ -164,6 +176,8 @@ void TwitchMessageBuilder::triggerHighlights()
|
|||||||
bool resolveFocus = !hasFocus || getSettings()->highlightAlwaysPlaySound;
|
bool resolveFocus = !hasFocus || getSettings()->highlightAlwaysPlaySound;
|
||||||
|
|
||||||
if (this->highlightSound_ && resolveFocus)
|
if (this->highlightSound_ && resolveFocus)
|
||||||
|
{
|
||||||
|
if (auto player = getPlayer())
|
||||||
{
|
{
|
||||||
// update the media player url if necessary
|
// update the media player url if necessary
|
||||||
QUrl highlightSoundUrl =
|
QUrl highlightSoundUrl =
|
||||||
@@ -181,6 +195,7 @@ void TwitchMessageBuilder::triggerHighlights()
|
|||||||
|
|
||||||
player->play();
|
player->play();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (this->highlightAlert_)
|
if (this->highlightAlert_)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user