qa-regulatory-gwj-vue/src/views/map/dialog/video_play_plat.vue

134 lines
2.9 KiB
Vue
Raw Normal View History

2023-11-07 10:04:37 +08:00
<template>
<div>
2024-01-11 17:33:21 +08:00
<div v-if="gangkou != '00005'" class="level-title">
2023-11-07 10:04:37 +08:00
<h1>摄像头名称{{ info.NAME }}</h1>
</div>
2024-01-11 17:33:21 +08:00
<table v-if="gangkou != '00005'" class="table-ui">
2023-11-07 10:04:37 +08:00
<tr>
<td class="bbg-transparent">编码</td>
<td >{{ info.INDEXCODE }}</td>
</tr>
</table>
2024-01-11 17:33:21 +08:00
<div id="aLiVideoPlayer" ref="aLiVideoPlayer" style="" class="prism-player"/>
2023-11-07 10:04:37 +08:00
</div>
</template>
<script>
import { requestFN } from '@/utils/request'
2024-01-11 17:33:21 +08:00
const imosPlayer = window.imosPlayer
let iframeObj = null
2023-11-07 10:04:37 +08:00
export default {
props: {
id: {
type: String,
default() {
return ''
}
},
type: {
type: String,
default() {
return ''
}
},
gangkou: {
type: String,
default: ''
},
2024-01-17 15:47:21 +08:00
corpInfoId: {
type: String,
default: ''
},
2023-11-07 10:04:37 +08:00
requestUrl: {
type: String,
default: '/platformvideomanagement/getHlsPathById'
}
},
data() {
return {
info: {},
player: null,
url: ''
}
},
beforeDestroy() {
this.player && this.player.dispose()
},
2024-01-11 17:33:21 +08:00
mounted() {
if (this.gangkou === '00005') {
this.showYsVideo()
} else {
this.showVideo()
}
},
2023-11-07 10:04:37 +08:00
created() {
2024-01-11 17:33:21 +08:00
// this.showVideo()
2023-11-07 10:04:37 +08:00
},
methods: {
2024-01-11 17:33:21 +08:00
showYsVideo() {
iframeObj = imosPlayer.createPanelWindow()
var dom = document.getElementById('aLiVideoPlayer')
iframeObj.style.margin = 'auto'
dom.appendChild(iframeObj)
imosPlayer
.playLive(iframeObj.id, {
camera: this.id,
title: this.id,
stream: 1
})
.then((e) => {
console.log(e)
})
},
2023-11-07 10:04:37 +08:00
showVideo() {
2024-01-17 15:47:21 +08:00
let url = this.requestUrl
console.log(this.corpInfoId)
console.log(this.corpInfoId == 'f8da1790b1034058ae2efefd69af3284')
if (this.corpInfoId == 'f8da1790b1034058ae2efefd69af3284') {
url = '/czks/map/getCameraHlsPath'
}
2023-11-07 10:04:37 +08:00
requestFN(
2024-01-17 15:47:21 +08:00
url,
2023-11-07 10:04:37 +08:00
{
2024-01-17 15:47:21 +08:00
PLATFORMVIDEOMANAGEMENT_ID: this.id,
CORPINFO_ID: this.corpInfoId
2023-11-07 10:04:37 +08:00
}
).then((res) => {
this.info = res.pd
2024-01-17 15:47:21 +08:00
let hlsPath = ''
if (this.corpInfoId == 'f8da1790b1034058ae2efefd69af3284') {
hlsPath = res.hlsPath
} else {
hlsPath = res.data.url
}
2023-11-07 10:04:37 +08:00
this.$nextTick(() => {
// eslint-disable-next-line no-undef
this.player = new Aliplayer({
'id': 'aLiVideoPlayer',
2024-01-17 15:47:21 +08:00
'source': hlsPath,
2023-11-07 10:04:37 +08:00
'width': '100%',
'height': '380px',
'autoplay': true,
'isLive': true,
'rePlay': false,
'playsinline': true,
'preload': true,
'controlBarVisibility': 'hover',
'useH5Prism': true
}, function(player) {
console.log('The player is created')
})
})
})
}
}
}
</script>
<style lang="scss" scoped>
</style>