File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,12 +44,7 @@ void MediaController::handleEarDetection(EarDetection *earDetection)
4444
4545 if (shouldPause && isActiveOutputDeviceAirPods ())
4646 {
47- QProcess process;
48- process.start (" playerctl" , QStringList () << " status" );
49- process.waitForFinished ();
50- QString playbackStatus = process.readAllStandardOutput ().trimmed ();
51- LOG_DEBUG (" Playback status: " << playbackStatus);
52- if (playbackStatus == " Playing" )
47+ if (m_mediaState == Playing)
5348 {
5449 pause ();
5550 }
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class MediaController : public QObject
4343
4444 void play ();
4545 void pause ();
46+ MediaState getCurrentMediaState () const { return m_mediaState; };
4647
4748Q_SIGNALS:
4849 void mediaStateChanged (MediaState state);
@@ -59,6 +60,7 @@ class MediaController : public QObject
5960 EarDetectionBehavior earDetectionBehavior = PauseWhenOneRemoved;
6061 QString m_deviceOutputName;
6162 PlayerStatusWatcher *playerStatusWatcher = nullptr ;
63+ MediaState m_mediaState = Stopped;
6264};
6365
6466#endif // MEDIACONTROLLER_H
You can’t perform that action at this time.
0 commit comments