diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 65bab0de..56efa72a 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -39,6 +39,7 @@ import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.redis.RedisUtil; import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; +import com.genersoft.iot.vmp.vmanager.bean.StreamContent; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent; import gov.nist.javax.sip.message.SIPResponse; @@ -1004,7 +1005,7 @@ public class PlayServiceImpl implements IPlayService { AudioBroadcastResult audioBroadcastResult = new AudioBroadcastResult(); audioBroadcastResult.setApp(app); audioBroadcastResult.setStream(stream); - audioBroadcastResult.setStreamInfo(mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, stream, null, null, null,false)); + audioBroadcastResult.setStreamInfo(new StreamContent(mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, stream, null, null, null,false))); audioBroadcastResult.setCodec("G.711"); return audioBroadcastResult; } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/AudioBroadcastResult.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/AudioBroadcastResult.java index 64bc243f..1126081d 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/AudioBroadcastResult.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/AudioBroadcastResult.java @@ -1,9 +1,5 @@ package com.genersoft.iot.vmp.vmanager.bean; -import com.genersoft.iot.vmp.common.StreamInfo; -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItemLite; - /** * @author lin */ @@ -11,7 +7,7 @@ public class AudioBroadcastResult { /** * 推流的各个方式流地址 */ - private StreamInfo streamInfo; + private StreamContent streamInfo; /** * 编码格式 @@ -29,11 +25,11 @@ public class AudioBroadcastResult { private String stream; - public StreamInfo getStreamInfo() { + public StreamContent getStreamInfo() { return streamInfo; } - public void setStreamInfo(StreamInfo streamInfo) { + public void setStreamInfo(StreamContent streamInfo) { this.streamInfo = streamInfo; } diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index 59e0ee3e..78df785c 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -626,6 +626,51 @@ export default { }) }, + getBroadcastStatus() { + if (this.broadcastStatus == -2) { + return "primary" + } + if (this.broadcastStatus == -1) { + return "primary" + } + if (this.broadcastStatus == 0) { + return "warning" + } + if (this.broadcastStatus == 1) { + return "danger" + } + + }, + broadcastStatusClick() { + if (this.broadcastStatus == -1) { + // 默认状态, 开始 + this.broadcastStatus = 0 + // 发起语音对讲 + this.$axios({ + method: 'get', + url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30" + }).then( (res)=> { + if (res.data.code == 0) { + let streamInfo = res.data.data.streamInfo; + if (document.location.protocol.includes("https")) { + this.startBroadcast(streamInfo.rtcs) + }else { + this.startBroadcast(streamInfo.rtc) + } + + }else { + this.$message({ + showClose: true, + message: res.data.msg, + type: "error", + }); + } + }); + }else if (this.broadcastStatus === 1) { + this.broadcastStatus = -1; + this.broadcastRtc.close() + } + }, startBroadcast(url) { // 获取推流鉴权Key this.$axios({