Files
Pal3.Unity/Assets/Scripts/Engine/Utilities/UnitySupportedVideoFormats.cs
2024-01-07 02:37:35 -08:00

75 lines
2.4 KiB
C#

// ---------------------------------------------------------------------------------------------
// Copyright (c) 2021-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------
namespace Engine.Utilities
{
using System;
using System.Collections.Generic;
using UnityEngine;
public static class UnitySupportedVideoFormats
{
public static readonly HashSet<string> WindowsSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".asf",
".avi",
".dv",
".m4v",
".mov",
".mp4",
".mpg",
".mpeg",
".ogv",
".vp8",
".webm",
".wmv",
};
public static readonly HashSet<string> MacOSSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".dv",
".m4v",
".mov",
".mp4",
".mpg",
".mpeg",
".ogv",
".vp8",
".webm",
};
public static readonly HashSet<string> LinuxSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".ogv",
".vp8",
".webm",
};
public static readonly HashSet<string> AndroidSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".webm",
".mp4",
};
public static readonly HashSet<string> iOSSupportedVideoFormats = new (StringComparer.OrdinalIgnoreCase)
{
".webm",
".mp4",
};
public static HashSet<string> GetSupportedVideoFormats(RuntimePlatform platform)
{
return platform switch
{
RuntimePlatform.WindowsPlayer or RuntimePlatform.WindowsEditor => WindowsSupportedVideoFormats,
RuntimePlatform.OSXPlayer or RuntimePlatform.OSXEditor => MacOSSupportedVideoFormats,
RuntimePlatform.LinuxPlayer or RuntimePlatform.LinuxEditor => LinuxSupportedVideoFormats,
RuntimePlatform.IPhonePlayer => iOSSupportedVideoFormats,
RuntimePlatform.Android => AndroidSupportedVideoFormats,
_ => new HashSet<string> (StringComparer.OrdinalIgnoreCase) {".mp4" }
};
}
}
}