@ray-js/ipc-player-integration 0.0.58-beta.2 → 0.0.59-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 (119) hide show
  1. package/README.md +6 -0
  2. package/lib/ctx/ctx.composition.js +4 -19
  3. package/lib/ctx/ctx.js +55 -100
  4. package/lib/ctx/ports.output.d.ts +0 -1
  5. package/lib/ctx/resolution.d.ts +1 -1
  6. package/lib/ctx/resolution.js +1 -3
  7. package/lib/i18n/index.d.ts +0 -12
  8. package/lib/i18n/strings.d.ts +0 -6
  9. package/lib/i18n/strings.js +0 -6
  10. package/lib/index.d.ts +4 -0
  11. package/lib/index.js +3 -1
  12. package/lib/interface.d.ts +3 -18
  13. package/lib/renderer/capabilities.d.ts +8 -0
  14. package/lib/renderer/capabilities.js +19 -0
  15. package/lib/renderer/context.d.ts +5 -0
  16. package/lib/renderer/context.js +6 -0
  17. package/lib/renderer/directionControl.d.ts +6 -0
  18. package/lib/renderer/directionControl.js +3 -0
  19. package/lib/renderer/font.less +5 -0
  20. package/lib/renderer/glyphs.d.ts +1 -0
  21. package/lib/renderer/glyphs.js +256 -0
  22. package/lib/renderer/index.module.less +48 -0
  23. package/lib/renderer/ptzZoom.d.ts +6 -0
  24. package/lib/renderer/ptzZoom.js +3 -0
  25. package/lib/renderer/text.d.ts +4 -0
  26. package/lib/renderer/text.js +32 -0
  27. package/lib/renderer/text.module.less +4 -0
  28. package/lib/renderer/viewport.d.ts +7 -0
  29. package/lib/renderer/viewport.js +24 -0
  30. package/lib/res/lynx-signal/index.d.ts +1 -0
  31. package/lib/res/lynx-signal/index.js +22 -0
  32. package/lib/res/lynx-signal/signalFour0.png +0 -0
  33. package/lib/res/lynx-signal/signalFour1.png +0 -0
  34. package/lib/res/lynx-signal/signalFour2.png +0 -0
  35. package/lib/res/lynx-signal/signalFour3.png +0 -0
  36. package/lib/res/lynx-signal/signalFour4.png +0 -0
  37. package/lib/res/lynx-signal/signalThree0.png +0 -0
  38. package/lib/res/lynx-signal/signalThree1.png +0 -0
  39. package/lib/res/lynx-signal/signalThree2.png +0 -0
  40. package/lib/res/lynx-signal/signalThree3.png +0 -0
  41. package/lib/res/player-more-arrow.png +0 -0
  42. package/lib/ui/bottomLeftContent.js +118 -52
  43. package/lib/ui/bottomRightContent.js +6 -3
  44. package/lib/ui/scrollHintArrow.d.ts +23 -0
  45. package/lib/ui/scrollHintArrow.js +82 -0
  46. package/lib/ui/ui.d.ts +5 -2
  47. package/lib/ui/ui.js +63 -49
  48. package/lib/utils/ttt.js +8 -2
  49. package/lib/widgets/battery/battery.js +2 -1
  50. package/lib/widgets/battery/batteryFull.js +2 -1
  51. package/lib/widgets/floodlight/floodlight.js +2 -1
  52. package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
  53. package/lib/widgets/fullScreen/fullScreen.js +2 -1
  54. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  55. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  56. package/lib/widgets/fullScreen/verticalScreen.js +2 -1
  57. package/lib/widgets/index.d.ts +0 -1
  58. package/lib/widgets/index.js +1 -2
  59. package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
  60. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
  61. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
  62. package/lib/widgets/multiCamera/landscapeTip.js +2 -1
  63. package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
  64. package/lib/widgets/multiCamera/multiPtz.js +2 -1
  65. package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
  66. package/lib/widgets/multiCamera/switchLayout.js +2 -1
  67. package/lib/widgets/multiCamera/tileMultiPtz.js +2 -1
  68. package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
  69. package/lib/widgets/multiCamera/tileTip.js +2 -1
  70. package/lib/widgets/muted/muted.js +5 -10
  71. package/lib/widgets/muted/muted.less +1 -5
  72. package/lib/widgets/ptz/ptz.js +2 -1
  73. package/lib/widgets/ptz/ptzControl.js +1 -1
  74. package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
  75. package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
  76. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
  77. package/lib/widgets/recordVideo/recordVideo.js +53 -53
  78. package/lib/widgets/recordVideo/recordVideo.less +74 -17
  79. package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
  80. package/lib/widgets/resolution/fullResolutionControl.js +29 -19
  81. package/lib/widgets/resolution/resolution.js +3 -2
  82. package/lib/widgets/screenshot/screenshot.js +45 -66
  83. package/lib/widgets/screenshot/screenshot.less +40 -1
  84. package/lib/widgets/signal4G/signal4G.js +4 -1
  85. package/lib/widgets/siren/siren.js +2 -1
  86. package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
  87. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
  88. package/lib/widgets/trialBadge/index.js +8 -3
  89. package/lib/widgets/trialBadge/index.less +24 -0
  90. package/lib/widgets/tryExperience/tryExperience.js +3 -1
  91. package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
  92. package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
  93. package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
  94. package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
  95. package/lib/widgets/zoomTurntable/turntable/index.js +2 -1
  96. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +2 -1
  97. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +2 -1
  98. package/package.json +15 -8
  99. package/lib/ctx/ctx.album.test.d.ts +0 -1
  100. package/lib/ctx/ctx.album.test.js +0 -197
  101. package/lib/ui/absoluteContent.d.ts +0 -2
  102. package/lib/ui/absoluteContent.js +0 -3
  103. package/lib/utils/captureResult.d.ts +0 -14
  104. package/lib/utils/captureResult.js +0 -70
  105. package/lib/utils/captureResult.test.d.ts +0 -1
  106. package/lib/utils/captureResult.test.js +0 -117
  107. package/lib/widgets/captureResult/captureResult.d.ts +0 -16
  108. package/lib/widgets/captureResult/captureResult.js +0 -85
  109. package/lib/widgets/captureResult/captureResult.less +0 -144
  110. package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
  111. package/lib/widgets/captureResult/captureResult.test.js +0 -80
  112. package/lib/widgets/captureResult/index.d.ts +0 -2
  113. package/lib/widgets/captureResult/index.js +0 -2
  114. package/lib/widgets/muted/muted.test.d.ts +0 -1
  115. package/lib/widgets/muted/muted.test.js +0 -81
  116. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
  117. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
  118. package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
  119. package/lib/widgets/screenshot/screenshot.test.js +0 -120
