Note that there are some explanatory texts on larger screens.

plurals
  1. POTake a snapshot of using the rectangle in WP7
    primarykey
    data
    text
    <p>Im working on a WP7-app where I would like to record video and before the video is saved take a snapshot of the video so that it could be used as a thumbnail picture. The thumbnail picture is temporary save in the isolated storage before it is used. For the camera I use a rectangle to record video and later I want to display the picture on the phone. The problem is that the picture is displays only a black screen. Even when i tried to save the picture in the media library the picture is also there displayed as black. What can be the cause of this problem and how do i solve it?</p> <p>I inserted the code below: </p> <p>Here is the rectangle where you capture the video with. </p> <pre><code> &lt;Rectangle x:Name="viewfinderRectangle" Width="640" Height="480" HorizontalAlignment="Left" Canvas.Left="80"/&gt; </code></pre> <p>Here is the code for taking the picture:</p> <pre><code>try { String tempJPEG = FOSConstants.TEMP_VIDEO_THUMBNAIL_NAME; var myStore = IsolatedStorageFile.GetUserStoreForApplication(); if (myStore.FileExists(tempJPEG)) { myStore.DeleteFile(tempJPEG); } IsolatedStorageFileStream myFileStream = myStore.CreateFile(tempJPEG); WriteableBitmap wb = new WriteableBitmap(viewfinderRectangle, null); wb.SaveJpeg(myFileStream, wb.PixelWidth, wb.PixelHeight, 0, 85); myFileStream.Close(); myFileStream.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error saving snapshot", MessageBoxButton.OK); } </code></pre> <p>Here is the code for reading the thumbnail picture from the isolated storage: </p> <pre><code>private BitmapImage GetIsolatedStorageFile(string isolatedStorageFileName) { var bimg = new BitmapImage(); using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { using (var stream = store.OpenFile(isolatedStorageFileName, FileMode.Open, FileAccess.Read)) { bimg.SetSource(stream); } } return bimg; } </code></pre> <p>Here is the image where I want to display my thumbnail in the GUI.</p> <pre><code>&lt;Image Width="180" Height="180" Stretch="Fill" Margin="24,0,0,0" Source="{Binding Path=ImageSoruce, Mode=TwoWay}" HorizontalAlignment="Left"/&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload