| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.service.IDeviceService; |
| | | import com.genersoft.iot.vmp.service.IPlayService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | |
| | | import javax.sip.InvalidArgumentException; |
| | | import javax.sip.SipException; |
| | | import java.text.ParseException; |
| | | |
| | | /** |
| | | * API兼容:实时直播 |
| | |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private IDeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private IPlayService playService; |
| | |
| | | result.put("RTMP", streamInfo.getRtmp()); |
| | | result.put("HLS", streamInfo.getHls()); |
| | | result.put("RTSP", streamInfo.getRtsp()); |
| | | result.put("WEBRTC", streamInfo.getRtc()); |
| | | result.put("CDN", ""); |
| | | result.put("SnapURL", ""); |
| | | result.put("Transport", device.getTransport()); |
| | |
| | | result.put("error","未找到流信息"); |
| | | return result; |
| | | } |
| | | cmder.streamByeCmd(serial, code, streamInfo.getStream(), null); |
| | | Device device = deviceService.queryDevice(serial); |
| | | if (device == null) { |
| | | JSONObject result = new JSONObject(); |
| | | result.put("error","未找到设备"); |
| | | return result; |
| | | } |
| | | try { |
| | | cmder.streamByeCmd(device, code, streamInfo.getStream(), null); |
| | | } catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) { |
| | | JSONObject result = new JSONObject(); |
| | | result.put("error","发送BYE失败:" + e.getMessage()); |
| | | return result; |
| | | } |
| | | redisCatchStorage.stopPlay(streamInfo); |
| | | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); |
| | | return null; |