Commit 922a9e8b3216ee5b6fd36ce607eaa81f6adf70ca

Authored by 648540858
1 parent c226deac

修复语音对讲返回的地址

src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -39,6 +39,7 @@ import com.genersoft.iot.vmp.utils.DateUtil; @@ -39,6 +39,7 @@ import com.genersoft.iot.vmp.utils.DateUtil;
39 import com.genersoft.iot.vmp.utils.redis.RedisUtil; 39 import com.genersoft.iot.vmp.utils.redis.RedisUtil;
40 import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; 40 import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult;
41 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; 41 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
  42 +import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
42 import com.genersoft.iot.vmp.vmanager.bean.WVPResult; 43 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
43 import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent; 44 import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent;
44 import gov.nist.javax.sip.message.SIPResponse; 45 import gov.nist.javax.sip.message.SIPResponse;
@@ -1004,7 +1005,7 @@ public class PlayServiceImpl implements IPlayService { @@ -1004,7 +1005,7 @@ public class PlayServiceImpl implements IPlayService {
1004 AudioBroadcastResult audioBroadcastResult = new AudioBroadcastResult(); 1005 AudioBroadcastResult audioBroadcastResult = new AudioBroadcastResult();
1005 audioBroadcastResult.setApp(app); 1006 audioBroadcastResult.setApp(app);
1006 audioBroadcastResult.setStream(stream); 1007 audioBroadcastResult.setStream(stream);
1007 - audioBroadcastResult.setStreamInfo(mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, stream, null, null, null,false)); 1008 + audioBroadcastResult.setStreamInfo(new StreamContent(mediaService.getStreamInfoByAppAndStream(mediaServerItem, app, stream, null, null, null,false)));
1008 audioBroadcastResult.setCodec("G.711"); 1009 audioBroadcastResult.setCodec("G.711");
1009 return audioBroadcastResult; 1010 return audioBroadcastResult;
1010 } 1011 }
src/main/java/com/genersoft/iot/vmp/vmanager/bean/AudioBroadcastResult.java
1 package com.genersoft.iot.vmp.vmanager.bean; 1 package com.genersoft.iot.vmp.vmanager.bean;
2 2
3 -import com.genersoft.iot.vmp.common.StreamInfo;  
4 -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;  
5 -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItemLite;  
6 -  
7 /** 3 /**
8 * @author lin 4 * @author lin
9 */ 5 */
@@ -11,7 +7,7 @@ public class AudioBroadcastResult { @@ -11,7 +7,7 @@ public class AudioBroadcastResult {
11 /** 7 /**
12 * 推流的各个方式流地址 8 * 推流的各个方式流地址
13 */ 9 */
14 - private StreamInfo streamInfo; 10 + private StreamContent streamInfo;
15 11
16 /** 12 /**
17 * 编码格式 13 * 编码格式
@@ -29,11 +25,11 @@ public class AudioBroadcastResult { @@ -29,11 +25,11 @@ public class AudioBroadcastResult {
29 private String stream; 25 private String stream;
30 26
31 27
32 - public StreamInfo getStreamInfo() { 28 + public StreamContent getStreamInfo() {
33 return streamInfo; 29 return streamInfo;
34 } 30 }
35 31
36 - public void setStreamInfo(StreamInfo streamInfo) { 32 + public void setStreamInfo(StreamContent streamInfo) {
37 this.streamInfo = streamInfo; 33 this.streamInfo = streamInfo;
38 } 34 }
39 35
web_src/src/components/dialog/devicePlayer.vue
@@ -626,6 +626,51 @@ export default { @@ -626,6 +626,51 @@ export default {
626 626
627 }) 627 })
628 }, 628 },
  629 + getBroadcastStatus() {
  630 + if (this.broadcastStatus == -2) {
  631 + return "primary"
  632 + }
  633 + if (this.broadcastStatus == -1) {
  634 + return "primary"
  635 + }
  636 + if (this.broadcastStatus == 0) {
  637 + return "warning"
  638 + }
  639 + if (this.broadcastStatus == 1) {
  640 + return "danger"
  641 + }
  642 +
  643 + },
  644 + broadcastStatusClick() {
  645 + if (this.broadcastStatus == -1) {
  646 + // 默认状态, 开始
  647 + this.broadcastStatus = 0
  648 + // 发起语音对讲
  649 + this.$axios({
  650 + method: 'get',
  651 + url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30"
  652 + }).then( (res)=> {
  653 + if (res.data.code == 0) {
  654 + let streamInfo = res.data.data.streamInfo;
  655 + if (document.location.protocol.includes("https")) {
  656 + this.startBroadcast(streamInfo.rtcs)
  657 + }else {
  658 + this.startBroadcast(streamInfo.rtc)
  659 + }
  660 +
  661 + }else {
  662 + this.$message({
  663 + showClose: true,
  664 + message: res.data.msg,
  665 + type: "error",
  666 + });
  667 + }
  668 + });
  669 + }else if (this.broadcastStatus === 1) {
  670 + this.broadcastStatus = -1;
  671 + this.broadcastRtc.close()
  672 + }
  673 + },
629 startBroadcast(url) { 674 startBroadcast(url) {
630 // 获取推流鉴权Key 675 // 获取推流鉴权Key
631 this.$axios({ 676 this.$axios({