This commit is contained in:
tiago.kayaya
2022-04-07 15:22:25 +01:00
parent 6a0ef4cb26
commit 647f5dcd3b
3 changed files with 78 additions and 49 deletions
@@ -300,15 +300,25 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
startRecording() { async startRecording() {
console.log('Recording'); if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){
if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){
//if(await this.hasAudioRecordingPermission()){
if (this.recording) { if (this.recording) {
return; return;
} }
this.recording = true; this.recording = true;
VoiceRecorder.startRecording(); VoiceRecorder.startRecording();
this.calculateDuration(); this.calculateDuration();
//}
}
else{
this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.');
}
}
else{
this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!');
}
} }
+14 -6
View File
@@ -237,17 +237,25 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
startRecording() { async startRecording() {
console.log('Recording'); if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){
if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){
//if(await this.hasAudioRecordingPermission()){
if (this.recording) { if (this.recording) {
return; return;
} }
this.recording = true; this.recording = true;
VoiceRecorder.startRecording() VoiceRecorder.startRecording();
.then((result: GenericResponse) => console.log(result.value))
.catch(error => console.log(error));
this.calculateDuration(); this.calculateDuration();
//}
}
else{
this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.');
}
}
else{
this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!');
}
} }
stopRecording() { stopRecording() {
+13 -2
View File
@@ -282,14 +282,25 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}); });
} }
startRecording() { async startRecording() {
if(await VoiceRecorder.canDeviceVoiceRecord().then((result: GenericResponse) =>{return result.value})){
if(await VoiceRecorder.requestAudioRecordingPermission().then((result: GenericResponse) => {return result.value})){
//if(await this.hasAudioRecordingPermission()){
if (this.recording) { if (this.recording) {
return; return;
} }
this.recording = true; this.recording = true;
VoiceRecorder.startRecording(); VoiceRecorder.startRecording();
this.calculateDuration(); this.calculateDuration();
//}
}
else{
this.toastService._badRequest('Para gravar uma mensagem de voz, permita o acesso do Gabinete Digital ao seu microfone.');
}
}
else{
this.toastService._badRequest('Este dispositivo não tem capacidade para gravação de áudio!');
}
} }
stopRecording() { stopRecording() {