MediaElement.SetSource doesn't set source RRS feed

  • Question

  • I am trying to play a file. In one project this code works fine:

    var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
                    OutputMedia.SetSource(stream, file.ContentType);

    However, in my current project the second line doesn't change the source property of OutputMedia. When I debug I can see that the source just remains null even though the stream and file both look correct. Any clues??

    Sorry for posting so many questions here, but I have very few people around me with any c#/XAML experience.

    Thursday, October 4, 2012 8:24 PM


  • Thanks for trying to help. I found that the problem was running the play method inside the loadstate method. I guess it will only work when the mediaElement is visible. So i changed it to run on my main grids "loaded" event and i works like a charm. Thanks again.
    • Marked as answer by johanvts Tuesday, October 9, 2012 11:39 AM
    Tuesday, October 9, 2012 11:33 AM

All replies