@ray-js/ipc-player-integration 0.0.29-beta.2 → 0.0.29-beta.21
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.d.ts +9 -3
- package/lib/ctx/ctx.composition.js +43 -1
- package/lib/ctx/ctx.js +5 -0
- package/lib/ctx/multiCameraCtx.d.ts +40 -5
- package/lib/ctx/multiCameraCtx.js +166 -20
- package/lib/features/initPlayerWidgets/index.d.ts +7 -1
- package/lib/features/initPlayerWidgets/index.js +14 -11
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.js +3 -1
- package/lib/hooks/useDpSupport/index.d.ts +6 -0
- package/lib/hooks/useDpSupport/index.js +47 -0
- package/lib/hooks/useSignal4G/index.d.ts +2 -0
- package/lib/hooks/useSignal4G/index.js +35 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/interface.d.ts +43 -2
- package/lib/ports.output.d.ts +4 -0
- package/lib/ports.output.js +3 -1
- package/lib/res/index.d.ts +1 -0
- package/lib/res/index.js +21 -1
- package/lib/res/svg/signalFour0.svg +1 -0
- package/lib/res/svg/signalFour1.svg +1 -0
- package/lib/res/svg/signalFour2.svg +1 -0
- package/lib/res/svg/signalFour3.svg +1 -0
- package/lib/res/svg/signalFour4.svg +1 -0
- package/lib/res/svg/signalThree0.svg +1 -0
- package/lib/res/svg/signalThree1.svg +1 -0
- package/lib/res/svg/signalThree2.svg +1 -0
- package/lib/res/svg/signalThree3.svg +1 -0
- package/lib/svg-module.d.ts +4 -0
- package/lib/ui/constant.d.ts +20 -0
- package/lib/ui/constant.js +21 -0
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.js +3 -1
- package/lib/ui/ui.d.ts +2 -0
- package/lib/ui/ui.js +130 -38
- package/lib/ui/ui.less +33 -4
- package/lib/ui/widgetClick.d.ts +2 -0
- package/lib/ui/widgetClick.js +2 -0
- package/lib/utils/content/dpCode.d.ts +5 -0
- package/lib/utils/content/dpCode.js +11 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +12 -1
- package/lib/utils/videoSplitHelper.d.ts +18 -0
- package/lib/utils/videoSplitHelper.js +48 -0
- package/lib/widgets/fullScreen/fullScreen.js +6 -4
- package/lib/widgets/fullScreen/fullTravelRouteControl.js +4 -1
- package/lib/widgets/fullScreen/fullVoiceIntercom.js +5 -2
- package/lib/widgets/fullScreen/verticalScreen.js +1 -1
- package/lib/widgets/fullSmallIntercom/fullSmallIntercom.js +4 -1
- package/lib/widgets/index.d.ts +2 -0
- package/lib/widgets/index.js +3 -1
- package/lib/widgets/moveInteractiveControl/controlButton.js +4 -1
- package/lib/widgets/moveInteractiveControl/moveInteractiveControl.js +7 -1
- package/lib/widgets/multiCamera/index.less +28 -5
- package/lib/widgets/multiCamera/moveablePtzControl.js +229 -47
- package/lib/widgets/multiCamera/tileActions.js +2 -2
- package/lib/widgets/muted/muted.js +12 -11
- package/lib/widgets/ptz/ptz.js +4 -1
- package/lib/widgets/ptzControlTip/ptzControlTip.js +4 -1
- package/lib/widgets/recordVideo/recordVideo.js +6 -1
- package/lib/widgets/resolution/fullResolutionControl.js +10 -2
- package/lib/widgets/resolution/resolution.js +4 -1
- package/lib/widgets/screenshot/screenshot.js +6 -1
- package/lib/widgets/signal4G/index.d.ts +1 -0
- package/lib/widgets/signal4G/index.js +1 -0
- package/lib/widgets/signal4G/signal4G.d.ts +8 -0
- package/lib/widgets/signal4G/signal4G.js +28 -0
- package/lib/widgets/signal4G/signal4G.less +15 -0
- package/lib/widgets/toggleVerticalFull/index.d.ts +1 -0
- package/lib/widgets/toggleVerticalFull/index.js +1 -0
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.d.ts +8 -0
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +32 -0
- package/lib/widgets/toggleVerticalFull/toggleVerticalFull.less +4 -0
- package/lib/widgets/verticalSmallIntercom/verticalSmallIntercom.js +4 -1
- package/lib/widgets/voiceIntercom/voiceIntercom.js +18 -21
- package/lib/widgets/voiceIntercom/voiceIntercom.less +85 -0
- package/package.json +6 -7
- package/lib/features/initPlayerWidgets/multiCamera.d.ts +0 -8
- package/lib/features/initPlayerWidgets/multiCamera.js +0 -78
- package/lib/widgets/battery/battery.composition.d.ts +0 -155
- package/lib/widgets/voiceIntercom/voiceIntercom.d.ts +0 -93
package/lib/ui/ui.js
CHANGED
|
@@ -9,7 +9,7 @@ import IPCPlayer from '@ray-js/ray-ipc-player';
|
|
|
9
9
|
import { ipcTTTOperatorLog } from '@ray-js/ray-ipc-utils';
|
|
10
10
|
import { PlayState, PlayerStreamStatus, MultiCameraScreenMode } from '../interface';
|
|
11
11
|
import { useCtx } from '../ctx/ctx.composition';
|
|
12
|
-
import { useStore } from '../ctx/store';
|
|
12
|
+
import { useStore, updateAtom } from '../ctx/store';
|
|
13
13
|
import { UIEventContext } from './context';
|
|
14
14
|
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId } from './constant';
|
|
15
15
|
import BottomLeftContent from './bottomLeftContent';
|
|
@@ -20,6 +20,7 @@ import { useMemoizedFn } from '../hooks';
|
|
|
20
20
|
import { Storage } from '../utils/storage';
|
|
21
21
|
import './ui.less';
|
|
22
22
|
import { updatePlayerWidgetProps } from '../features';
|
|
23
|
+
import { isSmallScreen } from '../utils';
|
|
23
24
|
function getCtxInstance(instance, devId) {
|
|
24
25
|
if (instance) return instance;
|
|
25
26
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -61,6 +62,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
61
62
|
awakeStatus = undefined,
|
|
62
63
|
onPlayerTap,
|
|
63
64
|
playerRoute = 'pages/home/index',
|
|
65
|
+
defaultAutoPlay = true,
|
|
66
|
+
limitFlow = false,
|
|
64
67
|
extend = {}
|
|
65
68
|
} = props;
|
|
66
69
|
const {
|
|
@@ -109,11 +112,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
109
112
|
setIgnoreStopOnHide(ignoreHideStopPreview);
|
|
110
113
|
}, [ignoreHideStopPreview]);
|
|
111
114
|
const handleOrientationChange = useMemoizedFn(data => {
|
|
112
|
-
console.log(data, 'data=============');
|
|
113
115
|
const {
|
|
114
116
|
orientation
|
|
115
117
|
} = data;
|
|
116
|
-
console.log(orientation, 'orientation=-====');
|
|
117
118
|
if (['portrait', 'landscape-left', 'landscape-right'].includes(orientation)) {
|
|
118
119
|
var _ty;
|
|
119
120
|
if (typeof ((_ty = ty) === null || _ty === void 0 ? void 0 : _ty.getDeviceOrientationSync) !== 'function') return;
|
|
@@ -121,29 +122,36 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
121
122
|
// 不是Player首页的话,禁止以下行为
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
|
-
console.log('
|
|
125
|
+
console.log('屏幕方向变化调用');
|
|
125
126
|
setPageOrientation({
|
|
126
127
|
pageOrientation: orientation === 'landscape-left' || orientation === 'landscape-right' ? 'landscape' : 'portrait',
|
|
127
128
|
reverse: orientation === 'landscape-left',
|
|
128
129
|
success: () => {
|
|
129
|
-
console.log('
|
|
130
|
+
console.log('setPageOrientation success');
|
|
130
131
|
},
|
|
131
132
|
fail: err => {
|
|
132
|
-
console.log('
|
|
133
|
+
console.log('setPageOrientation fail', err);
|
|
133
134
|
}
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
});
|
|
137
138
|
useEffect(() => {
|
|
138
139
|
var _ty2;
|
|
139
|
-
console.log('getDeviceOrientationSync =======');
|
|
140
140
|
if (typeof ((_ty2 = ty) === null || _ty2 === void 0 ? void 0 : _ty2.getDeviceOrientationSync) !== 'function') return undefined;
|
|
141
141
|
try {
|
|
142
|
+
const {
|
|
143
|
+
deviceType
|
|
144
|
+
} = getSystemInfoSync();
|
|
145
|
+
// 针对pad 暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
|
|
146
|
+
if (deviceType === 'pad') {
|
|
147
|
+
setScreenType('vertical');
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
142
150
|
ty.onOrientationChange(handleOrientationChange);
|
|
143
151
|
const {
|
|
144
152
|
orientation
|
|
145
153
|
} = ty.getDeviceOrientationSync();
|
|
146
|
-
console.log(
|
|
154
|
+
console.log('initial orientation', orientation);
|
|
147
155
|
if (orientation === 'landscape-left' || orientation === 'landscape-right') {
|
|
148
156
|
setScreenType('full');
|
|
149
157
|
}
|
|
@@ -202,7 +210,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
202
210
|
screenMode,
|
|
203
211
|
layoutStyle,
|
|
204
212
|
ptzStatus,
|
|
205
|
-
selectedLenInfo
|
|
213
|
+
selectedLenInfo,
|
|
214
|
+
isVerticalFullLayout
|
|
206
215
|
} = useStore({
|
|
207
216
|
topLeftContent: instance.topLeftContent,
|
|
208
217
|
topRightContent: instance.topRightContent,
|
|
@@ -216,7 +225,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
216
225
|
screenMode: instance.multiCameraCtx.screenMode,
|
|
217
226
|
layoutStyle: instance.multiCameraCtx.layoutStyle,
|
|
218
227
|
ptzStatus: instance.multiCameraCtx.ptzStatus,
|
|
219
|
-
selectedLenInfo: instance.multiCameraCtx.selectedLenInfo
|
|
228
|
+
selectedLenInfo: instance.multiCameraCtx.selectedLenInfo,
|
|
229
|
+
isVerticalFullLayout: instance.isVerticalFullLayout
|
|
220
230
|
});
|
|
221
231
|
|
|
222
232
|
/* ---------------------------------多目相关副作用统一处理开始----------------------------------------- */
|
|
@@ -231,10 +241,16 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
231
241
|
batchedUpdates(() => {
|
|
232
242
|
switch (screenMode) {
|
|
233
243
|
case MultiCameraScreenMode.full:
|
|
244
|
+
// 同步竖屏全屏布局状态
|
|
245
|
+
updateAtom(instance.isVerticalFullLayout, true);
|
|
246
|
+
|
|
234
247
|
// widgets 常驻显示
|
|
235
|
-
eventRef.current.emit(showAllComponent);
|
|
236
|
-
eventRef.current.emit('disablePlayerTap', true);
|
|
237
|
-
eventRef.current.emit(pauseTimeToHideAllComponent);
|
|
248
|
+
// eventRef.current.emit(showAllComponent);
|
|
249
|
+
// eventRef.current.emit('disablePlayerTap', true);
|
|
250
|
+
// eventRef.current.emit(pauseTimeToHideAllComponent);
|
|
251
|
+
|
|
252
|
+
// 隐藏landscapeTip
|
|
253
|
+
hideContent('absolute', landscapeTipId);
|
|
238
254
|
|
|
239
255
|
// 展示右侧插件
|
|
240
256
|
showContent('absolute', tileActionsId);
|
|
@@ -257,9 +273,18 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
257
273
|
});
|
|
258
274
|
break;
|
|
259
275
|
case MultiCameraScreenMode.short:
|
|
276
|
+
// 同步竖屏全屏布局状态
|
|
277
|
+
updateAtom(instance.isVerticalFullLayout, false);
|
|
278
|
+
|
|
260
279
|
// 恢复 widgets 展示逻辑
|
|
261
|
-
eventRef.current.emit('disablePlayerTap', false);
|
|
262
|
-
showComponents();
|
|
280
|
+
// eventRef.current.emit('disablePlayerTap', false);
|
|
281
|
+
// showComponents();
|
|
282
|
+
|
|
283
|
+
// 隐藏tileTip
|
|
284
|
+
hideContent('absolute', tileTipId);
|
|
285
|
+
|
|
286
|
+
// 隐藏landscapeTip
|
|
287
|
+
hideContent('absolute', landscapeTipId);
|
|
263
288
|
|
|
264
289
|
// 隐藏右侧插件
|
|
265
290
|
hideContent('absolute', tileActionsId);
|
|
@@ -274,9 +299,15 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
274
299
|
hideContent('bottomLeft', 'SmallIntercom');
|
|
275
300
|
break;
|
|
276
301
|
case MultiCameraScreenMode.landscape:
|
|
302
|
+
// 同步竖屏全屏布局状态
|
|
303
|
+
updateAtom(instance.isVerticalFullLayout, false);
|
|
304
|
+
|
|
277
305
|
// 恢复 widgets 展示逻辑
|
|
278
|
-
eventRef.current.emit('disablePlayerTap', false);
|
|
279
|
-
showComponents();
|
|
306
|
+
// eventRef.current.emit('disablePlayerTap', false);
|
|
307
|
+
// showComponents();
|
|
308
|
+
|
|
309
|
+
// 隐藏tileTip
|
|
310
|
+
hideContent('absolute', tileTipId);
|
|
280
311
|
if (multiCameraCtx.protocol.total_split_num === 2 && !storage.getSync(landscapeTipId)) {
|
|
281
312
|
showContent('absolute', landscapeTipId);
|
|
282
313
|
}
|
|
@@ -292,8 +323,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
292
323
|
|
|
293
324
|
// 展示小对讲
|
|
294
325
|
showContent('bottomLeft', 'SmallIntercom');
|
|
326
|
+
|
|
327
|
+
// 横屏 ptz 靠右展示
|
|
295
328
|
updatePlayerWidgetProps(instance, 'absolute', moveablePtzControlId, {
|
|
296
|
-
positionLeft:
|
|
329
|
+
positionLeft: getSystemInfoSync().screenWidth - 100 - 250
|
|
297
330
|
});
|
|
298
331
|
break;
|
|
299
332
|
default:
|
|
@@ -327,6 +360,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
327
360
|
}, [instance, ptzStatus]);
|
|
328
361
|
useEffect(() => {
|
|
329
362
|
if (!instance.multiCameraCtx.isSupport) return;
|
|
363
|
+
if (!ptzStatus || screenMode !== MultiCameraScreenMode.full) {
|
|
364
|
+
instance.hideContent('absolute', ptzMoveableTipId);
|
|
365
|
+
}
|
|
330
366
|
|
|
331
367
|
// ptz 激活状态下,需要根据组件隐藏状态来决定是否展示 moveablePtzControl
|
|
332
368
|
if (ptzStatus) {
|
|
@@ -338,14 +374,38 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
338
374
|
|
|
339
375
|
// ptz 提示
|
|
340
376
|
const storage = new Storage(devId);
|
|
341
|
-
if (!storage.getSync(ptzMoveableTipId) && selectedLenInfo.supportPTZ) {
|
|
377
|
+
if (!storage.getSync(ptzMoveableTipId) && selectedLenInfo.supportPTZ && screenMode === MultiCameraScreenMode.full) {
|
|
342
378
|
instance.showContent('absolute', ptzMoveableTipId);
|
|
343
379
|
}
|
|
344
380
|
}
|
|
345
|
-
}, [instance, ptzStatus, selectedLenInfo, componentHideState]);
|
|
381
|
+
}, [instance, ptzStatus, selectedLenInfo, componentHideState, screenMode]);
|
|
382
|
+
|
|
383
|
+
// 适配横屏进入面板的情况
|
|
384
|
+
useEffect(() => {
|
|
385
|
+
if (!instance.multiCameraCtx.isSupport) return;
|
|
386
|
+
if (hasInitializedLandscapeMultiRef.current) return;
|
|
387
|
+
if (screenType !== 'full') return;
|
|
388
|
+
hasInitializedLandscapeMultiRef.current = true;
|
|
389
|
+
instance.multiCameraCtx.setScreenMode(MultiCameraScreenMode.landscape);
|
|
390
|
+
}, [screenType, instance, layoutStyle]);
|
|
346
391
|
|
|
347
392
|
/* ---------------------------------多目相关副作用统一处理结束----------------------------------------- */
|
|
348
393
|
|
|
394
|
+
// 竖屏全屏副作用处理
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
if (isVerticalFullLayout && screenType === 'vertical') {
|
|
397
|
+
// 竖屏全屏时,控件常驻显示
|
|
398
|
+
eventRef.current.emit(showAllComponent);
|
|
399
|
+
eventRef.current.emit('disablePlayerTap', true);
|
|
400
|
+
eventRef.current.emit(pauseTimeToHideAllComponent);
|
|
401
|
+
// 按宽填充,保证播放流宽度为屏幕宽度,高度自适应
|
|
402
|
+
setScaleMultiple(-1);
|
|
403
|
+
} else {
|
|
404
|
+
// 短屏或横屏时,恢复自动隐藏
|
|
405
|
+
eventRef.current.emit('disablePlayerTap', false);
|
|
406
|
+
showComponents();
|
|
407
|
+
}
|
|
408
|
+
}, [isVerticalFullLayout, screenType, playerFit, instance]);
|
|
349
409
|
useEffect(() => {
|
|
350
410
|
if (createCtx) {
|
|
351
411
|
setScaleMultiple(playerFit === 'contain' ? 1 : -2);
|
|
@@ -379,15 +439,15 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
379
439
|
const {
|
|
380
440
|
type
|
|
381
441
|
} = sizeData;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
deviceType
|
|
385
|
-
} = systemInfo.current;
|
|
386
|
-
// 针对pad 暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
|
|
387
|
-
if (deviceType === 'pad') {
|
|
442
|
+
// 针对pad 和折叠屏展开的情况暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
|
|
443
|
+
if (isSmallScreen) {
|
|
388
444
|
setScreenType('vertical');
|
|
389
445
|
} else {
|
|
390
446
|
setScreenType(type === 'landscape' ? 'full' : 'vertical');
|
|
447
|
+
// 横屏时重置竖屏全屏状态
|
|
448
|
+
if (type === 'landscape') {
|
|
449
|
+
updateAtom(instance.isVerticalFullLayout, false);
|
|
450
|
+
}
|
|
391
451
|
triggerEvent(showAllComponent);
|
|
392
452
|
}
|
|
393
453
|
// 若为全屏模式并且要求按宽填充,即横屏时充满,主动设置模式为-1即可
|
|
@@ -434,11 +494,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
434
494
|
}
|
|
435
495
|
});
|
|
436
496
|
});
|
|
437
|
-
const systemInfo = useRef(null);
|
|
438
|
-
if (!systemInfo.current) {
|
|
439
|
-
systemInfo.current = getSystemInfoSync();
|
|
440
|
-
}
|
|
441
|
-
|
|
442
497
|
// 监听物理返回按键
|
|
443
498
|
const hackHandle = () => {
|
|
444
499
|
setPageOrientation({
|
|
@@ -575,6 +630,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
575
630
|
instance.changeStreamStatus(code);
|
|
576
631
|
});
|
|
577
632
|
const disablePlayerTap = useRef(false);
|
|
633
|
+
const hasInitializedLandscapeMultiRef = useRef(false);
|
|
634
|
+
const multiTapTimerRef = useRef(null);
|
|
635
|
+
const prevSelectedIndexRef = useRef(selectedLenInfo.index);
|
|
578
636
|
const handDisablePlayerTap = value => {
|
|
579
637
|
disablePlayerTap.current = !!value;
|
|
580
638
|
};
|
|
@@ -644,6 +702,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
644
702
|
eventRef.current.off('disablePlayerTap', handDisablePlayerTap);
|
|
645
703
|
eventRef.current.off('refreshBottomLeft', refreshBottomLeft);
|
|
646
704
|
eventRef.current.off(changeIgnoreHideStopPreview, onChangeIgnoreHideStopPreview);
|
|
705
|
+
if (multiTapTimerRef.current) {
|
|
706
|
+
clearTimeout(multiTapTimerRef.current);
|
|
707
|
+
multiTapTimerRef.current = null;
|
|
708
|
+
}
|
|
647
709
|
if (reGetOrientationTimer.current) {
|
|
648
710
|
clearTimeout(reGetOrientationTimer.current);
|
|
649
711
|
reGetOrientationTimer.current = null;
|
|
@@ -700,19 +762,20 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
700
762
|
return false;
|
|
701
763
|
});
|
|
702
764
|
const playerContainerHeight = screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh';
|
|
765
|
+
const isVerticalFullMode = isVerticalFullLayout && screenType === 'vertical';
|
|
703
766
|
return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
704
767
|
value: {
|
|
705
768
|
event: eventRef.current,
|
|
706
769
|
componentHideState
|
|
707
770
|
}
|
|
708
771
|
}, /*#__PURE__*/React.createElement(View, {
|
|
709
|
-
className: clsx('ipc-player-content', className),
|
|
772
|
+
className: clsx('ipc-player-content', isSmallScreen && 'ipc-player-content-small-screen', className),
|
|
710
773
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
|
|
711
774
|
height: playerContainerHeight
|
|
712
775
|
})
|
|
713
776
|
}, /*#__PURE__*/React.createElement(View, {
|
|
714
777
|
style: {
|
|
715
|
-
height:
|
|
778
|
+
height: isVerticalFullMode ? `calc(${playerContainerHeight} - 48px)` : playerContainerHeight
|
|
716
779
|
}
|
|
717
780
|
}, /*#__PURE__*/React.createElement(IPCPlayer, {
|
|
718
781
|
defaultMute: mute,
|
|
@@ -762,8 +825,33 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
762
825
|
eventRef.current.emit(playerTap);
|
|
763
826
|
console.log(prevTriggerEvent.current, 'prevTriggerEvent.current');
|
|
764
827
|
if (instance.multiCameraCtx.isSupport) {
|
|
765
|
-
|
|
766
|
-
|
|
828
|
+
var _instance$multiCamera, _instance$multiCamera2;
|
|
829
|
+
const preTapIndex = (_instance$multiCamera = (_instance$multiCamera2 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera2 === void 0 ? void 0 : _instance$multiCamera2.index) !== null && _instance$multiCamera !== void 0 ? _instance$multiCamera : prevSelectedIndexRef.current;
|
|
830
|
+
instance.multiCameraCtx.selectVideoFiredRef.current = false;
|
|
831
|
+
if (multiTapTimerRef.current) {
|
|
832
|
+
clearTimeout(multiTapTimerRef.current);
|
|
833
|
+
}
|
|
834
|
+
multiTapTimerRef.current = setTimeout(() => {
|
|
835
|
+
var _instance$multiCamera3, _instance$multiCamera4;
|
|
836
|
+
const selectFired = !!instance.multiCameraCtx.selectVideoFiredRef.current;
|
|
837
|
+
const currentIndex = (_instance$multiCamera3 = (_instance$multiCamera4 = instance.multiCameraCtx.selectedLenInfoRef.current) === null || _instance$multiCamera4 === void 0 ? void 0 : _instance$multiCamera4.index) !== null && _instance$multiCamera3 !== void 0 ? _instance$multiCamera3 : preTapIndex;
|
|
838
|
+
if (selectFired && currentIndex === preTapIndex) {
|
|
839
|
+
if (componentHideState) {
|
|
840
|
+
showComponents();
|
|
841
|
+
} else {
|
|
842
|
+
if (timer.current) {
|
|
843
|
+
clearTimeout(timer.current);
|
|
844
|
+
timer.current = null;
|
|
845
|
+
}
|
|
846
|
+
setComponentHideState(true);
|
|
847
|
+
}
|
|
848
|
+
} else {
|
|
849
|
+
// 点击不同镜头或非镜头区域时,保持现有行为
|
|
850
|
+
showComponents();
|
|
851
|
+
}
|
|
852
|
+
prevSelectedIndexRef.current = currentIndex;
|
|
853
|
+
multiTapTimerRef.current = null;
|
|
854
|
+
}, 50);
|
|
767
855
|
} else if (prevTriggerEvent.current === hideAllComponent) {
|
|
768
856
|
triggerEvent(showAllComponent);
|
|
769
857
|
} else {
|
|
@@ -775,7 +863,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
775
863
|
,
|
|
776
864
|
brandColor: brandColor,
|
|
777
865
|
playerRoute: playerRoute,
|
|
778
|
-
|
|
866
|
+
defaultAutoPlay: defaultAutoPlay,
|
|
867
|
+
limitFlow: limitFlow,
|
|
868
|
+
extend: _objectSpread(_objectSpread({
|
|
869
|
+
backgroundColor: '#262626'
|
|
870
|
+
}, instance.multiCameraCtx.extendProps), extend)
|
|
779
871
|
})), showTopContent && /*#__PURE__*/React.createElement(View, {
|
|
780
872
|
className: clsx('ipc-player-top-content', {
|
|
781
873
|
'ipc-player-top-content-hide': componentHideState,
|
|
@@ -792,12 +884,12 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
792
884
|
className: clsx('ipc-player-bottom-content', {
|
|
793
885
|
'ipc-player-bottom-content-hide': componentHideState,
|
|
794
886
|
'ipc-player-bottom-content-show': !componentHideState,
|
|
795
|
-
'ipc-player-bottom-content-full':
|
|
887
|
+
'ipc-player-bottom-content-full': isVerticalFullMode
|
|
796
888
|
}),
|
|
797
889
|
style: {
|
|
798
890
|
height: screenType === 'vertical' ? '48px' : '72px'
|
|
799
891
|
}
|
|
800
|
-
},
|
|
892
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BottomLeftContent, {
|
|
801
893
|
ctx: instance
|
|
802
894
|
}, renderBottomLeftContent), /*#__PURE__*/React.createElement(BottomRightContent, {
|
|
803
895
|
ctx: instance
|
package/lib/ui/ui.less
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
height: 60px;
|
|
13
13
|
background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 100%);
|
|
14
14
|
}
|
|
15
|
+
|
|
15
16
|
// 底部长条
|
|
16
17
|
.ipc-player-bottom-content {
|
|
17
18
|
position: absolute;
|
|
@@ -24,6 +25,21 @@
|
|
|
24
25
|
background: linear-gradient(360deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0) 100%);
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
.ipc-player-bottom-content-full {
|
|
29
|
+
:root[theme='dark'] & {
|
|
30
|
+
background: #000;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:root[theme='light'] & {
|
|
34
|
+
background: #fff;
|
|
35
|
+
--iconColor: #000;
|
|
36
|
+
|
|
37
|
+
.ipc-player-plugin-resolution {
|
|
38
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
27
43
|
// 顶部整条内容隐藏
|
|
28
44
|
.ipc-player-top-content-show {
|
|
29
45
|
transform: translate(0, 0);
|
|
@@ -53,6 +69,7 @@
|
|
|
53
69
|
top: 0;
|
|
54
70
|
z-index: 100;
|
|
55
71
|
}
|
|
72
|
+
|
|
56
73
|
// 右上角容器样式
|
|
57
74
|
.ipc-player-top-right-content-wrap {
|
|
58
75
|
position: absolute;
|
|
@@ -60,6 +77,7 @@
|
|
|
60
77
|
top: 0;
|
|
61
78
|
z-index: 100;
|
|
62
79
|
}
|
|
80
|
+
|
|
63
81
|
// 左下角容器样式
|
|
64
82
|
.ipc-player-bottom-left-content-wrap {
|
|
65
83
|
position: absolute;
|
|
@@ -69,6 +87,7 @@
|
|
|
69
87
|
display: flex;
|
|
70
88
|
flex-direction: row;
|
|
71
89
|
}
|
|
90
|
+
|
|
72
91
|
// 右下角容器样式
|
|
73
92
|
.ipc-player-bottom-right-content-wrap {
|
|
74
93
|
position: absolute;
|
|
@@ -159,12 +178,15 @@
|
|
|
159
178
|
.top-left-item-container {
|
|
160
179
|
padding: 0 8px;
|
|
161
180
|
}
|
|
181
|
+
|
|
162
182
|
.top-left-item-container:first-of-type {
|
|
163
183
|
padding: 0 8px 0 16px;
|
|
164
184
|
}
|
|
185
|
+
|
|
165
186
|
.top-left-item-container:last-of-type {
|
|
166
187
|
padding: 0 0 0 8px;
|
|
167
188
|
}
|
|
189
|
+
|
|
168
190
|
.top-left-item-container:only-of-type {
|
|
169
191
|
padding: 0 0 0 16px;
|
|
170
192
|
}
|
|
@@ -173,12 +195,15 @@
|
|
|
173
195
|
.top-right-item-container {
|
|
174
196
|
padding: 0 8px;
|
|
175
197
|
}
|
|
198
|
+
|
|
176
199
|
.top-right-item-container:first-of-type {
|
|
177
200
|
padding: 0 8px 0 0;
|
|
178
201
|
}
|
|
202
|
+
|
|
179
203
|
.top-right-item-container:last-of-type {
|
|
180
204
|
padding: 0 16px 0 8px;
|
|
181
205
|
}
|
|
206
|
+
|
|
182
207
|
.top-right-item-container:only-of-type {
|
|
183
208
|
padding: 0 16px 0 0;
|
|
184
209
|
}
|
|
@@ -194,9 +219,11 @@
|
|
|
194
219
|
.bottom-left-item-container:first-of-type {
|
|
195
220
|
padding: 0 12px 0 16px;
|
|
196
221
|
}
|
|
222
|
+
|
|
197
223
|
.bottom-left-item-container:last-of-type {
|
|
198
224
|
padding: 0 0 0 12px;
|
|
199
225
|
}
|
|
226
|
+
|
|
200
227
|
.bottom-left-item-container:only-of-type {
|
|
201
228
|
padding: 0 0 0 16px;
|
|
202
229
|
}
|
|
@@ -209,9 +236,11 @@
|
|
|
209
236
|
.bottom-left-item-full-container:first-of-type {
|
|
210
237
|
padding: 0 24px 0 16px !important;
|
|
211
238
|
}
|
|
239
|
+
|
|
212
240
|
.bottom-left-item-full-container:last-of-type {
|
|
213
241
|
padding: 0 0 0 24px !important;
|
|
214
242
|
}
|
|
243
|
+
|
|
215
244
|
.bottom-left-item-full-container:only-of-type {
|
|
216
245
|
padding: 0 0 0 16px !important;
|
|
217
246
|
}
|
|
@@ -227,9 +256,11 @@
|
|
|
227
256
|
.bottom-right-item-container:first-of-type {
|
|
228
257
|
padding: 0 12px 0 0;
|
|
229
258
|
}
|
|
259
|
+
|
|
230
260
|
.bottom-right-item-container:last-of-type {
|
|
231
261
|
padding: 0 16px 0 12px;
|
|
232
262
|
}
|
|
263
|
+
|
|
233
264
|
.bottom-right-item-container:only-of-type {
|
|
234
265
|
padding: 0 16px 0 0;
|
|
235
266
|
}
|
|
@@ -247,6 +278,7 @@
|
|
|
247
278
|
from {
|
|
248
279
|
transform: translate(calc(100vw), 0);
|
|
249
280
|
}
|
|
281
|
+
|
|
250
282
|
to {
|
|
251
283
|
transform: translate(0, 0);
|
|
252
284
|
}
|
|
@@ -259,13 +291,10 @@
|
|
|
259
291
|
animation: absolute-move-in-right-animation @animation-time ease-in-out;
|
|
260
292
|
transition: transform @animation-time ease-in, opacity @animation-time ease-in,
|
|
261
293
|
width @animation-time ease-in;
|
|
294
|
+
|
|
262
295
|
&.ipc-plugin-absolute-move-in-right-hide {
|
|
263
296
|
transform: translate(var(--translate-length), 0);
|
|
264
297
|
opacity: 0;
|
|
265
298
|
width: 0;
|
|
266
299
|
}
|
|
267
300
|
}
|
|
268
|
-
|
|
269
|
-
.ipc-player-bottom-content-full {
|
|
270
|
-
background-color: #000 !important;
|
|
271
|
-
}
|
|
@@ -3,3 +3,8 @@ export declare const TEMP_REPORT_F = "temp_report_f";
|
|
|
3
3
|
export declare const SENSOR_TEMPERATURE = "sensor_temperature";
|
|
4
4
|
export declare const SENSOR_HUMIDITY = "sensor_humidity";
|
|
5
5
|
export declare const PTZ_CONTROL = "ptz_control";
|
|
6
|
+
export declare const GUN_BALL = "ipc_multi_locate_coor";
|
|
7
|
+
export declare const ZOOM_CONTROL = "zoom_control";
|
|
8
|
+
export declare const MULTI_GUN_BALL = "ipc_multi_locate_coors";
|
|
9
|
+
export declare const MULTI_PTZ_CONTROL = "ipc_multi_ptz_control";
|
|
10
|
+
export declare const MULTI_ZOOM_CONTROL = "ipc_multi_zoom_control";
|
|
@@ -6,4 +6,14 @@ export const SENSOR_TEMPERATURE = 'sensor_temperature'; // 摄氏度
|
|
|
6
6
|
|
|
7
7
|
export const SENSOR_HUMIDITY = 'sensor_humidity'; // 湿度
|
|
8
8
|
|
|
9
|
-
export const PTZ_CONTROL = 'ptz_control'; // ptz
|
|
9
|
+
export const PTZ_CONTROL = 'ptz_control'; // ptz
|
|
10
|
+
|
|
11
|
+
export const GUN_BALL = 'ipc_multi_locate_coor'; // 旧枪球联动-定位器
|
|
12
|
+
|
|
13
|
+
export const ZOOM_CONTROL = 'zoom_control'; // 变焦控制
|
|
14
|
+
|
|
15
|
+
export const MULTI_GUN_BALL = 'ipc_multi_locate_coors'; // 多目枪球联动-定位器
|
|
16
|
+
|
|
17
|
+
export const MULTI_PTZ_CONTROL = 'ipc_multi_ptz_control'; // 多目 PTZ 控制
|
|
18
|
+
|
|
19
|
+
export const MULTI_ZOOM_CONTROL = 'ipc_multi_zoom_control'; // 多目 变焦控制
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
+
export declare const isSmallScreen: boolean;
|
|
2
3
|
/**
|
|
3
4
|
* 麦克风对讲按钮径向渐变
|
|
4
5
|
*/
|
|
@@ -13,3 +14,4 @@ export declare const promisify: <TParams extends Record<string, any>, TSuccessRe
|
|
|
13
14
|
fail?: ((error: any) => void) | undefined;
|
|
14
15
|
complete?: (() => void) | undefined;
|
|
15
16
|
}) => void) => (params: Omit<TParams, "complete" | "success" | "fail">) => Promise<TSuccessResult>;
|
|
17
|
+
export * from './videoSplitHelper';
|
package/lib/utils/index.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import { getSystemInfoSync } from '@ray-js/ray';
|
|
3
|
+
const {
|
|
4
|
+
windowWidth,
|
|
5
|
+
screenWidth,
|
|
6
|
+
windowHeight
|
|
7
|
+
} = getSystemInfoSync();
|
|
8
|
+
|
|
9
|
+
// pad和折叠屏小窗口展示面板的情况
|
|
10
|
+
export const isSmallScreen = !(screenWidth === windowWidth || screenWidth === windowHeight);
|
|
11
|
+
|
|
2
12
|
/**
|
|
3
13
|
* 麦克风对讲按钮径向渐变
|
|
4
14
|
*/
|
|
@@ -36,4 +46,5 @@ export const promisify = apiFunction => {
|
|
|
36
46
|
}));
|
|
37
47
|
});
|
|
38
48
|
};
|
|
39
|
-
};
|
|
49
|
+
};
|
|
50
|
+
export * from './videoSplitHelper';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { VideoSplitProtocol } from '../interface';
|
|
2
|
+
export type FourDirectionShow = {
|
|
3
|
+
top: boolean;
|
|
4
|
+
right: boolean;
|
|
5
|
+
bottom: boolean;
|
|
6
|
+
left: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function getLensInfoByIndex(protocol: VideoSplitProtocol | undefined, index?: number): import("../interface").VideoSplitInfoItem | undefined;
|
|
9
|
+
export declare function getLensSupportDirections(protocol: VideoSplitProtocol | undefined, index?: number): number[];
|
|
10
|
+
export declare function getPtzShowMapByProtocol(protocol: VideoSplitProtocol | undefined, index?: number): FourDirectionShow;
|
|
11
|
+
export declare function patchPtzDataShowByProtocol<T extends {
|
|
12
|
+
type: string;
|
|
13
|
+
show: boolean;
|
|
14
|
+
}>(ptzData: T[], protocol: VideoSplitProtocol | undefined, index?: number, isMultiCamera?: boolean): T[];
|
|
15
|
+
export declare function patchZoomDataShowByProtocol<T extends {
|
|
16
|
+
show: boolean;
|
|
17
|
+
}>(zoomData: T[], isMultiCamera?: boolean): T[];
|
|
18
|
+
export declare function isSwipeDirectionSupported(protocol: VideoSplitProtocol | undefined, index: number | undefined, direction: unknown): boolean;
|
|
@@ -0,0 +1,48 @@
|
|
|
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.filter.js";
|
|
4
|
+
import "core-js/modules/esnext.iterator.find.js";
|
|
5
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
6
|
+
export function getLensInfoByIndex(protocol, index) {
|
|
7
|
+
if (!protocol || !index) return undefined;
|
|
8
|
+
return protocol.split_info.find(item => item.index === index);
|
|
9
|
+
}
|
|
10
|
+
export function getLensSupportDirections(protocol, index) {
|
|
11
|
+
const lensInfo = getLensInfoByIndex(protocol, index);
|
|
12
|
+
if (!Array.isArray(lensInfo === null || lensInfo === void 0 ? void 0 : lensInfo.support_directions)) return [];
|
|
13
|
+
return lensInfo.support_directions.filter(direction => Number.isInteger(direction) && direction >= 0 && direction <= 7);
|
|
14
|
+
}
|
|
15
|
+
export function getPtzShowMapByProtocol(protocol, index) {
|
|
16
|
+
const supportSet = new Set(getLensSupportDirections(protocol, index));
|
|
17
|
+
return {
|
|
18
|
+
top: supportSet.has(0),
|
|
19
|
+
right: supportSet.has(2),
|
|
20
|
+
bottom: supportSet.has(4),
|
|
21
|
+
left: supportSet.has(6)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function patchPtzDataShowByProtocol(ptzData, protocol, index) {
|
|
25
|
+
let isMultiCamera = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
26
|
+
if (!isMultiCamera) return ptzData;
|
|
27
|
+
const showMap = getPtzShowMapByProtocol(protocol, index);
|
|
28
|
+
return ptzData.map(item => {
|
|
29
|
+
let show = false;
|
|
30
|
+
if (item.type === 'top') show = showMap.top;else if (item.type === 'right') show = showMap.right;else if (item.type === 'bottom') show = showMap.bottom;else if (item.type === 'left') show = showMap.left;
|
|
31
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
32
|
+
show
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export function patchZoomDataShowByProtocol(zoomData) {
|
|
37
|
+
let isMultiCamera = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
38
|
+
if (!isMultiCamera) return zoomData;
|
|
39
|
+
return zoomData.map(item => _objectSpread(_objectSpread({}, item), {}, {
|
|
40
|
+
show: true
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
export function isSwipeDirectionSupported(protocol, index, direction) {
|
|
44
|
+
const directionValue = Number(direction);
|
|
45
|
+
if (!Number.isInteger(directionValue)) return false;
|
|
46
|
+
const supportDirections = getLensSupportDirections(protocol, index);
|
|
47
|
+
return supportDirections.includes(directionValue);
|
|
48
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import React, { useContext } from 'react';
|
|
2
|
+
import React, { useContext, useEffect } from 'react';
|
|
3
3
|
import { View, setPageOrientation, Text, hideMenuButton, showMenuButton, showStatusBar, hideStatusBar, setNavigationBarBack } from '@ray-js/ray';
|
|
4
|
-
import { useUpdateEffect } from 'ahooks';
|
|
5
4
|
import clsx from 'clsx';
|
|
6
5
|
import { unstable_batchedUpdates as batchedUpdates } from '@ray-core/ray';
|
|
7
6
|
import { UIEventContext } from '../../ui/context';
|
|
8
|
-
import { showAllComponent, voiceIntercomId, verticalScreenId, fullTravelRouteControlId, ptzControlId, fullResolutionId, fullSmallIntercomId, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
7
|
+
import { showAllComponent, voiceIntercomId, verticalScreenId, fullTravelRouteControlId, ptzControlId, fullResolutionId, fullSmallIntercomId, pauseTimeToHideAllComponent, widgetLabs, widgetClick } from '../../ui/constant';
|
|
9
8
|
import { useStore } from '../../ctx/store';
|
|
10
9
|
import { VerticalScreen } from './verticalScreen';
|
|
11
10
|
import { FullVoiceIntercom } from './fullVoiceIntercom';
|
|
@@ -118,13 +117,16 @@ export function FullScreen(props) {
|
|
|
118
117
|
deleteContent('absolute', fullTravelRouteControlId);
|
|
119
118
|
}
|
|
120
119
|
};
|
|
121
|
-
|
|
120
|
+
useEffect(() => {
|
|
122
121
|
var _handlers$screenType;
|
|
123
122
|
(_handlers$screenType = handlers[screenType]) === null || _handlers$screenType === void 0 || _handlers$screenType.call(handlers);
|
|
124
123
|
}, [screenType]);
|
|
125
124
|
|
|
126
125
|
// 点击事件处理函数
|
|
127
126
|
const handClick = target => {
|
|
127
|
+
event.emit(widgetClick, {
|
|
128
|
+
widgetId: target === 'full' ? widgetLabs.FULL_SCREEN : widgetLabs.VERTICAL_SCREEN
|
|
129
|
+
});
|
|
128
130
|
// 根据target的值设置pageOrientation的值
|
|
129
131
|
const pageOrientation = target === 'vertical' ? 'portrait' : 'landscape';
|
|
130
132
|
// 发射事件
|