I am using Plugin.MediaManager.Forms
for playing a list of audios. I am also showing the same list of items (text data) in a listview. When playing audio I need to change the background color of the item.
My Code:
List<string> songsUrlList = new List<string>();
for (int i = 0; i < chaptersList.Count; i++)
{
songsUrlList.Add(aduioFormat+ chaptersList[i].audioUrl);
}
var mediaItem = await CrossMediaManager.Current.Play(songsUrlList);
First I created an audio list, then I play that list like above. I am able to change the background color of the first item. When the remaining audio starts playing I don't know how to change the background color.
If I tap an item, I clear the songsUrlList
first, then create a new list and play that list like below. Is it a correct implementation?
private async void ChapterTapped(object sender, ItemTappedEventArgs e)
{
var selectedItem = (ListVerses)e.Item;
if (selectedItem != null)
{
await CrossMediaManager.Current.Pause();
songsUrlList.Clear();
for (int i = Int32.Parse(selectedItem.slno) - 1; i < chaptersList.Count; i++)
{
songsUrlList.Add(aduioFormat+ chaptersList[i].audioUrl);
}
await CrossMediaManager.Current.Play(songsUrlList);
audioOrder = Int32.Parse(selectedItem.slno) - 1;
selectedItem.BGColor = Color.FromHex("#f2ee71");
}
ChapterList.SelectedItem = null;
}
I need to change the background color of the list item when audio plays that item. I have added an expected feature video here.
I have added a sample project here for reference.