Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package/src/components/Attachment/AudioAttachment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
soundRef.current = await NativeHandlers.Sound.initializeSound(
{ uri: item.file.uri },
{
pitchCorrectionQuality: 'high',
progressUpdateIntervalMillis: 100,
shouldCorrectPitch: true,
},
onPlaybackStatusUpdate,
);
Expand Down
2 changes: 1 addition & 1 deletion package/src/hooks/useAudioPlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const useAudioPlayer = (props: UseSoundPlayerProps) => {
return;
}
if (soundRef.current?.setRateAsync) {
await soundRef.current.setRateAsync(speed);
await soundRef.current.setRateAsync(speed, true, 'high');
}
},
[isExpoCLI, soundRef],
Expand Down
9 changes: 8 additions & 1 deletion package/src/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,12 @@ export type PlaybackStatus = {
shouldPlay: boolean;
};

export type PitchCorrectionQuality = 'low' | 'medium' | 'high';

export type AVPlaybackStatusToSet = {
isLooping: boolean;
isMuted: boolean;
pitchCorrectionQuality: PitchCorrectionQuality;
positionMillis: number;
progressUpdateIntervalMillis: number;
rate: number;
Expand Down Expand Up @@ -152,7 +155,11 @@ export type SoundReturnType = {
seek?: (progress: number, tolerance?: number) => void;
setPositionAsync?: (millis: number) => void;
setProgressUpdateIntervalAsync?: (progressUpdateIntervalMillis: number) => void;
setRateAsync?: (rate: number) => void;
setRateAsync?: (
rate: number,
shouldCorrectPitch: boolean,
pitchCorrectionQuality?: PitchCorrectionQuality,
) => void;
soundRef?: React.RefObject<SoundReturnType>;
stopAsync?: () => void;
style?: StyleProp<ViewStyle>;
Expand Down