Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Avalonia.Accelerate.Samples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAuthenticationBrokerSamp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebAuthenticationBrokerSample", "WebAuthenticationBrokerSample\WebAuthenticationBrokerSample\WebAuthenticationBrokerSample.csproj", "{7CFB22DE-B8D6-799B-743C-8AF89E97E88F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Media.Demo.LinuxFB", "MediaPlayerSample\Avalonia.Media.Demo.LinuxFB\Avalonia.Media.Demo.LinuxFB.csproj", "{649359EA-BB57-4FE2-968D-EE8EDDAF7350}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -90,6 +92,10 @@ Global
{7CFB22DE-B8D6-799B-743C-8AF89E97E88F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CFB22DE-B8D6-799B-743C-8AF89E97E88F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CFB22DE-B8D6-799B-743C-8AF89E97E88F}.Release|Any CPU.Build.0 = Release|Any CPU
{649359EA-BB57-4FE2-968D-EE8EDDAF7350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{649359EA-BB57-4FE2-968D-EE8EDDAF7350}.Debug|Any CPU.Build.0 = Debug|Any CPU
{649359EA-BB57-4FE2-968D-EE8EDDAF7350}.Release|Any CPU.ActiveCfg = Release|Any CPU
{649359EA-BB57-4FE2-968D-EE8EDDAF7350}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -106,5 +112,6 @@ Global
{A34DCED3-E26F-9DF0-163C-720E3F795031} = {F1654980-CA9F-ACCF-E2A2-9AEE1C29565B}
{C4E89863-6CA3-D3A6-C504-58989B5E7526} = {F1654980-CA9F-ACCF-E2A2-9AEE1C29565B}
{7CFB22DE-B8D6-799B-743C-8AF89E97E88F} = {F1654980-CA9F-ACCF-E2A2-9AEE1C29565B}
{649359EA-BB57-4FE2-968D-EE8EDDAF7350} = {D42C37AA-53F4-D48D-0B84-299B5E68CB34}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>

<TargetFramework>net8.0</TargetFramework>
<RuntimeIdentifier>linux-arm64</RuntimeIdentifier>

<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<RootNamespace>Avalonia.Media.Demo.LinuxFB</RootNamespace>

<!-- This is to enable the linux fb only behavior on the ViewModels -->
<DefineConstants>$(DefineConstants);DEMO_FB</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="$(AvaloniaVersion)" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Avalonia.Media.Demo\Avalonia.Media.Demo.csproj" />
</ItemGroup>

</Project>
23 changes: 23 additions & 0 deletions MediaPlayerSample/Avalonia.Media.Demo.LinuxFB/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using Avalonia;
using Avalonia.LinuxFramebuffer;

namespace Avalonia.Media.Demo.LinuxFB;

sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
// DRI paths can change. Try all the devices under /dev/dri/* if the default doesn't work.
.StartLinuxDrm(args: args, card: "/dev/dri/card1", scaling: 1.0);

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}
13 changes: 11 additions & 2 deletions MediaPlayerSample/Avalonia.Media.Demo/Views/MainView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)

MainVm.DropCommand = new RelayCommand<DragEventArgs>(HandleDrop);

#if DEMO_FB
// TODO: For testing purposes only, since Avalonia DRM backend doesn't support direct keyboard input just yet.
// So we "manually" set the media source for immediate playback.
Task.Factory.StartNew(async () =>
{
await Task.Delay(1000);
Dispatcher.UIThread.InvokeAsync(() => { MainVm.SetSource(new UriSource("/home/user/video.mp4")); });
});
#endif

base.OnAttachedToVisualTree(e);
}

Expand All @@ -41,7 +51,6 @@ private void HandleDrop(DragEventArgs? e)
if (files is null || MainVm is null) return;

MainVm.SetSource(new UriSource(files.Path));

}

private async void Load_Click(object? _, RoutedEventArgs __)
Expand Down Expand Up @@ -84,7 +93,7 @@ private async void Load_Uri_Click(object? sender, Avalonia.Interactivity.RoutedE

var result = await dialog.ShowAsync();

if(result == ContentDialogResult.Primary)
if (result == ContentDialogResult.Primary)
{
if (string.IsNullOrWhiteSpace(input.Text) || MainVm == null) return;

Expand Down