we don't need that anymore
This commit is contained in:
parent
08e5821df4
commit
f9b9271539
4 changed files with 0 additions and 164 deletions
|
@ -1,25 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Title>LibVLCSharp.Avalonia</Title>
|
||||
<Summary>Avalonia integration for LibVLCSharp</Summary>
|
||||
<Description>LibVLCSharp is a cross-platform audio and video API for .NET platforms based on VideoLAN's LibVLC Library. It provides a comprehensive multimedia API that can be used across mobile, server and desktop to render video and output audio. Mono, .NET Framework and .NET Core runtimes are supported.
|
||||
|
||||
LibVLCSharp.Avalonia contains the integration with Avalonia.
|
||||
This package contains the views that allows to display a video played with LibVLCSharp
|
||||
in a Avalonia app.
|
||||
|
||||
This package depends on LibVLCSharp as well as Avalonia.
|
||||
|
||||
LibVLC needs to be installed separately, see VideoLAN.LibVLC.* packages.
|
||||
</Description>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>LibVLCSharp.Avalonia</RootNamespace>
|
||||
<PackageId>LibVLCSharp.Avalonia</PackageId>
|
||||
<PackageTags>$(PackageTags);avalonia</PackageTags>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.0.4" />
|
||||
<PackageReference Include="LibVLCSharp" Version="3.7.0" />
|
||||
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,18 +0,0 @@
|
|||
# LibVLCSharp.Avalonia
|
||||
|
||||
The official [Avalonia](https://github.com/AvaloniaUI/Avalonia) views for [LibVLCSharp](../LibVLCSharp/README.md).
|
||||
|
||||
This package contains the views that allows to display a video played with [LibVLCSharp](../LibVLCSharp/README.md)
|
||||
in an Avalonia app.
|
||||
|
||||
This package depends on [LibVLCSharp](../LibVLCSharp/README.md) as well as [Avalonia](https://github.com/AvaloniaUI/Avalonia).
|
||||
|
||||
Supported frameworks:
|
||||
|
||||
- netstandard2.0
|
||||
|
||||
Supported platforms:
|
||||
|
||||
- Windows
|
||||
- MacOS
|
||||
- Linux
|
|
@ -1,115 +0,0 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Platform;
|
||||
using LibVLCSharp.Shared;
|
||||
|
||||
namespace LibVLCSharp.Avalonia
|
||||
{
|
||||
/// <summary>
|
||||
/// Avalonia VideoView for Windows, Linux and Mac.
|
||||
/// </summary>
|
||||
public class VideoView : NativeControlHost
|
||||
{
|
||||
private IPlatformHandle? _platformHandle = null;
|
||||
private MediaPlayer? _mediaPlayer = null;
|
||||
|
||||
/// <summary>
|
||||
/// MediaPlayer Data Bound property
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Defines the <see cref="MediaPlayer"/> property.
|
||||
/// </summary>
|
||||
public static readonly DirectProperty<VideoView, MediaPlayer?> MediaPlayerProperty =
|
||||
AvaloniaProperty.RegisterDirect<VideoView, MediaPlayer?>(
|
||||
nameof(MediaPlayer),
|
||||
o => o.MediaPlayer,
|
||||
(o, v) => o.MediaPlayer = v,
|
||||
defaultBindingMode: BindingMode.TwoWay);
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MediaPlayer that will be displayed.
|
||||
/// </summary>
|
||||
public MediaPlayer? MediaPlayer
|
||||
{
|
||||
get { return _mediaPlayer; }
|
||||
set
|
||||
{
|
||||
if (ReferenceEquals(_mediaPlayer, value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Detach();
|
||||
_mediaPlayer = value;
|
||||
Attach();
|
||||
}
|
||||
}
|
||||
|
||||
private void Attach()
|
||||
{
|
||||
if(_mediaPlayer == null || _platformHandle == null || !IsInitialized)
|
||||
return;
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
_mediaPlayer.Hwnd = _platformHandle.Handle;
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
_mediaPlayer.XWindow = (uint)_platformHandle.Handle;
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
_mediaPlayer.NsObject = _platformHandle.Handle;
|
||||
}
|
||||
}
|
||||
|
||||
private void Detach()
|
||||
{
|
||||
if (_mediaPlayer == null)
|
||||
return;
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
_mediaPlayer.Hwnd = IntPtr.Zero;
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
_mediaPlayer.XWindow = 0;
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
_mediaPlayer.NsObject = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle parent)
|
||||
{
|
||||
_platformHandle = base.CreateNativeControlCore(parent);
|
||||
|
||||
if (_mediaPlayer == null)
|
||||
return _platformHandle;
|
||||
|
||||
Attach();
|
||||
|
||||
return _platformHandle;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void DestroyNativeControlCore(IPlatformHandle control)
|
||||
{
|
||||
Detach();
|
||||
|
||||
base.DestroyNativeControlCore(control);
|
||||
|
||||
if (_platformHandle != null)
|
||||
{
|
||||
_platformHandle = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="AvaloniaCI" value="https://www.myget.org/F/avalonia-ci/api/v2" />
|
||||
</packageSources>
|
||||
</configuration>
|
Loading…
Reference in a new issue