Monica视频监控处理程序
add
xc
2021-08-16 209c26e699ba9b5f12855772b59618ce1a423da9
add
3 files modified
18 files added
225 ■■■■■ changed files
src/main/java/com/hbbh/adapter/app/RTDBPath.java 116 ●●●●● patch | view | raw | blame | history
src/main/java/com/hbbh/adapter/controller/MonibucaController.java 6 ●●●● patch | view | raw | blame | history
src/main/java/com/hbbh/adapter/utils/PathUtil.java 65 ●●●●● patch | view | raw | blame | history
src/main/resources/depend/LogAPI.xml 2 ●●●●● patch | view | raw | blame | history
src/main/resources/depend/commons-lang3-3.4.jar patch | view | raw | blame | history
src/main/resources/depend/cvs-dataprovider-3.0.0.jar patch | view | raw | blame | history
src/main/resources/depend/gson-2.2.4.jar patch | view | raw | blame | history
src/main/resources/depend/hd-dataprovider-3.5.0.jar patch | view | raw | blame | history
src/main/resources/depend/hd-datasdk-3.5.0.jar patch | view | raw | blame | history
src/main/resources/depend/hdDNAPI.dll patch | view | raw | blame | history
src/main/resources/depend/hdDataSDK.dll patch | view | raw | blame | history
src/main/resources/depend/hdKingAPI.dll patch | view | raw | blame | history
src/main/resources/depend/hdKingAPI.lib patch | view | raw | blame | history
src/main/resources/depend/hdNetClient.dll patch | view | raw | blame | history
src/main/resources/depend/hdOS.dll patch | view | raw | blame | history
src/main/resources/depend/hdProcComm.dll patch | view | raw | blame | history
src/main/resources/depend/hdsdkws.war patch | view | raw | blame | history
src/main/resources/depend/log4j-1.2.13.jar patch | view | raw | blame | history
src/main/resources/depend/webserviceClient.bat 30 ●●●●● patch | view | raw | blame | history
src/main/resources/public/monitor/live.html 4 ●●●● patch | view | raw | blame | history
src/main/resources/public/monitor/test.html 2 ●●● patch | view | raw | blame | history
src/main/java/com/hbbh/adapter/app/RTDBPath.java
New file
@@ -0,0 +1,116 @@
package com.hbbh.adapter.app;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
 * 设置 实时数据库环境程序
 */
