@ray-js/ipc-player-integration 0.0.17 → 0.0.18-beta-1

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 +54 -1
  2. package/package.json +2 -2
package/lib/ui/ui.js CHANGED
@@ -73,6 +73,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
73
73
  setRecording
74
74
  } = instance;
75
75
  const prevTriggerEvent = useRef();
76
+ const hasPlayedRef = useRef(false);
76
77
  /*
77
78
  player 的UI效果期望有一些控件在初始化的时候都展示,在点击 Player 之后隐藏:
78
79
  在控件显示时,点击播放器期望隐藏控件
@@ -94,6 +95,53 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
94
95
  // const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
95
96
  // const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
96
97
 
98
+ useEffect(() => {
99
+ if (createCtx) {
100
+ // 获取屏幕方向比例
101
+ try {
102
+ var _ty;
103
+ if (typeof ((_ty = ty) === null || _ty === void 0 ? void 0 : _ty.getOrientationSync) === 'function') {
104
+ const {
105
+ orientation
106
+ } = ty.getOrientationSync();
107
+ ipcTTTOperatorLog(`同步获取屏幕方向: ${orientation}`);
108
+ setScreenType(orientation === 'landscape' ? 'full' : 'vertical');
109
+ }
110
+ } catch (e) {
111
+ console.log('获取屏幕方向失败');
112
+ }
113
+ }
114
+ }, [createCtx]);
115
+ const handleOrientationChange = data => {
116
+ const {
117
+ orientation
118
+ } = data;
119
+ if (['portrait', 'portrait-upside-down', 'landscape-left', 'landscape-right'].includes(orientation)) {
120
+ setScreenType(orientation === 'landscape-left' || orientation === 'landscape-right' ? 'full' : 'vertical');
121
+ const pageOrientation = orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait';
122
+ setPageOrientation({
123
+ pageOrientation,
124
+ success: () => {
125
+ console.log('success');
126
+ },
127
+ fail: err => {
128
+ console.log('err', err);
129
+ }
130
+ });
131
+ }
132
+ };
133
+ useEffect(() => {
134
+ var _ty2;
135
+ if (typeof ((_ty2 = ty) === null || _ty2 === void 0 ? void 0 : _ty2.onOrientationChange) === 'function') {
136
+ ty.onOrientationChange(handleOrientationChange);
137
+ }
138
+ return () => {
139
+ var _ty3;
140
+ if (typeof ((_ty3 = ty) === null || _ty3 === void 0 ? void 0 : _ty3.offOrientationChange) === 'function') {
141
+ ty.offOrientationChange(handleOrientationChange);
142
+ }
143
+ };
144
+ }, []);
97
145
  useEffect(() => {
98
146
  if (createCtx) {
99
147
  setScaleMultiple(playerFit === 'contain' ? 1 : -2);
@@ -122,6 +170,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
122
170
  const {
123
171
  type
124
172
  } = sizeData;
173
+ console.log(type, 'type');
125
174
  console.log('监听到屏幕布局变化', type);
126
175
  const {
127
176
  platform,
@@ -336,7 +385,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
336
385
  if (playState !== PlayState.PLAYING) {
337
386
  console.log('非播放状态=======');
338
387
  console.log(currentZoomLevel, 'currentZoomLevel');
339
- setScaleMultiple(currentZoomLevel);
388
+ if (hasPlayedRef.current) {
389
+ setScaleMultiple(currentZoomLevel);
390
+ }
391
+ } else if (!hasPlayedRef.current) {
392
+ hasPlayedRef.current = true;
340
393
  }
341
394
  setPlayState(playState);
342
395
  (_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.17",
3
+ "version": "0.0.18-beta-1",
4
4
  "description": "IPC 融合播放器",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -38,7 +38,7 @@
38
38
  "@ray-js/ipc-ptz-zoom": "^0.0.2",
39
39
  "@ray-js/panel-sdk": "^1.13.1",
40
40
  "@ray-js/direction-control": "^0.0.8",
41
- "@ray-js/ray-ipc-player": "^2.0.25",
41
+ "@ray-js/ray-ipc-player": "2.0.26-beta-1",
42
42
  "@ray-js/ray-ipc-utils": "^1.1.10",
43
43
  "@ray-js/svg": "0.2.0",
44
44
  "clsx": "^1.2.1",