From d4da1dc91c3904885245c31c17bd9b8149f957af Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Tue, 7 Oct 2025 10:56:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=82=B9=E6=92=AD=E3=80=81?= =?UTF-8?q?=E5=81=9C=E6=AD=A2=E7=82=B9=E6=92=AD=E5=92=8C=E4=BA=91=E5=8F=B0?= =?UTF-8?q?=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/dao/CommonGBChannelMapper.java | 1 + .../service/IGbChannelPlayService.java | 2 +- .../iot/vmp/gb28181/service/IPlayService.java | 2 + .../gb28181/service/ISourcePlayService.java | 2 +- .../impl/GbChannelPlayServiceImpl.java | 6 +- .../gb28181/service/impl/PlayServiceImpl.java | 12 ++ .../impl/SourcePlayServiceForGbImpl.java | 4 +- .../impl/SourcePlayServiceForJTImpl.java | 2 +- .../SourcePlayServiceForStreamProxyImpl.java | 2 +- .../SourcePlayServiceForStreamPushImpl.java | 2 +- .../iot/vmp/vmanager/bean/WVPResult.java | 30 +---- .../web/custom/CameraChannelController.java | 77 +++++++++++- .../custom/service/CameraChannelService.java | 115 +++++++++++++++++- 13 files changed, 214 insertions(+), 43 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java index cffdd7cab..9ccf6db13 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/CommonGBChannelMapper.java @@ -612,4 +612,5 @@ public interface CommonGBChannelMapper { CommonGBChannel queryByDataIdAndDeviceID(Integer deviceDbId, String deviceId); + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelPlayService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelPlayService.java index 754acd18d..b0653e7ed 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelPlayService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IGbChannelPlayService.java @@ -21,7 +21,7 @@ public interface IGbChannelPlayService { void download(CommonGBChannel channel, Long startTime, Long stopTime, Integer downloadSpeed, ErrorCallback callback); - void stopPlay(CommonGBChannel channel, String stream); + void stopPlay(CommonGBChannel channel); void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback callback); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlayService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlayService.java index 32c3af615..a1f234fd4 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlayService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/IPlayService.java @@ -72,6 +72,8 @@ public interface IPlayService { void play(CommonGBChannel channel, Boolean record, ErrorCallback callback); + void stopPlay(InviteSessionType inviteSessionType, CommonGBChannel channel); + void stop(InviteSessionType inviteSessionType, CommonGBChannel channel, String stream); void playBack(CommonGBChannel channel, Long startTime, Long stopTime, ErrorCallback callback); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePlayService.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePlayService.java index 8886db469..5c125b7c3 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePlayService.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/ISourcePlayService.java @@ -12,6 +12,6 @@ public interface ISourcePlayService { void play(CommonGBChannel channel, Platform platform, Boolean record, ErrorCallback callback); - void stopPlay(CommonGBChannel channel, String stream); + void stopPlay(CommonGBChannel channel); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java index 6e43a2c8d..9285f1849 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelPlayServiceImpl.java @@ -70,7 +70,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { public void stopInvite(InviteSessionType type, CommonGBChannel channel, String stream) { switch (type) { case PLAY: - stopPlay(channel, stream); + stopPlay(channel); break; case PLAYBACK: stopPlayback(channel, stream); @@ -135,7 +135,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { } @Override - public void stopPlay(CommonGBChannel channel, String stream) { + public void stopPlay(CommonGBChannel channel) { Integer dataType = channel.getDataType(); ISourcePlayService sourceChannelPlayService = sourcePlayServiceMap.get(ChannelDataType.PLAY_SERVICE + dataType); if (sourceChannelPlayService == null) { @@ -143,7 +143,7 @@ public class GbChannelPlayServiceImpl implements IGbChannelPlayService { log.error("[点播通用通道] 类型编号: {} 不支持停止实时流", dataType); throw new PlayException(Response.BUSY_HERE, "channel not support"); } - sourceChannelPlayService.stopPlay(channel, stream); + sourceChannelPlayService.stopPlay(channel); } @Override diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java index def8b5f93..2f578e29b 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlayServiceImpl.java @@ -1741,6 +1741,18 @@ public class PlayServiceImpl implements IPlayService { } + @Override + public void stopPlay(InviteSessionType inviteSessionType, CommonGBChannel channel) { + Device device = deviceService.getDevice(channel.getDataDeviceId()); + if (device == null) { + log.warn("[停止播放] 未找到通道{}的设备信息", channel); + throw new PlayException(Response.SERVER_INTERNAL_ERROR, "server internal error"); + } + DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId()); + String stream = String.format("%s_%s", device.getDeviceId(), deviceChannel.getDeviceId()); + stop(inviteSessionType, device, deviceChannel, stream); + } + @Override public void stop(InviteSessionType inviteSessionType, CommonGBChannel channel, String stream) { Device device = deviceService.getDevice(channel.getDataDeviceId()); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePlayServiceForGbImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePlayServiceForGbImpl.java index 0ceff47d2..8dde900a1 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePlayServiceForGbImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/SourcePlayServiceForGbImpl.java @@ -40,10 +40,10 @@ public class SourcePlayServiceForGbImpl implements ISourcePlayService { } @Override - public void stopPlay(CommonGBChannel channel, String stream) { + public void stopPlay(CommonGBChannel channel) { // 国标通道 try { - deviceChannelPlayService.stop(InviteSessionType.PLAY, channel, stream); + deviceChannelPlayService.stopPlay(InviteSessionType.PLAY, channel); } catch (Exception e) { log.error("[停止点播失败] {}({})", channel.getGbName(), channel.getGbDeviceId(), e); } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePlayServiceForJTImpl.java b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePlayServiceForJTImpl.java index 9c4ad082a..8432a88a6 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePlayServiceForJTImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/SourcePlayServiceForJTImpl.java @@ -36,7 +36,7 @@ public class SourcePlayServiceForJTImpl implements ISourcePlayService { } @Override - public void stopPlay(CommonGBChannel channel, String stream) { + public void stopPlay(CommonGBChannel channel) { // 推流 try { playService.stop(channel.getDataDeviceId()); diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/SourcePlayServiceForStreamProxyImpl.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/SourcePlayServiceForStreamProxyImpl.java index 899356960..984d565e4 100644 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/SourcePlayServiceForStreamProxyImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/SourcePlayServiceForStreamProxyImpl.java @@ -31,7 +31,7 @@ public class SourcePlayServiceForStreamProxyImpl implements ISourcePlayService { } @Override - public void stopPlay(CommonGBChannel channel, String stream) { + public void stopPlay(CommonGBChannel channel) { // 拉流代理通道 try { playService.stop(channel.getDataDeviceId()); diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/SourcePlayServiceForStreamPushImpl.java b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/SourcePlayServiceForStreamPushImpl.java index 06d278eb1..5197687e4 100644 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/SourcePlayServiceForStreamPushImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/SourcePlayServiceForStreamPushImpl.java @@ -42,7 +42,7 @@ public class SourcePlayServiceForStreamPushImpl implements ISourcePlayService { } @Override - public void stopPlay(CommonGBChannel channel, String stream) { + public void stopPlay(CommonGBChannel channel) { // 推流 try { playService.stop(channel.getDataDeviceId()); diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java index d293b8d4f..3699d084e 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java @@ -2,7 +2,11 @@ package com.genersoft.iot.vmp.vmanager.bean; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; +@Setter +@Getter @Schema(description = "统一返回结果") public class WVPResult implements Cloneable{ @@ -28,7 +32,7 @@ public class WVPResult implements Cloneable{ return new WVPResult<>(ErrorCode.SUCCESS.getCode(), msg, t); } - public static WVPResult success() { + public static WVPResult success() { return new WVPResult<>(ErrorCode.SUCCESS.getCode(), ErrorCode.SUCCESS.getMsg(), null); } @@ -44,30 +48,6 @@ public class WVPResult implements Cloneable{ return fail(errorCode.getCode(), errorCode.getMsg()); } - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public T getData() { - return data; - } - - public void setData(T data) { - this.data = data; - } - @Override public Object clone() throws CloneNotSupportedException { return super.clone(); diff --git a/src/main/java/com/genersoft/iot/vmp/web/custom/CameraChannelController.java b/src/main/java/com/genersoft/iot/vmp/web/custom/CameraChannelController.java index e628896c2..b931d2d3d 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/custom/CameraChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/web/custom/CameraChannelController.java @@ -1,6 +1,16 @@ package com.genersoft.iot.vmp.web.custom; +import com.genersoft.iot.vmp.common.StreamInfo; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.conf.security.JwtUtils; +import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; +import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; +import com.genersoft.iot.vmp.service.bean.InviteErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.StreamContent; +import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.genersoft.iot.vmp.web.custom.bean.CameraChannel; import com.genersoft.iot.vmp.web.custom.bean.CameraStreamContent; import com.genersoft.iot.vmp.web.custom.bean.IdsQueryParam; @@ -11,11 +21,16 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; +import org.springframework.web.context.request.async.DeferredResult; +import java.net.MalformedURLException; +import java.net.URL; import java.util.List; @Tag(name = "第三方接口") @@ -27,6 +42,9 @@ public class CameraChannelController { @Autowired private CameraChannelService channelService; + @Autowired + private UserSetting userSetting; + @GetMapping(value = "/camera/list/group") @ResponseBody @@ -191,8 +209,42 @@ public class CameraChannelController { @Operation(summary = "播放摄像头", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "deviceId", description = "通道编号") @Parameter(name = "deviceCode", description = "摄像头设备国标编号, 对于非国标摄像头可以不设置此参数") - public CameraStreamContent play(String deviceId, @RequestParam(required = false) String deviceCode) { - return null; + public DeferredResult> play(HttpServletRequest request, String deviceId, @RequestParam(required = false) String deviceCode) { + + log.info("[SY-播放摄像头] API调用,deviceId:{} ,deviceCode:{} ",deviceId, deviceCode); + DeferredResult> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue()); + + ErrorCallback callback = (code, msg, streamInfo) -> { + if (code == InviteErrorCode.SUCCESS.getCode()) { + WVPResult wvpResult = WVPResult.success(); + if (streamInfo != null) { + if (userSetting.getUseSourceIpAsStreamIp()) { + streamInfo=streamInfo.clone();//深拷贝 + String host; + try { + URL url=new URL(request.getRequestURL().toString()); + host=url.getHost(); + } catch (MalformedURLException e) { + host=request.getLocalAddr(); + } + streamInfo.changeStreamIp(host); + } + if (!ObjectUtils.isEmpty(streamInfo.getMediaServer().getTranscodeSuffix()) + && !"null".equalsIgnoreCase(streamInfo.getMediaServer().getTranscodeSuffix())) { + streamInfo.setStream(streamInfo.getStream() + "_" + streamInfo.getMediaServer().getTranscodeSuffix()); + } + wvpResult.setData(new CameraStreamContent(streamInfo)); + }else { + wvpResult.setCode(code); + wvpResult.setMsg(msg); + } + result.setResult(wvpResult); + }else { + result.setResult(WVPResult.fail(code, msg)); + } + }; + channelService.play(deviceId, deviceCode, callback); + return result; } @GetMapping(value = "/camera/control/stop") @@ -201,6 +253,8 @@ public class CameraChannelController { @Parameter(name = "deviceId", description = "通道编号") @Parameter(name = "deviceCode", description = "摄像头设备国标编号, 对于非国标摄像头可以不设置此参数") public void stopPlay(String deviceId, @RequestParam(required = false) String deviceCode) { + log.info("[SY-停止播放摄像头] API调用,deviceId:{} ,deviceCode:{} ",deviceId, deviceCode); + channelService.stopPlay(deviceId, deviceCode); } @Operation(summary = "云台控制", security = @SecurityRequirement(name = JwtUtils.HEADER)) @@ -209,8 +263,25 @@ public class CameraChannelController { @Parameter(name = "command", description = "控制指令,允许值: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true) @Parameter(name = "speed", description = "速度(0-100)", required = true) @GetMapping("/camera/control/ptz") - public void ptz(String deviceId, @RequestParam(required = false) String deviceCode, String command, Integer speed){ + public DeferredResult> ptz(String deviceId, @RequestParam(required = false) String deviceCode, String command, Integer speed){ + log.info("[SY-云台控制] API调用,deviceId:{} ,deviceCode:{} ,command:{} ,speed:{} ",deviceId, deviceCode, command, speed); + + DeferredResult> result = new DeferredResult<>(); + + result.onTimeout(()->{ + WVPResult wvpResult = WVPResult.fail(ErrorCode.ERROR100.getCode(), "请求超时"); + result.setResult(wvpResult); + }); + + channelService.ptz(deviceId, deviceCode, command, speed, (code, msg, data) -> { + WVPResult wvpResult = new WVPResult<>(); + wvpResult.setCode(code); + wvpResult.setMsg(msg); + wvpResult.setData(data); + result.setResult(wvpResult); + }); + return result; } diff --git a/src/main/java/com/genersoft/iot/vmp/web/custom/service/CameraChannelService.java b/src/main/java/com/genersoft/iot/vmp/web/custom/service/CameraChannelService.java index 0243f1a3e..606fcbaf6 100644 --- a/src/main/java/com/genersoft/iot/vmp/web/custom/service/CameraChannelService.java +++ b/src/main/java/com/genersoft/iot/vmp/web/custom/service/CameraChannelService.java @@ -1,14 +1,23 @@ package com.genersoft.iot.vmp.web.custom.service; +import com.genersoft.iot.vmp.common.StreamInfo; import com.genersoft.iot.vmp.common.enums.ChannelDataType; +import com.genersoft.iot.vmp.conf.UserSetting; +import com.genersoft.iot.vmp.conf.exception.ControllerException; import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel; import com.genersoft.iot.vmp.gb28181.bean.Device; +import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ; import com.genersoft.iot.vmp.gb28181.bean.Group; import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.gb28181.dao.DeviceMapper; import com.genersoft.iot.vmp.gb28181.dao.GroupMapper; +import com.genersoft.iot.vmp.gb28181.service.IGbChannelControlService; +import com.genersoft.iot.vmp.gb28181.service.IGbChannelPlayService; +import com.genersoft.iot.vmp.service.bean.ErrorCallback; import com.genersoft.iot.vmp.utils.Coordtransform; +import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.genersoft.iot.vmp.web.custom.bean.CameraChannel; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -18,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import org.springframework.web.context.request.async.DeferredResult; import java.util.List; @@ -37,6 +47,15 @@ public class CameraChannelService implements CommandLineRunner { @Autowired private RedisTemplate redisTemplate; + @Autowired + private IGbChannelPlayService channelPlayService; + + @Autowired + private IGbChannelControlService channelControlService; + + @Autowired + private UserSetting userSetting; + @Override public void run(String... args) throws Exception { // 启动时获取全局token @@ -72,7 +91,7 @@ public class CameraChannelService implements CommandLineRunner { return channels; } - public CameraChannel queryOne(String deviceId, String deviceCode, String geoCoordSys) { + private CommonGBChannel queryChannelByDeviceIdAndDeviceCode(String deviceId, String deviceCode) { CommonGBChannel channel = null; if (deviceCode != null) { Device device = deviceMapper.getDeviceByDeviceId(deviceId); @@ -82,10 +101,13 @@ public class CameraChannelService implements CommandLineRunner { }else { channel = channelMapper.queryByDeviceId(deviceId); } + return channel; + } + + public CameraChannel queryOne(String deviceId, String deviceCode, String geoCoordSys) { + CommonGBChannel channel = queryChannelByDeviceIdAndDeviceCode(deviceId, deviceCode); + Assert.notNull(channel, "通道不存在"); - if (deviceDbId != null) { - channel.setDeviceCode(deviceCode); - } if (geoCoordSys != null && channel.getGbLongitude() != null && channel.getGbLatitude() != null && channel.getGbLongitude() > 0 && channel.getGbLatitude() > 0) { if (geoCoordSys.equalsIgnoreCase("GCJ02")) { @@ -99,6 +121,89 @@ public class CameraChannelService implements CommandLineRunner { channel.setGbLatitude(position[1]); } } - return channel; + CameraChannel resultChannel = (CameraChannel)channel; + if (deviceCode != null) { + resultChannel.setDeviceCode(deviceCode); + } + return resultChannel; + } + + /** + * 播放通道 + * @param deviceId 通道编号 + * @param deviceCode 通道对应的国标设备的编号 + * @param callback 点播结果的回放 + */ + public void play(String deviceId, String deviceCode, ErrorCallback callback) { + CommonGBChannel channel = queryChannelByDeviceIdAndDeviceCode(deviceId, deviceCode); + Assert.notNull(channel, "通道不存在"); + channelPlayService.play(channel, null, userSetting.getRecordSip(), callback); + } + + /** + * 停止播放通道 + * @param deviceId 通道编号 + * @param deviceCode 通道对应的国标设备的编号 + */ + public void stopPlay(String deviceId, String deviceCode) { + CommonGBChannel channel = queryChannelByDeviceIdAndDeviceCode(deviceId, deviceCode); + Assert.notNull(channel, "通道不存在"); + channelPlayService.stopPlay(channel); + } + + public void ptz(String deviceId, String deviceCode, String command, Integer speed, ErrorCallback callback) { + CommonGBChannel channel = queryChannelByDeviceIdAndDeviceCode(deviceId, deviceCode); + Assert.notNull(channel, "通道不存在"); + + if (speed == null) { + speed = 50; + }else if (speed < 0 || speed > 100) { + throw new ControllerException(ErrorCode.ERROR100.getCode(), "panSpeed 为 0-100的数字"); + } + + FrontEndControlCodeForPTZ controlCode = new FrontEndControlCodeForPTZ(); + controlCode.setPanSpeed(speed); + controlCode.setTiltSpeed(speed); + controlCode.setZoomSpeed(speed); + switch (command){ + case "left": + controlCode.setPan(0); + break; + case "right": + controlCode.setPan(1); + break; + case "up": + controlCode.setTilt(0); + break; + case "down": + controlCode.setTilt(1); + break; + case "upleft": + controlCode.setPan(0); + controlCode.setTilt(0); + break; + case "upright": + controlCode.setTilt(0); + controlCode.setPan(1); + break; + case "downleft": + controlCode.setPan(0); + controlCode.setTilt(1); + break; + case "downright": + controlCode.setTilt(1); + controlCode.setPan(1); + break; + case "zoomin": + controlCode.setZoom(1); + break; + case "zoomout": + controlCode.setZoom(0); + break; + default: + break; + } + + channelControlService.ptz(channel, controlCode, callback); } }