easyproctor-hml 0.0.1
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/README.md +228 -0
- package/dtos/AlertDTO.d.ts +5 -0
- package/dtos/ProctoringConfigDto.d.ts +10 -0
- package/dtos/SaveScreenDTO.d.ts +5 -0
- package/dtos/SessionDTO.d.ts +10 -0
- package/dtos/StartProctoringResponse.d.ts +12 -0
- package/dtos/UploadDataDTO.d.ts +5 -0
- package/errors/errors.d.ts +10 -0
- package/esm/index.js +25243 -0
- package/index.d.ts +1 -0
- package/index.js +36806 -0
- package/interfaces/Devices.d.ts +9 -0
- package/modules/checkPermissions.d.ts +2 -0
- package/modules/enumarateDevices.d.ts +2 -0
- package/new-flow/backend/BackendService.d.ts +47 -0
- package/new-flow/download/IDownloadService.d.ts +4 -0
- package/new-flow/download/downloadService.d.ts +10 -0
- package/new-flow/proctoring/ProctoringRecorder.d.ts +10 -0
- package/new-flow/proctoring/ProctoringSession.d.ts +52 -0
- package/new-flow/proctoring/ProctoringUploader.d.ts +13 -0
- package/new-flow/recorders/AlertRecorder.d.ts +19 -0
- package/new-flow/recorders/AudioRecorder.d.ts +13 -0
- package/new-flow/recorders/CameraRecorder.d.ts +22 -0
- package/new-flow/recorders/IRecorder.d.ts +8 -0
- package/new-flow/recorders/ScreenRecorder.d.ts +19 -0
- package/new-flow/repository/ISessionRepository.d.ts +9 -0
- package/new-flow/repository/IndexDbSessionRepository.d.ts +17 -0
- package/new-flow/upload/AwsUploadService.d.ts +9 -0
- package/new-flow/upload/AzureUploadService.d.ts +9 -0
- package/new-flow/upload/IUploadService.d.ts +10 -0
- package/new-flow/upload/uploadCalback.d.ts +1 -0
- package/package.json +49 -0
- package/plugins/MicRecorder2.d.ts +11 -0
- package/plugins/insights.d.ts +13 -0
- package/plugins/recorder.d.ts +1 -0
- package/proctoring/DeviceChecker.d.ts +13 -0
- package/proctoring/options/ProctoringOptions.d.ts +10 -0
- package/proctoring/options/ProctoringVideoOptions.d.ts +5 -0
- package/proctoring/proctoring.d.ts +55 -0
- package/proctoring/useProctoring.d.ts +29 -0
- package/unpkg/easyproctor.min.js +25 -0
- package/utils/time.d.ts +3 -0
- package/utils/verifyVersion.d.ts +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# EasyProctor
|
|
2
|
+
|
|
3
|
+
O componente web EasyProctor permite que qualquer plataforma de execução de exames registre sessões de proctoring.
|
|
4
|
+
|
|
5
|
+
## Instalação
|
|
6
|
+
|
|
7
|
+
Via NPM:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save easyproctor
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Via CDN
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/easyproctor/unpkg/easyproctor.min.js"></script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Utilização
|
|
20
|
+
|
|
21
|
+
Para utilizar o componente será necessário utilizar os seguintes parâmetros:
|
|
22
|
+
|
|
23
|
+
- examId: identificador do exame
|
|
24
|
+
- clientId: identificador do parceiro
|
|
25
|
+
- token: token de autenticação biométrica (utilizar SDK biométrico do EasyProctor)
|
|
26
|
+
|
|
27
|
+
Ao inicializar a sessão de proctoring através do método start do componente você receberá o objeto do tipo StartProctoringDTO que possui o identificador da sessão.
|
|
28
|
+
|
|
29
|
+
Após finalizar a sessão de proctoring através do método finish você poderá consultar os dados de proctoring através da nossa API.
|
|
30
|
+
|
|
31
|
+
https://proctoring-api.easyproctor.tech/index.html
|
|
32
|
+
|
|
33
|
+
Em um bundler
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { useProctoring } from "easyproctor";
|
|
37
|
+
|
|
38
|
+
const { start, finish, pause, resume, onFocus, onLostFocus, enumarateDevices, checkPermissions, checkIfhasMultipleMonitors, onStopSharingScreen } = useProctoring({
|
|
39
|
+
examId: "00001",
|
|
40
|
+
clientId: "000001",
|
|
41
|
+
token: "...",
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Via CDN: A função "useProctoring" é injetada para ser utilizada globalmente
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<script src="https://cdn.jsdelivr.net/npm/easyproctor/unpkg/easyproctor.min.js"></script>
|
|
49
|
+
<script>
|
|
50
|
+
const { start, finish, pause, resume, onFocus, onLostFocus, enumarateDevices, checkPermissions, checkIfhasMultipleMonitors, onStopSharingScreen } = useProctoring({
|
|
51
|
+
examId: "00001",
|
|
52
|
+
clientId: "000001",
|
|
53
|
+
token: "...",
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Exemplo completo
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<!DOCTYPE html>
|
|
62
|
+
<html lang="en">
|
|
63
|
+
<head>
|
|
64
|
+
<meta charset="UTF-8" />
|
|
65
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
66
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
67
|
+
<title>Document</title>
|
|
68
|
+
<script src="dist/unpkg/easyproctor.min.js"></script>
|
|
69
|
+
<script>
|
|
70
|
+
const {
|
|
71
|
+
start,
|
|
72
|
+
finish,
|
|
73
|
+
onFocus,
|
|
74
|
+
onLostFocus,
|
|
75
|
+
enumarateDevices,
|
|
76
|
+
checkPermissions,
|
|
77
|
+
} = useProctoring({
|
|
78
|
+
examId: "00001",
|
|
79
|
+
clientId: "000001",
|
|
80
|
+
token: "...",
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
async function startExam() {
|
|
84
|
+
try {
|
|
85
|
+
// Verificar se existem dispositívos disponíveis
|
|
86
|
+
if (devices.cameras.length == 0 || devices.microphones.length == 0) {
|
|
87
|
+
throw "Você precisa possuir ao menos uma câmera e um microfone";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Verificar se foram setados
|
|
91
|
+
const selectedCamera = cameras.value;
|
|
92
|
+
const selectedMicrophone = microphones.value;
|
|
93
|
+
|
|
94
|
+
if (!selectedCamera || !selectedMicrophone) {
|
|
95
|
+
throw "Você precisa selecionar uma camera e um microfone";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
startButton.innerHTML = "Carregando";
|
|
99
|
+
|
|
100
|
+
onFocus(() => generateAlert(false));
|
|
101
|
+
onLostFocus(() => generateAlert(true));
|
|
102
|
+
// Adicionar o dispositivo selecionado é opcional
|
|
103
|
+
const { cameraStream } = await start({
|
|
104
|
+
cameraId: selectedCamera,
|
|
105
|
+
microphoneId: selectedMicrophone,
|
|
106
|
+
});
|
|
107
|
+
} catch (error) {
|
|
108
|
+
alert(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async function finishExam() {
|
|
113
|
+
try {
|
|
114
|
+
await finish({ onProgress: (percentage) => console.log(percentage) });
|
|
115
|
+
console.log("EXAME FINALIZADO");
|
|
116
|
+
} catch (error) {
|
|
117
|
+
alert(error);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Verificar permissões
|
|
122
|
+
let devices = { cameras: [], microphones: [] };
|
|
123
|
+
async function verifyPermissions() {
|
|
124
|
+
// Checar permissões
|
|
125
|
+
var hasPermissions = await checkPermissions();
|
|
126
|
+
|
|
127
|
+
if (!hasPermissions) {
|
|
128
|
+
window.alert("Para continuar você precisa conceder as permissões");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Listar os dispositivos
|
|
133
|
+
devices = await enumarateDevices();
|
|
134
|
+
|
|
135
|
+
const generateOption = (text, value) => {
|
|
136
|
+
const el = document.createElement("option");
|
|
137
|
+
el.setAttribute("value", value);
|
|
138
|
+
el.innerHTML = text;
|
|
139
|
+
return el;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
devices.cameras.forEach((camera) => {
|
|
143
|
+
const option = generateOption(camera.label, camera.id);
|
|
144
|
+
cameras.appendChild(option);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
devices.microphones.forEach((microphone) => {
|
|
148
|
+
const option = generateOption(microphone.label, microphone.id);
|
|
149
|
+
microphones.appendChild(option);
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Gerar alerta
|
|
154
|
+
function generateAlert(lostFocus) {
|
|
155
|
+
const p = document.createElement("p");
|
|
156
|
+
if (lostFocus) {
|
|
157
|
+
p.classList.add("text-red-500");
|
|
158
|
+
p.innerHTML = `Perdeu o foco em: ${new Date().toLocaleTimeString()}`;
|
|
159
|
+
} else {
|
|
160
|
+
p.classList.add("text-green-500");
|
|
161
|
+
p.innerHTML = `Retomou o foco em: ${new Date().toLocaleTimeString()}`;
|
|
162
|
+
}
|
|
163
|
+
alerts.appendChild(p);
|
|
164
|
+
}
|
|
165
|
+
</script>
|
|
166
|
+
</head>
|
|
167
|
+
|
|
168
|
+
<body>
|
|
169
|
+
<div
|
|
170
|
+
style="height: 100vh; display: flex; align-items: center; justify-content: center;"
|
|
171
|
+
>
|
|
172
|
+
<button onclick="startExam()">Iniciar</button>
|
|
173
|
+
<button onclick="finishExam()">Finalizar</button>
|
|
174
|
+
<button onclick="verifyPermissions()">Verificar permissões</button>
|
|
175
|
+
</div>
|
|
176
|
+
</body>
|
|
177
|
+
</html>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## API
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
const {
|
|
184
|
+
// Inicia a gravação da prova
|
|
185
|
+
start,
|
|
186
|
+
|
|
187
|
+
// Pausa a gravação
|
|
188
|
+
pause,
|
|
189
|
+
|
|
190
|
+
// Reinicia a gravação
|
|
191
|
+
resume,
|
|
192
|
+
|
|
193
|
+
// Finaliza a gravação da prova retornando os arquivos gerados
|
|
194
|
+
finish,
|
|
195
|
+
|
|
196
|
+
// Adiciona uma função callback para ser executada quando o usuário recupera o foco da tela
|
|
197
|
+
onFocus,
|
|
198
|
+
|
|
199
|
+
// Adiciona uma função callback para ser executada quando o usuário perde o foco da tela
|
|
200
|
+
onLostFocus,
|
|
201
|
+
|
|
202
|
+
// Adiciona uma função callback para ser executada quando o usuário cancela o compartilhamento de tela
|
|
203
|
+
onStopSharingScreen
|
|
204
|
+
|
|
205
|
+
// Enumera os dispositivos de camera e microfone
|
|
206
|
+
enumarateDevices,
|
|
207
|
+
|
|
208
|
+
// Checa as permissões de camera e microfone
|
|
209
|
+
checkPermissions,
|
|
210
|
+
|
|
211
|
+
// Checa se existe mais de um monitor
|
|
212
|
+
checkIfhasMultipleMonitors
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
} = useProctoring({
|
|
216
|
+
examId: "00001",
|
|
217
|
+
clientId: "000001",
|
|
218
|
+
token: "...",
|
|
219
|
+
});
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Release Note V 0.0.84
|
|
223
|
+
|
|
224
|
+
- Deploy fluxo novo para testes
|
|
225
|
+
|
|
226
|
+
## License
|
|
227
|
+
|
|
228
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default interface StartProctoringDTO {
|
|
2
|
+
id: string;
|
|
3
|
+
clientId: string;
|
|
4
|
+
examId: string;
|
|
5
|
+
userCpf: string;
|
|
6
|
+
examStartTime: string;
|
|
7
|
+
examEndTime: string;
|
|
8
|
+
status: number;
|
|
9
|
+
cameraStream: MediaStream;
|
|
10
|
+
audioStream: MediaStream;
|
|
11
|
+
screenStream: MediaStream | undefined;
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const SCRIPT_NOT_CALLED_INSIDE_BODY = "script_not_called_inside_body";
|
|
2
|
+
export declare const INCOMPATIBLE_NAVIGATOR = "incompatible_navigator";
|
|
3
|
+
export declare const REQUIRED_FIELD_NOT_PROVIDED = "required_field_not_provided";
|
|
4
|
+
export declare const NOT_SHARED_FIRST_SCREEN = "not_shared_first_screen";
|
|
5
|
+
export declare const MULTIPLE_MONITORS_DETECTED = "multiple_monitors_detected";
|
|
6
|
+
export declare const PROCTORING_ALREADY_STARTED = "proctoring_already_started";
|
|
7
|
+
export declare const PROCTORING_NOT_STARTED = "proctoring_not_started";
|
|
8
|
+
export declare const PROCTORING_RUNNING = "proctoring_running";
|
|
9
|
+
export declare const NO_VIDEOS_RECORDED = "no_videos_recorded";
|
|
10
|
+
export declare const PERMISSIONS_NOT_GRANTED = "permissions_not_granted";
|