@ray-js/ipc-player-integration 0.0.60-beta.0 → 0.0.61-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.
Files changed (44) hide show
  1. package/lib/ctx/ctx.album.test.d.ts +1 -0
  2. package/lib/ctx/ctx.album.test.js +197 -0
  3. package/lib/ctx/ctx.composition.js +19 -4
  4. package/lib/ctx/ctx.js +100 -55
  5. package/lib/ctx/ports.output.d.ts +1 -0
  6. package/lib/ctx/resolution.d.ts +1 -1
  7. package/lib/ctx/resolution.js +3 -1
  8. package/lib/i18n/index.d.ts +12 -0
  9. package/lib/i18n/strings.d.ts +6 -0
  10. package/lib/i18n/strings.js +6 -0
  11. package/lib/interface.d.ts +18 -3
  12. package/lib/ui/absoluteContent.d.ts +2 -0
  13. package/lib/ui/absoluteContent.js +3 -0
  14. package/lib/ui/ui.d.ts +2 -0
  15. package/lib/ui/ui.js +30 -26
  16. package/lib/utils/captureResult.d.ts +14 -0
  17. package/lib/utils/captureResult.js +70 -0
  18. package/lib/utils/captureResult.test.d.ts +1 -0
  19. package/lib/utils/captureResult.test.js +117 -0
  20. package/lib/utils/ttt.js +2 -8
  21. package/lib/widgets/captureResult/captureResult.d.ts +16 -0
  22. package/lib/widgets/captureResult/captureResult.js +85 -0
  23. package/lib/widgets/captureResult/captureResult.less +144 -0
  24. package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
  25. package/lib/widgets/captureResult/captureResult.test.js +80 -0
  26. package/lib/widgets/captureResult/index.d.ts +2 -0
  27. package/lib/widgets/captureResult/index.js +2 -0
  28. package/lib/widgets/index.d.ts +1 -0
  29. package/lib/widgets/index.js +2 -1
  30. package/lib/widgets/muted/muted.js +9 -3
  31. package/lib/widgets/muted/muted.less +5 -1
  32. package/lib/widgets/muted/muted.test.d.ts +1 -0
  33. package/lib/widgets/muted/muted.test.js +81 -0
  34. package/lib/widgets/recordVideo/recordVideo.js +53 -52
  35. package/lib/widgets/recordVideo/recordVideo.less +17 -74
  36. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
  37. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
  38. package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
  39. package/lib/widgets/screenshot/screenshot.js +66 -44
  40. package/lib/widgets/screenshot/screenshot.less +1 -40
  41. package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
  42. package/lib/widgets/screenshot/screenshot.test.js +120 -0
  43. package/lib/widgets/tryExperience/tryExperience.js +0 -1
  44. package/package.json +3 -2
