miva-proctor-sdk 0.0.54 → 0.0.55-socket-v1

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.
@@ -0,0 +1,161 @@
1
+ import { ProctoringSocketConfig } from '../types/socket_types';
2
+ /**
3
+ * Manages socket-based communication for proctoring sessions
4
+ * and provides a comprehensive interface for proctoring functionality
5
+ */
6
+ export declare class ProctoringSocketCore {
7
+ private socket;
8
+ private config;
9
+ private isConnected;
10
+ private reconnectAttempts;
11
+ private pingInterval;
12
+ private lastPingTime;
13
+ private pingTimeout;
14
+ private tracking;
15
+ private screenSharing;
16
+ private fullscreen;
17
+ private inFocus;
18
+ private videoElement?;
19
+ private stream?;
20
+ private errorMessage;
21
+ private errorCode;
22
+ private audioDetector?;
23
+ private cameraStream?;
24
+ private faceDetector?;
25
+ /**
26
+ * Creates a new ProctoringManager
27
+ * @param config Configuration for the proctoring manager
28
+ */
29
+ constructor(config: ProctoringSocketConfig);
30
+ /**
31
+ * Connects to the proctoring socket server
32
+ * @returns Promise that resolves when connected
33
+ */
34
+ connect(): Promise<void>;
35
+ /**
36
+ * Disconnects from the proctoring socket server
37
+ */
38
+ disconnect(): void;
39
+ /**
40
+ * Sends a ping to the server to update the session
41
+ * @returns Promise that resolves when the ping is sent
42
+ */
43
+ pingSession(): Promise<void>;
44
+ /**
45
+ * Ends the proctoring session
46
+ * @returns Promise that resolves when the session is ended
47
+ */
48
+ endSession(): Promise<void>;
49
+ /**
50
+ * Starts a new proctoring session
51
+ * @param showFullscreenModal Optional callback to show a fullscreen modal
52
+ * @returns Promise that resolves to true if the session was started successfully
53
+ */
54
+ startSession(showFullscreenModal?: (cb: () => Promise<void>) => Promise<void>): Promise<boolean>;
55
+ /**
56
+ * Stops the proctoring session
57
+ */
58
+ stopSession(): Promise<void>;
59
+ /**
60
+ * Requests media permissions for camera and audio
61
+ */
62
+ private requestMediaPermissions;
63
+ /**
64
+ * Starts screen sharing
65
+ * @param isEnableFullScreen Whether to enable fullscreen
66
+ * @returns Promise that resolves to true if screen sharing was started successfully
67
+ */
68
+ private startScreenSharing;
69
+ /**
70
+ * Stops screen sharing
71
+ */
72
+ private stopScreenSharing;
73
+ /**
74
+ * Handles screen sharing ended event
75
+ */
76
+ private screenSharingEnded;
77
+ /**
78
+ * Starts fullscreen mode
79
+ */
80
+ private startFullscreen;
81
+ /**
82
+ * Stops fullscreen mode
83
+ */
84
+ private stopFullscreen;
85
+ /**
86
+ * Registers event listeners for window events
87
+ */
88
+ private registerForEvents;
89
+ /**
90
+ * Unregisters event listeners for window events
91
+ */
92
+ private unregisterEvents;
93
+ /**
94
+ * Handles focus event
95
+ */
96
+ private focusEvent;
97
+ /**
98
+ * Handles blur event
99
+ */
100
+ private blurEvent;
101
+ /**
102
+ * Checks if the window is in fullscreen mode
103
+ * @returns True if in fullscreen mode
104
+ */
105
+ isFullScreen(): boolean;
106
+ /**
107
+ * Handles resize event
108
+ */
109
+ private resizeEvent;
110
+ /**
111
+ * Takes a screenshot of the provided stream
112
+ * @param stream The media stream to take a screenshot of
113
+ * @returns Promise that resolves to a blob containing the screenshot
114
+ */
115
+ takeScreenshot(stream: MediaStream): Promise<Blob>;
116
+ /**
117
+ * Fallback method for taking screenshots in SEB or when Canvas API is blocked
118
+ * @param stream The media stream to take a screenshot of
119
+ * @returns Promise that resolves to a blob containing the screenshot
120
+ */
121
+ private takeScreenshotFallback;
122
+ /**
123
+ * Detects if running in SEB
124
+ * @returns True if running in SEB
125
+ */
126
+ private isSEB;
127
+ /**
128
+ * Checks if there are external monitors
129
+ * @returns True if there are external monitors
130
+ */
131
+ hasExternalMonitors(): boolean;
132
+ /**
133
+ * Takes a random screenshot
134
+ */
135
+ takeRandomScreenshot(): Promise<void>;
136
+ /**
137
+ * Takes a random picture from the camera
138
+ */
139
+ takeRandomPicture(): Promise<void>;
140
+ /**
141
+ * Calls takeRandomPicture or takeRandomScreenshot randomly
142
+ */
143
+ callRandomPictureOrScreenshot(): void;
144
+ /**
145
+ * Checks if the socket is connected
146
+ * @returns True if connected, false otherwise
147
+ */
148
+ isSocketConnected(): boolean;
149
+ /**
150
+ * Sets up event listeners for the socket
151
+ */
152
+ private setupEventListeners;
153
+ /**
154
+ * Starts the ping interval to keep the session alive
155
+ */
156
+ private startPingInterval;
157
+ /**
158
+ * Stops the ping interval
159
+ */
160
+ private stopPingInterval;
161
+ }