Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. public partial class MainPage : PhoneApplicationPage
  2. {
  3. private const CameraSensorLocation SENSOR_LOCATION = CameraSensorLocation.Back;
  4.  
  5. private AudioVideoCaptureDevice _videoDevice = null;
  6.  
  7. // ... ctor and camInitialization methods etc.
  8.  
  9. private async void CameraButtons_ShutterKeyPressed(object sender, EventArgs e)
  10. {
  11. try{
  12. StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("videos", CreationCollisionOption.ReplaceExisting);
  13. StorageFile storageFile = await folder.CreateFileAsync("Video.mp4", CreationCollisionOption.GenerateUniqueName);
  14.  
  15. using (var s = await storageFile.OpenAsync(FileAccessMode.ReadWrite))
  16. {
  17. _videoDevice.VideoEncodingFormat = CameraCaptureVideoFormat.H264;
  18. await _videoDevice.StartRecordingToStreamAsync(s);
  19.  
  20. Thread.Sleep(3000);
  21.  
  22. // I want the following 3 lines to be executed when I press the button again
  23. await _videoDevice.StopRecordingAsync();
  24. await s.FlushAsync();
  25. s.AsStream().Dispose();
  26. }
  27. } catch(Exception ex){
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement