using Windows.Devices.Enumeration;

namespace ytLive.Services;

public sealed class MediaCaptureCameraEnumerator : ICameraEnumerator
{
    public async Task<IReadOnlyList<CameraDeviceInfo>> GetCamerasAsync()
    {
        var devices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);
        var result = new List<CameraDeviceInfo>(devices.Count);
        foreach (var device in devices)
            result.Add(new CameraDeviceInfo(device.Id, device.Name));
        return result;
    }
}
