Skip to content

Commit 782b785

Browse files
committed
Clean
1 parent cec4c28 commit 782b785

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/react/src/lib/VoiceProvider.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ export const VoiceProvider: FC<VoiceProviderProps> = ({
232232
if (player.isPlaying) {
233233
onInterruption.current(message);
234234
}
235+
const shouldFadeOut = message.type === 'user_interruption';
235236
player.clearQueue({
236-
fadeOut: message.type === 'user_interruption',
237+
fadeOut: shouldFadeOut,
237238
});
238239
}
239240

packages/react/src/lib/useSoundPlayer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,9 @@ export const useSoundPlayer = (props: {
171171
}: {
172172
fadeOut?: boolean;
173173
} = {}) => {
174-
if (fadeOut) workletNode.current?.port.postMessage({ type: 'fade' });
175-
workletNode.current?.port.postMessage({ type: 'clear' });
174+
workletNode.current?.port.postMessage({
175+
type: fadeOut ? 'fade' : 'clear',
176+
});
176177

177178
isProcessing.current = false;
178179
setIsPlaying(false);

0 commit comments

Comments
 (0)