修复ui录象播放

优化录象查询接口
This commit is contained in:
648540858
2020-10-26 11:40:46 +08:00
parent ef19b4f85f
commit 9361943e47
20 changed files with 648 additions and 442 deletions

View File

@@ -183,4 +183,12 @@ public interface IVideoManagerStorager {
StreamInfo queryPlayByDevice(String deviceId, String code);
Map<String, StreamInfo> queryPlayByDeviceId(String deviceId);
boolean startPlayBlack(StreamInfo streamInfo);
boolean stopPlayBlack(StreamInfo streamInfo);
StreamInfo queryPlayBlackByDevice(String deviceId, String channelId);
StreamInfo queryPlayBlackBySSRC(String ssrc);
}

View File

@@ -190,6 +190,27 @@ public class VideoManagerJdbcStoragerImpl implements IVideoManagerStorager {
@Override
public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) {
return null;
}
@Override
public boolean startPlayBlack(StreamInfo streamInfo) {
return false;
}
@Override
public boolean stopPlayBlack(StreamInfo streamInfo) {
return false;
}
@Override
public StreamInfo queryPlayBlackByDevice(String deviceId, String channelId) {
return null;
}
@Override
public StreamInfo queryPlayBlackBySSRC(String ssrc) {
return null;
}
}

View File

@@ -410,6 +410,14 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
return (StreamInfo)redis.get(playLeys.get(0).toString());
}
@Override
public StreamInfo queryPlayBlackBySSRC(String ssrc) {
// List<Object> playLeys = redis.keys(String.format("%S_%s_*", VideoManagerConstants.PLAYER_PREFIX, ssrc));
List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.PLAY_BLACK_PREFIX, ssrc));
if (playLeys == null || playLeys.size() == 0) return null;
return (StreamInfo)redis.get(playLeys.get(0).toString());
}
@Override
public StreamInfo queryPlayByDevice(String deviceId, String code) {
// List<Object> playLeys = redis.keys(String.format("%S_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
@@ -498,5 +506,37 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
}
@Override
public boolean startPlayBlack(StreamInfo stream) {
return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getSsrc(),stream.getDeviceID(), stream.getCahnnelId()),
stream);
}
@Override
public boolean stopPlayBlack(StreamInfo streamInfo) {
if (streamInfo == null) return false;
DeviceChannel deviceChannel = queryChannel(streamInfo.getDeviceID(), streamInfo.getCahnnelId());
if (deviceChannel != null) {
deviceChannel.setSsrc(null);
deviceChannel.setPlay(false);
updateChannel(streamInfo.getDeviceID(), deviceChannel);
}
return redis.del(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
streamInfo.getSsrc(),
streamInfo.getDeviceID(),
streamInfo.getCahnnelId()));
}
@Override
public StreamInfo queryPlayBlackByDevice(String deviceId, String code) {
String format = String.format("%S_*_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
deviceId,
code);
List<Object> playLeys = redis.scan(String.format("%S_*_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX,
deviceId,
code));
if (playLeys == null || playLeys.size() == 0) return null;
return (StreamInfo)redis.get(playLeys.get(0).toString());
}
}