@ray-js/ipc-player-integration 0.0.35-beta.5 → 0.0.35-beta.6

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 -52
  2. package/package.json +2 -2
package/lib/ui/ui.js CHANGED
@@ -104,14 +104,14 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
104
104
  useImperativeHandle(eventRefProp, () => eventRef.current, [eventRef.current]);
105
105
  const timer = useRef();
106
106
  const reGetOrientationTimer = useRef(null);
107
- const [scaleMultiple, setScaleMultiple] = useState(playerFit === 'contain' ? 1 : -2);
108
- const [currentZoomLevel, setCurrentZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
107
+ // 统一调整为1倍缩放,保证画面展示完全
108
+ const [scaleMultiple, setScaleMultiple] = useState(1);
109
+ // 统一调整为1倍缩放,保证画面展示完全
110
+ const [currentZoomLevel, setCurrentZoomLevel] = useState(1);
109
111
  const [createCtx, setCreateCtx] = useState(false);
110
112
  // 是否需要忽略进入后台停止预览
111
113
  const [ignoreStopOnHide, setIgnoreStopOnHide] = useState(ignoreHideStopPreview);
112
114
  const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
113
- // const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
114
- // const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
115
115
 
116
116
  // 展示顶部内容
117
117
  const [showTopContent, setShowTopContent] = useState(true);
@@ -407,8 +407,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
407
407
  eventRef.current.emit(showAllComponent);
408
408
  eventRef.current.emit('disablePlayerTap', true);
409
409
  eventRef.current.emit(pauseTimeToHideAllComponent);
410
- // 按宽填充,保证播放流宽度为屏幕宽度,高度自适应
411
- setScaleMultiple(-1);
410
+ // 按宽填充,保证播放流宽度为屏幕宽度,高度自适应设为1倍
411
+ setScaleMultiple(1);
412
412
  } else {
413
413
  // 短屏或横屏时,恢复自动隐藏
414
414
  eventRef.current.emit('disablePlayerTap', false);
@@ -417,8 +417,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
417
417
  }, [isVerticalFullLayout, screenType, playerFit]);
418
418
  useEffect(() => {
419
419
  if (createCtx) {
420
- setScaleMultiple(playerFit === 'contain' ? 1 : -2);
421
- setCurrentZoomLevel(playerFit === 'contain' ? 1 : -2);
420
+ // 统一调整为1倍缩放,保证画面展示完全
421
+ setScaleMultiple(1);
422
+ setCurrentZoomLevel(1);
422
423
  }
423
424
  }, [playerFit, createCtx]);
424
425
  useEffect(() => {
@@ -497,19 +498,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
497
498
  }
498
499
  triggerEvent(showAllComponent);
499
500
  }
500
- // 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
501
- if (type === 'landscape' && landscapeMode === 'fill') {
502
- console.log(scaleMultiple, '===========fill');
503
- setScaleMultiple(-1);
504
- } else if (type === 'landscape' && landscapeMode === 'standard') {
505
- console.log(scaleMultiple, '===========landscape');
506
- setScaleMultiple(-2);
507
- } else {
508
- // 竖屏时 将屏幕播放比例设为按宽按高
509
-
510
- console.log(scaleMultiple, '===========landscape');
511
- setScaleMultiple(playerFit === 'contain' ? scaleMultiple === 1 ? -1 : 1 : -2);
512
- }
501
+ // 横屏(fill/standard)与竖屏均统一调整为 1 倍缩放,保证画面完整展示
502
+ setScaleMultiple(1);
513
503
  } catch (err) {
514
504
  console.log(err, 'err');
515
505
  }
@@ -673,10 +663,12 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
673
663
  }
674
664
  }
675
665
  if (playState === PlayState.PLAYING) {
676
- // 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2
666
+ // 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2 修改为只针对第一次播放成功时
677
667
  console.log('Playing状态');
678
- if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
679
- setScaleMultiple(-2);
668
+ // if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
669
+ if (!hasPlayedRef.current) {
670
+ // 统一调整为1倍缩放,保证画面展示完全
671
+ setScaleMultiple(1);
680
672
  hasPlayedRef.current = true;
681
673
  }
682
674
  }
@@ -792,14 +784,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
792
784
  /**
793
785
  * 监听当前的zoom比例状态
794
786
  */
795
- // useEffect(() => {
796
- // if (screenType === 'vertical') {
797
- // console.log(currentZoomLevel, '竖屏时的缩放比例');
798
- // setVerticalZoomLevel(currentZoomLevel);
799
- // // setScaleMultiple(currentZoomLevel);
800
- // }
801
- // }, [screenType, currentZoomLevel]);
802
-
803
787
  const onZoomChange = useMemoizedFn(data => {
804
788
  const {
805
789
  zoomLevel,
@@ -810,30 +794,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
810
794
  if (zoomLevel === 0) {
811
795
  return false;
812
796
  }
813
- /**
814
- * 针对竖屏为cover模式时,横屏为standard模式时,主动设置缩放比例,避免因值不能正常变化
815
- */
816
- if (scaleMode === -2 && playerFit === 'cover' && screenType === 'vertical' && landscapeMode === 'standard') {
817
- console.log('dsadsadsad----', zoomLevel);
818
- setScaleMultiple(zoomLevel);
819
- }
820
797
  /**
821
798
  * 针对竖屏为contain模式时,横屏为fill模式时,主动设置缩放比例,避免因值不能正常变化
822
799
  */
823
- if (scaleMode === -1 && playerFit === 'contain' && screenType === 'vertical' && landscapeMode === 'fill') {
824
- setVerticalCoverZoom(zoomLevel);
825
- }
800
+ // if (
801
+ // scaleMode === -1 &&
802
+ // playerFit === 'contain' &&
803
+ // screenType === 'vertical' &&
804
+ // landscapeMode === 'fill'
805
+ // ) {
806
+ // setVerticalCoverZoom(zoomLevel);
807
+ // }
826
808
 
827
- /**
828
- * 横屏情况下 针对竖屏为contain模式时,横屏为fill模式时,主动设置缩放比例,避免因值不能正常变化
829
- */
830
- if (scaleMode === -2 && playerFit === 'cover' && screenType !== 'vertical' && landscapeMode === 'standard') {
831
- setScaleMultiple(zoomLevel);
832
- }
833
- if (scaleMode === -1 && playerFit === 'contain' && screenType !== 'vertical' && landscapeMode === 'fill') {
834
- setVerticalCoverZoom(zoomLevel);
835
- setScaleMultiple(zoomLevel);
836
- }
809
+ // 直接记录当前缩放比例
837
810
  setCurrentZoomLevel(zoomLevel);
838
811
  instance.event.emit(zoomLevelChange, zoomLevel);
839
812
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.35-beta.5",
3
+ "version": "0.0.35-beta.6",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -64,7 +64,7 @@
64
64
  "husky": {
65
65
  "hooks": {
66
66
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS --config commitlint.config.js",
67
- "pre-commit": "lint-staged"
67
+ "pre-commit": "node ./scripts/check-protected-files.js && lint-staged"
68
68
  }
69
69
  },
70
70
  "lint-staged": {