由于ZLM服务提供的api接口【getMediaInfo】返回结果不在包含online值,因此只能根据调用【getMediaInfo】接口后的返回code值为“0”时来设置online的值。

pull/1624/head
xubinbin 2024-09-14 10:24:30 +08:00
parent 41de1f59ba
commit e0b54ac38d
2 changed files with 4 additions and 5 deletions

View File

@ -58,16 +58,12 @@ public class MediaInfo {
String schema = jsonObject.getString("schema");
mediaInfo.setSchema(schema);
Integer totalReaderCount = jsonObject.getInteger("totalReaderCount");
Boolean online = jsonObject.getBoolean("online");
Integer originType = jsonObject.getInteger("originType");
Long aliveSecond = jsonObject.getLong("aliveSecond");
Long bytesSpeed = jsonObject.getLong("bytesSpeed");
if (totalReaderCount != null) {
mediaInfo.setReaderCount(totalReaderCount);
}
if (online != null) {
mediaInfo.setOnline(online);
}
if (originType != null) {
mediaInfo.setOriginType(originType);
}

View File

@ -182,6 +182,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
}
JSONObject mediaJSON = data.getJSONObject(0);
MediaInfo mediaInfo = MediaInfo.getInstance(mediaJSON, mediaServer);
mediaInfo.setOnline(true);
StreamInfo streamInfo = getStreamInfoByAppAndStream(mediaServer, app, stream, mediaInfo, callId, true);
if (streamInfo != null) {
streamInfoList.add(streamInfo);
@ -232,7 +233,9 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
if (jsonObject.getInteger("code") != 0) {
return null;
}
return MediaInfo.getInstance(jsonObject, mediaServer);
MediaInfo mediaInfo = MediaInfo.getInstance(jsonObject, mediaServer);
mediaInfo.setOnline(true);
return mediaInfo;
}
@Override