@ray-js/ipc-player-integration 0.0.70-beta.0 → 0.0.71-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 (120) hide show
  1. package/README.md +6 -0
  2. package/lib/ctx/ctx.js +12 -17
  3. package/lib/ctx/ctx.test.js +54 -19
  4. package/lib/ctx/intercom.test.d.ts +1 -0
  5. package/lib/ctx/intercom.test.js +85 -0
  6. package/lib/index.d.ts +4 -0
  7. package/lib/index.js +3 -1
  8. package/lib/renderer/capabilities.d.ts +8 -0
  9. package/lib/renderer/capabilities.js +19 -0
  10. package/lib/renderer/context.d.ts +5 -0
  11. package/lib/renderer/context.js +6 -0
  12. package/lib/renderer/directionControl.d.ts +6 -0
  13. package/lib/renderer/directionControl.js +3 -0
  14. package/lib/renderer/font-manifest.json +9 -0
  15. package/lib/renderer/font.less +5 -0
  16. package/lib/renderer/glyphs.d.ts +1 -0
  17. package/lib/renderer/glyphs.js +256 -0
  18. package/lib/renderer/index.module.less +48 -0
  19. package/lib/renderer/overlay.d.ts +6 -0
  20. package/lib/renderer/overlay.js +18 -0
  21. package/lib/renderer/ptzZoom.d.ts +6 -0
  22. package/lib/renderer/ptzZoom.js +3 -0
  23. package/lib/renderer/text.d.ts +4 -0
  24. package/lib/renderer/text.js +32 -0
  25. package/lib/renderer/text.module.less +4 -0
  26. package/lib/renderer/viewport.d.ts +7 -0
  27. package/lib/renderer/viewport.js +24 -0
  28. package/lib/res/lynx-signal/index.d.ts +1 -0
  29. package/lib/res/lynx-signal/index.js +22 -0
  30. package/lib/res/lynx-signal/signalFour0.png +0 -0
  31. package/lib/res/lynx-signal/signalFour1.png +0 -0
  32. package/lib/res/lynx-signal/signalFour2.png +0 -0
  33. package/lib/res/lynx-signal/signalFour3.png +0 -0
  34. package/lib/res/lynx-signal/signalFour4.png +0 -0
  35. package/lib/res/lynx-signal/signalThree0.png +0 -0
  36. package/lib/res/lynx-signal/signalThree1.png +0 -0
  37. package/lib/res/lynx-signal/signalThree2.png +0 -0
  38. package/lib/res/lynx-signal/signalThree3.png +0 -0
  39. package/lib/res/player-charging.png +0 -0
  40. package/lib/res/player-more-arrow.png +0 -0
  41. package/lib/res/player-solar.png +0 -0
  42. package/lib/ui/bottomLeftContent.js +121 -53
  43. package/lib/ui/bottomRightContent.js +10 -5
  44. package/lib/ui/scrollHintArrow.d.ts +23 -0
  45. package/lib/ui/scrollHintArrow.js +83 -0
  46. package/lib/ui/topLeftContent.js +4 -2
  47. package/lib/ui/topRightContent.js +4 -2
  48. package/lib/ui/ui.d.ts +5 -0
  49. package/lib/ui/ui.js +46 -23
  50. package/lib/widgets/battery/battery.js +7 -5
  51. package/lib/widgets/battery/batteryFull.js +7 -5
  52. package/lib/widgets/battery/statusIcon.d.ts +6 -0
  53. package/lib/widgets/battery/statusIcon.js +36 -0
  54. package/lib/widgets/battery/statusIcon.less +24 -0
  55. package/lib/widgets/captureResult/captureResult.js +2 -1
  56. package/lib/widgets/captureToast/captureToast.d.ts +10 -0
  57. package/lib/widgets/captureToast/captureToast.js +58 -0
  58. package/lib/widgets/floodlight/floodlight.js +2 -1
  59. package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
  60. package/lib/widgets/fullScreen/fullScreen.js +2 -1
  61. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  62. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  63. package/lib/widgets/fullScreen/verticalScreen.js +2 -1
  64. package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
  65. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +16 -5
  66. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
  67. package/lib/widgets/multiCamera/landscapeTip.js +8 -2
  68. package/lib/widgets/multiCamera/moveablePtzControl.js +5 -3
  69. package/lib/widgets/multiCamera/multiPtz.js +2 -1
  70. package/lib/widgets/multiCamera/ptzMoveableTip.js +8 -2
  71. package/lib/widgets/multiCamera/switchLayout.js +2 -1
  72. package/lib/widgets/multiCamera/tileMultiPtz.js +2 -1
  73. package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
  74. package/lib/widgets/multiCamera/tileTip.js +8 -2
  75. package/lib/widgets/muted/muted.js +2 -1
  76. package/lib/widgets/muted/muted.test.js +66 -52
  77. package/lib/widgets/ptz/ptz.js +2 -1
  78. package/lib/widgets/ptz/ptzControl.js +4 -3
  79. package/lib/widgets/ptzControlTip/ptzControlTip.js +9 -4
  80. package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
  81. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
  82. package/lib/widgets/recordVideo/recordVideo.js +47 -169
  83. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +4 -2
  84. package/lib/widgets/recordVideo/recordVideo.test.js +169 -2
  85. package/lib/widgets/recordVideo/recordVideoTimer.d.ts +3 -0
  86. package/lib/widgets/recordVideo/recordVideoTimer.js +26 -0
  87. package/lib/widgets/resolution/fullResolutionControl.js +29 -19
  88. package/lib/widgets/resolution/resolution.js +3 -2
  89. package/lib/widgets/screenshot/screenshot.js +48 -122
  90. package/lib/widgets/screenshot/screenshot.permissions.test.d.ts +1 -0
  91. package/lib/widgets/screenshot/screenshot.permissions.test.js +137 -0
  92. package/lib/widgets/screenshot/screenshot.test.js +108 -113
  93. package/lib/widgets/signal4G/signal4G.js +4 -1
  94. package/lib/widgets/siren/siren.js +2 -1
  95. package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
  96. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
  97. package/lib/widgets/trialBadge/index.js +8 -3
  98. package/lib/widgets/trialBadge/index.less +24 -0
  99. package/lib/widgets/tryExperience/tryExperience.js +2 -1
  100. package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
  101. package/lib/widgets/voiceIntercom/voiceIntercom.js +57 -81
  102. package/lib/widgets/voiceIntercom/voiceIntercom.less +35 -0
  103. package/lib/widgets/voiceIntercom/voiceIntercom.test.d.ts +1 -0
  104. package/lib/widgets/voiceIntercom/voiceIntercom.test.js +135 -0
  105. package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +6 -0
  106. package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
  107. package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
  108. package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
  109. package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
  110. package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
  111. package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
  112. package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
  113. package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
  114. package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
  115. package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
  116. package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +5 -3
  117. package/lib/widgets/zoomTurntable/zoomTurntableDock.js +4 -4
  118. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +32 -19
  119. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +17 -3
  120. package/package.json +15 -7
