LibVLCSharp - Cross-platform .NET bindings for libvlc

This forum is about all development around libVLC.
mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 07 Jun 2018 05:42

Hello,

We are announcing LibVLCSharp, a new .NET binding for libvlc that is fully cross-platform: https://github.com/videolan/libvlcsharp

Have a look at the readme to get started. We support .NET Standard 2.0.

I want to write a few words for the developers not familiar with Xamarin/Xamarin.Forms and Mono:

Xamarin is the Mono runtime tuned for mobile platforms. Xamarin is the name of not just the runtime but also the cross-platform .NET mobile ecosystem. It can run most of your regular .NET code.

Having the same runtime API on both Android and iOS means you can re-use most of the code in your apps across platforms: business-specific rules, data models, view models, database integration, webservice calls and now a VLC media player.
Have a look here at the official cross-platform plugins that Xamarin offers https://docs.microsoft.com/en-us/xamarin/essentials/
Regarding the UI, you can code your native UI for each platforms in Visual Studio, Android Studio or XCode and that will work.

If you want to share the UI code too, meaning write your UI once and have it natively render on each platform, that is possible with Xamarin.Forms. Xamarin.Forms is a UI abstraction layer and is optional - you may write an app with Xamarin without using Xamarin.Forms. Some amount of animation may be shared as well. Per platform customization remains possible with custom renderers, which is what we use to customize the VideoView on each platform for LibVLCSharp with Xamarin.Forms support.
Be aware, this is not a webview. You're using the platform APIs directly and have the same access than Java/Kotlin or Obj-c/Swift developers, you' re just using C#/F# to perform the calls. You can get the same end result, have a look for yourself: https://github.com/jsuarezruiz/xamarin- ... looking-UI. It's all opensource too, so you can have a look under the hood to see how Mono integrates with the Android and Objc runtimes.

For questions and support about LibVLCSharp: https://code.videolan.org/videolan/LibVLCSharp

For more advanced samples (including Chromecast, recording, etc): https://code.videolan.org/mfkl/libvlcsharp-samples

Our nuget account is at https://www.nuget.org/profiles/videolan

NEW: A book has been written on LibVLC, LibVLCSharp and the VideoLAN ecosystem! https://mfkl.gumroad.com/l/libvlc-good-parts

You can also reach out on Discord https://discord.gg/3h3K3JF
https://mfkl.github.io

matttheknofe
New Cone
New Cone
Posts: 3
Joined: 05 Jul 2018 09:07

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby matttheknofe » 05 Jul 2018 09:23

I was wondering if I can get some help with this. I'm a noob (by no means a professional developer). I'm trying to test this in a Xamarin Forms app, but I'm not clear on if I've followed your instructions properly. Pretty much followed exactly what you've got in your sample app, but I'm confused about where to put the LibVLCSharpFormsRenderer.Init(); part.

I'm running my app in UWP, so in the UWP app's App.xaml.cs file, I've added a reference to LibVLCSharp.Forms.Shared, and I put the line immediately before Xamarin.Forms.Forms.init(e), and then tried immediately after this.InitializeCompnent(). In both cases (and without adding it at all), the app crashes when I open the page with the VideoView control on it.

Am I doing this right or am I missing something? The error I am getting from the debugger is:

MyApp.UWP.exe!MyApp.UWP.App.InitializeComponent.AnonymousMethod__5_0(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e) Line 53 C#

The error only appears to surface if I try to load a stream, not when loading the control.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 05 Jul 2018 09:53

Hi matttheknofe,

I think you're following the steps properly, unfortunately, UWP is NOT currently one of the supported platforms. It's on the roadmap though: https://github.com/videolan/libvlcsharp#roadmap

