zhanghua
2022-12-13 2044db864bea04b93e59f2417b7a635a82581ecb
视频流地址修改
2个文件已修改
22 ■■■■■ 已修改文件
ycl-platform/src/main/java/com/ycl/controller/video/VideoPointController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/util/VideoUtil.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-platform/src/main/java/com/ycl/controller/video/VideoPointController.java
@@ -41,9 +41,9 @@
                                         @RequestParam(required = false) Integer communityId) {
        IPage<VideoPointVo> pointVoIPage = iVideoPointService.getList(streetId, communityId, current.intValue(), size.intValue());
        pointVoIPage.getRecords()
                .stream()
                .forEach(item -> item.setUrlAddress(videoUtil.getVideo(item.getPlatResourceId(), "HLS", 0)));
//        pointVoIPage.getRecords()
//                .stream()
//                .forEach(item -> item.setUrlAddress(videoUtil.getVideo(item.getPlatResourceId(), "HLS", 0)));
        return CommonResult.success(pointVoIPage);
    }
ycl-platform/src/main/java/com/ycl/util/VideoUtil.java
@@ -22,16 +22,16 @@
public class VideoUtil {
    @Value("${videoPoint.url}")
    private  String url;
    private String url;
    @Value("${videoPoint.userName}")
    private  String userName;
    private String userName;
    @Value("${videoPoint.passWord}")
    private  String passWord;
    private String passWord;
    @Value("${videoPoint.ip}")
    private  String ip;
    private String ip;
    /*
     * @Description  subType:类型int,选填。码流类型,0:主码流、1:辅流1、2:辅流2。默认为0主码流。scheme:类型string,选填。协议类型,支持RTSP、FLV_HTTP、HLS三种,默认RTSP。
@@ -39,12 +39,16 @@
     * @return java.lang.String
     **/
    @SneakyThrows
    public  String getVideo(String code, String scheme,Integer subType) {
    public String getVideo(String code, String scheme, Integer subType) {
        String clientType = "winpc";
        String reqUrl = "/videoService/accounts/authorize";
        String deviceUrl = "/videoService/devicesManager/devices";
        String monitorUrl = "/videoService/realmonitor/uri?subType=" + subType + "&scheme=" + scheme + "&channelId=";
//        String monitorUrl = "/videoService/realmonitor/uri?subType=" + subType + "&scheme=" + scheme + "&channelId=";
        String monitorUrl = "/videoService/realmonitor/uri?trackId=&encryptedInfo=&userId=&urlType=1&keyIndex=&regionId=&packtype=Private&planId=&subType=" + subType + "&isroute=false&streamType=&locationEnable=false&domainId=&duration=600&scheme=RTSP&dataType=2&extend=&channelId=";
        if (!"RTSP".equals(scheme)) {
            monitorUrl = "/videoService/realmonitor/uri?subType=" + subType + "&scheme=" + scheme + "&channelId=";
        }
        RestTemplate restTemplate = new RestTemplate();
        restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
            @Override