修复ui开启音频无法播放的bug

修复可能导致录象查看的bug
修复开启openRTPServer时的bug
This commit is contained in:
648540858
2020-10-19 14:25:41 +08:00
parent 04af6de363
commit 36cd31d69d
9 changed files with 62 additions and 48 deletions

View File

@@ -54,12 +54,15 @@
</el-table-column>
<el-table-column prop="ptztypeText" label="云台类型">
</el-table-column>
<el-table-column label="操作" width="240" align="center" fixed="right">
<el-table-column label="操作" width="280" 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-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> -->
<el-button-group>
<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" icon="el-icon-video-camera" type="primary" >设备录象</el-button>-->
<!-- <el-button size="mini" @click="sendDevicePush(scope.row)">录像查询</el-button> -->
</el-button-group>
</template>
</el-table-column>
</el-table>

View File

@@ -1,8 +1,7 @@
<template>
<div id="devicePlayer">
<el-dialog title="视频播放" top="0" :visible.sync="showVideoDialog" :destroy-on-close="true" @close="close()">
<LivePlayer v-if="showVideoDialog && hasaudio" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" hasaudio fluent autoplay live ></LivePlayer>
<LivePlayer v-if="showVideoDialog && !hasaudio" ref="videoPlayer" :videoUrl="videoUrl" :error="videoError" fluent autoplay live ></LivePlayer>
<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">
<el-tab-pane label="媒体流信息" name="media">
@@ -123,20 +122,17 @@
methods: {
play: function(streamInfo, deviceId, channelId, hasAudio) {
// this.hasaudio = hasAudio;
if (!hasAudio) { // hasaudio == false时设置播放器hasaudio false, 否则不设置
this.hasaudio = hasAudio;
}
this.hasaudio = hasAudio;
// 根据媒体流信息二次判断
// if( this.hasaudio && !!streamInfo.tracks && streamInfo.tracks.length > 0) {
// var realHasAudio = false;
// for (let i = 0; i < streamInfo.tracks; i++) {
// if (streamInfo.tracks[i].codec_type == 1) { // 判断为音频
// realHasAudio = true;
// }
// }
// this.hasaudio = realHasAudio && this.hasaudio;
// }
if( this.hasaudio && !!streamInfo.tracks && streamInfo.tracks.length > 0) {
var realHasAudio = false;
for (let i = 0; i < streamInfo.tracks; i++) {
if (streamInfo.tracks[i].codec_type == 1) { // 判断为音频
realHasAudio = true;
}
}
this.hasaudio = realHasAudio && this.hasaudio;
}
this.ssrc = streamInfo.ssrc;
this.deviceId = deviceId;
this.channelId = channelId;