Comments (11)
Yeah I think this is the general idea. We are planning on working on the Photo Picker as one of the next features, so I'd like to see how that one gets spec'd out before we settle on a spec for this in case we can reuse the struct from it (like a common MediaFile
struct).
from essentials.
This would be an awesome, very useful, addition. Question - the UWP implementation would just capture the application window, not the entire desktop, right?
from essentials.
I would like to implement this API. Can you assign this to me?
from essentials.
This one needs some more discussion and specifications before it can be implemented.
- What is the native API like in Android, iOS, and UWP ?
- Do we need to make the method async?
- What should this return?
byte[]
or the filename? - What format of image can this be which all platforms support?
from essentials.
In the past I did a PR for this API. Using this as a reference....
1. What is the native API like in Android, iOS, and UWP ?
When I implemented I did not make use of the native APIs, to ensure that the implementation was similar on all platforms.
2. Do we need to make the method async?
Yes, because in all 3 platforms we use async methods. To get the byte[]
or to save the sreenshot image.
3. What should this return? byte[] or the filename?
The both. Like this:
public static Task<string> CaptureAsync(ScreenOutputType type = ScreenOutputType.PNG, string fileName = null) =>
PlataformCaptureAsync(type, fileName);
public static Task<byte[]> GetImageBytesAsync(ScreenOutputType type = ScreenOutputType.PNG) =>
PlataformGetImageBytesAsync(type);
The developer can use the byte[]
when he wants to do some other image processing, such as sending to a service. And we go back the path, when developer just wants to save the image on the device.
- What format of image can this be which all platforms support?
On all 3 platforms, we can convert the image to .png or .jpg .
from essentials.
I think if we can reasonably get a PNG back on each platform, we should just use that and not have an option for JPG (unless there's a compelling reason for needing both).
I also don't think we should have two methods returning different results. If anything we maybe need to return a ScreenshotFile
type or something similar and provide the filename and helper ReadStreamAsync
and ReadBytesAsync
type methods. It might be worth considering if we can use the same return type we will eventually be using for the photo picker.
from essentials.
First, I have 2 questions:
- How Photo Picker works?
- Will the screen capture API be in which folder?
How about we return a struct containing the information of the media types, can be used in Photo Picker and other APIs that handle media files. Like that:
Task<MediaFile> CaptureAsync(string fileName)
Task<Stream> ReadStreamAsync(MediaFile file)
Task<byte[]> ReadBytesAsync(MediaFile file)
struct MediaFile
{
string FileName;
string Path;
//Add other stuffs if necessary
}
from essentials.
Saving Screenshot should be an option, develop should have both option:
- View the screenshot on image control
- Save the screenshot
Sometimes you don't want to save the screenshot but just share it then why you need to save it
from essentials.
If you use Google Analytics app, you'll see that screenshot for some screen is not just the screenshot but the whole page shot which means the image will be vertically saving the whole page even the place which is not shown on the screen size.
It will be great if you add this so Xamarin Essentials will have a boolean value like this:
CaptureAsync(string filename, bool fullpage)
fullpage default is false
from essentials.
Can be closed
from essentials.
Thanks!
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] UWP Media Picker capture Photo doesn't work on windows 11 HOT 7
- [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.