@ray-js/ipc-player-integration 0.0.18-beta-2 → 0.0.18-beta-3

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 +33 -19
  2. package/package.json +1 -1
package/lib/ui/ui.js CHANGED
@@ -134,24 +134,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
134
134
  }
135
135
  }
136
136
  }, [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
137
  useEffect(() => {
156
138
  var _ty2;
157
139
  if (typeof ((_ty2 = ty) === null || _ty2 === void 0 ? void 0 : _ty2.onOrientationChange) === 'function') {
@@ -184,6 +166,35 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
184
166
  * 监听播放器实例创建完成
185
167
  */
186
168
 
169
+ const handleOrientationChange = data => {
170
+ const {
171
+ orientation
172
+ } = data;
173
+ if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'].includes(orientation)) {
174
+ // setScreenType(
175
+ // orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical'
176
+ // );
177
+ const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait';
178
+ const {
179
+ deviceType
180
+ } = systemInfo.current;
181
+ // 针对pad 暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
182
+ if (deviceType === 'pad') {
183
+ setScreenType('vertical');
184
+ }
185
+ // 强制更改页面转向
186
+ setPageOrientation({
187
+ pageOrientation,
188
+ success: () => {
189
+ console.log('success');
190
+ },
191
+ fail: err => {
192
+ console.log('err', err);
193
+ }
194
+ });
195
+ }
196
+ };
197
+
187
198
  /**
188
199
  * 监听屏幕布局变化
189
200
  */
@@ -384,16 +395,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
384
395
  if (playState !== PlayState.PLAYING) {
385
396
  console.log('非播放状态=======');
386
397
  console.log(currentZoomLevel, 'currentZoomLevel');
398
+ console.log(scaleMultiple, 'scaleMultiple');
399
+ console.log(hasPlayedRef.current, 'hasPlayedRef.current');
387
400
  if (hasPlayedRef.current) {
388
401
  setScaleMultiple(currentZoomLevel);
389
402
  }
390
403
  }
391
404
  if (playState === PlayState.PLAYING) {
392
405
  // 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2
406
+ console.log('Playing状态');
393
407
  if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
394
408
  setScaleMultiple(-2);
409
+ hasPlayedRef.current = true;
395
410
  }
396
- hasPlayedRef.current = true;
397
411
  }
398
412
  setPlayState(playState);
399
413
  (_props$onPlayStatus = props.onPlayStatus) === null || _props$onPlayStatus === void 0 || _props$onPlayStatus.call(props, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.18-beta-2",
3
+ "version": "0.0.18-beta-3",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [