@ray-js/ipc-player-integration 0.0.65-beta.3 → 0.0.66-beta.0
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 +6 -0
- package/lib/ctx/ctx.composition.js +3 -13
- package/lib/ctx/ctx.js +35 -46
- package/lib/ctx/multiCameraCtx.d.ts +0 -2
- package/lib/ctx/multiCameraCtx.js +1 -17
- package/lib/i18n/index.d.ts +0 -12
- package/lib/i18n/strings.d.ts +0 -6
- package/lib/i18n/strings.js +0 -6
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -1
- package/lib/interface.d.ts +3 -17
- package/lib/renderer/capabilities.d.ts +8 -0
- package/lib/renderer/capabilities.js +19 -0
- package/lib/renderer/context.d.ts +5 -0
- package/lib/renderer/context.js +6 -0
- package/lib/renderer/directionControl.d.ts +6 -0
- package/lib/renderer/directionControl.js +3 -0
- package/lib/renderer/font.less +5 -0
- package/lib/renderer/glyphs.d.ts +1 -0
- package/lib/renderer/glyphs.js +256 -0
- package/lib/renderer/index.module.less +48 -0
- package/lib/renderer/ptzZoom.d.ts +6 -0
- package/lib/renderer/ptzZoom.js +3 -0
- package/lib/renderer/text.d.ts +4 -0
- package/lib/renderer/text.js +32 -0
- package/lib/renderer/text.module.less +4 -0
- package/lib/renderer/viewport.d.ts +7 -0
- package/lib/renderer/viewport.js +24 -0
- package/lib/res/lynx-signal/index.d.ts +1 -0
- package/lib/res/lynx-signal/index.js +22 -0
- 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
- package/lib/res/player-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/bottomLeftContent.js +119 -55
- package/lib/ui/bottomRightContent.js +6 -3
- package/lib/ui/scrollHintArrow.d.ts +23 -0
- package/lib/ui/scrollHintArrow.js +82 -0
- package/lib/ui/ui.d.ts +5 -0
- package/lib/ui/ui.js +89 -98
- package/lib/utils/navigation.d.ts +1 -2
- package/lib/utils/navigation.js +3 -13
- package/lib/widgets/battery/battery.js +7 -5
- package/lib/widgets/battery/batteryFull.js +7 -5
- package/lib/widgets/battery/statusIcon.d.ts +6 -0
- package/lib/widgets/battery/statusIcon.js +36 -0
- package/lib/widgets/battery/statusIcon.less +24 -0
- package/lib/widgets/floodlight/floodlight.js +2 -1
- package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
- package/lib/widgets/fullScreen/fullScreen.js +2 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +2 -1
- package/lib/widgets/index.d.ts +0 -1
- package/lib/widgets/index.js +1 -2
- package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
- package/lib/widgets/multiCamera/index.less +0 -1
- package/lib/widgets/multiCamera/landscapeTip.js +2 -1
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +3 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
- package/lib/widgets/multiCamera/switchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileMultiPtz.js +3 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileTip.js +2 -1
- package/lib/widgets/muted/muted.js +2 -1
- package/lib/widgets/muted/muted.test.js +66 -52
- package/lib/widgets/ptz/ptz.js +2 -1
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
- package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +74 -17
- package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
- package/lib/widgets/resolution/fullResolutionControl.js +29 -19
- package/lib/widgets/resolution/resolution.js +3 -2
- package/lib/widgets/screenshot/screenshot.js +45 -66
- package/lib/widgets/screenshot/screenshot.less +40 -1
- package/lib/widgets/signal4G/signal4G.js +4 -1
- package/lib/widgets/siren/siren.js +2 -1
- package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
- package/lib/widgets/trialBadge/index.d.ts +1 -2
- package/lib/widgets/trialBadge/index.js +17 -20
- package/lib/widgets/trialBadge/index.less +24 -0
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
- package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
- package/lib/widgets/tryExperience/tryExperience.js +2 -1
- package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
- package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
- package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +6 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
- package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +2 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +31 -18
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +23 -3
- package/package.json +15 -7
- package/lib/ctx/ctx.album.test.d.ts +0 -1
- package/lib/ctx/ctx.album.test.js +0 -197
- package/lib/ctx/multiCameraCtx.test.d.ts +0 -1
- package/lib/ctx/multiCameraCtx.test.js +0 -65
- package/lib/ui/absoluteContent.d.ts +0 -2
- package/lib/ui/absoluteContent.js +0 -3
- package/lib/utils/captureResult.d.ts +0 -14
- package/lib/utils/captureResult.js +0 -70
- package/lib/utils/captureResult.test.d.ts +0 -1
- package/lib/utils/captureResult.test.js +0 -117
- package/lib/utils/fullLinkTracking.d.ts +0 -5
- package/lib/utils/fullLinkTracking.js +0 -71
- package/lib/widgets/captureResult/captureResult.d.ts +0 -16
- package/lib/widgets/captureResult/captureResult.js +0 -85
- package/lib/widgets/captureResult/captureResult.less +0 -144
- package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
- package/lib/widgets/captureResult/captureResult.test.js +0 -80
- package/lib/widgets/captureResult/index.d.ts +0 -2
- package/lib/widgets/captureResult/index.js +0 -2
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
- package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
- package/lib/widgets/screenshot/screenshot.test.js +0 -120
package/lib/widgets/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
import { PlayerText as Text } from '../../renderer/text';
|
|
4
5
|
import { useStore } from '../../ctx/store';
|
|
5
6
|
import { UIEventContext } from '../../ui/context';
|
|
6
7
|
import { hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
@@ -4,6 +4,8 @@ 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';
|
|
7
9
|
import './moveInteractiveControlUI.less';
|
|
8
10
|
const defaultMenu = [{
|
|
9
11
|
key: '0',
|
|
@@ -62,6 +64,7 @@ const defaultCSSVariable = {
|
|
|
62
64
|
'--activeColor': '#FF592A'
|
|
63
65
|
};
|
|
64
66
|
export function MoveInterActiveControlUI(props) {
|
|
67
|
+
const isLynx = usePlayerRenderMode() === 'lynx';
|
|
65
68
|
const {
|
|
66
69
|
contentClsName,
|
|
67
70
|
wrapClsName,
|
|
@@ -80,13 +83,17 @@ export function MoveInterActiveControlUI(props) {
|
|
|
80
83
|
// @ts-ignore
|
|
81
84
|
, {
|
|
82
85
|
style: _objectSpread({}, CSSVariable),
|
|
83
|
-
className: clsx('ipc-player-plugin-active-control-wrap', wrapClsName
|
|
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
|
+
})
|
|
84
90
|
}, /*#__PURE__*/React.createElement(View, {
|
|
85
91
|
className: clsx('ipc-player-plugin-active-control-title')
|
|
86
92
|
}, I18n.t('homeFeatureInteractiveMenuTitle')), /*#__PURE__*/React.createElement(ScrollView, {
|
|
87
93
|
style: {
|
|
88
94
|
flex: 1
|
|
89
95
|
},
|
|
96
|
+
className: isLynx ? 'ipc-player-plugin-active-control-scroll-lynx' : undefined,
|
|
90
97
|
scrollY: true
|
|
91
98
|
}, /*#__PURE__*/React.createElement(View, {
|
|
92
99
|
className: clsx('ipc-player-plugin-active-control', contentClsName)
|
|
@@ -98,9 +105,11 @@ export function MoveInterActiveControlUI(props) {
|
|
|
98
105
|
})
|
|
99
106
|
}, /*#__PURE__*/React.createElement(View, {
|
|
100
107
|
className: clsx('ipc-player-plugin-active-control-item-icon')
|
|
101
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
108
|
+
}, !isLynx && /*#__PURE__*/React.createElement(View, {
|
|
102
109
|
className: clsx('ipc-player-plugin-active-control-item-icon-mask')
|
|
103
|
-
}), /*#__PURE__*/React.createElement(
|
|
110
|
+
}), isLynx ? /*#__PURE__*/React.createElement(PlayerText, {
|
|
111
|
+
className: clsx('icon-panel', item.iconName, 'ipc-player-plugin-interactive-icon')
|
|
112
|
+
}) : /*#__PURE__*/React.createElement(View, {
|
|
104
113
|
className: clsx('icon-panel', item.iconName, 'ipc-player-plugin-interactive-icon')
|
|
105
114
|
})), /*#__PURE__*/React.createElement(View, {
|
|
106
115
|
className: clsx('ipc-player-plugin-active-control-item-title')
|
|
@@ -43,8 +43,6 @@
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
.ipc-player-plugin-active-control-item-icon {
|
|
46
|
-
position: relative;
|
|
47
|
-
z-index: 1;
|
|
48
46
|
width: calc(42px * var(--ipc-player-size-scale, 1));
|
|
49
47
|
height: calc(42px * var(--ipc-player-size-scale, 1));
|
|
50
48
|
border-radius: calc(42px * var(--ipc-player-size-scale, 1));
|
|
@@ -54,7 +52,6 @@
|
|
|
54
52
|
justify-content: center;
|
|
55
53
|
font-size: calc(16px * var(--ipc-player-size-scale, 1));
|
|
56
54
|
color: var(--color);
|
|
57
|
-
overflow: hidden;
|
|
58
55
|
.ipc-player-plugin-active-control-item-icon-mask {
|
|
59
56
|
position: absolute;
|
|
60
57
|
width: 100%;
|
|
@@ -64,6 +61,14 @@
|
|
|
64
61
|
opacity: 1;
|
|
65
62
|
}
|
|
66
63
|
}
|
|
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
|
+
}
|
|
67
72
|
.ipc-player-plugin-active-control-item-title {
|
|
68
73
|
width: calc(70px * var(--ipc-player-size-scale, 1));
|
|
69
74
|
white-space: nowrap; /* 防止文本换行 */
|
|
@@ -73,4 +78,19 @@
|
|
|
73
78
|
}
|
|
74
79
|
.ipc-player-plugin-interactive-icon {
|
|
75
80
|
font-size: calc(20px * var(--ipc-player-size-scale, 1));;
|
|
76
|
-
}
|
|
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
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, CoverView
|
|
2
|
+
import { View, CoverView } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
import { PlayerText as Text } from '../../renderer/text';
|
|
4
5
|
import { useStore } from '../../ctx/store';
|
|
5
6
|
import { landscapeTipId } from '../../ui/constant';
|
|
6
7
|
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 '../../renderer/ptzZoom';
|
|
11
11
|
import { useStore } from '../../ctx/store';
|
|
12
12
|
import { useMemoizedFn } from '../../hooks';
|
|
13
13
|
import { MultiCameraScreenMode } from '../../interface';
|
|
@@ -390,7 +390,7 @@ export const MoveablePtzControlItem = props => {
|
|
|
390
390
|
ptzData: selectedLenInfo.supportPTZ ? ptzData : [],
|
|
391
391
|
onTouchPtzStart: onTouchPtzStart,
|
|
392
392
|
onTouchPtzEnd: async () => {
|
|
393
|
-
screenMode
|
|
393
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
394
394
|
const stopConfig = dpSupportMap.ipc_multi_ptz_control ? {
|
|
395
395
|
code: 'ipc_multi_ptz_stop',
|
|
396
396
|
value: JSON.stringify({
|
|
@@ -415,7 +415,7 @@ export const MoveablePtzControlItem = props => {
|
|
|
415
415
|
},
|
|
416
416
|
onTouchZoomStart: onTouchZoomStart,
|
|
417
417
|
onTouchZoomEnd: async () => {
|
|
418
|
-
screenMode
|
|
418
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
419
419
|
const stopConfig = dpSupportMap.ipc_multi_zoom_control ? {
|
|
420
420
|
code: 'ipc_multi_zoom_stop',
|
|
421
421
|
value: JSON.stringify({
|
|
@@ -464,10 +464,10 @@ export const MoveablePtzControl = props => {
|
|
|
464
464
|
// 处理因为状态更新不同步导致的闪烁问题
|
|
465
465
|
const activeViewRef = useRef(0);
|
|
466
466
|
const onDragStart = () => {
|
|
467
|
-
screenMode
|
|
467
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(pauseTimeToHideAllComponent);
|
|
468
468
|
};
|
|
469
469
|
const onDragEnd = data => {
|
|
470
|
-
screenMode
|
|
470
|
+
screenMode === MultiCameraScreenMode.landscape && event.emit(startTimeToHideAllComponent);
|
|
471
471
|
activeViewRef.current = activeViewRef.current === 0 ? 1 : 0;
|
|
472
472
|
setStyle(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
473
473
|
positionLeft: data.positionLeft,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View
|
|
2
|
+
import { View } 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';
|
|
6
7
|
import { useStore } from '../../ctx/store';
|
|
7
8
|
import './index.less';
|
|
8
9
|
/**
|
|
@@ -26,7 +27,7 @@ export const MultiPtz = props => {
|
|
|
26
27
|
selectedLenInfo: multiCameraCtx.selectedLenInfo
|
|
27
28
|
});
|
|
28
29
|
const onPtz = useMemoizedFn(() => {
|
|
29
|
-
multiCameraCtx.
|
|
30
|
+
multiCameraCtx.setPtzStatus(!ptzStatus);
|
|
30
31
|
});
|
|
31
32
|
if (!selectedLenInfo.supportPTZ && !selectedLenInfo.supportZoom) {
|
|
32
33
|
return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { View, CoverView
|
|
2
|
+
import { View, CoverView } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
import { PlayerText as Text } from '../../renderer/text';
|
|
4
5
|
import { useStore } from '../../ctx/store';
|
|
5
6
|
import { ptzMoveableTipId } from '../../ui/constant';
|
|
6
7
|
import { PlayState } from '../../interface';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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';
|
|
4
5
|
import { useStore } from '../../ctx/store';
|
|
5
6
|
import { MultiCameraLayoutStyle, MultiCameraScreenMode } from '../../interface';
|
|
6
7
|
import { multiPrefix } from './constants';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View
|
|
2
|
+
import { View } 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';
|
|
7
8
|
import { useStore } from '../../ctx/store';
|
|
8
9
|
import { multiPrefix } from './constants';
|
|
9
10
|
import './index.less';
|
|
@@ -27,7 +28,7 @@ export const TileMultiPtz = props => {
|
|
|
27
28
|
});
|
|
28
29
|
const lighterBrandColor = new Color(brandColor).alpha(0.2).hexa();
|
|
29
30
|
const onPtz = useMemoizedFn(() => {
|
|
30
|
-
multiCameraCtx.
|
|
31
|
+
multiCameraCtx.setPtzStatus(!ptzStatus);
|
|
31
32
|
});
|
|
32
33
|
if (!selectedLenInfo.supportPTZ && !selectedLenInfo.supportZoom) {
|
|
33
34
|
return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { View
|
|
1
|
+
import { View } 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';
|
|
4
5
|
import { MultiCameraLayoutStyle } from '../../interface';
|
|
5
6
|
import { multiPrefix } from './constants';
|
|
6
7
|
import { useStore } from '../../ctx/store';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, CoverView
|
|
2
|
+
import { View, CoverView } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
import { PlayerText as Text } from '../../renderer/text';
|
|
4
5
|
import { useStore } from '../../ctx/store';
|
|
5
6
|
import { tileTipId } from '../../ui/constant';
|
|
6
7
|
import { PlayState } from '../../interface';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { View
|
|
1
|
+
import { View } 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';
|
|
4
5
|
import { useStore } from '../../ctx/store';
|
|
5
6
|
import { UIEventContext } from '../../ui/context';
|
|
6
7
|
import { widgetLabs, widgetClick, pauseTimeToHideAllComponent, startTimeToHideAllComponent } from '../../ui/constant';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { act, renderHook as renderPlayerHook } from '@testing-library/react-hooks/dom';
|
|
2
3
|
import { atom, getDefaultStore } from 'jotai';
|
|
4
|
+
import { PlayerRenderModeContext } from '../../renderer/context';
|
|
3
5
|
import { IntercomMode } from '../../interface';
|
|
4
6
|
import { Muted } from './muted';
|
|
5
7
|
jest.mock('@ray-js/ray', () => ({
|
|
@@ -27,55 +29,67 @@ const createProps = function () {
|
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
32
|
+
describe.each(['webview', 'lynx'])('%s speaker interactions', renderMode => {
|
|
33
|
+
const renderHook = callback => renderPlayerHook(callback, {
|
|
34
|
+
wrapper: _ref => {
|
|
35
|
+
let {
|
|
36
|
+
children
|
|
37
|
+
} = _ref;
|
|
38
|
+
return /*#__PURE__*/React.createElement(PlayerRenderModeContext.Provider, {
|
|
39
|
+
value: renderMode
|
|
40
|
+
}, children);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
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) => {
|
|
44
|
+
const props = createProps(true, mode, muted);
|
|
45
|
+
const {
|
|
46
|
+
result,
|
|
47
|
+
unmount
|
|
48
|
+
} = renderHook(() => Muted(props));
|
|
49
|
+
act(() => result.current.props.onClick());
|
|
50
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
51
|
+
expect(props.event.emit).not.toHaveBeenCalled();
|
|
52
|
+
expect(result.current.props.className).toContain('ipc-player-plugin-muted-disabled');
|
|
53
|
+
unmount();
|
|
54
|
+
});
|
|
55
|
+
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) => {
|
|
56
|
+
const props = createProps(talking, mode, muted);
|
|
57
|
+
const {
|
|
58
|
+
result,
|
|
59
|
+
unmount
|
|
60
|
+
} = renderHook(() => Muted(props));
|
|
61
|
+
act(() => result.current.props.onClick());
|
|
62
|
+
expect(props.setMute).toHaveBeenCalledTimes(1);
|
|
63
|
+
expect(props.setMute).toHaveBeenCalledWith(target);
|
|
64
|
+
expect(result.current.props.className).not.toContain('ipc-player-plugin-muted-disabled');
|
|
65
|
+
unmount();
|
|
66
|
+
});
|
|
67
|
+
it.each([IntercomMode.OneWay, IntercomMode.TwoWay])('uses shared talk state after remount and unlocks when talk ends in mode=%s', mode => {
|
|
68
|
+
const props = createProps(false, mode);
|
|
69
|
+
const store = getDefaultStore();
|
|
70
|
+
const first = renderHook(() => Muted(props));
|
|
71
|
+
act(() => store.set(props.intercom, true));
|
|
72
|
+
act(() => first.result.current.props.onClick());
|
|
73
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
74
|
+
first.unmount();
|
|
75
|
+
const second = renderHook(() => Muted(props));
|
|
76
|
+
act(() => second.result.current.props.onClick());
|
|
77
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
78
|
+
act(() => store.set(props.intercom, false));
|
|
79
|
+
act(() => second.result.current.props.onClick());
|
|
80
|
+
expect(props.setMute).toHaveBeenCalledWith(false);
|
|
81
|
+
second.unmount();
|
|
82
|
+
});
|
|
83
|
+
it.each([[IntercomMode.OneWay, IntercomMode.TwoWay], [IntercomMode.TwoWay, IntercomMode.OneWay]])('keeps the speaker locked when active talk changes from %s to %s', (mode, nextMode) => {
|
|
84
|
+
const props = createProps(true, mode);
|
|
85
|
+
const {
|
|
86
|
+
result,
|
|
87
|
+
unmount
|
|
88
|
+
} = renderHook(() => Muted(props));
|
|
89
|
+
act(() => getDefaultStore().set(props.intercomMode, nextMode));
|
|
90
|
+
act(() => result.current.props.onClick());
|
|
91
|
+
expect(props.setMute).not.toHaveBeenCalled();
|
|
92
|
+
expect(props.event.emit).not.toHaveBeenCalled();
|
|
93
|
+
unmount();
|
|
94
|
+
});
|
|
81
95
|
});
|
package/lib/widgets/ptz/ptz.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View
|
|
2
|
+
import { View } 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';
|
|
6
7
|
import { UIEventContext } from '../../ui/context';
|
|
7
8
|
import { usePtz } from '../../hooks';
|
|
8
9
|
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';
|
|
8
7
|
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,6 +1,8 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { View, Image, CoverView,
|
|
2
|
+
import { View, Image, CoverView, 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';
|
|
4
6
|
import { useStore } from '../../ctx/store';
|
|
5
7
|
import { ptzControlTipId, widgetLabs, widgetClick } from '../../ui/constant';
|
|
6
8
|
import { PlayState } from '../../interface';
|
|
@@ -12,6 +14,7 @@ export const PtzControlTip = props => {
|
|
|
12
14
|
devId,
|
|
13
15
|
deleteContent
|
|
14
16
|
} = props;
|
|
17
|
+
const isLynx = usePlayerRenderMode() === 'lynx';
|
|
15
18
|
const [showTipModal, setShowTipModal] = useState(true);
|
|
16
19
|
const {
|
|
17
20
|
playState
|
|
@@ -34,9 +37,9 @@ export const PtzControlTip = props => {
|
|
|
34
37
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
35
38
|
className: clsx('playerControlTipContainer')
|
|
36
39
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
37
|
-
mode:
|
|
40
|
+
mode: isLynx ? 'aspectFit' : 'widthFix',
|
|
38
41
|
src: playerPtzControlTip,
|
|
39
|
-
className: clsx('controlTipImage')
|
|
42
|
+
className: clsx('controlTipImage', isLynx && 'controlTipImageLynx')
|
|
40
43
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
41
44
|
className: clsx('controlTipText')
|
|
42
45
|
}, Strings.getLang('ipc_player_ptz_control_tip')), /*#__PURE__*/React.createElement(View, {
|
|
@@ -39,3 +39,9 @@
|
|
|
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,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
+
import { PlayerText as Text } from '../../renderer/text';
|
|
4
5
|
import { PlayState } from '../../interface';
|
|
5
6
|
import { useStore } from '../../ctx/store';
|
|
6
7
|
import { useDpSupport } from '../../hooks/useDpSupport';
|