修改获取的流地址

This commit is contained in:
cxh 2026-01-07 17:00:02 +08:00
parent d5768b2511
commit 9c639335ea
2 changed files with 6 additions and 3 deletions

View File

@ -113,8 +113,11 @@ static void handle_video_down_request(const nlohmann::json& req)
int loc = 0; int loc = 0;
for (const auto& ch : channels_info) for (const auto& ch : channels_info)
{ {
resp["data"].push_back({{"loc", loc}, {"url", ch.url}}); if (ch.running)
loc++; {
resp["data"].push_back({{"loc", loc}, {"url", ch.url}});
loc++;
}
} }
mqtt_client->publish(g_app_config.mqtt.topics.video_down, resp.dump(-1), 1); mqtt_client->publish(g_app_config.mqtt.topics.video_down, resp.dump(-1), 1);

View File

@ -306,7 +306,7 @@ bool RTMPManager::is_streaming(const std::string& cam_name)
std::string RTMPManager::get_stream_url(const std::string& cam_name) std::string RTMPManager::get_stream_url(const std::string& cam_name)
{ {
std::string ip = get_ip_address("enP2p33s0"); std::string ip = get_ip_address("enP2p33s0");
if (ip.empty()) ip = "127.0.0.1"; if (ip.empty()) ip = "192.168.4.194";
return "http://" + ip + ":11985/rtc/v1/whep/?app=camera&stream=" + cam_name + "_main&vhost=live"; return "http://" + ip + ":11985/rtc/v1/whep/?app=camera&stream=" + cam_name + "_main&vhost=live";
} }