Page 1 of 1

Can't set VideoResolution

PostPosted: Mon Nov 04, 2013 1:02 am
by AforgeConfusion
I was quite happily using DesiredFrameSize until it was made obsolete. Apparently I now have to use VideoResolution.... Great.... So can anyone educate me on how I should be using the new method, as simply changing DesiredFrameSize to VideoResolution causes a type casting error.

I've searched the forums, the sdk, and google in general to no avail.....

//Check if the video device provides a list of supported resolutions
if (FinalVideoSource.VideoCapabilities.Length > 0)
{
string highestSolution = "0;0";
//Search for the highest resolution
for (int i = 0; i < FinalVideoSource.VideoCapabilities.Length; i++)
{
if (FinalVideoSource.VideoCapabilities[i].FrameSize.Width > Convert.ToInt32(highestSolution.Split(';')[0]))
highestSolution = FinalVideoSource.VideoCapabilities[i].FrameSize.Width.ToString() + ";" + i.ToString();
}

FinalVideoSource.DesiredFrameSize
//Set the highest resolution as active
// The line below is the obsolete line of code that used to work
FinalVideoSource.DesiredFrameSize= FinalVideoSource.VideoCapabilities[Convert.ToInt32(highestSolution.Split(';')[1])].FrameSize;
}