I'm using this piece of code but it doesn't show the image in the editor
<button class="btn btn-primary" @onclick="Capturephoto">Scatta</button>
<SfImageEditor @ref="imageEditor" Height="500"></SfImageEditor>
@code {
SfImageEditor imageEditor;
private async Task Capturephoto()
{
FileResult photo = null;
if (DeviceInfo.Current.Platform == DevicePlatform.Android || DeviceInfo.Current.Platform == DevicePlatform.iOS)
{
photo = await MediaPicker.Default.CapturePhotoAsync();
}
if (photo != null)
{
Stream sourceStream = await photo.OpenReadAsync();
byte[] bytes = new byte[Convert.ToInt32(sourceStream.Length)];
using (var memoryStream = new MemoryStream())
{
sourceStream.CopyTo(memoryStream);
bytes = memoryStream.ToArray();
}
await imageEditor.OpenAsync(bytes);
}
}
}