@ray-js/ipc-player-integration 0.0.52-beta.0 → 0.0.52-beta.2
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 +13 -3
- package/lib/interface.d.ts +4 -0
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/ui.js +11 -10
- package/lib/widgets/captureResult/captureResult.d.ts +11 -7
- package/lib/widgets/captureResult/captureResult.js +40 -15
- package/lib/widgets/captureResult/captureResult.less +22 -8
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/zoomTurntable/lensSkill.js +4 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { IntercomMode, MuteMode, ClarityType } from '@ray-js/ray-ipc-utils/lib/i
|
|
|
6
6
|
import { createUseCtx } from './ctx';
|
|
7
7
|
import { FullSmallIntercom, VerticalSmallIntercom, BatteryFull, Battery, Screenshot, TempHumidity, Signal4G, RecordVideo, FullScreen, VideoBitKBP, Muted, Floodlight, Siren, TryExperience, Resolution, Ptz, MultiPtz, TileTip, PtzMoveableTip, LandscapeTip, TileActions, MoveablePtzControl, SwitchLayout, ToggleVerticalFull, RealTimeMagnification, ZoomTurntableEntry } from '../widgets';
|
|
8
8
|
import { authorizeStatus } from '../utils/authorize';
|
|
9
|
+
import { PlayState } from '../interface';
|
|
9
10
|
import { landscapeTipId, moveablePtzControlId, multiPtzId, ptzMoveableTipId, tileActionsId, tileTipId } from '../ui/constant';
|
|
10
11
|
import { multiPrefix } from '../widgets/multiCamera/constants';
|
|
11
12
|
const createPlayContext = ty.createIpcPlayerContext;
|
|
@@ -87,20 +88,29 @@ export const defaultBottomRightContent = [{
|
|
|
87
88
|
content: FullScreen
|
|
88
89
|
}];
|
|
89
90
|
const absoluteContent = [];
|
|
91
|
+
const renderWhenPlaying = _ref => {
|
|
92
|
+
let {
|
|
93
|
+
playState
|
|
94
|
+
} = _ref;
|
|
95
|
+
return playState === PlayState.PLAYING;
|
|
96
|
+
};
|
|
90
97
|
export const multiCameraAbsoluteContent = [{
|
|
91
98
|
id: tileTipId,
|
|
92
99
|
content: TileTip,
|
|
93
100
|
absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
|
|
101
|
+
renderWhen: renderWhenPlaying,
|
|
94
102
|
hidden: true
|
|
95
103
|
}, {
|
|
96
104
|
id: ptzMoveableTipId,
|
|
97
105
|
content: PtzMoveableTip,
|
|
98
106
|
absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
|
|
107
|
+
renderWhen: renderWhenPlaying,
|
|
99
108
|
hidden: true
|
|
100
109
|
}, {
|
|
101
110
|
id: landscapeTipId,
|
|
102
111
|
content: LandscapeTip,
|
|
103
112
|
absoluteContentClassName: `${multiPrefix}-tile-tip-wrap`,
|
|
113
|
+
renderWhen: renderWhenPlaying,
|
|
104
114
|
hidden: true
|
|
105
115
|
}, {
|
|
106
116
|
id: tileActionsId,
|
|
@@ -112,12 +122,12 @@ export const multiCameraAbsoluteContent = [{
|
|
|
112
122
|
absoluteNoCoverView: true,
|
|
113
123
|
hidden: true
|
|
114
124
|
}];
|
|
115
|
-
const toast =
|
|
125
|
+
const toast = _ref2 => {
|
|
116
126
|
let {
|
|
117
127
|
title,
|
|
118
128
|
duration
|
|
119
|
-
} =
|
|
120
|
-
config = _objectWithoutProperties(
|
|
129
|
+
} = _ref2,
|
|
130
|
+
config = _objectWithoutProperties(_ref2, _excluded);
|
|
121
131
|
ty.showToast(_objectSpread({
|
|
122
132
|
title,
|
|
123
133
|
duration,
|
package/lib/interface.d.ts
CHANGED
|
@@ -121,8 +121,12 @@ export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
|
|
|
121
121
|
absoluteContentClassName?: string;
|
|
122
122
|
absoluteContentStyle?: React.CSSProperties;
|
|
123
123
|
absoluteNoCoverView?: boolean;
|
|
124
|
+
renderWhen?: (state: ComponentRenderState) => boolean;
|
|
124
125
|
hidden?: boolean;
|
|
125
126
|
};
|
|
127
|
+
export type ComponentRenderState = {
|
|
128
|
+
playState: PlayState;
|
|
129
|
+
};
|
|
126
130
|
export type ComponentConfigProps = {
|
|
127
131
|
IPCPlayerContext: IpcContext;
|
|
128
132
|
} & ReturnType<UseCtx>;
|
package/lib/ui/ui.js
CHANGED
|
@@ -26,6 +26,7 @@ import { updatePlayerWidgetProps } from '../features';
|
|
|
26
26
|
import { getNgRawData, getSmartImageQualityState, isLowPhone } from '../utils/ttt';
|
|
27
27
|
import { getCaptureResultSummary } from '../utils/captureResult';
|
|
28
28
|
import { lensCount } from '../widgets/zoomTurntable/lensSkill';
|
|
29
|
+
import { shouldRenderContent } from './absoluteContent';
|
|
29
30
|
function getCtxInstance(instance, devId) {
|
|
30
31
|
if (instance) return instance;
|
|
31
32
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -1212,13 +1213,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1212
1213
|
}, renderBottomRightContent))), (() => {
|
|
1213
1214
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
1214
1215
|
return absoluteContent.map(item => {
|
|
1215
|
-
if (item
|
|
1216
|
+
if (!shouldRenderContent(item, {
|
|
1217
|
+
playState
|
|
1218
|
+
})) return null;
|
|
1219
|
+
const contentProps = _objectSpread(_objectSpread(_objectSpread({
|
|
1220
|
+
key: item.id
|
|
1221
|
+
}, item.initProps), instance), {}, {
|
|
1222
|
+
IPCPlayerContext: instance.IPCPlayerInstance
|
|
1223
|
+
});
|
|
1216
1224
|
if (item.absoluteNoCoverView) {
|
|
1217
|
-
return /*#__PURE__*/React.createElement(item.content,
|
|
1218
|
-
key: item.id
|
|
1219
|
-
}, item.initProps), instance), {}, {
|
|
1220
|
-
IPCPlayerContext: instance.IPCPlayerInstance
|
|
1221
|
-
}));
|
|
1225
|
+
return /*#__PURE__*/React.createElement(item.content, contentProps);
|
|
1222
1226
|
}
|
|
1223
1227
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
1224
1228
|
key: item.id,
|
|
@@ -1226,10 +1230,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
1226
1230
|
position: 'absolute'
|
|
1227
1231
|
}, item.absolutePosition),
|
|
1228
1232
|
className: item.absoluteContentClassName
|
|
1229
|
-
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(
|
|
1230
|
-
key: item.id
|
|
1231
|
-
}, item.initProps), instance), {}, {
|
|
1232
|
-
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
1233
|
+
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread({}, contentProps), {}, {
|
|
1233
1234
|
// 添加通用变量单独组件类名
|
|
1234
1235
|
className: clsx('absolute-item-container')
|
|
1235
1236
|
})));
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './captureResult.less';
|
|
3
|
-
type CaptureKind = 'record' | 'screenshot';
|
|
4
|
-
|
|
3
|
+
export type CaptureKind = 'record' | 'screenshot';
|
|
4
|
+
export interface CaptureResultToastProps {
|
|
5
5
|
brandColor: string;
|
|
6
|
-
count: number;
|
|
7
6
|
kind: CaptureKind;
|
|
8
|
-
onCheck: () => void;
|
|
9
7
|
thumbnailPath: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
onCheck: () => void;
|
|
9
|
+
count?: number;
|
|
10
|
+
/** 自定义标题(可选),不传时使用默认文案 */
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
/** 自定义操作按钮文案(可选),不传时默认为“查看” */
|
|
13
|
+
checkText?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function CaptureResultToast({ brandColor, count, kind, onCheck, thumbnailPath, title, checkText, className, }: CaptureResultToastProps): React.JSX.Element;
|
|
@@ -18,47 +18,72 @@ const TEXT_KEYS = {
|
|
|
18
18
|
single: 'ipc_player_screenshot_success_tip'
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
const LEGACY_CLASS_MAP = {
|
|
22
|
+
record: {
|
|
23
|
+
toast: 'ipc-player-plugin-record-success-toast',
|
|
24
|
+
imageBox: 'ipc-player-plugin-record-success-toast-image-box',
|
|
25
|
+
imageBoxMulti: 'ipc-player-plugin-record-success-toast-image-box-multi',
|
|
26
|
+
image: 'ipc-player-plugin-record-success-toast-image',
|
|
27
|
+
playIconBox: 'ipc-player-plugin-record-success-play-icon-box',
|
|
28
|
+
playIcon: 'ipc-player-plugin-record-success-play-icon',
|
|
29
|
+
title: 'ipc-player-plugin-record-success-toast-title',
|
|
30
|
+
check: 'ipc-player-plugin-record-success-toast-bottom'
|
|
31
|
+
},
|
|
32
|
+
screenshot: {
|
|
33
|
+
toast: 'ipc-player-plugin-screenshot-toast',
|
|
34
|
+
imageBox: 'ipc-player-plugin-screenshot-toast-image-box',
|
|
35
|
+
imageBoxMulti: 'ipc-player-plugin-screenshot-toast-image-box-multi',
|
|
36
|
+
image: 'ipc-player-plugin-screenshot-toast-image',
|
|
37
|
+
playIconBox: '',
|
|
38
|
+
playIcon: '',
|
|
39
|
+
title: 'ipc-player-plugin-screenshot-toast-title',
|
|
40
|
+
check: 'ipc-player-plugin-screenshot-toast-bottom'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
21
43
|
export function CaptureResultToast(_ref) {
|
|
22
44
|
let {
|
|
23
45
|
brandColor,
|
|
24
|
-
count,
|
|
46
|
+
count = 0,
|
|
25
47
|
kind,
|
|
26
48
|
onCheck,
|
|
27
|
-
thumbnailPath
|
|
49
|
+
thumbnailPath,
|
|
50
|
+
title,
|
|
51
|
+
checkText,
|
|
52
|
+
className
|
|
28
53
|
} = _ref;
|
|
29
|
-
const isMultiLens = count >
|
|
54
|
+
const isMultiLens = count > 1;
|
|
30
55
|
const textKeys = TEXT_KEYS[kind];
|
|
56
|
+
const legacyCls = LEGACY_CLASS_MAP[kind];
|
|
57
|
+
const imageClassName = clsx('ipc-player-plugin-capture-result-image', legacyCls.image);
|
|
31
58
|
return /*#__PURE__*/React.createElement(View, {
|
|
32
|
-
className:
|
|
59
|
+
className: clsx('ipc-player-plugin-capture-result-toast', legacyCls.toast, className)
|
|
33
60
|
}, /*#__PURE__*/React.createElement(View, {
|
|
34
|
-
className: clsx('ipc-player-plugin-capture-result-image-box',
|
|
35
|
-
'ipc-player-plugin-capture-result-image-box-multi': isMultiLens
|
|
36
|
-
})
|
|
61
|
+
className: clsx('ipc-player-plugin-capture-result-image-box', legacyCls.imageBox, isMultiLens && ['ipc-player-plugin-capture-result-image-box-multi', legacyCls.imageBoxMulti])
|
|
37
62
|
}, isMultiLens ? THUMBNAIL_LAYERS.slice(0, count).map((layer, index) => /*#__PURE__*/React.createElement(Image, {
|
|
38
63
|
key: layer,
|
|
39
|
-
className:
|
|
64
|
+
className: imageClassName,
|
|
40
65
|
src: thumbnailPath,
|
|
41
66
|
style: {
|
|
42
67
|
left: `${index * 5}px`,
|
|
43
68
|
zIndex: index + 1
|
|
44
69
|
}
|
|
45
70
|
})) : /*#__PURE__*/React.createElement(Image, {
|
|
46
|
-
className:
|
|
71
|
+
className: imageClassName,
|
|
47
72
|
src: thumbnailPath
|
|
48
73
|
}), kind === 'record' && /*#__PURE__*/React.createElement(View, {
|
|
49
|
-
className:
|
|
74
|
+
className: clsx('ipc-player-plugin-capture-result-play-icon-box', legacyCls.playIconBox)
|
|
50
75
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
51
|
-
className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-capture-result-play-icon')
|
|
76
|
+
className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-capture-result-play-icon', legacyCls.playIcon)
|
|
52
77
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
53
|
-
className:
|
|
54
|
-
}, isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
|
|
78
|
+
className: clsx('ipc-player-plugin-capture-result-title', legacyCls.title)
|
|
79
|
+
}, title ? typeof title === 'string' ? /*#__PURE__*/React.createElement(Text, null, title) : title : isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
|
|
55
80
|
className: "ipc-player-plugin-capture-result-count"
|
|
56
81
|
}, Strings.formatString(Strings.getLang('ipc_player_multi_capture_success_count'), count))) : Strings.getLang(textKeys.single)), /*#__PURE__*/React.createElement(View, {
|
|
57
82
|
onClick: onCheck,
|
|
58
|
-
className:
|
|
83
|
+
className: clsx('ipc-player-plugin-capture-result-check', legacyCls.check),
|
|
59
84
|
style: {
|
|
60
85
|
color: brandColor,
|
|
61
86
|
borderColor: brandColor
|
|
62
87
|
}
|
|
63
|
-
}, Strings.getLang(textKeys.check)));
|
|
88
|
+
}, checkText || Strings.getLang(textKeys.check)));
|
|
64
89
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
.ipc-player-plugin-capture-result-toast
|
|
1
|
+
.ipc-player-plugin-capture-result-toast,
|
|
2
|
+
.ipc-player-plugin-record-success-toast,
|
|
3
|
+
.ipc-player-plugin-screenshot-toast {
|
|
2
4
|
z-index: 100;
|
|
3
5
|
display: flex;
|
|
4
6
|
flex: 1;
|
|
@@ -9,7 +11,9 @@
|
|
|
9
11
|
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
.ipc-player-plugin-capture-result-image-box
|
|
14
|
+
.ipc-player-plugin-capture-result-image-box,
|
|
15
|
+
.ipc-player-plugin-record-success-toast-image-box,
|
|
16
|
+
.ipc-player-plugin-screenshot-toast-image-box {
|
|
13
17
|
position: relative;
|
|
14
18
|
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
15
19
|
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
@@ -17,13 +21,17 @@
|
|
|
17
21
|
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
18
22
|
}
|
|
19
23
|
|
|
20
|
-
.ipc-player-plugin-capture-result-image
|
|
24
|
+
.ipc-player-plugin-capture-result-image,
|
|
25
|
+
.ipc-player-plugin-record-success-toast-image,
|
|
26
|
+
.ipc-player-plugin-screenshot-toast-image {
|
|
21
27
|
width: 100%;
|
|
22
28
|
height: 100%;
|
|
23
29
|
object-fit: cover;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
|
-
.ipc-player-plugin-capture-result-image-box-multi .ipc-player-plugin-capture-result-image
|
|
32
|
+
.ipc-player-plugin-capture-result-image-box-multi .ipc-player-plugin-capture-result-image,
|
|
33
|
+
.ipc-player-plugin-record-success-toast-image-box-multi .ipc-player-plugin-record-success-toast-image,
|
|
34
|
+
.ipc-player-plugin-screenshot-toast-image-box-multi .ipc-player-plugin-screenshot-toast-image {
|
|
27
35
|
position: absolute;
|
|
28
36
|
top: 0;
|
|
29
37
|
width: calc(56px * var(--ipc-player-size-scale, 1));
|
|
@@ -32,7 +40,8 @@
|
|
|
32
40
|
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
.ipc-player-plugin-capture-result-play-icon-box
|
|
43
|
+
.ipc-player-plugin-capture-result-play-icon-box,
|
|
44
|
+
.ipc-player-plugin-record-success-play-icon-box {
|
|
36
45
|
position: absolute;
|
|
37
46
|
top: 50%;
|
|
38
47
|
left: 50%;
|
|
@@ -48,12 +57,15 @@
|
|
|
48
57
|
transform: translate(-50%, -50%);
|
|
49
58
|
}
|
|
50
59
|
|
|
51
|
-
.ipc-player-plugin-capture-result-play-icon
|
|
60
|
+
.ipc-player-plugin-capture-result-play-icon,
|
|
61
|
+
.ipc-player-plugin-record-success-play-icon {
|
|
52
62
|
color: #ffffff;
|
|
53
63
|
font-size: calc(18px * var(--ipc-player-size-scale, 1)) !important;
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
.ipc-player-plugin-capture-result-title
|
|
66
|
+
.ipc-player-plugin-capture-result-title,
|
|
67
|
+
.ipc-player-plugin-record-success-toast-title,
|
|
68
|
+
.ipc-player-plugin-screenshot-toast-title {
|
|
57
69
|
display: flex;
|
|
58
70
|
flex: 1;
|
|
59
71
|
flex-direction: column;
|
|
@@ -71,7 +83,9 @@
|
|
|
71
83
|
opacity: 0.5;
|
|
72
84
|
}
|
|
73
85
|
|
|
74
|
-
.ipc-player-plugin-capture-result-check
|
|
86
|
+
.ipc-player-plugin-capture-result-check,
|
|
87
|
+
.ipc-player-plugin-record-success-toast-bottom,
|
|
88
|
+
.ipc-player-plugin-screenshot-toast-bottom {
|
|
75
89
|
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
76
90
|
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
77
91
|
padding: calc(5px * var(--ipc-player-size-scale, 1))
|
package/lib/widgets/index.d.ts
CHANGED
package/lib/widgets/index.js
CHANGED
|
@@ -126,7 +126,10 @@ export const isSwitchChannelSupported = () => {
|
|
|
126
126
|
const supported = typeof ((_ty = ty) === null || _ty === void 0 || (_ty = _ty.ipc) === null || _ty === void 0 ? void 0 : _ty.switchChannel) === 'function';
|
|
127
127
|
if (!supported && !switchChannelMissingLogged) {
|
|
128
128
|
switchChannelMissingLogged = true;
|
|
129
|
-
console.warn
|
|
129
|
+
// 只能用 log:本判定会在 render 期被调用,而 IDE 宿主下 render 期的 console.warn
|
|
130
|
+
// 会打坏 Ray 运行时,整个面板崩在 areHookInputsEqual / TDZ —— 且症状伪装成
|
|
131
|
+
// 「hook 顺序错位」(报 change in the order of Hooks),极难归因,勿改回 warn
|
|
132
|
+
console.log('[zoomTurntable] 宿主不支持 ty.ipc.switchChannel,焦距转盘入口不展示');
|
|
130
133
|
dumpChannelApis();
|
|
131
134
|
}
|
|
132
135
|
return supported;
|