diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 66dac3a96..c1751e6d8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -129,7 +129,7 @@ from the main (upstream) repository:
### Developer Environment
-The latest .NET 6 SDK is required.
+The latest .NET 8 SDK is required.
- Visual Studio 2022 (with latest patches/updates), with the following workloads/components
- .NET desktop development workload
diff --git a/NEWS b/NEWS
index fec8cd242..61852ee76 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+LibVLCSharp version 3.9.3
+=========================
+* Dependency: Update System.Memory
+* Build and docs improvements
+* Update Avalonia sample by @jpmikkers
+* Core: dispose native mediaplayer instance before freeing gcHandle
+* WPF: Make VideoView support zero window height
+
+LibVLCSharp version 3.9.2
+=========================
+* Avalonia: Fix memory leaks.
+* MAUI: Add WinUI support.
+* MAUI: Add shell net8.0 target to support adding package to non-shared project solution structures by @jasells
+
LibVLCSharp version 3.9.1
=========================
* Add macOS and tvOS NET 8 targets
diff --git a/samples/LibVLCSharp.Avalonia.Sample/LibVLCSharp.Avalonia.Sample.csproj b/samples/LibVLCSharp.Avalonia.Sample/LibVLCSharp.Avalonia.Sample.csproj
index 2f28600a3..76f3cb807 100755
--- a/samples/LibVLCSharp.Avalonia.Sample/LibVLCSharp.Avalonia.Sample.csproj
+++ b/samples/LibVLCSharp.Avalonia.Sample/LibVLCSharp.Avalonia.Sample.csproj
@@ -1,8 +1,7 @@
WinExe
- net6.0
- netcoreapp3.1
+ net8.0
8.0
app.manifest
@@ -16,12 +15,12 @@
-
-
-
+
+
+
-
+
diff --git a/samples/LibVLCSharp.MAUI.Sample/AppShell.xaml b/samples/LibVLCSharp.MAUI.Sample/AppShell.xaml
index 29de45141..ab6f069ae 100644
--- a/samples/LibVLCSharp.MAUI.Sample/AppShell.xaml
+++ b/samples/LibVLCSharp.MAUI.Sample/AppShell.xaml
@@ -5,10 +5,5 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:LibVLCSharp.MAUI.Sample"
Shell.FlyoutBehavior="Disabled">
-
-
-
+
diff --git a/samples/LibVLCSharp.MAUI.Sample/LibVLCSharp.MAUI.Sample.csproj b/samples/LibVLCSharp.MAUI.Sample/LibVLCSharp.MAUI.Sample.csproj
index 77b52e0a5..831be0b85 100644
--- a/samples/LibVLCSharp.MAUI.Sample/LibVLCSharp.MAUI.Sample.csproj
+++ b/samples/LibVLCSharp.MAUI.Sample/LibVLCSharp.MAUI.Sample.csproj
@@ -2,17 +2,17 @@
net8.0-android;net8.0-ios
+ $(TargetFrameworks);net8.0-windows10.0.19041.0
Exe
LibVLCSharp.MAUI.Sample
true
true
enable
-
- LibVLCSharp.MAUI.Sample
-
+ LibVLCSharp.MAUI.SampleX
+ None
- com.companyname.libvlcsharp.maui.sample
+ com.companyname.libvlcsharp.maui.samplex
49861f9e-48d3-45c0-b6a8-f591ad6d2010
@@ -24,7 +24,7 @@
21.0
10.0.17763.0
10.0.17763.0
- 6.5
+ en
@@ -64,4 +64,7 @@
+
+
+
diff --git a/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml b/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml
index 4d9aaf385..a7c668182 100644
--- a/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml
+++ b/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml
@@ -8,6 +8,6 @@
-
+
diff --git a/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml.cs b/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml.cs
index 5ac49c8a6..65a14b39d 100644
--- a/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml.cs
+++ b/samples/LibVLCSharp.MAUI.Sample/MainPage.xaml.cs
@@ -12,7 +12,9 @@ public MainPage()
protected override void OnAppearing()
{
base.OnAppearing();
+#if !WINDOWS
((MainViewModel)BindingContext).OnAppearing();
+#endif
}
protected override void OnDisappearing()
@@ -25,5 +27,18 @@ private void VideoView_MediaPlayerChanged(object sender, MediaPlayerChangedEvent
{
((MainViewModel)BindingContext).OnVideoViewInitialized();
}
+
+ private void VideoView_HandlerChanged(object sender, EventArgs e)
+ {
+#if WINDOWS
+ var windowsView = ((LibVLCSharp.Platforms.Windows.VideoView)VideoView.Handler.PlatformView);
+
+ windowsView.Initialized += (s, e) =>
+ {
+ ((MainViewModel)BindingContext).Initialize(e.SwapChainOptions);
+ ((MainViewModel)BindingContext).OnAppearing();
+ };
+#endif
+ }
}
}
\ No newline at end of file
diff --git a/samples/LibVLCSharp.MAUI.Sample/MainViewModel.cs b/samples/LibVLCSharp.MAUI.Sample/MainViewModel.cs
index 6203cb362..934ab60b3 100644
--- a/samples/LibVLCSharp.MAUI.Sample/MainViewModel.cs
+++ b/samples/LibVLCSharp.MAUI.Sample/MainViewModel.cs
@@ -9,7 +9,9 @@ public class MainViewModel : INotifyPropertyChanged
public MainViewModel()
{
+#if !WINDOWS
Initialize();
+#endif
}
private LibVLC LibVLC { get; set; }
@@ -33,9 +35,9 @@ private void Set(string propertyName, ref T field, T value)
}
}
- private void Initialize()
+ internal void Initialize(string[] swapchainOptions = null)
{
- LibVLC = new LibVLC(enableDebugLogs: true);
+ LibVLC = new LibVLC(enableDebugLogs: true, swapchainOptions);
using var media = new Media(LibVLC, new Uri("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"));
MediaPlayer = new Shared.MediaPlayer(LibVLC)
diff --git a/samples/LibVLCSharp.MAUI.Sample/Properties/launchSettings.json b/samples/LibVLCSharp.MAUI.Sample/Properties/launchSettings.json
index edf8aadcc..cebfae9cb 100644
--- a/samples/LibVLCSharp.MAUI.Sample/Properties/launchSettings.json
+++ b/samples/LibVLCSharp.MAUI.Sample/Properties/launchSettings.json
@@ -1,8 +1,8 @@
{
"profiles": {
"Windows Machine": {
- "commandName": "MsixPackage",
- "nativeDebugging": false
+ "commandName": "Project",
+ "nativeDebugging": true
}
}
}
\ No newline at end of file
diff --git a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/LibVLCSharp.MAUI.Sample.MediaElement.csproj b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/LibVLCSharp.MAUI.Sample.MediaElement.csproj
index b4b416ddf..e2524917d 100644
--- a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/LibVLCSharp.MAUI.Sample.MediaElement.csproj
+++ b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/LibVLCSharp.MAUI.Sample.MediaElement.csproj
@@ -1,14 +1,14 @@
net8.0-android;net8.0-ios
-
-
+ $(TargetFrameworks);net8.0-windows10.0.19041
Exe
LibVLCSharp.MAUI.Sample.MediaElement
true
true
enable
latest
+ None
LibVLCSharp.MAUI.Sample.MediaElement
@@ -21,9 +21,7 @@
13.1
21.0
10.0.17763.0
- 6.5
True
- 10.0.19041.0
@@ -49,6 +47,9 @@
+
+
+
diff --git a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml
index 8477da926..176cc56af 100644
--- a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml
+++ b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml
@@ -4,17 +4,17 @@
xmlns:local="clr-namespace:LibVLCSharp.MAUI.Sample.MediaElement"
xmlns:vlc="clr-namespace:LibVLCSharp.MAUI;assembly=LibVLCSharp.MAUI"
x:Class="LibVLCSharp.MAUI.Sample.MediaElement.MainPage"
- Appearing="OnAppearing"
- Disappearing="OnDisappearing">
+ Appearing="ContentPage_Appearing"
+ Disappearing="ContentPage_Disappearing">
-
+
+ IsAspectRatioButtonVisible="True" IsSeekButtonVisible="True" IsCastButtonVisible="True"/>
diff --git a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml.cs b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml.cs
index bccf31a82..d82c128c8 100644
--- a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml.cs
+++ b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml.cs
@@ -13,17 +13,36 @@ public partial class MainPage : ContentPage
public MainPage()
{
InitializeComponent();
+ MediaPlayerElement.PlaybackControls.VideoView.HandlerChanged += VideoView_HandlerChanged;
}
- void OnAppearing(object sender, System.EventArgs e)
+ private void VideoView_HandlerChanged(object sender, EventArgs e)
+ {
+#if WINDOWS
+ var windowsView = ((LibVLCSharp.Platforms.Windows.VideoView)MediaPlayerElement.PlaybackControls.VideoView.Handler.PlatformView);
+
+ windowsView.Initialized += (s, e) =>
+ {
+ ((MainViewModel)BindingContext).OnAppearing(e.SwapChainOptions);
+ };
+#endif
+ }
+
+ private void ContentPage_Appearing(object sender, EventArgs e)
{
base.OnAppearing();
+#if !WINDOWS
((MainViewModel)BindingContext).OnAppearing();
+#endif
}
- void OnDisappearing(object sender, System.EventArgs e)
+ private void ContentPage_Disappearing(object sender, EventArgs e)
{
base.OnDisappearing();
+
+ // this is a hack to get the mediaplayer/libvlc objects databinding disabled before disposing of them in the viewmodel OnDisappearing function. The MediaElement control and MAUI lifecycle shutdown procedure don't play nice together, so sometimes, on destroy, media element events are being unsubscribed on an already disposed mediaplayer instance, causing a memory violation exception.
+ MediaPlayerElement.MediaPlayer = null;
+ MediaPlayerElement.LibVLC = null;
((MainViewModel)BindingContext).OnDisappearing();
}
}
diff --git a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainViewModel.cs b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainViewModel.cs
index 6d8304e67..e5334d5db 100644
--- a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainViewModel.cs
+++ b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainViewModel.cs
@@ -46,11 +46,11 @@ public LibVLCSharp.Shared.MediaPlayer MediaPlayer
///
/// Initialize LibVLC and playback when page appears
///
- public void OnAppearing()
+ public void OnAppearing(string[] swapchainOptions = null)
{
if (LibVLC == null)
{
- LibVLC = new LibVLC(enableDebugLogs: true);
+ LibVLC = new LibVLC(enableDebugLogs: true, swapchainOptions);
}
if (MediaPlayer == null)
@@ -70,11 +70,11 @@ public void OnAppearing()
///
public void OnDisappearing()
{
- MediaPlayer?.Dispose();
- MediaPlayer = null;
-
- LibVLC?.Dispose();
- LibVLC = null;
+ _mediaPlayer?.Stop();
+ _mediaPlayer?.Dispose();
+ _mediaPlayer = null;
+ _libVLC?.Dispose();
+ _libVLC = null;
}
///
diff --git a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/Properties/launchSettings.json b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/Properties/launchSettings.json
index edf8aadcc..cebfae9cb 100644
--- a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/Properties/launchSettings.json
+++ b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/Properties/launchSettings.json
@@ -1,8 +1,8 @@
{
"profiles": {
"Windows Machine": {
- "commandName": "MsixPackage",
- "nativeDebugging": false
+ "commandName": "Project",
+ "nativeDebugging": true
}
}
}
\ No newline at end of file
diff --git a/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/LibVLCSharp.Uno.WinUI.Sample.csproj b/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/LibVLCSharp.Uno.WinUI.Sample.csproj
index 8a8873d03..46207c5ff 100644
--- a/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/LibVLCSharp.Uno.WinUI.Sample.csproj
+++ b/samples/Uno/LibVLCSharp.Uno.WinUI.Sample/LibVLCSharp.Uno.WinUI.Sample.csproj
@@ -1,4 +1,4 @@
-
+
net8.0-android;
diff --git a/samples/Uno/global.json b/samples/Uno/global.json
deleted file mode 100644
index 9eb7cab0e..000000000
--- a/samples/Uno/global.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "msbuild-sdks": {
- "Uno.Sdk": "5.3.96"
- },
- "sdk": {
- "version": "8.0.300"
- }
-}
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 7c2632c8c..11d1c438e 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -44,10 +44,12 @@
https://code.videolan.org/videolan/LibVLCSharp
icon.png
https://code.videolan.org/videolan/LibVLCSharp/blob/master/NEWS
- 3.9.1
+ 3.9.3
libvlc;vlc;videolan;native;c/c++;video;audio;player;media;mediaplayer;codec;ffmpeg;xamarin;graphics;ios;android;linux;windows;macos;cross-platform
README.md
+ all
+ low
diff --git a/src/LibVLCSharp.Avalonia/VideoView.cs b/src/LibVLCSharp.Avalonia/VideoView.cs
index 4572262e3..b58beb0cb 100755
--- a/src/LibVLCSharp.Avalonia/VideoView.cs
+++ b/src/LibVLCSharp.Avalonia/VideoView.cs
@@ -21,6 +21,9 @@ public class VideoView : NativeControlHost
private IPlatformHandle? _platformHandle = null;
private MediaPlayer? _mediaPlayer = null;
private Window? _floatingContent = null;
+ IDisposable? contentChangedHandler = null;
+ IDisposable? isVisibleChangedHandler = null;
+ IDisposable? floatingContentChangedHandler = null;
///
/// MediaPlayer Data Bound property
@@ -74,15 +77,17 @@ public object? Content
public VideoView()
{
Initialized += (_, _) => { Attach(); };
- ContentProperty.Changed.AddClassHandler((s, _) => s.InitializeNativeOverlay());
- IsVisibleProperty.Changed.AddClassHandler((s, _) => s.ShowNativeOverlay(s.IsVisible));
+
+ contentChangedHandler = ContentProperty.Changed.AddClassHandler((s, _) => s.UpdateOverlayPosition());
+ isVisibleChangedHandler = IsVisibleProperty.Changed.AddClassHandler((s, _) => s.ShowNativeOverlay(s.IsVisible));
}
private void UpdateOverlayPosition()
{
if (_floatingContent == null || !IsVisible)
+ {
return;
-
+ }
bool forceSetWidth = false, forceSetHeight = false;
var topLeft = new Point();
var child = _floatingContent.Presenter?.Child;
@@ -250,21 +255,21 @@ private void InitializeNativeOverlay()
Opacity = 1.0,
DataContext = DataContext
};
- _floatingContent.Bind(ContentControl.ContentProperty, this.GetObservable(ContentProperty));
+ floatingContentChangedHandler = _floatingContent.Bind(ContentControl.ContentProperty, this.GetObservable(ContentProperty));
_floatingContent.PointerEntered += FloatingContentOnPointerEvent;
_floatingContent.PointerExited += FloatingContentOnPointerEvent;
_floatingContent.PointerPressed += FloatingContentOnPointerEvent;
_floatingContent.PointerReleased += FloatingContentOnPointerEvent;
- ContentProperty.Changed.AddClassHandler((o, _) => o.UpdateOverlayPosition());
-
- visualRoot.LayoutUpdated += (_, _) => UpdateOverlayPosition();
- visualRoot.PositionChanged += (_, _) => UpdateOverlayPosition();
+ visualRoot.LayoutUpdated += VisualRoot_UpdateOverlayPosition;
+ visualRoot.PositionChanged += VisualRoot_UpdateOverlayPosition;
}
ShowNativeOverlay(IsEffectivelyVisible);
}
+ private void VisualRoot_UpdateOverlayPosition(object sender, EventArgs e) => UpdateOverlayPosition();
+
private void FloatingContentOnPointerEvent(object? sender, PointerEventArgs e)
{
RaiseEvent(e);
@@ -284,13 +289,30 @@ private void ShowNativeOverlay(bool show)
///
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
+ var parent = this.GetVisualParent();
+ if(parent != null)
+ parent.DetachedFromVisualTree += Parent_DetachedFromVisualTree;
base.OnAttachedToVisualTree(e);
InitializeNativeOverlay();
}
+ private void Parent_DetachedFromVisualTree(object sender, VisualTreeAttachmentEventArgs e)
+ {
+ if (VisualRoot is not Window visualRoot)
+ {
+ return;
+ }
+
+ visualRoot.LayoutUpdated -= VisualRoot_UpdateOverlayPosition;
+ visualRoot.PositionChanged -= VisualRoot_UpdateOverlayPosition;
+ }
+
///
protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e)
{
+ var parent = this.GetVisualParent();
+ if (parent != null)
+ parent.DetachedFromVisualTree -= Parent_DetachedFromVisualTree;
base.OnDetachedFromVisualTree(e);
ShowNativeOverlay(false);
}
@@ -305,6 +327,10 @@ protected override IPlatformHandle CreateNativeControlCore(IPlatformHandle paren
///
protected override void DestroyNativeControlCore(IPlatformHandle control)
{
+ contentChangedHandler?.Dispose();
+ isVisibleChangedHandler?.Dispose();
+ floatingContentChangedHandler?.Dispose();
+
Detach();
if (_floatingContent != null)
{
diff --git a/src/LibVLCSharp.MAUI/AppHostBuilderExtensions.cs b/src/LibVLCSharp.MAUI/AppHostBuilderExtensions.cs
index 9b40c1ec9..c836645e9 100644
--- a/src/LibVLCSharp.MAUI/AppHostBuilderExtensions.cs
+++ b/src/LibVLCSharp.MAUI/AppHostBuilderExtensions.cs
@@ -15,7 +15,15 @@ public static MauiAppBuilder UseLibVLCSharp(this MauiAppBuilder builder)
// Register LibVLCSharp handlers
builder.ConfigureMauiHandlers(handlers =>
{
+#if ANDROID || IOS || WINDOWS
handlers.AddHandler(typeof(VideoView), typeof(VideoViewHandler));
+#else
+ //.net8 core has no impl, but we need to define it so that the package can be added to a .Net8 x-plat project
+ // for linking purposes. At runtime, the correct platform-specific lib will be loaded, as any Maui-app solution will
+ // also contain a platform-specific project targeting one of the supported targets (Android, iOS, WinUI),
+ // or will be a shared-project.
+ throw new NotImplementedException($"This exception means the current target plaftorm: {DeviceInfo.Current.Platform} is not supported or correctly initialized. VLC needs platform-specific libs loaded.");
+#endif
});
// Configure custom fonts
diff --git a/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs b/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs
index 8314698a1..d62283ebc 100644
--- a/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs
+++ b/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs
@@ -3,6 +3,10 @@
using VideoViewImpl = LibVLCSharp.Platforms.Android.VideoView;
#elif IOS
using VideoViewImpl = LibVLCSharp.Platforms.iOS.VideoView;
+#elif WINUI
+using VideoViewImpl = LibVLCSharp.Platforms.Windows.VideoView;
+#else //.Net 8 (core/x-plat)
+using VideoViewImpl = LibVLCSharp.Shared.IVideoView;
#endif
namespace LibVLCSharp.MAUI
@@ -23,8 +27,14 @@ protected override VideoViewImpl CreatePlatformView()
{
#if ANDROID
return new VideoViewImpl(Context);
-#else
+#elif IOS || WINUI
return new VideoViewImpl();
+#else
+ //.net8 core has no impl, but we need to define it so that the package can be added to a .Net8 x-plat project
+ // for linking purposes. At runtime, the correct platform-specific lib will be loaded, as any Maui-app solution will
+ // also contain a platform-specific project targeting one of the supported targets (Android, iOS, WinUI),
+ // or will be a shared-project.
+ throw new NotImplementedException($"This exception means the current target plaftorm: {DeviceInfo.Current.Platform} is not supported or correctly initialized. VLC needs platform-specific libs loaded.");
#endif
}
}
diff --git a/src/LibVLCSharp.MAUI/LibVLCSharp.MAUI.csproj b/src/LibVLCSharp.MAUI/LibVLCSharp.MAUI.csproj
index 40905a1ed..02174fb00 100644
--- a/src/LibVLCSharp.MAUI/LibVLCSharp.MAUI.csproj
+++ b/src/LibVLCSharp.MAUI/LibVLCSharp.MAUI.csproj
@@ -1,6 +1,7 @@
- net8.0-android;net8.0-ios
+ net8.0;net8.0-android;net8.0-ios
+ $(TargetFrameworks);net8.0-windows10.0.19041
true
true
enable
diff --git a/src/LibVLCSharp.Tests/DialogTests.cs b/src/LibVLCSharp.Tests/DialogTests.cs
index 28fab3e31..ee439b5d2 100644
--- a/src/LibVLCSharp.Tests/DialogTests.cs
+++ b/src/LibVLCSharp.Tests/DialogTests.cs
@@ -38,7 +38,7 @@ public async Task PostLogin()
mp.Play();
await tcs.Task;
- Assert.True(tcs.Task.Result);
+ Assert.That(tcs.Task.Result);
}
[Test]
@@ -67,7 +67,7 @@ public async Task ShouldThrowIfPostLoginsTwice()
mp.Play();
await tcs.Task;
- Assert.True(tcs.Task.Result);
+ Assert.That(tcs.Task.Result);
}
[Test]
@@ -80,9 +80,9 @@ public async Task ShouldNotThrowAndReturnFalseIfDimissingTwice()
(dialog, title, text, username, store, token) =>
{
var result = dialog.Dismiss();
- Assert.IsTrue(result);
+ Assert.That(result, Is.True);
result = dialog.Dismiss();
- Assert.IsFalse(result);
+ Assert.That(result, Is.False);
tcs.TrySetResult(true);
return Task.CompletedTask;
},
@@ -98,7 +98,7 @@ public async Task ShouldNotThrowAndReturnFalseIfDimissingTwice()
mp.Play();
await tcs.Task;
- Assert.True(tcs.Task.Result);
+ Assert.That(tcs.Task.Result);
}
[Test]
@@ -110,11 +110,11 @@ public void ShouldUnsetDialogHandlersWhenInstanceDisposed()
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask);
- Assert.True(_libVLC.DialogHandlersSet);
+ Assert.That(_libVLC.DialogHandlersSet);
_libVLC.Dispose();
- Assert.False(_libVLC.DialogHandlersSet);
+ Assert.That(_libVLC.DialogHandlersSet, Is.False);
}
}
}
diff --git a/src/LibVLCSharp.Tests/EqualizerTests.cs b/src/LibVLCSharp.Tests/EqualizerTests.cs
index d21a36bf2..acab5f025 100644
--- a/src/LibVLCSharp.Tests/EqualizerTests.cs
+++ b/src/LibVLCSharp.Tests/EqualizerTests.cs
@@ -12,7 +12,7 @@ public void BasicNativeCallTest()
{
var equalizer = new Equalizer();
equalizer.SetAmp(-1, 1);
- Assert.AreEqual(-1, equalizer.Amp(1));
+ Assert.That(-1 == equalizer.Amp(1));
}
[Test]
@@ -21,7 +21,7 @@ public void DisposeEqualizer()
var equalizer = new Equalizer();
equalizer.SetAmp(-1, 1);
equalizer.Dispose();
- Assert.AreEqual(IntPtr.Zero, equalizer.NativeReference);
+ Assert.That(IntPtr.Zero == equalizer.NativeReference);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/LibVLCSharp.Tests/EventManagerTests.cs b/src/LibVLCSharp.Tests/EventManagerTests.cs
index 8b637a869..e9c184aa5 100644
--- a/src/LibVLCSharp.Tests/EventManagerTests.cs
+++ b/src/LibVLCSharp.Tests/EventManagerTests.cs
@@ -17,14 +17,14 @@ public void MetaChangedEventSubscribe()
const MetadataType description = MetadataType.Description;
media.MetaChanged += (sender, args) =>
{
- Assert.AreEqual(description, args.MetadataType);
+ Assert.That(description == args.MetadataType);
eventHandlerCalled = true;
};
media.SetMeta(MetadataType.Description, "test");
- Assert.True(eventHandlerCalled);
+ Assert.That(eventHandlerCalled);
}
- public void DurationChanged()
+ public async void DurationChanged()
{
var media = new Media(_libVLC, RealMp3Path);
var called = false;
@@ -36,10 +36,10 @@ public void DurationChanged()
duration = args.Duration;
};
- media.Parse();
+ await media.Parse();
- Assert.True(called);
- Assert.NotZero(duration);
+ Assert.That(called);
+ Assert.That(duration, Is.Not.Zero);
}
[Test]
@@ -54,7 +54,7 @@ public void FreedMedia()
media.Dispose();
- Assert.True(eventCalled);
+ Assert.That(eventCalled);
}
[Test]
@@ -76,8 +76,8 @@ public async Task OpeningStateChanged()
var mp = new MediaPlayer(media);
mp.Play();
await tcs.Task;
- Assert.True(tcs.Task.Result);
- Assert.True(openingCalled);
+ Assert.That(tcs.Task.Result);
+ Assert.That(openingCalled);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/LibVLCSharp.Tests/LibVLCAPICoverage.cs b/src/LibVLCSharp.Tests/LibVLCAPICoverage.cs
index 28de950f2..ebe40b0ba 100644
--- a/src/LibVLCSharp.Tests/LibVLCAPICoverage.cs
+++ b/src/LibVLCSharp.Tests/LibVLCAPICoverage.cs
@@ -138,7 +138,7 @@ public async Task CheckLibVLCCoverage()
Debug.WriteLine(miss);
}
- Assert.Zero(missingApisCount);
+ Assert.That(missingApisCount, Is.Zero);
}
}
}
diff --git a/src/LibVLCSharp.Tests/LibVLCSharp.Tests.csproj b/src/LibVLCSharp.Tests/LibVLCSharp.Tests.csproj
index 933daeda8..656597ebd 100644
--- a/src/LibVLCSharp.Tests/LibVLCSharp.Tests.csproj
+++ b/src/LibVLCSharp.Tests/LibVLCSharp.Tests.csproj
@@ -11,11 +11,11 @@
true
-
-
-
-
-
+
+
+
+
+
diff --git a/src/LibVLCSharp.Tests/LibVLCTests.cs b/src/LibVLCSharp.Tests/LibVLCTests.cs
index a9c9786aa..c3acebe5e 100644
--- a/src/LibVLCSharp.Tests/LibVLCTests.cs
+++ b/src/LibVLCSharp.Tests/LibVLCTests.cs
@@ -15,7 +15,7 @@ public class LibVLCTests : BaseSetup
public void DisposeInstanceNativeRelease()
{
_libVLC.Dispose();
- Assert.AreEqual(IntPtr.Zero, _libVLC.NativeReference);
+ Assert.That(IntPtr.Zero == _libVLC.NativeReference);
}
[Test]
@@ -71,7 +71,7 @@ public void AudioOutputDevices()
[Test]
public void EqualityTests()
{
- Assert.AreNotSame(new LibVLC("--no-audio"), new LibVLC("--no-audio"));
+ Assert.That(new LibVLC("--no-audio"), Is.Not.SameAs(new LibVLC("--no-audio")));
}
[Test]
@@ -99,7 +99,7 @@ public void SetLogFile()
_libVLC.SetLogFile(path);
_libVLC.CloseLogFile();
var logs = File.ReadAllText(path);
- Assert.True(logs.StartsWith("VLC media player"));
+ Assert.That(logs.StartsWith("VLC media player"));
}
[Test]
@@ -111,24 +111,24 @@ public void DisposeLibVLC()
(dialog, title, text, indeterminate, position, cancelText, token) => Task.CompletedTask,
(dialog, position, text) => Task.CompletedTask);
- Assert.IsTrue(_libVLC.DialogHandlersSet);
+ Assert.That(_libVLC.DialogHandlersSet, Is.True);
_libVLC.Dispose();
- Assert.AreEqual(IntPtr.Zero, _libVLC.NativeReference);
- Assert.IsFalse(_libVLC.DialogHandlersSet);
+ Assert.That(IntPtr.Zero == _libVLC.NativeReference);
+ Assert.That(_libVLC.DialogHandlersSet, Is.False);
}
[Test]
public void LibVLCVersion()
{
- Assert.True(_libVLC.Version.StartsWith("3"));
+ Assert.That(_libVLC.Version.StartsWith("3"));
}
[Test]
public void LibVLCChangeset()
{
- Assert.IsNotNull(_libVLC.Changeset);
+ Assert.That(_libVLC.Changeset, Is.Not.Null);
}
}
}
diff --git a/src/LibVLCSharp.Tests/MediaDiscovererTests.cs b/src/LibVLCSharp.Tests/MediaDiscovererTests.cs
index 5db019671..d3aaada10 100644
--- a/src/LibVLCSharp.Tests/MediaDiscovererTests.cs
+++ b/src/LibVLCSharp.Tests/MediaDiscovererTests.cs
@@ -15,10 +15,10 @@ public void CreateStartAndStopDiscoverer()
{
var mds = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan);
var md = new MediaDiscoverer(_libVLC, mds.First().Name!);
- Assert.True(md.Start());
- Assert.True(md.IsRunning);
+ Assert.That(md.Start());
+ Assert.That(md.IsRunning);
md.Stop();
- Assert.False(md.IsRunning);
+ Assert.That(md.IsRunning, Is.False);
}
[Test]
@@ -26,18 +26,18 @@ public async Task DisposeMediaDiscoverer()
{
var mds = _libVLC.MediaDiscoverers(MediaDiscovererCategory.Lan);
var md = new MediaDiscoverer(_libVLC, mds.First().Name!);
- Assert.True(md.Start());
- Assert.True(md.IsRunning);
- Assert.NotNull(md.MediaList);
+ Assert.That(md.Start());
+ Assert.That(md.IsRunning);
+ Assert.That(md.MediaList, Is.Not.Null);
await Task.Delay(1000);
foreach(var media in md.MediaList!)
{
Debug.WriteLine(media.Mrl);
}
md.Dispose();
- Assert.IsNull(md.MediaList);
- Assert.False(md.IsRunning);
- Assert.AreEqual(IntPtr.Zero, md.NativeReference);
+ Assert.That(md.MediaList, Is.Null);
+ Assert.That(md.IsRunning, Is.False);
+ Assert.That(IntPtr.Zero == md.NativeReference);
}
}
}
diff --git a/src/LibVLCSharp.Tests/MediaListTests.cs b/src/LibVLCSharp.Tests/MediaListTests.cs
index a1046f16c..20d7a7f0a 100644
--- a/src/LibVLCSharp.Tests/MediaListTests.cs
+++ b/src/LibVLCSharp.Tests/MediaListTests.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Linq;
using LibVLCSharp.Shared;
using NUnit.Framework;
@@ -18,13 +19,13 @@ public void AddAndRemoveMediaFromMediaList()
mediaList.ItemAdded += (sender, args) => itemAdded = true;
mediaList.ItemDeleted += (sender, args) => itemDeleted = true;
mediaList.AddMedia(media);
- Assert.AreEqual(media, mediaList[0]);
- Assert.AreEqual(1, mediaList.Count);
- Assert.True(itemAdded);
- Assert.Zero(mediaList.IndexOf(media));
+ Assert.That(media.NativeReference == mediaList.First().NativeReference);
+ Assert.That(1 == mediaList.Count);
+ Assert.That(itemAdded);
+ Assert.That(mediaList.IndexOf(media), Is.Zero);
mediaList.RemoveIndex(0);
- Assert.Zero(mediaList.Count);
- Assert.True(itemDeleted);
+ Assert.That(mediaList.Count, Is.Zero);
+ Assert.That(itemDeleted);
}
[Test]
@@ -32,7 +33,7 @@ public void DisposeMediaList()
{
var mediaList = new MediaList(_libVLC);
mediaList.Dispose();
- Assert.AreEqual(IntPtr.Zero, mediaList.NativeReference);
+ Assert.That(IntPtr.Zero == mediaList.NativeReference);
}
}
}
diff --git a/src/LibVLCSharp.Tests/MediaPlayerTests.cs b/src/LibVLCSharp.Tests/MediaPlayerTests.cs
index 8e3caf224..81f06dbf0 100644
--- a/src/LibVLCSharp.Tests/MediaPlayerTests.cs
+++ b/src/LibVLCSharp.Tests/MediaPlayerTests.cs
@@ -17,7 +17,7 @@ public void CreateAndDestroy()
{
var mp = new MediaPlayer(_libVLC);
mp.Dispose();
- Assert.AreEqual(IntPtr.Zero, mp.NativeReference);
+ Assert.That(IntPtr.Zero == mp.NativeReference);
}
[Test]
@@ -40,12 +40,12 @@ public async Task TrackDescription()
mp.Playing += (sender, args) =>
{
var description = mp.AudioTrackDescription;
- Assert.True(mp.SetAudioTrack(description.First().Id));
- Assert.IsNotEmpty(description);
+ Assert.That(mp.SetAudioTrack(description.First().Id));
+ Assert.That(description, Is.Not.Empty);
tcs.SetResult(true);
};
await tcs.Task;
- Assert.True(tcs.Task.Result);
+ Assert.That(tcs.Task.Result);
}
[Test]
@@ -60,12 +60,12 @@ public async Task ChapterDescriptions()
mp.Playing += (sender, args) =>
{
var chapters = mp.FullChapterDescriptions(-1);
- Assert.IsNotEmpty(chapters);
- Assert.AreEqual(chapters.Length, mp.ChapterCount);
+ Assert.That(chapters, Is.Not.Empty);
+ Assert.That(chapters.Length == mp.ChapterCount);
tcs.SetResult(true);
};
await tcs.Task;
- Assert.True(tcs.Task.Result);
+ Assert.That(tcs.Task.Result);
}
[Test]
@@ -80,8 +80,8 @@ public async Task Play()
};
mp.Play();
await Task.Delay(5000);
- Assert.True(called);
- //Assert.True(mp.IsPlaying);
+ Assert.That(called);
+ //Assert.That(mp.IsPlaying);
}
int callCountRegisterOne = 0;
@@ -102,8 +102,8 @@ public async Task EventFireOnceForeachRegistration()
mp.Play();
await Task.Delay(2000);
- Assert.AreEqual(callCountRegisterOne, 1);
- Assert.AreEqual(callCountRegisterTwo, 1);
+ Assert.That(callCountRegisterOne == 1);
+ Assert.That(callCountRegisterTwo == 1);
callCountRegisterOne = 0;
callCountRegisterTwo = 0;
@@ -118,8 +118,8 @@ public async Task EventFireOnceForeachRegistration()
mp.Play();
await Task.Delay(2000);
- Assert.AreEqual(callCountRegisterOne, 0);
- Assert.AreEqual(callCountRegisterTwo, 1);
+ Assert.That(callCountRegisterOne == 0);
+ Assert.That(callCountRegisterTwo == 1);
// mp.Stop();
@@ -136,8 +136,8 @@ public async Task EventFireOnceForeachRegistration()
mp.Play();
await Task.Delay(500);
- Assert.AreEqual(callCountRegisterOne, 0);
- Assert.AreEqual(callCountRegisterTwo, 0);
+ Assert.That(callCountRegisterOne == 0);
+ Assert.That(callCountRegisterTwo == 0);
}
catch (Exception ex)
{
@@ -169,7 +169,7 @@ public async Task DisposeMediaPlayer()
mp.Dispose();
- Assert.AreEqual(IntPtr.Zero, mp.NativeReference);
+ Assert.That(IntPtr.Zero == mp.NativeReference);
}
[Test]
@@ -183,30 +183,30 @@ public async Task UpdateViewpoint()
var result = mp.UpdateViewpoint(yaw: 0, pitch: 90, roll: 0, fov: 0);
- Assert.IsTrue(result);
+ Assert.That(result, Is.True);
await Task.Delay(1000);
mp.Dispose();
- Assert.AreEqual(IntPtr.Zero, mp.NativeReference);
+ Assert.That(IntPtr.Zero == mp.NativeReference);
}
[Test]
public void GetMediaPlayerRole()
{
var mp = new MediaPlayer(_libVLC);
- Assert.AreEqual(MediaPlayerRole.Video, mp.Role);
+ Assert.That(MediaPlayerRole.Video == mp.Role);
}
[Test]
public void SetMediaPlayerRole()
{
var mp = new MediaPlayer(_libVLC);
- Assert.AreEqual(MediaPlayerRole.Video, mp.Role);
+ Assert.That(MediaPlayerRole.Video == mp.Role);
- Assert.True(mp.SetRole(MediaPlayerRole.None));
- Assert.AreEqual(MediaPlayerRole.None, mp.Role);
+ Assert.That(mp.SetRole(MediaPlayerRole.None));
+ Assert.That(MediaPlayerRole.None == mp.Role);
}
}
}
diff --git a/src/LibVLCSharp.Tests/MediaTests.cs b/src/LibVLCSharp.Tests/MediaTests.cs
index fa7a11703..1e1fc7dda 100644
--- a/src/LibVLCSharp.Tests/MediaTests.cs
+++ b/src/LibVLCSharp.Tests/MediaTests.cs
@@ -15,15 +15,14 @@ public class MediaTests : BaseSetup
public void CreateMedia()
{
using var media = new Media(_libVLC, Path.GetTempFileName());
-
- Assert.AreNotEqual(IntPtr.Zero, media.NativeReference);
+ Assert.That(media.NativeReference, Is.Not.EqualTo(IntPtr.Zero));
}
[Test]
public void CreateMediaFromUri()
{
var media = new Media(_libVLC, new Uri(RealStreamMediaPath, UriKind.Absolute));
- Assert.AreNotEqual(IntPtr.Zero, media.NativeReference);
+ Assert.That(media.NativeReference, Is.Not.EqualTo(IntPtr.Zero));
}
[Test]
@@ -42,7 +41,7 @@ public void ReleaseMedia()
media.Dispose();
- Assert.AreEqual(IntPtr.Zero, media.NativeReference);
+ Assert.That(IntPtr.Zero == media.NativeReference);
}
[Test]
@@ -51,7 +50,7 @@ public void CreateMediaFromStream()
using var stream = new FileStream(Path.GetTempFileName(), FileMode.OpenOrCreate);
using var input = new StreamMediaInput(stream);
using var media = new Media(_libVLC, input);
- Assert.AreNotEqual(IntPtr.Zero, media.NativeReference);
+ Assert.That(media.NativeReference, Is.Not.EqualTo(IntPtr.Zero));
}
[Test]
@@ -68,12 +67,12 @@ public async Task CreateRealMedia()
{
using (var media = new Media(_libVLC, RealStreamMediaPath, FromType.FromLocation))
{
- Assert.NotZero(media.Duration);
+ Assert.That(media.Duration, Is.Not.Zero);
using (var mp = new MediaPlayer(media))
{
- Assert.True(mp.Play());
+ Assert.That(mp.Play());
await Task.Delay(4000); // have to wait a bit for statistics to populate
- Assert.Greater(media.Statistics.DemuxBitrate, 0);
+ Assert.That(media.Statistics.DemuxBitrate, Is.GreaterThan(0));
mp.Stop();
}
}
@@ -84,12 +83,12 @@ public async Task CreateRealMediaFromUri()
{
using (var media = new Media(_libVLC, new Uri(RealStreamMediaPath, UriKind.Absolute)))
{
- Assert.NotZero(media.Duration);
+ Assert.That(media.Duration, Is.Not.Zero);
using (var mp = new MediaPlayer(media))
{
- Assert.True(mp.Play());
+ Assert.That(mp.Play());
await Task.Delay(4000); // have to wait a bit for statistics to populate
- Assert.Greater(media.Statistics.DemuxBitrate, 0);
+ Assert.That(media.Statistics.DemuxBitrate, Is.GreaterThan(0));
mp.Stop();
}
}
@@ -102,7 +101,7 @@ public void Duplicate()
using var input = new StreamMediaInput(stream);
using var media = new Media(_libVLC, input);
var duplicate = media.Duplicate();
- Assert.AreNotEqual(duplicate.NativeReference, media.NativeReference);
+ Assert.That(media.NativeReference, Is.Not.EqualTo(duplicate.NativeReference));
}
[Test]
@@ -111,7 +110,7 @@ public void CreateMediaFromFileStream()
using var stream = new FileStream(RealMp3Path, FileMode.Open, FileAccess.Read, FileShare.Read);
using var input = new StreamMediaInput(stream);
using var media = new Media(_libVLC, input);
- Assert.AreNotEqual(IntPtr.Zero, media.NativeReference);
+ Assert.That(media.NativeReference, Is.Not.EqualTo(IntPtr.Zero));
}
[Test]
@@ -120,8 +119,8 @@ public void SetMetadata()
using var media = new Media(_libVLC, Path.GetTempFileName());
const string test = "test";
media.SetMeta(MetadataType.ShowName, test);
- Assert.True(media.SaveMeta());
- Assert.AreEqual(test, media.Meta(MetadataType.ShowName));
+ Assert.That(media.SaveMeta());
+ Assert.That(test == media.Meta(MetadataType.ShowName));
}
[Test]
@@ -130,8 +129,8 @@ public async Task GetTracks()
{
using var media = new Media(_libVLC, RealMp3Path);
await media.Parse();
- Assert.AreEqual(media.Tracks.Single().Data.Audio.Channels, 2);
- Assert.AreEqual(media.Tracks.Single().Data.Audio.Rate, 44100);
+ Assert.That(media.Tracks.Single().Data.Audio.Channels == 2);
+ Assert.That(media.Tracks.Single().Data.Audio.Rate == 44100);
}
[Test]
@@ -139,15 +138,15 @@ public async Task CreateRealMediaSpecialCharacters()
{
using (var media = new Media(_libVLC, RealMp3PathSpecialCharacter, FromType.FromPath))
{
- Assert.False(media.IsParsed);
+ Assert.That(media.IsParsed, Is.False);
await media.Parse();
await Task.Delay(5000);
- Assert.True(media.IsParsed);
- Assert.AreEqual(MediaParsedStatus.Done, media.ParsedStatus);
+ Assert.That(media.IsParsed);
+ Assert.That(MediaParsedStatus.Done == media.ParsedStatus);
using (var mp = new MediaPlayer(media))
{
- Assert.True(mp.Play());
+ Assert.That(mp.Play());
await Task.Delay(1000);
mp.Stop();
}
@@ -212,7 +211,7 @@ public async Task ParseShouldTimeoutWith1MillisecondLimit()
{
using var media = new Media(_libVLC, RealMp3Path);
var parseResult = await media.Parse(timeout: 1);
- Assert.AreEqual(MediaParsedStatus.Timeout, parseResult);
+ Assert.That(MediaParsedStatus.Timeout == parseResult);
}
[Test]
@@ -221,7 +220,7 @@ public async Task ParseShouldSucceed()
{
using var media = new Media(_libVLC, RealMp3Path);
var parseResult = await media.Parse();
- Assert.AreEqual(MediaParsedStatus.Done, parseResult);
+ Assert.That(MediaParsedStatus.Done == parseResult);
}
[Test]
@@ -230,7 +229,7 @@ public async Task ParseShouldFailIfNotMediaFile()
{
using var media = new Media(_libVLC, Path.GetTempFileName());
var parseResult = await media.Parse();
- Assert.AreEqual(MediaParsedStatus.Failed, parseResult);
+ Assert.That(MediaParsedStatus.Failed == parseResult);
}
[Test]
@@ -238,7 +237,7 @@ public async Task ParseShouldBeSkippedIfLocalParseSpecifiedAndRemoteUrlProvided(
{
using var media = new Media(_libVLC, RealStreamMediaPath, FromType.FromLocation);
var parseResult = await media.Parse(MediaParseOptions.ParseLocal);
- Assert.AreEqual(MediaParsedStatus.Skipped, parseResult);
+ Assert.That(MediaParsedStatus.Skipped == parseResult);
}
private async Task GetStreamFromUrl(string url)
diff --git a/src/LibVLCSharp.Tests/RendererDiscovererTests.cs b/src/LibVLCSharp.Tests/RendererDiscovererTests.cs
index 86104f0d4..1967a5818 100644
--- a/src/LibVLCSharp.Tests/RendererDiscovererTests.cs
+++ b/src/LibVLCSharp.Tests/RendererDiscovererTests.cs
@@ -24,10 +24,10 @@ public async Task DiscoverItems()
FromType.FromLocation)
};
- Assert.True(mp.Play());
+ Assert.That(mp.Play());
var rendererList = _libVLC.RendererList;
- Assert.IsNotEmpty(rendererList);
+ Assert.That(rendererList, Is.Not.Empty);
var rendererDiscoverer = new RendererDiscoverer(_libVLC, _libVLC.RendererList.LastOrDefault().Name);
var rendererItems = new List();
@@ -47,12 +47,12 @@ public async Task DiscoverItems()
};
- Assert.True(rendererDiscoverer.Start());
+ Assert.That(rendererDiscoverer.Start());
await tcs.Task;
- Assert.True(tcs.Task.Result);
- Assert.IsNotEmpty(rendererItems);
- Assert.True(mp.SetRenderer(rendererItems.First()));
+ Assert.That(tcs.Task.Result);
+ Assert.That(rendererItems.Any(), Is.True);
+ Assert.That(mp.SetRenderer(rendererItems.First()));
await Task.Delay(10000);
}
@@ -62,7 +62,7 @@ public void DisposeRendererDiscoverer()
{
var rendererDiscoverer = new RendererDiscoverer(_libVLC, _libVLC.RendererList.LastOrDefault().Name);
rendererDiscoverer.Dispose();
- Assert.AreEqual(IntPtr.Zero, rendererDiscoverer.NativeReference);
+ Assert.That(IntPtr.Zero == rendererDiscoverer.NativeReference);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/LibVLCSharp.WPF/ForegroundWindow.cs b/src/LibVLCSharp.WPF/ForegroundWindow.cs
index d9d4efdbd..8c7b33fa5 100644
--- a/src/LibVLCSharp.WPF/ForegroundWindow.cs
+++ b/src/LibVLCSharp.WPF/ForegroundWindow.cs
@@ -136,6 +136,12 @@ void AlignWithBackground()
return;
}
+ if (double.IsNaN(_bckgnd.ActualWidth) || double.IsNaN(_bckgnd.ActualHeight) ||
+ _bckgnd.ActualWidth == 0 || _bckgnd.ActualHeight == 0)
+ {
+ return;
+ }
+
/*
* Note that _bckgnd.ActualWidth and _bckgnd.ActualWidth are in local coordinates
* and not in screen coordinates.
diff --git a/src/LibVLCSharp/LibVLCSharp.csproj b/src/LibVLCSharp/LibVLCSharp.csproj
index 334746e7f..da50e567a 100644
--- a/src/LibVLCSharp/LibVLCSharp.csproj
+++ b/src/LibVLCSharp/LibVLCSharp.csproj
@@ -92,8 +92,14 @@ LibVLC needs to be installed separately, see VideoLAN.LibVLC.* packages.
+
+
+
+
+
+
-
+
diff --git a/src/LibVLCSharp/Platforms/Windows/VideoViewBase.cs b/src/LibVLCSharp/Platforms/Windows/VideoViewBase.cs
index 41d6eccc3..3bf8e38a3 100644
--- a/src/LibVLCSharp/Platforms/Windows/VideoViewBase.cs
+++ b/src/LibVLCSharp/Platforms/Windows/VideoViewBase.cs
@@ -41,7 +41,7 @@ public abstract class VideoViewBase : Control, IVideoView
///
public VideoViewBase()
{
- DefaultStyleKey = typeof(VideoViewBase);
+ DefaultStyleKey = typeof(VideoView);
Unloaded += (s, e) => DestroySwapChain();
#if !WINUI
diff --git a/src/LibVLCSharp/Shared/MediaPlayer.cs b/src/LibVLCSharp/Shared/MediaPlayer.cs
index fa564255a..26a1ddfaa 100644
--- a/src/LibVLCSharp/Shared/MediaPlayer.cs
+++ b/src/LibVLCSharp/Shared/MediaPlayer.cs
@@ -2403,13 +2403,13 @@ public event EventHandler VolumeChanged
/// release any unmanaged resources
protected override void Dispose(bool disposing)
{
+ base.Dispose(disposing);
+
if(disposing)
{
if (_gcHandle.IsAllocated)
_gcHandle.Free();
}
-
- base.Dispose(disposing);
}
}
diff --git a/src/LibVLCSharp/Themes/Generic.xaml b/src/LibVLCSharp/Themes/Generic.xaml
index f609fae77..c90b5b02c 100644
--- a/src/LibVLCSharp/Themes/Generic.xaml
+++ b/src/LibVLCSharp/Themes/Generic.xaml
@@ -3,10 +3,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vlc="using:LibVLCSharp.Platforms.Windows">
-