Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

React native track player fails to add songs to playlist

$
0
0

I am working on a music player in react native and have been using the package react-native-track-player. I have so far not had a problem with the package in android. but when I try to run it on ios I get the error You attempted to set the key0with the value

{"id":"0","url":{"uri":"https://urltosong.mp3"},"artwork":"https://url_to_artwork.jpg","artist":"author","title":"song titile"} 

on an object that is meant to be immutable and has been frozen.

The code that generate the error is

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())    }  }

I am using this version of the package "react-native-track-player": "^2.0.0-rc13",I don't know if there is something I am missing. I will appreciate your help in fixing this.


Viewing all articles
Browse latest Browse all 16552

Trending Articles