播放本地文件
import Sound from 'react-native-sound';
let demoAudio = require('./sounds/.m4a');//支持众多格式
const s = new Sound(demoAudio, (e) => {
if (e) {
console.log('播放失败');
return;
}
s.play(() => s.release());
});
播放远程文件
const s = new Sound(path,null, (e) => {
if (e) {
console.log('播放失败');
return;
}
s.play(() => s.release());
});
请注意地扯后有一个null参数,必需加上,否则无法播放