Search code examples
windows-phone-7media-playermediaelement

how to use MediaHistory.NowPlaying Property to get current playing list in windows phone 7


how can I get the current playing list that is playing by "music + video" app. The only thing I can get so far is the current playing song, but users will have no idea what is the next song or what list is being played.

I check this http://msdn.microsoft.com/en-us/library/ff769558%28VS.92%29.aspx but it's about updating the hub. I want to update my app.....

For example, if I let's user choose to play 3rd Album in the Hub, I do it like this:

mySongCollection = library.Albums[3].Songs;

and to update my lists I use:

listbox.Itemssource = mySongCollection;

how can I get the current playing list from hub to mySongCollection list?


Solution

  • One way would be to loop through the MediaPlayer.Queue:

    for(int i = 0; i < MediaPlayer.Queue.Count; i++)
    {         
        Debug.WriteLine(MediaPlayer.Queue[i].Artist.Name);
    
        //to add the song to the listbox
        playListLb.Items.Add(MediaPlayer.Queue[i]);
    }