TrackPlayer.add 方法在 React-native-track-player 中不起作用

TrackPlayer.add method is not Working in React-native-track-player

  useEffect(() => {
    try {
      const voiceover = parseOrGet(item.scenes[selectedIndex].voiceover);
      voiceover["title"]="test"
      voiceover["artist"]="test"
      voiceover["id"]="2"
      voiceover["artwork"]="https://url_to_artwork.jpg"
      delete voiceover.metadata
      delete voiceover.name
      delete voiceover.type
      console.log(voiceover)
      if (voiceover) {
        TrackPlayer.add(voiceover);
        TrackPlayer.play();
        setSelectedTrack(voiceover);
      }else{
        TrackPlayer.destroy();
      }
    } catch (error) {
      console.log('my initial error', error);
    }
  }, [selectedIndex]);

我在这里添加了 trackplayer 画外音,但我听不到画外音音乐,它不起作用

这是我的配音对象

{"artist": "test", "artwork": "https://url_to_artwork.jpg", "id": 1, "title": "test", "url": "https://d3bm2z03a5d1kp.cloudfront.net/hindi-narration/1.mp3"}

让mw知道我哪里做错了

尝试改变从

if (voiceover) {
  TrackPlayer.add(voiceover);
  TrackPlayer.play();
  setSelectedTrack(voiceover);
} else {
  TrackPlayer.destroy();
}

if (voiceover) {
  await TrackPlayer.add(voiceover);
  await TrackPlayer.play();
  setSelectedTrack(voiceover);
} else {
  await TrackPlayer.destroy();
}

并将函数定义为 useEffect(async () => ....)