@ray-js/ipc-player-integration 0.0.1-beta-5 → 0.0.1-beta-7
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/store.d.ts +1 -1
- package/lib/ctx/store.js +1 -0
- package/lib/hooks/useTemperature/index.js +0 -1
- package/lib/hooks/useVideoBitKbps/index.js +7 -29
- package/lib/iconfont/iconfont.css +0 -1
- package/lib/interface.d.ts +2 -0
- package/lib/plugins/battery/battery.less +18 -19
- package/lib/plugins/fullScreen/fullScreen.js +15 -8
- package/lib/plugins/fullScreen/fullScreen.less +13 -5
- package/lib/plugins/fullScreen/verticalScreen.less +4 -2
- package/lib/plugins/fullScreen/voiceIntercom.d.ts +5 -0
- package/lib/plugins/fullScreen/voiceIntercom.js +32 -0
- package/lib/plugins/muted/muted.js +2 -2
- package/lib/plugins/muted/muted.less +3 -4
- package/lib/plugins/recordVideo/recordVideo.less +11 -11
- package/lib/plugins/screenshot/screenshot.less +18 -14
- package/lib/plugins/tempHumidity/tempHumidity.js +5 -7
- package/lib/plugins/tempHumidity/tempHumidity.less +10 -7
- package/lib/plugins/videoBitKbps/videoBitKbps.js +1 -1
- package/lib/plugins/videoBitKbps/videoBitKbps.less +5 -4
- package/lib/plugins/voiceIntercom/voiceIntercom.d.ts +4 -1
- package/lib/plugins/voiceIntercom/voiceIntercom.js +7 -3
- package/lib/plugins/voiceIntercom/voiceIntercom.less +5 -4
- package/lib/ui/bottomContent.d.ts +8 -0
- package/lib/ui/bottomContent.js +30 -0
- package/lib/ui/constant.d.ts +5 -0
- package/lib/ui/constant.js +5 -0
- package/lib/ui/context.d.ts +6 -0
- package/lib/ui/context.js +8 -0
- package/lib/ui/event.d.ts +8 -0
- package/lib/ui/event.js +26 -0
- package/lib/ui/hooks.d.ts +1 -0
- package/lib/ui/hooks.js +25 -0
- package/lib/ui/index.d.ts +2 -0
- package/lib/ui/index.js +3 -1
- package/lib/ui/topContent.d.ts +8 -0
- package/lib/ui/topContent.js +30 -0
- package/lib/ui/ui.d.ts +2 -1
- package/lib/ui/ui.js +129 -48
- package/lib/ui/ui.less +33 -21
- package/package.json +4 -3
package/lib/ctx/store.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RetAtom } from '../interface';
|
|
2
|
+
export { getDefaultStore } from 'jotai';
|
|
2
3
|
export declare const topContent: import("jotai").PrimitiveAtom<never[]> & {
|
|
3
4
|
init: never[];
|
|
4
5
|
};
|
|
@@ -8,4 +9,3 @@ type ExtractReturnType<T> = {
|
|
|
8
9
|
};
|
|
9
10
|
export declare const useStore: <V, T extends Record<string, RetAtom<V>>>(options: T) => ExtractReturnType<T>;
|
|
10
11
|
export declare const updateAtom: <T>(atom: RetAtom<T>, value: T | ((prevValue: T) => T)) => void;
|
|
11
|
-
export {};
|
package/lib/ctx/store.js
CHANGED
|
@@ -10,7 +10,6 @@ export const useTemperature = devId => {
|
|
|
10
10
|
dpCodes: [TEMP_UNIT_SELECT, SENSOR_TEMPERATURE, TEMP_REPORT_F]
|
|
11
11
|
});
|
|
12
12
|
useEffect(() => {
|
|
13
|
-
console.log('res===1', dpState);
|
|
14
13
|
// 1=华氏度 0=摄氏度
|
|
15
14
|
if (dpState[TEMP_UNIT_SELECT] !== undefined) {
|
|
16
15
|
setTempUnit(dpState[TEMP_UNIT_SELECT] + '');
|
|
@@ -1,44 +1,22 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
2
3
|
export const useVideoBitKbps = devId => {
|
|
3
4
|
const [bitKbps, setBitKbps] = useState('');
|
|
4
5
|
useEffect(() => {
|
|
5
6
|
// const timer = setInterval(() => {
|
|
6
7
|
init();
|
|
7
|
-
// },
|
|
8
|
+
// }, 1000);
|
|
8
9
|
// return () => {
|
|
9
10
|
// clearInterval(timer);
|
|
10
11
|
// timer === null;
|
|
11
12
|
// };
|
|
12
13
|
}, []);
|
|
13
14
|
const init = async () => {
|
|
14
|
-
|
|
15
|
-
console.log('res===
|
|
16
|
-
res
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const getVideoBitrateKbps = () => {
|
|
20
|
-
return new Promise((resolve, reject) => {
|
|
21
|
-
ty.ipc.getVideoBitrateKbps({
|
|
22
|
-
devId,
|
|
23
|
-
extendParam: {},
|
|
24
|
-
success: _ref => {
|
|
25
|
-
let {
|
|
26
|
-
kpbs = '0'
|
|
27
|
-
} = _ref;
|
|
28
|
-
resolve(kpbs);
|
|
29
|
-
},
|
|
30
|
-
fail: _ref2 => {
|
|
31
|
-
let {
|
|
32
|
-
errorMsg,
|
|
33
|
-
errorCode
|
|
34
|
-
} = _ref2;
|
|
35
|
-
return reject(errorMsg);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}).catch(error => {
|
|
39
|
-
console.log('res===getVideoBitrateKbps', error);
|
|
40
|
-
return '0';
|
|
41
|
-
});
|
|
15
|
+
const res = await IpcUtils.getVideoBitrateKbps(devId);
|
|
16
|
+
console.log('res===getVideoBitrateKbps', res);
|
|
17
|
+
if (res.code !== -1) {
|
|
18
|
+
setBitKbps(res.data.kbps + 'KB/S');
|
|
19
|
+
}
|
|
42
20
|
};
|
|
43
21
|
return bitKbps;
|
|
44
22
|
};
|
package/lib/interface.d.ts
CHANGED
|
@@ -54,6 +54,8 @@ export type ComponentConfig<T = ReturnType<UseCtx> & Record<string, any>> = {
|
|
|
54
54
|
id: string;
|
|
55
55
|
content: (props: T) => React.ReactElement;
|
|
56
56
|
initProps?: T;
|
|
57
|
+
absolutePosition?: Pick<React.CSSProperties, 'top' | 'left' | 'right' | 'bottom'>;
|
|
58
|
+
absoluteContentClassName?: string;
|
|
57
59
|
};
|
|
58
60
|
export type ComponentConfigProps = {
|
|
59
61
|
IPCPlayerContext: IpcContext;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
.ipc-player-plugin-battery {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
border-radius: 48rpx;
|
|
4
|
+
height: calc(24px * var(--ipc-player-size-scale, 1));
|
|
5
|
+
padding: 0 calc(9px * var(--ipc-player-size-scale, 1));
|
|
6
|
+
border-radius: calc(24px * var(--ipc-player-size-scale, 1));
|
|
8
7
|
background-color: rgba(255, 255, 255, 0.1);
|
|
9
8
|
backdrop-filter: blur(10px);
|
|
10
9
|
&.ipc-player-plugin-battery-absolute {
|
|
11
10
|
position: absolute;
|
|
12
11
|
top: 50%;
|
|
13
|
-
left:
|
|
12
|
+
left: calc(16px * var(--ipc-player-size-scale, 1));
|
|
14
13
|
transform: translateY(-50%);
|
|
15
14
|
}
|
|
16
15
|
&.ipc-player-plugin-battery-relative {
|
|
@@ -21,26 +20,26 @@
|
|
|
21
20
|
}
|
|
22
21
|
.ipc-player-plugin-battery-border {
|
|
23
22
|
position: relative;
|
|
24
|
-
width:
|
|
25
|
-
height:
|
|
23
|
+
width: calc(16px * var(--ipc-player-size-scale, 1));
|
|
24
|
+
height: calc(12px * var(--ipc-player-size-scale, 1));;
|
|
26
25
|
box-sizing: border-box;
|
|
27
|
-
border:
|
|
28
|
-
margin-right:
|
|
29
|
-
border-radius:
|
|
26
|
+
border: calc(2px * var(--ipc-player-size-scale, 1)) solid #fff;
|
|
27
|
+
margin-right: calc(4px * var(--ipc-player-size-scale, 1));;
|
|
28
|
+
border-radius: calc(3px * var(--ipc-player-size-scale, 1));;
|
|
30
29
|
overflow: visible;
|
|
31
30
|
.ipc-player-plugin-battery-border-1 {
|
|
32
31
|
position: absolute;
|
|
33
|
-
height:
|
|
34
|
-
width:
|
|
32
|
+
height: calc(5px * var(--ipc-player-size-scale, 1));
|
|
33
|
+
width: calc(2px * var(--ipc-player-size-scale, 1));
|
|
35
34
|
background-color: #fff;
|
|
36
|
-
left: -
|
|
37
|
-
top:
|
|
38
|
-
border-radius:
|
|
35
|
+
left: calc(-3.5px * var(--ipc-player-size-scale, 1));
|
|
36
|
+
top: calc(2px * var(--ipc-player-size-scale, 1));
|
|
37
|
+
border-radius: calc(2px * var(--ipc-player-size-scale, 1));
|
|
39
38
|
}
|
|
40
39
|
.ipc-player-plugin-battery-value-wrap {
|
|
41
40
|
position: absolute;
|
|
42
|
-
width:
|
|
43
|
-
height:
|
|
41
|
+
width: calc(10px * var(--ipc-player-size-scale, 1));
|
|
42
|
+
height: calc(6px * var(--ipc-player-size-scale, 1));
|
|
44
43
|
left: 50%;
|
|
45
44
|
top: 50%;
|
|
46
45
|
transform: translate(-50%, -50%);
|
|
@@ -59,8 +58,8 @@
|
|
|
59
58
|
|
|
60
59
|
|
|
61
60
|
.ipc-player-plugin-battery-text {
|
|
62
|
-
font-size:
|
|
63
|
-
line-height:
|
|
61
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
62
|
+
line-height: calc(12px * var(--ipc-player-size-scale, 1));
|
|
64
63
|
color: var(--fontColor);
|
|
65
64
|
font-family: 'Manrope';
|
|
66
65
|
font-weight: 600;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { View, setPageOrientation
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { View, setPageOrientation } from '@ray-js/ray';
|
|
4
|
+
import { UIEventContext } from '../../ui/context';
|
|
5
|
+
import { startTimeToHideAllComponent, showAllComponent } from '../../ui/constant';
|
|
4
6
|
import { useStore } from '../../ctx/store';
|
|
5
7
|
import { VerticalScreen } from './verticalScreen';
|
|
6
|
-
import { VoiceIntercom } from '
|
|
8
|
+
import { VoiceIntercom } from './voiceIntercom';
|
|
7
9
|
import './fullScreen.less';
|
|
8
10
|
const VerticalScreenId = 'VerticalScreen';
|
|
9
11
|
const VoiceIntercomId = 'VoiceIntercom';
|
|
@@ -19,6 +21,9 @@ export function FullScreen(props) {
|
|
|
19
21
|
} = useStore({
|
|
20
22
|
screenType: screenTypeAtom
|
|
21
23
|
});
|
|
24
|
+
const {
|
|
25
|
+
event
|
|
26
|
+
} = useContext(UIEventContext);
|
|
22
27
|
const handFull = () => {
|
|
23
28
|
ty.hideMenuButton();
|
|
24
29
|
ty.hideStatusBar();
|
|
@@ -26,36 +31,38 @@ export function FullScreen(props) {
|
|
|
26
31
|
type: 'custom'
|
|
27
32
|
});
|
|
28
33
|
|
|
29
|
-
// 显示全屏按钮5s后隐藏
|
|
30
|
-
// showFullButtonAnd5sHide();
|
|
31
34
|
// 添加全屏后,返回竖屏的控件
|
|
32
35
|
addContent('top', {
|
|
33
36
|
id: VerticalScreenId,
|
|
34
37
|
content: VerticalScreen,
|
|
35
38
|
initProps: _objectSpread(_objectSpread({}, props), {}, {
|
|
36
|
-
onClick:
|
|
39
|
+
onClick: () => {
|
|
40
|
+
event.emit(showAllComponent);
|
|
41
|
+
handClick('vertical');
|
|
42
|
+
}
|
|
37
43
|
})
|
|
38
44
|
});
|
|
39
45
|
// 全屏后,添加语音对讲控件
|
|
40
46
|
addContent('absolute', {
|
|
41
47
|
id: VoiceIntercomId,
|
|
42
48
|
content: props => {
|
|
43
|
-
return /*#__PURE__*/React.createElement(
|
|
49
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
44
50
|
className: "ipc-player-plugin-full-screen-voice"
|
|
45
51
|
}, /*#__PURE__*/React.createElement(VoiceIntercom, props));
|
|
46
52
|
},
|
|
53
|
+
absoluteContentClassName: 'ipc-player-plugin-full-screen-voice-warp',
|
|
47
54
|
initProps: _objectSpread({}, props)
|
|
48
55
|
});
|
|
49
56
|
};
|
|
50
57
|
const handClick = target => {
|
|
51
58
|
const pageOrientation = target === 'vertical' ? 'portrait' : 'landscape';
|
|
52
59
|
setScreenType(target);
|
|
53
|
-
handFull(); // todo
|
|
54
60
|
setPageOrientation({
|
|
55
61
|
pageOrientation,
|
|
56
62
|
success: () => {
|
|
57
63
|
if (target === 'full') {
|
|
58
64
|
handFull();
|
|
65
|
+
event.emit(startTimeToHideAllComponent);
|
|
59
66
|
} else {
|
|
60
67
|
ty.setNavigationBarBack({
|
|
61
68
|
type: 'system'
|
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
position: absolute;
|
|
3
3
|
top: 50%;
|
|
4
4
|
transform: translateY(-50%);
|
|
5
|
-
right:
|
|
5
|
+
right: calc(16px * var(--ipc-player-size-scale, 1));
|
|
6
6
|
color: var(--iconColor);
|
|
7
|
-
font-size: var(--iconFontSize);
|
|
7
|
+
font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.ipc-player-plugin-full-screen-voice {
|
|
10
|
+
.ipc-player-plugin-full-screen-voice-warp {
|
|
11
11
|
position: absolute;
|
|
12
12
|
top: 50%;
|
|
13
|
-
transform:
|
|
14
|
-
right:
|
|
13
|
+
transform: translate(0, -50%);
|
|
14
|
+
right: calc(10px * var(--ipc-player-size-scale, 1));;
|
|
15
15
|
z-index: 3;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ipc-player-plugin-full-screen-voice {
|
|
19
|
+
transform: translate(0, 0);
|
|
20
|
+
transition: transform ease-in 0.3s;
|
|
21
|
+
&.ipc-player-plugin-full-screen-voice-hide {
|
|
22
|
+
transform: translate(180%, 0);
|
|
23
|
+
}
|
|
16
24
|
}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
padding: 10rpx;
|
|
4
4
|
top: 50%;
|
|
5
5
|
transform: translateY(-50%);
|
|
6
|
-
left: 24px;
|
|
6
|
+
// left: 24px;
|
|
7
|
+
left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
7
8
|
.ipc-player-plugin-vertical-screen-icon {
|
|
8
|
-
font-size: var(--iconFontSize);
|
|
9
|
+
// font-size: var(--iconFontSize);
|
|
10
|
+
font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
|
|
9
11
|
color: var(--iconColor);
|
|
10
12
|
}
|
|
11
13
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { CoverView } from '@ray-js/ray';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { VoiceIntercom as Component } from '../voiceIntercom';
|
|
6
|
+
import { useComponentHideState } from '../../ui/hooks';
|
|
7
|
+
import { UIEventContext } from '../../ui/context';
|
|
8
|
+
import { startTimeToHideAllComponent, pauseTimeToHideAllComponent } from '../../ui/constant';
|
|
9
|
+
import { useStore } from '../../ctx/store';
|
|
10
|
+
export function VoiceIntercom(props) {
|
|
11
|
+
const {
|
|
12
|
+
screenType
|
|
13
|
+
} = useStore({
|
|
14
|
+
screenType: props.screenType
|
|
15
|
+
});
|
|
16
|
+
const [shouldHide] = useComponentHideState(screenType);
|
|
17
|
+
const {
|
|
18
|
+
event
|
|
19
|
+
} = useContext(UIEventContext);
|
|
20
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
+
className: clsx('ipc-player-plugin-full-screen-voice', {
|
|
22
|
+
'ipc-player-plugin-full-screen-voice-hide': shouldHide
|
|
23
|
+
})
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
|
|
25
|
+
onTouchStart: () => {
|
|
26
|
+
event.emit(pauseTimeToHideAllComponent);
|
|
27
|
+
},
|
|
28
|
+
onTouchEnd: () => {
|
|
29
|
+
event.emit(startTimeToHideAllComponent);
|
|
30
|
+
}
|
|
31
|
+
})));
|
|
32
|
+
}
|
|
@@ -44,8 +44,8 @@ export const Muted = props => {
|
|
|
44
44
|
display: 'flex'
|
|
45
45
|
}
|
|
46
46
|
}, isMuted ? /*#__PURE__*/React.createElement(Text, {
|
|
47
|
-
className: "text-icon icon-panel icon-panel-jingyin"
|
|
47
|
+
className: "ipc-player-plugin-muted-text-icon icon-panel icon-panel-jingyin"
|
|
48
48
|
}) : /*#__PURE__*/React.createElement(Text, {
|
|
49
|
-
className: "text-icon icon-panel icon-panel-yinliang"
|
|
49
|
+
className: "ipc-player-plugin-muted-text-icon icon-panel icon-panel-yinliang"
|
|
50
50
|
}));
|
|
51
51
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
.ipc-player-plugin-record-video-icon {
|
|
2
|
-
font-size: var(--iconFontSize);
|
|
2
|
+
font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
|
|
3
3
|
color: var(--iconColor);
|
|
4
4
|
}
|
|
5
5
|
.ipc-player-plugin-record-video-toast {
|
|
6
6
|
z-index: 2;
|
|
7
7
|
position: absolute;
|
|
8
8
|
display: flex;
|
|
9
|
-
padding:
|
|
9
|
+
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
10
10
|
align-items: center;
|
|
11
11
|
left: 50%;
|
|
12
12
|
transform: translateX(-50%);
|
|
13
|
-
top:
|
|
13
|
+
top: calc(7px * var(--ipc-player-size-scale, 1));
|
|
14
14
|
background-color: var(--bg-color);
|
|
15
|
-
border-radius:
|
|
15
|
+
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
16
16
|
.ipc-player-plugin-record-video-toast-point {
|
|
17
|
-
width:
|
|
18
|
-
height:
|
|
19
|
-
border-radius:
|
|
17
|
+
width: calc(6px * var(--ipc-player-size-scale, 1));
|
|
18
|
+
height: calc(6px * var(--ipc-player-size-scale, 1));
|
|
19
|
+
border-radius: calc(6px * var(--ipc-player-size-scale, 1));
|
|
20
20
|
background-color: #FF3838;
|
|
21
21
|
}
|
|
22
22
|
.ipc-player-plugin-record-video-toast-time {
|
|
23
|
-
font-size:
|
|
23
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));;
|
|
24
24
|
font-weight: 600;
|
|
25
25
|
color: var(--fontColor);
|
|
26
|
-
margin-left:
|
|
26
|
+
margin-left: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
27
27
|
display: flex;
|
|
28
28
|
align-items: center;
|
|
29
29
|
.ipc-player-plugin-record-video-toast-time-warp {
|
|
30
|
-
width:
|
|
30
|
+
width: calc(17px * var(--ipc-player-size-scale, 1));;
|
|
31
31
|
text-align: center;
|
|
32
32
|
}
|
|
33
33
|
.ipc-player-plugin-record-video-toast-time-delimiter {
|
|
34
|
-
margin: 0
|
|
34
|
+
margin: 0 calc(2px * var(--ipc-player-size-scale, 1));;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
.ipc-player-plugin-screenshot-icon {
|
|
2
2
|
color: var(--iconColor);
|
|
3
|
-
font-size: var(--iconFontSize);
|
|
3
|
+
font-size: calc(var(--iconFontSize) * var(--ipc-player-size-scale, 1));
|
|
4
4
|
}
|
|
5
5
|
.ipc-player-plugin-screenshot-toast {
|
|
6
6
|
position: absolute;
|
|
7
7
|
width: 90%;
|
|
8
|
-
border-radius:
|
|
8
|
+
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
9
9
|
background-color: var(--bg-color);
|
|
10
10
|
left: 50%;
|
|
11
11
|
transform: translateX(-50%);
|
|
12
|
-
top:
|
|
12
|
+
top: calc(16px * var(--ipc-player-size-scale, 1));
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
|
-
padding:
|
|
15
|
+
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(16px * var(--ipc-player-size-scale, 1));
|
|
16
16
|
z-index: 3;
|
|
17
17
|
.ipc-player-plugin-screenshot-toast-image {
|
|
18
|
-
width:
|
|
19
|
-
height:
|
|
20
|
-
border-radius:
|
|
18
|
+
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
19
|
+
height: calc(37px * var(--ipc-player-size-scale, 1));
|
|
20
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
21
21
|
}
|
|
22
22
|
.ipc-player-plugin-screenshot-toast-title {
|
|
23
|
-
margin-left:
|
|
24
|
-
font-size:
|
|
23
|
+
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
24
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
25
25
|
color: var(--fontColor);
|
|
26
|
-
line-height:
|
|
26
|
+
line-height: calc(20px * var(--ipc-player-size-scale, 1));
|
|
27
27
|
max-width: 60%;
|
|
28
28
|
}
|
|
29
29
|
.ipc-player-plugin-screenshot-toast-bottom {
|
|
30
30
|
position: absolute;
|
|
31
|
-
right: 32rpx;
|
|
31
|
+
// right: 32rpx;
|
|
32
|
+
right: calc(16px * var(--ipc-player-size-scale, 1));
|
|
32
33
|
border: 1rpx solid #1989FA;
|
|
33
|
-
border-radius: 8rpx;
|
|
34
|
-
|
|
34
|
+
// border-radius: 8rpx;
|
|
35
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
36
|
+
// padding: 10rpx 22rpx;
|
|
37
|
+
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
35
38
|
color: #1989FA;
|
|
36
|
-
font-size: 28rpx;
|
|
39
|
+
// font-size: 28rpx;
|
|
40
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
37
41
|
}
|
|
38
42
|
}
|
|
@@ -17,22 +17,20 @@ export const TempHumidity = props => {
|
|
|
17
17
|
const tempRender = () => {
|
|
18
18
|
if (tempUnit === '1') {
|
|
19
19
|
return tempF && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
20
|
-
className: "text-icon
|
|
20
|
+
className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-wendu"
|
|
21
21
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
22
22
|
className: "tempHumidity"
|
|
23
23
|
}, tempF));
|
|
24
24
|
}
|
|
25
25
|
return tempC && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
26
|
-
className: "text-icon
|
|
27
|
-
}), /*#__PURE__*/React.createElement(Text, {
|
|
28
|
-
className: "tempHumidity"
|
|
29
|
-
}, tempC), /*#__PURE__*/React.createElement(Text, {
|
|
30
|
-
className: "divider"
|
|
26
|
+
className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-wendu"
|
|
27
|
+
}), /*#__PURE__*/React.createElement(Text, null, tempC), /*#__PURE__*/React.createElement(Text, {
|
|
28
|
+
className: "ipc-player-plugin-tempHumidity-divider"
|
|
31
29
|
}, "/"));
|
|
32
30
|
};
|
|
33
31
|
const humRender = () => {
|
|
34
32
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
|
|
35
|
-
className: "text-icon
|
|
33
|
+
className: "ipc-player-plugin-tempHumidity-text-icon icon-panel icon-panel-shidu"
|
|
36
34
|
}), /*#__PURE__*/React.createElement(Text, {
|
|
37
35
|
className: "tempHumidity"
|
|
38
36
|
}, `${humidity}`));
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
.ipc-player-plugin-tempHumidity {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
height: calc(24px * var(--ipc-player-size-scale, 1));
|
|
5
|
+
padding: 0 calc(8px * var(--ipc-player-size-scale, 1));
|
|
6
|
+
border-radius: calc(24px * var(--ipc-player-size-scale, 1));
|
|
6
7
|
opacity: 1;
|
|
7
8
|
background: rgba(255, 255, 255, 0.1);
|
|
8
9
|
backdrop-filter: blur(10px);
|
|
9
10
|
color: var(--iconColor);
|
|
11
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
.divider {
|
|
13
|
-
margin:
|
|
14
|
+
.ipc-player-plugin-tempHumidity-divider {
|
|
15
|
+
margin: calc(4px * var(--ipc-player-size-scale, 1));
|
|
14
16
|
color: var(--iconColor);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
.text-icon-tempHumidity {
|
|
19
|
+
// .text-icon-tempHumidity {
|
|
20
|
+
.ipc-player-plugin-tempHumidity-text-icon {
|
|
18
21
|
color: var(--iconColor);
|
|
19
|
-
font-size: var(--
|
|
20
|
-
margin-right:
|
|
22
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
23
|
+
margin-right: calc(2px * var(--ipc-player-size-scale, 1));
|
|
21
24
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
.videoBitKbps {
|
|
1
|
+
.ipc-player-plugin-videoBitKbps {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
height: calc(24px * var(--ipc-player-size-scale, 1));
|
|
5
|
+
padding: 0 calc(8px * var(--ipc-player-size-scale, 1));
|
|
6
|
+
border-radius: calc(24px * var(--ipc-player-size-scale, 1));
|
|
6
7
|
opacity: 1;
|
|
7
8
|
background: rgba(255, 255, 255, 0.1);
|
|
8
9
|
backdrop-filter: blur(10px);
|
|
9
|
-
margin-right: 8px;
|
|
10
10
|
color: var(--iconColor);
|
|
11
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
11
12
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TouchEventHandler } from '@ray-js/components/lib/types';
|
|
2
3
|
import './voiceIntercom.less';
|
|
3
4
|
import { ComponentConfigProps } from '../../interface';
|
|
4
5
|
type Props = ComponentConfigProps & {
|
|
5
6
|
style?: React.CSSProperties;
|
|
6
7
|
className?: string;
|
|
8
|
+
onTouchStart?: TouchEventHandler['onTouchStart'];
|
|
9
|
+
onTouchEnd?: TouchEventHandler['onTouchEnd'];
|
|
7
10
|
};
|
|
8
|
-
export declare function VoiceIntercom({ style, className, recording: recordingAtom, intercom: intercomAtom, setIntercom, mute: muteAtom, setMute, getStreamStatus, }: Props): React.JSX.Element;
|
|
11
|
+
export declare function VoiceIntercom({ style, className, recording: recordingAtom, intercom: intercomAtom, setIntercom, mute: muteAtom, setMute, getStreamStatus, onTouchStart, onTouchEnd, }: Props): React.JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -5,6 +5,7 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { useStore } from '../../ctx/store';
|
|
6
6
|
import './voiceIntercom.less';
|
|
7
7
|
import { PlayerStreamStatus } from '../../interface';
|
|
8
|
+
const NILL = () => null;
|
|
8
9
|
export function VoiceIntercom(_ref) {
|
|
9
10
|
let {
|
|
10
11
|
style,
|
|
@@ -14,7 +15,9 @@ export function VoiceIntercom(_ref) {
|
|
|
14
15
|
setIntercom,
|
|
15
16
|
mute: muteAtom,
|
|
16
17
|
setMute,
|
|
17
|
-
getStreamStatus
|
|
18
|
+
getStreamStatus,
|
|
19
|
+
onTouchStart = NILL,
|
|
20
|
+
onTouchEnd = NILL
|
|
18
21
|
} = _ref;
|
|
19
22
|
const {
|
|
20
23
|
recording,
|
|
@@ -61,12 +64,13 @@ export function VoiceIntercom(_ref) {
|
|
|
61
64
|
return /*#__PURE__*/React.createElement(View, {
|
|
62
65
|
style: _objectSpread({}, style),
|
|
63
66
|
className: clsx('ipc-player-plugin-voice-intercom', className),
|
|
67
|
+
onTouchStart: onTouchStart,
|
|
64
68
|
onLongClick: () => {
|
|
65
|
-
console.log('2222');
|
|
66
69
|
longClickStartedRef.current = true;
|
|
67
70
|
startVoice(!intercom, recording, mute);
|
|
68
71
|
},
|
|
69
|
-
onTouchEnd:
|
|
72
|
+
onTouchEnd: e => {
|
|
73
|
+
onTouchEnd(e);
|
|
70
74
|
if (!longClickStartedRef.current) return;
|
|
71
75
|
longClickStartedRef.current = false;
|
|
72
76
|
endVoice();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
.ipc-player-plugin-voice-intercom {
|
|
2
2
|
background: var(--ipc-player-plugin-voice-bg, radial-gradient(77% 77% at 34% 28%, #FF997C 0%, #FF592A 99%));
|
|
3
|
-
width:
|
|
4
|
-
height:
|
|
5
|
-
border-radius:
|
|
3
|
+
width: calc(72px * var(--ipc-player-size-scale, 1));
|
|
4
|
+
height: calc(72px * var(--ipc-player-size-scale, 1));
|
|
5
|
+
border-radius: calc(72px * var(--ipc-player-size-scale, 1));
|
|
6
6
|
display: flex;
|
|
7
7
|
justify-content: center;
|
|
8
8
|
align-items: center;
|
|
9
|
-
font-size:
|
|
9
|
+
font-size: calc(29px * var(--ipc-player-size-scale, 1));
|
|
10
|
+
color: #fff;
|
|
10
11
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CoverView, View } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useStore } from '../ctx/store';
|
|
5
|
+
import { useComponentHideState } from './hooks';
|
|
6
|
+
export function BottomContent(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
ctx,
|
|
9
|
+
children
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
screenType
|
|
13
|
+
} = useStore({
|
|
14
|
+
screenType: ctx.screenType,
|
|
15
|
+
playState: ctx.playState
|
|
16
|
+
});
|
|
17
|
+
const [shouldHide] = useComponentHideState(screenType);
|
|
18
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
19
|
+
className: "ipc-player-bottom-content-warp"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
21
|
+
style: {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
'--height': screenType === 'vertical' ? '48px' : '69px',
|
|
24
|
+
'--gap': '25px'
|
|
25
|
+
},
|
|
26
|
+
className: clsx('ipc-player-content-item', 'ipc-player-bottom-content', {
|
|
27
|
+
'ipc-player-bottom-content-hide': shouldHide
|
|
28
|
+
})
|
|
29
|
+
}, children));
|
|
30
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const showAllComponent = "showAllComponent";
|
|
2
|
+
export declare const hideAllComponent = "hideAllComponent";
|
|
3
|
+
export declare const playerTap = "playerTap";
|
|
4
|
+
export declare const pauseTimeToHideAllComponent = "pauseTimeToHideAllComponent";
|
|
5
|
+
export declare const startTimeToHideAllComponent = "startTimeToHideAllComponent";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const showAllComponent = 'showAllComponent';
|
|
2
|
+
export const hideAllComponent = 'hideAllComponent';
|
|
3
|
+
export const playerTap = 'playerTap';
|
|
4
|
+
export const pauseTimeToHideAllComponent = 'pauseTimeToHideAllComponent';
|
|
5
|
+
export const startTimeToHideAllComponent = 'startTimeToHideAllComponent';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Task = (...args: any[]) => void;
|
|
2
|
+
export type EventInstance = {
|
|
3
|
+
on: (type: string, cb: Task) => void;
|
|
4
|
+
off: (type: string, cb: Task) => void;
|
|
5
|
+
emit: (type: string, ...args: any[]) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function getEventInstance(): EventInstance;
|
|
8
|
+
export {};
|
package/lib/ui/event.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function getEventInstance() {
|
|
2
|
+
const map = {};
|
|
3
|
+
return {
|
|
4
|
+
on(type, cb) {
|
|
5
|
+
if (!map[type]) {
|
|
6
|
+
map[type] = [];
|
|
7
|
+
}
|
|
8
|
+
map[type].push(cb);
|
|
9
|
+
},
|
|
10
|
+
off(type, cb) {
|
|
11
|
+
if (map[type]) {
|
|
12
|
+
map[type] = map[type].filter(item => item !== cb);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
emit(type) {
|
|
16
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
17
|
+
args[_key - 1] = arguments[_key];
|
|
18
|
+
}
|
|
19
|
+
if (map[type]) {
|
|
20
|
+
map[type].forEach(cb => {
|
|
21
|
+
cb && cb.apply(null, ...args);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useComponentHideState(screenType: any): boolean[];
|
package/lib/ui/hooks.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useContext, useState, useEffect } from 'react';
|
|
2
|
+
import { UIEventContext } from './context';
|
|
3
|
+
import { hideAllComponent, showAllComponent } from './constant';
|
|
4
|
+
export function useComponentHideState(screenType) {
|
|
5
|
+
const {
|
|
6
|
+
event
|
|
7
|
+
} = useContext(UIEventContext);
|
|
8
|
+
const [shouldHide, setShouldHide] = useState(false);
|
|
9
|
+
const listenHideEvent = () => {
|
|
10
|
+
if (screenType === 'vertical') return;
|
|
11
|
+
setShouldHide(true);
|
|
12
|
+
};
|
|
13
|
+
const listenShowEvent = () => {
|
|
14
|
+
setShouldHide(false);
|
|
15
|
+
};
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
event.on(hideAllComponent, listenHideEvent);
|
|
18
|
+
event.on(showAllComponent, listenShowEvent);
|
|
19
|
+
return () => {
|
|
20
|
+
event.off(hideAllComponent, listenHideEvent);
|
|
21
|
+
event.off(showAllComponent, listenShowEvent);
|
|
22
|
+
};
|
|
23
|
+
}, [listenHideEvent]);
|
|
24
|
+
return [shouldHide];
|
|
25
|
+
}
|
package/lib/ui/index.d.ts
CHANGED
package/lib/ui/index.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CoverView, View } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useStore } from '../ctx/store';
|
|
5
|
+
import { useComponentHideState } from './hooks';
|
|
6
|
+
export function TopContent(_ref) {
|
|
7
|
+
let {
|
|
8
|
+
ctx,
|
|
9
|
+
children
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
screenType
|
|
13
|
+
} = useStore({
|
|
14
|
+
screenType: ctx.screenType,
|
|
15
|
+
playState: ctx.playState
|
|
16
|
+
});
|
|
17
|
+
const [shouldHide] = useComponentHideState(screenType);
|
|
18
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
19
|
+
className: "ipc-player-top-content-warp"
|
|
20
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
21
|
+
style: {
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
'--height': screenType === 'vertical' ? '48px' : '69px',
|
|
24
|
+
'--gap': '16px'
|
|
25
|
+
},
|
|
26
|
+
className: clsx('ipc-player-content-item', 'ipc-player-top-content', {
|
|
27
|
+
'ipc-player-top-content-hide': shouldHide
|
|
28
|
+
})
|
|
29
|
+
}, children));
|
|
30
|
+
}
|
package/lib/ui/ui.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ type CSSVariable = {
|
|
|
7
7
|
'--iconFontSize': string;
|
|
8
8
|
'--bg-color': string;
|
|
9
9
|
'--fontColor': string;
|
|
10
|
+
'--fontSize': string;
|
|
10
11
|
};
|
|
11
12
|
type Props = {
|
|
12
13
|
devId: string;
|
|
@@ -16,5 +17,5 @@ type Props = {
|
|
|
16
17
|
style?: React.CSSProperties;
|
|
17
18
|
CSSVariable?: Partial<CSSVariable>;
|
|
18
19
|
};
|
|
19
|
-
export declare const IPCPlayerIntegration: (props: Props) => React.JSX.Element
|
|
20
|
+
export declare const IPCPlayerIntegration: React.MemoExoticComponent<(props: Props) => React.JSX.Element>;
|
|
20
21
|
export {};
|
package/lib/ui/ui.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import React, { useRef } from 'react';
|
|
2
|
+
import React, { useRef, useMemo, useEffect, useCallback } from 'react';
|
|
3
3
|
import { View, CoverView, getSystemInfoSync } from '@ray-js/ray';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import IPCPlayer from '@ray-js/ray-ipc-player';
|
|
6
6
|
import { PlayState, PlayerStreamStatus } from '../interface';
|
|
7
7
|
import { useCtx } from '../ctx/ctx.composition';
|
|
8
|
-
import { useStore } from '../ctx/store';
|
|
8
|
+
import { useStore, getDefaultStore } from '../ctx/store';
|
|
9
|
+
import { getEventInstance } from './event';
|
|
10
|
+
import { UIEventContext } from './context';
|
|
11
|
+
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent } from './constant';
|
|
12
|
+
import { BottomContent } from './bottomContent';
|
|
13
|
+
import { TopContent } from './topContent';
|
|
9
14
|
import './ui.less';
|
|
10
15
|
function getCtxInstance(instance, devId) {
|
|
11
16
|
if (instance) return instance;
|
|
@@ -19,11 +24,13 @@ function getCtxInstance(instance, devId) {
|
|
|
19
24
|
|
|
20
25
|
const defaultCSSVariable = {
|
|
21
26
|
'--iconColor': '#fff',
|
|
22
|
-
'--iconFontSize': '
|
|
27
|
+
'--iconFontSize': '20px',
|
|
23
28
|
'--bg-color': '#000',
|
|
24
|
-
'--fontColor': '#fff'
|
|
29
|
+
'--fontColor': '#fff',
|
|
30
|
+
'--fontSize': '12px'
|
|
25
31
|
};
|
|
26
|
-
|
|
32
|
+
const HIDE_COMPONENT_TIME = 5000;
|
|
33
|
+
export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
27
34
|
const {
|
|
28
35
|
className,
|
|
29
36
|
devId,
|
|
@@ -34,6 +41,12 @@ export const IPCPlayerIntegration = props => {
|
|
|
34
41
|
const {
|
|
35
42
|
setPlayState
|
|
36
43
|
} = instance;
|
|
44
|
+
const prevTriggerEvent = useRef();
|
|
45
|
+
const eventRef = useRef();
|
|
46
|
+
const timer = useRef();
|
|
47
|
+
if (!eventRef.current) {
|
|
48
|
+
eventRef.current = getEventInstance();
|
|
49
|
+
}
|
|
37
50
|
const systemInfo = useRef(null);
|
|
38
51
|
if (!systemInfo.current) {
|
|
39
52
|
systemInfo.current = getSystemInfoSync();
|
|
@@ -51,30 +64,97 @@ export const IPCPlayerIntegration = props => {
|
|
|
51
64
|
screenType: instance.screenType,
|
|
52
65
|
playState: instance.playState
|
|
53
66
|
});
|
|
67
|
+
const renderTopContent = useMemo(() => {
|
|
68
|
+
if (!topContent || !(topContent !== null && topContent !== void 0 && topContent.length)) return null;
|
|
69
|
+
return topContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
70
|
+
key: item.id
|
|
71
|
+
}, item.initProps), instance), {}, {
|
|
72
|
+
IPCPlayerContext: instance.IPCPlayerInstance
|
|
73
|
+
})));
|
|
74
|
+
}, [topContent, instance]);
|
|
75
|
+
const renderBottomContent = useMemo(() => {
|
|
76
|
+
if (!bottomContent || !(bottomContent !== null && bottomContent !== void 0 && bottomContent.length)) return null;
|
|
77
|
+
return bottomContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({}, item.initProps), {}, {
|
|
78
|
+
key: item.id
|
|
79
|
+
}, instance), {}, {
|
|
80
|
+
IPCPlayerContext: instance.IPCPlayerInstance
|
|
81
|
+
})));
|
|
82
|
+
}, [bottomContent, instance]);
|
|
54
83
|
|
|
55
84
|
/**
|
|
56
85
|
* 视频流加载状态封装
|
|
57
86
|
*/
|
|
58
87
|
|
|
88
|
+
const handPlayerTap = useCallback(data => {
|
|
89
|
+
console.log('res===on onVideoTap', data);
|
|
90
|
+
const store = getDefaultStore();
|
|
91
|
+
const _screenType = store.get(instance.screenType);
|
|
92
|
+
eventRef.current.emit(playerTap);
|
|
93
|
+
if (_screenType === 'full') {
|
|
94
|
+
if (prevTriggerEvent.current === hideAllComponent) {
|
|
95
|
+
triggerEvent(showAllComponent);
|
|
96
|
+
} else {
|
|
97
|
+
triggerEvent(hideAllComponent);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, []);
|
|
101
|
+
const triggerEvent = type => {
|
|
102
|
+
const store = getDefaultStore();
|
|
103
|
+
const _screenType = store.get(instance.screenType);
|
|
104
|
+
if (prevTriggerEvent.current === type || _screenType === 'vertical') return;
|
|
105
|
+
if (timer.current) {
|
|
106
|
+
clearTimeout(timer.current);
|
|
107
|
+
timer.current = null;
|
|
108
|
+
}
|
|
109
|
+
if (type === showAllComponent) {
|
|
110
|
+
// @ts-ignore
|
|
111
|
+
timer.current = setTimeout(() => {
|
|
112
|
+
triggerEvent(hideAllComponent);
|
|
113
|
+
}, HIDE_COMPONENT_TIME);
|
|
114
|
+
}
|
|
115
|
+
eventRef.current.emit(type);
|
|
116
|
+
prevTriggerEvent.current = type;
|
|
117
|
+
};
|
|
118
|
+
const listenStart = useCallback(() => {
|
|
119
|
+
if (!timer.current) {
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
timer.current = setTimeout(() => {
|
|
122
|
+
triggerEvent(hideAllComponent);
|
|
123
|
+
}, HIDE_COMPONENT_TIME);
|
|
124
|
+
}
|
|
125
|
+
}, []);
|
|
126
|
+
const listenPause = useCallback(() => {
|
|
127
|
+
clearTimeout(timer.current);
|
|
128
|
+
timer.current = null;
|
|
129
|
+
}, []);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
eventRef.current.on(startTimeToHideAllComponent, listenStart);
|
|
132
|
+
return () => {
|
|
133
|
+
eventRef.current.off(startTimeToHideAllComponent, listenStart);
|
|
134
|
+
};
|
|
135
|
+
}, [listenStart]);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
eventRef.current.on(pauseTimeToHideAllComponent, listenPause);
|
|
138
|
+
return () => {
|
|
139
|
+
eventRef.current.off(pauseTimeToHideAllComponent, listenPause);
|
|
140
|
+
};
|
|
141
|
+
});
|
|
59
142
|
const playerReady = playState === PlayState.PLAYING;
|
|
60
|
-
return /*#__PURE__*/React.createElement(
|
|
143
|
+
return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
144
|
+
value: {
|
|
145
|
+
event: eventRef.current
|
|
146
|
+
}
|
|
147
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
61
148
|
className: clsx('ipc-player-content', className),
|
|
62
149
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
|
|
63
|
-
height: screenType === '
|
|
150
|
+
height: screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh'
|
|
64
151
|
})
|
|
65
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
66
|
-
style: {
|
|
67
|
-
width: '100%',
|
|
68
|
-
height: '100%'
|
|
69
|
-
}
|
|
70
152
|
}, /*#__PURE__*/React.createElement(IPCPlayer, {
|
|
71
|
-
objectFit: "
|
|
153
|
+
objectFit: "",
|
|
72
154
|
defaultMute: true,
|
|
73
155
|
devId: devId,
|
|
74
156
|
onlineStatus: true,
|
|
75
|
-
ipcPlayerContext: instance.IPCPlayerInstance
|
|
76
|
-
// updateLayout={`${playerLayout}`}
|
|
77
|
-
,
|
|
157
|
+
ipcPlayerContext: instance.IPCPlayerInstance,
|
|
78
158
|
onChangeStreamStatus: code => {
|
|
79
159
|
var _props$onPlayStatus;
|
|
80
160
|
const playStateMap = {
|
|
@@ -95,38 +175,39 @@ export const IPCPlayerIntegration = props => {
|
|
|
95
175
|
// onCtx={getIpcPlayer}
|
|
96
176
|
// onPlayerTap={handlePlayerClick}
|
|
97
177
|
,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})), /*#__PURE__*/React.createElement(CoverView, {
|
|
101
|
-
style: {
|
|
102
|
-
height: screenType === 'vertical' ? '48px' : '69px'
|
|
178
|
+
onZoomChange: () => {
|
|
179
|
+
console.log('res===onZoomChange');
|
|
103
180
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!topContent || !(topContent !== null && topContent !== void 0 && topContent.length)) return null;
|
|
107
|
-
return topContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
108
|
-
key: item.id
|
|
109
|
-
}, item.initProps), instance), {}, {
|
|
110
|
-
IPCPlayerContext: instance.IPCPlayerInstance
|
|
111
|
-
})));
|
|
112
|
-
})()), /*#__PURE__*/React.createElement(CoverView, {
|
|
113
|
-
style: {
|
|
114
|
-
height: screenType === 'vertical' ? '48px' : '69px'
|
|
181
|
+
onSessionDidDisconnected: () => {
|
|
182
|
+
console.log('res===onSessionDidDisconnected');
|
|
115
183
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
184
|
+
onCameraPreviewFailure: () => {
|
|
185
|
+
console.log('res===onCameraPreviewFailure');
|
|
186
|
+
},
|
|
187
|
+
onCameraNotifyWeakNetwork: () => {
|
|
188
|
+
console.log('res===onCameraNotifyWeakNetwork');
|
|
189
|
+
},
|
|
190
|
+
clarity: "hd",
|
|
191
|
+
privateState: false,
|
|
192
|
+
onPlayerTap: handPlayerTap // 对应原来的onVideoTap
|
|
193
|
+
}), playerReady && /*#__PURE__*/React.createElement(TopContent, {
|
|
194
|
+
ctx: instance
|
|
195
|
+
}, renderTopContent), playerReady && /*#__PURE__*/React.createElement(BottomContent, {
|
|
196
|
+
ctx: instance
|
|
197
|
+
}, renderBottomContent), playerReady && (() => {
|
|
125
198
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
126
|
-
return absoluteContent.map(item =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
199
|
+
return absoluteContent.map(item => {
|
|
200
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
201
|
+
key: item.id,
|
|
202
|
+
style: _objectSpread({
|
|
203
|
+
position: 'absolute'
|
|
204
|
+
}, item.absolutePosition),
|
|
205
|
+
className: item.absoluteContentClassName
|
|
206
|
+
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
207
|
+
key: item.id
|
|
208
|
+
}, item.initProps), instance), {}, {
|
|
209
|
+
IPCPlayerContext: instance.IPCPlayerInstance
|
|
210
|
+
})));
|
|
211
|
+
});
|
|
212
|
+
})()));
|
|
213
|
+
});
|
package/lib/ui/ui.less
CHANGED
|
@@ -1,44 +1,56 @@
|
|
|
1
1
|
.ipc-player-content {
|
|
2
2
|
position: relative;
|
|
3
|
+
overflow: hidden;
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
height: 100vw;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.ipc-player-top-content {
|
|
5
|
+
.ipc-player-top-content-warp {
|
|
9
6
|
position: absolute;
|
|
10
7
|
width: 100%;
|
|
11
8
|
left: 0;
|
|
12
9
|
top: 0;
|
|
13
|
-
|
|
14
|
-
z-index: 2;
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: flex-end;
|
|
17
|
-
align-items: center;
|
|
18
|
-
padding: 11rpx;
|
|
19
|
-
font-size: 24rpx;
|
|
20
|
-
box-sizing: border-box;
|
|
10
|
+
z-index: 100;
|
|
21
11
|
}
|
|
22
12
|
|
|
23
|
-
.ipc-player-bottom-content {
|
|
13
|
+
.ipc-player-bottom-content-warp {
|
|
24
14
|
position: absolute;
|
|
25
|
-
z-index:
|
|
26
|
-
display: flex;
|
|
15
|
+
z-index: 100;
|
|
27
16
|
width: 100%;
|
|
28
17
|
left: 0;
|
|
29
18
|
bottom: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.ipc-player-content-item {
|
|
22
|
+
--height: 48px;
|
|
23
|
+
--gap: 10px;
|
|
24
|
+
display: flex;
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: calc(var(--height) * var(--ipc-player-size-scale, 1));
|
|
30
27
|
align-items: center;
|
|
31
|
-
gap:
|
|
32
|
-
padding:
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
gap: calc(var(--gap) * var(--ipc-player-size-scale, 1));
|
|
29
|
+
padding: 0 calc(16px * var(--ipc-player-size-scale, 1));
|
|
30
|
+
transform: translate(0, 0);
|
|
31
|
+
transition: transform ease-in 0.3s;
|
|
32
|
+
|
|
33
|
+
&.ipc-player-top-content {
|
|
34
|
+
justify-content: flex-end;
|
|
35
|
+
|
|
36
|
+
&.ipc-player-top-content-hide {
|
|
37
|
+
transform: translate(0, -110%);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&.ipc-player-bottom-content {
|
|
42
|
+
&.ipc-player-bottom-content-hide {
|
|
43
|
+
transform: translate(0, 110%)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
|
|
49
|
+
|
|
38
50
|
.ipc-player-element-visible {
|
|
39
51
|
visibility: visible !important;
|
|
40
52
|
}
|
|
41
53
|
|
|
42
54
|
.ipc-player-element-hidden {
|
|
43
|
-
visibility: hidden !important;
|
|
55
|
+
// visibility: hidden !important;
|
|
44
56
|
}
|
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-7",
|
|
4
4
|
"description": "IPC 播放器功能集成",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -35,9 +35,10 @@
|
|
|
35
35
|
"@ray-js/ray": "^1.4.9"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ray-js/ray-ipc-player": "2.0.
|
|
38
|
+
"@ray-js/ray-ipc-player": "2.0.18-beta-beta-1",
|
|
39
|
+
"@ray-js/ray-ipc-utils": "1.1.0-beta-7",
|
|
39
40
|
"clsx": "^1.2.1",
|
|
40
|
-
"jotai": "^2.10.
|
|
41
|
+
"jotai": "^2.10.2"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@commitlint/cli": "^7.2.1",
|