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