1078-支持快照的展示

This commit is contained in:
panlinlin
2024-06-08 22:58:23 +08:00
parent 6074638f5b
commit 18cfba612b
2 changed files with 23 additions and 50 deletions

View File

@@ -193,6 +193,18 @@ public class jt1078ServiceImpl implements Ijt1078Service {
}
subscribe.removeSubscribe(hook);
redisTemplate.opsForValue().set(playKey, info);
// 截图
String streamUrl;
if (mediaServer.getRtspPort() != 0) {
streamUrl = String.format("rtsp://127.0.0.1:%s/%s/%s", mediaServer.getRtspPort(), "rtp", stream);
} else {
streamUrl = String.format("http://127.0.0.1:%s/%s/%s.live.mp4", mediaServer.getHttpPort(), "rtp", stream);
}
String path = "snap";
String fileName = phoneNumber + "_" + channelId + ".jpg";
// 请求截图
logger.info("[请求截图]: " + fileName);
mediaServerService.getSnap(mediaServer, streamUrl, 15, 1, path, fileName);
});
// 开启收流端口
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServer, stream, "000", false, false, 0, false, !channel.getHasAudio(), false, 1);

View File

@@ -195,12 +195,10 @@ export default {
//通知设备上传媒体流
sendDevicePush: function (itemData) {
let deviceId = this.deviceId;
this.isLoging = true;
let channelId = itemData.channelId;
console.log("通知设备推流1" + deviceId + " : " + channelId);
console.log("通知设备推流1" + this.device.phoneNumber + " : " + channelId);
console.log(this.device);
let that = this;
this.$axios({
method: 'get',
url: '/api/jt1078/live/start',
@@ -209,32 +207,32 @@ export default {
channelId: channelId,
type: 0,
}
}).then(function (res) {
}).then((res)=> {
console.log(res)
that.isLoging = false;
this.isLoging = false;
if (res.data.code === 0) {
setTimeout(() => {
let snapId = deviceId + "_" + channelId;
that.loadSnap[deviceId + channelId] = 0;
that.getSnapErrorEvent(snapId)
let snapId = this.device.phoneNumber + "_" + channelId;
this.loadSnap[this.device.phoneNumber + channelId] = 0;
this.getSnapErrorEvent(snapId)
}, 5000)
itemData.streamId = res.data.data.stream;
that.$refs.devicePlayer.openDialog("media", deviceId, channelId, {
this.$refs.devicePlayer.openDialog("media", this.device.phoneNumber, 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;
this.isLoging = false;
// that.$message.error("请求超时");
});
},
@@ -278,7 +276,7 @@ export default {
},
getSnap: function (row) {
let baseUrl = window.baseUrl ? window.baseUrl : "";
return ((process.env.NODE_ENV === 'development') ? process.env.BASE_API : baseUrl) + '/api/device/query/snap/' + row.deviceId + '/' + row.channelId;
return ((process.env.NODE_ENV === 'development') ? process.env.BASE_API : baseUrl) + '/api/device/query/snap/' + this.device.phoneNumber + '/' + row.channelId;
},
getBigSnap: function (row) {
return [this.getSnap(row)]
@@ -331,43 +329,6 @@ export default {
console.log(JSON.stringify(res));
});
},
subStreamChange: function () {
this.$confirm('确定重置所有通道的码流类型?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$axios({
method: 'post',
url: `/api/device/query/channel/stream/identification/update/`,
params: {
deviceId: this.deviceId,
streamIdentification: this.subStream
}
}).then((res)=> {
console.log(JSON.stringify(res));
this.initData()
}).finally(()=>{
this.subStream = ""
})
}).catch(() => {
this.subStream = ""
});
},
channelSubStreamChange: function (row) {
this.$axios({
method: 'post',
url: `/api/device/query/channel/stream/identification/update/`,
params: {
deviceId: this.deviceId,
channelId: row.channelId,
streamIdentification: row.streamIdentification
}
}).then(function (res) {
console.log(JSON.stringify(res));
});
},
refresh: function () {
this.initData();
},