@ray-js/ipc-player-integration 0.0.65-beta.0 → 0.0.65-beta.1
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/ui/ui.js
CHANGED
|
@@ -14,15 +14,15 @@ import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
|
|
|
14
14
|
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
15
15
|
import { PlayState, PlayerStreamStatus, MultiCameraScreenMode } from '../interface';
|
|
16
16
|
import { useCtx } from '../ctx/ctx.composition';
|
|
17
|
-
import { useStore, updateAtom
|
|
17
|
+
import { useStore, updateAtom } from '../ctx/store';
|
|
18
18
|
import { UIEventContext } from './context';
|
|
19
|
-
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';
|
|
20
20
|
import BottomLeftContent from './bottomLeftContent';
|
|
21
21
|
import BottomRightContent from './bottomRightContent';
|
|
22
22
|
import TopLeftContent from './topLeftContent';
|
|
23
23
|
import TopRightContent from './topRightContent';
|
|
24
24
|
import { useOfflineShownNotification } from './useOfflineShownNotification';
|
|
25
|
-
import { FlowLowTip, VideoBitKBP } from '../widgets';
|
|
25
|
+
import { FlowLowTip, VideoBitKBP, zoomTurntableTipId } from '../widgets';
|
|
26
26
|
import { useMemoizedFn } from '../hooks';
|
|
27
27
|
import { Storage } from '../utils/storage';
|
|
28
28
|
import './ui.less';
|
|
@@ -331,6 +331,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
331
331
|
maxZoomSettings: instance.maxZoomSettings,
|
|
332
332
|
zoomSkill: instance.zoomSkill
|
|
333
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
|
+
}));
|
|
334
337
|
|
|
335
338
|
// 默认最大缩放倍数下发给播放器;多镜头设备的上限要按当前镜头换算,交给 zoomTurntable 下发
|
|
336
339
|
useEffect(() => {
|
|
@@ -456,13 +459,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
456
459
|
instance.multiCameraCtx.getNextLayoutStyle().then(res => {
|
|
457
460
|
instance.multiCameraCtx.setNextLayoutStyle(res);
|
|
458
461
|
});
|
|
462
|
+
if (isVerticalFullLayout && screenType === 'vertical') {
|
|
463
|
+
showComponents();
|
|
464
|
+
}
|
|
459
465
|
}, [layoutStyle, screenMode, instance]);
|
|
460
466
|
useEffect(() => {
|
|
461
467
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
462
468
|
|
|
463
469
|
// 组件隐藏时也隐藏镜头名
|
|
464
470
|
instance.multiCameraCtx.showLenNames(!componentHideState);
|
|
465
|
-
}, [componentHideState, instance]);
|
|
471
|
+
}, [componentHideState, instance, layoutStyle, screenMode]);
|
|
466
472
|
useEffect(() => {
|
|
467
473
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
468
474
|
if (ptzStatus) {
|
|
@@ -473,7 +479,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
473
479
|
}, [instance, ptzStatus]);
|
|
474
480
|
useEffect(() => {
|
|
475
481
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
476
|
-
if (!ptzStatus || screenMode !== MultiCameraScreenMode.full) {
|
|
482
|
+
if (!ptzStatus || screenMode !== MultiCameraScreenMode.full || componentHideState) {
|
|
477
483
|
instance.hideContent('absolute', ptzMoveableTipId);
|
|
478
484
|
}
|
|
479
485
|
|
|
@@ -487,7 +493,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
487
493
|
|
|
488
494
|
// ptz 提示
|
|
489
495
|
const storage = new Storage(devId);
|
|
490
|
-
if (!storage.getSync(ptzMoveableTipId) && selectedLenInfo.supportPTZ && screenMode === MultiCameraScreenMode.full) {
|
|
496
|
+
if (!storage.getSync(ptzMoveableTipId) && !componentHideState && selectedLenInfo.supportPTZ && screenMode === MultiCameraScreenMode.full) {
|
|
491
497
|
instance.showContent('absolute', ptzMoveableTipId);
|
|
492
498
|
}
|
|
493
499
|
}
|
|
@@ -508,8 +514,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
508
514
|
const handDisablePlayerTap = useMemoizedFn(value => {
|
|
509
515
|
disablePlayerTap.current = !!value;
|
|
510
516
|
});
|
|
511
|
-
|
|
512
|
-
// 须在竖屏全屏 effect 之前注册,否则多目首帧 emit('disablePlayerTap') 时 listener 尚未挂载
|
|
513
517
|
useEffect(() => {
|
|
514
518
|
eventRef.current.on('disablePlayerTap', handDisablePlayerTap);
|
|
515
519
|
return () => {
|
|
@@ -519,17 +523,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
519
523
|
|
|
520
524
|
// 竖屏全屏副作用处理
|
|
521
525
|
useEffect(() => {
|
|
526
|
+
eventRef.current.emit('disablePlayerTap', false);
|
|
527
|
+
showComponents();
|
|
522
528
|
if (isVerticalFullLayout && screenType === 'vertical') {
|
|
523
|
-
// 竖屏全屏时,控件常驻显示
|
|
524
|
-
eventRef.current.emit(showAllComponent);
|
|
525
|
-
eventRef.current.emit('disablePlayerTap', true);
|
|
526
|
-
eventRef.current.emit(pauseTimeToHideAllComponent);
|
|
527
|
-
// 按宽填充,保证播放流宽度为屏幕宽度,高度自适应设为1倍
|
|
528
529
|
setScaleMultiple(1);
|
|
529
|
-
} else {
|
|
530
|
-
// 短屏或横屏时,恢复自动隐藏
|
|
531
|
-
eventRef.current.emit('disablePlayerTap', false);
|
|
532
|
-
showComponents();
|
|
533
530
|
}
|
|
534
531
|
}, [isVerticalFullLayout, screenType, playerFit]);
|
|
535
532
|
useEffect(() => {
|
|
@@ -921,7 +918,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
921
918
|
clearTimeout(timer.current);
|
|
922
919
|
timer.current = null;
|
|
923
920
|
}
|
|
924
|
-
if (!hasUserTappedPlayerRef.current) return;
|
|
921
|
+
if (!hasUserTappedPlayerRef.current || hasVisibleGuideTip) return;
|
|
925
922
|
timer.current = setTimeout(onTimeout, HIDE_COMPONENT_TIME);
|
|
926
923
|
});
|
|
927
924
|
|
|
@@ -950,9 +947,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
950
947
|
const listenStart = useMemoizedFn(() => {
|
|
951
948
|
// 重新开始计时(用户还没点过画面时不启动,见 startHideTimer)
|
|
952
949
|
startHideTimer(() => {
|
|
953
|
-
// 定时器触发时从 store 读最新状态,避免启动时闭包拿到过期的 isVerticalFullLayout
|
|
954
|
-
const store = getDefaultStore();
|
|
955
|
-
if (store.get(instance.isVerticalFullLayout) && store.get(instance.screenType) === 'vertical') return;
|
|
956
950
|
triggerEvent(hideAllComponent);
|
|
957
951
|
});
|
|
958
952
|
});
|
|
@@ -967,6 +961,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
967
961
|
if (isHidingByTapRef.current) return;
|
|
968
962
|
setComponentHideState(false);
|
|
969
963
|
});
|
|
964
|
+
useEffect(() => {
|
|
965
|
+
if (hasVisibleGuideTip) {
|
|
966
|
+
showComponents();
|
|
967
|
+
} else {
|
|
968
|
+
listenStart();
|
|
969
|
+
}
|
|
970
|
+
}, [hasVisibleGuideTip]);
|
|
970
971
|
const onChangeIgnoreHideStopPreview = state => {
|
|
971
972
|
setIgnoreStopOnHide(state);
|
|
972
973
|
};
|
|
@@ -1090,7 +1091,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1090
1091
|
return false;
|
|
1091
1092
|
});
|
|
1092
1093
|
const playerContainerHeight = screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh';
|
|
1093
|
-
const
|
|
1094
|
+
const bottomHideState = isVerticalFullLayout && screenType === 'vertical' ? false : componentHideState;
|
|
1094
1095
|
return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
1095
1096
|
value: {
|
|
1096
1097
|
event: eventRef.current,
|
|
@@ -1104,7 +1105,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1104
1105
|
})
|
|
1105
1106
|
}, /*#__PURE__*/React.createElement(View, {
|
|
1106
1107
|
style: {
|
|
1107
|
-
height:
|
|
1108
|
+
height: isVerticalFullLayout && screenType === 'vertical' ? `calc(${playerContainerHeight} - 48px)` : playerContainerHeight
|
|
1108
1109
|
}
|
|
1109
1110
|
}, /*#__PURE__*/React.createElement(IPCPlayer, {
|
|
1110
1111
|
defaultMute: mute,
|
|
@@ -1118,6 +1119,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1118
1119
|
onCtx: res => {
|
|
1119
1120
|
if (res) {
|
|
1120
1121
|
setCreateCtx(true);
|
|
1122
|
+
if (instance.multiCameraCtx.isSupport) {
|
|
1123
|
+
instance.multiCameraCtx.showLenNames(!componentHideState);
|
|
1124
|
+
}
|
|
1121
1125
|
}
|
|
1122
1126
|
}
|
|
1123
1127
|
// onPlayerTap={handlePlayerClick}
|
|
@@ -1148,9 +1152,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1148
1152
|
onPlayerTap: data => {
|
|
1149
1153
|
console.log('playerTap event');
|
|
1150
1154
|
if (disablePlayerTap.current) {
|
|
1151
|
-
//
|
|
1152
|
-
// 但用户确实点了画面这个事实仍要派发出去 —— 转盘、PTZ 这类浮层靠它收起。
|
|
1153
|
-
// 不派发的话,竖屏全屏下点播放器关不掉转盘(普通竖屏可以,因为那时没禁用)。
|
|
1155
|
+
// Host overlays may disable toggling; popups still need the tap notification.
|
|
1154
1156
|
console.log('playerTap 事件已禁止显隐切换,仅派发 tap 通知浮层');
|
|
1155
1157
|
eventRef.current.emit(playerTap);
|
|
1156
1158
|
return;
|
|
@@ -1242,14 +1244,20 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1242
1244
|
show: !showTopContent || componentHideState || !playerReady
|
|
1243
1245
|
}), /*#__PURE__*/React.createElement(View, {
|
|
1244
1246
|
className: clsx('ipc-player-bottom-content', {
|
|
1245
|
-
'ipc-player-bottom-content-hide':
|
|
1246
|
-
'ipc-player-bottom-content-show': !
|
|
1247
|
-
'ipc-player-bottom-content-full':
|
|
1247
|
+
'ipc-player-bottom-content-hide': bottomHideState,
|
|
1248
|
+
'ipc-player-bottom-content-show': !bottomHideState,
|
|
1249
|
+
'ipc-player-bottom-content-full': isVerticalFullLayout && screenType === 'vertical'
|
|
1248
1250
|
}),
|
|
1249
1251
|
style: {
|
|
1250
1252
|
height: screenType === 'vertical' ? '48px' : '72px'
|
|
1251
1253
|
}
|
|
1252
|
-
}, /*#__PURE__*/React.createElement(
|
|
1254
|
+
}, /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
1255
|
+
value: {
|
|
1256
|
+
event: eventRef.current,
|
|
1257
|
+
componentHideState: bottomHideState,
|
|
1258
|
+
refreshElement
|
|
1259
|
+
}
|
|
1260
|
+
}, /*#__PURE__*/React.createElement(BottomLeftContent, {
|
|
1253
1261
|
ctx: instance,
|
|
1254
1262
|
reservedRight: bottomRightReserved
|
|
1255
1263
|
}, renderBottomLeftContent), /*#__PURE__*/React.createElement(BottomRightContent, {
|
|
@@ -1262,6 +1270,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1262
1270
|
if (!shouldRenderContent(item, {
|
|
1263
1271
|
playState
|
|
1264
1272
|
})) return null;
|
|
1273
|
+
if (item.id === tileActionsId && isVerticalFullLayout && componentHideState) return null;
|
|
1265
1274
|
const contentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
1266
1275
|
key: item.id
|
|
1267
1276
|
}, item.initProps), instance), {}, {
|
|
@@ -390,7 +390,7 @@ export const MoveablePtzControlItem = props => {
|
|
|
390
390
|
ptzData: selectedLenInfo.supportPTZ ? ptzData : [],
|
|
391
391
|
onTouchPtzStart: onTouchPtzStart,
|
|
392
392
|
onTouchPtzEnd: async () => {
|
|
393
|
-
screenMode
|
|
393
|
+
screenMode !== MultiCameraScreenMode.short && event.emit(startTimeToHideAllComponent);
|
|
394
394
|
const stopConfig = dpSupportMap.ipc_multi_ptz_control ? {
|
|
395
395
|
code: 'ipc_multi_ptz_stop',
|
|
396
396
|
value: JSON.stringify({
|
|
@@ -415,7 +415,7 @@ export const MoveablePtzControlItem = props => {
|
|
|
415
415
|
},
|
|
416
416
|
onTouchZoomStart: onTouchZoomStart,
|
|
417
417
|
onTouchZoomEnd: async () => {
|
|
418
|
-
screenMode
|
|
418
|
+
screenMode !== MultiCameraScreenMode.short && event.emit(startTimeToHideAllComponent);
|
|
419
419
|
const stopConfig = dpSupportMap.ipc_multi_zoom_control ? {
|
|
420
420
|
code: 'ipc_multi_zoom_stop',
|
|
421
421
|
value: JSON.stringify({
|
|
@@ -464,10 +464,10 @@ export const MoveablePtzControl = props => {
|
|
|
464
464
|
// 处理因为状态更新不同步导致的闪烁问题
|
|
465
465
|
const activeViewRef = useRef(0);
|
|
466
466
|
const onDragStart = () => {
|
|
467
|
-
screenMode
|
|
467
|
+
screenMode !== MultiCameraScreenMode.short && event.emit(pauseTimeToHideAllComponent);
|
|
468
468
|
};
|
|
469
469
|
const onDragEnd = data => {
|
|
470
|
-
screenMode
|
|
470
|
+
screenMode !== MultiCameraScreenMode.short && event.emit(startTimeToHideAllComponent);
|
|
471
471
|
activeViewRef.current = activeViewRef.current === 0 ? 1 : 0;
|
|
472
472
|
setStyle(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
473
473
|
positionLeft: data.positionLeft,
|