【发布时间】:2020-09-13 22:46:32
【问题描述】:
以下代码在 android 上运行良好,并且可以播放声音....但是在 ios 模拟器上却不行。
我已经将我的声音文件添加到 Xcode 项目中,并且没有发现任何错误......当我单步执行代码时,它成功运行 this.sound.play() 并调用了回调函数......但是你没有听到任何声音。
import Sound from 'react-native-sound';
sound = new Sound('sound.mp3');
try {
this.sound.setCategory('Playback');
this.sound.play(() => {
this.sound.stop();
this.sound.release();
});
} catch (e) {
console.log('cannot play the sound file', e);
}
【问题讨论】:
标签: react-native react-native-ios react-native-sound