@ray-js/ipc-player-integration 0.0.65-beta.2 → 0.0.65-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/ui/ui.js CHANGED
@@ -703,10 +703,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
703
703
  var _instance$multiLens, _instance$multiCamera;
704
704
  const summary = await getCaptureResultSummary(result, {
705
705
  multiLens: (_instance$multiLens = instance === null || instance === void 0 ? void 0 : instance.multiLens) !== null && _instance$multiLens !== void 0 ? _instance$multiLens : false,
706
- protocolCount: instance === null || instance === void 0 || (_instance$multiCamera = instance.multiCameraCtx) === null || _instance$multiCamera === void 0 || (_instance$multiCamera = _instance$multiCamera.protocol) === null || _instance$multiCamera === void 0 ? void 0 : _instance$multiCamera.total_split_num,
706
+ lensIndices: instance === null || instance === void 0 || (_instance$multiCamera = instance.multiCameraCtx) === null || _instance$multiCamera === void 0 || (_instance$multiCamera = _instance$multiCamera.protocol) === null || _instance$multiCamera === void 0 || (_instance$multiCamera = _instance$multiCamera.split_info) === null || _instance$multiCamera === void 0 ? void 0 : _instance$multiCamera.map(lens => lens.index),
707
707
  devId
708
708
  });
709
- ipcTTTOperatorLog(summary !== null && summary !== void 0 && summary.isMultiLens ? `hide: stop recording succeeded with ${summary.count} files` : 'hide: 调用停止录制方法成功');
709
+ ipcTTTOperatorLog(summary !== null && summary !== void 0 && summary.isMultiLens ? `hide: stop recording succeeded with ${summary.count} thumbnails` : 'hide: 调用停止录制方法成功');
710
710
  }).catch(() => {
711
711
  ipcTTTOperatorLog('hide: 调用停止录制方法失败');
712
712
  });
@@ -6,9 +6,7 @@ export type CaptureResultSummary = {
6
6
  };
7
7
  export type CaptureResultOptions = {
8
8
  multiLens: boolean;
9
- protocolCount?: number | string;
9
+ lensIndices?: number[];
10
10
  devId: string;
11
11
  };
12
- /** 从新多目高级能力配置获取当前设备的总镜头数 */
13
- export declare function getMultiLensCountFromAbility(devId: string): Promise<number>;
14
- export declare function getCaptureResultSummary(result: CaptureResult, { multiLens, protocolCount, devId }: CaptureResultOptions): Promise<CaptureResultSummary | null>;
12
+ export declare function getCaptureResultSummary(result: CaptureResult, { multiLens, lensIndices, devId }: CaptureResultOptions): Promise<CaptureResultSummary | null>;
@@ -1,70 +1,70 @@
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";
1
4
  /* eslint-disable camelcase */
2
-
5
+ import { getFileSystemManager } from '@ray-js/ray';
3
6
  import { getDeviceInfo } from './device';
4
7
  const MULTI_LENS_ABILITY_CODE = 'tyabimr4v3';
