VideoLAN, a project and a non-profit organization.

LibVLCSharp

LibVLCSharp is a cross-platform audio and video API for .NET platforms based on VideoLAN’s LibVLC Library. It provides a comprehensive multimedia API that can be used across mobile, server and desktop to render video and output audio as well as encode and stream.

LibVLCSharp banner

Features

Check out libvlc-nuget to get a basic understanding of how libvlc works, what it can offer and how to install it with NuGet.

Some of the features include:

  • Play every media file formats, every codec and every streaming protocols
  • Run on every platform, from desktop (Windows, Linux, Mac) to mobile (Android, iOS) and TVs
  • Hardware and efficient decoding on every platform, up to 8K
  • Network browsing for distant filesystems (SMB, FTP, SFTP, NFS…) and servers (UPnP, DLNA)
  • Playback of Audio CD, DVD and Bluray with menu navigation
  • Support for HDR, including tonemapping for SDR streams
  • Audio passthrough with SPDIF and HDMI, including for Audio HD codecs, like DD+, TrueHD or DTS-HD
  • Support for video and audio filters
  • Support for 360 video and 3D audio playback, including Ambisonics
  • Able to cast and stream to distant renderers, like Chromecast and UPnP renderers.

Most things you can achieve with the regular VLC desktop app, you can also achieve using libvlc.

MediaPlayerElement

Full featured video control for Xamarin.Forms available in LibVLCSharp.Forms (iOS/Android) and Uno platform (iOS/Android/UWP).

Supported platforms

Mono, .NET Framework and .NET Core runtimes are supported.

  • Xamarin.Android
  • Xamarin.iOS
  • Xamarin.tvOS
  • Xamarin.Mac (Cocoa)
  • Windows Classic (WPF, WinForms, GTK)
  • Windows Universal (UWP for Desktop, mobile and Xbox)
  • Linux including desktop, server and Raspberry Pi (GTK)
  • Xamarin.Forms
  • MAUI
  • Uno Platform 5 (WinUI, Android, iOS)
  • Avalonia (Windows, macOS, Linux)
  • .NET Standard 1.1 and 2.0
  • .NET Framework 4.0 and later
  • .NET Core (including ASP.NET Core)
  • Unity3D
    • Windows Classic, Android, UWP, iOS, macOS

Documentation

Follow the Getting started guide. The general documentation is part of the repository, and there is also an API docs website.

In September 2022, The Good Parts of LibVLC — the first book ever about LibVLC, the VideoLAN community and LibVLCSharp — was released.

MediaPlayerElement in LibVLCSharp.Forms

Quick API overview

using var libvlc = new LibVLC(enableDebugLogs: true);
using var media = new Media(libvlc, new Uri(@"C:\tmp\big_buck_bunny.mp4"));
using var mediaplayer = new MediaPlayer(media);

mediaplayer.Play();

Console.ReadKey();
  • LibVLC.cs: Main object pointing to a native libvlc instance in native code.
  • MediaPlayer.cs: Manages playback, offers event listeners and more. Accessible from VideoView with data-binding support.
  • Media.cs: Class representing and providing information about a media such as a video or audio file or stream.
  • VideoView.cs: Custom native view which holds a MediaPlayer object.
  • MediaDiscoverer.cs: This object should be used to find media on NAS and any SMB/UPnP-enabled device on your local network.
  • RendererDiscoverer.cs: Use this to find and use a Chromecast or other distant renderers.
  • Dialog.cs: Dialogs can be raised from the libvlc engine in some cases. Register callbacks with this object.

The LibVLCSharp.Forms and Uno packages features a MediaPlayerElement control, similar to the ones provided by the .NET Framework on WPF and UWP. It currently supports iOS, Android and UWP (Uno only).

Samples

For more advanced samples, have a look at libvlcsharp-samples with apps such as:

  • Chromecast sample: Discover chromecasts on your local network and select one for playback in 100% shared code (Xamarin.Forms, iOS/Android).
  • Record HLS sample: Simple .NET Core CLI app which shows how to record an HLS stream to the filesystem.
  • RTSP Mosaic sample: Cross-platform RTSP player sample with 4 views mosaic (Xamarin.Forms, iOS/Android).
  • PulseMusic UX sample: A stylish music player UX example using Skia on iOS and Android.
  • Gestures sample: Cross-platform touch gestures and 360 videos on iOS and Android.
  • LocalNetwork sample: Cross-platform local network browsing and playback with network shares (SMB, UPnP) on Android, iOS and WPF.
  • MediaPlayerElement sample: Minimal iOS/Android sample showing how to get started with the crossplatform MediaPlayerElement control from LibVLCSharp.Forms.
  • SkiaSharp Preview Thumbnailer sample: .NET Core sample app showing how to use LibVLC 3 video callbacks and encode the frame with SkiaSharp before saving it to disk.
  • lvst: Watch a movie while it is downloading! lvst is a .NET Core CLI app using MonoTorrent and LibVLCSharp for macOS, Linux and Windows.

Roadmap

Contribute

Pull requests are more than welcome! If you do submit one, please make sure to read the contributing guidelines first, and use our pull request template.

You can look through issues we currently have on the VideoLAN Gitlab. Please pick one of our GitLab issue templates so we can assist you better.

There are up for grabs tickets as well if you would like to start contributing.

Please read and follow the VideoLAN Code of Conduct.

Questions and Support

You can create issues on our Gitlab (using an issue template) for .NET related questions/problems. For LibVLC/VLC specific issues, usually native code, please go to the bug tracker of the VLC project.

We are on Discord and we regularly monitor the libvlcsharp tag on StackOverflow. For general questions, visit our forum.

Commercial services

If you would like VLC developers to provide you with custom development on LibVLC and/or LibVLCSharp, training and workshops, commercial licenses, support services, consulting services, or other multimedia services, feel free to contact us.