Showing
3 changed files
with
26 additions
and
7 deletions
| @@ -119,3 +119,8 @@ export const closeFlvPlay = (url: string, browserId: string) => { | @@ -119,3 +119,8 @@ export const closeFlvPlay = (url: string, browserId: string) => { | ||
| 119 | url: `/rtsp/closeFlv?url=${encodeURIComponent(url)}&browserId=${browserId}`, | 119 | url: `/rtsp/closeFlv?url=${encodeURIComponent(url)}&browserId=${browserId}`, |
| 120 | }); | 120 | }); |
| 121 | }; | 121 | }; |
| 122 | + | ||
| 123 | +//云台控制 | ||
| 124 | +export const controlling = (params: any) => { | ||
| 125 | + return `/api/yt/video/controlling?=${{ ...params }}`; | ||
| 126 | +}; |
| @@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
| 18 | } from '@ant-design/icons-vue'; | 18 | } from '@ant-design/icons-vue'; |
| 19 | import { Button } from 'ant-design-vue'; | 19 | import { Button } from 'ant-design-vue'; |
| 20 | import { nextTick } from 'vue'; | 20 | import { nextTick } from 'vue'; |
| 21 | + import { controlling } from '/@/api/camera/cameraManager'; | ||
| 21 | 22 | ||
| 22 | const { prefixCls } = useDesign('basic-video-play'); | 23 | const { prefixCls } = useDesign('basic-video-play'); |
| 23 | 24 | ||
| @@ -37,6 +38,7 @@ | @@ -37,6 +38,7 @@ | ||
| 37 | 38 | ||
| 38 | const getOptions = computed(() => { | 39 | const getOptions = computed(() => { |
| 39 | const { options, withToken } = props; | 40 | const { options, withToken } = props; |
| 41 | + console.log(props, 'props'); | ||
| 40 | 42 | ||
| 41 | const defaultOptions: VideoJsPlayerOptions & Recordable = { | 43 | const defaultOptions: VideoJsPlayerOptions & Recordable = { |
| 42 | language: 'zh', | 44 | language: 'zh', |
| @@ -89,10 +91,10 @@ | @@ -89,10 +91,10 @@ | ||
| 89 | 91 | ||
| 90 | const handleTopClick = async () => { | 92 | const handleTopClick = async () => { |
| 91 | console.log('上'); | 93 | console.log('上'); |
| 92 | - handleControl('up'); | 94 | + handleControl(0, 'up'); |
| 93 | setTimeout(() => { | 95 | setTimeout(() => { |
| 94 | - handleControl('stop'); | ||
| 95 | - }, 500); | 96 | + handleControl(1, 'up'); |
| 97 | + }, 2000); | ||
| 96 | }; | 98 | }; |
| 97 | 99 | ||
| 98 | const handleRightClick = () => { | 100 | const handleRightClick = () => { |
| @@ -110,10 +112,20 @@ | @@ -110,10 +112,20 @@ | ||
| 110 | // type 1:放大 2:缩小 | 112 | // type 1:放大 2:缩小 |
| 111 | const handleScale = (type: number) => { | 113 | const handleScale = (type: number) => { |
| 112 | console.log(type); | 114 | console.log(type); |
| 115 | + console.log(props); | ||
| 113 | }; | 116 | }; |
| 114 | 117 | ||
| 115 | - const handleControl = (direction: string) => { | 118 | + const getSn = () => { |
| 119 | + const { options } = props || {}; | ||
| 120 | + const { sources } = options || {}; | ||
| 121 | + return sources?.[0]?.sn; | ||
| 122 | + }; | ||
| 123 | + | ||
| 124 | + const handleControl = (action: number, direction: string) => { | ||
| 116 | console.log(direction); | 125 | console.log(direction); |
| 126 | + | ||
| 127 | + const organizationId = getSn(); | ||
| 128 | + controlling({ organizationId, action, direction }); | ||
| 117 | }; | 129 | }; |
| 118 | 130 | ||
| 119 | const isPlay = ref<Boolean | null | undefined>(true); | 131 | const isPlay = ref<Boolean | null | undefined>(true); |
| @@ -49,12 +49,13 @@ | @@ -49,12 +49,13 @@ | ||
| 49 | autoplay: true, | 49 | autoplay: true, |
| 50 | }); | 50 | }); |
| 51 | 51 | ||
| 52 | - const setSources = (url: string, fingerprintResult: GetResult) => { | 52 | + const setSources = (url: string, fingerprintResult: GetResult, sn) => { |
| 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 | }, | 59 | }, |
| 59 | ]; | 60 | ]; |
| 60 | 61 | ||
| @@ -65,6 +66,7 @@ | @@ -65,6 +66,7 @@ | ||
| 65 | const [register] = useModalInner( | 66 | const [register] = useModalInner( |
| 66 | async (data: { record: CameraModel | StreamingManageRecord }) => { | 67 | async (data: { record: CameraModel | StreamingManageRecord }) => { |
| 67 | const { record } = data; | 68 | const { record } = data; |
| 69 | + console.log(record, 'record'); | ||
| 68 | const result = await getResult(); | 70 | const result = await getResult(); |
| 69 | fingerprintResult.value = result; | 71 | fingerprintResult.value = result; |
| 70 | if (record.accessMode === AccessMode.ManuallyEnter) { | 72 | if (record.accessMode === AccessMode.ManuallyEnter) { |
| @@ -74,12 +76,12 @@ | @@ -74,12 +76,12 @@ | ||
| 74 | closeFlvPlay(unref(playUrl), result.visitorId); | 76 | closeFlvPlay(unref(playUrl), result.visitorId); |
| 75 | withToken.value = true; | 77 | withToken.value = true; |
| 76 | } | 78 | } |
| 77 | - setSources((record as CameraModel).videoUrl, result); | 79 | + setSources((record as CameraModel).videoUrl, result, record.sn); |
| 78 | } | 80 | } |
| 79 | } else { | 81 | } else { |
| 80 | try { | 82 | try { |
| 81 | const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!); | 83 | const { data: { url } = { url: '' } } = await getStreamingPlayUrl(record.id!); |
| 82 | - setSources(url, result); | 84 | + setSources(url, result, record.sn); |
| 83 | } catch (error) {} | 85 | } catch (error) {} |
| 84 | } | 86 | } |
| 85 | showVideo.value = true; | 87 | showVideo.value = true; |