@scaleflex/widget-screen-capture 4.8.6 → 4.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +155 -0
- package/dist/style.min.css +1 -0
- package/lib/CaptureScreen.js +77 -0
- package/lib/RecordButton.js +55 -0
- package/lib/ScreenRecIcon.js +41 -0
- package/lib/StopWatch.js +105 -0
- package/lib/StreamStatus.js +56 -0
- package/lib/SubmitButton.js +36 -0
- package/lib/common.slice.js +29 -0
- package/lib/defaultLocale.js +9 -0
- package/lib/index.js +438 -0
- package/lib/style.scss +149 -0
- package/package.json +31 -31
- package/CHANGELOG.md +0 -7077
package/dist/style.css
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");
|
|
2
|
+
.filerobot-ScreenCapture-container {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
align-items: center;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.filerobot-ScreenCapture-videoContainer {
|
|
12
|
+
width: 100%;
|
|
13
|
+
flex: 1;
|
|
14
|
+
flex-grow: 1;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
background-color: #37414B;
|
|
17
|
+
text-align: center;
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
.filerobot-size--md .filerobot-ScreenCapture-videoContainer {
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.filerobot-ScreenCapture-video {
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
max-height: 100%;
|
|
27
|
+
position: absolute;
|
|
28
|
+
top: 0;
|
|
29
|
+
right: 0;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
left: 0;
|
|
32
|
+
margin: auto;
|
|
33
|
+
outline: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.filerobot-ScreenCapture-buttonContainer {
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 75px;
|
|
39
|
+
border-top: 1px solid #eaeaea;
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
padding: 0 20px;
|
|
44
|
+
background-color: #fff;
|
|
45
|
+
}
|
|
46
|
+
[data-filerobot-theme=dark] .filerobot-ScreenCapture-buttonContainer {
|
|
47
|
+
background-color: #1f1f1f;
|
|
48
|
+
border-top: 1px solid #333;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.filerobot-ScreenCapture-button:focus {
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
54
|
+
.filerobot-ScreenCapture-button::-moz-focus-inner {
|
|
55
|
+
border: 0;
|
|
56
|
+
}
|
|
57
|
+
.filerobot-ScreenCapture-button:focus {
|
|
58
|
+
box-shadow: 0 0 0 3px rgba(82, 130, 219, 0.5);
|
|
59
|
+
}
|
|
60
|
+
.filerobot-ScreenCapture-button {
|
|
61
|
+
width: 45px;
|
|
62
|
+
height: 45px;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
color: #fff;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
transition: all 0.3s;
|
|
67
|
+
}
|
|
68
|
+
[data-filerobot-theme=dark] .filerobot-ScreenCapture-button:focus {
|
|
69
|
+
outline: none;
|
|
70
|
+
}
|
|
71
|
+
[data-filerobot-theme=dark] .filerobot-ScreenCapture-button::-moz-focus-inner {
|
|
72
|
+
border: 0;
|
|
73
|
+
}
|
|
74
|
+
[data-filerobot-theme=dark] .filerobot-ScreenCapture-button:focus {
|
|
75
|
+
box-shadow: 0 0 0 2px rgba(170, 225, 255, 0.85);
|
|
76
|
+
}
|
|
77
|
+
.filerobot-size--md .filerobot-ScreenCapture-button {
|
|
78
|
+
width: 60px;
|
|
79
|
+
height: 60px;
|
|
80
|
+
}
|
|
81
|
+
.filerobot-ScreenCapture-button:hover {
|
|
82
|
+
background-color: rgb(210.5769230769, 26.9230769231, 45.1923076923);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.filerobot-ScreenCapture-button svg {
|
|
86
|
+
width: 30px;
|
|
87
|
+
height: 30px;
|
|
88
|
+
max-width: 100%;
|
|
89
|
+
max-height: 100%;
|
|
90
|
+
display: inline-block;
|
|
91
|
+
vertical-align: text-top;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
fill: currentColor;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.filerobot-ScreenCapture-button--submit {
|
|
97
|
+
background-color: #5282DB;
|
|
98
|
+
margin-left: 12px;
|
|
99
|
+
}
|
|
100
|
+
.filerobot-ScreenCapture-button--submit:hover {
|
|
101
|
+
background-color: rgb(60.8923444976, 114.7488038278, 214.6076555024);
|
|
102
|
+
}
|
|
103
|
+
.filerobot-ScreenCapture-button--submit:disabled {
|
|
104
|
+
background-color: #939393;
|
|
105
|
+
cursor: default;
|
|
106
|
+
}
|
|
107
|
+
.filerobot-ScreenCapture-button--submit:disabled:hover {
|
|
108
|
+
background-color: #eaeaea;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.filerobot-ScreenCapture-title {
|
|
112
|
+
font-size: 22px;
|
|
113
|
+
line-height: 1.35;
|
|
114
|
+
font-weight: 400;
|
|
115
|
+
margin: 0;
|
|
116
|
+
margin-bottom: 5px;
|
|
117
|
+
padding: 0 15px;
|
|
118
|
+
max-width: 500px;
|
|
119
|
+
text-align: center;
|
|
120
|
+
color: #333;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.filerobot-ScreenCapture-icon--stream {
|
|
124
|
+
position: absolute;
|
|
125
|
+
right: 0;
|
|
126
|
+
top: 0;
|
|
127
|
+
margin: 1rem;
|
|
128
|
+
z-index: 1;
|
|
129
|
+
}
|
|
130
|
+
.filerobot-ScreenCapture-icon--stream svg {
|
|
131
|
+
fill: #939393;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.filerobot-ScreenCapture-icon--streamActive svg {
|
|
135
|
+
animation: filerobot-ScreenCapture-icon--blink 1s cubic-bezier(0.47, 0, 0.75, 0.72) infinite;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes filerobot-ScreenCapture-icon--blink {
|
|
139
|
+
0% {
|
|
140
|
+
fill: #5282DB;
|
|
141
|
+
}
|
|
142
|
+
50% {
|
|
143
|
+
fill: #939393;
|
|
144
|
+
}
|
|
145
|
+
100% {
|
|
146
|
+
fill: #5282DB;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
.filerobot-ScreenCapture-button--video {
|
|
150
|
+
color: #fff;
|
|
151
|
+
background: #e32437;
|
|
152
|
+
}
|
|
153
|
+
.filerobot-ScreenCapture-button--video:hover {
|
|
154
|
+
background-color: rgb(187.967611336, 24.032388664, 40.3400809717);
|
|
155
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");.filerobot-ScreenCapture-container{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;width:100%}.filerobot-ScreenCapture-videoContainer{background-color:#37414b;flex:1;flex-grow:1;overflow:hidden;position:relative;text-align:center;width:100%}.filerobot-size--md .filerobot-ScreenCapture-videoContainer{max-width:100%}.filerobot-ScreenCapture-video{bottom:0;left:0;margin:auto;max-height:100%;max-width:100%;outline:none;position:absolute;right:0;top:0}.filerobot-ScreenCapture-buttonContainer{align-items:center;background-color:#fff;border-top:1px solid #eaeaea;display:flex;height:75px;justify-content:center;padding:0 20px;width:100%}[data-filerobot-theme=dark] .filerobot-ScreenCapture-buttonContainer{background-color:#1f1f1f;border-top:1px solid #333}.filerobot-ScreenCapture-button:focus{outline:none}.filerobot-ScreenCapture-button::-moz-focus-inner{border:0}.filerobot-ScreenCapture-button:focus{box-shadow:0 0 0 3px rgba(82,130,219,.5)}.filerobot-ScreenCapture-button{border-radius:50%;color:#fff;cursor:pointer;height:45px;transition:all .3s;width:45px}[data-filerobot-theme=dark] .filerobot-ScreenCapture-button:focus{outline:none}[data-filerobot-theme=dark] .filerobot-ScreenCapture-button::-moz-focus-inner{border:0}[data-filerobot-theme=dark] .filerobot-ScreenCapture-button:focus{box-shadow:0 0 0 2px rgba(170,225,255,.85)}.filerobot-size--md .filerobot-ScreenCapture-button{height:60px;width:60px}.filerobot-ScreenCapture-button:hover{background-color:#d31b2d}.filerobot-ScreenCapture-button svg{display:inline-block;height:30px;max-height:100%;max-width:100%;overflow:hidden;vertical-align:text-top;width:30px;fill:currentColor}.filerobot-ScreenCapture-button--submit{background-color:#5282db;margin-left:12px}.filerobot-ScreenCapture-button--submit:hover{background-color:#3d73d7}.filerobot-ScreenCapture-button--submit:disabled{background-color:#939393;cursor:default}.filerobot-ScreenCapture-button--submit:disabled:hover{background-color:#eaeaea}.filerobot-ScreenCapture-title{color:#333;font-size:22px;font-weight:400;line-height:1.35;margin:0 0 5px;max-width:500px;padding:0 15px;text-align:center}.filerobot-ScreenCapture-icon--stream{margin:1rem;position:absolute;right:0;top:0;z-index:1}.filerobot-ScreenCapture-icon--stream svg{fill:#939393}.filerobot-ScreenCapture-icon--streamActive svg{animation:filerobot-ScreenCapture-icon--blink 1s cubic-bezier(.47,0,.75,.72) infinite}@keyframes filerobot-ScreenCapture-icon--blink{0%{fill:#5282db}50%{fill:#939393}to{fill:#5282db}}.filerobot-ScreenCapture-button--video{background:#e32437;color:#fff}.filerobot-ScreenCapture-button--video:hover{background-color:#bc1828}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import RecordButton from './RecordButton';
|
|
3
|
+
import SubmitButton from './SubmitButton';
|
|
4
|
+
import StopWatch from './StopWatch';
|
|
5
|
+
import StreamStatus from './StreamStatus';
|
|
6
|
+
import { useSelector } from 'react-redux';
|
|
7
|
+
import { selectScreenCaptureCommonState } from './common.slice';
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
var RecorderScreen = function RecorderScreen(_ref) {
|
|
10
|
+
var onStartRecording = _ref.onStartRecording,
|
|
11
|
+
onStopRecording = _ref.onStopRecording,
|
|
12
|
+
onStop = _ref.onStop,
|
|
13
|
+
onSubmit = _ref.onSubmit,
|
|
14
|
+
i18n = _ref.i18n,
|
|
15
|
+
videoStream = _ref.stream;
|
|
16
|
+
var recordedVideo = useSelector(function (state) {
|
|
17
|
+
return selectScreenCaptureCommonState(state).recordedVideo;
|
|
18
|
+
});
|
|
19
|
+
var recording = useSelector(function (state) {
|
|
20
|
+
return selectScreenCaptureCommonState(state).recording;
|
|
21
|
+
});
|
|
22
|
+
var videoElementRef = useRef();
|
|
23
|
+
var videoElement = videoElementRef === null || videoElementRef === void 0 ? void 0 : videoElementRef.current;
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
return function () {
|
|
26
|
+
onStop();
|
|
27
|
+
};
|
|
28
|
+
}, []);
|
|
29
|
+
if (videoElement) {
|
|
30
|
+
// show stream
|
|
31
|
+
if (recording || !recordedVideo && !recording) {
|
|
32
|
+
videoElement.muted = true;
|
|
33
|
+
videoElement.autoPlay = true;
|
|
34
|
+
videoElement.srcObject = videoStream;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// show preview
|
|
38
|
+
if (recordedVideo && !recording) {
|
|
39
|
+
videoElement.muted = false;
|
|
40
|
+
videoElement.controls = true;
|
|
41
|
+
videoElement.src = recordedVideo;
|
|
42
|
+
|
|
43
|
+
// reset srcObject in dom. If not resetted, stream sticks in element
|
|
44
|
+
videoElement.srcObject = undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
48
|
+
className: "filerobot filerobot-ScreenCapture-container",
|
|
49
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
50
|
+
className: "filerobot-ScreenCapture-videoContainer",
|
|
51
|
+
children: [/*#__PURE__*/_jsx(StreamStatus, {
|
|
52
|
+
i18n: i18n
|
|
53
|
+
}), /*#__PURE__*/_jsx("video", {
|
|
54
|
+
ref: videoElementRef,
|
|
55
|
+
className: "filerobot-ScreenCapture-video",
|
|
56
|
+
playsInline: true,
|
|
57
|
+
autoPlay: true
|
|
58
|
+
}), /*#__PURE__*/_jsx(StopWatch, {
|
|
59
|
+
i18n: i18n
|
|
60
|
+
})]
|
|
61
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
62
|
+
className: "filerobot-ScreenCapture-buttonContainer",
|
|
63
|
+
children: [/*#__PURE__*/_jsx(RecordButton, {
|
|
64
|
+
recording: recording,
|
|
65
|
+
onStartRecording: onStartRecording,
|
|
66
|
+
onStopRecording: onStopRecording,
|
|
67
|
+
i18n: i18n
|
|
68
|
+
}), /*#__PURE__*/_jsx(SubmitButton, {
|
|
69
|
+
recording: recording,
|
|
70
|
+
recordedVideo: recordedVideo,
|
|
71
|
+
onSubmit: onSubmit,
|
|
72
|
+
i18n: i18n
|
|
73
|
+
})]
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
export default RecorderScreen;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Control screen capture recording. Will show record or stop button.
|
|
4
|
+
*/
|
|
5
|
+
export default function RecordButton(_ref) {
|
|
6
|
+
var recording = _ref.recording,
|
|
7
|
+
onStartRecording = _ref.onStartRecording,
|
|
8
|
+
onStopRecording = _ref.onStopRecording,
|
|
9
|
+
i18n = _ref.i18n;
|
|
10
|
+
if (recording) {
|
|
11
|
+
return /*#__PURE__*/_jsx("button", {
|
|
12
|
+
className: "filerobot-u-reset filerobot-c-btn filerobot-ScreenCapture-button filerobot-ScreenCapture-button--video filerobot-ScreenCapture-button--stop-rec",
|
|
13
|
+
type: "button",
|
|
14
|
+
title: i18n('webcamStopRecordingTitle'),
|
|
15
|
+
"aria-label": i18n('webcamStopRecordingTitle'),
|
|
16
|
+
onClick: onStopRecording,
|
|
17
|
+
"data-filerobot-super-focusable": true,
|
|
18
|
+
children: /*#__PURE__*/_jsx("svg", {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
focusable: "false",
|
|
21
|
+
className: "filerobot-c-icon",
|
|
22
|
+
width: "100",
|
|
23
|
+
height: "100",
|
|
24
|
+
viewBox: "0 0 100 100",
|
|
25
|
+
children: /*#__PURE__*/_jsx("rect", {
|
|
26
|
+
x: "15",
|
|
27
|
+
y: "15",
|
|
28
|
+
width: "70",
|
|
29
|
+
height: "70"
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/_jsx("button", {
|
|
35
|
+
className: "filerobot-u-reset filerobot-c-btn filerobot-ScreenCapture-button filerobot-ScreenCapture-button--video",
|
|
36
|
+
type: "button",
|
|
37
|
+
title: i18n('screenCaptureStartCapturingTitle'),
|
|
38
|
+
"aria-label": i18n('screenCaptureStopCapturingLabel'),
|
|
39
|
+
onClick: onStartRecording,
|
|
40
|
+
"data-filerobot-super-focusable": true,
|
|
41
|
+
children: /*#__PURE__*/_jsx("svg", {
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
focusable: "false",
|
|
44
|
+
className: "filerobot-c-icon",
|
|
45
|
+
width: "100",
|
|
46
|
+
height: "100",
|
|
47
|
+
viewBox: "0 0 100 100",
|
|
48
|
+
children: /*#__PURE__*/_jsx("circle", {
|
|
49
|
+
cx: "50",
|
|
50
|
+
cy: "50",
|
|
51
|
+
r: "40"
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
|
|
9
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
10
|
+
var ScreenRecIcon = function ScreenRecIcon() {
|
|
11
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
12
|
+
props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
13
|
+
return /*#__PURE__*/_jsx("svg", _objectSpread(_objectSpread({
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
focusable: "false",
|
|
16
|
+
width: "32",
|
|
17
|
+
height: "32",
|
|
18
|
+
viewBox: "0 0 32 32"
|
|
19
|
+
}, props), {}, {
|
|
20
|
+
children: /*#__PURE__*/_jsxs("g", {
|
|
21
|
+
fill: "none",
|
|
22
|
+
fillRule: "evenodd",
|
|
23
|
+
children: [/*#__PURE__*/_jsx("rect", {
|
|
24
|
+
fill: "#2C3E50",
|
|
25
|
+
width: "32",
|
|
26
|
+
height: "32",
|
|
27
|
+
rx: "16"
|
|
28
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
29
|
+
d: "M24.182 9H7.818C6.81 9 6 9.742 6 10.667v10c0 .916.81 1.666 1.818 1.666h4.546V24h7.272v-1.667h4.546c1 0 1.809-.75 1.809-1.666l.009-10C26 9.742 25.182 9 24.182 9zM24 21H8V11h16v10z",
|
|
30
|
+
fill: "#FFF",
|
|
31
|
+
fillRule: "nonzero"
|
|
32
|
+
}), /*#__PURE__*/_jsx("circle", {
|
|
33
|
+
fill: "#FFF",
|
|
34
|
+
cx: "16",
|
|
35
|
+
cy: "16",
|
|
36
|
+
r: "2"
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
export default ScreenRecIcon;
|
package/lib/StopWatch.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
|
+
import { useRef, useState } from 'react';
|
|
8
|
+
import { useSelector } from 'react-redux';
|
|
9
|
+
import { selectScreenCaptureCommonState } from './common.slice';
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var wrapperStyle = {
|
|
12
|
+
width: '100%',
|
|
13
|
+
height: '100%',
|
|
14
|
+
display: 'flex'
|
|
15
|
+
};
|
|
16
|
+
var overlayStyle = {
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
width: '100%',
|
|
19
|
+
height: '100%',
|
|
20
|
+
background: 'black',
|
|
21
|
+
opacity: 0.7
|
|
22
|
+
};
|
|
23
|
+
var infoContainerStyle = {
|
|
24
|
+
marginLeft: 'auto',
|
|
25
|
+
marginRight: 'auto',
|
|
26
|
+
marginTop: 'auto',
|
|
27
|
+
marginBottom: 'auto',
|
|
28
|
+
zIndex: 1,
|
|
29
|
+
color: 'white'
|
|
30
|
+
};
|
|
31
|
+
var infotextStyle = {
|
|
32
|
+
marginLeft: 'auto',
|
|
33
|
+
marginRight: 'auto',
|
|
34
|
+
marginBottom: '1rem',
|
|
35
|
+
fontSize: '1.5rem'
|
|
36
|
+
};
|
|
37
|
+
var timeStyle = {
|
|
38
|
+
display: 'block',
|
|
39
|
+
fontWeight: 'bold',
|
|
40
|
+
marginLeft: 'auto',
|
|
41
|
+
marginRight: 'auto',
|
|
42
|
+
fontSize: '3rem',
|
|
43
|
+
fontFamily: 'Courier New'
|
|
44
|
+
};
|
|
45
|
+
var StopWatch = function StopWatch(_ref) {
|
|
46
|
+
var i18n = _ref.i18n;
|
|
47
|
+
var recording = useSelector(function (state) {
|
|
48
|
+
return selectScreenCaptureCommonState(state).recording;
|
|
49
|
+
});
|
|
50
|
+
var _useState = useState(0),
|
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
52
|
+
elapsedTime = _useState2[0],
|
|
53
|
+
setElapsedTime = _useState2[1];
|
|
54
|
+
var timerRef = useRef(null);
|
|
55
|
+
var isTimerRunning = useRef(false);
|
|
56
|
+
var startTimer = function startTimer() {
|
|
57
|
+
_timerTick();
|
|
58
|
+
isTimerRunning.current = true;
|
|
59
|
+
};
|
|
60
|
+
var resetTimer = function resetTimer() {
|
|
61
|
+
clearTimeout(timerRef.current);
|
|
62
|
+
setElapsedTime(0);
|
|
63
|
+
isTimerRunning.current = false;
|
|
64
|
+
};
|
|
65
|
+
var _timerTick = function timerTick() {
|
|
66
|
+
timerRef.current = setTimeout(function () {
|
|
67
|
+
setElapsedTime(function (elapsedTime) {
|
|
68
|
+
return elapsedTime + 1;
|
|
69
|
+
});
|
|
70
|
+
_timerTick();
|
|
71
|
+
}, 1000);
|
|
72
|
+
};
|
|
73
|
+
var fmtMSS = function fmtMSS(s) {
|
|
74
|
+
return (s - (s %= 60)) / 60 + (s > 9 ? ':' : ':0') + s;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// second to minutes and seconds
|
|
78
|
+
var minAndSec = fmtMSS(elapsedTime);
|
|
79
|
+
if (recording && !(isTimerRunning !== null && isTimerRunning !== void 0 && isTimerRunning.current)) {
|
|
80
|
+
startTimer();
|
|
81
|
+
}
|
|
82
|
+
if (!recording && isTimerRunning !== null && isTimerRunning !== void 0 && isTimerRunning.current) {
|
|
83
|
+
resetTimer();
|
|
84
|
+
}
|
|
85
|
+
if (recording) {
|
|
86
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
87
|
+
style: wrapperStyle,
|
|
88
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
89
|
+
style: overlayStyle
|
|
90
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
91
|
+
style: infoContainerStyle,
|
|
92
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
93
|
+
style: infotextStyle,
|
|
94
|
+
children: i18n('screenCaptureRecordingText')
|
|
95
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
96
|
+
style: timeStyle,
|
|
97
|
+
children: minAndSec
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
} else {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
export default StopWatch;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useSelector } from 'react-redux';
|
|
2
|
+
import { selectScreenCaptureCommonState } from './common.slice';
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
export default (function (_ref) {
|
|
5
|
+
var i18n = _ref.i18n;
|
|
6
|
+
var streamActive = useSelector(function (state) {
|
|
7
|
+
return selectScreenCaptureCommonState(state).streamActive;
|
|
8
|
+
});
|
|
9
|
+
if (streamActive) {
|
|
10
|
+
return /*#__PURE__*/_jsx("div", {
|
|
11
|
+
title: i18n('screenCaptureStreamActive'),
|
|
12
|
+
"aria-label": i18n('screenCaptureStreamActive'),
|
|
13
|
+
className: "filerobot-ScreenCapture-icon--stream filerobot-ScreenCapture-icon--streamActive",
|
|
14
|
+
children: /*#__PURE__*/_jsxs("svg", {
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
focusable: "false",
|
|
17
|
+
width: "24",
|
|
18
|
+
height: "24",
|
|
19
|
+
viewBox: "0 0 24 24",
|
|
20
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
21
|
+
d: "M0 0h24v24H0z",
|
|
22
|
+
opacity: ".1",
|
|
23
|
+
fill: "none"
|
|
24
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
25
|
+
d: "M0 0h24v24H0z",
|
|
26
|
+
fill: "none"
|
|
27
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
28
|
+
d: "M1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm18-7H5v1.63c3.96 1.28 7.09 4.41 8.37 8.37H19V7zM1 10v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11zm20-7H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
|
|
29
|
+
})]
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
return /*#__PURE__*/_jsx("div", {
|
|
34
|
+
title: i18n('screenCaptureStreamPassiveTitle'),
|
|
35
|
+
"aria-label": i18n('screenCaptureStreamPassiveTitle'),
|
|
36
|
+
className: "filerobot-ScreenCapture-icon--stream",
|
|
37
|
+
children: /*#__PURE__*/_jsxs("svg", {
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
focusable: "false",
|
|
40
|
+
width: "24",
|
|
41
|
+
height: "24",
|
|
42
|
+
viewBox: "0 0 24 24",
|
|
43
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
44
|
+
d: "M0 0h24v24H0z",
|
|
45
|
+
opacity: ".1",
|
|
46
|
+
fill: "none"
|
|
47
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
48
|
+
d: "M0 0h24v24H0z",
|
|
49
|
+
fill: "none"
|
|
50
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
51
|
+
d: "M21 3H3c-1.1 0-2 .9-2 2v3h2V5h18v14h-7v2h7c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM1 18v3h3c0-1.66-1.34-3-3-3zm0-4v2c2.76 0 5 2.24 5 5h2c0-3.87-3.13-7-7-7zm0-4v2c4.97 0 9 4.03 9 9h2c0-6.08-4.93-11-11-11z"
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Submit recorded video to filerobot. Enabled when file is available
|
|
4
|
+
*/
|
|
5
|
+
export default function SubmitButton(_ref) {
|
|
6
|
+
var recordedVideo = _ref.recordedVideo,
|
|
7
|
+
recording = _ref.recording,
|
|
8
|
+
onSubmit = _ref.onSubmit,
|
|
9
|
+
i18n = _ref.i18n;
|
|
10
|
+
if (recordedVideo && !recording) {
|
|
11
|
+
return /*#__PURE__*/_jsx("button", {
|
|
12
|
+
className: "filerobot-u-reset filerobot-c-btn filerobot-ScreenCapture-button filerobot-ScreenCapture-button--submit",
|
|
13
|
+
type: "button",
|
|
14
|
+
title: i18n('screenCaptureSubmitRecordedFileTitle'),
|
|
15
|
+
"aria-label": i18n('screenCaptureSubmitRecordedFileTitle'),
|
|
16
|
+
onClick: onSubmit,
|
|
17
|
+
"data-filerobot-super-focusable": true,
|
|
18
|
+
children: /*#__PURE__*/_jsxs("svg", {
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
focusable: "false",
|
|
21
|
+
className: "filerobot-c-icon",
|
|
22
|
+
width: "48",
|
|
23
|
+
height: "48",
|
|
24
|
+
viewBox: "0 0 48 48",
|
|
25
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
26
|
+
d: "M0 0h48v48h-48z",
|
|
27
|
+
fill: "none"
|
|
28
|
+
}), /*#__PURE__*/_jsx("path", {
|
|
29
|
+
d: "M38.71 20.07c-1.36-6.88-7.43-12.07-14.71-12.07-5.78 0-10.79 3.28-13.3 8.07-6.01.65-10.7 5.74-10.7 11.93 0 6.63 5.37 12 12 12h26c5.52 0 10-4.48 10-10 0-5.28-4.11-9.56-9.29-9.93zm-10.71 5.93v8h-8v-8h-6l10-10 10 10h-6z"
|
|
30
|
+
})]
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
8
|
+
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
9
|
+
var initialState = {
|
|
10
|
+
streamActive: false,
|
|
11
|
+
audioStreamActive: false,
|
|
12
|
+
recording: false,
|
|
13
|
+
recordedVideo: null
|
|
14
|
+
};
|
|
15
|
+
var commonSlice = createSlice({
|
|
16
|
+
name: PLUGINS_IDS.SCREEN_CAPTURE,
|
|
17
|
+
initialState: initialState,
|
|
18
|
+
reducers: {
|
|
19
|
+
screenCaptureCommonStateUpdated: function screenCaptureCommonStateUpdated(state, action) {
|
|
20
|
+
return _objectSpread(_objectSpread({}, state), action.payload);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var screenCaptureCommonStateUpdated = commonSlice.actions.screenCaptureCommonStateUpdated;
|
|
25
|
+
export { screenCaptureCommonStateUpdated };
|
|
26
|
+
export var selectScreenCaptureCommonState = function selectScreenCaptureCommonState(state) {
|
|
27
|
+
return state[PLUGINS_IDS.SCREEN_CAPTURE];
|
|
28
|
+
};
|
|
29
|
+
export default commonSlice.reducer;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
screenCaptureStartCapturingTitle: 'Begin screen capturing',
|
|
3
|
+
screenCaptureStopCapturingLabel: 'Stop screen capturing',
|
|
4
|
+
screenCaptureSubmitRecordedFileTitle: 'Submit captured video',
|
|
5
|
+
screenCaptureStreamActive: 'Stream active',
|
|
6
|
+
screenCaptureStreamPassiveTitle: 'Stream passive',
|
|
7
|
+
screenCaptureMicDisabledInfo: 'Microphone access denied by user',
|
|
8
|
+
screenCaptureRecordingText: 'Recording'
|
|
9
|
+
};
|