Once UWP is supported (with a custom libvlc.winrt on nuget also https://github.com/mfkl/libvlc-nuget/issues/8), then you will be able to use it, in Xamarin.Forms or standalone projects.
https://mfkl.github.io

matttheknofe
New Cone
New Cone
Posts: 3
Joined: 05 Jul 2018 09:07

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby matttheknofe » 05 Jul 2018 10:17

Awesome thanks. Fortunately I can test on iOS too so will redeploy to that, but the device I'm testing streams from is an ethernet multicast device that I can't access from iOS. Watching for the UWP release!

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 05 Jul 2018 10:35

the device I'm testing streams from is an ethernet multicast device that I can't access from iOS.
Not sure what you mean by that, or why UWP would help here.

In any case, feel free to ask questions and report bugs here:https://code.videolan.org/videolan/LibVLCSharp/issues ;)
https://mfkl.github.io

matttheknofe
New Cone
New Cone
Posts: 3
Joined: 05 Jul 2018 09:07

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby matttheknofe » 05 Jul 2018 12:56

Sorry for the confusion. I can't connect to it wirelessly, so need a Windows device. Thanks will use the GitHub site from now!

masterwok
New Cone
New Cone
Posts: 9
Joined: 07 Jun 2018 03:01

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby masterwok » 25 Aug 2018 08:58

This is awesome! Thanks!

fayuso
New Cone
New Cone
Posts: 2
Joined: 27 Nov 2018 10:53

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby fayuso » 27 Nov 2018 10:56

I need some help integrating LibVLCSharp in Winforms.
A first try opens the video in a separated windows, but I need to embedded it in my own Form.
Where can I find more information, examples, etc.?

Thanks

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 28 Nov 2018 03:24

If you're only targeting Windows Forms, I suggest you use https://github.com/ZeBobo5/Vlc.DotNet. They have samples and more mature Windows support (but Windows only).

If you still want to use LibVLCSharp for this, you should try integrating the WPF VideoView (which is hosted in a WindowsFormsHost, so should not be too hard).
https://mfkl.github.io

fayuso
New Cone
New Cone
Posts: 2
Joined: 27 Nov 2018 10:53

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby fayuso » 28 Nov 2018 09:05

I did some test with VLC.DoNet but I want to test LibVLCSharp in order to compare.
I will try LibVLCSharp.WPF. I hope I can use it inside my WinForm C# application

Thanks

cncb
New Cone
New Cone
Posts: 1
Joined: 15 Dec 2018 20:28

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby cncb » 15 Dec 2018 20:35

Thanks for making this available.

Can you please help me understand the licensing? Is it OK to use the NuGet packages in a commercial (paid) app? If so, is it necessary to display somewhere in the app that VLC is being used underneath?

Also, are there any default on-screen controls (play/pause buttons, progress bar, etc.) or does one have to create their own? Thanks.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 20 Dec 2018 12:39

Hi cncb,
Can you please help me understand the licensing?
https://tldrlegal.com/license/gnu-lesse ... (lgpl-2.1)
Is it OK to use the NuGet packages in a commercial (paid) app?
Yes
If so, is it necessary to display somewhere in the app that VLC is being used underneath?
Yes, I think you should mention both libvlc and libvlcsharp somewhere in your app.
are there any default on-screen controls (play/pause buttons, progress bar, etc.) or does one have to create their own?
I have not had time to do this yet, but it is planned https://code.videolan.org/videolan/LibV ... /issues/45
You should have plenty of OSS resources to pick from in the meantime.
https://mfkl.github.io

cphapp
New Cone
New Cone
Posts: 1
Joined: 05 Jan 2019 12:56

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby cphapp » 05 Jan 2019 12:59

Hi

We are trying to get LibVLCSharp (https://code.videolan.org/videolan/LibVLCSharp) to work. We want to build a Xamarin Form app with LibVLCSharp but it dos not work.

I have cloned and run the Chromecast sample made with Xamarin forms. I have tried both branches in the repo. The app is running fine without any errors, but will never find any RendererDiscoverer items. Why is that? I know I have a working wifi and ChromeCast running on my iOS Phone (Chromecast works fine from ex. youtube). I have also tried to set delay to ex. 10 seconds to give more time to discover ChromeCast items, but still no luck. Any ideas to why this is not working. I noticed that the LibVLCSharp Nuget is used in the sample and not the LibVLCSharp.Forms Nuget. I have also tried to switch library and initialise these as mentioned in the documentation. Still no luck. Any advice to get this to work would be appreciated. Thanks

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 06 Jan 2019 16:59

For issues and bug reports, please use https://code.videolan.org/videolan/LibVLCSharp/issues and include your code, your logs and your config
https://mfkl.github.io

shafique121
New Cone
New Cone
Posts: 5
Joined: 10 Feb 2020 07:19

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby shafique121 » 10 Feb 2020 08:46

Awesome thanks. Fortunately I can test on iOS too so will redeploy to that, but the device I'm testing streams from is an ethernet multicast device that I can't access from iOS. Watching for the UWP release!

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 11 Feb 2020 04:08

UWP support has been released a while ago.
Sample: https://code.videolan.org/videolan/LibVLCSharp/tree/3.x/Samples/LibVLCSharp.UWP.Sample
https://mfkl.github.io

binarez
New Cone
New Cone
Posts: 1
Joined: 04 Apr 2020 01:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby binarez » 04 Apr 2020 01:49

Hi, thanks for your work on LibVLCSharp and thanks to the whole team for their work on libvlc. I'm exploring my options for building an app integrating video that needs to run on Android, iOS and Windows. Ideally, I would use Xamarin.Forms as I'm somewhat familiar with the technology. I've been trying to get LibVLCSharp.Forms to work on UWP but just found out about the open bug about the platform not being supported right now and that it might needs to wait until libvlc 4.0 to get it done (https://code.videolan.org/videolan/LibVLCSharp/issues/138).

I'm writing here to see if you have any recommendation regarding my options : wait 'til 4.0 but I'm unsure how far away that is? (I know this is an open source freeware project so I think it's rather inappropriate to ask for a timeline :) just wondering ballpark), write a WFP version of the app using LibVLCSharp.WFP, look into the UNO platform (seems ok, not sure about long-term survival of the platform), or something else!?

