From 90d2843255e94e022c6bf07c7a0b6c9cdfef3a70 Mon Sep 17 00:00:00 2001
From: lin <648540858@qq.com>
Date: Wed, 12 Mar 2025 16:43:47 +0800
Subject: [PATCH] =?UTF-8?q?=E6=92=AD=E6=94=BE=E6=8C=89=E9=92=AE=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0loading=EF=BC=8C=20=E4=BF=AE=E5=A4=8D=E6=8B=89?=
=?UTF-8?q?=E6=B5=81=E4=BB=A3=E7=90=86=E6=92=AD=E6=94=BE=E5=90=8E=E5=86=8D?=
=?UTF-8?q?=E6=AC=A1=E7=82=B9=E6=92=AD=E5=A4=B1=E8=B4=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../iot/vmp/media/bean/MediaInfo.java | 1 +
.../media/zlm/ZLMMediaNodeServerService.java | 2 +-
web_src/src/components/StreamProxyList.vue | 68 +++----------------
web_src/src/components/StreamPushList.vue | 18 ++---
web_src/src/components/channelList.vue | 26 ++++---
5 files changed, 32 insertions(+), 83 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java
index 7dd49893..12921dcc 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java
@@ -186,6 +186,7 @@ public class MediaInfo {
mediaInfo.setOriginType(param.getOriginType());
mediaInfo.setOriginTypeStr(param.getOriginTypeStr());
mediaInfo.setOriginUrl(param.getOriginUrl());
+ mediaInfo.setOriginUrl(param.getOriginUrl());
mediaInfo.setAliveSecond(param.getAliveSecond());
mediaInfo.setBytesSpeed(param.getBytesSpeed());
mediaInfo.setParamMap(param.getParamMap());
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java
index d6091127..f8c0365e 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaNodeServerService.java
@@ -463,7 +463,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
}
MediaInfo mediaInfo = getMediaInfo(mediaServer, streamProxy.getApp(), streamProxy.getStream());
if (mediaInfo != null) {
- if (mediaInfo.getOriginUrl().equals(streamProxy.getSrcUrl())) {
+ if (mediaInfo.getOriginUrl() != null && mediaInfo.getOriginUrl().equals(streamProxy.getSrcUrl())) {
log.info("[启动拉流代理] 已存在, 直接返回, app: {}, stream: {}", mediaInfo.getApp(), streamProxy.getStream());
return getStreamInfoByAppAndStream(mediaServer, streamProxy.getApp(), streamProxy.getStream(), null, null, true);
}
diff --git a/web_src/src/components/StreamProxyList.vue b/web_src/src/components/StreamProxyList.vue
index 18fe863b..33ee524e 100755
--- a/web_src/src/components/StreamProxyList.vue
+++ b/web_src/src/components/StreamProxyList.vue
@@ -76,7 +76,7 @@
- 播放
+ 播放
停止
@@ -134,7 +134,6 @@
currentPage:1,
count:15,
total:0,
- startBtnLoading: false,
streamProxy: null,
searchSrt: "",
mediaServerId: "",
@@ -163,9 +162,6 @@
this.mediaServerList = data.data;
})
},
- stopUpdateList: function (){
- window.clearInterval(this.updateLooper)
- },
startUpdateList: function (){
this.updateLooper = setInterval(()=>{
if (!this.streamProxy) {
@@ -198,7 +194,7 @@
if (res.data.code === 0) {
that.total = res.data.data.total;
for (let i = 0; i < res.data.data.list.length; i++) {
- res.data.data.list[i]["startBtnLoading"] = false;
+ res.data.data.list[i]["playLoading"] = false;
}
that.streamProxyList = res.data.data.list;
}
@@ -267,21 +263,21 @@
this.streamProxy = null
},
play: function(row){
- let that = this;
+ row.playLoading = true;
this.$axios({
method: 'get',
url:`/api/proxy/start`,
params: {
id: row.id,
}
- }).then(function (res) {
+ }).then((res)=> {
if (res.data.code === 0) {
- that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
+ this.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data.data,
hasAudio: true
});
}else {
- that.$message({
+ this.$message({
showClose: true,
message: "获取地址失败:" + res.data.msg,
type: "error",
@@ -290,7 +286,9 @@
}).catch(function (error) {
console.log(error);
- });
+ }).finally(()=>{
+ row.playLoading = false;
+ })
},
stopPlay: function(row){
@@ -341,54 +339,6 @@
}).catch(() => {
});
},
- start: function(row){
- this.stopUpdateList()
- this.$set(row, 'startBtnLoading', true)
- this.$axios({
- method: 'get',
- url:`/api/proxy/start`,
- params: {
- app: row.app,
- stream: row.stream
- }
- }).then((res)=> {
- if (res.data.code === 0){
- this.initData()
- }else {
- this.$message({
- showClose: true,
- message: "启动失败,请检查地址是否可用!",
- type: "error",
- });
- }
- this.$set(row, 'startBtnLoading', false)
- this.startUpdateList()
- }).catch((error)=> {
- console.log(error);
- this.$message({
- showClose: true,
- message: "启动失败,请检查地址是否可用!",
- type: "error",
- });
- this.$set(row, 'startBtnLoading', false)
- this.startUpdateList()
- });
- },
- stop: function(row){
- let that = this;
- this.$axios({
- method: 'get',
- url:`/api/proxy/stop`,
- params: {
- app: row.app,
- stream: row.stream
- }
- }).then(function (res) {
- that.initData()
- }).catch(function (error) {
- console.log(error);
- });
- },
refresh: function (){
this.initData();
}
diff --git a/web_src/src/components/StreamPushList.vue b/web_src/src/components/StreamPushList.vue
index 9121f528..9a8d9562 100755
--- a/web_src/src/components/StreamPushList.vue
+++ b/web_src/src/components/StreamPushList.vue
@@ -78,7 +78,7 @@
- 播放
+ 播放
删除
@@ -194,6 +194,7 @@ export default {
that.pushList = res.data.data.list;
that.pushList.forEach(e => {
that.$set(e, "location", "");
+ that.$set(e, "playLoading", false);
if (e.gbLongitude && e.gbLatitude) {
that.$set(e, "location", e.gbLongitude + "," + e.gbLatitude);
}
@@ -208,29 +209,28 @@ export default {
},
playPush: function (row) {
- let that = this;
- this.getListLoading = true;
+ row.playLoading = true;
this.$axios({
method: 'get',
url: '/api/push/start',
params: {
id: row.id
}
- }).then(function (res) {
- that.getListLoading = false;
+ }).then((res) =>{
if (res.data.code === 0 ) {
- that.$refs.devicePlayer.openDialog("streamPlay", null, null, {
+ this.$refs.devicePlayer.openDialog("streamPlay", null, null, {
streamInfo: res.data.data,
hasAudio: true
});
}else {
- that.$message.error(res.data.msg);
+ this.$message.error(res.data.msg);
}
}).catch(function (error) {
console.error(error);
- that.getListLoading = false;
- });
+ }).finally(()=>{
+ row.playLoading = false;
+ })
},
deletePush: function (id) {
this.$confirm(`确定删除通道?`, '提示', {
diff --git a/web_src/src/components/channelList.vue b/web_src/src/components/channelList.vue
index 02c7448e..f20ad566 100755
--- a/web_src/src/components/channelList.vue
+++ b/web_src/src/components/channelList.vue
@@ -108,7 +108,7 @@
播放
+ type="text" :loading="scope.row.playLoading" @click="sendDevicePush(scope.row)">播放
{
e.ptzType = e.ptzType + "";
+ that.$set(e, "playLoading", false);
});
// 防止出现表格错位
that.$nextTick(() => {
@@ -292,44 +292,42 @@ export default {
//通知设备上传媒体流
sendDevicePush: function (itemData) {
let deviceId = this.deviceId;
- this.isLoging = true;
let channelId = itemData.deviceId;
+ itemData.playLoading = true;
console.log("通知设备推流1:" + deviceId + " : " + channelId);
- let that = this;
this.$axios({
method: 'get',
url: '/api/play/start/' + deviceId + '/' + channelId,
params: {
isSubStream: this.isSubStream
}
- }).then(function (res) {
+ }).then((res) =>{
console.log(res)
- that.isLoging = false;
if (res.data.code === 0) {
setTimeout(() => {
-
let snapId = deviceId + "_" + channelId;
- that.loadSnap[deviceId + channelId] = 0;
- that.getSnapErrorEvent(snapId)
+ this.loadSnap[deviceId + channelId] = 0;
+ this.getSnapErrorEvent(snapId)
}, 5000)
itemData.streamId = res.data.data.stream;
- that.$refs.devicePlayer.openDialog("media", deviceId, channelId, {
+ this.$refs.devicePlayer.openDialog("media", deviceId, channelId, {
streamInfo: res.data.data,
hasAudio: itemData.hasAudio
});
setTimeout(() => {
- that.initData();
+ this.initData();
}, 1000)
} else {
- that.$message.error(res.data.msg);
+ this.$message.error(res.data.msg);
}
}).catch(function (e) {
console.error(e)
- that.isLoging = false;
// that.$message.error("请求超时");
- });
+ }).finally(()=>{
+ itemData.playLoading = false;
+ })
},
moreClick: function (command, itemData) {
if (command === "records") {