@ray-js/ipc-player-integration 0.0.18-beta-4 → 0.0.18-beta-5

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.
Files changed (2) hide show
  1. package/lib/ui/ui.js +25 -25
  2. package/package.json +1 -1
package/lib/ui/ui.js CHANGED
@@ -187,14 +187,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
187
187
  * 监听播放器实例创建完成
188
188
  */
189
189
 
190
- const handleOrientationChange = data => {
190
+ const handleOrientationChange = useMemoizedFn(data => {
191
+ console.log(data, 'data=====');
191
192
  const {
192
193
  orientation
193
194
  } = data;
194
195
  if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'].includes(orientation)) {
195
- // setScreenType(
196
- // orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical'
197
- // );
196
+ setScreenType(orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical');
198
197
  const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait';
199
198
  const {
200
199
  deviceType
@@ -202,7 +201,22 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
202
201
  // 针对pad 暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
203
202
  if (deviceType === 'pad') {
204
203
  setScreenType('vertical');
205
- return;
204
+ } else {
205
+ setScreenType(pageOrientation === 'landscape' ? 'full' : 'vertical');
206
+ triggerEvent(showAllComponent);
207
+ }
208
+ // 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
209
+ if (pageOrientation === 'landscape' && landscapeMode === 'fill') {
210
+ console.log(scaleMultiple, '===========fill');
211
+ setScaleMultiple(-1);
212
+ } else if (pageOrientation === 'landscape' && landscapeMode === 'standard') {
213
+ console.log(scaleMultiple, '===========landscape');
214
+ setScaleMultiple(-2);
215
+ } else {
216
+ // 竖屏时 将屏幕播放比例设为按宽按高
217
+
218
+ console.log(scaleMultiple, '===========landscape');
219
+ setScaleMultiple(playerFit === 'contain' ? scaleMultiple === 1 ? -1 : 1 : -2);
206
220
  }
207
221
  // 强制更改页面转向
208
222
  setPageOrientation({
@@ -215,12 +229,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
215
229
  }
216
230
  });
217
231
  }
218
- };
232
+ });
219
233
 
220
234
  /**
221
235
  * 监听屏幕布局变化
222
236
  */
223
237
  usePageEvent('onResize', useMemoizedFn(sizeData => {
238
+ var _ty4;
239
+ if (typeof ((_ty4 = ty) === null || _ty4 === void 0 ? void 0 : _ty4.onOrientationChange) === 'function') {
240
+ return;
241
+ }
224
242
  try {
225
243
  const {
226
244
  type
@@ -238,34 +256,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
238
256
  }
239
257
  // 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
240
258
  if (type === 'landscape' && landscapeMode === 'fill') {
241
- // instance.IPCPlayerInstance.setObjectFit({
242
- // objectFit: 'fillCrop',
243
- // });
244
259
  console.log(scaleMultiple, '===========fill');
245
260
  setScaleMultiple(-1);
246
261
  } else if (type === 'landscape' && landscapeMode === 'standard') {
247
- // instance.IPCPlayerInstance.setObjectFit({
248
- // objectFit: 'contain',
249
- // });
250
- // setTimeout(() => {
251
- // console.log('dsahdjsahjdhsajhdjh==');
252
- // instance.IPCPlayerInstance.setScaleMultiple({
253
- // scaleMultiple: -2,
254
- // });
255
- // }, 3000);
256
262
  console.log(scaleMultiple, '===========landscape');
257
263
  setScaleMultiple(-2);
258
264
  } else {
259
265
  // 竖屏时 将屏幕播放比例设为按宽按高
260
- // console.log(verticalZoomLevel, 'verticalZoomLevel======');
261
- // instance.IPCPlayerInstance.setScaleMultiple({
262
- // scaleMultiple: playerFit === 'contain' ? -1 : -2,
263
- // });
266
+
264
267
  console.log(scaleMultiple, '===========landscape');
265
268
  setScaleMultiple(playerFit === 'contain' ? scaleMultiple === 1 ? -1 : 1 : -2);
266
- // instance.IPCPlayerInstance.setObjectFit({
267
- // objectFit: playerFit === 'contain' ? 'fillCrop' : 'contain',
268
- // });
269
269
  }
270
270
  } catch (err) {
271
271
  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.18-beta-4",
3
+ "version": "0.0.18-beta-5",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [