获取rtcconfig,
parent
a4d385c98b
commit
05fd3784f4
@ -0,0 +1 @@
|
|||||||
|
{"server":{"ice_credential":"","ice_servers":["stun:stun.l.google.com:19302"],"ice_username":"","http_port":":8083"},"streams":{"camera15":{"disable_audio":true,"url":"rtsp://admin:a1234567@192.168.2.64:8000/Streaming/Channels/1","on_demand":true},"camera14":{"disable_audio":true,"url":"rtsp://admin:a1234567@192.168.2.64:8000/Streaming/Channels/1","on_demand":true}}}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.zhehekeji.web.util;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class RtspUrlGenerator {
|
||||||
|
|
||||||
|
// 海康的RTSP URL格式
|
||||||
|
private static String generateHikvisionRtspUrl(String ip, Integer port, String username, String password, String channel) {
|
||||||
|
return String.format("rtsp://%s:%s@%s:%s/Streaming/Channels/%s", username, password, ip, 554, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 大华的RTSP URL格式
|
||||||
|
private static String generateDahuaRtspUrl(String ip, Integer port, String username, String password, String channel) {
|
||||||
|
return String.format("rtsp://%s:%s@%s:%s/cam/realmonitor?channel=%s&subtype=0", username, password, ip, 554, channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getRtsp(Integer choice,String ip, Integer port, String username, String password, String channel){
|
||||||
|
String rtspUrl = "";
|
||||||
|
if (choice == 1) {
|
||||||
|
rtspUrl = generateHikvisionRtspUrl(ip, port, username, password, channel);
|
||||||
|
} else if (choice == 2) {
|
||||||
|
rtspUrl = generateDahuaRtspUrl(ip, port, username, password, channel);
|
||||||
|
} else {
|
||||||
|
System.out.println("");
|
||||||
|
|
||||||
|
}
|
||||||
|
return rtspUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue