@ray-js/ipc-player-integration 0.0.57-beta.0 → 0.0.58-beta.1
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/README.md +0 -6
- package/lib/ctx/ctx.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +19 -4
- package/lib/ctx/ctx.js +106 -55
- package/lib/ctx/ports.output.d.ts +1 -0
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +9 -1
- package/lib/ctx/useAutoClarityConfig.d.ts +8 -0
- package/lib/ctx/useAutoClarityConfig.js +40 -0
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +16 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +17 -60
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +45 -60
- package/lib/utils/captureResult.d.ts +14 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +117 -0
- package/lib/utils/productAbility.d.ts +6 -0
- package/lib/utils/productAbility.js +20 -0
- package/lib/utils/ttt.js +2 -8
- package/lib/widgets/battery/battery.js +1 -2
- package/lib/widgets/battery/batteryFull.js +1 -2
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +80 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +1 -2
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +1 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
- package/lib/widgets/multiCamera/multiPtz.js +1 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- package/lib/widgets/muted/muted.js +10 -5
- package/lib/widgets/muted/muted.less +5 -1
- package/lib/widgets/muted/muted.test.d.ts +1 -0
- package/lib/widgets/muted/muted.test.js +81 -0
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +66 -45
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +120 -0
- package/lib/widgets/signal4G/signal4G.js +1 -4
- package/lib/widgets/siren/siren.js +1 -2
- package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
- package/lib/widgets/trialBadge/index.js +3 -8
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/tryExperience/tryExperience.js +1 -3
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
- package/lib/widgets/zoomTurntable/turntable/index.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +1 -2
- package/package.json +8 -15
- package/lib/renderer/capabilities.d.ts +0 -8
- package/lib/renderer/capabilities.js +0 -19
- package/lib/renderer/context.d.ts +0 -5
- package/lib/renderer/context.js +0 -6
- package/lib/renderer/directionControl.d.ts +0 -6
- package/lib/renderer/directionControl.js +0 -3
- package/lib/renderer/font.less +0 -5
- package/lib/renderer/glyphs.d.ts +0 -1
- package/lib/renderer/glyphs.js +0 -256
- package/lib/renderer/index.module.less +0 -48
- package/lib/renderer/ptzZoom.d.ts +0 -6
- package/lib/renderer/ptzZoom.js +0 -3
- package/lib/renderer/text.d.ts +0 -4
- package/lib/renderer/text.js +0 -32
- package/lib/renderer/text.module.less +0 -4
- package/lib/renderer/viewport.d.ts +0 -7
- package/lib/renderer/viewport.js +0 -24
- package/lib/res/lynx-signal/index.d.ts +0 -1
- package/lib/res/lynx-signal/index.js +0 -22
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* 全屏状态下要添加的摄像机行进路线控件
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import RectDirectionControl from '
|
|
5
|
+
import RectDirectionControl from '@ray-js/direction-control';
|
|
6
6
|
import type { ComponentConfigProps } from '../../interface';
|
|
7
7
|
type RectDirectionControlProps = React.ComponentProps<typeof RectDirectionControl>;
|
|
8
8
|
export type FullTravelRouteControlProps = ComponentConfigProps & {
|
|
@@ -6,8 +6,8 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
6
6
|
import React, { useEffect, useContext, useState, useRef } from 'react';
|
|
7
7
|
import { View } from '@ray-js/ray';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
+
import RectDirectionControl from '@ray-js/direction-control';
|
|
9
10
|
import { useMemoizedFn } from 'ahooks';
|
|
10
|
-
import RectDirectionControl from '../../renderer/directionControl';
|
|
11
11
|
import { UIEventContext } from '../../ui/context';
|
|
12
12
|
import { useDpState } from '../../hooks';
|
|
13
13
|
import { useComponentHideState } from '../../ui/hooks';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import './verticalScreen.less';
|
|
6
5
|
const NILL = () => null;
|
|
7
6
|
export function VerticalScreen(_ref) {
|
package/lib/widgets/index.d.ts
CHANGED
package/lib/widgets/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { UIEventContext } from '../../ui/context';
|
|
7
6
|
import { hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
@@ -4,8 +4,6 @@ import "core-js/modules/esnext.iterator.map.js";
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { View, ScrollView, CoverView } from '@ray-js/ray';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { usePlayerRenderMode } from '../../renderer/context';
|
|
8
|
-
import { PlayerText } from '../../renderer/text';
|
|
9
7
|
import './moveInteractiveControlUI.less';
|
|
10
8
|
const defaultMenu = [{
|
|
11
9
|
key: '0',
|
|
@@ -64,7 +62,6 @@ const defaultCSSVariable = {
|
|
|
64
62
|
'--activeColor': '#FF592A'
|
|
65
63
|
};
|
|
66
64
|
export function MoveInterActiveControlUI(props) {
|
|
67
|
-
const isLynx = usePlayerRenderMode() === 'lynx';
|
|
68
65
|
const {
|
|
69
66
|
contentClsName,
|
|
70
67
|
wrapClsName,
|
|
@@ -83,17 +80,13 @@ export function MoveInterActiveControlUI(props) {
|
|
|
83
80
|
// @ts-ignore
|
|
84
81
|
, {
|
|
85
82
|
style: _objectSpread({}, CSSVariable),
|
|
86
|
-
className: clsx('ipc-player-plugin-active-control-wrap', wrapClsName
|
|
87
|
-
'ipc-player-plugin-active-control-wrap-lynx': isLynx,
|
|
88
|
-
'ipc-player-plugin-active-control-wrap-webview': !isLynx
|
|
89
|
-
})
|
|
83
|
+
className: clsx('ipc-player-plugin-active-control-wrap', wrapClsName)
|
|
90
84
|
}, /*#__PURE__*/React.createElement(View, {
|
|
91
85
|
className: clsx('ipc-player-plugin-active-control-title')
|
|
92
86
|
}, I18n.t('homeFeatureInteractiveMenuTitle')), /*#__PURE__*/React.createElement(ScrollView, {
|
|
93
87
|
style: {
|
|
94
88
|
flex: 1
|
|
95
89
|
},
|
|
96
|
-
className: isLynx ? 'ipc-player-plugin-active-control-scroll-lynx' : undefined,
|
|
97
90
|
scrollY: true
|
|
98
91
|
}, /*#__PURE__*/React.createElement(View, {
|
|
99
92
|
className: clsx('ipc-player-plugin-active-control', contentClsName)
|
|
@@ -105,11 +98,9 @@ export function MoveInterActiveControlUI(props) {
|
|
|
105
98
|
})
|
|
106
99
|
}, /*#__PURE__*/React.createElement(View, {
|
|
107
100
|
className: clsx('ipc-player-plugin-active-control-item-icon')
|
|
108
|
-
},
|
|
101
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
109
102
|
className: clsx('ipc-player-plugin-active-control-item-icon-mask')
|
|
110
|
-
}),
|
|
111
|
-
className: clsx('icon-panel', item.iconName, 'ipc-player-plugin-interactive-icon')
|
|
112
|
-
}) : /*#__PURE__*/React.createElement(View, {
|
|
103
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
113
104
|
className: clsx('icon-panel', item.iconName, 'ipc-player-plugin-interactive-icon')
|
|
114
105
|
})), /*#__PURE__*/React.createElement(View, {
|
|
115
106
|
className: clsx('ipc-player-plugin-active-control-item-title')
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
.ipc-player-plugin-active-control-item-icon {
|
|
46
|
+
position: relative;
|
|
47
|
+
z-index: 1;
|
|
46
48
|
width: calc(42px * var(--ipc-player-size-scale, 1));
|
|
47
49
|
height: calc(42px * var(--ipc-player-size-scale, 1));
|
|
48
50
|
border-radius: calc(42px * var(--ipc-player-size-scale, 1));
|
|
@@ -52,6 +54,7 @@
|
|
|
52
54
|
justify-content: center;
|
|
53
55
|
font-size: calc(16px * var(--ipc-player-size-scale, 1));
|
|
54
56
|
color: var(--color);
|
|
57
|
+
overflow: hidden;
|
|
55
58
|
.ipc-player-plugin-active-control-item-icon-mask {
|
|
56
59
|
position: absolute;
|
|
57
60
|
width: 100%;
|
|
@@ -61,14 +64,6 @@
|
|
|
61
64
|
opacity: 1;
|
|
62
65
|
}
|
|
63
66
|
}
|
|
64
|
-
|
|
65
|
-
.ipc-player-plugin-active-control-wrap-webview {
|
|
66
|
-
.ipc-player-plugin-active-control-item-icon {
|
|
67
|
-
position: relative;
|
|
68
|
-
z-index: 1;
|
|
69
|
-
overflow: hidden;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
67
|
.ipc-player-plugin-active-control-item-title {
|
|
73
68
|
width: calc(70px * var(--ipc-player-size-scale, 1));
|
|
74
69
|
white-space: nowrap; /* 防止文本换行 */
|
|
@@ -78,19 +73,4 @@
|
|
|
78
73
|
}
|
|
79
74
|
.ipc-player-plugin-interactive-icon {
|
|
80
75
|
font-size: calc(20px * var(--ipc-player-size-scale, 1));;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.ipc-player-plugin-active-control-wrap-lynx {
|
|
84
|
-
min-height: 0;
|
|
85
|
-
|
|
86
|
-
.ipc-player-plugin-active-control-scroll-lynx {
|
|
87
|
-
height: 0;
|
|
88
|
-
min-height: 0;
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.ipc-player-plugin-active-control-item-icon {
|
|
93
|
-
// The background belongs to the scrolling card, not a separate absolute layer.
|
|
94
|
-
background: var(--iconBgColor);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
76
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, CoverView } from '@ray-js/ray';
|
|
2
|
+
import { View, CoverView, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { landscapeTipId } from '../../ui/constant';
|
|
7
6
|
import { PlayState } from '../../interface';
|
|
@@ -7,7 +7,7 @@ import { getDpIdByCode, publishDps } from '@ray-js/ray-ipc-utils';
|
|
|
7
7
|
import _find from 'lodash/find';
|
|
8
8
|
import _get from 'lodash/get';
|
|
9
9
|
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
|
-
import IpcPtzZoom from '
|
|
10
|
+
import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
|
|
11
11
|
import { useStore } from '../../ctx/store';
|
|
12
12
|
import { useMemoizedFn } from '../../hooks';
|
|
13
13
|
import { MultiCameraScreenMode } from '../../interface';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import { useStore } from '../../ctx/store';
|
|
8
7
|
import './index.less';
|
|
9
8
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { View, CoverView } from '@ray-js/ray';
|
|
2
|
+
import { View, CoverView, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { ptzMoveableTipId } from '../../ui/constant';
|
|
7
6
|
import { PlayState } from '../../interface';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { Text, View } from '@ray-js/ray';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { MultiCameraLayoutStyle, MultiCameraScreenMode } from '../../interface';
|
|
7
6
|
import { multiPrefix } from './constants';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { useMemoizedFn } from 'ahooks';
|
|
6
6
|
import Color from 'color';
|
|
7
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
8
7
|
import { useStore } from '../../ctx/store';
|
|
9
8
|
import { multiPrefix } from './constants';
|
|
10
9
|
import './index.less';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { View, Text } from '@ray-js/ray';
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { MultiCameraLayoutStyle } from '../../interface';
|
|
6
5
|
import { multiPrefix } from './constants';
|
|
7
6
|
import { useStore } from '../../ctx/store';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, CoverView } from '@ray-js/ray';
|
|
2
|
+
import { View, CoverView, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { tileTipId } from '../../ui/constant';
|
|
7
6
|
import { PlayState } from '../../interface';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { View, Text } from '@ray-js/ray';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { UIEventContext } from '../../ui/context';
|
|
7
6
|
import { widgetLabs, widgetClick, pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
|
|
@@ -18,13 +17,19 @@ export const Muted = props => {
|
|
|
18
17
|
} = useContext(UIEventContext);
|
|
19
18
|
const event = propsEvent !== null && propsEvent !== void 0 ? propsEvent : ctxEvent;
|
|
20
19
|
const {
|
|
21
|
-
isMuted
|
|
20
|
+
isMuted,
|
|
21
|
+
intercom
|
|
22
22
|
} = useStore({
|
|
23
|
-
isMuted: mute
|
|
23
|
+
isMuted: mute,
|
|
24
|
+
intercom: props.intercom
|
|
24
25
|
});
|
|
26
|
+
const disabled = intercom;
|
|
25
27
|
return /*#__PURE__*/React.createElement(View, {
|
|
26
|
-
className: clsx(className
|
|
28
|
+
className: clsx(className, {
|
|
29
|
+
'ipc-player-plugin-muted-disabled': disabled
|
|
30
|
+
}),
|
|
27
31
|
onClick: () => {
|
|
32
|
+
if (disabled) return;
|
|
28
33
|
event.emit(widgetClick, {
|
|
29
34
|
widgetId: widgetLabs.MUTED
|
|
30
35
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-hooks/dom';
|
|
2
|
+
import { atom, getDefaultStore } from 'jotai';
|
|
3
|
+
import { IntercomMode } from '../../interface';
|
|
4
|
+
import { Muted } from './muted';
|
|
5
|
+
jest.mock('@ray-js/ray', () => ({
|
|
6
|
+
View: 'div',
|
|
7
|
+
Text: 'span'
|
|
8
|
+
}));
|
|
9
|
+
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
|
|
10
|
+
IntercomMode: {
|
|
11
|
+
OneWay: 'OneWay',
|
|
12
|
+
TwoWay: 'TwoWay'
|
|
13
|
+
}
|
|
14
|
+
}));
|
|
15
|
+
jest.mock('./muted.less', () => ({}));
|
|
16
|
+
const createProps = function () {
|
|
17
|
+
let talking = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
18
|
+
let mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IntercomMode.OneWay;
|
|
19
|
+
let muted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
20
|
+
return {
|
|
21
|
+
mute: atom(muted),
|
|
22
|
+
intercom: atom(talking),
|
|
23
|
+
intercomMode: atom(mode),
|
|
24
|
+
setMute: jest.fn(),
|
|
25
|
+
event: {
|
|
26
|
+
emit: jest.fn()
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
it.each([[IntercomMode.OneWay, true], [IntercomMode.OneWay, false], [IntercomMode.TwoWay, true], [IntercomMode.TwoWay, false]])('blocks speaker changes and control events during talk in mode=%s, muted=%s', (mode, muted) => {
|
|
31
|
+
const props = createProps(true, mode, muted);
|
|
32
|
+
const {
|
|
33
|
+
result,
|
|
34
|
+
unmount
|
|
35
|
+
} = renderHook(() => Muted(props));
|
|
36
|
+
act(() => result.current.props.onClick());
|
|
37
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
38
|
+
expect(props.event.emit).not.toHaveBeenCalled();
|
|
39
|
+
expect(result.current.props.className).toContain('ipc-player-plugin-muted-disabled');
|
|
40
|
+
unmount();
|
|
41
|
+
});
|
|
42
|
+
it.each([[false, IntercomMode.OneWay, true, false], [false, IntercomMode.OneWay, false, true], [false, IntercomMode.TwoWay, true, false], [false, IntercomMode.TwoWay, false, true]])('keeps speaker switching when talking=%s, mode=%s, muted=%s', (talking, mode, muted, target) => {
|
|
43
|
+
const props = createProps(talking, mode, muted);
|
|
44
|
+
const {
|
|
45
|
+
result,
|
|
46
|
+
unmount
|
|
47
|
+
} = renderHook(() => Muted(props));
|
|
48
|
+
act(() => result.current.props.onClick());
|
|
49
|
+
expect(props.setMute).toHaveBeenCalledTimes(1);
|
|
50
|
+
expect(props.setMute).toHaveBeenCalledWith(target);
|
|
51
|
+
expect(result.current.props.className).not.toContain('ipc-player-plugin-muted-disabled');
|
|
52
|
+
unmount();
|
|
53
|
+
});
|
|
54
|
+
it.each([IntercomMode.OneWay, IntercomMode.TwoWay])('uses shared talk state after remount and unlocks when talk ends in mode=%s', mode => {
|
|
55
|
+
const props = createProps(false, mode);
|
|
56
|
+
const store = getDefaultStore();
|
|
57
|
+
const first = renderHook(() => Muted(props));
|
|
58
|
+
act(() => store.set(props.intercom, true));
|
|
59
|
+
act(() => first.result.current.props.onClick());
|
|
60
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
61
|
+
first.unmount();
|
|
62
|
+
const second = renderHook(() => Muted(props));
|
|
63
|
+
act(() => second.result.current.props.onClick());
|
|
64
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
65
|
+
act(() => store.set(props.intercom, false));
|
|
66
|
+
act(() => second.result.current.props.onClick());
|
|
67
|
+
expect(props.setMute).toHaveBeenCalledWith(false);
|
|
68
|
+
second.unmount();
|
|
69
|
+
});
|
|
70
|
+
it.each([[IntercomMode.OneWay, IntercomMode.TwoWay], [IntercomMode.TwoWay, IntercomMode.OneWay]])('keeps the speaker locked when active talk changes from %s to %s', (mode, nextMode) => {
|
|
71
|
+
const props = createProps(true, mode);
|
|
72
|
+
const {
|
|
73
|
+
result,
|
|
74
|
+
unmount
|
|
75
|
+
} = renderHook(() => Muted(props));
|
|
76
|
+
act(() => getDefaultStore().set(props.intercomMode, nextMode));
|
|
77
|
+
act(() => result.current.props.onClick());
|
|
78
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
79
|
+
expect(props.event.emit).not.toHaveBeenCalled();
|
|
80
|
+
unmount();
|
|
81
|
+
});
|
package/lib/widgets/ptz/ptz.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React, { useEffect, useState, useContext } from 'react';
|
|
5
5
|
import { useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import { UIEventContext } from '../../ui/context';
|
|
8
7
|
import { usePtz } from '../../hooks';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -4,8 +4,8 @@ import { CoverView } from '@ray-js/ray';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import _find from 'lodash/find';
|
|
6
6
|
import _get from 'lodash/get';
|
|
7
|
+
import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
|
|
7
8
|
import { getDpIdByCode, publishDps } from '@ray-js/ray-ipc-utils';
|
|
8
|
-
import IpcPtzZoom from '../../renderer/ptzZoom';
|
|
9
9
|
import { Storage } from '../../utils/storage';
|
|
10
10
|
import { useMemoizedFn } from '../../hooks';
|
|
11
11
|
import { useComponentHideState } from '../../ui/hooks';
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, Image, CoverView, setStorage } from '@ray-js/ray';
|
|
2
|
+
import { View, Image, CoverView, Text, setStorage } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
|
-
import { usePlayerRenderMode } from '../../renderer/context';
|
|
6
4
|
import { useStore } from '../../ctx/store';
|
|
7
5
|
import { ptzControlTipId, widgetLabs, widgetClick } from '../../ui/constant';
|
|
8
6
|
import { PlayState } from '../../interface';
|
|
@@ -14,7 +12,6 @@ export const PtzControlTip = props => {
|
|
|
14
12
|
devId,
|
|
15
13
|
deleteContent
|
|
16
14
|
} = props;
|
|
17
|
-
const isLynx = usePlayerRenderMode() === 'lynx';
|
|
18
15
|
const [showTipModal, setShowTipModal] = useState(true);
|
|
19
16
|
const {
|
|
20
17
|
playState
|
|
@@ -37,9 +34,9 @@ export const PtzControlTip = props => {
|
|
|
37
34
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
38
35
|
className: clsx('playerControlTipContainer')
|
|
39
36
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
40
|
-
mode:
|
|
37
|
+
mode: "widthFix",
|
|
41
38
|
src: playerPtzControlTip,
|
|
42
|
-
className: clsx('controlTipImage'
|
|
39
|
+
className: clsx('controlTipImage')
|
|
43
40
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
44
41
|
className: clsx('controlTipText')
|
|
45
42
|
}, Strings.getLang('ipc_player_ptz_control_tip')), /*#__PURE__*/React.createElement(View, {
|
|
@@ -39,9 +39,3 @@
|
|
|
39
39
|
color: #ffffff;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
// Original PNG is 404 x 158. Lynx needs both dimensions; widthFix is WebView-only.
|
|
44
|
-
.playerControlTipContainer .controlTipImageLynx {
|
|
45
|
-
height: calc(66.4851485149px * var(--ipc-player-size-scale, 1));
|
|
46
|
-
flex-shrink: 0;
|
|
47
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { View } from '@ray-js/ray';
|
|
2
|
+
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { PlayState } from '../../interface';
|
|
6
5
|
import { useStore } from '../../ctx/store';
|
|
7
6
|
import { useDpSupport } from '../../hooks/useDpSupport';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, Text, getSystemInfoSync } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { PlayState } from '../../interface';
|
|
8
|
+
import { getCaptureResultSummary } from '../../utils/captureResult';
|
|
9
|
+
import { CaptureResultToast } from '../captureResult/captureResult';
|
|
9
10
|
import { UIEventContext } from '../../ui/context';
|
|
10
11
|
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
|
|
11
12
|
import { useStore, getDefaultStore } from '../../ctx/store';
|
|
@@ -101,22 +102,45 @@ export function RecordVideo(props) {
|
|
|
101
102
|
playState: props.playState
|
|
102
103
|
});
|
|
103
104
|
const [state, setState] = useSetState({
|
|
104
|
-
showTimer: false,
|
|
105
105
|
showShot: false,
|
|
106
|
-
shotUrl: ''
|
|
106
|
+
shotUrl: '',
|
|
107
|
+
shotCount: 0
|
|
107
108
|
});
|
|
109
|
+
const recordResultRequestIdRef = useRef(0);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
return () => {
|
|
112
|
+
recordResultRequestIdRef.current += 1;
|
|
113
|
+
};
|
|
114
|
+
}, []);
|
|
115
|
+
const showRecordResult = async recordInfo => {
|
|
116
|
+
var _props$multiCameraCtx;
|
|
117
|
+
const requestId = ++recordResultRequestIdRef.current;
|
|
118
|
+
const splitNum = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.total_split_num;
|
|
119
|
+
const summary = await getCaptureResultSummary(recordInfo, {
|
|
120
|
+
multiLens: props.multiLens,
|
|
121
|
+
protocolCount: splitNum,
|
|
122
|
+
devId
|
|
123
|
+
});
|
|
124
|
+
if (requestId !== recordResultRequestIdRef.current) return;
|
|
125
|
+
if (!summary) return;
|
|
126
|
+
setState({
|
|
127
|
+
showShot: true,
|
|
128
|
+
shotUrl: summary.thumbnailPath,
|
|
129
|
+
shotCount: summary.isMultiLens ? summary.count : 0
|
|
130
|
+
});
|
|
131
|
+
};
|
|
108
132
|
|
|
109
133
|
/**
|
|
110
134
|
* 针对 playState为非连接中状态时,如果处于录制中, 结束录制
|
|
111
135
|
*/
|
|
112
136
|
useEffect(() => {
|
|
113
137
|
(async () => {
|
|
114
|
-
if (playState !== PlayState.PLAYING) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
138
|
+
if (playState !== PlayState.PLAYING && recording) {
|
|
139
|
+
try {
|
|
140
|
+
const recordInfo = await setRecording(false);
|
|
141
|
+
await showRecordResult(recordInfo);
|
|
142
|
+
} catch {
|
|
143
|
+
// setRecording reports the native failure through the configured toast.
|
|
120
144
|
}
|
|
121
145
|
}
|
|
122
146
|
})();
|
|
@@ -130,7 +154,8 @@ export function RecordVideo(props) {
|
|
|
130
154
|
timer.current = setTimeout(() => {
|
|
131
155
|
setState({
|
|
132
156
|
showShot: false,
|
|
133
|
-
shotUrl: ''
|
|
157
|
+
shotUrl: '',
|
|
158
|
+
shotCount: 0
|
|
134
159
|
});
|
|
135
160
|
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
136
161
|
}, CLOSE_TIME);
|
|
@@ -150,22 +175,20 @@ export function RecordVideo(props) {
|
|
|
150
175
|
showRecordToast();
|
|
151
176
|
}
|
|
152
177
|
}, [state.showShot, screenType]);
|
|
153
|
-
|
|
154
|
-
/** 根据showTimer的显示定时器 */
|
|
155
178
|
useUpdateEffect(() => {
|
|
156
|
-
if (
|
|
179
|
+
if (recording) {
|
|
157
180
|
showRecordTimer();
|
|
158
181
|
} else {
|
|
159
182
|
deleteContent('absolute', RECORD_VIDEO_TIMER_ID);
|
|
160
|
-
// 清除定时器,元素移除
|
|
161
183
|
}
|
|
162
|
-
}, [
|
|
184
|
+
}, [recording]);
|
|
163
185
|
|
|
164
186
|
/** 跳转相册 */
|
|
165
187
|
const handCheck = () => {
|
|
166
188
|
setState({
|
|
167
189
|
showShot: false,
|
|
168
|
-
shotUrl: ''
|
|
190
|
+
shotUrl: '',
|
|
191
|
+
shotCount: 0
|
|
169
192
|
});
|
|
170
193
|
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
171
194
|
clearInterval(timer.current);
|
|
@@ -187,27 +210,13 @@ export function RecordVideo(props) {
|
|
|
187
210
|
marginLeft: screenType === 'vertical' ? '0' : '-200px'
|
|
188
211
|
},
|
|
189
212
|
content: () => {
|
|
190
|
-
return /*#__PURE__*/React.createElement(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
198
|
-
className: "ipc-player-plugin-record-success-play-icon-box"
|
|
199
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
200
|
-
className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-record-success-play-icon')
|
|
201
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
202
|
-
className: "ipc-player-plugin-record-success-toast-title"
|
|
203
|
-
}, Strings.getLang('ipc_player_record_success_tip')), /*#__PURE__*/React.createElement(View, {
|
|
204
|
-
onClick: handCheck,
|
|
205
|
-
className: "ipc-player-plugin-record-success-toast-bottom",
|
|
206
|
-
style: {
|
|
207
|
-
color: brandColor,
|
|
208
|
-
borderColor: brandColor
|
|
209
|
-
}
|
|
210
|
-
}, Strings.getLang('ipc_player_record_success_check')));
|
|
213
|
+
return /*#__PURE__*/React.createElement(CaptureResultToast, {
|
|
214
|
+
brandColor: brandColor,
|
|
215
|
+
count: state.shotCount,
|
|
216
|
+
kind: "record",
|
|
217
|
+
onCheck: handCheck,
|
|
218
|
+
thumbnailPath: state.shotUrl
|
|
219
|
+
});
|
|
211
220
|
}
|
|
212
221
|
});
|
|
213
222
|
timeToCloseRecordToast();
|
|
@@ -219,8 +228,8 @@ export function RecordVideo(props) {
|
|
|
219
228
|
absoluteContentClassName: 'ipc-player-plugin-record-video-toast-wrap',
|
|
220
229
|
content: () => /*#__PURE__*/React.createElement(View, {
|
|
221
230
|
className: clsx('ipc-player-plugin-record-video-toast', {
|
|
222
|
-
'ipc-player-plugin-record-video-toast-show':
|
|
223
|
-
'ipc-player-plugin-record-video-toast-hide': !
|
|
231
|
+
'ipc-player-plugin-record-video-toast-show': recording,
|
|
232
|
+
'ipc-player-plugin-record-video-toast-hide': !recording
|
|
224
233
|
})
|
|
225
234
|
}, /*#__PURE__*/React.createElement(View, {
|
|
226
235
|
className: "ipc-player-plugin-record-video-toast-point",
|
|
@@ -231,9 +240,9 @@ export function RecordVideo(props) {
|
|
|
231
240
|
});
|
|
232
241
|
};
|
|
233
242
|
const handRecordVideo = async () => {
|
|
234
|
-
var _props$event
|
|
243
|
+
var _props$event;
|
|
235
244
|
const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
|
|
236
|
-
|
|
245
|
+
ev.emit(widgetClick, {
|
|
237
246
|
widgetId: widgetLabs.RECORD_VIDEO
|
|
238
247
|
});
|
|
239
248
|
event.emit(pauseTimeToHideAllComponent);
|
|
@@ -243,6 +252,7 @@ export function RecordVideo(props) {
|
|
|
243
252
|
if (recordingDisabled) {
|
|
244
253
|
return false;
|
|
245
254
|
}
|
|
255
|
+
recordResultRequestIdRef.current += 1;
|
|
246
256
|
if (state.showShot && _recording) {
|
|
247
257
|
setState({
|
|
248
258
|
showShot: false
|
|
@@ -263,18 +273,11 @@ export function RecordVideo(props) {
|
|
|
263
273
|
}
|
|
264
274
|
if (target) {
|
|
265
275
|
setRecordingDisabled(true);
|
|
266
|
-
setState({
|
|
267
|
-
showTimer: true
|
|
268
|
-
});
|
|
269
276
|
/** 录制开始后3秒后才可结束 */
|
|
270
277
|
timeToResetRecordDisabled();
|
|
271
278
|
} else {
|
|
272
279
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
|
|
273
|
-
|
|
274
|
-
showTimer: false,
|
|
275
|
-
showShot: true,
|
|
276
|
-
shotUrl: recordInfo.tempImagePath
|
|
277
|
-
});
|
|
280
|
+
await showRecordResult(recordInfo);
|
|
278
281
|
}
|
|
279
282
|
} catch (err) {
|
|
280
283
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
|
|
@@ -284,9 +287,6 @@ export function RecordVideo(props) {
|
|
|
284
287
|
toast({
|
|
285
288
|
title: errMsg
|
|
286
289
|
});
|
|
287
|
-
setState({
|
|
288
|
-
showTimer: false
|
|
289
|
-
});
|
|
290
290
|
}
|
|
291
291
|
return true;
|
|
292
292
|
};
|