I use MediaPlugin to record videos on iOS. After recorded, I use PHAsset.FetchAssets to get information of the recorded video, but PHAsset.Location is null.
If recording using Camera APP, it's ok to fetch PHAsset.Location. Could someone please tell me how to add Location in PHAsset of the video recorded by MediaPlugin? Many thanks.
Here is some related code.
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 = "";
...
}
}