mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-02-10 19:52:24 +00:00
[Linux] Don't use playerctl for current media state
This commit is contained in:
committed by
Tim Gromeyer
parent
aaf82c9738
commit
48ae249405
@@ -44,12 +44,7 @@ void MediaController::handleEarDetection(EarDetection *earDetection)
|
|||||||
|
|
||||||
if (shouldPause && isActiveOutputDeviceAirPods())
|
if (shouldPause && isActiveOutputDeviceAirPods())
|
||||||
{
|
{
|
||||||
QProcess process;
|
if (m_mediaState == Playing)
|
||||||
process.start("playerctl", QStringList() << "status");
|
|
||||||
process.waitForFinished();
|
|
||||||
QString playbackStatus = process.readAllStandardOutput().trimmed();
|
|
||||||
LOG_DEBUG("Playback status: " << playbackStatus);
|
|
||||||
if (playbackStatus == "Playing")
|
|
||||||
{
|
{
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
|
|
||||||
void play();
|
void play();
|
||||||
void pause();
|
void pause();
|
||||||
|
MediaState getCurrentMediaState() const { return m_mediaState; };
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void mediaStateChanged(MediaState state);
|
void mediaStateChanged(MediaState state);
|
||||||
@@ -59,6 +60,7 @@ private:
|
|||||||
EarDetectionBehavior earDetectionBehavior = PauseWhenOneRemoved;
|
EarDetectionBehavior earDetectionBehavior = PauseWhenOneRemoved;
|
||||||
QString m_deviceOutputName;
|
QString m_deviceOutputName;
|
||||||
PlayerStatusWatcher *playerStatusWatcher = nullptr;
|
PlayerStatusWatcher *playerStatusWatcher = nullptr;
|
||||||
|
MediaState m_mediaState = Stopped;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MEDIACONTROLLER_H
|
#endif // MEDIACONTROLLER_H
|
||||||
Reference in New Issue
Block a user