@ray-js/ipc-player-integration 0.0.61-beta.1 → 0.0.62
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/lib/ctx/ctx.composition.js +4 -19
- package/lib/ctx/ctx.js +55 -103
- 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/interface.d.ts +3 -19
- package/lib/ui/bottomLeftContent.js +1 -3
- package/lib/ui/ui.d.ts +0 -2
- package/lib/ui/ui.js +26 -30
- package/lib/utils/navigation.d.ts +1 -2
- package/lib/utils/navigation.js +3 -13
- package/lib/utils/ttt.js +8 -2
- package/lib/widgets/index.d.ts +0 -1
- package/lib/widgets/index.js +1 -2
- package/lib/widgets/muted/muted.js +3 -9
- package/lib/widgets/muted/muted.less +1 -5
- package/lib/widgets/recordVideo/recordVideo.js +52 -53
- package/lib/widgets/recordVideo/recordVideo.less +74 -17
- package/lib/widgets/recordVideo/recordVideo.test.js +0 -1
- package/lib/widgets/screenshot/screenshot.js +44 -66
- package/lib/widgets/screenshot/screenshot.less +40 -1
- package/lib/widgets/trialBadge/index.d.ts +1 -2
- package/lib/widgets/trialBadge/index.js +9 -17
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
- package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
- package/lib/widgets/tryExperience/tryExperience.js +1 -0
- package/package.json +2 -3
- 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/utils/fullLinkTracking.d.ts +0 -5
- package/lib/utils/fullLinkTracking.js +0 -71
- 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
|
@@ -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,14 +3,13 @@ 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';
|
|
@@ -33,20 +32,16 @@ export const createUseCtx = _ref => {
|
|
|
33
32
|
return _ref2 => {
|
|
34
33
|
let {
|
|
35
34
|
devId,
|
|
36
|
-
autoClarityDisabled,
|
|
37
35
|
initTopLeftContent,
|
|
38
36
|
initTopRightContent,
|
|
39
37
|
initBottomLeftContent,
|
|
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;
|
|
47
44
|
const streamStatus = useRef();
|
|
48
|
-
// The page owns this context; player UI remounts must retain exposure history.
|
|
49
|
-
const trialBadgeViewedRef = useRef(false);
|
|
50
45
|
// 全屏、竖屏
|
|
51
46
|
const [screenType, setScreenType] = useAtom('vertical');
|
|
52
47
|
const IPCPlayerInstance = useRef();
|
|
@@ -62,7 +57,6 @@ export const createUseCtx = _ref => {
|
|
|
62
57
|
|
|
63
58
|
// 录像中
|
|
64
59
|
const [recording] = useAtom(false);
|
|
65
|
-
const recordingMultiLensRef = useRef(false);
|
|
66
60
|
|
|
67
61
|
// 录像是否不可点击
|
|
68
62
|
const [recordingDisabled, setRecordingDisabled] = useAtom(false);
|
|
@@ -80,8 +74,6 @@ export const createUseCtx = _ref => {
|
|
|
80
74
|
const [resolution] = useAtom('HD');
|
|
81
75
|
// resolution 清晰度列表
|
|
82
76
|
const [resolutionList, setResolutionList] = useAtom([]);
|
|
83
|
-
const [memoryState, setMemoryState] = useState(null);
|
|
84
|
-
const autoFallbackPendingRef = useRef(null);
|
|
85
77
|
// 自动模式下宿主上报的实际清晰度,供横竖屏码率区域共用
|
|
86
78
|
const [autoClarity] = useAtom(null);
|
|
87
79
|
|
|
@@ -132,73 +124,40 @@ export const createUseCtx = _ref => {
|
|
|
132
124
|
if (!eventRef.current) {
|
|
133
125
|
eventRef.current = getEventInstance();
|
|
134
126
|
}
|
|
135
|
-
const syncMemoryState = res => {
|
|
136
|
-
var _res$maxZoomSettings;
|
|
137
|
-
setMemoryState({
|
|
138
|
-
devId,
|
|
139
|
-
data: res
|
|
140
|
-
});
|
|
141
|
-
// 历史 Auto 等宿主配置确定后再恢复,避免先显示 Auto 再回退。
|
|
142
|
-
if (res.resolution !== ClarityType.AUTO) {
|
|
143
|
-
restoreResolution(res.resolution, res.resolutionList, _setResolution);
|
|
144
|
-
}
|
|
145
|
-
_setMute(res.mute, true);
|
|
146
|
-
setIntercomMode(res.intercomMode);
|
|
147
|
-
setIntercomSupported(res.isIntercomSupported);
|
|
148
|
-
setMaxZoomSettings((_res$maxZoomSettings = res.maxZoomSettings) !== null && _res$maxZoomSettings !== void 0 ? _res$maxZoomSettings : 6);
|
|
149
|
-
};
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
autoFallbackPendingRef.current = null;
|
|
152
|
-
}, [devId]);
|
|
153
127
|
useEffect(() => {
|
|
154
128
|
// 初始化获取缓存值
|
|
155
|
-
|
|
129
|
+
|
|
156
130
|
(async () => {
|
|
157
131
|
if (!devId) return;
|
|
158
132
|
try {
|
|
133
|
+
var _res$maxZoomSettings;
|
|
159
134
|
const res = await getMemoryState(devId);
|
|
160
|
-
|
|
161
|
-
|
|
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);
|
|
162
141
|
} catch (error) {
|
|
163
142
|
console.error('获取 getMemoryState 失败:', error);
|
|
164
143
|
}
|
|
165
144
|
})();
|
|
166
|
-
return () => {
|
|
167
|
-
active = false;
|
|
168
|
-
};
|
|
169
145
|
}, [devId]);
|
|
170
146
|
useEffect(() => {
|
|
171
|
-
let active = true;
|
|
172
147
|
if (devId && _playState === PlayState.PLAYING) {
|
|
173
148
|
// 获取缓存的值且同步
|
|
174
149
|
getMemoryState(devId).then(res => {
|
|
175
|
-
|
|
176
|
-
|
|
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);
|
|
177
158
|
});
|
|
178
159
|
}
|
|
179
|
-
return () => {
|
|
180
|
-
active = false;
|
|
181
|
-
};
|
|
182
160
|
}, [devId, _playState]);
|
|
183
|
-
useEffect(() => {
|
|
184
|
-
// 普通档位或宿主配置变化时,决定是否追加 Auto。
|
|
185
|
-
const list = (memoryState === null || memoryState === void 0 ? void 0 : memoryState.devId) === devId ? memoryState.data.resolutionList : [];
|
|
186
|
-
if (autoClarityDisabled === null) {
|
|
187
|
-
setResolutionList(list.filter(clarity => clarity !== ClarityType.AUTO));
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
setResolutionList(withAutoClarity(list, autoClarityDisabled));
|
|
191
|
-
if ((memoryState === null || memoryState === void 0 ? void 0 : memoryState.devId) !== devId || memoryState.data.resolution !== ClarityType.AUTO) return;
|
|
192
|
-
if (autoClarityDisabled && autoFallbackPendingRef.current !== devId) {
|
|
193
|
-
autoFallbackPendingRef.current = devId;
|
|
194
|
-
_setResolution(memoryState.data.defaultResolution).catch(error => {
|
|
195
|
-
autoFallbackPendingRef.current = null;
|
|
196
|
-
console.warn('恢复默认清晰度失败:', error);
|
|
197
|
-
});
|
|
198
|
-
} else if (!autoClarityDisabled) {
|
|
199
|
-
restoreResolution(memoryState.data.resolution, list, _setResolution);
|
|
200
|
-
}
|
|
201
|
-
}, [devId, memoryState, currentResolution, autoClarityDisabled]);
|
|
202
161
|
useEffect(() => {
|
|
203
162
|
refreshAfterPlayback(_playState, currentResolution);
|
|
204
163
|
}, [devId, _playState, currentResolution]);
|
|
@@ -315,30 +274,6 @@ export const createUseCtx = _ref => {
|
|
|
315
274
|
});
|
|
316
275
|
});
|
|
317
276
|
};
|
|
318
|
-
const stopRecording = showError => {
|
|
319
|
-
return new Promise((resolve, reject) => {
|
|
320
|
-
IPCPlayerInstance.current.stopRecord({
|
|
321
|
-
saveToAlbum,
|
|
322
|
-
success: res => {
|
|
323
|
-
recordingMultiLensRef.current = false;
|
|
324
|
-
updateAtom(recording, false);
|
|
325
|
-
resolve(res);
|
|
326
|
-
},
|
|
327
|
-
fail: err => {
|
|
328
|
-
recordingMultiLensRef.current = false;
|
|
329
|
-
updateAtom(recording, false);
|
|
330
|
-
reject(err);
|
|
331
|
-
if (showError) {
|
|
332
|
-
const errObj = err.innerError || err || {};
|
|
333
|
-
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_stop_recording_err');
|
|
334
|
-
toast({
|
|
335
|
-
title: errMsg
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
};
|
|
342
277
|
const multiCameraCtx = useMultiCameraCtx({
|
|
343
278
|
devId,
|
|
344
279
|
IPCPlayerInstance: IPCPlayerInstance.current,
|
|
@@ -346,11 +281,9 @@ export const createUseCtx = _ref => {
|
|
|
346
281
|
});
|
|
347
282
|
return {
|
|
348
283
|
devId,
|
|
349
|
-
trialBadgeViewedRef,
|
|
350
284
|
brandColor,
|
|
351
285
|
verticalMic,
|
|
352
286
|
saveToAlbum,
|
|
353
|
-
multiLens,
|
|
354
287
|
screenType,
|
|
355
288
|
isVerticalFullLayout,
|
|
356
289
|
setIsVerticalFullLayout,
|
|
@@ -396,7 +329,7 @@ export const createUseCtx = _ref => {
|
|
|
396
329
|
ty.authorizeStatus({
|
|
397
330
|
// 麦克风权限
|
|
398
331
|
scope: 'scope.record',
|
|
399
|
-
success:
|
|
332
|
+
success: () => {
|
|
400
333
|
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
401
334
|
IPCPlayerInstance.current.startTalk({
|
|
402
335
|
success: () => {
|
|
@@ -414,12 +347,12 @@ export const createUseCtx = _ref => {
|
|
|
414
347
|
}
|
|
415
348
|
});
|
|
416
349
|
},
|
|
417
|
-
fail:
|
|
350
|
+
fail: () => {
|
|
418
351
|
console.log('authorizeStatus失败回调');
|
|
419
352
|
ty.authorize({
|
|
420
353
|
// 麦克风权限
|
|
421
354
|
scope: 'scope.record',
|
|
422
|
-
success:
|
|
355
|
+
success: () => {
|
|
423
356
|
console.log('authorize成功回调');
|
|
424
357
|
IPCPlayerInstance.current.startTalk({
|
|
425
358
|
success: () => {
|
|
@@ -495,25 +428,44 @@ export const createUseCtx = _ref => {
|
|
|
495
428
|
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
496
429
|
return false;
|
|
497
430
|
}
|
|
498
|
-
if (
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
431
|
+
if (target) {
|
|
432
|
+
const granted = await ensureAlbumPermission();
|
|
433
|
+
eventRef.current.emit(changeIgnoreHideStopPreview, false);
|
|
434
|
+
if (!granted) return false;
|
|
435
|
+
}
|
|
502
436
|
return new Promise((resolve, reject) => {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
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
|
+
}
|
|
514
467
|
});
|
|
515
468
|
},
|
|
516
|
-
stopRecordingOnUnload: () => stopRecording(false),
|
|
517
469
|
setRecordingDisabled,
|
|
518
470
|
setScreenType,
|
|
519
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,10 +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 autoClarityDisabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
25
24
|
const withoutAuto = list.filter(clarity => clarity !== ClarityType.AUTO);
|
|
26
|
-
|
|
27
|
-
return showAuto ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
|
|
25
|
+
return canShowAutoClarity(list) ? [...withoutAuto, ClarityType.AUTO] : withoutAuto;
|
|
28
26
|
};
|
|
29
27
|
export const normalizeResolution = (resolution, list) => {
|
|
30
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/interface.d.ts
CHANGED
|
@@ -41,24 +41,19 @@ export type EventInstance = {
|
|
|
41
41
|
};
|
|
42
42
|
export type UseCtx = (options: {
|
|
43
43
|
devId: string;
|
|
44
|
-
/** 宿主决定是否禁用 Auto;null 表示本次配置查询尚未完成。 */
|
|
45
|
-
autoClarityDisabled?: boolean | null;
|
|
46
44
|
initTopLeftContent?: ComponentConfig[];
|
|
47
45
|
initTopRightContent?: ComponentConfig[];
|
|
48
46
|
initBottomLeftContent?: ComponentConfig[];
|
|
49
47
|
initBottomRightContent?: ComponentConfig[];
|
|
50
48
|
initAbsoluteContent?: ComponentConfig[];
|
|
51
49
|
saveToAlbum?: 0 | 1;
|
|
52
|
-
multiLens?: boolean;
|
|
53
50
|
showPtzControlTip?: boolean;
|
|
54
51
|
videoSplitProtocol?: VideoSplitProtocol;
|
|
55
52
|
}) => {
|
|
56
53
|
devId: string;
|
|
57
|
-
trialBadgeViewedRef: React.MutableRefObject<boolean>;
|
|
58
54
|
brandColor: RetAtom<string>;
|
|
59
55
|
verticalMic: RetAtom<boolean>;
|
|
60
56
|
saveToAlbum: 0 | 1;
|
|
61
|
-
multiLens: boolean;
|
|
62
57
|
showPtzControlTip: boolean;
|
|
63
58
|
screenType: RetAtom<ScreenType>;
|
|
64
59
|
isVerticalFullLayout: RetAtom<boolean>;
|
|
@@ -94,8 +89,7 @@ export type UseCtx = (options: {
|
|
|
94
89
|
setRecordingDisabled: (type: boolean) => void;
|
|
95
90
|
setResolution: (type: string) => Promise<boolean>;
|
|
96
91
|
setResolutionList: (type: string[]) => void;
|
|
97
|
-
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<
|
|
98
|
-
stopRecordingOnUnload: () => Promise<CaptureResult>;
|
|
92
|
+
setRecording: (value: boolean, onlyUpdateAtom?: boolean) => Promise<RecordInfoData>;
|
|
99
93
|
setIntercom: (value: boolean, onlyUpdateAtom?: boolean) => Promise<boolean>;
|
|
100
94
|
setMute: (value: boolean) => Promise<boolean>;
|
|
101
95
|
changeStreamStatus: (value: PlayerStreamStatus) => void;
|
|
@@ -126,12 +120,8 @@ export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
|
|
|
126
120
|
absoluteContentClassName?: string;
|
|
127
121
|
absoluteContentStyle?: React.CSSProperties;
|
|
128
122
|
absoluteNoCoverView?: boolean;
|
|
129
|
-
renderWhen?: (state: ComponentRenderState) => boolean;
|
|
130
123
|
hidden?: boolean;
|
|
131
124
|
};
|
|
132
|
-
export type ComponentRenderState = {
|
|
133
|
-
playState: PlayState;
|
|
134
|
-
};
|
|
135
125
|
export type ComponentConfigProps = {
|
|
136
126
|
IPCPlayerContext: IpcContext;
|
|
137
127
|
} & ReturnType<UseCtx>;
|
|
@@ -139,17 +129,11 @@ export type PlayStatusData = {
|
|
|
139
129
|
playState: PlayState;
|
|
140
130
|
playCode: number;
|
|
141
131
|
};
|
|
142
|
-
export type
|
|
143
|
-
index?: number;
|
|
132
|
+
export type RecordInfoData = boolean | {
|
|
144
133
|
tempImagePath: string;
|
|
145
134
|
filePath: string;
|
|
146
|
-
thumbPath
|
|
147
|
-
width?: number;
|
|
148
|
-
height?: number;
|
|
149
|
-
data?: string;
|
|
135
|
+
thumbPath: string;
|
|
150
136
|
};
|
|
151
|
-
export type CaptureResult = boolean | CaptureFileInfo;
|
|
152
|
-
export type RecordInfoData = CaptureResult;
|
|
153
137
|
/**
|
|
154
138
|
* 多目屏幕模式
|
|
155
139
|
*/
|
|
@@ -82,10 +82,9 @@ const BottomLeftContent = _ref => {
|
|
|
82
82
|
const [shouldHide] = useComponentHideState();
|
|
83
83
|
const {
|
|
84
84
|
showTrialBadge,
|
|
85
|
-
handleTrialView,
|
|
86
85
|
handleTrialSubscribe,
|
|
87
86
|
handleCountdownEnd
|
|
88
|
-
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec
|
|
87
|
+
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec);
|
|
89
88
|
|
|
90
89
|
// 横向滚动状态:内容溢出且未滑到对应边缘时,显示左 / 右箭头提示
|
|
91
90
|
const idRef = useRef(++scrollClsSeq);
|
|
@@ -406,7 +405,6 @@ const BottomLeftContent = _ref => {
|
|
|
406
405
|
marginLeft: screenType === 'vertical' ? '12px' : '25px'
|
|
407
406
|
}
|
|
408
407
|
}, /*#__PURE__*/React.createElement(TrialBadge, {
|
|
409
|
-
onView: handleTrialView,
|
|
410
408
|
brandColor: brandColor,
|
|
411
409
|
trialRemainingSec: trialRemainingSec,
|
|
412
410
|
onSubscribe: handleTrialSubscribe,
|
package/lib/ui/ui.d.ts
CHANGED