@ray-js/ipc-player-integration 0.0.35-beta.1 → 0.0.35-beta.11
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 +5 -1
- package/lib/features/initPlayerWidgets/index.d.ts +1 -0
- package/lib/features/initPlayerWidgets/index.js +8 -0
- package/lib/i18n/index.d.ts +24 -0
- package/lib/i18n/strings.d.ts +12 -0
- package/lib/i18n/strings.js +14 -2
- package/lib/interface.d.ts +1 -1
- package/lib/res/try/try_close.png +0 -0
- package/lib/res/try/try_en.png +0 -0
- package/lib/res/try/try_open.png +0 -0
- package/lib/res/try/try_zh.png +0 -0
- package/lib/ui/bottomLeftContent.d.ts +4 -1
- package/lib/ui/bottomLeftContent.js +93 -8
- package/lib/ui/bottomRightContent.d.ts +3 -1
- package/lib/ui/bottomRightContent.js +11 -4
- package/lib/ui/constant.d.ts +7 -0
- package/lib/ui/constant.js +8 -0
- package/lib/ui/index.d.ts +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/ui.js +113 -56
- package/lib/ui/ui.less +5 -1
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +3 -11
- package/lib/utils/navigation.d.ts +7 -0
- package/lib/utils/navigation.js +23 -0
- package/lib/utils/ttt.d.ts +42 -0
- package/lib/utils/ttt.js +123 -0
- package/lib/widgets/index.d.ts +2 -0
- package/lib/widgets/index.js +2 -0
- package/lib/widgets/trialBadge/index.d.ts +17 -0
- package/lib/widgets/trialBadge/index.js +88 -0
- package/lib/widgets/trialBadge/index.less +57 -0
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +8 -0
- package/lib/widgets/trialBadge/useTrialBadge.js +42 -0
- package/lib/widgets/tryExperience/index.d.ts +1 -0
- package/lib/widgets/tryExperience/index.js +1 -0
- package/lib/widgets/tryExperience/tryExperience.d.ts +14 -0
- package/lib/widgets/tryExperience/tryExperience.js +150 -0
- package/lib/widgets/tryExperience/tryExperience.less +13 -0
- package/package.json +3 -3
package/lib/ui/ui.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.filter.js";
|
|
3
4
|
import "core-js/modules/esnext.iterator.map.js";
|
|
4
5
|
import React, { useContext, useState, useRef, useMemo, useEffect, useImperativeHandle } from 'react';
|
|
5
6
|
import { View, CoverView, getSystemInfoSync, usePageEvent, setNavigationBarBack, setPageOrientation, getCurrentPages } from '@ray-js/ray';
|
|
@@ -11,7 +12,7 @@ import { PlayState, PlayerStreamStatus, MultiCameraScreenMode } from '../interfa
|
|
|
11
12
|
import { useCtx } from '../ctx/ctx.composition';
|
|
12
13
|
import { useStore, updateAtom } from '../ctx/store';
|
|
13
14
|
import { UIEventContext } from './context';
|
|
14
|
-
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId, showFlowLowTipId, zoomLevelChange, setScaleMultipleEvent } from './constant';
|
|
15
|
+
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent, decodeClarityDic, changeIgnoreHideStopPreview, moveablePtzControlId, tileActionsId, tileTipId, landscapeTipId, multiPtzId, ptzMoveableTipId, showFlowLowTipId, zoomLevelChange, setScaleMultipleEvent, trialCountdownEnd, refreshSmartImageQualityEvent } from './constant';
|
|
15
16
|
import BottomLeftContent from './bottomLeftContent';
|
|
16
17
|
import BottomRightContent from './bottomRightContent';
|
|
17
18
|
import TopLeftContent from './topLeftContent';
|
|
@@ -21,7 +22,7 @@ import { useMemoizedFn } from '../hooks';
|
|
|
21
22
|
import { Storage } from '../utils/storage';
|
|
22
23
|
import './ui.less';
|
|
23
24
|
import { updatePlayerWidgetProps } from '../features';
|
|
24
|
-
import {
|
|
25
|
+
import { getSmartImageQualityState, isLowPhone } from '../utils/ttt';
|
|
25
26
|
function getCtxInstance(instance, devId) {
|
|
26
27
|
if (instance) return instance;
|
|
27
28
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -102,8 +103,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
102
103
|
useImperativeHandle(eventRefProp, () => eventRef.current, [eventRef.current]);
|
|
103
104
|
const timer = useRef();
|
|
104
105
|
const reGetOrientationTimer = useRef(null);
|
|
105
|
-
|
|
106
|
-
const [
|
|
106
|
+
// 统一调整为1倍缩放,保证画面展示完全
|
|
107
|
+
const [scaleMultiple, setScaleMultiple] = useState(1);
|
|
108
|
+
// 统一调整为1倍缩放,保证画面展示完全
|
|
109
|
+
const [currentZoomLevel, setCurrentZoomLevel] = useState(1);
|
|
107
110
|
const [createCtx, setCreateCtx] = useState(false);
|
|
108
111
|
// 是否需要忽略进入后台停止预览
|
|
109
112
|
const [ignoreStopOnHide, setIgnoreStopOnHide] = useState(ignoreHideStopPreview);
|
|
@@ -111,9 +114,29 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
111
114
|
// const [verticalCoverZoom, setVerticalCoverZoom] = useState(-2);
|
|
112
115
|
// const [verticalZoomLevel, setVerticalZoomLevel] = useState(playerFit === 'contain' ? 1 : -2);
|
|
113
116
|
|
|
117
|
+
const isLowPhoneRef = useRef(false);
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
isLowPhone().then(res => {
|
|
120
|
+
isLowPhoneRef.current = !!res;
|
|
121
|
+
});
|
|
122
|
+
}, []);
|
|
123
|
+
|
|
114
124
|
// 展示顶部内容
|
|
115
125
|
const [showTopContent, setShowTopContent] = useState(true);
|
|
116
126
|
|
|
127
|
+
// pad / 折叠屏小窗口展示面板的情况;getSystemInfoSync 在 onLoad 之后才有准确值,
|
|
128
|
+
// 这里给安全默认 false,由 onLoad / onResize 实际计算并更新
|
|
129
|
+
const [isSmallScreen, setIsSmallScreen] = useState(false);
|
|
130
|
+
const computeIsSmallScreen = useMemoizedFn(() => {
|
|
131
|
+
const {
|
|
132
|
+
windowWidth,
|
|
133
|
+
screenWidth,
|
|
134
|
+
windowHeight
|
|
135
|
+
} = getSystemInfoSync();
|
|
136
|
+
// 取小屏值判断是最准确的 pad / 折叠屏小窗口情况
|
|
137
|
+
return !(screenWidth === windowWidth || screenWidth === windowHeight);
|
|
138
|
+
});
|
|
139
|
+
|
|
117
140
|
// 外部传入的ignoreHideStopPreview变化时,同步更新
|
|
118
141
|
useEffect(() => {
|
|
119
142
|
setIgnoreStopOnHide(ignoreHideStopPreview);
|
|
@@ -405,8 +428,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
405
428
|
eventRef.current.emit(showAllComponent);
|
|
406
429
|
eventRef.current.emit('disablePlayerTap', true);
|
|
407
430
|
eventRef.current.emit(pauseTimeToHideAllComponent);
|
|
408
|
-
//
|
|
409
|
-
setScaleMultiple(
|
|
431
|
+
// 按宽填充,保证播放流宽度为屏幕宽度,高度自适应设为1倍
|
|
432
|
+
setScaleMultiple(1);
|
|
410
433
|
} else {
|
|
411
434
|
// 短屏或横屏时,恢复自动隐藏
|
|
412
435
|
eventRef.current.emit('disablePlayerTap', false);
|
|
@@ -415,14 +438,42 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
415
438
|
}, [isVerticalFullLayout, screenType, playerFit]);
|
|
416
439
|
useEffect(() => {
|
|
417
440
|
if (createCtx) {
|
|
418
|
-
|
|
419
|
-
|
|
441
|
+
// 统一调整为1倍缩放,保证画面展示完全
|
|
442
|
+
setScaleMultiple(1);
|
|
443
|
+
setCurrentZoomLevel(1);
|
|
420
444
|
}
|
|
421
445
|
}, [playerFit, createCtx]);
|
|
422
446
|
useEffect(() => {
|
|
423
447
|
setBrandColor(brandColor);
|
|
424
448
|
setVerticalMic(verticalMic);
|
|
425
449
|
}, [brandColor, verticalMic]);
|
|
450
|
+
const refreshSmartImageQuality = useMemoizedFn(async () => {
|
|
451
|
+
let res = await getSmartImageQualityState(devId);
|
|
452
|
+
console.log('res===refreshSmartImageQuality1', res);
|
|
453
|
+
// if (res === undefined) return;
|
|
454
|
+
// TODO: TEST
|
|
455
|
+
if (res === undefined) {
|
|
456
|
+
res = {
|
|
457
|
+
isPurchase: false,
|
|
458
|
+
buttonState: 0,
|
|
459
|
+
trialRemainingSec: 20,
|
|
460
|
+
canOpenSettings: true
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
updatePlayerWidgetProps(instance, 'bottomLeft', 'TryExperience', {
|
|
464
|
+
isPurchase: res.isPurchase,
|
|
465
|
+
buttonState: res.buttonState,
|
|
466
|
+
trialRemainingSec: res.trialRemainingSec,
|
|
467
|
+
canOpenSettings: res.canOpenSettings,
|
|
468
|
+
isLowPhone: isLowPhoneRef.current,
|
|
469
|
+
refreshToken: Date.now()
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
useEffect(() => {
|
|
473
|
+
if (playState === PlayState.PLAYING) {
|
|
474
|
+
refreshSmartImageQuality();
|
|
475
|
+
}
|
|
476
|
+
}, [instance, playState]);
|
|
426
477
|
const refreshBottomLeft = () => {
|
|
427
478
|
event.current.emit(startTimeToHideAllComponent);
|
|
428
479
|
event.current.emit(showAllComponent);
|
|
@@ -452,6 +503,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
452
503
|
* 监听播放器实例创建完成
|
|
453
504
|
*/
|
|
454
505
|
|
|
506
|
+
/**
|
|
507
|
+
* 页面 onLoad 后才能拿到准确的 systemInfo,这里第一次确定小屏状态
|
|
508
|
+
*/
|
|
509
|
+
usePageEvent('onLoad', () => {
|
|
510
|
+
setIsSmallScreen(computeIsSmallScreen());
|
|
511
|
+
});
|
|
512
|
+
|
|
455
513
|
/**
|
|
456
514
|
* 监听屏幕布局变化
|
|
457
515
|
*/
|
|
@@ -465,8 +523,13 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
465
523
|
const {
|
|
466
524
|
type
|
|
467
525
|
} = sizeData;
|
|
526
|
+
|
|
527
|
+
// 折叠屏展开/收起、pad 多窗口拖拽等场景,需要重新计算并同步
|
|
528
|
+
const small = computeIsSmallScreen();
|
|
529
|
+
setIsSmallScreen(small);
|
|
530
|
+
|
|
468
531
|
// 针对pad 和折叠屏展开的情况暂不支持横屏,且在ios pad模式下 会触发onResize事件, 待解决
|
|
469
|
-
if (
|
|
532
|
+
if (small) {
|
|
470
533
|
setScreenType('vertical');
|
|
471
534
|
} else {
|
|
472
535
|
setScreenType(type === 'landscape' ? 'full' : 'vertical');
|
|
@@ -481,19 +544,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
481
544
|
}
|
|
482
545
|
triggerEvent(showAllComponent);
|
|
483
546
|
}
|
|
484
|
-
//
|
|
485
|
-
|
|
486
|
-
console.log(scaleMultiple, '===========fill');
|
|
487
|
-
setScaleMultiple(-1);
|
|
488
|
-
} else if (type === 'landscape' && landscapeMode === 'standard') {
|
|
489
|
-
console.log(scaleMultiple, '===========landscape');
|
|
490
|
-
setScaleMultiple(-2);
|
|
491
|
-
} else {
|
|
492
|
-
// 竖屏时 将屏幕播放比例设为按宽按高
|
|
493
|
-
|
|
494
|
-
console.log(scaleMultiple, '===========landscape');
|
|
495
|
-
setScaleMultiple(playerFit === 'contain' ? scaleMultiple === 1 ? -1 : 1 : -2);
|
|
496
|
-
}
|
|
547
|
+
// 横屏(fill/standard)与竖屏均统一调整为 1 倍缩放,保证画面完整展示
|
|
548
|
+
setScaleMultiple(1);
|
|
497
549
|
} catch (err) {
|
|
498
550
|
console.log(err, 'err');
|
|
499
551
|
}
|
|
@@ -622,7 +674,18 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
622
674
|
// 添加通用变量单独组件类名
|
|
623
675
|
className: clsx('bottom-right-item-container')
|
|
624
676
|
})));
|
|
625
|
-
}, [
|
|
677
|
+
}, [bottomRightContent, instance]);
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* 右下角可见按钮数 → 右下角组件宽度(左下角同时用作右侧预留宽度)
|
|
681
|
+
* 1 个按钮: 115px / 2 个按钮: 132px / 0 个按钮: 0
|
|
682
|
+
*/
|
|
683
|
+
const bottomRightWidth = useMemo(() => {
|
|
684
|
+
const visibleCount = (bottomRightContent || []).filter(item => !item.hidden).length;
|
|
685
|
+
if (visibleCount <= 0) return 0;
|
|
686
|
+
if (visibleCount === 1) return 115;
|
|
687
|
+
return 132;
|
|
688
|
+
}, [bottomRightContent]);
|
|
626
689
|
|
|
627
690
|
/**
|
|
628
691
|
* 视频流加载状态封装
|
|
@@ -646,10 +709,12 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
646
709
|
}
|
|
647
710
|
}
|
|
648
711
|
if (playState === PlayState.PLAYING) {
|
|
649
|
-
// 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2
|
|
712
|
+
// 仅在第一次播放成功时,针对竖屏并且为cover模式时,设置为-2 修改为只针对第一次播放成功时
|
|
650
713
|
console.log('Playing状态');
|
|
651
|
-
if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
|
|
652
|
-
|
|
714
|
+
// if (screenType === 'vertical' && playerFit === 'cover' && !hasPlayedRef.current) {
|
|
715
|
+
if (!hasPlayedRef.current) {
|
|
716
|
+
// 统一调整为1倍缩放,保证画面展示完全
|
|
717
|
+
setScaleMultiple(1);
|
|
653
718
|
hasPlayedRef.current = true;
|
|
654
719
|
}
|
|
655
720
|
}
|
|
@@ -726,6 +791,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
726
791
|
const onSetScaleMultiple = value => {
|
|
727
792
|
setScaleMultiple(value);
|
|
728
793
|
};
|
|
794
|
+
const onTrialCountdownEnd = useMemoizedFn(() => {
|
|
795
|
+
updatePlayerWidgetProps(instance, 'bottomLeft', 'TryExperience', {
|
|
796
|
+
buttonState: 2
|
|
797
|
+
});
|
|
798
|
+
});
|
|
729
799
|
useEffect(() => {
|
|
730
800
|
eventRef.current.on(startTimeToHideAllComponent, listenStart);
|
|
731
801
|
eventRef.current.on(pauseTimeToHideAllComponent, listenPause);
|
|
@@ -735,6 +805,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
735
805
|
eventRef.current.on('refreshBottomLeft', refreshBottomLeft);
|
|
736
806
|
eventRef.current.on(changeIgnoreHideStopPreview, onChangeIgnoreHideStopPreview);
|
|
737
807
|
eventRef.current.on(setScaleMultipleEvent, onSetScaleMultiple);
|
|
808
|
+
eventRef.current.on(trialCountdownEnd, onTrialCountdownEnd);
|
|
809
|
+
eventRef.current.on(refreshSmartImageQualityEvent, refreshSmartImageQuality);
|
|
738
810
|
return () => {
|
|
739
811
|
eventRef.current.off(startTimeToHideAllComponent, listenStart);
|
|
740
812
|
eventRef.current.off(pauseTimeToHideAllComponent, listenPause);
|
|
@@ -744,6 +816,8 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
744
816
|
eventRef.current.off('refreshBottomLeft', refreshBottomLeft);
|
|
745
817
|
eventRef.current.off(changeIgnoreHideStopPreview, onChangeIgnoreHideStopPreview);
|
|
746
818
|
eventRef.current.off(setScaleMultipleEvent, onSetScaleMultiple);
|
|
819
|
+
eventRef.current.off(trialCountdownEnd, onTrialCountdownEnd);
|
|
820
|
+
eventRef.current.off(refreshSmartImageQualityEvent, refreshSmartImageQuality);
|
|
747
821
|
if (multiTapTimerRef.current) {
|
|
748
822
|
clearTimeout(multiTapTimerRef.current);
|
|
749
823
|
multiTapTimerRef.current = null;
|
|
@@ -758,14 +832,6 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
758
832
|
/**
|
|
759
833
|
* 监听当前的zoom比例状态
|
|
760
834
|
*/
|
|
761
|
-
// useEffect(() => {
|
|
762
|
-
// if (screenType === 'vertical') {
|
|
763
|
-
// console.log(currentZoomLevel, '竖屏时的缩放比例');
|
|
764
|
-
// setVerticalZoomLevel(currentZoomLevel);
|
|
765
|
-
// // setScaleMultiple(currentZoomLevel);
|
|
766
|
-
// }
|
|
767
|
-
// }, [screenType, currentZoomLevel]);
|
|
768
|
-
|
|
769
835
|
const onZoomChange = useMemoizedFn(data => {
|
|
770
836
|
const {
|
|
771
837
|
zoomLevel,
|
|
@@ -776,30 +842,19 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
776
842
|
if (zoomLevel === 0) {
|
|
777
843
|
return false;
|
|
778
844
|
}
|
|
779
|
-
/**
|
|
780
|
-
* 针对竖屏为cover模式时,横屏为standard模式时,主动设置缩放比例,避免因值不能正常变化
|
|
781
|
-
*/
|
|
782
|
-
if (scaleMode === -2 && playerFit === 'cover' && screenType === 'vertical' && landscapeMode === 'standard') {
|
|
783
|
-
console.log('dsadsadsad----', zoomLevel);
|
|
784
|
-
setScaleMultiple(zoomLevel);
|
|
785
|
-
}
|
|
786
845
|
/**
|
|
787
846
|
* 针对竖屏为contain模式时,横屏为fill模式时,主动设置缩放比例,避免因值不能正常变化
|
|
788
847
|
*/
|
|
789
|
-
if (
|
|
790
|
-
|
|
791
|
-
|
|
848
|
+
// if (
|
|
849
|
+
// scaleMode === -1 &&
|
|
850
|
+
// playerFit === 'contain' &&
|
|
851
|
+
// screenType === 'vertical' &&
|
|
852
|
+
// landscapeMode === 'fill'
|
|
853
|
+
// ) {
|
|
854
|
+
// setVerticalCoverZoom(zoomLevel);
|
|
855
|
+
// }
|
|
792
856
|
|
|
793
|
-
|
|
794
|
-
* 横屏情况下 针对竖屏为contain模式时,横屏为fill模式时,主动设置缩放比例,避免因值不能正常变化
|
|
795
|
-
*/
|
|
796
|
-
if (scaleMode === -2 && playerFit === 'cover' && screenType !== 'vertical' && landscapeMode === 'standard') {
|
|
797
|
-
setScaleMultiple(zoomLevel);
|
|
798
|
-
}
|
|
799
|
-
if (scaleMode === -1 && playerFit === 'contain' && screenType !== 'vertical' && landscapeMode === 'fill') {
|
|
800
|
-
setVerticalCoverZoom(zoomLevel);
|
|
801
|
-
setScaleMultiple(zoomLevel);
|
|
802
|
-
}
|
|
857
|
+
// 直接记录当前缩放比例
|
|
803
858
|
setCurrentZoomLevel(zoomLevel);
|
|
804
859
|
instance.event.emit(zoomLevelChange, zoomLevel);
|
|
805
860
|
return false;
|
|
@@ -945,9 +1000,11 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
945
1000
|
height: screenType === 'vertical' ? '48px' : '72px'
|
|
946
1001
|
}
|
|
947
1002
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BottomLeftContent, {
|
|
948
|
-
ctx: instance
|
|
1003
|
+
ctx: instance,
|
|
1004
|
+
reservedRight: bottomRightWidth
|
|
949
1005
|
}, renderBottomLeftContent), /*#__PURE__*/React.createElement(BottomRightContent, {
|
|
950
|
-
ctx: instance
|
|
1006
|
+
ctx: instance,
|
|
1007
|
+
width: bottomRightWidth
|
|
951
1008
|
}, renderBottomRightContent))), (() => {
|
|
952
1009
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
953
1010
|
return absoluteContent.map(item => {
|
package/lib/ui/ui.less
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
.ipc-player-bottom-content-hide {
|
|
61
|
-
transform: translate(0,
|
|
61
|
+
transform: translate(0, 100%);
|
|
62
62
|
transition: transform 0.3s ease-in-out;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -214,6 +214,9 @@
|
|
|
214
214
|
display: flex;
|
|
215
215
|
justify-content: center;
|
|
216
216
|
align-items: center;
|
|
217
|
+
// 左下角支持横向滚动;不允许子项被压缩,否则在 width:100% 的滚动容器里
|
|
218
|
+
// 子项会被挤而不是触发横滑
|
|
219
|
+
flex-shrink: 0;
|
|
217
220
|
}
|
|
218
221
|
|
|
219
222
|
.bottom-left-item-container:first-of-type {
|
|
@@ -231,6 +234,7 @@
|
|
|
231
234
|
// 左下角全屏子元素容器
|
|
232
235
|
.bottom-left-item-full-container {
|
|
233
236
|
padding: 0 24px !important;
|
|
237
|
+
flex-shrink: 0;
|
|
234
238
|
}
|
|
235
239
|
|
|
236
240
|
.bottom-left-item-full-container:first-of-type {
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
-
export declare const isSmallScreen: boolean;
|
|
3
2
|
/**
|
|
4
3
|
* 麦克风对讲按钮径向渐变
|
|
5
4
|
*/
|
|
@@ -15,3 +14,5 @@ export declare const promisify: <TParams extends Record<string, any>, TSuccessRe
|
|
|
15
14
|
complete?: (() => void) | undefined;
|
|
16
15
|
}) => void) => (params: Omit<TParams, "complete" | "success" | "fail">) => Promise<TSuccessResult>;
|
|
17
16
|
export * from './videoSplitHelper';
|
|
17
|
+
export * from './navigation';
|
|
18
|
+
export * from './ttt';
|
package/lib/utils/index.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
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
|
-
|
|
12
2
|
/**
|
|
13
3
|
* 麦克风对讲按钮径向渐变
|
|
14
4
|
*/
|
|
@@ -47,4 +37,6 @@ export const promisify = apiFunction => {
|
|
|
47
37
|
});
|
|
48
38
|
};
|
|
49
39
|
};
|
|
50
|
-
export * from './videoSplitHelper';
|
|
40
|
+
export * from './videoSplitHelper';
|
|
41
|
+
export * from './navigation';
|
|
42
|
+
export * from './ttt';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const miniIdLabs: {
|
|
2
|
+
aiDrawMini: string;
|
|
3
|
+
securityCloudService: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function gotoAIDrawMiniProgram(devId: string, brandColor: string): void;
|
|
6
|
+
export declare function gotoSecurityCloudService(homeId: string, uuid: string): Promise<void>;
|
|
7
|
+
export declare function gotoSecurityCloudService2(devId: string): Promise<import("@ray-js/ray-ipc-utils/lib/interface").IRes<unknown>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getServiceUrl, goToMiniProgramByShortLink } from '@ray-js/ray-ipc-utils';
|
|
2
|
+
import Color from 'color';
|
|
3
|
+
|
|
4
|
+
// 小程序ID集合
|
|
5
|
+
export const miniIdLabs = {
|
|
6
|
+
// ai智能画质
|
|
7
|
+
aiDrawMini: 'tyjo8cvir22cc0yech',
|
|
8
|
+
// security_cloud_service, 增值服务商城小程序ID
|
|
9
|
+
securityCloudService: 'tyeavwo0j4oocvdrf1'
|
|
10
|
+
};
|
|
11
|
+
export function gotoAIDrawMiniProgram(devId, brandColor) {
|
|
12
|
+
const color = new Color(brandColor);
|
|
13
|
+
color.rgb().toString();
|
|
14
|
+
const url = `godzilla://${miniIdLabs.aiDrawMini}${'/pages/smartImageQuality/index'}?deviceId=${devId}`;
|
|
15
|
+
goToMiniProgramByShortLink(url, 'right');
|
|
16
|
+
}
|
|
17
|
+
export async function gotoSecurityCloudService(homeId, uuid) {
|
|
18
|
+
const url = `godzilla://${miniIdLabs.securityCloudService}${'/pages/serviceList/index'}?homeId=${homeId}&deviceId=${uuid}&categoryCode=${'security_cloud_service'}`;
|
|
19
|
+
goToMiniProgramByShortLink(url, 'right');
|
|
20
|
+
}
|
|
21
|
+
export async function gotoSecurityCloudService2(devId) {
|
|
22
|
+
return getServiceUrl(devId, 'security_cloud_service', {}, true);
|
|
23
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type SmartImageQualityResult = {
|
|
2
|
+
isPurchase: boolean;
|
|
3
|
+
buttonState: number;
|
|
4
|
+
trialRemainingSec: number;
|
|
5
|
+
canOpenSettings: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function getSmartImageQualityState(devId: string): Promise<SmartImageQualityResult>;
|
|
8
|
+
export type AIFrameFeatureScope = {
|
|
9
|
+
inPreview: boolean;
|
|
10
|
+
inMessage: boolean;
|
|
11
|
+
inPlayback: boolean;
|
|
12
|
+
inCloudData: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type AIFrameFeatureDetail = {
|
|
15
|
+
srModelStatus: number;
|
|
16
|
+
lightModelStatus: number;
|
|
17
|
+
filterStatus: number;
|
|
18
|
+
};
|
|
19
|
+
export type AIFrameFeatureConfig = {
|
|
20
|
+
scope: AIFrameFeatureScope;
|
|
21
|
+
feature: AIFrameFeatureDetail;
|
|
22
|
+
exportEnabled: boolean;
|
|
23
|
+
};
|
|
24
|
+
export type SetAIFrameFeatureParams = {
|
|
25
|
+
devId: string;
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
aiFrameFeature: AIFrameFeatureConfig;
|
|
28
|
+
scene: string;
|
|
29
|
+
};
|
|
30
|
+
export type GetAIFrameFeatureResult = {
|
|
31
|
+
enabled: boolean;
|
|
32
|
+
aiFrameFeature: AIFrameFeatureConfig;
|
|
33
|
+
requestId: string;
|
|
34
|
+
localPath: string;
|
|
35
|
+
thingFileUri: string;
|
|
36
|
+
};
|
|
37
|
+
export declare function getAIFrameFeature(devId: string): Promise<GetAIFrameFeatureResult>;
|
|
38
|
+
export declare function setAIFrameFeature(params: SetAIFrameFeatureParams): Promise<any>;
|
|
39
|
+
export declare function getDeviceInfo(devId: string): Promise<unknown>;
|
|
40
|
+
export declare function getCurrentHomeInfo(): Promise<unknown>;
|
|
41
|
+
export declare function setTrailFinish(devId: string): Promise<unknown>;
|
|
42
|
+
export declare function isLowPhone(): Promise<unknown>;
|
package/lib/utils/ttt.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
export function getSmartImageQualityState(devId) {
|
|
3
|
+
return new Promise(resolve => {
|
|
4
|
+
try {
|
|
5
|
+
ty.ipc.getSmartImageQualityState({
|
|
6
|
+
devId,
|
|
7
|
+
scene: 'inPreview',
|
|
8
|
+
success: data => {
|
|
9
|
+
console.log('res===getSmartImageQualityState data', data);
|
|
10
|
+
resolve(data);
|
|
11
|
+
},
|
|
12
|
+
fail: () => {
|
|
13
|
+
resolve(undefined);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
} catch (e) {
|
|
17
|
+
resolve(undefined);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export function getAIFrameFeature(devId) {
|
|
22
|
+
return new Promise(resolve => {
|
|
23
|
+
try {
|
|
24
|
+
ty.ipc.getAIFrameFeature({
|
|
25
|
+
devId,
|
|
26
|
+
success: data => {
|
|
27
|
+
console.log('res===getAIFrameFeature data', data);
|
|
28
|
+
resolve(data);
|
|
29
|
+
},
|
|
30
|
+
fail: e => {
|
|
31
|
+
console.warn('res===getAIFrameFeature fail', e);
|
|
32
|
+
resolve(undefined);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
} catch (e) {
|
|
36
|
+
resolve(undefined);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function setAIFrameFeature(params) {
|
|
41
|
+
return new Promise(resolve => {
|
|
42
|
+
try {
|
|
43
|
+
ty.ipc.setAIFrameFeature(_objectSpread(_objectSpread({}, params), {}, {
|
|
44
|
+
success: data => {
|
|
45
|
+
console.log('res===setAIFrameFeature data', data);
|
|
46
|
+
resolve(data);
|
|
47
|
+
},
|
|
48
|
+
fail: e => {
|
|
49
|
+
console.warn('res===setAIFrameFeature fail', e);
|
|
50
|
+
resolve(undefined);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
} catch (e) {
|
|
54
|
+
resolve(undefined);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function getDeviceInfo(devId) {
|
|
59
|
+
return new Promise(resolve => {
|
|
60
|
+
try {
|
|
61
|
+
ty.device.getDeviceInfo({
|
|
62
|
+
deviceId: devId,
|
|
63
|
+
success: res => {
|
|
64
|
+
resolve(res);
|
|
65
|
+
},
|
|
66
|
+
fail: () => {
|
|
67
|
+
resolve(undefined);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
} catch (e) {
|
|
71
|
+
resolve(undefined);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function getCurrentHomeInfo() {
|
|
76
|
+
return new Promise(resolve => {
|
|
77
|
+
try {
|
|
78
|
+
ty.home.getCurrentHomeInfo({
|
|
79
|
+
success: res => {
|
|
80
|
+
resolve(res);
|
|
81
|
+
},
|
|
82
|
+
fail: () => {
|
|
83
|
+
resolve(undefined);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
} catch (e) {
|
|
87
|
+
resolve(undefined);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export function setTrailFinish(devId) {
|
|
92
|
+
return new Promise(resolve => {
|
|
93
|
+
try {
|
|
94
|
+
ty.ipc.setTrailFinish({
|
|
95
|
+
devId,
|
|
96
|
+
success: res => {
|
|
97
|
+
resolve(res);
|
|
98
|
+
},
|
|
99
|
+
fail: () => {
|
|
100
|
+
resolve(undefined);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
} catch (e) {
|
|
104
|
+
resolve(undefined);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export function isLowPhone() {
|
|
109
|
+
return new Promise(resolve => {
|
|
110
|
+
try {
|
|
111
|
+
ty.device.isLowPhone({
|
|
112
|
+
success: res => {
|
|
113
|
+
resolve(res);
|
|
114
|
+
},
|
|
115
|
+
fail: () => {
|
|
116
|
+
resolve(false);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
} catch (e) {
|
|
120
|
+
resolve(false);
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
package/lib/widgets/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export * from './voiceIntercom';
|
|
|
10
10
|
export * from './muted';
|
|
11
11
|
export * from './floodlight';
|
|
12
12
|
export * from './siren';
|
|
13
|
+
export * from './tryExperience';
|
|
14
|
+
export * from './trialBadge';
|
|
13
15
|
export * from './ptz';
|
|
14
16
|
export * from './resolution';
|
|
15
17
|
export * from './fullSmallIntercom';
|
package/lib/widgets/index.js
CHANGED
|
@@ -10,6 +10,8 @@ export * from './voiceIntercom';
|
|
|
10
10
|
export * from './muted';
|
|
11
11
|
export * from './floodlight';
|
|
12
12
|
export * from './siren';
|
|
13
|
+
export * from './tryExperience';
|
|
14
|
+
export * from './trialBadge';
|
|
13
15
|
export * from './ptz';
|
|
14
16
|
export * from './resolution';
|
|
15
17
|
export * from './fullSmallIntercom';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
type Props = {
|
|
4
|
+
className?: string;
|
|
5
|
+
/** 主题色(用于「开通」按钮背景)。默认与 player brandColor 一致 */
|
|
6
|
+
brandColor?: string;
|
|
7
|
+
/** 试看倒计时初始秒数,来源于 smartImageQualityState.trialRemainingSec */
|
|
8
|
+
trialRemainingSec?: number;
|
|
9
|
+
/** 刷新令牌,变化时重置倒计时状态 */
|
|
10
|
+
refreshToken?: number;
|
|
11
|
+
/** 点击「开通」按钮回调 */
|
|
12
|
+
onSubscribe?: () => void;
|
|
13
|
+
/** 倒计时归零时触发,本组件保证整个生命周期内只回调一次 */
|
|
14
|
+
onCountdownEnd?: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const TrialBadge: ({ className, brandColor, trialRemainingSec, refreshToken, onSubscribe, onCountdownEnd, }: Props) => React.JSX.Element;
|
|
17
|
+
export { useTrialBadge } from './useTrialBadge';
|