@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.
- package/README.md +6 -0
- package/lib/ctx/ctx.composition.js +4 -19
- package/lib/ctx/ctx.js +55 -100
- package/lib/ctx/ports.output.d.ts +0 -1
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +1 -3
- package/lib/i18n/index.d.ts +0 -12
- package/lib/i18n/strings.d.ts +0 -6
- package/lib/i18n/strings.js +0 -6
- package/lib/index.d.ts +4 -0
- package/lib/index.js +3 -1
- package/lib/interface.d.ts +3 -18
- package/lib/renderer/capabilities.d.ts +8 -0
- package/lib/renderer/capabilities.js +19 -0
- package/lib/renderer/context.d.ts +5 -0
- package/lib/renderer/context.js +6 -0
- package/lib/renderer/directionControl.d.ts +6 -0
- package/lib/renderer/directionControl.js +3 -0
- package/lib/renderer/font.less +5 -0
- package/lib/renderer/glyphs.d.ts +1 -0
- package/lib/renderer/glyphs.js +256 -0
- package/lib/renderer/index.module.less +48 -0
- package/lib/renderer/ptzZoom.d.ts +6 -0
- package/lib/renderer/ptzZoom.js +3 -0
- package/lib/renderer/text.d.ts +4 -0
- package/lib/renderer/text.js +32 -0
- package/lib/renderer/text.module.less +4 -0
- package/lib/renderer/viewport.d.ts +7 -0
- package/lib/renderer/viewport.js +24 -0
- package/lib/res/lynx-signal/index.d.ts +1 -0
- package/lib/res/lynx-signal/index.js +22 -0
- 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
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/ui/bottomLeftContent.js +118 -52
- package/lib/ui/bottomRightContent.js +6 -3
- package/lib/ui/scrollHintArrow.d.ts +23 -0
- package/lib/ui/scrollHintArrow.js +82 -0
- package/lib/ui/ui.d.ts +5 -2
- package/lib/ui/ui.js +63 -49
- package/lib/utils/ttt.js +8 -2
- package/lib/widgets/battery/battery.js +2 -1
- package/lib/widgets/battery/batteryFull.js +2 -1
- package/lib/widgets/floodlight/floodlight.js +2 -1
- package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
- package/lib/widgets/fullScreen/fullScreen.js +2 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +2 -1
- package/lib/widgets/index.d.ts +0 -1
- package/lib/widgets/index.js +1 -2
- package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +12 -3
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
- package/lib/widgets/multiCamera/landscapeTip.js +2 -1
- package/lib/widgets/multiCamera/moveablePtzControl.js +1 -1
- package/lib/widgets/multiCamera/multiPtz.js +2 -1
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
- package/lib/widgets/multiCamera/switchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileMultiPtz.js +2 -1
- package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileTip.js +2 -1
- package/lib/widgets/muted/muted.js +5 -10
- package/lib/widgets/muted/muted.less +1 -5
- package/lib/widgets/ptz/ptz.js +2 -1
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +6 -3
- package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
- package/lib/widgets/recordVideo/recordVideo.js +53 -53
- package/lib/widgets/recordVideo/recordVideo.less +74 -17
- package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
- package/lib/widgets/resolution/fullResolutionControl.js +29 -19
- package/lib/widgets/resolution/resolution.js +3 -2
- package/lib/widgets/screenshot/screenshot.js +45 -66
- package/lib/widgets/screenshot/screenshot.less +40 -1
- package/lib/widgets/signal4G/signal4G.js +4 -1
- package/lib/widgets/siren/siren.js +2 -1
- package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
- package/lib/widgets/trialBadge/index.js +8 -3
- package/lib/widgets/trialBadge/index.less +24 -0
- package/lib/widgets/tryExperience/tryExperience.js +3 -1
- package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
- package/lib/widgets/voiceIntercom/voiceIntercom.js +50 -24
- package/lib/widgets/voiceIntercom/voiceIntercom.less +16 -0
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
- package/lib/widgets/zoomTurntable/turntable/index.js +2 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +2 -1
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +2 -1
- package/package.json +15 -8
- package/lib/ctx/ctx.album.test.d.ts +0 -1
- package/lib/ctx/ctx.album.test.js +0 -197
- package/lib/ui/absoluteContent.d.ts +0 -2
- package/lib/ui/absoluteContent.js +0 -3
- package/lib/utils/captureResult.d.ts +0 -14
- package/lib/utils/captureResult.js +0 -70
- package/lib/utils/captureResult.test.d.ts +0 -1
- package/lib/utils/captureResult.test.js +0 -117
- package/lib/widgets/captureResult/captureResult.d.ts +0 -16
- package/lib/widgets/captureResult/captureResult.js +0 -85
- package/lib/widgets/captureResult/captureResult.less +0 -144
- package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
- package/lib/widgets/captureResult/captureResult.test.js +0 -80
- package/lib/widgets/captureResult/index.d.ts +0 -2
- package/lib/widgets/captureResult/index.js +0 -2
- package/lib/widgets/muted/muted.test.d.ts +0 -1
- package/lib/widgets/muted/muted.test.js +0 -81
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +0 -1
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +0 -106
- package/lib/widgets/screenshot/screenshot.test.d.ts +0 -1
- package/lib/widgets/screenshot/screenshot.test.js +0 -120
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
-
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
|
-
import "core-js/modules/esnext.iterator.map.js";
|
|
4
|
-
import React, { useState } from 'react';
|
|
5
|
-
import ReactDOM from 'react-dom';
|
|
6
|
-
import { act, Simulate } from 'react-dom/test-utils';
|
|
7
|
-
import { atom, getDefaultStore } from 'jotai';
|
|
8
|
-
import { PlayState } from '../../interface';
|
|
9
|
-
import { RecordVideo } from './recordVideo';
|
|
10
|
-
jest.mock('@ray-js/ray', () => ({
|
|
11
|
-
View: 'div',
|
|
12
|
-
Text: 'span',
|
|
13
|
-
Image: 'img',
|
|
14
|
-
getSystemInfoSync: () => ({
|
|
15
|
-
platform: 'android'
|
|
16
|
-
})
|
|
17
|
-
}));
|
|
18
|
-
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
19
|
-
goToIpcPageNativeRoute: jest.fn()
|
|
20
|
-
}));
|
|
21
|
-
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({}));
|
|
22
|
-
jest.mock('../../utils/device', () => ({
|
|
23
|
-
getDeviceInfo: jest.fn()
|
|
24
|
-
}));
|
|
25
|
-
jest.mock('../../i18n', () => ({
|
|
26
|
-
__esModule: true,
|
|
27
|
-
default: {
|
|
28
|
-
getLang: key => key
|
|
29
|
-
}
|
|
30
|
-
}));
|
|
31
|
-
jest.mock('./recordVideo.less', () => ({}));
|
|
32
|
-
jest.mock('../captureResult/captureResult.less', () => ({}));
|
|
33
|
-
describe('RecordVideo', () => {
|
|
34
|
-
let container;
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
jest.useFakeTimers('modern');
|
|
37
|
-
container = document.createElement('div');
|
|
38
|
-
document.body.appendChild(container);
|
|
39
|
-
});
|
|
40
|
-
afterEach(() => {
|
|
41
|
-
act(() => ReactDOM.unmountComponentAtNode(container));
|
|
42
|
-
container.remove();
|
|
43
|
-
jest.clearAllTimers();
|
|
44
|
-
jest.useRealTimers();
|
|
45
|
-
});
|
|
46
|
-
it.each([false, true])('removes the recording timer after stop (remounted: %s)', async remount => {
|
|
47
|
-
var _container$querySelec, _container$querySelec2;
|
|
48
|
-
const store = getDefaultStore();
|
|
49
|
-
const recording = atom(false);
|
|
50
|
-
const recordingDisabled = atom(false);
|
|
51
|
-
const screenType = atom('vertical');
|
|
52
|
-
const setRecording = jest.fn(async value => {
|
|
53
|
-
store.set(recording, value);
|
|
54
|
-
return value ? true : {
|
|
55
|
-
tempImagePath: 'thingfile://record.jpg'
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
function Harness(_ref) {
|
|
59
|
-
let {
|
|
60
|
-
widgetKey
|
|
61
|
-
} = _ref;
|
|
62
|
-
const [contents, setContents] = useState([]);
|
|
63
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(RecordVideo, {
|
|
64
|
-
key: widgetKey,
|
|
65
|
-
devId: 'device',
|
|
66
|
-
recording,
|
|
67
|
-
recordingDisabled,
|
|
68
|
-
screenType,
|
|
69
|
-
brandColor: atom('#ff592a'),
|
|
70
|
-
playState: atom(PlayState.PLAYING),
|
|
71
|
-
setRecording,
|
|
72
|
-
setRecordingDisabled: value => store.set(recordingDisabled, value),
|
|
73
|
-
addContent: (_type, content) => setContents(items => [...items, content]),
|
|
74
|
-
deleteContent: (_type, id) => setContents(items => items.filter(item => item.id !== id))
|
|
75
|
-
}), contents.map(item => /*#__PURE__*/React.createElement(item.content, {
|
|
76
|
-
key: item.id
|
|
77
|
-
})));
|
|
78
|
-
}
|
|
79
|
-
const clickRecord = async () => {
|
|
80
|
-
await act(async () => {
|
|
81
|
-
Simulate.click(container.querySelector('.ipc-player-plugin-record-video-icon').parentElement);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
await act(async () => {
|
|
85
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, {
|
|
86
|
-
widgetKey: 0
|
|
87
|
-
}), container);
|
|
88
|
-
});
|
|
89
|
-
await clickRecord();
|
|
90
|
-
act(() => jest.advanceTimersByTime(3000));
|
|
91
|
-
expect((_container$querySelec = container.querySelector('.ipc-player-plugin-record-video-toast-time')) === null || _container$querySelec === void 0 ? void 0 : _container$querySelec.textContent).toBe('00:03');
|
|
92
|
-
if (remount) {
|
|
93
|
-
await act(async () => {
|
|
94
|
-
store.set(screenType, 'full');
|
|
95
|
-
ReactDOM.render(/*#__PURE__*/React.createElement(Harness, {
|
|
96
|
-
widgetKey: 1
|
|
97
|
-
}), container);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
expect((_container$querySelec2 = container.querySelector('.ipc-player-plugin-record-video-toast-time')) === null || _container$querySelec2 === void 0 ? void 0 : _container$querySelec2.textContent).toBe('00:03');
|
|
101
|
-
await clickRecord();
|
|
102
|
-
expect(setRecording).toHaveBeenLastCalledWith(false);
|
|
103
|
-
expect(container.querySelector('.icon-panel-record-stop')).toBeNull();
|
|
104
|
-
expect(container.querySelector('.ipc-player-plugin-record-video-toast-time')).toBeNull();
|
|
105
|
-
});
|
|
106
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,120 +0,0 @@
|
|
|
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
|
-
});
|