Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions samples/Uno/LibVLCSharp.Uno.WinUI.Sample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ public partial class App : Application
public App()
{
this.InitializeComponent();
#if HAS_UNO
Suspending += OnSuspending;
Resuming += OnResuming;
#endif
}

protected Window? MainWindow { get; private set; }
Expand Down Expand Up @@ -140,6 +142,7 @@ public static void InitializeLogging()
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
#if HAS_UNO
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
Expand All @@ -151,4 +154,5 @@ private void OnResuming(object? sender, object e)
{
ViewModel?.Resume();
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Uno.Sdk/5.3.96">
<PropertyGroup>
<TargetFrameworks>
net9.0-android;
net9.0-ios;
</TargetFrameworks>
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net9.0-windows10.0.19041.0</TargetFrameworks>

<WindowsPackageType>None</WindowsPackageType>

<OutputType>Exe</OutputType>
<UnoSingleProject>true</UnoSingleProject>
Expand All @@ -28,6 +28,9 @@
<Nullable>enable</Nullable>
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>

<WinAppSdkVersion>1.8.260710003</WinAppSdkVersion>
<WinAppSdkBuildToolsVersion>10.0.26100.7175</WinAppSdkBuildToolsVersion>

<!--
Adding NoWarn to remove build warnings
NU1507: Warning when there are multiple package sources when using CPM with no source mapping
Expand All @@ -42,12 +45,15 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\src\LibVLCSharp.Uno\LibVLCSharp.Uno.csproj" />
<ProjectReference Include="..\..\..\src\LibVLCSharp\LibVLCSharp.csproj" />
<ProjectReference Include="..\..\..\src\LibVLCSharp\LibVLCSharp.csproj" Condition="!$(TargetFramework.Contains('-windows'))" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-android'))">
<PackageReference Include="VideoLAN.LibVLC.Android" Version="3.6.5" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))">
<PackageReference Include="VideoLAN.LibVLC.iOS" Version="3.6.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.21" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
</PropertyGroup>

