Merge branch 'wvp-28181-2.0' into 结构优化
# Conflicts: # src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java # src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java # src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java # src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java # src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java # src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java # src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java # src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java结构优化
commit
6d0361edf8
78
pom.xml
78
pom.xml
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<version>2.7.17</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.genersoft</groupId>
|
||||
|
@ -30,6 +30,7 @@
|
|||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>nexus-aliyun</id>
|
||||
|
@ -130,9 +131,9 @@
|
|||
|
||||
<!-- mysql数据库 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.30</version>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!--postgresql-->
|
||||
|
@ -144,8 +145,8 @@
|
|||
|
||||
<!-- kingbase人大金仓 -->
|
||||
<!-- 手动下载驱动后安装 -->
|
||||
<!-- mvn install:install-file -Dfile=/home/lin/soft/kingbase/jdbc-aarch/kingbase8-8.6.0.jar -DgroupId=com.kingbase -DartifactId=kingbase8 -Dversion=8.6.0 -Dpackaging=jar
|
||||
-->
|
||||
<!-- mvn install:install-file -Dfile=/home/lin/soft/kingbase/jdbc-aarch/kingbase8-8.6.0.jar -DgroupId=com.kingbase -DartifactId=kingbase8
|
||||
-Dversion=8.6.0 -Dpackaging=jar -->
|
||||
<dependency>
|
||||
<groupId>com.kingbase</groupId>
|
||||
<artifactId>kingbase8</artifactId>
|
||||
|
@ -165,7 +166,18 @@
|
|||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.6.10</version>
|
||||
<version>1.7.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -207,12 +219,6 @@
|
|||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>20.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- json解析库fastjson2 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
|
@ -247,11 +253,11 @@
|
|||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.sf.kxml/kxml2 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>net.sf.kxml</groupId>-->
|
||||
<!-- <artifactId>kxml2</artifactId>-->
|
||||
<!-- <version>2.3.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>net.sf.kxml</groupId>-->
|
||||
<!-- <artifactId>kxml2</artifactId>-->
|
||||
<!-- <version>2.3.0</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- jwt实现 -->
|
||||
<dependency>
|
||||
|
@ -271,7 +277,18 @@
|
|||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.3.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.24.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 获取系统信息 -->
|
||||
|
@ -286,31 +303,28 @@
|
|||
<artifactId>spring-session-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <!– 检测文件编码 –>-->
|
||||
<!-- <!– https://mvnrepository.com/artifact/cpdetector/cpdetector –>-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cpdetector</groupId>-->
|
||||
<!-- <artifactId>cpdetector</artifactId>-->
|
||||
<!-- <version>1.0.8</version>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- 检测文件编码 -->
|
||||
<!-- https://mvnrepository.com/artifact/cpdetector/cpdetector -->
|
||||
<!--<dependency>-->
|
||||
<!-- <groupId>cpdetector</groupId>-->
|
||||
<!-- <artifactId>cpdetector</artifactId>-->
|
||||
<!-- <version>1.0.8</version>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>31.1-jre</version>
|
||||
<version>32.1.3-jre</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<!-- <scope>test</scope>-->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}-${project.version}-${maven.build.timestamp}</finalName>
|
||||
<plugins>
|
||||
|
@ -322,6 +336,7 @@
|
|||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
@ -351,7 +366,6 @@
|
|||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
|
|
|
@ -11,4 +11,4 @@ alter table wvp_device
|
|||
add auto_sync_channel bool default true
|
||||
|
||||
alter table wvp_stream_proxy
|
||||
add stream_key varying(255)
|
||||
add stream_key character varying(255)
|
||||
|
|
|
@ -78,6 +78,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
|||
|
||||
// 构建UsernamePasswordAuthenticationToken,这里密码为null,是因为提供了正确的JWT,实现自动登录
|
||||
User user = new User();
|
||||
user.setId(jwtUser.getUserId());
|
||||
user.setUsername(jwtUser.getUserName());
|
||||
user.setPassword(jwtUser.getPassword());
|
||||
Role role = new Role();
|
||||
|
|
|
@ -144,6 +144,7 @@ public class JwtUtils implements InitializingBean {
|
|||
jwtUser.setUserName(username);
|
||||
jwtUser.setPassword(user.getPassword());
|
||||
jwtUser.setRoleId(user.getRole().getId());
|
||||
jwtUser.setUserId(user.getId());
|
||||
|
||||
return jwtUser;
|
||||
} catch (InvalidJwtException e) {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.genersoft.iot.vmp.conf.security;
|
||||
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
|
@ -28,6 +28,7 @@ import java.util.Arrays;
|
|||
|
||||
/**
|
||||
* 配置Spring Security
|
||||
*
|
||||
* @author lin
|
||||
*/
|
||||
@Configuration
|
||||
|
@ -79,7 +80,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
matchers.add("/assets/**");
|
||||
matchers.add("/resource/**");
|
||||
matchers.add("/favicon.ico");
|
||||
matchers.addAll(userSetting.getInterfaceAuthenticationExcludes());
|
||||
matchers.add("/api/emit");
|
||||
// 可以直接访问的静态数据
|
||||
web.ignoring().antMatchers(matchers.toArray(new String[0]));
|
||||
}
|
||||
|
@ -87,6 +88,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
|
||||
/**
|
||||
* 配置认证方式
|
||||
*
|
||||
* @param auth
|
||||
* @throws Exception
|
||||
*/
|
||||
|
@ -115,7 +117,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
.authorizeRequests()
|
||||
.requestMatchers(CorsUtils::isPreFlightRequest).permitAll()
|
||||
.antMatchers(userSetting.getInterfaceAuthenticationExcludes().toArray(new String[0])).permitAll()
|
||||
.antMatchers("/api/user/login","/index/hook/**","/zlm_Proxy/FhTuMYqB2HeCuNOb/record/t/1/2023-03-25/16:35:07-16:35:16-9353.mp4").permitAll()
|
||||
.antMatchers("/api/user/login", "/index/hook/**").permitAll()
|
||||
.anyRequest().authenticated()
|
||||
// 异常处理器
|
||||
.and()
|
||||
|
@ -128,7 +130,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
|
||||
}
|
||||
|
||||
CorsConfigurationSource configurationSource(){
|
||||
CorsConfigurationSource configurationSource() {
|
||||
// 配置跨域
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
corsConfiguration.setAllowedHeaders(Arrays.asList("*"));
|
||||
|
@ -139,7 +141,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
corsConfiguration.setExposedHeaders(Arrays.asList(JwtUtils.getHeader()));
|
||||
|
||||
UrlBasedCorsConfigurationSource url = new UrlBasedCorsConfigurationSource();
|
||||
url.registerCorsConfiguration("/**",corsConfiguration);
|
||||
url.registerCorsConfiguration("/**", corsConfiguration);
|
||||
return url;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ public class JwtUser {
|
|||
EXCEPTION
|
||||
}
|
||||
|
||||
private int userId;
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
@ -29,6 +30,14 @@ public class JwtUser {
|
|||
|
||||
private TokenStatus status;
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(int userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.genersoft.iot.vmp.gb28181.conf;
|
||||
|
||||
import gov.nist.core.StackLogger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.spi.LocationAwareLogger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Properties;
|
||||
|
@ -10,7 +10,39 @@ import java.util.Properties;
|
|||
@Component
|
||||
public class StackLoggerImpl implements StackLogger {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(StackLoggerImpl.class);
|
||||
/**
|
||||
* 完全限定类名(Fully Qualified Class Name),用于定位日志位置
|
||||
*/
|
||||
private static final String FQCN = StackLoggerImpl.class.getName();
|
||||
|
||||
/**
|
||||
* 获取栈中类信息(以便底层日志记录系统能够提取正确的位置信息(方法名、行号))
|
||||
* @return LocationAwareLogger
|
||||
*/
|
||||
private static LocationAwareLogger getLocationAwareLogger() {
|
||||
return (LocationAwareLogger) LoggerFactory.getLogger(new Throwable().getStackTrace()[4].getClassName());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 封装打印日志的位置信息
|
||||
* @param level 日志级别
|
||||
* @param message 日志事件的消息
|
||||
*/
|
||||
private static void log(int level, String message) {
|
||||
LocationAwareLogger locationAwareLogger = getLocationAwareLogger();
|
||||
locationAwareLogger.log(null, FQCN, level, message, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 封装打印日志的位置信息
|
||||
* @param level 日志级别
|
||||
* @param message 日志事件的消息
|
||||
*/
|
||||
private static void log(int level, String message, Throwable throwable) {
|
||||
LocationAwareLogger locationAwareLogger = getLocationAwareLogger();
|
||||
locationAwareLogger.log(null, FQCN, level, message, null, throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logStackTrace() {
|
||||
|
@ -34,27 +66,27 @@ public class StackLoggerImpl implements StackLogger {
|
|||
|
||||
@Override
|
||||
public void logDebug(String message) {
|
||||
// logger.debug(message);
|
||||
log(LocationAwareLogger.INFO_INT, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logDebug(String message, Exception ex) {
|
||||
// logger.debug(message);
|
||||
log(LocationAwareLogger.INFO_INT, message, ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logTrace(String message) {
|
||||
logger.trace(message);
|
||||
log(LocationAwareLogger.INFO_INT, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logFatalError(String message) {
|
||||
// logger.error(message);
|
||||
log(LocationAwareLogger.INFO_INT, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logError(String message) {
|
||||
// logger.error(message);
|
||||
log(LocationAwareLogger.INFO_INT, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -69,17 +101,17 @@ public class StackLoggerImpl implements StackLogger {
|
|||
|
||||
@Override
|
||||
public void logError(String message, Exception ex) {
|
||||
// logger.error(message);
|
||||
log(LocationAwareLogger.INFO_INT, message, ex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logWarning(String message) {
|
||||
logger.warn(message);
|
||||
log(LocationAwareLogger.INFO_INT, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logInfo(String message) {
|
||||
logger.info(message);
|
||||
log(LocationAwareLogger.INFO_INT, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,55 +1,68 @@
|
|||
package com.genersoft.iot.vmp.gb28181.event.alarm;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
import java.io.IOException;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @description: 报警事件监听
|
||||
* @author: lawrencehj
|
||||
* @data: 2021-01-20
|
||||
* 报警事件监听器.
|
||||
*
|
||||
* @author lawrencehj
|
||||
* @author <a href="mailto:xiaoQQya@126.com">xiaoQQya</a>
|
||||
* @since 2021/01/20
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class AlarmEventListener implements ApplicationListener<AlarmEvent> {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(AlarmEventListener.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(AlarmEventListener.class);
|
||||
|
||||
private static Map<String, SseEmitter> sseEmitters = new Hashtable<>();
|
||||
private static final Map<String, PrintWriter> SSE_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
public void addSseEmitters(String browserId, SseEmitter sseEmitter) {
|
||||
sseEmitters.put(browserId, sseEmitter);
|
||||
public void addSseEmitter(String browserId, PrintWriter writer) {
|
||||
SSE_CACHE.put(browserId, writer);
|
||||
logger.info("SSE 在线数量: {}", SSE_CACHE.size());
|
||||
}
|
||||
|
||||
public void removeSseEmitter(String browserId, PrintWriter writer) {
|
||||
SSE_CACHE.remove(browserId, writer);
|
||||
logger.info("SSE 在线数量: {}", SSE_CACHE.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(AlarmEvent event) {
|
||||
public void onApplicationEvent(@NotNull AlarmEvent event) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("设备报警事件触发,deviceId:" + event.getAlarmInfo().getDeviceId() + ", "
|
||||
+ event.getAlarmInfo().getAlarmDescription());
|
||||
logger.debug("设备报警事件触发, deviceId: {}, {}", event.getAlarmInfo().getDeviceId(), event.getAlarmInfo().getAlarmDescription());
|
||||
}
|
||||
String msg = "<strong>设备编码:</strong> <i>" + event.getAlarmInfo().getDeviceId() + "</i>"
|
||||
+ "<br><strong>报警描述:</strong> <i>" + event.getAlarmInfo().getAlarmDescription() + "</i>"
|
||||
+ "<br><strong>报警时间:</strong> <i>" + event.getAlarmInfo().getAlarmTime() + "</i>"
|
||||
+ "<br><strong>报警位置:</strong> <i>" + event.getAlarmInfo().getLongitude() + "</i>"
|
||||
+ ", <i>" + event.getAlarmInfo().getLatitude() + "</i>";
|
||||
|
||||
for (Iterator<Map.Entry<String, SseEmitter>> it = sseEmitters.entrySet().iterator(); it.hasNext();) {
|
||||
Map.Entry<String, SseEmitter> emitter = it.next();
|
||||
logger.info("推送到SSE连接,浏览器ID: " + emitter.getKey());
|
||||
String msg = "<strong>设备编号:</strong> <i>" + event.getAlarmInfo().getDeviceId() + "</i>"
|
||||
+ "<br><strong>通道编号:</strong> <i>" + event.getAlarmInfo().getChannelId() + "</i>"
|
||||
+ "<br><strong>报警描述:</strong> <i>" + event.getAlarmInfo().getAlarmDescription() + "</i>"
|
||||
+ "<br><strong>报警时间:</strong> <i>" + event.getAlarmInfo().getAlarmTime() + "</i>";
|
||||
|
||||
for (Iterator<Map.Entry<String, PrintWriter>> it = SSE_CACHE.entrySet().iterator(); it.hasNext(); ) {
|
||||
Map.Entry<String, PrintWriter> response = it.next();
|
||||
logger.info("推送到 SSE 连接, 浏览器 ID: {}", response.getKey());
|
||||
try {
|
||||
emitter.getValue().send(msg);
|
||||
} catch (IOException | IllegalStateException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("SSE连接已关闭");
|
||||
PrintWriter writer = response.getValue();
|
||||
|
||||
if (writer.checkError()) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
// 移除已关闭的连接
|
||||
|
||||
String sseMsg = "event:message\n" +
|
||||
"data:" + msg + "\n" +
|
||||
"\n";
|
||||
writer.write(sseMsg);
|
||||
writer.flush();
|
||||
} catch (Exception e) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,8 +117,19 @@ public class VideoStreamSessionManager {
|
|||
}
|
||||
|
||||
public void remove(String deviceId, String channelId, String stream) {
|
||||
SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream);
|
||||
if (ssrcTransaction == null) {
|
||||
List<SsrcTransaction> ssrcTransactionList = getSsrcTransactionForAll(deviceId, channelId, null, stream);
|
||||
if (ssrcTransactionList == null || ssrcTransactionList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
|
||||
redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"
|
||||
+ deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream());
|
||||
}
|
||||
}
|
||||
|
||||
public void removeByCallId(String deviceId, String channelId, String callId) {
|
||||
SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, callId, null);
|
||||
if (ssrcTransaction == null ) {
|
||||
return;
|
||||
}
|
||||
redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_"
|
||||
|
|
|
@ -89,17 +89,17 @@ public class CatalogSubscribeTask implements ISubscribeTask {
|
|||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
if (event.getResponse().getRawContent() != null) {
|
||||
// 成功
|
||||
logger.info("[取消目录订阅订阅]成功: {}", device.getDeviceId());
|
||||
logger.info("[取消目录订阅]成功: {}", device.getDeviceId());
|
||||
}else {
|
||||
// 成功
|
||||
logger.info("[取消目录订阅订阅]成功: {}", device.getDeviceId());
|
||||
logger.info("[取消目录订阅]成功: {}", device.getDeviceId());
|
||||
}
|
||||
},eventResult -> {
|
||||
// 失败
|
||||
logger.warn("[取消目录订阅订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
logger.warn("[取消目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
});
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 取消目录订阅订阅: {}", e.getMessage());
|
||||
logger.error("[命令发送失败] 取消目录订阅: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,6 +164,7 @@ public class SIPRequestHeaderProvider {
|
|||
Request request = null;
|
||||
//请求行
|
||||
SipURI requestLine = SipFactory.getInstance().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
// SipURI requestLine = SipFactory.getInstance().createAddressFactory().createSipURI(device.getDeviceId(), device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = SipFactory.getInstance().createHeaderFactory().createViaHeader(sipLayer.getLocalIp(device.getLocalIp()), sipConfig.getPort(), device.getTransport(), SipUtils.getNewViaTag());
|
||||
|
@ -174,6 +175,7 @@ public class SIPRequestHeaderProvider {
|
|||
FromHeader fromHeader = SipFactory.getInstance().createHeaderFactory().createFromHeader(fromAddress, transactionInfo.getFromTag());
|
||||
//to
|
||||
SipURI toSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(channelId,device.getHostAddress());
|
||||
// SipURI toSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(device.getDeviceId(),device.getHostAddress());
|
||||
Address toAddress = SipFactory.getInstance().createAddressFactory().createAddress(toSipURI);
|
||||
ToHeader toHeader = SipFactory.getInstance().createHeaderFactory().createToHeader(toAddress, transactionInfo.getToTag());
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import javax.sip.SipFactory;
|
|||
import javax.sip.header.CallIdHeader;
|
||||
import javax.sip.message.Request;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:设备能力接口,用于定义设备的控制、查询能力
|
||||
|
@ -373,7 +374,8 @@ public class SIPCommander implements ISIPCommander {
|
|||
}), e -> {
|
||||
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
||||
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
||||
streamSession.put(device.getDeviceId(), channelId, "play", stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response,
|
||||
String callId = response.getCallIdHeader().getCallId();
|
||||
streamSession.put(device.getDeviceId(), channelId, callId, stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response,
|
||||
InviteSessionType.PLAY);
|
||||
okEvent.response(e);
|
||||
});
|
||||
|
@ -611,18 +613,22 @@ public class SIPCommander implements ISIPCommander {
|
|||
*/
|
||||
@Override
|
||||
public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
|
||||
SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(device.getDeviceId(), channelId, callId, stream);
|
||||
if (ssrcTransaction == null) {
|
||||
List<SsrcTransaction> ssrcTransactionList = streamSession.getSsrcTransactionForAll(device.getDeviceId(), channelId, callId, stream);
|
||||
if (ssrcTransactionList == null || ssrcTransactionList.isEmpty()) {
|
||||
logger.info("[发送BYE] 未找到事务信息,设备: device: {}, channel: {}", device.getDeviceId(), channelId);
|
||||
throw new SsrcTransactionNotFoundException(device.getDeviceId(), channelId, callId, stream);
|
||||
}
|
||||
|
||||
for (SsrcTransaction ssrcTransaction : ssrcTransactionList) {
|
||||
logger.info("[发送BYE] 设备: device: {}, channel: {}, callId: {}", device.getDeviceId(), channelId, ssrcTransaction.getCallId());
|
||||
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
|
||||
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
|
||||
streamSession.remove(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
||||
|
||||
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
|
||||
streamSession.removeByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getCallId());
|
||||
Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());
|
||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 语音广播
|
||||
|
|
|
@ -178,7 +178,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
if (mediaServerItem != null) {
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcTransaction.getSsrc());
|
||||
}
|
||||
streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcTransaction.getStream());
|
||||
streamSession.removeByCallId(device.getDeviceId(), channel.getChannelId(), ssrcTransaction.getCallId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,6 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
|
|||
|
||||
if (CmdType.CATALOG.equals(cmd)) {
|
||||
logger.info("接收到Catalog通知");
|
||||
processNotifyCatalogList(take.getEvt());
|
||||
notifyRequestForCatalogProcessor.process(take.getEvt());
|
||||
} else if (CmdType.ALARM.equals(cmd)) {
|
||||
logger.info("接收到Alarm通知");
|
||||
|
|
|
@ -61,7 +61,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||
return;
|
||||
}
|
||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||
logger.info("[收到心跳], device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
||||
logger.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
||||
|
||||
// 回复200 OK
|
||||
try {
|
||||
|
@ -80,6 +80,11 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
|||
device.setPort(remoteAddressInfo.getPort());
|
||||
device.setHostAddress(remoteAddressInfo.getIp().concat(":").concat(String.valueOf(remoteAddressInfo.getPort())));
|
||||
device.setIp(remoteAddressInfo.getIp());
|
||||
// 设备地址变化会引起目录订阅任务失效,需要重新添加
|
||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||
deviceService.removeCatalogSubscribe(device);
|
||||
deviceService.addCatalogSubscribe(device);
|
||||
}
|
||||
}
|
||||
if (device.getKeepaliveTime() == null) {
|
||||
device.setKeepaliveIntervalTime(60);
|
||||
|
|
|
@ -262,16 +262,25 @@ public class ZLMHttpHookListener {
|
|||
} else {
|
||||
result.setEnable_mp4(userSetting.isRecordPushLive());
|
||||
}
|
||||
// 替换流地址
|
||||
if ("rtp".equals(param.getApp()) && !mediaInfo.isRtpEnable()) {
|
||||
String ssrc = String.format("%010d", Long.parseLong(param.getStream(), 16));;
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoBySSRC(ssrc);
|
||||
|
||||
// 国标流
|
||||
if ("rtp".equals(param.getApp()) ) {
|
||||
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream());
|
||||
|
||||
// 单端口模式下修改流 ID
|
||||
if (!mediaInfo.isRtpEnable() && inviteInfo == null) {
|
||||
String ssrc = String.format("%010d", Long.parseLong(param.getStream(), 16));
|
||||
inviteInfo = inviteStreamService.getInviteInfoBySSRC(ssrc);
|
||||
if (inviteInfo != null) {
|
||||
result.setStream_replace(inviteInfo.getStream());
|
||||
logger.info("[ZLM HOOK]推流鉴权 stream: {} 替换为 {}", param.getStream(), inviteInfo.getStream());
|
||||
}
|
||||
}
|
||||
List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream());
|
||||
|
||||
// 设置音频信息及录制信息
|
||||
List<SsrcTransaction> ssrcTransactionForAll = (inviteInfo == null ? null :
|
||||
sessionManager.getSsrcTransactionForAll(inviteInfo.getDeviceId(), inviteInfo.getChannelId(), null, null));
|
||||
if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
|
||||
String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
|
||||
String channelId = ssrcTransactionForAll.get(0).getChannelId();
|
||||
|
@ -285,6 +294,8 @@ public class ZLMHttpHookListener {
|
|||
result.setEnable_mp4(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaInfo.getRecordAssistPort() > 0 && userSetting.getRecordPath() == null) {
|
||||
logger.info("推流时发现尚未设置录像路径,从assist服务中读取");
|
||||
JSONObject info = assistRESTfulUtils.getInfo(mediaInfo, null);
|
||||
|
@ -514,11 +525,15 @@ public class ZLMHttpHookListener {
|
|||
if (info != null) {
|
||||
cmder.streamByeCmd(device, inviteInfo.getChannelId(),
|
||||
inviteInfo.getStream(), null);
|
||||
}else {
|
||||
logger.info("[无人观看] 未找到设备的点播信息: {}, 流:{}", inviteInfo.getDeviceId(), param.getStream());
|
||||
}
|
||||
} catch (InvalidArgumentException | ParseException | SipException |
|
||||
SsrcTransactionNotFoundException e) {
|
||||
logger.error("[无人观看]点播, 发送BYE失败 {}", e.getMessage());
|
||||
}
|
||||
}else {
|
||||
logger.info("[无人观看] 未找到设备: {},流:{}", inviteInfo.getDeviceId(), param.getStream());
|
||||
}
|
||||
|
||||
inviteStreamService.removeInviteInfo(inviteInfo.getType(), inviteInfo.getDeviceId(),
|
||||
|
@ -583,7 +598,7 @@ public class ZLMHttpHookListener {
|
|||
String deviceId = s[0];
|
||||
String channelId = s[1];
|
||||
Device device = redisCatchStorage.getDevice(deviceId);
|
||||
if (device == null) {
|
||||
if (device == null || !device.isOnLine()) {
|
||||
defaultResult.setResult(new HookResult(ErrorCode.ERROR404.getCode(), ErrorCode.ERROR404.getMsg()));
|
||||
return defaultResult;
|
||||
}
|
||||
|
|
|
@ -215,6 +215,21 @@ public class ZLMRESTfulUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public JSONObject isMediaOnline(MediaServerItem mediaServerItem, String app, String stream, String schema){
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
if (app != null) {
|
||||
param.put("app",app);
|
||||
}
|
||||
if (stream != null) {
|
||||
param.put("stream",stream);
|
||||
}
|
||||
if (schema != null) {
|
||||
param.put("schema",schema);
|
||||
}
|
||||
param.put("vhost","__defaultVhost__");
|
||||
return sendPost(mediaServerItem, "isMediaOnline", param, null);
|
||||
}
|
||||
|
||||
public JSONObject getMediaList(MediaServerItem mediaServerItem, String app, String stream, String schema, RequestCallback callback){
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
if (app != null) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
|||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForServerStarted;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
|
@ -140,7 +140,7 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||
/**
|
||||
* 音频采样位数
|
||||
*/
|
||||
private int sampleBit;
|
||||
private int sample_bit;
|
||||
|
||||
/**
|
||||
* 音频采样率
|
||||
|
@ -150,7 +150,7 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||
/**
|
||||
* 视频fps
|
||||
*/
|
||||
private int fps;
|
||||
private float fps;
|
||||
|
||||
/**
|
||||
* 视频高
|
||||
|
@ -162,6 +162,31 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||
*/
|
||||
private int width;
|
||||
|
||||
/**
|
||||
* 帧数
|
||||
*/
|
||||
private int frames;
|
||||
|
||||
/**
|
||||
* 关键帧数
|
||||
*/
|
||||
private int key_frames;
|
||||
|
||||
/**
|
||||
* GOP大小
|
||||
*/
|
||||
private int gop_size;
|
||||
|
||||
/**
|
||||
* GOP间隔时长(ms)
|
||||
*/
|
||||
private int gop_interval_ms;
|
||||
|
||||
/**
|
||||
* 丢帧率
|
||||
*/
|
||||
private float loss;
|
||||
|
||||
public int getChannels() {
|
||||
return channels;
|
||||
}
|
||||
|
@ -202,12 +227,12 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||
this.ready = ready;
|
||||
}
|
||||
|
||||
public int getSampleBit() {
|
||||
return sampleBit;
|
||||
public int getSample_bit() {
|
||||
return sample_bit;
|
||||
}
|
||||
|
||||
public void setSampleBit(int sampleBit) {
|
||||
this.sampleBit = sampleBit;
|
||||
public void setSample_bit(int sample_bit) {
|
||||
this.sample_bit = sample_bit;
|
||||
}
|
||||
|
||||
public int getSample_rate() {
|
||||
|
@ -218,11 +243,11 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||
this.sample_rate = sample_rate;
|
||||
}
|
||||
|
||||
public int getFps() {
|
||||
public float getFps() {
|
||||
return fps;
|
||||
}
|
||||
|
||||
public void setFps(int fps) {
|
||||
public void setFps(float fps) {
|
||||
this.fps = fps;
|
||||
}
|
||||
|
||||
|
@ -241,6 +266,46 @@ public class OnStreamChangedHookParam extends HookParam{
|
|||
public void setWidth(int width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public int getFrames() {
|
||||
return frames;
|
||||
}
|
||||
|
||||
public void setFrames(int frames) {
|
||||
this.frames = frames;
|
||||
}
|
||||
|
||||
public int getKey_frames() {
|
||||
return key_frames;
|
||||
}
|
||||
|
||||
public void setKey_frames(int key_frames) {
|
||||
this.key_frames = key_frames;
|
||||
}
|
||||
|
||||
public int getGop_size() {
|
||||
return gop_size;
|
||||
}
|
||||
|
||||
public void setGop_size(int gop_size) {
|
||||
this.gop_size = gop_size;
|
||||
}
|
||||
|
||||
public int getGop_interval_ms() {
|
||||
return gop_interval_ms;
|
||||
}
|
||||
|
||||
public void setGop_interval_ms(int gop_interval_ms) {
|
||||
this.gop_interval_ms = gop_interval_ms;
|
||||
}
|
||||
|
||||
public float getLoss() {
|
||||
return loss;
|
||||
}
|
||||
|
||||
public void setLoss(float loss) {
|
||||
this.loss = loss;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OriginSock{
|
||||
|
|
|
@ -272,6 +272,10 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
|||
if (channels.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String now = DateUtil.getNow();
|
||||
for (DeviceChannel channel : channels) {
|
||||
channel.setUpdateTime(now);
|
||||
}
|
||||
channelMapper.batchUpdate(channels);
|
||||
for (DeviceChannel channel : channels) {
|
||||
if (channel.getParentId() != null) {
|
||||
|
|
|
@ -215,7 +215,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
for (SsrcTransaction ssrcTransaction : ssrcTransactions) {
|
||||
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
|
||||
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
|
||||
streamSession.remove(deviceId, ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
||||
streamSession.removeByCallId(deviceId, ssrcTransaction.getChannelId(), ssrcTransaction.getCallId());
|
||||
}
|
||||
}
|
||||
// 移除订阅
|
||||
|
@ -518,16 +518,18 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
|
||||
|
||||
// 目录订阅相关的信息
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
||||
if (device.getSubscribeCycleForCatalog() > 0) {
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) {
|
||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
||||
// 开启订阅
|
||||
addCatalogSubscribe(deviceInStore);
|
||||
}
|
||||
}else if (device.getSubscribeCycleForCatalog() == 0) {
|
||||
// 若已开启订阅,但订阅周期不同,则先取消
|
||||
if (deviceInStore.getSubscribeCycleForCatalog() != 0) {
|
||||
removeCatalogSubscribe(deviceInStore);
|
||||
}
|
||||
// 开启订阅
|
||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
||||
addCatalogSubscribe(deviceInStore);
|
||||
}else if (device.getSubscribeCycleForCatalog() == 0) {
|
||||
// 取消订阅
|
||||
deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog());
|
||||
removeCatalogSubscribe(deviceInStore);
|
||||
}
|
||||
}
|
||||
|
@ -542,6 +544,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||
}
|
||||
}else if (device.getSubscribeCycleForMobilePosition() == 0) {
|
||||
if (deviceInStore.getSubscribeCycleForMobilePosition() != 0) {
|
||||
deviceInStore.setMobilePositionSubmissionInterval(device.getMobilePositionSubmissionInterval());
|
||||
deviceInStore.setSubscribeCycleForMobilePosition(device.getSubscribeCycleForMobilePosition());
|
||||
// 取消订阅
|
||||
removeMobilePositionSubscribe(deviceInStore);
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
|
|||
":" + inviteInfo.getDeviceId() +
|
||||
":" + inviteInfo.getChannelId() +
|
||||
":" + inviteInfo.getStream() +
|
||||
":" + inviteInfo.getSsrcInfo().getSsrc();
|
||||
":" + ssrc;
|
||||
if (inviteInfoInDb.getSsrcInfo() != null) {
|
||||
inviteInfoInDb.getSsrcInfo().setSsrc(ssrc);
|
||||
}
|
||||
|
|
|
@ -163,14 +163,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
if (streamId == null) {
|
||||
streamId = String.format("%08x", Long.parseLong(ssrc)).toUpperCase();
|
||||
}
|
||||
int ssrcCheckParam = 0;
|
||||
if (ssrcCheck && tcpMode > 1) {
|
||||
if (ssrcCheck && tcpMode > 0) {
|
||||
// 目前zlm不支持 tcp模式更新ssrc,暂时关闭ssrc校验
|
||||
logger.warn("[openRTPServer] TCP被动/TCP主动收流时,默认关闭ssrc检验");
|
||||
logger.warn("[openRTPServer] 平台对接时下级可能自定义ssrc,但是tcp模式zlm收流目前无法更新ssrc,可能收流超时,此时请使用udp收流或者关闭ssrc校验");
|
||||
}
|
||||
int rtpServerPort;
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, (ssrcCheck && tcpMode == 0) ? Long.parseLong(ssrc) : 0, port, reUsePort, tcpMode);
|
||||
rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, reUsePort, tcpMode);
|
||||
} else {
|
||||
rtpServerPort = mediaServerItem.getRtpProxyPort();
|
||||
}
|
||||
|
@ -197,8 +196,11 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
@Override
|
||||
public void closeRTPServer(String mediaServerId, String streamId) {
|
||||
MediaServerItem mediaServerItem = this.getOne(mediaServerId);
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
closeRTPServer(mediaServerItem, streamId);
|
||||
}
|
||||
zlmresTfulUtils.closeStreams(mediaServerItem, "rtp", streamId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) {
|
||||
|
@ -569,7 +571,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline
|
||||
if (mediaServerItem.getRtspPort() != 0) {
|
||||
param.put("ffmpeg.snap", "%s -rtsp_transport tcp -i %s -y -f mjpeg -t 0.001 %s");
|
||||
param.put("ffmpeg.snap", "%s -rtsp_transport tcp -i %s -y -f mjpeg -frames:v 1 %s");
|
||||
}
|
||||
param.put("hook.enable","1");
|
||||
param.put("hook.on_flow_report","");
|
||||
|
|
|
@ -149,6 +149,22 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delAllChannelForGB(String platformId, String catalogId) {
|
||||
|
||||
int result;
|
||||
if (platformId == null) {
|
||||
return 0;
|
||||
}
|
||||
ParentPlatform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||
if (platform == null) {
|
||||
return 0;
|
||||
}
|
||||
if (ObjectUtils.isEmpty(catalogId)) {
|
||||
catalogId = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonGbChannel queryChannelByPlatformIdAndChannelDeviceId(Integer platformId, String channelId) {
|
||||
return platformChannelMapper.queryChannelByPlatformIdAndChannelDeviceId(platformId, channelId);
|
||||
|
|
|
@ -231,6 +231,15 @@ public class PlayServiceImpl implements IPlayService {
|
|||
HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, "rtsp", mediaServerItem.getId());
|
||||
subscribe.removeSubscribe(hookSubscribe);
|
||||
}
|
||||
}else {
|
||||
logger.info("[点播超时] 收流超时 deviceId: {}, channelId: {},码流类型:{},端口:{}, SSRC: {}",
|
||||
device.getDeviceId(), channelId, device.isSwitchPrimarySubStream() ? "辅码流" : "主码流",
|
||||
ssrcInfo.getPort(), ssrcInfo.getSsrc());
|
||||
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||
|
||||
mediaServerService.closeRTPServer(mediaServerItem.getId(), ssrcInfo.getStream());
|
||||
streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream());
|
||||
}
|
||||
}, userSetting.getPlayTimeout());
|
||||
|
||||
|
@ -261,6 +270,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
InviteOKHandler(eventResult, ssrcInfo, mediaServerItem, device, channelId,
|
||||
timeOutTaskKey, callback, inviteInfo, InviteSessionType.PLAY);
|
||||
}, (event) -> {
|
||||
logger.info("[点播失败] deviceId: {}, channelId:{}, {}: {}", device.getDeviceId(), channelId, event.statusCode, event.msg);
|
||||
dynamicTask.stop(timeOutTaskKey);
|
||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||
// 释放ssrc
|
||||
|
@ -325,7 +335,13 @@ public class PlayServiceImpl implements IPlayService {
|
|||
if (!device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE")) {
|
||||
return;
|
||||
}
|
||||
String substring = contentString.substring(0, contentString.indexOf("y="));
|
||||
|
||||
String substring;
|
||||
if (contentString.indexOf("y=") > 0) {
|
||||
substring = contentString.substring(0, contentString.indexOf("y="));
|
||||
}else {
|
||||
substring = contentString;
|
||||
}
|
||||
try {
|
||||
SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring);
|
||||
int port = -1;
|
||||
|
@ -415,7 +431,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
deviceChannel.setStreamId(streamInfo.getStream());
|
||||
storager.startPlay(deviceId, channelId, streamInfo.getStream());
|
||||
}
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAYBACK, deviceId, channelId);
|
||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(InviteSessionType.PLAYBACK, ((OnStreamChangedHookParam) param).getStream());
|
||||
if (inviteInfo != null) {
|
||||
inviteInfo.setStatus(InviteSessionStatus.ok);
|
||||
|
||||
|
@ -559,7 +575,6 @@ public class PlayServiceImpl implements IPlayService {
|
|||
// 处理收到200ok后的TCP主动连接以及SSRC不一致的问题
|
||||
InviteOKHandler(eventResult, ssrcInfo, mediaServerItem, device, channelId,
|
||||
playBackTimeOutTaskKey, callback, inviteInfo, InviteSessionType.PLAYBACK);
|
||||
|
||||
}, errorEvent);
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 录像回放: {}", e.getMessage());
|
||||
|
@ -580,6 +595,10 @@ public class PlayServiceImpl implements IPlayService {
|
|||
ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
|
||||
String contentString = new String(responseEvent.getResponse().getRawContent());
|
||||
String ssrcInResponse = SipUtils.getSsrcFromSdp(contentString);
|
||||
// 兼容回复的消息中缺少ssrc(y字段)的情况
|
||||
if (ssrcInResponse == null) {
|
||||
ssrcInResponse = ssrcInfo.getSsrc();
|
||||
}
|
||||
if (ssrcInfo.getSsrc().equals(ssrcInResponse)) {
|
||||
// ssrc 一致
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
|
@ -658,6 +677,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<Object> callback) {
|
||||
Device device = storager.queryVideoDevice(deviceId);
|
||||
|
|
|
@ -35,12 +35,20 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.TransactionDefinition;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
|
@ -348,6 +356,8 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
logger.info("启用代理失败: {}/{}->{}({})", app, stream, jsonObject.getString("msg"),
|
||||
streamProxy.getSrcUrl() == null? streamProxy.getUrl():streamProxy.getSrcUrl());
|
||||
}
|
||||
} else if (streamProxy != null && streamProxy.isEnable()) {
|
||||
return true ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -522,6 +532,45 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
return new ResourceBaseInfo(total, online);
|
||||
}
|
||||
|
||||
|
||||
@Scheduled(cron = "* 0/10 * * * ?")
|
||||
public void asyncCheckStreamProxyStatus() {
|
||||
|
||||
List<MediaServerItem> all = mediaServerService.getAllOnline();
|
||||
|
||||
if (CollectionUtils.isEmpty(all)){
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, MediaServerItem> serverItemMap = all.stream().collect(Collectors.toMap(MediaServerItem::getId, Function.identity(), (m1, m2) -> m1));
|
||||
|
||||
List<StreamProxyItem> list = videoManagerStorager.getStreamProxyListForEnable(true);
|
||||
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
return;
|
||||
}
|
||||
|
||||
for (StreamProxyItem streamProxyItem : list) {
|
||||
|
||||
MediaServerItem mediaServerItem = serverItemMap.get(streamProxyItem.getMediaServerId());
|
||||
|
||||
// TODO 支持其他 schema
|
||||
JSONObject mediaInfo = zlmresTfulUtils.isMediaOnline(mediaServerItem, streamProxyItem.getApp(), streamProxyItem.getStream(), "rtsp");
|
||||
|
||||
if (mediaInfo == null){
|
||||
streamProxyItem.setStatus(false);
|
||||
} else {
|
||||
if (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")) {
|
||||
streamProxyItem.setStatus(true);
|
||||
} else {
|
||||
streamProxyItem.setStatus(false);
|
||||
}
|
||||
}
|
||||
|
||||
updateStreamProxy(streamProxyItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStreamGPS(List<GPSMsgInfo> gpsMsgInfoList) {
|
||||
streamProxyMapper.updateStreamGPS(gpsMsgInfoList);
|
||||
|
|
|
@ -441,6 +441,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
stream.setUpdateTime(now);
|
||||
stream.setCreateTime(now);
|
||||
stream.setServerId(userSetting.getServerId());
|
||||
stream.setMediaServerId(mediaConfig.getId());
|
||||
stream.setSelf(true);
|
||||
stream.setPushIng(true);
|
||||
return streamPushMapper.add(stream) > 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,15 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
|||
@Autowired
|
||||
private ParentPlatformMapper platformMapper;
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private PlatformChannelMapper platformChannelMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformCatalogMapper platformCatalogMapper;
|
||||
|
||||
@Autowired
|
||||
private StreamProxyMapper streamProxyMapper;
|
||||
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
package com.genersoft.iot.vmp.vmanager.gb28181.SseController;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
/**
|
||||
* @description: SSE推送
|
||||
* @author: lawrencehj
|
||||
* @data: 2021-01-20
|
||||
*/
|
||||
@Tag(name = "SSE推送")
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/api")
|
||||
public class SseController {
|
||||
@Autowired
|
||||
AlarmEventListener alarmEventListener;
|
||||
|
||||
@GetMapping("/emit")
|
||||
public SseEmitter emit(@RequestParam String browserId) {
|
||||
final SseEmitter sseEmitter = new SseEmitter(0L);
|
||||
try {
|
||||
alarmEventListener.addSseEmitters(browserId, sseEmitter);
|
||||
}catch (Exception e){
|
||||
sseEmitter.completeWithError(e);
|
||||
}
|
||||
return sseEmitter;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.genersoft.iot.vmp.vmanager.gb28181.sse;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEventListener;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
|
||||
/**
|
||||
* SSE 推送.
|
||||
*
|
||||
* @author lawrencehj
|
||||
* @author <a href="mailto:xiaoQQya@126.com">xiaoQQya</a>
|
||||
* @since 2021/01/20
|
||||
*/
|
||||
@Tag(name = "SSE 推送")
|
||||
@RestController
|
||||
@RequestMapping("/api")
|
||||
public class SseController {
|
||||
|
||||
@Resource
|
||||
private AlarmEventListener alarmEventListener;
|
||||
|
||||
/**
|
||||
* SSE 推送.
|
||||
*
|
||||
* @param response 响应
|
||||
* @param browserId 浏览器ID
|
||||
* @throws IOException IOEXCEPTION
|
||||
* @author <a href="mailto:xiaoQQya@126.com">xiaoQQya</a>
|
||||
* @since 2023/11/06
|
||||
*/
|
||||
@GetMapping("/emit")
|
||||
public void emit(HttpServletResponse response, @RequestParam String browserId) throws IOException, InterruptedException {
|
||||
response.setContentType("text/event-stream");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
|
||||
PrintWriter writer = response.getWriter();
|
||||
alarmEventListener.addSseEmitter(browserId, writer);
|
||||
|
||||
while (!writer.checkError()) {
|
||||
Thread.sleep(1000);
|
||||
writer.write(":keep alive\n\n");
|
||||
writer.flush();
|
||||
}
|
||||
alarmEventListener.removeSseEmitter(browserId, writer);
|
||||
}
|
||||
}
|
|
@ -150,9 +150,9 @@ media:
|
|||
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用
|
||||
record-assist-port: 0
|
||||
|
||||
# [可选] 日志配置, 一般不需要改
|
||||
# [可选] 日志配置, 如果不需要在jar外修改日志内容那么可以不配置此项
|
||||
logging:
|
||||
config: classpath:logback-spring-local.xml
|
||||
config: classpath:logback-spring.xml
|
||||
|
||||
# [根据业务需求配置]
|
||||
user-settings:
|
||||
|
|
|
@ -110,7 +110,4 @@ user-settings:
|
|||
allowed-origins:
|
||||
- http://localhost:8080
|
||||
- http://127.0.0.1:8080
|
||||
# [可选] 日志配置, 一般不需要改
|
||||
logging:
|
||||
config: classpath:logback-spring-local.xml
|
||||
|
||||
|
|
|
@ -71,10 +71,6 @@ media:
|
|||
record-assist-port: 18081
|
||||
sdp-ip: ${sip.ip}
|
||||
stream-ip: ${sip.ip}
|
||||
# [可选] 日志配置, 一般不需要改
|
||||
# [可选] 日志配置, 一般不需要改
|
||||
logging:
|
||||
config: classpath:logback-spring-local.xml
|
||||
|
||||
# [根据业务需求配置]
|
||||
user-settings:
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="LOG_HOME" value="logs" />
|
||||
|
||||
<substitutionProperty name="log.pattern" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr(%-1.30logger{0}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||
|
||||
<substitutionProperty name="log.pattern"
|
||||
value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr([%thread]) %clr(%5p) %clr(---){faint} %clr(%logger{50}){cyan}%clr(:) %clr(%L){cyan} %m%n%wEx"/>
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div ref="container" @dblclick="fullscreenSwich"
|
||||
style="width:100%;height:100%;background-color: #000000;margin:0 auto;">
|
||||
style="width:100%;height:100%;background-color: #000000;margin:0 auto;position: relative;">
|
||||
<div class="buttons-box" id="buttonsBox">
|
||||
<div class="buttons-box-left">
|
||||
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i>
|
||||
|
@ -47,10 +47,6 @@ export default {
|
|||
},
|
||||
props: ['videoUrl', 'error', 'hasAudio', 'height'],
|
||||
mounted() {
|
||||
window.onerror = (msg) => {
|
||||
// console.error(msg)
|
||||
};
|
||||
console.log(this._uid)
|
||||
let paramUrl = decodeURIComponent(this.$route.params.url)
|
||||
this.$nextTick(() => {
|
||||
this.updatePlayerDomSize()
|
||||
|
@ -61,15 +57,17 @@ export default {
|
|||
this.videoUrl = paramUrl;
|
||||
}
|
||||
this.btnDom = document.getElementById("buttonsBox");
|
||||
console.log("初始化时的地址为: " + this.videoUrl)
|
||||
this.play(this.videoUrl)
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
videoUrl(newData, oldData) {
|
||||
this.play(newData)
|
||||
videoUrl: {
|
||||
handler(val, _) {
|
||||
this.$nextTick(() => {
|
||||
this.play(val);
|
||||
})
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updatePlayerDomSize() {
|
||||
|
@ -87,30 +85,25 @@ export default {
|
|||
dom.style.height = height + "px";
|
||||
},
|
||||
create() {
|
||||
let options = {};
|
||||
console.log("hasAudio " + this.hasAudio)
|
||||
|
||||
jessibucaPlayer[this._uid] = new window.Jessibuca(Object.assign(
|
||||
{
|
||||
let options = {
|
||||
container: this.$refs.container,
|
||||
autoWasm: true,
|
||||
background: "",
|
||||
controlAutoHide: false,
|
||||
debug: false,
|
||||
decoder: "static/js/jessibuca/decoder.js",
|
||||
forceNoOffscreen: true,
|
||||
forceNoOffscreen: false,
|
||||
hasAudio: typeof (this.hasAudio) == "undefined" ? true : this.hasAudio,
|
||||
hasVideo: true,
|
||||
heartTimeout: 5,
|
||||
heartTimeoutReplay: true,
|
||||
heartTimeoutReplayTimes: 3,
|
||||
hiddenAutoPause: false,
|
||||
hotKey: false,
|
||||
hotKey: true,
|
||||
isFlv: false,
|
||||
isFullResize: false,
|
||||
isNotMute: this.isNotMute,
|
||||
isResize: false,
|
||||
keepScreenOn: false,
|
||||
keepScreenOn: true,
|
||||
loadingText: "请稍等, 视频加载中......",
|
||||
loadingTimeout: 10,
|
||||
loadingTimeoutReplay: true,
|
||||
|
@ -123,34 +116,23 @@ export default {
|
|||
audio: false,
|
||||
record: false
|
||||
},
|
||||
recordType: "webm",
|
||||
recordType: "mp4",
|
||||
rotate: 0,
|
||||
showBandwidth: false,
|
||||
supportDblclickFullscreen: false,
|
||||
timeout: 10,
|
||||
useMSE: location.hostname !== "localhost" && location.protocol !== "https:",
|
||||
useOffscreen: false,
|
||||
useWCS: location.hostname === "localhost" || location.protocol === "https",
|
||||
useWebFullScreen: false,
|
||||
videoBuffer: 0,
|
||||
wasmDecodeAudioSyncVideo: true,
|
||||
useMSE: true,
|
||||
useWCS: location.hostname === "localhost" || location.protocol === "https:",
|
||||
useWebFullScreen: true,
|
||||
videoBuffer: 0.1,
|
||||
wasmDecodeErrorReplay: true,
|
||||
wcsUseVideoRender: true
|
||||
},
|
||||
options
|
||||
));
|
||||
};
|
||||
console.log("Jessibuca -> options: ", options);
|
||||
jessibucaPlayer[this._uid] = new window.Jessibuca({...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;
|
||||
});
|
||||
|
@ -158,44 +140,11 @@ export default {
|
|||
_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("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) {
|
||||
|
@ -205,33 +154,36 @@ export default {
|
|||
}
|
||||
_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 () {
|
||||
|
||||
jessibuca.on("videoInfo", function (msg) {
|
||||
console.log("Jessibuca -> videoInfo: ", msg);
|
||||
});
|
||||
jessibuca.on("audioInfo", function (msg) {
|
||||
console.log("Jessibuca -> audioInfo: ", msg);
|
||||
});
|
||||
jessibuca.on("error", function (msg) {
|
||||
console.log("Jessibuca -> error: ", msg);
|
||||
});
|
||||
jessibuca.on("timeout", function (msg) {
|
||||
console.log("Jessibuca -> timeout: ", msg);
|
||||
});
|
||||
jessibuca.on("loadingTimeout", function (msg) {
|
||||
console.log("Jessibuca -> timeout: ", msg);
|
||||
});
|
||||
jessibuca.on("delayTimeout", function (msg) {
|
||||
console.log("Jessibuca -> timeout: ", msg);
|
||||
});
|
||||
jessibuca.on("playToRenderTimes", function (msg) {
|
||||
console.log("Jessibuca -> playToRenderTimes: ", msg);
|
||||
});
|
||||
},
|
||||
playBtnClick: function (event) {
|
||||
this.play(this.videoUrl)
|
||||
},
|
||||
play: function (url) {
|
||||
console.log(url)
|
||||
console.log("Jessibuca -> url: ", url);
|
||||
if (jessibucaPlayer[this._uid]) {
|
||||
this.destroy();
|
||||
}
|
||||
|
@ -245,7 +197,6 @@ export default {
|
|||
jessibucaPlayer[this._uid].play(url);
|
||||
} else {
|
||||
jessibucaPlayer[this._uid].on("load", () => {
|
||||
console.log("load 播放")
|
||||
jessibucaPlayer[this._uid].play(url);
|
||||
});
|
||||
}
|
||||
|
@ -286,11 +237,6 @@ export default {
|
|||
this.performance = "";
|
||||
|
||||
},
|
||||
eventcallbacK: function (type, message) {
|
||||
// console.log("player 事件回调")
|
||||
// console.log(type)
|
||||
// console.log(message)
|
||||
},
|
||||
fullscreenSwich: function () {
|
||||
let isFull = this.isFullscreen()
|
||||
jessibucaPlayer[this._uid].setFullscreen(!isFull)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div id="devicePlayer" v-loading="isLoging">
|
||||
|
||||
<el-dialog title="视频播放" top="0" :close-on-click-modal="false" :visible.sync="showVideoDialog" @close="close()">
|
||||
<el-dialog title="视频播放" top="0" :close-on-click-modal="false" :visible.sync="showVideoDialog" @close="close()" v-if="showVideoDialog">
|
||||
<div style="width: 100%; height: 100%">
|
||||
<el-tabs type="card" :stretch="true" v-model="activePlayer" @tab-click="changePlayer" v-if="Object.keys(this.player).length > 1">
|
||||
<!-- <el-tab-pane label="LivePlayer" name="livePlayer">-->
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import changePasswordDialog from '../components/dialog/changePassword.vue'
|
||||
import userService from '../components/service/UserService'
|
||||
import {Notification} from 'element-ui';
|
||||
|
@ -55,18 +54,19 @@ export default {
|
|||
};
|
||||
},
|
||||
created() {
|
||||
console.log(4444)
|
||||
console.log(JSON.stringify(userService.getUser()))
|
||||
if (this.$route.path.startsWith("/channelList")) {
|
||||
this.activeIndex = "/deviceList"
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('beforeunload', e => this.beforeunloadHandler(e))
|
||||
// window.addEventListener('unload', e => this.unloadHandler(e))
|
||||
this.alarmNotify = this.getAlarmSwitchStatus() === "true";
|
||||
this.sseControl();
|
||||
|
||||
// TODO: 此处延迟连接 sse, 避免 sse 连接时 browserId 还未生成, 后续待优化
|
||||
setTimeout(() => {
|
||||
this.sseControl()
|
||||
}, 3000);
|
||||
},
|
||||
methods: {
|
||||
loginout() {
|
||||
|
@ -107,10 +107,12 @@ export default {
|
|||
this.sseSource = new EventSource('/api/emit?browserId=' + this.$browserId);
|
||||
this.sseSource.addEventListener('message', function (evt) {
|
||||
that.$notify({
|
||||
title: '收到报警信息',
|
||||
title: '报警信息',
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: evt.data,
|
||||
type: 'warning'
|
||||
type: 'warning',
|
||||
position: 'bottom-right',
|
||||
duration: 3000
|
||||
});
|
||||
console.log("收到信息:" + evt.data);
|
||||
});
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
import Vue from 'vue';
|
||||
import App from './App.vue';
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
import ElementUI from 'element-ui';
|
||||
import ElementUI, {Notification} from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
import router from './router/index.js';
|
||||
import axios from 'axios';
|
||||
import VueCookies from 'vue-cookies';
|
||||
import echarts from 'echarts';
|
||||
import VCharts from 'v-charts';
|
||||
|
||||
import VueClipboard from 'vue-clipboard2';
|
||||
import {Notification} from 'element-ui';
|
||||
import Fingerprint2 from 'fingerprintjs2';
|
||||
import VueClipboards from 'vue-clipboards';
|
||||
import Contextmenu from "vue-contextmenujs"
|
||||
import userService from "./components/service/UserService"
|
||||
|
||||
Vue.config.productionTip = false;
|
||||
|
||||
|
||||
// 生成唯一ID
|
||||
Fingerprint2.get(function (components) {
|
||||
|
@ -29,10 +27,9 @@ Fingerprint2.get(function (components) {
|
|||
//console.log(values) //使用的浏览器信息npm
|
||||
// 生成最终id
|
||||
let port = window.location.port;
|
||||
console.log(port);
|
||||
const fingerPrint = Fingerprint2.x64hash128(values.join(port), 31)
|
||||
Vue.prototype.$browserId = fingerPrint;
|
||||
console.log("唯一标识码:" + fingerPrint);
|
||||
console.log("浏览器 ID: " + fingerPrint);
|
||||
});
|
||||
|
||||
Vue.use(VueClipboard);
|
||||
|
@ -75,7 +72,7 @@ axios.interceptors.request.use(
|
|||
);
|
||||
|
||||
Vue.prototype.$axios = axios;
|
||||
Vue.prototype.$cookies.config(60*30);
|
||||
Vue.prototype.$cookies.config(60 * 30);
|
||||
|
||||
new Vue({
|
||||
router: router,
|
||||
|
|
|
@ -561,9 +561,9 @@ declare class Jessibuca {
|
|||
buf: number;
|
||||
/** 当前视频帧率 */
|
||||
fps: number;
|
||||
/** 当前音频码率,单位bit */
|
||||
/** 当前音频码率,单位byte */
|
||||
abps: number;
|
||||
/** 当前视频码率,单位bit */
|
||||
/** 当前视频码率,单位byte */
|
||||
vbps: number;
|
||||
/** 当前视频帧pts,单位毫秒 */
|
||||
ts: number;
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue