@ray-js/ipc-player-integration 0.0.1-beta-57 → 0.0.1-beta-58
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/plugins/ptz/ptz.js +22 -13
- package/lib/plugins/ptz/ptz.less +1 -1
- package/lib/plugins/ptz/ptzControl.js +6 -1
- package/lib/plugins/resolution/resolution.less +1 -1
- package/lib/plugins/videoBitKBP/videoBitKBP.js +4 -2
- package/lib/plugins/voiceIntercom/voiceIntercom.js +0 -1
- package/package.json +1 -1
package/lib/plugins/ptz/ptz.js
CHANGED
|
@@ -2,6 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import { View, Text } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import React, { useEffect, useState, useContext } from 'react';
|
|
5
|
+
import { useMemoizedFn } from 'ahooks';
|
|
5
6
|
import { UIEventContext } from '../../ui/context';
|
|
6
7
|
import { usePtz } from '../../hooks';
|
|
7
8
|
import { useStore } from '../../ctx/store';
|
|
@@ -14,6 +15,7 @@ export const Ptz = props => {
|
|
|
14
15
|
screenType: screenTypeAtom,
|
|
15
16
|
addContent,
|
|
16
17
|
deleteContent,
|
|
18
|
+
hasContent,
|
|
17
19
|
showContent,
|
|
18
20
|
hideContent,
|
|
19
21
|
className,
|
|
@@ -37,14 +39,12 @@ export const Ptz = props => {
|
|
|
37
39
|
setIsPtzActive(false);
|
|
38
40
|
}
|
|
39
41
|
}, [screenType]);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (!isPtzActive) {
|
|
47
|
-
showContent('bottomLeft', 'FullSmallIntercom');
|
|
42
|
+
const onPtz = useMemoizedFn(() => {
|
|
43
|
+
console.log(isPtzActive, 'isPtzActive');
|
|
44
|
+
console.log(hasContent('absolute', ptzControlId), 'hasContent');
|
|
45
|
+
if (!isPtzActive) {
|
|
46
|
+
showContent('bottomLeft', 'FullSmallIntercom');
|
|
47
|
+
if (!hasContent('absolute', ptzControlId)) {
|
|
48
48
|
// 添加ptz空间
|
|
49
49
|
addContent('absolute', {
|
|
50
50
|
id: ptzControlId,
|
|
@@ -54,14 +54,23 @@ export const Ptz = props => {
|
|
|
54
54
|
absoluteContentClassName: 'ipc-player-plugin-full-screen-ptz-control-wrap',
|
|
55
55
|
initProps: _objectSpread({}, props)
|
|
56
56
|
});
|
|
57
|
-
event.emit('ptzControlShow');
|
|
58
57
|
} else {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
event.emit('ptzControlHide');
|
|
58
|
+
console.log('ptzControlShow ===========');
|
|
59
|
+
event.emit('ptzControlShow');
|
|
62
60
|
}
|
|
63
|
-
|
|
61
|
+
} else {
|
|
62
|
+
// deleteContent('absolute', ptzControlId);
|
|
63
|
+
hideContent('bottomLeft', 'FullSmallIntercom');
|
|
64
|
+
event.emit('ptzControlHide');
|
|
64
65
|
}
|
|
66
|
+
setIsPtzActive(!isPtzActive);
|
|
67
|
+
});
|
|
68
|
+
if (screenType === 'vertical' || !supportPtz) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
72
|
+
className: clsx(className),
|
|
73
|
+
onClick: onPtz
|
|
65
74
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
66
75
|
className: clsx('icon-panel', 'icon-panel-ptz', 'ipc-player-plugin-ptz-text-icon'),
|
|
67
76
|
style: _objectSpread({}, isPtzActive && {
|
package/lib/plugins/ptz/ptz.less
CHANGED
|
@@ -56,10 +56,15 @@ export const PtzControl = props => {
|
|
|
56
56
|
const onPtzControlHide = useMemoizedFn(() => {
|
|
57
57
|
setIsPtzActive(false);
|
|
58
58
|
});
|
|
59
|
+
const onPtzControlShow = useMemoizedFn(() => {
|
|
60
|
+
setIsPtzActive(true);
|
|
61
|
+
});
|
|
59
62
|
useEffect(() => {
|
|
60
63
|
event.on('ptzControlHide', onPtzControlHide);
|
|
64
|
+
event.on('ptzControlShow', onPtzControlShow);
|
|
61
65
|
return () => {
|
|
62
66
|
event.off('ptzControlHide', onPtzControlHide);
|
|
67
|
+
event.off('ptzControlShow', onPtzControlShow);
|
|
63
68
|
};
|
|
64
69
|
}, []);
|
|
65
70
|
useEffect(() => {
|
|
@@ -72,7 +77,7 @@ export const PtzControl = props => {
|
|
|
72
77
|
}, []);
|
|
73
78
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
74
79
|
className: clsx('ipc-player-plugin-full-screen-ptz-control', {
|
|
75
|
-
'ipc-player-plugin-full-screen-ptz-control-hide':
|
|
80
|
+
'ipc-player-plugin-full-screen-ptz-control-hide': !isPtzActive || shouldHide,
|
|
76
81
|
'ipc-player-plugin-full-screen-ptz-disappear': screenType === 'vertical'
|
|
77
82
|
})
|
|
78
83
|
}, /*#__PURE__*/React.createElement(IpcPtzZoom, {
|
|
@@ -21,7 +21,9 @@ export const VideoBitKBP = props => {
|
|
|
21
21
|
init();
|
|
22
22
|
timer = setInterval(() => {
|
|
23
23
|
init();
|
|
24
|
-
},
|
|
24
|
+
}, 3000);
|
|
25
|
+
} else {
|
|
26
|
+
clearInterval(timer);
|
|
25
27
|
}
|
|
26
28
|
return () => {
|
|
27
29
|
clearInterval(timer);
|
|
@@ -33,7 +35,7 @@ export const VideoBitKBP = props => {
|
|
|
33
35
|
setBitKBP(`${res.data.kbps}KB/S`);
|
|
34
36
|
}
|
|
35
37
|
};
|
|
36
|
-
if (bitKBP === '') {
|
|
38
|
+
if (bitKBP === '' || bitKBP === '0KB/S' || store.playState !== PlayState.PLAYING) {
|
|
37
39
|
return null;
|
|
38
40
|
}
|
|
39
41
|
return /*#__PURE__*/React.createElement(View, {
|