Commit 19049788564257a1bdc09a0a7411f85c15ba3003
1 parent
f3e45410
添加addParentPlatform, queryParentPlatformList 接口
Showing
10 changed files
with
616 additions
and
10 deletions
README.md
| @@ -13,13 +13,6 @@ WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台 | @@ -13,13 +13,6 @@ WEB VIDEO PLATFORM是一个基于GB28181-2016标准实现的网络视频平台 | ||
| 13 | # gitee同步仓库 | 13 | # gitee同步仓库 |
| 14 | https://gitee.com/18010473990/wvp-GB28181.git | 14 | https://gitee.com/18010473990/wvp-GB28181.git |
| 15 | 15 | ||
| 16 | -# 截图 | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 20 | - | ||
| 21 | - | ||
| 22 | - | ||
| 23 | 16 | ||
| 24 | # 1.0 支持特性 | 17 | # 1.0 支持特性 |
| 25 | 1. 视频预览; | 18 | 1. 视频预览; |
| @@ -43,8 +36,12 @@ https://gitee.com/18010473990/wvp-GB28181.git | @@ -43,8 +36,12 @@ https://gitee.com/18010473990/wvp-GB28181.git | ||
| 43 | 19. 支持播放h265, g.711格式的流(需要将closeWaitRTPInfo设为false). | 36 | 19. 支持播放h265, g.711格式的流(需要将closeWaitRTPInfo设为false). |
| 44 | 37 | ||
| 45 | # 2.0 支持特性 | 38 | # 2.0 支持特性 |
| 46 | -# 待实现: | ||
| 47 | - [ ] 国标通道向上级联 | 39 | - [ ] 国标通道向上级联 |
| 40 | + - [ ] WEB添加上级平台 | ||
| 41 | + - [ ] 注册 | ||
| 42 | + - [ ] 通道选择 | ||
| 43 | + - [ ] 通道推送 | ||
| 44 | + - [ ] 点播 | ||
| 48 | - [ ] 添加RTSP视频 | 45 | - [ ] 添加RTSP视频 |
| 49 | - [ ] 添加ONVIF探测局域网内的设备 | 46 | - [ ] 添加ONVIF探测局域网内的设备 |
| 50 | - [ ] 添加RTMP视频 | 47 | - [ ] 添加RTMP视频 |
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
| @@ -20,6 +20,8 @@ public class VideoManagerConstants { | @@ -20,6 +20,8 @@ public class VideoManagerConstants { | ||
| 20 | 20 | ||
| 21 | public static final String PLAY_BLACK_PREFIX = "VMP_playback_"; | 21 | public static final String PLAY_BLACK_PREFIX = "VMP_playback_"; |
| 22 | 22 | ||
| 23 | + public static final String PLATFORM_PREFIX = "VMP_platform_"; | ||
| 24 | + | ||
| 23 | public static final String EVENT_ONLINE_REGISTER = "1"; | 25 | public static final String EVENT_ONLINE_REGISTER = "1"; |
| 24 | 26 | ||
| 25 | public static final String EVENT_ONLINE_KEEPLIVE = "2"; | 27 | public static final String EVENT_ONLINE_KEEPLIVE = "2"; |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.bean; | ||
| 2 | + | ||
| 3 | +public class ParentPlatform { | ||
| 4 | + | ||
| 5 | + /** | ||
| 6 | + * 是否启用 | ||
| 7 | + */ | ||
| 8 | + private boolean enable; | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 名称 | ||
| 12 | + */ | ||
| 13 | + private String name; | ||
| 14 | + | ||
| 15 | + /** | ||
| 16 | + * SIP服务国标编码 | ||
| 17 | + */ | ||
| 18 | + private String serverGBId; | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * SIP服务国标域 | ||
| 22 | + */ | ||
| 23 | + private String serverGBDomain; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * SIP服务IP | ||
| 27 | + */ | ||
| 28 | + private String serverIP; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * SIP服务端口 | ||
| 32 | + */ | ||
| 33 | + private int serverPort; | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 设备国标编号 | ||
| 37 | + */ | ||
| 38 | + private String deviceGBId; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 设备ip | ||
| 42 | + */ | ||
| 43 | + private String deviceIp; | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 设备端口 | ||
| 47 | + */ | ||
| 48 | + private String devicePort; | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * SIP认证用户名(默认使用设备国标编号) | ||
| 52 | + */ | ||
| 53 | + private String username; | ||
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * SIP认证密码 | ||
| 57 | + */ | ||
| 58 | + private String password; | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 注册周期 (秒) | ||
| 62 | + */ | ||
| 63 | + private String expires; | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 心跳周期(秒) | ||
| 67 | + */ | ||
| 68 | + private String keepTimeout; | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 传输协议 | ||
| 72 | + * UDP/TCP | ||
| 73 | + */ | ||
| 74 | + private String transport; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 字符集 | ||
| 78 | + */ | ||
| 79 | + private String characterSet; | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 允许云台控制 | ||
| 83 | + */ | ||
| 84 | + private boolean PTZEnable; | ||
| 85 | + | ||
| 86 | + /** | ||
| 87 | + * RTCP流保活 | ||
| 88 | + */ | ||
| 89 | + private boolean rtcp; | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + public boolean isEnable() { | ||
| 93 | + return enable; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + public void setEnable(boolean enable) { | ||
| 97 | + this.enable = enable; | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + public String getName() { | ||
| 101 | + return name; | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + public void setName(String name) { | ||
| 105 | + this.name = name; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + public String getServerGBId() { | ||
| 109 | + return serverGBId; | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + public void setServerGBId(String serverGBId) { | ||
| 113 | + this.serverGBId = serverGBId; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public String getServerGBDomain() { | ||
| 117 | + return serverGBDomain; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public void setServerGBDomain(String serverGBDomain) { | ||
| 121 | + this.serverGBDomain = serverGBDomain; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public String getServerIP() { | ||
| 125 | + return serverIP; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public void setServerIP(String serverIP) { | ||
| 129 | + this.serverIP = serverIP; | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + public int getServerPort() { | ||
| 133 | + return serverPort; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public void setServerPort(int serverPort) { | ||
| 137 | + this.serverPort = serverPort; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + public String getDeviceGBId() { | ||
| 141 | + return deviceGBId; | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + public void setDeviceGBId(String deviceGBId) { | ||
| 145 | + this.deviceGBId = deviceGBId; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + public String getDeviceIp() { | ||
| 149 | + return deviceIp; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public void setDeviceIp(String deviceIp) { | ||
| 153 | + this.deviceIp = deviceIp; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public String getDevicePort() { | ||
| 157 | + return devicePort; | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + public void setDevicePort(String devicePort) { | ||
| 161 | + this.devicePort = devicePort; | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + public String getUsername() { | ||
| 165 | + return username; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + public void setUsername(String username) { | ||
| 169 | + this.username = username; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + public String getPassword() { | ||
| 173 | + return password; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public void setPassword(String password) { | ||
| 177 | + this.password = password; | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + public String getExpires() { | ||
| 181 | + return expires; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public void setExpires(String expires) { | ||
| 185 | + this.expires = expires; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public String getKeepTimeout() { | ||
| 189 | + return keepTimeout; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public void setKeepTimeout(String keepTimeout) { | ||
| 193 | + this.keepTimeout = keepTimeout; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public String getTransport() { | ||
| 197 | + return transport; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public void setTransport(String transport) { | ||
| 201 | + this.transport = transport; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + public String getCharacterSet() { | ||
| 205 | + return characterSet; | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + public void setCharacterSet(String characterSet) { | ||
| 209 | + this.characterSet = characterSet; | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + public boolean isPTZEnable() { | ||
| 213 | + return PTZEnable; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public void setPTZEnable(boolean PTZEnable) { | ||
| 217 | + this.PTZEnable = PTZEnable; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + public boolean isRtcp() { | ||
| 221 | + return rtcp; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + public void setRtcp(boolean rtcp) { | ||
| 225 | + this.rtcp = rtcp; | ||
| 226 | + } | ||
| 227 | +} |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
| @@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; | @@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 9 | import com.genersoft.iot.vmp.conf.MediaServerConfig; | 9 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 10 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 10 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 11 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 11 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 12 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * @Description:视频设备数据存储接口 | 15 | * @Description:视频设备数据存储接口 |
| @@ -191,4 +192,25 @@ public interface IVideoManagerStorager { | @@ -191,4 +192,25 @@ public interface IVideoManagerStorager { | ||
| 191 | StreamInfo queryPlaybackByDevice(String deviceId, String channelId); | 192 | StreamInfo queryPlaybackByDevice(String deviceId, String channelId); |
| 192 | 193 | ||
| 193 | StreamInfo queryPlaybackBySSRC(String ssrc); | 194 | StreamInfo queryPlaybackBySSRC(String ssrc); |
| 195 | + | ||
| 196 | + /** | ||
| 197 | + * 更新或添加上级平台 | ||
| 198 | + * @param parentPlatform | ||
| 199 | + */ | ||
| 200 | + boolean updateParentPlatform(ParentPlatform parentPlatform); | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * 删除上级平台 | ||
| 204 | + * @param parentPlatform | ||
| 205 | + */ | ||
| 206 | + boolean deleteParentPlatform(ParentPlatform parentPlatform); | ||
| 207 | + | ||
| 208 | + | ||
| 209 | + /** | ||
| 210 | + * 分页获取上级平台 | ||
| 211 | + * @param page | ||
| 212 | + * @param count | ||
| 213 | + * @return | ||
| 214 | + */ | ||
| 215 | + public PageResult<ParentPlatform> queryParentPlatformList(int page, int count); | ||
| 194 | } | 216 | } |
src/main/java/com/genersoft/iot/vmp/storager/jdbc/VideoManagerJdbcStoragerImpl.java
| @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.common.PageResult; | @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.common.PageResult; | ||
| 7 | import com.genersoft.iot.vmp.common.StreamInfo; | 7 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 8 | import com.genersoft.iot.vmp.conf.MediaServerConfig; | 8 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 9 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 10 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 10 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 11 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
| 12 | 13 | ||
| @@ -213,4 +214,19 @@ public class VideoManagerJdbcStoragerImpl implements IVideoManagerStorager { | @@ -213,4 +214,19 @@ public class VideoManagerJdbcStoragerImpl implements IVideoManagerStorager { | ||
| 213 | public StreamInfo queryPlaybackBySSRC(String ssrc) { | 214 | public StreamInfo queryPlaybackBySSRC(String ssrc) { |
| 214 | return null; | 215 | return null; |
| 215 | } | 216 | } |
| 217 | + | ||
| 218 | + @Override | ||
| 219 | + public boolean updateParentPlatform(ParentPlatform parentPlatform) { | ||
| 220 | + return false; | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + @Override | ||
| 224 | + public boolean deleteParentPlatform(ParentPlatform parentPlatform) { | ||
| 225 | + return false; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + @Override | ||
| 229 | + public PageResult<ParentPlatform> queryParentPlatformList(int page, int count) { | ||
| 230 | + return null; | ||
| 231 | + } | ||
| 216 | } | 232 | } |
src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java
| @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.common.PageResult; | @@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.common.PageResult; | ||
| 8 | import com.genersoft.iot.vmp.common.StreamInfo; | 8 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 9 | import com.genersoft.iot.vmp.conf.MediaServerConfig; | 9 | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| 10 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 10 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 11 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
| 13 | 14 | ||
| @@ -557,4 +558,33 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager { | @@ -557,4 +558,33 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager { | ||
| 557 | if (playLeys == null || playLeys.size() == 0) return null; | 558 | if (playLeys == null || playLeys.size() == 0) return null; |
| 558 | return (StreamInfo)redis.get(playLeys.get(0).toString()); | 559 | return (StreamInfo)redis.get(playLeys.get(0).toString()); |
| 559 | } | 560 | } |
| 561 | + | ||
| 562 | + @Override | ||
| 563 | + public boolean updateParentPlatform(ParentPlatform parentPlatform) { | ||
| 564 | + // 存储device | ||
| 565 | + return redis.set(VideoManagerConstants.PLATFORM_PREFIX + parentPlatform.getDeviceGBId(), parentPlatform); | ||
| 566 | + } | ||
| 567 | + | ||
| 568 | + @Override | ||
| 569 | + public boolean deleteParentPlatform(ParentPlatform parentPlatform) { | ||
| 570 | + return false; | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + @Override | ||
| 574 | + public PageResult<ParentPlatform> queryParentPlatformList(int page, int count) { | ||
| 575 | + PageResult pageResult = new PageResult<Device>(); | ||
| 576 | + pageResult.setPage(page); | ||
| 577 | + pageResult.setCount(count); | ||
| 578 | + List<ParentPlatform> resultData = new ArrayList<>(); | ||
| 579 | + List<Object> parentPlatformList = redis.scan(VideoManagerConstants.PLATFORM_PREFIX + "*"); | ||
| 580 | + pageResult.setTotal(parentPlatformList.size()); | ||
| 581 | + int maxCount = (page + 1)* count; | ||
| 582 | + for (int i = page * count; i < (pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal() ); i++) { | ||
| 583 | + ParentPlatform parentPlatform =(ParentPlatform)redis.get((String)parentPlatformList.get(i)); | ||
| 584 | + resultData.add(parentPlatform); | ||
| 585 | + | ||
| 586 | + } | ||
| 587 | + pageResult.setData(resultData); | ||
| 588 | + return pageResult; | ||
| 589 | + } | ||
| 560 | } | 590 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.vmanager.platform; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.common.PageResult; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 6 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | ||
| 7 | +import com.genersoft.iot.vmp.vmanager.device.DeviceController; | ||
| 8 | +import org.slf4j.Logger; | ||
| 9 | +import org.slf4j.LoggerFactory; | ||
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 11 | +import org.springframework.http.HttpStatus; | ||
| 12 | +import org.springframework.http.ResponseEntity; | ||
| 13 | +import org.springframework.stereotype.Controller; | ||
| 14 | +import org.springframework.web.bind.annotation.*; | ||
| 15 | + | ||
| 16 | +@CrossOrigin | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("/api") | ||
| 19 | +public class PlatformController { | ||
| 20 | + | ||
| 21 | + private final static Logger logger = LoggerFactory.getLogger(PlatformController.class); | ||
| 22 | + | ||
| 23 | + @Autowired | ||
| 24 | + private IVideoManagerStorager storager; | ||
| 25 | + | ||
| 26 | + @GetMapping("/platforms") | ||
| 27 | + public PageResult<ParentPlatform> platforms(int page, int count){ | ||
| 28 | + | ||
| 29 | + if (logger.isDebugEnabled()) { | ||
| 30 | + logger.debug("查询所有上级设备API调用"); | ||
| 31 | + } | ||
| 32 | + return storager.queryParentPlatformList(page, count); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @PostMapping("/platforms/add") | ||
| 36 | + public ResponseEntity<String> addPlatform(ParentPlatform parentPlatform){ | ||
| 37 | + | ||
| 38 | + if (logger.isDebugEnabled()) { | ||
| 39 | + logger.debug("查询所有上级设备API调用"); | ||
| 40 | + } | ||
| 41 | + boolean updateResult = storager.updateParentPlatform(parentPlatform); | ||
| 42 | + if (updateResult) { | ||
| 43 | + return new ResponseEntity<>("success", HttpStatus.OK); | ||
| 44 | + }else { | ||
| 45 | + return new ResponseEntity<>("fail", HttpStatus.OK); | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | +} |
web_src/src/components/ParentPlatformList.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div id="app"> | ||
| 3 | + <el-container> | ||
| 4 | + <el-header> | ||
| 5 | + <uiHeader></uiHeader> | ||
| 6 | + </el-header> | ||
| 7 | + <el-main> | ||
| 8 | + <div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;"> | ||
| 9 | + <span style="font-size: 1rem; font-weight: bold;">上级平台列表</span> | ||
| 10 | + </div> | ||
| 11 | + <devicePlayer ref="devicePlayer"></devicePlayer> | ||
| 12 | + <!--设备列表--> | ||
| 13 | + <el-table :data="deviceList" border style="width: 100%" :height="winHeight"> | ||
| 14 | + <el-table-column prop="name" label="名称" width="180" align="center"> | ||
| 15 | + </el-table-column> | ||
| 16 | + <el-table-column prop="deviceId" label="平台编号" width="240" align="center"> | ||
| 17 | + </el-table-column> | ||
| 18 | + <el-table-column prop="deviceId" label="是否启用" width="50" align="center"> | ||
| 19 | + </el-table-column> | ||
| 20 | + <el-table-column label="状态" width="180" align="center"> | ||
| 21 | + <template slot-scope="scope"> | ||
| 22 | + <div slot="reference" class="name-wrapper"> | ||
| 23 | + <el-tag size="medium" v-if="scope.row.online == 1">在线</el-tag> | ||
| 24 | + <el-tag size="medium" type="info" v-if="scope.row.online == 0">离线</el-tag> | ||
| 25 | + </div> | ||
| 26 | + </template> | ||
| 27 | + </el-table-column> | ||
| 28 | + <el-table-column label="地址" width="180" align="center"> | ||
| 29 | + <template slot-scope="scope"> | ||
| 30 | + <div slot="reference" class="name-wrapper"> | ||
| 31 | + <el-tag size="medium">{{ scope.row.host.address }}</el-tag> | ||
| 32 | + </div> | ||
| 33 | + </template> | ||
| 34 | + <el-table-column prop="deviceId" label="设备国标编号" width="240" align="center"> | ||
| 35 | + </el-table-column> | ||
| 36 | + </el-table-column> | ||
| 37 | + | ||
| 38 | + <el-table-column label="流传输模式" align="center" width="160"> | ||
| 39 | + <template slot-scope="scope"> | ||
| 40 | + <el-select size="mini" @change="transportChange(scope.row)" v-model="scope.row.streamMode" placeholder="请选择"> | ||
| 41 | + <el-option key="UDP" label="UDP" value="UDP"></el-option> | ||
| 42 | + <el-option key="TCP-ACTIVE" label="TCP主动模式" :disabled="true" value="TCP-ACTIVE"></el-option> | ||
| 43 | + <el-option key="TCP-PASSIVE" label="TCP被动模式" value="TCP-PASSIVE"></el-option> | ||
| 44 | + </el-select> | ||
| 45 | + </template> | ||
| 46 | + </el-table-column> | ||
| 47 | + <el-table-column prop="channelCount" label="通道数" align="center"> | ||
| 48 | + </el-table-column> | ||
| 49 | + | ||
| 50 | + <el-table-column label="操作" width="240" align="center" fixed="right"> | ||
| 51 | + <template slot-scope="scope"> | ||
| 52 | + <el-button size="mini" icon="el-icon-refresh" @click="refDevice(scope.row)">刷新通道</el-button> | ||
| 53 | + <el-button size="mini" icon="el-icon-s-open" type="primary" @click="showChannelList(scope.row)">查看通道</el-button> | ||
| 54 | + </template> | ||
| 55 | + </el-table-column> | ||
| 56 | + </el-table> | ||
| 57 | + <el-pagination | ||
| 58 | + style="float: right" | ||
| 59 | + @size-change="handleSizeChange" | ||
| 60 | + @current-change="currentChange" | ||
| 61 | + :current-page="currentPage" | ||
| 62 | + :page-size="count" | ||
| 63 | + :page-sizes="[15, 25, 35, 50]" | ||
| 64 | + layout="total, sizes, prev, pager, next" | ||
| 65 | + :total="total"> | ||
| 66 | + </el-pagination> | ||
| 67 | + | ||
| 68 | + </el-main> | ||
| 69 | + </el-container> | ||
| 70 | + </div> | ||
| 71 | +</template> | ||
| 72 | + | ||
| 73 | +<script> | ||
| 74 | +import devicePlayer from './gb28181/devicePlayer.vue' | ||
| 75 | +import uiHeader from './UiHeader.vue' | ||
| 76 | +export default { | ||
| 77 | + name: 'app', | ||
| 78 | + components: { | ||
| 79 | + devicePlayer, | ||
| 80 | + uiHeader | ||
| 81 | + }, | ||
| 82 | + data() { | ||
| 83 | + return { | ||
| 84 | + deviceList: [], //设备列表 | ||
| 85 | + currentDevice: {}, //当前操作设备对象 | ||
| 86 | + | ||
| 87 | + videoComponentList: [], | ||
| 88 | + updateLooper: 0, //数据刷新轮训标志 | ||
| 89 | + currentDeviceChannelsLenth:0, | ||
| 90 | + winHeight: window.innerHeight - 200, | ||
| 91 | + currentPage:1, | ||
| 92 | + count:15, | ||
| 93 | + total:0 | ||
| 94 | + }; | ||
| 95 | + }, | ||
| 96 | + computed: { | ||
| 97 | + getcurrentDeviceChannels: function() { | ||
| 98 | + let data = this.currentDevice['channelMap']; | ||
| 99 | + let channels = null; | ||
| 100 | + if (data) { | ||
| 101 | + channels = Object.keys(data).map(key => { | ||
| 102 | + return data[key]; | ||
| 103 | + }); | ||
| 104 | + this.currentDeviceChannelsLenth = channels.length; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + console.log("数据:" + JSON.stringify(channels)); | ||
| 108 | + return channels; | ||
| 109 | + } | ||
| 110 | + }, | ||
| 111 | + mounted() { | ||
| 112 | + this.initData(); | ||
| 113 | + this.updateLooper = setInterval(this.initData, 10000); | ||
| 114 | + }, | ||
| 115 | + destroyed() { | ||
| 116 | + this.$destroy('videojs'); | ||
| 117 | + clearTimeout(this.updateLooper); | ||
| 118 | + }, | ||
| 119 | + methods: { | ||
| 120 | + initData: function() { | ||
| 121 | + this.getDeviceList(); | ||
| 122 | + }, | ||
| 123 | + currentChange: function(val){ | ||
| 124 | + this.currentPage = val; | ||
| 125 | + this.getDeviceList(); | ||
| 126 | + }, | ||
| 127 | + handleSizeChange: function(val){ | ||
| 128 | + this.count = val; | ||
| 129 | + this.getDeviceList(); | ||
| 130 | + }, | ||
| 131 | + getDeviceList: function() { | ||
| 132 | + let that = this; | ||
| 133 | + | ||
| 134 | + this.$axios.get(`/api/devices`,{ | ||
| 135 | + params: { | ||
| 136 | + page: that.currentPage - 1, | ||
| 137 | + count: that.count | ||
| 138 | + } | ||
| 139 | + } ) | ||
| 140 | + .then(function (res) { | ||
| 141 | + console.log(res); | ||
| 142 | + that.total = res.data.total; | ||
| 143 | + that.deviceList = res.data.data; | ||
| 144 | + }) | ||
| 145 | + .catch(function (error) { | ||
| 146 | + console.log(error); | ||
| 147 | + }); | ||
| 148 | + | ||
| 149 | + }, | ||
| 150 | + showChannelList: function(row) { | ||
| 151 | + console.log(JSON.stringify(row)) | ||
| 152 | + this.$router.push(`/channelList/${row.deviceId}/0/15/1`); | ||
| 153 | + }, | ||
| 154 | + | ||
| 155 | + | ||
| 156 | + //gb28181平台对接 | ||
| 157 | + //刷新设备信息 | ||
| 158 | + refDevice: function(itemData) { | ||
| 159 | + ///api/devices/{deviceId}/sync | ||
| 160 | + console.log("刷新对应设备:" + itemData.deviceId); | ||
| 161 | + this.$axios({ | ||
| 162 | + method: 'post', | ||
| 163 | + url: '/api/devices/' + itemData.deviceId + '/sync' | ||
| 164 | + }).then(function(res) { | ||
| 165 | + // console.log("刷新设备结果:"+JSON.stringify(res)); | ||
| 166 | + }).catch(function(e) { | ||
| 167 | + that.$message({ | ||
| 168 | + showClose: true, | ||
| 169 | + message: '请求成功', | ||
| 170 | + type: 'success' | ||
| 171 | + }); | ||
| 172 | + });; | ||
| 173 | + }, | ||
| 174 | + //通知设备上传媒体流 | ||
| 175 | + sendDevicePush: function(itemData) { | ||
| 176 | + let deviceId = this.currentDevice.deviceId; | ||
| 177 | + let channelId = itemData.channelId; | ||
| 178 | + console.log("通知设备推流1:" + deviceId + " : " + channelId); | ||
| 179 | + let that = this; | ||
| 180 | + this.$axios({ | ||
| 181 | + method: 'get', | ||
| 182 | + url: '/api/play/' + deviceId + '/' + channelId | ||
| 183 | + }).then(function(res) { | ||
| 184 | + let ssrc = res.data.ssrc; | ||
| 185 | + that.$refs.devicePlayer.play(ssrc,deviceId,channelId); | ||
| 186 | + }).catch(function(e) { | ||
| 187 | + }); | ||
| 188 | + }, | ||
| 189 | + transportChange: function (row) { | ||
| 190 | + console.log(row); | ||
| 191 | + console.log(`修改传输方式为 ${row.streamMode}:${row.deviceId} `); | ||
| 192 | + let that = this; | ||
| 193 | + this.$axios({ | ||
| 194 | + method: 'get', | ||
| 195 | + url: '/api/devices/' + row.deviceId + '/transport/' + row.streamMode | ||
| 196 | + }).then(function(res) { | ||
| 197 | + | ||
| 198 | + }).catch(function(e) { | ||
| 199 | + }); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + } | ||
| 203 | +}; | ||
| 204 | +</script> | ||
| 205 | + | ||
| 206 | +<style> | ||
| 207 | +.videoList { | ||
| 208 | + display: flex; | ||
| 209 | + flex-wrap: wrap; | ||
| 210 | + align-content: flex-start; | ||
| 211 | +} | ||
| 212 | + | ||
| 213 | +.video-item { | ||
| 214 | + position: relative; | ||
| 215 | + width: 15rem; | ||
| 216 | + height: 10rem; | ||
| 217 | + margin-right: 1rem; | ||
| 218 | + background-color: #000000; | ||
| 219 | +} | ||
| 220 | + | ||
| 221 | +.video-item-img { | ||
| 222 | + position: absolute; | ||
| 223 | + top: 0; | ||
| 224 | + bottom: 0; | ||
| 225 | + left: 0; | ||
| 226 | + right: 0; | ||
| 227 | + margin: auto; | ||
| 228 | + width: 100%; | ||
| 229 | + height: 100%; | ||
| 230 | +} | ||
| 231 | + | ||
| 232 | +.video-item-img:after { | ||
| 233 | + content: ""; | ||
| 234 | + display: inline-block; | ||
| 235 | + position: absolute; | ||
| 236 | + z-index: 2; | ||
| 237 | + top: 0; | ||
| 238 | + bottom: 0; | ||
| 239 | + left: 0; | ||
| 240 | + right: 0; | ||
| 241 | + margin: auto; | ||
| 242 | + width: 3rem; | ||
| 243 | + height: 3rem; | ||
| 244 | + background-image: url("../assets/loading.png"); | ||
| 245 | + background-size: cover; | ||
| 246 | + background-color: #000000; | ||
| 247 | +} | ||
| 248 | + | ||
| 249 | +.video-item-title { | ||
| 250 | + position: absolute; | ||
| 251 | + bottom: 0; | ||
| 252 | + color: #000000; | ||
| 253 | + background-color: #ffffff; | ||
| 254 | + line-height: 1.5rem; | ||
| 255 | + padding: 0.3rem; | ||
| 256 | + width: 14.4rem; | ||
| 257 | +} | ||
| 258 | +</style> |
web_src/src/components/UiHeader.vue
| @@ -3,8 +3,8 @@ | @@ -3,8 +3,8 @@ | ||
| 3 | <el-menu router :default-active="this.$route.path" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal"> | 3 | <el-menu router :default-active="this.$route.path" background-color="#545c64" text-color="#fff" active-text-color="#ffd04b" mode="horizontal"> |
| 4 | <el-menu-item index="/">控制台</el-menu-item> | 4 | <el-menu-item index="/">控制台</el-menu-item> |
| 5 | <el-menu-item index="/videoList">设备列表</el-menu-item> | 5 | <el-menu-item index="/videoList">设备列表</el-menu-item> |
| 6 | + <el-menu-item index="/parentPlatformList">国标级联</el-menu-item> | ||
| 6 | <!-- <el-menu-item index="/videoReplay">录像回看</el-menu-item> --> | 7 | <!-- <el-menu-item index="/videoReplay">录像回看</el-menu-item> --> |
| 7 | - <!-- <el-menu-item index="4">级联设置</el-menu-item> --> | ||
| 8 | <el-menu-item style="float: right;" @click="loginout">退出</el-menu-item> | 8 | <el-menu-item style="float: right;" @click="loginout">退出</el-menu-item> |
| 9 | </el-menu> | 9 | </el-menu> |
| 10 | </div> | 10 | </div> |
| @@ -23,4 +23,4 @@ export default { | @@ -23,4 +23,4 @@ export default { | ||
| 23 | } | 23 | } |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | -</script> | ||
| 27 | \ No newline at end of file | 26 | \ No newline at end of file |
| 27 | +</script> |
web_src/src/router/index.js
| @@ -5,6 +5,7 @@ import control from '../components/control.vue' | @@ -5,6 +5,7 @@ import control from '../components/control.vue' | ||
| 5 | import videoList from '../components/videoList.vue' | 5 | import videoList from '../components/videoList.vue' |
| 6 | import channelList from '../components/channelList.vue' | 6 | import channelList from '../components/channelList.vue' |
| 7 | import login from '../components/Login.vue' | 7 | import login from '../components/Login.vue' |
| 8 | +import parentPlatformList from '../components/ParentPlatformList.vue' | ||
| 8 | 9 | ||
| 9 | const originalPush = VueRouter.prototype.push | 10 | const originalPush = VueRouter.prototype.push |
| 10 | VueRouter.prototype.push = function push(location) { | 11 | VueRouter.prototype.push = function push(location) { |
| @@ -34,6 +35,11 @@ export default new VueRouter({ | @@ -34,6 +35,11 @@ export default new VueRouter({ | ||
| 34 | path: '/channelList/:deviceId/:parentChannelId/:count/:page', | 35 | path: '/channelList/:deviceId/:parentChannelId/:count/:page', |
| 35 | name: 'channelList', | 36 | name: 'channelList', |
| 36 | component: channelList, | 37 | component: channelList, |
| 38 | + },, | ||
| 39 | + { | ||
| 40 | + path: '/parentPlatformList/:platformId/:count/:page', | ||
| 41 | + name: 'parentPlatformList', | ||
| 42 | + component: parentPlatformList, | ||
| 37 | }, | 43 | }, |
| 38 | ] | 44 | ] |
| 39 | }) | 45 | }) |