@ray-js/ipc-player-integration 0.0.1-beta-5 → 0.0.1-beta-6
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/useVideoBitKbps/index.js +3 -27
- 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 +93 -3
- 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 +128 -48
- package/lib/ui/ui.less +28 -22
- package/lib/utils/ipcApi/index.d.ts +78 -0
- package/lib/utils/ipcApi/index.js +251 -0
- package/package.json +2 -2
|
@@ -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,96 @@ 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(() => {
|
|
89
|
+
const store = getDefaultStore();
|
|
90
|
+
const _screenType = store.get(instance.screenType);
|
|
91
|
+
eventRef.current.emit(playerTap);
|
|
92
|
+
if (_screenType === 'full') {
|
|
93
|
+
if (prevTriggerEvent.current === hideAllComponent) {
|
|
94
|
+
triggerEvent(showAllComponent);
|
|
95
|
+
} else {
|
|
96
|
+
triggerEvent(hideAllComponent);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
100
|
+
const triggerEvent = type => {
|
|
101
|
+
const store = getDefaultStore();
|
|
102
|
+
const _screenType = store.get(instance.screenType);
|
|
103
|
+
if (prevTriggerEvent.current === type || _screenType === 'vertical') return;
|
|
104
|
+
if (timer.current) {
|
|
105
|
+
clearTimeout(timer.current);
|
|
106
|
+
timer.current = null;
|
|
107
|
+
}
|
|
108
|
+
if (type === showAllComponent) {
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
timer.current = setTimeout(() => {
|
|
111
|
+
triggerEvent(hideAllComponent);
|
|
112
|
+
}, HIDE_COMPONENT_TIME);
|
|
113
|
+
}
|
|
114
|
+
eventRef.current.emit(type);
|
|
115
|
+
prevTriggerEvent.current = type;
|
|
116
|
+
};
|
|
117
|
+
const listenStart = useCallback(() => {
|
|
118
|
+
if (!timer.current) {
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
timer.current = setTimeout(() => {
|
|
121
|
+
triggerEvent(hideAllComponent);
|
|
122
|
+
}, HIDE_COMPONENT_TIME);
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
const listenPause = useCallback(() => {
|
|
126
|
+
clearTimeout(timer.current);
|
|
127
|
+
timer.current = null;
|
|
128
|
+
}, []);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
eventRef.current.on(startTimeToHideAllComponent, listenStart);
|
|
131
|
+
return () => {
|
|
132
|
+
eventRef.current.off(startTimeToHideAllComponent, listenStart);
|
|
133
|
+
};
|
|
134
|
+
}, [listenStart]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
eventRef.current.on(pauseTimeToHideAllComponent, listenPause);
|
|
137
|
+
return () => {
|
|
138
|
+
eventRef.current.off(pauseTimeToHideAllComponent, listenPause);
|
|
139
|
+
};
|
|
140
|
+
});
|
|
59
141
|
const playerReady = playState === PlayState.PLAYING;
|
|
60
|
-
return /*#__PURE__*/React.createElement(
|
|
142
|
+
return /*#__PURE__*/React.createElement(UIEventContext.Provider, {
|
|
143
|
+
value: {
|
|
144
|
+
event: eventRef.current
|
|
145
|
+
}
|
|
146
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
61
147
|
className: clsx('ipc-player-content', className),
|
|
62
148
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
|
|
63
|
-
height: screenType === '
|
|
149
|
+
height: screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh'
|
|
64
150
|
})
|
|
65
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
66
|
-
style: {
|
|
67
|
-
width: '100%',
|
|
68
|
-
height: '100%'
|
|
69
|
-
}
|
|
70
151
|
}, /*#__PURE__*/React.createElement(IPCPlayer, {
|
|
71
|
-
objectFit: "
|
|
152
|
+
objectFit: "",
|
|
72
153
|
defaultMute: true,
|
|
73
154
|
devId: devId,
|
|
74
155
|
onlineStatus: true,
|
|
75
|
-
ipcPlayerContext: instance.IPCPlayerInstance
|
|
76
|
-
// updateLayout={`${playerLayout}`}
|
|
77
|
-
,
|
|
156
|
+
ipcPlayerContext: instance.IPCPlayerInstance,
|
|
78
157
|
onChangeStreamStatus: code => {
|
|
79
158
|
var _props$onPlayStatus;
|
|
80
159
|
const playStateMap = {
|
|
@@ -95,38 +174,39 @@ export const IPCPlayerIntegration = props => {
|
|
|
95
174
|
// onCtx={getIpcPlayer}
|
|
96
175
|
// onPlayerTap={handlePlayerClick}
|
|
97
176
|
,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})), /*#__PURE__*/React.createElement(CoverView, {
|
|
101
|
-
style: {
|
|
102
|
-
height: screenType === 'vertical' ? '48px' : '69px'
|
|
177
|
+
onZoomChange: () => {
|
|
178
|
+
console.log('res===onZoomChange');
|
|
103
179
|
},
|
|
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'
|
|
180
|
+
onSessionDidDisconnected: () => {
|
|
181
|
+
console.log('res===onSessionDidDisconnected');
|
|
115
182
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
183
|
+
onCameraPreviewFailure: () => {
|
|
184
|
+
console.log('res===onCameraPreviewFailure');
|
|
185
|
+
},
|
|
186
|
+
onCameraNotifyWeakNetwork: () => {
|
|
187
|
+
console.log('res===onCameraNotifyWeakNetwork');
|
|
188
|
+
},
|
|
189
|
+
clarity: "hd",
|
|
190
|
+
privateState: false,
|
|
191
|
+
onPlayerTap: handPlayerTap
|
|
192
|
+
}), playerReady && /*#__PURE__*/React.createElement(TopContent, {
|
|
193
|
+
ctx: instance
|
|
194
|
+
}, renderTopContent), playerReady && /*#__PURE__*/React.createElement(BottomContent, {
|
|
195
|
+
ctx: instance
|
|
196
|
+
}, renderBottomContent), playerReady && (() => {
|
|
125
197
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
126
|
-
return absoluteContent.map(item =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
198
|
+
return absoluteContent.map(item => {
|
|
199
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
200
|
+
key: item.id,
|
|
201
|
+
style: _objectSpread({
|
|
202
|
+
position: 'absolute'
|
|
203
|
+
}, item.absolutePosition),
|
|
204
|
+
className: item.absoluteContentClassName
|
|
205
|
+
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
206
|
+
key: item.id
|
|
207
|
+
}, item.initProps), instance), {}, {
|
|
208
|
+
IPCPlayerContext: instance.IPCPlayerInstance
|
|
209
|
+
})));
|
|
210
|
+
});
|
|
211
|
+
})()));
|
|
212
|
+
});
|
package/lib/ui/ui.less
CHANGED
|
@@ -1,40 +1,46 @@
|
|
|
1
1
|
.ipc-player-content {
|
|
2
2
|
position: relative;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
height: 100vw;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.ipc-player-top-content {
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
.ipc-player-top-content-warp {
|
|
9
5
|
position: absolute;
|
|
10
6
|
width: 100%;
|
|
11
7
|
left: 0;
|
|
12
8
|
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;
|
|
9
|
+
z-index: 100;
|
|
21
10
|
}
|
|
22
|
-
|
|
23
|
-
.ipc-player-bottom-content {
|
|
11
|
+
.ipc-player-bottom-content-warp {
|
|
24
12
|
position: absolute;
|
|
25
|
-
z-index:
|
|
26
|
-
display: flex;
|
|
13
|
+
z-index: 100;
|
|
27
14
|
width: 100%;
|
|
28
15
|
left: 0;
|
|
29
16
|
bottom: 0;
|
|
17
|
+
}
|
|
18
|
+
.ipc-player-content-item {
|
|
19
|
+
--height: 48px;
|
|
20
|
+
--gap: 10px;
|
|
21
|
+
display: flex;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: calc(var(--height) * var(--ipc-player-size-scale, 1));
|
|
30
24
|
align-items: center;
|
|
31
|
-
gap:
|
|
32
|
-
padding:
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
gap: calc(var(--gap) * var(--ipc-player-size-scale, 1));
|
|
26
|
+
padding: 0 calc(16px * var(--ipc-player-size-scale, 1));
|
|
27
|
+
transform: translate(0, 0);
|
|
28
|
+
transition: transform ease-in 0.3s;
|
|
29
|
+
&.ipc-player-top-content {
|
|
30
|
+
justify-content: flex-end;
|
|
31
|
+
&.ipc-player-top-content-hide {
|
|
32
|
+
transform: translate(0, -110%);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
&.ipc-player-bottom-content {
|
|
36
|
+
&.ipc-player-bottom-content-hide {
|
|
37
|
+
transform: translate(0, 110%)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
43
|
+
|
|
38
44
|
.ipc-player-element-visible {
|
|
39
45
|
visibility: visible !important;
|
|
40
46
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export interface IApiError {
|
|
2
|
+
errorMsg: string;
|
|
3
|
+
errorCode: string;
|
|
4
|
+
innerError: {
|
|
5
|
+
errorMsg: string;
|
|
6
|
+
errorCode: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 获取信号强度
|
|
11
|
+
* @param devId
|
|
12
|
+
* @param dps 扩展参数
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const requestWifiSignal: <T>(devId: string, dps?: {}) => Promise<IApiError | T>;
|
|
16
|
+
/**
|
|
17
|
+
* 获取视频码率
|
|
18
|
+
* @param devId
|
|
19
|
+
* @param extendParam 扩展参数
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare const getVideoBitrateKbps: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
|
|
23
|
+
export declare const addCameraDeviceObserver: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
|
|
24
|
+
export declare const networkStatusDidChangedEvent: (callback: any) => void;
|
|
25
|
+
/**
|
|
26
|
+
* IPC-低功耗唤醒:低功耗唤醒,唤醒门铃设备
|
|
27
|
+
* 需引入DeviceKit,且在>=3.1.0-ipcwake.1版本才可使用
|
|
28
|
+
* @param devId
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export declare const wakeUpDevice: <T>(devId: string, dps?: {}) => Promise<IApiError | T>;
|
|
32
|
+
/**
|
|
33
|
+
* 画中画:是否支持画中画:只有安卓在用
|
|
34
|
+
* 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
|
|
35
|
+
* @param devId
|
|
36
|
+
* @param extendParam 扩展参数
|
|
37
|
+
* @returns
|
|
38
|
+
*/
|
|
39
|
+
export declare const getMobileOrientation: <T>() => Promise<IApiError | T>;
|
|
40
|
+
/**
|
|
41
|
+
* 屏幕旋转设置,auto(暂不支持) / portrait / landscape。pad 模式下不支持屏幕旋转
|
|
42
|
+
* 需引入MiniKit,且在>=2.4.1版本才可使用
|
|
43
|
+
* @param pageOrientation
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
export declare const setScreenOrientation: <T>(pageOrientation: string) => Promise<IApiError | T>;
|
|
47
|
+
/**
|
|
48
|
+
* 画中画:是否支持画中画:只有安卓在用
|
|
49
|
+
* 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
|
|
50
|
+
* @param devId
|
|
51
|
+
* @param extendParam 扩展参数
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
export declare const isSupportFloatWindow: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
|
|
55
|
+
/**
|
|
56
|
+
* 画中画:开启画中画
|
|
57
|
+
* 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
|
|
58
|
+
* @param devId
|
|
59
|
+
* @param extendParam 扩展参数
|
|
60
|
+
* @returns
|
|
61
|
+
*/
|
|
62
|
+
export declare const openFloatWindow: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
|
|
63
|
+
/**
|
|
64
|
+
* IPC-APP 缓存支持的对讲方式:是否支持对讲
|
|
65
|
+
* 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
|
|
66
|
+
* @param devId
|
|
67
|
+
* @param extendParam 扩展参数
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
export declare const isSupportedTalk: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
|
|
71
|
+
/**
|
|
72
|
+
* 设备支持的对讲模式
|
|
73
|
+
* 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
|
|
74
|
+
* @param devId
|
|
75
|
+
* @param extendParam 扩展参数
|
|
76
|
+
* @returns 设备支持的对讲模式。回掉方法的参数为数值型,0 未知;1:单向对讲;2:双向对讲。
|
|
77
|
+
*/
|
|
78
|
+
export declare const getCurrentSupportedTalkMode: <T>(devId: string, extendParam?: {}) => Promise<IApiError | T>;
|