<PropertyGroup>
<!-- Minimum supported dependency. Windows App SDK 1.8 is incompatible with .NET MAUI 9;
newer consumers can resolve a higher version through NuGet. -->
<MicrosoftWindowsAppSDKVersion>1.7.250909003</MicrosoftWindowsAppSDKVersion>
<MicrosoftWindowsSDKBuildToolsVersion>10.0.22621.756</MicrosoftWindowsSDKBuildToolsVersion>
<NeutralLanguage>en</NeutralLanguage>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
Expand Down
15 changes: 15 additions & 0 deletions src/LibVLCSharp.Uno/DisplayInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,24 @@ namespace LibVLCSharp.Uno
/// </summary>
internal class DisplayInformation : IDisplayInformation
{
private Microsoft.UI.Xaml.FrameworkElement Owner { get; }

/// <summary>
/// Initializes a new instance of the <see cref="DisplayInformation"/> class.
/// </summary>
/// <param name="owner">Element whose display scale is used.</param>
public DisplayInformation(Microsoft.UI.Xaml.FrameworkElement owner)
{
Owner = owner;
}

/// <summary>
/// Gets the scale factor
/// </summary>
#if WINDOWS
public double ScalingFactor => Owner.XamlRoot?.RasterizationScale ?? 1d;
#else
public double ScalingFactor => Windows.Graphics.Display.DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
#endif
}
}
4 changes: 2 additions & 2 deletions src/LibVLCSharp.Uno/LibVLCSharp.Uno.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ It also contains a VLC MediaPlayerElement for the Uno Platform (UWP, Android, iO
<Page Include="**\*.iOS.*xaml" Exclude="bin\**\*.xaml;obj\**\*.xaml" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('windows'))">
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.251106002" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7175" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="$(MicrosoftWindowsAppSDKVersion)" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="$(MicrosoftWindowsSDKBuildToolsVersion)" />
</ItemGroup>
</Project>
8 changes: 2 additions & 6 deletions src/LibVLCSharp.Uno/PlaybackControls.UWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ protected override void SetToolTip(DependencyObject? element, string? resource,
{
return;
}
var resourceLoader = ResourceLoader;
if (resourceLoader != null)
{
ToolTipService.SetToolTip(element, string.Format(resourceLoader.GetString(resource),
args.Select(arg => resourceLoader.GetString(arg)).Cast<object>().ToArray()));
}
ToolTipService.SetToolTip(element, string.Format(StringResourceLoader.GetString(resource),
args.Select(StringResourceLoader.GetString).Cast<object>().ToArray()));
}
}
}
10 changes: 5 additions & 5 deletions src/LibVLCSharp.Uno/PlaybackControlsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public PlaybackControlsBase()
{
DefaultStyleKey = typeof(PlaybackControls);

Manager = new MediaPlayerElementManager(new DispatcherAdapter(Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread()), new DisplayInformation(), new DisplayRequestAdapter());
Manager = new MediaPlayerElementManager(new DispatcherAdapter(Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread()), new DisplayInformation(this), new DisplayRequestAdapter());
Manager.Get<AspectRatioManager>().AspectRatioChanged += AspectRatioChanged;
var autoHideManager = Manager.Get<AutoHideNotifier>();
autoHideManager.Shown += (sender, e) => VisualStateManager.GoToState(this, ControlPanelFadeInState, true);
Expand Down Expand Up @@ -684,7 +684,7 @@ private void AddAspectRatioMenu(Button? zoomButton)
{
var menuItem = new ToggleMenuFlyoutItem
{
Text = ResourceLoader.GetString($"{nameof(AspectRatio)}{aspectRatio}"),
Text = StringResourceLoader.GetString($"{nameof(AspectRatio)}{aspectRatio}"),
IsChecked = aspectRatio == currentAspectRatio,
Command = new ActionCommand<AspectRatio>(AspectRatioMenuItemClick),
CommandParameter = aspectRatio
Expand Down Expand Up @@ -778,7 +778,7 @@ private void AddTracksMenu(Button? trackButton, TracksManager manager, string av

private void AddNoneItem(MenuFlyout menuflyout)
{
AddTrack(menuflyout, null, ResourceLoader.GetString("None") ?? string.Empty);
AddTrack(menuflyout, null, StringResourceLoader.GetString("None"));
}

private void AddTrack(MenuFlyout menuflyout, int? trackId, string trackName)
Expand Down Expand Up @@ -969,7 +969,7 @@ private void CastButton_Click(object sender, RoutedEventArgs e)
{
AddCastMenuItem(items, renderer.Name);
}
AddCastMenuItem(items, ResourceLoader.GetString("Disconnect"), true);
AddCastMenuItem(items, StringResourceLoader.GetString("Disconnect"), true);
((Button)sender).Flyout = castMenu;
}

Expand Down Expand Up @@ -1034,7 +1034,7 @@ private void ShowError()
var errorTextBlock = ErrorTextBlock;
if (errorTextBlock != null)
{
errorTextBlock.Text = string.Format(ResourceLoader.GetString("Error") ?? string.Empty, Manager.Get<StateManager>().MediaResourceLocator);
errorTextBlock.Text = string.Format(StringResourceLoader.GetString("Error"), Manager.Get<StateManager>().MediaResourceLocator);
VisualStateManager.GoToState(this, ErrorState, true);
}
}
Expand Down
21 changes: 21 additions & 0 deletions src/LibVLCSharp.Uno/StringResourceLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace LibVLCSharp.Uno
{
internal static class StringResourceLoader
{
private const string ResourceMap = "LibVLCSharp.Uno/Resources";

#if WINDOWS
private static readonly Microsoft.Windows.ApplicationModel.Resources.ResourceLoader ResourceLoader =
new Microsoft.Windows.ApplicationModel.Resources.ResourceLoader(
Microsoft.Windows.ApplicationModel.Resources.ResourceLoader.GetDefaultResourceFilePath(),
ResourceMap);

internal static string GetString(string resource) => ResourceLoader.GetString(resource);
#else
internal static string GetString(string resource) =>
Windows.ApplicationModel.Resources.ResourceLoader
.GetForCurrentView(ResourceMap)
.GetString(resource) ?? string.Empty;
#endif
}
}
4 changes: 3 additions & 1 deletion src/LibVLCSharp.Uno/Themes/Generic.xaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///LibVLCSharp.Uno/Themes/MediaPlayerElement.xaml" />
<ResourceDictionary Source="ms-appx:///LibVLCSharp.Uno/Themes/PlaybackControls.xaml" />
<win:ResourceDictionary Source="ms-appx:///LibVLCSharp.Uno/Themes/VideoView.UWP.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
15 changes: 15 additions & 0 deletions src/LibVLCSharp.Uno/Themes/VideoView.UWP.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vlc="using:LibVLCSharp.Uno">

<Style TargetType="vlc:VideoView">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="vlc:VideoView">
<SwapChainPanel x:Name="SwapChainPanel" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
8 changes: 8 additions & 0 deletions src/LibVLCSharp.Uno/VideoView.UWP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ namespace LibVLCSharp.Uno
/// </summary>
public class VideoView : VideoView<InitializedEventArgs>, IVideoView, IVideoControl
{
/// <summary>
/// Initializes a new instance of the <see cref="VideoView"/> class.
/// </summary>
public VideoView()
{
DefaultStyleKey = typeof(VideoView);
}

/// <summary>
/// Creates args for <see cref="VideoView{TInitializedEventArgs}.Initialized"/> event
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions src/LibVLCSharp.WinUI/LibVLCSharp.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ LibVLC needs to be installed separately, see VideoLAN.LibVLC.Windows.</Descripti
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.251106002" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.7175" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="$(MicrosoftWindowsAppSDKVersion)" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="$(MicrosoftWindowsSDKBuildToolsVersion)" />
<PackageReference Include="SharpDX.Direct3D11" Version="4.2.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" NoWarn="NU1510" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" NoWarn="NU1510" />
Expand Down