This directory contains a C# example application that demonstrates how to use the PanelPlayer library from .NET applications.
- .NET 9.0 or later
- libpanelplayer.so compiled and available
- Root privileges (required for raw ethernet access)
First, you need to build the shared library from the main project directory:
cd /path/to/PanelPlayer
make libraryThis will create build/libpanelplayer.so.
The C# project is configured to automatically copy the library to the output directory during build, but you can also copy it manually:
cp ../../build/libpanelplayer.so ./bin/Debug/net9.0/dotnet buildThe application must be run as root due to raw ethernet socket requirements:
sudo dotnet run [webp-file]Play a WebP file:
sudo dotnet run animation.webpRun without arguments to see the blue frame demonstration:
sudo dotnet runMake a self contained app
dotnet publish -r linux-arm64 --self-contained true -c ReleaseThe example demonstrates:
- Basic initialization - Setting up the panel with network interface and dimensions
- WebP file playback - Playing WebP files (if provided as argument)
- Manual frame display - Sending raw BGR pixel data to create a blue frame
- Proper cleanup - Using
usingstatement for automatic resource disposal
The example is configured for:
- Network interface:
end0(eth0 is more common) - Panel dimensions: 192x64 pixels
- Brightness: 255 (maximum)
Modify these values in PanelPlayerExample.cs to match your setup.
This example has been tested on:
- Hardware: Orange Pi Zero 3
- OS: Debian Bookworm
- Runtime: .NET 9.0.302
Make sure you're running with sudo - raw ethernet access requires root privileges.
Ensure libpanelplayer.so is in the output directory or in your system's library path.
Verify that the network interface name (end0) matches your system's ethernet interface.
The C# wrapper provides these main methods:
PanelPlayer(interface, width, height, brightness)- Initialize the panelPlayWebPFile(path)- Play animated WebP filePlayFrameBGR(data, width, height)- Display raw BGR frame dataSetBrightness(red, green, blue)- Adjust color balanceLoadExtension(path)- Load processing extensionsSetMix(percentage)- Control frame blendingSetFrameRate(fps)- Override animation timing
For detailed API documentation, see the native library header file source/panelplayer_api.h.