gpt4 book ai didi

react-native - react-native-sound音频文件无法在iOS 13中播放

转载 作者:行者123 更新时间:2023-12-03 01:11:31 32 4
gpt4 key购买 nike

我正在使用react-native-sound播放声音,并且正在iOS 12设备上播放,但是当我 checkin iOS 13设备时无法播放。
这是我的代码

this.soundPlayer = new Sound(require('../assets/fly.mp3'), '', (error) => {
console.log(error)
if (error) {
console.log('failed to load the sound', error);
return;
}
this.soundPlayer.play()
})

最佳答案

如果您使用require加载声音,请使用

this.soundPlayer = new Sound(require('../assets/fly.mp3'), (error) => {
console.log(error)
if (error) {
console.log('failed to load the sound', error);
return;
}
this.soundPlayer.play()
})
当您在网络中加载声音时,请使用
this.soundPlayer = new Sound(require('../assets/fly.mp3'), '', (error) => {
console.log(error)
if (error) {
console.log('failed to load the sound', error);
return;
}
this.soundPlayer.play()
})

关于react-native - react-native-sound音频文件无法在iOS 13中播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63590781/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com