@@ -0,0 +1,144 @@
1
+ .ipc-player-plugin-capture-result-toast,
2
+ .ipc-player-plugin-record-success-toast,
3
+ .ipc-player-plugin-screenshot-toast {
4
+ --capture-result-text-color: var(--fontColor, #fff);
5
+ --capture-result-near-backdrop-color: rgba(255, 255, 255, 0.2);
6
+ --capture-result-far-backdrop-color: rgba(255, 255, 255, 0.1);
7
+
8
+ z-index: 100;
9
+ display: flex;
10
+ flex: 1;
11
+ align-items: center;
12
+ padding: calc(7px * var(--ipc-player-size-scale, 1))
13
+ calc(16px * var(--ipc-player-size-scale, 1))
14
+ calc(7px * var(--ipc-player-size-scale, 1))
15
+ calc(12px * var(--ipc-player-size-scale, 1));
16
+ background-color: var(--shot-card-bg-color);
17
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));
18
+ }
19
+
20
+ :root[theme='light'] .ipc-player-plugin-capture-result-toast {
21
+ --capture-result-text-color: #1a1a1a;
22
+ --capture-result-near-backdrop-color: rgba(0, 0, 0, 0.1);
23
+ --capture-result-far-backdrop-color: rgba(0, 0, 0, 0.05);
24
+
25
+ background-color: #fff;
26
+ }
27
+
28
+ .ipc-player-plugin-capture-result-image-box,
29
+ .ipc-player-plugin-record-success-toast-image-box,
30
+ .ipc-player-plugin-screenshot-toast-image-box {
31
+ position: relative;
32
+ width: calc(66px * var(--ipc-player-size-scale, 1));
33
+ height: calc(39px * var(--ipc-player-size-scale, 1));
34
+ overflow: hidden;
35
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
36
+ }
37
+
38
+ .ipc-player-plugin-capture-result-image,
39
+ .ipc-player-plugin-record-success-toast-image,
40
+ .ipc-player-plugin-screenshot-toast-image {
41
+ width: 100%;
42
+ height: 100%;
43
+ object-fit: cover;
44
+ }
45
+
46
+ .ipc-player-plugin-capture-result-backdrop,
47
+ .ipc-player-plugin-capture-result-image-front {
48
+ position: absolute;
49
+ box-sizing: border-box;
50
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
51
+ }
52
+
53
+ .ipc-player-plugin-capture-result-image-back {
54
+ top: calc(1px * var(--ipc-player-size-scale, 1));
55
+ left: calc(5px * var(--ipc-player-size-scale, 1));
56
+ z-index: 1;
57
+ width: calc(56px * var(--ipc-player-size-scale, 1));
58
+ height: calc(28px * var(--ipc-player-size-scale, 1));
59
+ background: var(--capture-result-far-backdrop-color);
60
+ }
61
+
62
+ .ipc-player-plugin-capture-result-image-middle {
63
+ top: calc(3px * var(--ipc-player-size-scale, 1));
64
+ left: calc(2.5px * var(--ipc-player-size-scale, 1));
65
+ z-index: 2;
66
+ width: calc(61px * var(--ipc-player-size-scale, 1));
67
+ height: calc(30.5px * var(--ipc-player-size-scale, 1));
68
+ background: var(--capture-result-near-backdrop-color);
69
+ }
70
+
71
+ .ipc-player-plugin-capture-result-image-front {
72
+ top: calc(5px * var(--ipc-player-size-scale, 1));
73
+ left: 0;
74
+ z-index: 3;
75
+ width: calc(66px * var(--ipc-player-size-scale, 1));
76
+ height: calc(33px * var(--ipc-player-size-scale, 1));
77
+ }
78
+
79
+ .ipc-player-plugin-capture-result-play-icon-box,
80
+ .ipc-player-plugin-record-success-play-icon-box {
81
+ position: absolute;
82
+ top: 50%;
83
+ left: 50%;
84
+ z-index: 4;
85
+ display: flex;
86
+ align-items: center;
87
+ justify-content: center;
88
+ width: calc(16px * var(--ipc-player-size-scale, 1));
89
+ height: calc(16px * var(--ipc-player-size-scale, 1));
90
+ overflow: hidden;
91
+ background-color: rgba(0, 0, 0, 0.2);
92
+ border-radius: 50%;
93
+ transform: translate(-50%, -50%);
94
+ }
95
+
96
+ .ipc-player-plugin-capture-result-image-box-multi
97
+ .ipc-player-plugin-capture-result-play-icon-box {
98
+ top: calc(50% + 2px * var(--ipc-player-size-scale, 1));
99
+ }
100
+
101
+ .ipc-player-plugin-capture-result-play-icon,
102
+ .ipc-player-plugin-record-success-play-icon {
103
+ color: #ffffff;
104
+ font-size: calc(9px * var(--ipc-player-size-scale, 1)) !important;
105
+ }
106
+
107
+ .ipc-player-plugin-capture-result-title,
108
+ .ipc-player-plugin-record-success-toast-title,
109
+ .ipc-player-plugin-screenshot-toast-title {
110
+ display: flex;
111
+ flex: 1;
112
+ flex-direction: column;
113
+ min-width: 0;
114
+ margin-right: calc(12px * var(--ipc-player-size-scale, 1));
115
+ margin-left: calc(8px * var(--ipc-player-size-scale, 1));
116
+ color: var(--capture-result-text-color, var(--fontColor));
117
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
118
+ line-height: calc(20px * var(--ipc-player-size-scale, 1));
119
+ word-break: break-word;
120
+ }
121
+
122
+ .ipc-player-plugin-capture-result-count {
123
+ margin-top: calc(2px * var(--ipc-player-size-scale, 1));
124
+ color: var(--capture-result-text-color, var(--fontColor));
125
+ font-size: calc(12px * var(--ipc-player-size-scale, 1));
126
+ line-height: calc(17px * var(--ipc-player-size-scale, 1));
127
+ opacity: 0.5;
128
+ }
129
+
130
+ .ipc-player-plugin-capture-result-check,
131
+ .ipc-player-plugin-record-success-toast-bottom,
132
+ .ipc-player-plugin-screenshot-toast-bottom {
133
+ min-width: calc(52px * var(--ipc-player-size-scale, 1));
134
+ max-width: calc(100px * var(--ipc-player-size-scale, 1));
135
+ flex-shrink: 0;
136
+ padding: calc(5px * var(--ipc-player-size-scale, 1))
137
+ calc(11px * var(--ipc-player-size-scale, 1));
138
+ overflow: hidden;
139
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
140
+ white-space: nowrap;
141
+ text-overflow: ellipsis;
142
+ border: 1px solid #1989fa;
143
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
144
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { renderToStaticMarkup } from 'react-dom/server';
3
+ jest.mock('@ray-js/ray', () => {
4
+ const React = require('react');
5
+ return {
6
+ Image: _ref => {
7
+ let {
8
+ className,
9
+ src
10
+ } = _ref;
11
+ return /*#__PURE__*/React.createElement("img", {
12
+ alt: "",
13
+ className: className,
14
+ src: src
15
+ });
16
+ },
17
+ Text: _ref2 => {
18
+ let {
19
+ children,
20
+ className
21
+ } = _ref2;
22
+ return /*#__PURE__*/React.createElement("span", {
23
+ className: className
24
+ }, children);
25
+ },
26
+ View: _ref3 => {
27
+ let {
28
+ children,
29
+ className
30
+ } = _ref3;
31
+ return /*#__PURE__*/React.createElement("div", {
32
+ className: className
33
+ }, children);
34
+ }
35
+ };
36
+ });
37
+ jest.mock('../../i18n', () => ({
38
+ __esModule: true,
39
+ default: {
40
+ getLang: key => key,
41
+ formatString: (template, count) => `${template}:${count}`
42
+ }
43
+ }));
44
+ jest.mock('./captureResult.less', () => ({}));
45
+ const {
46
+ CaptureResultToast
47
+ } = require('./captureResult');
48
+ const renderToast = count => renderToStaticMarkup(/*#__PURE__*/React.createElement(CaptureResultToast, {
49
+ brandColor: "#ff592a",
50
+ count: count,
51
+ kind: "screenshot",
52
+ onCheck: () => undefined,
53
+ thumbnailPath: "thingfile://capture.jpg"
54
+ }));
55
+ const countClass = (markup, className) => [...markup.matchAll(/class="([^"]*)"/g)].filter(_ref4 => {
56
+ let [, names] = _ref4;
57
+ return names.split(/\s+/).includes(className);
58
+ }).length;
59
+ describe('CaptureResultToast', () => {
60
+ it('keeps the single-item thumbnail unchanged', () => {
61
+ const markup = renderToast(1);
62
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(0);
63
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(0);
64
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image')).toBe(1);
65
+ });
66
+ it('renders both backdrops for two captured items', () => {
67
+ const markup = renderToast(2);
68
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
69
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
70
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
71
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
72
+ });
73
+ it('caps the backdrop count at two', () => {
74
+ const markup = renderToast(4);
75
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
76
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
77
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
78
+ expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
79
+ });
80
+ });
@@ -0,0 +1,2 @@
1
+ export * from './captureResult';
2
+ export type { CaptureResultToastProps, CaptureKind } from './captureResult';
@@ -0,0 +1,2 @@
1
+ export * from './captureResult';
2
+ export {};
@@ -24,3 +24,4 @@ export * from './toggleVerticalFull';
24
24
  export * from './flowLowTip';
