VOOZH about

URL: https://www.nuget.org/packages/Iciclecreek.Avalonia.Controls.Media/

⇱ NuGet Gallery | Iciclecreek.Avalonia.Controls.Media 1.0.5




👁 Image
Iciclecreek.Avalonia.Controls.Media 1.0.5

dotnet add package Iciclecreek.Avalonia.Controls.Media --version 1.0.5
 
 
NuGet\Install-Package Iciclecreek.Avalonia.Controls.Media -Version 1.0.5
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Iciclecreek.Avalonia.Controls.Media" Version="1.0.5" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Iciclecreek.Avalonia.Controls.Media" Version="1.0.5" />
 
Directory.Packages.props
<PackageReference Include="Iciclecreek.Avalonia.Controls.Media" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Iciclecreek.Avalonia.Controls.Media --version 1.0.5
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Iciclecreek.Avalonia.Controls.Media, 1.0.5"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Iciclecreek.Avalonia.Controls.Media@1.0.5
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Iciclecreek.Avalonia.Controls.Media&version=1.0.5
 
Install as a Cake Addin
#tool nuget:?package=Iciclecreek.Avalonia.Controls.Media&version=1.0.5
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 Icon

Iciclecreek.Avalonia.Controls.Media

This control library adds support for LibVLC MediaPlayer for Avalonia Desktop applications.

  • MediaPlayerViewModel - A view model class which wraps MediaPlayer so that it's easy to bind UI controls to Commands and state.
  • VideoView element - a element which playing videos and exposes MediaPlayerViewModel for controlling the video playback.
  • MediaPlayerControls element - a off-the-shelf implementation of a UI to control playback of the video
    • Play/Stop/Pause
    • Mute
    • Rate
    • etc.

Installation

  • Install the control nuget package into to your shared Avalonia project
    • Iciclcreek.Avalonia.Controls.Media
  • Install the video playback nuget packages into your Desktop project
    • VideoLan.LibVLC.Mac
    • VideoLAN.LibVLC.Windows

Add a namespace for the library to your .axaml files:

xmlns:media="using:Iciclecreek.Avalonia.Controls.Media"

Samples

Overlay Controls Sample

<media:VideoView Source={Binding Url}>
 <media:MediaPlayerControls/>
</media:VideoView>

👁 MediaPlayerControls-overlay.gif

External Controls Sample

In this case a MediaPlayerControls element is external to the video player window (aka, not overlayed), but data bound to the MediaPlayerViewModel for the VideoView.

<media:VideoView Name="Player" Source={Binding Url} />

<media:MediaPlayerControls DataContext={Binding #Player.MediaPlayerViewModel}"/>

Custom binding sample

Here is an example which shows how you can create your own command bindings using the MediaPlayerViewModel

<media:VideoView Name="Player" Source={Binding Url} >
 <StackPanel Orientation="Horizontal" Background="Lavender">
 <Button Command="{Binding Play}">Play</Button>
 <Slider Value="{Binding Time}" Maximum="{Binding Length}" Width="200"/>
 <Button Command="{Binding Stop}">Stop</Button>
 </StackPanel>
</media:VideoView>

MediaPlayerViewModel class

The main class driving this is a view model which is set up to support Commands and Property notification to make it easy to data bind UI to the state of the MediaPlayer in the VideoView control. All of the Commands implement CanXXX() so that they are enabled/disabled automatically when bound as a Command.

Command Parameters Description
Play - Play video
Stop - Stop Video - Play starts video over
Pause - Pause video - Play resumes
Mute - Mutes video
Unmute - Unmutes video
TogglePlayPause - Toggles Play/Pause for video
ToggleMute - Toggles Mute state
SetRate float Changes rate of playback (for example "1.75" ⇒ 1.75x faster than noraml)
Download Open video external

The MediaPlayerViewModel also exposes the state of the MediaPlayer so you can bind your UI to the properties and it will update in real time to changes (aka appropriate property notification).

Property Type Description
IsMuted bool Mute state
IsCloseCaptioned bool Closed Caption state
Volume int volume for the video playback
IsSeekable bool Seekable state
Time int Current playback position in ms. Changing this changes playback position, so Slider control bound to this controls playback position of the video.
Length int Length of the video in ms.
Rate float Playback speed.

VideoView element

This library contains a fork of the unofficial VideoView with overlay support. The changes are

  • Adds a MediaPlayerViewModel property
  • Sets DataContext for child overlay content to MediaPlayerViewModel
  • Fixes overlay bugs on linux
  • Fixes positioning bugs for overlay
  • Cleaned up (removed static this pointers)

MediaPlayerControls Element

This is a prebuilt element which looks like this:

👁 image-20231114101518141

Supported Platforms

  • Avalonia.Desktop
    • Windows
    • Linux
    • MacOS

It has not been tested at all with Android/iOS

Product Versions Compatible and additional computed target framework versions.
.NET net6.0 net6.0 is compatible.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 was computed.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Iciclecreek.Avalonia.Controls.Media:

Package Downloads
Iciclecreek.AdaptiveCards.Rendering.Avalonia

AdaptiveCard renderer for AvaloniauUI

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.5 1,176 12/6/2023
1.0.4 263 11/16/2023
1.0.3 235 11/15/2023
1.0.2 228 11/15/2023
1.0.1 227 11/15/2023
1.0.0 232 11/14/2023