@ray-js/ipc-player-integration 0.0.66-beta.0 → 0.0.67-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 +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 +13 -3
- package/lib/ctx/ctx.js +46 -35
- package/lib/ctx/multiCameraCtx.d.ts +2 -0
- package/lib/ctx/multiCameraCtx.js +17 -1
- package/lib/ctx/multiCameraCtx.test.d.ts +1 -0
- package/lib/ctx/multiCameraCtx.test.js +65 -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 +17 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +55 -119
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +98 -89
- package/lib/utils/captureResult.d.ts +12 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +223 -0
- package/lib/utils/fullLinkTracking.d.ts +5 -0
- package/lib/utils/fullLinkTracking.js +71 -0
- package/lib/utils/navigation.d.ts +2 -1
- package/lib/utils/navigation.js +13 -3
- package/lib/widgets/battery/battery.js +5 -7
- package/lib/widgets/battery/batteryFull.js +5 -7
- 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 +84 -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 +4 -18
- 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/index.less +1 -0
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +2 -3
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +2 -3
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- package/lib/widgets/muted/muted.js +1 -2
- package/lib/widgets/muted/muted.test.js +52 -66
- 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 +58 -54
- 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 +67 -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 +135 -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.d.ts +2 -1
- package/lib/widgets/trialBadge/index.js +20 -17
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
- package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
- package/lib/widgets/tryExperience/tryExperience.js +1 -2
- 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 -3
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +0 -2
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +18 -31
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -23
- package/package.json +7 -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
- 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/scrollHintArrow.d.ts +0 -23
- package/lib/ui/scrollHintArrow.js +0 -82
- package/lib/widgets/battery/statusIcon.d.ts +0 -6
- package/lib/widgets/battery/statusIcon.js +0 -36
- package/lib/widgets/battery/statusIcon.less +0 -24
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
- package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
- package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
|
@@ -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,14 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
1
3
|
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
2
|
-
import { View,
|
|
4
|
+
import { View, Text, getSystemInfoSync } from '@ray-js/ray';
|
|
3
5
|
import { useSetState, useUpdateEffect } from 'ahooks';
|
|
4
6
|
import clsx from 'clsx';
|
|
5
7
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
8
|
import Strings from '../../i18n';
|
|
8
9
|
import { PlayState } from '../../interface';
|
|
10
|
+
import { getCaptureResultSummary } from '../../utils/captureResult';
|
|
11
|
+
import { CaptureResultToast } from '../captureResult/captureResult';
|
|
9
12
|
import { UIEventContext } from '../../ui/context';
|
|
10
13
|
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
|
|
11
14
|
import { useStore, getDefaultStore } from '../../ctx/store';
|
|
@@ -101,22 +104,45 @@ export function RecordVideo(props) {
|
|
|
101
104
|
playState: props.playState
|
|
102
105
|
});
|
|
103
106
|
const [state, setState] = useSetState({
|
|
104
|
-
showTimer: false,
|
|
105
107
|
showShot: false,
|
|
106
|
-
shotUrl: ''
|
|
108
|
+
shotUrl: '',
|
|
109
|
+
shotCount: 0
|
|
107
110
|
});
|
|
111
|
+
const recordResultRequestIdRef = useRef(0);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
return () => {
|
|
114
|
+
recordResultRequestIdRef.current += 1;
|
|
115
|
+
};
|
|
116
|
+
}, []);
|
|
117
|
+
const showRecordResult = async recordInfo => {
|
|
118
|
+
var _props$multiCameraCtx;
|
|
119
|
+
const requestId = ++recordResultRequestIdRef.current;
|
|
120
|
+
const lensIndices = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.split_info) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.map(lens => lens.index);
|
|
121
|
+
const summary = await getCaptureResultSummary(recordInfo, {
|
|
122
|
+
multiLens: props.multiLens,
|
|
123
|
+
lensIndices,
|
|
124
|
+
devId
|
|
125
|
+
});
|
|
126
|
+
if (requestId !== recordResultRequestIdRef.current) return;
|
|
127
|
+
if (!summary) return;
|
|
128
|
+
setState({
|
|
129
|
+
showShot: true,
|
|
130
|
+
shotUrl: summary.thumbnailPath,
|
|
131
|
+
shotCount: summary.isMultiLens ? summary.count : 0
|
|
132
|
+
});
|
|
133
|
+
};
|
|
108
134
|
|
|
109
135
|
/**
|
|
110
136
|
* 针对 playState为非连接中状态时,如果处于录制中, 结束录制
|
|
111
137
|
*/
|
|
112
138
|
useEffect(() => {
|
|
113
139
|
(async () => {
|
|
114
|
-
if (playState !== PlayState.PLAYING) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
140
|
+
if (playState !== PlayState.PLAYING && recording) {
|
|
141
|
+
try {
|
|
142
|
+
const recordInfo = await setRecording(false);
|
|
143
|
+
await showRecordResult(recordInfo);
|
|
144
|
+
} catch {
|
|
145
|
+
// setRecording reports the native failure through the configured toast.
|
|
120
146
|
}
|
|
121
147
|
}
|
|
122
148
|
})();
|
|
@@ -130,7 +156,8 @@ export function RecordVideo(props) {
|
|
|
130
156
|
timer.current = setTimeout(() => {
|
|
131
157
|
setState({
|
|
132
158
|
showShot: false,
|
|
133
|
-
shotUrl: ''
|
|
159
|
+
shotUrl: '',
|
|
160
|
+
shotCount: 0
|
|
134
161
|
});
|
|
135
162
|
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
136
163
|
}, CLOSE_TIME);
|
|
@@ -150,22 +177,20 @@ export function RecordVideo(props) {
|
|
|
150
177
|
showRecordToast();
|
|
151
178
|
}
|
|
152
179
|
}, [state.showShot, screenType]);
|
|
153
|
-
|
|
154
|
-
/** 根据showTimer的显示定时器 */
|
|
155
180
|
useUpdateEffect(() => {
|
|
156
|
-
if (
|
|
181
|
+
if (recording) {
|
|
157
182
|
showRecordTimer();
|
|
158
183
|
} else {
|
|
159
184
|
deleteContent('absolute', RECORD_VIDEO_TIMER_ID);
|
|
160
|
-
// 清除定时器,元素移除
|
|
161
185
|
}
|
|
162
|
-
}, [
|
|
186
|
+
}, [recording]);
|
|
163
187
|
|
|
164
188
|
/** 跳转相册 */
|
|
165
189
|
const handCheck = () => {
|
|
166
190
|
setState({
|
|
167
191
|
showShot: false,
|
|
168
|
-
shotUrl: ''
|
|
192
|
+
shotUrl: '',
|
|
193
|
+
shotCount: 0
|
|
169
194
|
});
|
|
170
195
|
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
171
196
|
clearInterval(timer.current);
|
|
@@ -187,27 +212,13 @@ export function RecordVideo(props) {
|
|
|
187
212
|
marginLeft: screenType === 'vertical' ? '0' : '-200px'
|
|
188
213
|
},
|
|
189
214
|
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')));
|
|
215
|
+
return /*#__PURE__*/React.createElement(CaptureResultToast, {
|
|
216
|
+
brandColor: brandColor,
|
|
217
|
+
count: state.shotCount,
|
|
218
|
+
kind: "record",
|
|
219
|
+
onCheck: handCheck,
|
|
220
|
+
thumbnailPath: state.shotUrl
|
|
221
|
+
});
|
|
211
222
|
}
|
|
212
223
|
});
|
|
213
224
|
timeToCloseRecordToast();
|
|
@@ -219,8 +230,8 @@ export function RecordVideo(props) {
|
|
|
219
230
|
absoluteContentClassName: 'ipc-player-plugin-record-video-toast-wrap',
|
|
220
231
|
content: () => /*#__PURE__*/React.createElement(View, {
|
|
221
232
|
className: clsx('ipc-player-plugin-record-video-toast', {
|
|
222
|
-
'ipc-player-plugin-record-video-toast-show':
|
|
223
|
-
'ipc-player-plugin-record-video-toast-hide': !
|
|
233
|
+
'ipc-player-plugin-record-video-toast-show': recording,
|
|
234
|
+
'ipc-player-plugin-record-video-toast-hide': !recording
|
|
224
235
|
})
|
|
225
236
|
}, /*#__PURE__*/React.createElement(View, {
|
|
226
237
|
className: "ipc-player-plugin-record-video-toast-point",
|
|
@@ -231,9 +242,9 @@ export function RecordVideo(props) {
|
|
|
231
242
|
});
|
|
232
243
|
};
|
|
233
244
|
const handRecordVideo = async () => {
|
|
234
|
-
var _props$event
|
|
245
|
+
var _props$event;
|
|
235
246
|
const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
|
|
236
|
-
|
|
247
|
+
ev.emit(widgetClick, {
|
|
237
248
|
widgetId: widgetLabs.RECORD_VIDEO
|
|
238
249
|
});
|
|
239
250
|
event.emit(pauseTimeToHideAllComponent);
|
|
@@ -243,10 +254,13 @@ export function RecordVideo(props) {
|
|
|
243
254
|
if (recordingDisabled) {
|
|
244
255
|
return false;
|
|
245
256
|
}
|
|
246
|
-
|
|
257
|
+
recordResultRequestIdRef.current += 1;
|
|
258
|
+
if (state.showShot) {
|
|
247
259
|
setState({
|
|
248
260
|
showShot: false
|
|
249
261
|
});
|
|
262
|
+
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
263
|
+
clearTimeout(timer.current);
|
|
250
264
|
}
|
|
251
265
|
// 发送忽略进入后台停止预览的标记
|
|
252
266
|
const {
|
|
@@ -263,18 +277,11 @@ export function RecordVideo(props) {
|
|
|
263
277
|
}
|
|
264
278
|
if (target) {
|
|
265
279
|
setRecordingDisabled(true);
|
|
266
|
-
setState({
|
|
267
|
-
showTimer: true
|
|
268
|
-
});
|
|
269
280
|
/** 录制开始后3秒后才可结束 */
|
|
270
281
|
timeToResetRecordDisabled();
|
|
271
282
|
} else {
|
|
272
283
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
|
|
273
|
-
|
|
274
|
-
showTimer: false,
|
|
275
|
-
showShot: true,
|
|
276
|
-
shotUrl: recordInfo.tempImagePath
|
|
277
|
-
});
|
|
284
|
+
await showRecordResult(recordInfo);
|
|
278
285
|
}
|
|
279
286
|
} catch (err) {
|
|
280
287
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
|
|
@@ -284,9 +291,6 @@ export function RecordVideo(props) {
|
|
|
284
291
|
toast({
|
|
285
292
|
title: errMsg
|
|
286
293
|
});
|
|
287
|
-
setState({
|
|
288
|
-
showTimer: false
|
|
289
|
-
});
|
|
290
294
|
}
|
|
291
295
|
return true;
|
|
292
296
|
};
|
|
@@ -1,116 +1,59 @@
|
|
|
1
1
|
.ipc-player-plugin-record-video-icon {
|
|
2
|
-
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
3
2
|
color: var(--iconColor);
|
|
3
|
+
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
.ipc-player-plugin-record-video-toast-wrap {
|
|
6
|
-
z-index: 400;
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: calc(7px * var(--ipc-player-size-scale, 1));
|
|
9
9
|
left: 50%;
|
|
10
|
+
z-index: 400;
|
|
10
11
|
transform: translateX(-50%);
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
// 计时器显示
|
|
14
14
|
.ipc-player-plugin-record-video-toast-show {
|
|
15
15
|
transform: translate(0, 0) !important;
|
|
16
16
|
transition: transform ease-in 3s;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
.ipc-player-plugin-record-video-toast-hide {
|
|
20
20
|
transform: translate(0, -110%) !important;
|
|
21
21
|
transition: transform 0.3s ease-in-out;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.ipc-player-plugin-record-video-toast {
|
|
25
|
-
transform: translate(0, -110%);
|
|
26
25
|
display: flex;
|
|
27
|
-
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
28
26
|
align-items: center;
|
|
29
|
-
|
|
27
|
+
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
28
|
+
background: linear-gradient(0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)),
|
|
29
|
+
#000000;
|
|
30
30
|
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
transform: translate(0, -110%);
|
|
32
|
+
|
|
33
33
|
.ipc-player-plugin-record-video-toast-point {
|
|
34
34
|
width: calc(6px * var(--ipc-player-size-scale, 1));
|
|
35
35
|
height: calc(6px * var(--ipc-player-size-scale, 1));
|
|
36
36
|
border-radius: calc(6px * var(--ipc-player-size-scale, 1));
|
|
37
37
|
}
|
|
38
|
+
|
|
38
39
|
.ipc-player-plugin-record-video-toast-time {
|
|
39
|
-
font-size: calc(12px * var(--ipc-player-size-scale, 1));;
|
|
40
|
-
font-weight: 700;
|
|
41
|
-
color: var(--fontColor);
|
|
42
|
-
margin-left: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
43
40
|
display: flex;
|
|
44
41
|
align-items: center;
|
|
42
|
+
margin-left: calc(8px * var(--ipc-player-size-scale, 1));
|
|
43
|
+
color: var(--fontColor);
|
|
44
|
+
font-weight: 700;
|
|
45
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
46
|
+
|
|
45
47
|
.ipc-player-plugin-record-video-toast-time-warp {
|
|
46
48
|
text-align: center;
|
|
47
49
|
}
|
|
50
|
+
|
|
48
51
|
.ipc-player-plugin-record-video-toast-time-delimiter {
|
|
49
|
-
margin: 0 calc(2px * var(--ipc-player-size-scale, 1))
|
|
52
|
+
margin: 0 calc(2px * var(--ipc-player-size-scale, 1));
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
/** 录制成功弹窗 */
|
|
55
57
|
.ipc-player-plugin-record-success-toast-wrap {
|
|
56
58
|
position: absolute;
|
|
57
59
|
}
|
|
58
|
-
.ipc-player-plugin-record-success-toast {
|
|
59
|
-
flex: 1;
|
|
60
|
-
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
61
|
-
background-color: var(--shot-card-bg-color);
|
|
62
|
-
display: flex;
|
|
63
|
-
align-items: center;
|
|
64
|
-
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
|
|
65
|
-
z-index: 100;
|
|
66
|
-
.ipc-player-plugin-record-success-toast-image-box {
|
|
67
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
68
|
-
overflow: hidden;
|
|
69
|
-
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
70
|
-
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
71
|
-
position: relative;
|
|
72
|
-
}
|
|
73
|
-
.ipc-player-plugin-record-success-toast-image {
|
|
74
|
-
width: 100%;
|
|
75
|
-
height: 100%;
|
|
76
|
-
object-fit: cover;
|
|
77
|
-
}
|
|
78
|
-
.ipc-player-plugin-record-success-play-icon-box {
|
|
79
|
-
width: 30px;
|
|
80
|
-
height: 30px;
|
|
81
|
-
background-color: rgba(0, 0, 0, 0.2);
|
|
82
|
-
border-radius: 50%;
|
|
83
|
-
overflow: hidden;
|
|
84
|
-
position: absolute;
|
|
85
|
-
top: 50%;
|
|
86
|
-
left: 50%;
|
|
87
|
-
transform: translate(-50%, -50%);
|
|
88
|
-
display: flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
justify-content: center;
|
|
91
|
-
}
|
|
92
|
-
.ipc-player-plugin-record-success-play-icon {
|
|
93
|
-
font-size: calc(18px * var(--ipc-player-size-scale, 1)) !important;
|
|
94
|
-
color: #ffffff;
|
|
95
|
-
}
|
|
96
|
-
.ipc-player-plugin-record-success-toast-title {
|
|
97
|
-
flex: 1;
|
|
98
|
-
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
99
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
100
|
-
color: var(--fontColor);
|
|
101
|
-
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
102
|
-
word-break: break-word;
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
.ipc-player-plugin-record-success-toast-bottom {
|
|
106
|
-
border: 1px solid #1989FA;
|
|
107
|
-
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
108
|
-
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
109
|
-
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
110
|
-
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
111
|
-
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
112
|
-
white-space: nowrap;
|
|
113
|
-
overflow: hidden;
|
|
114
|
-
text-overflow: ellipsis;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import { act, Simulate } from 'react-dom/test-utils';
|
|
7
|
+
import { atom, getDefaultStore } from 'jotai';
|
|
8
|
+
import { PlayState } from '../../interface';
|
|
9
|
+
import { RecordVideo } from './recordVideo';
|
|
10
|
+
jest.mock('@ray-js/ray', () => ({
|
|
11
|
+
View: 'div',
|
|
12
|
+
Text: 'span',
|
|
13
|
+
Image: 'img',
|
|
14
|
+
getSystemInfoSync: () => ({
|
|
15
|
+
platform: 'android'
|
|
16
|
+
})
|
|
17
|
+
}));
|
|
18
|
+
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
19
|
+
goToIpcPageNativeRoute: jest.fn()
|
|
20
|
+
}));
|
|
21
|
+
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({}));
|
|
22
|
+
jest.mock('../../utils/device', () => ({
|
|
23
|
+
getDeviceInfo: jest.fn()
|
|
24
|
+
}));
|
|
25
|
+
jest.mock('../../i18n', () => ({
|
|
26
|
+
__esModule: true,
|
|
27
|
+
default: {
|
|
28
|
+
getLang: key => key
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
jest.mock('./recordVideo.less', () => ({}));
|
|
32
|
+
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
33
|
+
describe('RecordVideo', () => {
|
|
34
|
+
let container;
|
|
35
|
+
beforeEach(() => {
|
|
36
|
+
jest.useFakeTimers('modern');
|
|
37
|
+
container = document.createElement('div');
|
|
38
|
+
document.body.appendChild(container);
|
|
39
|
+
});
|
|
40
|
+
afterEach(() => {
|
|
41
|
+
act(() => ReactDOM.unmountComponentAtNode(container));
|
|
42
|
+
container.remove();
|
|
43
|
+
jest.clearAllTimers();
|
|
44
|
+
jest.useRealTimers();
|
|
45
|
+
});
|
|
46
|
+
it.each([false, true])('removes the recording timer after stop (remounted: %s)', async remount => {
|
|
47
|
+
var _container$querySelec, _container$querySelec2;
|
|
48
|
+
const store = getDefaultStore();
|
|
49
|
+
const recording = atom(false);
|
|
50
|
+
const recordingDisabled = atom(false);
|
|
51
|
+
const screenType = atom('vertical');
|
|
52
|
+
const setRecording = jest.fn(async value => {
|
|
53
|
+
store.set(recording, value);
|
|
54
|
+
return value ? true : {
|
|
55
|
+
tempImagePath: 'thingfile://record.jpg'
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
function Harness(_ref) {
|
|
59
|
+
let {
|
|
60
|
+
widgetKey
|
|
61
|
+
} = _ref;
|
|
62
|
+
const [contents, setContents] = useState([]);
|
|
63
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(RecordVideo, {
|
|
64
|
+
key: widgetKey,
|
|
65
|
+
devId: 'device',
|
|
66
|
+
recording,
|
|
67
|
+
recordingDisabled,
|
|
68
|
+
screenType,
|
|
69
|
+
brandColor: atom('#ff592a'),
|
|
70
|
+
playState: atom(PlayState.PLAYING),
|
|
71
|
+
setRecording,
|
|
72
|
+
setRecordingDisabled: value => store.set(recordingDisabled, value),
|
|
73
|
+
addContent: (_type, content) => setContents(items => [...items, content]),
|
|
74
|
+
deleteContent: (_type, id) => setContents(items => items.filter(item => item.id !== id))
|
|
75
|
+
}), contents.map(item => /*#__PURE__*/React.createElement(item.content, {
|
|
76
|
+
key: item.id
|
|
77
|
+
})));
|
|
78
|
+
}
|
|
79
|
+
const clickRecord = async () => {
|
|
80
|
+
await act(async () => {
|
|
81
|
+
Simulate.click(container.querySelector('.ipc-player-plugin-record-video-icon').parentElement);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
await act(async () => {
|
|
85
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, {
|
|
86
|
+
widgetKey: 0
|
|
87
|
+
}), container);
|
|
88
|
+
});
|
|
89
|
+
await clickRecord();
|
|
90
|
+
act(() => jest.advanceTimersByTime(3000));
|
|
91
|
+
expect((_container$querySelec = container.querySelector('.ipc-player-plugin-record-video-toast-time')) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.textContent).toBe('00:03');
|
|
92
|
+
if (remount) {
|
|
93
|
+
await act(async () => {
|
|
94
|
+
store.set(screenType, 'full');
|
|
95
|
+
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, {
|
|
96
|
+
widgetKey: 1
|
|
97
|
+
}), container);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
expect((_container$querySelec2 = container.querySelector('.ipc-player-plugin-record-video-toast-time')) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.textContent).toBe('00:03');
|
|
101
|
+
await clickRecord();
|
|
102
|
+
expect(setRecording).toHaveBeenLastCalledWith(false);
|
|
103
|
+
expect(container.querySelector('.icon-panel-record-stop')).toBeNull();
|
|
104
|
+
expect(container.querySelector('.ipc-player-plugin-record-video-toast-time')).toBeNull();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -22,6 +22,7 @@ jest.mock('../../i18n', () => ({
|
|
|
22
22
|
}
|
|
23
23
|
}));
|
|
24
24
|
jest.mock('./recordVideo.less', () => ({}));
|
|
25
|
+
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
25
26
|
it('keeps the record control idle when starting is declined', async () => {
|
|
26
27
|
const addContent = jest.fn();
|
|
27
28
|
const setRecordingDisabled = jest.fn();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
2
|
import "core-js/modules/esnext.iterator.map.js";
|
|
3
3
|
import React, { useState, useContext, useEffect } from 'react';
|
|
4
|
-
import { View, showToast } from '@ray-js/ray';
|
|
4
|
+
import { Text, View, showToast } from '@ray-js/ray';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { useMemoizedFn } from '../../hooks';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -34,10 +33,6 @@ export const FullResolutionControl = props => {
|
|
|
34
33
|
const onPlayerTap = useMemoizedFn(() => {
|
|
35
34
|
setHide(true);
|
|
36
35
|
});
|
|
37
|
-
const normalizeResolution = value => {
|
|
38
|
-
const normalized = String(value || '').toUpperCase();
|
|
39
|
-
return normalized === 'HD' ? 'HD' : 'SD';
|
|
40
|
-
};
|
|
41
36
|
useEffect(() => {
|
|
42
37
|
event.on('showFullResolutionControl', onShowFullResolutionControl);
|
|
43
38
|
event.on(playerTap, onPlayerTap);
|
|
@@ -47,14 +42,13 @@ export const FullResolutionControl = props => {
|
|
|
47
42
|
};
|
|
48
43
|
}, []);
|
|
49
44
|
const changeResolution = useMemoizedFn(value => {
|
|
50
|
-
|
|
51
|
-
if (targetResolution === normalizeResolution(resolution)) {
|
|
45
|
+
if (value === resolution) {
|
|
52
46
|
showToast({
|
|
53
47
|
icon: 'none',
|
|
54
48
|
title: Strings.getLang('ipc_player_current_resolution_is_equal')
|
|
55
49
|
});
|
|
56
50
|
} else {
|
|
57
|
-
setResolution(
|
|
51
|
+
setResolution(value).then(() => {
|
|
58
52
|
showToast({
|
|
59
53
|
icon: 'none',
|
|
60
54
|
title: Strings.getLang('ipc_player_change_resolution_success')
|
|
@@ -74,24 +68,20 @@ export const FullResolutionControl = props => {
|
|
|
74
68
|
className: clsx('ipc-player-plugin-full-resolution-control', 'ipc-plugin-absolute-move-in-right', {
|
|
75
69
|
'ipc-plugin-absolute-move-in-right-hide': hide
|
|
76
70
|
})
|
|
77
|
-
}, resolutionList.map(item => {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
color: brandColor
|
|
94
|
-
} : undefined
|
|
95
|
-
}, Strings.getLang(`ipc_player_resolution_${normalizedItem}`));
|
|
96
|
-
}));
|
|
71
|
+
}, resolutionList.map(item => /*#__PURE__*/React.createElement(Text, {
|
|
72
|
+
onClick: () => {
|
|
73
|
+
event.emit(widgetClick, {
|
|
74
|
+
widgetId: widgetLabs.FULL_RESOLUTION_CONTROL,
|
|
75
|
+
extra: {
|
|
76
|
+
resolution: item
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
changeResolution(item);
|
|
80
|
+
},
|
|
81
|
+
key: item,
|
|
82
|
+
className: clsx('ipc-player-plugin-full-resolution-control-text'),
|
|
83
|
+
style: item === resolution && {
|
|
84
|
+
color: brandColor
|
|
85
|
+
}
|
|
86
|
+
}, Strings.getLang(`ipc_player_resolution_${item}`))));
|
|
97
87
|
};
|
|
@@ -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, { useContext } from 'react';
|
|
5
5
|
import { useMemoizedFn } from 'ahooks';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { FullResolutionControl } from './fullResolutionControl';
|
|
9
8
|
import { fullResolutionId, pauseTimeToHideAllComponent, hideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
@@ -53,7 +52,7 @@ export const Resolution = props => {
|
|
|
53
52
|
}
|
|
54
53
|
if (verticalResolutionCustomClick) return false;
|
|
55
54
|
if (screenType === 'vertical') {
|
|
56
|
-
setResolution(
|
|
55
|
+
setResolution(resolution === 'HD' ? 'SD' : 'HD');
|
|
57
56
|
}
|
|
58
57
|
event.emit(pauseTimeToHideAllComponent);
|
|
59
58
|
return true;
|