Getting camera resultion in Mobile Sdk

Is there a neat way to check camera resolution in Mobile Sdk? As I don’t want to assume what’s the width and height of thumbnail I want to snatch?

var videoParams = new VideoParams()
{
   CameraId = camera.CameraId,
   DestWidth = 1920,
   DestHeight = 1080,
   CompressionLvl = 100,
   FPS = 30,
   MethodType = StreamParamsHelper.MethodType.Pull,
   SignalType = StreamParamsHelper.SignalType.Playback,
   StreamType = StreamParamsHelper.StreamType.Transcoded,
};

var playbackParams = new PlaybackParams { Time = DateTime.Now.AddMinutes(-1) };

if (connection.Thumbnail.GetThumbnailByTime(videoParams, playbackParams, 
TimeSpan.FromSeconds(15)) is GetThumbnailResponse response 
&& response.Thumbnail is byte  thumbnail && thumbnail?.Length > 0 
&& new MagickImage(thumbnail) is MagickImage image)
{
   var savePath = $“{playbackParams.Time:yyyy-MM-ddThh-mm-ss}.jpg”;

   if (File.Exists(savePath)) File.Delete(savePath);

   image.Write(savePath);

   Console.WriteLine($"Saved thumbnail to {savePath}...");
}

Can somebody help with that?

Hi @RChojnacki

Mobile SDK does not provide a direct API to query supported resolutions. Possible approaches are:

  1. Query the camera/stream configuration (recommended).
    Use MIP SDK or API Gateway to read the camera’s settings. Those contain the actual resolution(s) configured on the device. Mobile SDK is primarily a consumer, therefore it doesn provide the actual administrative settings of the camera.

  2. Inspect the returned image.
    DestWidth/DestHeight symbolize the dimensions of client’s available size (e.g. thumbnail canvas size or screen size). Based on request, server decides what actual thumbnail to return (after decoding and maybe scaling down). If you provide very large numbers for DestWidth/DestHeight, server will return the actual size of the largest available stream for that camera.