@ray-js/ipc-player-integration 0.0.63 → 0.0.65-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.album.test.d.ts +1 -0
- package/lib/ctx/ctx.album.test.js +197 -0
- package/lib/ctx/ctx.composition.js +19 -4
- package/lib/ctx/ctx.js +103 -55
- package/lib/ctx/ports.output.d.ts +1 -0
- package/lib/ctx/resolution.d.ts +1 -1
- package/lib/ctx/resolution.js +3 -1
- package/lib/i18n/index.d.ts +12 -0
- package/lib/i18n/strings.d.ts +6 -0
- package/lib/i18n/strings.js +6 -0
- package/lib/interface.d.ts +19 -3
- package/lib/ui/absoluteContent.d.ts +2 -0
- package/lib/ui/absoluteContent.js +3 -0
- package/lib/ui/bottomLeftContent.js +3 -1
- package/lib/ui/ui.d.ts +2 -0
- package/lib/ui/ui.js +30 -26
- package/lib/utils/captureResult.d.ts +14 -0
- package/lib/utils/captureResult.js +70 -0
- package/lib/utils/captureResult.test.d.ts +1 -0
- package/lib/utils/captureResult.test.js +117 -0
- package/lib/utils/fullLinkTracking.d.ts +5 -0
- package/lib/utils/fullLinkTracking.js +71 -0
- package/lib/utils/navigation.d.ts +2 -1
- package/lib/utils/navigation.js +13 -3
- package/lib/utils/ttt.js +2 -8
- package/lib/widgets/captureResult/captureResult.d.ts +16 -0
- package/lib/widgets/captureResult/captureResult.js +85 -0
- package/lib/widgets/captureResult/captureResult.less +144 -0
- package/lib/widgets/captureResult/captureResult.test.d.ts +1 -0
- package/lib/widgets/captureResult/captureResult.test.js +80 -0
- package/lib/widgets/captureResult/index.d.ts +2 -0
- package/lib/widgets/captureResult/index.js +2 -0
- package/lib/widgets/index.d.ts +1 -0
- package/lib/widgets/index.js +2 -1
- package/lib/widgets/multiCamera/index.less +1 -0
- package/lib/widgets/recordVideo/recordVideo.js +53 -52
- package/lib/widgets/recordVideo/recordVideo.less +17 -74
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.d.ts +1 -0
- package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +106 -0
- package/lib/widgets/recordVideo/recordVideo.test.js +1 -0
- package/lib/widgets/screenshot/screenshot.js +66 -44
- package/lib/widgets/screenshot/screenshot.less +1 -40
- package/lib/widgets/screenshot/screenshot.test.d.ts +1 -0
- package/lib/widgets/screenshot/screenshot.test.js +120 -0
- package/lib/widgets/trialBadge/index.d.ts +2 -1
- package/lib/widgets/trialBadge/index.js +17 -9
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +3 -2
- package/lib/widgets/trialBadge/useTrialBadge.js +13 -2
- package/lib/widgets/tryExperience/tryExperience.js +0 -1
- package/package.json +3 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Image, Text, View } from '@ray-js/ray';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import Strings from '../../i18n';
|
|
5
|
+
import './captureResult.less';
|
|
6
|
+
const BACKDROP_LAYERS = ['back', 'middle'];
|
|
7
|
+
const TEXT_KEYS = {
|
|
8
|
+
record: {
|
|
9
|
+
check: 'ipc_player_record_success_check',
|
|
10
|
+
multi: 'ipc_player_record_multi_success_tip',
|
|
11
|
+
single: 'ipc_player_record_success_tip'
|
|
12
|
+
},
|
|
13
|
+
screenshot: {
|
|
14
|
+
check: 'ipc_player_shot_success_check',
|
|
15
|
+
multi: 'ipc_player_screenshot_multi_success_tip',
|
|
16
|
+
single: 'ipc_player_screenshot_success_tip'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const LEGACY_CLASS_MAP = {
|
|
20
|
+
record: {
|
|
21
|
+
toast: 'ipc-player-plugin-record-success-toast',
|
|
22
|
+
imageBox: 'ipc-player-plugin-record-success-toast-image-box',
|
|
23
|
+
imageBoxMulti: 'ipc-player-plugin-record-success-toast-image-box-multi',
|
|
24
|
+
image: 'ipc-player-plugin-record-success-toast-image',
|
|
25
|
+
playIconBox: 'ipc-player-plugin-record-success-play-icon-box',
|
|
26
|
+
playIcon: 'ipc-player-plugin-record-success-play-icon',
|
|
27
|
+
title: 'ipc-player-plugin-record-success-toast-title',
|
|
28
|
+
check: 'ipc-player-plugin-record-success-toast-bottom'
|
|
29
|
+
},
|
|
30
|
+
screenshot: {
|
|
31
|
+
toast: 'ipc-player-plugin-screenshot-toast',
|
|
32
|
+
imageBox: 'ipc-player-plugin-screenshot-toast-image-box',
|
|
33
|
+
imageBoxMulti: 'ipc-player-plugin-screenshot-toast-image-box-multi',
|
|
34
|
+
image: 'ipc-player-plugin-screenshot-toast-image',
|
|
35
|
+
playIconBox: '',
|
|
36
|
+
playIcon: '',
|
|
37
|
+
title: 'ipc-player-plugin-screenshot-toast-title',
|
|
38
|
+
check: 'ipc-player-plugin-screenshot-toast-bottom'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export function CaptureResultToast(_ref) {
|
|
42
|
+
let {
|
|
43
|
+
brandColor,
|
|
44
|
+
count = 0,
|
|
45
|
+
kind,
|
|
46
|
+
onCheck,
|
|
47
|
+
thumbnailPath,
|
|
48
|
+
title,
|
|
49
|
+
checkText,
|
|
50
|
+
className
|
|
51
|
+
} = _ref;
|
|
52
|
+
const isMultiLens = count > 1;
|
|
53
|
+
const textKeys = TEXT_KEYS[kind];
|
|
54
|
+
const legacyCls = LEGACY_CLASS_MAP[kind];
|
|
55
|
+
const imageClassName = clsx('ipc-player-plugin-capture-result-image', legacyCls.image);
|
|
56
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
57
|
+
className: clsx('ipc-player-plugin-capture-result-toast', legacyCls.toast, className)
|
|
58
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
59
|
+
className: clsx('ipc-player-plugin-capture-result-image-box', legacyCls.imageBox, isMultiLens && ['ipc-player-plugin-capture-result-image-box-multi', legacyCls.imageBoxMulti])
|
|
60
|
+
}, isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, BACKDROP_LAYERS.map(layer => /*#__PURE__*/React.createElement(View, {
|
|
61
|
+
key: layer,
|
|
62
|
+
className: clsx('ipc-player-plugin-capture-result-backdrop', `ipc-player-plugin-capture-result-image-${layer}`)
|
|
63
|
+
})), /*#__PURE__*/React.createElement(Image, {
|
|
64
|
+
className: clsx(imageClassName, 'ipc-player-plugin-capture-result-image-front'),
|
|
65
|
+
src: thumbnailPath
|
|
66
|
+
})) : /*#__PURE__*/React.createElement(Image, {
|
|
67
|
+
className: imageClassName,
|
|
68
|
+
src: thumbnailPath
|
|
69
|
+
}), kind === 'record' && /*#__PURE__*/React.createElement(View, {
|
|
70
|
+
className: clsx('ipc-player-plugin-capture-result-play-icon-box', legacyCls.playIconBox)
|
|
71
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
72
|
+
className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-capture-result-play-icon', legacyCls.playIcon)
|
|
73
|
+
}))), /*#__PURE__*/React.createElement(View, {
|
|
74
|
+
className: clsx('ipc-player-plugin-capture-result-title', legacyCls.title)
|
|
75
|
+
}, title ? typeof title === 'string' ? /*#__PURE__*/React.createElement(Text, null, title) : title : isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
|
|
76
|
+
className: "ipc-player-plugin-capture-result-count"
|
|
77
|
+
}, Strings.formatString(Strings.getLang('ipc_player_multi_capture_success_count'), count))) : Strings.getLang(textKeys.single)), /*#__PURE__*/React.createElement(View, {
|
|
78
|
+
onClick: onCheck,
|
|
79
|
+
className: clsx('ipc-player-plugin-capture-result-check', legacyCls.check),
|
|
80
|
+
style: {
|
|
81
|
+
color: brandColor,
|
|
82
|
+
borderColor: brandColor
|
|
83
|
+
}
|
|
84
|
+
}, checkText || Strings.getLang(textKeys.check)));
|
|
85
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
.ipc-player-plugin-capture-result-toast,
|
|
2
|
+
.ipc-player-plugin-record-success-toast,
|
|
3
|
+
.ipc-player-plugin-screenshot-toast {
|
|
4
|
+
--capture-result-text-color: var(--fontColor, #fff);
|
|
5
|
+
--capture-result-near-backdrop-color: rgba(255, 255, 255, 0.2);
|
|
6
|
+
--capture-result-far-backdrop-color: rgba(255, 255, 255, 0.1);
|
|
7
|
+
|
|
8
|
+
z-index: 100;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex: 1;
|
|
11
|
+
align-items: center;
|
|
12
|
+
padding: calc(7px * var(--ipc-player-size-scale, 1))
|
|
13
|
+
calc(16px * var(--ipc-player-size-scale, 1))
|
|
14
|
+
calc(7px * var(--ipc-player-size-scale, 1))
|
|
15
|
+
calc(12px * var(--ipc-player-size-scale, 1));
|
|
16
|
+
background-color: var(--shot-card-bg-color);
|
|
17
|
+
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:root[theme='light'] .ipc-player-plugin-capture-result-toast {
|
|
21
|
+
--capture-result-text-color: #1a1a1a;
|
|
22
|
+
--capture-result-near-backdrop-color: rgba(0, 0, 0, 0.1);
|
|
23
|
+
--capture-result-far-backdrop-color: rgba(0, 0, 0, 0.05);
|
|
24
|
+
|
|
25
|
+
background-color: #fff;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ipc-player-plugin-capture-result-image-box,
|
|
29
|
+
.ipc-player-plugin-record-success-toast-image-box,
|
|
30
|
+
.ipc-player-plugin-screenshot-toast-image-box {
|
|
31
|
+
position: relative;
|
|
32
|
+
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
33
|
+
height: calc(39px * var(--ipc-player-size-scale, 1));
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ipc-player-plugin-capture-result-image,
|
|
39
|
+
.ipc-player-plugin-record-success-toast-image,
|
|
40
|
+
.ipc-player-plugin-screenshot-toast-image {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
object-fit: cover;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ipc-player-plugin-capture-result-backdrop,
|
|
47
|
+
.ipc-player-plugin-capture-result-image-front {
|
|
48
|
+
position: absolute;
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ipc-player-plugin-capture-result-image-back {
|
|
54
|
+
top: calc(1px * var(--ipc-player-size-scale, 1));
|
|
55
|
+
left: calc(5px * var(--ipc-player-size-scale, 1));
|
|
56
|
+
z-index: 1;
|
|
57
|
+
width: calc(56px * var(--ipc-player-size-scale, 1));
|
|
58
|
+
height: calc(28px * var(--ipc-player-size-scale, 1));
|
|
59
|
+
background: var(--capture-result-far-backdrop-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ipc-player-plugin-capture-result-image-middle {
|
|
63
|
+
top: calc(3px * var(--ipc-player-size-scale, 1));
|
|
64
|
+
left: calc(2.5px * var(--ipc-player-size-scale, 1));
|
|
65
|
+
z-index: 2;
|
|
66
|
+
width: calc(61px * var(--ipc-player-size-scale, 1));
|
|
67
|
+
height: calc(30.5px * var(--ipc-player-size-scale, 1));
|
|
68
|
+
background: var(--capture-result-near-backdrop-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ipc-player-plugin-capture-result-image-front {
|
|
72
|
+
top: calc(5px * var(--ipc-player-size-scale, 1));
|
|
73
|
+
left: 0;
|
|
74
|
+
z-index: 3;
|
|
75
|
+
width: calc(66px * var(--ipc-player-size-scale, 1));
|
|
76
|
+
height: calc(33px * var(--ipc-player-size-scale, 1));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.ipc-player-plugin-capture-result-play-icon-box,
|
|
80
|
+
.ipc-player-plugin-record-success-play-icon-box {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: 50%;
|
|
83
|
+
left: 50%;
|
|
84
|
+
z-index: 4;
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
width: calc(16px * var(--ipc-player-size-scale, 1));
|
|
89
|
+
height: calc(16px * var(--ipc-player-size-scale, 1));
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
background-color: rgba(0, 0, 0, 0.2);
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
transform: translate(-50%, -50%);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ipc-player-plugin-capture-result-image-box-multi
|
|
97
|
+
.ipc-player-plugin-capture-result-play-icon-box {
|
|
98
|
+
top: calc(50% + 2px * var(--ipc-player-size-scale, 1));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.ipc-player-plugin-capture-result-play-icon,
|
|
102
|
+
.ipc-player-plugin-record-success-play-icon {
|
|
103
|
+
color: #ffffff;
|
|
104
|
+
font-size: calc(9px * var(--ipc-player-size-scale, 1)) !important;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ipc-player-plugin-capture-result-title,
|
|
108
|
+
.ipc-player-plugin-record-success-toast-title,
|
|
109
|
+
.ipc-player-plugin-screenshot-toast-title {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex: 1;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
margin-right: calc(12px * var(--ipc-player-size-scale, 1));
|
|
115
|
+
margin-left: calc(8px * var(--ipc-player-size-scale, 1));
|
|
116
|
+
color: var(--capture-result-text-color, var(--fontColor));
|
|
117
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
118
|
+
line-height: calc(20px * var(--ipc-player-size-scale, 1));
|
|
119
|
+
word-break: break-word;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ipc-player-plugin-capture-result-count {
|
|
123
|
+
margin-top: calc(2px * var(--ipc-player-size-scale, 1));
|
|
124
|
+
color: var(--capture-result-text-color, var(--fontColor));
|
|
125
|
+
font-size: calc(12px * var(--ipc-player-size-scale, 1));
|
|
126
|
+
line-height: calc(17px * var(--ipc-player-size-scale, 1));
|
|
127
|
+
opacity: 0.5;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ipc-player-plugin-capture-result-check,
|
|
131
|
+
.ipc-player-plugin-record-success-toast-bottom,
|
|
132
|
+
.ipc-player-plugin-screenshot-toast-bottom {
|
|
133
|
+
min-width: calc(52px * var(--ipc-player-size-scale, 1));
|
|
134
|
+
max-width: calc(100px * var(--ipc-player-size-scale, 1));
|
|
135
|
+
flex-shrink: 0;
|
|
136
|
+
padding: calc(5px * var(--ipc-player-size-scale, 1))
|
|
137
|
+
calc(11px * var(--ipc-player-size-scale, 1));
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
font-size: calc(14px * var(--ipc-player-size-scale, 1));
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
text-overflow: ellipsis;
|
|
142
|
+
border: 1px solid #1989fa;
|
|
143
|
+
border-radius: calc(4px * var(--ipc-player-size-scale, 1));
|
|
144
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
|
+
jest.mock('@ray-js/ray', () => {
|
|
4
|
+
const React = require('react');
|
|
5
|
+
return {
|
|
6
|
+
Image: _ref => {
|
|
7
|
+
let {
|
|
8
|
+
className,
|
|
9
|
+
src
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement("img", {
|
|
12
|
+
alt: "",
|
|
13
|
+
className: className,
|
|
14
|
+
src: src
|
|
15
|
+
});
|
|
16
|
+
},
|
|
17
|
+
Text: _ref2 => {
|
|
18
|
+
let {
|
|
19
|
+
children,
|
|
20
|
+
className
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: className
|
|
24
|
+
}, children);
|
|
25
|
+
},
|
|
26
|
+
View: _ref3 => {
|
|
27
|
+
let {
|
|
28
|
+
children,
|
|
29
|
+
className
|
|
30
|
+
} = _ref3;
|
|
31
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: className
|
|
33
|
+
}, children);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
jest.mock('../../i18n', () => ({
|
|
38
|
+
__esModule: true,
|
|
39
|
+
default: {
|
|
40
|
+
getLang: key => key,
|
|
41
|
+
formatString: (template, count) => `${template}:${count}`
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
jest.mock('./captureResult.less', () => ({}));
|
|
45
|
+
const {
|
|
46
|
+
CaptureResultToast
|
|
47
|
+
} = require('./captureResult');
|
|
48
|
+
const renderToast = count => renderToStaticMarkup(/*#__PURE__*/React.createElement(CaptureResultToast, {
|
|
49
|
+
brandColor: "#ff592a",
|
|
50
|
+
count: count,
|
|
51
|
+
kind: "screenshot",
|
|
52
|
+
onCheck: () => undefined,
|
|
53
|
+
thumbnailPath: "thingfile://capture.jpg"
|
|
54
|
+
}));
|
|
55
|
+
const countClass = (markup, className) => [...markup.matchAll(/class="([^"]*)"/g)].filter(_ref4 => {
|
|
56
|
+
let [, names] = _ref4;
|
|
57
|
+
return names.split(/\s+/).includes(className);
|
|
58
|
+
}).length;
|
|
59
|
+
describe('CaptureResultToast', () => {
|
|
60
|
+
it('keeps the single-item thumbnail unchanged', () => {
|
|
61
|
+
const markup = renderToast(1);
|
|
62
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(0);
|
|
63
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(0);
|
|
64
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image')).toBe(1);
|
|
65
|
+
});
|
|
66
|
+
it('renders both backdrops for two captured items', () => {
|
|
67
|
+
const markup = renderToast(2);
|
|
68
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
|
|
69
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
|
|
70
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
|
|
71
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
|
|
72
|
+
});
|
|
73
|
+
it('caps the backdrop count at two', () => {
|
|
74
|
+
const markup = renderToast(4);
|
|
75
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
|
|
76
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
|
|
77
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
|
|
78
|
+
expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
|
|
79
|
+
});
|
|
80
|
+
});
|
package/lib/widgets/index.d.ts
CHANGED
package/lib/widgets/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, useContext } from 'react';
|
|
2
|
-
import { View, Text,
|
|
2
|
+
import { View, Text, getSystemInfoSync } from '@ray-js/ray';
|
|
3
3
|
import { useSetState, useUpdateEffect } from 'ahooks';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { goToIpcPageNativeRoute } from '@ray-js/ray-ipc-utils';
|
|
6
6
|
import Strings from '../../i18n';
|
|
7
7
|
import { PlayState } from '../../interface';
|
|
8
|
+
import { getCaptureResultSummary } from '../../utils/captureResult';
|
|
9
|
+
import { CaptureResultToast } from '../captureResult/captureResult';
|
|
8
10
|
import { UIEventContext } from '../../ui/context';
|
|
9
11
|
import { pauseTimeToHideAllComponent, changeIgnoreHideStopPreview, widgetLabs, widgetClick } from '../../ui/constant';
|
|
10
12
|
import { useStore, getDefaultStore } from '../../ctx/store';
|
|
@@ -100,22 +102,45 @@ export function RecordVideo(props) {
|
|
|
100
102
|
playState: props.playState
|
|
101
103
|
});
|
|
102
104
|
const [state, setState] = useSetState({
|
|
103
|
-
showTimer: false,
|
|
104
105
|
showShot: false,
|
|
105
|
-
shotUrl: ''
|
|
106
|
+
shotUrl: '',
|
|
107
|
+
shotCount: 0
|
|
106
108
|
});
|
|
109
|
+
const recordResultRequestIdRef = useRef(0);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
return () => {
|
|
112
|
+
recordResultRequestIdRef.current += 1;
|
|
113
|
+
};
|
|
114
|
+
}, []);
|
|
115
|
+
const showRecordResult = async recordInfo => {
|
|
116
|
+
var _props$multiCameraCtx;
|
|
117
|
+
const requestId = ++recordResultRequestIdRef.current;
|
|
118
|
+
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;
|
|
119
|
+
const summary = await getCaptureResultSummary(recordInfo, {
|
|
120
|
+
multiLens: props.multiLens,
|
|
121
|
+
protocolCount: splitNum,
|
|
122
|
+
devId
|
|
123
|
+
});
|
|
124
|
+
if (requestId !== recordResultRequestIdRef.current) return;
|
|
125
|
+
if (!summary) return;
|
|
126
|
+
setState({
|
|
127
|
+
showShot: true,
|
|
128
|
+
shotUrl: summary.thumbnailPath,
|
|
129
|
+
shotCount: summary.isMultiLens ? summary.count : 0
|
|
130
|
+
});
|
|
131
|
+
};
|
|
107
132
|
|
|
108
133
|
/**
|
|
109
134
|
* 针对 playState为非连接中状态时,如果处于录制中, 结束录制
|
|
110
135
|
*/
|
|
111
136
|
useEffect(() => {
|
|
112
137
|
(async () => {
|
|
113
|
-
if (playState !== PlayState.PLAYING) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
138
|
+
if (playState !== PlayState.PLAYING && recording) {
|
|
139
|
+
try {
|
|
140
|
+
const recordInfo = await setRecording(false);
|
|
141
|
+
await showRecordResult(recordInfo);
|
|
142
|
+
} catch {
|
|
143
|
+
// setRecording reports the native failure through the configured toast.
|
|
119
144
|
}
|
|
120
145
|
}
|
|
121
146
|
})();
|
|
@@ -129,7 +154,8 @@ export function RecordVideo(props) {
|
|
|
129
154
|
timer.current = setTimeout(() => {
|
|
130
155
|
setState({
|
|
131
156
|
showShot: false,
|
|
132
|
-
shotUrl: ''
|
|
157
|
+
shotUrl: '',
|
|
158
|
+
shotCount: 0
|
|
133
159
|
});
|
|
134
160
|
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
135
161
|
}, CLOSE_TIME);
|
|
@@ -149,22 +175,20 @@ export function RecordVideo(props) {
|
|
|
149
175
|
showRecordToast();
|
|
150
176
|
}
|
|
151
177
|
}, [state.showShot, screenType]);
|
|
152
|
-
|
|
153
|
-
/** 根据showTimer的显示定时器 */
|
|
154
178
|
useUpdateEffect(() => {
|
|
155
|
-
if (
|
|
179
|
+
if (recording) {
|
|
156
180
|
showRecordTimer();
|
|
157
181
|
} else {
|
|
158
182
|
deleteContent('absolute', RECORD_VIDEO_TIMER_ID);
|
|
159
|
-
// 清除定时器,元素移除
|
|
160
183
|
}
|
|
161
|
-
}, [
|
|
184
|
+
}, [recording]);
|
|
162
185
|
|
|
163
186
|
/** 跳转相册 */
|
|
164
187
|
const handCheck = () => {
|
|
165
188
|
setState({
|
|
166
189
|
showShot: false,
|
|
167
|
-
shotUrl: ''
|
|
190
|
+
shotUrl: '',
|
|
191
|
+
shotCount: 0
|
|
168
192
|
});
|
|
169
193
|
deleteContent('absolute', RECORD_VIDEO_SUCCESS_TOAST_ID);
|
|
170
194
|
clearInterval(timer.current);
|
|
@@ -186,27 +210,13 @@ export function RecordVideo(props) {
|
|
|
186
210
|
marginLeft: screenType === 'vertical' ? '0' : '-200px'
|
|
187
211
|
},
|
|
188
212
|
content: () => {
|
|
189
|
-
return /*#__PURE__*/React.createElement(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
197
|
-
className: "ipc-player-plugin-record-success-play-icon-box"
|
|
198
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
199
|
-
className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-record-success-play-icon')
|
|
200
|
-
}))), /*#__PURE__*/React.createElement(View, {
|
|
201
|
-
className: "ipc-player-plugin-record-success-toast-title"
|
|
202
|
-
}, Strings.getLang('ipc_player_record_success_tip')), /*#__PURE__*/React.createElement(View, {
|
|
203
|
-
onClick: handCheck,
|
|
204
|
-
className: "ipc-player-plugin-record-success-toast-bottom",
|
|
205
|
-
style: {
|
|
206
|
-
color: brandColor,
|
|
207
|
-
borderColor: brandColor
|
|
208
|
-
}
|
|
209
|
-
}, Strings.getLang('ipc_player_record_success_check')));
|
|
213
|
+
return /*#__PURE__*/React.createElement(CaptureResultToast, {
|
|
214
|
+
brandColor: brandColor,
|
|
215
|
+
count: state.shotCount,
|
|
216
|
+
kind: "record",
|
|
217
|
+
onCheck: handCheck,
|
|
218
|
+
thumbnailPath: state.shotUrl
|
|
219
|
+
});
|
|
210
220
|
}
|
|
211
221
|
});
|
|
212
222
|
timeToCloseRecordToast();
|
|
@@ -218,8 +228,8 @@ export function RecordVideo(props) {
|
|
|
218
228
|
absoluteContentClassName: 'ipc-player-plugin-record-video-toast-wrap',
|
|
219
229
|
content: () => /*#__PURE__*/React.createElement(View, {
|
|
220
230
|
className: clsx('ipc-player-plugin-record-video-toast', {
|
|
221
|
-
'ipc-player-plugin-record-video-toast-show':
|
|
222
|
-
'ipc-player-plugin-record-video-toast-hide': !
|
|
231
|
+
'ipc-player-plugin-record-video-toast-show': recording,
|
|
232
|
+
'ipc-player-plugin-record-video-toast-hide': !recording
|
|
223
233
|
})
|
|
224
234
|
}, /*#__PURE__*/React.createElement(View, {
|
|
225
235
|
className: "ipc-player-plugin-record-video-toast-point",
|
|
@@ -230,9 +240,9 @@ export function RecordVideo(props) {
|
|
|
230
240
|
});
|
|
231
241
|
};
|
|
232
242
|
const handRecordVideo = async () => {
|
|
233
|
-
var _props$event
|
|
243
|
+
var _props$event;
|
|
234
244
|
const ev = (_props$event = props.event) !== null && _props$event !== void 0 ? _props$event : event;
|
|
235
|
-
|
|
245
|
+
ev.emit(widgetClick, {
|
|
236
246
|
widgetId: widgetLabs.RECORD_VIDEO
|
|
237
247
|
});
|
|
238
248
|
event.emit(pauseTimeToHideAllComponent);
|
|
@@ -242,6 +252,7 @@ export function RecordVideo(props) {
|
|
|
242
252
|
if (recordingDisabled) {
|
|
243
253
|
return false;
|
|
244
254
|
}
|
|
255
|
+
recordResultRequestIdRef.current += 1;
|
|
245
256
|
if (state.showShot && _recording) {
|
|
246
257
|
setState({
|
|
247
258
|
showShot: false
|
|
@@ -262,18 +273,11 @@ export function RecordVideo(props) {
|
|
|
262
273
|
}
|
|
263
274
|
if (target) {
|
|
264
275
|
setRecordingDisabled(true);
|
|
265
|
-
setState({
|
|
266
|
-
showTimer: true
|
|
267
|
-
});
|
|
268
276
|
/** 录制开始后3秒后才可结束 */
|
|
269
277
|
timeToResetRecordDisabled();
|
|
270
278
|
} else {
|
|
271
279
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
|
|
272
|
-
|
|
273
|
-
showTimer: false,
|
|
274
|
-
showShot: true,
|
|
275
|
-
shotUrl: recordInfo.tempImagePath
|
|
276
|
-
});
|
|
280
|
+
await showRecordResult(recordInfo);
|
|
277
281
|
}
|
|
278
282
|
} catch (err) {
|
|
279
283
|
props.event ? props.event.emit(changeIgnoreHideStopPreview, false) : event.emit(changeIgnoreHideStopPreview, false);
|
|
@@ -283,9 +287,6 @@ export function RecordVideo(props) {
|
|
|
283
287
|
toast({
|
|
284
288
|
title: errMsg
|
|
285
289
|
});
|
|
286
|
-
setState({
|
|
287
|
-
showTimer: false
|
|
288
|
-
});
|
|
289
290
|
}
|
|
290
291
|
return true;
|
|
291
292
|
};
|
|
@@ -1,116 +1,59 @@
|
|
|
1
1
|
.ipc-player-plugin-record-video-icon {
|
|
2
|
-
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
3
2
|
color: var(--iconColor);
|
|
3
|
+
font-size: calc(var(--iconPlayerSize) * var(--ipc-player-size-scale, 1)) !important;
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
.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;
|
|
10
11
|
transform: translateX(-50%);
|
|
11
12
|
}
|
|
12
13
|
|
|
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%);
|
|
26
25
|
display: flex;
|
|
27
|
-
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
28
26
|
align-items: center;
|
|
29
|
-
|
|
27
|
+
padding: calc(12px * var(--ipc-player-size-scale, 1));
|
|
28
|
+
background: linear-gradient(0deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.15)),
|
|
29
|
+
#000000;
|
|
30
30
|
border-radius: calc(8px * var(--ipc-player-size-scale, 1));
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
transform: translate(0, -110%);
|
|
32
|
+
|
|
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
|
+
|
|
38
39
|
.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));;
|
|
43
40
|
display: flex;
|
|
44
41
|
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
|
+
|
|
45
47
|
.ipc-player-plugin-record-video-toast-time-warp {
|
|
46
48
|
text-align: center;
|
|
47
49
|
}
|
|
50
|
+
|
|
48
51
|
.ipc-player-plugin-record-video-toast-time-delimiter {
|
|
49
|
-
margin: 0 calc(2px * var(--ipc-player-size-scale, 1))
|
|
52
|
+
margin: 0 calc(2px * var(--ipc-player-size-scale, 1));
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
/** 录制成功弹窗 */
|
|
55
57
|
.ipc-player-plugin-record-success-toast-wrap {
|
|
56
58
|
position: absolute;
|
|
57
59
|
}
|
|
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 @@
|
|
|
1
|
+
export {};
|