Commit 12e44f3e137e20a9574ad94264c29671c1281d06
Committed by
xp.Huang
1 parent
5a4cd84d
feat: 新增视频通道同步功能,联调通道同步接口完成和加上相关权限标识key
Showing
4 changed files
with
40 additions
and
7 deletions
... | ... | @@ -21,6 +21,7 @@ enum CameraManagerApi { |
21 | 21 | STREAMING_PLAY_GET_URL = '/video/url', |
22 | 22 | VIDEO_CONTROL_STOP = '/video/control/stop/', |
23 | 23 | CAMERA_ADDGPT_API_URL = '/video/add/gbt28181', |
24 | + VIDEO_CONTROL_SYNC = '/video/control/sync/', | |
24 | 25 | } |
25 | 26 | |
26 | 27 | export const cameraPage = (params: CameraQueryParam) => { |
... | ... | @@ -144,3 +145,10 @@ export const createGPTPostApi = (data: Recordable) => { |
144 | 145 | data, |
145 | 146 | }); |
146 | 147 | }; |
148 | + | |
149 | +//云台控制 通道同步 | |
150 | +export const syncVideoApiGet = (deviceId: string) => { | |
151 | + return defHttp.get({ | |
152 | + url: `${CameraManagerApi.VIDEO_CONTROL_SYNC}${deviceId}`, | |
153 | + }); | |
154 | +}; | ... | ... |
... | ... | @@ -6,6 +6,13 @@ import { withInstall } from '/@/utils/index'; |
6 | 6 | import VideoPlay from './video.vue'; |
7 | 7 | export const Video = withInstall(VideoPlay); |
8 | 8 | |
9 | +//视频通道权限标识枚举 | |
10 | +export enum GBT28181_DEVICE_PERMISSION_ENUM { | |
11 | + PLAY_SYNC = 'api:yt:video:control:play', //视频点播/预览和摄像头通道同步 | |
12 | + STOP = 'api:yt:video:control:stop', //停止点播 | |
13 | + CONTROL = 'api:yt:video:control:control', //云台控制 | |
14 | +} | |
15 | + | |
9 | 16 | enum ChannelStatusEnum { |
10 | 17 | ONLINE = 'ONLINE', |
11 | 18 | } | ... | ... |
... | ... | @@ -3,6 +3,11 @@ |
3 | 3 | class="bg-neutral-100 dark:text-gray-300 dark:bg-dark-700 p-4" |
4 | 4 | @register="registerTable" |
5 | 5 | > |
6 | + <template #toolbar> | |
7 | + <Authority :value="GBT28181_DEVICE_PERMISSION_ENUM.PLAY_SYNC"> | |
8 | + <a-button type="primary" @click="handleSyncPlay">通道同步</a-button> | |
9 | + </Authority> | |
10 | + </template> | |
6 | 11 | <template #hasAudio="{ record }"> |
7 | 12 | <Switch |
8 | 13 | :checked="record.status === 1" |
... | ... | @@ -17,25 +22,26 @@ |
17 | 22 | :actions="[ |
18 | 23 | { |
19 | 24 | label: '播放', |
20 | - auth: 'api:yt:sceneLinkage:get', | |
25 | + auth: GBT28181_DEVICE_PERMISSION_ENUM.PLAY_SYNC, | |
21 | 26 | icon: 'ant-design:play-circle-outlined', |
22 | 27 | onClick: handlePlay.bind(null, record), |
23 | 28 | }, |
24 | 29 | { |
25 | - label: '停止点播', | |
26 | - auth: 'api:yt:sceneLinkage:get', | |
30 | + label: '停止', | |
31 | + auth: GBT28181_DEVICE_PERMISSION_ENUM.STOP, | |
27 | 32 | icon: 'ant-design:pause-outlined', |
28 | 33 | onClick: handleStopPlay.bind(null, record), |
34 | + ifShow: !!record?.streamId, //通道号存在则显示停止点播按钮 | |
29 | 35 | }, |
30 | 36 | ]" |
31 | 37 | /> |
32 | 38 | </template> |
33 | 39 | </BasicTable> |
34 | - <VideoModal @register="registerModal" /> | |
40 | + <VideoModal @register="registerModal" @reloadTable="reload()" /> | |
35 | 41 | </template> |
36 | 42 | |
37 | 43 | <script lang="ts" setup> |
38 | - import { configColumns, searchFormSchema } from './config'; | |
44 | + import { configColumns, searchFormSchema, GBT28181_DEVICE_PERMISSION_ENUM } from './config'; | |
39 | 45 | import { BasicTable, useTable, TableAction } from '/@/components/Table'; |
40 | 46 | import { Switch } from 'ant-design-vue'; |
41 | 47 | import { DeviceRecord } from '/@/api/device/model/deviceModel'; |
... | ... | @@ -43,7 +49,8 @@ |
43 | 49 | import { useModal } from '/@/components/Modal'; |
44 | 50 | import { useMessage } from '/@/hooks/web/useMessage'; |
45 | 51 | import { getVideoChannelList } from '/@/api/device/videoChannel'; |
46 | - import { stopOnDemandVideoApiGet } from '/@/api/camera/cameraManager'; | |
52 | + import { stopOnDemandVideoApiGet, syncVideoApiGet } from '/@/api/camera/cameraManager'; | |
53 | + import { Authority } from '/@/components/Authority'; | |
47 | 54 | |
48 | 55 | const props = defineProps<{ deviceDetail: DeviceRecord }>(); |
49 | 56 | |
... | ... | @@ -96,7 +103,15 @@ |
96 | 103 | if (!record) return; |
97 | 104 | const { deviceId, channelId } = record; |
98 | 105 | if (await stopOnDemandVideoApiGet(deviceId, channelId)) { |
99 | - createMessage.success('已停止点播'); | |
106 | + createMessage.success('已停止'); | |
107 | + } | |
108 | + }; | |
109 | + | |
110 | + //通道同步 | |
111 | + const handleSyncPlay = async () => { | |
112 | + if (await syncVideoApiGet(props.deviceDetail.tbDeviceId)) { | |
113 | + createMessage.success('已同步'); | |
114 | + reload(); | |
100 | 115 | } |
101 | 116 | }; |
102 | 117 | </script> | ... | ... |
... | ... | @@ -36,6 +36,8 @@ |
36 | 36 | import { AccessMode } from '/@/views/camera/manage/config.data'; |
37 | 37 | import { getStreamingPlayUrl } from '/@/api/camera/cameraManager'; |
38 | 38 | |
39 | + const emit = defineEmits(['reloadTable', 'register']); | |
40 | + | |
39 | 41 | const heightNum = ref(800); |
40 | 42 | const showVideo = ref(false); |
41 | 43 | |
... | ... | @@ -91,6 +93,7 @@ |
91 | 93 | const handleCancel = () => { |
92 | 94 | showVideo.value = false; |
93 | 95 | withToken.value = false; |
96 | + emit('reloadTable'); | |
94 | 97 | }; |
95 | 98 | </script> |
96 | 99 | ... | ... |