@ray-js/ipc-player-integration 0.0.1-beta-36 → 0.0.1-beta-38
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.composition.js +0 -1
- package/lib/ctx/ctx.js +12 -7
- package/lib/ctx/event.js +3 -0
- package/lib/ctx/store.js +2 -0
- package/lib/hooks/useDpState/useDpState.js +3 -0
- package/lib/interface.js +11 -2
- package/lib/plugins/fullScreen/fullScreen.js +4 -4
- package/lib/plugins/fullScreen/fullScreen.less +6 -0
- package/lib/plugins/fullScreen/fullVoiceIntercom.js +8 -1
- package/lib/plugins/moveInteractiveControl/moveInteractiveControlUI.js +2 -0
- package/lib/plugins/ptz/ptz.less +6 -0
- package/lib/plugins/ptz/ptzControl.js +2 -1
- package/lib/plugins/resolution/fullResolutionControl.js +2 -0
- package/lib/plugins/resolution/resolution.d.ts +1 -1
- package/lib/plugins/resolution/resolution.js +28 -27
- package/lib/plugins/voiceIntercom/voiceIntercom.js +35 -8
- package/lib/ui/event.js +3 -0
- package/lib/ui/ui.js +2 -0
- package/lib/utils/device/index.js +3 -0
- package/lib/utils/plugins/index.d.ts +3 -1
- package/lib/utils/plugins/index.js +10 -2
- package/package.json +2 -2
- package/lib/ctx/ports.output.d.ts +0 -9
- package/lib/interface.d.ts +0 -102
- package/lib/utils/device/index.d.ts +0 -23
package/lib/ctx/ctx.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.find.js";
|
|
4
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
1
5
|
import { useRef, useCallback, useEffect } from 'react';
|
|
2
6
|
import Strings from '../i18n';
|
|
3
7
|
import { useAtom, updateAtom, getDefaultStore, useStore } from './store';
|
|
@@ -80,10 +84,10 @@ export const createUseCtx = _ref => {
|
|
|
80
84
|
// 获取缓存的值且同步
|
|
81
85
|
getMemoryState(devId).then(res => {
|
|
82
86
|
console.log('==== getMemoryState ====', res);
|
|
87
|
+
setResolutionList(res.resolutionList);
|
|
88
|
+
_setResolution(res.resolution);
|
|
83
89
|
_setMute(res.mute);
|
|
84
90
|
setIntercomMode(res.intercomMode);
|
|
85
|
-
_setResolution(res.resolution);
|
|
86
|
-
setResolutionList(res.resolutionList);
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
93
|
}, [devId, _playState]);
|
|
@@ -122,6 +126,7 @@ export const createUseCtx = _ref => {
|
|
|
122
126
|
IPCPlayerInstance.current = createPlayContext(devId);
|
|
123
127
|
}
|
|
124
128
|
const _setMute = async target => {
|
|
129
|
+
console.log(target, '_setMute====');
|
|
125
130
|
return new Promise((resolve, reject) => {
|
|
126
131
|
IPCPlayerInstance.current.setMuted({
|
|
127
132
|
mute: target,
|
|
@@ -138,12 +143,12 @@ export const createUseCtx = _ref => {
|
|
|
138
143
|
updateAtom(mute, res);
|
|
139
144
|
}
|
|
140
145
|
});
|
|
146
|
+
console.log('喇叭调用失败', JSON.stringify(err));
|
|
141
147
|
reject(err);
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
148
|
+
|
|
149
|
+
// const errObj = err.innerError || err || {};
|
|
150
|
+
// const errMsg = errObj.errorMsg || I18n.t('error_setMute');
|
|
151
|
+
// toast({ title: errMsg });
|
|
147
152
|
}
|
|
148
153
|
});
|
|
149
154
|
});
|
package/lib/ctx/event.js
CHANGED
package/lib/ctx/store.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
4
|
+
import "core-js/modules/esnext.iterator.reduce.js";
|
|
2
5
|
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
3
6
|
import { getDeviceInfo, onDpDataChange, offDpDataChange } from '@ray-js/ray';
|
|
4
7
|
import { useMemoizedFn } from '../useMemoizedFn';
|
package/lib/interface.js
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
export { IntercomMode } from './ports.output';
|
|
2
2
|
export let PlayerStreamStatus = /*#__PURE__*/function (PlayerStreamStatus) {
|
|
3
3
|
PlayerStreamStatus[PlayerStreamStatus["UnknownException"] = -1000] = "UnknownException";
|
|
4
|
+
// 未知异常
|
|
4
5
|
PlayerStreamStatus[PlayerStreamStatus["ConnectSuccess"] = 1001] = "ConnectSuccess";
|
|
6
|
+
// 连接成功
|
|
5
7
|
PlayerStreamStatus[PlayerStreamStatus["ConnectFail"] = -1001] = "ConnectFail";
|
|
8
|
+
// 链接失败
|
|
6
9
|
PlayerStreamStatus[PlayerStreamStatus["PreviewSuccess"] = 1002] = "PreviewSuccess";
|
|
10
|
+
// preview 成功
|
|
7
11
|
PlayerStreamStatus[PlayerStreamStatus["PreviewFail"] = -1002] = "PreviewFail";
|
|
12
|
+
// preview 失败
|
|
8
13
|
PlayerStreamStatus[PlayerStreamStatus["NetworkError"] = -1010] = "NetworkError";
|
|
14
|
+
// 网络状态不可用
|
|
9
15
|
PlayerStreamStatus[PlayerStreamStatus["DeviceDelete"] = -1012] = "DeviceDelete";
|
|
16
|
+
// 设备被移除
|
|
10
17
|
PlayerStreamStatus[PlayerStreamStatus["DisconnectSuccess"] = 1009] = "DisconnectSuccess";
|
|
18
|
+
// 断连成功
|
|
11
19
|
PlayerStreamStatus[PlayerStreamStatus["DisconnectFail"] = -1009] = "DisconnectFail";
|
|
12
|
-
|
|
20
|
+
// 断连失败
|
|
21
|
+
PlayerStreamStatus[PlayerStreamStatus["PAUSE"] = 4] = "PAUSE"; // 暂停
|
|
13
22
|
return PlayerStreamStatus;
|
|
14
|
-
}({});
|
|
23
|
+
}({});
|
|
15
24
|
export let PlayState = /*#__PURE__*/function (PlayState) {
|
|
16
25
|
PlayState[PlayState["CONNECTING"] = 0] = "CONNECTING";
|
|
17
26
|
PlayState[PlayState["PLAYING"] = 1] = "PLAYING";
|
|
@@ -93,17 +93,17 @@ export function FullScreen(props) {
|
|
|
93
93
|
handleFull();
|
|
94
94
|
},
|
|
95
95
|
vertical: () => {
|
|
96
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
96
97
|
ty.setNavigationBarBack({
|
|
97
98
|
type: 'system'
|
|
98
99
|
});
|
|
99
|
-
|
|
100
|
+
ty.showMenuButton();
|
|
101
|
+
ty.showStatusBar();
|
|
102
|
+
deleteContent('topLeft', verticalScreenId);
|
|
100
103
|
deleteContent('absolute', voiceIntercomId);
|
|
101
104
|
deleteContent('absolute', ptzControlId);
|
|
102
|
-
deleteContent('topLeft', verticalScreenId);
|
|
103
105
|
deleteContent('absolute', fullResolutionId);
|
|
104
106
|
deleteContent('absolute', fullTravelRouteControlId);
|
|
105
|
-
ty.showMenuButton();
|
|
106
|
-
ty.showStatusBar();
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
useUpdateEffect(() => {
|
|
@@ -24,6 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
.ipc-player-plugin-full-screen-voice-disappear {
|
|
28
|
+
width: 0;
|
|
29
|
+
height: 0;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
.ipc-plugin-full-travel-route-control {
|
|
28
34
|
width: calc(172px * var(--ipc-player-size-scale, 1));
|
|
29
35
|
height: calc(172px * var(--ipc-player-size-scale, 1));
|
|
@@ -10,12 +10,18 @@ import { useComponentHideState } from '../../ui/hooks';
|
|
|
10
10
|
import { useMemoizedFn } from '../../hooks';
|
|
11
11
|
import { UIEventContext } from '../../ui/context';
|
|
12
12
|
import { pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
13
|
+
import { useStore } from '../../ctx/store';
|
|
13
14
|
export function FullVoiceIntercom(props) {
|
|
14
15
|
const [shouldHide] = useComponentHideState();
|
|
15
16
|
const [isPtzActive, setIsPtzActive] = useState(false);
|
|
16
17
|
const {
|
|
17
18
|
event
|
|
18
19
|
} = useContext(UIEventContext);
|
|
20
|
+
const {
|
|
21
|
+
screenType
|
|
22
|
+
} = useStore({
|
|
23
|
+
screenType: props.screenType
|
|
24
|
+
});
|
|
19
25
|
const onPtzControlShow = useMemoizedFn(() => {
|
|
20
26
|
setIsPtzActive(true);
|
|
21
27
|
});
|
|
@@ -32,7 +38,8 @@ export function FullVoiceIntercom(props) {
|
|
|
32
38
|
}, []);
|
|
33
39
|
return /*#__PURE__*/React.createElement(View, {
|
|
34
40
|
className: clsx('ipc-player-plugin-full-screen-voice', {
|
|
35
|
-
'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive
|
|
41
|
+
'ipc-player-plugin-full-screen-voice-hide': shouldHide || isPtzActive,
|
|
42
|
+
'ipc-player-plugin-full-screen-voice-disappear': screenType === 'vertical'
|
|
36
43
|
})
|
|
37
44
|
}, /*#__PURE__*/React.createElement(VoiceIntercom, _extends({}, props, {
|
|
38
45
|
talkingColor: "#FFFFFF",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { View, ScrollView } from '@ray-js/ray';
|
|
4
6
|
import clsx from 'clsx';
|
package/lib/plugins/ptz/ptz.less
CHANGED
|
@@ -72,7 +72,8 @@ export const PtzControl = props => {
|
|
|
72
72
|
}, []);
|
|
73
73
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
74
74
|
className: clsx('ipc-player-plugin-full-screen-ptz-control', {
|
|
75
|
-
'ipc-player-plugin-full-screen-ptz-control-hide': shouldHide || !isPtzActive
|
|
75
|
+
'ipc-player-plugin-full-screen-ptz-control-hide': shouldHide || !isPtzActive,
|
|
76
|
+
'ipc-player-plugin-full-screen-ptz-disappear': screenType === 'vertical'
|
|
76
77
|
})
|
|
77
78
|
}, /*#__PURE__*/React.createElement(IpcPtzZoom, {
|
|
78
79
|
ptzSize: "172px",
|
|
@@ -4,7 +4,7 @@ import './resolution.less';
|
|
|
4
4
|
export type ChangeResolutionWhenClick = ScreenType[];
|
|
5
5
|
type Props = ComponentConfigProps & {
|
|
6
6
|
className?: string;
|
|
7
|
-
|
|
7
|
+
verticalResolutionCustomClick?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare const Resolution: (props: Props) => React.JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -2,13 +2,13 @@ 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, { useContext } from 'react';
|
|
5
|
+
import { useMemoizedFn } from 'ahooks';
|
|
5
6
|
import Strings from '../../i18n';
|
|
6
7
|
import { FullResolutionControl } from './fullResolutionControl';
|
|
7
8
|
import { fullResolutionId, pauseTimeToHideAllComponent, hideAllComponent } from '../../ui/constant';
|
|
8
9
|
import { UIEventContext } from '../../ui/context';
|
|
9
10
|
import { useStore } from '../../ctx/store';
|
|
10
11
|
import './resolution.less';
|
|
11
|
-
const defaultChangeResolutionWhenClick = ['full'];
|
|
12
12
|
export const Resolution = props => {
|
|
13
13
|
const {
|
|
14
14
|
IPCPlayerContext,
|
|
@@ -16,7 +16,7 @@ export const Resolution = props => {
|
|
|
16
16
|
addContent,
|
|
17
17
|
hasContent,
|
|
18
18
|
className,
|
|
19
|
-
|
|
19
|
+
verticalResolutionCustomClick
|
|
20
20
|
} = props;
|
|
21
21
|
const {
|
|
22
22
|
resolution,
|
|
@@ -28,32 +28,33 @@ export const Resolution = props => {
|
|
|
28
28
|
const {
|
|
29
29
|
event
|
|
30
30
|
} = useContext(UIEventContext);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
event.emit(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
initProps: _objectSpread({}, props)
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return false;
|
|
50
|
-
}
|
|
51
|
-
if (screenType === 'vertical' && defaultChangeResolutionWhenClick.includes(screenType)) {
|
|
52
|
-
setResolution(resolution === 'HD' ? 'SD' : 'HD');
|
|
31
|
+
const onResolution = useMemoizedFn(() => {
|
|
32
|
+
event.emit('resolutionBtnControlClick');
|
|
33
|
+
if (screenType === 'full') {
|
|
34
|
+
event.emit(hideAllComponent);
|
|
35
|
+
if (hasContent('absolute', fullResolutionId)) {
|
|
36
|
+
event.emit('showFullResolutionControl');
|
|
37
|
+
} else {
|
|
38
|
+
addContent('absolute', {
|
|
39
|
+
id: fullResolutionId,
|
|
40
|
+
content: props => {
|
|
41
|
+
return /*#__PURE__*/React.createElement(FullResolutionControl, props);
|
|
42
|
+
},
|
|
43
|
+
absoluteContentClassName: 'ipc-player-plugin-full-resolution-control-wrap',
|
|
44
|
+
initProps: _objectSpread({}, props)
|
|
45
|
+
});
|
|
53
46
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
if (verticalResolutionCustomClick) return false;
|
|
50
|
+
if (screenType === 'vertical') {
|
|
51
|
+
setResolution(resolution === 'HD' ? 'SD' : 'HD');
|
|
52
|
+
}
|
|
53
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
54
|
+
return true;
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
57
|
+
onClick: onResolution,
|
|
57
58
|
className: clsx(className, screenType === 'vertical' ? 'ipc-player-plugin-resolution-vertical' : 'ipc-player-plugin-resolution-full')
|
|
58
59
|
}, /*#__PURE__*/React.createElement(View, {
|
|
59
60
|
className: "ipc-player-plugin-resolution"
|
|
@@ -30,6 +30,8 @@ export const VoiceIntercom = props => {
|
|
|
30
30
|
} = props;
|
|
31
31
|
const [frame, setFrame] = useState(0);
|
|
32
32
|
const talkingInterval = useRef(null);
|
|
33
|
+
// 每帧间隔(ms)
|
|
34
|
+
|
|
33
35
|
const {
|
|
34
36
|
event
|
|
35
37
|
} = useContext(UIEventContext);
|
|
@@ -79,18 +81,43 @@ export const VoiceIntercom = props => {
|
|
|
79
81
|
await setIntercom(false);
|
|
80
82
|
event.emit(startTimeToHideAllComponent);
|
|
81
83
|
};
|
|
84
|
+
// 获取 requestAnimationFrame 和兼容性回退
|
|
85
|
+
const requestFrame = callback => {
|
|
86
|
+
if (typeof requestAnimationFrame !== 'undefined') {
|
|
87
|
+
return requestAnimationFrame(callback);
|
|
88
|
+
}
|
|
89
|
+
return setTimeout(callback, 30); // 使用 setTimeout 模拟帧更新
|
|
90
|
+
};
|
|
91
|
+
const cancelFrame = id => {
|
|
92
|
+
if (typeof cancelAnimationFrame !== 'undefined') {
|
|
93
|
+
cancelAnimationFrame(id);
|
|
94
|
+
} else {
|
|
95
|
+
clearTimeout(id); // 清除 setTimeout
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
82
99
|
/**
|
|
83
100
|
* 处理对讲中动画
|
|
84
101
|
*/
|
|
85
102
|
useEffect(() => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
const updateFrame = () => {
|
|
104
|
+
setFrame(prevFrame => (prevFrame + 1) % 124);
|
|
105
|
+
talkingInterval.current = requestFrame(updateFrame);
|
|
106
|
+
};
|
|
107
|
+
const stopAnimation = () => {
|
|
108
|
+
if (talkingInterval.current) {
|
|
109
|
+
cancelFrame(talkingInterval.current);
|
|
110
|
+
talkingInterval.current = null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
intercom ? (() => {
|
|
114
|
+
if (!talkingInterval.current) {
|
|
115
|
+
talkingInterval.current = requestFrame(updateFrame);
|
|
116
|
+
}
|
|
117
|
+
})() : stopAnimation();
|
|
118
|
+
return () => {
|
|
119
|
+
stopAnimation();
|
|
120
|
+
};
|
|
94
121
|
}, [intercom]);
|
|
95
122
|
|
|
96
123
|
// 根据当前帧和矩形索引计算高度
|
package/lib/ui/event.js
CHANGED
package/lib/ui/ui.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
2
4
|
import React, { useState, useRef, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
3
5
|
import { View, CoverView, getSystemInfoSync, usePageEvent } from '@ray-js/ray';
|
|
4
6
|
import clsx from 'clsx';
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
|
+
import "core-js/modules/esnext.iterator.find.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
1
4
|
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
2
5
|
export function getDpValue(options) {
|
|
3
6
|
return new Promise((resolve, reject) => {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { UseCtx } from '../../interface';
|
|
2
2
|
type Ctx = ReturnType<UseCtx>;
|
|
3
|
-
export declare function initPlayerPlugins(ctx: Ctx
|
|
3
|
+
export declare function initPlayerPlugins(ctx: Ctx, options: {
|
|
4
|
+
verticalResolutionCustomClick?: boolean;
|
|
5
|
+
}): Promise<void>;
|
|
4
6
|
export {};
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import _cloneDeep from 'lodash/cloneDeep';
|
|
1
2
|
import { defaultTopLeftContent, defaultTopRightContent, defaultBottomLeftContent, defaultBottomRightContent } from '../../ctx';
|
|
2
3
|
import { hasDpCode } from '../../utils/device';
|
|
3
4
|
import { MoveInteractiveControlButton } from '../../plugins/moveInteractiveControl';
|
|
4
5
|
// 根据当前 dp 信息决定设置哪些 plugin
|
|
5
|
-
export async function initPlayerPlugins(ctx) {
|
|
6
|
+
export async function initPlayerPlugins(ctx, options) {
|
|
6
7
|
ctx.addContent('topLeft', defaultTopLeftContent);
|
|
7
8
|
ctx.addContent('topRight', defaultTopRightContent);
|
|
8
|
-
|
|
9
|
+
const newDefaultBottomLeftContent = _cloneDeep(defaultBottomLeftContent);
|
|
10
|
+
const resolutionIndex = newDefaultBottomLeftContent.findIndex(item => item.id === 'Resolution');
|
|
11
|
+
if (resolutionIndex !== -1) {
|
|
12
|
+
newDefaultBottomLeftContent[resolutionIndex].initProps = {
|
|
13
|
+
verticalResolutionCustomClick: options.verticalResolutionCustomClick
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
ctx.addContent('bottomLeft', newDefaultBottomLeftContent);
|
|
9
17
|
ctx.addContent('bottomRight', defaultBottomRightContent);
|
|
10
18
|
|
|
11
19
|
// 根据 ipc_manual_petting 是否存在,决定是否要插入控件 moveInteractiveControl
|
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-38",
|
|
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-6",
|
|
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",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { IntercomMode } from '../ports.output';
|
|
2
|
-
export type { Toast, IntercomMode } from '../ports.output';
|
|
3
|
-
export type createPlayContext = (devId: string) => IpcContext;
|
|
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;
|
package/lib/interface.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PrimitiveAtom } from 'jotai';
|
|
3
|
-
import type { Toast, IntercomMode } from './ports.output';
|
|
4
|
-
export { IntercomMode } from './ports.output';
|
|
5
|
-
type WithInitialValue<Value> = {
|
|
6
|
-
init: Value;
|
|
7
|
-
};
|
|
8
|
-
export type RetAtom<T> = PrimitiveAtom<T> & WithInitialValue<T>;
|
|
9
|
-
export type ScreenType = 'full' | 'vertical';
|
|
10
|
-
export declare const enum PlayerStreamStatus {
|
|
11
|
-
UnknownException = -1000,
|
|
12
|
-
ConnectSuccess = 1001,
|
|
13
|
-
ConnectFail = -1001,
|
|
14
|
-
PreviewSuccess = 1002,
|
|
15
|
-
PreviewFail = -1002,
|
|
16
|
-
NetworkError = -1010,
|
|
17
|
-
DeviceDelete = -1012,
|
|
18
|
-
DisconnectSuccess = 1009,
|
|
19
|
-
DisconnectFail = -1009,
|
|
20
|
-
PAUSE = 4
|
|
21
|
-
}
|
|
22
|
-
export declare const enum PlayState {
|
|
23
|
-
CONNECTING = 0,
|
|
24
|
-
PLAYING = 1,
|
|
25
|
-
PAUSE = 2
|
|
26
|
-
}
|
|
27
|
-
export type ContentPlaceType = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'absolute';
|
|
28
|
-
type Task = (...args: any[]) => void;
|
|
29
|
-
export type EventInstance = {
|
|
30
|
-
on: (type: string, cb: Task) => void;
|
|
31
|
-
off: (type: string, cb: Task) => void;
|
|
32
|
-
emit: (type: string, ...args: any[]) => void;
|
|
33
|
-
};
|
|
34
|
-
export type UseCtx = (options: {
|
|
35
|
-
devId: string;
|
|
36
|
-
initTopLeftContent?: ComponentConfig[];
|
|
37
|
-
initTopRightContent?: ComponentConfig[];
|
|
38
|
-
initBottomLeftContent?: ComponentConfig[];
|
|
39
|
-
initBottomRightContent?: ComponentConfig[];
|
|
40
|
-
initAbsoluteContent?: ComponentConfig[];
|
|
41
|
-
saveToAlbum?: 0 | 1;
|
|
42
|
-
}) => {
|
|
43
|
-
devId: string;
|
|
44
|
-
brandColor: RetAtom<string>;
|
|
45
|
-
verticalMic: RetAtom<boolean>;
|
|
46
|
-
saveToAlbum: 0 | 1;
|
|
47
|
-
screenType: RetAtom<ScreenType>;
|
|
48
|
-
recording: RetAtom<boolean>;
|
|
49
|
-
recordingDisabled: RetAtom<boolean>;
|
|
50
|
-
mute: RetAtom<boolean>;
|
|
51
|
-
intercom: RetAtom<boolean>;
|
|
52
|
-
intercomMode: RetAtom<IntercomMode>;
|
|
53
|
-
resolution: RetAtom<string>;
|
|
54
|
-
resolutionList: RetAtom<string[]>;
|
|
55
|
-
playState: RetAtom<PlayState>;
|
|
56
|
-
IPCPlayerInstance: IpcContext;
|
|
57
|
-
topLeftContent: RetAtom<ComponentConfig[]>;
|
|
58
|
-
topRightContent: RetAtom<ComponentConfig[]>;
|
|
59
|
-
bottomLeftContent: RetAtom<ComponentConfig[]>;
|
|
60
|
-
bottomRightContent: RetAtom<ComponentConfig[]>;
|
|
61
|
-
absoluteContent: RetAtom<ComponentConfig[]>;
|
|
62
|
-
setBrandColor: (color: string) => void;
|
|
63
|
-
setVerticalMic: (color: boolean) => void;
|
|
64
|
-
setScreenType: (type: ScreenType) => void;
|
|
65
|
-
setRecordingDisabled: (type: boolean) => void;
|
|
66
|
-
setResolution: (type: string) => void;
|
|
67
|
-
setResolutionList: (type: string[]) => void;
|
|
68
|
-
setRecording: (value: boolean) => Promise<RecordInfoData>;
|
|
69
|
-
setIntercom: (value: boolean) => Promise<boolean>;
|
|
70
|
-
setMute: (value: boolean) => Promise<boolean>;
|
|
71
|
-
changeStreamStatus: (value: PlayerStreamStatus) => void;
|
|
72
|
-
getStreamStatus: () => PlayerStreamStatus;
|
|
73
|
-
setPlayState: (value: PlayState) => void;
|
|
74
|
-
addContent: <T>(type: ContentPlaceType, config: ComponentConfig<T> | ComponentConfig<T>[], position?: number) => void;
|
|
75
|
-
deleteContent: (type: ContentPlaceType, id: string) => void;
|
|
76
|
-
hasContent: (type: ContentPlaceType, id: string) => boolean;
|
|
77
|
-
hideContent: (type: ContentPlaceType, id: string) => void;
|
|
78
|
-
showContent: (type: ContentPlaceType, id: string) => void;
|
|
79
|
-
toast: Toast;
|
|
80
|
-
event: EventInstance;
|
|
81
|
-
};
|
|
82
|
-
export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
|
|
83
|
-
id: string;
|
|
84
|
-
content: (props: T) => React.ReactElement;
|
|
85
|
-
initProps?: T;
|
|
86
|
-
absolutePosition?: React.CSSProperties;
|
|
87
|
-
absoluteContentClassName?: string;
|
|
88
|
-
absoluteContentStyle?: React.CSSProperties;
|
|
89
|
-
hidden?: boolean;
|
|
90
|
-
};
|
|
91
|
-
export type ComponentConfigProps = {
|
|
92
|
-
IPCPlayerContext: IpcContext;
|
|
93
|
-
} & ReturnType<UseCtx>;
|
|
94
|
-
export type PlayStatusData = {
|
|
95
|
-
playState: PlayState;
|
|
96
|
-
playCode: number;
|
|
97
|
-
};
|
|
98
|
-
export type RecordInfoData = boolean | {
|
|
99
|
-
tempImagePath: string;
|
|
100
|
-
filePath: string;
|
|
101
|
-
thumbPath: string;
|
|
102
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function getDpValue<T extends string>(options: {
|
|
2
|
-
devId: string;
|
|
3
|
-
dps: T[];
|
|
4
|
-
}): Promise<Record<T, number | string | boolean>>;
|
|
5
|
-
export interface IDpCode {
|
|
6
|
-
code: string;
|
|
7
|
-
dpId: number;
|
|
8
|
-
value: string;
|
|
9
|
-
time: number;
|
|
10
|
-
type: string;
|
|
11
|
-
}
|
|
12
|
-
type ReturnDeviceInfo = Parameters<Parameters<typeof ty.device.getDeviceInfo>[0]['success']>[0];
|
|
13
|
-
export declare function getDeviceInfo(devId: string): Promise<ReturnDeviceInfo>;
|
|
14
|
-
export declare function getDpIdsByCodes<T extends string>(devId: string, dpIds: T[]): Promise<Record<T, string>>;
|
|
15
|
-
export declare const showMathPowValue: (value: any, scale: any) => string | 0;
|
|
16
|
-
export declare const getDevInfo: <T>(deviceId: string) => Promise<any>;
|
|
17
|
-
/**
|
|
18
|
-
* 根据DpCode获取枚举型DP的range是否包含对应项
|
|
19
|
-
* @param result: {code: number, msg: string}
|
|
20
|
-
*/
|
|
21
|
-
export declare const getEnumRangeIsValid: (devId: any, dpCode: any, rangValue: any) => Promise<any>;
|
|
22
|
-
export declare function hasDpCode(devId: string, code: string): Promise<boolean>;
|
|
23
|
-
export {};
|