locked
How to change video resolution for CameraCaptureUI and how to set StartPreviewAsync video to full screen? RRS feed

  • Question

  • Hello all, I'm learning the sample code about Metro APP for camera and now I have two question.

    Firstly, I want change video resolution, I have added my code to DeviceAppForWebcam to do this.Code like this

    void DeviceAppPage::OnVideoFormatChanged(Object^ sender, RoutedEventArgs^ e)
    {
     Windows::Foundation::Collections::IVectorView<IMediaEncodingProperties^> ^res;
    res = videoDevController->GetAvailableMediaStreamProperties(Windows::Media::Capture::MediaStreamType::VideoPreview);
    .......
    videoDevController->SetMediaStreamPropertiesAsync(Windows::Media::Capture::MediaStreamType::VideoPreview, (VideoEncodingProperties^) res->GetAt(j));
    }

    It works when I use camera option UI sample. But can't work with CameraCapture sample and Camera App. For the last two apps, when I change resolution, I will get following words on flyout

    Something went wrong and this app can’t set camera setting
    Go back to continue using the camera

    I can find it crash at videoDevController->GetAvailableMediaStreamProperties. And I know the different is camera option UI use MediaCapture.StartPreviewAsync to preview video and another use CameraCaptureUI to do this. 

    So my question for the second case , how can I set video resolution ?

    Secondly is how to set video to full sreen when I use MediaCapture.StartPreviewAsync,I have added strech=fill to xml, but nothing happend.

    Thanks


    • Edited by Tango__ Sunday, June 9, 2013 8:49 AM
    Sunday, June 9, 2013 8:48 AM

Answers

  • Hello,

    You need to query the supported resolutions of the camera. You can't send an arbitrary resolution or media type. If you do not use a supported resolution or media type you will get the error that you are reporting.

    Setting the video to full screen simply requires that you query the screen resolution and DPI and then adjust the preview control to the proper size. There is no "go full screen" option.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, June 12, 2013 11:09 PM
    Moderator

All replies

  • Hello,

    You need to query the supported resolutions of the camera. You can't send an arbitrary resolution or media type. If you do not use a supported resolution or media type you will get the error that you are reporting.

    Setting the video to full screen simply requires that you query the screen resolution and DPI and then adjust the preview control to the proper size. There is no "go full screen" option.

    I hope this helps,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, June 12, 2013 11:09 PM
    Moderator
  • Hi James

    Thanks for your help.

    For the first question, I know I need query the supported resolutions. But if App use MediaCapture.StartPreviewAsync to preview video, just like the sample CameraOptionsUI Sample, it's OK. But if App use  CameraCaptureUI to show video, just like the sample CameraCaptureUI Sample,I will get crash when I query resolutions by using videoDevController->GetAvailableMediaStreamProperties.  I want to know for the second case, how can I get the supported resolutions and set resolution.

     Thanks

    Thursday, June 13, 2013 2:10 AM