I've used AudioVideoCapture devise to record a video, but I can't get the thumbnail of the recorded video. Please help me!
Asked
Active
Viewed 685 times
1
-
this question is answered here [How to get the thumbnail of a recorded video - windows phone 8][1] [1]: http://stackoverflow.com/questions/15271922/how-to-get-the-thumbnail-of-a-recorded-video-windows-phone-8 – M.Saleh Jan 02 '14 at 12:35
1 Answers
0
You can try this. If you are using AudioVideoCaptureDevice api. following event(previewThumbnail) call after every frame capture. You can choose any frame that you need. As take first one.
private AudioVideoCaptureDevice VideoRecordingDevice;
VideoRecordingDevice.PreviewFrameAvailable += previewThumbnail;
bool DisablePreviewFrame = false;
private void previewThumbnail(ICameraCaptureDevice a, object b)
{
if (!DisablePreviewFrame)
{
DisablePreviewFrame = true;
int frameWidth = (int)VideoRecordingDevice.PreviewResolution.Width;
int frameHeight = (int)VideoRecordingDevice.PreviewResolution.Height;
}
int[] buf = new int[frameWidth * frameHeight];
VideoRecordingDevice.GetPreviewBufferArgb(buf);
using (IsolatedStorageFile isoStoreFile = IsolatedStorageFile.GetUserStoreForApplication())
{
var fileName = "temp.jpg";
if (isoStoreFile.FileExists(fileName))
isoStoreFile.DeleteFile(fileName);
using (IsolatedStorageFileStream isostream = isoStoreFile.CreateFile(fileName))
{
WriteableBitmap wb = new WriteableBitmap(frameWidth, frameWidth);
Array.Copy(buf, wb.Pixels, buf.Length);
wb.SaveJpeg(isostream, 120, 120, 0, 60);
isostream.Close();
}
}
}

reza.cse08
- 5,938
- 48
- 39