@ray-js/ipc-player-integration 0.0.58-beta.1 → 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 -106
- package/lib/ctx/ports.output.d.ts +0 -1
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +1 -9
- 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 -16
- 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 -0
- package/lib/ui/ui.js +60 -45
- 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/ctx/useAutoClarityConfig.d.ts +0 -8
- package/lib/ctx/useAutoClarityConfig.js +0 -40
- 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/utils/productAbility.d.ts +0 -6
- package/lib/utils/productAbility.js +0 -20
- 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
package/README.md
CHANGED
|
@@ -359,3 +359,9 @@ yarn build
|
|
|
359
359
|
```
|
|
360
360
|
|
|
361
361
|
Other available scripts: `start:wechat`, `start:web`, `start:native`, `build:tuya`, `build:wechat`, `build:web`, `build:native`.
|
|
362
|
+
|
|
363
|
+
## Lynx integration
|
|
364
|
+
|
|
365
|
+
This branch includes master `3fadcb8` (`0.0.55`) updates for automatic clarity, offline notifications and album permissions. Set `renderMode="lynx"` explicitly; the default remains `webview`.
|
|
366
|
+
|
|
367
|
+
Use **`@ray-js/ray-ipc-player: 2.1.6-beta.0`** exactly and **`@ray-js/ray-ipc-utils: ^1.1.18`** (currently locked to `1.1.18`). Pin **`@ray-js/direction-control: 0.0.13-beta.0`** and **`@ray-js/ipc-ptz-zoom: 0.0.5-beta.0`** as the published Lynx versions. PTZ, direction and turntable widgets require compatible `lynxAdapters`. See [Lynx integration notes](./README-LYNX.md) for adapter requirements, verification and remaining runtime limitations.
|
|
@@ -6,7 +6,6 @@ import { IntercomMode, MuteMode, ClarityType } from '@ray-js/ray-ipc-utils/lib/i
|
|
|
6
6
|
import { createUseCtx } from './ctx';
|
|
7
7
|
import { FullSmallIntercom, VerticalSmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, Signal4G, RecordVideo, FullScreen, VideoBitKBP, Muted, Floodlight, Siren, TryExperience, Resolution, Ptz, MultiPtz, TileTip, PtzMoveableTip, LandscapeTip, TileActions, MoveablePtzControl, SwitchLayout, ToggleVerticalFull, RealTimeMagnification, ZoomTurntableEntry } from '../widgets';
|
|
8
8
|
import { authorizeStatus } from '../utils/authorize';
|
|
9
|
-
import { PlayState } from '../interface';
|
|
10
9
|
import { landscapeTipId, moveablePtzControlId, multiPtzId, ptzMoveableTipId, tileActionsId, tileTipId } from '../ui/constant';
|
|
11
10
|
import { multiPrefix } from '../widgets/multiCamera/constants';
|
|
12
11
|
const createPlayContext = ty.createIpcPlayerContext;
|
|
@@ -88,29 +87,20 @@ export const defaultBottomRightContent = [{
|
|
|
88
87
|
content: FullScreen
|
|
89
88
|
}];
|
|
90
89
|
const absoluteContent = [];
|
|
91
|
-
const renderWhenPlaying = _ref => {
|
|
92
|
-
let {
|
|
93
|
-
playState
|
|
94
|
-
} = _ref;
|
|
95
|
-
return playState === PlayState.PLAYING;
|
|
96
|
-
};
|
|
97
90
|
export const multiCameraAbsoluteContent = [{
|
|
98
91
|
id: tileTipId,
|
|
99
92
|
content: TileTip,
|
|
100
93
|
absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
|
|
101
|
-
renderWhen: renderWhenPlaying,
|
|
102
94
|
hidden: true
|
|
103
95
|
}, {
|
|
104
96
|
id: ptzMoveableTipId,
|
|
105
97
|
content: PtzMoveableTip,
|
|
106
98
|
absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
|
|
107
|
-
renderWhen: renderWhenPlaying,
|
|
108
99
|
hidden: true
|
|
109
100
|
}, {
|
|
110
101
|
id: landscapeTipId,
|
|
111
102
|
content: LandscapeTip,
|
|
112
103
|
absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
|
|
113
|
-
renderWhen: renderWhenPlaying,
|
|
114
104
|
hidden: true
|
|
115
105
|
}, {
|
|
116
106
|
id: tileActionsId,
|
|
@@ -122,12 +112,12 @@ export const multiCameraAbsoluteContent = [{
|
|
|
122
112
|
absoluteNoCoverView: true,
|
|
123
113
|
hidden: true
|
|
124
114
|
}];
|
|
125
|
-
const toast =
|
|
115
|
+
const toast = _ref => {
|
|
126
116
|
let {
|
|
127
117
|
title,
|
|
128
118
|
duration
|
|
129
|
-
} =
|
|
130
|
-
config = _objectWithoutProperties(
|
|
119
|
+
} = _ref,
|
|
120
|
+
config = _objectWithoutProperties(_ref, _excluded);
|
|
131
121
|
ty.showToast(_objectSpread({
|
|
132
122
|
title,
|
|
133
123
|
duration,
|
|
@@ -139,7 +129,6 @@ const getMemoryState = devId => {
|
|
|
139
129
|
mute: true,
|
|
140
130
|
intercomMode: IntercomMode.TwoWay,
|
|
141
131
|
resolution: ClarityType.HD,
|
|
142
|
-
defaultResolution: ClarityType.HD,
|
|
143
132
|
resolutionList: [ClarityType.HD, ClarityType.SD],
|
|
144
133
|
isIntercomSupported: false,
|
|
145
134
|
maxZoomSettings: 6
|
|
@@ -151,16 +140,12 @@ const getMemoryState = devId => {
|
|
|
151
140
|
return resolve(defaultValue);
|
|
152
141
|
}
|
|
153
142
|
const muteValue = res.data.microphoneSettings.cachedMuteMode === MuteMode.OFF;
|
|
154
|
-
const {
|
|
155
|
-
availableResolutions
|
|
156
|
-
} = res.data.videoResolution;
|
|
157
143
|
return resolve({
|
|
158
144
|
mute: muteValue,
|
|
159
145
|
intercomMode: res.data.intercomInfo.cachedIntercomMode,
|
|
160
146
|
isIntercomSupported: res.data.intercomInfo.isIntercomSupported,
|
|
161
147
|
resolution: res.data.videoResolution.cachedResolution,
|
|
162
|
-
|
|
163
|
-
resolutionList: Array.isArray(availableResolutions) && availableResolutions.length > 0 ? availableResolutions : defaultValue.resolutionList,
|
|
148
|
+
resolutionList: res.data.videoResolution.availableResolutions,
|
|
164
149
|
maxZoomSettings: (_res$data$maxZoomSett = res.data.maxZoomSettings) !== null && _res$data$maxZoomSett !== void 0 ? _res$data$maxZoomSett : 6
|
|
165
150
|
});
|
|
166
151
|
}).catch(err => {
|
package/lib/ctx/ctx.js
CHANGED
|
@@ -3,19 +3,17 @@ import "core-js/modules/esnext.iterator.constructor.js";
|
|
|
3
3
|
import "core-js/modules/esnext.iterator.filter.js";
|
|
4
4
|
import "core-js/modules/esnext.iterator.find.js";
|
|
5
5
|
import "core-js/modules/esnext.iterator.map.js";
|
|
6
|
-
import { useRef, useCallback, useEffect
|
|
6
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
7
7
|
import { getSystemInfoSync, showModal, openAppSystemSettingPage } from '@ray-js/ray';
|
|
8
8
|
import Strings from '../i18n';
|
|
9
9
|
import { ensureAlbumPermission } from '../utils/authorize/album';
|
|
10
10
|
import { useAtom, updateAtom, getDefaultStore, useStore } from './store';
|
|
11
11
|
import { PlayState, IntercomMode } from '../interface';
|
|
12
12
|
import { changeIgnoreHideStopPreview } from '../ui/constant';
|
|
13
|
-
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
14
13
|
import { getEventInstance } from './event';
|
|
15
14
|
import { isMultiCameraTileSupported, useMultiCameraCtx } from './multiCameraCtx';
|
|
16
15
|
import { toNativeClarity, withAutoClarity } from './resolution';
|
|
17
16
|
import { useAutoClarity } from './useAutoClarity';
|
|
18
|
-
import { useAutoClarityConfig } from './useAutoClarityConfig';
|
|
19
17
|
const SAVE_TO_ALBUM = 1;
|
|
20
18
|
export const createUseCtx = _ref => {
|
|
21
19
|
let {
|
|
@@ -40,7 +38,6 @@ export const createUseCtx = _ref => {
|
|
|
40
38
|
initBottomRightContent,
|
|
41
39
|
initAbsoluteContent,
|
|
42
40
|
saveToAlbum = SAVE_TO_ALBUM,
|
|
43
|
-
multiLens = false,
|
|
44
41
|
showPtzControlTip = false,
|
|
45
42
|
videoSplitProtocol
|
|
46
43
|
} = _ref2;
|
|
@@ -60,7 +57,6 @@ export const createUseCtx = _ref => {
|
|
|
60
57
|
|
|
61
58
|
// 录像中
|
|
62
59
|
const [recording] = useAtom(false);
|
|
63
|
-
const recordingMultiLensRef = useRef(false);
|
|
64
60
|
|
|
65
61
|
// 录像是否不可点击
|
|
66
62
|
const [recordingDisabled, setRecordingDisabled] = useAtom(false);
|
|
@@ -78,13 +74,6 @@ export const createUseCtx = _ref => {
|
|
|
78
74
|
const [resolution] = useAtom('HD');
|
|
79
75
|
// resolution 清晰度列表
|
|
80
76
|
const [resolutionList, setResolutionList] = useAtom([]);
|
|
81
|
-
const [memoryState, setMemoryState] = useState(null);
|
|
82
|
-
const autoFallbackPendingRef = useRef(null);
|
|
83
|
-
const {
|
|
84
|
-
is4G,
|
|
85
|
-
enableAutoClarity,
|
|
86
|
-
ready: autoConfigReady
|
|
87
|
-
} = useAutoClarityConfig(devId);
|
|
88
77
|
// 自动模式下宿主上报的实际清晰度,供横竖屏码率区域共用
|
|
89
78
|
const [autoClarity] = useAtom(null);
|
|
90
79
|
|
|
@@ -135,74 +124,40 @@ export const createUseCtx = _ref => {
|
|
|
135
124
|
if (!eventRef.current) {
|
|
136
125
|
eventRef.current = getEventInstance();
|
|
137
126
|
}
|
|
138
|
-
const syncMemoryState = res => {
|
|
139
|
-
var _res$maxZoomSettings;
|
|
140
|
-
setMemoryState({
|
|
141
|
-
devId,
|
|
142
|
-
data: res
|
|
143
|
-
});
|
|
144
|
-
// 历史 Auto 等 4G 和面板云配置确定后再恢复,避免先显示 Auto 再回退。
|
|
145
|
-
if (res.resolution !== ClarityType.AUTO) {
|
|
146
|
-
restoreResolution(res.resolution, res.resolutionList, _setResolution);
|
|
147
|
-
}
|
|
148
|
-
_setMute(res.mute, true);
|
|
149
|
-
setIntercomMode(res.intercomMode);
|
|
150
|
-
setIntercomSupported(res.isIntercomSupported);
|
|
151
|
-
setMaxZoomSettings((_res$maxZoomSettings = res.maxZoomSettings) !== null && _res$maxZoomSettings !== void 0 ? _res$maxZoomSettings : 6);
|
|
152
|
-
};
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
autoFallbackPendingRef.current = null;
|
|
155
|
-
}, [devId]);
|
|
156
127
|
useEffect(() => {
|
|
157
128
|
// 初始化获取缓存值
|
|
158
|
-
|
|
129
|
+
|
|
159
130
|
(async () => {
|
|
160
131
|
if (!devId) return;
|
|
161
132
|
try {
|
|
133
|
+
var _res$maxZoomSettings;
|
|
162
134
|
const res = await getMemoryState(devId);
|
|
163
|
-
|
|
164
|
-
|
|
135
|
+
setResolutionList(withAutoClarity(res.resolutionList));
|
|
136
|
+
restoreResolution(res.resolution, res.resolutionList, _setResolution);
|
|
137
|
+
_setMute(res.mute, true);
|
|
138
|
+
setIntercomMode(res.intercomMode);
|
|
139
|
+
setIntercomSupported(res.isIntercomSupported);
|
|
140
|
+
setMaxZoomSettings((_res$maxZoomSettings = res.maxZoomSettings) !== null && _res$maxZoomSettings !== void 0 ? _res$maxZoomSettings : 6);
|
|
165
141
|
} catch (error) {
|
|
166
142
|
console.error('获取 getMemoryState 失败:', error);
|
|
167
143
|
}
|
|
168
144
|
})();
|
|
169
|
-
return () => {
|
|
170
|
-
active = false;
|
|
171
|
-
};
|
|
172
145
|
}, [devId]);
|
|
173
146
|
useEffect(() => {
|
|
174
|
-
let active = true;
|
|
175
147
|
if (devId && _playState === PlayState.PLAYING) {
|
|
176
148
|
// 获取缓存的值且同步
|
|
177
149
|
getMemoryState(devId).then(res => {
|
|
178
|
-
|
|
179
|
-
|
|
150
|
+
var _res$maxZoomSettings2;
|
|
151
|
+
setResolutionList(withAutoClarity(res.resolutionList));
|
|
152
|
+
// 传true表示值即可,会取播放器的值
|
|
153
|
+
restoreResolution(res.resolution, res.resolutionList, _setResolution);
|
|
154
|
+
_setMute(res.mute, true);
|
|
155
|
+
setIntercomMode(res.intercomMode);
|
|
156
|
+
setIntercomSupported(res.isIntercomSupported);
|
|
157
|
+
setMaxZoomSettings((_res$maxZoomSettings2 = res.maxZoomSettings) !== null && _res$maxZoomSettings2 !== void 0 ? _res$maxZoomSettings2 : 6);
|
|
180
158
|
});
|
|
181
159
|
}
|
|
182
|
-
return () => {
|
|
183
|
-
active = false;
|
|
184
|
-
};
|
|
185
160
|
}, [devId, _playState]);
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
// 普通档位或配置变化时,按 432 面板相同的条件决定是否追加 Auto。
|
|
188
|
-
const list = (memoryState === null || memoryState === void 0 ? void 0 : memoryState.devId) === devId ? memoryState.data.resolutionList : [];
|
|
189
|
-
if (!autoConfigReady) {
|
|
190
|
-
setResolutionList(list.filter(clarity => clarity !== ClarityType.AUTO));
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
setResolutionList(withAutoClarity(list, is4G, enableAutoClarity));
|
|
194
|
-
const autoDisabled = is4G && enableAutoClarity === false;
|
|
195
|
-
if ((memoryState === null || memoryState === void 0 ? void 0 : memoryState.devId) !== devId || memoryState.data.resolution !== ClarityType.AUTO) return;
|
|
196
|
-
if (autoDisabled && autoFallbackPendingRef.current !== devId) {
|
|
197
|
-
autoFallbackPendingRef.current = devId;
|
|
198
|
-
_setResolution(memoryState.data.defaultResolution).catch(error => {
|
|
199
|
-
autoFallbackPendingRef.current = null;
|
|
200
|
-
console.warn('恢复默认清晰度失败:', error);
|
|
201
|
-
});
|
|
202
|
-
} else if (!autoDisabled) {
|
|
203
|
-
restoreResolution(memoryState.data.resolution, list, _setResolution);
|
|
204
|
-
}
|
|
205
|
-
}, [devId, memoryState, currentResolution, is4G, enableAutoClarity, autoConfigReady]);
|
|
206
161
|
useEffect(() => {
|
|
207
162
|
refreshAfterPlayback(_playState, currentResolution);
|
|
208
163
|
}, [devId, _playState, currentResolution]);
|
|
@@ -319,30 +274,6 @@ export const createUseCtx = _ref => {
|
|
|
319
274
|
});
|
|
320
275
|
});
|
|
321
276
|
};
|
|
322
|
-
const stopRecording = showError => {
|
|
323
|
-
return new Promise((resolve, reject) => {
|
|
324
|
-
IPCPlayerInstance.current.stopRecord({
|
|
325
|
-
saveToAlbum,
|
|
326
|
-
success: res => {
|
|
327
|
-
recordingMultiLensRef.current = false;
|
|
328
|
-
updateAtom(recording, false);
|
|
329
|
-
resolve(res);
|
|
330
|
-
},
|
|
331
|
-
fail: err => {
|
|
332
|
-
recordingMultiLensRef.current = false;
|
|
333
|
-
updateAtom(recording, false);
|
|
334
|
-
reject(err);
|
|
335
|
-
if (showError) {
|
|
336
|
-
const errObj = err.innerError || err || {};
|
|
337
|
-
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_stop_recording_err');
|
|
338
|
-
toast({
|
|
339
|
-
title: errMsg
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
};
|
|
346
277
|
const multiCameraCtx = useMultiCameraCtx({
|
|
347
278
|
devId,
|
|
348
279
|
IPCPlayerInstance: IPCPlayerInstance.current,
|
|
@@ -353,7 +284,6 @@ export const createUseCtx = _ref => {
|
|
|
353
284
|
brandColor,
|
|
354
285
|
verticalMic,
|
|
355
286
|
saveToAlbum,
|
|
356
|
-
multiLens,
|
|
357
287
|
screenType,
|
|
358
288
|
isVerticalFullLayout,
|
|
359
289
|
setIsVerticalFullLayout,
|
|
@@ -399,7 +329,7 @@ export const createUseCtx = _ref => {
|
|
|
399
329
|
ty.authorizeStatus({
|
|
400
330
|
// 麦克风权限
|
|
401
331
|
scope: 'scope.record',
|
|
402
|
-
success:
|
|
332
|
+
success: () => {
|
|
403
333
|
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
404
334
|
IPCPlayerInstance.current.startTalk({
|
|
405
335
|
success: () => {
|
|
@@ -417,12 +347,12 @@ export const createUseCtx = _ref => {
|
|
|
417
347
|
}
|
|
418
348
|
});
|
|
419
349
|
},
|
|
420
|
-
fail:
|
|
350
|
+
fail: () => {
|
|
421
351
|
console.log('authorizeStatus失败回调');
|
|
422
352
|
ty.authorize({
|
|
423
353
|
// 麦克风权限
|
|
424
354
|
scope: 'scope.record',
|
|
425
|
-
success:
|
|
355
|
+
success: () => {
|
|
426
356
|
console.log('authorize成功回调');
|
|
427
357
|
IPCPlayerInstance.current.startTalk({
|
|
428
358
|
success: () => {
|
|
@@ -498,25 +428,44 @@ export const createUseCtx = _ref => {
|
|
|
498
428
|
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
499
429
|
return false;
|
|
500
430
|
}
|
|
501
|
-
if (
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
431
|
+
if (target) {
|
|
432
|
+
const granted = await ensureAlbumPermission();
|
|
433
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
434
|
+
if (!granted) return false;
|
|
435
|
+
}
|
|
505
436
|
return new Promise((resolve, reject) => {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
437
|
+
if (target) {
|
|
438
|
+
IPCPlayerInstance.current.startRecord({
|
|
439
|
+
saveToAlbum,
|
|
440
|
+
success: () => {
|
|
441
|
+
updateAtom(recording, true);
|
|
442
|
+
resolve(true);
|
|
443
|
+
},
|
|
444
|
+
fail: err => {
|
|
445
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
446
|
+
reject(err);
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
} else {
|
|
450
|
+
IPCPlayerInstance.current.stopRecord({
|
|
451
|
+
saveToAlbum,
|
|
452
|
+
success: res => {
|
|
453
|
+
updateAtom(recording, false);
|
|
454
|
+
resolve(res);
|
|
455
|
+
},
|
|
456
|
+
fail: err => {
|
|
457
|
+
updateAtom(recording, false);
|
|
458
|
+
reject(err);
|
|
459
|
+
const errObj = err.innerError || err || {};
|
|
460
|
+
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_stop_recording_err');
|
|
461
|
+
toast({
|
|
462
|
+
title: errMsg
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
517
467
|
});
|
|
518
468
|
},
|
|
519
|
-
stopRecordingOnUnload: () => stopRecording(false),
|
|
520
469
|
setRecordingDisabled,
|
|
521
470
|
setScreenType,
|
|
522
471
|
topLeftContent,
|
|
@@ -8,7 +8,6 @@ export type GetMemoryState = (devId: string) => Promise<{
|
|
|
8
8
|
intercomMode: IntercomMode;
|
|
9
9
|
isIntercomSupported: boolean;
|
|
10
10
|
resolution: ClarityType;
|
|
11
|
-
defaultResolution: ClarityType;
|
|
12
11
|
resolutionList: [ClarityType.HD, ClarityType.SD];
|
|
13
12
|
maxZoomSettings?: number;
|
|
14
13
|
}>;
|
package/lib/ctx/resolution.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ type NativeClarity = Parameters<IpcContext['setClarity']>[0]['clarity'];
|
|
|
3
3
|
export declare const toNativeClarity: (clarity: ClarityType) => NativeClarity;
|
|
4
4
|
/** 宿主支持自动清晰度,且返回至少两个档位时才展示 AUTO。 */
|
|
5
5
|
export declare const canShowAutoClarity: (list?: ClarityType[]) => boolean;
|
|
6
|
-
export declare const withAutoClarity: (list?: ClarityType[]
|
|
6
|
+
export declare const withAutoClarity: (list?: ClarityType[]) => ClarityType[];
|
|
7
7
|
export declare const normalizeResolution: (resolution: ClarityType, list: ClarityType[]) => ClarityType;
|
|
8
8
|
export {};
|
package/lib/ctx/resolution.js
CHANGED
|
@@ -21,16 +21,8 @@ export const canShowAutoClarity = function () {
|
|
|
21
21
|
};
|
|
22
22
|
export const withAutoClarity = function () {
|
|
23
23
|
let list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
24
|
-
let is4G = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
25
|
-
let enableAutoClarity = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
26
24
|
const withoutAuto = list.filter(clarity => clarity !== ClarityType.AUTO);
|
|
27
|
-
|
|
28
|
-
// 仅 4G 能力开启且面板云配置明确关闭时隐藏 Auto。
|
|
29
|
-
if (is4G && enableAutoClarity === false) {
|
|
30
|
-
showAuto = false;
|
|
31
|
-
}
|
|
32
|
-
console.log('res===showAuto', is4G, enableAutoClarity, showAuto);
|
|
33
|
-
return showAuto ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
|
|
25
|
+
return canShowAutoClarity(list) ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
|
|
34
26
|
};
|
|
35
27
|
export const normalizeResolution = (resolution, list) => {
|
|
36
28
|
if (resolution !== ClarityType.AUTO || canShowAutoClarity(list)) return resolution;
|
package/lib/i18n/index.d.ts
CHANGED
|
@@ -10,11 +10,8 @@ declare const Strings: kit.I18N<{
|
|
|
10
10
|
ipc_player_resolution_AUDIO: string;
|
|
11
11
|
ipc_player_current_resolution_is_equal: string;
|
|
12
12
|
ipc_player_screenshot_success_tip: string;
|
|
13
|
-
ipc_player_screenshot_multi_success_tip: string;
|
|
14
13
|
ipc_player_error_screenshot_error_tip: string;
|
|
15
14
|
ipc_player_record_success_tip: string;
|
|
16
|
-
ipc_player_record_multi_success_tip: string;
|
|
17
|
-
ipc_player_multi_capture_success_count: string;
|
|
18
15
|
ipc_player_shot_success_check: string;
|
|
19
16
|
ipc_player_record_success_check: string;
|
|
20
17
|
ipc_player_recording_now_tip: string;
|
|
@@ -55,11 +52,8 @@ declare const Strings: kit.I18N<{
|
|
|
55
52
|
ipc_player_resolution_AUDIO: string;
|
|
56
53
|
ipc_player_current_resolution_is_equal: string;
|
|
57
54
|
ipc_player_screenshot_success_tip: string;
|
|
58
|
-
ipc_player_screenshot_multi_success_tip: string;
|
|
59
55
|
ipc_player_error_screenshot_error_tip: string;
|
|
60
56
|
ipc_player_record_success_tip: string;
|
|
61
|
-
ipc_player_record_multi_success_tip: string;
|
|
62
|
-
ipc_player_multi_capture_success_count: string;
|
|
63
57
|
ipc_player_shot_success_check: string;
|
|
64
58
|
ipc_player_record_success_check: string;
|
|
65
59
|
ipc_player_recording_now_tip: string;
|
|
@@ -100,11 +94,8 @@ declare const Strings: kit.I18N<{
|
|
|
100
94
|
ipc_player_resolution_AUDIO: string;
|
|
101
95
|
ipc_player_current_resolution_is_equal: string;
|
|
102
96
|
ipc_player_screenshot_success_tip: string;
|
|
103
|
-
ipc_player_screenshot_multi_success_tip: string;
|
|
104
97
|
ipc_player_error_screenshot_error_tip: string;
|
|
105
98
|
ipc_player_record_success_tip: string;
|
|
106
|
-
ipc_player_record_multi_success_tip: string;
|
|
107
|
-
ipc_player_multi_capture_success_count: string;
|
|
108
99
|
ipc_player_shot_success_check: string;
|
|
109
100
|
ipc_player_record_success_check: string;
|
|
110
101
|
ipc_player_recording_now_tip: string;
|
|
@@ -144,11 +135,8 @@ declare const Strings: kit.I18N<{
|
|
|
144
135
|
ipc_player_resolution_AUDIO: string;
|
|
145
136
|
ipc_player_current_resolution_is_equal: string;
|
|
146
137
|
ipc_player_screenshot_success_tip: string;
|
|
147
|
-
ipc_player_screenshot_multi_success_tip: string;
|
|
148
138
|
ipc_player_error_screenshot_error_tip: string;
|
|
149
139
|
ipc_player_record_success_tip: string;
|
|
150
|
-
ipc_player_record_multi_success_tip: string;
|
|
151
|
-
ipc_player_multi_capture_success_count: string;
|
|
152
140
|
ipc_player_shot_success_check: string;
|
|
153
141
|
ipc_player_record_success_check: string;
|
|
154
142
|
ipc_player_recording_now_tip: string;
|
package/lib/i18n/strings.d.ts
CHANGED
|
@@ -9,11 +9,8 @@ declare const _default: {
|
|
|
9
9
|
ipc_player_resolution_AUDIO: string;
|
|
10
10
|
ipc_player_current_resolution_is_equal: string;
|
|
11
11
|
ipc_player_screenshot_success_tip: string;
|
|
12
|
-
ipc_player_screenshot_multi_success_tip: string;
|
|
13
12
|
ipc_player_error_screenshot_error_tip: string;
|
|
14
13
|
ipc_player_record_success_tip: string;
|
|
15
|
-
ipc_player_record_multi_success_tip: string;
|
|
16
|
-
ipc_player_multi_capture_success_count: string;
|
|
17
14
|
ipc_player_shot_success_check: string;
|
|
18
15
|
ipc_player_record_success_check: string;
|
|
19
16
|
ipc_player_recording_now_tip: string;
|
|
@@ -54,11 +51,8 @@ declare const _default: {
|
|
|
54
51
|
ipc_player_resolution_AUDIO: string;
|
|
55
52
|
ipc_player_current_resolution_is_equal: string;
|
|
56
53
|
ipc_player_screenshot_success_tip: string;
|
|
57
|
-
ipc_player_screenshot_multi_success_tip: string;
|
|
58
54
|
ipc_player_error_screenshot_error_tip: string;
|
|
59
55
|
ipc_player_record_success_tip: string;
|
|
60
|
-
ipc_player_record_multi_success_tip: string;
|
|
61
|
-
ipc_player_multi_capture_success_count: string;
|
|
62
56
|
ipc_player_shot_success_check: string;
|
|
63
57
|
ipc_player_record_success_check: string;
|
|
64
58
|
ipc_player_recording_now_tip: string;
|
package/lib/i18n/strings.js
CHANGED
|
@@ -9,11 +9,8 @@ export default {
|
|
|
9
9
|
ipc_player_resolution_AUDIO: 'Audio Mode',
|
|
10
10
|
ipc_player_current_resolution_is_equal: 'Already at current clarity',
|
|
11
11
|
ipc_player_screenshot_success_tip: 'Screenshot saved to album',
|
|
12
|
-
ipc_player_screenshot_multi_success_tip: 'Screenshots saved to album',
|
|
13
12
|
ipc_player_error_screenshot_error_tip: 'Screenshot failed. Please try again later.',
|
|
14
13
|
ipc_player_record_success_tip: 'Recording saved to album',
|
|
15
|
-
ipc_player_record_multi_success_tip: 'Recordings saved to album',
|
|
16
|
-
ipc_player_multi_capture_success_count: '{0} items',
|
|
17
14
|
ipc_player_shot_success_check: 'View',
|
|
18
15
|
ipc_player_record_success_check: 'View',
|
|
19
16
|
ipc_player_recording_now_tip: 'Recording in progress...',
|
|
@@ -54,11 +51,8 @@ export default {
|
|
|
54
51
|
ipc_player_resolution_AUDIO: '音频模式',
|
|
55
52
|
ipc_player_current_resolution_is_equal: '已是当前清晰度',
|
|
56
53
|
ipc_player_screenshot_success_tip: '截图已保存在APP相册',
|
|
57
|
-
ipc_player_screenshot_multi_success_tip: '图片已保存至相册',
|
|
58
54
|
ipc_player_error_screenshot_error_tip: '截图失败了,请稍后再试',
|
|
59
55
|
ipc_player_record_success_tip: '录像已保存在APP相册',
|
|
60
|
-
ipc_player_record_multi_success_tip: '视频已保存至相册',
|
|
61
|
-
ipc_player_multi_capture_success_count: '共{0}个',
|
|
62
56
|
ipc_player_shot_success_check: '查看',
|
|
63
57
|
ipc_player_record_success_check: '查看',
|
|
64
58
|
ipc_player_recording_now_tip: '正在录像中...',
|
package/lib/index.d.ts
CHANGED
|
@@ -5,3 +5,7 @@ import * as Widgets from './widgets';
|
|
|
5
5
|
import * as Features from './features';
|
|
6
6
|
import * as Utils from './utils';
|
|
7
7
|
export { Widgets, Features, Utils };
|
|
8
|
+
export { PlayerRenderModeContext } from './renderer/context';
|
|
9
|
+
export type { PlayerRenderMode } from './renderer/context';
|
|
10
|
+
export type { LynxPlayerAdapters } from './renderer/capabilities';
|
|
11
|
+
export { LynxPlayerAdaptersContext } from './renderer/capabilities';
|
package/lib/index.js
CHANGED
|
@@ -4,4 +4,6 @@ export * from './interface';
|
|
|
4
4
|
import * as Widgets from './widgets';
|
|
5
5
|
import * as Features from './features';
|
|
6
6
|
import * as Utils from './utils';
|
|
7
|
-
export { Widgets, Features, Utils };
|
|
7
|
+
export { Widgets, Features, Utils };
|
|
8
|
+
export { PlayerRenderModeContext } from './renderer/context';
|
|
9
|
+
export { LynxPlayerAdaptersContext } from './renderer/capabilities';
|
package/lib/interface.d.ts
CHANGED
|
@@ -47,7 +47,6 @@ export type UseCtx = (options: {
|
|
|
47
47
|
initBottomRightContent?: ComponentConfig[];
|
|
48
48
|
initAbsoluteContent?: ComponentConfig[];
|
|
49
49
|
saveToAlbum?: 0 | 1;
|
|
50
|
-
multiLens?: boolean;
|
|
51
50
|
showPtzControlTip?: boolean;
|
|
52
51
|
videoSplitProtocol?: VideoSplitProtocol;
|
|
53
52
|
}) => {
|
|
@@ -55,7 +54,6 @@ export type UseCtx = (options: {
|
|
|
55
54
|
brandColor: RetAtom<string>;
|
|
56
55
|
verticalMic: RetAtom<boolean>;
|
|
57
56
|
saveToAlbum: 0 | 1;
|
|
58
|
-
multiLens: boolean;
|
|
59
57
|
showPtzControlTip: boolean;
|
|
60
58
|
screenType: RetAtom<ScreenType>;
|
|
61
59
|
isVerticalFullLayout: RetAtom<boolean>;
|
|
@@ -91,8 +89,7 @@ export type UseCtx = (options: {
|
|
|
91
89
|
setRecordingDisabled: (type: boolean) => void;
|
|
92
90
|
setResolution: (type: string) => Promise<boolean>;
|
|
93
91
|
setResolutionList: (type: string[]) => void;
|
|
94
|
-
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<
|
|
95
|
-
stopRecordingOnUnload: () => Promise<CaptureResult>;
|
|
92
|
+
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<RecordInfoData>;
|
|
96
93
|
setIntercom: (value: boolean, onlyUpdateAtom?: boolean) => Promise<boolean>;
|
|
97
94
|
setMute: (value: boolean) => Promise<boolean>;
|
|
98
95
|
changeStreamStatus: (value: PlayerStreamStatus) => void;
|
|
@@ -123,12 +120,8 @@ export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
|
|
|
123
120
|
absoluteContentClassName?: string;
|
|
124
121
|
absoluteContentStyle?: React.CSSProperties;
|
|
125
122
|
absoluteNoCoverView?: boolean;
|
|
126
|
-
renderWhen?: (state: ComponentRenderState) => boolean;
|
|
127
123
|
hidden?: boolean;
|
|
128
124
|
};
|
|
129
|
-
export type ComponentRenderState = {
|
|
130
|
-
playState: PlayState;
|
|
131
|
-
};
|
|
132
125
|
export type ComponentConfigProps = {
|
|
133
126
|
IPCPlayerContext: IpcContext;
|
|
134
127
|
} & ReturnType<UseCtx>;
|
|
@@ -136,17 +129,11 @@ export type PlayStatusData = {
|
|
|
136
129
|
playState: PlayState;
|
|
137
130
|
playCode: number;
|
|
138
131
|
};
|
|
139
|
-
export type
|
|
140
|
-
index?: number;
|
|
132
|
+
export type RecordInfoData = boolean | {
|
|
141
133
|
tempImagePath: string;
|
|
142
134
|
filePath: string;
|
|
143
|
-
thumbPath
|
|
144
|
-
width?: number;
|
|
145
|
-
height?: number;
|
|
146
|
-
data?: string;
|
|
135
|
+
thumbPath: string;
|
|
147
136
|
};
|
|
148
|
-
export type CaptureResult = boolean | CaptureFileInfo;
|
|
149
|
-
export type RecordInfoData = CaptureResult;
|
|
150
137
|
/**
|
|
151
138
|
* 多目屏幕模式
|
|
152
139
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
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);
|