WPF user control to easily play video. Powered by mpv.
- Simple setup
- Auto play
- Playlist - Load, Next, Previous Move, Remove, Shuffle or Clear
- Optional youtube-dl support to play videos from hundreds of video sites.
- Change the desired video quality.
- This software is not yet ready to be used in a production environment.
If you encounter any bugs or would like to see a feature added then please open an issue. Contributions are very welcome!
This package is available via NuGet.
See Mpv.NET documentation here.
MpvPlayer is the only control in this library.
The MpvPlayer cannot be declared in XAML since it needs to be instantiated with the path to the libmpv DLL.
To instantiate MpvPlayer:
// Class-scope
private MpvPlayer player;
private const string libMpvPath = @"lib\mpv-1.dll";
// Constructor/Initialisation
player = new MpvPlayer(libMpvPath);
// Add the player as a child to
// a WPF element. (E.g. grid)
playerHost.Children.Add(player);
See Mpv.WPF.Example for a full example.
youtube-dl is a program that allows you to download videos from YouTube and about another thousand video sites. This program can work in conjunction with mpv to allow you to stream videos on the MpvPlayer.
To enable youtube-dl follow these steps:
- Download youtube-dl from https://mpv.srsfckn.biz/ or https://rg3.github.io/youtube-dl/download.html.
- Place "youtube-dl.exe" into the same folder as "mpv-1.dll".
- Like when you installed libmpv, include "youtube-dl.exe" in your project and set it to always copy to output directory.
- Download ytdl_hook.lua from the mpv repository.
- Place "ytdl_hook.lua" into your project, into a "scripts" folder if you like.
- As previously, include "ytdl_hook.lua" in your project and set it to copy to output directory.
- Open the script and make the following changes:
- Change the value of "try_ytdl_first" to true. (Line 7)
try_ytdl_first = true,
- Change the value of "path" to the relative path from your executable to your "youtube-dl.exe". (Line 13)
path = "lib\\youtube-dl.exe",
- Change the value of "try_ytdl_first" to true. (Line 7)
- Lastly, you will need to enable youtube-dl like so:
const string ytdlHookPath = @"scripts\ytdl_hook.lua"; player.EnableYouTubeDl(ytdlHookPath);
- Done!
- Mpv.NET - A .NET wrapper for the mpv C API.
- Mpv.WinForms - Upcoming user control library for Windows Forms.
See Mpv.NET documentation here.