| | |
| | | <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"> |
| | |
| | | play: function(streamInfo, deviceId, channelId, hasAudio) { |
| | | console.log(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; |
| | | } |
| | | console.log("111") |
| | | console.log(this.hasaudio) |
| | | this.ssrc = streamInfo.ssrc; |
| | | this.deviceId = deviceId; |
| | | this.channelId = channelId; |
| | |
| | | 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); |