I'm pretty new on Windows Phone 8.1 development and what I'm currently trying is recording a video and store it on the Windows Phone. However, I don't have any idea how that can be done. I have some code excerpt below which is the code executed when the start/stop record button is pressed. The code is taken from an example.
My questions:
- How _videoFile can be saved to the VideoLibrary?
Preferably I would like the program to execute a method when recording is stopped. How I get the video filename inside this method?
private async void OnCaptureVideoButtonClick(object sender, RoutedEventArgs e) { if (!_capturingVideo) { //BtnStartStop.Content = "Stop"; StartAppBarButton.Icon = new SymbolIcon(Symbol.Stop); _capturingVideo = true; _videoFile = await TestedControl.StartVideoCaptureAsync(KnownFolders.VideosLibrary, "capture.mp4"); CapturedVideoElement.Visibility = Visibility.Visible; IRandomAccessStreamWithContentType stream; try { stream = await TryCatchRetry.RunWithDelayAsync<Exception, IRandomAccessStreamWithContentType>( _videoFile.OpenReadAsync(), TimeSpan.FromSeconds(0.5), 10); } catch (Exception ex) { #pragma warning disable 4014 new MessageDialog(ex.Message, "Error").ShowAsync(); #pragma warning restore 4014 return; } CapturedVideoElement.SetSource(stream, _videoFile.ContentType); } else { StartAppBarButton.Icon = new SymbolIcon(Symbol.Camera); _capturingVideo = false; #pragma warning disable 4014 await TestedControl.StopCapture(); #pragma warning restore 4014 } }