Xamarin.forms 如何在MediaPlugin录制的视频中添加录制位置

Xamarin.forms 如何在MediaPlugin录制的视频中添加录制位置,xamarin.forms,geolocation,video-recording,phasset,plugin.media.crossmedia,Xamarin.forms,Geolocation,Video Recording,Phasset,Plugin.media.crossmedia,我使用MediaPlugin在iOS上录制视频。录制后,我使用PHAsset.FetchAssets获取录制视频的信息,但PHAsset.Location为空 如果使用摄像头应用程序录制,则可以获取PHAsset.Location。有人能告诉我如何在MediaPlugin录制的视频中添加位置吗?非常感谢 下面是一些相关代码 var file = await CrossMedia.Current.TakeVideoAsync(new Plugin.Media.Abstractions.St

我使用MediaPlugin在iOS上录制视频。录制后,我使用PHAsset.FetchAssets获取录制视频的信息,但PHAsset.Location为空

如果使用摄像头应用程序录制,则可以获取PHAsset.Location。有人能告诉我如何在MediaPlugin录制的视频中添加位置吗?非常感谢

下面是一些相关代码

    var file = await CrossMedia.Current.TakeVideoAsync(new Plugin.Media.Abstractions.StoreVideoOptions
    {
        Name = "video.mp4",
        Directory = "DefaultVideos",
        SaveToAlbum = true,
    });

...

    var fetchOptions = new PHFetchOptions();
    fetchOptions.SortDescriptors = new NSSortDescriptor[] { new NSSortDescriptor("creationDate", false) };
    PHFetchResult videosFetchResult = PHAsset.FetchAssets(PHAssetMediaType.Video, fetchOptions);

    foreach (PHAsset videoAsset in videosFetchResult)
    {
        if (videoAsset.Location != null)
        {
            videoItem.RecordPlace.Longitude = videoAsset.Location.Coordinate.Longitude;
            videoItem.RecordPlace.Latitude = videoAsset.Location.Coordinate.Latitude;
            videoItem.RecordPlaceName = "";
...
        }
    }

您在拍摄视频时是否尝试过设置
SaveMetaData=true
?@JackHua MSFT刚刚尝试过,但不起作用。您可以在mediaplugin github上打开一个问题,询问这是否可用。