尝试使用expo音频播放器在React-native中实现一个简单的音乐播放器。不确定拨打哪里
handlePlay1 = async () => {
try {
console.log('TRYING TO LOAD: ', this.state.selectedTrack);
await this.state.player.loadAsync({uri: this.props.tracks[this.state.selectedTrack].localFile});
console.log('loaded');
{ shouldPlay: true }
this.audioPlayer1 = this.state.player;
} catch (error) {
console.log('an error has occured: ', error);
}
}
还有这个
new Expo.Audio.Sound()
我们正在播放音频,并且可以切换音轨,但会出现大量错误“ 声音已加载”,并且无法始终如一地管理状态播放。
回购链接:https://github.com/Anarchonist7/Fresh_Radio
谢谢