@@ -176,7 +176,15 @@ const Audio = React.forwardRef<AudioTagHandle, AudioProps>((props, ref) => {
176176 setReady ( false ) ;
177177 onLoadStart ( ) ;
178178 try {
179- if (
179+ if ( path . startsWith ( 'http' ) ) {
180+ const arrayBuffer = await fetch ( path , {
181+ headers :
182+ typeof source === 'object' && source && 'headers' in source
183+ ? source . headers
184+ : undefined ,
185+ } ) . then ( ( response ) => response . arrayBuffer ( ) ) ;
186+ sourceRef . current = arrayBuffer ;
187+ } else if (
180188 Platform . OS === 'android' &&
181189 ! __DEV__ &&
182190 ! path . startsWith ( 'file://' )
@@ -187,24 +195,10 @@ const Audio = React.forwardRef<AudioTagHandle, AudioProps>((props, ref) => {
187195 ) ;
188196 const arrayBuffer = base64ToArrayBuffer ( base64Payload ) ;
189197 sourceRef . current = arrayBuffer ;
198+ } else if ( path . startsWith ( 'file://' ) ) {
199+ sourceRef . current = path . replace ( 'file://' , '' ) ;
190200 } else {
191- if ( path . startsWith ( 'http' ) ) {
192- const arrayBuffer = await fetch ( path , {
193- headers :
194- typeof source === 'object' && source && 'headers' in source
195- ? source . headers
196- : undefined ,
197- } ) . then ( ( response ) => response . arrayBuffer ( ) ) ;
198-
199- if ( isCancelled ) {
200- return ;
201- }
202- sourceRef . current = arrayBuffer ;
203- } else if ( path . startsWith ( 'file://' ) ) {
204- sourceRef . current = path . replace ( 'file://' , '' ) ;
205- } else {
206- sourceRef . current = path ;
207- }
201+ sourceRef . current = path ;
208202 }
209203
210204 if ( ! isCancelled ) {
0 commit comments