MediaPlayer.Native.Abstractions
0.1.0-alpha.1
dotnet add package MediaPlayer.Native.Abstractions --version 0.1.0-alpha.1
NuGet\Install-Package MediaPlayer.Native.Abstractions -Version 0.1.0-alpha.1
<PackageReference Include="MediaPlayer.Native.Abstractions" Version="0.1.0-alpha.1" />
<PackageVersion Include="MediaPlayer.Native.Abstractions" Version="0.1.0-alpha.1" />
<PackageReference Include="MediaPlayer.Native.Abstractions" />
paket add MediaPlayer.Native.Abstractions --version 0.1.0-alpha.1
#r "nuget: MediaPlayer.Native.Abstractions, 0.1.0-alpha.1"
#:package MediaPlayer.Native.Abstractions@0.1.0-alpha.1
#addin nuget:?package=MediaPlayer.Native.Abstractions&version=0.1.0-alpha.1&prerelease
#tool nuget:?package=MediaPlayer.Native.Abstractions&version=0.1.0-alpha.1&prerelease
MediaPlayer
GPU-accelerated media playback for Avalonia with no airspace gap, native platform backends, FFmpeg and LibVLC fallback paths, and a reusable QuickTime-inspired application layer.
Documentation site: wieslawsoltes.github.io/MediaPlayer
NuGet Packages
Primary Packages
| Package | Purpose |
|---|---|
MediaPlayer.Controls |
Shippable Avalonia media playback control library with GPU compositing, backend selection, transport control APIs, and reusable media workflow services. |
MediaPlayer.Native.Abstractions |
Contracts, diagnostics models, backend/provider enums, and capability models shared across native playback and workflow implementations. |
MediaPlayer.Native.Interop |
Managed interop provider catalog and runtime selection helpers for native playback/workflow integrations. |
Features
- No-airspace video composition inside Avalonia using GPU rendering paths instead of
NativeControlHost. - QuickTime-style playback shell patterns: floating HUD controls, auto-hide behavior, native macOS menu integration, and window chrome integration.
- Native backend selection for macOS and Windows, with FFmpeg and LibVLC fallback modes kept available as user-selectable options.
- Direct GPU texture upload mode with a compatibility copy-upload fallback, both exposed through the demo menu.
- Audio track, subtitle track, input/output device, and route management APIs on the reusable control surface.
- Reusable media workflow layer for trim, split, combine, export, transform, recording, and audio/video removal operations.
- Cross-platform demo app showing how to wire playback UX, workflow dialogs, diagnostics, and backend controls together.
Architecture
| Layer | Responsibility |
|---|---|
MediaPlayer.Controls |
Public Avalonia control layer, GPU renderer integration, backend orchestration, audio/device APIs, workflow services, and reusable playback shell components. |
MediaPlayer.Native.Abstractions |
Backend-neutral contracts and capability models used by the control layer and native/interop implementations. |
MediaPlayer.Native.Interop |
Interop provider catalogs and runtime helpers for selecting native-backed playback and workflow providers. |
MediaPlayer.Demo |
Reference application showing QuickTime-style UX, native menu wiring, diagnostics, workflow commands, and backend selection. |
Usage
1. Install the main control package
dotnet add package MediaPlayer.Controls
If you want direct access to backend/provider contracts in your own composition layer:
dotnet add package MediaPlayer.Native.Abstractions
dotnet add package MediaPlayer.Native.Interop
2. Use GpuMediaPlayer in XAML
<Window
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Sample.ViewModels"
xmlns:media="clr-namespace:MediaPlayer.Controls;assembly=MediaPlayer.Controls"
x:Class="Sample.MainWindow"
x:DataType="vm:MainWindowViewModel">
<media:GpuMediaPlayer
Source="{Binding CurrentSource}"
AutoPlay="True"
LayoutMode="Uniform"
Volume="100"
PreferDirectGpuTextureUpload="True" />
</Window>
3. Drive playback from your ViewModel or service layer
using System;
using MediaPlayer.Controls;
GpuMediaPlayer player = new();
player.Source = new Uri("file:///path/to/media.mp4");
player.Play();
player.Seek(TimeSpan.FromSeconds(30));
4. Register reusable workflow services
using MediaPlayer.Controls.Workflows;
using Microsoft.Extensions.DependencyInjection;
ServiceCollection services = new();
services.AddMediaPlayerWorkflows(options =>
{
options.PreferNativePlatformServices = true;
});
The workflow service layer exposes trim, split, combine, export, transform, recording, and media stream removal operations through IMediaWorkflowService.
Backend Model
GpuMediaPlayer selects the strongest available playback backend for the current platform and configuration while preserving a single Avalonia control surface:
- macOS: native AVFoundation-based helper paths and interop-driven providers.
- Windows: native Media Foundation-based helper paths and interop-driven providers.
- Cross-platform fallback: FFmpeg and LibVLC-backed decoding modes remain available for compatibility and diagnostics.
- Rendering: Avalonia-hosted GPU composition with direct texture upload enabled by default, with a compatibility path available when drivers require it.
This design keeps video inside the Avalonia compositor and avoids the classic airspace problems that appear when embedding separate native child windows.
Demo
The demo app shows the intended production UX patterns:
- QuickTime-style floating transport HUD and centered playback controls.
- Native macOS application menus and platform window integration.
- Backend diagnostics, provider selection, texture upload mode switching, and audio route inspection.
- Reusable workflow entry points for export, trim, transform, record, and related media operations.
Run the demo:
dotnet run --project src/MediaPlayer.Demo/MediaPlayer.Demo.csproj
Building
Prerequisites
- .NET SDK 9.0 or later
- Platform-native media dependencies required by the backend modes you enable at runtime
Build, test, and pack
dotnet build MediaPlayer.sln -warnaserror
dotnet test MediaPlayer.sln
dotnet pack src/MediaPlayer.Controls/MediaPlayer.Controls.csproj -c Release
dotnet pack src/MediaPlayer.Native.Abstractions/MediaPlayer.Native.Abstractions.csproj -c Release
dotnet pack src/MediaPlayer.Native.Interop/MediaPlayer.Native.Interop.csproj -c Release
CI and Release
The repository includes GitHub Actions workflows modeled on the RoyalTerminal repository:
ci.yml: multi-platform restore, build, test, and preview package generation.release.yml: tag-driven validation, package creation, optional NuGet publication, and GitHub release creation.
Release tags use the v* format, for example v0.1.0.
Project Structure
src/
MediaPlayer.Controls/
MediaPlayer.Native.Abstractions/
MediaPlayer.Native.Interop/
MediaPlayer.Demo/
MediaPlayer.Controls.Tests/
MediaPlayer.Demo.Tests/
plan/
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MediaPlayer.Native.Abstractions:
| Package | Downloads |
|---|---|
|
MediaPlayer.Controls
GPU-accelerated Avalonia media playback controls with no-airspace rendering, native backend selection, and reusable QuickTime-style playback workflows. |
|
|
MediaPlayer.Native.Interop
Managed interop provider catalogs and runtime helpers for MediaPlayer native playback and media workflow backends. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-alpha.1 | 52 | 3/10/2026 |