ciyidogan commited on
Commit
89a156c
Β·
verified Β·
1 Parent(s): 6dc0f83

Update flare-ui/src/app/services/audio-stream.service.ts

Browse files
flare-ui/src/app/services/audio-stream.service.ts CHANGED
@@ -61,6 +61,18 @@ export class AudioStreamService implements OnDestroy {
61
 
62
  async startRecording(): Promise<void> {
63
  try {
 
 
 
 
 
 
 
 
 
 
 
 
64
  // Check browser support
65
  if (!AudioStreamService.checkBrowserSupport()) {
66
  throw this.createError('browser', 'Your browser does not support audio recording');
@@ -127,15 +139,21 @@ export class AudioStreamService implements OnDestroy {
127
 
128
  stopRecording(): void {
129
  try {
 
 
 
 
 
 
130
  if (this.mediaRecorder && this.mediaRecorder.state !== 'inactive') {
131
  this.mediaRecorder.stop();
132
  }
133
 
134
  this.cleanup();
135
  this.recordingStateSubject.next(false);
136
- console.log('πŸ›‘ Audio recording stopped');
137
  } catch (error) {
138
- console.error('Error stopping recording:', error);
139
  this.cleanup();
140
  }
141
  }
 
61
 
62
  async startRecording(): Promise<void> {
63
  try {
64
+ console.log('🎀 [AudioStream] startRecording called', {
65
+ isAlreadyRecording: this.isRecording(),
66
+ hasStream: !!this.audioStream,
67
+ timestamp: new Date().toISOString()
68
+ });
69
+
70
+ // Check if already recording
71
+ if (this.isRecording()) {
72
+ console.warn('⚠️ [AudioStream] Already recording, ignoring start request');
73
+ return;
74
+ }
75
+
76
  // Check browser support
77
  if (!AudioStreamService.checkBrowserSupport()) {
78
  throw this.createError('browser', 'Your browser does not support audio recording');
 
139
 
140
  stopRecording(): void {
141
  try {
142
+ console.log('πŸ›‘ [AudioStream] stopRecording called', {
143
+ hasMediaRecorder: !!this.mediaRecorder,
144
+ state: this.mediaRecorder?.state,
145
+ timestamp: new Date().toISOString()
146
+ });
147
+
148
  if (this.mediaRecorder && this.mediaRecorder.state !== 'inactive') {
149
  this.mediaRecorder.stop();
150
  }
151
 
152
  this.cleanup();
153
  this.recordingStateSubject.next(false);
154
+ console.log('πŸ›‘ [AudioStream] Audio recording stopped successfully');
155
  } catch (error) {
156
+ console.error('❌ [AudioStream] Error stopping recording:', error);
157
  this.cleanup();
158
  }
159
  }