@ray-js/ipc-player-integration 0.0.1-beta-38 → 0.0.1-beta-39

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.
@@ -3,3 +3,4 @@ export * from './useHumidity';
3
3
  export * from './useTemperature';
4
4
  export * from './useDpState';
5
5
  export * from './useMemoizedFn';
6
+ export * from './usePtz';
@@ -2,4 +2,5 @@ export * from './useBattery';
2
2
  export * from './useHumidity';
3
3
  export * from './useTemperature';
4
4
  export * from './useDpState';
5
- export * from './useMemoizedFn';
5
+ export * from './useMemoizedFn';
6
+ export * from './usePtz';
@@ -0,0 +1 @@
1
+ export declare const usePtz: (devId: string) => boolean;
@@ -0,0 +1,13 @@
1
+ import { useMemo } from 'react';
2
+ import { PTZ_CONTROL } from '../../utils/content/dpCode';
3
+ import { useDpState } from '../useDpState';
4
+ export const usePtz = devId => {
5
+ const [dpState] = useDpState({
6
+ devId,
7
+ dpCodes: [PTZ_CONTROL]
8
+ });
9
+ const supportPtz = useMemo(() => {
10
+ return dpState[PTZ_CONTROL];
11
+ }, [dpState]);
12
+ return supportPtz;
13
+ };
@@ -3,6 +3,7 @@ import { View, Text } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
4
  import React, { useEffect, useState, useContext } from 'react';
5
5
  import { UIEventContext } from '../../ui/context';
6
+ import { usePtz } from '../../hooks';
6
7
  import { useStore } from '../../ctx/store';
7
8
  import { ptzControlId } from '../../ui/constant';
8
9
  import './ptz.less';
@@ -15,7 +16,8 @@ export const Ptz = props => {
15
16
  deleteContent,
16
17
  showContent,
17
18
  hideContent,
18
- className
19
+ className,
20
+ devId
19
21
  } = props;
20
22
  const {
21
23
  screenType,
@@ -28,13 +30,14 @@ export const Ptz = props => {
28
30
  const {
29
31
  event
30
32
  } = useContext(UIEventContext);
33
+ const supportPtz = usePtz(devId);
31
34
  useEffect(() => {
32
35
  if (screenType === 'vertical') {
33
36
  event.emit('ptzControlHide');
34
37
  setIsPtzActive(false);
35
38
  }
36
39
  }, [screenType]);
37
- if (screenType === 'vertical') {
40
+ if (screenType === 'vertical' || !supportPtz) {
38
41
  return null;
39
42
  }
40
43
  return /*#__PURE__*/React.createElement(View, {
@@ -57,7 +57,9 @@ export const Resolution = props => {
57
57
  onClick: onResolution,
58
58
  className: clsx(className, screenType === 'vertical' ? 'ipc-player-plugin-resolution-vertical' : 'ipc-player-plugin-resolution-full')
59
59
  }, /*#__PURE__*/React.createElement(View, {
60
- className: "ipc-player-plugin-resolution"
60
+ className: clsx('ipc-player-plugin-resolution', {
61
+ 'ipc-player-plugin-resolution-full': screenType === 'full'
62
+ })
61
63
  }, /*#__PURE__*/React.createElement(Text, {
62
64
  className: "resolutionText"
63
65
  }, Strings.getLang(`ipc_player_resolution_${resolution}`))));
@@ -2,19 +2,23 @@
2
2
 
3
3
  .ipc-player-plugin-resolution {
4
4
  background-color: rgba(255,255,255,0.2);
5
- padding: calc(4px * var(--ipc-player-size-scale, 1)) calc(5px * var(--ipc-player-size-scale, 1)) !important;
5
+ padding: calc(4px * var(--ipc-player-size-scale, 1)) calc(5px * var(--ipc-player-size-scale, 1));
6
6
  display: flex;
7
7
  justify-content: center;
8
8
  align-items: center;
9
- border-radius: calc(8px * var(--ipc-player-size-scale, 1));
9
+ border-radius: calc(3px * var(--ipc-player-size-scale, 1));
10
10
  background-color: rgba(255, 255, 255, 0.3);
11
11
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
12
12
  .resolutionText {
13
13
  color: var(--iconColor);
14
14
  font-weight: 600;
15
- font-size: calc(14px * var(--ipc-player-size-scale, 1));
15
+ font-size: calc(12px * var(--ipc-player-size-scale, 1));
16
16
  }
17
17
  }
18
+ .ipc-player-plugin-resolution-full {
19
+ padding-left: calc(8px * var(--ipc-player-size-scale, 1));
20
+ padding-right: calc(8px * var(--ipc-player-size-scale, 1));
21
+ }
18
22
 
19
23
  .ipc-player-plugin-full-resolution-control {
20
24
  height: 100%;
@@ -3,6 +3,7 @@ export type UseBattery = (devId: string) => {
3
3
  batteryValue: number;
4
4
  batteryCharging: boolean;
5
5
  };
6
+ export type UsePtz = (devId: string) => boolean;
6
7
  export type UseTemperature = (devId: string) => number;
7
8
  export type UseHumidity = () => number;
8
9
  export type Toast = (options: {
@@ -2,6 +2,8 @@ export { IntercomMode } from '@ray-js/ray-ipc-utils/lib/interface';
2
2
 
3
3
  // plugin 获取电池电量 todo
4
4
 
5
+ // plugin 获取是否支持Ptz
6
+
5
7
  // plugin 获取温度
6
8
 
7
9
  // plugin 获取湿度
package/lib/ui/ui.less CHANGED
@@ -191,6 +191,9 @@
191
191
  // 左下角子元素容器
192
192
  .bottom-left-item-container {
193
193
  padding: 0 12px;
194
+ display: flex;
195
+ justify-content: center;
196
+ align-items: center;
194
197
  }
195
198
 
196
199
  .bottom-left-item-container:first-of-type {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/ipc-player-integration",
3
- "version": "0.0.1-beta-38",
3
+ "version": "0.0.1-beta-39",
4
4
  "description": "IPC 播放器功能集成",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -36,7 +36,7 @@
36
36
  "ahooks": "^3.1.6"
37
37
  },
38
38
  "dependencies": {
39
- "@ray-js/ipc-ptz-zoom": "0.0.2-beta-6",
39
+ "@ray-js/ipc-ptz-zoom": "0.0.2-beta-7",
40
40
  "@ray-js/panel-sdk": "^1.13.1",
41
41
  "@ray-js/ray-ipc-player": "2.0.20-beta-6",
42
42
  "@ray-js/ray-ipc-utils": "1.1.0-beta-13",