Ios React native track player无法将歌曲添加到播放列表
我正在用react native开发一款音乐播放器,并一直在使用react native track player软件包。到目前为止,我还没有遇到android软件包的问题。但是当我尝试在ios上运行它时,我得到了一个错误Ios React native track player无法将歌曲添加到播放列表,ios,react-native,react-native-track-player,Ios,React Native,React Native Track Player,我正在用react native开发一款音乐播放器,并一直在使用react native track player软件包。到目前为止,我还没有遇到android软件包的问题。但是当我尝试在ios上运行它时,我得到了一个错误 您试图用值设置键0 {"id":"0", "url":{"uri":"https://urltosong.mp3"}, "artwork":"https://url_to_artwork.jpg", "artist":"author", "title":"song t
您试图用值设置键
0
{"id":"0",
"url":{"uri":"https://urltosong.mp3"},
"artwork":"https://url_to_artwork.jpg",
"artist":"author",
"title":"song titile"
}
对象,该对象是不可变的,并且已被冻结。
生成错误的代码是
async function togglePlayback() {
const currentTrack = await TrackPlayer.getCurrentTrack();
if (currentTrack == null) {
await TrackPlayer.reset();
await TrackPlayer.add(playlist); //this was never adding and die silently
await TrackPlayer.play();
} else {
await TrackPlayer.add(playlist); //adding this line the error above appeared
await TrackPlayer.play();
//console.warn(TrackPlayer.getCurrentTrack())
}
}
我正在使用此版本的软件包“react native track player”:“^2.0.0-rc13”,
我不知道我是否遗漏了什么。我会感谢你帮我解决这个问题 将您的曲目更改为:
{"id":"0",
"url":"https://urltosong.mp3",
"artwork":"https://url_to_artwork.jpg",
"artist":"author",
"title":"song titile"
}
URL应该是
字符串
或资源对象
将您的曲目更改为:
{"id":"0",
"url":"https://urltosong.mp3",
"artwork":"https://url_to_artwork.jpg",
"artist":"author",
"title":"song titile"
}
URL应该是字符串
或资源对象