@ray-js/ipc-player-integration 0.0.16-beta-2 → 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.
@@ -18,7 +18,8 @@ const BottomLeftContent = _ref => {
18
18
  return /*#__PURE__*/React.createElement(CoverView, {
19
19
  className: clsx('ipc-player-bottom-left-content-wrap'),
20
20
  style: {
21
- paddingRight: screenType === 'vertical' ? '0' : '50px'
21
+ paddingRight: screenType === 'vertical' ? '0' : '50px',
22
+ height: screenType === 'vertical' ? shouldHide ? '41px' : '40px' : shouldHide ? '57px' : '58px'
22
23
  }
23
24
  }, /*#__PURE__*/React.createElement(View, {
24
25
  style: {
@@ -18,7 +18,8 @@ const BottomRightContent = _ref => {
18
18
  return /*#__PURE__*/React.createElement(CoverView, {
19
19
  className: clsx('ipc-player-bottom-right-content-wrap'),
20
20
  style: {
21
- paddingLeft: screenType === 'vertical' ? '10px' : '0'
21
+ paddingLeft: screenType === 'vertical' ? '10px' : '0',
22
+ height: screenType === 'vertical' ? shouldHide ? '41px' : '40px' : shouldHide ? '57px' : '58px'
22
23
  }
23
24
  }, /*#__PURE__*/React.createElement(View, {
24
25
  style: {
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { CoverView, View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import { useStore } from '../ctx/store';
5
+ import { useComponentHideState } from './hooks';
5
6
  const TopLeftContent = _ref => {
6
7
  let {
7
8
  ctx,
@@ -13,10 +14,12 @@ const TopLeftContent = _ref => {
13
14
  screenType: ctx.screenType,
14
15
  playState: ctx.playState
15
16
  });
17
+ const [shouldHide] = useComponentHideState();
16
18
  return /*#__PURE__*/React.createElement(CoverView, {
17
19
  className: clsx('ipc-player-top-left-content-wrap'),
18
20
  style: {
19
- paddingRight: screenType === 'vertical' ? '0' : '20px'
21
+ paddingRight: screenType === 'vertical' ? '0' : '20px',
22
+ height: screenType === 'vertical' ? shouldHide ? '37px' : '36px' : shouldHide ? '41px' : '40px'
20
23
  }
21
24
  }, /*#__PURE__*/React.createElement(View, {
22
25
  style: {
@@ -16,7 +16,10 @@ const TopRightContent = _ref => {
16
16
  });
17
17
  const [shouldHide] = useComponentHideState();
18
18
  return /*#__PURE__*/React.createElement(CoverView, {
19
- className: clsx('ipc-player-top-right-content-wrap')
19
+ className: clsx('ipc-player-top-right-content-wrap'),
20
+ style: {
21
+ height: screenType === 'vertical' ? shouldHide ? '37px' : '36px' : shouldHide ? '41px' : '40px'
22
+ }
20
23
  }, /*#__PURE__*/React.createElement(View, {
21
24
  style: {
22
25
  paddingTop: screenType === 'vertical' ? '12px' : '16px',
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, {
@@ -108,6 +108,8 @@ export const PtzControl = props => {
108
108
  const res = await storage.get('ptzControlTip');
109
109
  showPtzControlTip.current = false;
110
110
  if (!res) {
111
+ // 结束操作提示
112
+ onTouchPtzEnd();
111
113
  addContent('absolute', {
112
114
  id: ptzControlTipId,
113
115
  content: props => {
@@ -119,6 +121,19 @@ export const PtzControl = props => {
119
121
  }
120
122
  }
121
123
  });
124
+ const onTouchPtzEnd = async () => {
125
+ const ptzStopData = await getDpIdByCode(devId, 'ptz_stop');
126
+ if (ptzStopData.code === 0) {
127
+ const ptzStopId = ptzStopData.data;
128
+ publishDps(devId, {
129
+ [ptzStopId]: true
130
+ });
131
+ }
132
+ if (ptzTimeId.current) {
133
+ clearInterval(ptzTimeId.current);
134
+ ptzTimeId.current = null;
135
+ }
136
+ };
122
137
  return /*#__PURE__*/React.createElement(CoverView, {
123
138
  className: clsx('ipc-player-plugin-full-screen-ptz-control', {
124
139
  'ipc-player-plugin-full-screen-ptz-control-hide': !isPtzActive || shouldHide,
@@ -129,19 +144,7 @@ export const PtzControl = props => {
129
144
  zoomData: [],
130
145
  ptzData: ptzData.current,
131
146
  onTouchPtzStart: onTouchPtzStart,
132
- onTouchPtzEnd: async () => {
133
- const ptzStopData = await getDpIdByCode(devId, 'ptz_stop');
134
- if (ptzStopData.code === 0) {
135
- const ptzStopId = ptzStopData.data;
136
- publishDps(devId, {
137
- [ptzStopId]: true
138
- });
139
- }
140
- if (ptzTimeId.current) {
141
- clearInterval(ptzTimeId.current);
142
- ptzTimeId.current = null;
143
- }
144
- },
147
+ onTouchPtzEnd: onTouchPtzEnd,
145
148
  brandColor: brandColor,
146
149
  iconClassName: Styles['arrow-icon-wrapper'],
147
150
  darkMode: true
@@ -1,20 +1,19 @@
1
1
  import "core-js/modules/esnext.iterator.constructor.js";
2
2
  import "core-js/modules/esnext.iterator.map.js";
3
- import React, { useCallback, useState, useContext, useEffect } from 'react';
3
+ import React, { useState, useContext, useEffect } from 'react';
4
4
  import { Text, View, showToast } from '@ray-js/ray';
5
5
  import clsx from 'clsx';
6
6
  import Strings from '../../i18n';
7
7
  import { useMemoizedFn } from '../../hooks';
8
8
  import { useStore } from '../../ctx/store';
9
9
  import { UIEventContext } from '../../ui/context';
10
- import { playerTap } from '../../ui/constant';
10
+ import { playerTap, showAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
11
11
  import './resolution.less';
12
12
  export const FullResolutionControl = props => {
13
13
  const {
14
14
  setResolution
15
15
  } = props;
16
16
  const {
17
- screenType,
18
17
  resolution,
19
18
  resolutionList,
20
19
  brandColor
@@ -42,7 +41,7 @@ export const FullResolutionControl = props => {
42
41
  event.off(playerTap, onPlayerTap);
43
42
  };
44
43
  }, []);
45
- const changeResolution = useCallback(value => {
44
+ const changeResolution = useMemoizedFn(value => {
46
45
  if (value === resolution) {
47
46
  showToast({
48
47
  icon: 'none',
@@ -54,6 +53,8 @@ export const FullResolutionControl = props => {
54
53
  icon: 'none',
55
54
  title: Strings.getLang('ipc_player_change_resolution_success')
56
55
  });
56
+ event.emit(pauseTimeToHideAllComponent);
57
+ event.emit(showAllComponent);
57
58
  setHide(true);
58
59
  }).catch(() => {
59
60
  showToast({
@@ -62,7 +63,7 @@ export const FullResolutionControl = props => {
62
63
  });
63
64
  });
64
65
  }
65
- }, [resolution]);
66
+ });
66
67
  return /*#__PURE__*/React.createElement(View, {
67
68
  className: clsx('ipc-player-plugin-full-resolution-control', 'ipc-plugin-absolute-move-in-right', {
68
69
  'ipc-plugin-absolute-move-in-right-hide': hide
@@ -1,7 +1,7 @@
1
1
  @animation-time: 0.3s;
2
2
 
3
3
  .ipc-player-plugin-resolution {
4
- background-color: rgba(255,255,255,0.2);
4
+ background-color: rgba(255, 255, 255, 0.2);
5
5
  padding: calc(4px * var(--ipc-player-size-scale, 1)) calc(5px * var(--ipc-player-size-scale, 1));
6
6
  display: flex;
7
7
  justify-content: center;
@@ -24,12 +24,12 @@
24
24
 
25
25
  .ipc-player-plugin-full-resolution-control {
26
26
  height: 100%;
27
- width: 200px;
27
+ width: 200px;
28
28
  display: flex;
29
29
  flex-direction: column;
30
30
  justify-content: center;
31
31
  align-items: center;
32
- background-color: rgba(0,0,0,0.9);
32
+ background-color: rgba(0, 0, 0, 0.9);
33
33
  }
34
34
 
35
35
  .ipc-player-plugin-full-resolution-control-wrap {
@@ -60,4 +60,9 @@
60
60
  color: #ffffff;
61
61
  min-height: 40px;
62
62
  width: 100%;
63
+ margin-bottom: 5px;
64
+ }
65
+
66
+ .ipc-player-plugin-full-resolution-control-text:last-child {
67
+ margin-bottom: 0;
63
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.16-beta-2",
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.24",
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",