@ray-js/ipc-player-integration 0.0.53-beta.0 → 0.0.53-beta.10

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 (36) hide show
  1. package/lib/ctx/ctx.autoClarity.test.d.ts +1 -0
  2. package/lib/ctx/ctx.autoClarity.test.js +150 -0
  3. package/lib/ctx/ctx.composition.js +1 -6
  4. package/lib/ctx/ctx.js +94 -7
  5. package/lib/features/initPlayerWidgets/index.js +0 -9
  6. package/lib/i18n/index.d.ts +20 -4
  7. package/lib/i18n/strings.d.ts +10 -2
  8. package/lib/i18n/strings.js +10 -2
  9. package/lib/interface.d.ts +4 -7
  10. package/lib/ui/constant.d.ts +0 -7
  11. package/lib/ui/constant.js +0 -8
  12. package/lib/ui/ui.js +50 -7
  13. package/lib/utils/captureResult.d.ts +6 -1
  14. package/lib/utils/captureResult.js +15 -13
  15. package/lib/utils/captureResult.test.js +42 -15
  16. package/lib/utils/ttt.autoClarity.test.d.ts +1 -0
  17. package/lib/utils/ttt.autoClarity.test.js +75 -0
  18. package/lib/utils/ttt.d.ts +18 -4
  19. package/lib/utils/ttt.js +83 -32
  20. package/lib/widgets/captureResult/captureResult.js +6 -10
  21. package/lib/widgets/captureResult/captureResult.less +59 -14
  22. package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
  23. package/lib/widgets/captureResult/captureResult.test.js +80 -0
  24. package/lib/widgets/recordVideo/recordVideo.js +5 -1
  25. package/lib/widgets/resolution/index.d.ts +0 -1
  26. package/lib/widgets/resolution/index.js +1 -2
  27. package/lib/widgets/resolution/resolution.js +0 -1
  28. package/lib/widgets/resolution/resolution.less +0 -4
  29. package/lib/widgets/screenshot/screenshot.js +5 -1
  30. package/lib/widgets/videoBitKBP/videoBitKBP.js +36 -37
  31. package/lib/widgets/videoBitKBP/videoBitKBP.less +2 -5
  32. package/lib/widgets/videoBitKBP/videoBitKBP.test.d.ts +1 -0
  33. package/lib/widgets/videoBitKBP/videoBitKBP.test.js +112 -0
  34. package/package.json +2 -2
  35. package/lib/widgets/resolution/autoClarity.d.ts +0 -13
  36. package/lib/widgets/resolution/autoClarity.js +0 -110
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,150 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { act, renderHook } from '@testing-library/react-hooks';
3
+ import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
4
+ import { createUseCtx } from './ctx';
5
+ import { useStore } from './store';
6
+ import { PlayState } from '../interface';
7
+ import { getCachedAutoClarity, setCachedAutoClarity, subscribeClarityChanged } from '../utils/ttt';
8
+ jest.mock('@ray-js/ray', () => ({}));
9
+ jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
10
+ ClarityType: {
11
+ SS: 'SS',
12
+ SD: 'SD',
13
+ HD: 'HD',
14
+ UD: 'UD',
15
+ SSP: 'SSP',
16
+ AUTO: 'AUTO',
17
+ AUDIO: 'AUDIO'
18
+ },
19
+ IntercomMode: {
20
+ OneWay: 'OneWay',
21
+ TwoWay: 'TwoWay'
22
+ }
23
+ }));
24
+ jest.mock('../i18n', () => ({
25
+ __esModule: true,
26
+ default: {
27
+ getLang: key => key
28
+ }
29
+ }));
30
+ jest.mock('./multiCameraCtx', () => ({
31
+ isMultiCameraTileSupported: () => false,
32
+ useMultiCameraCtx: () => ({})
33
+ }));
34
+ jest.mock('../utils/ttt', () => ({
35
+ getCachedAutoClarity: jest.fn(),
36
+ isClarityChangedSupported: () => true,
37
+ setCachedAutoClarity: jest.fn(),
38
+ subscribeClarityChanged: jest.fn(() => () => undefined)
39
+ }));
40
+ const cameraState = resolution => ({
41
+ resolution,
42
+ resolutionList: [ClarityType.HD, ClarityType.SD],
43
+ mute: true,
44
+ intercomMode: 'TwoWay',
45
+ isIntercomSupported: false,
46
+ maxZoomSettings: 6
47
+ });
48
+ describe('cached auto clarity restoration', () => {
49
+ beforeEach(() => {
50
+ jest.clearAllMocks();
51
+ });
52
+ const mountContext = resolution => {
53
+ const setClarity = jest.fn();
54
+ const getMemoryState = jest.fn().mockResolvedValue(cameraState(resolution));
55
+ const useCtx = createUseCtx({
56
+ createPlayContext: () => ({
57
+ setClarity
58
+ }),
59
+ getMemoryState,
60
+ setResolutionMemoryState: jest.fn(),
61
+ setMuteMemoryState: jest.fn(),
62
+ authorizeStatus: jest.fn(),
63
+ toast: jest.fn()
64
+ });
65
+ const hook = renderHook(() => {
66
+ const ctx = useCtx({
67
+ devId: 'camera-1'
68
+ });
69
+ const state = useStore({
70
+ resolution: ctx.resolution,
71
+ autoClarity: ctx.autoClarity
72
+ });
73
+ return _objectSpread(_objectSpread({}, ctx), {}, {
74
+ state
75
+ });
76
+ });
77
+ return _objectSpread(_objectSpread({}, hook), {}, {
78
+ setClarity
79
+ });
80
+ };
81
+ it('shows last listener value on reopening AUTO and refreshes it after preview', async () => {
82
+ getCachedAutoClarity.mockReturnValue(ClarityType.HD);
83
+ const {
84
+ result,
85
+ setClarity,
86
+ unmount
87
+ } = mountContext(ClarityType.AUTO);
88
+ await act(async () => Promise.resolve());
89
+ expect(result.current.state).toEqual({
90
+ resolution: ClarityType.AUTO,
91
+ autoClarity: ClarityType.HD
92
+ });
93
+ act(() => result.current.setPlayState(PlayState.PLAYING));
94
+ await act(async () => Promise.resolve());
95
+ expect(setClarity).toHaveBeenCalledTimes(1);
96
+ expect(setClarity).toHaveBeenCalledWith(expect.objectContaining({
97
+ clarity: 'auto'
98
+ }));
99
+ const onReport = subscribeClarityChanged.mock.calls[0][1];
100
+ act(() => onReport({
101
+ deviceId: 'camera-1',
102
+ clarity: ClarityType.SD
103
+ }));
104
+ expect(result.current.state.autoClarity).toBe(ClarityType.SD);
105
+ expect(setCachedAutoClarity).toHaveBeenCalledWith('camera-1', ClarityType.SD);
106
+ unmount();
107
+ });
108
+ it('does not restore cached actual clarity in manual mode', async () => {
109
+ getCachedAutoClarity.mockReturnValue(ClarityType.HD);
110
+ const {
111
+ result,
112
+ unmount
113
+ } = mountContext(ClarityType.SD);
114
+ await act(async () => Promise.resolve());
115
+ expect(result.current.state).toEqual({
116
+ resolution: ClarityType.SD,
117
+ autoClarity: null
118
+ });
119
+ expect(getCachedAutoClarity).not.toHaveBeenCalled();
120
+ const onReport = subscribeClarityChanged.mock.calls[0][1];
121
+ act(() => onReport({
122
+ deviceId: 'camera-1',
123
+ clarity: ClarityType.HD
124
+ }));
125
+ expect(result.current.state.autoClarity).toBeNull();
126
+ expect(setCachedAutoClarity).not.toHaveBeenCalled();
127
+ unmount();
128
+ });
129
+ it('requests a fresh report when reopening AUTO without an actual clarity cache', async () => {
130
+ getCachedAutoClarity.mockReturnValue(null);
131
+ const {
132
+ result,
133
+ setClarity,
134
+ unmount
135
+ } = mountContext(ClarityType.AUTO);
136
+ await act(async () => Promise.resolve());
137
+ expect(result.current.state.autoClarity).toBeNull();
138
+ act(() => result.current.setPlayState(PlayState.PLAYING));
139
+ expect(setClarity).toHaveBeenCalledWith(expect.objectContaining({
140
+ clarity: 'auto'
141
+ }));
142
+ const onReport = subscribeClarityChanged.mock.calls[0][1];
143
+ act(() => onReport({
144
+ deviceId: 'camera-1',
145
+ clarity: ClarityType.HD
146
+ }));
147
+ expect(result.current.state.autoClarity).toBe(ClarityType.HD);
148
+ unmount();
149
+ });
150
+ });
@@ -4,7 +4,7 @@ const _excluded = ["title", "duration"];
4
4
  import { getCameraConfigInfo } from '@ray-js/ray-ipc-utils';
