@ray-js/ipc-player-integration 0.0.1-beta-21 → 0.0.1-beta-23

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 (72) hide show
  1. package/lib/ctx/ctx.composition.js +19 -9
  2. package/lib/ctx/ctx.d.ts +5 -3
  3. package/lib/ctx/ctx.js +57 -28
  4. package/lib/ctx/store.d.ts +1 -1
  5. package/lib/ctx/store.js +1 -1
  6. package/lib/i18n/index.d.ts +28 -0
  7. package/lib/i18n/strings.d.ts +14 -0
  8. package/lib/i18n/strings.js +16 -2
  9. package/lib/interface.d.ts +18 -8
  10. package/lib/plugins/battery/battery.composition.d.ts +47 -5
  11. package/lib/plugins/battery/battery.composition.js +4 -0
  12. package/lib/plugins/battery/battery.js +9 -9
  13. package/lib/plugins/battery/battery.less +4 -14
  14. package/lib/plugins/battery/batteryFull.d.ts +13 -0
  15. package/lib/plugins/battery/batteryFull.js +46 -0
  16. package/lib/plugins/fullScreen/fullScreen.js +12 -10
  17. package/lib/plugins/fullScreen/fullScreen.less +9 -8
  18. package/lib/plugins/fullScreen/verticalScreen.d.ts +1 -1
  19. package/lib/plugins/fullScreen/verticalScreen.js +8 -5
  20. package/lib/plugins/fullScreen/verticalScreen.less +7 -12
  21. package/lib/plugins/fullScreen/voiceIntercom.js +2 -2
  22. package/lib/plugins/index.d.ts +3 -1
  23. package/lib/plugins/index.js +6 -2
  24. package/lib/plugins/muted/muted.js +4 -4
  25. package/lib/plugins/muted/muted.less +8 -1
  26. package/lib/plugins/ptz/ptz.js +13 -26
  27. package/lib/plugins/ptz/ptz.less +2 -7
  28. package/lib/plugins/ptz/ptzControl.d.ts +0 -1
  29. package/lib/plugins/ptz/ptzControl.js +76 -32
  30. package/lib/plugins/recordVideo/recordVideo.js +154 -26
  31. package/lib/plugins/recordVideo/recordVideo.less +63 -6
  32. package/lib/plugins/resolution/fullResolutionControl.js +2 -2
  33. package/lib/plugins/resolution/resolution.js +9 -3
  34. package/lib/plugins/resolution/resolution.less +5 -5
  35. package/lib/plugins/screenshot/screenshot.js +65 -14
  36. package/lib/plugins/screenshot/screenshot.less +25 -23
  37. package/lib/plugins/smallIntercom/index.d.ts +1 -0
  38. package/lib/plugins/smallIntercom/index.js +1 -0
  39. package/lib/plugins/smallIntercom/smallIntercom.d.ts +6 -0
  40. package/lib/plugins/smallIntercom/smallIntercom.js +49 -0
  41. package/lib/plugins/smallIntercom/smallIntercom.less +50 -0
  42. package/lib/plugins/tempHumidity/tempHumidity.d.ts +1 -1
  43. package/lib/plugins/tempHumidity/tempHumidity.js +12 -4
  44. package/lib/plugins/videoBitKBP/index.d.ts +1 -0
  45. package/lib/plugins/videoBitKBP/index.js +1 -0
  46. package/lib/plugins/{videoBitKbps/videoBitKbps.d.ts → videoBitKBP/videoBitKBP.d.ts} +2 -2
  47. package/lib/plugins/{videoBitKbps/videoBitKbps.js → videoBitKBP/videoBitKBP.js} +14 -7
  48. package/lib/plugins/{videoBitKbps/videoBitKbps.less → videoBitKBP/videoBitKBP.less} +4 -5
  49. package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +1 -1
  50. package/lib/plugins/voiceIntercom/voiceIntercom.js +25 -18
  51. package/lib/ui/bottomLeftContent.d.ts +8 -0
  52. package/lib/ui/bottomLeftContent.js +33 -0
  53. package/lib/ui/bottomRightContent.d.ts +8 -0
  54. package/lib/ui/bottomRightContent.js +33 -0
  55. package/lib/ui/constant.d.ts +1 -0
  56. package/lib/ui/constant.js +2 -1
  57. package/lib/ui/hooks.d.ts +1 -1
  58. package/lib/ui/hooks.js +4 -3
  59. package/lib/ui/{bottomContent.d.ts → topLeftContent.d.ts} +2 -2
  60. package/lib/ui/{bottomContent.js → topLeftContent.js} +9 -8
  61. package/lib/ui/{topContent.d.ts → topRightContent.d.ts} +2 -2
  62. package/lib/ui/{topContent.js → topRightContent.js} +9 -8
  63. package/lib/ui/ui.d.ts +3 -0
  64. package/lib/ui/ui.js +115 -56
  65. package/lib/ui/ui.less +162 -25
  66. package/lib/utils/device/index.d.ts +6 -0
  67. package/lib/utils/device/index.js +52 -0
  68. package/lib/utils/index.d.ts +3 -0
  69. package/lib/utils/index.js +15 -0
  70. package/package.json +7 -9
  71. package/lib/plugins/videoBitKbps/index.d.ts +0 -1
  72. package/lib/plugins/videoBitKbps/index.js +0 -1