25
25
  export * from './realTimeMagnification';
26
26
  export * from './zoomTurntable';
27
+ export * from './captureResult';
@@ -23,4 +23,5 @@ export * from './smallIntercom';
23
23
  export * from './toggleVerticalFull';
24
24
  export * from './flowLowTip';
25
25
  export * from './realTimeMagnification';
26
- export * from './zoomTurntable';
26
+ export * from './zoomTurntable';
27
+ export * from './captureResult';
@@ -17,13 +17,19 @@ export const Muted = props => {
17
17
  } = useContext(UIEventContext);
18
18
  const event = propsEvent !== null && propsEvent !== void 0 ? propsEvent : ctxEvent;
19
19
  const {
20
- isMuted
20
+ isMuted,
21
+ intercom
21
22
  } = useStore({
22
- isMuted: mute
23
+ isMuted: mute,
24
+ intercom: props.intercom
23
25
  });
26
+ const disabled = intercom;
24
27
  return /*#__PURE__*/React.createElement(View, {
25
- className: clsx(className),
28
+ className: clsx(className, {
29
+ 'ipc-player-plugin-muted-disabled': disabled
30
+ }),
26
31
  onClick: () => {
32
+ if (disabled) return;
27
33
  event.emit(widgetClick, {
28
34
  widgetId: widgetLabs.MUTED
29
35
  });
@@ -8,4 +8,8 @@
8
8
  .ipc-player-plugin-muted-text-icon {
9
9
  color: var(--iconColor);
10
10
  font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
11
- }
11
+ }
12
+
13
+ .ipc-player-plugin-muted-disabled {
14
+ opacity: 0.4;
15
+ }
@@ -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
+ });
@@ -1,10 +1,12 @@
1
1
  import React, { useState, useEffect, useRef, useContext } from 'react';
