In my application I have the following code, which get's the phone's MediaLibrary
and filters out the correct chosen Song
from the MediaLibrary.Songs
and plays it:
using (MediaLibrary library = new MediaLibrary())
{
foreach (var item in library.Songs)
{
if (item.Name == songName)
{
FrameworkDispatcher.Update();
MediaPlayer.Play(item);
}
}
library.Dispose();
}
However this takes quite a while and results in a pause. Is there a faster/more-efficient way to access a specific Song
from the phone's MediaLibrary.Songs
?
Thanks for your help.
Maybe you have to store the values in a XML document after you read the directory, this can save you a lot of time if the library doesn't get changed (Check the size of the whole library). If it does then you can check the library again and update your XML.