(
options: {
mimeType: string;
sessionId?: string;
maxPendingChunkBytes?: number;
},
backend: RecordingSpoolBackend = new IndexedDbRecordingSpoolBackend(),
)
| 226 | } |
| 227 | |
| 228 | static async create( |
| 229 | options: { |
| 230 | mimeType: string; |
| 231 | sessionId?: string; |
| 232 | maxPendingChunkBytes?: number; |
| 233 | }, |
| 234 | backend: RecordingSpoolBackend = new IndexedDbRecordingSpoolBackend(), |
| 235 | ) { |
| 236 | const now = Date.now(); |
| 237 | const session = { |
| 238 | sessionId: options.sessionId ?? createSessionId(), |
| 239 | mimeType: options.mimeType, |
| 240 | totalBytes: 0, |
| 241 | chunkCount: 0, |
| 242 | createdAt: now, |
| 243 | updatedAt: now, |
| 244 | } satisfies RecordingSpoolSessionRecord; |
| 245 | |
| 246 | await backend.initialize(); |
| 247 | await backend.createSession(session); |
| 248 | |
| 249 | return new RecordingSpool( |
| 250 | backend, |
| 251 | session, |
| 252 | options.maxPendingChunkBytes ?? DEFAULT_MAX_PENDING_CHUNK_BYTES, |
| 253 | ); |
| 254 | } |
| 255 | |
| 256 | get sessionId() { |
| 257 | return this.session.sessionId; |
no test coverage detected