Reputation: 14375
I am working on a telepresence app that uses a Windows Phone 8 device to beam images back to a desktop/tablet PC. I have found several samples that show how to record video, even save it to a file, but not one that shows me how to get each frame from the camera as it's streamed. I saw a sample that used a FileSink object to save video to storage, but nothing similar for getting each frame as it is generated. I also don't see an event in the camera object that is fired whenever a new bitmap/frame is generated. There is an event like that for taking a picture, but picture taking is very slow and isn't usable for streaming video.
How can I get each frame as it is generated by the camera when in video recording mode? I need this of course so I can send each frame over the socket link I have with the desktop/tablet PC.
Upvotes: 4
Views: 554
Reputation: 1949
If you are using PhotoCaptureDevice or PhotoCamera you can use this
camera.GetPreviewBufferArgb(previewBuffer);
or
camera.GetPreviewBufferArgb32(previewBuffer);
where previewBuffer
is pixel array of the frame. Which you can assign to WriteableBitmap.Pixels
or pass raw array over the socket and assign it to image on desktop.
Upvotes: 2