src/main/java/com/dji/sample/common/error/LiveErrorEnum.java
@@ -63,6 +63,7 @@ /** * Get the corresponding enumeration object based on the error code. * 根据错误代码获取相应的枚举对象。 * @param code error code * @return enumeration object */ src/main/java/com/dji/sample/component/mqtt/service/IMessageSenderService.java
@@ -28,6 +28,7 @@ /** * Send message and receive a response at the same time. * 发送消息并同时接收响应。 * @param clazz * @param topic * @param response notification of whether the start is successful. src/main/java/com/dji/sample/manage/controller/LiveStreamController.java
@@ -64,6 +64,7 @@ /** * Live streaming according to the parameters passed in from the web side. * 根据从web端传入的参数进行直播。 * @param liveParam Live streaming parameters. * @return */ @@ -74,6 +75,7 @@ /** * Stop live streaming according to the parameters passed in from the web side. * 根据从web端传入的参数停止直播。 * @param liveParam Live streaming parameters. * @return */ src/main/java/com/dji/sample/manage/service/ICapacityCameraService.java
@@ -14,6 +14,7 @@ /** * Query all camera data that can be live streamed from this device based on the device sn. * 根据设备序列号查询该设备可直播的所有摄像头数据。 * @param deviceSn * @return */ src/main/java/com/dji/sample/manage/service/IDeviceRedisService.java
@@ -17,6 +17,7 @@ /** * Determine if the device is online. * 判断设备是否在线 * @param sn * @return */ src/main/java/com/dji/sample/manage/service/IDeviceService.java
@@ -69,6 +69,7 @@ /** * Obtain device data according to different query conditions. * 根据不同的查询条件获取设备数据。 * @param param query parameters * @return */ @@ -171,6 +172,7 @@ /** * Get device information based on device's sn. * 根据设备码获取设备信息 * @param sn device's sn * @return device */ src/main/java/com/dji/sample/manage/service/ILiveStreamService.java
@@ -31,6 +31,7 @@ /** * Initiate a live streaming by publishing mqtt message. * 通过发布mqtt消息启动实时流。 * @param liveParam Parameters needed for on-demand. * @return */ @@ -38,6 +39,7 @@ /** * Stop the live streaming by publishing mqtt message. * 通过发布mqtt消息来停止实时流。 * @param videoId * @return */ src/main/java/com/dji/sample/manage/service/impl/DeviceServiceImpl.java
@@ -279,10 +279,13 @@ 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()), src/main/java/com/dji/sample/manage/service/impl/LiveStreamServiceImpl.java
@@ -65,6 +65,7 @@ // 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())) @@ -97,6 +98,7 @@ // 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; @@ -104,11 +106,14 @@ 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"); @@ -122,6 +127,7 @@ LiveUrlTypeEnum urlType = LiveUrlTypeEnum.find(liveParam.getUrlType()); LiveDTO live = new LiveDTO(); //对不同的协议类型做处理 switch (urlType) { case RTMP: // live.setUrl(liveParam.getUrl().replace("rtmp", "webrtc")); @@ -156,6 +162,7 @@ return responseResult; } //thing/product/{gateway_sn}/services String respTopic = THING_MODEL_PRE + PRODUCT + responseResult.getData().getDeviceSn() + SERVICES_SUF; videoId = videoId.replace("_","/"); @@ -228,6 +235,7 @@ /** * Check if this lens is available live. * 检查镜头是否可用 * @param videoId * @return */ @@ -309,6 +317,7 @@ /** * Send a message to the pilot via mqtt to start the live streaming. *通过mqtt向飞行员发送消息以启动直播。 * @param topic * @param liveParam * @return