Commit bf6190c8023e8b5ae18b3f8289b6b0e27035d59d

Authored by dev001
1 parent 2862e7fa

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

@@ -122,5 +122,9 @@ export const closeFlvPlay = (url: string, browserId: string) => { @@ -122,5 +122,9 @@ export const closeFlvPlay = (url: string, browserId: string) => {
122 122
123 //云台控制 123 //云台控制
124 export const controlling = (params: any) => { 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,43 +89,17 @@
89 !unref(isPlay) && unref(videoPlayInstance)?.play(); 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 const { options } = props || {}; 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 const handleControl = (action: number, direction: string) => { 98 const handleControl = (action: number, direction: string) => {
125 console.log(direction); 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 const isPlay = ref<Boolean | null | undefined>(true); 105 const isPlay = ref<Boolean | null | undefined>(true);
@@ -159,6 +133,15 @@ @@ -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 onUnmounted(() => { 145 onUnmounted(() => {
163 unref(videoPlayInstance)?.dispose(); 146 unref(videoPlayInstance)?.dispose();
164 videoPlayInstance.value = null; 147 videoPlayInstance.value = null;
@@ -191,18 +174,34 @@ @@ -191,18 +174,34 @@
191 174
192 <div class="box"> 175 <div class="box">
193 <div> 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 <CaretUpOutlined class="icon-rotate child-icon" /> 182 <CaretUpOutlined class="icon-rotate child-icon" />
196 </Button> 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 <CaretRightOutlined class="icon-rotate child-icon" /> 189 <CaretRightOutlined class="icon-rotate child-icon" />
199 </Button> 190 </Button>
200 </div> 191 </div>
201 <div> 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 <CaretLeftOutlined class="icon-rotate child-icon" /> 198 <CaretLeftOutlined class="icon-rotate child-icon" />
204 </Button> 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 <CaretDownOutlined class="icon-rotate child-icon" /> 205 <CaretDownOutlined class="icon-rotate child-icon" />
207 </Button> 206 </Button>
208 </div> 207 </div>
@@ -211,10 +210,20 @@ @@ -211,10 +210,20 @@
211 </div> 210 </div>
212 </div> 211 </div>
213 <div class="flex justify-center mt-8"> 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 <ZoomInOutlined style="color: #315a9c; font-size: 1.5rem" /> 219 <ZoomInOutlined style="color: #315a9c; font-size: 1.5rem" />
216 </Button> 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 <ZoomOutOutlined style="color: #315a9c; font-size: 1.5rem" /> 227 <ZoomOutOutlined style="color: #315a9c; font-size: 1.5rem" />
219 </Button> 228 </Button>
220 </div> 229 </div>
@@ -254,6 +263,7 @@ @@ -254,6 +263,7 @@
254 height: 3rem; 263 height: 3rem;
255 background: #f5f5f5; 264 background: #f5f5f5;
256 border: none; 265 border: none;
  266 + border-radius: 50% !important;
257 } 267 }
258 268
259 .center { 269 .center {
@@ -49,13 +49,13 @@ @@ -49,13 +49,13 @@
49 autoplay: true, 49 autoplay: true,
50 }); 50 });
51 51
52 - const setSources = (url: string, fingerprintResult: GetResult, sn) => { 52 + const setSources = (url: string, fingerprintResult: GetResult, id) => {
53 const flag = isRtspProtocol(url); 53 const flag = isRtspProtocol(url);
54 options.sources = [ 54 options.sources = [
55 { 55 {
56 src: flag ? getFlvPlayUrl(url, fingerprintResult.visitorId) : url, 56 src: flag ? getFlvPlayUrl(url, fingerprintResult.visitorId) : url,
57 type: getVideoTypeByUrl(url), 57 type: getVideoTypeByUrl(url),
58 - sn, 58 + id,
59 }, 59 },
60 ]; 60 ];
61 61
@@ -76,12 +76,12 @@ @@ -76,12 +76,12 @@
76 closeFlvPlay(unref(playUrl), result.visitorId); 76 closeFlvPlay(unref(playUrl), result.visitorId);
77 withToken.value = true; 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 } else { 81 } else {
82 try { 82 try {
83 const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!); 83 const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!);
84 - setSources(url, result, record.sn); 84 + setSources(url, result, record.id);
85 } catch (error) {} 85 } catch (error) {}
86 } 86 }
87 showVideo.value = true; 87 showVideo.value = true;