@ray-js/ipc-player-integration 0.0.1-beta-21 → 0.0.1-beta-22
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 +19 -9
- package/lib/ctx/ctx.d.ts +5 -3
- package/lib/ctx/ctx.js +43 -22
- package/lib/ctx/store.d.ts +1 -1
- package/lib/ctx/store.js +1 -1
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +8 -2
- package/lib/interface.d.ts +11 -7
- package/lib/plugins/battery/battery.composition.d.ts +47 -5
- package/lib/plugins/battery/battery.composition.js +4 -0
- package/lib/plugins/battery/battery.js +9 -9
- package/lib/plugins/battery/battery.less +4 -14
- package/lib/plugins/battery/batteryFull.d.ts +13 -0
- package/lib/plugins/battery/batteryFull.js +46 -0
- package/lib/plugins/fullScreen/fullScreen.js +11 -7
- package/lib/plugins/fullScreen/fullScreen.less +7 -7
- package/lib/plugins/fullScreen/verticalScreen.d.ts +1 -1
- package/lib/plugins/fullScreen/verticalScreen.js +8 -5
- package/lib/plugins/fullScreen/verticalScreen.less +7 -12
- package/lib/plugins/index.d.ts +3 -1
- package/lib/plugins/index.js +6 -2
- package/lib/plugins/muted/muted.js +4 -4
- package/lib/plugins/muted/muted.less +8 -1
- package/lib/plugins/ptz/ptz.js +5 -21
- package/lib/plugins/ptz/ptz.less +1 -1
- package/lib/plugins/ptz/ptzControl.js +1 -3
- package/lib/plugins/recordVideo/recordVideo.js +8 -7
- package/lib/plugins/recordVideo/recordVideo.less +2 -2
- package/lib/plugins/resolution/fullResolutionControl.js +0 -1
- package/lib/plugins/resolution/resolution.js +6 -3
- package/lib/plugins/resolution/resolution.less +4 -3
- package/lib/plugins/screenshot/screenshot.js +40 -16
- package/lib/plugins/screenshot/screenshot.less +28 -23
- package/lib/plugins/smallIntercom/index.d.ts +1 -0
- package/lib/plugins/smallIntercom/index.js +1 -0
- package/lib/plugins/smallIntercom/smallIntercom.d.ts +6 -0
- package/lib/plugins/smallIntercom/smallIntercom.js +49 -0
- package/lib/plugins/smallIntercom/smallIntercom.less +50 -0
- package/lib/plugins/tempHumidity/tempHumidity.d.ts +1 -1
- package/lib/plugins/tempHumidity/tempHumidity.js +12 -4
- package/lib/plugins/videoBitKBP/index.d.ts +1 -0
- package/lib/plugins/videoBitKBP/index.js +1 -0
- package/lib/plugins/{videoBitKbps/videoBitKbps.d.ts → videoBitKBP/videoBitKBP.d.ts} +2 -2
- package/lib/plugins/{videoBitKbps/videoBitKbps.js → videoBitKBP/videoBitKBP.js} +14 -7
- package/lib/plugins/{videoBitKbps/videoBitKbps.less → videoBitKBP/videoBitKBP.less} +4 -5
- package/lib/ui/bottomLeftContent.d.ts +8 -0
- package/lib/ui/{topContent.js → bottomLeftContent.js} +10 -9
- package/lib/ui/bottomRightContent.d.ts +8 -0
- package/lib/ui/bottomRightContent.js +33 -0
- package/lib/ui/constant.d.ts +1 -0
- package/lib/ui/constant.js +2 -1
- package/lib/ui/hooks.d.ts +1 -1
- package/lib/ui/hooks.js +4 -3
- package/lib/ui/{bottomContent.d.ts → topLeftContent.d.ts} +2 -2
- package/lib/ui/topLeftContent.js +37 -0
- package/lib/ui/{topContent.d.ts → topRightContent.d.ts} +2 -2
- package/lib/ui/{bottomContent.js → topRightContent.js} +10 -9
- package/lib/ui/ui.d.ts +3 -0
- package/lib/ui/ui.js +97 -37
- package/lib/ui/ui.less +162 -25
- package/package.json +6 -8
- package/lib/plugins/videoBitKbps/index.d.ts +0 -1
- package/lib/plugins/videoBitKbps/index.js +0 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { View } from '@ray-js/ray';
|
|
3
|
-
import '
|
|
3
|
+
import clsx from 'clsx';
|
|
4
4
|
import IpcUtils from '@ray-js/ray-ipc-utils';
|
|
5
5
|
import { PlayState } from '../../interface';
|
|
6
|
+
import './videoBitKBP.less';
|
|
6
7
|
import { useStore } from '../../ctx/store';
|
|
7
|
-
export const
|
|
8
|
+
export const VideoBitKBP = props => {
|
|
8
9
|
const {
|
|
9
10
|
devId,
|
|
10
|
-
playState
|
|
11
|
+
playState,
|
|
12
|
+
className
|
|
11
13
|
} = props;
|
|
12
|
-
const [
|
|
14
|
+
const [bitKBP, setBitKBP] = useState('');
|
|
13
15
|
const store = useStore({
|
|
14
16
|
playState
|
|
15
17
|
});
|
|
@@ -28,10 +30,15 @@ export const VideoBitKbps = props => {
|
|
|
28
30
|
const init = async () => {
|
|
29
31
|
const res = await IpcUtils.getVideoBitrateKbps(devId);
|
|
30
32
|
if (res.code !== -1) {
|
|
31
|
-
|
|
33
|
+
setBitKBP(`${res.data.kbps}KB/S`);
|
|
32
34
|
}
|
|
33
35
|
};
|
|
36
|
+
if (bitKBP === '') {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
34
39
|
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
-
className:
|
|
36
|
-
},
|
|
40
|
+
className: clsx(className)
|
|
41
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
42
|
+
className: "ipc-player-plugin-videoBitKBP"
|
|
43
|
+
}, bitKBP));
|
|
37
44
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
.ipc-player-plugin-
|
|
1
|
+
.ipc-player-plugin-videoBitKBP {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
height: calc(24px * var(--ipc-player-size-scale, 1));
|
|
5
|
-
padding: 0 calc(
|
|
5
|
+
padding: 0 calc(9px * var(--ipc-player-size-scale, 1));
|
|
6
6
|
border-radius: calc(24px * var(--ipc-player-size-scale, 1));
|
|
7
|
-
opacity: 1;
|
|
8
|
-
background: rgba(255, 255, 255, 0.1);
|
|
9
|
-
backdrop-filter: blur(10px);
|
|
10
7
|
color: var(--iconColor);
|
|
11
8
|
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
9
|
+
background-color: rgba(255, 255, 255, 0.3);
|
|
10
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
12
11
|
}
|
|
@@ -3,7 +3,7 @@ import { CoverView, View } from '@ray-js/ray';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useStore } from '../ctx/store';
|
|
5
5
|
import { useComponentHideState } from './hooks';
|
|
6
|
-
|
|
6
|
+
const BottomLeftContent = _ref => {
|
|
7
7
|
let {
|
|
8
8
|
ctx,
|
|
9
9
|
children
|
|
@@ -18,15 +18,16 @@ export function TopContent(_ref) {
|
|
|
18
18
|
});
|
|
19
19
|
const [shouldHide] = useComponentHideState(screenType);
|
|
20
20
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
-
className:
|
|
21
|
+
className: clsx('ipc-player-bottom-left-content-wrap', {
|
|
22
|
+
'ipc-player-bottom-left-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
+
'ipc-player-bottom-left-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
+
})
|
|
22
25
|
}, /*#__PURE__*/React.createElement(View, {
|
|
23
26
|
style: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'--gap': '16px'
|
|
27
|
+
paddingBottom: screenType === 'vertical' ? '14px' : '20px',
|
|
28
|
+
paddingLeft: screenType === 'vertical' ? 0 : '25px'
|
|
27
29
|
},
|
|
28
|
-
className: clsx('ipc-player-
|
|
29
|
-
'ipc-player-top-content-hide': shouldHide || fullResolutionActive
|
|
30
|
-
})
|
|
30
|
+
className: clsx('ipc-player-bottom-left-content-container')
|
|
31
31
|
}, children));
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
|
+
export default BottomLeftContent;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UseCtx } from '../interface';
|
|
3
|
+
type Props = {
|
|
4
|
+
ctx: ReturnType<UseCtx>;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
declare const BottomRightContent: ({ ctx, children }: Props) => React.JSX.Element;
|
|
8
|
+
export default BottomRightContent;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
const BottomRightContent = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
ctx,
|
|
9
|
+
children
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
screenType,
|
|
13
|
+
fullResolutionActive
|
|
14
|
+
} = useStore({
|
|
15
|
+
screenType: ctx.screenType,
|
|
16
|
+
playState: ctx.playState,
|
|
17
|
+
fullResolutionActive: ctx.fullResolutionActive
|
|
18
|
+
});
|
|
19
|
+
const [shouldHide] = useComponentHideState(screenType);
|
|
20
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
+
className: clsx('ipc-player-bottom-right-content-wrap', {
|
|
22
|
+
'ipc-player-bottom-right-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
+
'ipc-player-bottom-right-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
+
})
|
|
25
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
26
|
+
style: {
|
|
27
|
+
paddingBottom: screenType === 'vertical' ? '14px' : '20px',
|
|
28
|
+
paddingRight: screenType === 'vertical' ? 0 : '25px'
|
|
29
|
+
},
|
|
30
|
+
className: clsx('ipc-player-bottom-right-content-container')
|
|
31
|
+
}, children));
|
|
32
|
+
};
|
|
33
|
+
export default BottomRightContent;
|
package/lib/ui/constant.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export declare const voiceIntercomId = "voiceIntercomId";
|
|
|
7
7
|
export declare const verticalScreenId = "verticalScreenId";
|
|
8
8
|
export declare const ptzControlId = "ptzControlId";
|
|
9
9
|
export declare const fullResolutionId = "fullResolutionId";
|
|
10
|
+
export declare const batteryId = "Battery";
|
package/lib/ui/constant.js
CHANGED
|
@@ -6,4 +6,5 @@ export const startTimeToHideAllComponent = 'startTimeToHideAllComponent';
|
|
|
6
6
|
export const voiceIntercomId = 'voiceIntercomId';
|
|
7
7
|
export const verticalScreenId = 'verticalScreenId';
|
|
8
8
|
export const ptzControlId = 'ptzControlId';
|
|
9
|
-
export const fullResolutionId = 'fullResolutionId';
|
|
9
|
+
export const fullResolutionId = 'fullResolutionId';
|
|
10
|
+
export const batteryId = 'Battery';
|
package/lib/ui/hooks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const useComponentHideState: (screenType: any) => boolean[];
|
package/lib/ui/hooks.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useContext, useState, useEffect } from 'react';
|
|
2
2
|
import { UIEventContext } from './context';
|
|
3
3
|
import { hideAllComponent, showAllComponent } from './constant';
|
|
4
|
-
export
|
|
4
|
+
export const useComponentHideState = () => {
|
|
5
5
|
const {
|
|
6
6
|
event
|
|
7
7
|
} = useContext(UIEventContext);
|
|
8
8
|
const [shouldHide, setShouldHide] = useState(false);
|
|
9
9
|
const listenHideEvent = () => {
|
|
10
|
-
|
|
10
|
+
// 横竖屏都支持点击隐藏
|
|
11
|
+
// if (screenType === 'vertical') return;
|
|
11
12
|
setShouldHide(true);
|
|
12
13
|
};
|
|
13
14
|
const listenShowEvent = () => {
|
|
@@ -22,4 +23,4 @@ export function useComponentHideState(screenType) {
|
|
|
22
23
|
};
|
|
23
24
|
}, [listenHideEvent]);
|
|
24
25
|
return [shouldHide];
|
|
25
|
-
}
|
|
26
|
+
};
|
|
@@ -4,5 +4,5 @@ type Props = {
|
|
|
4
4
|
ctx: ReturnType<UseCtx>;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
declare const TopLeftContent: ({ ctx, children }: Props) => React.JSX.Element;
|
|
8
|
+
export default TopLeftContent;
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
const TopLeftContent = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
ctx,
|
|
9
|
+
children
|
|
10
|
+
} = _ref;
|
|
11
|
+
const {
|
|
12
|
+
screenType,
|
|
13
|
+
fullResolutionActive
|
|
14
|
+
} = useStore({
|
|
15
|
+
screenType: ctx.screenType,
|
|
16
|
+
playState: ctx.playState,
|
|
17
|
+
fullResolutionActive: ctx.fullResolutionActive
|
|
18
|
+
});
|
|
19
|
+
const [shouldHide] = useComponentHideState(screenType);
|
|
20
|
+
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
+
className: clsx('ipc-player-top-left-content-wrap', {
|
|
22
|
+
'ipc-player-top-left-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
+
'ipc-player-top-left-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
+
})
|
|
25
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
26
|
+
style: {
|
|
27
|
+
paddingTop: screenType === 'vertical' ? '12px' : '16px',
|
|
28
|
+
paddingLeft: screenType === 'vertical' ? 0 : '25px'
|
|
29
|
+
}
|
|
30
|
+
// className={clsx('ipc-player-content-item', 'ipc-player-top-content', {
|
|
31
|
+
// 'ipc-player-top-content-hide': shouldHide || fullResolutionActive,
|
|
32
|
+
// })}
|
|
33
|
+
,
|
|
34
|
+
className: clsx('ipc-player-top-left-content-container')
|
|
35
|
+
}, children));
|
|
36
|
+
};
|
|
37
|
+
export default TopLeftContent;
|
|
@@ -4,5 +4,5 @@ type Props = {
|
|
|
4
4
|
ctx: ReturnType<UseCtx>;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
declare const TopRightContent: ({ ctx, children }: Props) => React.JSX.Element;
|
|
8
|
+
export default TopRightContent;
|
|
@@ -3,7 +3,7 @@ import { CoverView, View } from '@ray-js/ray';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useStore } from '../ctx/store';
|
|
5
5
|
import { useComponentHideState } from './hooks';
|
|
6
|
-
|
|
6
|
+
const TopRightContent = _ref => {
|
|
7
7
|
let {
|
|
8
8
|
ctx,
|
|
9
9
|
children
|
|
@@ -18,15 +18,16 @@ export function BottomContent(_ref) {
|
|
|
18
18
|
});
|
|
19
19
|
const [shouldHide] = useComponentHideState(screenType);
|
|
20
20
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
21
|
-
className:
|
|
21
|
+
className: clsx('ipc-player-top-right-content-wrap', {
|
|
22
|
+
'ipc-player-top-right-content-hide': shouldHide || fullResolutionActive,
|
|
23
|
+
'ipc-player-top-right-content-show': !shouldHide && !fullResolutionActive
|
|
24
|
+
})
|
|
22
25
|
}, /*#__PURE__*/React.createElement(View, {
|
|
23
26
|
style: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'--gap': '25px'
|
|
27
|
+
paddingTop: screenType === 'vertical' ? '12px' : '16px',
|
|
28
|
+
paddingRight: screenType === 'vertical' ? 0 : '25px'
|
|
27
29
|
},
|
|
28
|
-
className: clsx('ipc-player-
|
|
29
|
-
'ipc-player-bottom-content-hide': shouldHide || fullResolutionActive
|
|
30
|
-
})
|
|
30
|
+
className: clsx('ipc-player-top-right-content-container')
|
|
31
31
|
}, children));
|
|
32
|
-
}
|
|
32
|
+
};
|
|
33
|
+
export default TopRightContent;
|
package/lib/ui/ui.d.ts
CHANGED
|
@@ -6,7 +6,10 @@ type CSSVariable = {
|
|
|
6
6
|
'--iconColor': string;
|
|
7
7
|
'--iconActiveColor': string;
|
|
8
8
|
'--iconFontSize': string;
|
|
9
|
+
'--iconPlayerSize': string;
|
|
10
|
+
'--iconBoxSize': string;
|
|
9
11
|
'--bg-color': string;
|
|
12
|
+
'--shot-card-bg-color': string;
|
|
10
13
|
'--fontColor': string;
|
|
11
14
|
'--fontSize': string;
|
|
12
15
|
};
|
package/lib/ui/ui.js
CHANGED
|
@@ -9,8 +9,10 @@ import { useStore, getDefaultStore } from '../ctx/store';
|
|
|
9
9
|
import { getEventInstance } from './event';
|
|
10
10
|
import { UIEventContext } from './context';
|
|
11
11
|
import { showAllComponent, hideAllComponent, playerTap, startTimeToHideAllComponent, pauseTimeToHideAllComponent } from './constant';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import BottomLeftContent from './bottomLeftContent';
|
|
13
|
+
import BottomRightContent from './bottomRightContent';
|
|
14
|
+
import TopLeftContent from './topLeftContent';
|
|
15
|
+
import TopRightContent from './topRightContent';
|
|
14
16
|
import './ui.less';
|
|
15
17
|
function getCtxInstance(instance, devId) {
|
|
16
18
|
if (instance) return instance;
|
|
@@ -27,13 +29,15 @@ const defaultCSSVariable = {
|
|
|
27
29
|
// 有需要点击呈现不同颜色的icon
|
|
28
30
|
'--iconActiveColor': '#ec653c',
|
|
29
31
|
'--iconFontSize': '20px',
|
|
32
|
+
'--iconPlayerSize': '22px',
|
|
33
|
+
'--iconBoxSize': '24px',
|
|
30
34
|
'--bg-color': '#000',
|
|
35
|
+
'--shot-card-bg-color': '#262626',
|
|
31
36
|
'--fontColor': '#fff',
|
|
32
37
|
'--fontSize': '12px'
|
|
33
38
|
};
|
|
34
39
|
const HIDE_COMPONENT_TIME = 5000;
|
|
35
40
|
export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
36
|
-
console.log(props, 'props');
|
|
37
41
|
const {
|
|
38
42
|
className,
|
|
39
43
|
devId,
|
|
@@ -73,8 +77,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
73
77
|
systemInfo.current = getSystemInfoSync();
|
|
74
78
|
}
|
|
75
79
|
const {
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
topLeftContent,
|
|
81
|
+
topRightContent,
|
|
82
|
+
bottomLeftContent,
|
|
83
|
+
bottomRightContent,
|
|
78
84
|
absoluteContent,
|
|
79
85
|
screenType,
|
|
80
86
|
playState,
|
|
@@ -82,8 +88,10 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
82
88
|
resolution,
|
|
83
89
|
mute
|
|
84
90
|
} = useStore({
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
topLeftContent: instance.topLeftContent,
|
|
92
|
+
topRightContent: instance.topRightContent,
|
|
93
|
+
bottomLeftContent: instance.bottomLeftContent,
|
|
94
|
+
bottomRightContent: instance.bottomRightContent,
|
|
87
95
|
absoluteContent: instance.absoluteContent,
|
|
88
96
|
screenType: instance.screenType,
|
|
89
97
|
playState: instance.playState,
|
|
@@ -91,22 +99,66 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
91
99
|
resolution: instance.resolution,
|
|
92
100
|
mute: instance.mute
|
|
93
101
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 渲染随机定位播放器内容
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 渲染播放器左上角内容
|
|
109
|
+
*/
|
|
110
|
+
const renderTopLeftContent = useMemo(() => {
|
|
111
|
+
if (!topLeftContent || !(topLeftContent !== null && topLeftContent !== void 0 && topLeftContent.length)) return null;
|
|
112
|
+
return topLeftContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
113
|
+
key: item.id
|
|
114
|
+
}, item.initProps), instance), {}, {
|
|
115
|
+
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
116
|
+
// 添加通用变量单独组件类名
|
|
117
|
+
className: clsx('top-left-item-container')
|
|
118
|
+
})));
|
|
119
|
+
}, [topLeftContent, instance]);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 渲染播放器右上角内容
|
|
123
|
+
*/
|
|
124
|
+
const renderTopRightContent = useMemo(() => {
|
|
125
|
+
if (!topRightContent || !(topRightContent !== null && topRightContent !== void 0 && topRightContent.length)) return null;
|
|
126
|
+
return topRightContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
97
127
|
key: item.id
|
|
98
128
|
}, item.initProps), instance), {}, {
|
|
99
|
-
IPCPlayerContext: instance.IPCPlayerInstance
|
|
129
|
+
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
130
|
+
// 添加通用变量单独组件类名
|
|
131
|
+
className: clsx('top-right-item-container')
|
|
132
|
+
})));
|
|
133
|
+
}, [topRightContent, instance]);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 渲染播放器左下角内容
|
|
137
|
+
*/
|
|
138
|
+
const renderBottomLeftContent = useMemo(() => {
|
|
139
|
+
if (!bottomLeftContent || !(bottomLeftContent !== null && bottomLeftContent !== void 0 && bottomLeftContent.length)) return null;
|
|
140
|
+
return bottomLeftContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({}, item.initProps), {}, {
|
|
141
|
+
key: item.id
|
|
142
|
+
}, instance), {}, {
|
|
143
|
+
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
144
|
+
// 添加通用变量单独组件类名
|
|
145
|
+
className: clsx('bottom-left-item-container')
|
|
100
146
|
})));
|
|
101
|
-
}, [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
147
|
+
}, [bottomLeftContent, instance]);
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 渲染播放器右下角内容
|
|
151
|
+
*/
|
|
152
|
+
const renderBottomRightContent = useMemo(() => {
|
|
153
|
+
if (!bottomRightContent || !(bottomRightContent !== null && bottomRightContent !== void 0 && bottomRightContent.length)) return null;
|
|
154
|
+
return bottomRightContent.map(item => /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({}, item.initProps), {}, {
|
|
105
155
|
key: item.id
|
|
106
156
|
}, instance), {}, {
|
|
107
|
-
IPCPlayerContext: instance.IPCPlayerInstance
|
|
157
|
+
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
158
|
+
// 添加通用变量单独组件类名
|
|
159
|
+
className: clsx('bottom-right-item-container')
|
|
108
160
|
})));
|
|
109
|
-
}, [
|
|
161
|
+
}, [bottomLeftContent, instance]);
|
|
110
162
|
|
|
111
163
|
/**
|
|
112
164
|
* 视频流加载状态封装
|
|
@@ -117,27 +169,27 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
117
169
|
const store = getDefaultStore();
|
|
118
170
|
const _screenType = store.get(instance.screenType);
|
|
119
171
|
eventRef.current.emit(playerTap);
|
|
120
|
-
if (_screenType === 'full') {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
172
|
+
// if (_screenType === 'full') {
|
|
173
|
+
// 如果全屏清晰度展开, 则点击关闭全屏清晰度, 展示所有组件
|
|
174
|
+
if (fullResolutionActive && _screenType === 'full') {
|
|
175
|
+
setFullResolutionActive(false);
|
|
176
|
+
// 展示相应菜单启动自动隐藏定时
|
|
177
|
+
triggerEvent(showAllComponent);
|
|
178
|
+
// event.emit(startTimeToHideAllComponent);
|
|
179
|
+
return false;
|
|
180
|
+
}
|
|
181
|
+
console.log(prevTriggerEvent.current, 'prevTriggerEvent.current');
|
|
182
|
+
if (prevTriggerEvent.current === hideAllComponent) {
|
|
183
|
+
triggerEvent(showAllComponent);
|
|
184
|
+
} else {
|
|
185
|
+
triggerEvent(hideAllComponent);
|
|
134
186
|
}
|
|
135
187
|
return false;
|
|
136
188
|
}, [fullResolutionActive]);
|
|
137
189
|
const triggerEvent = type => {
|
|
138
190
|
const store = getDefaultStore();
|
|
139
|
-
|
|
140
|
-
if (prevTriggerEvent.current === type
|
|
191
|
+
store.get(instance.screenType); // if (prevTriggerEvent.current === type || _screenType === 'vertical') return;
|
|
192
|
+
if (prevTriggerEvent.current === type) return;
|
|
141
193
|
if (timer.current) {
|
|
142
194
|
clearTimeout(timer.current);
|
|
143
195
|
timer.current = null;
|
|
@@ -183,6 +235,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
183
235
|
}, /*#__PURE__*/React.createElement(View, {
|
|
184
236
|
className: clsx('ipc-player-content', className),
|
|
185
237
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultCSSVariable), CSSVariable), style), {}, {
|
|
238
|
+
// backgroundColor: 'rgba(0,0,0,0.2)',
|
|
186
239
|
height: screenType === 'vertical' ? (style === null || style === void 0 ? void 0 : style.height) || '100%' : '100vh'
|
|
187
240
|
})
|
|
188
241
|
}, /*#__PURE__*/React.createElement(IPCPlayer, {
|
|
@@ -193,6 +246,7 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
193
246
|
ipcPlayerContext: instance.IPCPlayerInstance,
|
|
194
247
|
onChangeStreamStatus: code => {
|
|
195
248
|
var _props$onPlayStatus;
|
|
249
|
+
console.log(code, 'code');
|
|
196
250
|
const playStateMap = {
|
|
197
251
|
[PlayerStreamStatus.PreviewSuccess]: PlayState.PLAYING,
|
|
198
252
|
// 播放中
|
|
@@ -241,11 +295,15 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
241
295
|
clarity: resolution === 'HD' ? 'hd' : 'normal',
|
|
242
296
|
privateState: privateState,
|
|
243
297
|
onPlayerTap: handPlayerTap // 对应原来的onVideoTap
|
|
244
|
-
}),
|
|
298
|
+
}), /*#__PURE__*/React.createElement(TopLeftContent, {
|
|
299
|
+
ctx: instance
|
|
300
|
+
}, renderTopLeftContent), /*#__PURE__*/React.createElement(TopRightContent, {
|
|
301
|
+
ctx: instance
|
|
302
|
+
}, renderTopRightContent), /*#__PURE__*/React.createElement(BottomLeftContent, {
|
|
245
303
|
ctx: instance
|
|
246
|
-
},
|
|
304
|
+
}, renderBottomLeftContent), /*#__PURE__*/React.createElement(BottomRightContent, {
|
|
247
305
|
ctx: instance
|
|
248
|
-
},
|
|
306
|
+
}, renderBottomRightContent), playerReady && (() => {
|
|
249
307
|
if (!absoluteContent || !(absoluteContent !== null && absoluteContent !== void 0 && absoluteContent.length)) return null;
|
|
250
308
|
console.log(absoluteContent, 'absoluteContent');
|
|
251
309
|
return absoluteContent.map(item => {
|
|
@@ -258,7 +316,9 @@ export const IPCPlayerIntegration = /*#__PURE__*/React.memo(props => {
|
|
|
258
316
|
}, /*#__PURE__*/React.createElement(item.content, _objectSpread(_objectSpread(_objectSpread({
|
|
259
317
|
key: item.id
|
|
260
318
|
}, item.initProps), instance), {}, {
|
|
261
|
-
IPCPlayerContext: instance.IPCPlayerInstance
|
|
319
|
+
IPCPlayerContext: instance.IPCPlayerInstance,
|
|
320
|
+
// 添加通用变量单独组件类名
|
|
321
|
+
className: clsx('absolute-item-container')
|
|
262
322
|
})));
|
|
263
323
|
});
|
|
264
324
|
})()));
|