This project is read-only.

Preview Image for Video in MediaPlayer control?

Topics: Windows 8 Xaml
Sep 11, 2012 at 2:09 PM

How do I show a preview image in the MediaPlayer control, I am not able to find any properties for setting a preview image. I have a image or capture from the video and would like that to be shown, before the user hits the play button.

Sep 11, 2012 at 3:27 PM

Hello, there's a PosterSource property that you can set to the uri of your preview image. Additionally, if you set AutoLoad=false you will see the poster and a big play button displayed. Downloading of the video won't start until the user hits play. You can find an example of this in our source download.

Regards, Tim

Sep 11, 2012 at 4:25 PM

Thanks Tim, PosterSource is working, I had set AutoLoad to False, but still I don't get the preview image.
The video is not in local storage but from an internet location. 

Jul 9, 2013 at 4:18 PM
Can you please give me a quick hint on how i show the PosterSource again after the video finished?
Jul 9, 2013 at 11:23 PM
One way is to null the source when the media has ended, set AutoLoad back to false and then reset the source. For example:
(note: the dispatcher is needed to let the MediaEnded event finish setting the visual state before you reset the source; it's a little "hackish" but is needed)
public MainPage()
    player.MediaEnded += player_MediaEnded;

async void player_MediaEnded(object sender, MediaEndedEventArgs e)
    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
        var src = player.Source;
        player.Source = null;
        player.AutoLoad = false;
        player.Source = src;
Jul 10, 2013 at 10:41 AM
Thank you very much for the fast reply!

Working well as expected!