修复点播判断错误导致的15s超长延时

增加默认不关闭推流, 无人观看超时或点击停止按钮关闭流
修复点播其他bug
This commit is contained in:
648540858
2020-10-14 14:39:10 +08:00
parent fbdad00cdb
commit 3ec3b88456
9 changed files with 114 additions and 29 deletions

View File

@@ -56,7 +56,8 @@
</el-table-column>
<el-table-column label="操作" width="240" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">预览视频</el-button>
<el-button size="mini" icon="el-icon-video-play" v-if="scope.row.parental == 0" @click="sendDevicePush(scope.row)">播放</el-button>
<el-button size="mini" icon="el-icon-switch-button" type="danger" v-if="scope.row.play" @click="stopDevicePush(scope.row)">停止</el-button>
<el-button size="mini" icon="el-icon-s-open" type="primary" v-if="scope.row.parental == 1" @click="changeSubchannel(scope.row)">查看子目录</el-button>
<!-- <el-button size="mini" @click="sendDevicePush(scope.row)">录像查询</el-button> -->
</template>
@@ -198,7 +199,7 @@
message: '请求成功',
type: 'success'
});
});;
});
},
//通知设备上传媒体流
sendDevicePush: function(itemData) {
@@ -212,12 +213,30 @@
method: 'get',
url: '/api/play/' + deviceId + '/' + channelId
}).then(function(res) {
console.log(res.data)
let ssrc = res.data.ssrc;
that.isLoging = false
that.$refs.devicePlayer.play(res.data,deviceId,channelId,itemData.hasAudio);
if (!!ssrc) {
that.$refs.devicePlayer.play(res.data,deviceId,channelId,itemData.hasAudio);
that.initData();
}else {
that.$message.error(res.data);
}
}).catch(function(e) {
});
},
stopDevicePush: function(itemData) {
console.log(itemData)
var that = this;
this.$axios({
method: 'post',
url: '/api/play/' + itemData.ssrc + '/stop'
}).then(function(res) {
console.log(JSON.stringify(res));
that.initData();
});
},
showDevice: function(){
this.$router.push(this.beforeUrl).then(()=>{
this.initParam();

View File

@@ -1,6 +1,6 @@
<template>
<div id="devicePlayer">
<el-dialog title="视频播放" top="0" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="stop()">
<el-dialog title="视频播放" top="0" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="close()">
<LivePlayer v-if="showVideoDialog" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" :hasaudio="hasaudio" fluent autoplay live ></LivePlayer>
<div id="shared" style="text-align: right; margin-top: 1rem;">
<el-tabs v-model="tabActiveName">
@@ -145,24 +145,11 @@
this.showVideoDialog = true;
console.log(this.ssrc);
},
stop: function() {
close: function() {
console.log('关闭视频');
this.$refs.videoPlayer.pause();
this.videoUrl = '';
this.showVideoDialog = false;
this.$axios({
method: 'post',
url: '/api/play/' + this.ssrc + '/stop'
}).then(function(res) {
console.log(JSON.stringify(res));
});
this.$axios({
method: 'post',
url: '/api/playback/' + this.ssrc + '/stop'
}).then(function(res) {
console.log(JSON.stringify(res));
});
},
copySharedInfo: function(data) {
console.log('复制内容:' + data);