@ray-js/ipc-player-integration 0.0.29-beta.2 → 0.0.29-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ctx/ctx.composition.d.ts +9 -3
- package/lib/ctx/ctx.composition.js +43 -1
- package/lib/ctx/ctx.js +5 -0
- package/lib/ctx/multiCameraCtx.d.ts +40 -5
- package/lib/ctx/multiCameraCtx.js +166 -20
- package/lib/features/initPlayerWidgets/index.d.ts +7 -1
- package/lib/features/initPlayerWidgets/index.js +14 -11
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +3 -1
- package/lib/hooks/useDpSupport/index.d.ts +6 -0
- package/lib/hooks/useDpSupport/index.js +47 -0
- package/lib/hooks/useSignal4G/index.d.ts +2 -0
- package/lib/hooks/useSignal4G/index.js +35 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/interface.d.ts +43 -2
- package/lib/ports.output.d.ts +4 -0
- package/lib/ports.output.js +3 -1
- package/lib/res/index.d.ts +1 -0
- package/lib/res/index.js +21 -1
- package/lib/res/svg/signalFour0.svg +1 -0
- package/lib/res/svg/signalFour1.svg +1 -0
- package/lib/res/svg/signalFour2.svg +1 -0
- package/lib/res/svg/signalFour3.svg +1 -0
- package/lib/res/svg/signalFour4.svg +1 -0
- package/lib/res/svg/signalThree0.svg +1 -0
- package/lib/res/svg/signalThree1.svg +1 -0
- package/lib/res/svg/signalThree2.svg +1 -0
- package/lib/res/svg/signalThree3.svg +1 -0
- package/lib/svg-module.d.ts +4 -0
- package/lib/ui/constant.d.ts +20 -0
- package/lib/ui/constant.js +21 -0
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.js +3 -1
- package/lib/ui/ui.d.ts +2 -0
- package/lib/ui/ui.js +130 -38
- package/lib/ui/ui.less +33 -4
- package/lib/ui/widgetClick.d.ts +2 -0
- package/lib/ui/widgetClick.js +2 -0
- package/lib/utils/content/dpCode.d.ts +5 -0
- package/lib/utils/content/dpCode.js +11 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +12 -1
- package/lib/utils/videoSplitHelper.d.ts +18 -0
- package/lib/utils/videoSplitHelper.js +48 -0
- package/lib/widgets/fullScreen/fullScreen.js +6 -4
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +4 -1
- package/lib/widgets/fullScreen/fullVoiceIntercom.js +5 -2
- package/lib/widgets/fullScreen/verticalScreen.js +1 -1
- package/lib/widgets/fullSmallIntercom/fullSmallIntercom.js +4 -1
- package/lib/widgets/index.d.ts +2 -0
- package/lib/widgets/index.js +3 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +4 -1
- package/lib/widgets/moveInteractiveControl/moveInteractiveControl.js +7 -1
- package/lib/widgets/multiCamera/index.less +28 -5
- package/lib/widgets/multiCamera/moveablePtzControl.js +229 -47
- package/lib/widgets/multiCamera/tileActions.js +2 -2
- package/lib/widgets/muted/muted.js +12 -11
- package/lib/widgets/ptz/ptz.js +4 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +4 -1
- package/lib/widgets/recordVideo/recordVideo.js +6 -1
- package/lib/widgets/resolution/fullResolutionControl.js +10 -2
- package/lib/widgets/resolution/resolution.js +4 -1
- package/lib/widgets/screenshot/screenshot.js +6 -1
- package/lib/widgets/signal4G/index.d.ts +1 -0
- package/lib/widgets/signal4G/index.js +1 -0
- package/lib/widgets/signal4G/signal4G.d.ts +8 -0
- package/lib/widgets/signal4G/signal4G.js +28 -0
- package/lib/widgets/signal4G/signal4G.less +15 -0
- package/lib/widgets/toggleVerticalFull/index.d.ts +1 -0
- package/lib/widgets/toggleVerticalFull/index.js +1 -0
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.d.ts +8 -0
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +32 -0
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.less +4 -0
- package/lib/widgets/verticalSmallIntercom/verticalSmallIntercom.js +4 -1
- package/lib/widgets/voiceIntercom/voiceIntercom.js +18 -21
- package/lib/widgets/voiceIntercom/voiceIntercom.less +85 -0
- package/package.json +6 -7
- package/lib/features/initPlayerWidgets/multiCamera.d.ts +0 -8
- package/lib/features/initPlayerWidgets/multiCamera.js +0 -78
- package/lib/widgets/battery/battery.composition.d.ts +0 -155
- package/lib/widgets/voiceIntercom/voiceIntercom.d.ts +0 -93
|
@@ -11,7 +11,7 @@ import { useMemoizedFn } from 'ahooks';
|
|
|
11
11
|
import { UIEventContext } from '../../ui/context';
|
|
12
12
|
import { useDpState } from '../../hooks';
|
|
13
13
|
import { useComponentHideState } from '../../ui/hooks';
|
|
14
|
-
import { pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
|
|
14
|
+
import { pauseTimeToHideAllComponent, startTimeToHideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
15
15
|
import { DIRECTION_CONTROL_DP_CODE } from './constant';
|
|
16
16
|
import { useStore } from '../../ctx/store';
|
|
17
17
|
export function FullTravelRouteControl(props) {
|
|
@@ -80,6 +80,9 @@ export function FullTravelRouteControl(props) {
|
|
|
80
80
|
}, directionControlProps, {
|
|
81
81
|
onTouchStart: value => {
|
|
82
82
|
var _directionControlProp2;
|
|
83
|
+
event.emit(widgetClick, {
|
|
84
|
+
widgetId: widgetLabs.FULL_TRAVEL_ROUTE_CONTROL
|
|
85
|
+
});
|
|
83
86
|
pauseTimeToHideAllComponentFn();
|
|
84
87
|
sendDpValueFn(String(value));
|
|
85
88
|
// @ts-ignore
|
|
@@ -9,7 +9,7 @@ import { VoiceIntercom } from '../voiceIntercom';
|
|
|
9
9
|
import { useComponentHideState } from '../../ui/hooks';
|
|
10
10
|
import { useMemoizedFn } from '../../hooks';
|
|
11
11
|
import { UIEventContext } from '../../ui/context';
|
|
12
|
-
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
12
|
+
import { pauseTimeToHideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
13
13
|
import { useStore } from '../../ctx/store';
|
|
14
14
|
export function FullVoiceIntercom(props) {
|
|
15
15
|
const [shouldHide] = useComponentHideState();
|
|
@@ -47,9 +47,12 @@ export function FullVoiceIntercom(props) {
|
|
|
47
47
|
})
|
|
48
48
|
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
|
49
49
|
talkingColor: "#FFFFFF",
|
|
50
|
-
scale:
|
|
50
|
+
scale: 1.2,
|
|
51
51
|
mode: "circle",
|
|
52
52
|
onTouchStart: () => {
|
|
53
|
+
event.emit(widgetClick, {
|
|
54
|
+
widgetId: widgetLabs.FULL_VOICE_INTERCOM
|
|
55
|
+
});
|
|
53
56
|
event.emit(pauseTimeToHideAllComponent);
|
|
54
57
|
},
|
|
55
58
|
onTouchEnd: () => {
|
|
@@ -3,7 +3,7 @@ import React, { useContext } from 'react';
|
|
|
3
3
|
import { View } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useStore } from '../../ctx/store';
|
|
6
|
-
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
6
|
+
import { pauseTimeToHideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
7
7
|
import { UIEventContext } from '../../ui/context';
|
|
8
8
|
import { VoiceIntercom } from '../voiceIntercom';
|
|
9
9
|
import './fullSmallIntercom.less';
|
|
@@ -27,6 +27,9 @@ export function FullSmallIntercom(props) {
|
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
const onTouchStart = () => {
|
|
30
|
+
event.emit(widgetClick, {
|
|
31
|
+
widgetId: widgetLabs.FULL_SMALL_INTERCOM
|
|
32
|
+
});
|
|
30
33
|
event.emit(pauseTimeToHideAllComponent);
|
|
31
34
|
};
|
|
32
35
|
const onTouchEnd = () => {
|
package/lib/widgets/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './battery';
|
|
2
|
+
export * from './signal4G';
|
|
2
3
|
export * from './battery/batteryFull';
|
|
3
4
|
export * from './screenshot';
|
|
4
5
|
export * from './tempHumidity';
|
|
@@ -15,3 +16,4 @@ export * from './moveInteractiveControl';
|
|
|
15
16
|
export * from './ptzControlTip';
|
|
16
17
|
export * from './multiCamera';
|
|
17
18
|
export * from './smallIntercom';
|
|
19
|
+
export * from './toggleVerticalFull';
|
package/lib/widgets/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from './battery';
|
|
2
|
+
export * from './signal4G';
|
|
2
3
|
export * from './battery/batteryFull';
|
|
3
4
|
export * from './screenshot';
|
|
4
5
|
export * from './tempHumidity';
|
|
@@ -14,4 +15,5 @@ export * from './verticalSmallIntercom';
|
|
|
14
15
|
export * from './moveInteractiveControl';
|
|
15
16
|
export * from './ptzControlTip';
|
|
16
17
|
export * from './multiCamera';
|
|
17
|
-
export * from './smallIntercom';
|
|
18
|
+
export * from './smallIntercom';
|
|
19
|
+
export * from './toggleVerticalFull';
|
|
@@ -3,7 +3,7 @@ import { View, Text } from '@ray-js/ray';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useStore } from '../../ctx/store';
|
|
5
5
|
import { UIEventContext } from '../../ui/context';
|
|
6
|
-
import { hideAllComponent } from '../../ui/constant';
|
|
6
|
+
import { hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
7
7
|
import { MoveInteractiveControl } from './moveInteractiveControl';
|
|
8
8
|
import './controlButton.less';
|
|
9
9
|
const ID = 'MoveInteractiveControl';
|
|
@@ -26,6 +26,9 @@ export function MoveInteractiveControlButton(props) {
|
|
|
26
26
|
if (screenType === 'vertical') return null;
|
|
27
27
|
return /*#__PURE__*/React.createElement(View, {
|
|
28
28
|
onClick: () => {
|
|
29
|
+
event.emit(widgetClick, {
|
|
30
|
+
widgetId: widgetLabs.MOVE_INTERACTIVE_CONTROL
|
|
31
|
+
});
|
|
29
32
|
event.emit(hideAllComponent);
|
|
30
33
|
if (hasContent('absolute', ID)) {
|
|
31
34
|
event.emit('showMoveInteractiveControl');
|
|
@@ -3,7 +3,7 @@ import "core-js/modules/esnext.iterator.map.js";
|
|
|
3
3
|
import React, { useCallback, useContext, useEffect, useState, useRef, useMemo } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { MoveInterActiveControlUI } from './moveInteractiveControlUI';
|
|
6
|
-
import { playerTap, showAllComponent } from '../../ui/constant';
|
|
6
|
+
import { playerTap, showAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
7
7
|
import { useDpState, useSchemaInfo } from '../../hooks';
|
|
8
8
|
import { UIEventContext } from '../../ui/context';
|
|
9
9
|
import { useStore } from '../../ctx/store';
|
|
@@ -80,6 +80,12 @@ export function MoveInteractiveControl(props) {
|
|
|
80
80
|
}),
|
|
81
81
|
menu: menu,
|
|
82
82
|
onClick: value => {
|
|
83
|
+
event.emit(widgetClick, {
|
|
84
|
+
widgetId: widgetLabs.MOVE_INTERACTIVE_CONTROL,
|
|
85
|
+
extra: {
|
|
86
|
+
key: value
|
|
87
|
+
}
|
|
88
|
+
});
|
|
83
89
|
sendDp({
|
|
84
90
|
[TYPE_CODE]: value
|
|
85
91
|
});
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
.@{prefix}-actions-wrap {
|
|
17
17
|
position: absolute;
|
|
18
|
-
bottom:
|
|
18
|
+
bottom: 64px;
|
|
19
19
|
right: 16px;
|
|
20
20
|
z-index: 340;
|
|
21
21
|
}
|
|
@@ -44,9 +44,10 @@
|
|
|
44
44
|
--app-native-btn-bg-color: transparent;
|
|
45
45
|
--ptz-border-color: rgba(255, 255, 255, 0.2);
|
|
46
46
|
--ptz-arrow-icon-color: #fff;
|
|
47
|
-
--ptz-circle-inner-bg-color: rgba(255, 255, 255,
|
|
47
|
+
--ptz-circle-inner-bg-color: rgba(255, 255, 255, 1);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
|
|
50
51
|
.@{prefix}-tile-tip-wrap {
|
|
51
52
|
position: absolute;
|
|
52
53
|
top: 0;
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
|
|
75
76
|
&.@{prefix}-step2 {
|
|
76
77
|
right: 10px;
|
|
77
|
-
bottom:
|
|
78
|
+
bottom: 57px;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
&.@{prefix}-ptz-tip {
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
|
|
172
173
|
&.@{prefix}-step2 {
|
|
173
174
|
right: 130px;
|
|
174
|
-
bottom:
|
|
175
|
+
bottom: 76px;
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
&.@{prefix}-ptz-tip {
|
|
@@ -198,7 +199,7 @@
|
|
|
198
199
|
|
|
199
200
|
&.@{prefix}-step2 {
|
|
200
201
|
right: 130px;
|
|
201
|
-
bottom:
|
|
202
|
+
bottom: 16px;
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
&.@{prefix}-ptz-tip {
|
|
@@ -212,3 +213,25 @@
|
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
215
|
}
|
|
216
|
+
|
|
217
|
+
.ipc-player-content-small-screen {
|
|
218
|
+
.@{prefix}-tile-tip-wrap {
|
|
219
|
+
.@{prefix}-tile-tip-content {
|
|
220
|
+
&.@{prefix}-step1 {
|
|
221
|
+
right: 0px;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.@{prefix}-tile-tip-text {
|
|
227
|
+
&.@{prefix}-step1 {
|
|
228
|
+
right: 14px;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.@{prefix}-tile-tip-button {
|
|
233
|
+
&.@{prefix}-step1 {
|
|
234
|
+
right: 14px;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
4
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
5
|
import { CoverView, View } from '@ray-js/ray';
|
|
4
6
|
import { getDpIdByCode, publishDps } from '@ray-js/ray-ipc-utils';
|
|
5
7
|
import _find from 'lodash/find';
|
|
6
8
|
import _get from 'lodash/get';
|
|
7
|
-
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
9
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
8
10
|
import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
|
|
9
11
|
import { useStore } from '../../ctx/store';
|
|
10
12
|
import { useMemoizedFn } from '../../hooks';
|
|
@@ -12,6 +14,7 @@ import { MultiCameraScreenMode } from '../../interface';
|
|
|
12
14
|
import { pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
|
|
13
15
|
import { UIEventContext } from '../../ui/context';
|
|
14
16
|
import { getEnumRangeIsValid } from '../../utils/device';
|
|
17
|
+
import { patchPtzDataShowByProtocol, patchZoomDataShowByProtocol } from '../../utils';
|
|
15
18
|
import Styles from '../ptz/ptz.less';
|
|
16
19
|
import { multiPrefix } from './constants';
|
|
17
20
|
import './index.less';
|
|
@@ -74,6 +77,9 @@ export const MoveablePtzControlItem = props => {
|
|
|
74
77
|
selectedLenInfo: multiCameraCtx.selectedLenInfo,
|
|
75
78
|
screenMode: multiCameraCtx.screenMode
|
|
76
79
|
});
|
|
80
|
+
const {
|
|
81
|
+
dpSupportMap
|
|
82
|
+
} = multiCameraCtx;
|
|
77
83
|
const [style, setStyle] = useState({
|
|
78
84
|
positionLeft,
|
|
79
85
|
positionBottom,
|
|
@@ -85,18 +91,156 @@ export const MoveablePtzControlItem = props => {
|
|
|
85
91
|
pageY: 0
|
|
86
92
|
});
|
|
87
93
|
const canMoveRef = useRef(false);
|
|
94
|
+
|
|
95
|
+
// 获取播放器容器尺寸用于边界限制
|
|
96
|
+
const containerInfo = useRef({
|
|
97
|
+
width: 0,
|
|
98
|
+
height: 0,
|
|
99
|
+
top: 0,
|
|
100
|
+
left: 0
|
|
101
|
+
});
|
|
102
|
+
// 动态获取组件实际尺寸
|
|
103
|
+
const componentSizeRef = useRef({
|
|
104
|
+
width: 0,
|
|
105
|
+
height: 0
|
|
106
|
+
});
|
|
107
|
+
// 控制栏高度:竖屏 48px,横屏 72px
|
|
108
|
+
const controlBarHeight = screenMode === MultiCameraScreenMode.landscape ? 72 : 48;
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
// 使用 createSelectorQuery 查询播放器容器和组件的实际尺寸
|
|
111
|
+
const query = ty.createSelectorQuery();
|
|
112
|
+
query.select('.ipc-player-content').boundingClientRect().exec(res => {
|
|
113
|
+
const rect = res === null || res === void 0 ? void 0 : res[0];
|
|
114
|
+
if (rect) {
|
|
115
|
+
containerInfo.current = {
|
|
116
|
+
width: rect.width,
|
|
117
|
+
height: rect.height,
|
|
118
|
+
top: rect.top,
|
|
119
|
+
left: rect.left
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// 查询 PTZ 控件的实际尺寸
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
const ptzQuery = ty.createSelectorQuery();
|
|
127
|
+
ptzQuery.select(`.${multiPrefix}-moveable-ptz-control`).boundingClientRect().exec(res => {
|
|
128
|
+
const rect = res === null || res === void 0 ? void 0 : res[0];
|
|
129
|
+
if (rect) {
|
|
130
|
+
componentSizeRef.current = {
|
|
131
|
+
width: rect.width,
|
|
132
|
+
height: rect.height
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}, 100);
|
|
137
|
+
}, [screenMode, selectedLenInfo]);
|
|
138
|
+
|
|
139
|
+
// 边界限制函数
|
|
140
|
+
// 注意:组件使用 bottom 定位,bottom 值越大组件越往上
|
|
141
|
+
const clampPosition = (left, bottom) => {
|
|
142
|
+
const {
|
|
143
|
+
width,
|
|
144
|
+
height
|
|
145
|
+
} = containerInfo.current;
|
|
146
|
+
const componentSize = componentSizeRef.current;
|
|
147
|
+
|
|
148
|
+
// 如果还没获取到组件尺寸,使用默认值
|
|
149
|
+
const compWidth = componentSize.width || 238;
|
|
150
|
+
const compHeight = componentSize.height || 172;
|
|
151
|
+
|
|
152
|
+
// 左右边界:0 到 容器宽度 - 组件宽度
|
|
153
|
+
const clampedLeft = Math.max(0, Math.min(left, width - compWidth));
|
|
154
|
+
// bottom 边界:
|
|
155
|
+
// - 最小值:控制栏高度(底部不能被控制栏遮挡)
|
|
156
|
+
// - 最大值:容器高度 - 组件高度(顶部不能超出容器)
|
|
157
|
+
const clampedBottom = Math.max(controlBarHeight, Math.min(bottom, height - compHeight));
|
|
158
|
+
return {
|
|
159
|
+
positionLeft: clampedLeft,
|
|
160
|
+
positionBottom: clampedBottom
|
|
161
|
+
};
|
|
162
|
+
};
|
|
88
163
|
const {
|
|
89
164
|
event
|
|
90
165
|
} = useContext(UIEventContext);
|
|
91
166
|
const ptzTimeId = useRef(null);
|
|
92
|
-
const ptzData =
|
|
93
|
-
|
|
167
|
+
const ptzData = useMemo(() => {
|
|
168
|
+
const data = getPtzData(devId);
|
|
169
|
+
return patchPtzDataShowByProtocol(data, multiCameraCtx.protocol, selectedLenInfo.index, multiCameraCtx.isSupport);
|
|
170
|
+
}, [devId, multiCameraCtx.isSupport, multiCameraCtx.protocol, selectedLenInfo.index]);
|
|
171
|
+
const zoomData = useMemo(() => {
|
|
172
|
+
const data = patchZoomDataShowByProtocol(getZoomData(devId), multiCameraCtx.isSupport);
|
|
173
|
+
return data.filter(item => item.show);
|
|
174
|
+
}, [devId, multiCameraCtx.isSupport]);
|
|
94
175
|
useEffect(() => {
|
|
95
176
|
const pages = getCurrentPages();
|
|
96
177
|
const page = pages[pages.length - 1];
|
|
97
178
|
const compTime = page.selectComponent('#moveable-ptz-control-move-view');
|
|
98
179
|
moveDomRef.current = compTime;
|
|
99
180
|
}, []);
|
|
181
|
+
|
|
182
|
+
// 停止所有 PTZ/Zoom 控制的方法
|
|
183
|
+
const stopAllControl = useMemoizedFn(async () => {
|
|
184
|
+
// 清除定时器
|
|
185
|
+
if (ptzTimeId.current) {
|
|
186
|
+
clearInterval(ptzTimeId.current);
|
|
187
|
+
ptzTimeId.current = null;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// 发送 PTZ 停止命令
|
|
191
|
+
const ptzStopConfig = dpSupportMap.ipc_multi_ptz_control ? {
|
|
192
|
+
code: 'ipc_multi_ptz_stop',
|
|
193
|
+
value: JSON.stringify({
|
|
194
|
+
index: selectedLenInfo.index
|
|
195
|
+
})
|
|
196
|
+
} : dpSupportMap.ptz_control ? {
|
|
197
|
+
code: 'ptz_stop',
|
|
198
|
+
value: true
|
|
199
|
+
} : null;
|
|
200
|
+
if (ptzStopConfig) {
|
|
201
|
+
const ptzStopData = await getDpIdByCode(devId, ptzStopConfig.code);
|
|
202
|
+
if (ptzStopData.code === 0) {
|
|
203
|
+
publishDps(devId, {
|
|
204
|
+
[ptzStopData.data]: ptzStopConfig.value
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// 发送 Zoom 停止命令
|
|
210
|
+
const zoomStopConfig = dpSupportMap.ipc_multi_zoom_control ? {
|
|
211
|
+
code: 'ipc_multi_zoom_stop',
|
|
212
|
+
value: JSON.stringify({
|
|
213
|
+
index: selectedLenInfo.index
|
|
214
|
+
})
|
|
215
|
+
} : dpSupportMap.zoom_control ? {
|
|
216
|
+
code: 'zoom_stop',
|
|
217
|
+
value: true
|
|
218
|
+
} : null;
|
|
219
|
+
if (zoomStopConfig) {
|
|
220
|
+
const zoomStopData = await getDpIdByCode(devId, zoomStopConfig.code);
|
|
221
|
+
if (zoomStopData.code === 0) {
|
|
222
|
+
publishDps(devId, {
|
|
223
|
+
[zoomStopData.data]: zoomStopConfig.value
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
console.info('PTZ/Zoom 控制已中止');
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// 记录上一次的镜头 index
|
|
231
|
+
const prevLenIndexRef = useRef(selectedLenInfo.index);
|
|
232
|
+
|
|
233
|
+
// 监听选中镜头变化,如果改变则停止 PTZ/Zoom 控制
|
|
234
|
+
useEffect(() => {
|
|
235
|
+
if (prevLenIndexRef.current !== selectedLenInfo.index) {
|
|
236
|
+
console.info('镜头切换,中止 PTZ/Zoom 控制', {
|
|
237
|
+
from: prevLenIndexRef.current,
|
|
238
|
+
to: selectedLenInfo.index
|
|
239
|
+
});
|
|
240
|
+
stopAllControl();
|
|
241
|
+
prevLenIndexRef.current = selectedLenInfo.index;
|
|
242
|
+
}
|
|
243
|
+
}, [selectedLenInfo.index, stopAllControl]);
|
|
100
244
|
useEffect(() => {
|
|
101
245
|
return () => {
|
|
102
246
|
if (ptzTimeId.current) {
|
|
@@ -112,22 +256,29 @@ export const MoveablePtzControlItem = props => {
|
|
|
112
256
|
event: touchEvent
|
|
113
257
|
} = data;
|
|
114
258
|
touchEvent.stopPropagation();
|
|
115
|
-
const
|
|
259
|
+
const dpValue = _get(_find(ptzData, {
|
|
260
|
+
type
|
|
261
|
+
}), 'dpValue', null);
|
|
262
|
+
const ptzConfig = dpSupportMap.ipc_multi_ptz_control ? {
|
|
263
|
+
code: 'ipc_multi_ptz_control',
|
|
264
|
+
value: JSON.stringify({
|
|
265
|
+
index: selectedLenInfo.index,
|
|
266
|
+
direction: dpValue
|
|
267
|
+
})
|
|
268
|
+
} : dpSupportMap.ptz_control ? {
|
|
269
|
+
code: 'ptz_control',
|
|
270
|
+
value: dpValue
|
|
271
|
+
} : null;
|
|
272
|
+
if (!ptzConfig) return;
|
|
273
|
+
const dpData = await getDpIdByCode(devId, ptzConfig.code);
|
|
116
274
|
if (dpData.code === 0) {
|
|
117
275
|
const ptzControlId = dpData.data;
|
|
118
|
-
const direction = _get(_find(ptzData.current, {
|
|
119
|
-
type
|
|
120
|
-
}), 'dpValue', null);
|
|
121
|
-
const sndDpValue = JSON.stringify({
|
|
122
|
-
index: selectedLenInfo.index,
|
|
123
|
-
direction
|
|
124
|
-
});
|
|
125
276
|
publishDps(devId, {
|
|
126
|
-
[ptzControlId]:
|
|
277
|
+
[ptzControlId]: ptzConfig.value
|
|
127
278
|
});
|
|
128
279
|
ptzTimeId.current = setInterval(() => {
|
|
129
280
|
publishDps(devId, {
|
|
130
|
-
[ptzControlId]:
|
|
281
|
+
[ptzControlId]: ptzConfig.value
|
|
131
282
|
});
|
|
132
283
|
}, 1000);
|
|
133
284
|
}
|
|
@@ -139,22 +290,29 @@ export const MoveablePtzControlItem = props => {
|
|
|
139
290
|
event: touchEvent
|
|
140
291
|
} = data;
|
|
141
292
|
touchEvent.stopPropagation();
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const sndDpValue = JSON.stringify({
|
|
293
|
+
const dpValue = _get(_find(zoomData, {
|
|
294
|
+
type
|
|
295
|
+
}), 'dpValue', null);
|
|
296
|
+
const zoomConfig = dpSupportMap.ipc_multi_zoom_control ? {
|
|
297
|
+
code: 'ipc_multi_zoom_control',
|
|
298
|
+
value: JSON.stringify({
|
|
149
299
|
index: selectedLenInfo.index,
|
|
150
|
-
control
|
|
151
|
-
})
|
|
300
|
+
control: dpValue
|
|
301
|
+
})
|
|
302
|
+
} : dpSupportMap.zoom_control ? {
|
|
303
|
+
code: 'zoom_control',
|
|
304
|
+
value: dpValue
|
|
305
|
+
} : null;
|
|
306
|
+
if (!zoomConfig) return;
|
|
307
|
+
const dpData = await getDpIdByCode(devId, zoomConfig.code);
|
|
308
|
+
if (dpData.code === 0) {
|
|
309
|
+
const zoomControlId = dpData.data;
|
|
152
310
|
publishDps(devId, {
|
|
153
|
-
[
|
|
311
|
+
[zoomControlId]: zoomConfig.value
|
|
154
312
|
});
|
|
155
313
|
ptzTimeId.current = setInterval(() => {
|
|
156
314
|
publishDps(devId, {
|
|
157
|
-
[
|
|
315
|
+
[zoomControlId]: zoomConfig.value
|
|
158
316
|
});
|
|
159
317
|
}, 1000);
|
|
160
318
|
}
|
|
@@ -177,8 +335,17 @@ export const MoveablePtzControlItem = props => {
|
|
|
177
335
|
pageX,
|
|
178
336
|
pageY
|
|
179
337
|
} = event.changedTouches[0];
|
|
338
|
+
const deltaX = pageX - pageStartRef.current.pageX;
|
|
339
|
+
const deltaY = pageY - pageStartRef.current.pageY;
|
|
340
|
+
const newLeft = style.positionLeft + deltaX;
|
|
341
|
+
const newBottom = style.positionBottom - deltaY;
|
|
342
|
+
|
|
343
|
+
// 应用边界限制
|
|
344
|
+
const clamped = clampPosition(newLeft, newBottom);
|
|
345
|
+
const clampedDeltaX = clamped.positionLeft - style.positionLeft;
|
|
346
|
+
const clampedDeltaY = style.positionBottom - clamped.positionBottom;
|
|
180
347
|
(_moveDomRef$current = moveDomRef.current) === null || _moveDomRef$current === void 0 || _moveDomRef$current.setStyle({
|
|
181
|
-
transform: `translateY(${
|
|
348
|
+
transform: `translateY(${clampedDeltaY}px) translateX(${clampedDeltaX}px)`
|
|
182
349
|
});
|
|
183
350
|
},
|
|
184
351
|
onTouchStart: event => {
|
|
@@ -208,30 +375,38 @@ export const MoveablePtzControlItem = props => {
|
|
|
208
375
|
const deltaY = pageY - pageStartRef.current.pageY;
|
|
209
376
|
const newPositionLeft = deltaX + style.positionLeft;
|
|
210
377
|
const newPositionBottom = style.positionBottom - deltaY;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
378
|
+
|
|
379
|
+
// 应用边界限制
|
|
380
|
+
const clamped = clampPosition(newPositionLeft, newPositionBottom);
|
|
381
|
+
onDragEnd === null || onDragEnd === void 0 || onDragEnd(clamped);
|
|
215
382
|
ty.nativeDisabled(false);
|
|
216
383
|
}
|
|
217
384
|
}, /*#__PURE__*/React.createElement(IpcPtzZoom, {
|
|
385
|
+
key: `ptz-zoom-${selectedLenInfo.index}`,
|
|
218
386
|
className: `${multiPrefix}-moveable-ptz-control`,
|
|
219
387
|
ptzSize: "172px",
|
|
220
388
|
zoomSize: "66px",
|
|
221
|
-
zoomData: selectedLenInfo.supportZoom ? zoomData
|
|
222
|
-
ptzData: selectedLenInfo.supportPTZ ? ptzData
|
|
389
|
+
zoomData: selectedLenInfo.supportZoom ? zoomData : [],
|
|
390
|
+
ptzData: selectedLenInfo.supportPTZ ? ptzData : [],
|
|
223
391
|
onTouchPtzStart: onTouchPtzStart,
|
|
224
392
|
onTouchPtzEnd: async () => {
|
|
225
393
|
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
226
|
-
const
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const sendDpValue = JSON.stringify({
|
|
394
|
+
const stopConfig = dpSupportMap.ipc_multi_ptz_control ? {
|
|
395
|
+
code: 'ipc_multi_ptz_stop',
|
|
396
|
+
value: JSON.stringify({
|
|
230
397
|
index: selectedLenInfo.index
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
398
|
+
})
|
|
399
|
+
} : dpSupportMap.ptz_control ? {
|
|
400
|
+
code: 'ptz_stop',
|
|
401
|
+
value: true
|
|
402
|
+
} : null;
|
|
403
|
+
if (stopConfig) {
|
|
404
|
+
const ptzStopData = await getDpIdByCode(devId, stopConfig.code);
|
|
405
|
+
if (ptzStopData.code === 0) {
|
|
406
|
+
publishDps(devId, {
|
|
407
|
+
[ptzStopData.data]: stopConfig.value
|
|
408
|
+
});
|
|
409
|
+
}
|
|
235
410
|
}
|
|
236
411
|
if (ptzTimeId.current) {
|
|
237
412
|
clearInterval(ptzTimeId.current);
|
|
@@ -241,15 +416,22 @@ export const MoveablePtzControlItem = props => {
|
|
|
241
416
|
onTouchZoomStart: onTouchZoomStart,
|
|
242
417
|
onTouchZoomEnd: async () => {
|
|
243
418
|
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
const sendDpValue = JSON.stringify({
|
|
419
|
+
const stopConfig = dpSupportMap.ipc_multi_zoom_control ? {
|
|
420
|
+
code: 'ipc_multi_zoom_stop',
|
|
421
|
+
value: JSON.stringify({
|
|
248
422
|
index: selectedLenInfo.index
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
423
|
+
})
|
|
424
|
+
} : dpSupportMap.zoom_control ? {
|
|
425
|
+
code: 'zoom_stop',
|
|
426
|
+
value: true
|
|
427
|
+
} : null;
|
|
428
|
+
if (stopConfig) {
|
|
429
|
+
const zoomStopData = await getDpIdByCode(devId, stopConfig.code);
|
|
430
|
+
if (zoomStopData.code === 0) {
|
|
431
|
+
publishDps(devId, {
|
|
432
|
+
[zoomStopData.data]: stopConfig.value
|
|
433
|
+
});
|
|
434
|
+
}
|
|
253
435
|
}
|
|
254
436
|
if (ptzTimeId.current) {
|
|
255
437
|
clearInterval(ptzTimeId.current);
|
|
@@ -9,7 +9,7 @@ import './index.less';
|
|
|
9
9
|
export function TileActions(props) {
|
|
10
10
|
return /*#__PURE__*/React.createElement(View, {
|
|
11
11
|
className: clsx(`${multiPrefix}-actions`)
|
|
12
|
-
}, /*#__PURE__*/React.createElement(
|
|
12
|
+
}, /*#__PURE__*/React.createElement(TileMultiPtz, _extends({}, props, {
|
|
13
13
|
className: `${multiPrefix}-action-wrap`
|
|
14
|
-
})));
|
|
14
|
+
})), /*#__PURE__*/React.createElement(TileSwitchLayout, props));
|
|
15
15
|
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { View, Text } from '@ray-js/ray';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useStore } from '../../ctx/store';
|
|
5
|
+
import { UIEventContext } from '../../ui/context';
|
|
6
|
+
import { widgetLabs, widgetClick } from '../../ui/constant';
|
|
5
7
|
import './muted.less';
|
|
6
8
|
export const Muted = props => {
|
|
7
9
|
const {
|
|
8
10
|
mute,
|
|
9
11
|
setMute,
|
|
10
|
-
className
|
|
12
|
+
className,
|
|
13
|
+
event: propsEvent
|
|
11
14
|
} = props;
|
|
15
|
+
const {
|
|
16
|
+
event: ctxEvent
|
|
17
|
+
} = useContext(UIEventContext);
|
|
18
|
+
const event = propsEvent !== null && propsEvent !== void 0 ? propsEvent : ctxEvent;
|
|
12
19
|
const {
|
|
13
20
|
isMuted
|
|
14
21
|
} = useStore({
|
|
@@ -17,15 +24,9 @@ export const Muted = props => {
|
|
|
17
24
|
return /*#__PURE__*/React.createElement(View, {
|
|
18
25
|
className: clsx(className),
|
|
19
26
|
onClick: () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// setIsMuted(!isMuted);
|
|
24
|
-
// },
|
|
25
|
-
// fail: res => {
|
|
26
|
-
// console.log('res===setMuted err', res);
|
|
27
|
-
// },
|
|
28
|
-
// });
|
|
27
|
+
event.emit(widgetClick, {
|
|
28
|
+
widgetId: widgetLabs.MUTED
|
|
29
|
+
});
|
|
29
30
|
setMute(!isMuted);
|
|
30
31
|
}
|
|
31
32
|
}, isMuted ? /*#__PURE__*/React.createElement(Text, {
|
package/lib/widgets/ptz/ptz.js
CHANGED
|
@@ -6,7 +6,7 @@ import { useMemoizedFn } from 'ahooks';
|
|
|
6
6
|
import { UIEventContext } from '../../ui/context';
|
|
7
7
|
import { usePtz } from '../../hooks';
|
|
8
8
|
import { useStore } from '../../ctx/store';
|
|
9
|
-
import { ptzControlId } from '../../ui/constant';
|
|
9
|
+
import { ptzControlId, widgetLabs, widgetClick } from '../../ui/constant';
|
|
10
10
|
import './ptz.less';
|
|
11
11
|
import { PtzControl } from './ptzControl';
|
|
12
12
|
export const Ptz = props => {
|
|
@@ -40,6 +40,9 @@ export const Ptz = props => {
|
|
|
40
40
|
}
|
|
41
41
|
}, [screenType]);
|
|
42
42
|
const onPtz = useMemoizedFn(() => {
|
|
43
|
+
event.emit(widgetClick, {
|
|
44
|
+
widgetId: widgetLabs.PTZ
|
|
45
|
+
});
|
|
43
46
|
if (!isPtzActive) {
|
|
44
47
|
showContent('bottomLeft', 'FullSmallIntercom');
|
|
45
48
|
if (!hasContent('absolute', ptzControlId)) {
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { View, Image, CoverView, Text, setStorage } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useStore } from '../../ctx/store';
|
|
5
|
-
import { ptzControlTipId } from '../../ui/constant';
|
|
5
|
+
import { ptzControlTipId, widgetLabs, widgetClick } from '../../ui/constant';
|
|
6
6
|
import { PlayState } from '../../interface';
|
|
7
7
|
import './ptzControlTip.less';
|
|
8
8
|
import { playerPtzControlTip } from '../../res';
|
|
@@ -20,6 +20,9 @@ export const PtzControlTip = props => {
|
|
|
20
20
|
});
|
|
21
21
|
// 获取缓存状态
|
|
22
22
|
const changeShowTipModal = () => {
|
|
23
|
+
props.event.emit(widgetClick, {
|
|
24
|
+
widgetId: widgetLabs.PTZ_CONTROL_TIP
|
|
25
|
+
});
|
|
23
26
|
setShowTipModal(false);
|
|
24
27
|
deleteContent('absolute', ptzControlTipId);
|
|
25
28
|
setStorage({
|