在IOS中它可以正常工作,在android中,它在调试模式下再次正常,但在发布模式下它不起作用
这是错误消息,但没有意义.. {额外:-2147483648,什么:1}。
here is the code:
const Sound = require('react-native-sound')
Sound.setCategory('Ambient')
const music = new Sound('game.mp3', Sound.MAIN_BUNDLE, error => {
if (error) {
alert(JSON.stringify(error))/prompts: {extra: -2147483648, what: 1}
console.log('failed to create sound', error)
return
}
alert('load successfully')
})
music.setNumberOfLoops(-1)
包.json:
..
"react-native": "0.63.4",
"react-native-sound": "^0.11.0",
编辑:如果我这样重构代码;有用。
let localSound = require('./game.mp3')
Sound.setCategory('Ambient')
const music = new Sound(localSound, Sound.MAIN_BUNDLE, error => {
为什么它没有从'../res/raw/game.mp3'获取声音文件(文件在那里..)
如何解决这个奇怪的问题?