1

I started using the Avalonia during creating an app in C#. I saw that in the library is an "Image" Control, but is it possible to show video in Avalonia? For example with using LibVLCSharp?

--EDIT

I forget to mention that my main goal is running Avalonia application with Video on Linux on Raspberry Pi

Art Base
  • 1,739
  • 3
  • 15
  • 23
  • LibVLCSharp is not an Image control, as other libraries are (Vlc.DotNet.Wpf 3 for example). However, writing every frame in a bitmap is not a good idea for performance. – cube45 Mar 28 '19 at 14:52
  • I thought so, what you propose if I would like to display a video? – Art Base Mar 28 '19 at 18:00
  • GTK# (mono gtk#2) would be my choice at that point, it's the only libvlcsharp implementation that works on linux at the moment. winforms on mono on linux is feasible but was not implemented because of the lack of user demand and because the platform itself has not been updated for a while. – cube45 Mar 28 '19 at 19:06

3 Answers3

2

Currently only possible via WriteableBitmap and somehow wiring up ffmpeg.

There is AvaloniaAV project, but it's only compatible with Windows+Direct2D.

kekekeks
  • 3,193
  • 19
  • 16
  • I forgot to mention that I want to find a solution for Linux because I'm trying to run the program on Raspberry Pi, but thank you for the suggestion. – Art Base Mar 28 '19 at 17:58
2

I recently wrote this post on SO about how to play videos using Avalonia and LibVLCSharp in Window, Linux, MacOS and Raspberry with the ability

  • to put the VLC MediaPlayer inside an Avalonia Window or UserControl,
  • and to add a layer on top of the VLC MediaPlayer (e.g. buttons to control the MediaPlayer).

Other references:

I also created a PR here:

All the links updated (latest libs and samples versions)

Unofficial Avalonia LibVLCSharp Links

VLC video player inside an Avalonia Window/UserControl embedding single static customizable control (e.g.player buttons) LibVLCSharp.Avalonia.Unofficial

VLC video player inside an Avalonia Window/UserControl embedding multiple draggable customizable controls (e.g.player buttons, images,...) LibVLCSharp.Avalonia.Unofficial.UCanvas

LibVLCSharp.Avalonia.Unofficial Samples LibVLCSharp.Avalonia.Unofficial.Samples

LibVLCSharp.Avalonia.Unofficial.UCanvas sample LibVLCSharp.Avalonia.Unofficial.UCanvas.Samples

YAMP 2 - Open source video player sample using LibVLCSharp.Avalonia.Unofficial library Github sources Watch YAMP2 in action

radiolondra
  • 293
  • 4
  • 15
1

There is an issue for that https://code.videolan.org/videolan/LibVLCSharp/issues/7. Should be easy enough to integrate if Avalonia exposes a Windows HWND. PR welcome!

mfkl
  • 1,914
  • 1
  • 11
  • 21
  • If `Avalonia` expose a Windows `HWND` the integration will be able for all platform ex. for Linux too? I understand it correct? – Art Base Mar 28 '19 at 18:06
  • HWND is unfortunately a windows-only concept. Each platform has its own way of exposing window handle, and we need to support and test each one by one. Moreover, the Avalonia framework seems to have many platform implementations, and supporting all of them seems to be a hard work. – cube45 Mar 28 '19 at 19:03