Commit bf6190c8023e8b5ae18b3f8289b6b0e27035d59d

Authored by dev001
1 parent 2862e7fa

fix: 修改流媒体控制台的东西

... ... @@ -122,5 +122,9 @@ export const closeFlvPlay = (url: string, browserId: string) => {
122 122
123 123 //云台控制
124 124 export const controlling = (params: any) => {
125   - return `/api/yt/video/controlling?=${{ ...params }}`;
  125 + console.log(params, 'params');
  126 + return defHttp.get({
  127 + url: `/video/controlling`,
  128 + params,
  129 + });
126 130 };
... ...
... ... @@ -89,43 +89,17 @@
89 89 !unref(isPlay) && unref(videoPlayInstance)?.play();
90 90 };
91 91
92   - const handleTopClick = async () => {
93   - console.log('上');
94   - handleControl(0, 'up');
95   - setTimeout(() => {
96   - handleControl(1, 'up');
97   - }, 2000);
98   - };
99   -
100   - const handleRightClick = () => {
101   - console.log('右');
102   - };
103   -
104   - const handleBottomClick = () => {
105   - console.log('下');
106   - };
107   -
108   - const handleLeftClick = () => {
109   - console.log('左');
110   - };
111   -
112   - // type 1:放大 2:缩小
113   - const handleScale = (type: number) => {
114   - console.log(type);
115   - console.log(props);
116   - };
117   -
118   - const getSn = () => {
  92 + const getId = () => {
119 93 const { options } = props || {};
120   - const { sources } = options || {};
121   - return sources?.[0]?.sn;
  94 + const { sources }: any = options || {};
  95 + return sources?.[0]?.id;
122 96 };
123 97
124 98 const handleControl = (action: number, direction: string) => {
125 99 console.log(direction);
126 100
127   - const organizationId = getSn();
128   - controlling({ organizationId, action, direction });
  101 + const organizationId = getId();
  102 + controlling({ cameralndexCode: organizationId, action, command: direction });
129 103 };
130 104
131 105 const isPlay = ref<Boolean | null | undefined>(true);
... ... @@ -159,6 +133,15 @@
159 133 });
160 134 });
161 135
  136 + //长按开始
  137 + const moveStart = (action) => {
  138 + handleControl(0, action);
  139 + };
  140 + // 长按结束
  141 + const moveStop = (action) => {
  142 + handleControl(1, action);
  143 + };
  144 +
162 145 onUnmounted(() => {
163 146 unref(videoPlayInstance)?.dispose();
164 147 videoPlayInstance.value = null;
... ... @@ -191,18 +174,34 @@
191 174
192 175 <div class="box">
193 176 <div>
194   - <Button class="left-top in-block" @click="handleTopClick">
  177 + <Button
  178 + class="left-top in-block"
  179 + @mousedown="moveStart('up')"
  180 + @mouseup="moveStop('up')"
  181 + >
195 182 <CaretUpOutlined class="icon-rotate child-icon" />
196 183 </Button>
197   - <Button class="right-top in-block" @click="handleRightClick">
  184 + <Button
  185 + class="right-top in-block"
  186 + @mousedown="moveStart('RIGHT')"
  187 + @mouseup="moveStop('RIGHT')"
  188 + >
198 189 <CaretRightOutlined class="icon-rotate child-icon" />
199 190 </Button>
200 191 </div>
201 192 <div>
202   - <Button class="left-bottom in-block" @click="handleBottomClick">
  193 + <Button
  194 + class="left-bottom in-block"
  195 + @mousedown="moveStart('LEFT')"
  196 + @mouseup="moveStop('LEFT')"
  197 + >
203 198 <CaretLeftOutlined class="icon-rotate child-icon" />
204 199 </Button>
205   - <Button class="right-bottom in-block" @click="handleLeftClick">
  200 + <Button
  201 + class="right-bottom in-block"
  202 + @mousedown="moveStart('DOWN')"
  203 + @mouseup="moveStop('DOWN')"
  204 + >
206 205 <CaretDownOutlined class="icon-rotate child-icon" />
207 206 </Button>
208 207 </div>
... ... @@ -211,10 +210,20 @@
211 210 </div>
212 211 </div>
213 212 <div class="flex justify-center mt-8">
214   - <Button shape="circle" class="button-icon" @click="handleScale(1)">
  213 + <Button
  214 + class="button-icon"
  215 + @mousedown="moveStart('ZOOM_IN')"
  216 + @mouseup="moveStop('ZOOM_IN')"
  217 + style="border-radius: :50%;"
  218 + >
215 219 <ZoomInOutlined style="color: #315a9c; font-size: 1.5rem" />
216 220 </Button>
217   - <Button shape="circle" class="ml-10 button-icon" @click="handleScale(2)">
  221 + <Button
  222 + class="ml-10 button-icon"
  223 + @mousedown="moveStart('ZOOM_OUT')"
  224 + @mouseup="moveStop('ZOOM_OUT')"
  225 + style="border-radius: :50%;"
  226 + >
218 227 <ZoomOutOutlined style="color: #315a9c; font-size: 1.5rem" />
219 228 </Button>
220 229 </div>
... ... @@ -254,6 +263,7 @@
254 263 height: 3rem;
255 264 background: #f5f5f5;
256 265 border: none;
  266 + border-radius: 50% !important;
257 267 }
258 268
259 269 .center {
... ...
... ... @@ -49,13 +49,13 @@
49 49 autoplay: true,
50 50 });
51 51
52   - const setSources = (url: string, fingerprintResult: GetResult, sn) => {
  52 + const setSources = (url: string, fingerprintResult: GetResult, id) => {
53 53 const flag = isRtspProtocol(url);
54 54 options.sources = [
55 55 {
56 56 src: flag ? getFlvPlayUrl(url, fingerprintResult.visitorId) : url,
57 57 type: getVideoTypeByUrl(url),
58   - sn,
  58 + id,
59 59 },
60 60 ];
61 61
... ... @@ -76,12 +76,12 @@
76 76 closeFlvPlay(unref(playUrl), result.visitorId);
77 77 withToken.value = true;
78 78 }
79   - setSources((record as CameraModel).videoUrl, result, record.sn);
  79 + setSources((record as CameraModel).videoUrl, result, record.id);
80 80 }
81 81 } else {
82 82 try {
83 83 const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!);
84   - setSources(url, result, record.sn);
  84 + setSources(url, result, record.id);
85 85 } catch (error) {}
86 86 }
87 87 showVideo.value = true;
... ...