Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- playAudio() {
- this.filePath = this.file.externalDataDirectory.replace(/file:\/\//g, '') + '_temp_audio.mp3';
- this.audioMedia = this.media.create(this.filePath);
- this.audioMedia.play();
- this.audioMedia.onStatusUpdate.subscribe((status) => {
- if(status == 1) { this.isPlaying = true; }
- if(status == 4) { this.stopAudio(); }
- this.cd.detectChanges();
- });
- this.isPlaying = true;
- }
- stopAudio() {
- this.audioMedia.stop();
- this.isPlaying = false;
- }
- startRecord() {
- this.filePath = this.file.externalDataDirectory.replace(/file:\/\//g, '') + '_temp_audio.mp3';
- //if(this.siteService.isPlaying) { this.dropPlay = true; this.siteService.emitPlayer(); }
- this.audioMedia = this.media.create(this.filePath);
- this.audioMedia.startRecord();
- this.recording = true;
- this.timerStart();
- }
- stopRecord() {
- this.audioMedia.stopRecord();
- this.audioMedia = this.media.create(this.filePath);
- this.counting = false; this.recording = false; this.hasFile = true;
- if(!this.siteService.isPlaying && this.dropPlay) { this.siteService.emitPlayer(); }
- this.dropPlay = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement