@ray-js/ipc-player-integration 0.0.66-beta.0 → 0.0.67-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 +0 -6
- package/lib/ctx/ctx.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +13 -3
- package/lib/ctx/ctx.js +46 -35
- package/lib/ctx/multiCameraCtx.d.ts +2 -0
- package/lib/ctx/multiCameraCtx.js +17 -1
- package/lib/ctx/multiCameraCtx.test.d.ts +1 -0
- package/lib/ctx/multiCameraCtx.test.js +65 -0
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/index.d.ts +0 -4
- package/lib/index.js +1 -3
- package/lib/interface.d.ts +17 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +55 -119
- package/lib/ui/bottomRightContent.js +3 -6
- package/lib/ui/ui.d.ts +0 -5
- package/lib/ui/ui.js +98 -89
- package/lib/utils/captureResult.d.ts +12 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +223 -0
- 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/widgets/battery/battery.js +5 -7
- package/lib/widgets/battery/batteryFull.js +5 -7
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +84 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/floodlight/floodlight.js +1 -2
- package/lib/widgets/flowLowTip/flowLowTip.js +1 -2
- package/lib/widgets/fullScreen/fullScreen.js +4 -18
- package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
- package/lib/widgets/fullScreen/verticalScreen.js +1 -2
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +1 -2
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +3 -12
- package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +4 -24
- package/lib/widgets/multiCamera/index.less +1 -0
- package/lib/widgets/multiCamera/landscapeTip.js +1 -2
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +2 -3
- package/lib/widgets/multiCamera/ptzMoveableTip.js +1 -2
- package/lib/widgets/multiCamera/switchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileMultiPtz.js +2 -3
- package/lib/widgets/multiCamera/tileSwitchLayout.js +1 -2
- package/lib/widgets/multiCamera/tileTip.js +1 -2
- package/lib/widgets/muted/muted.js +1 -2
- package/lib/widgets/muted/muted.test.js +52 -66
- package/lib/widgets/ptz/ptz.js +1 -2
- package/lib/widgets/ptz/ptzControl.js +1 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +3 -6
- package/lib/widgets/ptzControlTip/ptzControlTip.less +0 -6
- package/lib/widgets/realTimeMagnification/realTimeMagnification.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +58 -54
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/resolution/fullResolutionControl.js +19 -29
- package/lib/widgets/resolution/resolution.js +2 -3
- package/lib/widgets/screenshot/screenshot.js +67 -45
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +135 -0
- package/lib/widgets/signal4G/signal4G.js +1 -4
- package/lib/widgets/siren/siren.js +1 -2
- package/lib/widgets/tempHumidity/tempHumidity.js +1 -2
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +1 -2
- package/lib/widgets/trialBadge/index.d.ts +2 -1
- package/lib/widgets/trialBadge/index.js +20 -17
- package/lib/widgets/trialBadge/index.less +0 -24
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
- package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
- package/lib/widgets/tryExperience/tryExperience.js +1 -2
- package/lib/widgets/videoBitKBP/videoBitKBP.js +1 -2
- package/lib/widgets/voiceIntercom/voiceIntercom.js +24 -50
- package/lib/widgets/voiceIntercom/voiceIntercom.less +0 -16
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +7 -5
- package/lib/widgets/zoomTurntable/turntable/index.js +1 -3
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +0 -2
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +18 -31
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +3 -23
- package/package.json +7 -15
- package/lib/renderer/capabilities.d.ts +0 -8
- package/lib/renderer/capabilities.js +0 -19
- package/lib/renderer/context.d.ts +0 -5
- package/lib/renderer/context.js +0 -6
- package/lib/renderer/directionControl.d.ts +0 -6
- package/lib/renderer/directionControl.js +0 -3
- package/lib/renderer/font.less +0 -5
- package/lib/renderer/glyphs.d.ts +0 -1
- package/lib/renderer/glyphs.js +0 -256
- package/lib/renderer/index.module.less +0 -48
- package/lib/renderer/ptzZoom.d.ts +0 -6
- package/lib/renderer/ptzZoom.js +0 -3
- package/lib/renderer/text.d.ts +0 -4
- package/lib/renderer/text.js +0 -32
- package/lib/renderer/text.module.less +0 -4
- package/lib/renderer/viewport.d.ts +0 -7
- package/lib/renderer/viewport.js +0 -24
- package/lib/res/lynx-signal/index.d.ts +0 -1
- package/lib/res/lynx-signal/index.js +0 -22
- package/lib/res/lynx-signal/signalFour0.png +0 -0
- package/lib/res/lynx-signal/signalFour1.png +0 -0
- package/lib/res/lynx-signal/signalFour2.png +0 -0
- package/lib/res/lynx-signal/signalFour3.png +0 -0
- package/lib/res/lynx-signal/signalFour4.png +0 -0
- package/lib/res/lynx-signal/signalThree0.png +0 -0
- package/lib/res/lynx-signal/signalThree1.png +0 -0
- package/lib/res/lynx-signal/signalThree2.png +0 -0
- package/lib/res/lynx-signal/signalThree3.png +0 -0
- package/lib/res/player-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/scrollHintArrow.d.ts +0 -23
- package/lib/ui/scrollHintArrow.js +0 -82
- package/lib/widgets/battery/statusIcon.d.ts +0 -6
- package/lib/widgets/battery/statusIcon.js +0 -36
- package/lib/widgets/battery/statusIcon.less +0 -24
- package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +0 -6
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +0 -30
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +0 -5
- package/lib/widgets/zoomTurntable/turntable/lynx.js +0 -273
- package/lib/widgets/zoomTurntable/turntable/lynx.less +0 -9
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +0 -37
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +0 -122
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +0 -3
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +0 -36
package/lib/ui/ui.js
CHANGED
|
@@ -12,27 +12,25 @@ import clsx from 'clsx';
|
|
|
12
12
|
import IPCPlayer from '@ray-js/ray-ipc-player';
|
|
13
13
|
import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
|
|
14
14
|
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
15
|
-
import { PlayerRenderModeContext, PlayerControlVisibilityContext } from '../renderer/context';
|
|
16
|
-
import lynxStyles from '../renderer/index.module.less';
|
|
17
|
-
import { getPlayerViewport } from '../renderer/viewport';
|
|
18
|
-
import { LynxPlayerAdaptersContext } from '../renderer/capabilities';
|
|
19
15
|
import { PlayState, PlayerStreamStatus, MultiCameraScreenMode } from '../interface';
|
|
20
16
|
import { useCtx } from '../ctx/ctx.composition';
|
|
21
|
-
import { useStore, updateAtom
|
|
17
|
+
import { useStore, updateAtom } from '../ctx/store';
|
|
22
18
|
import { UIEventContext } from './context';
|
|
23
|
-
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId, showFlowLowTipId, zoomLevelChange, setScaleMultipleEvent, trialCountdownEnd, refreshSmartImageQualityEvent } from './constant';
|
|
19
|
+
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId, ptzControlTipId, showFlowLowTipId, zoomLevelChange, setScaleMultipleEvent, trialCountdownEnd, refreshSmartImageQualityEvent } from './constant';
|
|
24
20
|
import BottomLeftContent from './bottomLeftContent';
|
|
25
21
|
import BottomRightContent from './bottomRightContent';
|
|
26
22
|
import TopLeftContent from './topLeftContent';
|
|
27
23
|
import TopRightContent from './topRightContent';
|
|
28
24
|
import { useOfflineShownNotification } from './useOfflineShownNotification';
|
|
29
|
-
import { FlowLowTip, VideoBitKBP } from '../widgets';
|
|
25
|
+
import { FlowLowTip, VideoBitKBP, zoomTurntableTipId } from '../widgets';
|
|
30
26
|
import { useMemoizedFn } from '../hooks';
|
|
31
27
|
import { Storage } from '../utils/storage';
|
|
32
28
|
import './ui.less';
|
|
33
29
|
import { updatePlayerWidgetProps } from '../features';
|
|
34
30
|
import { getNgRawData, getSmartImageQualityState, isLowPhone } from '../utils/ttt';
|
|
31
|
+
import { getCaptureResultSummary } from '../utils/captureResult';
|
|
35
32
|
import { lensCount } from '../widgets/zoomTurntable/lensSkill';
|
|
33
|
+
import { shouldRenderContent } from './absoluteContent';
|
|
36
34
|
const AutoClarityOnly = _ref => {
|
|
37
35
|
let {
|
|
38
36
|
instance
|
|
@@ -104,7 +102,6 @@ const SCALE_MATCH_EPS = 0.01;
|
|
|
104
102
|
const BOTTOM_RIGHT_SAFE_GAP = 4;
|
|
105
103
|
export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
106
104
|
const {
|
|
107
|
-
renderMode = 'webview',
|
|
108
105
|
className,
|
|
109
106
|
devId,
|
|
110
107
|
style,
|
|
@@ -334,6 +331,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
334
331
|
maxZoomSettings: instance.maxZoomSettings,
|
|
335
332
|
zoomSkill: instance.zoomSkill
|
|
336
333
|
});
|
|
334
|
+
const hasVisibleGuideTip = absoluteContent === null || absoluteContent === void 0 ? void 0 : absoluteContent.some(item => [tileTipId, landscapeTipId, ptzMoveableTipId, ptzControlTipId, zoomTurntableTipId].includes(item.id) && playState === PlayState.PLAYING && shouldRenderContent(item, {
|
|
335
|
+
playState
|
|
336
|
+
}));
|
|
337
|
+
const hasPendingLayoutGuide = (absoluteContent === null || absoluteContent === void 0 ? void 0 : absoluteContent.some(item => item.id === tileTipId)) && !new Storage(devId).getSync(tileTipId);
|
|
337
338
|
|
|
338
339
|
// 默认最大缩放倍数下发给播放器;多镜头设备的上限要按当前镜头换算,交给 zoomTurntable 下发
|
|
339
340
|
useEffect(() => {
|
|
@@ -452,6 +453,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
452
453
|
multiCameraCtx.setPtzStatus(false);
|
|
453
454
|
}, null);
|
|
454
455
|
}, [screenMode, instance]);
|
|
456
|
+
useEffect(() => {
|
|
457
|
+
const {
|
|
458
|
+
multiCameraCtx
|
|
459
|
+
} = instance;
|
|
460
|
+
if (!multiCameraCtx.isSupport || screenMode !== MultiCameraScreenMode.full || hasPendingLayoutGuide) {
|
|
461
|
+
return;
|
|
462
|
+
}
|
|
463
|
+
if (selectedLenInfo.supportPTZ) {
|
|
464
|
+
multiCameraCtx.openDefaultPtz();
|
|
465
|
+
} else if (!selectedLenInfo.supportZoom) {
|
|
466
|
+
multiCameraCtx.setPtzStatus(false);
|
|
467
|
+
}
|
|
468
|
+
}, [instance, screenMode, selectedLenInfo.index, selectedLenInfo.supportPTZ, selectedLenInfo.supportZoom, hasPendingLayoutGuide]);
|
|
455
469
|
useEffect(() => {
|
|
456
470
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
457
471
|
|
|
@@ -459,13 +473,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
459
473
|
instance.multiCameraCtx.getNextLayoutStyle().then(res => {
|
|
460
474
|
instance.multiCameraCtx.setNextLayoutStyle(res);
|
|
461
475
|
});
|
|
476
|
+
if (isVerticalFullLayout && screenType === 'vertical') {
|
|
477
|
+
showComponents();
|
|
478
|
+
}
|
|
462
479
|
}, [layoutStyle, screenMode, instance]);
|
|
463
480
|
useEffect(() => {
|
|
464
481
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
465
482
|
|
|
466
483
|
// 组件隐藏时也隐藏镜头名
|
|
467
484
|
instance.multiCameraCtx.showLenNames(!componentHideState);
|
|
468
|
-
}, [componentHideState, instance]);
|
|
485
|
+
}, [componentHideState, instance, layoutStyle, screenMode]);
|
|
469
486
|
useEffect(() => {
|
|
470
487
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
471
488
|
if (ptzStatus) {
|
|
@@ -476,7 +493,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
476
493
|
}, [instance, ptzStatus]);
|
|
477
494
|
useEffect(() => {
|
|
478
495
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
479
|
-
if (!ptzStatus || screenMode !== MultiCameraScreenMode.full) {
|
|
496
|
+
if (!ptzStatus || screenMode !== MultiCameraScreenMode.full || componentHideState || hasPendingLayoutGuide) {
|
|
480
497
|
instance.hideContent('absolute', ptzMoveableTipId);
|
|
481
498
|
}
|
|
482
499
|
|
|
@@ -490,11 +507,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
490
507
|
|
|
491
508
|
// ptz 提示
|
|
492
509
|
const storage = new Storage(devId);
|
|
493
|
-
if (!storage.getSync(ptzMoveableTipId) && selectedLenInfo.supportPTZ && screenMode === MultiCameraScreenMode.full) {
|
|
510
|
+
if (!storage.getSync(ptzMoveableTipId) && !hasPendingLayoutGuide && !componentHideState && selectedLenInfo.supportPTZ && screenMode === MultiCameraScreenMode.full) {
|
|
494
511
|
instance.showContent('absolute', ptzMoveableTipId);
|
|
495
512
|
}
|
|
496
513
|
}
|
|
497
|
-
}, [instance, ptzStatus, selectedLenInfo, componentHideState, screenMode]);
|
|
514
|
+
}, [instance, ptzStatus, selectedLenInfo, componentHideState, screenMode, hasPendingLayoutGuide]);
|
|
498
515
|
|
|
499
516
|
// 适配横屏进入面板的情况
|
|
500
517
|
useEffect(() => {
|
|
@@ -511,8 +528,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
511
528
|
const handDisablePlayerTap = useMemoizedFn(value => {
|
|
512
529
|
disablePlayerTap.current = !!value;
|
|
513
530
|
});
|
|
514
|
-
|
|
515
|
-
// 须在竖屏全屏 effect 之前注册,否则多目首帧 emit('disablePlayerTap') 时 listener 尚未挂载
|
|
516
531
|
useEffect(() => {
|
|
517
532
|
eventRef.current.on('disablePlayerTap', handDisablePlayerTap);
|
|
518
533
|
return () => {
|
|
@@ -522,17 +537,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
522
537
|
|
|
523
538
|
// 竖屏全屏副作用处理
|
|
524
539
|
useEffect(() => {
|
|
540
|
+
eventRef.current.emit('disablePlayerTap', false);
|
|
541
|
+
showComponents();
|
|
525
542
|
if (isVerticalFullLayout && screenType === 'vertical') {
|
|
526
|
-
// 竖屏全屏时,控件常驻显示
|
|
527
|
-
eventRef.current.emit(showAllComponent);
|
|
528
|
-
eventRef.current.emit('disablePlayerTap', true);
|
|
529
|
-
eventRef.current.emit(pauseTimeToHideAllComponent);
|
|
530
|
-
// 按宽填充,保证播放流宽度为屏幕宽度,高度自适应设为1倍
|
|
531
543
|
setScaleMultiple(1);
|
|
532
|
-
} else {
|
|
533
|
-
// 短屏或横屏时,恢复自动隐藏
|
|
534
|
-
eventRef.current.emit('disablePlayerTap', false);
|
|
535
|
-
showComponents();
|
|
536
544
|
}
|
|
537
545
|
}, [isVerticalFullLayout, screenType, playerFit]);
|
|
538
546
|
useEffect(() => {
|
|
@@ -691,14 +699,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
691
699
|
ipcTTTOperatorLog('hide: 调用停止录制方法');
|
|
692
700
|
setRecording(false, true);
|
|
693
701
|
setIntercom(false, true);
|
|
694
|
-
instance === null || instance === void 0 || instance.
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
702
|
+
instance === null || instance === void 0 || instance.stopRecordingOnUnload().then(async result => {
|
|
703
|
+
var _instance$multiLens, _instance$multiCamera;
|
|
704
|
+
const summary = await getCaptureResultSummary(result, {
|
|
705
|
+
multiLens: (_instance$multiLens = instance === null || instance === void 0 ? void 0 : instance.multiLens) !== null && _instance$multiLens !== void 0 ? _instance$multiLens : false,
|
|
706
|
+
lensIndices: instance === null || instance === void 0 || (_instance$multiCamera = instance.multiCameraCtx) === null || _instance$multiCamera === void 0 || (_instance$multiCamera = _instance$multiCamera.protocol) === null || _instance$multiCamera === void 0 || (_instance$multiCamera = _instance$multiCamera.split_info) === null || _instance$multiCamera === void 0 ? void 0 : _instance$multiCamera.map(lens => lens.index),
|
|
707
|
+
devId
|
|
708
|
+
});
|
|
709
|
+
ipcTTTOperatorLog(summary !== null && summary !== void 0 && summary.isMultiLens ? `hide: stop recording succeeded with ${summary.count} thumbnails` : 'hide: 调用停止录制方法成功');
|
|
710
|
+
}).catch(() => {
|
|
711
|
+
ipcTTTOperatorLog('hide: 调用停止录制方法失败');
|
|
702
712
|
});
|
|
703
713
|
ipcTTTOperatorLog('hide: 调用停止对讲方法');
|
|
704
714
|
instance === null || instance === void 0 || instance.IPCPlayerInstance.stopTalk({
|
|
@@ -922,7 +932,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
922
932
|
clearTimeout(timer.current);
|
|
923
933
|
timer.current = null;
|
|
924
934
|
}
|
|
925
|
-
if (!hasUserTappedPlayerRef.current) return;
|
|
935
|
+
if (!hasUserTappedPlayerRef.current || hasVisibleGuideTip) return;
|
|
926
936
|
timer.current = setTimeout(onTimeout, HIDE_COMPONENT_TIME);
|
|
927
937
|
});
|
|
928
938
|
|
|
@@ -951,9 +961,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
951
961
|
const listenStart = useMemoizedFn(() => {
|
|
952
962
|
// 重新开始计时(用户还没点过画面时不启动,见 startHideTimer)
|
|
953
963
|
startHideTimer(() => {
|
|
954
|
-
// 定时器触发时从 store 读最新状态,避免启动时闭包拿到过期的 isVerticalFullLayout
|
|
955
|
-
const store = getDefaultStore();
|
|
956
|
-
if (store.get(instance.isVerticalFullLayout) && store.get(instance.screenType) === 'vertical') return;
|
|
957
964
|
triggerEvent(hideAllComponent);
|
|
958
965
|
});
|
|
959
966
|
});
|
|
@@ -968,6 +975,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
968
975
|
if (isHidingByTapRef.current) return;
|
|
969
976
|
setComponentHideState(false);
|
|
970
977
|
});
|
|
978
|
+
useEffect(() => {
|
|
979
|
+
if (hasVisibleGuideTip) {
|
|
980
|
+
showComponents();
|
|
981
|
+
} else {
|
|
982
|
+
listenStart();
|
|
983
|
+
}
|
|
984
|
+
}, [hasVisibleGuideTip]);
|
|
971
985
|
const onChangeIgnoreHideStopPreview = state => {
|
|
972
986
|
setIgnoreStopOnHide(state);
|
|
973
987
|
};
|
|
@@ -1091,32 +1105,23 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1091
1105
|
return false;
|
|
1092
1106
|
});
|
|
1093
1107
|
const playerContainerHeight = screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh';
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1096
|
-
const viewport = getPlayerViewport(renderMode, isVerticalFullMode, playerContainerHeight);
|
|
1097
|
-
return /*#__PURE__*/React.createElement(PlayerRenderModeContext.Provider, {
|
|
1098
|
-
value: renderMode
|
|
1099
|
-
}, /*#__PURE__*/React.createElement(LynxPlayerAdaptersContext.Provider, {
|
|
1100
|
-
value: props.lynxAdapters || {}
|
|
1101
|
-
}, /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
1108
|
+
const bottomHideState = isVerticalFullLayout && screenType === 'vertical' ? false : componentHideState;
|
|
1109
|
+
return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
1102
1110
|
value: {
|
|
1103
1111
|
event: eventRef.current,
|
|
1104
1112
|
componentHideState,
|
|
1105
1113
|
refreshElement
|
|
1106
1114
|
}
|
|
1107
1115
|
}, /*#__PURE__*/React.createElement(View, {
|
|
1108
|
-
className: clsx('ipc-player-content',
|
|
1116
|
+
className: clsx('ipc-player-content', isSmallScreen && 'ipc-player-content-small-screen', className),
|
|
1109
1117
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
|
|
1110
1118
|
height: playerContainerHeight
|
|
1111
|
-
}
|
|
1112
|
-
backgroundColor: '#000'
|
|
1113
|
-
} : {})
|
|
1119
|
+
})
|
|
1114
1120
|
}, /*#__PURE__*/React.createElement(View, {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
} : {}, {
|
|
1121
|
+
style: {
|
|
1122
|
+
height: isVerticalFullLayout && screenType === 'vertical' ? `calc(${playerContainerHeight} - 48px)` : playerContainerHeight
|
|
1123
|
+
}
|
|
1124
|
+
}, /*#__PURE__*/React.createElement(IPCPlayer, {
|
|
1120
1125
|
defaultMute: mute,
|
|
1121
1126
|
devId: devId,
|
|
1122
1127
|
onlineStatus: deviceOnline,
|
|
@@ -1128,6 +1133,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1128
1133
|
onCtx: res => {
|
|
1129
1134
|
if (res) {
|
|
1130
1135
|
setCreateCtx(true);
|
|
1136
|
+
if (instance.multiCameraCtx.isSupport) {
|
|
1137
|
+
instance.multiCameraCtx.showLenNames(!componentHideState);
|
|
1138
|
+
}
|
|
1131
1139
|
}
|
|
1132
1140
|
}
|
|
1133
1141
|
// onPlayerTap={handlePlayerClick}
|
|
@@ -1135,7 +1143,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1135
1143
|
onCameraNotifyWeakNetwork: data => {
|
|
1136
1144
|
console.log(`onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`);
|
|
1137
1145
|
},
|
|
1138
|
-
clarity: decodeClarityDic[
|
|
1146
|
+
clarity: decodeClarityDic[resolution],
|
|
1139
1147
|
onZoomChange: onZoomChange
|
|
1140
1148
|
// objectFit={
|
|
1141
1149
|
// screenType === 'vertical'
|
|
@@ -1149,7 +1157,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1149
1157
|
// scaleMultiple={0}
|
|
1150
1158
|
,
|
|
1151
1159
|
awakeStatus: awakeStatus,
|
|
1152
|
-
objectFit:
|
|
1160
|
+
objectFit: "fillCrop",
|
|
1153
1161
|
scaleMultiple: scaleMultiple
|
|
1154
1162
|
// 安卓横屏问题
|
|
1155
1163
|
// ptzControllable={screenType === 'vertical'}
|
|
@@ -1158,9 +1166,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1158
1166
|
onPlayerTap: data => {
|
|
1159
1167
|
console.log('playerTap event');
|
|
1160
1168
|
if (disablePlayerTap.current) {
|
|
1161
|
-
//
|
|
1162
|
-
// 但用户确实点了画面这个事实仍要派发出去 —— 转盘、PTZ 这类浮层靠它收起。
|
|
1163
|
-
// 不派发的话,竖屏全屏下点播放器关不掉转盘(普通竖屏可以,因为那时没禁用)。
|
|
1169
|
+
// Host overlays may disable toggling; popups still need the tap notification.
|
|
1164
1170
|
console.log('playerTap 事件已禁止显隐切换,仅派发 tap 通知浮层');
|
|
1165
1171
|
eventRef.current.emit(playerTap);
|
|
1166
1172
|
return;
|
|
@@ -1169,17 +1175,17 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1169
1175
|
// 这一下起,自动隐藏倒计时才开始生效
|
|
1170
1176
|
hasUserTappedPlayerRef.current = true;
|
|
1171
1177
|
if (instance.multiCameraCtx.isSupport) {
|
|
1172
|
-
var _instance$
|
|
1173
|
-
const preTapIndex = (_instance$
|
|
1178
|
+
var _instance$multiCamera2, _instance$multiCamera3;
|
|
1179
|
+
const preTapIndex = (_instance$multiCamera2 = (_instance$multiCamera3 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera3 === void 0 ? void 0 : _instance$multiCamera3.index) !== null && _instance$multiCamera2 !== void 0 ? _instance$multiCamera2 : prevSelectedIndexRef.current;
|
|
1174
1180
|
const wasHidden = componentHideState;
|
|
1175
1181
|
instance.multiCameraCtx.selectVideoFiredRef.current = false;
|
|
1176
1182
|
if (multiTapTimerRef.current) {
|
|
1177
1183
|
clearTimeout(multiTapTimerRef.current);
|
|
1178
1184
|
}
|
|
1179
1185
|
multiTapTimerRef.current = setTimeout(() => {
|
|
1180
|
-
var _instance$
|
|
1186
|
+
var _instance$multiCamera4, _instance$multiCamera5;
|
|
1181
1187
|
const selectFired = !!instance.multiCameraCtx.selectVideoFiredRef.current;
|
|
1182
|
-
const currentIndex = (_instance$
|
|
1188
|
+
const currentIndex = (_instance$multiCamera4 = (_instance$multiCamera5 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera5 === void 0 ? void 0 : _instance$multiCamera5.index) !== null && _instance$multiCamera4 !== void 0 ? _instance$multiCamera4 : preTapIndex;
|
|
1183
1189
|
if (selectFired && currentIndex === preTapIndex) {
|
|
1184
1190
|
if (wasHidden) {
|
|
1185
1191
|
showComponents();
|
|
@@ -1231,11 +1237,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1231
1237
|
limitFlow: limitFlow,
|
|
1232
1238
|
autoWakeUp: autoWakeUp,
|
|
1233
1239
|
extend: _objectSpread(_objectSpread({
|
|
1234
|
-
backgroundColor:
|
|
1240
|
+
backgroundColor: '#262626'
|
|
1235
1241
|
}, instance.multiCameraCtx.extendProps), extend)
|
|
1236
|
-
}))
|
|
1237
|
-
value: !componentHideState && !refreshElement
|
|
1238
|
-
}, showTopContent && /*#__PURE__*/React.createElement(View, {
|
|
1242
|
+
})), showTopContent && /*#__PURE__*/React.createElement(View, {
|
|
1239
1243
|
className: clsx('ipc-player-top-content', {
|
|
1240
1244
|
'ipc-player-top-content-hide': componentHideState,
|
|
1241
1245
|
'ipc-player-top-content-show': !componentHideState
|
|
@@ -1249,37 +1253,45 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1249
1253
|
ctx: instance
|
|
1250
1254
|
}, renderTopRightContent, !hasVisibleBitrateWidget && /*#__PURE__*/React.createElement(AutoClarityOnly, {
|
|
1251
1255
|
instance: instance
|
|
1252
|
-
})))), /*#__PURE__*/React.createElement(
|
|
1256
|
+
})))), /*#__PURE__*/React.createElement(StandaloneAutoClarity, {
|
|
1257
|
+
instance: instance,
|
|
1258
|
+
show: !showTopContent || componentHideState || !playerReady
|
|
1259
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
1253
1260
|
className: clsx('ipc-player-bottom-content', {
|
|
1254
|
-
'ipc-player-bottom-content-hide':
|
|
1255
|
-
'ipc-player-bottom-content-show': !
|
|
1256
|
-
'ipc-player-bottom-content-full':
|
|
1261
|
+
'ipc-player-bottom-content-hide': bottomHideState,
|
|
1262
|
+
'ipc-player-bottom-content-show': !bottomHideState,
|
|
1263
|
+
'ipc-player-bottom-content-full': isVerticalFullLayout && screenType === 'vertical'
|
|
1257
1264
|
}),
|
|
1258
|
-
style:
|
|
1265
|
+
style: {
|
|
1259
1266
|
height: screenType === 'vertical' ? '48px' : '72px'
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1267
|
+
}
|
|
1268
|
+
}, /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
1269
|
+
value: {
|
|
1270
|
+
event: eventRef.current,
|
|
1271
|
+
componentHideState: bottomHideState,
|
|
1272
|
+
refreshElement
|
|
1273
|
+
}
|
|
1274
|
+
}, /*#__PURE__*/React.createElement(BottomLeftContent, {
|
|
1264
1275
|
ctx: instance,
|
|
1265
1276
|
reservedRight: bottomRightReserved
|
|
1266
1277
|
}, renderBottomLeftContent), /*#__PURE__*/React.createElement(BottomRightContent, {
|
|
1267
1278
|
ctx: instance,
|
|
1268
1279
|
width: bottomRightStyleWidth,
|
|
1269
1280
|
onWidthChange: handleBottomRightWidthChange
|
|
1270
|
-
}, renderBottomRightContent)))
|
|
1271
|
-
instance: instance,
|
|
1272
|
-
show: !showTopContent || componentHideState || !playerReady
|
|
1273
|
-
}), (() => {
|
|
1281
|
+
}, renderBottomRightContent))), (() => {
|
|
1274
1282
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
1275
1283
|
return absoluteContent.map(item => {
|
|
1276
|
-
if (item
|
|
1284
|
+
if (!shouldRenderContent(item, {
|
|
1285
|
+
playState
|
|
1286
|
+
})) return null;
|
|
1287
|
+
if (item.id === tileActionsId && isVerticalFullLayout && componentHideState) return null;
|
|
1288
|
+
const contentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
1289
|
+
key: item.id
|
|
1290
|
+
}, item.initProps), instance), {}, {
|
|
1291
|
+
IPCPlayerContext: instance.IPCPlayerInstance
|
|
1292
|
+
});
|
|
1277
1293
|
if (item.absoluteNoCoverView) {
|
|
1278
|
-
return /*#__PURE__*/React.createElement(item.content,
|
|
1279
|
-
key: item.id
|
|
1280
|
-
}, item.initProps), instance), {}, {
|
|
1281
|
-
IPCPlayerContext: instance.IPCPlayerInstance
|
|
1282
|
-
}));
|
|
1294
|
+
return /*#__PURE__*/React.createElement(item.content, contentProps);
|
|
1283
1295
|
}
|
|
1284
1296
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
1285
1297
|
key: item.id,
|
|
@@ -1287,13 +1299,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1287
1299
|
position: 'absolute'
|
|
1288
1300
|
}, item.absolutePosition),
|
|
1289
1301
|
className: item.absoluteContentClassName
|
|
1290
|
-
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(
|
|
1291
|
-
key: item.id
|
|
1292
|
-
}, item.initProps), instance), {}, {
|
|
1293
|
-
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
1302
|
+
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
1294
1303
|
// 添加通用变量单独组件类名
|
|
1295
1304
|
className: clsx('absolute-item-container')
|
|
1296
1305
|
})));
|
|
1297
1306
|
});
|
|
1298
|
-
})()))
|
|
1307
|
+
})()));
|
|
1299
1308
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CaptureResult } from '../interface';
|
|
2
|
+
export type CaptureResultSummary = {
|
|
3
|
+
count: number;
|
|
4
|
+
isMultiLens: boolean;
|
|
5
|
+
thumbnailPath: string;
|
|
6
|
+
};
|
|
7
|
+
export type CaptureResultOptions = {
|
|
8
|
+
multiLens: boolean;
|
|
9
|
+
lensIndices?: number[];
|
|
10
|
+
devId: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function getCaptureResultSummary(result: CaptureResult, { multiLens, lensIndices, devId }: CaptureResultOptions): Promise<CaptureResultSummary | null>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
4
|
+
/* eslint-disable camelcase */
|
|
5
|
+
import { getFileSystemManager } from '@ray-js/ray';
|
|
6
|
+
import { getDeviceInfo } from './device';
|
|
7
|
+
const MULTI_LENS_ABILITY_CODE = 'tyabimr4v3';
|
|
8
|
+
const LENS_SUFFIX_PATTERN = /_lens\d+(?=\.[^./?#]+(?:[?#].*)?$)/;
|
|
9
|
+
const FILE_EXTENSION_PATTERN = /(\.[^./?#]+)([?#].*)?$/;
|
|
10
|
+
const getMultiLensIndices = async devId => {
|
|
11
|
+
try {
|
|
12
|
+
var _devInfo$configMetas, _config$split_info;
|
|
13
|
+
const devInfo = await getDeviceInfo(devId);
|
|
14
|
+
const raw = devInfo === null || devInfo === void 0 || (_devInfo$configMetas = devInfo.configMetas) === null || _devInfo$configMetas === void 0 ? void 0 : _devInfo$configMetas[MULTI_LENS_ABILITY_CODE];
|
|
15
|
+
const config = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
16
|
+
return (config === null || config === void 0 || (_config$split_info = config.split_info) === null || _config$split_info === void 0 ? void 0 : _config$split_info.map(item => Number(item.index))) || [];
|
|
17
|
+
} catch {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const getLensPath = (path, index) => path.replace(LENS_SUFFIX_PATTERN, '').replace(FILE_EXTENSION_PATTERN, `_lens${index}$1$2`);
|
|
22
|
+
const extractPath = item => {
|
|
23
|
+
if (typeof item === 'string') return item;
|
|
24
|
+
if (typeof (item === null || item === void 0 ? void 0 : item.value) === 'string') return item.value;
|
|
25
|
+
return '';
|
|
26
|
+
};
|
|
27
|
+
const imageExists = async path => {
|
|
28
|
+
if (!path) return false;
|
|
29
|
+
try {
|
|
30
|
+
const manager = await getFileSystemManager();
|
|
31
|
+
return await new Promise(resolve => {
|
|
32
|
+
manager.access({
|
|
33
|
+
path,
|
|
34
|
+
success: () => resolve(true),
|
|
35
|
+
fail: () => resolve(false)
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
} catch {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export async function getCaptureResultSummary(result, _ref) {
|
|
43
|
+
let {
|
|
44
|
+
multiLens,
|
|
45
|
+
lensIndices,
|
|
46
|
+
devId
|
|
47
|
+
} = _ref;
|
|
48
|
+
if (!result || typeof result === 'boolean') return null;
|
|
49
|
+
if (!multiLens) {
|
|
50
|
+
return {
|
|
51
|
+
count: 1,
|
|
52
|
+
isMultiLens: false,
|
|
53
|
+
thumbnailPath: extractPath(result.tempImagePath) || extractPath(result.thumbPath) || extractPath(result.filePath)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const thumbnailPath = extractPath(result.thumbPath) || extractPath(result.tempImagePath);
|
|
57
|
+
if (!thumbnailPath) return null;
|
|
58
|
+
const indices = [...new Set(lensIndices !== null && lensIndices !== void 0 && lensIndices.length ? lensIndices : await getMultiLensIndices(devId))];
|
|
59
|
+
const thumbnails = await Promise.all(indices.map(async index => {
|
|
60
|
+
const path = getLensPath(thumbnailPath, index);
|
|
61
|
+
return (await imageExists(path)) ? path : '';
|
|
62
|
+
}));
|
|
63
|
+
const existingThumbnails = thumbnails.filter(Boolean);
|
|
64
|
+
if (!existingThumbnails.length) return null;
|
|
65
|
+
return {
|
|
66
|
+
count: existingThumbnails.length,
|
|
67
|
+
isMultiLens: true,
|
|
68
|
+
thumbnailPath: existingThumbnails[0]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|