从隔离存储中传输手机视频

时间:2013-12-13 13:45:18

标签: c# video windows-phone-8 isolatedstorage isolatedstoragefile

我正在制作视频录制应用。视频被记录并存储在隔离的存储器中,但我希望用户能够将他的视频从手机上传输出来......也许可以将视频传输到手机的“音乐+视频”部分或通过其他方式。

隔离存储视频代码:

// File details for storing the recording.        
    private IsolatedStorageFileStream isoVideoFile;


private void StartVideoRecording()
    {
        try
        {
        videos = null;
        isoVideoFileName = string.Format(dateTime.Day.ToString() + dateTime.Month.ToString() + dateTime.Year.ToString() + "_" + dateTime.Hour.ToString() + dateTime.Minute.ToString() + dateTime.Second.ToString()+".mp4");

            //SAVE TO LOCAL MEMORY............

        videos.Add(isoVideoFileName.ToString());
        IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
        if (settings.Contains("Storage"))
        {
            List<string> vids = new List<string>();
            List<string> vids1 = new List<string>();
            vids.AddRange(IsolatedStorageSettings.ApplicationSettings["Storage"] as List<string>);
            videos.AddRange(vids);
            settings["Storage"] = videos;
            settings.Save();
        }
        else
        {
            settings["Storage"] = videos;
            settings.Save();
        }
        //.......................................

            if (captureSource.VideoCaptureDevice != null
                && captureSource.State == CaptureState.Started)
            {
                captureSource.Stop();


                fileSink.CaptureSource = captureSource;
                fileSink.IsolatedStorageFileName = isoVideoFileName;
            }

            // Begin recording.
            if (captureSource.VideoCaptureDevice != null
                && captureSource.State == CaptureState.Stopped)
            {
                captureSource.Start();
            }


            disp.Text = "DashCam - Recording...";
            status = "recording";

        }


        catch (Exception e)
        {
            //this.Dispatcher.BeginInvoke(delegate()
            //{
            //    MessageBox.Show(e.ToString());
            //    
            //});
        }
    }

更新1

当我解决这个问题时,我发现文档中提供了ID_CAP_MEDIALIB_VIDEO,这使我们能够将视频传输到相机胶卷。但是缺少清单,有没有其他方法可以实现这一点?