| | |
| | | NO_CAMERA(613002, "没有找到相机。"), |
| | | |
| | | LIVE_STREAM_ALREADY_STARTED(613003, "摄像机已经开始直播了。"), |
| | | |
| | | |
| | | FUNCTION_NOT_SUPPORT(613004, "不支持该功能。"), |
| | | |
| | | |
| | | STRATEGY_NOT_SUPPORT(613005, "不支持该策略。"), |
| | | |
| | | |
| | | NOT_IN_CAMERA_INTERFACE(613006, "当前的应用程序不在摄像头界面中。"), |
| | | |
| | | |
| | | NO_FLIGHT_CONTROL(613007, "遥控器没有飞行控制权限,无法响应控制命令。"), |
| | | |
| | | NO_STREAM_DATA(613008, "当前应用程序没有流数据。"), |
| | | |
| | | |
| | | TOO_FREQUENT(613009, "操作太频繁了。"), |
| | | |
| | | |
| | | ENABLE_FAILED(613010, "请检查直播服务是否正常。"), |
| | | |
| | | |
| | | NO_LIVE_STREAM(613011, "目前没有直播。"), |
| | | |
| | | |
| | | SWITCH_NOT_SUPPORT(613012, "直播流中已经有另一个摄像头了。不支持直接切换流。"), |
| | | |
| | | URL_TYPE_NOT_SUPPORTED(613013, "不支持此url类型。"), |
| | |
| | | |
| | | /** |
| | | * Get the corresponding enumeration object based on the error code. |
| | | * 根据错误代码获取相应的枚举对象。 |
| | | * @param code error code |
| | | * @return enumeration object |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Send message and receive a response at the same time. |
| | | * 发送消息并同时接收响应。 |
| | | * @param clazz |
| | | * @param topic |
| | | * @param response notification of whether the start is successful. |
| | |
| | | |
| | | /** |
| | | * Live streaming according to the parameters passed in from the web side. |
| | | * 根据从web端传入的参数进行直播。 |
| | | * @param liveParam Live streaming parameters. |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Stop live streaming according to the parameters passed in from the web side. |
| | | * 根据从web端传入的参数停止直播。 |
| | | * @param liveParam Live streaming parameters. |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Query all camera data that can be live streamed from this device based on the device sn. |
| | | * 根据设备序列号查询该设备可直播的所有摄像头数据。 |
| | | * @param deviceSn |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Determine if the device is online. |
| | | * 判断设备是否在线 |
| | | * @param sn |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Obtain device data according to different query conditions. |
| | | * 根据不同的查询条件获取设备数据。 |
| | | * @param param query parameters |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Get device information based on device's sn. |
| | | * 根据设备码获取设备信息 |
| | | * @param sn device's sn |
| | | * @return device |
| | | */ |
| | |
| | | */ |
| | | Boolean checkAuthorityFlight(String gatewaySn); |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * Initiate a live streaming by publishing mqtt message. |
| | | * 通过发布mqtt消息启动实时流。 |
| | | * @param liveParam Parameters needed for on-demand. |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Stop the live streaming by publishing mqtt message. |
| | | * 通过发布mqtt消息来停止实时流。 |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | |
| | | public List<DeviceDTO> getDevicesByParams(DeviceQueryParam param) { |
| | | return mapper.selectList( |
| | | new LambdaQueryWrapper<DeviceEntity>() |
| | | //设备编码 |
| | | .eq(StringUtils.hasText(param.getDeviceSn()), |
| | | DeviceEntity::getDeviceSn, param.getDeviceSn()) |
| | | //设备类型 |
| | | .eq(param.getDeviceType() != null, |
| | | DeviceEntity::getDeviceType, param.getDeviceType()) |
| | | //负载类型 |
| | | .eq(param.getSubType() != null, |
| | | DeviceEntity::getSubType, param.getSubType()) |
| | | .eq(StringUtils.hasText(param.getChildSn()), |
| | |
| | | } |
| | | return deviceBasic.getPayloads(); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | // Query the live capability of each drone. |
| | | return devicesList.stream() |
| | | //过滤出在线设备 |
| | | .filter(device -> deviceRedisService.checkDeviceOnline(device.getDeviceSn())) |
| | | .map(device -> CapacityDeviceDTO.builder() |
| | | .name(Objects.requireNonNullElse(device.getNickname(), device.getDeviceName())) |
| | |
| | | // liveParam.setVideoId(streamId_2); |
| | | |
| | | // Check if this lens is available live. |
| | | //检查镜头是否可用 |
| | | ResponseResult responseResult = this.checkBeforeLive(liveParam.getVideoId()); |
| | | if (ResponseResult.CODE_SUCCESS != responseResult.getCode()) { |
| | | return responseResult; |
| | |
| | | |
| | | DeviceDTO data = (DeviceDTO)responseResult.getData(); |
| | | // target topic |
| | | //thing/product/{gateway_sn}/services 云平台向设备发送的服务 |
| | | String respTopic = THING_MODEL_PRE + PRODUCT + |
| | | data.getDeviceSn() + SERVICES_SUF; |
| | | |
| | | //获取返回结果 |
| | | ServiceReply receiveReply = this.publishLiveStart(respTopic, liveParam); |
| | | |
| | | //相机已经在直播中,请勿重复开启直播 |
| | | if(receiveReply.getResult() == 513003) { |
| | | LiveDTO live = new LiveDTO(); |
| | | live.setUrl(liveParam.getUrl().replace("rtmp", "https").replace("735","700") + ".flv"); |
| | |
| | | LiveUrlTypeEnum urlType = LiveUrlTypeEnum.find(liveParam.getUrlType()); |
| | | LiveDTO live = new LiveDTO(); |
| | | |
| | | //对不同的协议类型做处理 |
| | | switch (urlType) { |
| | | case RTMP: |
| | | // live.setUrl(liveParam.getUrl().replace("rtmp", "webrtc")); |
| | |
| | | return responseResult; |
| | | } |
| | | |
| | | //thing/product/{gateway_sn}/services |
| | | String respTopic = THING_MODEL_PRE + PRODUCT + responseResult.getData().getDeviceSn() + SERVICES_SUF; |
| | | |
| | | videoId = videoId.replace("_","/"); |
| | |
| | | |
| | | /** |
| | | * Check if this lens is available live. |
| | | * 检查镜头是否可用 |
| | | * @param videoId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * Send a message to the pilot via mqtt to start the live streaming. |
| | | *通过mqtt向飞行员发送消息以启动直播。 |
| | | * @param topic |
| | | * @param liveParam |
| | | * @return |