| | |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| | | import com.genersoft.iot.vmp.service.IMediaService; |
| | | import com.genersoft.iot.vmp.service.IPlayService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | @Api(tags = "国标设备点播") |
| | | @Tag(name = "国标设备点播") |
| | | @CrossOrigin |
| | | @RestController |
| | | @RequestMapping("/api/play") |
| | |
| | | @Autowired |
| | | private IMediaServerService mediaServerService; |
| | | |
| | | @ApiOperation("开始点播") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), |
| | | }) |
| | | @Operation(summary = "开始点播") |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @GetMapping("/start/{deviceId}/{channelId}") |
| | | public DeferredResult<ResponseEntity<String>> play(@PathVariable String deviceId, |
| | | @PathVariable String channelId) { |
| | |
| | | return playResult.getResult(); |
| | | } |
| | | |
| | | @ApiOperation("停止点播") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备ID", dataTypeClass = String.class), |
| | | @ApiImplicitParam(name = "channelId", value = "通道ID", dataTypeClass = String.class), |
| | | }) |
| | | |
| | | @Operation(summary = "停止点播") |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @GetMapping("/stop/{deviceId}/{channelId}") |
| | | public DeferredResult<ResponseEntity<String>> playStop(@PathVariable String deviceId, @PathVariable String channelId) { |
| | | |
| | |
| | | // 超时处理 |
| | | result.onTimeout(()->{ |
| | | logger.warn(String.format("设备预览/回放停止超时,deviceId/channelId:%s_%s ", deviceId, channelId)); |
| | | redisCatchStorage.stopPlay(streamInfo); |
| | | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); |
| | | RequestMessage msg = new RequestMessage(); |
| | | msg.setId(uuid); |
| | | msg.setKey(key); |
| | |
| | | * @param streamId 流ID |
| | | * @return |
| | | */ |
| | | @ApiOperation("将不是h264的视频通过ffmpeg 转码为h264 + aac") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "streamId", value = "视频流ID", dataTypeClass = String.class), |
| | | }) |
| | | @Operation(summary = "将不是h264的视频通过ffmpeg 转码为h264 + aac") |
| | | @Parameter(name = "streamId", description = "视频流ID", required = true) |
| | | @PostMapping("/convert/{streamId}") |
| | | public ResponseEntity<String> playConvert(@PathVariable String streamId) { |
| | | StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId); |
| | |
| | | * @param key |
| | | * @return |
| | | */ |
| | | @ApiOperation("结束转码") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "key", value = "视频流key", dataTypeClass = String.class), |
| | | }) |
| | | @Operation(summary = "结束转码") |
| | | @Parameter(name = "key", description = "视频流key", required = true) |
| | | @Parameter(name = "mediaServerId", description = "流媒体服务ID", required = true) |
| | | @PostMapping("/convertStop/{key}") |
| | | public ResponseEntity<String> playConvertStop(@PathVariable String key, String mediaServerId) { |
| | | JSONObject result = new JSONObject(); |
| | |
| | | |
| | | } |
| | | |
| | | @ApiOperation("语音广播命令") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = String.class), |
| | | }) |
| | | @Operation(summary = "语音广播命令") |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @GetMapping("/broadcast/{deviceId}") |
| | | @PostMapping("/broadcast/{deviceId}") |
| | | public DeferredResult<ResponseEntity<String>> broadcastApi(@PathVariable String deviceId) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | @ApiOperation("获取所有的ssrc") |
| | | @Operation(summary = "获取所有的ssrc") |
| | | @GetMapping("/ssrc") |
| | | public WVPResult<JSONObject> getSSRC() { |
| | | if (logger.isDebugEnabled()) { |