public class RTDBPath {
    public static void main(String[] args) {
        printLibrary();
    }
    private static final String key = "java.library.path";
    //Windows
    private static final String regex_win = ";";
    // mac
    private static final String regex_mac = ":";
    private static final String _mac = "mac";
    private static final String _windows = "windows";
    private static final String os_name = "os.name";
    public static void printLibrary() {
        String os = chooseOS();
        setSystemPath(os);
        String osName = System.getProperty(os_name).toLowerCase();
        System.out.println("当前运行操作系统:" + osName);
        System.out.println("-------------- 引入第三方包环境变量之前 --- Before -------------- ");
        String propertyBefore = System.getProperty(key);
        if (propertyBefore.contains(regex_win)) {
            String[] split = propertyBefore.split(regex_win);
            for (String s : split) {
                System.out.println(s);
            }
        } else {
            System.out.println(propertyBefore);
        }
        System.out.println("------------------------------------------ ");
    }
    //需要在 resources 下创建 depend 文件夹 将实时库依赖包放进去
    private static String dependPath = Thread.currentThread().getContextClassLoader().getResource("depend").getPath();
    private static void setSystemPath(String os) {
        String propertyBefore = System.getProperty(key);
        switch (os) {
            case _windows:
                String[] splitWin = propertyBefore.split(regex_win);
                List<String> wins = Arrays.asList(splitWin);
                List<String> winList = Lists.newArrayList(wins);
                winList.add(dependPath);
                spliceWin(wins);
                break;
            case _mac:
                String[] splitMac = propertyBefore.split(regex_mac);
                List<String> macs = Arrays.asList(splitMac);
                List<String> macList = Lists.newArrayList(macs);
                macList.add(dependPath);
                spliceMac(macList);
                break;
            default:
                throw new RuntimeException("当前操作系统不识别");
        }
    }
    private static void spliceMac(List<String> macList) {
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < macList.size(); i++) {
            if (i==(macList.size()-1)){
                sb.append(macList.get(i));
            }else {
                sb.append(macList.get(i));
                sb.append(regex_mac);
            }
        }
        System.setProperty(key, sb.toString());
    }
    private static void spliceWin(List<String> winList) {
        StringBuilder sb=new StringBuilder();
        for (int i = 0; i < winList.size(); i++) {
            if (i==(winList.size()-1)){
                sb.append(winList.get(i));
            }else {
                sb.append(winList.get(i));
                sb.append(regex_win);
            }
        }
        System.setProperty(key, sb.toString());
    }
    private static String chooseOS() {
        String osName = System.getProperty(os_name).toLowerCase();
        if (osName.contains(_mac)) {
            //throw new RuntimeException("警告:当前程序必须在Windows环境下执行");
        } else if (osName.contains(_windows)) {
            return _windows;
        } else {
            throw new RuntimeException("当前操作系统不识别");
        }
        throw new RuntimeException("当前操作系统不识别");
    }
}
src/main/java/com/hbbh/adapter/controller/MonibucaController.java
@@ -56,12 +56,12 @@
    public MonicaResult live(@RequestParam("param")String param) {
        MonicaResult monicaResult = new MonicaResult();
        try {
            monicaResult.setSourceURL("rtsp:////");
            monicaResult.setSourceURL("rtsp://admin:abcd1234@192.168.12.211:554/Streaming/Channels/202");
            monicaResult.setHlsURL("");
            monicaResult.setFlvURL("");
            monicaResult.setJessicaURL("ws://172.16.30.113:8082/live/ff80808178af424e0178af44e677000343616d657261.flv");
            monicaResult.setJessicaURL("ws://172.16.30.113:8082/live/402881e878d98f2d0178d9b0154b006243616d657261.flv");
            monicaResult.setWebrtcURL("");
            monicaResult.setStreamPath("live/ff80808178af424e0178af44e677000343616d657261");
            monicaResult.setStreamPath("live/402881e878d98f2d0178d9b0154b006243616d657261");
            return monicaResult;
        } catch (Exception e) {
src/main/java/com/hbbh/adapter/utils/PathUtil.java
New file
@@ -0,0 +1,65 @@
package com.hbbh.adapter.utils;
import java.util.Properties;
/**
 * 环境变量工具
 * for fameview
 */
public class PathUtil {
    private static final String key= "java.library.path";
    private static final String path="user.dir";
    //Windows
    private static final String regex_win= ";";
    // mac
    private static final String regex_mac= ":";
    private static final String _mac= "mac";
    private static final String _windows= "windows";
    private static final String os_name= "os.name";
    /**
     * 输出
     * 1.当前程序必须在Windows环境运行
     * 2.第三方依赖包存放位置
     * 3.环境变量所在位置
     */
    public static void printLibrary(){
        String regex=null;
        String osName = System.getProperty(os_name).toLowerCase();
        if (osName.contains(_mac)){
            System.out.println("警告:当前程序必须在Windows环境下执行");
            regex=regex_mac;
        }else if (osName.contains(_windows)){
            regex=regex_win;
        }else if (null==osName){
            System.out.println("警告:当前程序必须在Windows环境下执行");
            regex=regex_win;
        }
        System.out.println("当前运行操作系统:"+osName);
        System.out.println("-------------- 引入第三方包环境变量 -------------- ");
        String property = System.getProperty(key);
        if (property.contains(regex)) {
            String[] split = property.split(regex);
            for (String s : split) {
                System.out.println("需要在文件--> "+s+"  | 下放置依赖包");
            }
        } else {
            System.out.println("需要在文件--> "+property+"  | 下放置依赖包");
        }
        System.out.println("-------------- 或者重新制定环境变量 ------------------- ");
    }
    public static void main(String[] args) {
        //printLibrary();
        Properties properties = System.getProperties();
    }
}
src/main/resources/depend/LogAPI.xml
New file
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<Config level="error" maxsize="1024"/>
src/main/resources/depend/commons-lang3-3.4.jar
Binary files differ
src/main/resources/depend/cvs-dataprovider-3.0.0.jar
Binary files differ
src/main/resources/depend/gson-2.2.4.jar
Binary files differ
src/main/resources/depend/hd-dataprovider-3.5.0.jar
Binary files differ
src/main/resources/depend/hd-datasdk-3.5.0.jar
Binary files differ
src/main/resources/depend/hdDNAPI.dll
Binary files differ
src/main/resources/depend/hdDataSDK.dll
Binary files differ
src/main/resources/depend/hdKingAPI.dll
Binary files differ
src/main/resources/depend/hdKingAPI.lib
Binary files differ
src/main/resources/depend/hdNetClient.dll
Binary files differ
src/main/resources/depend/hdOS.dll
Binary files differ
src/main/resources/depend/hdProcComm.dll
Binary files differ
src/main/resources/depend/hdsdkws.war
Binary files differ
src/main/resources/depend/log4j-1.2.13.jar
Binary files differ
src/main/resources/depend/webserviceClient.bat
New file
@@ -0,0 +1,30 @@
@chcp 65001
@echo webservice根据相应的service的IP和端口生成客户端client
@echo Input IP(eg:127.0.0.1)......
@set /p ip=
@echo Input port(eg:8080)......
@set /p port=
@mkdir clientTmp
@cd clientTmp
@echo 根据wsdl生成client的java文件...
@chcp 936
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDConnectionFactoryWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDUserManagerWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDTagManagerWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDDataProviderWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDDataWriterWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDAlarmManagerWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDServerFactoryWs?wsdl
@wsimport -s ./ -p com.baosight.client -keep http://%ip%:%port%/hdsdkws/HDDataAnalysisWs?wsdl
@chcp 65001
@echo 把java文件打包成jar...
@jar -cef com.baosight.client hdsdkwsclient.jar com
@move hdsdkwsclient.jar ./../
@cd ..
@rd /s /q clientTmp
@echo.
@echo.
@echo ------------------------------------------------------
@echo ----- 生成的jar包为当前目录下的hdsdkwsclient.jar -----
@echo ------------------------------------------------------
@pause
src/main/resources/public/monitor/live.html
@@ -27,8 +27,8 @@
<script>
    let liveComponent = new LiveComponent({
        elem: "jessibucaContainer",
        cameraId: "ff80808178af424e0178af44e677000343616d657261",
        rtspUrl: "rtsp://admin:12345...@192.168.1.201:554/Streaming/Channels/301",
        cameraId: "",
        rtspUrl: "rtsp://admin:abcd1234@192.168.12.211:554/Streaming/Channels/202",
    });
    //关闭流
    //liveComponent.close();
src/main/resources/public/monitor/test.html
@@ -62,7 +62,7 @@
    h5lc.onLoad = function () {
        //this.play("wss://pulls.1234326.cn/live/L01.flv")
        //this.play("ws://localhost:8080/live/test.flv")
        //this.play("ws://" + source + ":8080/live/" + stream)
        this.play("ws://172.16.30.113:8082/live/ff80808178af4cc60178af5f629f004a43616d657261.flv");
        //this.play("ws://pull3.afb1188.com/live/" + stream + ".flv")
        //this.play("ws://pull2.afb1188.com/live/" + stream + ".flv")
    }