@ray-js/ipc-player-integration 0.0.1-beta-54 → 0.0.1-beta-55
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/ctx/ctx.js +33 -5
- package/lib/hooks/useBattery/index.js +1 -1
- package/lib/hooks/useDpState/useDpState.js +2 -1
- package/lib/plugins/fullScreen/fullScreen.js +7 -1
- package/lib/plugins/recordVideo/recordVideo.js +5 -11
- package/lib/ui/constant.d.ts +9 -0
- package/lib/ui/constant.js +16 -1
- package/lib/ui/ui.js +2 -3
- package/package.json +2 -2
package/lib/ctx/ctx.js
CHANGED
|
@@ -80,14 +80,32 @@ export const createUseCtx = _ref => {
|
|
|
80
80
|
if (!eventRef.current) {
|
|
81
81
|
eventRef.current = getEventInstance();
|
|
82
82
|
}
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
// 初始化获取缓存值
|
|
85
|
+
|
|
86
|
+
(async () => {
|
|
87
|
+
if (!devId) return;
|
|
88
|
+
try {
|
|
89
|
+
const res = await getMemoryState(devId);
|
|
90
|
+
console.log('==== getMemoryState ====xghazh', res);
|
|
91
|
+
setResolutionList(res.resolutionList);
|
|
92
|
+
_setResolution(res.resolution, true);
|
|
93
|
+
_setMute(res.mute, true);
|
|
94
|
+
setIntercomMode(res.intercomMode);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('获取 getMemoryState 失败:', error);
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
}, [devId]);
|
|
83
100
|
useEffect(() => {
|
|
84
101
|
if (devId && _playState === PlayState.PLAYING) {
|
|
85
102
|
// 获取缓存的值且同步
|
|
86
103
|
getMemoryState(devId).then(res => {
|
|
87
|
-
console.log('
|
|
104
|
+
console.log('PlayingMemoryState', res);
|
|
88
105
|
setResolutionList(res.resolutionList);
|
|
89
|
-
|
|
90
|
-
|
|
106
|
+
// 传true表示值即可,会取播放器的值
|
|
107
|
+
_setResolution(res.resolution, true);
|
|
108
|
+
_setMute(res.mute, true);
|
|
91
109
|
setIntercomMode(res.intercomMode);
|
|
92
110
|
});
|
|
93
111
|
}
|
|
@@ -126,8 +144,13 @@ export const createUseCtx = _ref => {
|
|
|
126
144
|
if (!IPCPlayerInstance.current) {
|
|
127
145
|
IPCPlayerInstance.current = createPlayContext(devId);
|
|
128
146
|
}
|
|
129
|
-
const _setMute = async target
|
|
147
|
+
const _setMute = async function (target) {
|
|
148
|
+
let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
130
149
|
console.log(target, '_setMute====');
|
|
150
|
+
if (onlyUpdateAtom) {
|
|
151
|
+
updateAtom(mute, target);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
131
154
|
return new Promise((resolve, reject) => {
|
|
132
155
|
IPCPlayerInstance.current.setMuted({
|
|
133
156
|
mute: target,
|
|
@@ -155,8 +178,13 @@ export const createUseCtx = _ref => {
|
|
|
155
178
|
* 设置清晰度
|
|
156
179
|
*
|
|
157
180
|
*/
|
|
158
|
-
const _setResolution = async target
|
|
181
|
+
const _setResolution = async function (target) {
|
|
182
|
+
let onlyUpdateAtom = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
159
183
|
// target 为需要切换的清晰度
|
|
184
|
+
if (onlyUpdateAtom) {
|
|
185
|
+
updateAtom(resolution, target);
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
160
188
|
return new Promise((resolve, reject) => {
|
|
161
189
|
IPCPlayerInstance.current.setClarity({
|
|
162
190
|
clarity: target === ClarityType.HD ? 'hd' : 'normal',
|
|
@@ -44,7 +44,7 @@ export const useBattery = devId => {
|
|
|
44
44
|
const batteryInfo = useMemo(() => {
|
|
45
45
|
return {
|
|
46
46
|
batteryValue: getEleValue(dpState[POWER_VALUE_DP_CODE], dpState[POWER_CALC_METHOD_DP_CODE]),
|
|
47
|
-
batteryCharging: dpState[POWER_MODE_DP_CODE]
|
|
47
|
+
batteryCharging: dpState[POWER_MODE_DP_CODE] === '1'
|
|
48
48
|
};
|
|
49
49
|
}, [dpState]);
|
|
50
50
|
return batteryInfo;
|
|
@@ -77,8 +77,9 @@ export function useDpState(options) {
|
|
|
77
77
|
codeMapToIdRef.current = codeMapToId;
|
|
78
78
|
dpCodeSchemaMapsRef.current = dpCodeSchemaMaps;
|
|
79
79
|
const initValue = options.dpCodes.reduce((ret, key) => {
|
|
80
|
+
const currentId = codeMapToIdRef.current[key];
|
|
80
81
|
return _objectSpread(_objectSpread({}, ret), {}, {
|
|
81
|
-
[key]: res.
|
|
82
|
+
[key]: res.dps[currentId]
|
|
82
83
|
});
|
|
83
84
|
}, {});
|
|
84
85
|
setValues(initValue);
|
|
@@ -55,9 +55,15 @@ export function FullScreen(props) {
|
|
|
55
55
|
absoluteContentClassName: 'ipc-player-plugin-vertical-screen-wrap',
|
|
56
56
|
initProps: _objectSpread(_objectSpread({}, props), {}, {
|
|
57
57
|
onClick: () => {
|
|
58
|
+
// 点击返回时提前调用一波
|
|
59
|
+
deleteContent('topLeft', verticalScreenId);
|
|
60
|
+
deleteContent('absolute', voiceIntercomId);
|
|
61
|
+
deleteContent('absolute', ptzControlId);
|
|
62
|
+
deleteContent('absolute', fullResolutionId);
|
|
63
|
+
deleteContent('absolute', fullTravelRouteControlId);
|
|
64
|
+
handClick('vertical');
|
|
58
65
|
event.emit(pauseTimeToHideAllComponent);
|
|
59
66
|
event.emit(showAllComponent);
|
|
60
|
-
handClick('vertical');
|
|
61
67
|
}
|
|
62
68
|
})
|
|
63
69
|
});
|
|
@@ -260,17 +260,11 @@ export function RecordVideo(props) {
|
|
|
260
260
|
}
|
|
261
261
|
} catch (err) {
|
|
262
262
|
console.log('录制失败', err);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
const errObj = err.innerError || err || {};
|
|
269
|
-
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_record_tip');
|
|
270
|
-
toast({
|
|
271
|
-
title: errMsg
|
|
272
|
-
});
|
|
273
|
-
}
|
|
263
|
+
const errObj = err.innerError || err || {};
|
|
264
|
+
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_record_tip');
|
|
265
|
+
toast({
|
|
266
|
+
title: errMsg
|
|
267
|
+
});
|
|
274
268
|
setState({
|
|
275
269
|
showTimer: false
|
|
276
270
|
});
|
package/lib/ui/constant.d.ts
CHANGED
|
@@ -9,3 +9,12 @@ export declare const verticalScreenId = "verticalScreenId";
|
|
|
9
9
|
export declare const ptzControlId = "ptzControlId";
|
|
10
10
|
export declare const fullResolutionId = "fullResolutionId";
|
|
11
11
|
export declare const batteryId = "Battery";
|
|
12
|
+
export declare const decodeClarityDic: {
|
|
13
|
+
SS: string;
|
|
14
|
+
SD: string;
|
|
15
|
+
HD: string;
|
|
16
|
+
UD: string;
|
|
17
|
+
SSP: string;
|
|
18
|
+
AUTO: string;
|
|
19
|
+
AUDIO: string;
|
|
20
|
+
};
|
package/lib/ui/constant.js
CHANGED
|
@@ -8,4 +8,19 @@ export const fullTravelRouteControlId = 'fullTravelRouteControl';
|
|
|
8
8
|
export const verticalScreenId = 'verticalScreenId';
|
|
9
9
|
export const ptzControlId = 'ptzControlId';
|
|
10
10
|
export const fullResolutionId = 'fullResolutionId';
|
|
11
|
-
export const batteryId = 'Battery';
|
|
11
|
+
export const batteryId = 'Battery';
|
|
12
|
+
export const decodeClarityDic = {
|
|
13
|
+
SS: 'ss',
|
|
14
|
+
// 省流量
|
|
15
|
+
SD: 'normal',
|
|
16
|
+
// 标清
|
|
17
|
+
HD: 'hd',
|
|
18
|
+
// 高清
|
|
19
|
+
UD: 'ud',
|
|
20
|
+
// 超清
|
|
21
|
+
SSP: 'ssp',
|
|
22
|
+
// 超超清
|
|
23
|
+
AUTO: 'auto',
|
|
24
|
+
// 自动
|
|
25
|
+
AUDIO: 'audio' // 音频模式
|
|
26
|
+
};
|
package/lib/ui/ui.js
CHANGED
|
@@ -10,7 +10,7 @@ import { PlayState, PlayerStreamStatus } from '../interface';
|
|
|
10
10
|
import { useCtx } from '../ctx/ctx.composition';
|
|
11
11
|
import { useStore } from '../ctx/store';
|
|
12
12
|
import { UIEventContext } from './context';
|
|
13
|
-
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent } from './constant';
|
|
13
|
+
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic } from './constant';
|
|
14
14
|
import BottomLeftContent from './bottomLeftContent';
|
|
15
15
|
import BottomRightContent from './bottomRightContent';
|
|
16
16
|
import TopLeftContent from './topLeftContent';
|
|
@@ -271,7 +271,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
271
271
|
}, /*#__PURE__*/React.createElement(View, {
|
|
272
272
|
className: clsx('ipc-player-content', className),
|
|
273
273
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
|
|
274
|
-
// backgroundColor: 'rgba(0,0,0,0.2)',
|
|
275
274
|
height: screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh'
|
|
276
275
|
})
|
|
277
276
|
}, /*#__PURE__*/React.createElement(IPCPlayer, _extends({
|
|
@@ -302,7 +301,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
302
301
|
onCameraNotifyWeakNetwork: data => {
|
|
303
302
|
console.log(`onCameraNotifyWeakNetwork: ${JSON.stringify(data)}`);
|
|
304
303
|
},
|
|
305
|
-
clarity: resolution
|
|
304
|
+
clarity: decodeClarityDic[resolution]
|
|
306
305
|
// 安卓横屏问题
|
|
307
306
|
// ptzControllable={screenType === 'vertical'}
|
|
308
307
|
,
|
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-55",
|
|
4
4
|
"description": "IPC 播放器功能集成",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -39,7 +39,7 @@
|
|
|
39
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-12",
|
|
42
|
-
"@ray-js/ray-ipc-utils": "1.1.0-beta-
|
|
42
|
+
"@ray-js/ray-ipc-utils": "1.1.0-beta-16",
|
|
43
43
|
"@ray-js/svg": "0.2.0",
|
|
44
44
|
"clsx": "^1.2.1",
|
|
45
45
|
"jotai": "^2.10.2"
|