@@ -1,9 +1,11 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useRef, useContext, useState, useEffect, forwardRef, useImperativeHandle } from 'react';
3
- import { View, Image, getSystemInfoSync } from '@ray-js/ray';
2
+ import React, { useRef, useContext, useEffect, forwardRef, useImperativeHandle } from 'react';
3
+ import { View, Image, Text, getSystemInfoSync } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
- import { useStore, getDefaultStore, updateAtom } from '../../ctx/store';
5
+ import { useStore, updateAtom } from '../../ctx/store';
6
6
  import './voiceIntercom.less';
7
+ import { usePlayerRenderMode } from '../../renderer/context';
8
+ import { PlayerText } from '../../renderer/text';
7
9
  import { PlayerStreamStatus, IntercomMode, PlayState } from '../../interface';
8
10
  import { UIEventContext } from '../../ui/context';
9
11
  import { radialGradient } from '../../utils';
@@ -31,12 +33,10 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
31
33
  bgColor,
32
34
  disabled = false
33
35
  } = props;
34
- const [frame, setFrame] = useState(0);
35
- const talkingInterval = useRef(null);
36
- // 每帧间隔(ms)
37
36
  const {
38
37
  event
39
38
  } = useContext(UIEventContext);
39
+ const renderMode = usePlayerRenderMode();
40
40
  const {
41
41
  recording,
42
42
  mute,
@@ -69,11 +69,8 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
69
69
  }
70
70
  console.log('==== 开始对讲 =====');