2
- import { View, Text, Image, getSystemInfoSync } from '@ray-js/ray';
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
6
  import Strings from '../../i18n';
7
7
  import { PlayState } from '../../interface';
8
+ import { getCaptureResultSummary } from '../../utils/captureResult';
9
+ import { CaptureResultToast } from '../captureResult/captureResult';
8
10
  import { UIEventContext } from '../../ui/context';
9
11
  import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
10
12
  import { useStore, getDefaultStore } from '../../ctx/store';
@@ -100,22 +102,45 @@ export function RecordVideo(props) {
100
102
  playState: props.playState
101
103
  });
102
104
  const [state, setState] = useSetState({
103
- showTimer: false,
104
105
  showShot: false,
105
- shotUrl: ''
106
+ shotUrl: '',
107
+ shotCount: 0
106
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
+ };
107
132
 
108
133
  /**
109
134
  * 针对 playState为非连接中状态时,如果处于录制中, 结束录制
110
135
  */
111
136
  useEffect(() => {
112
137
  (async () => {
113
- if (playState !== PlayState.PLAYING) {
114
- if (recording) {
115
- setState({
116
- showTimer: false
117
- });
118
- await setRecording(false);
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.
119
144
  }
120
145
  }
121
146
  })();
@@ -129,7 +154,8 @@ export function RecordVideo(props) {
129
154
  timer.current = setTimeout(() => {
130
155
  setState({
131
156
  showShot: false,
132
- shotUrl: ''
157
+ shotUrl: '',
158
+ shotCount: 0
133
159
  });
134
160
  deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
135
161
  }, CLOSE_TIME);
@@ -149,22 +175,20 @@ export function RecordVideo(props) {
149
175
  showRecordToast();
150
176
  }
151
177
  }, [state.showShot, screenType]);
152
-
153
- /** 根据showTimer的显示定时器 */
154
178
  useUpdateEffect(() => {
155
- if (state.showTimer) {
179
+ if (recording) {
156
180
  showRecordTimer();
157
181
  } else {
158
182
  deleteContent('absolute', RECORD_VIDEO_TIMER_ID);
159
- // 清除定时器,元素移除
160
183
  }
161
- }, [state.showTimer]);
184
+ }, [recording]);
162
185
 
163
186
  /** 跳转相册 */
164
187
  const handCheck = () => {
165
188
  setState({
166
189
  showShot: false,
167
- shotUrl: ''
190
+ shotUrl: '',
191
+ shotCount: 0
168
192
  });
169
193
  deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
170
194
  clearInterval(timer.current);
@@ -186,27 +210,13 @@ export function RecordVideo(props) {
186
210
  marginLeft: screenType === 'vertical' ? '0' : '-200px'
187
211
  },
188
212
  content: () => {
189
- return /*#__PURE__*/React.createElement(View, {
190
- className: "ipc-player-plugin-record-success-toast"
191
- }, /*#__PURE__*/React.createElement(View, {
192
- className: "ipc-player-plugin-record-success-toast-image-box"
193
- }, /*#__PURE__*/React.createElement(Image, {
194
- className: "ipc-player-plugin-record-success-toast-image",
195
- src: state.shotUrl
196
- }), /*#__PURE__*/React.createElement(View, {
197
- className: "ipc-player-plugin-record-success-play-icon-box"
198
- }, /*#__PURE__*/React.createElement(Text, {
199
- className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-record-success-play-icon')
200
- }))), /*#__PURE__*/React.createElement(View, {
201
- className: "ipc-player-plugin-record-success-toast-title"
202
- }, Strings.getLang('ipc_player_record_success_tip')), /*#__PURE__*/React.createElement(View, {
203
- onClick: handCheck,
204
- className: "ipc-player-plugin-record-success-toast-bottom",
205
- style: {
206
- color: brandColor,
207
- borderColor: brandColor
208
- }
209
- }, 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
+ });
210
220
  }
211
221
  });