package/lib/ui/ui.js CHANGED
@@ -9,8 +9,10 @@ import { useStore, getDefaultStore } from '../ctx/store';
9
9
  import { getEventInstance } from './event';
10
10
  import { UIEventContext } from './context';
11
11
  import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent } from './constant';
12
- import { BottomContent } from './bottomContent';
13
- import { TopContent } from './topContent';
12
+ import BottomLeftContent from './bottomLeftContent';
13
+ import BottomRightContent from './bottomRightContent';
14
+ import TopLeftContent from './topLeftContent';
15
+ import TopRightContent from './topRightContent';
14
16
  import './ui.less';
15
17
  function getCtxInstance(instance, devId) {
16
18
  if (instance) return instance;
@@ -27,13 +29,15 @@ const defaultCSSVariable = {
27
29
  // 有需要点击呈现不同颜色的icon
28
30
  '--iconActiveColor': '#ec653c',
29
31
  '--iconFontSize': '20px',
32
+ '--iconPlayerSize': '22px',
33
+ '--iconBoxSize': '24px',
30
34
  '--bg-color': '#000',
35
+ '--shot-card-bg-color': '#262626',
31
36
  '--fontColor': '#fff',
32
37
  '--fontSize': '12px'
33
38
  };
34
39
  const HIDE_COMPONENT_TIME = 5000;
35
40
  export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
36
- console.log(props, 'props');
37
41
  const {
38
42
  className,
39
43
  devId,
@@ -73,8 +77,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
73
77
  systemInfo.current = getSystemInfoSync();
74
78
  }
75
79
  const {
76
- topContent,
77
- bottomContent,
80
+ topLeftContent,
81
+ topRightContent,
82
+ bottomLeftContent,
83
+ bottomRightContent,
78
84
  absoluteContent,
79
85
  screenType,
80
86
  playState,
@@ -82,8 +88,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
82
88
  resolution,
83
89
  mute
84
90
  } = useStore({
85
- topContent: instance.topContent,
86
- bottomContent: instance.bottomContent,
91
+ topLeftContent: instance.topLeftContent,
92
+ topRightContent: instance.topRightContent,
93
+ bottomLeftContent: instance.bottomLeftContent,
94
+ bottomRightContent: instance.bottomRightContent,
87
95
  absoluteContent: instance.absoluteContent,
88
96
  screenType: instance.screenType,
89
97
  playState: instance.playState,
@@ -91,22 +99,66 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
91
99
  resolution: instance.resolution,
92
100
  mute: instance.mute
93
101
  });
94
- const renderTopContent = useMemo(() => {
95
- if (!topContent || !(topContent !== null && topContent !== void 0 && topContent.length)) return null;
96
- return topContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
102
+
103
+ /**
104
+ * 渲染随机定位播放器内容
105
+ */
106
+
107
+ /**
108
+ * 渲染播放器左上角内容
109
+ */
110
+ const renderTopLeftContent = useMemo(() => {
111
+ if (!topLeftContent || !(topLeftContent !== null && topLeftContent !== void 0 && topLeftContent.length)) return null;
112
+ return topLeftContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
113
+ key: item.id
114
+ }, item.initProps), instance), {}, {
115
+ IPCPlayerContext: instance.IPCPlayerInstance,
116
+ // 添加通用变量单独组件类名
117
+ className: clsx('top-left-item-container')
118
+ })));
119
+ }, [topLeftContent, instance]);
120
+
121
+ /**
122
+ * 渲染播放器右上角内容
123
+ */
124
+ const renderTopRightContent = useMemo(() => {
125
+ if (!topRightContent || !(topRightContent !== null && topRightContent !== void 0 && topRightContent.length)) return null;
126
+ return topRightContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
97
127
  key: item.id
98
128
  }, item.initProps), instance), {}, {
99
- IPCPlayerContext: instance.IPCPlayerInstance
129
+ IPCPlayerContext: instance.IPCPlayerInstance,
130
+ // 添加通用变量单独组件类名
131
+ className: clsx('top-right-item-container')
100
132
  })));