71
71
  originMuteStatusBeforeVoice.current = _mute;
72
- try {
73
- await setIntercom(true);
74
- } catch (e) {
75
- console.error('setIntercom failed:', e);
76
- }
72
+ const started = await setIntercom(true);
73
+ if (!started) return;
77
74
  // 确定对讲有成功回调后,单向对讲判断开始对讲前需要静音
78
75
  // 确定对讲有成功回调后, 双路对讲开始对讲前需要打开拾音器
79
76
  const muteTarget = intercomMode === IntercomMode.OneWay;
@@ -98,20 +95,18 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
98
95
  }, [playState, intercom]);
99
96
  const endVoice = async () => {
100
97
  console.log('=== 结束对讲 ====');
101
- // 对讲结束之后,统一关闭静态状态
102
- await setMute(false);
98
+ // 先释放对讲,扬声器恢复的失败或延迟不应阻止挂断。
103
99
  await setIntercom(false);
100
+ await setMute(false);
104
101
  event.emit(startTimeToHideAllComponent);
105
102
  };
106
103
  const handTouchStart = async e => {
107
- var _props$event, _props$event2;
104
+ var _props$event;
108
105
  if (disabled) return;
109
- (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
110
- ((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
106
+ ((_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event).emit(widgetClick, {
111
107
  widgetId: widgetLabs.VOICE_INTERCOM
112
108
  });
113
109
  onTouchStart(e);
114
- getDefaultStore();
115
110
  if (loading.current) return;
116
111
  loading.current = true;
117
112
  // const _intercom = store.get(intercomAtom);
@@ -140,47 +135,6 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
140
135
  triggerIntercom: e => handTouchStart(e)
141
136
  }));
142
137
 
143
- // 获取 requestAnimationFrame 和兼容性回退
144
- const requestFrame = callback => {
145
- if (typeof requestAnimationFrame !== 'undefined') {
146
- return requestAnimationFrame(callback);
147
- }
148
- return setTimeout(callback, 30); // 使用 setTimeout 模拟帧更新
149
- };
150
- const cancelFrame = id => {
151
- if (typeof cancelAnimationFrame !== 'undefined') {
152
- cancelAnimationFrame(id);
153
- } else {
154
- clearTimeout(id); // 清除 setTimeout
155
- }
156
- };
157
-
158
- /**
159
- * 处理对讲中动画
160
- */
161
- useEffect(() => {
162
- const updateFrame = () => {
163
- setFrame(prevFrame => (prevFrame + 1) % 124);
164
- talkingInterval.current = requestFrame(updateFrame);
165
- };
166
- const stopAnimation = () => {
167
- if (talkingInterval.current) {
168
- cancelFrame(talkingInterval.current);
169
- talkingInterval.current = null;
170
- }
171
- };
172
- intercom ? (() => {
173
- if (!talkingInterval.current) {
174
- talkingInterval.current = requestFrame(updateFrame);
175
- }
176
- })() : stopAnimation();
177
- return () => {
178
- stopAnimation();
179
- };
180
- }, [intercom]);
181
-
182
- // 根据当前帧和矩形索引计算高度
183
-
184
138
  // 渲染对讲中的动画
185
139
 
186
140
  // 渲染非对讲状态的图标
@@ -195,23 +149,44 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
195
149
  }, intercomClassName),
196
150
  onTouchStart: handTouchStart,
197
151
  onTouchEnd: onTouchEnd
