How to correctly initialize MediaCaptureInitializationSettings for an IP Camera?



I'm currently attempting to use Windows::Media::Capture APIs in C++/CX to record MP4 streams from an IP Camera. Here is a code snippet I have written:

MediaCaptureInitializationSettings^ settings = ref new Capture::MediaCaptureInitializationSettings();
settings->SharingMode = Capture::MediaCaptureSharingMode::SharedReadOnly;
settings->StreamingCaptureMode = Capture::StreamingCaptureMode::Video;

if (deviceUser && deviceUser->Length() > 0)
    PasswordCredential^ credential = ref new PasswordCredential();
    credential->UserName = deviceUser;
    credential->Password = devicePassword;
    credential->Resource = deviceUri;

    settings->DeviceUriPasswordCredential = credential;
    settings->DeviceUri = ref new Uri(deviceUri);

task<void> cameraInitializeTask = create_task(_mediaCapture->InitializeAsync(settings));

return cameraInitializeTask.then([this, deviceUri]()
    if (_mediaFrameReader != nullptr)
        _isInitialized = true;

However, while _mediaCapture gets initialized, _mediaCapture->FrameSources does not point to the correct camera device. Can someone please help me understand why? I need this information to create the correct frame readers for my cameras. Thank you in advance for any help!

Best regards, Christa

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
749 questions
{count} votes