Page 1 of 2
LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 07 Jun 2018 05:42
by mfkl
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 05 Jul 2018 09:23
by matttheknofe
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 05 Jul 2018 09:53
by mfkl
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 05 Jul 2018 10:17
by matttheknofe
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!
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 05 Jul 2018 10:35
by mfkl
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 05 Jul 2018 12:56
by matttheknofe
Sorry for the confusion. I can't connect to it wirelessly, so need a Windows device. Thanks will use the GitHub site from now!
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 25 Aug 2018 08:58
by masterwok
This is awesome! Thanks!
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 27 Nov 2018 10:56
by fayuso
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 28 Nov 2018 03:24
by mfkl
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).
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 28 Nov 2018 09:05
by fayuso
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 15 Dec 2018 20:35
by cncb
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 20 Dec 2018 12:39
by mfkl
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 05 Jan 2019 12:59
by cphapp
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 06 Jan 2019 16:59
by mfkl
For issues and bug reports, please use
https://code.videolan.org/videolan/LibVLCSharp/issues and include your code, your logs and your config
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 10 Feb 2020 08:46
by shafique121
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!
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 11 Feb 2020 04:08
by mfkl
UWP support has been released a while ago.
Sample: https://code.videolan.org/videolan/LibVLCSharp/tree/3.x/Samples/LibVLCSharp.UWP.Sample
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 04 Apr 2020 01:49
by binarez
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 04 Apr 2020 22:25
by mfkl
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/
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 12 May 2020 17:53
by Fidchell's Eye
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 12 May 2020 21:44
by mfkl
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 13 May 2020 15:39
by Fidchell's Eye
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.
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 18 May 2020 15:03
by mfkl
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
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 22 May 2020 16:39
by Fidchell's Eye
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 22 May 2020 22:01
by Fidchell's Eye
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.
Re: LibVLCSharp - Cross-platform .NET bindings for libvlc
Posted: 23 May 2020 22:21
by mfkl
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