| | |
| | | result.onCompletion(()->{ |
| | | // 点播结束时调用截图接口 |
| | | // TODO 应该在上流时调用更好,结束也可能是错误结束 |
| | | String path = "static/static/snap/"; |
| | | String path = "snap"; |
| | | String fileName = deviceId + "_" + channelId + ".jpg"; |
| | | ResponseEntity responseEntity = (ResponseEntity)result.getResult(); |
| | | if (responseEntity != null && responseEntity.getStatusCode() == HttpStatus.OK) { |
| | |
| | | streamInfo = null; |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | if (streamInfo == null) { |
| | |
| | | }, userSetting.getPlayTimeout()); |
| | | final String ssrc = ssrcInfo.getSsrc(); |
| | | final String stream = ssrcInfo.getStream(); |
| | | //端口获取失败的ssrcInfo 没有必要发送点播指令 |
| | | if(ssrcInfo.getPort() <= 0){ |
| | | logger.info("[点播端口分配异常],deviceId={},channelId={},ssrcInfo={}", device.getDeviceId(), channelId, ssrcInfo); |
| | | return; |
| | | } |
| | | cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> { |
| | | logger.info("收到订阅消息: " + response.toJSONString()); |
| | | dynamicTask.stop(timeOutTaskKey); |
| | |
| | | public StreamInfo onPublishHandler(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId) { |
| | | String streamId = resonse.getString("stream"); |
| | | JSONArray tracks = resonse.getJSONArray("tracks"); |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks); |
| | | StreamInfo streamInfo = mediaService.getStreamInfoByAppAndStream(mediaServerItem,"rtp", streamId, tracks, null); |
| | | streamInfo.setDeviceID(deviceId); |
| | | streamInfo.setChannelId(channelId); |
| | | return streamInfo; |