@@ -2,7 +2,46 @@
2
2
  color: var(--iconColor);
3
3
  font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
4
4
  }
5
-
6
5
  .ipc-player-plugin-screenshot-toast-wrap {
7
6
  position: absolute;
8
7
  }
8
+ .ipc-player-plugin-screenshot-toast {
9
+ flex: 1;
10
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
11
+ background-color: var(--shot-card-bg-color);
12
+ display: flex;
13
+ align-items: center;
14
+ padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
15
+ z-index: 100;
16
+ .ipc-player-plugin-screenshot-toast-image-box {
17
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
18
+ overflow: hidden;
19
+ width: calc(66px * var(--ipc-player-size-scale, 1));
20
+ height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
21
+ }
22
+ .ipc-player-plugin-screenshot-toast-image {
23
+ width: 100%;
24
+ height: 100%;
25
+ object-fit: cover;
26
+ }
27
+ .ipc-player-plugin-screenshot-toast-title {
28
+ flex: 1;
29
+ margin-left: calc(12px * var(--ipc-player-size-scale, 1));
30
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
31
+ color: var(--fontColor);
32
+ margin-right: calc(12px * var(--ipc-player-size-scale, 1));
33
+ word-break: break-word;
34
+
35
+ }
36
+ .ipc-player-plugin-screenshot-toast-bottom {
37
+ border: 1px solid #1989FA;
38
+ min-width: calc(52px * var(--ipc-player-size-scale, 1));
39
+ max-width: calc(100px * var(--ipc-player-size-scale, 1));
40
+ border-radius: calc(4px * var(--ipc-player-size-scale, 1));
41
+ padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
42
+ font-size: calc(14px * var(--ipc-player-size-scale, 1));
43
+ white-space: nowrap;
44
+ overflow: hidden;
45
+ text-overflow: ellipsis;
46
+ }
47
+ }
@@ -3,12 +3,15 @@ import { View, Image } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import { useSignal4G } from '../../hooks';
5
5
  import { signalSvgMap } from '../../res';
