@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
@@ -4,23 +4,29 @@ const _excluded = ["title", "duration"];
4
4
  import IPCUtils from '@ray-js/ray-ipc-utils';
5
5
  import { IntercomMode, MuteMode, ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
6
6
  import { createUseCtx } from './ctx';
7
- import { Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKbps, Muted, Resolution, Ptz } from '../plugins';
7
+ import { SmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKBP, Muted, Resolution, Ptz } from '../plugins';
8
8
  import { authorizeStatus } from '../utils/authorize';
9
9
  const createPlayContext = ty.createIpcPlayerContext;
10
10
  // const createPlayContext = () => null;
11
11
 
12
- const topContent = [{
12
+ const topLeftContent = [{
13
13
  id: 'Battery',
14
14
  content: Battery
15
+ }];
16
+ const topRightContent = [{
17
+ id: 'BatteryFull',
18
+ content: BatteryFull
15
19
  }, {
16
20
  id: 'TempHumidity',
17
21
  content: TempHumidity
18
22
  }, {
19
- id: 'VideoBitKbps',
20
- content: VideoBitKbps
23
+ id: 'VideoBitKBP',
24
+ content: VideoBitKBP
21
25
  }];
22
- const absoluteContent = [];
23
- const bottomContent = [{
26
+ const bottomLeftContent = [{
27
+ id: 'SmallIntercom',
28
+ content: SmallIntercom
29
+ }, {
24
30
  id: 'Screenshot',
25
31
  content: Screenshot
26
32
  }, {
@@ -35,10 +41,12 @@ const bottomContent = [{
35
41
  }, {
36
42
  id: 'Resolution',
37
43
  content: Resolution
38
- }, {
44
+ }];
45
+ const bottomRightContent = [{
39
46
  id: 'FullScreen',
40
47
  content: FullScreen
41
48
  }];
49
+ const absoluteContent = [];
42
50
  const toast = _ref => {
43
51
  let {
44
52
  title,
@@ -94,9 +102,11 @@ const setMuteMemoryState = (devId, value) => {
94
102
  };
95
103
  export const useCtx = createUseCtx({
96
104
  createPlayContext,
97
- defaultTopContent: topContent,
105
+ defaultTopLeftContent: topLeftContent,
106
+ defaultTopRightContent: topRightContent,
107
+ defaultBottomLeftContent: bottomLeftContent,
108
+ defaultBottomRightContent: bottomRightContent,
98
109
  defaultAbsoluteContent: absoluteContent,
99
- defaultBottomContent: bottomContent,
100
110
  authorizeStatus: authorizeStatus,
101
111
  toast,
102
112
  getMemoryState,
package/lib/ctx/ctx.d.ts CHANGED
@@ -2,13 +2,15 @@ import { ComponentConfig, UseCtx } from '../interface';
2
2
  import type { createPlayContext, AuthorizeStatus, Toast, GetMemoryState, SetMuteMemoryState } from './ports.output';
3
3
  type Depend = {
4
4
  createPlayContext: createPlayContext;
5
- defaultTopContent?: ComponentConfig[];
6
- defaultBottomContent?: ComponentConfig[];
5
+ defaultTopLeftContent?: ComponentConfig[];
6
+ defaultTopRightContent?: ComponentConfig[];
7
+ defaultBottomLeftContent?: ComponentConfig[];
8
+ defaultBottomRightContent?: ComponentConfig[];
7
9
  defaultAbsoluteContent?: ComponentConfig[];
8
10
  authorizeStatus: AuthorizeStatus;
9
11
  toast: Toast;
10
12
  getMemoryState: GetMemoryState;
11
13
  setMuteMemoryState: SetMuteMemoryState;
12
14
  };
13
- export declare const createUseCtx: ({ createPlayContext, defaultTopContent, defaultBottomContent, defaultAbsoluteContent, authorizeStatus, toast, getMemoryState, setMuteMemoryState, }: Depend) => UseCtx;
15
+ export declare const createUseCtx: ({ createPlayContext, defaultTopLeftContent, defaultTopRightContent, defaultBottomLeftContent, defaultBottomRightContent, defaultAbsoluteContent, authorizeStatus, toast, getMemoryState, setMuteMemoryState, }: Depend) => UseCtx;
14
16
  export {};
package/lib/ctx/ctx.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { useRef, useCallback, useEffect } from 'react';
2
+ import Strings from '../i18n';
2
3
  import { useAtom, updateAtom, getDefaultStore, useStore } from './store';
3
4
  import { PlayState, IntercomMode } from '../interface';
4
5
  import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
@@ -6,8 +7,10 @@ const SAVE_TO_ALBUM = 1;
6
7
  export const createUseCtx = _ref => {
7
8
  let {
8
9
  createPlayContext,
9
- defaultTopContent,
10
- defaultBottomContent,
10
+ defaultTopLeftContent,
11
+ defaultTopRightContent,
12
+ defaultBottomLeftContent,
13
+ defaultBottomRightContent,
11
14
  defaultAbsoluteContent,
12
15
  authorizeStatus,
13
16
  toast,
@@ -17,8 +20,10 @@ export const createUseCtx = _ref => {
17
20
  return _ref2 => {
18
21
  let {
19
22
  devId,
20
- initTopContent,
21
- initBottomContent,
23
+ initTopLeftContent,
24
+ initTopRightContent,
25
+ initBottomLeftContent,
26
+ initBottomRightContent,
22
27
  initAbsoluteContent,
23
28
  saveToAlbum = SAVE_TO_ALBUM
24
29
  } = _ref2;
@@ -29,11 +34,14 @@ export const createUseCtx = _ref => {
29
34
  // 录像中
30
35
  const [recording] = useAtom(false);
31
36
 
37
+ // 录像是否不可点击
38
+ const [recordingDisabled, setRecordingDisabled] = useAtom(false);
39
+
32
40
  // 静音 true 代表静音 false 代表不静音
33
41
  const [mute] = useAtom(true);
34
42
 
35
43
  // 品牌色 默认
36
- const [brandColor, setBrandColor] = useAtom('#FF592A');
44
+ const [brandColor, setBrandColor] = useAtom('#4b9ae9');
37
45
 
38
46
  // ptz 是否点击
39
47
  const [ptzActive, setPtzActive] = useAtom(false);
@@ -55,8 +63,10 @@ export const createUseCtx = _ref => {
55
63
  const setPlayState = useCallback(value => {
56
64
  updateAtom(playState, value);
57
65
  }, [playState]);
58
- const [topContent] = useAtom(initTopContent || defaultTopContent || []);
59
- const [bottomContent] = useAtom(initBottomContent || defaultBottomContent || []);
66
+ const [topLeftContent] = useAtom(initTopLeftContent || defaultTopLeftContent || []);
67
+ const [topRightContent] = useAtom(initTopRightContent || defaultTopRightContent || []);
68
+ const [bottomLeftContent] = useAtom(initBottomLeftContent || defaultBottomLeftContent || []);
69
+ const [bottomRightContent] = useAtom(initBottomRightContent || defaultBottomRightContent || []);
60
70
  const [absoluteContent] = useAtom(initAbsoluteContent || defaultAbsoluteContent || []);
61
71
  const {
62
72
  _playState
@@ -135,6 +145,7 @@ export const createUseCtx = _ref => {
135
145
  saveToAlbum,
136
146
  screenType,
137
147
  recording,
148
+ recordingDisabled,
138
149
  mute,
139
150
  resolution,
140
151
  resolutionList,
@@ -190,7 +201,9 @@ export const createUseCtx = _ref => {
190
201
  const store = getDefaultStore();
191
202
  const _recording = store.get(recording);
192
203
  if (target && target === _recording) {
193
- console.log('Cannot record during video recording');
204
+ toast({
205
+ title: Strings.getLang('ipc_player_recording_now_tip')
206
+ });
194
207
  return false;
195
208
  }
196
209
  return new Promise((resolve, reject) => {
@@ -208,15 +221,15 @@ export const createUseCtx = _ref => {
208
221
  } else {
209
222
  IPCPlayerInstance.current.stopRecord({
210
223
  saveToAlbum,
211
- success: () => {
224
+ success: res => {
212
225
  updateAtom(recording, false);
213
- resolve(true);
226
+ resolve(res);
214
227
  },
215
228
  fail: err => {
216
- updateAtom(recording, true);
229
+ updateAtom(recording, false);
217
230
  reject(err);
218
231
  const errObj = err.innerError || err || {};
219
- const errMsg = errObj.errorMsg || I18n.t('error_recording');
232
+ const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_stop_recording_err');
220
233
  toast({
221
234
  title: errMsg
222
235
  });
@@ -225,30 +238,46 @@ export const createUseCtx = _ref => {
225
238
  }
226
239
  });
227
240
  },
241
+ setRecordingDisabled,
228
242
  setPtzActive,
229
243
  setFullResolutionActive,
230
244
  setScreenType,
231
- topContent,
232
- bottomContent,
245
+ topLeftContent,
246
+ topRightContent,
247
+ bottomLeftContent,
248
+ bottomRightContent,
233
249
  absoluteContent,
234
- addContent: (type, config) => {
235
- function createNewData(originData, newData) {
236
- if (newData instanceof Array) return [...originData, ...newData];
237
- return [...originData, newData];
238
- }
239
- if (type === 'top') {
240
- updateAtom(topContent, prevValue => createNewData(prevValue, config));
241
- } else if (type === 'bottom') {
242
- updateAtom(bottomContent, prevValue => createNewData(prevValue, config));
250
+ addContent: function (type, config) {
251
+ let position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
252
+ // 组合数据, 保存到对应位置, 并去重
253
+ const createNewData = (originData, newData, position) => {
254
+ // 如果newData是数组, 则插入整个数组
255
+ if (Array.isArray(newData)) {
256
+ return [...originData.slice(0, position), ...newData, ...originData.slice(position)];
257
+ }
258
+ return [...originData.slice(0, position), newData, ...originData.slice(position)];
259
+ };
260
+ if (type === 'topLeft') {
261
+ updateAtom(topLeftContent, prevValue => createNewData(prevValue, config, position));
262
+ } else if (type === 'topRight') {
263
+ updateAtom(topRightContent, prevValue => createNewData(prevValue, config, position));
264
+ } else if (type === 'bottomLeft') {
265
+ updateAtom(bottomLeftContent, prevValue => createNewData(prevValue, config, position));
266
+ } else if (type === 'bottomRight') {
267
+ updateAtom(bottomRightContent, prevValue => createNewData(prevValue, config, position));
243
268
  } else {
244
- updateAtom(absoluteContent, prevValue => createNewData(prevValue, config));
269
+ updateAtom(absoluteContent, prevValue => createNewData(prevValue, config, position));
245
270
  }
246
271
  },
247
272
  deleteContent: (type, id) => {
248
- if (type === 'top') {
249
- updateAtom(topContent, prevValue => prevValue.filter(item => item.id !== id));
250
- } else if (type === 'bottom') {
251
- updateAtom(bottomContent, prevValue => prevValue.filter(item => item.id !== id));
273
+ if (type === 'topLeft') {
274
+ updateAtom(topLeftContent, prevValue => prevValue.filter(item => item.id !== id));
275
+ } else if (type === 'topRight') {
276
+ updateAtom(topRightContent, prevValue => prevValue.filter(item => item.id !== id));
277
+ } else if (type === 'bottomLeft') {
278
+ updateAtom(bottomLeftContent, prevValue => prevValue.filter(item => item.id !== id));
279
+ } else if (type === 'bottomRight') {
280
+ updateAtom(bottomLeftContent, prevValue => prevValue.filter(item => item.id !== id));
252
281
  } else {
253
282
  updateAtom(absoluteContent, prevValue => prevValue.filter(item => item.id !== id));
254
283
  }
@@ -1,6 +1,6 @@
1
1
  import { RetAtom } from '../interface';
2
2
  export { getDefaultStore } from 'jotai';
3
- export declare const topContent: import("jotai").PrimitiveAtom<never[]> & {
3
+ export declare const topLeftContent: import("jotai").PrimitiveAtom<never[]> & {
4
4
  init: never[];
5
5
  };
6
6
  type Action<T> = T | ((prevValue: T) => T);
package/lib/ctx/store.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useRef } from 'react';
2
2
  import { atom, useAtomValue, getDefaultStore } from 'jotai';
3
3
  export { getDefaultStore } from 'jotai';
4
- export const topContent = atom([]);
4
+ export const topLeftContent = atom([]);
5
5
  export const useAtom = defaultValue => {
6
6
  const ref = useRef();
7
7
  if (!ref.current) {
@@ -4,19 +4,47 @@ declare const Strings: kit.I18N<{
4
4
  ipc_player_resolution_HD: string;
5
5
  ipc_player_resolution_SD: string;
6
6
  ipc_player_current_resolution_is_equal: string;
7
+ ipc_player_screenshot_success_tip: string;
8
+ ipc_player_error_screenshot_error_tip: string;
9
+ ipc_player_record_success_tip: string;
10
+ ipc_player_shot_success_check: string;
11
+ ipc_player_record_success_check: string;
12
+ ipc_player_recording_now_tip: string;
13
+ ipc_player_stop_recording_err: string;
7
14
  };
8
15
  zh: {
9
16
  ipc_player_resolution_HD: string;
10
17
  ipc_player_resolution_SD: string;
11
18
  ipc_player_current_resolution_is_equal: string;
19
+ ipc_player_screenshot_success_tip: string;
20
+ ipc_player_error_screenshot_error_tip: string;
21
+ ipc_player_record_success_tip: string;
22
+ ipc_player_shot_success_check: string;
23
+ ipc_player_record_success_check: string;
24
+ ipc_player_recording_now_tip: string;
25
+ ipc_player_stop_recording_err: string;
12
26
  };
13
27
  }, {
14
28
  ipc_player_resolution_HD: string;
15
29
  ipc_player_resolution_SD: string;
16
30
  ipc_player_current_resolution_is_equal: string;
31
+ ipc_player_screenshot_success_tip: string;
32
+ ipc_player_error_screenshot_error_tip: string;
33
+ ipc_player_record_success_tip: string;
34
+ ipc_player_shot_success_check: string;
35
+ ipc_player_record_success_check: string;
36
+ ipc_player_recording_now_tip: string;
37
+ ipc_player_stop_recording_err: string;
17
38
  } | {
18
39
  ipc_player_resolution_HD: string;
19
40
  ipc_player_resolution_SD: string;
20
41
  ipc_player_current_resolution_is_equal: string;
42
+ ipc_player_screenshot_success_tip: string;
43
+ ipc_player_error_screenshot_error_tip: string;
44
+ ipc_player_record_success_tip: string;
45
+ ipc_player_shot_success_check: string;
46
+ ipc_player_record_success_check: string;
47
+ ipc_player_recording_now_tip: string;
48
+ ipc_player_stop_recording_err: string;
21
49
  }>;
22
50
  export default Strings;
@@ -3,11 +3,25 @@ declare const _default: {
3
3
  ipc_player_resolution_HD: string;
4
4
  ipc_player_resolution_SD: string;
5
5
  ipc_player_current_resolution_is_equal: string;
6
+ ipc_player_screenshot_success_tip: string;
7
+ ipc_player_error_screenshot_error_tip: string;
8
+ ipc_player_record_success_tip: string;
9
+ ipc_player_shot_success_check: string;
10
+ ipc_player_record_success_check: string;
11
+ ipc_player_recording_now_tip: string;
12
+ ipc_player_stop_recording_err: string;
6
13
  };
7
14
  zh: {
8
15
  ipc_player_resolution_HD: string;
9
16
  ipc_player_resolution_SD: string;
10
17
  ipc_player_current_resolution_is_equal: string;
18
+ ipc_player_screenshot_success_tip: string;
19
+ ipc_player_error_screenshot_error_tip: string;
20
+ ipc_player_record_success_tip: string;
21
+ ipc_player_shot_success_check: string;
22
+ ipc_player_record_success_check: string;
23
+ ipc_player_recording_now_tip: string;
24
+ ipc_player_stop_recording_err: string;
11
25
  };
12
26
  };
13
27
  export default _default;
@@ -2,11 +2,25 @@ export default {
2
2
  en: {
3
3
  ipc_player_resolution_HD: 'HD',
4
4
  ipc_player_resolution_SD: 'SD',
5
- ipc_player_current_resolution_is_equal: 'Already at current clarity'
5
+ ipc_player_current_resolution_is_equal: 'Already at current clarity',
6
+ ipc_player_screenshot_success_tip: 'Screenshot saved to album',
7
+ ipc_player_error_screenshot_error_tip: 'Screenshot failed. Please try again later.',
8
+ ipc_player_record_success_tip: 'Recording saved to album',
9
+ ipc_player_shot_success_check: 'View',
10
+ ipc_player_record_success_check: 'View',
11
+ ipc_player_recording_now_tip: 'Recording in progress...',
12
+ ipc_player_stop_recording_err: 'Failed to stop recording. Please exit and try again.'
6
13
  },
7
14
  zh: {
8
15
  ipc_player_resolution_HD: '高清',
9
16
  ipc_player_resolution_SD: '标清',
10
- ipc_player_current_resolution_is_equal: '已是当前清晰度'
17
+ ipc_player_current_resolution_is_equal: '已是当前清晰度',
18
+ ipc_player_screenshot_success_tip: '截图已保存在APP相册',
19
+ ipc_player_error_screenshot_error_tip: '截图失败了,请稍后再试',
20
+ ipc_player_record_success_tip: '录像已保存在APP相册',
21
+ ipc_player_shot_success_check: '查看',
22
+ ipc_player_record_success_check: '查看',
23
+ ipc_player_recording_now_tip: '正在录像中...',
24
+ ipc_player_stop_recording_err: '结束录像失败,请退出重试'
11
25
  }
12
26
  };
@@ -26,13 +26,15 @@ export declare const enum PlayState {
26
26
  }
27
27
  export type UseCtx = (options: {
28
28
  devId: string;
29
- initTopContent?: ComponentConfig[];
30
- initBottomContent?: ComponentConfig[];
29
+ initTopLeftContent?: ComponentConfig[];
30
+ initTopRightContent?: ComponentConfig[];
31
+ initBottomLeftContent?: ComponentConfig[];
32
+ initBottomRightContent?: ComponentConfig[];
31
33
  initAbsoluteContent?: ComponentConfig[];
32
34
  saveToAlbum?: 0 | 1;
33
35
  }) => {
34
36
  devId: string;
35
- brandColor: string;
37
+ brandColor: RetAtom<string>;
36
38
  saveToAlbum: 0 | 1;
37
39
  screenType: RetAtom<ScreenType>;
38
40
  recording: RetAtom<boolean>;
@@ -45,8 +47,10 @@ export type UseCtx = (options: {
45
47
  fullResolutionActive: RetAtom<boolean>;
46
48
  playState: RetAtom<PlayState>;
47
49
  IPCPlayerInstance: IpcContext;
48
- topContent: RetAtom<ComponentConfig[]>;
49
- bottomContent: RetAtom<ComponentConfig[]>;
50
+ topLeftContent: RetAtom<ComponentConfig[]>;
51
+ topRightContent: RetAtom<ComponentConfig[]>;
52
+ bottomLeftContent: RetAtom<ComponentConfig[]>;
53
+ bottomRightContent: RetAtom<ComponentConfig[]>;
50
54
  absoluteContent: RetAtom<ComponentConfig[]>;
51
55
  setBrandColor: (color: string) => void;
52
56
  setScreenType: (type: ScreenType) => void;
@@ -60,16 +64,17 @@ export type UseCtx = (options: {
60
64
  changeStreamStatus: (value: PlayerStreamStatus) => void;
61
65
  getStreamStatus: () => PlayerStreamStatus;
62
66
  setPlayState: (value: PlayState) => void;
63
- addContent: <T>(type: 'top' | 'bottom' | 'absolute', config: ComponentConfig<T> | ComponentConfig<T>[]) => void;
64
- deleteContent: (type: 'top' | 'bottom' | 'absolute', id: string) => void;
67
+ addContent: <T>(type: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'absolute', config: ComponentConfig<T> | ComponentConfig<T>[]) => void;
68
+ deleteContent: (type: 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'absolute', id: string) => void;
65
69
  toast: Toast;
66
70
  };
67
71
  export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
68
72
  id: string;
69
73
  content: (props: T) => React.ReactElement;
70
74
  initProps?: T;
71
- absolutePosition?: Pick<React.CSSProperties, 'top' | 'left' | 'right' | 'bottom'>;
75
+ absolutePosition?: React.CSSProperties;
72
76
  absoluteContentClassName?: string;
77
+ absoluteContentStyle?: React.CSSProperties;
73
78
  };
74
79
  export type ComponentConfigProps = {
75
80
  IPCPlayerContext: IpcContext;
@@ -78,3 +83,8 @@ export type PlayStatusData = {
78
83
  playState: PlayState;
79
84
  playCode: number;
80
85
  };
86
+ export type RecordInfoData = boolean | {
87
+ tempImagePath: string;
88
+ filePath: string;
89
+ thumbPath: string;
90
+ };
@@ -3,7 +3,7 @@ export declare const Battery: import("react").FunctionComponent<{
3
3
  IPCPlayerContext: IpcContext;
4
4
  } & {
5
5
  devId: string;
6
- brandColor: string;
6
+ brandColor: import("../..").RetAtom<string>;
7
7
  saveToAlbum: 0 | 1;
8
8
  screenType: import("../..").RetAtom<import("../..").ScreenType>;
9
9
  recording: import("../..").RetAtom<boolean>;
@@ -16,8 +16,10 @@ export declare const Battery: import("react").FunctionComponent<{
16
16
  fullResolutionActive: import("../..").RetAtom<boolean>;
17
17
  playState: import("../..").RetAtom<import("../..").PlayState>;
18
18
  IPCPlayerInstance: IpcContext;
19
- topContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
20
- bottomContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
19
+ topLeftContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
20
+ topRightContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
21
+ bottomLeftContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
22
+ bottomRightContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
21
23
  absoluteContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
22
24
  setBrandColor: (color: string) => void;
23
25
  setScreenType: (type: import("../..").ScreenType) => void;
@@ -31,8 +33,48 @@ export declare const Battery: import("react").FunctionComponent<{
31
33
  changeStreamStatus: (value: import("../..").PlayerStreamStatus) => void;
32
34
  getStreamStatus: () => import("../..").PlayerStreamStatus;
33
35
  setPlayState: (value: import("../..").PlayState) => void;
34
- addContent: <T>(type: "absolute" | "top" | "bottom", config: import("../..").ComponentConfig<T> | import("../..").ComponentConfig<T>[]) => void;
35
- deleteContent: (type: "absolute" | "top" | "bottom", id: string) => void;
36
+ addContent: <T>(type: "absolute" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight", config: import("../..").ComponentConfig<T> | import("../..").ComponentConfig<T>[]) => void;
37
+ deleteContent: (type: "absolute" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight", id: string) => void;
38
+ toast: import("../../ports.output").Toast;
39
+ } & {
40
+ className?: string | undefined;
41
+ }>;
42
+ export declare const BatteryFull: import("react").FunctionComponent<{
43
+ IPCPlayerContext: IpcContext;
44
+ } & {
45
+ devId: string;
46
+ brandColor: import("../..").RetAtom<string>;
47
+ saveToAlbum: 0 | 1;
48
+ screenType: import("../..").RetAtom<import("../..").ScreenType>;
49
+ recording: import("../..").RetAtom<boolean>;
50
+ mute: import("../..").RetAtom<boolean>;
51
+ intercom: import("../..").RetAtom<boolean>;
52
+ intercomMode: import("../..").RetAtom<import("@ray-js/ray-ipc-utils/lib/interface").IntercomMode>;
53
+ ptzActive: import("../..").RetAtom<boolean>;
54
+ resolution: import("../..").RetAtom<string>;
55
+ resolutionList: import("../..").RetAtom<string[]>;
56
+ fullResolutionActive: import("../..").RetAtom<boolean>;
57
+ playState: import("../..").RetAtom<import("../..").PlayState>;
58
+ IPCPlayerInstance: IpcContext;
59
+ topLeftContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
60
+ topRightContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
61
+ bottomLeftContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
62
+ bottomRightContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
63
+ absoluteContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
64
+ setBrandColor: (color: string) => void;
65
+ setScreenType: (type: import("../..").ScreenType) => void;
66
+ setPtzActive: (type: boolean) => void;
67
+ setResolution: (type: string) => void;
68
+ setResolutionList: (type: string[]) => void;
69
+ setFullResolutionActive: (type: boolean) => void;
70
+ setRecording: (value: boolean) => Promise<boolean>;
71
+ setIntercom: (value: boolean) => Promise<boolean>;
72
+ setMute: (value: boolean) => Promise<boolean>;
73
+ changeStreamStatus: (value: import("../..").PlayerStreamStatus) => void;
74
+ getStreamStatus: () => import("../..").PlayerStreamStatus;
75
+ setPlayState: (value: import("../..").PlayState) => void;
76
+ addContent: <T>(type: "absolute" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight", config: import("../..").ComponentConfig<T> | import("../..").ComponentConfig<T>[]) => void;
77
+ deleteContent: (type: "absolute" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight", id: string) => void;
36
78
  toast: import("../../ports.output").Toast;
37
79
  } & {
38
80
  className?: string | undefined;
@@ -1,5 +1,9 @@
1
1
  import { createBattery } from './battery';
2
+ import { createBatteryFull } from './batteryFull';
2
3
  import { useBattery } from '../../hooks';
3
4
  export const Battery = createBattery({
4
5
  useBattery // todo
6
+ });
7
+ export const BatteryFull = createBatteryFull({
8
+ useBattery // todo
5
9
  });
@@ -10,24 +10,24 @@ export const createBattery = _ref => {
10
10
  return props => {
11
11
  const {
12
12
  className,
13
- devId,
14
- screenType
13
+ devId
15
14
  } = props;
16
- const store = useStore({
15
+ const {
17
16
  screenType
17
+ } = useStore({
18
+ screenType: props.screenType
18
19
  });
19
20
  const {
20
21
  batteryValue,
21
22
  batteryCharging
22
23
  } = useBattery(devId);
23
- if (batteryValue === undefined) {
24
+ if (batteryValue === undefined || screenType === 'full') {
24
25
  return null;
25
26
  }
26
27
  return /*#__PURE__*/React.createElement(View, {
27
- className: clsx('ipc-player-plugin-battery', {
28
- 'ipc-player-plugin-battery-relative': store.screenType === 'full',
29
- 'ipc-player-plugin-battery-absolute': store.screenType === 'vertical'
30
- }, className)
28
+ className: clsx(className)
29
+ }, /*#__PURE__*/React.createElement(View, {
30
+ className: "ipc-player-plugin-battery"
31
31
  }, /*#__PURE__*/React.createElement(View, {
32
32
  className: "ipc-player-plugin-battery-border"
33
33
  }, /*#__PURE__*/React.createElement(View, {
@@ -41,6 +41,6 @@ export const createBattery = _ref => {
41
41
  className: "ipc-player-plugin-battery-value-value"
42
42
  }))), /*#__PURE__*/React.createElement(Text, {
43
43
  className: "ipc-player-plugin-battery-text"
44
- }, batteryValue, "%"));
44
+ }, batteryValue, "%")));
45
45
  };
46
46
  };
@@ -4,20 +4,10 @@
4
4
  height: calc(24px * var(--ipc-player-size-scale, 1));
5
5
  padding: 0 calc(9px * var(--ipc-player-size-scale, 1));
6
6
  border-radius: calc(24px * var(--ipc-player-size-scale, 1));
7
- background-color: rgba(255, 255, 255, 0.1);
8
- backdrop-filter: blur(10px);
9
- &.ipc-player-plugin-battery-absolute {
10
- position: absolute;
11
- top: 50%;
12
- left: calc(16px * var(--ipc-player-size-scale, 1));
13
- transform: translateY(-50%);
14
- }
15
- &.ipc-player-plugin-battery-relative {
16
- position: relative;
17
- top: 0;
18
- left: 0;
19
- transform: translateY(0);
20
- }
7
+ background-color: rgba(255, 255, 255, 0.3);
8
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
9
+ // backdrop-filter: blur(10px);
10
+
21
11
  .ipc-player-plugin-battery-border {
22
12
  position: relative;
23
13
  width: calc(16px * var(--ipc-player-size-scale, 1));
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { UseBattery } from '../../ports.output';
3
+ import { ComponentConfigProps } from '../../interface';
4
+ import './battery.less';
5
+ type Depend = {
6
+ useBattery: UseBattery;
7
+ };
8
+ type Props = ComponentConfigProps & {
9
+ className?: string;
10
+ };
11
+ type CreateBattery = (deps: Depend) => React.FunctionComponent<Props>;
12
+ export declare const createBatteryFull: CreateBattery;
13
+ export {};
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { View, Text } from '@ray-js/ray';
3
+ import clsx from 'clsx';
4
+ import { useStore } from '../../ctx/store';
5
+ import './battery.less';
6
+ export const createBatteryFull = _ref => {
7
+ let {
8
+ useBattery
9
+ } = _ref;
10
+ return props => {
11
+ const {
12
+ className,
13
+ devId
14
+ } = props;
15
+ const {
16
+ screenType
17
+ } = useStore({
18
+ screenType: props.screenType
19
+ });
20
+ const {
21
+ batteryValue,
22
+ batteryCharging
23
+ } = useBattery(devId);
24
+ if (batteryValue === undefined || screenType === 'vertical') {
25
+ return null;
26
+ }
27
+ return /*#__PURE__*/React.createElement(View, {
28
+ className: clsx(className)
29
+ }, /*#__PURE__*/React.createElement(View, {
30
+ className: "ipc-player-plugin-battery"
31
+ }, /*#__PURE__*/React.createElement(View, {
32
+ className: "ipc-player-plugin-battery-border"
33
+ }, /*#__PURE__*/React.createElement(View, {
34
+ className: "ipc-player-plugin-battery-border-1"
35
+ }), /*#__PURE__*/React.createElement(View, {
36
+ className: "ipc-player-plugin-battery-value-wrap"
37
+ }, /*#__PURE__*/React.createElement(View, {
38
+ style: {
39
+ width: `${batteryValue}%`
40
+ },
41
+ className: "ipc-player-plugin-battery-value-value"
42
+ }))), /*#__PURE__*/React.createElement(Text, {
43
+ className: "ipc-player-plugin-battery-text"
44
+ }, batteryValue, "%")));
45
+ };
46
+ };