@ray-js/ipc-player-integration 0.0.1-beta-66 → 0.0.1-beta-68
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 +4 -17
- package/package.json +1 -1
package/lib/ui/ui.js
CHANGED
|
@@ -67,8 +67,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
67
67
|
setVerticalMic
|
|
68
68
|
} = instance;
|
|
69
69
|
const prevTriggerEvent = useRef();
|
|
70
|
-
const landscapeModeRef = useRef(landscapeMode);
|
|
71
|
-
const playerFitRef = useRef(playerFit);
|
|
72
70
|
/*
|
|
73
71
|
player 的UI效果期望有一些控件在初始化的时候都展示,在点击 Player 之后隐藏:
|
|
74
72
|
在控件显示时,点击播放器期望隐藏控件
|
|
@@ -85,20 +83,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
85
83
|
const timer = useRef();
|
|
86
84
|
const [scaleMultiple, setScaleMultiple] = useState(playerFit === 'contain' ? 1 : -2);
|
|
87
85
|
const [currentZoomLevel, setCurrentZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
88
|
-
|
|
89
|
-
// 监听playerMode的变化,更新scaleMultiple
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
setScaleMultiple(playerFit === 'contain' ? 1 : -2);
|
|
92
|
-
setCurrentZoomLevel(playerFit === 'contain' ? 1 : -2);
|
|
93
|
-
}, [playerFit]);
|
|
94
86
|
useEffect(() => {
|
|
95
87
|
setBrandColor(brandColor);
|
|
96
88
|
setVerticalMic(verticalMic);
|
|
97
89
|
}, []);
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
landscapeModeRef.current = landscapeMode;
|
|
100
|
-
playerFitRef.current = playerFit;
|
|
101
|
-
}, [landscapeMode, playerFit]);
|
|
102
90
|
const refreshBottomLeft = () => {
|
|
103
91
|
event.current.emit(startTimeToHideAllComponent);
|
|
104
92
|
event.current.emit(showAllComponent);
|
|
@@ -108,7 +96,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
108
96
|
/**
|
|
109
97
|
* 监听屏幕布局变化
|
|
110
98
|
*/
|
|
111
|
-
usePageEvent('onResize', sizeData => {
|
|
99
|
+
usePageEvent('onResize', useMemoizedFn(sizeData => {
|
|
112
100
|
try {
|
|
113
101
|
const {
|
|
114
102
|
type
|
|
@@ -127,17 +115,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
127
115
|
}
|
|
128
116
|
|
|
129
117
|
// 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
|
|
130
|
-
if (type === 'landscape' &&
|
|
131
|
-
console.log(landscapeModeRef, 'landscapeModeRef');
|
|
118
|
+
if (type === 'landscape' && landscapeMode === 'fill') {
|
|
132
119
|
setScaleMultiple(-1);
|
|
133
120
|
} else {
|
|
134
121
|
// 将屏幕播放比例设为1
|
|
135
|
-
setScaleMultiple(
|
|
122
|
+
setScaleMultiple(playerFit === 'contain' ? 1 : -2);
|
|
136
123
|
}
|
|
137
124
|
} catch (err) {
|
|
138
125
|
console.log(err, 'err');
|
|
139
126
|
}
|
|
140
|
-
});
|
|
127
|
+
}));
|
|
141
128
|
const systemInfo = useRef(null);
|
|
142
129
|
if (!systemInfo.current) {
|
|
143
130
|
systemInfo.current = getSystemInfoSync();
|