Skip to content

Commit cf7b47f

Browse files
committed
fix: audio starting on playback rate change
1 parent 322ce32 commit cf7b47f

File tree

1 file changed

+8
-1
lines changed
  • package/native-package/src/optionalDependencies

1 file changed

+8
-1
lines changed

package/native-package/src/optionalDependencies/Sound.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,13 @@ class NativeAudioSoundAdapter implements SoundReturnType {
271271

272272
if (this.playbackInstance?.setPlaybackSpeed && this.isLoaded) {
273273
await this.playbackInstance.setPlaybackSpeed(rate);
274+
275+
// Some Android backends resume playback as a side effect of changing speed.
276+
// Preserve the previous paused state explicitly so rate changes stay silent.
277+
if (!this.isPlaying) {
278+
await this.playbackInstance.pausePlayer();
279+
this.emitPlaybackStatus();
280+
}
274281
}
275282
};
276283

@@ -315,7 +322,7 @@ class NativeAudioSoundAdapter implements SoundReturnType {
315322

316323
const initializeSound =
317324
createNitroSound || LegacyAudioRecorderPlayer
318-
? async (
325+
? (
319326
source?: { uri: string },
320327
initialStatus?: Partial<AVPlaybackStatusToSet>,
321328
onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void,

0 commit comments

Comments
 (0)