Commit 9684d7731ed419e528067b6304ce1d64981712cc

Authored by loveumiko
1 parent 1b2526d8

fix: 修改视频播放控制台的问题

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