locked
InvalidCastException while using StartRecordToCustomSinkAsync

    Question

  • Hi,

    I am modifying Media_capture_using_capture_device_sample sample code. I want to use StartRecordToCustomSinkAsync instead of StartRecordToStorageFileAsync. In the example code I have just replaced the required API as below :

    In AdvancedCapture.xaml.cpp,

    instead of below API

    create_task(m_mediaCaptureMgr->StartRecordToStorageFileAsync(recordProfile, this->m_recordStorageFile)).then([this](task<void> recordTask)

    I have put

    task<void>(m_mediaCaptureMgr->StartRecordToCustomSinkAsync(recordProfile,"GrayscaleTransform.GrayscaleEffect",nullptr)).then([this](task<void> recordTask)

    [My intention is to receive frames in custom sink]

    When I call  StartRecordToCustomSinkAsync it enters the immidiate try block executes recordTask.get() and then enters catch block with InvalidCastException

    Pls help to understand the scenario...

    Thanks in advance


    a

    Sunday, October 28, 2012 11:15 AM

Answers