@ray-js/ipc-player-integration 0.0.1-beta-12 → 0.0.1-beta-14

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 (37) hide show
  1. package/lib/ctx/ctx.composition.js +45 -2
  2. package/lib/ctx/ctx.d.ts +4 -2
  3. package/lib/ctx/ctx.js +75 -33
  4. package/lib/ctx/ports.output.d.ts +7 -1
  5. package/lib/ctx/store.d.ts +3 -2
  6. package/lib/ctx/store.js +1 -1
  7. package/lib/interface.d.ts +7 -2
  8. package/lib/interface.js +1 -0
  9. package/lib/plugins/battery/battery.composition.d.ts +5 -0
  10. package/lib/plugins/fullScreen/fullScreen.js +50 -19
  11. package/lib/plugins/fullScreen/voiceIntercom.js +7 -3
  12. package/lib/plugins/index.d.ts +1 -0
  13. package/lib/plugins/index.js +1 -0
  14. package/lib/plugins/muted/muted.js +14 -29
  15. package/lib/plugins/ptz/index.d.ts +1 -0
  16. package/lib/plugins/ptz/index.js +1 -0
  17. package/lib/plugins/ptz/ptz.d.ts +4 -0
  18. package/lib/plugins/ptz/ptz.js +67 -0
  19. package/lib/plugins/ptz/ptz.less +42 -0
  20. package/lib/plugins/ptz/ptzControl.d.ts +4 -0
  21. package/lib/plugins/ptz/ptzControl.js +64 -0
  22. package/lib/plugins/recordVideo/recordVideo.less +3 -1
  23. package/lib/plugins/resolution/fullResolutionControl.d.ts +4 -0
  24. package/lib/plugins/resolution/fullResolutionControl.js +31 -0
  25. package/lib/plugins/resolution/resolution.js +37 -17
  26. package/lib/plugins/resolution/resolution.less +43 -7
  27. package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +1 -1
  28. package/lib/plugins/voiceIntercom/voiceIntercom.js +32 -12
  29. package/lib/ports.output.d.ts +1 -0
  30. package/lib/ports.output.js +7 -1
  31. package/lib/ui/bottomContent.js +5 -3
  32. package/lib/ui/constant.d.ts +4 -0
  33. package/lib/ui/constant.js +5 -1
  34. package/lib/ui/topContent.js +5 -3
  35. package/lib/ui/ui.d.ts +1 -0
  36. package/lib/ui/ui.js +23 -5
  37. package/package.json +3 -2
@@ -1,8 +1,10 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  const _excluded = ["title", "duration"];
4
+ import IPCUtils from '@ray-js/ray-ipc-utils';
5
+ import { IntercomMode, MuteMode } from '@ray-js/ray-ipc-utils/lib/interface';
4
6
  import { createUseCtx } from './ctx';
5
- import { Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKbps, Muted, Resolution } from '../plugins';
7
+ import { Battery, Screenshot, TempHumidity, RecordVideo, FullScreen, VideoBitKbps, Muted, Resolution, Ptz } from '../plugins';
6
8
  import { authorizeStatus } from '../utils/authorize';
7
9
  const createPlayContext = ty.createIpcPlayerContext;
8
10
  // const createPlayContext = () => null;
@@ -27,6 +29,9 @@ const bottomContent = [{
27
29
  }, {
28
30
  id: 'Muted',
29
31
  content: Muted
32
+ }, {
33
+ id: 'Ptz',
34
+ content: Ptz
30
35
  }, {
31
36
  id: 'Resolution',
32
37
  content: Resolution
@@ -46,11 +51,49 @@ const toast = _ref => {
46
51
  icon: 'none'
47
52
  }, config));
48
53
  };
54
+ const getMemoryState = devId => {
55
+ const defaultValue = {
56
+ mute: true,
57
+ intercomMode: IntercomMode.TwoWay
58
+ };
59
+ return new Promise(resolve => {
60
+ IPCUtils.getCameraConfigInfo(devId).then(res => {
61
+ if (res.code === -1) {
62
+ return resolve(defaultValue);
63
+ }
64
+ const value = res.data.microphoneSettings.cachedMuteMode === MuteMode.OFF;
65
+ return resolve({
66
+ mute: value,
67
+ intercomMode: res.data.intercomInfo.cachedIntercomMode
68
+ });
69
+ }).catch(() => {
70
+ resolve(defaultValue);
71
+ });
72
+ });
73
+ };
74
+ const setMuteMemoryState = (devId, value) => {
75
+ const storageKey = `${devId}_microphone`;
76
+ const originStorage = ty.getStorageSync({
77
+ key: storageKey
78
+ });
79
+ const newData = originStorage ? _objectSpread({}, originStorage) : null;
80
+ if (newData) {
81
+ const muteMode = value ? MuteMode.OFF : MuteMode.ON;
82
+ newData.cachedMuteMode = muteMode;
83
+ // @ts-ignore
84
+ ty.setStorageSync({
85
+ key: storageKey,
86
+ data: newData
87
+ });
88
+ }
89
+ };
49
90
  export const useCtx = createUseCtx({
50
91
  createPlayContext,
51
92
  defaultTopContent: topContent,
52
93
  defaultAbsoluteContent: absoluteContent,
53
94
  defaultBottomContent: bottomContent,
54
95
  authorizeStatus: authorizeStatus,
55
- toast
96
+ toast,
97
+ getMemoryState,
98
+ setMuteMemoryState
56
99
  });
