@ray-js/ipc-player-integration 0.0.71-beta.0 → 0.0.72-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 (145) hide show
  1. package/README.md +0 -6
  2. package/lib/ctx/ctx.composition.d.ts +5 -1
  3. package/lib/ctx/ctx.composition.js +4 -1
  4. package/lib/ctx/ctx.js +17 -12
  5. package/lib/ctx/ctx.test.js +19 -54
  6. package/lib/features/initPlayerWidgets/index.d.ts +3 -0
  7. package/lib/features/initPlayerWidgets/index.js +4 -0
  8. package/lib/index.d.ts +0 -4
  9. package/lib/index.js +1 -3
  10. package/lib/interface.d.ts +1 -1
  11. package/lib/ui/bottomControlLayout.d.ts +11 -0
  12. package/lib/ui/bottomControlLayout.js +19 -0
  13. package/lib/ui/bottomControlLayout.test.js +64 -0
  14. package/lib/ui/bottomLeftContent.js +73 -180
  15. package/lib/ui/bottomLeftContent.test.js +138 -0
  16. package/lib/ui/bottomRightContent.d.ts +2 -2
  17. package/lib/ui/bottomRightContent.js +24 -16
  18. package/lib/ui/bottomRightContent.test.js +144 -0
  19. package/lib/ui/constant.d.ts +2 -0
  20. package/lib/ui/constant.js +4 -1
  21. package/lib/ui/topLeftContent.js +2 -4
  22. package/lib/ui/topRightContent.js +2 -4
  23. package/lib/ui/ui.d.ts +0 -5
  24. package/lib/ui/ui.js +33 -86
  25. package/lib/ui/ui.less +24 -59
  26. package/lib/widgets/battery/battery.js +5 -7
  27. package/lib/widgets/battery/batteryFull.js +5 -7
  28. package/lib/widgets/captureResult/captureResult.js +1 -2
  29. package/lib/widgets/floatWindow/floatWindow.d.ts +13 -0
  30. package/lib/widgets/floatWindow/floatWindow.js +93 -0
  31. package/lib/widgets/floatWindow/floatWindow.less +14 -0
  32. package/lib/widgets/floatWindow/floatWindow.test.d.ts +1 -0
  33. package/lib/widgets/floatWindow/floatWindow.test.js +164 -0
  34. package/lib/widgets/floatWindow/icon.d.ts +1 -0
  35. package/lib/widgets/floatWindow/icon.js +4 -0
  36. package/lib/widgets/floatWindow/index.d.ts +1 -0
  37. package/lib/widgets/floatWindow/index.js +1 -0
  38. package/lib/widgets/floodlight/floodlight.js +1 -2
  39. package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
  40. package/lib/widgets/fullScreen/fullScreen.js +1 -2
  41. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  42. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  43. package/lib/widgets/fullScreen/verticalScreen.js +1 -2
  44. package/lib/widgets/index.d.ts +1 -0
  45. package/lib/widgets/index.js +2 -1
  46. package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
  47. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +5 -16
  48. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
  49. package/lib/widgets/multiCamera/landscapeTip.js +2 -8
  50. package/lib/widgets/multiCamera/moveablePtzControl.js +3 -5
  51. package/lib/widgets/multiCamera/multiPtz.js +1 -2
  52. package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -8
  53. package/lib/widgets/multiCamera/switchLayout.js +1 -2
  54. package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
  55. package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
  56. package/lib/widgets/multiCamera/tileTip.js +2 -8
  57. package/lib/widgets/muted/muted.js +1 -2
  58. package/lib/widgets/muted/muted.test.js +52 -66
  59. package/lib/widgets/ptz/ptz.js +1 -2
  60. package/lib/widgets/ptz/ptzControl.js +3 -4
  61. package/lib/widgets/ptzControlTip/ptzControlTip.js +4 -9
  62. package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
  63. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
  64. package/lib/widgets/recordVideo/recordVideo.js +169 -47
  65. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +2 -4
  66. package/lib/widgets/recordVideo/recordVideo.test.js +2 -169
  67. package/lib/widgets/resolution/fullResolutionControl.js +19 -29
  68. package/lib/widgets/resolution/resolution.js +2 -3
  69. package/lib/widgets/screenshot/screenshot.js +122 -48
  70. package/lib/widgets/screenshot/screenshot.test.js +113 -108
  71. package/lib/widgets/signal4G/signal4G.js +1 -4
  72. package/lib/widgets/siren/siren.js +1 -2
  73. package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
  74. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
  75. package/lib/widgets/trialBadge/index.js +3 -8
  76. package/lib/widgets/trialBadge/index.less +0 -24
  77. package/lib/widgets/tryExperience/tryExperience.js +1 -2
  78. package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
  79. package/lib/widgets/voiceIntercom/voiceIntercom.js +81 -57
  80. package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -35
  81. package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
  82. package/lib/widgets/zoomTurntable/turntable/index.js +1 -3
  83. package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +3 -5
  84. package/lib/widgets/zoomTurntable/zoomTurntableDock.js +4 -4
  85. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +19 -32
  86. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -17
  87. package/package.json +7 -15
  88. package/lib/ctx/intercom.test.js +0 -85
  89. package/lib/renderer/capabilities.d.ts +0 -8
  90. package/lib/renderer/capabilities.js +0 -19
  91. package/lib/renderer/context.d.ts +0 -5
  92. package/lib/renderer/context.js +0 -6
  93. package/lib/renderer/directionControl.d.ts +0 -6
  94. package/lib/renderer/directionControl.js +0 -3
  95. package/lib/renderer/font-manifest.json +0 -9
  96. package/lib/renderer/font.less +0 -5
  97. package/lib/renderer/glyphs.d.ts +0 -1
  98. package/lib/renderer/glyphs.js +0 -256
  99. package/lib/renderer/index.module.less +0 -48
  100. package/lib/renderer/overlay.d.ts +0 -6
  101. package/lib/renderer/overlay.js +0 -18
  102. package/lib/renderer/ptzZoom.d.ts +0 -6
  103. package/lib/renderer/ptzZoom.js +0 -3
  104. package/lib/renderer/text.d.ts +0 -4
  105. package/lib/renderer/text.js +0 -32
  106. package/lib/renderer/text.module.less +0 -4
  107. package/lib/renderer/viewport.d.ts +0 -7
  108. package/lib/renderer/viewport.js +0 -24
  109. package/lib/res/lynx-signal/index.d.ts +0 -1
  110. package/lib/res/lynx-signal/index.js +0 -22
  111. package/lib/res/lynx-signal/signalFour0.png +0 -0
  112. package/lib/res/lynx-signal/signalFour1.png +0 -0
  113. package/lib/res/lynx-signal/signalFour2.png +0 -0
  114. package/lib/res/lynx-signal/signalFour3.png +0 -0
  115. package/lib/res/lynx-signal/signalFour4.png +0 -0
  116. package/lib/res/lynx-signal/signalThree0.png +0 -0
  117. package/lib/res/lynx-signal/signalThree1.png +0 -0
  118. package/lib/res/lynx-signal/signalThree2.png +0 -0
  119. package/lib/res/lynx-signal/signalThree3.png +0 -0
  120. package/lib/res/player-charging.png +0 -0
  121. package/lib/res/player-more-arrow.png +0 -0
  122. package/lib/res/player-solar.png +0 -0
  123. package/lib/ui/scrollHintArrow.d.ts +0 -23
  124. package/lib/ui/scrollHintArrow.js +0 -83
  125. package/lib/widgets/battery/statusIcon.d.ts +0 -6
  126. package/lib/widgets/battery/statusIcon.js +0 -36
  127. package/lib/widgets/battery/statusIcon.less +0 -24
  128. package/lib/widgets/captureToast/captureToast.d.ts +0 -10
  129. package/lib/widgets/captureToast/captureToast.js +0 -58
  130. package/lib/widgets/recordVideo/recordVideoTimer.d.ts +0 -3
  131. package/lib/widgets/recordVideo/recordVideoTimer.js +0 -26
  132. package/lib/widgets/screenshot/screenshot.permissions.test.js +0 -137
  133. package/lib/widgets/voiceIntercom/voiceIntercom.test.js +0 -135
  134. package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
  135. package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
  136. package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
  137. package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
  138. package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
  139. package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
  140. package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
  141. package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
  142. package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
  143. /package/lib/{ctx/intercom.test.d.ts → ui/bottomControlLayout.test.d.ts} +0 -0
  144. /package/lib/{widgets/screenshot/screenshot.permissions.test.d.ts → ui/bottomLeftContent.test.d.ts} +0 -0
  145. /package/lib/{widgets/voiceIntercom/voiceIntercom.test.d.ts → ui/bottomRightContent.test.d.ts} +0 -0