101
- }, [topContent, instance]);
102
- const renderBottomContent = useMemo(() => {
103
- if (!bottomContent || !(bottomContent !== null && bottomContent !== void 0 && bottomContent.length)) return null;
104
- return bottomContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({}, item.initProps), {}, {
133
+ }, [topRightContent, instance]);
134
+
135
+ /**
136
+ * 渲染播放器左下角内容
137
+ */
138
+ const renderBottomLeftContent = useMemo(() => {
139
+ if (!bottomLeftContent || !(bottomLeftContent !== null && bottomLeftContent !== void 0 && bottomLeftContent.length)) return null;
140
+ return bottomLeftContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({}, item.initProps), {}, {
105
141
  key: item.id
106
142
  }, instance), {}, {
107
- IPCPlayerContext: instance.IPCPlayerInstance
143
+ IPCPlayerContext: instance.IPCPlayerInstance,
144
+ // 添加通用变量单独组件类名
145
+ className: clsx('bottom-left-item-container')
108
146
  })));
109
- }, [bottomContent, instance]);
147
+ }, [bottomLeftContent, instance]);
148
+
149
+ /**
150
+ * 渲染播放器右下角内容
151
+ */
152
+ const renderBottomRightContent = useMemo(() => {
153
+ if (!bottomRightContent || !(bottomRightContent !== null && bottomRightContent !== void 0 && bottomRightContent.length)) return null;
154
+ return bottomRightContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({}, item.initProps), {}, {
155
+ key: item.id
156
+ }, instance), {}, {
157
+ IPCPlayerContext: instance.IPCPlayerInstance,
158
+ // 添加通用变量单独组件类名
159
+ className: clsx('bottom-right-item-container')
160
+ })));
161
+ }, [bottomLeftContent, instance]);
110
162
 
111
163
  /**
112
164
  * 视频流加载状态封装
@@ -117,27 +169,27 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
117
169
  const store = getDefaultStore();
118
170
  const _screenType = store.get(instance.screenType);
119
171
  eventRef.current.emit(playerTap);
120
- if (_screenType === 'full') {
121
- // 如果全屏清晰度展开, 则点击关闭全屏清晰度, 展示所有组件
122
- if (fullResolutionActive) {
123
- setFullResolutionActive(false);
124
- // 展示相应菜单启动自动隐藏定时
125
- triggerEvent(showAllComponent);
126
- // event.emit(startTimeToHideAllComponent);
127
- return false;
128
- }
129
- if (prevTriggerEvent.current === hideAllComponent) {
130
- triggerEvent(showAllComponent);
131
- } else {
132
- triggerEvent(hideAllComponent);
133
- }
172
+ // if (_screenType === 'full') {
173
+ // 如果全屏清晰度展开, 则点击关闭全屏清晰度, 展示所有组件
174
+ if (fullResolutionActive && _screenType === 'full') {
175
+ setFullResolutionActive(false);
176
+ // 展示相应菜单启动自动隐藏定时
177
+ triggerEvent(showAllComponent);
178
+ // event.emit(startTimeToHideAllComponent);
179
+ return false;
180
+ }
181
+ console.log(prevTriggerEvent.current, 'prevTriggerEvent.current');
182
+ if (prevTriggerEvent.current === hideAllComponent) {
183
+ triggerEvent(showAllComponent);
184
+ } else {
185
+ triggerEvent(hideAllComponent);
134
186
  }
135
187
  return false;
136
188
  }, [fullResolutionActive]);
137
189
  const triggerEvent = type => {
138
190
  const store = getDefaultStore();
139
- const _screenType = store.get(instance.screenType);
140
- if (prevTriggerEvent.current === type || _screenType === 'vertical') return;
191
+ store.get(instance.screenType); // if (prevTriggerEvent.current === type || _screenType === 'vertical') return;
192
+ if (prevTriggerEvent.current === type) return;
141
193
  if (timer.current) {
142
194
  clearTimeout(timer.current);
143
195
  timer.current = null;
@@ -183,6 +235,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
183
235
  }, /*#__PURE__*/React.createElement(View, {
184
236
  className: clsx('ipc-player-content', className),
185
237
  style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
238
+ // backgroundColor: 'rgba(0,0,0,0.2)',
186
239
  height: screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh'
187
240
  })
