修改了代码
This commit is contained in:
parent
0429afb3ad
commit
a24d08b0c2
|
|
@ -25,6 +25,7 @@ import org.apache.logging.log4j.util.Strings;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
|
@ -198,7 +199,42 @@ public class StreamRecordController {
|
|||
return "OK";
|
||||
}
|
||||
|
||||
public String streamSwitch(String source) {
|
||||
@Value("${srs.domain}")
|
||||
private String srsdomain;
|
||||
|
||||
@Value("${srs.name}")
|
||||
private String srsname;
|
||||
|
||||
// public String streamSwitch(String source) {
|
||||
// if (source.contains("stream.t-aaron.com")) {
|
||||
// return source;
|
||||
// } else if (source.contains("rtmp://live.push.t-aaron.com")) {
|
||||
// source = source.replace("rtmp://live.push.t-aaron.com", "http://live.play.t-aaron.com");
|
||||
// if (source.endsWith("_")) {
|
||||
// String var10000 = source.substring(0, source.length() - 1);
|
||||
// source = var10000 + ".flv_";
|
||||
// } else {
|
||||
// source = source + ".flv";
|
||||
// }
|
||||
//
|
||||
// return source;
|
||||
// } else {
|
||||
// if (source.contains("https://live.play.t-aaron.com")) {
|
||||
// source = source.replace("https://live.play.t-aaron.com", "http://live.play.t-aaron.com");
|
||||
// }
|
||||
//
|
||||
// return source;
|
||||
// }
|
||||
// }
|
||||
|
||||
public String streamSwitch(String source){
|
||||
|
||||
if(Objects.nonNull(srsname) && !srsname.isEmpty()){
|
||||
if(Objects.nonNull(source) && !source.isEmpty()){
|
||||
return dockerFix(source);
|
||||
}
|
||||
}
|
||||
|
||||
if (source.contains("stream.t-aaron.com")) {
|
||||
return source;
|
||||
} else if (source.contains("rtmp://live.push.t-aaron.com")) {
|
||||
|
|
@ -218,5 +254,31 @@ public class StreamRecordController {
|
|||
|
||||
return source;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String dockerFix(String url) {
|
||||
logger.info("dockerFix{}",url);
|
||||
if (url == null || url.isEmpty()) {
|
||||
return url;
|
||||
}
|
||||
url = url.replaceFirst("^https?://", "rtmp://");
|
||||
// 删除末尾的 .flv
|
||||
url = url.replaceFirst("\\.flv$", "");
|
||||
if(url.contains("srs-jndsj")){
|
||||
return url;
|
||||
}
|
||||
// 处理 RTMP URL
|
||||
if (url.startsWith("rtmp://")) {
|
||||
// 先删除端口号
|
||||
String withoutPort = url.replaceFirst("(rtmp://[^:/]+):\\d+", "$1");
|
||||
// 替换域名为 aaa
|
||||
String withNewDomain = withoutPort.replaceFirst("rtmp://[^/]+", "rtmp://"+srsname);
|
||||
// 删除 .flv 后缀
|
||||
return withNewDomain.replaceFirst("\\.flv$", "");
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,15 +8,16 @@
|
|||
#livedates=8
|
||||
#cangneiwai=false
|
||||
|
||||
#大数据局
|
||||
spring.application.name=stream_server
|
||||
server.port = 8989
|
||||
srs.splitPath=/data/java/srs/stream_server/temp
|
||||
srs.targetPath=/data/java/srs/srs/trunk/objs/nginx/html/recording
|
||||
ffmpeg=ffmpeg
|
||||
recordPath=/data/java/srs/srs/trunk/objs/nginx/html/record
|
||||
livedates=8
|
||||
cangneiwai=true
|
||||
#大数据局生产
|
||||
#spring.application.name=stream_server
|
||||
#server.port = 8989
|
||||
#srs.splitPath=/data/java/srs/stream_server/temp
|
||||
#srs.targetPath=/data/java/srs/srs/trunk/objs/nginx/html/recording
|
||||
#ffmpeg=ffmpeg
|
||||
#recordPath=/data/java/srs/srs/trunk/objs/nginx/html/record
|
||||
#livedates=8
|
||||
#cangneiwai=true
|
||||
|
||||
# 录制码率配置 (单位: kbps, 2000k = 2Mbps)
|
||||
video.bitrate=4000k
|
||||
audio.bitrate=128k
|
||||
|
|
@ -30,3 +31,18 @@ audio.bitrate=128k
|
|||
#recordPath=/Users/sunpeng/workspace/stream/record
|
||||
#livedates=7
|
||||
#cangneiwai=false
|
||||
|
||||
#大数据容器化
|
||||
##通过注入
|
||||
srs.name = STREAM
|
||||
spring.application.name=stream_server
|
||||
server.port = 8080
|
||||
#零时文件
|
||||
srs.splitPath=/data/temp
|
||||
#拍照 + 录像
|
||||
srs.targetPath=/data/recording
|
||||
ffmpeg=ffmpeg
|
||||
#
|
||||
recordPath=/data/record
|
||||
livedates=8
|
||||
cangneiwai=false
|
||||
|
|
|
|||
Loading…
Reference in New Issue