【发布时间】:2019-06-03 00:45:24
【问题描述】:
是否有任何方法可以在 React Native 中预取音频,或者是否有任何库允许我这样做?
【问题讨论】:
标签: android react-native caching audio
是否有任何方法可以在 React Native 中预取音频,或者是否有任何库允许我这样做?
【问题讨论】:
标签: android react-native caching audio
由于缺乏信息,我相信您在问是否可以使用 react native 下载音频? 你可以使用类似https://www.npmjs.com/package/rn-fetch-blob 这将允许您将流保存到手机存储中,为您提供手机上文件的路径,然后您可以将其保存以供以后重复使用。
他们文档中的一个例子。
RNFetchBlob.config({
// add this option that makes response data to be stored as a file,
// this is much more performant.
fileCache : true,
})
.fetch('GET', 'http://www.example.com/file/example.zip', {
//some headers ..
})
.then((res) => {
// the temp file path
console.log('The file saved to ', res.path())
})
【讨论】: