From d68071cda36d8d44b5a7f483a3f00482bcdedab8 Mon Sep 17 00:00:00 2001 From: redPanther Date: Wed, 10 Aug 2016 06:54:20 +0200 Subject: [PATCH] fix #158 (#161) --- libsrc/kodivideochecker/KODIVideoChecker.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libsrc/kodivideochecker/KODIVideoChecker.cpp b/libsrc/kodivideochecker/KODIVideoChecker.cpp index ee349438..143715c2 100644 --- a/libsrc/kodivideochecker/KODIVideoChecker.cpp +++ b/libsrc/kodivideochecker/KODIVideoChecker.cpp @@ -146,8 +146,15 @@ void KODIVideoChecker::receiveReply() emit videoMode(VIDEO_2D); QString type = resultArray[0].toObject()["type"].toString(); + int prevCurrentPlayerID = _currentPlayerID; _currentPlayerID = resultArray[0].toObject()["playerid"].toInt(); + // set initial player state + if (prevCurrentPlayerID == 0 && _currentPlayerID != 0) + { + _socket.write(_getCurrentPlaybackState.arg(_currentPlayerID).toUtf8()); + return; + } if (type == "video") { if (_currentPlaybackState) @@ -360,8 +367,6 @@ void KODIVideoChecker::connected() // send a request for the current player state _socket.write(_activePlayerRequest.toUtf8()); _socket.write(_checkScreensaverRequest.toUtf8()); - if (_currentPlayerID != 0) - _socket.write(_getCurrentPlaybackState.arg(_currentPlayerID).toUtf8()); } void KODIVideoChecker::disconnected()