@@ -1,24 +0,0 @@
1
- export const getPlayerViewport = (mode, verticalFull, height) => {
2
- if (mode === 'lynx' && verticalFull) {
3
- // The outer player already has a resolved height. Do not nest its calc expression.
4
- return {
5
- style: {
6
- height: 'calc(100% - 48px)',
7
- flexShrink: 0,
8
- backgroundColor: '#000',
9
- display: 'flex',
10
- flexDirection: 'column',
11
- justifyContent: 'center'
12
- },
13
- objectFit: 'fillCrop',
14
- backgroundColor: '#000'
15
- };
16
- }
17
- return {
18
- style: {
19
- height: verticalFull ? `calc(${height} - 48px)` : height
20
- },
21
- objectFit: 'fillCrop',
22
- backgroundColor: '#262626'
23
- };
24
- };
@@ -1 +0,0 @@
1
- export declare const signalPngMap: Record<string, string>;
@@ -1,22 +0,0 @@
1
- import signalFour0 from './signalFour0.png';
2
- import signalFour1 from './signalFour1.png';
3
- import signalFour2 from './signalFour2.png';
4
- import signalFour3 from './signalFour3.png';
5
- import signalFour4 from './signalFour4.png';
6
- import signalThree0 from './signalThree0.png';
7
- import signalThree1 from './signalThree1.png';
8
- import signalThree2 from './signalThree2.png';
9
- import signalThree3 from './signalThree3.png';
10
-
11
- // Rasterized from the corresponding WebView SVG; keep every signal level unchanged.
12
- export const signalPngMap = {
13
- signalFour0,
14
- signalFour1,
15
- signalFour2,
16
- signalFour3,
17
- signalFour4,
18
- signalThree0,
19
- signalThree1,
20
- signalThree2,
21
- signalThree3
22
- };
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,23 +0,0 @@
1
- import React from 'react';
2
- export declare function usesNativeHintImage(renderMode: string, platform: string): boolean;
3
- /** Android cannot paint the WebView fade mask: end its viewport at the hint's left edge.
4
- * Layout width and hint position still use the original measured WebView budget.
5
- */
6
- export declare const getHintViewport: (renderMode: string, platform: string, scrollMode: boolean, lockedWidth: number, availableWidth: number, hintSize: number, hintEdgeGap: number, atEnd?: boolean) => {
7
- layoutWidth: number;
8
- visibleWidth: number;
9
- width: string;
10
- };
11
- /** Consume a Lynx control tap before paging can remove its native hit target. */
12
- export declare function ScrollHintButton({ renderMode, platform, onPress, ...props }: {
13
- renderMode: 'lynx' | 'webview';
14
- platform?: string;
15
- onPress?: () => void;
16
- [key: string]: any;
17
- }): React.JSX.Element;
18
- /** Keep legacy/iOS geometry; Android Lynx paints a real image rather than CSS URL/borders. */
19
- export declare function ScrollHintArrow({ renderMode, platform, button, }: {
20
- renderMode: string;
21
- platform: string;
22
- button: boolean;
23
- }): React.JSX.Element;
@@ -1,83 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- const _excluded = ["renderMode", "platform", "onPress"];
4
- import React from 'react';
5
- import { Image, View } from '@ray-js/ray';
6
- import clsx from 'clsx';
7
- import { getPlayerOverlayHost } from '../renderer/overlay';
8
- import moreArrow from '../res/player-more-arrow.png';
9
- export function usesNativeHintImage(renderMode, platform) {
10
- return renderMode === 'lynx' && platform === 'android';
11
- }
12
-
13
- /** Android cannot paint the WebView fade mask: end its viewport at the hint's left edge.
14
- * Layout width and hint position still use the original measured WebView budget.
15
- */
16
- export const getHintViewport = function (renderMode, platform, scrollMode, lockedWidth, availableWidth, hintSize, hintEdgeGap) {
17
- let atEnd = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
18
- const layoutWidth = lockedWidth > 0 ? lockedWidth : availableWidth;
19
- const reservedHintWidth = usesNativeHintImage(renderMode, platform) && scrollMode && !atEnd ? hintSize + hintEdgeGap : 0;
20
- const visibleWidth = Math.max(0, layoutWidth - reservedHintWidth);
21
- return {
22
- layoutWidth,
23
- visibleWidth,
24
- width: lockedWidth > 0 ? `${visibleWidth}px` : reservedHintWidth ? `calc(100% - ${reservedHintWidth}px)` : '100%'
25
- };
26
- };
27
-
28
- /** Consume a Lynx control tap before paging can remove its native hit target. */
29
- export function ScrollHintButton(_ref) {
30
- let {
31
- renderMode,
32
- platform,
33
- onPress
34
- } = _ref,
35
- props = _objectWithoutProperties(_ref, _excluded);
36
- const nativeHitTarget = usesNativeHintImage(renderMode, platform || '');
37
- const HintHost = getPlayerOverlayHost(renderMode);
38
- return /*#__PURE__*/React.createElement(HintHost, _extends({}, props, nativeHitTarget ? {
39
- flatten: false,
40
- 'native-interaction-enabled': true
41
- } : {}, {
42
- onClick: onPress ? event => {
43
- var _event$origin, _event$origin$stopPro;
44
- if (renderMode === 'lynx') event === null || event === void 0 || (_event$origin = event.origin) === null || _event$origin === void 0 || (_event$origin$stopPro = _event$origin.stopPropagation) === null || _event$origin$stopPro === void 0 || _event$origin$stopPro.call(_event$origin);
45
- onPress();
46
- } : undefined
47
- }));
48
- }
49
-
50
- /** Keep legacy/iOS geometry; Android Lynx paints a real image rather than CSS URL/borders. */
51
- export function ScrollHintArrow(_ref2) {
52
- let {
53
- renderMode,
54
- platform,
55
- button
56
- } = _ref2;
57
- if (usesNativeHintImage(renderMode, platform)) {
58
- const size = button ? '14px' : '10px';
59
- return /*#__PURE__*/React.createElement(Image, {
60
- className: "ipc-player-bottom-left-scroll-hint-image",
61
- src: moreArrow,
62
- mode: "aspectFit",
63
- style: {
64
- width: size,
65
- height: size,
66
- flexShrink: 0,
67
- pointerEvents: 'none'
68
- }
69
- });
70
- }
71
- return /*#__PURE__*/React.createElement(View, {
72
- className: clsx('ipc-player-bottom-left-scroll-hint-arrow', {
73
- 'ipc-player-bottom-left-scroll-hint-arrow--right': true,
74
- 'ipc-player-bottom-left-scroll-hint-arrow--light': button,
75
- 'ipc-player-bottom-left-scroll-hint-arrow--static': button
76
- }),
77
- style: button ? {
78
- width: '9px',
79
- height: '9px',
80
- transform: 'translate(-1px, 0) rotate(45deg)'
81
- } : undefined
82
- });
83
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import './statusIcon.less';
3
- /** Android needs a real image; geometry is normalized from the stylesheet. */
4
- export declare function BatteryStatusIcon({ kind }: {
5
- kind: 'charging' | 'solar';
6
- }): React.JSX.Element;
@@ -1,36 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { Image, View, getSystemInfoSync } from '@ray-js/ray';
3
- import { usePlayerRenderMode } from '../../renderer/context';
4
- import chargingImage from '../../res/player-charging.png';
5
- import solarImage from '../../res/player-solar.png';
6
- import './statusIcon.less';
7
-
8
- /** Android needs a real image; geometry is normalized from the stylesheet. */
9
- export function BatteryStatusIcon(_ref) {
10
- let {
11
- kind
12
- } = _ref;
13
- const renderMode = usePlayerRenderMode();
14
- const platform = useMemo(() => {
15
- var _getSystemInfoSync;
16
- return renderMode === 'lynx' ? (_getSystemInfoSync = getSystemInfoSync()) === null || _getSystemInfoSync === void 0 ? void 0 : _getSystemInfoSync.platform : '';
17
- }, [renderMode]);
18
- const className = `icon-panel icon-panel-${kind} ipc-player-plugin-battery-${kind}`;
19
- if (renderMode !== 'lynx' || platform !== 'android') return /*#__PURE__*/React.createElement(View, {
20
- className: className
21
- });
22
- if (kind === 'solar') {
23
- return /*#__PURE__*/React.createElement(Image, {
24
- className: `${className} ipc-player-plugin-battery-solar-image`,
25
- src: solarImage,
26
- mode: "aspectFit"
27
- });
28
- }
29
- return /*#__PURE__*/React.createElement(View, {
30
- className: `${className} ipc-player-plugin-battery-charging-image-wrap`
31
- }, /*#__PURE__*/React.createElement(Image, {
32
- className: "ipc-player-plugin-battery-charging-image",
33
- src: chargingImage,
34
- mode: "scaleToFill"
35
- }));
36
- }
@@ -1,24 +0,0 @@
1
- .ipc-player-plugin-battery-charging-image-wrap {
2
- position: relative;
3
- width: calc(16px * var(--ipc-player-size-scale, 1));
4
- height: calc(16px * var(--ipc-player-size-scale, 1));
5
- flex-shrink: 0;
6
- overflow: hidden;
7
- background-image: none;
8
- }
9
-
10
- .ipc-player-plugin-battery-charging-image {
11
- position: absolute;
12
- left: calc(-1px * var(--ipc-player-size-scale, 1));
13
- top: 0;
14
- width: calc(18px * var(--ipc-player-size-scale, 1));
15
- height: calc(19px * var(--ipc-player-size-scale, 1));
16
- pointer-events: none;
17
- }
18
-
19
- .ipc-player-plugin-battery-solar-image {
20
- width: calc(8px * var(--ipc-player-size-scale, 1));
21
- height: calc(8px * var(--ipc-player-size-scale, 1));
22
- background-image: none;
23
- pointer-events: none;
24
- }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { ComponentConfigProps } from '../../interface';
3
- type Props = Pick<ComponentConfigProps, 'screenType' | 'brandColor' | 'devId' | 'deleteContent'> & {
4
- kind: 'screenshot' | 'record';
5
- imageUrl: string;
6
- captureId: number;
7
- count?: number;
8
- };
9
- declare const CaptureToast: ({ kind, imageUrl, captureId, count, screenType, brandColor, devId, deleteContent, }: Props) => React.JSX.Element;
10
- export default CaptureToast;
@@ -1,58 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import { useMemoizedFn } from 'ahooks';
3
- import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
4
- import { useStore } from '../../ctx/store';
5
- import { usePlayerOverlayHost } from '../../renderer/overlay';
6
- import { CaptureResultToast } from '../captureResult/captureResult';
7
- // This overlay belongs to the player, independently of the remounting toolbar.
8
- const CaptureToast = _ref => {
9
- let {
10
- kind,
11
- imageUrl,
12
- captureId,
13
- count,
14
- screenType,
15
- brandColor,
16
- devId,
17
- deleteContent
18
- } = _ref;
19
- const {
20
- screenType: screen,
21
- brandColor: color
22
- } = useStore({
23
- screenType,
24
- brandColor
25
- });
26
- const OverlayView = usePlayerOverlayHost();
27
- const isRecord = kind === 'record';
28
- const id = isRecord ? 'record_video_SUCCESS_toast_id' : 'plugin-screenshot-toast';
29
- const prefix = isRecord ? 'ipc-player-plugin-record-success' : 'ipc-player-plugin-screenshot';
30
- const close = useMemoizedFn(() => deleteContent('absolute', id));
31
- useEffect(() => {
32
- const timer = setTimeout(close, 5000);
33
- return () => clearTimeout(timer);
34
- }, [captureId, close]);
35
- const vertical = screen === 'vertical';
36
- return /*#__PURE__*/React.createElement(OverlayView, {
37
- className: `${prefix}-toast-wrap`,
38
- style: {
39
- position: 'absolute',
40
- top: vertical ? '12px' : '60px',
41
- left: vertical ? '16px' : '50%',
42
- right: vertical ? '16px' : 'auto',
43
- display: 'flex',
44
- width: vertical ? 'auto' : '400px',
45
- marginLeft: vertical ? '0' : '-200px'
46
- }
47
- }, /*#__PURE__*/React.createElement(CaptureResultToast, {
48
- kind: kind,
49
- count: count,
50
- brandColor: color,
51
- thumbnailPath: imageUrl,
52
- onCheck: () => {
53
- close();
54
- goToIpcPageNativeRoute('ipc_album_panel', devId);
55
- }
56
- }));
57
- };
58
- export default CaptureToast;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const RecordVideoTimer: () => React.JSX.Element;
3
- export default RecordVideoTimer;
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { View } from '@ray-js/ray';
3
-
4
- // Keep the timer state in this component, without a separate custom-hook binding.
5
- const RecordVideoTimer = () => {
6
- const [elapsedSeconds, setElapsedSeconds] = React.useState(0);
7
- React.useEffect(() => {
8
- const startedAt = Date.now();
9
- const interval = setInterval(() => {
10
- setElapsedSeconds(Math.max(0, Math.floor((Date.now() - startedAt) / 1000)));
11
- }, 1000);
12
- return () => clearInterval(interval);
13
- }, []);
14
- const minutes = String(Math.floor(elapsedSeconds / 60)).padStart(2, '0');
15
- const seconds = String(elapsedSeconds % 60).padStart(2, '0');
16
- return /*#__PURE__*/React.createElement(View, {
17
- className: "ipc-player-plugin-record-video-toast-time"
18
- }, /*#__PURE__*/React.createElement(View, {
19
- className: "ipc-player-plugin-record-video-toast-time-warp"
20
- }, minutes), /*#__PURE__*/React.createElement(View, {
21
- className: "ipc-player-plugin-record-video-toast-time-delimiter"
22
- }, ":"), /*#__PURE__*/React.createElement(View, {
23
- className: "ipc-player-plugin-record-video-toast-time-warp"
24
- }, seconds));
25
- };
26
- export default RecordVideoTimer;
@@ -1,137 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react-hooks/dom';
2
- import { atom } from 'jotai';
3
- import { authorize, authorizeStatus, getFileSystemManager, getSystemInfoSync, showModal } from '@ray-js/ray';
4
- import { getDeviceInfo } from '../../utils/device';
5
- import { Screenshot } from './screenshot';
6
- jest.mock('@ray-js/ray', () => ({
7
- View: 'div',
8
- Text: 'span',
9
- Image: 'img',
10
- getSystemInfoSync: jest.fn(),
11
- getFileSystemManager: jest.fn(),
12
- authorize: jest.fn(),
13
- authorizeStatus: jest.fn(),
14
- showModal: jest.fn(),
15
- openAppSystemSettingPage: jest.fn()
16
- }));
17
- jest.mock('@ray-js/ray-ipc-utils', () => ({
18
- goToIpcPageNativeRoute: jest.fn()
19
- }));
20
- jest.mock('../../utils/device', () => ({
21
- getDeviceInfo: jest.fn()
22
- }));
23
- jest.mock('../../i18n', () => ({
24
- __esModule: true,
25
- default: {
26
- getLang: key => key
27
- }
28
- }));
29
- jest.mock('./screenshot.less', () => ({}));
30
- jest.mock('../captureResult/captureResult.less', () => ({}));
31
- beforeEach(() => {
32
- jest.clearAllMocks();
33
- getSystemInfoSync.mockReturnValue({
34
- platform: 'android',
35
- system: 'android 12'
36
- });
37
- authorizeStatus.mockImplementation(_ref => {
38
- let {
39
- fail
40
- } = _ref;
41
- return fail({
42
- errorCode: 9004
43
- });
44
- });
45
- authorize.mockImplementation(_ref2 => {
46
- let {
47
- fail
48
- } = _ref2;
49
- return fail({
50
- errorCode: 9004
51
- });
52
- });
53
- getFileSystemManager.mockReturnValue({
54
- access: jest.fn(_ref3 => {
55
- let {
56
- success
57
- } = _ref3;
58
- return success();
59
- })
60
- });
61
- getDeviceInfo.mockResolvedValue({
62
- configMetas: {
63
- tyabimr4v3: {
64
- split_info: [{
65
- index: 1
66
- }, {
67
- index: 2
68
- }, {
69
- index: 3
70
- }]
71
- }
72
- }
73
- });
74
- });
75
- const createProps = () => ({
76
- IPCPlayerContext: {
77
- snapshot: jest.fn(_ref4 => {
78
- let {
79
- success
80
- } = _ref4;
81
- return success({
82
- tempImagePath: 'thingfile://capture.jpg'
83
- });
84
- })
85
- },
86
- addContent: jest.fn(),
87
- deleteContent: jest.fn(),
88
- saveToAlbum: 0,
89
- devId: 'camera-1',
90
- toast: jest.fn(),
91
- screenType: atom('vertical'),
92
- brandColor: atom('#000000'),
93
- multiLens: true,
94
- event: {
95
- emit: jest.fn()
96
- }
97
- });
98
- it('keeps multi-lens results when legacy album authorization is unavailable', async () => {
99
- const props = createProps();
100
- const {
101
- result,
102
- unmount
103
- } = renderHook(() => Screenshot(props));
104
- await act(async () => {
105
- await result.current.props.onClick();
106
- });
107
- expect(authorizeStatus).not.toHaveBeenCalled();
108
- expect(props.IPCPlayerContext.snapshot).toHaveBeenCalledWith(expect.objectContaining({
109
- saveToAlbum: 0
110
- }));
111
- const [, config] = props.addContent.mock.calls[0];
112
- const overlay = renderHook(() => config.content(config.initProps));
113
- expect(overlay.result.current.props.children.props).toEqual(expect.objectContaining({
114
- count: 3,
115
- thumbnailPath: 'thingfile://capture_lens1.jpg'
116
- }));
117
- overlay.unmount();
118
- unmount();
119
- });
120
- it('keeps the permission rejection path before taking a snapshot', async () => {
121
- getSystemInfoSync.mockReturnValue({
122
- platform: 'ios',
123
- system: 'iOS 18'
124
- });
125
- const props = createProps();
126
- const {
127
- result,
128
- unmount
129
- } = renderHook(() => Screenshot(props));
130
- await act(async () => {
131
- await result.current.props.onClick();
132
- });
133
- expect(props.IPCPlayerContext.snapshot).not.toHaveBeenCalled();
134
- expect(props.addContent).not.toHaveBeenCalled();
135
- expect(showModal).toHaveBeenCalledTimes(1);
136
- unmount();
137
- });
@@ -1,135 +0,0 @@
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
- });
@@ -1,6 +0,0 @@
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
- };
@@ -1,30 +0,0 @@
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
- }