0

I am fetching sound file from s3 bucket in my react native app, the file is in .wav format, but whenever I try to play it using react-native-sound, it isn't playing. When I replaced my s3 link with this sample link, it works just fine: https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3. the main difference between this sample link and my s3 link is, the s3 link automatically downloads the file (in .wav format) whenever I open the link in my browser, but the sample link plays in the site. below is my code

  Sound.setCategory('Playback');
  const {
    data,
    isLoading,
    error,
    refetch: refetchContact,
  } = useQuery('voicemailRecording', () => getVoicemailRecording(item.id));

  const url = data;

  console.log('url', url);

  const sound = new Sound(
    'https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3',
    undefined,
    (error) => {
      if (error) {
        console.log('Error loading sound', error);
      }
    },
  );

  const playSound = () => {
    setPlayText('Pause');
    sound.play((success) => {
      if (success) {
        setPlayText('Play');
        console.log('Sound played successfully');
      } else {
        console.log('Error playing sound');
      }
    });
  };

it gives the following error for my s3 link: "message": "The operation couldn’t be completed. (OSStatus error -10875.)", "nativeStackIOS":

ayus
  • 13
  • 4

0 Answers0