Browse Source

修复wvp使用https时播放流地址使用wss,以使用ssl播放

pull/183/head
648540858 3 years ago
parent
commit
b922898129
  1. 90
      src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
  2. 20
      src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
  3. 14
      web_src/src/components/dialog/devicePlayer.vue

90
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java

@ -9,15 +9,25 @@ public class StreamInfo {
private String deviceID;
private String channelId;
private String flv;
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 mediaServerId;
private JSONArray tracks;
@ -174,4 +184,84 @@ public class StreamInfo {
public void setMediaServerId(String mediaServerId) {
this.mediaServerId = mediaServerId;
}
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;
}
}

20
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java

@ -70,7 +70,13 @@ public class MediaServiceImpl implements IMediaService {
}
streamInfoResult.setMediaServerId(mediaInfo.getId());
streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s", addr, mediaInfo.getRtmpPort(), app, stream));
if (mediaInfo.getRtmpSSlPort() != 0) {
streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s", addr, mediaInfo.getRtmpSSlPort(), app, stream));
}
streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s", addr, mediaInfo.getRtspPort(), app, stream));
if (mediaInfo.getRtspSSLPort() != 0) {
streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s", addr, mediaInfo.getRtspSSLPort(), app, stream));
}
streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.flv", addr, mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.flv", addr, mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpPort(), app, stream));
@ -79,7 +85,19 @@ public class MediaServiceImpl implements IMediaService {
streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpPort(), app, stream));
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream));
if (mediaInfo.getHttpSSlPort() != 0) {
streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.flv", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.flv", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts", addr, mediaInfo.getHttpSSlPort(), app, stream));
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream));
}
streamInfoResult.setTracks(tracks);
return streamInfoResult;
}

14
web_src/src/components/dialog/devicePlayer.vue

@ -285,7 +285,21 @@ export default {
let baseZlmApi = process.env.NODE_ENV === 'development'?`${location.host}/debug/zlm`:`${location.host}/zlm`
// return `${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
// return `http://${baseZlmApi}/${streamInfo.app}/${streamInfo.streamId}.flv`;
if (location.protocol === "https:") {
if (streamInfo.wss_flv === null) {
this.$message({
showClose: true,
message: '媒体服务器未配置ssl端口',
type: 'error'
});
}else {
return streamInfo.wss_flv;
}
}else {
return streamInfo.ws_flv;
}
},
coverPlay: function () {
var that = this;

Loading…
Cancel
Save