0

I'm trying to create a video capturing application store video file with 'thumbnail' image in Windows phone 8. I got some hint from the following link : How to get the thumbnail of a recorded video - windows phone 8?. But the result is quite annoying. I think there is some problem with the function.

 void captureSource_CaptureImageCompleted(object sender, CaptureImageCompletedEventArgs e)
        {
            using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
            {
                WriteableBitmap wb = e.Result;
                string fileName = "CameraMovie.jpg";
                if (isoStore.FileExists(fileName))
                    isoStore.DeleteFile(fileName);
                IsolatedStorageFileStream file = isoStore.CreateFile(fileName);
                Extensions.SaveJpeg(wb, file, wb.PixelWidth, wb.PixelHeight, 0, 85);
                file.Close();

                captureSource.Stop();
                fileSink.CaptureSource = null;
                fileSink.IsolatedStorageFileName = null;
            }
        }

e.Result has some invalid data in it.while i bind it to an image control it shows some annoying image. Anyone please help me.

Community
  • 1
  • 1
Deepak
  • 35
  • 5

1 Answers1

0

[EDIT] Adding a bit of explanation.

The snapshot of the video being recorded can be obtained at any point while the video is recorded. Obtain the preview buffer into an Argb pixel and apply that to a writable bitmap.

When you have to display the video, add an overlay to the screenshot image with another image which has got a glossy play button over it.

var videoWritableBitmap = new WriteableBitmap((int)[AudioVideoDevice].PreviewResolution.Width, (int)[AudioVideoDevice].PreviewResolution.Height);

var argbPixels = new int[(int)[AudioVideoDevice].PreviewResolution.Width * (int)[AudioVideoDevice].PreviewResolution.Height];

[AudioVideoDevice].GetPreviewBufferArgb(argbPixels);

argbPixels.CopyTo(videoWritableBitmap.Pixels, 0);

var videoThumbNailFile = await[localFolder].OpenStreamForWriteAsync([ThumbNailImageName], CreationCollisionOption.ReplaceExisting);

videoWritableBitmap.SaveJpeg(videoThumbNailFile, videoWritableBitmap.PixelWidth, videoWritableBitmap.PixelHeight, 0, 100);
dolbyarun
  • 1
  • 1