6
+ import { signalPngMap } from '../../res/lynx-signal';
7
+ import { usePlayerRenderMode } from '../../renderer/context';
6
8
  import './signal4G.less';
7
9
  export const Signal4G = props => {
8
10
  const {
9
11
  className,
10
12
  devId
11
13
  } = props;
14
+ const isLynx = usePlayerRenderMode() === 'lynx';
12
15
  const {
13
16
  dpValue,
14
17
  signalKey
@@ -22,7 +25,7 @@ export const Signal4G = props => {
22
25
  className: clsx('ipc-player-plugin-signal4g')
23
26
  }, /*#__PURE__*/React.createElement(Image, {
24
27
  className: clsx('ipc-player-plugin-signal4g-icon'),
25
- src: signalSvgMap[signalKey],
28
+ src: isLynx ? signalPngMap[signalKey] : signalSvgMap[signalKey],
26
29
  mode: "aspectFit"
27
30
  })));
28
31
  };
@@ -1,6 +1,7 @@
1
- import { View, Text } from '@ray-js/ray';
1
+ import { View } from '@ray-js/ray';
2
2
  import React, { useContext } from 'react';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useDpState } from '../../hooks';
5
6
  import { useStore } from '../../ctx/store';
6
7
  import { UIEventContext } from '../../ui/context';
@@ -1,8 +1,9 @@
1
1
  import "core-js/modules/esnext.iterator.constructor.js";
2
2
  import "core-js/modules/esnext.iterator.map.js";
3
3
  import React, { useMemo } from 'react';
4
- import { View, Text } from '@ray-js/ray';
4
+ import { View } from '@ray-js/ray';
5
5
  import clsx from 'clsx';
6
+ import { PlayerText as Text } from '../../renderer/text';
6
7
  import { useTemperature, useHumidity, useEc, useWaterTemperature, useDpSupport } from '../../hooks';
7
8
  import { IPC_EC, IPC_WATER_TEMPERATURE, SENSOR_HUMIDITY, SENSOR_TEMPERATURE } from '../../utils/content/dpCode';
8
9
  import './tempHumidity.less';
@@ -1,6 +1,7 @@
1
- import { Text, View } from '@ray-js/ray';
1
+ import { View } from '@ray-js/ray';
2
2
  import clsx from 'clsx';
3
3
  import React from 'react';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import './toggleVerticalFull.less';
