fix(snap): 修复国标级联无法截图的问题
parent
319cdd2151
commit
38ab21d3a0
|
@ -280,18 +280,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
InviteErrorCode.SUCCESS.getMsg(),
|
InviteErrorCode.SUCCESS.getMsg(),
|
||||||
streamInfo);
|
streamInfo);
|
||||||
logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
logger.info("[点播成功] deviceId: {}, channelId: {}", device.getDeviceId(), channelId);
|
||||||
String streamUrl;
|
snapOnPlay(mediaServerItemInuse, device.getDeviceId(), channelId, streamInfo.getStream());
|
||||||
if (mediaServerItemInuse.getRtspPort() != 0) {
|
|
||||||
streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", ssrcInfo.getStream());
|
|
||||||
}else {
|
|
||||||
streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.mp4", mediaServerItemInuse.getHttpPort(), "rtp", ssrcInfo.getStream());
|
|
||||||
}
|
|
||||||
String path = "snap";
|
|
||||||
String fileName = device.getDeviceId() + "_" + channelId + ".jpg";
|
|
||||||
// 请求截图
|
|
||||||
logger.info("[请求截图]: " + fileName);
|
|
||||||
zlmresTfulUtils.getSnap(mediaServerItemInuse, streamUrl, 15, 1, path, fileName);
|
|
||||||
|
|
||||||
}, (event) -> {
|
}, (event) -> {
|
||||||
inviteInfo.setStatus(InviteSessionStatus.ok);
|
inviteInfo.setStatus(InviteSessionStatus.ok);
|
||||||
|
|
||||||
|
@ -376,6 +365,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
InviteErrorCode.SUCCESS.getCode(),
|
InviteErrorCode.SUCCESS.getCode(),
|
||||||
InviteErrorCode.SUCCESS.getMsg(),
|
InviteErrorCode.SUCCESS.getMsg(),
|
||||||
streamInfo);
|
streamInfo);
|
||||||
|
snapOnPlay(mediaServerItemInUse, device.getDeviceId(), channelId, stream);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -446,6 +436,28 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点播成功时调用截图.
|
||||||
|
*
|
||||||
|
* @param mediaServerItemInuse media
|
||||||
|
* @param deviceId 设备 ID
|
||||||
|
* @param channelId 通道 ID
|
||||||
|
* @param stream ssrc
|
||||||
|
*/
|
||||||
|
private void snapOnPlay(MediaServerItem mediaServerItemInuse, String deviceId, String channelId, String stream) {
|
||||||
|
String streamUrl;
|
||||||
|
if (mediaServerItemInuse.getRtspPort() != 0) {
|
||||||
|
streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServerItemInuse.getRtspPort(), "rtp", stream);
|
||||||
|
} else {
|
||||||
|
streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.mp4", mediaServerItemInuse.getHttpPort(), "rtp", stream);
|
||||||
|
}
|
||||||
|
String path = "snap";
|
||||||
|
String fileName = deviceId + "_" + channelId + ".jpg";
|
||||||
|
// 请求截图
|
||||||
|
logger.info("[请求截图]: " + fileName);
|
||||||
|
zlmresTfulUtils.getSnap(mediaServerItemInuse, streamUrl, 15, 1, path, fileName);
|
||||||
|
}
|
||||||
|
|
||||||
private StreamInfo onPublishHandlerForPlay(MediaServerItem mediaServerItem, JSONObject response, String deviceId, String channelId) {
|
private StreamInfo onPublishHandlerForPlay(MediaServerItem mediaServerItem, JSONObject response, String deviceId, String channelId) {
|
||||||
StreamInfo streamInfo = onPublishHandler(mediaServerItem, response, deviceId, channelId);
|
StreamInfo streamInfo = onPublishHandler(mediaServerItem, response, deviceId, channelId);
|
||||||
if (streamInfo != null) {
|
if (streamInfo != null) {
|
||||||
|
|
Loading…
Reference in New Issue