198
- }, intercom ? (() => /*#__PURE__*/React.createElement(View, {
199
- className: clsx({
200
- 'ipc-player-plugin-voice-small-ing-intercom': mode !== 'circle'
201
- })
202
- }, /*#__PURE__*/React.createElement(View, {
203
- className: clsx('bars'),
204
- style: {
205
- transform: `scale(${scale})`,
206
- transformOrigin: 'center'
207
- }
208
- }, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement(View, {
209
- key: index,
210
- className: clsx('bar'),
211
- style: {
212
- background: talkingColor
152
+ }, intercom ? (() => {
153
+ if (renderMode === 'lynx') {
154
+ return /*#__PURE__*/React.createElement(View, {
155
+ className: clsx('lynx-talking-bars', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName),
156
+ style: {
157
+ transform: `scale(${scale})`,
158
+ transformOrigin: 'center'
159
+ }
160
+ }, [0, 1, 2, 3, 4].map(index => {
161
+ const baseHeight = [5, 10, 16, 10, 5][index];
162
+ return /*#__PURE__*/React.createElement(View, {
163
+ key: index,
164
+ className: `lynx-talking-bar lynx-talking-bar-${index}`,
165
+ style: {
166
+ height: `${baseHeight}px`,
167
+ background: talkingColor
168
+ }
169
+ });
170
+ }));
213
171
  }
214
- })))))() : (() => {
172
+ return /*#__PURE__*/React.createElement(View, {
173
+ className: clsx({
174
+ 'ipc-player-plugin-voice-small-ing-intercom': mode !== 'circle'
175
+ })
176
+ }, /*#__PURE__*/React.createElement(View, {
177
+ className: clsx('bars'),
178
+ style: {
179
+ transform: `scale(${scale})`,
180
+ transformOrigin: 'center'
181
+ }
182
+ }, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement(View, {
183
+ key: index,
184
+ className: clsx('bar'),
185
+ style: {
186
+ background: talkingColor
187
+ }
188
+ }))));
189
+ })() : (() => {
215
190
  if (icon) {
216
191
  if (typeof icon === 'string') {
217
192
  return /*#__PURE__*/React.createElement(View, {
@@ -225,13 +200,14 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
225
200
  className: clsx('icon-image-default-container', iconClassName)
226
201
  }, icon);
227
202
  }
228
- return /*#__PURE__*/React.createElement(View, {
229
- className: clsx('icon-panel',
230
- // 类名按 iconfont 的 font_class 取,不是 name —— 图标库里这枚图标的
231
- // name 是「one-way-intercom」(单向对讲)、font_class 是「yuyin」(unicode e63c),
232
- // 而 CSS 类是按 font_class 生成的。曾经按 name 拼类名,字形永远找不到,
233
- // 重新导出多少次都不会有那个类。别再"顺手改成语义化名字"。
234
- 'icon-panel-yuyin', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName)
203
+ const className = clsx('icon-panel',
204
+ // 按 iconfont 的 font_class 使用 yuyin,而不是 name one-way-intercom。
205
+ 'icon-panel-yuyin', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName);
206
+ if (renderMode === 'lynx') return /*#__PURE__*/React.createElement(PlayerText, {
207
+ className: className
208
+ });
209
+ return /*#__PURE__*/React.createElement(Text, {
210
+ className: className
235
211
  });
236
212
  })());
237
213
  });
@@ -32,6 +32,23 @@
32
32
  align-items: center;
33
33
  height: 100%;
34
34
  }
