mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
implementing audio functionality
This commit is contained in:
@@ -20,7 +20,7 @@ import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
|
||||
import { Directory, Encoding, FilesystemDirectory } from '@capacitor/filesystem';
|
||||
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
||||
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
|
||||
import { Haptics, ImpactStyle } from '@capacitor/haptics';
|
||||
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
|
||||
@@ -40,9 +40,9 @@ import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { Storage } from '@ionic/storage';
|
||||
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
|
||||
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||
import {Plugins} from '@capacitor/core';
|
||||
/* import {Plugins} from '@capacitor/core';
|
||||
|
||||
const { Filesystem } = Plugins;
|
||||
const { Filesystem } = Plugins; */
|
||||
|
||||
|
||||
const IMAGE_DIR = 'stored-images';
|
||||
@@ -144,7 +144,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log('MEMBER', value)
|
||||
})
|
||||
|
||||
//this.loadFiles();
|
||||
this.loadFiles();
|
||||
VoiceRecorder.requestAudioRecordingPermission();
|
||||
this.getChatMembers();
|
||||
Filesystem.mkdir({
|
||||
@@ -197,13 +197,16 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
directory: Directory.Data
|
||||
}).then(result => {
|
||||
console.log(result);
|
||||
const temp: any[] = result.files.reverse();
|
||||
this.storedFileNames = result.files;
|
||||
/* const temp: any[] = result.files.reverse();
|
||||
this.storedFileNames = temp[0];
|
||||
console.log(this.storedFileNames);
|
||||
console.log(this.storedFileNames); */
|
||||
})
|
||||
}
|
||||
|
||||
startRecording() {
|
||||
console.log('Recording');
|
||||
|
||||
if (this.recording) {
|
||||
return;
|
||||
}
|
||||
@@ -212,6 +215,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
stopRecording() {
|
||||
console.log('Stop');
|
||||
if (!this.recording) {
|
||||
return;
|
||||
}
|
||||
@@ -220,7 +224,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.recording = false;
|
||||
if (result.value && result.value.recordDataBase64) {
|
||||
const recordData = result.value.recordDataBase64;
|
||||
console.log(recordData);
|
||||
//console.log(recordData);
|
||||
this.myAudio = recordData;
|
||||
const fileName = new Date().getTime() + ".wav";
|
||||
await Filesystem.writeFile({
|
||||
|
||||
Reference in New Issue
Block a user