ソースを参照

avalonia: Fixed android video selector

Kenric Nugteren 1 週間 前
コミット
aa0cc69148
1 ファイル変更5 行追加3 行削除
  1. 5 3
      InABox.Avalonia.Platform.Android/ImageTools.Android.cs

+ 5 - 3
InABox.Avalonia.Platform.Android/ImageTools.Android.cs

@@ -81,7 +81,7 @@ namespace InABox.Avalonia.Platform.Android
         
         public async Task<ImageFile?> PickVideoAsync(TopLevel window)
         {
-            var fileResult = await MediaPicker.PickPhotoAsync();
+            var fileResult = await MediaPicker.PickVideoAsync();
             if (fileResult == null)
                 return null;
             await using var stream = await fileResult.OpenReadAsync();
@@ -90,11 +90,13 @@ namespace InABox.Avalonia.Platform.Android
         
         public async Task<ImageFile?> CaptureVideoAsync(TopLevel window)
         {
-            var fileResult = await MediaPicker.CapturePhotoAsync();
+            var fileResult = await MediaPicker.CaptureVideoAsync();
             if (fileResult == null)
                 return null;
             await using var stream = await fileResult.OpenReadAsync();
-            return await ProcessFile(stream, null, null);
+            using var memStream = new MemoryStream();
+            stream.CopyTo(memStream);
+            return new ImageFile(fileResult.FileName, memStream.ToArray());
         }
 
         private async Task<ImageFile> ProcessFile(Stream stream, int? compression, Size? constraints)