l-min-components 1.7.1538 → 1.7.1540
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/package.json +1 -1
- package/src/components/reportsComponents/reportQuestions/index.jsx +11 -2
- package/src/components/video-player/icons/zoomIn.jsx +23 -0
- package/src/components/video-player/icons/zoomOut.jsx +21 -0
- package/src/components/video-player/index.jsx +82 -53
- package/src/components/video-player/index.styled.jsx +27 -12
package/package.json
CHANGED
|
@@ -100,8 +100,9 @@ const ReportQuestions = ({
|
|
|
100
100
|
const commentData = answerData?.answer?.comments;
|
|
101
101
|
const hasAnswer = answerData?.answer?.data;
|
|
102
102
|
useEffect(() => {
|
|
103
|
-
if (commentData?.length
|
|
104
|
-
|
|
103
|
+
if (commentData?.length && findedQuestion?.question_id)
|
|
104
|
+
setComment(commentData?.[0]);
|
|
105
|
+
}, [commentData, findedQuestion?.question_id, questionActivityID]);
|
|
105
106
|
useEffect(() => {
|
|
106
107
|
if (findedQuestion?.question_id) {
|
|
107
108
|
if (
|
|
@@ -149,10 +150,18 @@ const ReportQuestions = ({
|
|
|
149
150
|
);
|
|
150
151
|
const prevId = questions?.[currentQuestionIndex - 1]?.question_activity_id;
|
|
151
152
|
const nextId = questions?.[currentQuestionIndex + 1]?.question_activity_id;
|
|
153
|
+
|
|
154
|
+
const reset = () => {
|
|
155
|
+
setAIScore(0);
|
|
156
|
+
setInstructorScore(0);
|
|
157
|
+
setComment(null);
|
|
158
|
+
};
|
|
152
159
|
const handleNext = () => {
|
|
160
|
+
reset();
|
|
153
161
|
if (nextId) onSwitchQuestion?.(nextId);
|
|
154
162
|
};
|
|
155
163
|
const handlePrev = () => {
|
|
164
|
+
reset();
|
|
156
165
|
if (prevId) onSwitchQuestion?.(prevId);
|
|
157
166
|
};
|
|
158
167
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const ZoomInIcon = ({ onClick }) => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width="15"
|
|
7
|
+
height="15"
|
|
8
|
+
viewBox="0 0 15 15"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
onClick={onClick}
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M2.5 4.81065V2.40625M2.5 2.40625H5M2.5 2.40625L5.625 5.41176M12.5 4.81065V2.40625M12.5 2.40625H10M12.5 2.40625L9.375 5.41176M2.5 9.61946V12.0239M2.5 12.0239H5M2.5 12.0239L5.625 9.01836M12.5 12.0239L9.375 9.01836M12.5 12.0239V9.61946M12.5 12.0239H10"
|
|
15
|
+
stroke="#4A4D4D"
|
|
16
|
+
stroke-linecap="round"
|
|
17
|
+
stroke-linejoin="round"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default ZoomInIcon;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
const ZoomOutIcon = ({ onClick }) => {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width="13"
|
|
7
|
+
height="13"
|
|
8
|
+
viewBox="0 0 13 13"
|
|
9
|
+
fill="none"
|
|
10
|
+
onClick={onClick}
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M6.875 5.40991V2.4044H8.75L6.25 0L3.75 2.4044H5.625V5.40991H2.5V3.60661L0 6.01101L2.5 8.41542V6.61211H5.625V9.61762H3.75L6.25 12.022L8.75 9.61762H6.875V6.61211H10V8.41542L12.5 6.01101L10 3.60661V5.40991H6.875Z"
|
|
15
|
+
fill="#323232"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default ZoomOutIcon;
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
useContext,
|
|
6
6
|
useMemo,
|
|
7
7
|
useCallback,
|
|
8
|
-
} from
|
|
9
|
-
import { OutletContext } from
|
|
10
|
-
import FullPageLoader from
|
|
11
|
-
import screenfull from
|
|
12
|
-
import Hls from
|
|
8
|
+
} from "react";
|
|
9
|
+
import { OutletContext } from "../AppMainLayout";
|
|
10
|
+
import FullPageLoader from "../fullPageLoader";
|
|
11
|
+
import screenfull from "screenfull";
|
|
12
|
+
import Hls from "hls.js";
|
|
13
13
|
import {
|
|
14
14
|
ErrorMessage,
|
|
15
15
|
LoadingScreen,
|
|
@@ -23,17 +23,21 @@ import PauseIcon from "./icons/pause";
|
|
|
23
23
|
import errorImage from "./icons/laptop-book.png";
|
|
24
24
|
import useTranslation from "../../hooks/useTranslation.jsx";
|
|
25
25
|
import wordStore from "../../mc/wordStore.json";
|
|
26
|
+
import ZoomInIcon from "./icons/zoomIn.jsx";
|
|
27
|
+
import ZoomOutIcon from "./icons/zoomOut.jsx";
|
|
26
28
|
const VideoPlayer2 = ({
|
|
27
29
|
width,
|
|
28
|
-
height =
|
|
30
|
+
height = "360px",
|
|
29
31
|
style,
|
|
30
32
|
hideRange,
|
|
31
33
|
controlSize,
|
|
32
34
|
src,
|
|
33
35
|
streamUrl,
|
|
34
36
|
small,
|
|
37
|
+
onFullModeClick,
|
|
35
38
|
}) => {
|
|
36
39
|
const { findText } = useTranslation(wordStore);
|
|
40
|
+
const [isFullscreen, setIsFullScreen] = useState(false);
|
|
37
41
|
const [isPlaying, setIsPlaying] = useState(false);
|
|
38
42
|
const [isSeeking, setIsSeeking] = useState(false);
|
|
39
43
|
const [isBuffering, setIsBuffering] = useState(false);
|
|
@@ -55,8 +59,8 @@ const VideoPlayer2 = ({
|
|
|
55
59
|
const minutes = Math.floor(sec_num / 60) % 60;
|
|
56
60
|
const seconds = sec_num % 60;
|
|
57
61
|
return [hours, minutes, seconds]
|
|
58
|
-
.map((v) => (v < 10 ?
|
|
59
|
-
.join(
|
|
62
|
+
.map((v) => (v < 10 ? "0" + v : v))
|
|
63
|
+
.join(":");
|
|
60
64
|
}, []);
|
|
61
65
|
const play = useCallback(() => {
|
|
62
66
|
if (videoRef?.current && isReady) {
|
|
@@ -69,10 +73,17 @@ const VideoPlayer2 = ({
|
|
|
69
73
|
}
|
|
70
74
|
}, [isReady, videoRef?.current]);
|
|
71
75
|
const handleFullScreen = useCallback(() => {
|
|
72
|
-
if (
|
|
73
|
-
|
|
76
|
+
if (onFullModeClick) {
|
|
77
|
+
setIsFullScreen((prev) => {
|
|
78
|
+
onFullModeClick?.(!prev);
|
|
79
|
+
return !prev;
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
if (screenfull.isEnabled) {
|
|
83
|
+
screenfull.toggle(playContainerRef.current);
|
|
84
|
+
}
|
|
74
85
|
}
|
|
75
|
-
}, [playContainerRef?.current]);
|
|
86
|
+
}, [playContainerRef?.current, isFullscreen]);
|
|
76
87
|
const handleProgress = useCallback(() => {
|
|
77
88
|
if (count > 3) {
|
|
78
89
|
setHideController(true);
|
|
@@ -133,29 +144,29 @@ const VideoPlayer2 = ({
|
|
|
133
144
|
setIsReady(true);
|
|
134
145
|
};
|
|
135
146
|
const attachEvents = () => {
|
|
136
|
-
video?.addEventListener(
|
|
137
|
-
video?.addEventListener(
|
|
138
|
-
video?.addEventListener(
|
|
139
|
-
video?.addEventListener(
|
|
147
|
+
video?.addEventListener("play", handlePlay);
|
|
148
|
+
video?.addEventListener("pause", handlePause);
|
|
149
|
+
video?.addEventListener("ended", handleEnded);
|
|
150
|
+
video?.addEventListener("timeupdate", handleTimeUpdate);
|
|
140
151
|
// video?.addEventListener("waiting", handleWaiting);
|
|
141
152
|
if (streamUrl && !src) {
|
|
142
|
-
video?.addEventListener(
|
|
153
|
+
video?.addEventListener("canplay", handleCanPlay);
|
|
143
154
|
}
|
|
144
155
|
};
|
|
145
156
|
const detachEvents = () => {
|
|
146
|
-
video?.removeEventListener(
|
|
147
|
-
video?.removeEventListener(
|
|
148
|
-
video?.removeEventListener(
|
|
149
|
-
video?.removeEventListener(
|
|
157
|
+
video?.removeEventListener("play", handlePlay);
|
|
158
|
+
video?.removeEventListener("pause", handlePause);
|
|
159
|
+
video?.removeEventListener("ended", handleEnded);
|
|
160
|
+
video?.removeEventListener("timeupdate", handleTimeUpdate);
|
|
150
161
|
// video?.removeEventListener("waiting", handleWaiting);
|
|
151
|
-
video?.removeEventListener(
|
|
162
|
+
video?.removeEventListener("canplay", handleCanPlay);
|
|
152
163
|
};
|
|
153
164
|
if (!src && Hls.isSupported()) {
|
|
154
165
|
hlsRef.current = new Hls({
|
|
155
166
|
xhrSetup: function (xhr, url) {
|
|
156
167
|
const modifiedURL = `${url}?_account=${accountId}`;
|
|
157
|
-
xhr.open(
|
|
158
|
-
xhr.setRequestHeader(
|
|
168
|
+
xhr.open("GET", modifiedURL, true);
|
|
169
|
+
xhr.setRequestHeader("Authorization", `Bearer ${accessToken}`);
|
|
159
170
|
},
|
|
160
171
|
lowLatencyMode: true,
|
|
161
172
|
});
|
|
@@ -164,32 +175,32 @@ const VideoPlayer2 = ({
|
|
|
164
175
|
hlsRef.current?.loadSource(url);
|
|
165
176
|
});
|
|
166
177
|
hlsRef.current?.on(Hls.Events.LEVEL_SWITCHED, (val) => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
178
|
+
// setIsReady(true);
|
|
179
|
+
// setError(null);
|
|
180
|
+
// if (val === "hlsLevelSwitched") {
|
|
181
|
+
// }
|
|
171
182
|
});
|
|
172
183
|
hlsRef.current?.on(Hls.Events.LEVEL_LOADING, (val) => {
|
|
173
|
-
if (val ===
|
|
184
|
+
if (val === "hlsLevelLoading") {
|
|
174
185
|
setIsReady(false);
|
|
175
186
|
}
|
|
176
187
|
});
|
|
177
188
|
hlsRef.current?.on(Hls.Events.BUFFER_STALLED, () => setIsBuffering(true));
|
|
178
189
|
hlsRef.current?.on(Hls.Events.BUFFER_APPENDED, () =>
|
|
179
|
-
setIsBuffering(false)
|
|
190
|
+
setIsBuffering(false)
|
|
180
191
|
);
|
|
181
192
|
hlsRef.current?.on(Hls.Events.BUFFER_CREATED, (val) => {
|
|
182
|
-
if (val ===
|
|
193
|
+
if (val === "hlsBufferCreated") {
|
|
183
194
|
setIsBuffering(true);
|
|
184
195
|
}
|
|
185
196
|
});
|
|
186
197
|
hlsRef.current?.on(Hls.Events.BUFFER_APPENDED, (val) => {
|
|
187
|
-
if (val ===
|
|
198
|
+
if (val === "hlsBufferAppended") {
|
|
188
199
|
setIsBuffering(false);
|
|
189
200
|
}
|
|
190
201
|
});
|
|
191
202
|
hlsRef.current?.on(Hls.Events.ERROR, (event, data) => {
|
|
192
|
-
console.warn(
|
|
203
|
+
console.warn("HLS error", data);
|
|
193
204
|
if (data.fatal) {
|
|
194
205
|
setError(data);
|
|
195
206
|
setIsReady(false);
|
|
@@ -200,7 +211,7 @@ const VideoPlayer2 = ({
|
|
|
200
211
|
} else {
|
|
201
212
|
if (
|
|
202
213
|
hlsRef.current &&
|
|
203
|
-
typeof hlsRef.current.destroy ===
|
|
214
|
+
typeof hlsRef.current.destroy === "function" &&
|
|
204
215
|
!error
|
|
205
216
|
) {
|
|
206
217
|
hlsRef.current?.destroy();
|
|
@@ -209,14 +220,14 @@ const VideoPlayer2 = ({
|
|
|
209
220
|
}
|
|
210
221
|
}
|
|
211
222
|
});
|
|
212
|
-
} else if (video.canPlayType(
|
|
223
|
+
} else if (video.canPlayType("application/vnd.apple.mpegurl") && !src) {
|
|
213
224
|
video.src = url;
|
|
214
|
-
video.addEventListener(
|
|
225
|
+
video.addEventListener("loadedmetadata", () => {
|
|
215
226
|
setIsReady(true);
|
|
216
227
|
});
|
|
217
228
|
} else {
|
|
218
229
|
video.src = src;
|
|
219
|
-
video.addEventListener(
|
|
230
|
+
video.addEventListener("loadedmetadata", () => {
|
|
220
231
|
setIsReady(true);
|
|
221
232
|
});
|
|
222
233
|
video.load();
|
|
@@ -225,7 +236,7 @@ const VideoPlayer2 = ({
|
|
|
225
236
|
return () => {
|
|
226
237
|
if (
|
|
227
238
|
hlsRef.current &&
|
|
228
|
-
typeof hlsRef.current?.destroy ===
|
|
239
|
+
typeof hlsRef.current?.destroy === "function" &&
|
|
229
240
|
!error
|
|
230
241
|
) {
|
|
231
242
|
hlsRef.current?.destroy();
|
|
@@ -234,6 +245,14 @@ const VideoPlayer2 = ({
|
|
|
234
245
|
detachEvents();
|
|
235
246
|
};
|
|
236
247
|
}, [url, accountId, accessToken, videoRef.current, error]);
|
|
248
|
+
|
|
249
|
+
useEffect(() => {
|
|
250
|
+
if (screenfull.isEnabled) {
|
|
251
|
+
screenfull.on("change", () => {
|
|
252
|
+
setIsFullScreen(screenfull.isFullscreen);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}, []);
|
|
237
256
|
return (
|
|
238
257
|
<VideoPlayerContainer
|
|
239
258
|
ref={playContainerRef}
|
|
@@ -246,7 +265,7 @@ const VideoPlayer2 = ({
|
|
|
246
265
|
<ErrorMessage
|
|
247
266
|
width={width}
|
|
248
267
|
height={height}
|
|
249
|
-
className={small ?
|
|
268
|
+
className={small ? "small" : undefined}
|
|
250
269
|
>
|
|
251
270
|
<div>
|
|
252
271
|
<img src={errorImage} alt="" />
|
|
@@ -285,21 +304,31 @@ const VideoPlayer2 = ({
|
|
|
285
304
|
<VideoController hide={hideController} size={controlSize}>
|
|
286
305
|
{!hideRange && (
|
|
287
306
|
<RangeContainer>
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
307
|
+
<div className="range_body">
|
|
308
|
+
<p className="range-text duration_text">
|
|
309
|
+
{formatTime(progress?.currentTime || 0)}
|
|
310
|
+
</p>
|
|
311
|
+
<input
|
|
312
|
+
type="range"
|
|
313
|
+
min={0}
|
|
314
|
+
max={100}
|
|
315
|
+
className="range"
|
|
316
|
+
onChange={handleSeekChange}
|
|
317
|
+
onMouseDown={handleSeekMouseDown}
|
|
318
|
+
onMouseUp={handleSeekMouseUp}
|
|
319
|
+
value={(rangeProgress || 0) * 100}
|
|
320
|
+
/>
|
|
321
|
+
<p className="range-text">
|
|
322
|
+
{formatTime(progress?.duration || 0)}
|
|
323
|
+
</p>
|
|
324
|
+
</div>
|
|
325
|
+
|
|
326
|
+
{isFullscreen ? (
|
|
327
|
+
<ZoomOutIcon onClick={handleFullScreen} />
|
|
328
|
+
) : (
|
|
329
|
+
<ZoomInIcon onClick={handleFullScreen} />
|
|
330
|
+
)}
|
|
331
|
+
{/* <VideoScreenIcon onClick={handleFullScreen} /> */}
|
|
303
332
|
</RangeContainer>
|
|
304
333
|
)}
|
|
305
334
|
{isReady &&
|
|
@@ -48,14 +48,26 @@ export const RangeContainer = styled.div`
|
|
|
48
48
|
background: #fff;
|
|
49
49
|
display: flex;
|
|
50
50
|
align-items: center;
|
|
51
|
-
padding:
|
|
51
|
+
padding: 0 12.5px;
|
|
52
|
+
height: 15px;
|
|
52
53
|
gap: 15px;
|
|
53
54
|
position: relative;
|
|
55
|
+
max-width: 543px;
|
|
56
|
+
width: 100%;
|
|
57
|
+
margin: 0 auto;
|
|
58
|
+
.range_body {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 10px;
|
|
62
|
+
width: 100%;
|
|
63
|
+
}
|
|
54
64
|
.range-text {
|
|
55
|
-
position: absolute;
|
|
56
65
|
color: #b0dcdc;
|
|
57
66
|
font-size: 10px;
|
|
58
|
-
|
|
67
|
+
color: #636666;
|
|
68
|
+
&.duration_text {
|
|
69
|
+
color: #00c2c2;
|
|
70
|
+
}
|
|
59
71
|
}
|
|
60
72
|
svg {
|
|
61
73
|
cursor: pointer;
|
|
@@ -65,18 +77,21 @@ export const RangeContainer = styled.div`
|
|
|
65
77
|
flex: 1;
|
|
66
78
|
width: 100%;
|
|
67
79
|
display: block;
|
|
80
|
+
height: 4px;
|
|
68
81
|
-webkit-appearance: none;
|
|
69
82
|
appearance: none;
|
|
70
83
|
overflow: hidden;
|
|
71
84
|
cursor: pointer;
|
|
85
|
+
background-color: transparent;
|
|
86
|
+
|
|
72
87
|
&::-webkit-slider-runnable-track {
|
|
73
|
-
height:
|
|
88
|
+
height: 4px;
|
|
74
89
|
background: rgba(198, 204, 204, 0.4);
|
|
75
90
|
border-radius: 16px;
|
|
76
91
|
}
|
|
77
92
|
|
|
78
93
|
&::-moz-range-track {
|
|
79
|
-
height:
|
|
94
|
+
height: 4px;
|
|
80
95
|
background: rgba(198, 204, 204, 0.4);
|
|
81
96
|
border-radius: 16px;
|
|
82
97
|
}
|
|
@@ -84,8 +99,8 @@ export const RangeContainer = styled.div`
|
|
|
84
99
|
&::-webkit-slider-thumb {
|
|
85
100
|
-webkit-appearance: none;
|
|
86
101
|
appearance: none;
|
|
87
|
-
height:
|
|
88
|
-
width:
|
|
102
|
+
height: 4px;
|
|
103
|
+
width: 4px;
|
|
89
104
|
background-color: #099;
|
|
90
105
|
border-radius: 50%;
|
|
91
106
|
border: 2px solid #099;
|
|
@@ -93,12 +108,12 @@ export const RangeContainer = styled.div`
|
|
|
93
108
|
}
|
|
94
109
|
|
|
95
110
|
&::-moz-range-thumb {
|
|
96
|
-
height:
|
|
97
|
-
width:
|
|
98
|
-
background-color: #
|
|
111
|
+
height: 4px;
|
|
112
|
+
width: 6px;
|
|
113
|
+
background-color: #00c2c2;
|
|
99
114
|
border-radius: 50%;
|
|
100
|
-
border: 1px solid #
|
|
101
|
-
box-shadow: -9999px 0 0 9993px #
|
|
115
|
+
border: 1px solid #009999;
|
|
116
|
+
box-shadow: -9999px 0 0 9993px #009999;
|
|
102
117
|
}
|
|
103
118
|
}
|
|
104
119
|
/* .range::-webkit-slider-thumb {
|