This commit is contained in:
Peter Maquiran
2022-03-22 14:23:38 +01:00
parent ce357b7862
commit c4c4355c95
6 changed files with 151 additions and 113 deletions
@@ -50,7 +50,7 @@
</div>
<div class="d-flex justify-space-between">
<ion-label *ngIf="msg.delate == false" class="flex-0">{{msg.msg}}</ion-label>
<ion-label *ngIf="msg.delate == false" class="flex-0">{{msg.msg}} {{msg._id}}</ion-label>
<ion-label *ngIf="msg.delate == true" class="flex-0">Apagou a mensagem</ion-label>
<ion-label class="float-status-all float-status" >
+31 -24
View File
@@ -250,20 +250,23 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async loadFiles() {
try {
this.storage.get('fileName').then((fileName) => {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
}
});
} catch (error) {}
this.storage.get('fileName').then((fileName) => {
this.lastAudioRecorded = fileName;
})
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(recordData.value.recordDataBase64);
}
else{
this.audioRecorded = this.sanitiser.bypassSecurityTrustResourceUrl(`data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`);
}
});
}
startRecording() {
@@ -355,19 +358,23 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async sendAudio(fileName) {
const roomId = this.roomId
let audioFile;
this.storage.get('recordData').then((recordData) => {
console.log(recordData);
audioFile = recordData;
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData.value.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
}
});
try {
this.storage.get('recordData').then((recordData) => {
// console.log(recordData);
audioFile = recordData;
if(recordData.value.recordDataBase64.includes('data:audio')){
this.audioRecorded = recordData.value.recordDataBase64;
}
else{
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData.value.recordDataBase64}`;
}
});
} catch (error) {}
//Converting base64 to blob
const base64Response = await fetch(this.audioRecorded);