Commit 22b7817ea2647e9ec1aae5e60a80d5aa4a2f1d18

Authored by xp.Huang
2 parents 5481b808 0f822514

Merge branch 'feat/ezviz-video-control' into 'main_dev'

feat: 新增萤石云视频控制

See merge request yunteng/thingskit-front!1413
... ... @@ -102,3 +102,9 @@ export interface VideoChanneControlType {
102 102 tbDeviceId?: string | number | object;
103 103 channelId?: string | number | object;
104 104 }
  105 +
  106 +export interface EzvizControlType {
  107 + entityId: string;
  108 + action: number;
  109 + controllingType: number;
  110 +}
... ...
... ... @@ -3,6 +3,7 @@ import {
3 3 VideoChannelPlayAddressType,
4 4 VideoChannelQueryParamsType,
5 5 VideoChanneControlType,
  6 + EzvizControlType,
6 7 } from './model/videoChannelModel';
7 8 import { PaginationResult } from '/#/axios';
8 9 import { defHttp } from '/@/utils/http/axios';
... ... @@ -12,6 +13,7 @@ enum Api {
12 13 GET_VIDEO_CONTROL_START = '/video/control/start',
13 14 GET_VIDEO_CONTROL_STOP = '/video/control/stop',
14 15 SET_VIDEO_CONTROL_CONTROL = '/video/control/control',
  16 + SET_EZVIZ_CONTROL = '/video/ezviz/controlling',
15 17 }
16 18
17 19 export const getVideoChannelList = (params: VideoChannelQueryParamsType) => {
... ... @@ -43,3 +45,10 @@ export const setVideoControl = (tbDeviceId, channelId, params: VideoChanneContro
43 45 params,
44 46 });
45 47 };
  48 +
  49 +export const setEzvizControl = (params: EzvizControlType) => {
  50 + return defHttp.get({
  51 + url: Api.SET_EZVIZ_CONTROL,
  52 + params,
  53 + });
  54 +};
... ...
... ... @@ -100,7 +100,6 @@
100 100 AccessMode,
101 101 PageMode,
102 102 CameraPermission,
103   - VideoPlatformEnum,
104 103 accessModeConfig,
105 104 getPlayUrl,
106 105 } from './config.data';
... ... @@ -199,14 +198,12 @@
199 198 const handleViewVideo = (record: CameraRecord) => {
200 199 const { videoPlatformDTO, params } = record;
201 200 const { type } = videoPlatformDTO || {};
202   -
203 201 openModal(true, {
204 202 record: {
205 203 id: record.id,
206   - canControl:
207   - [AccessMode.Streaming, AccessMode.GBT28181].includes(record.accessMode) &&
208   - type !== VideoPlatformEnum.FLUORITE,
  204 + canControl: [AccessMode.Streaming, AccessMode.GBT28181].includes(record.accessMode),
209 205 isGBT: record.accessMode === AccessMode.GBT28181,
  206 + videoPlatformType: type,
210 207 channelId: params?.channelNo,
211 208 tbDeviceId: params?.deviceId,
212 209 getPlayUrl: async () => {
... ...
1 1 import { h } from 'vue';
2 2 import { BasicColumn, FormSchema } from '/@/components/Table';
3 3 import { Tag } from 'ant-design-vue';
  4 +import { VideoPlatformEnum } from '/@/views/camera/manage/config.data';
4 5 export type VideoCancelModalParamsType = {
5 6 canControl?: boolean;
  7 + videoPlatformType: VideoPlatformEnum;
6 8 isGBT?: boolean;
7 9 tbDeviceId?: string;
8 10 channelId?: string;
... ... @@ -101,3 +103,25 @@ export const searchFormSchema: FormSchema[] | any = [
101 103 },
102 104 },
103 105 ];
  106 +
  107 +export enum VideoControlEnum {
  108 + Up = 'UP',
  109 + Right = 'RIGHT',
  110 + Left = 'LEFT',
  111 + Down = 'DOWN',
  112 + ZoomIn = 'ZOOM_IN',
  113 + ZoomOut = 'ZOOM_OUT',
  114 +}
  115 +
  116 +export enum EzvizVideoControlEnum {
  117 + UP,
  118 + DOWN,
  119 + LEFT,
  120 + RIGHT,
  121 + LEFT_UP,
  122 + LEFT_DOWN,
  123 + RIGHT_UP,
  124 + RIGHT_DOWN,
  125 + ZOOM_IN,
  126 + ZOOM_OUT,
  127 +}
... ...
... ... @@ -13,20 +13,14 @@
13 13 } from '@ant-design/icons-vue';
14 14 import { Button, Slider } from 'ant-design-vue';
15 15 import { controlling } from '/@/api/camera/cameraManager';
16   - import { setVideoControl } from '/@/api/device/videoChannel';
  16 + import { setEzvizControl, setVideoControl } from '/@/api/device/videoChannel';
17 17 import XGPlayer from '/@/components/Video/src/XGPlayer.vue';
18   - import PresetPlayer from 'xgplayer';
  18 + import { EzvizVideoControlEnum, VideoCancelModalParamsType, VideoControlEnum } from './config';
  19 + import { VideoPlatformEnum } from '/@/views/camera/manage/config.data';
19 20
20 21 const props = defineProps<{
21 22 playUrl?: string;
22   - options?: {
23   - canControl?: boolean;
24   - isGBT?: boolean;
25   - tbDeviceId?: string;
26   - channelId?: string;
27   - id?: string;
28   - playerProps?: Recordable;
29   - };
  23 + options?: VideoCancelModalParamsType;
30 24 }>();
31 25
32 26 const playerRef = ref<InstanceType<typeof XGPlayer>>();
... ... @@ -64,12 +58,24 @@
64 58 });
65 59 };
66 60
  61 + const handleEzvizControl = (actionType: string, start: boolean) => {
  62 + const { id } = props.options || {};
  63 + const action = EzvizVideoControlEnum[actionType as VideoControlEnum];
  64 + setEzvizControl({ entityId: id!, action, controllingType: Number(!start) });
  65 + };
  66 +
