VionConfig.java 1.74 KB
package com.viontech.fanxing.commons.config;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * .
 *
 * @author 谢明辉
 * @date 2021/9/8
 */
@RefreshScope
@Configuration
@Getter
@Setter
@ConfigurationProperties(prefix = "vion")
@Slf4j
public class VionConfig {

    /** 视频和图片存储配置 */
    private Image image;
    /** 是否启用转发 */
    private boolean enableForward;
    /** auth 服务地址 */
    private Boolean authEnabled;
    private String receiveResultPrefixPath;
    /** 支持的视频格式列表 */
    private List<String> supportedVideoFormats;
    /** 需要跳过 token 验证的 url 的正则表达式列表 */
    private List<String> skipAuth;
    /** 平台srs的配置 */
    private Srs srs;
    /** 视频云平台对接的配置 */
    private VideoCloud videoCloud;

    public @Getter
    @Setter
    static class Image {
        /** images 本地存储路径 */
        private String path;
        /** 访问 images 前缀,images 包含录像文件和分析图片 */
        private String urlPrefix;
    }

    public @Getter
    @Setter
    static class Srs {
        private String ip;
        private String rtmpPort = "1935";

        public String getRtmpUrl(String taskUnid) {
            String url = "rtmp://" + ip + ":" + rtmpPort + "/live/" + taskUnid;
            log.debug(url);
            return url;
        }
    }

    public @Getter
    @Setter
    static class VideoCloud {
        private String id;
        private String url;
    }

}