I’m creating a simple media player with Silverlight 4 (C#). Now I’m using the MediaElement but it gives me an error
error 4001: …. System.Collections.ListDictionaryInternal
Now this error happens when I want to set the source of the MediaElement. So when the user hits “Play”, it sets the source of the first song.
Song s = afspeelijst.ElementAt(currentPlayingIndex);
media.Source = new System.Uri(s.FilePath);
media.Position = TimeSpan.Zero;
media.Play();
The next code doesn’t work either, but it removes the error. But still no sound :s
media.SetSource(new FileStream(s.FilePath, FileMode.Open));
You might want to check out this code. It worked just fine for me 🙂