67 67 //长按开始
68 68 const moveStart = (action: string) => {
69 69 if (unref(props.options?.isGBT)) {
70 70 handleGBTControl(action, unref(sliderValue));
71 71 return;
72 72 }
  73 +
  74 + if (props.options?.videoPlatformType === VideoPlatformEnum.FLUORITE) {
  75 + handleEzvizControl(action, true);
  76 + return;
  77 + }
  78 +
73 79 handleControl(0, action);
74 80 };
75 81
... ... @@ -79,6 +85,14 @@
79 85 handleGBTControl('STOP', unref(sliderValue));
80 86 return;
81 87 }
  88 +
  89 + if (props.options?.videoPlatformType === VideoPlatformEnum.FLUORITE) {
  90 + setTimeout(() => {
  91 + handleEzvizControl(action, false);
  92 + }, 1000);
  93 + return;
  94 + }
  95 +
82 96 handleControl(1, action);
83 97 };
84 98
... ... @@ -122,15 +136,15 @@
122 136 <div>
123 137 <Button
124 138 class="left-top in-block"
125   - @mousedown="moveStart('UP')"
126   - @mouseup="moveStop('UP')"
  139 + @mousedown="moveStart(VideoControlEnum.Up)"
  140 + @mouseup="moveStop(VideoControlEnum.Up)"
127 141 >
128 142 <CaretUpOutlined class="icon-rotate child-icon" />
129 143 </Button>
130 144 <Button
131 145 class="right-top in-block"
132   - @mousedown="moveStart('RIGHT')"
133   - @mouseup="moveStop('RIGHT')"
  146 + @mousedown="moveStart(VideoControlEnum.Right)"
  147 + @mouseup="moveStop(VideoControlEnum.Right)"
134 148 >
135 149 <CaretRightOutlined class="icon-rotate child-icon" />
136 150 </Button>
... ... @@ -138,15 +152,15 @@
138 152 <div>
139 153 <Button
140 154 class="left-bottom in-block"
141   - @mousedown="moveStart('LEFT')"
142   - @mouseup="moveStop('LEFT')"
  155 + @mousedown="moveStart(VideoControlEnum.Left)"
  156 + @mouseup="moveStop(VideoControlEnum.Left)"
143 157 >
144 158 <CaretLeftOutlined class="icon-rotate child-icon" />
145 159 </Button>
146 160 <Button
147 161 class="right-bottom in-block"
148   - @mousedown="moveStart('DOWN')"
149   - @mouseup="moveStop('DOWN')"
  162 + @mousedown="moveStart(VideoControlEnum.Down)"
  163 + @mouseup="moveStop(VideoControlEnum.Down)"
150 164 >
151 165 <CaretDownOutlined class="icon-rotate child-icon" />
152 166 </Button>
... ... @@ -161,16 +175,16 @@
161 175 <div class="flex justify-center mt-8">
162 176 <Button
163 177 class="button-icon"
164   - @mousedown="moveStart('ZOOM_IN')"
165   - @mouseup="moveStop('ZOOM_IN')"
  178 + @mousedown="moveStart(VideoControlEnum.ZoomIn)"
  179 + @mouseup="moveStop(VideoControlEnum.ZoomIn)"
166 180 style="border-radius: 50%"
167 181 >
168 182 <ZoomInOutlined style="color: #315a9c; font-size: 1.5rem" />
169 183 </Button>
170 184 <Button
171 185 class="ml-10 button-icon"
172   - @mousedown="moveStart('ZOOM_OUT')"
173   - @mouseup="moveStop('ZOOM_OUT')"
  186 + @mousedown="moveStart(VideoControlEnum.ZoomOut)"
  187 + @mouseup="moveStop(VideoControlEnum.ZoomOut)"
174 188 style="border-radius: 50%"
175 189 >
176 190 <ZoomOutOutlined style="color: #315a9c; font-size: 1.5rem" />
... ...
... ... @@ -31,7 +31,6 @@
31 31 options.value = null;
32 32 setModalProps({ loading: true, loadingTip: '视频加载中...' });
33 33 const { url, type } = await record.getPlayUrl();
34   -
35 34 playUrl.value = url;
36 35 options.value = record;
37 36 options.value.playerProps = {
... ...