我正在使用react-native-sound
播放声音,并且正在iOS 12设备上播放,但当我登录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()
})
const notificationSound = new Sound('ring_tone.wav', Sound.MAIN_BUNDLE, (error) => {
if (error) {
console.log('failed to load the sound', error);
return;
}
});
enter code here
请在ios中使用以下方式notificationSound.play(((=>{}(;
Android通知声音播放((;