我有一个应用程序,我希望允许用户录制视频,然后将该视频与代表该视频的图像一起保存到隔离存储中。我从这里的一些示例代码中找出了视频部分:
' Set recording state: start recording.
Private Sub StartVideoRecording()
Try
...
App.ViewModel.IsDataLoaded = False
' Connect fileSink to captureSource.
If captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Started Then
captureSource.Stop()
' Connect the input and output of fileSink.
fileSink.CaptureSource = captureSource
fileSink.IsolatedStorageFileName = isoVideoFileName
End If
' Begin recording.
If captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Stopped Then
captureSource.Start()
End If
' Set the button states and the message.
UpdateUI(ButtonState.Recording, "Recording...")
Catch e As Exception
' If recording fails, display an error.
Me.Dispatcher.BeginInvoke(Sub() txtDebug.Text = "ERROR: " & e.Message.ToString())
End Try
End Sub
' Set the recording state: stop recording.
Private Sub StopVideoRecording()
Try
' Stop recording.
If captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Started Then
captureSource.Stop()
' Disconnect fileSink.
fileSink.CaptureSource = Nothing
fileSink.IsolatedStorageFileName = Nothing
' Set the button states and the message.
UpdateUI(ButtonState.NoChange, "Preparing viewfinder...")
StartVideoPreview()
End If
Catch e As Exception
' If stop fails, display an error.
Me.Dispatcher.BeginInvoke(Sub() txtDebug.Text = "ERROR: " & e.Message.ToString())
End Try
End Sub
有没有办法自动从录制的视频中提取缩略图而不强迫用户也拍照?