Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stability issues with WPF MediaElement (MediaFailed, slow-motion video), are there workarounds out there?

I have a couple issues with it:

  • media fails to play and continues to fail until the application is restarted
  • audio plays normally but video is in slow-motion and will not play normally until the application is restarted.
  • there's no way to reinitialize other than an app restart. (that I know of)
  • there's no real solid way to know if a video is rendering. I can observe Position to verify it is playing but it's not a guarantee there's any video output.

I run two instances of an extended version of MediaElement in my WPF app which hinges on their stability. After many tests I've concluded that it's the highest performing video player out there, above MediaKit and vlcdotnet, due to using solely GPU to decode. I've encoded videos in WVC1 (Windows Media Video AP@l3 VC-1) for 1080p quality and relatively small file sizes. Eventually after several plays the videos will fail to play, at which point the MediaFailed event is fired and subsequently stops working altogether until the application is restarted.

It is my understanding that when it fails like this, it's a core failure within the underlying Windows Media Player OCX control and it cannot be fixed in any way other than a full application restart. Has anybody found any reliable workarounds for these issues? Mum's the word over at the Microsoft forums...

like image 932
erodewald Avatar asked May 07 '12 14:05

erodewald


1 Answers

Answering my own question here to possibly facilitate future SO'ers who might run into these issues. The issue lies in WPF, it is not planned to be improved. For a more reliable solution with minimal overhead, try WPFMediaKit.

like image 97
erodewald Avatar answered Oct 31 '22 07:10

erodewald