212
222
  timeToCloseRecordToast();
@@ -218,8 +228,8 @@ export function RecordVideo(props) {
218
228
  absoluteContentClassName: 'ipc-player-plugin-record-video-toast-wrap',
219
229
  content: () => /*#__PURE__*/React.createElement(View, {
220
230
  className: clsx('ipc-player-plugin-record-video-toast', {
221
- 'ipc-player-plugin-record-video-toast-show': state.showTimer,
222
- 'ipc-player-plugin-record-video-toast-hide': !state.showTimer
231
+ 'ipc-player-plugin-record-video-toast-show': recording,
232
+ 'ipc-player-plugin-record-video-toast-hide': !recording
223
233
  })
224
234
  }, /*#__PURE__*/React.createElement(View, {
225
235
  className: "ipc-player-plugin-record-video-toast-point",
@@ -230,9 +240,9 @@ export function RecordVideo(props) {
230
240
  });
231
241
  };
232
242
  const handRecordVideo = async () => {
233
- var _props$event, _props$event2;
243
+ var _props$event;
234
244
  const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
235
- ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
245
+ ev.emit(widgetClick, {
236
246
  widgetId: widgetLabs.RECORD_VIDEO
237
247
  });
238
248
  event.emit(pauseTimeToHideAllComponent);
@@ -242,6 +252,7 @@ export function RecordVideo(props) {
242
252
  if (recordingDisabled) {
243
253
  return false;
244
254
  }
255
+ recordResultRequestIdRef.current += 1;
245
256
  if (state.showShot && _recording) {
246
257
  setState({
247
258
  showShot: false
@@ -262,18 +273,11 @@ export function RecordVideo(props) {
262
273
  }
263
274
  if (target) {
264
275
  setRecordingDisabled(true);
265
- setState({
266
- showTimer: true
267
- });
268
276
  /** 录制开始后3秒后才可结束 */
269
277
  timeToResetRecordDisabled();
270
278
  } else {
271
279
  props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
272
- setState({
273
- showTimer: false,
274
- showShot: true,
275
- shotUrl: recordInfo.tempImagePath
276
- });
280
+ await showRecordResult(recordInfo);
277
281
  }
278
282
  } catch (err) {
279
283
  props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
@@ -283,9 +287,6 @@ export function RecordVideo(props) {
283
287
  toast({
284
288
  title: errMsg
285
289
  });
286
- setState({
287
- showTimer: false
288
- });
289
290
  }
290
291
  return true;
291
292
  };