zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.79k stars 749 forks source link

Can't play from firebase url. #801

Open ArjunKarki opened 2 years ago

ArjunKarki commented 2 years ago

can't play url from firebase. My link is https://storage.googleapis.com/chat_bucket_aso/2ihzd1mklbl8pwvhsw_3.36.mp3 My code const audio = new Sound( message.audio, null, error => { setLoadingAudio(false); if (error) { console.log('failed to load the sound', error); setError(true); } }, );

nHussain18 commented 1 year ago

@ArjunKarki wrap your audio file url into decodeURIComponent() function.

const audio = new Sound(
  decodeURIComponent(message.audio),
  null,
  error => {
    setLoadingAudio(false);
    if (error) {
      console.log('failed to load the sound', error);
      setError(true);
    }
  },
);