I have an issue with MediaElement
in my Win8 app - when I try to play some \".wmv\" files from local library it very often (not always) throws MediaFailed
The problem is likely that you are closing the stream prior to playing it. Therefore this code:
if (file != null)
{
using (IRandomAccessStream ras = await file.OpenAsync(FileAccessMode.Read))
{
me.SetSource(ras, file.ContentType);
}
// The stream is now closed! How can it be played!?
}
should be changed to not have the using
block:
if (file != null)
{
IRandomAccessStream ras = await file.OpenAsync(FileAccessMode.Read);
me.SetSource(ras, file.ContentType);
}
I did try the second block of code above on some channel 9 videos (both mid and high quality wmv files) and my app played them successfully.