Replies: 43 comments 26 replies
-
To do this in Avalonia itself seems not-super-feasible, because you'd have to either include some kind of cross platform media player (VLC?), codecs or libraries (like libavcodec) with Avalonia itself (which is a lot of data most people don't need, and probably wouldn't perform great), or hook the low level media APIs in every single supported operating system, which wouldn't be super easy as far as i can tell? |
Beta Was this translation helpful? Give feedback.
-
I think this won't be in our focus for the time-being, as @WamWooWam said, it's a bit tricky to coordinate a sane approach towards media decoding. First off we have a crippling bug for this kind of applications (#2244) because we need to shuttle image data to-&-fro native codecs to managed .NET space and thus will definitely rely with critical time rendering (#2185). Wrappers like FFMpeg.Autogen will definitely ease it up but for now it'd have to take a backseat. |
Beta Was this translation helpful? Give feedback.
-
May be this project can be ported to Avalonia: https://github.com/unosquare/ffmediaelement - it already has wrappers around ffmpeg and some WPF controls which relatively easy can be ported |
Beta Was this translation helpful? Give feedback.
-
@Sergey-Terekhin yes I've been aware of that project even before I got into Avalonia, but there are still some bugs (#2244) that we need to address first to have an acceptable media playback experience. Besides porting that is not for the faint-hearted, trust me coz i tried before and i judged that we're better off learning how it interacts with ffmpeg.autogen instead of porting ffmediaelement outright. |
Beta Was this translation helpful? Give feedback.
-
Started working on this and hopefully it gets merged in. I've tested it on Windows, MacOS, and Linux (only Ubuntu so far) and it works pretty well. |
Beta Was this translation helpful? Give feedback.
-
@shawnallen85 Is there a way to plug your video extension into an Avalonia UI application? |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay -- this is what I have in my code for using the video extension: In the XAML:
In the view model: I have a property for the MediaPlayer (referenced above in the XAML): public MediaPlayer MediaPlayer { get; } Then in my functions I control the media player -- that being I start/stop/change the media, etc. I hope that helps -- let me know. Happy Thursday! Edit: I just noticed this, but my code is referencing the control before it was integrated into the LibVLC project officially -- controls:Video might actually be controls:VideoView. I think the rest is the same. |
Beta Was this translation helpful? Give feedback.
-
Do you have a simple demo with this in?
|
Beta Was this translation helpful? Give feedback.
-
I don't -- I'll see if I can modify the app I was using this in to use the official control and push it to github in the next day or so. |
Beta Was this translation helpful? Give feedback.
-
I figured if I didn't knock it out now it wouldn't happen anytime soon :P. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I will give it a whirl!
From: Shawn Black ***@***.***>
Sent: 18 March 2021 16:47
To: AvaloniaUI/Avalonia ***@***.***>
Cc: Simon Murrell ***@***.***>; Comment ***@***.***>
Subject: Re: [AvaloniaUI/Avalonia] Video Player (#2571)
I figured if I didn't knock it out now it wouldn't happen anytime soon :P.
https://github.com/shawnallen85/Homer
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#2571 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AB7O7J3FEC7ST3B3FOAL53LTEIG7DANCNFSM4HPSWYWQ>.
|
Beta Was this translation helpful? Give feedback.
-
@simonmurrell Any luck? |
Beta Was this translation helpful? Give feedback.
-
I success。 https://github.com/hudec117/Mpv.NET-lib-/blob/master/src/Mpv.NET.WPFExample/MainWindow.xaml.cs My Code: *.csproj add line
/// <summary>
/// Avalonia VideoView for Windows, Linux and Mac.
/// </summary>
public class VideoView : NativeControlHost
{
private MpvPlayer player;
IPlatformHandle CreateWin32(IPlatformHandle parent)
{
//var control = base.CreateNativeControlCore(parent);
player = new MpvPlayer(parent.Handle, "win-x64/mpv-1.dll")
{
Loop = true,
Volume = 100
};
player.Load("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4");
player.Resume();
return parent;// new PlatformHandle(control.Handle, "HWND");
}
void DestroyWin32(IPlatformHandle handle)
{
player.Dispose();
base.DestroyNativeControlCore(handle);
}
protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle parent)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return CreateWin32(parent);
return base.CreateNativeControlCore(parent);
}
protected override void DestroyNativeControlCore(IPlatformHandle control)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
DestroyWin32(control);
base.DestroyNativeControlCore(control);
}
} xaml
|
Beta Was this translation helpful? Give feedback.
-
Do any of you have a simple VLC demo? I want to use it on raspberry pie, otherwise I can only use pyqt5 it, but I'm familiar with C# |
Beta Was this translation helpful? Give feedback.
-
@shawnallen85 There is currently no way to draw something on top of the mediaplayer (because it has no content property) but for LibVLCSharp's WPF implementation it is. Any chance this can be done for Avalonia as well? |
Beta Was this translation helpful? Give feedback.
-
OMG this would be a game changer for those of us doing video on raspberry pis! I'll give this a try asap...that looks amazing! And from what I'm gathering, the video is playing without stuttering?! |
Beta Was this translation helpful? Give feedback.
-
The video is playing per-fec-tly! And my Raspberry is a pi3 model b, so just 1 GB of RAM. But it works like a charme. DietPi is lighter than whatever else Raspberry OS, but not less complete. Use the 32bits or you'll go against other issues. Be sure to install MATE or Xfce, I didn't test yet with the other X options. Be prepared to swallow a couple of shirts before to have it installed in a clean way. I had to flash it 3 times (on the SD). At start, it uses the old text installation (it remembers the old RedHat way to install Linux) and it seems not so obvious. After some attempts (you have to manually configure the network too) you will thanks this kind of approach, as it's very powerful. Remember to use "root" (default password is "dietpi") to install what you need (libx11-dev, libvlc-dev and vlc). Ther's no X pre-installed, so you have to choose which X you want and install it (MATE). Once X is installed, if you have the default (text) login start MATE with normal "startx" command. Now copy your published (full) project somewhere (I put mine in root/Desktop), then add needed libraries above. I don't know if they are the ONLY libs needed, they were for my test project. You should set exec rights to your project files (I used chmod 777 for all) and start your app as root (or using sudo). Everything should work. |
Beta Was this translation helpful? Give feedback.
-
I have just created a pull request on Videolan/LibVLCSharp to include my solution in the distro. |
Beta Was this translation helpful? Give feedback.
-
For anyone is interested: A sample to apply in the real world the changes I did in LibVLCSharp.Avalonia I created YAMP2 repository (Yet-Another-Media-Player v2) here, which fully uses my new LibVLCSharp.Avalonia.Unofficial lib. To make tests, build it by yourselves and run. Enjoy. |
Beta Was this translation helpful? Give feedback.
-
The new release of the Unofficial Avalonia LibVLCSharp, allows to display multiple draggable controls over the scene of a video played with LibVLCSharp in an Avalonia app. For anyone is interested. output.mp4 |
Beta Was this translation helpful? Give feedback.
-
All the links updated (latest libs and samples versions)External LinksVLC video player inside an Avalonia Window/UserControl embedding single static customizable control (e.g.player buttons) VLC video player inside an Avalonia Window/UserControl embedding multiple draggable customizable controls (e.g.player buttons, images,...) LibVLCSharp.Avalonia.Unofficial Samples LibVLCSharp.Avalonia.Unofficial.UCanvas sample YAMP 2 - Open source video player sample using LibVLCSharp.Avalonia.Unofficial library |
Beta Was this translation helpful? Give feedback.
-
The overlapped window which hosts the content will be disappeared if it lost focus on macOS 12.6.3. I changed some code (add a TextBox) in MainWindow.axaml to produce this problem:
the overlapped content will disappear if your click on the TextBox. Maybe someone has solution. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Anyone tried this on a DRM framebuffer based configuration? |
Beta Was this translation helpful? Give feedback.
-
I'm going to move this issue into discussions as there is nothing to do on Avalonia code side |
Beta Was this translation helpful? Give feedback.
-
VLC does not provide the best video quality. MPV is a more powerful player. I have the MediaPlayerUI project that allows embedding any audio/video players with a standard UI, however, the MPV implementation hasn't been done yet. Someone did make some progress in implementing MPV player in Avalonia with OpenGL integration but still has some issues. |
Beta Was this translation helpful? Give feedback.
-
LibMpv.Client - a complete libmpv API wrapper and some examples of implementing Avalonia controls for displaying video (using OpenGL and Software rendering). Works on Linux and Windows (maybe MacOS) |
Beta Was this translation helpful? Give feedback.
-
We've considered creating a video player as a "pro control"; we'd provide commercial support and charge a nominal fee to license it. Is this something folks would be interested in? |
Beta Was this translation helpful? Give feedback.
-
If we put everything in the core library, there is nothing to sell; it'd all be FOSS, so I don't know what you'd be selling your colleagues. Users != Revenue. To be clear, we're not working on video players, 3D or anything else you mentioned. We're focused on XPF and v11 right now. |
Beta Was this translation helpful? Give feedback.
-
LibMpv.Client - video control (a little more progress) |
Beta Was this translation helpful? Give feedback.
-
I need video playback within Avalonia that is effective for embedded videos and streaming videos and can have other visual elements (like text or UI graphics) over top. It must work in Windows/iOS/Android. Does anyone know if this is currently possible? Or is this not currently possible? Perhaps via: LibVLCSharp as per: https://stackoverflow.com/questions/75493300/avalonia-libvlcsharp-support-for-ios-android-and-wasm And: https://github.com/radiolondra/libvlcsharp/tree/3.x/src/LibVLCSharp.Avalonia.Unofficial To get the overlay functions working? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi, is there any way to play the video through Avalonia?
I found a project, but it works only on Windows, i would like cross-platform.
Beta Was this translation helpful? Give feedback.
All reactions