@ray-js/ipc-player-integration 0.0.1-beta-64 → 0.0.1-beta-66

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.d.ts CHANGED
@@ -25,7 +25,7 @@ type Props = {
25
25
  brandColor?: string;
26
26
  verticalMic?: boolean;
27
27
  landscapeMode?: 'fill' | 'standard';
28
- playerMode: 'portrait' | 'landscape';
28
+ playerFit: 'contain' | 'cover';
29
29
  eventRef?: React.RefObject<EventInstance>;
30
30
  onPlayerTap?: (data: any) => void;
31
31
  extend?: Record<string, any>;
package/lib/ui/ui.js CHANGED
@@ -52,7 +52,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
52
52
  verticalMic = true,
53
53
  eventRef: eventRefProp,
54
54
  landscapeMode = 'standard',
55
- playerMode = 'portrait',
55
+ playerFit = 'contain',
56
56
  onPlayerTap,
57
57
  extend = {}
58
58
  } = props;
@@ -67,7 +67,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
67
67
  setVerticalMic
68
68
  } = instance;
69
69
  const prevTriggerEvent = useRef();
70
-
70
+ const landscapeModeRef = useRef(landscapeMode);
71
+ const playerFitRef = useRef(playerFit);
71
72
  /*
72
73
  player 的UI效果期望有一些控件在初始化的时候都展示,在点击 Player 之后隐藏:
73
74
  在控件显示时,点击播放器期望隐藏控件
@@ -82,18 +83,22 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
82
83
  }
83
84
  useImperativeHandle(eventRefProp, () => eventRef.current, [eventRef.current]);
84
85
  const timer = useRef();
85
- const [scaleMultiple, setScaleMultiple] = useState(playerMode === 'portrait' ? 1 : -2);
86
- const [currentZoomLevel, setCurrentZoomLevel] = useState(playerMode === 'portrait' ? 1 : -2);
86
+ const [scaleMultiple, setScaleMultiple] = useState(playerFit === 'contain' ? 1 : -2);
87
+ const [currentZoomLevel, setCurrentZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
87
88
 
88
89
  // 监听playerMode的变化,更新scaleMultiple
89
90
  useEffect(() => {
90
- setScaleMultiple(playerMode === 'portrait' ? 1 : -2);
91
- setCurrentZoomLevel(playerMode === 'portrait' ? 1 : -2);
92
- }, [playerMode]);
91
+ setScaleMultiple(playerFit === 'contain' ? 1 : -2);
92
+ setCurrentZoomLevel(playerFit === 'contain' ? 1 : -2);
93
+ }, [playerFit]);
93
94
  useEffect(() => {
94
95
  setBrandColor(brandColor);
95
96
  setVerticalMic(verticalMic);
96
97
  }, []);
98
+ useEffect(() => {
99
+ landscapeModeRef.current = landscapeMode;
100
+ playerFitRef.current = playerFit;
101
+ }, [landscapeMode, playerFit]);
97
102
  const refreshBottomLeft = () => {
98
103
  event.current.emit(startTimeToHideAllComponent);
99
104
  event.current.emit(showAllComponent);
@@ -122,12 +127,12 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
122
127
  }
123
128
 
124
129
  // 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
125
- if (type === 'landscape' && landscapeMode === 'fill') {
126
- console.log('横屏时充满');
130
+ if (type === 'landscape' && landscapeModeRef.current === 'fill') {
131
+ console.log(landscapeModeRef, 'landscapeModeRef');
127
132
  setScaleMultiple(-1);
128
133
  } else {
129
134
  // 将屏幕播放比例设为1
130
- setScaleMultiple(playerMode === 'portrait' ? 1 : -2);
135
+ setScaleMultiple(playerFitRef.current === 'contain' ? 1 : -2);
131
136
  }
132
137
  } catch (err) {
133
138
  console.log(err, 'err');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-64",
3
+ "version": "0.0.1-beta-66",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [