Windows Phone - 将缩略图预览保存到录制视频的独立存储中

时间:2013-02-01 16:03:48

标签: windows-phone-8 windows-phone

我有一个应用程序,我想让用户录制视频,然后将该视频与表示该视频的图像保存到隔离存储中。我从这里的示例代码中找到了视频部分:

' 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

是否有自动从录制的视频中提取缩略图而不强迫用户也拍照?

1 个答案:

答案 0 :(得分:0)

您会很高兴知道生成了自动缩略图。文件名将具有.jpg扩展名。您可以查找IsolatedStorage浏览器以查看结果。