5
8
  const LENS_SUFFIX_PATTERN = /_lens\d+(?=\.[^./?#]+(?:[?#].*)?$)/;
6
9
  const FILE_EXTENSION_PATTERN = /(\.[^./?#]+)([?#].*)?$/;
7
- /** 从新多目高级能力配置获取当前设备的总镜头数 */
8
- export async function getMultiLensCountFromAbility(devId) {
9
- if (!devId) return 0;
10
+ const getMultiLensIndices = async devId => {
10
11
  try {
11
- var _devInfo$configMetas;
12
+ var _devInfo$configMetas, _config$split_info;
12
13
  const devInfo = await getDeviceInfo(devId);
13
14
  const raw = devInfo === null || devInfo === void 0 || (_devInfo$configMetas = devInfo.configMetas) === null || _devInfo$configMetas === void 0 ? void 0 : _devInfo$configMetas[MULTI_LENS_ABILITY_CODE];
14
- if (raw) {
15
- const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
16
- const count = Number(parsed === null || parsed === void 0 ? void 0 : parsed.total_split_num) || (Array.isArray(parsed === null || parsed === void 0 ? void 0 : parsed.split_info) ? parsed.split_info.length : 0);
17
- if (count > 1) {
18
- return count;
19
- }
20
- }
21
- } catch (e) {
22
- // ignore
15
+ const config = typeof raw === 'string' ? JSON.parse(raw) : raw;
16
+ return (config === null || config === void 0 || (_config$split_info = config.split_info) === null || _config$split_info === void 0 ? void 0 : _config$split_info.map(item => Number(item.index))) || [];
17
+ } catch {
18
+ return [];
23
19
  }
24
- return 0;
25
- }
26
- const normalizeMultiLensThumbnailPath = path => {
27
- if (!path || LENS_SUFFIX_PATTERN.test(path)) return path;
28
- return path.replace(FILE_EXTENSION_PATTERN, '_lens1$1$2');
29
20
  };
21
+ const getLensPath = (path, index) => path.replace(LENS_SUFFIX_PATTERN, '').replace(FILE_EXTENSION_PATTERN, `_lens${index}$1$2`);
30
22
  const extractPath = item => {
31
- if (!item) return '';
32
23
  if (typeof item === 'string') return item;
33
24
  if (typeof (item === null || item === void 0 ? void 0 : item.value) === 'string') return item.value;
34
25
  return '';
35
26
  };
27
+ const imageExists = async path => {
28
+ if (!path) return false;
29
+ try {
30
+ const manager = await getFileSystemManager();
31
+ return await new Promise(resolve => {
32
+ manager.access({
33
+ path,
34
+ success: () => resolve(true),
35
+ fail: () => resolve(false)
36
+ });
37
+ });
38
+ } catch {
39
+ return false;
40
+ }
41
+ };
36
42
  export async function getCaptureResultSummary(result, _ref) {
37
43
  let {
38
44
  multiLens,
39
- protocolCount,
45
+ lensIndices,
40
46
  devId
41
47
  } = _ref;
42
48
  if (!result || typeof result === 'boolean') return null;
43
- const thumbnailPath = extractPath(result.tempImagePath) || extractPath(result.thumbPath) || extractPath(result.filePath) || '';
44
49
  if (!multiLens) {
45
50
  return {
46
51
  count: 1,
47
52
  isMultiLens: false,
48
- thumbnailPath
49
- };
50
- }
51
- const splitCount = Number(protocolCount) > 1 ? Number(protocolCount) : 0;
52
- const multiLensAbilityCount = await getMultiLensCountFromAbility(devId);
53
-
54
- // The native multi-lens snapshot can return one object while writing lens-specific
55
- // files. Use the ability result to distinguish that file-name convention from the
56
- // legacy split protocol.
57
- const multiCount = splitCount || multiLensAbilityCount;
58
- if (multiCount > 1) {
59
- return {
60
- count: multiCount,
61
- isMultiLens: true,
62
- thumbnailPath: multiLensAbilityCount > 1 ? normalizeMultiLensThumbnailPath(thumbnailPath) : thumbnailPath
53
+ thumbnailPath: extractPath(result.tempImagePath) || extractPath(result.thumbPath) || extractPath(result.filePath)
63
54
  };
64
55
  }
56
+ const thumbnailPath = extractPath(result.thumbPath) || extractPath(result.tempImagePath);
57
+ if (!thumbnailPath) return null;
58
+ const indices = [...new Set(lensIndices !== null && lensIndices !== void 0 && lensIndices.length ? lensIndices : await getMultiLensIndices(devId))];
59
+ const thumbnails = await Promise.all(indices.map(async index => {
60
+ const path = getLensPath(thumbnailPath, index);
61
+ return (await imageExists(path)) ? path : '';
62
+ }));
63
+ const existingThumbnails = thumbnails.filter(Boolean);
64
+ if (!existingThumbnails.length) return null;
65
65
  return {
66
- count: 1,
67
- isMultiLens: false,
68
- thumbnailPath
66
+ count: existingThumbnails.length,
67
+ isMultiLens: true,
68
+ thumbnailPath: existingThumbnails[0]
69
69
  };
70
70
  }
@@ -1,117 +1,223 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { getFileInfo, getFileSystemManager } from '@ray-js/ray';
1
3
  import { getCaptureResultSummary } from './captureResult';
2
4
  import { getDeviceInfo } from './device';
5
+ jest.mock('@ray-js/ray', () => ({
6
+ getFileInfo: jest.fn(),
7
+ getFileSystemManager: jest.fn()
8
+ }));
3
9
  jest.mock('./device', () => ({
4
10
  getDeviceInfo: jest.fn()
5
11
  }));
6
12
  const mockGetDeviceInfo = getDeviceInfo;
7
- const basePath = 'thingfile://tmp/capture_123.jpg';
8
- const createCaptureResult = tempImagePath => ({
9
- tempImagePath,
10
- filePath: tempImagePath
13
+ const mockGetFileInfo = getFileInfo;
14
+ const mockGetFileSystemManager = getFileSystemManager;
15
+ const access = jest.fn();
16
+ const basePath = 'https://thing.miniapp.com/__tmp__/capture.png';
17
+ const result = {
18
+ tempImagePath: basePath,
19
+ filePath: basePath
20
+ };
21
+ const options = {
22
+ multiLens: true,
23
+ lensIndices: [1, 2, 3, 4],
24
+ devId: 'dev-1'
25
+ };
26
+ beforeEach(() => {
27
+ jest.resetAllMocks();
28
+ mockGetDeviceInfo.mockResolvedValue({
29
+ configMetas: {}
30
+ });
31
+ mockGetFileSystemManager.mockReturnValue({
32
+ access
33
+ });
34
+ access.mockImplementation(_ref => {
35
+ let {
36
+ success
37
+ } = _ref;
38
+ return success();
39
+ });
40
+ mockGetFileInfo.mockImplementation(() => {
41
+ throw new Error('Source file inspection is forbidden');
42
+ });
11
43
  });
12
- describe('getCaptureResultSummary', () => {
13
- beforeEach(() => {
14
- mockGetDeviceInfo.mockReset();
15
- mockGetDeviceInfo.mockResolvedValue({
16
- configMetas: {}
17
- });
44
+ it('counts existing images instead of the configured lens total', async () => {
45
+ access.mockImplementation(_ref2 => {
46
+ let {
47
+ path,
48
+ success,
49
+ fail
50
+ } = _ref2;
51
+ if (path.endsWith('_lens2.png')) fail({
52
+ errorCode: 10011
53
+ });else success();
18
54
  });
19
- it('normalizes the thumbnail path for the new multi-lens ability', async () => {
20
- mockGetDeviceInfo.mockResolvedValue({
21
- configMetas: {
22
- tyabimr4v3: {
23
- total_split_num: 4
24
- }
25
- }
26
- });
27
- await expect(getCaptureResultSummary(createCaptureResult(basePath), {
28
- multiLens: true,
29
- devId: 'dev-1'
30
- })).resolves.toEqual({
31
- count: 4,
32
- isMultiLens: true,
33
- thumbnailPath: 'thingfile://tmp/capture_123_lens1.jpg'
34
- });
55
+ await expect(getCaptureResultSummary(result, options)).resolves.toEqual({
56
+ count: 3,
57
+ isMultiLens: true,
58
+ thumbnailPath: 'https://thing.miniapp.com/__tmp__/capture_lens1.png'
35
59
  });
36
- it('keeps the single-lens result for a legacy multi-camera device', async () => {
37
- await expect(getCaptureResultSummary(createCaptureResult(basePath), {
38
- multiLens: false,
39
- protocolCount: 4,
40
- devId: 'dev-1'
41
- })).resolves.toEqual({
42
- count: 1,
43
- isMultiLens: false,
44
- thumbnailPath: basePath
45
- });
46
- expect(mockGetDeviceInfo).not.toHaveBeenCalled();
47
- });
48
- it('uses the protocol count when the multi-lens mode is enabled', async () => {
49
- await expect(getCaptureResultSummary(createCaptureResult(basePath), {
50
- multiLens: true,
51
- protocolCount: 4,
52
- devId: 'dev-1'
53
- })).resolves.toEqual({
54
- count: 4,
55
- isMultiLens: true,
56
- thumbnailPath: basePath
57
- });
58
- expect(mockGetDeviceInfo).toHaveBeenCalledWith('dev-1');
59
- });
60
- it('uses the lens path when both multi-lens sources are present', async () => {
61
- mockGetDeviceInfo.mockResolvedValue({
62
- configMetas: {
63
- tyabimr4v3: {
64
- total_split_num: 4
65
- }
66
- }
67
- });
68
- await expect(getCaptureResultSummary(createCaptureResult(basePath), {
69
- multiLens: true,
70
- protocolCount: 4,
71
- devId: 'dev-1'
72
- })).resolves.toEqual({
73
- count: 4,
74
- isMultiLens: true,
75
- thumbnailPath: 'thingfile://tmp/capture_123_lens1.jpg'
60
+ });
61
+ it('uses protocol indices unchanged and selects the first existing image', async () => {
62
+ access.mockImplementation(_ref3 => {
63
+ let {
64
+ path,
65
+ success,
66
+ fail
67
+ } = _ref3;
68
+ if (path === 'https://thing.miniapp.com/__tmp__/capture_lens7.png') success();else fail({
69
+ errorCode: 10011
76
70
  });
77
71
  });
78
- it('does not add a duplicate lens suffix', async () => {
79
- mockGetDeviceInfo.mockResolvedValue({
80
- configMetas: {
81
- tyabimr4v3: JSON.stringify({
82
- total_split_num: 4
83
- })
84
- }
85
- });
86
- const path = 'thingfile://tmp/capture_123_lens1.jpg';
87
- await expect(getCaptureResultSummary(createCaptureResult(path), {
88
- multiLens: true,
89
- devId: 'dev-1'
90
- })).resolves.toEqual({
91
- count: 4,
92
- isMultiLens: true,
93
- thumbnailPath: path
72
+ await expect(getCaptureResultSummary(result, _objectSpread(_objectSpread({}, options), {}, {
73
+ lensIndices: [2, 7, 9]
74
+ }))).resolves.toEqual({
75
+ count: 1,
76
+ isMultiLens: true,
77
+ thumbnailPath: 'https://thing.miniapp.com/__tmp__/capture_lens7.png'
78
+ });
79
+ });
80
+ it('waits for access callbacks even when the method returns undefined', async () => {
81
+ const callbacks = [];
82
+ access.mockImplementation(_ref4 => {
83
+ let {
84
+ success
85
+ } = _ref4;
86
+ callbacks.push(success);
87
+ });
88
+ const summary = getCaptureResultSummary(result, options);
89
+ await Promise.resolve();
90
+ await Promise.resolve();
91
+ expect(callbacks).toHaveLength(4);
92
+ for (const success of callbacks) success();
93
+ await expect(summary).resolves.toMatchObject({
94
+ count: 4
95
+ });
96
+ });
97
+ it('returns no success summary when every image is missing', async () => {
98
+ access.mockImplementation(_ref5 => {
99
+ let {
100
+ fail
101
+ } = _ref5;
102
+ return fail({
103
+ errorCode: 10011
94
104
  });
95
105
  });
96
- it('keeps a mono result unchanged', async () => {
97
- await expect(getCaptureResultSummary(createCaptureResult(basePath), {
98
- multiLens: false,
99
- devId: 'dev-1'
100
- })).resolves.toEqual({
101
- count: 1,
102
- isMultiLens: false,
103
- thumbnailPath: basePath
106
+ await expect(getCaptureResultSummary(result, options)).resolves.toBeNull();
107
+ });
108
+ it('does not duplicate a lens suffix or count duplicate indices', async () => {
109
+ await expect(getCaptureResultSummary({
110
+ tempImagePath: 'thingfile://tmp/capture_lens7.jpg?token=a',
111
+ filePath: ''
112
+ }, _objectSpread(_objectSpread({}, options), {}, {
113
+ lensIndices: [2, 7, 7]
114
+ }))).resolves.toEqual({
115
+ count: 2,
116
+ isMultiLens: true,
117
+ thumbnailPath: 'thingfile://tmp/capture_lens2.jpg?token=a'
118
+ });
119
+ });
120
+ it('reads the original lens indices from the ability when no protocol is supplied', async () => {
121
+ mockGetDeviceInfo.mockResolvedValue({
122
+ configMetas: {
123
+ tyabimr4v3: JSON.stringify({
124
+ split_info: [{
125
+ index: '2'
126
+ }, {
127
+ index: '7'
128
+ }]
129
+ })
130
+ }
131
+ });
132
+ await expect(getCaptureResultSummary(result, {
133
+ multiLens: true,
134
+ devId: 'dev-1'
135
+ })).resolves.toMatchObject({
136
+ count: 2,
137
+ thumbnailPath: basePath.replace('.png', '_lens2.png')
138
+ });
139
+ });
140
+ it('keeps legacy or mono capture unchanged', async () => {
141
+ await expect(getCaptureResultSummary(result, {
142
+ multiLens: false,
143
+ lensIndices: [1],
144
+ devId: 'dev-1'
145
+ })).resolves.toEqual({
146
+ count: 1,
147
+ isMultiLens: false,
148
+ thumbnailPath: basePath
149
+ });
150
+ expect(access).not.toHaveBeenCalled();
151
+ expect(mockGetFileInfo).not.toHaveBeenCalled();
152
+ });
153
+ it('counts recording thumbnails even when the source video path is missing', async () => {
154
+ const recording = {
155
+ tempImagePath: '',
156
+ thumbPath: basePath,
157
+ filePath: '/missing/record.mp4'
158
+ };
159
+ access.mockImplementation(_ref6 => {
160
+ let {
161
+ path,
162
+ success,
163
+ fail
164
+ } = _ref6;
165
+ if (path.endsWith('_lens2.png')) fail({
166
+ errorCode: 10011
167
+ });else success();
168
+ });
169
+ await expect(getCaptureResultSummary(recording, options)).resolves.toEqual({
170
+ count: 3,
171
+ isMultiLens: true,
172
+ thumbnailPath: basePath.replace('.png', '_lens1.png')
173
+ });
174
+ expect(mockGetFileInfo).not.toHaveBeenCalled();
175
+ expect(recording.filePath).toBe('/missing/record.mp4');
176
+ });
177
+ it('does not count source videos when every recording thumbnail is missing', async () => {
178
+ access.mockImplementation(_ref7 => {
179
+ let {
180
+ fail
181
+ } = _ref7;
182
+ return fail({
183
+ errorCode: 10011
104
184
  });
105
185
  });
106
- it('keeps a single-lens result when multi-lens mode has one lens', async () => {
107
- await expect(getCaptureResultSummary(createCaptureResult(basePath), {
108
- multiLens: true,
109
- protocolCount: 1,
110
- devId: 'dev-1'
111
- })).resolves.toEqual({
112
- count: 1,
113
- isMultiLens: false,
114
- thumbnailPath: basePath
186
+ await expect(getCaptureResultSummary(_objectSpread(_objectSpread({}, result), {}, {
187
+ filePath: '/album/record.mp4'
188
+ }), options)).resolves.toBeNull();
189
+ expect(mockGetFileInfo).not.toHaveBeenCalled();
190
+ });
191
+ it('never falls back to a source path when no thumbnail is returned', async () => {
192
+ await expect(getCaptureResultSummary({
193
+ tempImagePath: '',
194
+ filePath: '/album/record.mp4'
195
+ }, options)).resolves.toBeNull();
196
+ expect(access).not.toHaveBeenCalled();
197
+ expect(mockGetFileInfo).not.toHaveBeenCalled();
198
+ });
199
+ it('uses explicit thumbnails ahead of other image paths without renumbering lenses', async () => {
200
+ access.mockImplementation(_ref8 => {
201
+ let {
202
+ path,
203
+ success,
204
+ fail
205
+ } = _ref8;
206
+ if (path === 'thingfile://tmp/record_thumb_lens7.png') success();else fail({
207
+ errorCode: 10011
115
208
  });
116
209
  });
210
+ const recording = {
211
+ tempImagePath: 'thingfile://tmp/other.png',
212
+ thumbPath: 'thingfile://tmp/record_thumb.png',
213
+ filePath: '/album/record.mp4'
214
+ };
215
+ await expect(getCaptureResultSummary(recording, _objectSpread(_objectSpread({}, options), {}, {
216
+ lensIndices: [2, 7, 9]
217
+ }))).resolves.toEqual({
218
+ count: 1,
219
+ isMultiLens: true,
220
+ thumbnailPath: 'thingfile://tmp/record_thumb_lens7.png'
221
+ });
222
+ expect(recording.filePath).toBe('/album/record.mp4');
117
223
  });
@@ -72,7 +72,7 @@ export function CaptureResultToast(_ref) {
72
72
  className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-capture-result-play-icon', legacyCls.playIcon)
73
73
  }))), /*#__PURE__*/React.createElement(View, {
74
74
  className: clsx('ipc-player-plugin-capture-result-title', legacyCls.title)
75
- }, title ? typeof title === 'string' ? /*#__PURE__*/React.createElement(Text, null, title) : title : isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
75
+ }, title ? typeof title === 'string' ? /*#__PURE__*/React.createElement(Text, null, title) : title : count > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
76
76
  className: "ipc-player-plugin-capture-result-count"
77
77
  }, Strings.formatString(Strings.getLang('ipc_player_multi_capture_success_count'), count))) : Strings.getLang(textKeys.single)), /*#__PURE__*/React.createElement(View, {
78
78
  onClick: onCheck,
@@ -57,6 +57,10 @@ const countClass = (markup, className) => [...markup.matchAll(/class="([^"]*)"/g
57
57
  return names.split(/\s+/).includes(className);
58
58
  }).length;
59
59
  describe('CaptureResultToast', () => {
60
+ it('shows the actual count for one successful multi-lens item', () => {
61
+ expect(renderToast(1)).toContain('ipc_player_multi_capture_success_count:1');
62
+ expect(renderToast(0)).not.toContain('ipc_player_multi_capture_success_count');
63
+ });
60
64
  it('keeps the single-item thumbnail unchanged', () => {
61
65
  const markup = renderToast(1);
62
66
  expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(0);
@@ -1,3 +1,5 @@
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
4
  import { View, Text, getSystemInfoSync } from '@ray-js/ray';
3
5
  import { useSetState, useUpdateEffect } from 'ahooks';
@@ -115,10 +117,10 @@ export function RecordVideo(props) {
115
117
  const showRecordResult = async recordInfo => {
116
118
  var _props$multiCameraCtx;
117
119
  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;
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);
119
121
  const summary = await getCaptureResultSummary(recordInfo, {
120
122
  multiLens: props.multiLens,
121
- protocolCount: splitNum,
123
+ lensIndices,
122
124
  devId
123
125
  });
124
126
  if (requestId !== recordResultRequestIdRef.current) return;
@@ -253,10 +255,12 @@ export function RecordVideo(props) {
253
255
  return false;
254
256
  }
255
257
  recordResultRequestIdRef.current += 1;
256
- if (state.showShot && _recording) {
258
+ if (state.showShot) {
257
259
  setState({
258
260
  showShot: false
259
261
  });
262
+ deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
263
+ clearTimeout(timer.current);
260
264
  }
261
265
  // 发送忽略进入后台停止预览的标记
262
266
  const {
@@ -1,3 +1,5 @@
1
+ import "core-js/modules/esnext.iterator.constructor.js";
2
+ import "core-js/modules/esnext.iterator.map.js";
1
3
  import React, { useContext, useEffect, useRef } from 'react';
2
4
  import { View, Text, getSystemInfoSync } from '@ray-js/ray';
3
5
  import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
@@ -109,6 +111,8 @@ export function Screenshot(props) {
109
111
  widgetId: widgetLabs.SCREENSHOT
110
112
  });
111
113
  console.log('截屏!!!');
114
+ deleteContent('absolute', 'plugin-screenshot-toast');
115
+ clearTimeout(timer.current);
112
116
  setState({
113
117
  showShot: false
114
118
  });
@@ -142,17 +146,14 @@ export function Screenshot(props) {
142
146
  success: async res => {
143
147
  var _props$multiCameraCtx;
144
148
  setIgnoreHideStopPreview(false);
145
- 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;
149
+ 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);
146
150
  const summary = await getCaptureResultSummary(res, {
147
151
  multiLens: props.multiLens,
148
- protocolCount: splitNum,
152
+ lensIndices,
149
153
  devId
150
154
  });
151
155
  if (requestId !== snapshotRequestIdRef.current) return;
152
- if (!summary) {
153
- handleSnapshotFail({});
154
- return;
155
- }
156
+ if (!summary) return;
156
157
  setState({
157
158
  showShot: true,
158
159
  shotUrl: summary.thumbnailPath,
@@ -1,6 +1,6 @@
1
1
  import { act, renderHook } from '@testing-library/react-hooks/dom';
2
2
  import { atom } from 'jotai';
3
- import { authorize, authorizeStatus, getSystemInfoSync, showModal } from '@ray-js/ray';
3
+ import { authorize, authorizeStatus, getFileSystemManager, getSystemInfoSync, showModal } from '@ray-js/ray';
4
4
  import { getDeviceInfo } from '../../utils/device';
5
5
  import { Screenshot } from './screenshot';
6
6
  jest.mock('@ray-js/ray', () => ({
@@ -8,6 +8,7 @@ jest.mock('@ray-js/ray', () => ({
8
8
  Text: 'span',
9
9
  Image: 'img',
10
10
  getSystemInfoSync: jest.fn(),
11
+ getFileSystemManager: jest.fn(),
11
12
  authorize: jest.fn(),
12
13
  authorizeStatus: jest.fn(),
13
14
  showModal: jest.fn(),
@@ -49,20 +50,34 @@ beforeEach(() => {
49
50
  errorCode: 9004
50
51
  });
51
52
  });
53
+ getFileSystemManager.mockReturnValue({
54
+ access: jest.fn(_ref3 => {
55
+ let {
56
+ success
57
+ } = _ref3;
58
+ return success();
59
+ })
60
+ });
52
61
  getDeviceInfo.mockResolvedValue({
53
62
  configMetas: {
54
63
  tyabimr4v3: {
55
- total_split_num: 3
64
+ split_info: [{
65
+ index: 1
66
+ }, {
67
+ index: 2
68
+ }, {
69
+ index: 3
70
+ }]
56
71
  }
57
72
  }
58
73
  });
59
74
  });
60
75
  const createProps = () => ({
61
76
  IPCPlayerContext: {
62
- snapshot: jest.fn(_ref3 => {
77
+ snapshot: jest.fn(_ref4 => {
63
78
  let {
64
79
  success
65
- } = _ref3;
80
+ } = _ref4;
66
81
  return success({
67
82
  tempImagePath: 'thingfile://capture.jpg'
68
83
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.65-beta.2",
3
+ "version": "0.0.65-beta.4",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [