将多个视频保存和检索到本地存储? [英] Save and retrieve multiple videos to local storage?

查看:37
本文介绍了将多个视频保存和检索到本地存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里使用来自微软的示例应用:

http://msdn.microsoft.com/en-us/library/hh394041(v=vs.92).aspx

作为开发应用的起点,该应用允许用户将应用中的多个视频录制到一个集合中.

实现这一目标的最佳方法是什么?我注意到该示例使用 fileSink 对象来指定隔离存储中的捕获源和文件名.

 Private Sub StartVideoRecording()尝试' 将 fileSink 连接到 captureSource.如果 captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Started 然后捕获源.停止()' 连接 fileSink 的输入和输出.fileSink.CaptureSource = captureSourcefileSink.IsolatedStorageFileName = isoVideoFileName万一'开始录音.如果 captureSource.VideoCaptureDevice IsNot Nothing AndAlso captureSource.State = CaptureState.Stopped 那么捕获源.开始()万一' 设置按钮状态和消息.UpdateUI(ButtonState.Recording, "Recording...")' 如果记录失败,则显示错误.将 e 作为异常捕获Me.Dispatcher.BeginInvoke(Sub() txtDebug.Text = "ERROR: " & e.Message.ToString())结束尝试结束子

然后我将如何查询该集合并允许用户选择该视频以在列表视图中查看?有没有办法指定一个文件夹来组织视频文件?

只是寻找一些关于最佳实践的建议来完成这项工作.我想使用一个视频选择器,允许用户从他们的照片胶卷中选择一个视频,但 Windows Phone 目前不允许这样做......

解决方案

嗯,有没有必要使用文件夹?没有人可以浏览 ISO 存储,所以我认为不需要文件夹:)

使用该教程,创建了两个文件:CameraMovie.mp4"和CameraMovie.mp4.jpg"(jpg 至少是在我的手机上创建的,使用 ISETool 查看 ISO 存储的内容).

要录制多个视频,每次都必须重命名文件名

private string isoVideoFileName = "CameraMovie.mp4";//录制开始时重置名称isoVideoFileName = DateTime.Now.ToString("yyyy-MM-dd_HH_mm") + ".mp4";

只需在开始录制时更改该变量即可.

在每次录制结束时,将视频的名称添加到列表中,添加视频后,您将保存列表(也保存到 ISO 存储中).在加载应用程序时,您从 ISO 加载列表,使用 jpg 来制作视频图块(或者您想用它来做;))

希望这对您有所帮助,如果您还没有找到解决方案.

注意,我很抱歉使用 C#,而您使用 VB.然而,我不太了解 VB,无法随意输入 ;)

I'm using the sample app from microsoft here:

http://msdn.microsoft.com/en-us/library/hh394041(v=vs.92).aspx

as a starting point to develop an app that allows the user to record multiple videos in the app to a collection.

What is the best way to accomplish this? I noticed that the example uses a fileSink object to specify the capture source and file name in isolated storage.

 Private Sub StartVideoRecording()
    Try
        ' 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...")

        ' If recording fails, display an error.
    Catch e As Exception
        Me.Dispatcher.BeginInvoke(Sub() txtDebug.Text = "ERROR: " & e.Message.ToString())
    End Try
End Sub

How would I then query that collection and allow the user to select that video for viewing in a listview? Is there no way to specify a folder to keep the video files organized?

Just looking for some advice on best practices to get this done. I wanted to use a video chooser that would allow the user to choose a video from their photo roll, but Windows Phone doesn't currently allow this.....

解决方案

Well, is there any need to use a folder? noone can browse the ISO storage, so I see no need for folders :).

Using that tutorial, two files are created: "CameraMovie.mp4" and "CameraMovie.mp4.jpg" (the jpg is at least created on my phone, use ISETool to see the content of the ISO storage).

To record multiple videos, you would have to rename the filename each time

private string isoVideoFileName = "CameraMovie.mp4";

// reset the name when the recording starts
isoVideoFileName = DateTime.Now.ToString("yyyy-MM-dd_HH_mm") + ".mp4";

just change that variable when you start recording.

At the end of each recording, add the name of the video to a list, and once a video is added, you save the list (also to the ISO storage). While loading the app, you load the list from the ISO, use the jpg's to make video tiles (or w/e you wanna do with it ;))

Hope this will help you a little forward, if not you have found the solution yet.

note, im sorry for using C#, whereas you use VB. It is however that i dont know VB well enough to type it at will ;)

这篇关于将多个视频保存和检索到本地存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