Merge branch 'master' into dev/数据库统合

# Conflicts:
#	src/main/java/com/genersoft/iot/vmp/gb28181/service/IDeviceChannelService.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java
#	src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java
#	src/main/java/com/genersoft/iot/vmp/streamProxy/service/impl/StreamProxyPlayServiceImpl.java
#	web_src/src/components/DeviceList.vue
master
648540858 2025-03-10 21:36:52 +08:00
commit 33abdb1db6
50 changed files with 8656 additions and 479 deletions

View File

@ -117,6 +117,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git
# 非开源的内容
- [X] ONVIF设备的接入支持点播云台控制国标级联点播自动点播。试用安装包以及使用教程: [知识星球](https://t.zsxq.com/10WAnH2MP),没有使用时间限制,需要源码可以星球私信我或者邮箱联系。
- [X] 支持部标1078+808协议支持点播云台控制录像回放位置上报自动点播。
- [X] 支持国标28181-2022协议支持巡航轨迹查询PTZ精准控制存储卡格式化设备软件升级OSD配置h265+aac支持辅码流录像倒放等。具体的功能列表可在[知识星球](https://t.zsxq.com/18GXkpkqs)查看,试用安装包: [知识星球](https://t.zsxq.com/UJ6V3),没有使用时间限制,需要源码可以星球私信我或者邮箱联系。

View File

@ -1,8 +1,5 @@
package com.genersoft.iot.vmp.common.enums;
import lombok.Getter;
/**
*
*/

View File

@ -0,0 +1,184 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
*
*/
@Data
public class FrontEndCode {
public static String encode(IFrontEndControlCode frontEndControlCode){
return frontEndControlCode.encode();
}
public static IFrontEndControlCode decode(@NotNull String cmdStr) {
if (cmdStr.length() != 16) {
return null;
}
String cmdCodeStr = cmdStr.substring(6, 8);
int cmdCode = Integer.parseInt(cmdCodeStr, 16);
if (cmdCode < 39) {
// PTZ指令
FrontEndControlCodeForPTZ codeForPTZ = new FrontEndControlCodeForPTZ();
int zoomOut = cmdCode >> 5 & 1;
if (zoomOut == 1) {
codeForPTZ.setZoom(0);
}
int zoomIn = cmdCode >> 4 & 1;
if (zoomIn == 1) {
codeForPTZ.setZoom(1);
}
int tiltUp = cmdCode >> 3 & 1;
if (tiltUp == 1) {
codeForPTZ.setTilt(0);
}
int tiltDown = cmdCode >> 2 & 1;
if (tiltDown == 1) {
codeForPTZ.setTilt(1);
}
int panLeft = cmdCode >> 1 & 1;
if (panLeft == 1) {
codeForPTZ.setPan(0);
}
int panRight = cmdCode & 1;
if (panRight == 1) {
codeForPTZ.setPan(1);
}
String param1Str = cmdStr.substring(8, 10);
codeForPTZ.setPanSpeed(Integer.parseInt(param1Str, 16));
String param2Str = cmdStr.substring(10, 12);
codeForPTZ.setTiltSpeed(Integer.parseInt(param2Str, 16));
String param3Str = cmdStr.substring(12, 13);
codeForPTZ.setZoomSpeed(Integer.parseInt(param3Str, 16));
return codeForPTZ;
}else if (cmdCode < 74) {
// FI指令
FrontEndControlCodeForFI codeForFI = new FrontEndControlCodeForFI();
int irisOut = cmdCode >> 3 & 1;
if (irisOut == 1) {
codeForFI.setIris(0);
}
int irisIn = cmdCode >> 2 & 1;
if (irisIn == 1) {
codeForFI.setIris(1);
}
int focusNear = cmdCode >> 1 & 1;
if (focusNear == 1) {
codeForFI.setFocus(0);
}
int focusFar = cmdCode & 1;
if (focusFar == 1) {
codeForFI.setFocus(1);
}
String param1Str = cmdStr.substring(8, 10);
codeForFI.setFocusSpeed(Integer.parseInt(param1Str, 16));
String param2Str = cmdStr.substring(10, 12);
codeForFI.setIrisSpeed(Integer.parseInt(param2Str, 16));
return codeForFI;
}else if (cmdCode < 131) {
// 预置位指令
FrontEndControlCodeForPreset codeForPreset = new FrontEndControlCodeForPreset();
switch (cmdCode) {
case 0x81: // 设置预置位
codeForPreset.setCode(1);
break;
case 0x82: // 调用预置位
codeForPreset.setCode(2);
break;
case 0x83: // 删除预置位
codeForPreset.setCode(3);
break;
default:
return null;
}
// 预置位编号
String param2Str = cmdStr.substring(10, 12);
codeForPreset.setPresetId(Integer.parseInt(param2Str, 16));
return codeForPreset;
}else if (cmdCode < 136) {
// 巡航指令
FrontEndControlCodeForTour codeForTour = new FrontEndControlCodeForTour();
String param3Str = cmdStr.substring(12, 13);
switch (cmdCode) {
case 0x84: // 加入巡航点
codeForTour.setCode(1);
break;
case 0x85: // 删除一个巡航点
codeForTour.setCode(2);
break;
case 0x86: // 设置巡航速度
codeForTour.setCode(3);
codeForTour.setTourSpeed(Integer.parseInt(param3Str, 16));
break;
case 0x87: // 设置巡航停留时间
codeForTour.setCode(4);
codeForTour.setTourTime(Integer.parseInt(param3Str, 16));
break;
case 0x88: // 开始巡航
codeForTour.setCode(5);
break;
default:
return null;
}
String param1Str = cmdStr.substring(8, 10);
codeForTour.setTourId(Integer.parseInt(param1Str, 16));
String param2Str = cmdStr.substring(10, 12);
codeForTour.setPresetId(Integer.parseInt(param2Str, 16));
return codeForTour;
}else if (cmdCode < 138) {
// 扫描指令
FrontEndControlCodeForScan controlCodeForScan = new FrontEndControlCodeForScan();
String param2Str = cmdStr.substring(10, 11);
int param2Code = Integer.parseInt(param2Str, 16);
switch (cmdCode) {
case 0x89:
switch (param2Code) {
case 0x00: // 开始自动扫描
controlCodeForScan.setCode(1);
break;
case 0x01: // 设置自动扫描左边界
controlCodeForScan.setCode(2);
break;
case 0x02: // 设置自动扫描右边界
controlCodeForScan.setCode(3);
break;
}
break;
case 0x8A: // 删除一个巡航点
controlCodeForScan.setCode(4);
String param3Str = cmdStr.substring(12, 13);
controlCodeForScan.setScanSpeed(Integer.parseInt(param3Str, 16));
break;
default:
return null;
}
String param1Str = cmdStr.substring(8, 10);
controlCodeForScan.setScanId(Integer.parseInt(param1Str, 16));
return controlCodeForScan;
}else if (cmdCode < 141) {
// 辅助开关
FrontEndControlCodeForAuxiliary codeForAuxiliary = new FrontEndControlCodeForAuxiliary();
switch (cmdCode) {
case 0x8C: // 开
codeForAuxiliary.setCode(1);
break;
case 0x8D: // 关
codeForAuxiliary.setCode(2);
break;
default:
return null;
}
// 预置位编号
String param2Str = cmdStr.substring(10, 12);
codeForAuxiliary.setAuxiliaryId(Integer.parseInt(param2Str, 16));
return codeForAuxiliary;
}else {
return null;
}
}
}

View File

@ -0,0 +1,34 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Getter;
import lombok.Setter;
public class FrontEndControlCodeForAuxiliary implements IFrontEndControlCode {
private final FrontEndControlType type = FrontEndControlType.AUXILIARY;
@Override
public FrontEndControlType getType() {
return type;
}
/**
* 1 2 3 4
*/
@Getter
@Setter
private Integer code;
/**
*
*/
@Getter
@Setter
private Integer auxiliaryId;
@Override
public String encode() {
return "";
}
}

View File

@ -0,0 +1,48 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Getter;
import lombok.Setter;
public class FrontEndControlCodeForFI implements IFrontEndControlCode {
private final FrontEndControlType type = FrontEndControlType.FI;
@Override
public FrontEndControlType getType() {
return type;
}
/**
* 0 1
*/
@Getter
@Setter
private Integer iris;
/**
* 0 1
*/
@Getter
@Setter
private Integer focus;
/**
*
*/
@Getter
@Setter
private Integer focusSpeed;
/**
*
*/
@Getter
@Setter
private Integer irisSpeed;
@Override
public String encode() {
return "";
}
}

View File

@ -0,0 +1,62 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Getter;
import lombok.Setter;
public class FrontEndControlCodeForPTZ implements IFrontEndControlCode {
private final FrontEndControlType type = FrontEndControlType.PTZ;
@Override
public FrontEndControlType getType() {
return type;
}
/**
* 0 1
*/
@Getter
@Setter
private Integer zoom;
/**
* 0 1
*/
@Getter
@Setter
private Integer tilt;
/**
* 0 1
*/
@Getter
@Setter
private Integer pan;
/**
*
*/
@Getter
@Setter
private Integer panSpeed;
/**
*
*/
@Getter
@Setter
private Integer tiltSpeed;
/**
*
*/
@Getter
@Setter
private Integer zoomSpeed;
@Override
public String encode() {
return "";
}
}

View File

@ -0,0 +1,35 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Getter;
import lombok.Setter;
public class FrontEndControlCodeForPreset implements IFrontEndControlCode {
private final FrontEndControlType type = FrontEndControlType.PRESET;
@Override
public FrontEndControlType getType() {
return type;
}
/**
* 1 2 3
*/
@Getter
@Setter
private Integer code;
/**
*
*/
@Getter
@Setter
private Integer presetId;
@Override
public String encode() {
return "";
}
}

View File

@ -0,0 +1,41 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Getter;
import lombok.Setter;
public class FrontEndControlCodeForScan implements IFrontEndControlCode {
private final FrontEndControlType type = FrontEndControlType.SCAN;
@Override
public FrontEndControlType getType() {
return type;
}
/**
* 1 2 3 4
*/
@Getter
@Setter
private Integer code;
/**
*
*/
@Getter
@Setter
private Integer scanSpeed;
/**
*
*/
@Getter
@Setter
private Integer scanId;
@Override
public String encode() {
return "";
}
}

View File

@ -0,0 +1,55 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Getter;
import lombok.Setter;
public class FrontEndControlCodeForTour implements IFrontEndControlCode {
private final FrontEndControlType type = FrontEndControlType.TOUR;
@Override
public FrontEndControlType getType() {
return type;
}
/**
* 1 2 3 4 5
*/
@Getter
@Setter
private Integer code;
/**
*
*/
@Getter
@Setter
private Integer tourId;
/**
*
*/
@Getter
@Setter
private Integer tourTime;
/**
*
*/
@Getter
@Setter
private Integer tourSpeed;
/**
*
*/
@Getter
@Setter
private Integer presetId;
@Override
public String encode() {
return "";
}
}

View File

@ -0,0 +1,6 @@
package com.genersoft.iot.vmp.gb28181.bean;
public enum FrontEndControlType {
PTZ,FI,PRESET,TOUR,SCAN,AUXILIARY
}

View File

@ -0,0 +1,7 @@
package com.genersoft.iot.vmp.gb28181.bean;
public interface IFrontEndControlCode {
FrontEndControlType getType();
String encode();
}

View File

@ -36,7 +36,7 @@ public class PtzController {
private IDeviceService deviceService;
@Autowired
private IPTZService iptzService;
private IPTZService ptzService;
@Autowired
private DeferredResultHolder resultHolder;
@ -69,7 +69,7 @@ public class PtzController {
Assert.notNull(device, "设备[" + deviceId + "]不存在");
iptzService.frontEndCommand(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
ptzService.frontEndCommand(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
}
@Operation(summary = "云台控制", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@ -1,12 +1,18 @@
package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.common.enums.DeviceControlType;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import com.genersoft.iot.vmp.gb28181.controller.bean.ChannelReduce;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
import com.github.pagehelper.PageInfo;
import org.dom4j.Element;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -125,6 +131,8 @@ public interface IDeviceChannelService {
List<Integer> queryChaneIdListByDeviceDbIds(List<Integer> deviceDbId);
void handlePtzCmd(@NotNull Integer dataDeviceId, @NotNull Integer gbId, Element rootElement, DeviceControlType type, ErrorCallback<String> callback);
void queryRecordInfo(Device device, DeviceChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> object);
void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> object);

View File

@ -0,0 +1,16 @@
package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
public interface IGbChannelControlService {
void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
void fi(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
void preset(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
void tour(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
void scan(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
void auxiliary(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback);
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionType;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.common.enums.DeviceControlType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.*;
@ -22,6 +23,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcPlayService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
@ -30,6 +32,7 @@ import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -41,11 +44,18 @@ import org.springframework.util.ObjectUtils;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
import java.text.ParseException;
import javax.sip.InvalidArgumentException;
import javax.sip.SipException;
import javax.sip.message.Response;
import javax.validation.constraints.NotNull;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
/**
* @author lin
*/
@ -101,6 +111,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
}
}
@Autowired
private ISIPCommander cmder;
@Override
public int updateChannels(Device device, List<DeviceChannel> channels) {
List<DeviceChannel> addChannels = new ArrayList<>();
@ -389,6 +403,39 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
return channelMapper.queryChaneIdListByDeviceDbIds(deviceDbIds);
}
@Override
public void handlePtzCmd(@NotNull Integer dataDeviceId, @NotNull Integer gbId, Element rootElement, DeviceControlType type, ErrorCallback<String> callback) {
// 根据通道ID获取所属设备
Device device = deviceMapper.query(dataDeviceId);
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 设备ID {}", dataDeviceId);
callback.run(Response.NOT_FOUND, "device not found", null);
return;
}
DeviceChannel deviceChannel = channelMapper.getOneForSource(gbId);
if (deviceChannel == null) {
log.warn("[deviceControl] 未找到设备原始通道, 设备: {}{}),通道编号:{}", device.getName(),
device.getDeviceId(), gbId);
callback.run(Response.NOT_FOUND, "channel not found", null);
return;
}
log.info("[deviceControl] 命令: {}, 设备: {}{} 通道{}{}", type, device.getName(), device.getDeviceId(),
deviceChannel.getName(), deviceChannel.getDeviceId());
String cmdString = getText(rootElement, type.getVal());
try {
cmder.fronEndCmd(device, deviceChannel.getDeviceId(), cmdString, errorResult->{
callback.run(errorResult.statusCode, errorResult.msg, null);
}, errorResult->{
callback.run(errorResult.statusCode, errorResult.msg, null);
});
} catch (InvalidArgumentException | SipException | ParseException e) {
log.error("[命令发送失败] 云台/前端: {}", e.getMessage());
}
}
@Override
public void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition) {
if (userSetting.getSavePositionHistory()) {

View File

@ -200,8 +200,8 @@ public class DeviceServiceImpl implements IDeviceService {
log.warn("[设备不存在] device{}", deviceId);
return;
}
log.info("[设备离线] device{} 当前心跳间隔: {} 上次心跳时间:{} 上次注册时间: {}", deviceId,
device.getHeartBeatInterval(), device.getKeepaliveTime(), device.getRegisterTime());
log.info("[设备离线] device{} 心跳间隔 {},心跳超时次数 {} 上次心跳时间:{} 上次注册时间: {}", deviceId,
device.getHeartBeatInterval(), device.getHeartBeatCount(), device.getKeepaliveTime(), device.getRegisterTime());
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId;
dynamicTask.stop(registerExpireTaskKey);
if (device.isOnLine()) {

View File

@ -0,0 +1,43 @@
package com.genersoft.iot.vmp.gb28181.service.impl;
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
import com.genersoft.iot.vmp.gb28181.bean.FrontEndControlCodeForPTZ;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelControlService;
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class GbChannelControlServiceImpl implements IGbChannelControlService {
@Override
public void ptz(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
log.info("[通用通道] 云台控制, 通道: {}", channel.getGbId());
}
@Override
public void preset(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
log.info("[通用通道] 预置位, 通道: {}", channel.getGbId());
}
@Override
public void fi(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
log.info("[通用通道] FI指令 通道: {}", channel.getGbId());
}
@Override
public void tour(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
}
@Override
public void scan(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
}
@Override
public void auxiliary(CommonGBChannel channel, FrontEndControlCodeForPTZ frontEndControlCode, ErrorCallback<String> callback) {
}
}

View File

@ -61,7 +61,7 @@ public class SipInviteSessionManager {
if (ssrcTransaction == null ) {
return;
}
redisTemplate.opsForHash().delete(VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId(), stream);
redisTemplate.opsForHash().delete(VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId(), app + stream);
if (ssrcTransaction.getCallId() != null) {
redisTemplate.opsForHash().delete(VideoManagerConstants.SIP_INVITE_SESSION_CALL_ID + userSetting.getServerId(), ssrcTransaction.getCallId());
}
@ -74,7 +74,7 @@ public class SipInviteSessionManager {
}
redisTemplate.opsForHash().delete(VideoManagerConstants.SIP_INVITE_SESSION_CALL_ID + userSetting.getServerId(), callId);
if (ssrcTransaction.getStream() != null) {
redisTemplate.opsForHash().delete(VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId(), ssrcTransaction.getStream());
redisTemplate.opsForHash().delete(VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId(), ssrcTransaction.getApp() + ssrcTransaction.getStream());
}
}

View File

@ -218,9 +218,6 @@ public class SIPCommander implements ISIPCommander {
ptzXml.append("</Info>\r\n");
ptzXml.append("</Control>\r\n");
SIPRequest request = (SIPRequest) headerProvider.createMessageRequest(device, ptzXml.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()),request);

View File

@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelControlService;
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@ -43,6 +44,9 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
@Autowired
private IGbChannelService channelService;
@Autowired
private IGbChannelControlService channelControlService;
@Autowired
private IDeviceService deviceService;
@ -136,49 +140,91 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent
*
*/
private void handlePtzCmd(CommonGBChannel channel, Element rootElement, SIPRequest request, DeviceControlType type) {
if (channel.getDataType() != ChannelDataType.GB28181.value) {
// 只支持国标的云台控制
log.warn("[INFO 消息] 只支持国标的云台控制, 通道ID {}", channel.getGbId());
if (channel.getDataType() == ChannelDataType.GB28181.value) {
deviceChannelService.handlePtzCmd(channel.getDataDeviceId(), channel.getGbId(), rootElement, type, ((code, msg, data) -> {
try {
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
}));
}else {
// 解析云台控制参数
String cmdString = getText(rootElement, type.getVal());
IFrontEndControlCode frontEndControlCode = FrontEndCode.decode(cmdString);
if (frontEndControlCode == null) {
log.info("[INFO 消息] 不支持的控制方式");
try {
responseAck(request, Response.FORBIDDEN, "");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 错误信息: {}", e.getMessage());
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
return;
}
// 根据通道ID获取所属设备
Device device = deviceService.getDevice(channel.getDataDeviceId());
if (device == null) {
// 不存在则回复404
log.warn("[INFO 消息] 通道所属设备不存在, 通道ID {}", channel.getGbId());
switch (frontEndControlCode.getType()){
case PTZ:
channelControlService.ptz(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
try {
responseAck(request, Response.NOT_FOUND, "device not found");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 错误信息: {}", e.getMessage());
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
return;
}
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
if (deviceChannel == null) {
log.warn("[deviceControl] 未找到设备原始通道, 设备: {}{}),通道编号:{}", device.getName(),
device.getDeviceId(), channel.getGbId());
}));
break;
case FI:
channelControlService.fi(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
try {
responseAck(request, Response.NOT_FOUND, "channel not found");
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[命令发送失败] 错误信息: {}", e.getMessage());
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
return;
}
log.info("[deviceControl] 命令: {}, 设备: {}{} 通道{}{}", type, device.getName(), device.getDeviceId(),
deviceChannel.getName(), deviceChannel.getDeviceId());
String cmdString = getText(rootElement, type.getVal());
}));
break;
case PRESET:
channelControlService.preset(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
try {
cmder.fronEndCmd(device, deviceChannel.getDeviceId(), cmdString,
errorResult -> onError(request, errorResult),
okResult -> onOk(request));
} catch (InvalidArgumentException | SipException | ParseException e) {
log.error("[命令发送失败] 云台/前端: {}", e.getMessage());
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
}));
break;
case TOUR:
channelControlService.tour(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
try {
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
}));
break;
case SCAN:
channelControlService.scan(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
try {
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
}));
break;
case AUXILIARY:
channelControlService.auxiliary(channel, (FrontEndControlCodeForPTZ)frontEndControlCode, ((code, msg, data) -> {
try {
responseAck(request, code, msg);
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
}));
break;
default:
log.info("[INFO 消息] 设备不支持的控制方式");
try {
responseAck(request, Response.FORBIDDEN, "");
} catch (InvalidArgumentException | SipException | ParseException exception) {
log.error("[命令发送失败] 云台指令: {}", exception.getMessage());
}
}
}
}

View File

@ -140,8 +140,6 @@ public class MediaServiceImpl implements IMediaService {
result.setEnable_mp4(userSetting.getRecordSip());
}
result.setEnable_mp4(inviteInfo.getRecord());
// 单端口模式下修改流 ID
if (!mediaServer.isRtpEnable() && inviteInfo == null) {
String ssrc = String.format("%010d", Long.parseLong(stream, 16));

View File

@ -2,9 +2,14 @@ package com.genersoft.iot.vmp.streamProxy.service.impl;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.media.bean.MediaInfo;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.media.event.hook.Hook;
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
import com.genersoft.iot.vmp.media.event.hook.HookType;
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcPlayService;
@ -24,6 +29,7 @@ import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import javax.sip.message.Response;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
/**
@ -39,6 +45,12 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
@Autowired
private IMediaServerService mediaServerService;
@Autowired
private HookSubscribe subscribe;
@Autowired
private DynamicTask dynamicTask;
@Autowired
private UserSetting userSetting;
@ -103,7 +115,26 @@ public class StreamProxyPlayServiceImpl implements IStreamProxyPlayService {
streamProxy.setEnableMp4(record);
}
return startProxy(streamProxy);
StreamInfo streamInfo = startProxy(streamProxy);
if (callback != null) {
// 设置流超时的定时任务
String timeOutTaskKey = UUID.randomUUID().toString();
Hook rtpHook = Hook.getInstance(HookType.on_media_arrival, streamProxy.getApp(), streamProxy.getStream(), streamInfo.getMediaServer().getId());
dynamicTask.startDelay(timeOutTaskKey, () -> {
// 收流超时
subscribe.removeSubscribe(rtpHook);
callback.run(InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getCode(), InviteErrorCode.ERROR_FOR_STREAM_TIMEOUT.getMsg(), streamInfo);
}, userSetting.getPlayTimeout());
// 开启流到来的监听
subscribe.addSubscribe(rtpHook, (hookData) -> {
dynamicTask.stop(timeOutTaskKey);
// hook响应
callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
subscribe.removeSubscribe(rtpHook);
});
}
return streamInfo;
}
@Override

View File

@ -15,6 +15,8 @@
<script type="text/javascript" src="./static/js/ZLMRTCClient.js"></script>
<script type="text/javascript" src="./static/js/config.js"></script>
<script type="text/javascript" src="./static/js/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="./static/js/h265web/h265webjs-v20221106.js"></script>
<script type="text/javascript" src="./static/js/h265web/missile.js"></script>
<div id="app"></div>

View File

@ -69,7 +69,7 @@ body,
background-color: #f0f2f5;
color: #333;
text-align: center;
padding-top: 0px !important;
padding: 0 20px;
}
/*定义滚动条高宽及背景 高宽分别对应横竖滚动条的尺寸*/

View File

@ -2,9 +2,7 @@
<div id="ChannelEdit" v-loading="locading" style="width: 100%">
<div class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
<el-divider direction="vertical"></el-divider>
编辑通道
<el-page-header @back="close" content="编辑通道"></el-page-header>
</div>
<div class="page-header-btn">
<div style="display: inline;">

View File

@ -44,7 +44,7 @@
</div>
</div>
<!--设备列表-->
<el-table size="medium" :data="recordList" style="width: 100%" :height="winHeight">
<el-table size="medium" :data="recordList" style="width: 100%" :height="$tableHeght">
<el-table-column
type="selection"
width="55">

View File

@ -22,7 +22,7 @@
</div>
</div>
<!--设备列表-->
<el-table size="medium" :data="deviceList" style="width: 100%;font-size: 12px;" :height="winHeight" header-row-class-name="table-header">
<el-table size="medium" :data="deviceList" style="width: 100%;font-size: 12px;" :height="$tableHeght" header-row-class-name="table-header">
<el-table-column prop="name" label="名称" min-width="160">
</el-table-column>
<el-table-column prop="deviceId" label="设备编号" min-width="160" >
@ -143,7 +143,6 @@ export default {
videoComponentList: [],
updateLooper: 0, //
currentDeviceChannelsLength: 0,
winHeight: window.innerHeight - 200,
currentPage: 1,
count: 15,
total: 0,

View File

@ -2,9 +2,7 @@
<div id="PlatformEdit" style="width: 100%">
<div class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
<el-divider direction="vertical"></el-divider>
添加上级平台
<el-page-header @back="close" content="添加上级平台"></el-page-header>
</div>
<div class="page-header-btn">
<div style="display: inline;">

View File

@ -15,7 +15,7 @@
</div>
<!--设备列表-->
<el-table size="medium" :data="platformList" style="width: 100%" :height="winHeight" :loading="loading">
<el-table size="medium" :data="platformList" style="width: 100%" :height="$tableHeght" :loading="loading">
<el-table-column prop="name" label="名称"></el-table-column>
<el-table-column prop="serverGBId" label="平台编号" min-width="200"></el-table-column>
<el-table-column label="是否启用" min-width="80">
@ -115,7 +115,6 @@ export default {
defaultPlatform: null,
platform: null,
pushChannelLoading: false,
winHeight: window.innerHeight - 260,
searchSrt: "",
currentPage: 1,
count: 15,

View File

@ -16,7 +16,7 @@
</div>
</div>
</div>
<el-table size="medium" ref="recordPlanListTable" :data="recordPlanList" :height="winHeight" style="width: 100%"
<el-table size="medium" ref="recordPlanListTable" :data="recordPlanList" :height="$tableHeght" style="width: 100%"
header-row-class-name="table-header" >
<el-table-column type="selection" width="55" >
</el-table-column>
@ -67,7 +67,6 @@ export default {
return {
recordPlanList: [],
searchSrt: "",
winHeight: window.innerHeight - 180,
currentPage: 1,
count: 15,
total: 0,

View File

@ -2,9 +2,7 @@
<div id="StreamProxyEdit" style="width: 100%">
<div class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
<el-divider direction="vertical"></el-divider>
编辑拉流代理信息
<el-page-header @back="close" content="编辑拉流代理信息"></el-page-header>
</div>
<div class="page-header-btn">
<div style="display: inline;">

View File

@ -32,7 +32,7 @@
</div>
</div>
<devicePlayer ref="devicePlayer"></devicePlayer>
<el-table size="medium" :data="streamProxyList" style="width: 100%" :height="winHeight">
<el-table size="medium" :data="streamProxyList" style="width: 100%" :height="$tableHeght" >
<el-table-column prop="app" label="流应用名" min-width="120" show-overflow-tooltip/>
<el-table-column prop="stream" label="流ID" min-width="120" show-overflow-tooltip/>
<el-table-column label="流地址" min-width="250" show-overflow-tooltip >
@ -131,7 +131,6 @@
currentPusher: {}, //
updateLooper: 0, //
currentDeviceChannelsLenth:0,
winHeight: window.innerHeight - 250,
currentPage:1,
count:15,
total:0,

View File

@ -2,9 +2,7 @@
<div id="ChannelEdit" style="width: 100%">
<div class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="close" ></el-button>
<el-divider direction="vertical"></el-divider>
编辑推流信息
<el-page-header @back="close" content="编辑推流信息"></el-page-header>
</div>
<div class="page-header-btn">
<div style="display: inline;">

View File

@ -40,7 +40,7 @@
<el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
</div>
</div>
<el-table size="medium" ref="pushListTable" :data="pushList" style="width: 100%" :height="winHeight" :loading="loading"
<el-table size="medium" ref="pushListTable" :data="pushList" style="width: 100%" :height="$tableHeght" :loading="loading"
@selection-change="handleSelectionChange" :row-key="(row)=> row.app + row.stream">
<el-table-column type="selection" :reserve-selection="true" min-width="55">
</el-table-column>
@ -135,7 +135,6 @@ export default {
currentPusher: {}, //
updateLooper: 0, //
currentDeviceChannelsLenth: 0,
winHeight: window.innerHeight - 250,
mediaServerObj: new MediaServer(),
currentPage: 1,
count: 15,

View File

@ -8,11 +8,10 @@
<el-button icon="el-icon-plus" size="mini" style="margin-right: 1rem;" type="primary" @click="addUser">
添加用户
</el-button>
</div>
</div>
<!--用户列表-->
<el-table size="medium" :data="userList" style="width: 100%;font-size: 12px;" :height="winHeight"
<el-table size="medium" :data="userList" style="width: 100%;font-size: 12px;" :height="$tableHeght"
header-row-class-name="table-header">
<el-table-column prop="username" label="用户名" min-width="160"/>
<el-table-column prop="pushKey" label="pushkey" min-width="160"/>
@ -69,7 +68,6 @@ export default {
videoComponentList: [],
updateLooper: 0, //
currentUserLenth: 0,
winHeight: window.innerHeight - 200,
currentPage: 1,
count: 15,
total: 0,

View File

@ -1,10 +1,9 @@
<template>
<div id="channelList" style="width: 100%">
<div v-if="!editId" class="page-header">
<div v-if="!editId">
<div class="page-header">
<div class="page-title">
<el-button icon="el-icon-back" size="mini" style="font-size: 20px; color: #000;" type="text" @click="showDevice" ></el-button>
<el-divider direction="vertical"></el-divider>
通道列表
<el-page-header @back="showDevice" content="通道列表"></el-page-header>
</div>
<div class="page-header-btn">
<div v-if="!showTree" style="display: inline;">
@ -42,13 +41,7 @@
<el-button icon="el-icon-refresh-right" circle size="mini" @click="refresh()"></el-button>
</div>
</div>
<devicePlayer ref="devicePlayer"></devicePlayer>
<el-container v-if="!editId" v-loading="isLoging" style="height: 82vh;">
<el-aside width="auto" style="height: 82vh; background-color: #ffffff; overflow: auto" v-if="showTree">
<DeviceTree ref="deviceTree" :device="device" :onlyCatalog="true" :clickEvent="treeNodeClickEvent"></DeviceTree>
</el-aside>
<el-main style="padding: 5px;">
<el-table size="medium" ref="channelListTable" :data="deviceChannelList" :height="winHeight" style="width: 100%"
<el-table size="medium" ref="channelListTable" :data="deviceChannelList" :height="$tableHeght"
header-row-class-name="table-header">
<el-table-column prop="name" label="名称" min-width="180">
</el-table-column>
@ -166,10 +159,10 @@
layout="total, sizes, prev, pager, next"
:total="total">
</el-pagination>
</el-main>
</el-container>
</div>
<devicePlayer ref="devicePlayer"></devicePlayer>
<channel-edit v-if="editId" :id="editId" :closeEdit="closeEdit"></channel-edit>
<!--设备列表-->
</div>
</template>

View File

@ -1,31 +1,36 @@
<template>
<div ref="container" @dblclick="fullscreenSwich" style="width:100%;height:100%;background-color: #000000;margin:0 auto;">
<div id="glplayer" style="width: 100%; height: 100%; display: flex"></div>
<div class="buttons-box" id="buttonsBox">
<div class="buttons-box-left">
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i>
<i v-if="playing" class="iconfont icon-pause jessibuca-btn" @click="pause"></i>
<i class="iconfont icon-stop jessibuca-btn" @click="destroy"></i>
<i v-if="isNotMute" class="iconfont icon-audio-high jessibuca-btn" @click="mute()"></i>
<i v-if="!isNotMute" class="iconfont icon-audio-mute jessibuca-btn" @click="cancelMute()"></i>
<i v-if="!playing" class="iconfont icon-play h265web-btn" @click="unPause"></i>
<i v-if="playing" class="iconfont icon-pause h265web-btn" @click="pause"></i>
<i class="iconfont icon-stop h265web-btn" @click="destroy"></i>
<i v-if="isNotMute" class="iconfont icon-audio-high h265web-btn" @click="mute()"></i>
<i v-if="!isNotMute" class="iconfont icon-audio-mute h265web-btn" @click="cancelMute()"></i>
</div>
<div class="buttons-box-right">
<span class="jessibuca-btn">{{ kBps }} kb/s</span>
<!-- <i class="iconfont icon-file-record1 jessibuca-btn"></i>-->
<!-- <i class="iconfont icon-xiangqing2 jessibuca-btn" ></i>-->
<i class="iconfont icon-camera1196054easyiconnet jessibuca-btn" @click="jessibuca.screenshot('截图','png',0.5)"
<!-- <i class="iconfont icon-file-record1 h265web-btn"></i>-->
<!-- <i class="iconfont icon-xiangqing2 h265web-btn" ></i>-->
<i class="iconfont icon-camera1196054easyiconnet h265web-btn" @click="screenshot"
style="font-size: 1rem !important"></i>
<i class="iconfont icon-shuaxin11 jessibuca-btn" @click="playBtnClick"></i>
<i v-if="!fullscreen" class="iconfont icon-weibiaoti10 jessibuca-btn" @click="fullscreenSwich"></i>
<i v-if="fullscreen" class="iconfont icon-weibiaoti11 jessibuca-btn" @click="fullscreenSwich"></i>
<i class="iconfont icon-shuaxin11 h265web-btn" @click="playBtnClick"></i>
<i v-if="!fullscreen" class="iconfont icon-weibiaoti10 h265web-btn" @click="fullscreenSwich"></i>
<i v-if="fullscreen" class="iconfont icon-weibiaoti11 h265web-btn" @click="fullscreenSwich"></i>
</div>
</div>
</div>
</template>
<script>
let jessibucaPlayer = {};
let h265webPlayer = {};
/**
* 从github上复制的
* @see https://github.com/numberwolf/h265web.js/blob/master/example_normal/index.js
*/
const token = "base64:QXV0aG9yOmNoYW5neWFubG9uZ3xudW1iZXJ3b2xmLEdpdGh1YjpodHRwczovL2dpdGh1Yi5jb20vbnVtYmVyd29sZixFbWFpbDpwb3JzY2hlZ3QyM0Bmb3htYWlsLmNvbSxRUTo1MzEzNjU4NzIsSG9tZVBhZ2U6aHR0cDovL3h2aWRlby52aWRlbyxEaXNjb3JkOm51bWJlcndvbGYjODY5NCx3ZWNoYXI6bnVtYmVyd29sZjExLEJlaWppbmcsV29ya0luOkJhaWR1";
export default {
name: 'jessibuca',
name: 'h265web',
data() {
return {
playing: false,
@ -34,7 +39,6 @@ export default {
fullscreen: false,
loaded: false, // mute
speed: 0,
performance: "", //
kBps: 0,
btnDom: null,
videoInfo: null,
@ -88,182 +92,94 @@ export default {
create() {
let options = {};
console.log("hasAudio " + this.hasAudio)
jessibucaPlayer[this._uid] = new window.Jessibuca(Object.assign(
h265webPlayer[this._uid] = new window.new265webjs(this.videoUrl, Object.assign(
{
container: this.$refs.container,
videoBuffer: 0.2, //
isResize: true,
decoder: "static/js/jessibuca/decoder.js",
useMSE: false,
showBandwidth: false,
isFlv: true,
// text: "WVP-PRO",
// background: "static/images/zlm-logo.png",
loadingText: "加载中",
hasAudio: typeof (this.hasAudio) == "undefined" ? true : this.hasAudio,
debug: false,
supportDblclickFullscreen: false, //
operateBtns: {
fullscreen: false,
screenshot: false,
play: false,
audio: false,
recorder: false,
},
record: "record",
vod: this.vod,
forceNoOffscreen: this.forceNoOffscreen,
isNotMute: this.isNotMute,
player: "glplayer", // id
width: 960,
height: 540,
token : token,
extInfo : {
coreProbePart : 0.4,
probeSize : 8192,
ignoreAudio : 0
}
},
options
));
let jessibuca = jessibucaPlayer[this._uid];
let _this = this;
jessibuca.on("load", function () {
console.log("on load init");
});
jessibuca.on("log", function (msg) {
console.log("on log", msg);
});
jessibuca.on("record", function (msg) {
console.log("on record:", msg);
});
jessibuca.on("pause", function () {
_this.playing = false;
});
jessibuca.on("play", function () {
_this.playing = true;
});
jessibuca.on("fullscreen", function (msg) {
console.log("on fullscreen", msg);
_this.fullscreen = msg
});
jessibuca.on("mute", function (msg) {
console.log("on mute", msg);
_this.isNotMute = !msg;
});
jessibuca.on("audioInfo", function (msg) {
// console.log("audioInfo", msg);
});
jessibuca.on("videoInfo", function (msg) {
// this.videoInfo = msg;
console.log("videoInfo", msg);
});
jessibuca.on("bps", function (bps) {
// console.log('bps', bps);
});
let _ts = 0;
jessibuca.on("timeUpdate", function (ts) {
// console.log('timeUpdate,old,new,timestamp', _ts, ts, ts - _ts);
_ts = ts;
});
jessibuca.on("videoInfo", function (info) {
console.log("videoInfo", info);
});
jessibuca.on("error", function (error) {
console.log("error", error);
});
jessibuca.on("timeout", function () {
console.log("timeout");
});
jessibuca.on('start', function () {
console.log('start');
})
jessibuca.on("performance", function (performance) {
let show = "卡顿";
if (performance === 2) {
show = "非常流畅";
} else if (performance === 1) {
show = "流畅";
let h265web = h265webPlayer[this._uid];
h265web.onOpenFullScreen = () => {
this.fullscreen = true
}
h265web.onCloseFullScreen = () => {
this.fullscreen = false
}
h265web.onReadyShowDone = () => {
//
const result = h265web.play()
this.playing = result;
}
h265web.onLoadFinish = () => {
this.loaded = true;
// mediaInfo
// @see https://github.com/numberwolf/h265web.js/blob/8b26a31ffa419bd0a0f99fbd5111590e144e36a8/example_normal/index.js#L252C9-L263C11
// mediaInfo = playerObj.mediaInfo();
}
h265web.onPlayTime = (...args) => {
console.log(args)
}
h265web.do()
},
screenshot: function () {
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].screenshot();
}
_this.performance = show;
});
jessibuca.on('buffer', function (buffer) {
// console.log('buffer', buffer);
})
jessibuca.on('stats', function (stats) {
// console.log('stats', stats);
})
jessibuca.on('kBps', function (kBps) {
_this.kBps = Math.round(kBps);
});
// PTS
jessibuca.on('videoFrame', function () {
})
//
jessibuca.on('metadata', function () {
});
},
playBtnClick: function (event) {
this.play(this.videoUrl)
},
play: function (url) {
console.log(url)
if (jessibucaPlayer[this._uid]) {
if (h265webPlayer[this._uid]) {
this.destroy();
}
this.create();
jessibucaPlayer[this._uid].on("play", () => {
this.playing = true;
this.loaded = true;
this.quieting = jessibuca.quieting;
});
if (jessibucaPlayer[this._uid].hasLoaded()) {
jessibucaPlayer[this._uid].play(url);
} else {
jessibucaPlayer[this._uid].on("load", () => {
console.log("load 播放")
jessibucaPlayer[this._uid].play(url);
});
},
unPause: function () {
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].play();
}
this.playing = h265webPlayer[this._uid].isPlaying();
this.err = "";
},
pause: function () {
if (jessibucaPlayer[this._uid]) {
jessibucaPlayer[this._uid].pause();
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].pause();
}
this.playing = false;
this.playing = h265webPlayer[this._uid].isPlaying();
this.err = "";
this.performance = "";
},
mute: function () {
if (jessibucaPlayer[this._uid]) {
jessibucaPlayer[this._uid].mute();
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].setVoice(0.0);
this.isNotMute = false;
}
},
cancelMute: function () {
if (jessibucaPlayer[this._uid]) {
jessibucaPlayer[this._uid].cancelMute();
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].setVoice(1.0);
this.isNotMute = true;
}
},
destroy: function () {
if (jessibucaPlayer[this._uid]) {
jessibucaPlayer[this._uid].destroy();
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].release();
}
if (document.getElementById("buttonsBox") == null) {
this.$refs.container.appendChild(this.btnDom)
}
jessibucaPlayer[this._uid] = null;
h265webPlayer[this._uid] = null;
this.playing = false;
this.err = "";
this.performance = "";
},
eventcallbacK: function (type, message) {
@ -273,7 +189,11 @@ export default {
},
fullscreenSwich: function () {
let isFull = this.isFullscreen()
jessibucaPlayer[this._uid].setFullscreen(!isFull)
if (isFull) {
h265webPlayer[this._uid].closeFullScreen()
} else {
h265webPlayer[this._uid].fullScreen()
}
this.fullscreen = !isFull;
},
isFullscreen: function () {
@ -284,12 +204,11 @@ export default {
}
},
destroyed() {
if (jessibucaPlayer[this._uid]) {
jessibucaPlayer[this._uid].destroy();
if (h265webPlayer[this._uid]) {
h265webPlayer[this._uid].destroy();
}
this.playing = false;
this.loaded = false;
this.performance = "";
},
}
</script>
@ -309,7 +228,7 @@ export default {
z-index: 10;
}
.jessibuca-btn {
.h265web-btn {
width: 20px;
color: rgb(255, 255, 255);
line-height: 27px;

View File

@ -33,11 +33,12 @@ export default {
props: [ 'app', 'stream', 'mediaServerId'],
components: {},
created() {
this.getMediaInfo()
this.getMediaInfo();
},
data() {
return {
info: {}
info: {},
task: null,
};
},
methods: {
@ -61,6 +62,16 @@ export default {
console.log(error);
});
},
startTask: function () {
this.task = setInterval(this.getMediaInfo, 1000)
},
stopTask: function () {
if (this.task) {
window.clearInterval(this.task);
this.task = null;
}
},
formatByteSpeed: function (){
let bytesSpeed = this.info.bytesSpeed
let num = 1024.0 //byte

View File

@ -15,7 +15,11 @@
:videoUrl="videoUrl" :error="videoError" :message="videoError" height="100px"
:hasAudio="hasAudio" fluent autoplay live></rtc-player>
</el-tab-pane>
<el-tab-pane label="h265web">h265web敬请期待</el-tab-pane>
<el-tab-pane label="h265web" name="h265web">
<h265web v-if="activePlayer === 'h265web'" ref="h265web"
:videoUrl="videoUrl" :error="videoError" :message="videoError" height="100px"
:hasAudio="hasAudio" fluent autoplay live></h265web>
</el-tab-pane>
</el-tabs>
<jessibucaPlayer v-if="Object.keys(this.player).length == 1 && this.player.jessibuca" ref="jessibuca"
:visible.sync="showVideoDialog" :videoUrl="videoUrl" :error="videoError" :message="videoError"
@ -23,7 +27,9 @@
<rtc-player v-if="Object.keys(this.player).length == 1 && this.player.webRTC" ref="jessibuca"
:visible.sync="showVideoDialog" :videoUrl="videoUrl" :error="videoError" :message="videoError"
height="100px" :hasAudio="hasAudio" fluent autoplay live></rtc-player>
<h265web v-if="Object.keys(this.player).length == 1 && this.player.h265web" ref="jessibuca"
:visible.sync="showVideoDialog" :videoUrl="videoUrl" :error="videoError" :message="videoError"
height="100px" :hasAudio="hasAudio" fluent autoplay live></h265web>
</div>
<div id="shared" style="text-align: right; margin-top: 1rem;">
@ -231,14 +237,19 @@
</div>
</div>
</el-tab-pane>
<el-tab-pane label="编码信息" name="codec" v-loading="tracksLoading">
<mediaInfo :app="app" :stream="streamId" :mediaServerId="mediaServerId"></mediaInfo>
<el-tab-pane label="编码信息" name="codec" >
<mediaInfo ref="mediaInfo" :app="app" :stream="streamId" :mediaServerId="mediaServerId"></mediaInfo>
</el-tab-pane>
<el-tab-pane label="语音对讲" name="broadcast">
<div style="padding: 0 10px">
<el-switch v-model="broadcastMode" :disabled="broadcastStatus !== -1" active-color="#409EFF"
active-text="喊话(Broadcast)"
inactive-text="对讲(Talk)"></el-switch>
<!-- <el-switch v-model="broadcastMode" :disabled="broadcastStatus !== -1" active-color="#409EFF"-->
<!-- active-text="喊话(Broadcast)"-->
<!-- inactive-text="对讲(Talk)"></el-switch>-->
<el-radio-group v-model="broadcastMode" :disabled="broadcastStatus !== -1">
<el-radio :label="true" >喊话(Broadcast)</el-radio>
<el-radio :label="false" >对讲(Talk)</el-radio>
</el-radio-group>
</div>
<div class="trank" style="text-align: center;">
<el-button @click="broadcastStatusClick()" :type="getBroadcastStatus()" :disabled="broadcastStatus === -2"
@ -270,11 +281,13 @@ import ptzScan from "../common/ptzScan.vue";
import ptzWiper from "../common/ptzWiper.vue";
import ptzSwitch from "../common/ptzSwitch.vue";
import mediaInfo from "../common/mediaInfo.vue";
import H265web from "../common/h265web.vue";
export default {
name: 'devicePlayer',
props: {},
components: {
H265web,
PtzPreset,PtzCruising,ptzScan,ptzWiper,ptzSwitch,mediaInfo,
LivePlayer, jessibucaPlayer, rtcPlayer,
},
@ -304,6 +317,7 @@ export default {
player: {
jessibuca: ["ws_flv", "wss_flv"],
webRTC: ["rtc", "rtcs"],
h265web: ["ws_flv", "wss_flv"],
},
showVideoDialog: false,
streamId: '',
@ -329,10 +343,8 @@ export default {
scanSpeed: 100,
scanGroup: 0,
tracks: [],
tracksLoading: false,
showPtz: true,
showRrecord: true,
tracksNotLoaded: false,
sliderTime: 0,
seekTime: 0,
recordStartTime: 0,
@ -346,28 +358,11 @@ export default {
methods: {
tabHandleClick: function (tab, event) {
console.log(tab)
var that = this;
that.tracks = [];
that.tracksLoading = true;
that.tracksNotLoaded = false;
this.tracks = [];
if (tab.name === "codec") {
this.$axios({
method: 'get',
url: '/zlm/' + this.mediaServerId + '/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtsp&app=' + this.app + '&stream=' + this.streamId
}).then(function (res) {
that.tracksLoading = false;
if (res.data.code == 0 && res.data.tracks) {
that.tracks = res.data.tracks;
this.$refs.mediaInfo.startTask()
}else {
that.tracksNotLoaded = true;
that.$message({
showClose: true,
message: '获取编码信息失败,',
type: 'warning'
});
}
}).catch(function (e) {
});
this.$refs.mediaInfo.stopTask()
}
},
changePlayer: function (tab) {

View File

@ -5,7 +5,7 @@
<GroupTree ref="groupTree" :show-header="true" :edit="true" :clickEvent="treeNodeClickEvent"
:onChannelChange="onChannelChange" :enableAddChannel="true" :addChannelToGroup="addChannelToGroup"></GroupTree>
</el-aside>
<el-main style="padding: 5px;">
<el-main style="padding: 0 0 0 5px;">
<div class="page-header">
<div class="page-title">
<el-breadcrumb separator="/" v-if="regionParents.length > 0">
@ -46,7 +46,7 @@
</div>
</div>
</div>
<el-table size="medium" ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%"
<el-table size="medium" ref="channelListTable" :data="channelList" :height="$tableHeght" style="width: 100%"
header-row-class-name="table-header" @selection-change="handleSelectionChange"
@row-dblclick="rowDblclick">
<el-table-column type="selection" width="55" >
@ -113,7 +113,6 @@ export default {
channelType: "",
online: "",
hasGroup: "false",
winHeight: window.innerHeight - 180,
currentPage: 1,
count: 15,
total: 0,

View File

@ -5,7 +5,7 @@
<RegionTree ref="regionTree" :showHeader=true :edit="true" :clickEvent="treeNodeClickEvent"
:onChannelChange="onChannelChange" :enableAddChannel="true" :addChannelToCivilCode="addChannelToCivilCode"></RegionTree>
</el-aside>
<el-main style="padding: 5px;">
<el-main style="padding: 0 0 0 5px;">
<div class="page-header">
<div class="page-title">
<el-breadcrumb separator="/" v-if="regionParents.length > 0">
@ -45,7 +45,7 @@
</div>
</div>
</div>
<el-table size="medium" ref="channelListTable" :data="channelList" :height="winHeight" style="width: 100%"
<el-table size="medium" ref="channelListTable" :data="channelList" :height="$tableHeght" style="width: 100%"
header-row-class-name="table-header" @selection-change="handleSelectionChange"
@row-dblclick="rowDblclick">
<el-table-column type="selection" width="55">
@ -109,7 +109,6 @@ export default {
searchSrt: "",
channelType: "",
online: "",
winHeight: window.innerHeight - 180,
currentPage: 1,
count: 15,
total: 0,

View File

@ -4,11 +4,7 @@
<ui-header/>
</el-header>
<el-main>
<el-container>
<transition name="fade">
<router-view></router-view>
</transition>
</el-container>
</el-main>
</el-container>
</template>

View File

@ -75,6 +75,7 @@ axios.interceptors.request.use(
Vue.prototype.$axios = axios;
Vue.prototype.$cookies.config(60 * 30);
Vue.prototype.$tableHeght = window.innerHeight - 170;

File diff suppressed because one or more lines are too long

97
web_src/static/js/h265web/index.d.ts vendored Normal file
View File

@ -0,0 +1,97 @@
export interface Web265JsExtraConfig {
moovStartFlag?: boolean
rawFps?: number
autoCrop?: boolean
core?: 0 | 1
coreProbePart?: number
ignoreAudio?: 0 | 1
probeSize?: number
}
export interface Web265JsConfig {
/**
*The type of the file to be played, do not fill in the automatic identification
*/
type?: 'mp4' | 'hls' | 'ts' | 'raw265' | 'flv'
/**
* playback window dom id value
*/
player: string
/**
* the video window width size
*/
width: number
/**
* the video window height size
*/
height: number
/**
* player token value
*/
token: string
extInfo?: Web265JsExtraConfig
}
export interface Web265JsMediaInfo {
audioNone: boolean
durationMs: number
fps: number
sampleRate: number
size: {
height: number
width: number
}
videoCodec: 0 | 1
isHEVC: boolean
videoType: Web265JsConfig['type']
}
interface New265WebJs {
onSeekFinish(): void
onRender(
width: number,
height: number,
imageBufferY: typeof Uint8Array,
imageBufferB: typeof Uint8Array,
imageBufferR: typeof Uint8Array
): void
onLoadFinish(): void
onPlayTime(videoPTS: number): void
onPlayFinish(): void
onCacheProcess(cPts: number): void
onReadyShowDone(): void
onLoadCache(): void
onLoadCacheFinshed(): void
onOpenFullScreen(): void
onCloseFullScreen(): void
do(): void
pause(): void
isPlaying(): boolean
setRenderScreen(state: boolean): void
seek(pts: number): void
setVoice(volume: number): void
mediaInfo(): Web265JsMediaInfo
fullScreen(): void
closeFullScreen(): void
playNextFrame(): void
snapshot(): void
release(): void
setPlaybackRate(rate: number): void
getPlaybackRate(): number
}
declare type new265webJsFn = (
url: string,
config: Web265JsConfig
) => New265WebJs
declare global {
interface Window {
new265webjs: new265webJsFn
}
}
export default class H265webjsModule {
static createPlayer: (url: string, config: Web265JsConfig) => New265WebJs
static clear(): void
}

View File

@ -0,0 +1,32 @@
/*********************************************************
* LICENSE: LICENSE-Free_CN.MD
*
* Author: Numberwolf - ChangYanlong
* QQ: 531365872
* QQ Group:925466059
* Wechat: numberwolf11
* Discord: numberwolf#8694
* E-Mail: porschegt23@foxmail.com
* Github: https://github.com/numberwolf/h265web.js
*
* 作者: 小老虎(Numberwolf)(常炎隆)
* QQ: 531365872
* QQ群: 531365872
* 微信: numberwolf11
* Discord: numberwolf#8694
* 邮箱: porschegt23@foxmail.com
* 博客: https://www.jianshu.com/u/9c09c1e00fd1
* Github: https://github.com/numberwolf/h265web.js
*
**********************************************************/
require('./h265webjs-v20221106');
export default class h265webjs {
static createPlayer(videoURL, config) {
return window.new265webjs(videoURL, config);
}
static clear() {
global.STATICE_MEM_playerCount = -1;
global.STATICE_MEM_playerIndexPtr = 0;
}
}

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -313,6 +313,7 @@ create table wvp_stream_proxy
stream_key character varying(255),
server_id character varying(50),
enable_disable_none_reader bool default false,
relates_media_server_id character varying(50),
constraint uk_stream_proxy_app_stream unique (app, stream)
);

View File

@ -330,6 +330,7 @@ create table wvp_stream_proxy
stream_key character varying(255),
server_id character varying(50),
enable_disable_none_reader bool default false,
relates_media_server_id character varying(50),
constraint uk_stream_proxy_app_stream unique (app, stream)
);
@ -458,7 +459,7 @@ create table wvp_record_plan
create table wvp_record_plan_item
(
id serial primary key,
start int,
"start" int,
stop int,
week_day int,
plan_id int,