Cannot record audio


#1

I´m trying to record audio with this docs steps
https://ionicframework.com/docs/native/media/
but nothing is happening.

It doesn´t ask permission for microphone or anything like that.

import { Component, Provider } from '@angular/core';
import { IonicPage, NavController, NavParams, 
  ActionSheetController, ToastController, 
  Platform, LoadingController, Loading } from 'ionic-angular';

import { Media, MediaObject } from '@ionic-native/media';
import { ImagePicker } from '@ionic-native/image-picker';

import { File } from '@ionic-native/file';
import { Transfer, TransferObject } from '@ionic-native/transfer';
import { FilePath } from '@ionic-native/file-path';
import { Camera } from '@ionic-native/camera';
import { IonicImageViewerModule } from 'ionic-img-viewer';
import { AudioProvider } from 'ionic-audio';

constructor(public navCtrl: NavController, public navParams: NavParams, 
    private media: Media,...){}

recordAudio: MediaObject = this.media.create('audio.mp3'); 

record() {

    this.recordAudio.startRecord();
    this.presentToast('Recording...'); 
  }

stopRecord() {
    this.recordAudio.stopRecord();
    this.presentToast('Stop recording...');
  }

  play(){
    this.recordAudio.play();
    this.presentToast('Play');
  }

  stop(){
    this.recordAudio.stop();
    this.presentToast('Stop');
  }


#2

I’m trying to do something similar, but this.recordAudio.startRecord() crashes my app. I haven’t figured out how to use remote debugging (on the device) yet.


#3

Try https://github.com/pinchnzoom/cordova-plugin-ios-microphone-permissions