@ray-js/ipc-player-integration 0.0.18-beta-2 → 0.0.18-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.
- package/lib/ui/ui.js +56 -20
- package/package.json +1 -1
package/lib/ui/ui.js
CHANGED
|
@@ -126,32 +126,35 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
126
126
|
const {
|
|
127
127
|
orientation
|
|
128
128
|
} = ty.getOrientationSync();
|
|
129
|
+
console.log(`同步获取屏幕方向: ${orientation}`);
|
|
129
130
|
ipcTTTOperatorLog(`同步获取屏幕方向: ${orientation}`);
|
|
130
|
-
|
|
131
|
+
if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right', 'landscape'].includes(orientation)) {
|
|
132
|
+
const {
|
|
133
|
+
deviceType
|
|
134
|
+
} = systemInfo.current;
|
|
135
|
+
if (deviceType === 'pad') {
|
|
136
|
+
setScreenType('vertical');
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' || orientation === 'landscape' ? 'landscape' : 'portrait';
|
|
140
|
+
setScreenType(pageOrientation === 'landscape' ? 'full' : 'vertical');
|
|
141
|
+
// 强制更改页面转向
|
|
142
|
+
setPageOrientation({
|
|
143
|
+
pageOrientation,
|
|
144
|
+
success: () => {
|
|
145
|
+
console.log('success');
|
|
146
|
+
},
|
|
147
|
+
fail: err => {
|
|
148
|
+
console.log('err', err);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
131
152
|
}
|
|
132
153
|
} catch (e) {
|
|
133
154
|
console.log('获取屏幕方向失败');
|
|
134
155
|
}
|
|
135
156
|
}
|
|
136
157
|
}, [createCtx]);
|
|
137
|
-
const handleOrientationChange = data => {
|
|
138
|
-
const {
|
|
139
|
-
orientation
|
|
140
|
-
} = data;
|
|
141
|
-
if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'].includes(orientation)) {
|
|
142
|
-
setScreenType(orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical');
|
|
143
|
-
const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait';
|
|
144
|
-
setPageOrientation({
|
|
145
|
-
pageOrientation,
|
|
146
|
-
success: () => {
|
|
147
|
-
console.log('success');
|
|
148
|
-
},
|
|
149
|
-
fail: err => {
|
|
150
|
-
console.log('err', err);
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
158
|
useEffect(() => {
|
|
156
159
|
var _ty2;
|
|
157
160
|
if (typeof ((_ty2 = ty) === null || _ty2 === void 0 ? void 0 : _ty2.onOrientationChange) === 'function') {
|
|
@@ -184,6 +187,36 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
184
187
|
* 监听播放器实例创建完成
|
|
185
188
|
*/
|
|
186
189
|
|
|
190
|
+
const handleOrientationChange = data => {
|
|
191
|
+
const {
|
|
192
|
+
orientation
|
|
193
|
+
} = data;
|
|
194
|
+
if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'].includes(orientation)) {
|
|
195
|
+
// setScreenType(
|
|
196
|
+
// orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical'
|
|
197
|
+
// );
|
|
198
|
+
const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait';
|
|
199
|
+
const {
|
|
200
|
+
deviceType
|
|
201
|
+
} = systemInfo.current;
|
|
202
|
+
// 针对pad 暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
|
|
203
|
+
if (deviceType === 'pad') {
|
|
204
|
+
setScreenType('vertical');
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
// 强制更改页面转向
|
|
208
|
+
setPageOrientation({
|
|
209
|
+
pageOrientation,
|
|
210
|
+
success: () => {
|
|
211
|
+
console.log('success');
|
|
212
|
+
},
|
|
213
|
+
fail: err => {
|
|
214
|
+
console.log('err', err);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
187
220
|
/**
|
|
188
221
|
* 监听屏幕布局变化
|
|
189
222
|
*/
|
|
@@ -384,16 +417,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
384
417
|
if (playState !== PlayState.PLAYING) {
|
|
385
418
|
console.log('非播放状态=======');
|
|
386
419
|
console.log(currentZoomLevel, 'currentZoomLevel');
|
|
420
|
+
console.log(scaleMultiple, 'scaleMultiple');
|
|
421
|
+
console.log(hasPlayedRef.current, 'hasPlayedRef.current');
|
|
387
422
|
if (hasPlayedRef.current) {
|
|
388
423
|
setScaleMultiple(currentZoomLevel);
|
|
389
424
|
}
|
|
390
425
|
}
|
|
391
426
|
if (playState === PlayState.PLAYING) {
|
|
392
427
|
// 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2
|
|
428
|
+
console.log('Playing状态');
|
|
393
429
|
if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
|
|
394
430
|
setScaleMultiple(-2);
|
|
431
|
+
hasPlayedRef.current = true;
|
|
395
432
|
}
|
|
396
|
-
hasPlayedRef.current = true;
|
|
397
433
|
}
|
|
398
434
|
setPlayState(playState);
|
|
399
435
|
(_props$onPlayStatus = props.onPlayStatus) === null || _props$onPlayStatus === void 0 || _props$onPlayStatus.call(props, {
|