refactor: 重构StreamInfo, 各类型流地址生成由StreamInfo管理
Signed-off-by: duzeng <duzengrass@163.com>pull/644/head
parent
a463b676e2
commit
d34abab2c7
|
@ -1,47 +1,36 @@
|
||||||
package com.genersoft.iot.vmp.common;
|
package com.genersoft.iot.vmp.common;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
||||||
public class StreamInfo {
|
public class StreamInfo {
|
||||||
|
|
||||||
private String app;
|
private String app;
|
||||||
private String stream;
|
private String stream;
|
||||||
private String deviceID;
|
private String deviceID;
|
||||||
private String channelId;
|
private String channelId;
|
||||||
private String flv;
|
|
||||||
|
|
||||||
private String ip;
|
private String ip;
|
||||||
|
|
||||||
private String https_flv;
|
|
||||||
private String ws_flv;
|
|
||||||
private String wss_flv;
|
|
||||||
private String fmp4;
|
|
||||||
private String https_fmp4;
|
|
||||||
private String ws_fmp4;
|
|
||||||
private String wss_fmp4;
|
|
||||||
private String hls;
|
|
||||||
private String https_hls;
|
|
||||||
private String ws_hls;
|
|
||||||
private String wss_hls;
|
|
||||||
private String ts;
|
|
||||||
private String https_ts;
|
|
||||||
private String ws_ts;
|
|
||||||
private String wss_ts;
|
|
||||||
private String rtmp;
|
|
||||||
private String rtmps;
|
|
||||||
private String rtsp;
|
|
||||||
private String rtsps;
|
|
||||||
private String rtc;
|
|
||||||
|
|
||||||
private String rtcs;
|
|
||||||
private String mediaServerId;
|
private String mediaServerId;
|
||||||
private Object tracks;
|
private Object tracks;
|
||||||
private String startTime;
|
private String startTime;
|
||||||
private String endTime;
|
private String endTime;
|
||||||
private double progress;
|
private double progress;
|
||||||
|
|
||||||
private boolean pause;
|
private boolean pause;
|
||||||
|
|
||||||
public static class TransactionInfo{
|
|
||||||
|
private Integer rtmpPort;
|
||||||
|
private Integer rtmpSslPort;
|
||||||
|
private Integer rtspPort;
|
||||||
|
private Integer rtspSSlPort;
|
||||||
|
private Integer httpPort;
|
||||||
|
private Integer httpSSLPort;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private String callId;
|
||||||
|
|
||||||
|
public static class TransactionInfo {
|
||||||
public String callId;
|
public String callId;
|
||||||
public String localTag;
|
public String localTag;
|
||||||
public String remoteTag;
|
public String remoteTag;
|
||||||
|
@ -54,272 +43,263 @@ public class StreamInfo {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setApp(String app) {
|
public StreamInfo setApp(String app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeviceID() {
|
public String getDeviceID() {
|
||||||
return deviceID;
|
return deviceID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeviceID(String deviceID) {
|
public StreamInfo setDeviceID(String deviceID) {
|
||||||
this.deviceID = deviceID;
|
this.deviceID = deviceID;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getChannelId() {
|
public String getChannelId() {
|
||||||
return channelId;
|
return channelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChannelId(String channelId) {
|
public StreamInfo setChannelId(String channelId) {
|
||||||
this.channelId = channelId;
|
this.channelId = channelId;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
public String getFlv() {
|
|
||||||
return flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlv(String flv) {
|
|
||||||
this.flv = flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWs_flv() {
|
|
||||||
return ws_flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWs_flv(String ws_flv) {
|
|
||||||
this.ws_flv = ws_flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtmp() {
|
|
||||||
return rtmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtmp(String rtmp) {
|
|
||||||
this.rtmp = rtmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHls() {
|
|
||||||
return hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHls(String hls) {
|
|
||||||
this.hls = hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtsp() {
|
|
||||||
return rtsp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtsp(String rtsp) {
|
|
||||||
this.rtsp = rtsp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getTracks() {
|
public Object getTracks() {
|
||||||
return tracks;
|
return tracks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTracks(Object tracks) {
|
public StreamInfo setTracks(Object tracks) {
|
||||||
this.tracks = tracks;
|
this.tracks = tracks;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
public String getFmp4() {
|
|
||||||
return fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFmp4(String fmp4) {
|
|
||||||
this.fmp4 = fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWs_fmp4() {
|
|
||||||
return ws_fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWs_fmp4(String ws_fmp4) {
|
|
||||||
this.ws_fmp4 = ws_fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWs_hls() {
|
|
||||||
return ws_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWs_hls(String ws_hls) {
|
|
||||||
this.ws_hls = ws_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTs() {
|
|
||||||
return ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTs(String ts) {
|
|
||||||
this.ts = ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWs_ts() {
|
|
||||||
return ws_ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWs_ts(String ws_ts) {
|
|
||||||
this.ws_ts = ws_ts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStream() {
|
public String getStream() {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStream(String stream) {
|
public StreamInfo setStream(String stream) {
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
public String getRtc() {
|
|
||||||
return rtc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtc(String rtc) {
|
|
||||||
this.rtc = rtc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransactionInfo getTransactionInfo() {
|
public TransactionInfo getTransactionInfo() {
|
||||||
return transactionInfo;
|
return transactionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTransactionInfo(TransactionInfo transactionInfo) {
|
public StreamInfo setTransactionInfo(TransactionInfo transactionInfo) {
|
||||||
this.transactionInfo = transactionInfo;
|
this.transactionInfo = transactionInfo;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMediaServerId() {
|
public String getMediaServerId() {
|
||||||
return mediaServerId;
|
return mediaServerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaServerId(String mediaServerId) {
|
public StreamInfo setMediaServerId(String mediaServerId) {
|
||||||
this.mediaServerId = mediaServerId;
|
this.mediaServerId = mediaServerId;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHttps_flv() {
|
|
||||||
return https_flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttps_flv(String https_flv) {
|
|
||||||
this.https_flv = https_flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWss_flv() {
|
|
||||||
return wss_flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWss_flv(String wss_flv) {
|
|
||||||
this.wss_flv = wss_flv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWss_fmp4() {
|
|
||||||
return wss_fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWss_fmp4(String wss_fmp4) {
|
|
||||||
this.wss_fmp4 = wss_fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWss_hls() {
|
|
||||||
return wss_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWss_hls(String wss_hls) {
|
|
||||||
this.wss_hls = wss_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWss_ts() {
|
|
||||||
return wss_ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWss_ts(String wss_ts) {
|
|
||||||
this.wss_ts = wss_ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtmps() {
|
|
||||||
return rtmps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtmps(String rtmps) {
|
|
||||||
this.rtmps = rtmps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRtsps() {
|
|
||||||
return rtsps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtsps(String rtsps) {
|
|
||||||
this.rtsps = rtsps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHttps_hls() {
|
|
||||||
return https_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttps_hls(String https_hls) {
|
|
||||||
this.https_hls = https_hls;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHttps_fmp4() {
|
|
||||||
return https_fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttps_fmp4(String https_fmp4) {
|
|
||||||
this.https_fmp4 = https_fmp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHttps_ts() {
|
|
||||||
return https_ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttps_ts(String https_ts) {
|
|
||||||
this.https_ts = https_ts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public String getStartTime() {
|
public String getStartTime() {
|
||||||
return startTime;
|
return startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartTime(String startTime) {
|
public StreamInfo setStartTime(String startTime) {
|
||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEndTime() {
|
public String getEndTime() {
|
||||||
return endTime;
|
return endTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEndTime(String endTime) {
|
public StreamInfo setEndTime(String endTime) {
|
||||||
this.endTime = endTime;
|
this.endTime = endTime;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getProgress() {
|
public double getProgress() {
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProgress(double progress) {
|
public StreamInfo setProgress(double progress) {
|
||||||
this.progress = progress;
|
this.progress = progress;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIp() {
|
public String getIp() {
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIp(String ip) {
|
public StreamInfo setIp(String ip) {
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
}
|
return this;
|
||||||
|
|
||||||
public String getRtcs() {
|
|
||||||
return rtcs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRtcs(String rtcs) {
|
|
||||||
this.rtcs = rtcs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPause() {
|
public boolean isPause() {
|
||||||
return pause;
|
return pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPause(boolean pause) {
|
public StreamInfo setPause(boolean pause) {
|
||||||
this.pause = pause;
|
this.pause = pause;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamInfo setRtmpPort(Integer rtmpPort) {
|
||||||
|
this.rtmpPort = rtmpPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamInfo setRtmpSslPort(Integer rtmpSslPort) {
|
||||||
|
this.rtmpSslPort = rtmpSslPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamInfo setRtspPort(Integer rtspPort) {
|
||||||
|
this.rtspPort = rtspPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamInfo setRtspSSlPort(Integer rtspSSlPort) {
|
||||||
|
this.rtspSSlPort = rtspSSlPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamInfo setHttpPort(Integer httpPort) {
|
||||||
|
this.httpPort = httpPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamInfo setHttpSSLPort(Integer httpSSLPort) {
|
||||||
|
this.httpSSLPort = httpSSLPort;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCallId() {
|
||||||
|
return callId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCallIdParam() {
|
||||||
|
return ObjectUtils.isEmpty(callId) ? "" : "?callId=" + callId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public StreamInfo setCallId(String callId) {
|
||||||
|
this.callId=callId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRtmpPort() {
|
||||||
|
return rtmpPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRtmpSslPort() {
|
||||||
|
return rtmpSslPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRtspPort() {
|
||||||
|
return rtspPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRtspSSlPort() {
|
||||||
|
return rtspSSlPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getHttpPort() {
|
||||||
|
return httpPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getHttpSSLPort() {
|
||||||
|
return httpSSLPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlv() {
|
||||||
|
return String.format("http://%s:%s/%s/%s.live.flv%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_flv() {
|
||||||
|
return String.format("ws://%s:%s/%s/%s.live.flv%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtmp() {
|
||||||
|
return String.format("rtmp://%s:%s/%s/%s%s", this.ip, this.rtmpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHls() {
|
||||||
|
return String.format("http://%s:%s/%s/%s/hls.m3u8%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtsp() {
|
||||||
|
return String.format("rtsp://%s:%s/%s/%s%s", this.ip, this.rtspPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFmp4() {
|
||||||
|
return String.format("http://%s:%s/%s/%s.live.mp4%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_fmp4() {
|
||||||
|
return String.format("ws://%s:%s/%s/%s.live.mp4%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_hls() {
|
||||||
|
return String.format("ws://%s:%s/%s/%s/hls.m3u8%s", this.ip, this.httpPort, app, stream, getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTs() {
|
||||||
|
return String.format("http://%s:%s/%s/%s.live.ts%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWs_ts() {
|
||||||
|
return String.format("ws://%s:%s/%s/%s.live.ts%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtc() {
|
||||||
|
return String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", this.ip, this.httpPort, this.app, this.stream, this.getCallIdParam());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_flv() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("https://%s:%s/%s/%s.live.flv%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_flv() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("wss://%s:%s/%s/%s.live.flv%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_fmp4() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("wss://%s:%s/%s/%s.live.mp4%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_hls() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("wss://%s:%s/%s/%s/hls.m3u8%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWss_ts() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("wss://%s:%s/%s/%s.live.ts%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtmps() {
|
||||||
|
return this.rtmpSslPort != 0 ? String.format("rtmps://%s:%s/%s/%s%s", this.ip, this.rtmpSslPort, this.app, this.stream, getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtsps() {
|
||||||
|
return this.rtspSSlPort != 0 ? String.format("rtsps://%s:%s/%s/%s%s", this.ip, this.rtspSSlPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_hls() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("https://%s:%s/%s/%s/hls.m3u8%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_fmp4() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("https://%s:%s/%s/%s.live.mp4%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttps_ts() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("https://%s:%s/%s/%s.live.ts%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRtcs() {
|
||||||
|
return this.httpSSLPort != 0 ? String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", this.ip, this.httpSSLPort, this.app, this.stream, this.getCallIdParam()) : null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam;
|
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.service.IMediaServerService;
|
import com.genersoft.iot.vmp.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
@ -16,7 +15,6 @@ import com.genersoft.iot.vmp.service.IMediaService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MediaServiceImpl implements IMediaService {
|
public class MediaServiceImpl implements IMediaService {
|
||||||
|
@ -38,7 +36,6 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
private ZLMRESTfulUtils zlmresTfulUtils;
|
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) {
|
public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String callId) {
|
||||||
return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId);
|
return getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, null, callId);
|
||||||
|
@ -70,8 +67,8 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
JSONArray tracks = mediaJSON.getJSONArray("tracks");
|
JSONArray tracks = mediaJSON.getJSONArray("tracks");
|
||||||
if (authority) {
|
if (authority) {
|
||||||
streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr, calld);
|
streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr, calld);
|
||||||
}else {
|
} else {
|
||||||
streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr,null);
|
streamInfo = getStreamInfoByAppAndStream(mediaInfo, app, stream, tracks, addr, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +76,6 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority) {
|
public StreamInfo getStreamInfoByAppAndStreamWithCheck(String app, String stream, String mediaServerId, boolean authority) {
|
||||||
return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null, authority);
|
return getStreamInfoByAppAndStreamWithCheck(app, stream, mediaServerId, null, authority);
|
||||||
|
@ -87,47 +83,19 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId) {
|
public StreamInfo getStreamInfoByAppAndStream(MediaServerItem mediaInfo, String app, String stream, Object tracks, String addr, String callId) {
|
||||||
StreamInfo streamInfoResult = new StreamInfo();
|
return new StreamInfo()
|
||||||
streamInfoResult.setStream(stream);
|
.setStream(stream)
|
||||||
streamInfoResult.setApp(app);
|
.setApp(app)
|
||||||
if (addr == null) {
|
.setIp(addr == null ? mediaInfo.getStreamIp() : addr)
|
||||||
addr = mediaInfo.getStreamIp();
|
.setMediaServerId(mediaInfo.getId())
|
||||||
}
|
.setCallId(callId)
|
||||||
streamInfoResult.setIp(addr);
|
.setHttpPort(mediaInfo.getHttpPort())
|
||||||
streamInfoResult.setMediaServerId(mediaInfo.getId());
|
.setHttpSSLPort(mediaInfo.getHttpSSlPort())
|
||||||
String callIdParam = ObjectUtils.isEmpty(callId)?"":"?callId=" + callId;
|
.setRtmpPort(mediaInfo.getRtmpPort())
|
||||||
streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpPort(), app, stream, callIdParam));
|
.setRtmpSslPort(mediaInfo.getRtmpSSlPort())
|
||||||
if (mediaInfo.getRtmpSSlPort() != 0) {
|
.setRtspPort(mediaInfo.getRtspPort())
|
||||||
streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpSSlPort(), app, stream, callIdParam));
|
.setRtspSSlPort(mediaInfo.getRtspSSLPort()).
|
||||||
}
|
setTracks(tracks);
|
||||||
streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s%s", addr, mediaInfo.getRtspPort(), app, stream, callIdParam));
|
|
||||||
if (mediaInfo.getRtspSSLPort() != 0) {
|
|
||||||
streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s%s", addr, mediaInfo.getRtspSSLPort(), app, stream, callIdParam));
|
|
||||||
}
|
|
||||||
streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream, ObjectUtils.isEmpty(callId)?"":"&callId=" + callId));
|
|
||||||
if (mediaInfo.getHttpSSlPort() != 0) {
|
|
||||||
streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
|
||||||
streamInfoResult.setRtcs(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, ObjectUtils.isEmpty(callId)?"":"&callId=" + callId));
|
|
||||||
}
|
|
||||||
|
|
||||||
streamInfoResult.setTracks(tracks);
|
|
||||||
return streamInfoResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue