@@ -20,7 +20,7 @@ export const Sound = {
2020 await ExpoAudioComponent . setAudioModeAsync ( {
2121 playsInSilentMode : true ,
2222 } ) ;
23- const sound = new ExpoAudioSoundAdapter ( onPlaybackStatusUpdate ) ;
23+ const sound = new ExpoAudioSoundAdapter ( source , initialStatus , onPlaybackStatusUpdate ) ;
2424 await sound . loadAsync ( source , initialStatus ) ;
2525 return sound ;
2626 }
@@ -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 ) {
@@ -92,7 +97,6 @@ class ExpoAudioSoundAdapter {
9297
9398 // eslint-disable-next-line require-await
9499 loadAsync = async ( source , initialStatus ) => {
95- this . player = expoCreateSoundPlayer ?.( source , initialStatus . progressUpdateIntervalMillis ) ;
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