5
5
  import { IntercomMode, MuteMode, ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
6
6
  import { createUseCtx } from './ctx';
7
- import { FullSmallIntercom, VerticalSmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, Signal4G, RecordVideo, FullScreen, VideoBitKBP, Muted, Floodlight, Siren, TryExperience, Resolution, AutoClarity, Ptz, MultiPtz, TileTip, PtzMoveableTip, LandscapeTip, TileActions, MoveablePtzControl, SwitchLayout, ToggleVerticalFull, RealTimeMagnification, ZoomTurntableEntry } from '../widgets';
7
+ import { FullSmallIntercom, VerticalSmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, Signal4G, RecordVideo, FullScreen, VideoBitKBP, Muted, Floodlight, Siren, TryExperience, Resolution, Ptz, MultiPtz, TileTip, PtzMoveableTip, LandscapeTip, TileActions, MoveablePtzControl, SwitchLayout, ToggleVerticalFull, RealTimeMagnification, ZoomTurntableEntry } from '../widgets';
8
8
  import { authorizeStatus } from '../utils/authorize';
9
9
  import { PlayState } from '../interface';
10
10
  import { landscapeTipId, moveablePtzControlId, multiPtzId, ptzMoveableTipId, tileActionsId, tileTipId } from '../ui/constant';
@@ -74,11 +74,6 @@ export const defaultBottomLeftContent = [{
74
74
  id: 'RealTimeMagnification',
75
75
  content: RealTimeMagnification,
76
76
  hidden: true
77
- }, /* 自动清晰度:仅宿主存在 ttt 方法 clarityChanged 时由 widget 内部渲染 */
78
- {
79
- id: 'AutoClarity',
80
- content: AutoClarity,
81
- hidden: true
82
77
  }];
83
78
  export const defaultBottomRightContent = [{
84
79
  id: 'SwitchLayout',
package/lib/ctx/ctx.js CHANGED
@@ -12,6 +12,7 @@ import { changeIgnoreHideStopPreview } from '../ui/constant';
12
12
  import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
13
13
  import { getEventInstance } from './event';
14
14
  import { isMultiCameraTileSupported, useMultiCameraCtx } from './multiCameraCtx';
15
+ import { getCachedAutoClarity, isClarityChangedSupported, setCachedAutoClarity, subscribeClarityChanged } from '../utils/ttt';
15
16
  const SAVE_TO_ALBUM = 1;
16
17
  export const createUseCtx = _ref => {
17
18
  let {
@@ -74,6 +75,8 @@ export const createUseCtx = _ref => {
74
75
  const [resolution] = useAtom('HD');
75
76
  // resolution 清晰度列表
76
77
  const [resolutionList, setResolutionList] = useAtom([]);
78
+ // 自动模式下宿主上报的实际清晰度,供横竖屏码率区域共用
79
+ const [autoClarity] = useAtom(null);
77
80
 
78
81
  // 单向对讲还是双向对讲
79
82
  const [intercomMode, setIntercomMode] = useAtom(IntercomMode.TwoWay);
@@ -101,14 +104,67 @@ export const createUseCtx = _ref => {
101
104
  const [bottomRightContent] = useAtom(initBottomRightContent || defaultBottomRightContent || []);
102
105
  const [absoluteContent] = useAtom(initAbsoluteContent || defaultAbsoluteContent || []);
103
106
  const {
104
- _playState
107
+ _playState,
108
+ currentResolution
105
109
  } = useStore({
106
- _playState: playState
110
+ _playState: playState,
111
+ currentResolution: resolution
107
112
  });
113
+ const restoredAutoRef = useRef(false);
114
+ const refreshedAutoRef = useRef(false);
115
+ const freshAutoClarityRef = useRef(false);
116
+ const pendingAutoSelectionRef = useRef(false);
117
+ const userSelectedResolutionRef = useRef(false);
118
+ useEffect(() => {
119
+ updateAtom(autoClarity, null);
120
+ restoredAutoRef.current = false;
121
+ refreshedAutoRef.current = false;
122
+ freshAutoClarityRef.current = false;
123
+ userSelectedResolutionRef.current = false;
124
+ if (!devId) return undefined;
125
+ return subscribeClarityChanged(devId, res => {
126
+ if (getDefaultStore().get(resolution) !== ClarityType.AUTO && !pendingAutoSelectionRef.current) {
127
+ return;
128
+ }
129
+ freshAutoClarityRef.current = true;
130
+ updateAtom(autoClarity, res.clarity);
131
+ setCachedAutoClarity(devId, res.clarity);
132
+ });
133
+ }, [autoClarity, devId, resolution]);
108
134
  const eventRef = useRef();
109
135
  if (!eventRef.current) {
110
136
  eventRef.current = getEventInstance();
111
137
  }
138
+
139
+ /**
140
+ * 只有宿主支持自动清晰度事件,且接口返回的清晰度档位数量不少于 2 个时,才展示 AUTO:
141
+ * 竖屏宿主弹框(由 resolutionList 构建 actionData)与横屏 FullResolutionControl 共用。
142
+ */
143
+ const canShowAutoClarity = function () {
144
+ let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
145
+ return isClarityChangedSupported() && list.length >= 2;
146
+ };
147
+ const withAutoClarity = function () {
148
+ let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
149
+ const withoutAuto = list.filter(clarity => clarity !== ClarityType.AUTO);
150
+ return canShowAutoClarity(list) ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
151
+ };
152
+ const normalizeResolution = (resolution, list) => {
153
+ if (resolution !== ClarityType.AUTO || canShowAutoClarity(list)) return resolution;
154
+ return list.find(clarity => clarity !== ClarityType.AUTO) || ClarityType.HD;
155
+ };
156
+ const restoreResolution = (cachedResolution, list) => {
157
+ if (userSelectedResolutionRef.current) return;
158
+ const target = normalizeResolution(cachedResolution, list);
159
+ if (target === ClarityType.AUTO) {
160
+ restoredAutoRef.current = true;
161
+ const cachedClarity = getCachedAutoClarity(devId);
162
+ if (cachedClarity && list.includes(cachedClarity) && !getDefaultStore().get(autoClarity)) {
163
+ updateAtom(autoClarity, cachedClarity);
164
+ }
165
+ }
166
+ _setResolution(target, true);
167
+ };
112
168
  useEffect(() => {
113
169
  // 初始化获取缓存值
114
170
 
@@ -117,8 +173,8 @@ export const createUseCtx = _ref => {
117
173
  try {
118
174
  var _res$maxZoomSettings;
119
175
  const res = await getMemoryState(devId);
120
- setResolutionList(res.resolutionList);
121
- _setResolution(res.resolution, true);
176
+ setResolutionList(withAutoClarity(res.resolutionList));
177
+ restoreResolution(res.resolution, res.resolutionList);
122
178
  _setMute(res.mute, true);
123
179
  setIntercomMode(res.intercomMode);
124
180
  setIntercomSupported(res.isIntercomSupported);
@@ -133,9 +189,9 @@ export const createUseCtx = _ref => {
133
189
  // 获取缓存的值且同步
134
190
  getMemoryState(devId).then(res => {
135
191
  var _res$maxZoomSettings2;
136
- setResolutionList(res.resolutionList);
192
+ setResolutionList(withAutoClarity(res.resolutionList));
137
193
  // 传true表示值即可,会取播放器的值
138
- _setResolution(res.resolution, true);
194
+ restoreResolution(res.resolution, res.resolutionList);
139
195
  _setMute(res.mute, true);
140
196
  setIntercomMode(res.intercomMode);
141
197
  setIntercomSupported(res.isIntercomSupported);
@@ -143,6 +199,18 @@ export const createUseCtx = _ref => {
143
199
  });
144
200
  }
145
201
  }, [devId, _playState]);
202
+ useEffect(() => {
203
+ var _IPCPlayerInstance$cu;
204
+ if (!devId || _playState !== PlayState.PLAYING || currentResolution !== ClarityType.AUTO || !restoredAutoRef.current || freshAutoClarityRef.current || refreshedAutoRef.current) {
205
+ return;
206
+ }
207
+ refreshedAutoRef.current = true;
208
+ // 缓存只保证首屏有上次档位;出流后重申自动,让宿主回报本次实际档位。
209
+ (_IPCPlayerInstance$cu = IPCPlayerInstance.current) === null || _IPCPlayerInstance$cu === void 0 || _IPCPlayerInstance$cu.setClarity({
210
+ clarity: 'auto',
211
+ fail: error => console.warn('res===restore auto clarity fail', error)
212
+ });
213
+ }, [devId, _playState, currentResolution]);
146
214
  // 获取content数据
147
215
  const getContent = () => {
148
216
  const store = getDefaultStore();
@@ -237,15 +305,33 @@ export const createUseCtx = _ref => {
237
305
  updateAtom(resolution, target);
238
306
  return false;
239
307
  }
308
+ userSelectedResolutionRef.current = true;
309
+ // 清晰度事件可能在 setClarity 的 success 回调前到达,进入自动前先清掉上次的值。
310
+ restoredAutoRef.current = false;
311
+ if (target === ClarityType.AUTO) {
312
+ pendingAutoSelectionRef.current = true;
313
+ updateAtom(autoClarity, null);
314
+ }
240
315
  return new Promise((resolve, reject) => {
316
+ const clarityMap = {
317
+ [ClarityType.SS]: 'ss',
318
+ [ClarityType.SD]: 'normal',
319
+ [ClarityType.HD]: 'hd',
320
+ [ClarityType.UD]: 'ud',
321
+ [ClarityType.SSP]: 'ssp',
322
+ [ClarityType.AUTO]: 'auto',
323
+ [ClarityType.AUDIO]: 'audio'
324
+ };
241
325
  IPCPlayerInstance.current.setClarity({
242
- clarity: target === ClarityType.HD ? 'hd' : 'normal',
326
+ clarity: clarityMap[target] || 'normal',
243
327
  success: () => {
328
+ pendingAutoSelectionRef.current = false;
244
329
  setResolutionMemoryState(devId, target);
245
330
  updateAtom(resolution, target);
246
331
  resolve(true);
247
332
  },
248
333
  fail: err => {
334
+ pendingAutoSelectionRef.current = false;
249
335
  console.log(err, 'setClarity err');
250
336
  // updateAtom(mute, !target);
251
337
  reject(err);
@@ -297,6 +383,7 @@ export const createUseCtx = _ref => {
297
383
  mute,
298
384
  resolution,
299
385
  resolutionList,
386
+ autoClarity,
300
387
  intercom,
301
388
  intercomMode,
302
389
  intercomSupported,
@@ -52,15 +52,6 @@ export async function initPlayerWidgets(ctx, options) {
52
52
  newDefaultBottomLeftContent[magnificationIndex].hidden = false;
53
53
  }
54
54
  }
55
- // 自动清晰度入口:这里只放开占位,真正是否渲染由 widget 内部按
56
- // 「宿主有 ttt 方法 clarityChanged」+「设备支持的清晰度档位 ≥ 2」决定
57
- {
58
- const autoClarityIndex = newDefaultBottomLeftContent.findIndex(item => item.id === 'AutoClarity');
59
- console.log('res===autoClarityIndex', autoClarityIndex);
60
- if (autoClarityIndex !== -1) {
61
- newDefaultBottomLeftContent[autoClarityIndex].hidden = false;
62
- }
63
- }
64
55
  // 焦距转盘入口:这里只放开占位,真正是否渲染由 widget 内部按
65
56
  // 「宿主有 ty.ipc.switchChannel」+「ipc_multi_zoom 解析出 cnt > 1」决定
66
57
  // (单镜头设备、不支持切镜头的老宿主都不出现)
@@ -1,9 +1,13 @@
1
1
  import { kit } from '@ray-js/panel-sdk';
2
2
  declare const Strings: kit.I18N<{
3
3
  en: {
4
+ ipc_player_resolution_SS: string;
4
5
  ipc_player_resolution_HD: string;
5
6
  ipc_player_resolution_SD: string;
6
- ipc_player_resolution_auto: string;
7
+ ipc_player_resolution_UD: string;
8
+ ipc_player_resolution_SSP: string;
9
+ ipc_player_resolution_AUTO: string;
10
+ ipc_player_resolution_AUDIO: string;
7
11
  ipc_player_current_resolution_is_equal: string;
8
12
  ipc_player_screenshot_success_tip: string;
9
13
  ipc_player_screenshot_multi_success_tip: string;
@@ -42,9 +46,13 @@ declare const Strings: kit.I18N<{
42
46
  ipc_player_low_phone_not_support: string;
43
47
  };
44
48
  zh: {
49
+ ipc_player_resolution_SS: string;
45
50
  ipc_player_resolution_HD: string;
46
51
  ipc_player_resolution_SD: string;
47
- ipc_player_resolution_auto: string;
52
+ ipc_player_resolution_UD: string;
53
+ ipc_player_resolution_SSP: string;
54
+ ipc_player_resolution_AUTO: string;
55
+ ipc_player_resolution_AUDIO: string;
48
56
  ipc_player_current_resolution_is_equal: string;
49
57
  ipc_player_screenshot_success_tip: string;
50
58
  ipc_player_screenshot_multi_success_tip: string;
@@ -83,9 +91,13 @@ declare const Strings: kit.I18N<{
83
91
  ipc_player_low_phone_not_support: string;
84
92
  };
85
93
  }, {
94
+ ipc_player_resolution_SS: string;
86
95
  ipc_player_resolution_HD: string;
87
96
  ipc_player_resolution_SD: string;
88
- ipc_player_resolution_auto: string;
97
+ ipc_player_resolution_UD: string;
98
+ ipc_player_resolution_SSP: string;
99
+ ipc_player_resolution_AUTO: string;
100
+ ipc_player_resolution_AUDIO: string;
89
101
  ipc_player_current_resolution_is_equal: string;
90
102
  ipc_player_screenshot_success_tip: string;
91
103
  ipc_player_screenshot_multi_success_tip: string;
@@ -123,9 +135,13 @@ declare const Strings: kit.I18N<{
123
135
  ipc_player_fetch_error: string;
124
136
  ipc_player_low_phone_not_support: string;
125
137
  } | {
138
+ ipc_player_resolution_SS: string;
126
139
  ipc_player_resolution_HD: string;
127
140
  ipc_player_resolution_SD: string;
128
- ipc_player_resolution_auto: string;
141
+ ipc_player_resolution_UD: string;
142
+ ipc_player_resolution_SSP: string;
143
+ ipc_player_resolution_AUTO: string;
144
+ ipc_player_resolution_AUDIO: string;
129
145
  ipc_player_current_resolution_is_equal: string;
130
146
  ipc_player_screenshot_success_tip: string;
131
147
  ipc_player_screenshot_multi_success_tip: string;
@@ -1,8 +1,12 @@
1
1
  declare const _default: {
2
2
  en: {
3
+ ipc_player_resolution_SS: string;
3
4
  ipc_player_resolution_HD: string;
4
5
  ipc_player_resolution_SD: string;
5
- ipc_player_resolution_auto: string;
6
+ ipc_player_resolution_UD: string;
7
+ ipc_player_resolution_SSP: string;
8
+ ipc_player_resolution_AUTO: string;
9
+ ipc_player_resolution_AUDIO: string;
6
10
  ipc_player_current_resolution_is_equal: string;
7
11
  ipc_player_screenshot_success_tip: string;
8
12
  ipc_player_screenshot_multi_success_tip: string;
@@ -41,9 +45,13 @@ declare const _default: {
41
45
  ipc_player_low_phone_not_support: string;
42
46
  };
43
47
  zh: {
48
+ ipc_player_resolution_SS: string;
44
49
  ipc_player_resolution_HD: string;
45
50
  ipc_player_resolution_SD: string;
46
- ipc_player_resolution_auto: string;
51
+ ipc_player_resolution_UD: string;
52
+ ipc_player_resolution_SSP: string;
53
+ ipc_player_resolution_AUTO: string;
54
+ ipc_player_resolution_AUDIO: string;
47
55
  ipc_player_current_resolution_is_equal: string;
48
56
  ipc_player_screenshot_success_tip: string;
49
57
  ipc_player_screenshot_multi_success_tip: string;
@@ -1,8 +1,12 @@
1
1
  export default {
2
2
  en: {
3
+ ipc_player_resolution_SS: 'Data Saver',
3
4
  ipc_player_resolution_HD: 'HD',
4
5
  ipc_player_resolution_SD: 'SD',
5
- ipc_player_resolution_auto: 'Auto',
6
+ ipc_player_resolution_UD: 'Ultra HD',
7
+ ipc_player_resolution_SSP: 'Super Ultra HD',
8
+ ipc_player_resolution_AUTO: 'Auto',
9
+ ipc_player_resolution_AUDIO: 'Audio Mode',
6
10
  ipc_player_current_resolution_is_equal: 'Already at current clarity',
7
11
  ipc_player_screenshot_success_tip: 'Screenshot saved to album',
8
12
  ipc_player_screenshot_multi_success_tip: 'Screenshots saved to album',
@@ -41,9 +45,13 @@ export default {
41
45
  ipc_player_low_phone_not_support: 'This feature is not supported on this device'
42
46
  },
43
47
  zh: {
48
+ ipc_player_resolution_SS: '省流量',
44
49
  ipc_player_resolution_HD: '高清',
45
50
  ipc_player_resolution_SD: '标清',
46
- ipc_player_resolution_auto: '自动',
51
+ ipc_player_resolution_UD: '超清',
52
+ ipc_player_resolution_SSP: '超超清',
53
+ ipc_player_resolution_AUTO: '自动',
54
+ ipc_player_resolution_AUDIO: '音频模式',
47
55
  ipc_player_current_resolution_is_equal: '已是当前清晰度',
48
56
  ipc_player_screenshot_success_tip: '截图已保存在APP相册',
49
57
  ipc_player_screenshot_multi_success_tip: '图片已保存至相册',
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PrimitiveAtom } from 'jotai';
3
+ import type { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
3
4
  import type { Toast, IntercomMode } from './ports.output';
4
5
  import { useMultiCameraCtx } from './ctx/multiCameraCtx';
5
6
  import type { ZoomSkill } from './widgets/zoomTurntable/lensSkill';
@@ -74,6 +75,7 @@ export type UseCtx = (options: {
74
75
  setZoomLensIndex: (value: number) => void;
75
76
  resolution: RetAtom<string>;
76
77
  resolutionList: RetAtom<string[]>;
78
+ autoClarity: RetAtom<ClarityType | null>;
77
79
  playState: RetAtom<PlayState>;
78
80
  IPCPlayerInstance: IpcContext;
79
81
  topLeftContent: RetAtom<ComponentConfig[]>;
@@ -87,7 +89,7 @@ export type UseCtx = (options: {
87
89
  setVerticalMic: (value: boolean) => void;
88
90
  setScreenType: (type: ScreenType) => void;
89
91
  setRecordingDisabled: (type: boolean) => void;
90
- setResolution: (type: string) => void;
92
+ setResolution: (type: string) => Promise<boolean>;
91
93
  setResolutionList: (type: string[]) => void;
92
94
  setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<CaptureResult>;
93
95
  stopRecordingOnUnload: () => Promise<CaptureResult>;
@@ -143,12 +145,7 @@ export type CaptureFileInfo = {
143
145
  height?: number;
144
146
  data?: string;
145
147
  };
146
- export type MultiCaptureFileInfo = CaptureFileInfo & {
147
- index: number;
148
- };
149
- export type CaptureResult = boolean | CaptureFileInfo | {
150
- items: MultiCaptureFileInfo[];
151
- };
148
+ export type CaptureResult = boolean | CaptureFileInfo;
152
149
  export type RecordInfoData = CaptureResult;
153
150
  /**
154
151
  * 多目屏幕模式
@@ -33,7 +33,6 @@ export declare const widgetLabs: {
33
33
  readonly SCREENSHOT: "Screenshot";
34
34
  readonly RECORD_VIDEO: "RecordVideo";
35
35
  readonly RESOLUTION: "Resolution";
36
- readonly AUTO_CLARITY: "AutoClarity";
37
36
  readonly TRY_EXPERIENCE: "TryExperience";
38
37
  readonly FULL_RESOLUTION_CONTROL: "FullResolutionControl";
39
38
  readonly MUTED: "Muted";
@@ -61,12 +60,6 @@ export declare const widgetLabs: {
61
60
  */
62
61
  export declare const bottomLeftContentResize = "bottomLeftContentResize";
63
62
  export declare const zoomLevelChange = "zoomLevelChange";
64
- /**
65
- * 自动清晰度状态变化事件:AutoClarity 控件开启/关闭自动模式或收到 clarityChanged
66
- * 回调结果时触发,携带 { enabled, clarity }(clarity 为 'HD' | 'SD' | null)。
67
- * VideoBitKBP 监听此事件,在码率前展示当前高清/标清文案。
68
- */
69
- export declare const autoClarityChange = "autoClarityChange";
70
63
  export declare const setScaleMultipleEvent = "setScaleMultipleEvent";
71
64
  export declare const decodeClarityDic: {
72
65
  SS: string;
@@ -35,7 +35,6 @@ export const widgetLabs = {
35
35
  SCREENSHOT: 'Screenshot',
36
36
  RECORD_VIDEO: 'RecordVideo',
37
37
  RESOLUTION: 'Resolution',
38
- AUTO_CLARITY: 'AutoClarity',
39
38
  TRY_EXPERIENCE: 'TryExperience',
40
39
  FULL_RESOLUTION_CONTROL: 'FullResolutionControl',
41
40
  MUTED: 'Muted',
@@ -64,13 +63,6 @@ export const widgetLabs = {
64
63
  */
65
64
  export const bottomLeftContentResize = 'bottomLeftContentResize';
66
65
  export const zoomLevelChange = 'zoomLevelChange';
67
-
68
- /**
69
- * 自动清晰度状态变化事件:AutoClarity 控件开启/关闭自动模式或收到 clarityChanged
70
- * 回调结果时触发,携带 { enabled, clarity }(clarity 为 'HD' | 'SD' | null)。
71
- * VideoBitKBP 监听此事件,在码率前展示当前高清/标清文案。
72
- */
73
- export const autoClarityChange = 'autoClarityChange';
74
66
  export const setScaleMultipleEvent = 'setScaleMultipleEvent';
75
67
  export const decodeClarityDic = {
76
68
  SS: 'ss',