Skip to content

Commit

Permalink
fix(example): recording expo-av
Browse files Browse the repository at this point in the history
  • Loading branch information
jamsch committed Nov 25, 2024
1 parent 6f3a39c commit ace6f02
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions example/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1189,29 +1189,38 @@ function RecordUsingExpoAvDemo() {

const handleStart = async () => {
setIsRecording(true);
try {
await Audio.setAudioModeAsync({
allowsRecordingIOS: true,
playsInSilentModeIOS: true,
});
const { recording } = await Audio.Recording.createAsync({
isMeteringEnabled: true,
android: {
bitRate: 32000,
extension: ".m4a",
outputFormat: AndroidOutputFormat.MPEG_4,
audioEncoder: AndroidAudioEncoder.AAC,
numberOfChannels: 1,
sampleRate: 16000,
},
ios: {
...Audio.RecordingOptionsPresets.HIGH_QUALITY.ios,
numberOfChannels: 1,
bitRate: 16000,
extension: ".wav",
outputFormat: IOSOutputFormat.LINEARPCM,
},
web: {
mimeType: "audio/wav",
bitsPerSecond: 128000,
},
});

const { recording } = await Audio.Recording.createAsync({
isMeteringEnabled: true,
android: {
bitRate: 32000,
extension: ".m4a",
outputFormat: AndroidOutputFormat.MPEG_4,
audioEncoder: AndroidAudioEncoder.AAC,
numberOfChannels: 1,
sampleRate: 16000,
},
ios: {
...Audio.RecordingOptionsPresets.HIGH_QUALITY.ios,
extension: ".wav",
outputFormat: IOSOutputFormat.LINEARPCM,
},
web: {
mimeType: "audio/wav",
bitsPerSecond: 128000,
},
});

recordingRef.current = recording;
recordingRef.current = recording;
} catch (e) {
console.log("Error starting recording", e);
}
};

const handleStop = async () => {
Expand Down

0 comments on commit ace6f02

Please sign in to comment.