Play Stream with MPV Player in C# (WebDAV)

306 views Asked by At

So this is a bit of a niche question. I'm using MPV Player hosted in a C#/WPF application running in .NET 6.0 with the help of this MediaPlayerUI.NET library.

Currently the media files I am accessing are stored on a Synology server which I get to via WebDAV using RaiDrive which mounts the Synology folder locally to my Z:\ Drive.

I want to cut RaiDrive out of the picture and manage the WebDAV connection myself in C#. This seems to be pretty straightforward using this WebDAVClient library. However, there's a small issue. MPV Player's functionality want's a filepath to load from and the WebDAVClient offers me a Stream.

Of course I could download the file locally, play it, and then delete it once the play is complete, but that seems excessive and I'd rather not use local storage. RaiDrive is able to allow me to play the files without copying a local version. How can I either:

  • Get a "path" out of the WebDAV client that I can feed to MPV Player

OR

  • Feed a Stream to MPV Player so that it can play from a stream rather than a hard path

The MediaPlayerUI.NET does offer direct access to the underlying C commands. I'm not exactly sure how to interact with them, but the functionality is exposed, so if anyone knows how to use those to make this happen, I'm not above writing dark scary IntPtr code.

EDIT After some research, I've concluded that it is probably not possible (or at least not easy) to get a "path" to a file hosted in WebDAV. In order for MPV Player's C code to recognize a path, it would have to be known throughout windows, which, without installations like RaiDrive (or Dokan or others like it) isn't really possible to facilitate in my C# app alone.

So I'm stuck trying to find a way to feed a Stream into MPV player rather than simply telling it about a file path.

0

There are 0 answers