ユーザーがビデオを録画し、そのビデオを表す画像と共にそのビデオを分離ストレージに保存できるようにするアプリがあります。ここにあるサンプルコードからビデオ部分を理解しました:
' 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
ユーザーに写真を撮らせることなく、記録されたビデオからサムネイルを自動的に抽出する方法はありますか?