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
1 change: 1 addition & 0 deletions src/LibVLCSharp/Shared/Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ internal static class Constants

internal static class ArchitectureNames
{
internal const string WinArm64 = "win-arm64";
internal const string Win64 = "win-x64";
internal const string Win86 = "win-x86";
internal const string MacOS64 = "osx-x64";
Expand Down
35 changes: 35 additions & 0 deletions src/LibVLCSharp/Shared/Core/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ static internal bool LibVLCLoaded
{
arch = Path.Combine(ArchitectureNames.MacOS64, Constants.Lib);
}

#if !NET40 && !NETSTANDARD1_1
else if (PlatformHelper.IsWindows)
{
arch = RuntimeInformation.ProcessArchitecture switch
{
Architecture.X64 => ArchitectureNames.Win64,
Architecture.X86 => ArchitectureNames.Win86,
Architecture.Arm64 => ArchitectureNames.WinArm64,
_ => arch = PlatformHelper.IsX64BitProcess ? ArchitectureNames.Win64 : ArchitectureNames.Win86
};
}
#endif

else
{
arch = PlatformHelper.IsX64BitProcess ? ArchitectureNames.Win64 : ArchitectureNames.Win86;
Expand Down Expand Up @@ -117,6 +131,27 @@ static internal bool LibVLCLoaded

paths.Add((string.Empty, libvlcPath3));

// Add Win64 folders as fallback for WinArm64 to keep compatibility
if (arch == ArchitectureNames.WinArm64)
{
var fallbackLibvlcDirPath1 = Path.Combine(Path.GetDirectoryName(libvlcAssemblyLocation)!,
Constants.LibrariesRepositoryFolderName, ArchitectureNames.Win64);

var fallbackLibvlccorePath1 = LibVLCCorePath(fallbackLibvlcDirPath1);
var fallbackLibvlcPath1 = LibVLCPath(fallbackLibvlcDirPath1);
paths.Add((fallbackLibvlccorePath1, fallbackLibvlcPath1));

if (!string.IsNullOrEmpty(assemblyLocation))
{
var fallbackLibvlcDirPath2 = Path.Combine(Path.GetDirectoryName(assemblyLocation)!,
Constants.LibrariesRepositoryFolderName, ArchitectureNames.Win64);

var fallbackLibvlccorePath2 = LibVLCCorePath(fallbackLibvlcDirPath2);
var fallbackLibvlcPath2 = LibVLCPath(fallbackLibvlcDirPath2);
paths.Add((fallbackLibvlccorePath2, fallbackLibvlcPath2));
}
}

if (PlatformHelper.IsMac)
{
var libvlcPath4 = Path.Combine(Path.Combine(Path.GetDirectoryName(libvlcAssemblyLocation)!,
Expand Down
Loading