I have an app (enterprise, distributed OTA) that among other things records video clips. All of a sudden, we started getting video uploads that were missing audio, and this issue now seems to be totally reproducible. I've been using the PBJVision library, which had seemed to work great, but I have also tested this with SwiftyCam (another AVFoundation-based library) with same results. It's unclear exactly when this was introduced, but I've checked the following:
- Ensure that a
NSMicrophoneUsageDescription
is set in the target .plist - Ensure that camera and microphone permissions are showing as granted in system settings
- Try disabling microphone permissions in settings (app correctly prompts the user to re-enable permissions)
- Try earlier releases of the video capture library in case of regression
- Try different video capture library
- Explicitly set audio enabled and bitrate for PBJVision/SwiftyCamera, and ensure that the session is at least reporting that it has audio in the logs (that is, the library and AVFoundation think there's an input set up, with an input stream that's being handled)
- Take a video with the system camera, and upload through the app — in this case, audio does work (it's not a problem with the hardware)
- Reset all content and permissions on a device, to make sure there isn't some kind of cached permission hanging out
- Make sure volume is not muted
The copy that gets saved to the camera roll is also silent, so it's not happening when the video gets uploaded. I also started to implement recording using just AVFoundation, but don't want to waste time if that will produce the same results. What could be causing a particular app not to record audio with video? I have looked at related questions, and none of the solutions provided address the problem I'm having here.
EDIT:
Here are the logs that appear when starting, recording, and stopping a PBJVision session:
[5411:1305718] VISION: camera setup
[5411:1305718] VISION: switchDevice 1 switchMode 1
[5411:1305718] VISION: capture session setup
[5411:1305291] VISION: session was started
[5411:1305718] VISION: capture session running
[5411:1305291] VISION: starting video capture
[5411:1305718] VISION: ready for video (1)
[5411:1305718] VISION: audio stream setup, channels (1) sampleRate (44100.000000)
[5411:1305718] VISION: ready for audio (1)
[5411:1305291] VISION: ending video capture
[5411:1305963] VISION: capture session stopped
[5411:1305963] VISION: session was stopped
[5411:1305291] CMTimeMakeWithSeconds(8.396 seconds, timescale 24): warning: error of -0.021 introduced due to very low timescale