Commit 8f7e8efc981cf68a3067fb3421fdfbbf6f6275ab
1 parent
020f9ea8
合并主线
Showing
11 changed files
with
149 additions
and
195 deletions
sql/update.sql
| 1 | -alter table parent_platform | ||
| 2 | - add startOfflinePush int default 0 null; | ||
| 3 | - | ||
| 4 | -alter table parent_platform | ||
| 5 | - add administrativeDivision varchar(50) not null; | ||
| 6 | - | ||
| 7 | -alter table parent_platform | ||
| 8 | - add catalogGroup int default 1 null; | ||
| 9 | - | ||
| 10 | -alter table device | ||
| 11 | - add audioChannelForReceive VARCHAR(50) null; | ||
| 12 | - | ||
| 13 | -alter table device | ||
| 14 | - add audioChannelForSend VARCHAR(50) null; | ||
| 15 | - | ||
| 16 | -alter table stream_push | ||
| 17 | - add serverId varchar(50) not null; | ||
| 18 | - | ||
| 19 | -alter table device | ||
| 20 | - add geoCoordSys varchar(50) not null; | ||
| 21 | -alter table device | ||
| 22 | - add treeType varchar(50) not null; | ||
| 23 | -update device set device.geoCoordSys='WGS84'; | ||
| 24 | -update device set device.treeType='CivilCode'; | ||
| 25 | - | ||
| 26 | -alter table device_channel | ||
| 27 | - add longitudeGcj02 double default null; | ||
| 28 | -alter table device_channel | ||
| 29 | - add latitudeGcj02 double default null; | ||
| 30 | -alter table device_channel | ||
| 31 | - add longitudeWgs84 double default null; | ||
| 32 | -alter table device_channel | ||
| 33 | - add latitudeWgs84 double default null; | ||
| 34 | -alter table device_channel | ||
| 35 | - add businessGroupId varchar(50) default null; | ||
| 36 | -alter table device_channel | ||
| 37 | - add gpsTime varchar(50) default null; | ||
| 38 | - | ||
| 39 | - | ||
| 40 | -alter table device_mobile_position | ||
| 41 | - change cnLng longitudeGcj02 double default null; | ||
| 42 | -alter table device_mobile_position | ||
| 43 | - change cnLat latitudeGcj02 double default null; | ||
| 44 | -alter table device_mobile_position | ||
| 45 | - add longitudeWgs84 double default null; | ||
| 46 | -alter table device_mobile_position | ||
| 47 | - add latitudeWgs84 double default null; | ||
| 48 | -alter table device_mobile_position | ||
| 49 | - drop geodeticSystem; | ||
| 50 | -alter table device_mobile_position | ||
| 51 | - add createTime varchar(50) default null; | ||
| 52 | - | ||
| 53 | -alter table device_alarm | ||
| 54 | - add createTime varchar(50) default null; | ||
| 55 | - | ||
| 56 | -alter table gb_stream | ||
| 57 | - change createStamp createTime varchar(50) default null; | ||
| 58 | - | ||
| 59 | -alter table parent_platform | ||
| 60 | - add createTime varchar(50) default null; | ||
| 61 | -alter table parent_platform | ||
| 62 | - add updateTime varchar(50) default null; | ||
| 63 | - | ||
| 64 | -alter table stream_proxy | ||
| 65 | - add updateTime varchar(50) default null; | ||
| 66 | - | ||
| 67 | -alter table stream_push | ||
| 68 | - add pushTime varchar(50) default null; | ||
| 69 | -alter table stream_push | ||
| 70 | - add status int DEFAULT NULL; | ||
| 71 | -alter table stream_push | ||
| 72 | - add updateTime varchar(50) default null; | ||
| 73 | -alter table stream_push | ||
| 74 | - add pushIng int DEFAULT NULL; | ||
| 75 | -alter table stream_push | ||
| 76 | - change createStamp createTime varchar(50) default null; | ||
| 77 | - | ||
| 78 | -alter table gb_stream | ||
| 79 | - drop column status; | ||
| 80 | - | ||
| 81 | -alter table user | ||
| 82 | - add pushKey varchar(50) default null; | ||
| 83 | -update user set pushKey='453df297a57a5a7438934sda801fc3' where id=1; | ||
| 84 | - | ||
| 85 | -alter table parent_platform | ||
| 86 | - add treeType varchar(50) not null; | ||
| 87 | -update parent_platform set parent_platform.treeType='BusinessGroup'; | ||
| 88 | -alter table parent_platform drop shareAllLiveStream; | ||
| 89 | - | ||
| 90 | -alter table platform_catalog | ||
| 91 | - add civilCode varchar(50) default null; | ||
| 92 | -alter table platform_catalog | ||
| 93 | - add businessGroupId varchar(50) default null; | ||
| 94 | - | ||
| 95 | -/********************* ADD ***************************/ | ||
| 96 | -alter table stream_push | ||
| 97 | - add self int DEFAULT NULL; | ||
| 98 | - | ||
| 99 | - |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
| @@ -10,6 +10,7 @@ import gov.nist.javax.sip.message.SIPRequest; | @@ -10,6 +10,7 @@ import gov.nist.javax.sip.message.SIPRequest; | ||
| 10 | import gov.nist.javax.sip.stack.SIPDialog; | 10 | import gov.nist.javax.sip.stack.SIPDialog; |
| 11 | 11 | ||
| 12 | import javax.sip.Dialog; | 12 | import javax.sip.Dialog; |
| 13 | +import javax.sip.InvalidArgumentException; | ||
| 13 | import javax.sip.SipException; | 14 | import javax.sip.SipException; |
| 14 | import java.text.ParseException; | 15 | import java.text.ParseException; |
| 15 | 16 | ||
| @@ -127,7 +128,7 @@ public interface ISIPCommander { | @@ -127,7 +128,7 @@ public interface ISIPCommander { | ||
| 127 | */ | 128 | */ |
| 128 | void streamByeCmd(String deviceId, String channelId, String stream, String callId, SipSubscribe.Event okEvent); | 129 | void streamByeCmd(String deviceId, String channelId, String stream, String callId, SipSubscribe.Event okEvent); |
| 129 | void streamByeCmd(String deviceId, String channelId, String stream, String callId); | 130 | void streamByeCmd(String deviceId, String channelId, String stream, String callId); |
| 130 | - void streamByeCmd(SIPDialog dialog, SIPRequest request, SipSubscribe.Event okEvent) throws SipException, ParseException; | 131 | + void streamByeCmd(SIPDialog dialog, String channelId, SIPRequest request, SipSubscribe.Event okEvent) throws SipException, ParseException, InvalidArgumentException; |
| 131 | 132 | ||
| 132 | /** | 133 | /** |
| 133 | * 回放暂停 | 134 | * 回放暂停 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -676,6 +676,46 @@ public class SIPCommander implements ISIPCommander { | @@ -676,6 +676,46 @@ public class SIPCommander implements ISIPCommander { | ||
| 676 | streamByeCmd(deviceId, channelId, stream, callId, null); | 676 | streamByeCmd(deviceId, channelId, stream, callId, null); |
| 677 | } | 677 | } |
| 678 | 678 | ||
| 679 | + @Override | ||
| 680 | + public void streamByeCmd(SIPDialog dialog, String channelId, SIPRequest request, SipSubscribe.Event okEvent) throws SipException, ParseException, InvalidArgumentException { | ||
| 681 | + Request byeRequest = dialog.createRequest(Request.BYE); | ||
| 682 | + SipURI byeURI = (SipURI) byeRequest.getRequestURI(); | ||
| 683 | + byeURI.setHost(request.getRemoteAddress().getHostAddress()); | ||
| 684 | + byeURI.setPort(request.getRemotePort()); | ||
| 685 | + byeURI.setUser(channelId); | ||
| 686 | + ViaHeader viaHeader = (ViaHeader) byeRequest.getHeader(ViaHeader.NAME); | ||
| 687 | + String protocol = viaHeader.getTransport().toUpperCase(); | ||
| 688 | + viaHeader.setRPort(); | ||
| 689 | + // 增加Contact header | ||
| 690 | + Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); | ||
| 691 | + byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); | ||
| 692 | + List<String> agentParam = new ArrayList<>(); | ||
| 693 | + agentParam.add("wvp-pro"); | ||
| 694 | + // TODO 添加版本信息以及日期 | ||
| 695 | + UserAgentHeader userAgentHeader = null; | ||
| 696 | + try { | ||
| 697 | + userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); | ||
| 698 | + } catch (ParseException e) { | ||
| 699 | + throw new RuntimeException(e); | ||
| 700 | + } | ||
| 701 | + byeRequest.addHeader(userAgentHeader); | ||
| 702 | + ClientTransaction clientTransaction = null; | ||
| 703 | + if("TCP".equals(protocol)) { | ||
| 704 | + clientTransaction = tcpSipProvider.getNewClientTransaction(byeRequest); | ||
| 705 | + } else if("UDP".equals(protocol)) { | ||
| 706 | + clientTransaction = udpSipProvider.getNewClientTransaction(byeRequest); | ||
| 707 | + } | ||
| 708 | + | ||
| 709 | + CallIdHeader callIdHeader = (CallIdHeader) byeRequest.getHeader(CallIdHeader.NAME); | ||
| 710 | + if (okEvent != null) { | ||
| 711 | + sipSubscribe.addOkSubscribe(callIdHeader.getCallId(), okEvent); | ||
| 712 | + } | ||
| 713 | + CSeqHeader cSeqHeader = (CSeqHeader)byeRequest.getHeader(CSeqHeader.NAME); | ||
| 714 | + cSeqHeader.setSeqNumber(redisCatchStorage.getCSEQ()); | ||
| 715 | + dialog.sendRequest(clientTransaction); | ||
| 716 | + | ||
| 717 | + } | ||
| 718 | + | ||
| 679 | /** | 719 | /** |
| 680 | * 视频流停止 | 720 | * 视频流停止 |
| 681 | */ | 721 | */ |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
| @@ -26,10 +26,7 @@ import org.springframework.beans.factory.InitializingBean; | @@ -26,10 +26,7 @@ import org.springframework.beans.factory.InitializingBean; | ||
| 26 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
| 27 | import org.springframework.stereotype.Component; | 27 | import org.springframework.stereotype.Component; |
| 28 | 28 | ||
| 29 | -import javax.sip.Dialog; | ||
| 30 | -import javax.sip.DialogState; | ||
| 31 | -import javax.sip.RequestEvent; | ||
| 32 | -import javax.sip.SipException; | 29 | +import javax.sip.*; |
| 33 | import javax.sip.address.SipURI; | 30 | import javax.sip.address.SipURI; |
| 34 | import javax.sip.header.CallIdHeader; | 31 | import javax.sip.header.CallIdHeader; |
| 35 | import javax.sip.header.FromHeader; | 32 | import javax.sip.header.FromHeader; |
| @@ -151,11 +148,13 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -151,11 +148,13 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 151 | if (sendRtpItem.isOnlyAudio()) { | 148 | if (sendRtpItem.isOnlyAudio()) { |
| 152 | // 语音对讲 | 149 | // 语音对讲 |
| 153 | try { | 150 | try { |
| 154 | - cmder.streamByeCmd((SIPDialog) evt.getDialog(), (SIPRequest) evt.getRequest(), null); | 151 | + cmder.streamByeCmd((SIPDialog) evt.getDialog(), sendRtpItem.getChannelId(), (SIPRequest) evt.getRequest(), null); |
| 155 | } catch (SipException e) { | 152 | } catch (SipException e) { |
| 156 | throw new RuntimeException(e); | 153 | throw new RuntimeException(e); |
| 157 | } catch (ParseException e) { | 154 | } catch (ParseException e) { |
| 158 | throw new RuntimeException(e); | 155 | throw new RuntimeException(e); |
| 156 | + } catch (InvalidArgumentException e) { | ||
| 157 | + throw new RuntimeException(e); | ||
| 159 | } | 158 | } |
| 160 | } else { | 159 | } else { |
| 161 | // 向上级平台 | 160 | // 向上级平台 |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| @@ -90,12 +90,6 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -90,12 +90,6 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | @Autowired | 92 | @Autowired |
| 93 | - private IVideoManagerStorage storager; | ||
| 94 | - | ||
| 95 | - @Autowired | ||
| 96 | - private IStreamProxyService streamProxyService; | ||
| 97 | - | ||
| 98 | - @Autowired | ||
| 99 | private EventPublisher publisher; | 93 | private EventPublisher publisher; |
| 100 | 94 | ||
| 101 | /** | 95 | /** |
| @@ -288,6 +282,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -288,6 +282,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 288 | return (MediaServerItem)RedisUtil.get(key); | 282 | return (MediaServerItem)RedisUtil.get(key); |
| 289 | } | 283 | } |
| 290 | 284 | ||
| 285 | + | ||
| 291 | @Override | 286 | @Override |
| 292 | public MediaServerItem getDefaultMediaServer() { | 287 | public MediaServerItem getDefaultMediaServer() { |
| 293 | 288 |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
| @@ -25,12 +25,8 @@ public class MediaServiceImpl implements IMediaService { | @@ -25,12 +25,8 @@ public class MediaServiceImpl implements IMediaService { | ||
| 25 | private IRedisCatchStorage redisCatchStorage; | 25 | private IRedisCatchStorage redisCatchStorage; |
| 26 | 26 | ||
| 27 | @Autowired | 27 | @Autowired |
| 28 | - private IVideoManagerStorage storager; | ||
| 29 | - | ||
| 30 | - @Autowired | ||
| 31 | private IMediaServerService mediaServerService; | 28 | private IMediaServerService mediaServerService; |
| 32 | 29 | ||
| 33 | - | ||
| 34 | @Autowired | 30 | @Autowired |
| 35 | private MediaConfig mediaConfig; | 31 | private MediaConfig mediaConfig; |
| 36 | 32 |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -4,6 +4,7 @@ import java.math.BigDecimal; | @@ -4,6 +4,7 @@ import java.math.BigDecimal; | ||
| 4 | import java.math.RoundingMode; | 4 | import java.math.RoundingMode; |
| 5 | import java.util.*; | 5 | import java.util.*; |
| 6 | 6 | ||
| 7 | +import javax.sip.InvalidArgumentException; | ||
| 7 | import javax.sip.ResponseEvent; | 8 | import javax.sip.ResponseEvent; |
| 8 | 9 | ||
| 9 | import com.genersoft.iot.vmp.gb28181.bean.*; | 10 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| @@ -745,7 +746,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -745,7 +746,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 745 | zlmresTfulUtils.closeStreams(mediaInfo, sendRtpItem.getApp(), sendRtpItem.getStreamId()); | 746 | zlmresTfulUtils.closeStreams(mediaInfo, sendRtpItem.getApp(), sendRtpItem.getStreamId()); |
| 746 | } | 747 | } |
| 747 | if (audioBroadcastCatch.getStatus() == AudioBroadcastCatchStatus.Ok) { | 748 | if (audioBroadcastCatch.getStatus() == AudioBroadcastCatchStatus.Ok) { |
| 748 | - cmder.streamByeCmd(audioBroadcastCatch.getDialog(), audioBroadcastCatch.getRequest(), null); | 749 | + cmder.streamByeCmd(audioBroadcastCatch.getDialog(), audioBroadcastCatch.getChannelId(), audioBroadcastCatch.getRequest(), null); |
| 749 | } | 750 | } |
| 750 | audioBroadcastManager.del(deviceId, channelId); | 751 | audioBroadcastManager.del(deviceId, channelId); |
| 751 | 752 | ||
| @@ -753,6 +754,8 @@ public class PlayServiceImpl implements IPlayService { | @@ -753,6 +754,8 @@ public class PlayServiceImpl implements IPlayService { | ||
| 753 | throw new RuntimeException(e); | 754 | throw new RuntimeException(e); |
| 754 | } catch (ParseException e) { | 755 | } catch (ParseException e) { |
| 755 | throw new RuntimeException(e); | 756 | throw new RuntimeException(e); |
| 757 | + } catch (InvalidArgumentException e) { | ||
| 758 | + throw new RuntimeException(e); | ||
| 756 | } | 759 | } |
| 757 | } | 760 | } |
| 758 | 761 |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| @@ -77,12 +77,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -77,12 +77,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 77 | private PlatformGbStreamMapper platformGbStreamMapper; | 77 | private PlatformGbStreamMapper platformGbStreamMapper; |
| 78 | 78 | ||
| 79 | @Autowired | 79 | @Autowired |
| 80 | - private EventPublisher eventPublisher; | ||
| 81 | - | ||
| 82 | - @Autowired | ||
| 83 | - private ParentPlatformMapper parentPlatformMapper; | ||
| 84 | - | ||
| 85 | - @Autowired | ||
| 86 | private IGbStreamService gbStreamService; | 80 | private IGbStreamService gbStreamService; |
| 87 | 81 | ||
| 88 | @Autowired | 82 | @Autowired |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -197,9 +197,11 @@ public class PlayController { | @@ -197,9 +197,11 @@ public class PlayController { | ||
| 197 | 197 | ||
| 198 | @Operation(summary = "语音广播命令") | 198 | @Operation(summary = "语音广播命令") |
| 199 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) | 199 | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| 200 | - @GetMapping("/broadcast/{deviceId}") | ||
| 201 | - @PostMapping("/broadcast/{deviceId}") | ||
| 202 | - public DeferredResult<WVPResult<AudioBroadcastResult>> broadcastApi(@PathVariable String deviceId) { | 200 | + @Parameter(name = "deviceId", description = "通道国标编号", required = true) |
| 201 | + @Parameter(name = "timeout", description = "推流超时时间(秒)", required = true) | ||
| 202 | + @GetMapping("/broadcast/{deviceId}/{channelId}") | ||
| 203 | + @PostMapping("/broadcast/{deviceId}/{channelId}") | ||
| 204 | + public DeferredResult<WVPResult<AudioBroadcastResult>> broadcastApi(@PathVariable String deviceId, @PathVariable String channelId, Integer timeout) { | ||
| 203 | if (logger.isDebugEnabled()) { | 205 | if (logger.isDebugEnabled()) { |
| 204 | logger.debug("语音广播API调用"); | 206 | logger.debug("语音广播API调用"); |
| 205 | } | 207 | } |
| @@ -258,13 +260,10 @@ public class PlayController { | @@ -258,13 +260,10 @@ public class PlayController { | ||
| 258 | return result; | 260 | return result; |
| 259 | } | 261 | } |
| 260 | 262 | ||
| 261 | - @Operation(summary = "获取所有的ssrc") | ||
| 262 | 263 | ||
| 263 | - @ApiOperation("停止语音广播") | ||
| 264 | - @ApiImplicitParams({ | ||
| 265 | - @ApiImplicitParam(name = "deviceId", value = "设备Id", dataTypeClass = String.class), | ||
| 266 | - @ApiImplicitParam(name = "channelId", value = "通道Id", dataTypeClass = String.class), | ||
| 267 | - }) | 264 | + @Operation(summary = "停止语音广播") |
| 265 | + @Parameter(name = "deviceId", description = "设备Id", required = true) | ||
| 266 | + @Parameter(name = "channelId", description = "通道Id", required = true) | ||
| 268 | @GetMapping("/broadcast/stop/{deviceId}/{channelId}") | 267 | @GetMapping("/broadcast/stop/{deviceId}/{channelId}") |
| 269 | @PostMapping("/broadcast/stop/{deviceId}/{channelId}") | 268 | @PostMapping("/broadcast/stop/{deviceId}/{channelId}") |
| 270 | public WVPResult<String> stopBroadcastA(@PathVariable String deviceId, @PathVariable String channelId) { | 269 | public WVPResult<String> stopBroadcastA(@PathVariable String deviceId, @PathVariable String channelId) { |
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
| @@ -199,4 +199,15 @@ public class UserController { | @@ -199,4 +199,15 @@ public class UserController { | ||
| 199 | } | 199 | } |
| 200 | } | 200 | } |
| 201 | } | 201 | } |
| 202 | + | ||
| 203 | + @PostMapping("/userInfo") | ||
| 204 | + @Operation(summary = "管理员修改普通用户密码") | ||
| 205 | + public LoginUser getUserInfo() { | ||
| 206 | + // 获取当前登录用户id | ||
| 207 | + LoginUser userInfo = SecurityUtils.getUserInfo(); | ||
| 208 | + if (userInfo == null) { | ||
| 209 | + throw new ControllerException(ErrorCode.ERROR100); | ||
| 210 | + } | ||
| 211 | + return userInfo; | ||
| 212 | + } | ||
| 202 | } | 213 | } |
web_src/src/components/dialog/devicePlayer.vue
| @@ -871,76 +871,91 @@ export default { | @@ -871,76 +871,91 @@ export default { | ||
| 871 | } | 871 | } |
| 872 | }, | 872 | }, |
| 873 | startBroadcast(url){ | 873 | startBroadcast(url){ |
| 874 | - // 获取推流鉴权KEY | ||
| 875 | - console.log(this.$loginUser) | ||
| 876 | - console.log(this.$loginUser.pushKey) | ||
| 877 | - url += "&sign=" + crypto.createHash('md5').update(this.$loginUser.pushKey, "utf8").digest('hex') | ||
| 878 | - console.log("开始语音对讲: " + url) | ||
| 879 | - this.broadcastRtc = new ZLMRTCClient.Endpoint({ | ||
| 880 | - debug: true, // 是否打印日志 | ||
| 881 | - zlmsdpUrl: url, //流地址 | ||
| 882 | - simulecast: false, | ||
| 883 | - useCamera: false, | ||
| 884 | - audioEnable: true, | ||
| 885 | - videoEnable: false, | ||
| 886 | - recvOnly: false, | ||
| 887 | - }) | 874 | + // 获取推流鉴权Key |
| 875 | + this.$axios({ | ||
| 876 | + method: 'post', | ||
| 877 | + url: '/api/user/userInfo', | ||
| 878 | + }).then( (res)=> { | ||
| 879 | + if (res.data.code !== 0) { | ||
| 880 | + this.$message({ | ||
| 881 | + showClose: true, | ||
| 882 | + message: "获取推流鉴权Key失败", | ||
| 883 | + type: "error", | ||
| 884 | + }); | ||
| 885 | + }else { | ||
| 886 | + let pushKey = res.data.data.pushKey; | ||
| 887 | + // 获取推流鉴权KEY | ||
| 888 | + url += "&sign=" + crypto.createHash('md5').update(pushKey, "utf8").digest('hex') | ||
| 889 | + console.log("开始语音对讲: " + url) | ||
| 890 | + this.broadcastRtc = new ZLMRTCClient.Endpoint({ | ||
| 891 | + debug: true, // 是否打印日志 | ||
| 892 | + zlmsdpUrl: url, //流地址 | ||
| 893 | + simulecast: false, | ||
| 894 | + useCamera: false, | ||
| 895 | + audioEnable: true, | ||
| 896 | + videoEnable: false, | ||
| 897 | + recvOnly: false, | ||
| 898 | + }) | ||
| 888 | 899 | ||
| 889 | - // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//获取到了远端流,可以播放 | ||
| 890 | - // console.error('播放成功',e.streams) | ||
| 891 | - // this.broadcastStatus = 1; | ||
| 892 | - // }); | ||
| 893 | - // | ||
| 894 | - // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 获取到了本地流 | ||
| 895 | - // this.broadcastStatus = 1; | ||
| 896 | - // // document.getElementById('selfVideo').srcObject=s; | ||
| 897 | - // // this.eventcallbacK("LOCAL STREAM", "获取到了本地流") | ||
| 898 | - // }); | 900 | + // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_REMOTE_STREAMS,(e)=>{//获取到了远端流,可以播放 |
| 901 | + // console.error('播放成功',e.streams) | ||
| 902 | + // this.broadcastStatus = 1; | ||
| 903 | + // }); | ||
| 904 | + // | ||
| 905 | + // webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ON_LOCAL_STREAM,(s)=>{// 获取到了本地流 | ||
| 906 | + // this.broadcastStatus = 1; | ||
| 907 | + // // document.getElementById('selfVideo').srcObject=s; | ||
| 908 | + // // this.eventcallbacK("LOCAL STREAM", "获取到了本地流") | ||
| 909 | + // }); | ||
| 899 | 910 | ||
| 900 | - this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_NOT_SUPPORT,(e)=>{// 获取到了本地流 | ||
| 901 | - console.error('不支持webrtc',e) | ||
| 902 | - this.$message({ | ||
| 903 | - showClose: true, | ||
| 904 | - message: '不支持webrtc, 无法进行语音对讲', | ||
| 905 | - type: 'error' | ||
| 906 | - }); | ||
| 907 | - }); | 911 | + this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_NOT_SUPPORT,(e)=>{// 获取到了本地流 |
| 912 | + console.error('不支持webrtc',e) | ||
| 913 | + this.$message({ | ||
| 914 | + showClose: true, | ||
| 915 | + message: '不支持webrtc, 无法进行语音对讲', | ||
| 916 | + type: 'error' | ||
| 917 | + }); | ||
| 918 | + }); | ||
| 908 | 919 | ||
| 909 | - this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 协商出错 | ||
| 910 | - console.error('ICE 协商出错') | ||
| 911 | - this.$message({ | ||
| 912 | - showClose: true, | ||
| 913 | - message: 'ICE 协商出错', | ||
| 914 | - type: 'error' | ||
| 915 | - }); | ||
| 916 | - }); | 920 | + this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE 协商出错 |
| 921 | + console.error('ICE 协商出错') | ||
| 922 | + this.$message({ | ||
| 923 | + showClose: true, | ||
| 924 | + message: 'ICE 协商出错', | ||
| 925 | + type: 'error' | ||
| 926 | + }); | ||
| 927 | + }); | ||
| 917 | 928 | ||
| 918 | - this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(e)=>{// offer anwser 交换失败 | ||
| 919 | - console.error('offer anwser 交换失败',e) | ||
| 920 | - this.$message({ | ||
| 921 | - showClose: true, | ||
| 922 | - message: 'offer anwser 交换失败' + e, | ||
| 923 | - type: 'error' | ||
| 924 | - }); | ||
| 925 | - }); | ||
| 926 | - this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,(e)=>{// offer anwser 交换失败 | ||
| 927 | - console.log('状态改变',e) | ||
| 928 | - if (e === "connecting") { | ||
| 929 | - this.broadcastStatus = 0; | ||
| 930 | - }else if (e === "connected") { | ||
| 931 | - this.broadcastStatus = 1; | ||
| 932 | - }else if (e === "disconnected") { | ||
| 933 | - this.broadcastStatus = -1; | 929 | + this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED,(e)=>{// offer anwser 交换失败 |
| 930 | + console.error('offer anwser 交换失败',e) | ||
| 931 | + this.$message({ | ||
| 932 | + showClose: true, | ||
| 933 | + message: 'offer anwser 交换失败' + e, | ||
| 934 | + type: 'error' | ||
| 935 | + }); | ||
| 936 | + }); | ||
| 937 | + this.broadcastRtc.on(ZLMRTCClient.Events.WEBRTC_ON_CONNECTION_STATE_CHANGE,(e)=>{// offer anwser 交换失败 | ||
| 938 | + console.log('状态改变',e) | ||
| 939 | + if (e === "connecting") { | ||
| 940 | + this.broadcastStatus = 0; | ||
| 941 | + }else if (e === "connected") { | ||
| 942 | + this.broadcastStatus = 1; | ||
| 943 | + }else if (e === "disconnected") { | ||
| 944 | + this.broadcastStatus = -1; | ||
| 945 | + } | ||
| 946 | + }); | ||
| 947 | + this.broadcastRtc.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED,(e)=>{// offer anwser 交换失败 | ||
| 948 | + console.log('捕获流失败',e) | ||
| 949 | + this.$message({ | ||
| 950 | + showClose: true, | ||
| 951 | + message: '捕获流失败' + e, | ||
| 952 | + type: 'error' | ||
| 953 | + }); | ||
| 954 | + }); | ||
| 934 | } | 955 | } |
| 935 | }); | 956 | }); |
| 936 | - this.broadcastRtc.on(ZLMRTCClient.Events.CAPTURE_STREAM_FAILED,(e)=>{// offer anwser 交换失败 | ||
| 937 | - console.log('捕获流失败',e) | ||
| 938 | - this.$message({ | ||
| 939 | - showClose: true, | ||
| 940 | - message: '捕获流失败' + e, | ||
| 941 | - type: 'error' | ||
| 942 | - }); | ||
| 943 | - }); | 957 | + |
| 958 | + | ||
| 944 | }, | 959 | }, |
| 945 | stopBroadcast(){ | 960 | stopBroadcast(){ |
| 946 | this.broadcastStatus = -2; | 961 | this.broadcastStatus = -2; |