6
7
  export function ToggleVerticalFull(props) {
@@ -1,6 +1,8 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import { Image, Text, View } from '@ray-js/ray';
2
+ import { Image, View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { usePlayerRenderMode } from '../../renderer/context';
5
+ import { PlayerText as Text } from '../../renderer/text';
4
6
  import Strings from '../../i18n';
5
7
  import tryOpen from '../../res/try/try_open.png';
6
8
  import './index.less';
@@ -21,6 +23,7 @@ export const TrialBadge = _ref => {
21
23
  onSubscribe,
22
24
  onCountdownEnd
23
25
  } = _ref;
26
+ const renderMode = usePlayerRenderMode();
24
27
  const [remainingSec, setRemainingSec] = useState(Math.max(0, Math.floor(trialRemainingSec)));
25
28
  const endedRef = useRef(false);
26
29
  const onCountdownEndRef = useRef(onCountdownEnd);
@@ -60,14 +63,16 @@ export const TrialBadge = _ref => {
60
63
  }, [trialRemainingSec]);
61
64
  const countdownText = formatCountdown(remainingSec);
62
65
  return /*#__PURE__*/React.createElement(View, {
63
- className: clsx('ipc-player-trial-badge', className)
66
+ className: clsx('ipc-player-trial-badge', className, {
67
+ 'ipc-player-trial-badge--lynx': renderMode === 'lynx'
68
+ })
64
69
  }, /*#__PURE__*/React.createElement(Image, {
65
70
  className: "ipc-player-trial-badge-icon",
66
71
  src: tryOpen,
67
72
  mode: "heightFix"
68
73
  }), /*#__PURE__*/React.createElement(Text, {
69
74
  className: "ipc-player-trial-badge-status"
70
- }, Strings.getLang('ipc_player_trial_in_use')), /*#__PURE__*/React.createElement(Text, {
75
+ }, Strings.getLang('ipc_player_trial_in_use').replace(/\s*[||]\s*$/, '')), /*#__PURE__*/React.createElement(Text, {
71
76
  className: "ipc-player-trial-badge-divider"
72
77
  }, "|"), /*#__PURE__*/React.createElement(Text, {
73
78
  className: "ipc-player-trial-badge-preview"
@@ -66,3 +66,27 @@
66
66
  font-weight: 600;
67
67
  line-height: 1;
68
68
  }
69
+
70
+ // Lynx 不支持 inline-flex 的 WebView 排版语义,显式声明横向 flex。
71
+ .ipc-player-trial-badge--lynx {
72
+ // Match WebView inline-flex: size to content instead of stretching across its parent.
73
+ align-self: flex-start;
74
+ display: flex;
75
+ flex-direction: row;
76
+ background-color: rgba(0, 0, 0, 0.65);
77
+
78
+ .ipc-player-trial-badge-icon {
79
+ width: 20px;
80
+ }
81
+
82
+ .ipc-player-trial-badge-status,
83
+ .ipc-player-trial-badge-divider,
84
+ .ipc-player-trial-badge-preview {
85
+ flex-shrink: 0;
86
+ }
87
+
88
+ .ipc-player-trial-badge-cta {
89
+ display: flex;
90
+ flex-direction: row;
91
+ }
92
+ }
@@ -1,7 +1,8 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { View, Image, getSystemInfoSync, showToast, Text } from '@ray-js/ray';
2
+ import { View, Image, getSystemInfoSync, showToast } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import React, { useState, useEffect, useCallback, useRef } from 'react';
5
+ import { PlayerText as Text } from '../../renderer/text';
5
6
  import { useStore } from '../../ctx/store';
6
7
  import Strings from '../../i18n';
7
8
  import { getAIFrameFeature, gotoAIDrawMiniProgram, setAIFrameFeature } from '../../utils';
@@ -77,6 +78,7 @@ export const TryExperience = props => {
77
78
  }
78
79
  }, [buttonState]);
79
80
  const onTryExperience = useCallback(async () => {
81
+ console.log('res===onTryExperience', lockRef.current, isLowPhone);
80
82
  if (lockRef.current) return;
81
83
  if (isLowPhone) {
82
84
  showToast({
@@ -1,8 +1,9 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
- import { View, Text, usePageEvent } from '@ray-js/ray';
2
+ import { View, usePageEvent } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import { getVideoBitrateKbps, requestWifiSignal } from '@ray-js/ray-ipc-utils';
5
5
  import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
6
+ import { PlayerText as Text } from '../../renderer/text';
6
7
  import { PlayState } from '../../interface';
7
8
  import './videoBitKBP.less';
8
9
  import { useStore } from '../../ctx/store';
@@ -1,9 +1,11 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { useRef, useContext, useState, useEffect, forwardRef, useImperativeHandle } from 'react';
3
- import { View, Image, getSystemInfoSync } from '@ray-js/ray';
3
+ import { View, Image, Text, getSystemInfoSync } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
5
  import { useStore, getDefaultStore, 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';
@@ -37,6 +39,7 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
37
39
  const {
38
40
  event
39
41
  } = useContext(UIEventContext);
42
+ const renderMode = usePlayerRenderMode();
40
43
  const {
41
44
  recording,
42
45
  mute,
@@ -195,23 +198,45 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
195
198
  }, intercomClassName),
196
199
  onTouchStart: handTouchStart,
197
200
  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
201
+ }, intercom ? (() => {
202
+ if (renderMode === 'lynx') {
203
+ return /*#__PURE__*/React.createElement(View, {
204
+ className: clsx('lynx-talking-bars', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName),
205
+ style: {
206
+ transform: `scale(${scale})`,
207
+ transformOrigin: 'center'
208
+ }
209
+ }, [0, 1, 2, 3, 4].map(index => {
210
+ const baseHeight = [5, 10, 16, 10, 5][index];
211
+ const factor = 1 + Math.sin((frame + index) / 5) * 0.2;
212
+ return /*#__PURE__*/React.createElement(View, {
213
+ key: index,
214
+ className: "lynx-talking-bar",
215
+ style: {
216
+ height: `${baseHeight * factor}px`,
217
+ background: talkingColor
218
+ }
219
+ });
220
+ }));
213
221
  }
214
- })))))() : (() => {
222
+ return /*#__PURE__*/React.createElement(View, {
223
+ className: clsx({
224
+ 'ipc-player-plugin-voice-small-ing-intercom': mode !== 'circle'
225
+ })
226
+ }, /*#__PURE__*/React.createElement(View, {
227
+ className: clsx('bars'),
228
+ style: {
229
+ transform: `scale(${scale})`,
230
+ transformOrigin: 'center'
231
+ }
232
+ }, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement(View, {
233
+ key: index,
234
+ className: clsx('bar'),
235
+ style: {
236
+ background: talkingColor
237
+ }
238
+ }))));
239
+ })() : (() => {
215
240
  if (icon) {
216
241
  if (typeof icon === 'string') {
217
242
  return /*#__PURE__*/React.createElement(View, {
@@ -225,13 +250,14 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
225
250
  className: clsx('icon-image-default-container', iconClassName)
226
251
  }, icon);
227
252
  }
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)
253
+ const className = clsx('icon-panel',
254
+ // 按 iconfont 的 font_class 使用 yuyin,而不是 name one-way-intercom。
255
+ 'icon-panel-yuyin', mode === 'circle' && 'intercom-default-size', mode !== 'circle' && 'ipc-player-plugin-voice-small-intercom', iconClassName);
256
+ if (renderMode === 'lynx') return /*#__PURE__*/React.createElement(PlayerText, {
257
+ className: className
258
+ });
259
+ return /*#__PURE__*/React.createElement(Text, {
260
+ className: className
235
261
  });
236
262
  })());
