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..b35247881 100644
--- a/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml.cs
+++ b/samples/MAUI/LibVLCSharp.MAUI.Sample.MediaElement/MainPage.xaml.cs
@@ -13,15 +13,30 @@ 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();
((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..0904b849e 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)
@@ -71,10 +71,10 @@ public void OnAppearing()
public void OnDisappearing()
{
MediaPlayer?.Dispose();
- MediaPlayer = null;
+ //MediaPlayer = null;
LibVLC?.Dispose();
- LibVLC = null;
+ //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/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs b/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs
index 8314698a1..c7e10676a 100644
--- a/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs
+++ b/src/LibVLCSharp.MAUI/Handlers/VideoViewHandler.cs
@@ -3,6 +3,8 @@
using VideoViewImpl = LibVLCSharp.Platforms.Android.VideoView;
#elif IOS
using VideoViewImpl = LibVLCSharp.Platforms.iOS.VideoView;
+#elif WINUI
+using VideoViewImpl = LibVLCSharp.Platforms.Windows.VideoView;
#endif
namespace LibVLCSharp.MAUI
diff --git a/src/LibVLCSharp.MAUI/LibVLCSharp.MAUI.csproj b/src/LibVLCSharp.MAUI/LibVLCSharp.MAUI.csproj
index 40905a1ed..8834955a8 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
+ $(TargetFrameworks);net8.0-windows10.0.19041
true
true
enable
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/MediaPlayerElement/SeekBarManager.cs b/src/LibVLCSharp/Shared/MediaPlayerElement/SeekBarManager.cs
index 773b0b29f..f5980444a 100644
--- a/src/LibVLCSharp/Shared/MediaPlayerElement/SeekBarManager.cs
+++ b/src/LibVLCSharp/Shared/MediaPlayerElement/SeekBarManager.cs
@@ -74,8 +74,10 @@ private bool ErrorOrEnded
{
get
{
- var mediaPlayer = MediaPlayer;
- return mediaPlayer == null ? true : mediaPlayer.State == VLCState.Error || mediaPlayer.State == VLCState.Ended;
+ var state = MediaPlayer?.State;
+ if (state == null)
+ return true;
+ return state == VLCState.Error || state == VLCState.Ended;
}
}
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">
-