@@ -20,8 +20,8 @@ export const Sound = {
20
20
await ExpoAudioComponent . setAudioModeAsync ( {
21
21
playsInSilentMode : true ,
22
22
} ) ;
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 ) ;
25
25
return sound ;
26
26
}
27
27
: AudioComponent
@@ -64,7 +64,12 @@ class ExpoAudioSoundAdapter {
64
64
private initialShouldCorrectPitch ;
65
65
private onPlaybackStatusUpdate ;
66
66
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 ) ;
68
73
this . onPlaybackStatusUpdate = ( playbackStatus : ExpoAudioPlaybackStatus ) => {
69
74
onPlaybackStatusUpdate ( expoAudioToExpoAvStatusAdapter ( playbackStatus ) ) ;
70
75
if ( playbackStatus . didJustFinish ) {
@@ -91,8 +96,7 @@ class ExpoAudioSoundAdapter {
91
96
} ;
92
97
93
98
// eslint-disable-next-line require-await
94
- loadAsync = async ( source , initialStatus ) => {
95
- this . player = expoCreateSoundPlayer ?.( source , initialStatus . progressUpdateIntervalMillis ) ;
99
+ loadAsync = async ( initialStatus ) => {
96
100
this . initialShouldCorrectPitch = initialStatus . shouldCorrectPitch ;
97
101
this . initialPitchCorrectionQuality = initialStatus . pitchCorrectionQuality ;
98
102
} ;
@@ -126,6 +130,7 @@ class ExpoAudioSoundAdapter {
126
130
replayAsync : SoundReturnType [ 'replayAsync' ] = async ( ) => {
127
131
this . subscribeStatusEventListener ( ) ;
128
132
this . player . seekTo ( 0 ) ;
133
+ this . player . play ( ) ;
129
134
} ;
130
135
131
136
// eslint-disable-next-line require-await
0 commit comments