I have reduced a lot of code which is unnecessary for me into this and I am getting an error of "HRESULT:0xC00D36B6 This object needs to be initialized before the requested operation can be carried out" which the pointer points at the preview->Source
= mediacapture; at the CameraPreview and I have searched on internet and still have no idea what is wrong with it.

namespace App4
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public ref class MainPage sealed
{
public:
MainPage();
private:
void CameraInit();
void CameraPreview();
Platform::Agile<Windows::Media::Capture::MediaCapture> m_mediacapturemgr;
};
}

We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.