@ray-js/ipc-player-integration 0.0.49-beta.2 → 0.0.49-beta.4

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.
@@ -1,11 +1,12 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import "core-js/modules/esnext.iterator.constructor.js";
3
3
  import "core-js/modules/esnext.iterator.find.js";
4
- import React, { useEffect, useMemo, useRef, useState } from 'react';
4
+ import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { CoverView, ScrollView, View } from '@ray-js/ray';
6
6
  import clsx from 'clsx';
7
7
  import { useStore } from '../ctx/store';
8
8
  import { useComponentHideState } from './hooks';
9
+ import { UIEventContext } from './context';
9
10
  import { TrialBadge, useTrialBadge } from '../widgets/trialBadge';
10
11
  import { pauseTimeToHideAllComponent, startTimeToHideAllComponent } from './constant';
11
12
 
@@ -59,6 +60,11 @@ const BottomLeftContent = _ref => {
59
60
  return (_gRawData = tryExp === null || tryExp === void 0 || (_tryExp$initProps5 = tryExp.initProps) === null || _tryExp$initProps5 === void 0 ? void 0 : _tryExp$initProps5.gRawData) !== null && _gRawData !== void 0 ? _gRawData : false;
60
61
  }, [bottomLeftContent]);
61
62
  const [shouldHide] = useComponentHideState();
63
+ // 透明隐藏只跟随真实隐藏态:refreshElement 重测脉冲仍走 shouldHide 驱动 ±1px 高度,
64
+ // 但不应把工具栏短暂隐掉,否则缩起/展开等触发重测时会肉眼可见地闪一下
65
+ const {
66
+ componentHideState
67
+ } = useContext(UIEventContext);
62
68
  const {
63
69
  showTrialBadge,
64
70
  handleTrialSubscribe,
@@ -231,8 +237,8 @@ const BottomLeftContent = _ref => {
231
237
  display: 'flex',
232
238
  flexDirection: 'column',
233
239
  justifyContent: 'flex-start',
234
- opacity: shouldHide ? 0 : 1,
235
- pointerEvents: shouldHide ? 'none' : 'auto'
240
+ opacity: componentHideState ? 0 : 1,
241
+ pointerEvents: componentHideState ? 'none' : 'auto'
236
242
  }
237
243
  }, showBadge && /*#__PURE__*/React.createElement(View, {
238
244
  style: {
package/lib/ui/ui.js CHANGED
@@ -434,6 +434,18 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
434
434
  };
435
435
  }, [handDisablePlayerTap]);
436
436
 
437
+ // 缩起/展开后四角 CoverView 的原生热区不随布局高度变化重测,停留在旧位置吞掉点击(首次缩起必现);
438
+ // 复用 refreshElement 通道翻转各 wrap 的 ±1px 重排跟位。120ms:iOS 原生异步测量 50ms 内可能不落盘。
439
+ const [regionRefresh, setRegionRefresh] = useState(false);
440
+ useEffect(() => {
441
+ // 仅竖屏下发:缩起/展开只存在于竖屏;旋转进横屏也会翻转 isVerticalFullLayout,
442
+ // 脉冲会打断横屏 widget(ptz/对讲等)0.3s 出入场动画。从 store 同步读,避开 React 提交顺序竞态
443
+ if (getDefaultStore().get(instance.screenType) !== 'vertical') return undefined;
444
+ setRegionRefresh(true);
445
+ const nudgeTimer = setTimeout(() => setRegionRefresh(false), 120);
446
+ return () => clearTimeout(nudgeTimer);
447
+ }, [isVerticalFullLayout]);
448
+
437
449
  // 竖屏全屏副作用处理
438
450
  useEffect(() => {
439
451
  if (isVerticalFullLayout && screenType === 'vertical') {
@@ -577,25 +589,18 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
577
589
  } = sizeData;
578
590
 
579
591
  // 折叠屏展开/收起、pad 多窗口拖拽等场景,需要重新计算并同步
580
- const small = computeIsSmallScreen();
581
- setIsSmallScreen(small);
582
-
583
- // 针对pad 和折叠屏展开的情况暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
584
- if (small) {
585
- setScreenType('vertical');
586
- } else {
587
- setScreenType(type === 'landscape' ? 'full' : 'vertical');
588
- if (type === 'landscape') {
589
- // 记录切换横屏前的竖屏全屏状态
590
- prevVerticalFullLayoutRef.current = isVerticalFullLayout;
591
- // 横屏时重置竖屏全屏状态
592
- updateAtom(instance.isVerticalFullLayout, false);
593
- } else if (!instance.multiCameraCtx.isSupport) {
594
- // 单目设备从横屏切回竖屏时,恢复之前的竖屏全屏状态
595
- updateAtom(instance.isVerticalFullLayout, prevVerticalFullLayoutRef.current);
596
- }
597
- triggerEvent(showAllComponent);
592
+ setIsSmallScreen(computeIsSmallScreen());
593
+ setScreenType(type === 'landscape' ? 'full' : 'vertical');
594
+ if (type === 'landscape') {
595
+ // 记录切换横屏前的竖屏全屏状态
596
+ prevVerticalFullLayoutRef.current = isVerticalFullLayout;
597
+ // 横屏时重置竖屏全屏状态
598
+ updateAtom(instance.isVerticalFullLayout, false);
599
+ } else if (!instance.multiCameraCtx.isSupport) {
600
+ // 单目设备从横屏切回竖屏时,恢复之前的竖屏全屏状态
601
+ updateAtom(instance.isVerticalFullLayout, prevVerticalFullLayoutRef.current);
598
602
  }
603
+ triggerEvent(showAllComponent);
599
604
  // 横屏(fill/standard)与竖屏均统一调整为 1 倍缩放,保证画面完整展示
600
605
  setScaleMultiple(1);
601
606
  } catch (err) {
@@ -916,7 +921,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
916
921
  value: {
917
922
  event: eventRef.current,
918
923
  componentHideState,
919
- refreshElement
924
+ refreshElement: refreshElement || regionRefresh
920
925
  }
921
926
  }, /*#__PURE__*/React.createElement(View, {
922
927
  className: clsx('ipc-player-content', isSmallScreen && 'ipc-player-content-small-screen', className),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.49-beta.2",
3
+ "version": "0.0.49-beta.4",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [