@@ -20,8 +20,8 @@ export const Sound = {
2020 await ExpoAudioComponent . setAudioModeAsync ( {
2121 playsInSilentMode : true ,
2222 } ) ;
23- const sound = new ExpoAudioSoundAdapter ( onPlaybackStatusUpdate ) ;
24- await sound . loadAsync ( source , initialStatus ) ;
23+ const sound = new ExpoAudioSoundAdapter ( source , initialStatus , onPlaybackStatusUpdate ) ;
24+ await sound . loadAsync ( initialStatus ) ;
2525 return sound ;
2626 }
2727 : AudioComponent
@@ -64,7 +64,12 @@ class ExpoAudioSoundAdapter {
6464 private initialShouldCorrectPitch ;
6565 private onPlaybackStatusUpdate ;
6666
67- constructor ( onPlaybackStatusUpdate : ( playbackStatus : PlaybackStatus ) => void ) {
67+ constructor (
68+ source ,
69+ initialStatus ,
70+ onPlaybackStatusUpdate : ( playbackStatus : PlaybackStatus ) => void ,
71+ ) {
72+ this . player = expoCreateSoundPlayer ?.( source , initialStatus . progressUpdateIntervalMillis ) ;
6873 this . onPlaybackStatusUpdate = ( playbackStatus : ExpoAudioPlaybackStatus ) => {
6974 onPlaybackStatusUpdate ( expoAudioToExpoAvStatusAdapter ( playbackStatus ) ) ;
7075 if ( playbackStatus . didJustFinish ) {
@@ -91,8 +96,7 @@ class ExpoAudioSoundAdapter {
9196 } ;
9297
9398 // eslint-disable-next-line require-await
94- loadAsync = async ( source , initialStatus ) => {
95- this . player = expoCreateSoundPlayer ?.( source , initialStatus . progressUpdateIntervalMillis ) ;
99+ loadAsync = async ( initialStatus ) => {
96100 this . initialShouldCorrectPitch = initialStatus . shouldCorrectPitch ;
97101 this . initialPitchCorrectionQuality = initialStatus . pitchCorrectionQuality ;
98102 } ;
@@ -126,6 +130,7 @@ class ExpoAudioSoundAdapter {
126130 replayAsync : SoundReturnType [ 'replayAsync' ] = async ( ) => {
127131 this . subscribeStatusEventListener ( ) ;
128132 this . player . seekTo ( 0 ) ;
133+ this . player . play ( ) ;
129134 } ;
130135
131136 // eslint-disable-next-line require-await
0 commit comments