修复前端播放
parent
03d6ad289b
commit
cfe9c762d6
|
@ -41,7 +41,9 @@ import javax.sip.header.*;
|
||||||
import javax.sip.message.Request;
|
import javax.sip.message.Request;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description:设备能力接口,用于定义设备的控制、查询能力
|
* @description:设备能力接口,用于定义设备的控制、查询能力
|
||||||
|
@ -685,15 +687,7 @@ public class SIPCommander implements ISIPCommander {
|
||||||
// 增加Contact header
|
// 增加Contact header
|
||||||
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||||
byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
byeRequest.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress));
|
||||||
List<String> agentParam = new ArrayList<>();
|
UserAgentHeader userAgentHeader = HeaderUtils.createUserAgentHeader(sipFactory);
|
||||||
agentParam.add("wvp-pro");
|
|
||||||
// TODO 添加版本信息以及日期
|
|
||||||
UserAgentHeader userAgentHeader = null;
|
|
||||||
try {
|
|
||||||
userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
byeRequest.addHeader(userAgentHeader);
|
byeRequest.addHeader(userAgentHeader);
|
||||||
ClientTransaction clientTransaction = null;
|
ClientTransaction clientTransaction = null;
|
||||||
if("TCP".equals(protocol)) {
|
if("TCP".equals(protocol)) {
|
||||||
|
|
|
@ -63,12 +63,9 @@ public abstract class SIPRequestProcessorParent {
|
||||||
System.out.println(serverTransaction.getState().toString());
|
System.out.println(serverTransaction.getState().toString());
|
||||||
}
|
}
|
||||||
// 判断TCP还是UDP
|
// 判断TCP还是UDP
|
||||||
boolean isTcp = false;
|
|
||||||
ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
|
ViaHeader reqViaHeader = (ViaHeader) request.getHeader(ViaHeader.NAME);
|
||||||
String transport = reqViaHeader.getTransport();
|
String transport = reqViaHeader.getTransport();
|
||||||
if (transport.equals("TCP")) {
|
boolean isTcp = "TCP".equals(transport);
|
||||||
isTcp = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (serverTransaction == null) {
|
if (serverTransaction == null) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
private DeferredResultHolder resultHolder;
|
private DeferredResultHolder resultHolder;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ZLMHttpHookSubscribe subscribe;
|
private ZlmHttpHookSubscribe subscribe;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SipConfig config;
|
private SipConfig config;
|
||||||
|
@ -776,13 +776,13 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void inviteFromDeviceHandle(RequestEvent evt, String requesterId, String channelId1) throws InvalidArgumentException, ParseException, SipException, SdpException {
|
public void inviteFromDeviceHandle(RequestEvent evt, String requesterId, String channelId) throws InvalidArgumentException, ParseException, SipException, SdpException {
|
||||||
|
|
||||||
// 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备)
|
// 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备)
|
||||||
Device device = redisCatchStorage.getDevice(requesterId);
|
Device device = redisCatchStorage.getDevice(requesterId);
|
||||||
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(requesterId, channelId1);
|
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(requesterId, channelId);
|
||||||
if (audioBroadcastCatch == null) {
|
if (audioBroadcastCatch == null) {
|
||||||
logger.warn("来自设备的Invite请求非语音广播,已忽略");
|
logger.warn("来自设备的Invite请求非语音广播,已忽略,requesterId: {}/{}", requesterId, channelId);
|
||||||
responseAck(evt, Response.FORBIDDEN);
|
responseAck(evt, Response.FORBIDDEN);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
streamInfoResult.setWs_fmp4(String.format("ws://%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.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.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));
|
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=%s%s", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream, isPlay?"play":"push", ObjectUtils.isEmpty(callId)?"":"&callId=" + callId));
|
||||||
if (mediaInfo.getHttpSSlPort() != 0) {
|
if (mediaInfo.getHttpSSlPort() != 0) {
|
||||||
streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
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.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||||
|
@ -119,7 +119,7 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts%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.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.setRtcs(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=%s%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, isPlay?"play":"push", ObjectUtils.isEmpty(callId)?"":"&callId=" + callId));
|
||||||
}
|
}
|
||||||
|
|
||||||
streamInfoResult.setTracks(tracks);
|
streamInfoResult.setTracks(tracks);
|
||||||
|
|
|
@ -266,12 +266,11 @@ public class PlayController {
|
||||||
@Parameter(name = "channelId", description = "通道Id", required = true)
|
@Parameter(name = "channelId", description = "通道Id", required = true)
|
||||||
@GetMapping("/broadcast/stop/{deviceId}/{channelId}")
|
@GetMapping("/broadcast/stop/{deviceId}/{channelId}")
|
||||||
@PostMapping("/broadcast/stop/{deviceId}/{channelId}")
|
@PostMapping("/broadcast/stop/{deviceId}/{channelId}")
|
||||||
public WVPResult<String> stopBroadcastA(@PathVariable String deviceId, @PathVariable String channelId) {
|
public void stopBroadcastA(@PathVariable String deviceId, @PathVariable String channelId) {
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
logger.debug("停止语音广播API调用");
|
logger.debug("停止语音广播API调用");
|
||||||
}
|
}
|
||||||
playService.stopAudioBroadcast(deviceId, channelId);
|
playService.stopAudioBroadcast(deviceId, channelId);
|
||||||
return new WVPResult<>(0, "success", null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "获取所有的ssrc")
|
@Operation(summary = "获取所有的ssrc")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="devicePlayer" v-loading="isLoging">
|
<div id="devicePlayer" v-loading="isLoging">
|
||||||
|
|
||||||
<el-dialog title="视频播放" top="0" :close-on-click-modal="false" :visible.sync="showVideoDialog" @close="close()">
|
<el-dialog title="视频播放" top="0" :close-on-click-modal="false" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="close()">
|
||||||
<!-- <LivePlayer v-if="showVideoDialog" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" :message="videoError" :hasaudio="hasaudio" fluent autoplay live></LivePlayer> -->
|
<!-- <LivePlayer v-if="showVideoDialog" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" :message="videoError" :hasaudio="hasaudio" fluent autoplay live></LivePlayer> -->
|
||||||
<div style="width: 100%; height: 100%">
|
<div style="width: 100%; height: 100%">
|
||||||
<el-tabs type="card" :stretch="true" v-model="activePlayer" @tab-click="changePlayer" v-if="Object.keys(this.player).length > 1">
|
<el-tabs type="card" :stretch="true" v-model="activePlayer" @tab-click="changePlayer" v-if="Object.keys(this.player).length > 1">
|
||||||
|
@ -319,7 +319,9 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
console.log("created")
|
||||||
console.log(this.player)
|
console.log(this.player)
|
||||||
|
this.broadcastStatus = -1;
|
||||||
if (Object.keys(this.player).length === 1) {
|
if (Object.keys(this.player).length === 1) {
|
||||||
this.activePlayer = Object.keys(this.player)[0]
|
this.activePlayer = Object.keys(this.player)[0]
|
||||||
}
|
}
|
||||||
|
@ -332,7 +334,7 @@ export default {
|
||||||
// 如何你只是用一种播放器,直接注释掉不用的部分即可
|
// 如何你只是用一种播放器,直接注释掉不用的部分即可
|
||||||
player: {
|
player: {
|
||||||
jessibuca : ["ws_flv", "wss_flv"],
|
jessibuca : ["ws_flv", "wss_flv"],
|
||||||
webRTC: ["rtc", "rtc"],
|
webRTC: ["rtc", "rtcs"],
|
||||||
},
|
},
|
||||||
videoHistory: {
|
videoHistory: {
|
||||||
date: '',
|
date: '',
|
||||||
|
@ -540,9 +542,7 @@ export default {
|
||||||
this.stopPlayRecord();
|
this.stopPlayRecord();
|
||||||
}
|
}
|
||||||
this.recordPlay = ''
|
this.recordPlay = ''
|
||||||
if (this.broadcastStatus === 1) {
|
this.stopBroadcast()
|
||||||
this.stopBroadcast()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
copySharedInfo: function (data) {
|
copySharedInfo: function (data) {
|
||||||
|
@ -857,7 +857,12 @@ export default {
|
||||||
}).then( (res)=> {
|
}).then( (res)=> {
|
||||||
if (res.data.code == 0) {
|
if (res.data.code == 0) {
|
||||||
let streamInfo = res.data.data.streamInfo;
|
let streamInfo = res.data.data.streamInfo;
|
||||||
this.startBroadcast(streamInfo.rtc)
|
if (document.location.protocol.includes("https")) {
|
||||||
|
this.startBroadcast(streamInfo.rtcs)
|
||||||
|
}else {
|
||||||
|
this.startBroadcast(streamInfo.rtc)
|
||||||
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
this.$message({
|
this.$message({
|
||||||
showClose: true,
|
showClose: true,
|
||||||
|
@ -958,23 +963,28 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
stopBroadcast(){
|
stopBroadcast(){
|
||||||
this.broadcastStatus = -2;
|
if (this.broadcastStatus === -1) {
|
||||||
this.broadcastRtc = null;
|
this.broadcastStatus = 1;
|
||||||
this.$axios({
|
}else {
|
||||||
method: 'get',
|
this.broadcastStatus = -2;
|
||||||
url: '/api/play/broadcast/stop/' + this.deviceId + '/' + this.channelId
|
this.broadcastRtc = null;
|
||||||
}).then( (res)=> {
|
this.$axios({
|
||||||
if (res.data.code == 0) {
|
method: 'get',
|
||||||
// this.broadcastStatus = -1;
|
url: '/api/play/broadcast/stop/' + this.deviceId + '/' + this.channelId
|
||||||
// this.broadcastRtc.close()
|
}).then( (res)=> {
|
||||||
}else {
|
if (res.data.code == 0) {
|
||||||
this.$message({
|
// this.broadcastStatus = -1;
|
||||||
showClose: true,
|
// this.broadcastRtc.close()
|
||||||
message: res.data.msg,
|
}else {
|
||||||
type: "error",
|
this.$message({
|
||||||
});
|
showClose: true,
|
||||||
}
|
message: res.data.msg,
|
||||||
});
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue