如何将图像保存到图库

时间:2018-12-21 04:58:15

标签: xamarin xamarin.forms xamarin.ios xamarin.android

我想制作一个录像机,为此,我想将录制的视频保存到图库中,但不保存在图库中,而是保存的是自己的内部应用存储空间

private async void VideoRecorderAsync()
{
    if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakeVideoSupported)
    {
        _pageDialog.DisplayAlertAsync("No Camera", ":( No camera avaialble.", "OK");
        return;
    }

    //var pathFile = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads);
    //var absolutePath = pathFile.AbsolutePath;

    var file = await CrossMedia.Current.TakeVideoAsync(new Plugin.Media.Abstractions.StoreVideoOptions
    {
        SaveToAlbum = true,
    });

    if (file == null)
        return;

   _pageDialog.DisplayAlertAsync("Video Recorded", "Location: " + file.AlbumPath, "OK");

    file.Dispose();
}

我想从移动图库中保存图片。

0 个答案:

没有答案