简体   繁体   中英

Some audio url not playing on ios react native

Im building a react native application which plays audio file from url(internet).

From the admin side we are providing 2 options. (upload audio and record audio).

Using react-mic on the admin side for recording audio.

The issue is the audio files which we upload is getting played properly in react native android and ios.( https://s3.eu-west-3.amazonaws.com/evolum/beginner_1.mp3 )

But the recorded audio using react-mic is getting played in android but not in ios.( https://learnpodseditornodeserver.knomadixapp.com/b2748b8d36e12478e2d99ff6c04492a2.mp3 )

I'm using react-native-sound to play audio on mobile.

Here's my code

const sound = new Sound(audioUrl, '', (error) => {
                  if (error) {
                    console.log('failed to load the sound', error); // this error
                    return;
                  }
                  // Play the sound with an onEnd callback
                  sound.play((success) => {
                    if (success) {
                      console.log('successfully finished playing');
                    } else {
                      console.log('playback failed due to audio decoding errors');
                    }
                  });
                });

Here's the error i'm getting.

{
 code: "ENSOSSTATUSERRORDOMAIN1954115647",
 message: "The operation couldn’t be completed. (OSStatus error 1954115647.)",
 nativeStackIOS: Array(19),
 domain: "NSOSStatusErrorDomain",
 userInfo: {
    …
 }
}

Try removing '' from initialization

const sound = new Sound(audioUrl, error => {
  
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM