优化编码信息刷新, 优化语音对讲选择按钮

pull/1773/head
lin 2025-02-19 10:53:02 +08:00
parent b68e5423db
commit 73560d9e7e
2 changed files with 47 additions and 51 deletions

View File

@ -34,11 +34,11 @@ export default {
components: {},
created() {
this.getMediaInfo();
setInterval(this.getMediaInfo, 1000)
},
data() {
return {
info: {}
info: {},
task: null,
};
},
methods: {
@ -62,6 +62,16 @@ export default {
console.log(error);
});
},
startTask: function () {
this.task = setInterval(this.getMediaInfo, 1000)
},
stopTask: function () {
if (this.task) {
window.clearInterval(this.task);
this.task = null;
}
},
formatByteSpeed: function (){
let bytesSpeed = this.info.bytesSpeed
let num = 1024.0 //byte

View File

@ -231,14 +231,19 @@
</div>
</div>
</el-tab-pane>
<el-tab-pane label="编码信息" name="codec" v-loading="tracksLoading">
<mediaInfo :app="app" :stream="streamId" :mediaServerId="mediaServerId"></mediaInfo>
<el-tab-pane label="编码信息" name="codec" >
<mediaInfo ref="mediaInfo" :app="app" :stream="streamId" :mediaServerId="mediaServerId"></mediaInfo>
</el-tab-pane>
<el-tab-pane label="语音对讲" name="broadcast">
<div style="padding: 0 10px">
<el-switch v-model="broadcastMode" :disabled="broadcastStatus !== -1" active-color="#409EFF"
active-text="喊话(Broadcast)"
inactive-text="对讲(Talk)"></el-switch>
<!-- <el-switch v-model="broadcastMode" :disabled="broadcastStatus !== -1" active-color="#409EFF"-->
<!-- active-text="喊话(Broadcast)"-->
<!-- inactive-text="对讲(Talk)"></el-switch>-->
<el-radio-group v-model="broadcastMode" :disabled="broadcastStatus !== -1">
<el-radio :label="true" >喊话(Broadcast)</el-radio>
<el-radio :label="false" >对讲(Talk)</el-radio>
</el-radio-group>
</div>
<div class="trank" style="text-align: center;">
<el-button @click="broadcastStatusClick()" :type="getBroadcastStatus()" :disabled="broadcastStatus === -2"
@ -329,10 +334,8 @@ export default {
scanSpeed: 100,
scanGroup: 0,
tracks: [],
tracksLoading: false,
showPtz: true,
showRrecord: true,
tracksNotLoaded: false,
sliderTime: 0,
seekTime: 0,
recordStartTime: 0,
@ -346,28 +349,11 @@ export default {
methods: {
tabHandleClick: function (tab, event) {
console.log(tab)
var that = this;
that.tracks = [];
that.tracksLoading = true;
that.tracksNotLoaded = false;
this.tracks = [];
if (tab.name === "codec") {
this.$axios({
method: 'get',
url: '/zlm/' + this.mediaServerId + '/index/api/getMediaInfo?vhost=__defaultVhost__&schema=rtsp&app=' + this.app + '&stream=' + this.streamId
}).then(function (res) {
that.tracksLoading = false;
if (res.data.code == 0 && res.data.tracks) {
that.tracks = res.data.tracks;
this.$refs.mediaInfo.startTask()
}else {
that.tracksNotLoaded = true;
that.$message({
showClose: true,
message: '获取编码信息失败,',
type: 'warning'
});
}
}).catch(function (e) {
});
this.$refs.mediaInfo.stopTask()
}
},
changePlayer: function (tab) {