0

For my wpf application i need to play video files saved in a MemoryStream. Is it possibile to achieve this by using WPF-mediakit?

Since MediaElement does not support playing a video directly from memory I have been using the vlc.dotnet library to achieve this. However I am looking for an alternative. I have found some posts that say WPF-Mediakit can play videos from a MemoryStream, but i was unable to find the described functionality in the source code or documentation.

If anyone could point me in the right direction towards playing video saved in memory in WPF-Mediakit, that would be great.

Penzich
  • 21
  • 2

1 Answers1

0

No, WPF-MediaKit cannot play video from memory stream. Just save it to a temporary file (e.g. use System.IO.Path.GetTempFileName()) and play the video from file.

WPF-MediaKit uses DirectShowLib, which is just a wrapper around MS Windows DirectShow interface. And that is unmanaged code. So:

  1. You cannot use C# MemoryStream, i.e. managed memory, for an unmanaged code. You have to use unmanaged memory.
  2. DirectShow is based on filters. AFAIK it has no input filter, which can play from memory. But you can code one, e.g. see https://stackoverflow.com/a/24478030/254109

Note: You may also some FFmpeg based solutions, see https://github.com/Sascha-L/WPF-MediaKit/wiki/Similar-Projects e.g. FFME.

xmedeko
  • 7,336
  • 6
  • 55
  • 85