首页 > 解决方案 > React native sound is too slow when loading a sound from url (delay)

问题描述

So i am making a mobile app with react native and i used react-native-sound for playing sounds in the app but i noticed that everytime i load the page that plays the sound it dosent play right away i have to wait for at least 10 seconds to hear it

NOTE: i am taking the sound from my website with a link that has the mp3 file retrieved from a buffer and you know how it goes .. i tried other websites but still the same .

    const track = new Sound(
      'https://example.com/voice/' + this.props.res._id,
      null,
      e => {
        if (e) {
          console.warn('error loading track:', e);
        } else {
          track.play();
        }
      },
    );
  }

so do you have any idea about this delay or how to get rid of it because when i open this link in the phone or pc browser it starts working instantly i just want the same think on the app and thank you..

标签: androidreact-nativeaudioloadreact-native-sound

解决方案


推荐阅读