Skip to content

Cross-platform .NET/Mono bindings for libVLC

License

Notifications You must be signed in to change notification settings

rocksdanister/libvlcsharp

 
 

Repository files navigation

LibVLCSharp

LibVLCSharp are .NET/Mono bindings for libvlc, the multimedia framework powering the VLC applications.

The official repository URL for this repo is https://code.videolan.org/videolan/LibVLCSharp.

Goal

LibVLCSharp's goal is to support all .NET runtimes (Xamarin/Mono, .NET Core and .NET Framework) on most operating systems by targeting .NET Standard 2.0.

We also aim to provide you with a custom video control integrated with the OS native UI toolkit. That means integration with UWP, Cocoa (Xamarin.Mac), GTK# and game engines with Mono support (Unity, Unreal, Godot). For a current status, see Supported platforms and Roadmap.

libvlc is a complete, opensource and crossplatform multimedia framework written in C. On the other hand, Xamarin allows true crossplatform .NET code on all platforms and provides an efficient way to build crossplatform UIs with Xamarin.Forms.

LibVLCSharp is designed to be the connecting layer in between libvlc and Xamarin.

Using LibVLCSharp means you can take advantage of all libvlc features from shared managed code (C#/F#), in a true crossplatform way. You may use the features described below on all supported platforms by LibVLCSharp (Android, iOS, XForms for now, more coming soon).

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:

  • Network browsing for distant filesystems (SMB, FTP, SFTP, NFS...).
  • HDMI passthrough for Audio HD codecs, like E-AC3, TrueHD or DTS-HD.
  • Stream to distant renderers, like Chromecast.
  • 360 video and 3D audio playback with viewpoint change.
  • Support for Ambisonics audio and more than 8 audio channels.
  • Subtitles size modification live.
  • Hardware decoding and display on all platforms.
  • DVD playback and menu navigation.

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

Supported platforms

  • Xamarin.Android
  • Xamarin.iOS
  • Xamarin.Forms

Installation

You need to install 2 packages to get started.

The first is libvlc, which is the actual VLC engine written mostly in C/C++ and compiled for your target platform. You can find information about it and how to download it on NuGet here.

The second package you need is LibVLCSharp, the .NET wrapper that consumes libvlc and allows you to interact with native code from C#/F#.

dotnet add package LibVLCSharp --version 0.0.1-alpha2 

https://www.nuget.org/packages/LibVLCSharp

If you plan to use LibVLCSharp with Xamarin.Forms, you need to install LibVLCSharp.Forms instead (which references LibVLCSharp).

dotnet add package LibVLCSharp.Forms --version 0.0.1-alpha

https://www.nuget.org/packages/LibVLCSharp.Forms/

Getting started

Feel free to check out the native sample projects for iOS and Android to get started.

Basically, you need to instantiate a VideoView and add it to your View. It handles the required libvlc initialization for you on each platform, and offers a MediaPlayer .NET object on which you can call Play, Pause, set a new media or listen for libvlc events.

For usage of the API, you should check out the libvlc C API documentation which this wrapper follows closely.

Regarding LibVLCSharp.Forms, check out the sample for Forms to get started. Notably, make sure to call LibVLCSharpFormsRenderer.Init() in your platform specific project before Xamarin.Forms.Forms.Init is called.

Quick API overview

  • VideoView.cs: Custom view which holds a LibVLC object and a MediaPlayer object.
  • LibVLC.cs: Main object pointing to a native libvlc instance in native code. Accessible from VideoView.
  • MediaPlayer.cs: Manages playback, offers event listeners and more. Accessible from VideoView.
  • 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.
  • Media.cs: Class representing and providing information about a media such as a video or audio file or stream.
  • Dialog.cs: Dialogs can be raised from the libvlc engine in some cases. Register callbacks with this object.

Roadmap

  • macOS (using Xamarin.Mac)
  • Linux (using GTK#)
  • Windows 10 (using UWP)
  • Game engines (Unity, Unreal, Godot)

We are discussing WPF support, please contact us if that is something you would like to see.

If you have a request or question regarding the roadmap, feel free to open an issue or PR.

Contribute

Pull request

Pull requests are more than welcome! If you do submit one, please make sure to use a descriptive title and description.

Gitlab issues

You can look through issues we currently have on the VideoLAN Gitlab.

Communication

Forum

If you have any question or if you're not sure it's actually an issue, please visit our forum.

Issues

You have encountered an issue and wish to report it to the VLC dev team?

You can create one on our Gitlab or on our bug tracker.

Before creating an issue or ticket, please double check for duplicates!

IRC

Want to quickly get in touch with us for a question, or even just to talk?

You will always find someone from the VLC team on IRC, #videolan channel on the freenode network.

If you don't have an IRC client, you can always use the freenode webchat.

Code of Conduct

Please read and follow the VideoLAN CoC license.

License

LibVLCSharp is under the LGPLv2.1.

About

Cross-platform .NET/Mono bindings for libVLC

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.9%
  • F# 0.1%