diff --git a/server/stream_server.cpp b/server/stream_server.cpp index 706f8ca2..9b446027 100644 --- a/server/stream_server.cpp +++ b/server/stream_server.cpp @@ -19,6 +19,7 @@ #include "stream_server.hpp" #include "common/aixlog.hpp" #include "config.hpp" +#include "message/client_settings.hpp" #include "message/hello.hpp" #include "message/stream_tags.hpp" #include "message/time.hpp" @@ -634,6 +635,23 @@ void StreamServer::onMessageReceived(StreamSession* streamSession, const msg::Ba client->connected = true; } } + else if (baseMessage.type == message_type::kClientSettings) + { + ClientInfoPtr clientInfo = Config::instance().getClientInfo(streamSession->clientId); + if (clientInfo == nullptr) + { + LOG(ERROR) << "client not found: " << streamSession->clientId << "\n"; + return; + } + msg::ClientSettings settingsMsg; + settingsMsg.deserialize(baseMessage, buffer); + + clientInfo->config.volume.percent = settingsMsg.getVolume(); + clientInfo->config.volume.muted = settingsMsg.isMuted(); + jsonrpcpp::notification_ptr notification = make_shared( + "Client.OnVolumeChanged", jsonrpcpp::Parameter("id", streamSession->clientId, "volume", clientInfo->config.volume.toJson())); + controlServer_->send(notification->to_json().dump()); + } else if (baseMessage.type == message_type::kHello) { msg::Hello helloMsg;