修复拉流代理相关问题
parent
80ac701748
commit
0b7d55ed74
|
@ -178,11 +178,13 @@ public class StreamProxyController {
|
|||
@ResponseBody
|
||||
@Operation(summary = "启用代理", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||
@Parameter(name = "id", description = "代理Id", required = true)
|
||||
public void start(int id){
|
||||
log.info("启用代理: " + id);
|
||||
boolean result = streamProxyService.start(id);
|
||||
if (!result) {
|
||||
throw new ControllerException(ErrorCode.ERROR100);
|
||||
public StreamContent start(int id){
|
||||
log.info("播放代理: " + id);
|
||||
StreamInfo streamInfo = streamProxyService.start(id);
|
||||
if (streamInfo == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), ErrorCode.ERROR100.getMsg());
|
||||
}else {
|
||||
return new StreamContent(streamInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,12 +20,12 @@ public class StreamProxyProvider {
|
|||
}
|
||||
|
||||
public String selectForEnableInMediaServer(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + String.format(" WHERE st.enable=%s and st.media_server_id= %s order by st.create_time desc",
|
||||
return getBaseSelectSql() + String.format(" WHERE st.enable=%s and st.media_server_id= '%s' order by st.create_time desc",
|
||||
params.get("enable"), params.get("mediaServerId"));
|
||||
}
|
||||
|
||||
public String selectOneByAppAndStream(Map<String, Object> params ){
|
||||
return getBaseSelectSql() + String.format(" WHERE st.app=%s AND st.stream=%s order by st.create_time desc",
|
||||
return getBaseSelectSql() + String.format(" WHERE st.app='%s' AND st.stream='%s' order by st.create_time desc",
|
||||
params.get("app"), params.get("stream"));
|
||||
}
|
||||
|
||||
|
|
|
@ -93,5 +93,5 @@ public interface IStreamProxyService {
|
|||
|
||||
void delete(int id);
|
||||
|
||||
boolean start(int id);
|
||||
StreamInfo start(int id);
|
||||
}
|
||||
|
|
|
@ -177,7 +177,8 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
}
|
||||
|
||||
private void delete(StreamProxy streamProxy) {
|
||||
if (streamProxy.getPulling()) {
|
||||
assert streamProxy != null;
|
||||
if (streamProxy.getPulling() != null && streamProxy.getPulling()) {
|
||||
stopProxy(streamProxy);
|
||||
}
|
||||
if(streamProxy.getGbId() > 0) {
|
||||
|
@ -441,13 +442,12 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
|
||||
|
||||
@Override
|
||||
public boolean start(int id) {
|
||||
public StreamInfo start(int id) {
|
||||
StreamProxy streamProxy = streamProxyMapper.select(id);
|
||||
if (streamProxy == null) {
|
||||
throw new ControllerException(ErrorCode.ERROR404.getCode(), "代理信息未找到");
|
||||
}
|
||||
StreamInfo streamInfo = startProxy(streamProxy);
|
||||
return streamInfo != null;
|
||||
return startProxy(streamProxy);
|
||||
}
|
||||
|
||||
private StreamInfo startProxy(StreamProxy streamProxy){
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="拉流方式(RTSP)" prop="rtpType" v-if="streamProxy.type ==='default'">
|
||||
<el-form-item label="拉流方式(RTSP)" prop="rtpType">
|
||||
<el-select
|
||||
v-model="streamProxy.rtspType"
|
||||
style="width: 100%"
|
||||
|
@ -79,10 +79,13 @@
|
|||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="无人观看" prop="rtpType" >
|
||||
<el-radio v-model="streamProxy.noneReader" label="0">不做处理</el-radio>
|
||||
<el-radio v-model="streamProxy.noneReader" label="1">停用</el-radio>
|
||||
<el-radio v-model="streamProxy.noneReader" label="2">移除</el-radio>
|
||||
<el-form-item label="无人观看" prop="noneReader" >
|
||||
<el-radio-group v-model="streamProxy.noneReader">
|
||||
<el-radio :label="0">不做处理</el-radio>
|
||||
<el-radio :label="1">停用</el-radio>
|
||||
<el-radio :label="2">移除</el-radio>
|
||||
</el-radio-group>
|
||||
|
||||
</el-form-item>
|
||||
<el-form-item label="其他选项">
|
||||
<div style="float: left;">
|
||||
|
@ -94,7 +97,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item>
|
||||
<div style="float: right;">
|
||||
<el-button type="primary" @click="onSubmit" :loading="locading" >保存</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :loading="saveLoading" >保存</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
</div>
|
||||
|
||||
|
@ -114,7 +117,7 @@ import MediaServer from "./service/MediaServer";
|
|||
|
||||
export default {
|
||||
name: "channelEdit",
|
||||
props: [ 'streamProxy', 'closeEdit'],
|
||||
props: [ 'value', 'closeEdit'],
|
||||
components: {
|
||||
CommonChannelEdit,
|
||||
},
|
||||
|
@ -126,7 +129,8 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
locading: false,
|
||||
saveLoading: false,
|
||||
streamProxy: this.value,
|
||||
mediaServer: new MediaServer(),
|
||||
mediaServerList:{},
|
||||
ffmpegCmdList:{},
|
||||
|
@ -142,7 +146,9 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
onSubmit: function () {
|
||||
this.locading = true;
|
||||
console.log(typeof this.streamProxy.noneReader)
|
||||
this.saveLoading = true;
|
||||
|
||||
this.noneReaderHandler();
|
||||
if (this.streamProxy.id) {
|
||||
this.$axios({
|
||||
|
@ -150,17 +156,19 @@ export default {
|
|||
url:`/api/proxy/update`,
|
||||
data: this.streamProxy
|
||||
}).then((res)=> {
|
||||
this.saveLoading = false;
|
||||
if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
|
||||
this.$message.success("保存成功");
|
||||
this.locading = false;
|
||||
this.streamProxy = res.data.data
|
||||
}else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
}).catch((error) =>{
|
||||
this.$message.error(res.data.error);
|
||||
this.$message.error(error);
|
||||
this.saveLoading = false;
|
||||
}).finally(()=>{
|
||||
this.locading = false;
|
||||
console.log("finally==finally")
|
||||
this.saveLoading = false;
|
||||
})
|
||||
}else {
|
||||
this.$axios({
|
||||
|
@ -168,17 +176,18 @@ export default {
|
|||
url:`/api/proxy/add`,
|
||||
data: this.streamProxy
|
||||
}).then((res)=> {
|
||||
this.saveLoading = false;
|
||||
if (typeof (res.data.code) != "undefined" && res.data.code === 0) {
|
||||
this.$message.success("保存成功");
|
||||
this.locading = false;
|
||||
this.streamProxy = res.data.data
|
||||
}else {
|
||||
this.$message.error(res.data.msg);
|
||||
}
|
||||
}).catch((error) =>{
|
||||
this.$message.error(res.data.error);
|
||||
this.saveLoading = false;
|
||||
}).finally(()=>{
|
||||
this.locading = false;
|
||||
this.saveLoading = false;
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -205,13 +214,13 @@ export default {
|
|||
},
|
||||
noneReaderHandler: function() {
|
||||
console.log(this.streamProxy)
|
||||
if (this.streamProxy.noneReader === null || this.streamProxy.noneReader === "0" || !this.streamProxy.noneReader) {
|
||||
if (this.streamProxy.noneReader === null || this.streamProxy.noneReader === 0 || !this.streamProxy.noneReader) {
|
||||
this.streamProxy.enableDisableNoneReader = false;
|
||||
this.streamProxy.enableRemoveNoneReader = false;
|
||||
}else if (this.streamProxy.noneReader === "1"){
|
||||
}else if (this.streamProxy.noneReader === 1){
|
||||
this.streamProxy.enableDisableNoneReader = true;
|
||||
this.streamProxy.enableRemoveNoneReader = false;
|
||||
}else if (this.streamProxy.noneReader ==="2"){
|
||||
}else if (this.streamProxy.noneReader ===2){
|
||||
this.streamProxy.enableDisableNoneReader = false;
|
||||
this.streamProxy.enableRemoveNoneReader = true;
|
||||
}
|
||||
|
|
|
@ -80,8 +80,6 @@
|
|||
编辑
|
||||
</el-button>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<el-button size="medium" icon="el-icon-check" type="text" :loading="scope.row.startBtnLoading" v-if="!scope.row.enable" @click="start(scope.row)">启用</el-button>
|
||||
<el-divider v-if="!scope.row.enable" direction="vertical"></el-divider>
|
||||
<el-button size="medium" icon="el-icon-cloudy" type="text" @click="queryCloudRecords(scope.row)">云端录像</el-button>
|
||||
<el-divider direction="vertical"></el-divider>
|
||||
<el-button size="medium" icon="el-icon-delete" type="text" style="color: #f56c6c" @click="deleteStreamProxy(scope.row)">删除</el-button>
|
||||
|
@ -101,7 +99,7 @@
|
|||
</div>
|
||||
<streamProxyEdit ref="streamProxyEdit" ></streamProxyEdit>
|
||||
<onvifEdit ref="onvifEdit" ></onvifEdit>
|
||||
<StreamProxyEdit v-if="streamProxy" :streamProxy="streamProxy" :closeEdit="closeEdit" ></StreamProxyEdit>
|
||||
<StreamProxyEdit v-if="streamProxy" v-model="streamProxy" :closeEdit="closeEdit" ></StreamProxyEdit>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -199,7 +197,7 @@
|
|||
// this.$refs.streamProxyEdit.openDialog(null, this.initData)
|
||||
this.streamProxy = {
|
||||
type: "default",
|
||||
noneReader: "1",
|
||||
noneReader: 1,
|
||||
enable: true,
|
||||
enableAudio: true,
|
||||
mediaServerId: "",
|
||||
|
@ -232,6 +230,13 @@
|
|||
|
||||
},
|
||||
edit: function(row){
|
||||
if (row.enableDisableNoneReader) {
|
||||
this.$set(row, "noneReader", 1)
|
||||
}else if (row.enableRemoveNoneReader) {
|
||||
this.$set(row, "noneReader", 2)
|
||||
}else {
|
||||
this.$set(row, "noneReader", 0)
|
||||
}
|
||||
this.streamProxy = row
|
||||
},
|
||||
closeEdit: function(row){
|
||||
|
@ -241,11 +246,9 @@
|
|||
let that = this;
|
||||
this.$axios({
|
||||
method: 'get',
|
||||
url:`/api/media/getPlayUrl`,
|
||||
url:`/api/proxy/start`,
|
||||
params: {
|
||||
app: row.app,
|
||||
stream: row.stream,
|
||||
mediaServerId: row.mediaServerId
|
||||
id: row.id,
|
||||
}
|
||||
}).then(function (res) {
|
||||
if (res.data.code === 0) {
|
||||
|
|
Loading…
Reference in New Issue