【发布时间】:2021-07-04 02:48:17
【问题描述】:
我尝试从 react-native-audio 中的 url 播放音频文件。音频管理器在加载音频文件之前尝试播放音频文件...
我在 git hub 中查找了这个问题,但没有一个解决方案有效...希望它对您有所帮助,因为它在 android 中对我有用...
playback failed due to audio decoding error
static play(audioPath) {
setTimeout(() => {
if (Platform.OS === "ios") {
Sound.enable(true);
}
const sound = new Sound(audioPath, "", (error) => {
if (error) {
console.log("failed to load the sound", error);
}
});
setTimeout(() => {
sound.play((success) => {
if (success) {
console.log("successfully finished playing");
} else {
// HERE WhAT I Did was just recurr this same function until and unless the audio is download properly and played successfully
console.log("Error Occurred Retrying");
}
});
}, 100);
}, 100);
【问题讨论】:
标签: reactjs react-native react-redux rxjs react-router