Connecting directly IP cameras is a new UWP feature. On this page: https://blogs.windows.com/windowsdeveloper/2019/10/10/connecting-network-cameras-to-windows-10-devices/
It says: "For streaming from a URI through the MediaCapture class, assign the desired URI to MediaCaptureInitializationSettings::DeviceUri. If credentials are required, they can be set through MediaCaptureInitializationSettings::DeviceUriPasswordCredential. The API supports ONVIF and generic RTSP server URIs. This allows applications to use the standard Windows Media APIs to capture video from generic cameras that do not conform to the ONVIF standards, or from an arbitrary URI without pairing."
Update: Now I am able to connect to the camera successfully. The problem was with the format of the URI. I have Reolink-410 Camera
MediaCapture = new MediaCapture();
MediaCaptureInitializationSettings captureInitSettings = new MediaCaptureInitializationSettings();
captureInitSettings.DeviceUri = new
Uri("rtsp://admin:[email protected]:554//h264Preview_01_main");
captureInitSettings.DeviceUriPasswordCredential = new Windows.Security.Credentials.PasswordCredential
{
UserName = "admin",
Password = "password"
};
MediaCapture.Failed += MediaCapture_Failed;
MediaCapture.RecordLimitationExceeded += MediaCapture_RecordLimitationExceeded;
await MediaCapture.InitializeAsync(captureInitSettings);
After this I can take pictures successfully
....
await _app.VM.MediaCapture.CapturePhotoToStorageFileAsync(GetImageEncodingProperties(), file);
But When I try to record video it throws exception: {"The specified object or value does not exist. (Exception from HRESULT: 0xC00D36D5)"}
...
var _mediaRecording = await _app.VM.MediaCapture.PrepareLowLagRecordToStorageFileAsync(MediaEncodingProfile.CreateHevc(VideoEncodingQuality.Auto), file);// Exception here {"The specified object or value does not exist. (Exception from HRESULT: 0xC00D36D5)"}
//also tried with CreateMP4
await _mediaRecording.StartAsync();
I also have tried await _mediaRecording.StartAsync();
which throws same exception.
{"The specified object or value does not exist. (Exception from HRESULT: 0xC00D36D5)"}
It should be enough to set the MediaCaptureInitializationSettings like this:
Start end stop recording is for the IP camera just like any other USB camera:
In the package manifest I have check: Microphone, Pictureslibrary,VideoLibrary, WebCam and internet(server&client)
your specific camera the 410 (not 410W) should use rtsp://admin:[email protected]/h264Preview_01_sub (source: https://www.ispyconnect.com/man.aspx?n=Reolink)