@ray-js/ipc-player-integration 0.0.57-beta.0 → 0.0.58-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -6
- package/lib/ctx/ctx.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +19 -4
- package/lib/ctx/ctx.js +106 -55
- package/lib/ctx/ports.output.d.ts +1 -0
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +9 -1
- package/lib/ctx/useAutoClarityConfig.d.ts +8 -0
- package/lib/ctx/useAutoClarityConfig.js +40 -0
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +16 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +17 -60
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +45 -60
- package/lib/utils/captureResult.d.ts +14 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +117 -0
- package/lib/utils/productAbility.d.ts +6 -0
- package/lib/utils/productAbility.js +20 -0
- package/lib/utils/ttt.js +2 -8
- package/lib/widgets/battery/battery.js +1 -2
- package/lib/widgets/battery/batteryFull.js +1 -2
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +80 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +1 -2
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +1 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
- package/lib/widgets/multiCamera/multiPtz.js +1 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +1 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- package/lib/widgets/muted/muted.js +10 -5
- package/lib/widgets/muted/muted.less +5 -1
- package/lib/widgets/muted/muted.test.d.ts +1 -0
- package/lib/widgets/muted/muted.test.js +81 -0
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +66 -45
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +120 -0
- package/lib/widgets/signal4G/signal4G.js +1 -4
- package/lib/widgets/siren/siren.js +1 -2
- package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
- package/lib/widgets/trialBadge/index.js +3 -8
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/tryExperience/tryExperience.js +1 -3
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
- package/lib/widgets/zoomTurntable/turntable/index.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +1 -2
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +1 -2
- package/package.json +8 -15
- package/lib/renderer/capabilities.d.ts +0 -8
- package/lib/renderer/capabilities.js +0 -19
- package/lib/renderer/context.d.ts +0 -5
- package/lib/renderer/context.js +0 -6
- package/lib/renderer/directionControl.d.ts +0 -6
- package/lib/renderer/directionControl.js +0 -3
- package/lib/renderer/font.less +0 -5
- package/lib/renderer/glyphs.d.ts +0 -1
- package/lib/renderer/glyphs.js +0 -256
- package/lib/renderer/index.module.less +0 -48
- package/lib/renderer/ptzZoom.d.ts +0 -6
- package/lib/renderer/ptzZoom.js +0 -3
- package/lib/renderer/text.d.ts +0 -4
- package/lib/renderer/text.js +0 -32
- package/lib/renderer/text.module.less +0 -4
- package/lib/renderer/viewport.d.ts +0 -7
- package/lib/renderer/viewport.js +0 -24
- package/lib/res/lynx-signal/index.d.ts +0 -1
- package/lib/res/lynx-signal/index.js +0 -22
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-hooks/dom';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { authorize, authorizeStatus, 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
|
+
authorize: jest.fn(),
|
|
12
|
+
authorizeStatus: jest.fn(),
|
|
13
|
+
showModal: jest.fn(),
|
|
14
|
+
openAppSystemSettingPage: jest.fn()
|
|
15
|
+
}));
|
|
16
|
+
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
17
|
+
goToIpcPageNativeRoute: jest.fn()
|
|
18
|
+
}));
|
|
19
|
+
jest.mock('../../utils/device', () => ({
|
|
20
|
+
getDeviceInfo: jest.fn()
|
|
21
|
+
}));
|
|
22
|
+
jest.mock('../../i18n', () => ({
|
|
23
|
+
__esModule: true,
|
|
24
|
+
default: {
|
|
25
|
+
getLang: key => key
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
jest.mock('./screenshot.less', () => ({}));
|
|
29
|
+
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
jest.clearAllMocks();
|
|
32
|
+
getSystemInfoSync.mockReturnValue({
|
|
33
|
+
platform: 'android',
|
|
34
|
+
system: 'android 12'
|
|
35
|
+
});
|
|
36
|
+
authorizeStatus.mockImplementation(_ref => {
|
|
37
|
+
let {
|
|
38
|
+
fail
|
|
39
|
+
} = _ref;
|
|
40
|
+
return fail({
|
|
41
|
+
errorCode: 9004
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
authorize.mockImplementation(_ref2 => {
|
|
45
|
+
let {
|
|
46
|
+
fail
|
|
47
|
+
} = _ref2;
|
|
48
|
+
return fail({
|
|
49
|
+
errorCode: 9004
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
getDeviceInfo.mockResolvedValue({
|
|
53
|
+
configMetas: {
|
|
54
|
+
tyabimr4v3: {
|
|
55
|
+
total_split_num: 3
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
const createProps = () => ({
|
|
61
|
+
IPCPlayerContext: {
|
|
62
|
+
snapshot: jest.fn(_ref3 => {
|
|
63
|
+
let {
|
|
64
|
+
success
|
|
65
|
+
} = _ref3;
|
|
66
|
+
return success({
|
|
67
|
+
tempImagePath: 'thingfile://capture.jpg'
|
|
68
|
+
});
|
|
69
|
+
})
|
|
70
|
+
},
|
|
71
|
+
addContent: jest.fn(),
|
|
72
|
+
deleteContent: jest.fn(),
|
|
73
|
+
saveToAlbum: 0,
|
|
74
|
+
devId: 'camera-1',
|
|
75
|
+
toast: jest.fn(),
|
|
76
|
+
screenType: atom('vertical'),
|
|
77
|
+
brandColor: atom('#000000'),
|
|
78
|
+
multiLens: true,
|
|
79
|
+
event: {
|
|
80
|
+
emit: jest.fn()
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
it('keeps multi-lens results when legacy album authorization is unavailable', async () => {
|
|
84
|
+
const props = createProps();
|
|
85
|
+
const {
|
|
86
|
+
result,
|
|
87
|
+
unmount
|
|
88
|
+
} = renderHook(() => Screenshot(props));
|
|
89
|
+
await act(async () => {
|
|
90
|
+
await result.current.props.onClick();
|
|
91
|
+
});
|
|
92
|
+
expect(authorizeStatus).not.toHaveBeenCalled();
|
|
93
|
+
expect(props.IPCPlayerContext.snapshot).toHaveBeenCalledWith(expect.objectContaining({
|
|
94
|
+
saveToAlbum: 0
|
|
95
|
+
}));
|
|
96
|
+
const [, config] = props.addContent.mock.calls[0];
|
|
97
|
+
expect(config.content().props).toEqual(expect.objectContaining({
|
|
98
|
+
count: 3,
|
|
99
|
+
thumbnailPath: 'thingfile://capture_lens1.jpg'
|
|
100
|
+
}));
|
|
101
|
+
unmount();
|
|
102
|
+
});
|
|
103
|
+
it('keeps the permission rejection path before taking a snapshot', async () => {
|
|
104
|
+
getSystemInfoSync.mockReturnValue({
|
|
105
|
+
platform: 'ios',
|
|
106
|
+
system: 'iOS 18'
|
|
107
|
+
});
|
|
108
|
+
const props = createProps();
|
|
109
|
+
const {
|
|
110
|
+
result,
|
|
111
|
+
unmount
|
|
112
|
+
} = renderHook(() => Screenshot(props));
|
|
113
|
+
await act(async () => {
|
|
114
|
+
await result.current.props.onClick();
|
|
115
|
+
});
|
|
116
|
+
expect(props.IPCPlayerContext.snapshot).not.toHaveBeenCalled();
|
|
117
|
+
expect(props.addContent).not.toHaveBeenCalled();
|
|
118
|
+
expect(showModal).toHaveBeenCalledTimes(1);
|
|
119
|
+
unmount();
|
|
120
|
+
});
|
|
@@ -3,15 +3,12 @@ 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';
|
|
8
6
|
import './signal4G.less';
|
|
9
7
|
export const Signal4G = props => {
|
|
10
8
|
const {
|
|
11
9
|
className,
|
|
12
10
|
devId
|
|
13
11
|
} = props;
|
|
14
|
-
const isLynx = usePlayerRenderMode() === 'lynx';
|
|
15
12
|
const {
|
|
16
13
|
dpValue,
|
|
17
14
|
signalKey
|
|
@@ -25,7 +22,7 @@ export const Signal4G = props => {
|
|
|
25
22
|
className: clsx('ipc-player-plugin-signal4g')
|
|
26
23
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
27
24
|
className: clsx('ipc-player-plugin-signal4g-icon'),
|
|
28
|
-
src:
|
|
25
|
+
src: signalSvgMap[signalKey],
|
|
29
26
|
mode: "aspectFit"
|
|
30
27
|
})));
|
|
31
28
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { View, Text } 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';
|
|
5
4
|
import { useDpState } from '../../hooks';
|
|
6
5
|
import { useStore } from '../../ctx/store';
|
|
7
6
|
import { UIEventContext } from '../../ui/context';
|
|
@@ -1,9 +1,8 @@
|
|
|
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 } from '@ray-js/ray';
|
|
4
|
+
import { View, Text } from '@ray-js/ray';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
7
6
|
import { useTemperature, useHumidity, useEc, useWaterTemperature, useDpSupport } from '../../hooks';
|
|
8
7
|
import { IPC_EC, IPC_WATER_TEMPERATURE, SENSOR_HUMIDITY, SENSOR_TEMPERATURE } from '../../utils/content/dpCode';
|
|
9
8
|
import './tempHumidity.less';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { View } from '@ray-js/ray';
|
|
1
|
+
import { Text, 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';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import './toggleVerticalFull.less';
|
|
7
6
|
export function ToggleVerticalFull(props) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { Image, View } from '@ray-js/ray';
|
|
2
|
+
import { Image, Text, 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';
|
|
6
4
|
import Strings from '../../i18n';
|
|
7
5
|
import tryOpen from '../../res/try/try_open.png';
|
|
8
6
|
import './index.less';
|
|
@@ -23,7 +21,6 @@ export const TrialBadge = _ref => {
|
|
|
23
21
|
onSubscribe,
|
|
24
22
|
onCountdownEnd
|
|
25
23
|
} = _ref;
|
|
26
|
-
const renderMode = usePlayerRenderMode();
|
|
27
24
|
const [remainingSec, setRemainingSec] = useState(Math.max(0, Math.floor(trialRemainingSec)));
|
|
28
25
|
const endedRef = useRef(false);
|
|
29
26
|
const onCountdownEndRef = useRef(onCountdownEnd);
|
|
@@ -63,16 +60,14 @@ export const TrialBadge = _ref => {
|
|
|
63
60
|
}, [trialRemainingSec]);
|
|
64
61
|
const countdownText = formatCountdown(remainingSec);
|
|
65
62
|
return /*#__PURE__*/React.createElement(View, {
|
|
66
|
-
className: clsx('ipc-player-trial-badge', className
|
|
67
|
-
'ipc-player-trial-badge--lynx': renderMode === 'lynx'
|
|
68
|
-
})
|
|
63
|
+
className: clsx('ipc-player-trial-badge', className)
|
|
69
64
|
}, /*#__PURE__*/React.createElement(Image, {
|
|
70
65
|
className: "ipc-player-trial-badge-icon",
|
|
71
66
|
src: tryOpen,
|
|
72
67
|
mode: "heightFix"
|
|
73
68
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
74
69
|
className: "ipc-player-trial-badge-status"
|
|
75
|
-
}, Strings.getLang('ipc_player_trial_in_use')
|
|
70
|
+
}, Strings.getLang('ipc_player_trial_in_use')), /*#__PURE__*/React.createElement(Text, {
|
|
76
71
|
className: "ipc-player-trial-badge-divider"
|
|
77
72
|
}, "|"), /*#__PURE__*/React.createElement(Text, {
|
|
78
73
|
className: "ipc-player-trial-badge-preview"
|
|
@@ -66,27 +66,3 @@
|
|
|
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,8 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import { View, Image, getSystemInfoSync, showToast } from '@ray-js/ray';
|
|
2
|
+
import { View, Image, getSystemInfoSync, showToast, Text } 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';
|
|
6
5
|
import { useStore } from '../../ctx/store';
|
|
7
6
|
import Strings from '../../i18n';
|
|
8
7
|
import { getAIFrameFeature, gotoAIDrawMiniProgram, setAIFrameFeature } from '../../utils';
|
|
@@ -78,7 +77,6 @@ export const TryExperience = props => {
|
|
|
78
77
|
}
|
|
79
78
|
}, [buttonState]);
|
|
80
79
|
const onTryExperience = useCallback(async () => {
|
|
81
|
-
console.log('res===onTryExperience', lockRef.current, isLowPhone);
|
|
82
80
|
if (lockRef.current) return;
|
|
83
81
|
if (isLowPhone) {
|
|
84
82
|
showToast({
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { View, usePageEvent } from '@ray-js/ray';
|
|
2
|
+
import { View, Text, 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';
|
|
7
6
|
import { PlayState } from '../../interface';
|
|
8
7
|
import './videoBitKBP.less';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -1,11 +1,9 @@
|
|
|
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,
|
|
3
|
+
import { View, Image, 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';
|
|
9
7
|
import { PlayerStreamStatus, IntercomMode, PlayState } from '../../interface';
|
|
10
8
|
import { UIEventContext } from '../../ui/context';
|
|
11
9
|
import { radialGradient } from '../../utils';
|
|
@@ -39,7 +37,6 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
39
37
|
const {
|
|
40
38
|
event
|
|
41
39
|
} = useContext(UIEventContext);
|
|
42
|
-
const renderMode = usePlayerRenderMode();
|
|
43
40
|
const {
|
|
44
41
|
recording,
|
|
45
42
|
mute,
|
|
@@ -198,45 +195,23 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
198
195
|
}, intercomClassName),
|
|
199
196
|
onTouchStart: handTouchStart,
|
|
200
197
|
onTouchEnd: onTouchEnd
|
|
201
|
-
}, intercom ? (() => {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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
|
-
}));
|
|
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'
|
|
221
207
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
})() : (() => {
|
|
208
|
+
}, [0, 1, 2, 3, 4].map(index => /*#__PURE__*/React.createElement(View, {
|
|
209
|
+
key: index,
|
|
210
|
+
className: clsx('bar'),
|
|
211
|
+
style: {
|
|
212
|
+
background: talkingColor
|
|
213
|
+
}
|
|
214
|
+
})))))() : (() => {
|
|
240
215
|
if (icon) {
|
|
241
216
|
if (typeof icon === 'string') {
|
|
242
217
|
return /*#__PURE__*/React.createElement(View, {
|
|
@@ -250,14 +225,13 @@ export const VoiceIntercom = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
250
225
|
className: clsx('icon-image-default-container', iconClassName)
|
|
251
226
|
}, icon);
|
|
252
227
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
className: className
|
|
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)
|
|
261
235
|
});
|
|
262
236
|
})());
|
|
263
237
|
});
|
|
@@ -32,22 +32,6 @@
|
|
|
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
|
-
|
|
51
35
|
.ipc-player-plugin-voice-intercom-img {
|
|
52
36
|
width: calc(@size * var(--ipc-player-size-scale, 1));
|
|
53
37
|
height: calc(@size * var(--ipc-player-size-scale, 1));
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ZoomTurntableProps } from './type';
|
|
3
3
|
import './index.less';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* 焦距转盘渲染层。
|
|
6
|
+
* 内嵌自 ray-zoom-turntable,实际绘制与手势在 rjs(render 线程)内完成,
|
|
7
|
+
* 拖动不过桥,保证跟手。
|
|
8
|
+
*/
|
|
9
|
+
declare const ZoomTurntable: React.FC<ZoomTurntableProps>;
|
|
10
|
+
export default ZoomTurntable;
|
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
let canvasIdCounter = 0;
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -82,4 +81,4 @@ const ZoomTurntable = props => {
|
|
|
82
81
|
}
|
|
83
82
|
});
|
|
84
83
|
};
|
|
85
|
-
export default
|
|
84
|
+
export default ZoomTurntable;
|
|
@@ -2,10 +2,9 @@ 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, usePageEvent } from '@ray-js/ray';
|
|
5
|
+
import { View, Text, 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';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
10
9
|
import { UIEventContext } from '../../ui/context';
|
|
11
10
|
import { PlayState } from '../../interface';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import { CoverView, View } from '@ray-js/ray';
|
|
2
|
+
import { CoverView, Text, View } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { PlayerText as Text } from '../../renderer/text';
|
|
5
4
|
import { useStore } from '../../ctx/store';
|
|
6
5
|
import { PlayState } from '../../interface';
|
|
7
6
|
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.
|
|
3
|
+
"version": "0.0.58-beta.1",
|
|
4
4
|
"description": "IPC 融合播放器",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -29,18 +29,17 @@
|
|
|
29
29
|
"start:web": "ray start ./example -t web",
|
|
30
30
|
"prepublishOnly": "yarn build",
|
|
31
31
|
"release-it": "standard-version",
|
|
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"
|
|
32
|
+
"test": "yarn jest"
|
|
35
33
|
},
|
|
36
34
|
"peerDependencies": {
|
|
37
35
|
"ahooks": "^3.1.6"
|
|
38
36
|
},
|
|
39
37
|
"dependencies": {
|
|
40
|
-
"@ray-js/direction-control": "0.0.
|
|
41
|
-
"@ray-js/ipc-ptz-zoom": "0.0.
|
|
42
|
-
"@ray-js/
|
|
43
|
-
"@ray-js/ray-ipc-
|
|
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",
|
|
44
43
|
"@ray-js/svg": "0.2.0",
|
|
45
44
|
"clsx": "^1.2.1",
|
|
46
45
|
"color": "^5.0.2",
|
|
@@ -58,13 +57,7 @@
|
|
|
58
57
|
"eslint-config-tuya-panel": "^0.4.2",
|
|
59
58
|
"husky": "^1.2.0",
|
|
60
59
|
"lint-staged": "^10.2.11",
|
|
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"
|
|
60
|
+
"standard-version": "9.3.2"
|
|
68
61
|
},
|
|
69
62
|
"resolutions": {
|
|
70
63
|
"@ray-js/builder-mp": "^1.7.62"
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type LynxPlayerAdapters = Partial<Record<'zoomTurntable' | 'ptzZoom' | 'directionControl', React.ComponentType<any>>>;
|
|
3
|
-
export declare const LynxPlayerAdaptersContext: React.Context<Partial<Record<"zoomTurntable" | "ptzZoom" | "directionControl", React.ComponentType<any>>>>;
|
|
4
|
-
/** Never mount a WebView-only RJS renderer in the Lynx tree. */
|
|
5
|
-
export declare function withPlayerRenderer<P>(capability: keyof LynxPlayerAdapters, WebViewComponent: React.ComponentType<P>): {
|
|
6
|
-
(props: P): React.JSX.Element;
|
|
7
|
-
displayName: string;
|
|
8
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext } from 'react';
|
|
2
|
-
import { usePlayerRenderMode } from './context';
|
|
3
|
-
export const LynxPlayerAdaptersContext = /*#__PURE__*/createContext({});
|
|
4
|
-
|
|
5
|
-
/** Never mount a WebView-only RJS renderer in the Lynx tree. */
|
|
6
|
-
export function withPlayerRenderer(capability, WebViewComponent) {
|
|
7
|
-
const RendererComponent = props => {
|
|
8
|
-
const mode = usePlayerRenderMode();
|
|
9
|
-
const adapters = useContext(LynxPlayerAdaptersContext);
|
|
10
|
-
if (mode !== 'lynx') return /*#__PURE__*/React.createElement(WebViewComponent, props);
|
|
11
|
-
const Adapter = adapters[capability];
|
|
12
|
-
if (!Adapter) {
|
|
13
|
-
throw new Error(`IPC_LYNX_CAPABILITY_MISSING:${capability}. Supply a supported Native/WebView adapter before enabling this widget.`);
|
|
14
|
-
}
|
|
15
|
-
return /*#__PURE__*/React.createElement(Adapter, props);
|
|
16
|
-
};
|
|
17
|
-
RendererComponent.displayName = `PlayerRenderer(${String(capability)})`;
|
|
18
|
-
return RendererComponent;
|
|
19
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const PlayerControlVisibilityContext: import("react").Context<boolean | undefined>;
|
|
3
|
-
export type PlayerRenderMode = 'webview' | 'lynx';
|
|
4
|
-
export declare const PlayerRenderModeContext: import("react").Context<PlayerRenderMode>;
|
|
5
|
-
export declare const usePlayerRenderMode: () => PlayerRenderMode;
|
package/lib/renderer/context.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
|
|
3
|
-
// Scoped to the control bars, not absolute widgets or the standalone intercom.
|
|
4
|
-
export const PlayerControlVisibilityContext = /*#__PURE__*/createContext(undefined);
|
|
5
|
-
export const PlayerRenderModeContext = /*#__PURE__*/createContext('webview');
|
|
6
|
-
export const usePlayerRenderMode = () => useContext(PlayerRenderModeContext);
|