Skip to content

feat(audio-recorder): add bitRate option  #519

@Ratatinator97

Description

@Ratatinator97

Plugin(s)

  • Android Battery Optimization
  • Android Dark Mode Support
  • Android Edge-to-Edge Support
  • Android Foreground Service
  • App Review
  • App Shortcuts
  • App Update
  • Asset Manager
  • Audio Recorder
  • Background Task
  • Badge
  • Bluetooth Low Energy
  • Cloudinary
  • Contacts
  • Datetime Picker
  • File Compressor
  • File Opener
  • File Picker
  • Live Update
  • Managed Configurations
  • NFC
  • Photo Editor
  • Posthog
  • Printer
  • Screen Orientation
  • Screenshot
  • Speech Recognition
  • Speech Synthesis
  • Torch
  • Zip

Current problem

First of all, thanks a lot for your awesome plugins !

We experience quality issues on the audio recording for android devices. Searching the android docs, we found that there is a setAudioEncodingBitRate for Android devices to improve the quality of the audio. In Android, it appears that the devices sets automatically the bitrate to a CD like quality, it would be better to have 192kbps by default. (128kbps is decent, 192kbps is good, 256kbps is very good).
In iOS, the quality is very nice, you use the AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue but we could also use the AVEncoderBitRateKey to have the same parameters as Android does. Adding other options like preferedOutputFormat and audioSource would also be nice, but not as critical as the bitRate

Thanks,
Alex

Preferred solution

It would be nice to have something like this

export interface StartRecordingOptions {
    /**
     * The audio sample rate in Hz.
     *
     * This option is only available on Android and iOS.
     *
     * @since 7.1.0
     * @default 44100
     * @example 16000
     */
    sampleRate?: number;
     /**
     * The audio bitrate in bytes per second.
     *
     * This option is only available on Android and iOS.
     *
     * @since 7.X.X
     * @default 192000
     * @example 256000
     */
    bitRate?: number;
}

Alternative options

No response

Additional context

No response

Before submitting

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions