Issue with nativescript-audio



I’m trying to use the nativescript-audio plugin (on iOS platform for now, with permissions granted in Info.plist file).
The TNSPlayer methods works fine, but I always get this error

CONSOLE LOG file:///app/tns_modules/nativescript-audio/src/ios/recorder.js:26:32: setCategoryError: null

when I use TNSRecorder.start() method with the code below :

public startRecord() {
        if (TNSRecorder.CAN_RECORD()) {

        var audioFolder = knownFolders.currentApp().getFolder("audio");
        console.log("audioFolder : " + JSON.stringify(audioFolder));

        let androidFormat;
        let androidEncoder;
        if (platform.isAndroid) {
            // m4a
            // static constants are not available, using raw values here
            // androidFormat =;
            androidFormat = 2;
            // androidEncoder =;
            androidEncoder = 3;

        let recordingPath = audioFolder.path + "/recording." + this.platformExtension();
        let recorderOptions: AudioRecorderOptions = {

            filename: recordingPath,

            format: androidFormat,

            encoder: androidEncoder,

            metering: true,

            infoCallback: (infoObject) => {
                console.log("infoCallback : " + JSON.stringify(infoObject));

            errorCallback: (errorObject) => {
                console.log("errorCallback : " + JSON.stringify(errorObject));

        this.recorder.start(recorderOptions).then((result) => {
            this.set("isRecording", true);
            if (recorderOptions.metering) {
        }, (err) => {
            this.set("isRecording", false);
        } else {
            dialogs.alert("This device cannot record audio.");

Can anyone give a suggest for this?

Thanks in advance.



Did you resolve your issues here?

I am having similar problems. See: Nativescript-audio plugin errors: 'Error Domain' and 'null is not an object'


Hi @WS123,

I did not go back to this specific problem with audio plugin, but I had similar problem with Image saving.
It was due to the use of currentApp() instead of documents().

Indeed, currentApp() gets the root folder for the current application, but on iOS, this folder is read-only, contrary to documents().

If you develop your app on iOS device, using documents() method could solve the problem.


@Chris, Thanks very much for your reply. I will take a look at the currentApp() v documents() issue.