Spaces:
Running
Running
undefined - Initial Deployment
Browse files- index.html +189 -20
index.html
CHANGED
|
@@ -148,9 +148,12 @@
|
|
| 148 |
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
| 149 |
<div class="flex justify-between items-center mb-4">
|
| 150 |
<h3 class="text-lg font-semibold text-gray-800">Recording Session</h3>
|
| 151 |
-
<div class="flex items-center space-x-
|
|
|
|
|
|
|
|
|
|
| 152 |
<span class="text-sm text-gray-500">00:32:45</span>
|
| 153 |
-
<button class="p-2 rounded-full bg-
|
| 154 |
<i class="fas fa-microphone"></i>
|
| 155 |
</button>
|
| 156 |
</div>
|
|
@@ -169,6 +172,18 @@
|
|
| 169 |
<i class="fas fa-step-forward text-gray-600"></i>
|
| 170 |
</button>
|
| 171 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
</div>
|
| 173 |
|
| 174 |
<!-- Live Transcription -->
|
|
@@ -234,7 +249,7 @@
|
|
| 234 |
</div>
|
| 235 |
|
| 236 |
<script>
|
| 237 |
-
// Initialize FullCalendar
|
| 238 |
document.addEventListener('DOMContentLoaded', function() {
|
| 239 |
const calendarEl = document.getElementById('calendar');
|
| 240 |
const calendar = new FullCalendar.Calendar(calendarEl, {
|
|
@@ -244,37 +259,191 @@
|
|
| 244 |
center: 'title',
|
| 245 |
right: 'timeGridWeek,timeGridDay'
|
| 246 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
events: [
|
| 248 |
{
|
| 249 |
title: 'Interview with Maria',
|
| 250 |
start: '2024-03-20T10:00:00',
|
| 251 |
end: '2024-03-20T11:00:00',
|
| 252 |
-
backgroundColor: '#4f46e5'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
}
|
| 254 |
]
|
| 255 |
});
|
| 256 |
calendar.render();
|
| 257 |
});
|
| 258 |
|
| 259 |
-
//
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
|
| 268 |
-
|
| 269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
const recordButton = document.querySelector('.recording-pulse');
|
| 274 |
-
recordButton.addEventListener('click', () => {
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
});
|
| 279 |
|
| 280 |
// Handle metadata drawer
|
|
|
|
| 148 |
<div class="bg-white rounded-xl shadow-sm p-6 mb-6">
|
| 149 |
<div class="flex justify-between items-center mb-4">
|
| 150 |
<h3 class="text-lg font-semibold text-gray-800">Recording Session</h3>
|
| 151 |
+
<div class="flex items-center space-x-4">
|
| 152 |
+
<select id="audioDeviceSelect" class="px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
|
| 153 |
+
<option value="">Select Microphone</option>
|
| 154 |
+
</select>
|
| 155 |
<span class="text-sm text-gray-500">00:32:45</span>
|
| 156 |
+
<button class="p-2 rounded-full bg-gray-500 text-white">
|
| 157 |
<i class="fas fa-microphone"></i>
|
| 158 |
</button>
|
| 159 |
</div>
|
|
|
|
| 172 |
<i class="fas fa-step-forward text-gray-600"></i>
|
| 173 |
</button>
|
| 174 |
</div>
|
| 175 |
+
|
| 176 |
+
<!-- Recording Status -->
|
| 177 |
+
<div class="mt-4 p-4 bg-gray-50 rounded-lg">
|
| 178 |
+
<div class="flex items-center space-x-2">
|
| 179 |
+
<div class="w-2 h-2 rounded-full bg-gray-400"></div>
|
| 180 |
+
<span class="text-sm text-gray-600">Ready to record</span>
|
| 181 |
+
</div>
|
| 182 |
+
<div class="mt-2 text-sm text-gray-500">
|
| 183 |
+
<p>Selected device: <span id="selectedDeviceName">Default Microphone</span></p>
|
| 184 |
+
<p>Recording format: WAV (44.1kHz, 16-bit)</p>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
</div>
|
| 188 |
|
| 189 |
<!-- Live Transcription -->
|
|
|
|
| 249 |
</div>
|
| 250 |
|
| 251 |
<script>
|
| 252 |
+
// Initialize FullCalendar with enhanced configuration
|
| 253 |
document.addEventListener('DOMContentLoaded', function() {
|
| 254 |
const calendarEl = document.getElementById('calendar');
|
| 255 |
const calendar = new FullCalendar.Calendar(calendarEl, {
|
|
|
|
| 259 |
center: 'title',
|
| 260 |
right: 'timeGridWeek,timeGridDay'
|
| 261 |
},
|
| 262 |
+
slotMinTime: '08:00:00',
|
| 263 |
+
slotMaxTime: '20:00:00',
|
| 264 |
+
allDaySlot: false,
|
| 265 |
+
slotDuration: '00:30:00',
|
| 266 |
+
snapDuration: '00:15:00',
|
| 267 |
+
eventOverlap: false,
|
| 268 |
+
eventConstraint: {
|
| 269 |
+
startTime: '08:00',
|
| 270 |
+
endTime: '20:00',
|
| 271 |
+
dows: [1, 2, 3, 4, 5] // Monday to Friday
|
| 272 |
+
},
|
| 273 |
+
eventDidMount: function(info) {
|
| 274 |
+
// Check for conflicts
|
| 275 |
+
const events = calendar.getEvents();
|
| 276 |
+
const hasConflict = events.some(event => {
|
| 277 |
+
if (event.id === info.event.id) return false;
|
| 278 |
+
return (
|
| 279 |
+
(info.event.start < event.end && info.event.end > event.start)
|
| 280 |
+
);
|
| 281 |
+
});
|
| 282 |
+
if (hasConflict) {
|
| 283 |
+
info.el.classList.add('conflict-highlight');
|
| 284 |
+
}
|
| 285 |
+
},
|
| 286 |
+
editable: true,
|
| 287 |
+
droppable: true,
|
| 288 |
events: [
|
| 289 |
{
|
| 290 |
title: 'Interview with Maria',
|
| 291 |
start: '2024-03-20T10:00:00',
|
| 292 |
end: '2024-03-20T11:00:00',
|
| 293 |
+
backgroundColor: '#4f46e5',
|
| 294 |
+
extendedProps: {
|
| 295 |
+
participant: 'Maria Gonzalez',
|
| 296 |
+
project: 'Urban Sustainability Study',
|
| 297 |
+
teamMembers: ['John Doe', 'Jane Smith']
|
| 298 |
+
}
|
| 299 |
}
|
| 300 |
]
|
| 301 |
});
|
| 302 |
calendar.render();
|
| 303 |
});
|
| 304 |
|
| 305 |
+
// Device Recording Resource Handling
|
| 306 |
+
class RecordingManager {
|
| 307 |
+
constructor() {
|
| 308 |
+
this.mediaRecorder = null;
|
| 309 |
+
this.audioChunks = [];
|
| 310 |
+
this.isRecording = false;
|
| 311 |
+
this.stream = null;
|
| 312 |
+
this.availableDevices = {
|
| 313 |
+
audioInputs: [],
|
| 314 |
+
videoInputs: []
|
| 315 |
+
};
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
async initialize() {
|
| 319 |
+
try {
|
| 320 |
+
// Get available devices
|
| 321 |
+
const devices = await navigator.mediaDevices.enumerateDevices();
|
| 322 |
+
this.availableDevices.audioInputs = devices.filter(device => device.kind === 'audioinput');
|
| 323 |
+
this.availableDevices.videoInputs = devices.filter(device => device.kind === 'videoinput');
|
| 324 |
+
|
| 325 |
+
// Update device selectors
|
| 326 |
+
this.updateDeviceSelectors();
|
| 327 |
+
|
| 328 |
+
// Initialize default audio stream
|
| 329 |
+
await this.setupAudioStream(this.availableDevices.audioInputs[0]?.deviceId);
|
| 330 |
+
} catch (error) {
|
| 331 |
+
console.error('Error initializing recording:', error);
|
| 332 |
+
this.showError('Failed to initialize recording devices');
|
| 333 |
+
}
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
updateDeviceSelectors() {
|
| 337 |
+
const audioSelect = document.getElementById('audioDeviceSelect');
|
| 338 |
+
if (audioSelect) {
|
| 339 |
+
audioSelect.innerHTML = this.availableDevices.audioInputs
|
| 340 |
+
.map(device => `<option value="${device.deviceId}">${device.label || `Microphone ${device.deviceId}`}</option>`)
|
| 341 |
+
.join('');
|
| 342 |
+
}
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
async setupAudioStream(deviceId) {
|
| 346 |
+
try {
|
| 347 |
+
const constraints = {
|
| 348 |
+
audio: deviceId ? { deviceId: { exact: deviceId } } : true,
|
| 349 |
+
video: false
|
| 350 |
+
};
|
| 351 |
|
| 352 |
+
this.stream = await navigator.mediaDevices.getUserMedia(constraints);
|
| 353 |
+
|
| 354 |
+
// Initialize WaveSurfer with the audio stream
|
| 355 |
+
wavesurfer.microphone.start({
|
| 356 |
+
stream: this.stream,
|
| 357 |
+
bufferSize: 4096
|
| 358 |
+
});
|
| 359 |
|
| 360 |
+
// Initialize MediaRecorder
|
| 361 |
+
this.mediaRecorder = new MediaRecorder(this.stream);
|
| 362 |
+
this.setupMediaRecorderEvents();
|
| 363 |
+
} catch (error) {
|
| 364 |
+
console.error('Error setting up audio stream:', error);
|
| 365 |
+
this.showError('Failed to access microphone');
|
| 366 |
+
}
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
setupMediaRecorderEvents() {
|
| 370 |
+
this.mediaRecorder.ondataavailable = (event) => {
|
| 371 |
+
if (event.data.size > 0) {
|
| 372 |
+
this.audioChunks.push(event.data);
|
| 373 |
+
}
|
| 374 |
+
};
|
| 375 |
+
|
| 376 |
+
this.mediaRecorder.onstop = () => {
|
| 377 |
+
const audioBlob = new Blob(this.audioChunks, { type: 'audio/wav' });
|
| 378 |
+
const audioUrl = URL.createObjectURL(audioBlob);
|
| 379 |
+
wavesurfer.load(audioUrl);
|
| 380 |
+
this.audioChunks = [];
|
| 381 |
+
};
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
async startRecording() {
|
| 385 |
+
if (!this.mediaRecorder) {
|
| 386 |
+
await this.initialize();
|
| 387 |
+
}
|
| 388 |
+
|
| 389 |
+
try {
|
| 390 |
+
this.audioChunks = [];
|
| 391 |
+
this.mediaRecorder.start();
|
| 392 |
+
this.isRecording = true;
|
| 393 |
+
this.updateRecordingUI(true);
|
| 394 |
+
} catch (error) {
|
| 395 |
+
console.error('Error starting recording:', error);
|
| 396 |
+
this.showError('Failed to start recording');
|
| 397 |
+
}
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
stopRecording() {
|
| 401 |
+
if (this.mediaRecorder && this.isRecording) {
|
| 402 |
+
this.mediaRecorder.stop();
|
| 403 |
+
this.isRecording = false;
|
| 404 |
+
this.updateRecordingUI(false);
|
| 405 |
+
}
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
updateRecordingUI(isRecording) {
|
| 409 |
+
const recordButton = document.querySelector('.recording-pulse');
|
| 410 |
+
if (recordButton) {
|
| 411 |
+
recordButton.classList.toggle('bg-red-500', isRecording);
|
| 412 |
+
recordButton.classList.toggle('bg-gray-500', !isRecording);
|
| 413 |
+
recordButton.classList.toggle('recording-pulse', isRecording);
|
| 414 |
+
}
|
| 415 |
+
}
|
| 416 |
+
|
| 417 |
+
showError(message) {
|
| 418 |
+
// Implement error notification UI
|
| 419 |
+
console.error(message);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
async switchDevice(deviceId) {
|
| 423 |
+
if (this.stream) {
|
| 424 |
+
this.stream.getTracks().forEach(track => track.stop());
|
| 425 |
+
}
|
| 426 |
+
await this.setupAudioStream(deviceId);
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
// Initialize recording manager
|
| 431 |
+
const recordingManager = new RecordingManager();
|
| 432 |
+
recordingManager.initialize();
|
| 433 |
+
|
| 434 |
+
// Update recording controls
|
| 435 |
const recordButton = document.querySelector('.recording-pulse');
|
| 436 |
+
recordButton.addEventListener('click', async () => {
|
| 437 |
+
if (recordingManager.isRecording) {
|
| 438 |
+
recordingManager.stopRecording();
|
| 439 |
+
} else {
|
| 440 |
+
await recordingManager.startRecording();
|
| 441 |
+
}
|
| 442 |
+
});
|
| 443 |
+
|
| 444 |
+
// Handle device selection
|
| 445 |
+
document.getElementById('audioDeviceSelect')?.addEventListener('change', (e) => {
|
| 446 |
+
recordingManager.switchDevice(e.target.value);
|
| 447 |
});
|
| 448 |
|
| 449 |
// Handle metadata drawer
|