Repository: microsoft/PowerToys
File: src/modules/peek/Peek.FilePreviewer/Previewers/MediaPreviewer/VideoPreviewer.cs (C#)

Code before:
                ClipboardHelper.SaveToClipboard(storageItem);
            });
        }

        private Task<bool> LoadVideoAsync(CancellationToken cancellationToken)
        {
            return TaskExtension.RunSafe(async () =>
            {
                cancellationToken.ThrowIfCancellationRequested();

                var storageFile = await Item.GetStorageItemAsync() as StorageFile;

                await Dispatcher.RunOnUiThread(() =>
                {
                    cancellationToken.ThrowIfCancellationRequested();

                    Preview = MediaSource.CreateFromStorageFile(storageFile);
                });
            });
        }

        private bool HasFailedLoadingPreview()
        {
            return !(VideoTask?.Result ?? true);
        }

        private static readonly HashSet<string> _supportedFileTypes = new()
        {
            ".mp4", ".3g2", ".3gp", ".3gp2", ".3gpp", ".asf", ".avi", ".m2t", ".m2ts",
            ".m4v", ".mkv", ".mov", ".mp4", ".mp4v", ".mts", ".wm", ".wmv", ".webm",
        };
    }
}


Review comment (suggestion):
I see in this file, there is a list like:
        private static readonly HashSet<string> _supportedFileTypes = new()
        {
            ".mp4", ".3g2", ".3gp", ".3gp2", ".3gpp", ".asf", ".avi", ".m2t", ".m2ts",
            ".m4v", ".mkv", ".mov", ".mp4", ".mp4v", ".mts", ".wm", ".wmv", ".webm",
        };
        
        Do we need to revisit them? Not necessary in this PR.

Code after:
        }

        public async Task CopyAsync()
        {
            await Dispatcher.RunOnUiThread(async () =>
            {
                var storageItem = await Item.GetStorageItemAsync();
                ClipboardHelper.SaveToClipboard(storageItem);
            });
        }

        private async Task<string> GetMissingCodecAsync(StorageFile? file)
        {
            try
            {
                var profile = await MediaEncodingProfile.CreateFromFileAsync(file);

                if (profile.Video != null)
                {
                    var codecQuery = new CodecQuery();
                    var decoders = await codecQuery.FindAllAsync(
                        CodecKind.Video,
                        CodecCategory.Decoder,
                        profile.Video.Subtype);

                    return decoders.Count > 0 ? string.Empty : profile.Video.Subtype;
                }
                else
                {
                    Logger.LogWarning($"No video profile found for file {file?.Path}. Cannot determine codec support.");
                }
            }
            catch (Exception ex)
            {
                Logger.LogError($"Error checking codec support for file {file?.Path}: {ex.Message}");
            }

            return string.Empty;
        }

        private Task<bool> LoadVideoAsync(CancellationToken cancellationToken)
        {
            return TaskExtension.RunSafe(async () =>
            {
                cancellationToken.ThrowIfCancellationRequested();

                var storageFile = await Item.GetStorageItemAsync() as StorageFile;

                var missingCodecName = await GetMissingCodecAsync(storageFile);

                await Dispatcher.RunOnUiThread(() =>