237
263
  });
@@ -32,6 +32,22 @@
32
32
  align-items: center;
33
33
  height: 100%;
34
34
  }
35
+
36
+ // Lynx 对讲中状态使用内联帧高度,避开 :nth-child 与 CSS animation 在 Lynx 下的兼容差异。
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
+ transition: height 30ms linear;
49
+ }
50
+
35
51
  .ipc-player-plugin-voice-intercom-img {
36
52
  width: calc(@size * var(--ipc-player-size-scale, 1));
37
53
  height: calc(@size * var(--ipc-player-size-scale, 1));
@@ -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;
@@ -2,6 +2,7 @@ import React, { useRef } from 'react';
2
2
  // @ts-ignore rjs 原生组件,无类型声明
3
3
  import Component from './rjs/index.js';
4
4
  import './index.less';
5
+ import { withPlayerRenderer } from '../../../renderer/capabilities';
5
6
  let canvasIdCounter = 0;
6
7
 
7
8
  /**
@@ -81,4 +82,4 @@ const ZoomTurntable = props => {
81
82
  }
82
83
  });
83
84
  };
84
- export default ZoomTurntable;
85
+ export default withPlayerRenderer('zoomTurntable', ZoomTurntable);
@@ -2,9 +2,10 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import "core-js/modules/esnext.iterator.constructor.js";
3
3
  import "core-js/modules/esnext.iterator.map.js";
4
4
  import React, { useContext, useEffect, useRef, useState } from 'react';
5
- import { View, Text, usePageEvent } from '@ray-js/ray';
5
+ import { View, usePageEvent } from '@ray-js/ray';
6
6
  import clsx from 'clsx';
7
7
  import { useMemoizedFn } from 'ahooks';
8
+ import { PlayerText as Text } from '../../renderer/text';
8
9
  import { useStore } from '../../ctx/store';
9
10
  import { UIEventContext } from '../../ui/context';
10
11
  import { PlayState } from '../../interface';
@@ -1,6 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { CoverView, Text, View } from '@ray-js/ray';
2
+ import { CoverView, View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { PlayerText as Text } from '../../renderer/text';
4
5
  import { useStore } from '../../ctx/store';
5
6
  import { PlayState } from '../../interface';
6
7
  import { widgetClick, widgetLabs } from '../../ui/constant';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.58-beta.2",
3
+ "version": "0.0.59-beta.0",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -29,17 +29,18 @@
29
29
  "start:web": "ray start ./example -t web",
30
30
  "prepublishOnly": "yarn build",
31
31
  "release-it": "standard-version",
32
- "test": "yarn jest"
32
+ "test": "yarn jest",
33
+ "test:lynx": "node --test tests/*.test.cjs",
34
+ "test:features": "jest --runInBand --runTestsByPath tests/master-features.test.tsx src/utils/authorize/album.test.ts src/widgets/recordVideo/recordVideo.test.tsx src/widgets/zoomTurntable/lensModel.test.ts"
33
35
  },
34
36
  "peerDependencies": {
35
37
  "ahooks": "^3.1.6"
36
38
  },
37
39
  "dependencies": {
38
- "@ray-js/direction-control": "^0.0.8",
39
- "@ray-js/ipc-ptz-zoom": "^0.0.3",
40
- "@ray-js/panel-sdk": "^1.13.1",
41
- "@ray-js/ray-ipc-player": "2.1.5-beta.0",
42
- "@ray-js/ray-ipc-utils": "^1.1.16",
40
+ "@ray-js/direction-control": "0.0.13-beta.0",
41
+ "@ray-js/ipc-ptz-zoom": "0.0.5-beta.0",
42
+ "@ray-js/ray-ipc-player": "2.1.6-beta.0",
43
+ "@ray-js/ray-ipc-utils": "^1.1.18",
43
44
  "@ray-js/svg": "0.2.0",
44
45
  "clsx": "^1.2.1",
45
46
  "color": "^5.0.2",
@@ -57,7 +58,13 @@
57
58
  "eslint-config-tuya-panel": "^0.4.2",
58
59
  "husky": "^1.2.0",
59
60
  "lint-staged": "^10.2.11",
60
- "standard-version": "9.3.2"
61
+ "standard-version": "9.3.2",
62
+ "react": "17.0.2",
63
+ "react-dom": "17.0.2",
64
+ "typescript": "4.9.5",
65
+ "jest": "29.7.0",
66
+ "ts-jest": "29.2.6",
67
+ "jest-environment-jsdom": "29.7.0"
61
68
  },
62
69
  "resolutions": {
63
70
  "@ray-js/builder-mp": "^1.7.62"
@@ -1 +0,0 @@
1
- export {};
@@ -1,197 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { act, renderHook } from '@testing-library/react-hooks/dom';
3
- import { authorize, authorizeStatus, getSystemInfoSync, showModal } from '@ray-js/ray';
4
- import { createUseCtx } from './ctx';
5
- import { useStore } from './store';
6
- jest.mock('@ray-js/ray', () => ({
7
- authorize: jest.fn(),
8
- authorizeStatus: jest.fn(),
9
- getSystemInfoSync: jest.fn(),
10
- openAppSystemSettingPage: jest.fn(),
11
- showModal: jest.fn()
12
- }));
13
- jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({
14
- ClarityType: {
15
- HD: 'HD',
16
- SD: 'SD',
17
- AUTO: 'AUTO'
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: () => false,
37
- setCachedAutoClarity: jest.fn(),
38
- subscribeClarityChanged: () => () => undefined
39
- }));
40
- beforeEach(() => {
41
- jest.clearAllMocks();
42
- getSystemInfoSync.mockReturnValue({
43
- platform: 'android',
44
- system: 'android 12'
45
- });
46
- authorizeStatus.mockImplementation(_ref => {
47
- let {
48
- fail
49
- } = _ref;
50
- return fail({
51
- errorCode: 9004
52
- });
53
- });
54
- authorize.mockImplementation(_ref2 => {
55
- let {
56
- fail
57
- } = _ref2;
58
- return fail({
59
- errorCode: 9004
60
- });
61
- });
62
- });
63
- const mountContext = function () {
64
- let saveToAlbum = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
65
- const capture = {
66
- tempImagePath: 'thingfile://capture.jpg',
67
- filePath: 'thingfile://record.mp4'
68
- };
69
- const startRecord = jest.fn(_ref3 => {
70
- let {
71
- success
72
- } = _ref3;
73
- return success();
74
- });
75
- const stopRecord = jest.fn(_ref4 => {
76
- let {
77
- success
78
- } = _ref4;
79
- return success(capture);
80
- });
81
- const useCtx = createUseCtx({
82
- createPlayContext: () => ({
83
- startRecord,
84
- stopRecord
85
- }),
86
- getMemoryState: jest.fn().mockResolvedValue({
87
- resolution: 'HD',
88
- resolutionList: ['HD', 'SD'],
89
- mute: true,
90
- intercomMode: 'TwoWay',
91
- isIntercomSupported: false
92
- }),
93
- setResolutionMemoryState: jest.fn(),
94
- setMuteMemoryState: jest.fn(),
95
- authorizeStatus: jest.fn(),
96
- toast: jest.fn()
97
- });
98
- const hook = renderHook(() => {
99
- const ctx = useCtx({
100
- devId: 'camera-1',
101
- multiLens: true,
102
- saveToAlbum
103
- });
104
- const state = useStore({
105
- recording: ctx.recording
106
- });
107
- return _objectSpread(_objectSpread({}, ctx), {}, {
108
- state
109
- });
110
- });
111
- return _objectSpread(_objectSpread({}, hook), {}, {
112
- startRecord,
113
- stopRecord,
114
- capture
115
- });
116
- };
117
- it('starts without legacy authorization and retains the native stop result', async () => {
118
- const {
119
- result,
120
- startRecord,
121
- stopRecord,
122
- capture,
123
- unmount
124
- } = mountContext();
125
- await act(async () => {
126
- expect(await result.current.setRecording(true)).toBe(true);
127
- });
128
- expect(startRecord).toHaveBeenCalledWith(expect.objectContaining({
129
- saveToAlbum: 1
130
- }));
131
- expect(result.current.state.recording).toBe(true);
132
- expect(result.current.multiLens).toBe(true);
133
- await act(async () => {
134
- expect(await result.current.setRecording(false)).toEqual(capture);
135
- });
136
- expect(stopRecord).toHaveBeenCalledTimes(1);
137
- expect(result.current.state.recording).toBe(false);
138
- expect(authorizeStatus).not.toHaveBeenCalled();
139
- expect(authorize).not.toHaveBeenCalled();
140
- unmount();
141
- });
142
- it('settles a denied start without calling the native recorder', async () => {
143
- getSystemInfoSync.mockReturnValue({
144
- platform: 'ios',
145
- system: 'iOS 18'
146
- });
147
- const {
148
- result,
149
- startRecord,
150
- unmount
151
- } = mountContext();
152
- await act(async () => {
153
- expect(await result.current.setRecording(true)).toBe(false);
154
- });
155
- expect(startRecord).not.toHaveBeenCalled();
156
- expect(result.current.state.recording).toBe(false);
157
- expect(showModal).toHaveBeenCalledTimes(1);
158
- unmount();
159
- });
160
- it('propagates a native start failure without entering recording state', async () => {
161
- const {
162
- result,
163
- startRecord,
164
- unmount
165
- } = mountContext();
166
- const error = {
167
- errorCode: 1001,
168
- errorMsg: 'Start failed'
169
- };
170
- startRecord.mockImplementationOnce(_ref5 => {
171
- let {
172
- fail
173
- } = _ref5;
174
- return fail(error);
175
- });
176
- await act(async () => {
177
- await expect(result.current.setRecording(true)).rejects.toEqual(error);
178
- });
179
- expect(result.current.state.recording).toBe(false);
180
- unmount();
181
- });
182
- it('keeps the requested album when stopping on page unload', async () => {
183
- const {
184
- result,
185
- stopRecord,
186
- capture,
187
- unmount
188
- } = mountContext(0);
189
- await act(async () => {
190
- expect(await result.current.stopRecordingOnUnload()).toEqual(capture);
191
- });
192
- expect(stopRecord).toHaveBeenCalledWith(expect.objectContaining({
193
- saveToAlbum: 0
194
- }));
195
- expect(authorizeStatus).not.toHaveBeenCalled();
196
- unmount();
197
- });
@@ -1,2 +0,0 @@
1
- import type { ComponentConfig, ComponentRenderState } from '../interface';
2
- export declare function shouldRenderContent<T>(item: ComponentConfig<T>, state: ComponentRenderState): boolean;
@@ -1,3 +0,0 @@
1
- export function shouldRenderContent(item, state) {
2
- return !item.hidden && (!item.renderWhen || item.renderWhen(state));
3
- }
@@ -1,14 +0,0 @@
1
- import type { CaptureResult } from '../interface';
2
- export type CaptureResultSummary = {
3
- count: number;
4
- isMultiLens: boolean;
5
- thumbnailPath: string;
6
- };
7
- export type CaptureResultOptions = {
8
- multiLens: boolean;
9
- protocolCount?: number | string;
10
- devId: string;
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>;