apache / apache/cordova-plugin-media

Failed to start recording using AVAudioRecorder: (null) code:1

Open
#396 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
391
Forks
762
PR merge metrics
No merged PRs in 30d

Description

# Bug Report

Failed to start recording using AVAudioRecorder: (null) code:1

## Problem

when I try the simple code provided, I get the above error.

### What is expected to happen?

Start recording Audio.

### What does actually happen?

the above error happens.

## Information

This is my code:

```
var src = cordova.file.cacheDirectory + "myrecording.wav";
//var src = "myrecording.wav";
var mediaRec = new Media(src,
// Success callback
function() {
alert("Recording success");
},

// Error callback
function(err) {
alert("Recording error: " + JSON.stringify(err));
});

// Start recording
mediaRec.startRecord();
```

when I run this code, I get the above error. This is tested on iOS 17.1

I have the Audio permission set as well before calling this function/code.

### Command or Code

### Environment, Platform, Device

iOS 17.1 iPhone Pro

### Version information

## Checklist

- [ x] I searched for existing GitHub issues
- [ x] I updated all Cordova tooling to most recent version
- [ x] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start from the Media.startRecord() call and the iOS AVAudioRecorder path, reproducing the failure with the provided cacheDirectory recording code on iOS 17.1. Compare the reported error with the plugin's iOS recording behavior and verify that recording starts successfully without code:1 while preserving the success and error callbacks.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, objective-c
Domain
audio-video-rtc, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.