diff --git a/plugins/mprisremote/mprisremoteplugin.cpp b/plugins/mprisremote/mprisremoteplugin.cpp index e877e6600..4abbc7645 100644 --- a/plugins/mprisremote/mprisremoteplugin.cpp +++ b/plugins/mprisremote/mprisremoteplugin.cpp @@ -50,7 +50,7 @@ bool MprisRemotePlugin::receivePacket(const NetworkPacket& np) return false; if (np.has(QStringLiteral("player"))) { - m_players[m_currentPlayer]->parseNetworkPacket(np); + m_players[np.get(QStringLiteral("player"))]->parseNetworkPacket(np); } if (np.has(QStringLiteral("playerList"))) { @@ -59,6 +59,7 @@ bool MprisRemotePlugin::receivePacket(const NetworkPacket& np) m_players.clear(); for (const QString& player : players) { m_players[player] = new MprisRemotePlayer(); + requestPlayerStatus(player); } if (m_players.empty()) { @@ -84,10 +85,10 @@ QString MprisRemotePlugin::dbusPath() const return "/modules/kdeconnect/devices/" + device()->id() + "/mprisremote"; } -void MprisRemotePlugin::requestPlayerStatus() +void MprisRemotePlugin::requestPlayerStatus(const QString& player) { NetworkPacket np(PACKET_TYPE_MPRIS_REQUEST, { - {"player", m_currentPlayer}, + {"player", player}, {"requestNowPlaying", true}, {"requestVolume", true}} ); @@ -141,7 +142,7 @@ void MprisRemotePlugin::setPlayer(const QString& player) { if (m_currentPlayer != player) { m_currentPlayer = player; - requestPlayerStatus(); + requestPlayerStatus(player); Q_EMIT propertiesChanged(); } } diff --git a/plugins/mprisremote/mprisremoteplugin.h b/plugins/mprisremote/mprisremoteplugin.h index 6d83a123e..175f5e8c4 100644 --- a/plugins/mprisremote/mprisremoteplugin.h +++ b/plugins/mprisremote/mprisremoteplugin.h @@ -77,7 +77,7 @@ Q_SIGNALS: void propertiesChanged(); private: - void requestPlayerStatus(); + void requestPlayerStatus(const QString& player); QString m_currentPlayer; QMap m_players;