#include <QLoggingCategory>
#include <QQmlApplicationEngine>
+#ifdef Q_OS_WIN
+#include <Windows.h>
+#endif
+
Q_LOGGING_CATEGORY(playerCategory, "Player")
Player::Player(BackendPluginBase *backendPlugin, QObject *parent)
Q_CHECK_PTR(m_chapterModel);
}
-Player::~Player() { qCDebug(playerCategory) << "Destroying player" << this; }
+Player::~Player() {
+ qCDebug(playerCategory) << "Destroying player" << this;
+#ifdef Q_OS_WIN
+ SetThreadExecutionState(ES_CONTINUOUS);
+#endif
+}
BackendInstance *Player::backend() const { return m_backend; }
void Player::playStateChanged(PlayerPluginInterface::PlayState state) {
auto s = static_cast<PlayState>(state);
- // if (currentSource().isEmpty()) s = PlayState::Stopped;
if (m_state == s)
return;
m_state = s;
qCDebug(playerCategory) << "Play state changed to" << s;
+
+#ifdef Q_OS_WIN
+ if (m_state == PlayState::Playing)
+ SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED);
+ else
+ SetThreadExecutionState(ES_CONTINUOUS);
+#endif
+
emit stateChanged(s);
}