@ray-js/ipc-player-integration 0.0.53-beta.9 → 0.0.55-beta.0
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 +3 -13
- package/lib/ctx/ctx.js +32 -160
- package/lib/i18n/index.d.ts +0 -32
- package/lib/i18n/strings.d.ts +0 -16
- package/lib/i18n/strings.js +0 -16
- package/lib/interface.d.ts +4 -19
- package/lib/ui/ui.js +25 -75
- package/lib/utils/authorize/album.d.ts +1 -0
- package/lib/utils/authorize/album.js +39 -0
- package/lib/utils/authorize/album.test.js +82 -0
- package/lib/utils/ttt.d.ts +0 -26
- package/lib/utils/ttt.js +2 -109
- package/lib/widgets/index.d.ts +0 -1
- package/lib/widgets/index.js +1 -2
- package/lib/widgets/recordVideo/recordVideo.js +40 -50
- package/lib/widgets/recordVideo/recordVideo.less +74 -17
- package/lib/widgets/recordVideo/recordVideo.test.js +58 -0
- package/lib/widgets/resolution/resolution.js +1 -0
- package/lib/widgets/screenshot/screenshot.js +44 -97
- package/lib/widgets/screenshot/screenshot.less +40 -1
- package/lib/widgets/videoBitKBP/videoBitKBP.js +9 -38
- package/lib/widgets/videoBitKBP/videoBitKBP.less +0 -6
- package/package.json +2 -2
- package/lib/ctx/ctx.autoClarity.test.js +0 -150
- package/lib/ui/absoluteContent.d.ts +0 -2
- package/lib/ui/absoluteContent.js +0 -3
- package/lib/utils/captureResult.d.ts +0 -14
- package/lib/utils/captureResult.js +0 -70
- package/lib/utils/captureResult.test.js +0 -117
- package/lib/utils/ttt.autoClarity.test.d.ts +0 -1
- package/lib/utils/ttt.autoClarity.test.js +0 -75
- package/lib/widgets/captureResult/captureResult.d.ts +0 -16
- package/lib/widgets/captureResult/captureResult.js +0 -85
- package/lib/widgets/captureResult/captureResult.less +0 -144
- package/lib/widgets/captureResult/captureResult.test.d.ts +0 -1
- package/lib/widgets/captureResult/captureResult.test.js +0 -80
- package/lib/widgets/captureResult/index.d.ts +0 -2
- package/lib/widgets/captureResult/index.js +0 -2
- package/lib/widgets/videoBitKBP/videoBitKBP.test.d.ts +0 -1
- package/lib/widgets/videoBitKBP/videoBitKBP.test.js +0 -81
- /package/lib/{ctx/ctx.autoClarity.test.d.ts → utils/authorize/album.test.d.ts} +0 -0
- /package/lib/{utils/captureResult.test.d.ts → widgets/recordVideo/recordVideo.test.d.ts} +0 -0
|
@@ -1,59 +1,116 @@
|
|
|
1
1
|
.ipc-player-plugin-record-video-icon {
|
|
2
|
-
color: var(--iconColor);
|
|
3
2
|
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
3
|
+
color: var(--iconColor);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
.ipc-player-plugin-record-video-toast-wrap {
|
|
6
|
+
z-index: 400;
|
|
7
7
|
position: absolute;
|
|
8
8
|
top: calc(7px * var(--ipc-player-size-scale, 1));
|
|
9
9
|
left: 50%;
|
|
10
|
-
z-index: 400;
|
|
11
10
|
transform: translateX(-50%);
|
|
12
11
|
}
|
|
13
12
|
|
|
13
|
+
// 计时器显示
|
|
14
14
|
.ipc-player-plugin-record-video-toast-show {
|
|
15
15
|
transform: translate(0, 0) !important;
|
|
16
16
|
transition: transform ease-in 3s;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
// 计时器隐藏
|
|
19
19
|
.ipc-player-plugin-record-video-toast-hide {
|
|
20
20
|
transform: translate(0, -110%) !important;
|
|
21
21
|
transition: transform 0.3s ease-in-out;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.ipc-player-plugin-record-video-toast {
|
|
25
|
+
transform: translate(0, -110%);
|
|
25
26
|
display: flex;
|
|
26
|
-
align-items: center;
|
|
27
27
|
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
align-items: center;
|
|
29
|
+
background-color: var(--shot-card-bg-color);
|
|
30
30
|
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// background-color: #fff;
|
|
32
|
+
background: linear-gradient(0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)), #000000;
|
|
33
33
|
.ipc-player-plugin-record-video-toast-point {
|
|
34
34
|
width: calc(6px * var(--ipc-player-size-scale, 1));
|
|
35
35
|
height: calc(6px * var(--ipc-player-size-scale, 1));
|
|
36
36
|
border-radius: calc(6px * var(--ipc-player-size-scale, 1));
|
|
37
37
|
}
|
|
38
|
-
|
|
39
38
|
.ipc-player-plugin-record-video-toast-time {
|
|
39
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));;
|
|
40
|
+
font-weight: 700;
|
|
41
|
+
color: var(--fontColor);
|
|
42
|
+
margin-left: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
40
43
|
display: flex;
|
|
41
44
|
align-items: center;
|
|
42
|
-
margin-left: calc(8px * var(--ipc-player-size-scale, 1));
|
|
43
|
-
color: var(--fontColor);
|
|
44
|
-
font-weight: 700;
|
|
45
|
-
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
46
|
-
|
|
47
45
|
.ipc-player-plugin-record-video-toast-time-warp {
|
|
48
46
|
text-align: center;
|
|
49
47
|
}
|
|
50
|
-
|
|
51
48
|
.ipc-player-plugin-record-video-toast-time-delimiter {
|
|
52
|
-
margin: 0 calc(2px * var(--ipc-player-size-scale, 1))
|
|
49
|
+
margin: 0 calc(2px * var(--ipc-player-size-scale, 1));;
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
}
|
|
56
53
|
|
|
54
|
+
/** 录制成功弹窗 */
|
|
57
55
|
.ipc-player-plugin-record-success-toast-wrap {
|
|
58
56
|
position: absolute;
|
|
59
57
|
}
|
|
58
|
+
.ipc-player-plugin-record-success-toast {
|
|
59
|
+
flex: 1;
|
|
60
|
+
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
61
|
+
background-color: var(--shot-card-bg-color);
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
|
|
65
|
+
z-index: 100;
|
|
66
|
+
.ipc-player-plugin-record-success-toast-image-box {
|
|
67
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
70
|
+
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
71
|
+
position: relative;
|
|
72
|
+
}
|
|
73
|
+
.ipc-player-plugin-record-success-toast-image {
|
|
74
|
+
width: 100%;
|
|
75
|
+
height: 100%;
|
|
76
|
+
object-fit: cover;
|
|
77
|
+
}
|
|
78
|
+
.ipc-player-plugin-record-success-play-icon-box {
|
|
79
|
+
width: 30px;
|
|
80
|
+
height: 30px;
|
|
81
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
82
|
+
border-radius: 50%;
|
|
83
|
+
overflow: hidden;
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 50%;
|
|
86
|
+
left: 50%;
|
|
87
|
+
transform: translate(-50%, -50%);
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
.ipc-player-plugin-record-success-play-icon {
|
|
93
|
+
font-size: calc(18px * var(--ipc-player-size-scale, 1)) !important;
|
|
94
|
+
color: #ffffff;
|
|
95
|
+
}
|
|
96
|
+
.ipc-player-plugin-record-success-toast-title {
|
|
97
|
+
flex: 1;
|
|
98
|
+
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
99
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
100
|
+
color: var(--fontColor);
|
|
101
|
+
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
102
|
+
word-break: break-word;
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
.ipc-player-plugin-record-success-toast-bottom {
|
|
106
|
+
border: 1px solid #1989FA;
|
|
107
|
+
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
108
|
+
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
109
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
110
|
+
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
111
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
text-overflow: ellipsis;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { act, renderHook } from '@testing-library/react-hooks/dom';
|
|
2
|
+
import { atom } from 'jotai';
|
|
3
|
+
import { RecordVideo } from './recordVideo';
|
|
4
|
+
import { PlayState } from '../../interface';
|
|
5
|
+
jest.mock('@ray-js/ray', () => ({
|
|
6
|
+
View: 'div',
|
|
7
|
+
Text: 'span',
|
|
8
|
+
Image: 'img',
|
|
9
|
+
getSystemInfoSync: () => ({
|
|
10
|
+
platform: 'ios',
|
|
11
|
+
system: 'iOS 18'
|
|
12
|
+
})
|
|
13
|
+
}));
|
|
14
|
+
jest.mock('@ray-js/ray-ipc-utils', () => ({
|
|
15
|
+
goToIpcPageNativeRoute: jest.fn()
|
|
16
|
+
}));
|
|
17
|
+
jest.mock('@ray-js/ray-ipc-utils/lib/interface', () => ({}));
|
|
18
|
+
jest.mock('../../i18n', () => ({
|
|
19
|
+
__esModule: true,
|
|
20
|
+
default: {
|
|
21
|
+
getLang: key => key
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
jest.mock('./recordVideo.less', () => ({}));
|
|
25
|
+
it('keeps the record control idle when starting is declined', async () => {
|
|
26
|
+
const addContent = jest.fn();
|
|
27
|
+
const setRecordingDisabled = jest.fn();
|
|
28
|
+
const setRecording = jest.fn().mockResolvedValue(false);
|
|
29
|
+
const toast = jest.fn();
|
|
30
|
+
const props = {
|
|
31
|
+
recording: atom(false),
|
|
32
|
+
brandColor: atom('#000000'),
|
|
33
|
+
screenType: atom('vertical'),
|
|
34
|
+
recordingDisabled: atom(false),
|
|
35
|
+
playState: atom(PlayState.PLAYING),
|
|
36
|
+
setRecording,
|
|
37
|
+
setRecordingDisabled,
|
|
38
|
+
addContent,
|
|
39
|
+
deleteContent: jest.fn(),
|
|
40
|
+
toast,
|
|
41
|
+
devId: 'test-device',
|
|
42
|
+
event: {
|
|
43
|
+
emit: jest.fn()
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const {
|
|
47
|
+
result,
|
|
48
|
+
unmount
|
|
49
|
+
} = renderHook(() => RecordVideo(props));
|
|
50
|
+
await act(async () => {
|
|
51
|
+
await result.current.props.onClick();
|
|
52
|
+
});
|
|
53
|
+
expect(setRecording).toHaveBeenCalledWith(true);
|
|
54
|
+
expect(addContent).not.toHaveBeenCalled();
|
|
55
|
+
expect(setRecordingDisabled).not.toHaveBeenCalled();
|
|
56
|
+
expect(toast).not.toHaveBeenCalled();
|
|
57
|
+
unmount();
|
|
58
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { useContext,
|
|
2
|
-
import { View,
|
|
1
|
+
import React, { useContext, useRef } from 'react';
|
|
2
|
+
import { View, Image, Text, getSystemInfoSync } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect, useMemoizedFn } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
@@ -7,8 +7,7 @@ import Strings from '../../i18n';
|
|
|
7
7
|
import { useStore } from '../../ctx/store';
|
|
8
8
|
import { UIEventContext } from '../../ui/context';
|
|
9
9
|
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
|
|
10
|
-
import {
|
|
11
|
-
import { CaptureResultToast } from '../captureResult/captureResult';
|
|
10
|
+
import { ensureAlbumPermission } from '../../utils/authorize/album';
|
|
12
11
|
import './screenshot.less';
|
|
13
12
|
const CLOSE_TIME = 5000;
|
|
14
13
|
export function Screenshot(props) {
|
|
@@ -36,15 +35,8 @@ export function Screenshot(props) {
|
|
|
36
35
|
/** 记录截屏url */
|
|
37
36
|
const [state, setState] = useSetState({
|
|
38
37
|
showShot: false,
|
|
39
|
-
shotUrl: ''
|
|
40
|
-
shotCount: 0
|
|
38
|
+
shotUrl: ''
|
|
41
39
|
});
|
|
42
|
-
const snapshotRequestIdRef = useRef(0);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
return () => {
|
|
45
|
-
snapshotRequestIdRef.current += 1;
|
|
46
|
-
};
|
|
47
|
-
}, []);
|
|
48
40
|
useUpdateEffect(() => {
|
|
49
41
|
if (state.showShot && screenType) {
|
|
50
42
|
showShotToast();
|
|
@@ -57,8 +49,7 @@ export function Screenshot(props) {
|
|
|
57
49
|
timer.current = setTimeout(() => {
|
|
58
50
|
setState({
|
|
59
51
|
showShot: false,
|
|
60
|
-
shotUrl: ''
|
|
61
|
-
shotCount: 0
|
|
52
|
+
shotUrl: ''
|
|
62
53
|
});
|
|
63
54
|
deleteContent('absolute', 'plugin-screenshot-toast');
|
|
64
55
|
}, CLOSE_TIME);
|
|
@@ -68,8 +59,7 @@ export function Screenshot(props) {
|
|
|
68
59
|
const handCheck = () => {
|
|
69
60
|
setState({
|
|
70
61
|
showShot: false,
|
|
71
|
-
shotUrl: ''
|
|
72
|
-
shotCount: 0
|
|
62
|
+
shotUrl: ''
|
|
73
63
|
});
|
|
74
64
|
deleteContent('absolute', 'plugin-screenshot-toast');
|
|
75
65
|
clearInterval(timer.current);
|
|
@@ -91,20 +81,31 @@ export function Screenshot(props) {
|
|
|
91
81
|
marginLeft: screenType === 'vertical' ? '0' : '-200px'
|
|
92
82
|
},
|
|
93
83
|
content: () => {
|
|
94
|
-
return /*#__PURE__*/React.createElement(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
84
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
85
|
+
className: "ipc-player-plugin-screenshot-toast"
|
|
86
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
87
|
+
className: "ipc-player-plugin-screenshot-toast-image-box"
|
|
88
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
89
|
+
className: "ipc-player-plugin-screenshot-toast-image",
|
|
90
|
+
src: state.shotUrl
|
|
91
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
92
|
+
className: "ipc-player-plugin-screenshot-toast-title"
|
|
93
|
+
}, Strings.getLang('ipc_player_screenshot_success_tip')), /*#__PURE__*/React.createElement(View, {
|
|
94
|
+
onClick: handCheck,
|
|
95
|
+
className: "ipc-player-plugin-screenshot-toast-bottom",
|
|
96
|
+
style: {
|
|
97
|
+
color: brandColor,
|
|
98
|
+
borderColor: brandColor
|
|
99
|
+
}
|
|
100
|
+
}, Strings.getLang('ipc_player_shot_success_check')));
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
timeToCloseToast();
|
|
104
104
|
};
|
|
105
|
-
const handClick = useMemoizedFn(() => {
|
|
106
|
-
var _props$event;
|
|
107
|
-
(
|
|
105
|
+
const handClick = useMemoizedFn(async () => {
|
|
106
|
+
var _props$event, _props$event2;
|
|
107
|
+
const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
|
|
108
|
+
((_props$event2 = props.event) !== null && _props$event2 !== void 0 ? _props$event2 : event).emit(widgetClick, {
|
|
108
109
|
widgetId: widgetLabs.SCREENSHOT
|
|
109
110
|
});
|
|
110
111
|
console.log('截屏!!!');
|
|
@@ -118,78 +119,24 @@ export function Screenshot(props) {
|
|
|
118
119
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, true) : event.emit(changeIgnoreHideStopPreview, true);
|
|
119
120
|
}
|
|
120
121
|
event.emit(pauseTimeToHideAllComponent);
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
const takeSnapshot = () => {
|
|
135
|
-
const requestId = ++snapshotRequestIdRef.current;
|
|
136
|
-
IPCPlayerContext.snapshot({
|
|
137
|
-
saveToAlbum,
|
|
138
|
-
success: async res => {
|
|
139
|
-
var _props$multiCameraCtx;
|
|
140
|
-
setIgnoreHideStopPreview(false);
|
|
141
|
-
const splitNum = (_props$multiCameraCtx = props.multiCameraCtx) === null || _props$multiCameraCtx === void 0 || (_props$multiCameraCtx = _props$multiCameraCtx.protocol) === null || _props$multiCameraCtx === void 0 ? void 0 : _props$multiCameraCtx.total_split_num;
|
|
142
|
-
const summary = await getCaptureResultSummary(res, {
|
|
143
|
-
multiLens: props.multiLens,
|
|
144
|
-
protocolCount: splitNum,
|
|
145
|
-
devId
|
|
146
|
-
});
|
|
147
|
-
if (requestId !== snapshotRequestIdRef.current) return;
|
|
148
|
-
if (!summary) {
|
|
149
|
-
handleSnapshotFail({});
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
setState({
|
|
153
|
-
showShot: true,
|
|
154
|
-
shotUrl: summary.thumbnailPath,
|
|
155
|
-
shotCount: summary.isMultiLens ? summary.count : 0
|
|
156
|
-
});
|
|
157
|
-
},
|
|
158
|
-
fail: handleSnapshotFail
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
ty.authorizeStatus({
|
|
162
|
-
// 相册写入权限
|
|
163
|
-
scope: 'scope.writePhotosAlbum',
|
|
164
|
-
success: () => {
|
|
165
|
-
setIgnoreHideStopPreview(false);
|
|
166
|
-
takeSnapshot();
|
|
122
|
+
const granted = await ensureAlbumPermission();
|
|
123
|
+
ev.emit(changeIgnoreHideStopPreview, false);
|
|
124
|
+
if (!granted) return;
|
|
125
|
+
IPCPlayerContext.snapshot({
|
|
126
|
+
saveToAlbum,
|
|
127
|
+
success: res => {
|
|
128
|
+
ev.emit(changeIgnoreHideStopPreview, false);
|
|
129
|
+
setState({
|
|
130
|
+
showShot: true,
|
|
131
|
+
shotUrl: res.tempImagePath
|
|
132
|
+
});
|
|
167
133
|
},
|
|
168
|
-
fail:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
fail: () => {
|
|
175
|
-
showModal({
|
|
176
|
-
title: '',
|
|
177
|
-
content: Strings.getLang('ipc_player_no_album_permission'),
|
|
178
|
-
cancelText: Strings.getLang('ipc_player_authorize_cancel_text'),
|
|
179
|
-
confirmText: Strings.getLang('ipc_player_authorize_confirm_text'),
|
|
180
|
-
isShowGlobal: true,
|
|
181
|
-
success: res => {
|
|
182
|
-
if (res.confirm) {
|
|
183
|
-
openAppSystemSettingPage({
|
|
184
|
-
scope: 'App-Settings',
|
|
185
|
-
success: () => {
|
|
186
|
-
console.log('跳转成功');
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
134
|
+
fail: err => {
|
|
135
|
+
ev.emit(changeIgnoreHideStopPreview, false);
|
|
136
|
+
const errObj = err.innerError || err || {};
|
|
137
|
+
const errMsg = errObj.errorMsg || Strings.getLang('ipc_player_error_screenshot_error_tip');
|
|
138
|
+
toast({
|
|
139
|
+
title: errMsg
|
|
193
140
|
});
|
|
194
141
|
}
|
|
195
142
|
});
|
|
@@ -2,7 +2,46 @@
|
|
|
2
2
|
color: var(--iconColor);
|
|
3
3
|
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
.ipc-player-plugin-screenshot-toast-wrap {
|
|
7
6
|
position: absolute;
|
|
8
7
|
}
|
|
8
|
+
.ipc-player-plugin-screenshot-toast {
|
|
9
|
+
flex: 1;
|
|
10
|
+
border-radius: calc(8px * var(--ipc-player-size-scale, 1));;
|
|
11
|
+
background-color: var(--shot-card-bg-color);
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: calc(8px * var(--ipc-player-size-scale, 1)) calc(12px * var(--ipc-player-size-scale, 1));
|
|
15
|
+
z-index: 100;
|
|
16
|
+
.ipc-player-plugin-screenshot-toast-image-box {
|
|
17
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
20
|
+
height: calc(66px * 0.57 * var(--ipc-player-size-scale, 1));
|
|
21
|
+
}
|
|
22
|
+
.ipc-player-plugin-screenshot-toast-image {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
object-fit: cover;
|
|
26
|
+
}
|
|
27
|
+
.ipc-player-plugin-screenshot-toast-title {
|
|
28
|
+
flex: 1;
|
|
29
|
+
margin-left: calc(12px * var(--ipc-player-size-scale, 1));
|
|
30
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
31
|
+
color: var(--fontColor);
|
|
32
|
+
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
33
|
+
word-break: break-word;
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
.ipc-player-plugin-screenshot-toast-bottom {
|
|
37
|
+
border: 1px solid #1989FA;
|
|
38
|
+
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
39
|
+
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
40
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
41
|
+
padding: calc(5px * var(--ipc-player-size-scale, 1)) calc(11px * var(--ipc-player-size-scale, 1));
|
|
42
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -2,11 +2,9 @@ import React, { useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import { View, Text, usePageEvent } from '@ray-js/ray';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { getVideoBitrateKbps, requestWifiSignal } from '@ray-js/ray-ipc-utils';
|
|
5
|
-
import { ClarityType } from '@ray-js/ray-ipc-utils/lib/interface';
|
|
6
5
|
import { PlayState } from '../../interface';
|
|
7
6
|
import './videoBitKBP.less';
|
|
8
7
|
import { useStore } from '../../ctx/store';
|
|
9
|
-
import Strings from '../../i18n';
|
|
10
8
|
export const VideoBitKBP = props => {
|
|
11
9
|
const {
|
|
12
10
|
devId,
|
|
@@ -18,9 +16,7 @@ export const VideoBitKBP = props => {
|
|
|
18
16
|
const [bitKBP, setBitKBP] = useState('');
|
|
19
17
|
const [signalStrength, setSignalStrength] = useState(null);
|
|
20
18
|
const store = useStore({
|
|
21
|
-
playState
|
|
22
|
-
resolution: props.resolution,
|
|
23
|
-
autoClarity: props.autoClarity
|
|
19
|
+
playState
|
|
24
20
|
});
|
|
25
21
|
const timerRef = useRef();
|
|
26
22
|
useEffect(() => {
|
|
@@ -56,14 +52,12 @@ export const VideoBitKBP = props => {
|
|
|
56
52
|
}
|
|
57
53
|
}
|
|
58
54
|
};
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const activeClarity = store.resolution === ClarityType.AUTO ? store.autoClarity : null;
|
|
63
|
-
const hasClarity = Boolean(activeClarity);
|
|
64
|
-
if (!hasKbps && !hasSignal && !hasClarity) {
|
|
55
|
+
const hasKbps = !hideKbsMenu && bitKBP !== '' && bitKBP !== '0';
|
|
56
|
+
const hasSignal = !hideSignalMenu && signalStrength !== null;
|
|
57
|
+
if (!hasKbps && !hasSignal || store.playState !== PlayState.PLAYING) {
|
|
65
58
|
return null;
|
|
66
59
|
}
|
|
60
|
+
if (hideKbsMenu && hideSignalMenu) return null;
|
|
67
61
|
return /*#__PURE__*/React.createElement(View, {
|
|
68
62
|
className: clsx({
|
|
69
63
|
'ipc-player-plugin-videoBitKBP-container': true,
|
|
@@ -77,34 +71,11 @@ export const VideoBitKBP = props => {
|
|
|
77
71
|
className: clsx('icon-panel', 'icon-panel-wi-Fi', 'ipc-player-plugin-videoBitKBP-signal-icon')
|
|
78
72
|
}), /*#__PURE__*/React.createElement(Text, null, signalStrength), /*#__PURE__*/React.createElement(Text, {
|
|
79
73
|
className: "ipc-player-plugin-videoBitKBP-unit-percent"
|
|
80
|
-
}, signalStrength > 0 ? '%' : 'dBm')), hasSignal &&
|
|
74
|
+
}, signalStrength > 0 ? '%' : 'dBm')), hasSignal && hasKbps && /*#__PURE__*/React.createElement(View, {
|
|
81
75
|
className: "ipc-player-plugin-videoBitKBP-divider"
|
|
82
|
-
}),
|
|
76
|
+
}), hasKbps && /*#__PURE__*/React.createElement(View, {
|
|
83
77
|
className: "ipc-player-plugin-videoBitKBP-kbps"
|
|
84
|
-
},
|
|
85
|
-
className: clsx('ipc-player-plugin-videoBitKBP-clarity', {
|
|
86
|
-
'ipc-player-plugin-videoBitKBP-clarity-only': !hasKbps
|
|
87
|
-
})
|
|
88
|
-
}, (clarity => {
|
|
89
|
-
switch (clarity) {
|
|
90
|
-
case ClarityType.SS:
|
|
91
|
-
return Strings.getLang('ipc_player_resolution_SS');
|
|
92
|
-
case ClarityType.SD:
|
|
93
|
-
return Strings.getLang('ipc_player_resolution_SD');
|
|
94
|
-
case ClarityType.HD:
|
|
95
|
-
return Strings.getLang('ipc_player_resolution_HD');
|
|
96
|
-
case ClarityType.UD:
|
|
97
|
-
return Strings.getLang('ipc_player_resolution_UD');
|
|
98
|
-
case ClarityType.SSP:
|
|
99
|
-
return Strings.getLang('ipc_player_resolution_SSP');
|
|
100
|
-
case ClarityType.AUTO:
|
|
101
|
-
return Strings.getLang('ipc_player_resolution_AUTO');
|
|
102
|
-
case ClarityType.AUDIO:
|
|
103
|
-
return Strings.getLang('ipc_player_resolution_AUDIO');
|
|
104
|
-
default:
|
|
105
|
-
return clarity;
|
|
106
|
-
}
|
|
107
|
-
})(activeClarity)), hasKbps && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, bitKBP), /*#__PURE__*/React.createElement(Text, {
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Text, null, bitKBP), /*#__PURE__*/React.createElement(Text, {
|
|
108
79
|
className: "ipc-player-plugin-videoBitKBP-unit-kbs"
|
|
109
|
-
}, "KB/S"))))
|
|
80
|
+
}, "KB/S"))));
|
|
110
81
|
};
|
|
@@ -36,12 +36,6 @@
|
|
|
36
36
|
display: flex;
|
|
37
37
|
align-items: center;
|
|
38
38
|
}
|
|
39
|
-
.ipc-player-plugin-videoBitKBP-clarity {
|
|
40
|
-
margin-right: calc(4px * var(--ipc-player-size-scale, 1));
|
|
41
|
-
}
|
|
42
|
-
.ipc-player-plugin-videoBitKBP-clarity-only {
|
|
43
|
-
margin-right: 0;
|
|
44
|
-
}
|
|
45
39
|
.ipc-player-plugin-videoBitKBP-unit-kbs {
|
|
46
40
|
margin-left: calc(4px * var(--ipc-player-size-scale, 1));
|
|
47
41
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/ipc-player-integration",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.55-beta.0",
|
|
4
4
|
"description": "IPC 融合播放器",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ray-js/direction-control": "^0.0.8",
|
|
39
39
|
"@ray-js/ipc-ptz-zoom": "^0.0.3",
|
|
40
|
-
"@ray-js/ray-ipc-player": "2.1.
|
|
40
|
+
"@ray-js/ray-ipc-player": "^2.1.3",
|
|
41
41
|
"@ray-js/ray-ipc-utils": "^1.1.16",
|
|
42
42
|
"@ray-js/svg": "0.2.0",
|
|
43
43
|
"clsx": "^1.2.1",
|