zhaowenyu
2025-12-24 19763ebd20ad16435f3c1ccfdc8abd1518712cc1
ard-admin/src/main/java/com/ard/web/controller/sample/LiveStreamController.java
@@ -4,9 +4,13 @@
import com.ard.common.utils.SecurityUtils;
import com.ard.sample.common.model.ResponseResult;
import com.ard.sample.component.mqtt.model.ChannelName;
import com.ard.sample.component.websocket.handler.LiveStreamHandler;
import com.ard.sample.manage.model.dto.CapacityDeviceDTO;
import com.ard.sample.manage.model.dto.LiveTypeDTO;
import com.ard.sample.manage.model.param.RemoteDebugParam;
import com.ard.sample.manage.model.receiver.LiveCapacityReceiver;
import com.ard.sample.manage.model.receiver.LiveStatusTwoReceiver;
import com.ard.sample.manage.service.IDeviceService;
import com.ard.sample.manage.service.ILiveStreamService;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.swagger.annotations.Api;
@@ -37,6 +41,9 @@
    private ILiveStreamService liveStreamService;
    @Autowired
    private LiveStreamHandler _liveStreamHandler;
    @Autowired
    private ObjectMapper mapper;
    /**
@@ -48,6 +55,15 @@
    @ServiceActivator(inputChannel = ChannelName.INBOUND_STATE_CAPACITY)
    public void stateCapacity(LiveCapacityReceiver liveCapacity, MessageHeaders headers) {
        liveStreamService.saveLiveCapacity(liveCapacity, headers.getTimestamp());
    }
    /**
     * 处理摄像头返回状态
     * */
    @ServiceActivator(inputChannel = ChannelName.INBOUND_STATE_STATUS)
    public void LiveStateStatus(LiveStatusTwoReceiver liveReceiver, MessageHeaders headers) {
//        log.info("摄像头返回状态通道INBOUND_STATE_STATUS:{}", liveReceiver);
    }
    /**
@@ -66,6 +82,27 @@
        return ResponseResult.success(liveCapacity);
    }
    @ApiOperation(value = "获取sn设备的摄像头模式", notes = "获取sn设备的直播能力数据中摄像头的videotype数组")
    @GetMapping("/videotype")
    public ResponseResult<List<String>> getVideoType(String sn){
        return liveStreamService.getLiveLens(sn);
    }
    @ApiOperation("获取video_id")
    @PostMapping("/videoid/{sn}")
    public ResponseResult<LiveTypeDTO> getVideoId(@PathVariable String sn) {
        LiveTypeDTO liveTypeDTO = new LiveTypeDTO();
        try{
            liveTypeDTO = _liveStreamHandler.getLiveParam(sn);
        }
        catch (Exception e){
            // videoId = e.getMessage();
            e.printStackTrace();
        }
        return ResponseResult.success(liveTypeDTO);
    }
    /**
     * Live streaming according to the parameters passed in from the web side.
     *