0

I am looking for a solution for a question that was already posted but did not answer correctly, thanks in advance.

Show first frame of video in WPF MediaElement

Community
  • 1
  • 1
Dave Jones
  • 305
  • 1
  • 3
  • 4
  • I'm confused. The answer to that other question was accepted, with the OP even commenting on the accepted answer "Thx - this works!" Why were you unable to use that answer? – Matt Ball Sep 22 '10 at 22:20
  • I tried the solution and does not work unfortunately – Dave Jones Sep 22 '10 at 22:23
  • 1
    Can you explain why it didn't work/any errors you got/generally any more information you have as to your problem? – Callum Rogers Sep 22 '10 at 22:40

1 Answers1

0

The solution in the other thread should work but you could approach it differently.

Basically, to avoid having to load the video just to grab the first frame you could generate a static image that is the frame you want to show. If you are encoding the video most encoding software will generate a thumbnail for you for this purpose. If not you can screen shot a frame and use that

Then display that image in a normal WPF image control when the movie is not playing. When the user plays the video use a trigger to hide the image and show the video.

This will give you the effect you want.

Downside: This static image will get out of sync with the video if your video file is updated (you would need to regenerate the thumbnail in this case)

Brad Cunningham
  • 6,402
  • 1
  • 32
  • 39
  • thanks, I was thinking of this but lots of work for such a simple scenario. – Dave Jones Sep 22 '10 at 23:33
  • yes and no. It is a little more work but it gives you some more flexibility (able to show a broken image if the video fails to load, show a image not actually in the video etc..) and saves you the performance hit o loading every video just to show a thumbnail. – Brad Cunningham Sep 23 '10 at 04:42