35
+
36
+ // Lynx 由渲染线程绘制声波,独立类名避免依赖 :nth-child。
37
+ .lynx-talking-bars {
38
+ padding: 0 1px;
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: center;
42
+ }
43
+
44
+ .lynx-talking-bar {
45
+ width: 2px;
46
+ margin: 0 1px;
47
+ border-radius: 5px;
48
+ transform-origin: center;
49
+ animation: lynx-intercom-pulse 600ms ease-in-out infinite;
50
+ }
51
+
35
52
  .ipc-player-plugin-voice-intercom-img {
36
53
  width: calc(@size * var(--ipc-player-size-scale, 1));
37
54
  height: calc(@size * var(--ipc-player-size-scale, 1));
@@ -151,3 +168,21 @@
151
168
  // transform: translateX(10px) translateY(-50%) rotate(45deg);
152
169
  // }
153
170
  // }
171
+
172
+ @keyframes lynx-intercom-pulse {
173
+ 0%,
174
+ 100% {
175
+ transform: scaleY(0.8);
176
+ }
177
+ 50% {
178
+ transform: scaleY(1.2);
179
+ }
180
+ }
181
+
182
+ .lynx-talking-bar-1,
183
+ .lynx-talking-bar-3 {
184
+ animation-delay: -200ms;
185
+ }
186
+ .lynx-talking-bar-2 {
187
+ animation-delay: -400ms;
188
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,135 @@
1
+ import React from 'react';
2
+ import { act, renderHook } from '@testing-library/react-hooks/dom';
3
+ import { atom, getDefaultStore } from 'jotai';
4
+ import { VoiceIntercom } from './voiceIntercom';
5
+ import { PlayerRenderModeContext } from '../../renderer/context';
6
+ import { IntercomMode, PlayState, PlayerStreamStatus } from '../../interface';
7
+ jest.mock('@ray-js/ray', () => ({
8
+ View: 'view',
9
+ Image: 'image',
10
+ Text: 'text',
11
+ getSystemInfoSync: () => ({
12
+ platform: 'android'
13
+ })
14
+ }));
15
+ jest.mock('@ray-js/svg', () => ({
16
+ __esModule: true,
17
+ default: 'svg'
18
+ }));
19
+ jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
20
+ IntercomMode: {
21
+ OneWay: 'OneWay',
22
+ TwoWay: 'TwoWay'
23
+ }
24
+ }));
25
+ jest.mock('../../utils', () => ({
26
+ radialGradient: () => 'none'
27
+ }));
28
+ describe.each(['lynx', 'webview'])('%s intercom lifecycle', renderMode => {
29
+ const mount = props => renderHook(() => VoiceIntercom.render(props, null), {
30
+ wrapper: _ref => {
31
+ let {
32
+ children
33
+ } = _ref;
34
+ return /*#__PURE__*/React.createElement(PlayerRenderModeContext.Provider, {
35
+ value: renderMode
36
+ }, children);
37
+ }
38
+ });
39
+ const createProps = () => {
40
+ const intercom = atom(false);
41
+ return {
42
+ intercom,
43
+ recording: atom(false),
44
+ mute: atom(true),
45
+ intercomMode: atom(IntercomMode.OneWay),
46
+ brandColor: atom('#FF592A'),
47
+ playState: atom(PlayState.PLAYING),
48
+ mode: 'other',
49
+ event: {
50
+ emit: jest.fn()
51
+ },
52
+ getStreamStatus: () => PlayerStreamStatus.PreviewSuccess,
53
+ setMute: jest.fn().mockResolvedValue(true),
54
+ setIntercom: jest.fn(async target => {
55
+ getDefaultStore().set(intercom, target);
56
+ return true;
57
+ })
58
+ };
59
+ };
60
+ afterEach(() => {
61
+ jest.useRealTimers();
62
+ });
63
+ it('keeps a long call clickable without a JS animation loop and stops/restarts normally', async () => {
64
+ jest.useFakeTimers();
65
+ const props = createProps();
66
+ const {
67
+ result,
68
+ unmount
69
+ } = mount(props);
70
+ await act(async () => {
71
+ await result.current.props.onTouchStart({});
72
+ });
73
+ expect(getDefaultStore().get(props.intercom)).toBe(true);
74
+ act(() => jest.advanceTimersByTime(1000));
75
+ expect(jest.getTimerCount()).toBe(0);
76
+ act(() => jest.advanceTimersByTime(5 * 60 * 1000));
77
+ await act(async () => {
78
+ await result.current.props.onTouchStart({});
79
+ });
80
+ expect(props.setIntercom).toHaveBeenLastCalledWith(false);
81
+ expect(getDefaultStore().get(props.intercom)).toBe(false);
82
+ await act(async () => {
83
+ await result.current.props.onTouchStart({});
84
+ });
85
+ expect(props.setIntercom).toHaveBeenLastCalledWith(true);
86
+ unmount();
87
+ act(() => jest.advanceTimersByTime(1000));
88
+ expect(jest.getTimerCount()).toBe(0);
89
+ });
90
+ it('does not change mute after occupation failure and releases the button for retry', async () => {
91
+ const props = createProps();
92
+ props.setIntercom.mockRejectedValueOnce(undefined);
93
+ const {
94
+ result,
95
+ unmount
96
+ } = mount(props);
97
+ // 双向通话原本会改变静音,失败时必须直接结束。
98
+ act(() => getDefaultStore().set(props.intercomMode, IntercomMode.TwoWay));
99
+ await act(async () => {
100
+ await result.current.props.onTouchStart({});
101
+ });
102
+ expect(props.setMute).not.toHaveBeenCalled();
103
+ expect(getDefaultStore().get(props.intercom)).toBe(false);
104
+ await act(async () => {
105
+ await result.current.props.onTouchStart({});
106
+ });
107
+ expect(props.setIntercom).toHaveBeenCalledTimes(2);
108
+ expect(getDefaultStore().get(props.intercom)).toBe(true);
109
+ unmount();
110
+ });
111
+ it('stops talk before waiting for speaker restoration', async () => {
112
+ const props = createProps();
113
+ getDefaultStore().set(props.intercom, true);
114
+ let restoreSpeaker;
115
+ props.setMute.mockImplementationOnce(() => new Promise(resolve => {
116
+ restoreSpeaker = resolve;
117
+ }));
118
+ const {
119
+ result,
120
+ unmount
121
+ } = mount(props);
122
+ let end;
123
+ await act(async () => {
124
+ end = result.current.props.onTouchStart({});
125
+ await Promise.resolve();
126
+ });
127
+ expect(props.setIntercom).toHaveBeenCalledWith(false);
128
+ expect(getDefaultStore().get(props.intercom)).toBe(false);
129
+ await act(async () => {
130
+ restoreSpeaker(true);
131
+ await end;
132
+ });
133
+ unmount();
134
+ });
135
+ });
@@ -0,0 +1,6 @@
1
+ import type { CSSProperties } from 'react';
2
+ /** Keep legacy draw coordinates, but bound the actual native clipping host to the video. */
3
+ export declare function clipZoomDock(position: CSSProperties, horizontalWidth?: number): {
4
+ position: CSSProperties;
5
+ content: CSSProperties;
6
+ };
@@ -0,0 +1,30 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ /** Keep legacy draw coordinates, but bound the actual native clipping host to the video. */
3
+ export function clipZoomDock(position, horizontalWidth) {
4
+ const next = _objectSpread(_objectSpread({}, position), {}, {
5
+ overflow: 'hidden'
6
+ });
7
+ const content = {
8
+ position: 'absolute',
9
+ top: 0,
10
+ left: 0
11
+ };
12
+ if (horizontalWidth !== undefined) {
13
+ const right = parseFloat(String(position.right)) || 0;
14
+ next.right = `${Math.max(0, right)}px`;
15
+ next.width = `${Math.max(0, horizontalWidth + Math.min(0, right))}px`;
16
+ content.width = `${horizontalWidth}px`;
17
+ content.height = '100%';
18
+ } else {
19
+ const bottom = parseFloat(String(position.bottom)) || 0;
20
+ const height = parseFloat(String(position.height)) || 0;
21
+ next.bottom = `${Math.max(0, bottom)}px`;
22
+ next.height = `${Math.max(0, height + Math.min(0, bottom))}px`;
23
+ content.height = `${height}px`;
24
+ content.width = '100%';
25
+ }
26
+ return {
27
+ position: next,
28
+ content
29
+ };
30
+ }
@@ -1,10 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { ZoomTurntableProps } from './type';
3
3
  import './index.less';