package/lib/ctx/ctx.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ComponentConfig, UseCtx } from '../interface';
2
- import type { createPlayContext, AuthorizeStatus, Toast } from './ports.output';
2
+ import type { createPlayContext, AuthorizeStatus, Toast, GetMemoryState, SetMuteMemoryState } from './ports.output';
3
3
  type Depend = {
4
4
  createPlayContext: createPlayContext;
5
5
  defaultTopContent?: ComponentConfig[];
@@ -7,6 +7,8 @@ type Depend = {
7
7
  defaultAbsoluteContent?: ComponentConfig[];
8
8
  authorizeStatus: AuthorizeStatus;
9
9
  toast: Toast;
10
+ getMemoryState: GetMemoryState;
11
+ setMuteMemoryState: SetMuteMemoryState;
10
12
  };
11
- export declare const createUseCtx: ({ createPlayContext, defaultTopContent, defaultBottomContent, defaultAbsoluteContent, authorizeStatus, toast, }: Depend) => UseCtx;
13
+ export declare const createUseCtx: ({ createPlayContext, defaultTopContent, defaultBottomContent, defaultAbsoluteContent, authorizeStatus, toast, getMemoryState, setMuteMemoryState, }: Depend) => UseCtx;
12
14
  export {};
package/lib/ctx/ctx.js CHANGED
@@ -1,6 +1,6 @@
1
- import { useRef, useCallback } from 'react';
2
- import { useAtom, updateAtom, getDefaultStore } from './store';
3
- import { PlayState } from '../interface';
1
+ import { useRef, useCallback, useEffect } from 'react';
2
+ import { useAtom, updateAtom, getDefaultStore, useStore } from './store';
3
+ import { PlayState, IntercomMode } from '../interface';
4
4
  const SAVE_TO_ALBUM = 1;
5
5
  export const createUseCtx = _ref => {
6
6
  let {
@@ -9,7 +9,9 @@ export const createUseCtx = _ref => {
9
9
  defaultBottomContent,
10
10
  defaultAbsoluteContent,
11
11
  authorizeStatus,
12
- toast
12
+ toast,
13
+ getMemoryState,
14
+ setMuteMemoryState
13
15
  } = _ref;
14
16
  return _ref2 => {
15
17
  let {
@@ -21,29 +23,81 @@ export const createUseCtx = _ref => {
21
23
  } = _ref2;
22
24
  const streamStatus = useRef();
23
25
  // 全屏、竖屏
24
- const screenType = useAtom('vertical');
26
+ const [screenType, setScreenType] = useAtom('vertical');
27
+
25
28
  // 录像中
26
- const recording = useAtom(false);
29
+ const [recording] = useAtom(false);
27
30
 
28
- // 静音
29
- const mute = useAtom(false);
31
+ // 静音 true 代表静音 false 代表不静音
32
+ const [mute] = useAtom(false);
30
33
 
31
34
  // 清晰度
32
- const resolution = useAtom('HD');
35
+ const [resolution] = useAtom('HD');
36
+
37
+ // ptz 是否点击
38
+ const [ptzActive, setPtzActive] = useAtom(false);
39
+
40
+ // 单向对讲还是双向对讲
41
+ const [intercomMode, setIntercomMode] = useAtom(IntercomMode.TwoWay);
42
+
43
+ // 全屏清晰度UI切换是否展示
44
+ const [fullResolutionActive, setFullResolutionActive] = useAtom(false);
33
45
 
34
46
  // 对讲中
35
- const intercom = useAtom(false);
36
- const playState = useAtom(PlayState.CONNECTING);
47
+ const [intercom] = useAtom(false);
48
+ const [playState] = useAtom(PlayState.CONNECTING);
37
49
  const setPlayState = useCallback(value => {
38
50
  updateAtom(playState, value);
39
51
  }, [playState]);
40
- const topContent = useAtom(initTopContent || defaultTopContent || []);
41
- const bottomContent = useAtom(initBottomContent || defaultBottomContent || []);
42
- const absoluteContent = useAtom(initAbsoluteContent || defaultAbsoluteContent || []);
52
+ const [topContent] = useAtom(initTopContent || defaultTopContent || []);
53
+ const [bottomContent] = useAtom(initBottomContent || defaultBottomContent || []);
54
+ const [absoluteContent] = useAtom(initAbsoluteContent || defaultAbsoluteContent || []);
55
+ const {
56
+ _playState
57
+ } = useStore({
58
+ _playState: playState
59
+ });
60
+ useEffect(() => {
61
+ if (devId && _playState === PlayState.PLAYING) {
62
+ // 获取缓存的值且同步
63
+ getMemoryState(devId).then(res => {
64
+ console.log('==== getMemoryState ====', res);
65
+ _setMute(res.mute);
66
+ setIntercomMode(res.intercomMode);
67
+ });
68
+ }
69
+ }, [devId, _playState]);
43
70
  const IPCPlayerInstance = useRef();
44
71
  if (!IPCPlayerInstance.current) {
45
72
  IPCPlayerInstance.current = createPlayContext(devId);
46
73
  }
74
+ const _setMute = async target => {
75
+ return new Promise((resolve, reject) => {
76
+ IPCPlayerInstance.current.setMuted({
77
+ mute: target,
78
+ success: () => {
79
+ console.log('=== set mute success ===', target);
80
+ setMuteMemoryState(devId, target);
81
+ updateAtom(mute, target);
82
+ resolve(true);
83
+ },
84
+ fail: err => {
85
+ IPCPlayerInstance.current.isMuted({
86
+ success(res) {
87
+ console.log('==== 当前静音状态 ====', res);
88
+ updateAtom(mute, res);
89
+ }
90
+ });
91
+ reject(err);
92
+ const errObj = err.innerError || err || {};
93
+ const errMsg = errObj.errorMsg || I18n.t('error_setMute');
94
+ toast({
95
+ title: errMsg
96
+ });
97
+ }
98
+ });
99
+ });
100
+ };
47
101
 
48
102
  /**
49
103
  * 设置清晰度
@@ -57,7 +111,10 @@ export const createUseCtx = _ref => {
57
111
  recording,
58
112
  mute,
59
113
  resolution,
114
+ ptzActive,
115
+ fullResolutionActive,
60
116
  intercom,
117
+ intercomMode,
61
118
  playState,
62
119
  setPlayState,
63
120
  setIntercom: async target => {
@@ -98,22 +155,7 @@ export const createUseCtx = _ref => {
98
155
  }
99
156
  });
100
157
  },
101
- setMute: async target => {
102
- return new Promise((resolve, reject) => {
103
- updateAtom(mute, target);
104
- IPCPlayerInstance.current.setMuted({
105
- mute: target,
106
- success: () => {
107
- updateAtom(mute, target);
108
- resolve(true);
109
- },
110
- fail: err => {
111
- updateAtom(mute, !target);
112
- reject(err);
113
- }
114
- });
115
- });
116
- },
158
+ setMute: _setMute,
117
159
  setResolution: async target => {
118
160
  console.log('执行清晰度方法');
119
161
  return new Promise((resolve, reject) => {
@@ -171,9 +213,9 @@ export const createUseCtx = _ref => {
171
213
  }
172
214
  });
173
215
  },
174
- setScreenType: value => {
175
- updateAtom(screenType, value);
176
- },
216
+ setPtzActive,
217
+ setFullResolutionActive,
218
+ setScreenType,
177
219
  topContent,
178
220
  bottomContent,
179
221
  absoluteContent,
@@ -1,3 +1,9 @@
1
- export type { Toast } from '../ports.output';
1
+ import { IntercomMode } from '../ports.output';
2
+ export type { Toast, IntercomMode } from '../ports.output';
2
3
  export type createPlayContext = (devId: string) => IpcContext;
3
4
  export type AuthorizeStatus = (type: string) => Promise<boolean>;
5
+ export type GetMemoryState = (devId: string) => Promise<{
6
+ mute: boolean;
7
+ intercomMode: IntercomMode;
8
+ }>;
9
+ export type SetMuteMemoryState = (devId: string, value: boolean) => void;
@@ -3,9 +3,10 @@ export { getDefaultStore } from 'jotai';
3
3
  export declare const topContent: import("jotai").PrimitiveAtom<never[]> & {
4
4
  init: never[];
5
5
  };
6
- export declare const useAtom: <T extends unknown>(defaultValue: T) => RetAtom<T>;
6
+ type Action<T> = T | ((prevValue: T) => T);
7
+ export declare const useAtom: <T extends unknown>(defaultValue: T) => [RetAtom<T>, (value: Action<T>) => void];
7
8
  type ExtractReturnType<T> = {
8
9
  [K in keyof T]: T[K] extends RetAtom<infer R> ? R : never;
9
10
  };
10
11
  export declare const useStore: <V, T extends Record<string, RetAtom<V>>>(options: T) => ExtractReturnType<T>;
11
- export declare const updateAtom: <T>(atom: RetAtom<T>, value: T | ((prevValue: T) => T)) => void;
12
+ export declare const updateAtom: <T>(atom: RetAtom<T>, value: Action<T>) => void;
package/lib/ctx/store.js CHANGED
@@ -8,7 +8,7 @@ export const useAtom = defaultValue => {
8
8
  // @ts-ignore
9
9
  ref.current = atom(defaultValue);
10
10
  }
11
- return ref.current;
11
+ return [ref.current, value => updateAtom(ref.current, value)];
12
12
  };
13
13
  export const useStore = options => {
14
14
  const combinedAtomRef = useRef();
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { PrimitiveAtom } from 'jotai';
3
- import type { Toast } from './ports.output';
3
+ import type { Toast, IntercomMode } from './ports.output';
4
+ export { IntercomMode } from './ports.output';
4
5
  type WithInitialValue<Value> = {
5
6
  init: Value;
6
7
  };
@@ -36,12 +37,17 @@ export type UseCtx = (options: {
36
37
  recording: RetAtom<boolean>;
37
38
  mute: RetAtom<boolean>;
38
39
  intercom: RetAtom<boolean>;
40
+ intercomMode: RetAtom<IntercomMode>;
41
+ ptzActive: RetAtom<boolean>;
42
+ fullResolutionActive: RetAtom<boolean>;
39
43
  playState: RetAtom<PlayState>;
40
44
  IPCPlayerInstance: IpcContext;
41
45
  topContent: RetAtom<ComponentConfig[]>;
42
46
  bottomContent: RetAtom<ComponentConfig[]>;
43
47
  absoluteContent: RetAtom<ComponentConfig[]>;
44
48
  setScreenType: (type: ScreenType) => void;
49
+ setPtzActive: (type: boolean) => void;
50
+ setFullResolutionActive: (type: boolean) => void;
45
51
  setRecording: (value: boolean) => Promise<boolean>;
46
52
  setIntercom: (value: boolean) => Promise<boolean>;
47
53
  setMute: (value: boolean) => Promise<boolean>;
@@ -66,4 +72,3 @@ export type PlayStatusData = {
66
72
  playState: PlayState;
67
73
  playCode: number;
68
74
  };
69
- export {};
package/lib/interface.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { IntercomMode } from './ports.output';
1
2
  export let PlayerStreamStatus = /*#__PURE__*/function (PlayerStreamStatus) {
2
3
  PlayerStreamStatus[PlayerStreamStatus["UnknownException"] = -1000] = "UnknownException";
3
4
  PlayerStreamStatus[PlayerStreamStatus["ConnectSuccess"] = 1001] = "ConnectSuccess";
@@ -8,12 +8,17 @@ export declare const Battery: import("react").FunctionComponent<{
8
8
  recording: import("../..").RetAtom<boolean>;
9
9
  mute: import("../..").RetAtom<boolean>;
10
10
  intercom: import("../..").RetAtom<boolean>;
11
+ intercomMode: import("../..").RetAtom<import("@ray-js/ray-ipc-utils/lib/interface").IntercomMode>;
12
+ ptzActive: import("../..").RetAtom<boolean>;
13
+ fullResolutionActive: import("../..").RetAtom<boolean>;
11
14
  playState: import("../..").RetAtom<import("../..").PlayState>;
12
15
  IPCPlayerInstance: IpcContext;
13
16
  topContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
14
17
  bottomContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
15
18
  absoluteContent: import("../..").RetAtom<import("../..").ComponentConfig<any & Record<string, any>>[]>;
16
19
  setScreenType: (type: import("../..").ScreenType) => void;
20
+ setPtzActive: (type: boolean) => void;
21
+ setFullResolutionActive: (type: boolean) => void;
17
22
  setRecording: (value: boolean) => Promise<boolean>;
18
23
  setIntercom: (value: boolean) => Promise<boolean>;
19
24
  setMute: (value: boolean) => Promise<boolean>;
@@ -1,20 +1,22 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { useContext } from 'react';
3
3
  import { View, setPageOrientation } from '@ray-js/ray';
4
+ import { useUpdateEffect } from 'ahooks';
5
+ import clsx from 'clsx';
4
6
  import { UIEventContext } from '../../ui/context';
5
- import { startTimeToHideAllComponent, showAllComponent } from '../../ui/constant';
7
+ import { startTimeToHideAllComponent, showAllComponent, voiceIntercomId, verticalScreenId, ptzControlId, fullResolutionId } from '../../ui/constant';
6
8
  import { useStore } from '../../ctx/store';
7
9
  import { VerticalScreen } from './verticalScreen';
8
10
  import { VoiceIntercom } from './voiceIntercom';
9
11
  import './fullScreen.less';
10
- const VerticalScreenId = 'VerticalScreen';
11
- const VoiceIntercomId = 'VoiceIntercom';
12
12
  export function FullScreen(props) {
13
13
  const {
14
14
  screenType: screenTypeAtom,
15
15
  setScreenType,
16
16
  addContent,
17
- deleteContent
17
+ deleteContent,
18
+ setPtzActive,
19
+ setFullResolutionActive
18
20
  } = props;
19
21
  const {
20
22
  screenType
@@ -24,7 +26,15 @@ export function FullScreen(props) {
24
26
  const {
25
27
  event
26
28
  } = useContext(UIEventContext);
27
- const handFull = () => {
29
+
30
+ /**
31
+ * 竖屏统一操作
32
+ */
33
+
34
+ /**
35
+ * 全屏统一操作
36
+ */
37
+ const handleFull = () => {
28
38
  ty.hideMenuButton();
29
39
  ty.hideStatusBar();
30
40
  ty.setNavigationBarBack({
@@ -33,7 +43,7 @@ export function FullScreen(props) {
33
43
 
34
44
  // 添加全屏后,返回竖屏的控件
35
45
  addContent('top', {
36
- id: VerticalScreenId,
46
+ id: verticalScreenId,
37
47
  content: VerticalScreen,
38
48
  initProps: _objectSpread(_objectSpread({}, props), {}, {
39
49
  onClick: () => {
@@ -44,33 +54,54 @@ export function FullScreen(props) {
44
54
  });
45
55
  // 全屏后,添加语音对讲控件
46
56
  addContent('absolute', {
47
- id: VoiceIntercomId,
57
+ id: voiceIntercomId,
48
58
  content: props => {
49
59
  return /*#__PURE__*/React.createElement(View, {
50
- className: "ipc-player-plugin-full-screen-voice"
60
+ className: clsx('ipc-player-plugin-full-screen-voice')
51
61
  }, /*#__PURE__*/React.createElement(VoiceIntercom, props));
52
62
  },
53
63
  absoluteContentClassName: 'ipc-player-plugin-full-screen-voice-warp',
54
64
  initProps: _objectSpread({}, props)
55
65
  });
56
66
  };
67
+
68
+ /**
69
+ * 针对横竖屏方法统一集中处理
70
+ */
71
+ const handlers = {
72
+ full: () => {
73
+ handleFull();
74
+ event.emit(startTimeToHideAllComponent);
75
+ },
76
+ vertical: () => {
77
+ ty.setNavigationBarBack({
78
+ type: 'system'
79
+ });
80
+ ty.showMenuButton();
81
+ ty.showStatusBar();
82
+ deleteContent('top', verticalScreenId);
83
+ deleteContent('absolute', voiceIntercomId);
84
+ deleteContent('absolute', ptzControlId);
85
+ deleteContent('absolute', fullResolutionId);
86
+ // 还原Ptz点击状态值
87
+ setPtzActive(false);
88
+ // 还原全屏清晰度状态值
89
+ setFullResolutionActive(false);
90
+ }
91
+ };
92
+ useUpdateEffect(() => {
93
+ var _handlers$screenType;
94
+ (_handlers$screenType = handlers[screenType]) === null || _handlers$screenType === void 0 || _handlers$screenType.call(handlers);
95
+ }, [screenType]);
57
96
  const handClick = target => {
58
97
  const pageOrientation = target === 'vertical' ? 'portrait' : 'landscape';
59
- setScreenType(target);
60
98
  setPageOrientation({
61
99
  pageOrientation,
62
100
  success: () => {
101
+ setScreenType(target);
63
102
  if (target === 'full') {
64
- handFull();
65
- event.emit(startTimeToHideAllComponent);
66
- } else {
67
- ty.setNavigationBarBack({
68
- type: 'system'
69
- });
70
- ty.showMenuButton();
71
- ty.showStatusBar();
72
- deleteContent('top', VerticalScreenId);
73
- deleteContent('absolute', VoiceIntercomId);
103
+ // handFull();
104
+ // event.emit(startTimeToHideAllComponent);
74
105
  }
75
106
  }
76
107
  });
@@ -9,9 +9,13 @@ import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../
9
9
  import { useStore } from '../../ctx/store';
10
10
  export function VoiceIntercom(props) {
11
11
  const {
12
- screenType
12
+ screenType,
13
+ isPtzActive,
14
+ fullResolutionActive
13
15
  } = useStore({
14
- screenType: props.screenType
16
+ screenType: props.screenType,
17
+ isPtzActive: props.ptzActive,
18
+ fullResolutionActive: props.fullResolutionActive
15
19
  });
16
20
  const [shouldHide] = useComponentHideState(screenType);
17
21
  const {
@@ -19,7 +23,7 @@ export function VoiceIntercom(props) {
19
23
  } = useContext(UIEventContext);
20
24
  return /*#__PURE__*/React.createElement(CoverView, {
21
25
  className: clsx('ipc-player-plugin-full-screen-voice', {
22
- 'ipc-player-plugin-full-screen-voice-hide': shouldHide
26
+ 'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive || fullResolutionActive
23
27
  })
24
28
  }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
25
29
  onTouchStart: () => {
@@ -6,4 +6,5 @@ export * from './fullScreen';
6
6
  export * from './videoBitKbps';
7
7
  export * from './voiceIntercom';
8
8
  export * from './muted';
9
+ export * from './ptz';
9
10
  export * from './resolution';
@@ -6,4 +6,5 @@ export * from './fullScreen';
6
6
  export * from './videoBitKbps';
7
7
  export * from './voiceIntercom';
8
8
  export * from './muted';
9
+ export * from './ptz';
9
10
  export * from './resolution';
@@ -1,44 +1,29 @@
1
1
  import { View, Text } from '@ray-js/ray';
2
- import React, { useEffect } from 'react';
3
- import { useStore, updateAtom } from '../../ctx/store';
2
+ import React from 'react';
3
+ import { useStore } from '../../ctx/store';
4
4
  import './muted.less';
5
5
  export const Muted = props => {
6
6
  const {
7
- IPCPlayerContext,
8
- mute
7
+ mute,
8
+ setMute
9
9
  } = props;
10
10
  const {
11
11
  isMuted
12
12
  } = useStore({
13
13
  isMuted: mute
14
14
  });
15
- const setIsMuted = value => {
16
- updateAtom(mute, value);
17
- };
18
- useEffect(() => {
19
- init();
20
- }, []);
21
- const init = () => {
22
- IPCPlayerContext.isMuted({
23
- success: res => {
24
- setIsMuted(res);
25
- },
26
- fail: res => {
27
- console.log('res===isMuted err', res);
28
- }
29
- });
30
- };
31
15
  return /*#__PURE__*/React.createElement(View, {
32
16
  onClick: () => {
33
- IPCPlayerContext.setMuted({
34
- mute: !isMuted,
35
- success: () => {
36
- setIsMuted(!isMuted);
37
- },
38
- fail: res => {
39
- console.log('res===setMuted err', res);
40
- }
41
- });
17
+ // IPCPlayerContext.setMuted({
18
+ // mute: !isMuted,
19
+ // success: res => {
20
+ // setIsMuted(!isMuted);
21
+ // },
22
+ // fail: res => {
23
+ // console.log('res===setMuted err', res);
24
+ // },
25
+ // });
26
+ setMute(!isMuted);
42
27
  },
43
28
  style: {
44
29
  display: 'flex'
@@ -0,0 +1 @@
1
+ export * from './ptz';
@@ -0,0 +1 @@
1
+ export * from './ptz';
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ComponentConfigProps } from '../../interface';
3
+ import './ptz.less';
4
+ export declare const Ptz: (props: ComponentConfigProps) => React.JSX.Element | null;
@@ -0,0 +1,67 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { View, Text } from '@ray-js/ray';
3
+ import clsx from 'clsx';
4
+ import React, { useEffect } from 'react';
5
+ import { useStore, updateAtom } from '../../ctx/store';
6
+ import { ptzControlId } from '../../ui/constant';
7
+ import './ptz.less';
8
+ import { PtzControl } from './ptzControl';
9
+ export const Ptz = props => {
10
+ const {
11
+ IPCPlayerContext,
12
+ screenType: screenTypeAtom,
13
+ ptzActive,
14
+ addContent,
15
+ deleteContent
16
+ } = props;
17
+ const {
18
+ screenType,
19
+ isPtzActive
20
+ } = useStore({
21
+ screenType: screenTypeAtom,
22
+ isPtzActive: ptzActive
23
+ });
24
+ useEffect(() => {
25
+ // init();
26
+ }, []);
27
+
28
+ // const init = () => {
29
+ // IPCPlayerContext.isMuted({
30
+ // success: res => {
31
+ // setIsMuted(res);
32
+ // },
33
+ // fail: res => {
34
+ // console.log('res===isMuted err', res);
35
+ // },
36
+ // });
37
+ // };
38
+
39
+ if (screenType === 'vertical') {
40
+ return null;
41
+ }
42
+ return /*#__PURE__*/React.createElement(View, {
43
+ onClick: () => {
44
+ if (!isPtzActive) {
45
+ // 添加ptz空间
46
+ addContent('absolute', {
47
+ id: ptzControlId,
48
+ content: props => {
49
+ return /*#__PURE__*/React.createElement(View, {
50
+ className: "ipc-player-plugin-full-screen-ptz-control"
51
+ }, /*#__PURE__*/React.createElement(PtzControl, props));
52
+ },
53
+ absoluteContentClassName: 'ipc-player-plugin-full-screen-ptz-control-warp',
54
+ initProps: _objectSpread({}, props)
55
+ });
56
+ } else {
57
+ deleteContent('absolute', ptzControlId);
58
+ }
59
+ updateAtom(ptzActive, !isPtzActive);
60
+ },
61
+ style: {
62
+ display: 'flex'
63
+ }
64
+ }, /*#__PURE__*/React.createElement(Text, {
65
+ className: clsx('ipc-player-plugin-ptz-text-icon', 'icon-panel', 'icon-panel-ptz', isPtzActive && 'ipc-ptz-active')
66
+ }));
67
+ };
@@ -0,0 +1,42 @@
1
+ .ipc-player-plugin-ptz-text-icon {
2
+ color: var(--iconColor);
3
+ font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
4
+ }
5
+
6
+ .ipc-ptz-active {
7
+ color: var(--iconActiveColor);
8
+ }
9
+
10
+ // .ipc-player-plugin-full-screen-ptz {
11
+ // position: absolute;
12
+ // top: 60%;
13
+ // transform: translateY(-50%);
14
+ // right: calc(16px * var(--ipc-player-size-scale, 1));
15
+ // color: var(--iconColor);
16
+ // font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
17
+ // }
18
+
19
+ .ipc-player-plugin-full-screen-ptz-control-warp {
20
+ position: absolute;
21
+ bottom: 10px;
22
+ // transform: translate(0, -20%);
23
+ right: calc(10px * var(--ipc-player-size-scale, 1));;
24
+ z-index: 3;
25
+ }
26
+
27
+
28
+
29
+ .ipc-player-plugin-full-screen-ptz-control {
30
+ transform: translate(0, 0);
31
+ transition: transform ease-in 0.3s;
32
+ &.ipc-player-plugin-full-screen-ptz-control-hide {
33
+ transform: translate(0, 200%);
34
+ }
35
+ }
36
+
37
+ .arrow-icon-wrapper {
38
+ font-size: 12px;
39
+ color: #707070;
40
+ }
41
+
42
+
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ComponentConfigProps } from '../../interface';
3
+ import './ptz.less';
4
+ export declare const PtzControl: (props: ComponentConfigProps) => React.JSX.Element;
@@ -0,0 +1,64 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { useContext } from 'react';
3
+ import { CoverView } from '@ray-js/ray';
4
+ import clsx from 'clsx';
5
+ import IpcPtzZoom from '@ray-js/ipc-ptz-zoom';
6
+ import { useComponentHideState } from '../../ui/hooks';
7
+ import { UIEventContext } from '../../ui/context';
8
+ import { useStore } from '../../ctx/store';
9
+ import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
10
+ import './ptz.less';
11
+ export const PtzControl = props => {
12
+ const {
13
+ screenType
14
+ } = useStore({
15
+ screenType: props.screenType
16
+ });
17
+ const [shouldHide] = useComponentHideState(screenType);
18
+ const {
19
+ event
20
+ } = useContext(UIEventContext);
21
+ return /*#__PURE__*/React.createElement(CoverView, _extends({
22
+ className: clsx('ipc-player-plugin-full-screen-ptz-control', {
23
+ 'ipc-player-plugin-full-screen-ptz-control-hide': shouldHide
24
+ })
25
+ }, props), /*#__PURE__*/React.createElement(IpcPtzZoom, {
26
+ ptzSize: "172px",
27
+ zoomData: [],
28
+ ptzData: [{
29
+ type: 'top',
30
+ // show: getEnumRangeIsValid('ptz_control', '0'),
31
+ show: true,
32
+ dpValue: '0',
33
+ icon: 'ptz-arrow'
34
+ }, {
35
+ type: 'right',
36
+ // show: getEnumRangeIsValid('ptz_control', '2'),
37
+ show: true,
38
+ dpValue: '2',
39
+ icon: 'ptz-arrow'
40
+ }, {
41
+ type: 'left',
42
+ // show: getEnumRangeIsValid('ptz_control', '6'),
43
+ show: true,
44
+ dpValue: '6',
45
+ icon: 'ptz-arrow'
46
+ }, {
47
+ type: 'bottom',
48
+ // show: getEnumRangeIsValid('ptz_control', '4'),
49
+ show: true,
50
+ dpValue: '4',
51
+ icon: 'ptz-arrow'
52
+ }],
53
+ onTouchPtzStart: data => {
54
+ console.log(data, 'data');
55
+ event.emit(pauseTimeToHideAllComponent);
56
+ },
57
+ onTouchPtzEnd: () => {
58
+ console.log('dsads');
59
+ event.emit(startTimeToHideAllComponent);
60
+ },
61
+ brandColor: "red",
62
+ iconClassName: clsx('arrow-icon-wrapper')
63
+ }));
64
+ };
@@ -3,7 +3,7 @@
3
3
  color: var(--iconColor);
4
4
  }
5
5
  .ipc-player-plugin-record-video-toast-wrap {
6
- z-index: 2;
6
+ z-index: 110;
7
7
  position: absolute;
8
8
  top: calc(7px * var(--ipc-player-size-scale, 1));
9
9
  left: 50%;
@@ -15,6 +15,8 @@
15
15
  align-items: center;
16
16
  background-color: var(--bg-color);
17
17
  border-radius: calc(8px * var(--ipc-player-size-scale, 1));
18
+ // background-color: #fff;
19
+ background: linear-gradient(0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)), #000000;
18
20
  .ipc-player-plugin-record-video-toast-point {
19
21
  width: calc(6px * var(--ipc-player-size-scale, 1));
20
22
  height: calc(6px * var(--ipc-player-size-scale, 1));
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ComponentConfigProps } from '../../interface';
3
+ import './resolution.less';
4
+ export declare const FullResolutionControl: (props: ComponentConfigProps) => React.JSX.Element;
@@ -0,0 +1,31 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { useContext } from 'react';
3
+ import { Text, View } from '@ray-js/ray';
4
+ import clsx from 'clsx';
5
+ import { useComponentHideState } from '../../ui/hooks';
6
+ import { UIEventContext } from '../../ui/context';
7
+ import { useStore } from '../../ctx/store';
8
+ import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
9
+ import './resolution.less';
10
+ export const FullResolutionControl = props => {
11
+ const {
12
+ screenType,
13
+ fullResolutionActive
14
+ } = useStore({
15
+ screenType: props.screenType,
16
+ fullResolutionActive: props.fullResolutionActive
17
+ });
18
+ const [shouldHide] = useComponentHideState(screenType);
19
+ const {
20
+ event
21
+ } = useContext(UIEventContext);
22
+ return /*#__PURE__*/React.createElement(View, _extends({
23
+ className: clsx('ipc-player-plugin-full-resolution-control', {
24
+ 'ipc-player-plugin-full-resolution-control-hide': shouldHide || !fullResolutionActive
25
+ })
26
+ }, props), /*#__PURE__*/React.createElement(Text, {
27
+ className: clsx('ipc-player-plugin-full-resolution-control-text')
28
+ }, "\u9AD8\u6E05"), /*#__PURE__*/React.createElement(Text, {
29
+ className: clsx('ipc-player-plugin-full-resolution-control-text')
30
+ }, "\u6807\u6E05"));
31
+ };
@@ -1,19 +1,34 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
1
2
  import { View, Text } from '@ray-js/ray';
2
- import React, { useEffect } from 'react';
3
- import { useStore } from '../../ctx/store';
3
+ import clsx from 'clsx';
4
+ import React, { useContext, useEffect } from 'react';
5
+ import { FullResolutionControl } from './fullResolutionControl';
6
+ import { fullResolutionId, pauseTimeToHideAllComponent } from '../../ui/constant';
7
+ import { UIEventContext } from '../../ui/context';
8
+ import { useStore, updateAtom } from '../../ctx/store';
4
9
  import './resolution.less';
5
10
  export const Resolution = props => {
6
- console.log(props, 'props');
7
11
  const {
8
12
  IPCPlayerContext,
9
13
  resolution,
10
- setResolution
14
+ setResolution,
15
+ screenType: screenTypeAtom,
16
+ fullResolutionActive,
17
+ addContent
11
18
  } = props;
12
19
  const {
13
- currentResolution
20
+ currentResolution,
21
+ screenType,
22
+ isFullResolutionActive
14
23
  } = useStore({
15
- currentResolution: resolution
24
+ currentResolution: resolution,
25
+ screenType: screenTypeAtom,
26
+ isFullResolutionActive: fullResolutionActive
16
27
  });
28
+ const {
29
+ event
30
+ } = useContext(UIEventContext);
31
+ console.log(screenType, 'screenType');
17
32
  // const setIsMuted = (value: typeof currentResolution) => {
18
33
  // // updateAtom(mute, value);
19
34
  // };
@@ -23,19 +38,24 @@ export const Resolution = props => {
23
38
  }, []);
24
39
  return /*#__PURE__*/React.createElement(View, {
25
40
  onClick: () => {
26
- console.log('_____');
41
+ if (screenType === 'full') {
42
+ // 添加全屏清晰度空间
43
+ addContent('absolute', {
44
+ id: fullResolutionId,
45
+ content: props => {
46
+ return /*#__PURE__*/React.createElement(FullResolutionControl, props);
47
+ },
48
+ absoluteContentClassName: 'ipc-player-plugin-full-resolution-control-wrap',
49
+ initProps: _objectSpread({}, props)
50
+ });
51
+ updateAtom(fullResolutionActive, true);
52
+ event.emit(pauseTimeToHideAllComponent);
53
+ return false;
54
+ }
27
55
  setResolution(currentResolution === 'HD' ? 'normal' : 'hd');
28
- // // IPCPlayerContext.setMuted({
29
- // // mute: !isMuted,
30
- // // success: res => {
31
- // // setIsMuted(!isMuted);
32
- // // },
33
- // // fail: res => {
34
- // // console.log('res===setMuted err', res);
35
- // // },
36
- // // });
56
+ return true;
37
57
  },
38
- className: "resolutionWrapper"
58
+ className: clsx('ipc-player-plugin-resolution', screenType === 'vertical' ? 'ipc-player-plugin-resolution-vertical' : 'ipc-player-plugin-resolution-full')
39
59
  }, /*#__PURE__*/React.createElement(Text, {
40
60
  className: "resolutionText"
41
61
  }, currentResolution));
@@ -1,15 +1,51 @@
1
- .resolutionWrapper {
1
+ .ipc-player-plugin-resolution {
2
2
  background-color: rgba(255,255,255,0.2);
3
- padding: 2px 4px;
3
+ padding: calc(2px * var(--ipc-player-size-scale, 1)) calc(4px * var(--ipc-player-size-scale, 1));
4
4
  display: flex;
5
5
  justify-content: center;
6
6
  align-items: center;
7
- border-radius: 8rpx;
7
+ border-radius: calc(8px * var(--ipc-player-size-scale, 1));
8
8
  backdrop-filter: blur(8rpx);
9
9
  .resolutionText {
10
- color: #ffffff;
10
+ color: var(--iconColor);
11
11
  font-weight: 600;
12
- font-size: 24rpx;
13
-
12
+ font-size: calc(12px * var(--ipc-player-size-scale, 1));
14
13
  }
15
- }
14
+ }
15
+
16
+ .ipc-player-plugin-full-resolution-control {
17
+ transform: translate(0, 0);
18
+ height: 100%;
19
+ transition: transform 0.3s ease-in, opacity 0.3s ease-in, width 0.3s ease-in;
20
+ width: 200px;
21
+ display: flex;
22
+ flex-direction: column;
23
+ justify-content: center;
24
+ align-items: center;
25
+ background-color: rgba(0,0,0,0.9);
26
+ &.ipc-player-plugin-full-resolution-control-hide {
27
+ transform: translate(300%, 0);
28
+ opacity: 0;
29
+ width: 0;
30
+ }
31
+ }
32
+
33
+ .ipc-player-plugin-full-resolution-control-wrap {
34
+ position: absolute;
35
+ top: 0;
36
+ bottom: 0;
37
+ right: 0;
38
+ display: flex;
39
+ justify-content: center;
40
+ align-items: center;
41
+ // transform: translate(200%, 0);
42
+ z-index: 3;
43
+ }
44
+
45
+ .ipc-player-plugin-full-resolution-control-text {
46
+ font-size: 14px;
47
+ font-weight: 400;
48
+ text-align: center;
49
+ color: #ffffff;
50
+ min-height: 40px;
51
+ }
@@ -9,5 +9,5 @@ type Props = ComponentConfigProps & {
9
9
  onTouchStart?: TouchEventHandler['onTouchStart'];
10
10
  onTouchEnd?: TouchEventHandler['onTouchEnd'];
11
11
  };
12
- export declare function VoiceIntercom({ style, className, iconClassName, recording: recordingAtom, intercom: intercomAtom, setIntercom, mute: muteAtom, setMute, getStreamStatus, onTouchStart, onTouchEnd, }: Props): React.JSX.Element;
12
+ export declare function VoiceIntercom({ style, className, iconClassName, recording: recordingAtom, intercom: intercomAtom, intercomMode: intercomModeAtom, setIntercom, mute: muteAtom, setMute, getStreamStatus, onTouchStart, onTouchEnd, }: Props): React.JSX.Element;
13
13
  export {};
@@ -5,7 +5,7 @@ import clsx from 'clsx';
5
5
  import Res from './voice.gif';
6
6
  import { useStore, getDefaultStore } from '../../ctx/store';
7
7
  import './voiceIntercom.less';
8
- import { PlayerStreamStatus } from '../../interface';
8
+ import { PlayerStreamStatus, IntercomMode } from '../../interface';
9
9
  import { UIEventContext } from '../../ui/context';
10
10
  import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
11
11
  const NILL = () => null;
@@ -16,6 +16,7 @@ export function VoiceIntercom(_ref) {
16
16
  iconClassName,
17
17
  recording: recordingAtom,
18
18
  intercom: intercomAtom,
19
+ intercomMode: intercomModeAtom,
19
20
  setIntercom,
20
21
  mute: muteAtom,
21
22
  setMute,
@@ -28,10 +29,12 @@ export function VoiceIntercom(_ref) {
28
29
  } = useContext(UIEventContext);
29
30
  const {
30
31
  mute,
31
- intercom
32
+ intercom,
33
+ intercomMode
32
34
  } = useStore({
33
35
  mute: muteAtom,
34
- intercom: intercomAtom
36
+ intercom: intercomAtom,
37
+ intercomMode: intercomModeAtom
35
38
  });
36
39
  // 对讲开始之前的静音状态
37
40
  const originMuteStatusBeforeVoice = useRef(mute);
@@ -41,16 +44,28 @@ export function VoiceIntercom(_ref) {
41
44
  console.log('PlayerStreamStatus not 1002');
42
45
  return;
43
46
  }
47
+ console.log('==== 开始对讲 =====');
44
48
  originMuteStatusBeforeVoice.current = _mute;
45
- // 如果对讲开始之前,是静音的,则需要关闭静音
46
- if (_mute) {
47
- await setMute(false);
49
+ // 单路对讲,开始对讲前需要静音
50
+ // 双路对讲,开始对讲前需要打开拾音器
51
+ const muteTarget = intercomMode === IntercomMode.OneWay;
52
+ if (_mute !== muteTarget) {
53
+ console.log(`=== 切换静音状态: ${_mute}`, `${intercomMode}`);
54
+ await setMute(muteTarget);
48
55
  }
49
56
  await setIntercom(true);
50
57
  event.emit(pauseTimeToHideAllComponent);
51
58
  };
52
59
  const endVoice = async () => {
53
- await setMute(originMuteStatusBeforeVoice.current);
60
+ console.log('=== 结束对讲 ====');
61
+ // 单向对讲,结束对讲之后,强制关闭静态状态
62
+ if (intercomMode === IntercomMode.OneWay) {
63
+ console.log('=== 单向对讲,强制关闭静音状态 ===');
64
+ await setMute(false);
65
+ } else {
66
+ console.log(`=== 双向对讲,恢复对讲之前的静音状态 ${originMuteStatusBeforeVoice.current}===`);
67
+ await setMute(originMuteStatusBeforeVoice.current);
68
+ }
54
69
  await setIntercom(false);
55
70
  event.emit(startTimeToHideAllComponent);
56
71
  };
@@ -70,12 +85,17 @@ export function VoiceIntercom(_ref) {
70
85
  loading.current = false;
71
86
  return;
72
87
  }
73
- if (target) {
74
- await startVoice(mute);
75
- } else {
76
- await endVoice();
88
+ try {
89
+ if (target) {
90
+ await startVoice(mute);
91
+ } else {
92
+ await endVoice();
93
+ }
94
+ } catch (err) {
95
+ loading.current = false;
96
+ } finally {
97
+ loading.current = false;
77
98
  }
78
- loading.current = false;
79
99
  },
80
100
  onTouchEnd: onTouchEnd
81
101
  }, intercom ? /*#__PURE__*/React.createElement(Image, {
@@ -1,3 +1,4 @@
1
+ export { IntercomMode } from '@ray-js/ray-ipc-utils/lib/interface';
1
2
  export type UseBattery = (devId: string) => {
2
3
  batteryValue: number;
3
4
  batteryCharging: boolean;
@@ -1 +1,7 @@
1
- export {};
1
+ export { IntercomMode } from '@ray-js/ray-ipc-utils/lib/interface';
2
+
3
+ // plugin 获取电池电量 todo
4
+
5
+ // plugin 获取温度
6
+
7
+ // plugin 获取湿度
@@ -9,10 +9,12 @@ export function BottomContent(_ref) {
9
9
  children
10
10
  } = _ref;
11
11
  const {
12
- screenType
12
+ screenType,
13
+ fullResolutionActive
13
14
  } = useStore({
14
15
  screenType: ctx.screenType,
15
- playState: ctx.playState
16
+ playState: ctx.playState,
17
+ fullResolutionActive: ctx.fullResolutionActive
16
18
  });
17
19
  const [shouldHide] = useComponentHideState(screenType);
18
20
  return /*#__PURE__*/React.createElement(CoverView, {
@@ -24,7 +26,7 @@ export function BottomContent(_ref) {
24
26
  '--gap': '25px'
25
27
  },
26
28
  className: clsx('ipc-player-content-item', 'ipc-player-bottom-content', {
27
- 'ipc-player-bottom-content-hide': shouldHide
29
+ 'ipc-player-bottom-content-hide': shouldHide || fullResolutionActive
28
30
  })
29
31
  }, children));
30
32
  }
@@ -3,3 +3,7 @@ export declare const hideAllComponent = "hideAllComponent";
3
3
  export declare const playerTap = "playerTap";
4
4
  export declare const pauseTimeToHideAllComponent = "pauseTimeToHideAllComponent";
5
5
  export declare const startTimeToHideAllComponent = "startTimeToHideAllComponent";
6
+ export declare const voiceIntercomId = "voiceIntercomId";
7
+ export declare const verticalScreenId = "verticalScreenId";
8
+ export declare const ptzControlId = "ptzControlId";
9
+ export declare const fullResolutionId = "fullResolutionId";
@@ -2,4 +2,8 @@ export const showAllComponent = 'showAllComponent';
2
2
  export const hideAllComponent = 'hideAllComponent';
3
3
  export const playerTap = 'playerTap';
4
4
  export const pauseTimeToHideAllComponent = 'pauseTimeToHideAllComponent';
5
- export const startTimeToHideAllComponent = 'startTimeToHideAllComponent';
5
+ export const startTimeToHideAllComponent = 'startTimeToHideAllComponent';
6
+ export const voiceIntercomId = 'voiceIntercomId';
7
+ export const verticalScreenId = 'verticalScreenId';
8
+ export const ptzControlId = 'ptzControlId';
9
+ export const fullResolutionId = 'fullResolutionId';
@@ -9,10 +9,12 @@ export function TopContent(_ref) {
9
9
  children
10
10
  } = _ref;
11
11
  const {
12
- screenType
12
+ screenType,
13
+ fullResolutionActive
13
14
  } = useStore({
14
15
  screenType: ctx.screenType,
15
- playState: ctx.playState
16
+ playState: ctx.playState,
17
+ fullResolutionActive: ctx.fullResolutionActive
16
18
  });
17
19
  const [shouldHide] = useComponentHideState(screenType);
18
20
  return /*#__PURE__*/React.createElement(CoverView, {
@@ -24,7 +26,7 @@ export function TopContent(_ref) {
24
26
  '--gap': '16px'
25
27
  },
26
28
  className: clsx('ipc-player-content-item', 'ipc-player-top-content', {
27
- 'ipc-player-top-content-hide': shouldHide
29
+ 'ipc-player-top-content-hide': shouldHide || fullResolutionActive
28
30
  })
29
31
  }, children));
30
32
  }
package/lib/ui/ui.d.ts CHANGED
@@ -4,6 +4,7 @@ import './ui.less';
4
4
  type CtxInstance = ReturnType<UseCtx>;
5
5
  type CSSVariable = {
6
6
  '--iconColor': string;
7
+ '--iconActiveColor': string;
7
8
  '--iconFontSize': string;
8
9
  '--bg-color': string;
9
10
  '--fontColor': string;
package/lib/ui/ui.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useRef, useMemo, useEffect, useCallback } from 'react';
2
+ import React, { useContext, useRef, useMemo, useEffect, useCallback } from 'react';
3
3
  import { View, CoverView, getSystemInfoSync, usePageEvent } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
5
  import IPCPlayer from '@ray-js/ray-ipc-player';
@@ -24,6 +24,8 @@ function getCtxInstance(instance, devId) {
24
24
 
25
25
  const defaultCSSVariable = {
26
26
  '--iconColor': '#fff',
27
+ // 有需要点击呈现不同颜色的icon
28
+ '--iconActiveColor': '#ec653c',
27
29
  '--iconFontSize': '20px',
28
30
  '--bg-color': '#000',
29
31
  '--fontColor': '#fff',
@@ -42,7 +44,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
42
44
  console.log(instance, 'instance');
43
45
  const {
44
46
  setPlayState,
45
- setScreenType
47
+ setScreenType,
48
+ setFullResolutionActive
46
49
  } = instance;
47
50
  const prevTriggerEvent = useRef();
48
51
  const eventRef = useRef();
@@ -50,6 +53,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
50
53
  if (!eventRef.current) {
51
54
  eventRef.current = getEventInstance();
52
55
  }
56
+ const {
57
+ event
58
+ } = useContext(UIEventContext);
53
59
 
54
60
  /**
55
61
  * 监听屏幕布局变化
@@ -70,13 +76,15 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
70
76
  bottomContent,
71
77
  absoluteContent,
72
78
  screenType,
73
- playState
79
+ playState,
80
+ fullResolutionActive
74
81
  } = useStore({
75
82
  topContent: instance.topContent,
76
83
  bottomContent: instance.bottomContent,
77
84
  absoluteContent: instance.absoluteContent,
78
85
  screenType: instance.screenType,
79
- playState: instance.playState
86
+ playState: instance.playState,
87
+ fullResolutionActive: instance.fullResolutionActive
80
88
  });
81
89
  const renderTopContent = useMemo(() => {
82
90
  if (!topContent || !(topContent !== null && topContent !== void 0 && topContent.length)) return null;
@@ -105,13 +113,22 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
105
113
  const _screenType = store.get(instance.screenType);
106
114
  eventRef.current.emit(playerTap);
107
115
  if (_screenType === 'full') {
116
+ // 如果全屏清晰度展开, 则点击关闭全屏清晰度, 展示所有组件
117
+ if (fullResolutionActive) {
118
+ setFullResolutionActive(false);
119
+ // 展示相应菜单启动自动隐藏定时
120
+ triggerEvent(showAllComponent);
121
+ // event.emit(startTimeToHideAllComponent);
122
+ return false;
123
+ }
108
124
  if (prevTriggerEvent.current === hideAllComponent) {
109
125
  triggerEvent(showAllComponent);
110
126
  } else {
111
127
  triggerEvent(hideAllComponent);
112
128
  }
113
129
  }
114
- }, []);
130
+ return false;
131
+ }, [fullResolutionActive]);
115
132
  const triggerEvent = type => {
116
133
  const store = getDefaultStore();
117
134
  const _screenType = store.get(instance.screenType);
@@ -225,6 +242,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
225
242
  ctx: instance
226
243
  }, renderBottomContent), playerReady && (() => {
227
244
  if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
245
+ console.log(absoluteContent, 'absoluteContent');
228
246
  return absoluteContent.map(item => {
229
247
  return /*#__PURE__*/React.createElement(CoverView, {
230
248
  key: item.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-12",
3
+ "version": "0.0.1-beta-14",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -36,7 +36,8 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@ray-js/ray-ipc-player": "2.0.18-beta-beta-1",
39
- "@ray-js/ray-ipc-utils": "1.1.0-beta-7",
39
+ "@ray-js/ray-ipc-utils": "1.1.0-beta-12",
40
+ "@ray-js/ipc-ptz-zoom": "0.0.2-beta-1",
40
41
  "clsx": "^1.2.1",
41
42
  "jotai": "^2.10.2"
42
43
  },