Comments (7)
The issue is indeed the AllowCropping is set by default on true, this setting should be exposed and make it available to the developer.
But seems nobody from Xamarin Essentials read this
from essentials.
Are there any updates on this? It seems like it should be a relatively simple fix to expose the property or disable clipping since it doesn't seem to work as a feature in that context in general.
from essentials.
For anyone that needs a workaround, adding this method to a helper on your UWP project and calling it via the dependency service works.
public async Task<(FileResult, byte[])> CaptureAsync(MediaPickerOptions options, bool photo)
{
// This is largely taken from the following file to get around the following issue
// https://github.com/xamarin/Essentials/blob/ae2cb946f8215ff49fa20773ec824b317e6ca603/Xamarin.Essentials/MediaPicker/MediaPicker.uwp.cs
// https://github.com/xamarin/Essentials/issues/2112
var captureUi = new CameraCaptureUI();
if (photo)
{
captureUi.PhotoSettings.Format = CameraCaptureUIPhotoFormat.Jpeg;
captureUi.PhotoSettings.AllowCropping = false;
}
else
{
captureUi.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;
}
var file = await captureUi.CaptureFileAsync(photo ? CameraCaptureUIMode.Photo : CameraCaptureUIMode.Video);
// I'm not 100% sure why but assume it's related to local extension methods I don't have access to, but I cannot send the file as an argument to the file result.
// We still can use it's file name handling here, etc., but the OpenReadAsync on the FileResult object created below does not work.
// Pulling the full image early here lets us work around this issue.
if (file != null)
{
using (var ms = new MemoryStream())
{
using (var s = await file.OpenReadAsync())
{
s.AsStreamForRead().CopyTo(ms);
return (new FileResult(file.Path, file.ContentType), ms.ToArray());
}
}
}
return (null, null);
}
from essentials.
Hello Sir, i also have the same problem but i didn't find a workaround for this issue yet. Please let me know if you find any solution!
from essentials.
I went into the same problem. Didn't find any solution.
from essentials.
Manage pass over the issue described above.
But now I have another issue on UWP when my app is running on Windows 11 platform. Because
Did some debugging on the Xamarin Essentials sample code. and the issue is caused by the setting form picture bellow, because you cannot save the unstill you make some editing, and if you press the save a copy button then the image cannot be loaded to the app anymore.
My question is if you can expose AllowCropping setting int the MediaPickerOptions this way the this setting can be disabled and MediaPicker will work again as expected.
This issue can be closed I'll open a new one and complete all the details needed
from essentials.
Encountering this issue too, in regard to the cropper not allowing to save without editing, though i'm not seeing the code mentioned here
Manage pass over the issue described above. But now I have another issue on UWP when my app is running on Windows 11 platform. Because Did some debugging on the Xamarin Essentials sample code. and the issue is caused by the setting form picture bellow, because you cannot save the unstill you make some editing, and if you press the save a copy button then the image cannot be loaded to the app anymore.
My question is if you can expose AllowCropping setting int the MediaPickerOptions this way the this setting can be disabled and MediaPicker will work again as expected.
This issue can be closed I'll open a new one and complete all the details needed
or is it the fact that AllowCropping is set to true by default?
I believe this to be the line in question
from essentials.
Related Issues (20)
- Error with Android Xamarin.Essentials 1.8.0 HOT 4
- Xamarin.Essentials 1.8.0 FilePicker gives NotImplementedInReferenceAssemblyException HOT 4
- [Bug] [Android] Android 14 MediaPicker shows modally over a blank view HOT 1
- support OpenHarmony HOT 1
- [Bug] WebAuthenticator with gogole auth 2.0 not returning back with the google auth 2.0 auth url
- [Bug] iOS 17+ Calendar Permissions not working when setting the first time HOT 9
- [Bug] Version 1.8.0 breaks VersionTracking.Track() .. HOT 8
- [Bug] Essentials connectivity - Android 14 Crash - java.lang.SecurityException:One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts(API level 34)[Bug] HOT 7
- [Bug] WebAuthenticator/Android - user case scenario when WebAuthenticator opens external Chrome and does not return to app HOT 3
- [Bug] [Bug] Xamarin Essentials connectivity - Android 14 Crash - java.lang.SecurityException:One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts(API level 34) HOT 1
- Values provided to `WebAuthenticatorResult` as an `Uri` are not properly url decoded
- The type or namespace 'Platform' does not exist on iOS HOT 4
- Can't compile Xamarin.Essentials while targeting Android SDK v34 HOT 1
- OrientationSensor on iOS does not work when Location Services are off. HOT 1
- Unable to Grant ScheduleExactAlarm permission.
- exceptions thrown?? HOT 2
- [Bug] `Connectivity.ConnectivityChanged` handler does not work when targeting API 34 on Android 14 phones / emulators. HOT 4
- [Bug] Native crash in xamarin.forms due to "Xamarin_Essentials_Xamarin_Essentials_Preferences_Get_string_System_DateTime_string"
- magnometro xamarin form HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from essentials.