Thanks, any feedback appreciated.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 04 Apr 2020 22:25

I'm unsure how far away that is?
Hard to say.

I'd probably go the WPF route if I were you, as a Xamarin.Forms back-end as well if you want https://www.nuget.org/packages/LibVLCSharp.Forms.WPF/
https://mfkl.github.io

Fidchell's Eye
New Cone
New Cone
Posts: 5
Joined: 12 May 2020 17:06

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby Fidchell's Eye » 12 May 2020 17:53

Hi

I was wondering if I can get some answers as I tend to miss some things when searching for answers.
I'm a not a great programmer, and use C# as my programming language of choice.

Now I'm looking to use VLC in a C# project with VS2013 as my IDE.
The project is for video/image analysis with data coming from files and capture devices,
but I need to grab a new frame after my image analysis tool(s) have finished with the frame it worked on with some video frames likely be skipped.
I am not sure how to grab the uncompressed frames for my tool in with the LibVlcSharp wrapper API, or if it supports that function?
Later on some audio analysis or network streaming fucntions might be added to the project, but for now the big one is how do i grab uncompressed frames?

FE

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 12 May 2020 21:44

I am not sure how to grab the uncompressed frames for my tool in with the LibVlcSharp wrapper API, or if it supports that function?
Yes, it does. See https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/PreviewThumbnailExtractor
https://mfkl.github.io

Fidchell's Eye
New Cone
New Cone
Posts: 5
Joined: 12 May 2020 17:06

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby Fidchell's Eye » 13 May 2020 15:39

I am not sure how to grab the uncompressed frames for my tool in with the LibVlcSharp wrapper API, or if it supports that function?
Yes, it does. See https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/PreviewThumbnailExtractor
Thanks, this helps a lot. :D

:?: So the ThumbnailExtractor example can pull non-sequential frames, and more so on the frame I request a snapshot of while video is running?

:?: Also does the ThumbnailExtractor example cover how to grab double color byte formats (10-bit, 12-bit, 14-bit, and or 16-bit color, or should I say 30-bit, 36-bit,42-bit and or 48-bit color) and if so how are they formatted in bits?
As I want to also upgrade my video/image analysis tool to start reading double byte color formats as it currently only handles single byte color formats like 24-bit color at the moment.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 18 May 2020 15:03

You should check out the docs to see if these functions fit your needs.

https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media__player.html#ga612605f2e5c638d9f4ed59021d714bf0

https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media__player.html#ga6518394e05d458731c11c86edb23f4cc

If you have high perf requirements, you will need to wait for the libvlc 4.0 support in libvlcsharp to be able to use this API https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media__player.html#gafae363ba4c4655780b0403e00159be56
https://mfkl.github.io

Fidchell's Eye
New Cone
New Cone
Posts: 5
Joined: 12 May 2020 17:06

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby Fidchell's Eye » 22 May 2020 16:39

I am not sure how to grab the uncompressed frames for my tool in with the LibVlcSharp wrapper API, or if it supports that function?
Yes, it does. See https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/PreviewThumbnailExtractor
I've tried to get these samples running,
but seem to have issues getting the projects to load in Visual Studio.

Couldn't use VS 2013, due to .Net Core in use,
LibVLCSharp not loading, needing to setup Nuget, etc

For a newcomer to this from VS2013 without ever using Nuget,
I'd ask and recommend a bit of a getting started/setup manual in the root of the samples.
Including setting up Nuget to access the net for Nuget Packages and not a offline folder.

Fidchell's Eye
New Cone
New Cone
Posts: 5
Joined: 12 May 2020 17:06

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby Fidchell's Eye » 22 May 2020 22:01

I am not sure how to grab the uncompressed frames for my tool in with the LibVlcSharp wrapper API, or if it supports that function?
Yes, it does. See https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/PreviewThumbnailExtractor
Can the Samples be checked and updated, as it's using functions that have been removed from the SixLabors.ImageSharp library, as GetPixelSpan() is obsolete and no longer accessable even from the SixLabors.ImageSharp.Advanced library.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp - Cross-platform .NET bindings for libvlc

Postby mfkl » 23 May 2020 22:21

For a newcomer to this from VS2013 without ever using Nuget,
VS2013 is not supported because it is way too old, you need to be up to date as this is a modern framework targeting modern TFMs (including dotnet core).
I'd ask and recommend a bit of a getting started/setup manual in the root of the samples.
Including setting up Nuget to access the net for Nuget Packages and not a offline folder.
We always welcome PRs. A restore and build on the sln file should be enough, there is no offline folder, but feel free to contribute more details on how to get started. You should probably read a bit about nuget as well, as this is not specific to libvlcsharp but just general dotnet development.
Can the Samples be checked and updated, as it's using functions that have been removed from the SixLabors.ImageSharp library, as GetPixelSpan() is obsolete and no longer accessable even from the SixLabors.ImageSharp.Advanced library.
Feel free to create an issue (or better yet, a PR) to update this, should be pretty simple :-)
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests