Ionic 4 Media plugin audio recording not capturing audio after resumeRecording()

I am using the Ionic Media plugin for recording audio. And There are 3 button clicks one for Start recording, one for pause recording and one for stop recording. Pressing start after pause will call resumeRecording(). And the issue is the final audio will only contain the data till we press the pause button.
Recording function pasted belo:

this.recording('start');//Will start recording
this.recording('pause');//Will pause recording
this.recording('start');//Will resume recording if paused
this.recording('stop');//Will stop recording and upload to server
recording(type = 'start') {
        if (type === 'start') {
            if (this.isStopped === false) {
                if (this.isStarted === false) {
                    // Start listening
                    this.rippleAnimation = 'ripple 0.7s linear infinite';
                    this.isStarted = true;
                    if (this.platform.is('ios')) {
                        this.fileName = this.storyId + '_record.aac';
                        this.filePath = this.file.tempDirectory.replace(/^file:\/\//, '') + this.fileName;
                        this.file.createFile(this.file.tempDirectory, this.fileName, true).then(() => {
                            this.audio = this.media.create(this.file.tempDirectory.replace(/^file:\/\//, '') + this.fileName);
                            this.audio.startRecord();
                            // this.audio = this.media.create(this.filePath);
                        });
                    } else if (this.platform.is('android')) {
                        this.fileName = this.storyId + '_record.aac';
                        this.file.createFile(this.file.externalDataDirectory, this.fileName, true).then(() => {
                            this.filePath = this.file.externalDataDirectory.replace(/file:\/\//g, '') + this.fileName;
                            this.audio = this.media.create(this.filePath);
                            // this.audio.onStatusUpdate.subscribe(status => console.log(status)); // fires when file status changes
                            //
                            // this.audio.onSuccess.subscribe(() => console.log('Action is successful'));
                            //
                            // this.audio.onError.subscribe(error => console.log('Error!', error));
                            this.audio.startRecord();
                        });

                    }
                    this.isRecording = true;
                    setInterval((variable) => {
                        if (this.isRecording === true) {
                            this.audioDuration++;
                            const hours = Math.floor(this.audioDuration / 3600);
                            const totalSeconds = this.audioDuration % 3600;
                            const minutes = Math.floor(totalSeconds / 60);
                            const seconds = totalSeconds % 60;
                            if (hours < 10) {
                                this.audioDurationText = '0' + hours + ':';
                            } else {
                                this.audioDurationText += hours + ':';
                            }
                            if (minutes < 10) {
                                this.audioDurationText += '0' + minutes + ':';
                            } else {
                                this.audioDurationText += minutes + ':';
                            }
                            if (seconds < 10) {
                                this.audioDurationText += '0' + seconds;
                            } else {
                                this.audioDurationText += seconds;
                            }
                        }
                    }, 1000);
                    this.showToast('Recording started.');
                } else {
                    this.rippleAnimation = 'ripple 0.7s linear infinite';
                    this.audio.resumeRecord();
                    this.isRecording = true;
                    this.showToast('Recording resumed.');
                }
            } else {
                this.showToast('Recording stopped.');
            }
        } else if (type === 'stop') {
            if (this.isStopped === false) {
                // Stop listening
                this.rippleAnimation = 'ripple 0s linear infinite';
                this.audio.stopRecord();
                this.isRecording = false;
                this.isStopped = true;
                // console.log(this.filePath);
                // this.playAudio('record.aac');
                // this.showToast('Recording stopped and saving audio..');
                this.loadingController.create({
                    message: 'Saving...'
                }).then((loader) => {
                    loader.present().then(() => {
                        this.storage.get('_token').then((token) => {
                            if (token != null) {
                                this.storyService.uploadAudio(token, this.fileName, this.filePath, this.storyId).then((data) => {
                                    console.log(data);
                                    loader.dismiss();
                                    this.navController.navigateRoot('home');
                                }, (err) => {
                                    console.log(err);
                                    loader.dismiss();
                                    this.showToast('Something went wrong.');
                                });
                            } else {
                                loader.dismiss();
                            }
                        }, (err) => {
                            loader.dismiss();
                        });
                    });
                });
            } else {
                this.showToast('Recording already stopped.');
            }
        } else if (type === 'pause') {
            if (this.isStopped === false) {
                if (this.isRecording === true) {
                    // Stop listening
                    this.rippleAnimation = 'ripple 0s linear infinite';
                    this.audio.pauseRecord();
                    this.isRecording = false;
                    this.showToast('Recording paused.');
                } else {
                    this.showToast('Not recording.');
                }
            } else {
                this.showToast('Recording stopped.');
            }
        }
    }