|
|
@@ -2,42 +2,42 @@
|
|
|
<div>
|
|
|
<el-row align="middle">
|
|
|
<span style="margin-left: 10px">通道名称:</span>
|
|
|
- <el-select
|
|
|
- v-model="channelId"
|
|
|
- placeholder="请选择"
|
|
|
- @change="changeChannel"
|
|
|
+ <el-select
|
|
|
+ v-model="channelId"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="changeChannel"
|
|
|
size="small"
|
|
|
- style="width: 200px;"
|
|
|
+ style="width: 200px"
|
|
|
>
|
|
|
- <el-option
|
|
|
- v-for="option in channelList"
|
|
|
- :key="option.value"
|
|
|
- :label="option.label"
|
|
|
+ <el-option
|
|
|
+ v-for="option in channelList"
|
|
|
+ :key="option.value"
|
|
|
+ :label="option.label"
|
|
|
:value="option.value"
|
|
|
/>
|
|
|
</el-select>
|
|
|
<span style="margin: 0 10px 0 30px">开启拉流:</span>
|
|
|
- <el-switch
|
|
|
- v-model="pushStream"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#c4c6c9"
|
|
|
- :disabled="channelId === ''"
|
|
|
+ <el-switch
|
|
|
+ v-model="pushStream"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#c4c6c9"
|
|
|
+ :disabled="channelId === ''"
|
|
|
@change="startPushStream"
|
|
|
/>
|
|
|
<span style="margin: 0 10px 0 30px">开启直播录像:</span>
|
|
|
- <el-switch
|
|
|
- v-model="playrecord"
|
|
|
- active-color="#13ce66"
|
|
|
- inactive-color="#c4c6c9"
|
|
|
- :disabled="channelId === ''"
|
|
|
+ <el-switch
|
|
|
+ v-model="playrecord"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#c4c6c9"
|
|
|
+ :disabled="channelId === ''"
|
|
|
@change="handleStartPlayRecord"
|
|
|
/>
|
|
|
</el-row>
|
|
|
- <player
|
|
|
- ref="playerRef"
|
|
|
- :playerinfo="playinfo"
|
|
|
+ <player
|
|
|
+ ref="playerRef"
|
|
|
+ :playerinfo="playinfo"
|
|
|
class="components-container"
|
|
|
- style="margin-top: 10px;"
|
|
|
+ style="margin-top: 10px"
|
|
|
/>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -46,7 +46,6 @@
|
|
|
import { ref, reactive, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
|
|
|
import Player from './player.vue'
|
|
|
|
|
|
-
|
|
|
import { startPlay, closeStream, listChannel } from '@/api/pms/video/channel'
|
|
|
import { startPlayRecord } from '@/api/pms/video/record'
|
|
|
|
|
|
@@ -76,33 +75,36 @@ const channelList = ref([])
|
|
|
// 查询参数
|
|
|
const queryParams = reactive({
|
|
|
pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
+ pageSize: 99,
|
|
|
deviceSipId: null,
|
|
|
channelSipId: null
|
|
|
})
|
|
|
|
|
|
// 播放信息
|
|
|
-const playinfo = reactive({
|
|
|
- playtype: 'play'
|
|
|
+const playinfo = reactive({
|
|
|
+ playtype: 'play'
|
|
|
})
|
|
|
|
|
|
// Watch device prop变化
|
|
|
-watch(() => props.device, (newVal, oldVal) => {
|
|
|
- console.log('device 发生变化>>>>>>>>>>>>>>>', newVal?.channelId)
|
|
|
- deviceInfo.value = newVal
|
|
|
- if (newVal?.channelId) {
|
|
|
- channelId.value = newVal.channelId
|
|
|
- changeChannel()
|
|
|
- }
|
|
|
- if (newVal && newVal.deviceId !== 0) {
|
|
|
- queryParams.deviceSipId = newVal.serialNumber
|
|
|
- deviceId.value = newVal.serialNumber
|
|
|
- }
|
|
|
-}, { immediate: true })
|
|
|
+watch(
|
|
|
+ () => props.device,
|
|
|
+ (newVal, oldVal) => {
|
|
|
+ console.log('device 发生变化>>>>>>>>>>>>>>>', newVal?.channelId)
|
|
|
+ deviceInfo.value = newVal
|
|
|
+ if (newVal?.channelId) {
|
|
|
+ channelId.value = newVal.channelId
|
|
|
+ changeChannel()
|
|
|
+ }
|
|
|
+ if (newVal && newVal.deviceId !== 0) {
|
|
|
+ queryParams.deviceSipId = newVal.serialNumber
|
|
|
+ deviceId.value = newVal.serialNumber
|
|
|
+ }
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+)
|
|
|
|
|
|
// 组件挂载时执行
|
|
|
onMounted(() => {
|
|
|
-
|
|
|
if (props.device) {
|
|
|
queryParams.deviceSipId = props.device.serialNumber
|
|
|
deviceId.value = props.device.serialNumber
|
|
|
@@ -113,7 +115,7 @@ onMounted(() => {
|
|
|
|
|
|
// 组件销毁前执行
|
|
|
onBeforeUnmount(() => {
|
|
|
- console.log("beforeDestroy")
|
|
|
+ console.log('beforeDestroy')
|
|
|
closeDestroy(false)
|
|
|
})
|
|
|
|
|
|
@@ -123,7 +125,6 @@ const getList = () => {
|
|
|
channelList.value = response.list.map((item) => {
|
|
|
return { value: item.channelSipId, label: item.channelName }
|
|
|
})
|
|
|
-
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -169,22 +170,20 @@ const handleStartPlayRecord = () => {
|
|
|
// 开启直播播放器
|
|
|
const startPlayer = () => {
|
|
|
if (!channelId.value) {
|
|
|
-
|
|
|
return
|
|
|
}
|
|
|
deviceId.value = queryParams.deviceSipId
|
|
|
if (playing.value) {
|
|
|
closeDestroy(false)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 注册回调
|
|
|
playerRef.value?.registercallback('loadingTimeout', TimeoutCallback)
|
|
|
playerRef.value?.registercallback('delayTimeout', TimeoutCallback)
|
|
|
-
|
|
|
+
|
|
|
if (playrecord.value) {
|
|
|
// 录像播放
|
|
|
startPlayRecord(deviceId.value, channelId.value).then((response) => {
|
|
|
-
|
|
|
// const res = response.data
|
|
|
streamId.value = response.streamId
|
|
|
playurl.value = response.playurl
|
|
|
@@ -211,7 +210,6 @@ const startPlayer = () => {
|
|
|
const handleCloseStream = (force) => {
|
|
|
if (force) {
|
|
|
if (playing.value && streamId.value) {
|
|
|
-
|
|
|
closeStream(deviceId.value, channelId.value, streamId.value).then((res) => {
|
|
|
streamId.value = ''
|
|
|
ssrc.value = ''
|
|
|
@@ -258,4 +256,4 @@ defineExpose({
|
|
|
playing,
|
|
|
changeChannel
|
|
|
})
|
|
|
-</script>
|
|
|
+</script>
|