4
- /**
5
- * 焦距转盘渲染层。
6
- * 内嵌自 ray-zoom-turntable,实际绘制与手势在 rjs(render 线程)内完成,
7
- * 拖动不过桥,保证跟手。
8
- */
9
- declare const ZoomTurntable: React.FC<ZoomTurntableProps>;
10
- export default ZoomTurntable;
4
+ declare const _default: {
5
+ (props: ZoomTurntableProps): React.JSX.Element;
6
+ displayName: string;
7
+ };
8
+ export default _default;
@@ -1,7 +1,9 @@
1
1
  import React, { useRef } from 'react';
2
2
  // @ts-ignore rjs 原生组件,无类型声明
3
3
  import Component from './rjs/index.js';
4
+ import LynxZoomTurntable from './lynx';
4
5
  import './index.less';
6
+ import { withPlayerRenderer } from '../../../renderer/capabilities';
5
7
  let canvasIdCounter = 0;
6
8
 
7
9
  /**
@@ -81,4 +83,4 @@ const ZoomTurntable = props => {
81
83
  }
82
84
  });
83
85
  };
84
- export default ZoomTurntable;
86
+ export default withPlayerRenderer('zoomTurntable', ZoomTurntable, LynxZoomTurntable);
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import type { ZoomTurntableProps } from './type';
3
+ import './lynx.less';
4
+ /** Native nodes only: no WebView canvas/RJS, and no fallback into the legacy tree. */
5
+ export default function LynxZoomTurntable(props: ZoomTurntableProps): React.JSX.Element;