@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.
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +2 -1
- package/lib/hooks/usePtz/index.d.ts +1 -0
- package/lib/hooks/usePtz/index.js +13 -0
- package/lib/plugins/ptz/ptz.js +5 -2
- package/lib/plugins/resolution/resolution.js +3 -1
- package/lib/plugins/resolution/resolution.less +7 -3
- package/lib/ports.output.d.ts +1 -0
- package/lib/ports.output.js +2 -0
- package/lib/ui/ui.less +3 -0
- package/package.json +2 -2
package/lib/hooks/index.d.ts
CHANGED
package/lib/hooks/index.js
CHANGED
|
@@ -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
|
+
};
|
package/lib/plugins/ptz/ptz.js
CHANGED
|
@@ -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:
|
|
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))
|
|
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(
|
|
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(
|
|
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%;
|
package/lib/ports.output.d.ts
CHANGED
|
@@ -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: {
|
package/lib/ports.output.js
CHANGED
package/lib/ui/ui.less
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ipc-player-integration",
|
|
3
|
-
"version": "0.0.1-beta-
|
|
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-
|
|
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",
|