49 lines
1.8 KiB
TypeScript
49 lines
1.8 KiB
TypeScript
import { Audio, AudioMode, InterruptionModeAndroid, InterruptionModeIOS } from 'expo-av';
|
|
import { RecordingOptions } from 'expo-av/build/Audio';
|
|
|
|
export const RECORDING_EXTENSION = '.aac';
|
|
export const RECORDING_SETTINGS: RecordingOptions = {
|
|
android: {
|
|
// Settings related to audio encoding.
|
|
extension: RECORDING_EXTENSION,
|
|
outputFormat: Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADTS,
|
|
audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC,
|
|
// Settings related to audio quality.
|
|
sampleRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.sampleRate,
|
|
numberOfChannels: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.numberOfChannels,
|
|
bitRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.android.bitRate
|
|
},
|
|
ios: {
|
|
// Settings related to audio encoding.
|
|
extension: RECORDING_EXTENSION,
|
|
audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM,
|
|
outputFormat: Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC,
|
|
// Settings related to audio quality.
|
|
sampleRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.ios.sampleRate,
|
|
numberOfChannels: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.ios.numberOfChannels,
|
|
bitRate: Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY.ios.bitRate
|
|
},
|
|
web: {},
|
|
keepAudioActiveHint: true
|
|
};
|
|
|
|
export const RECORDING_MODE: AudioMode = {
|
|
allowsRecordingIOS: true,
|
|
playsInSilentModeIOS: true,
|
|
staysActiveInBackground: true,
|
|
shouldDuckAndroid: true,
|
|
playThroughEarpieceAndroid: false,
|
|
interruptionModeIOS: InterruptionModeIOS.DoNotMix,
|
|
interruptionModeAndroid: InterruptionModeAndroid.DoNotMix
|
|
};
|
|
|
|
export const AUDIO_MODE: AudioMode = {
|
|
allowsRecordingIOS: false,
|
|
playsInSilentModeIOS: true,
|
|
staysActiveInBackground: true,
|
|
shouldDuckAndroid: true,
|
|
playThroughEarpieceAndroid: false,
|
|
interruptionModeIOS: InterruptionModeIOS.DoNotMix,
|
|
interruptionModeAndroid: InterruptionModeAndroid.DoNotMix
|
|
};
|