188
241
  }, /*#__PURE__*/React.createElement(IPCPlayer, {
@@ -193,6 +246,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
193
246
  ipcPlayerContext: instance.IPCPlayerInstance,
194
247
  onChangeStreamStatus: code => {
195
248
  var _props$onPlayStatus;
249
+ console.log(code, 'code');
196
250
  const playStateMap = {
197
251
  [PlayerStreamStatus.PreviewSuccess]: PlayState.PLAYING,
198
252
  // 播放中
@@ -213,41 +267,44 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
213
267
  ,
214
268
  onZoomChange: data => {
215
269
  console.log(`zoomChange事件: ${JSON.stringify(data)}`);
216
- ty.showToast({
217
- title: `zoomChange事件: ${JSON.stringify(data)}`
218
- });
219
- setTimeout(() => {
220
- ty.hideToast();
221
- }, 3000);
270
+ // ty.showToast({
271
+ // title: `zoomChange事件: ${JSON.stringify(data)}`,
272
+ // });
273
+ // setTimeout(() => {
274
+ // ty.hideToast();
275
+ // }, 3000);
222
276
  },
223
277
  onCameraPreviewFailure: data => {
224
278
  console.log(`onCameraPreviewFailure事件: ${JSON.stringify(data)}`);
225
- ty.showToast({
226
- title: `onCameraPreviewFailure事件: ${JSON.stringify(data)}`
227
- });
228
- setTimeout(() => {
229
- ty.hideToast();
230
- }, 3000);
279
+ // ty.showToast({
280
+ // title: `onCameraPreviewFailure事件: ${JSON.stringify(data)}`,
281
+ // });
282
+ // setTimeout(() => {
283
+ // ty.hideToast();
284
+ // }, 3000);
231
285
  },
232
286
  onCameraNotifyWeakNetwork: data => {
233
287
  console.log(`onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`);
234
- ty.showToast({
235
- title: `onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`
236
- });
237
- setTimeout(() => {
238
- ty.hideToast();
239
- }, 3000);
288
+ // ty.showToast({
289
+ // title: `onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`,
290
+ // });
291
+ // setTimeout(() => {
292
+ // ty.hideToast();
293
+ // }, 3000);
240
294
  },
241
295
  clarity: resolution === 'HD' ? 'hd' : 'normal',
242
296
  privateState: privateState,
243
297
  onPlayerTap: handPlayerTap // 对应原来的onVideoTap
244
- }), playerReady && /*#__PURE__*/React.createElement(TopContent, {
298
+ }), /*#__PURE__*/React.createElement(TopLeftContent, {
299
+ ctx: instance
300
+ }, renderTopLeftContent), /*#__PURE__*/React.createElement(TopRightContent, {
301
+ ctx: instance
302
+ }, renderTopRightContent), /*#__PURE__*/React.createElement(BottomLeftContent, {
245
303
  ctx: instance
246
- }, renderTopContent), playerReady && /*#__PURE__*/React.createElement(BottomContent, {
304
+ }, renderBottomLeftContent), /*#__PURE__*/React.createElement(BottomRightContent, {
247
305
  ctx: instance
248
- }, renderBottomContent), playerReady && (() => {
306
+ }, renderBottomRightContent), playerReady && (() => {
249
307
  if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
250
- console.log(absoluteContent, 'absoluteContent');
251
308
  return absoluteContent.map(item => {
252
309
  return /*#__PURE__*/React.createElement(CoverView, {
253
310
  key: item.id,
@@ -258,7 +315,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
258
315
  }, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
259
316
  key: item.id
260
317
  }, item.initProps), instance), {}, {
261
- IPCPlayerContext: instance.IPCPlayerInstance
318
+ IPCPlayerContext: instance.IPCPlayerInstance,
319
+ // 添加通用变量单独组件类名
320
+ className: clsx('absolute-item-container')
262
321
  })));
263
322
  });
264
323
  })()));
package/lib/ui/ui.less CHANGED
@@ -2,48 +2,185 @@
2
2
  position: relative;
3
3
  overflow: hidden;
4
4
 
5
- .ipc-player-top-content-warp {
5
+ // 左上角容器样式
6
+ .ipc-player-top-left-content-wrap {
6
7
  position: absolute;
7
- width: 100%;
8
8
  left: 0;
9
9
  top: 0;
10
10
  z-index: 100;
11
11
  }
12
-
13
- .ipc-player-bottom-content-warp {
12
+ // 右上角容器样式
13
+ .ipc-player-top-right-content-wrap {
14
+ position: absolute;
15
+ right: 0;
16
+ top: 0;
17
+ z-index: 100;
18
+ }
19
+ // 左下角容器样式
20
+ .ipc-player-bottom-left-content-wrap {
14
21
  position: absolute;
15
22
  z-index: 100;
16
- width: 100%;
17
23
  left: 0;
18
24
  bottom: 0;
25
+ display: flex;
26
+ flex-direction: row;
19
27
  }
20
-
21
- .ipc-player-content-item {
22
- --height: 48px;
23
- --gap: 10px;
28
+ // 右下角容器样式
29
+ .ipc-player-bottom-right-content-wrap {
30
+ position: absolute;
31
+ z-index: 100;
32
+ right: 0;
33
+ bottom: 0;
24
34
  display: flex;
25
- width: 100%;
26
- height: calc(var(--height) * var(--ipc-player-size-scale, 1));
27
- align-items: center;
28
- gap: calc(var(--gap) * var(--ipc-player-size-scale, 1));
29
- padding: 0 calc(16px * var(--ipc-player-size-scale, 1));
35
+ flex-direction: row;
36
+ }
37
+
38
+
39
+ // 左上角隐藏
40
+ .ipc-player-top-left-content-show {
41
+ transform: translate(0, 0);
42
+ transition: transform ease-in 0.3s;
43
+ }
44
+
45
+ .ipc-player-top-left-content-hide {
46
+ transform: translate(0, -110%);
47
+ transition: transform 0.3s ease-in-out;
48
+ }
49
+
50
+ // 右上角隐藏
51
+ .ipc-player-top-right-content-show {
30
52
  transform: translate(0, 0);
31
53
  transition: transform ease-in 0.3s;
54
+ }
55
+
56
+ .ipc-player-top-right-content-hide {
57
+ transform: translate(0, -110%);
58
+ transition: transform 0.3s ease-in-out;
59
+ }
60
+
61
+
62
+ // 左下角隐藏
63
+ .ipc-player-bottom-left-content-hide {
64
+ transform: translate(0, 110%);
65
+ transition: transform 0.3s ease-in-out;
66
+ }
67
+
68
+ .ipc-player-bottom-left-content-show {
69
+ transform: translate(0, 0);
70
+ transition: transform ease-in 0.3s;
71
+ }
72
+
73
+ // 右下角隐藏
74
+ .ipc-player-bottom-right-content-hide {
75
+ transform: translate(0, 110%);
76
+ transition: transform 0.3s ease-in-out;
77
+ }
78
+
79
+ .ipc-player-bottom-right-content-show {
80
+ transform: translate(0, 0);
81
+ transition: transform ease-in 0.3s;
82
+ }
83
+
84
+
85
+ // 左上角子元素内容区域样式
86
+ .ipc-player-top-left-content-container {
87
+ display: flex;
88
+ flex-direction: inherit;
89
+ }
32
90
 
33
- &.ipc-player-top-content {
34
- justify-content: flex-end;
91
+ // 右上角子元素内容区域样式
92
+ .ipc-player-top-right-content-container {
93
+ display: flex;
94
+ flex-direction: inherit;
95
+ }
96
+
97
+ // 左下角子元素内容区域样式
98
+ .ipc-player-bottom-left-content-container {
99
+ display: flex;
100
+ flex-direction: inherit;
101
+ }
35
102
 
36
- &.ipc-player-top-content-hide {
37
- transform: translate(0, -110%);
38
- }
39
- }
103
+ // 右下角子元素内容区域样式
104
+ .ipc-player-bottom-right-content-container {
105
+ display: flex;
106
+ flex-direction: inherit;
107
+ }
40
108
 
41
- &.ipc-player-bottom-content {
42
- &.ipc-player-bottom-content-hide {
43
- transform: translate(0, 110%)
44
- }
45
- }
109
+ .ipc-player-bottom-right-content-wrap {
110
+ position: absolute;
111
+ z-index: 100;
112
+ right: 0;
113
+ bottom: 0;
114
+ }
115
+
116
+ .ipc-player-bottom-right-item-container {
117
+ padding: 0 8px;
118
+ height: 100%;
119
+ display: flex;
120
+ justify-content: center;
121
+ align-items: center;
122
+ }
123
+
124
+
125
+ // 左上角子元素容器
126
+ .top-left-item-container {
127
+ padding: 0 8px;
128
+ }
129
+ .top-left-item-container:first-of-type {
130
+ padding: 0 8px 0 16px;
131
+ }
132
+ .top-left-item-container:last-of-type {
133
+ padding: 0 0 0 8px;
134
+ }
135
+ .top-left-item-container:only-of-type {
136
+ padding: 0 0 0 16px;
137
+ }
138
+
139
+
140
+ // 右上角子元素容器
141
+ .top-right-item-container {
142
+ padding: 0 8px;
143
+ }
144
+ .top-right-item-container:first-of-type {
145
+ padding: 0 8px 0 0;
146
+ }
147
+ .top-right-item-container:last-of-type {
148
+ padding: 0 16px 0 8px;
149
+ }
150
+ .top-right-item-container:only-of-type {
151
+ padding: 0 16px 0 0;
152
+ }
153
+
154
+ // 左下角子元素容器
155
+ .bottom-left-item-container {
156
+ padding: 0 8px;
157
+ }
158
+
159
+ .bottom-left-item-container:first-of-type {
160
+ padding: 0 8px 0 16px;
161
+ }
162
+ .bottom-left-item-container:last-of-type {
163
+ padding: 0 0 0 8px;
164
+ }
165
+ .bottom-left-item-container:only-of-type{
166
+ padding: 0 0 0 16px;
167
+ }
168
+
169
+ // 右下角子元素容器
170
+ .bottom-right-item-container {
171
+ padding: 0 8px;
172
+ }
173
+
174
+ .bottom-right-item-container:first-of-type {
175
+ padding: 0 8px 0 0;
176
+ }
177
+ .bottom-right-item-container:last-of-type {
178
+ padding: 0 16px 0 8px;
179
+ }
180
+ .bottom-right-item-container:only-of-type {
181
+ padding: 0 16px 0 0;
46
182
  }
183
+
47
184
  }
48
185
 
49
186
 
@@ -11,3 +11,9 @@ export interface IDpCode {
11
11
  }
12
12
  export declare function getDpIdsByCodes<T extends string>(devId: string, dpIds: T[]): Promise<Record<T, string>>;
13
13
  export declare const showMathPowValue: (value: any, scale: any) => string | 0;
14
+ export declare const getDevInfo: <T>(deviceId: string) => Promise<any>;
15
+ /**
16
+ * 根据DpCode获取枚举型DP的range是否包含对应项
17
+ * @param result: {code: number, msg: string}
18
+ */
19
+ export declare const getEnumRangeIsValid: (devId: any, dpCode: any, rangValue: any) => Promise<any>;
@@ -1,3 +1,4 @@
1
+ import IpcUtils from '@ray-js/ray-ipc-utils';
1
2
  export function getDpValue(options) {
2
3
  return new Promise((resolve, reject) => {
3
4
  ty.device.getDeviceInfo({
@@ -52,4 +53,55 @@ export const showMathPowValue = (value, scale) => {
52
53
  v = (Number(value) / Math.pow(10, scale)).toFixed(1);
53
54
  }
54
55
  return v;
56
+ };
57
+ export const getDevInfo = deviceId => {
58
+ return new Promise(resolve => {
59
+ try {
60
+ ty.device.getDeviceInfo({
61
+ deviceId,
62
+ success: res => {
63
+ resolve({
64
+ code: 0,
65
+ data: res
66
+ });
67
+ },
68
+ fail: err => {
69
+ resolve({
70
+ code: -1,
71
+ msg: err
72
+ });
73
+ }
74
+ });
75
+ } catch (err) {
76
+ resolve({
77
+ code: -1,
78
+ msg: String(err)
79
+ });
80
+ }
81
+ });
82
+ };
83
+
84
+ /**
85
+ * 根据DpCode获取枚举型DP的range是否包含对应项
86
+ * @param result: {code: number, msg: string}
87
+ */
88
+
89
+ export const getEnumRangeIsValid = async (devId, dpCode, rangValue) => {
90
+ const infoData = await IpcUtils.getDevInfo(devId);
91
+ if (infoData.code === 0) {
92
+ var _targetSchema$propert;
93
+ const {
94
+ schema
95
+ } = infoData.data;
96
+ const arrayFromValues = Object.values(schema);
97
+ const targetSchema = arrayFromValues.find(item => item.code === dpCode);
98
+ if ((targetSchema === null || targetSchema === void 0 || (_targetSchema$propert = targetSchema.property) === null || _targetSchema$propert === void 0 ? void 0 : _targetSchema$propert.type) === 'enum') {
99
+ const {
100
+ range
101
+ } = targetSchema.property;
102
+ return range.includes(rangValue);
103
+ }
104
+ return false;
105
+ }
106
+ return false;
55
107
  };
@@ -0,0 +1,3 @@
1
+ /** 美克风对讲按钮径向渐变 */
2
+ export declare const radialGradient: (color: any) => string;
3
+ export declare const adjustBrightness: (hex: any, factor: any) => string;
@@ -0,0 +1,15 @@
1
+ /** 美克风对讲按钮径向渐变 */
2
+ export const radialGradient = color => {
3
+ return `radial-gradient(at center, ${adjustBrightness(color, 0.88)}, ${adjustBrightness(color, 1.2)})`;
4
+ };
5
+ export const adjustBrightness = (hex, factor) => {
6
+ const color = parseInt(hex.slice(1), 16); // 去掉 # 转为数字
7
+ let r = color >> 16 & 0xff;
8
+ let g = color >> 8 & 0xff;
9
+ let b = color >> 0 & 0xff;
10
+ r = Math.min(255, Math.max(30, Math.floor(r * factor)));
11
+ g = Math.min(255, Math.max(30, Math.floor(g * factor)));
12
+ b = Math.min(255, Math.max(30, Math.floor(b * factor)));
13
+ const hexString = 1 << 24 | r << 16 | g << 8 | b;
14
+ return `#${hexString.toString(16).slice(1)}`;
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-21",
3
+ "version": "0.0.1-beta-23",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -31,21 +31,19 @@
31
31
  "release-it": "standard-version",
32
32
  "test": "yarn jest"
33
33
  },
34
- "peerDependencies": {
35
- "@ray-js/ray": "^1.4.9"
36
- },
34
+ "peerDependencies": {},
37
35
  "dependencies": {
38
- "@ray-js/ray-ipc-player": "2.0.18-beta-3",
36
+ "@ray-js/ray-ipc-player": "2.0.19-beta-beta-1",
39
37
  "@ray-js/ray-ipc-utils": "1.1.0-beta-12",
40
- "@ray-js/ipc-ptz-zoom": "0.0.2-beta-1",
38
+ "@ray-js/ipc-ptz-zoom": "0.0.2-beta-3",
41
39
  "clsx": "^1.2.1",
42
- "jotai": "^2.10.2"
40
+ "jotai": "^2.10.2",
41
+ "@ray-js/panel-sdk": "^1.13.1"
43
42
  },
44
43
  "devDependencies": {
45
44
  "@commitlint/cli": "^7.2.1",
46
45
  "@commitlint/config-conventional": "^9.0.1",
47
46
  "@ray-js/cli": "^1.4.9",
48
- "@ray-js/panel-sdk": "^1.13.0-storage.7",
49
47
  "@ray-js/ray": "^1.4.9",
50
48
  "@testing-library/react-hooks": "^8.0.1",
51
49
  "@types/jest": "^29.5.14",
@@ -56,7 +54,7 @@
56
54
  "standard-version": "9.3.2"
57
55
  },
58
56
  "resolutions": {
59
- "@ray-js/builder-mp": "1.5.37"
57
+ "@ray-js/builder-mp": "1.6.2"
60
58
  },
61
59
  "husky": {
62
60
  "hooks": {
@@ -1 +0,0 @@
1
- export * from './videoBitKbps';
@@ -1 +0,0 @@
1
- export * from './videoBitKbps';