Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Screenshot API #125

Closed
mattleibow opened this issue Mar 28, 2018 · 11 comments
Closed

Screenshot API #125

mattleibow opened this issue Mar 28, 2018 · 11 comments
Labels
feature-request A request for a new feature. needs-more-discussion This needs more discussion or info before discussing it as a proposal. needs-specifications Accepted feature/enhancement and needs specification. proposal Proposed feature or enhancement. up-for-grabs Implementation from community can be started.
Milestone

Comments

@mattleibow
Copy link
Contributor

mattleibow commented Mar 28, 2018

Would we want a Screenshot of the current window/screen?

VS bug #735683

@mattleibow mattleibow added the proposal Proposed feature or enhancement. label Mar 28, 2018
@mattleibow mattleibow added this to New in Triage Mar 29, 2018
@pictos pictos mentioned this issue Sep 16, 2018
@Redth Redth added this to Needs triage in Triage Nov 20, 2018
@Redth Redth added up-for-grabs Implementation from community can be started. needs-specifications Accepted feature/enhancement and needs specification. azdo-sync labels Nov 26, 2018
@Redth Redth moved this from Needs triage to Up for Grabs in Triage Nov 26, 2018
@pictos
Copy link
Contributor

pictos commented Nov 27, 2018

I would like to implement this API. Can you assign this to me?

@Redth Redth moved this from Up for Grabs to Needs triage in Triage Nov 27, 2018
@Redth
Copy link
Member

Redth commented Nov 27, 2018

This one needs some more discussion and specifications before it can be implemented.

  1. What is the native API like in Android, iOS, and UWP ?
  2. Do we need to make the method async?
  3. What should this return? byte[] or the filename?
  4. What format of image can this be which all platforms support?

@Redth Redth moved this from Needs triage to Needs Info in Triage Nov 27, 2018
@Redth Redth moved this from Needs Info to Up for Grabs in Triage Nov 27, 2018
@Redth Redth added the needs-more-discussion This needs more discussion or info before discussing it as a proposal. label Nov 27, 2018
@pictos
Copy link
Contributor

pictos commented Nov 27, 2018

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.

  1. What format of image can this be which all platforms support?
    On all 3 platforms, we can convert the image to .png or .jpg .

@xamarin-release-manager xamarin-release-manager added the feature-request A request for a new feature. label Nov 28, 2018
@Redth Redth moved this from Up for Grabs to Needs triage in Triage Nov 28, 2018
@Redth
Copy link
Member

Redth commented Nov 29, 2018

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.

@Redth Redth moved this from Needs triage to Up for Grabs in Triage Nov 29, 2018
@pictos
Copy link
Contributor

pictos commented Nov 29, 2018

First, I have 2 questions:

  1. How Photo Picker works?
  2. 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
}

@Redth Redth moved this from Up for Grabs to Needs triage in Triage Nov 30, 2018
@Redth
Copy link
Member

Redth commented Dec 3, 2018

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).

@Redth Redth moved this from Needs triage to Low priority in Triage Dec 3, 2018
@jrahma
Copy link

jrahma commented Sep 11, 2019

Saving Screenshot should be an option, develop should have both option:

  1. View the screenshot on image control
  2. Save the screenshot

Sometimes you don't want to save the screenshot but just share it then why you need to save it

@Redth Redth moved this from Low priority to Needs triage in Triage Sep 12, 2019
@jrahma
Copy link

jrahma commented Oct 16, 2019

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

@mzhukovs
Copy link

This would be an awesome, very useful, addition. Question - the UWP implementation would just capture the application window, not the entire desktop, right?

@Mrnikbobjeff
Copy link
Contributor

Can be closed

Triage automation moved this from Needs triage to Closed Oct 5, 2020
@mattleibow mattleibow added this to the 1.6.0 milestone Oct 5, 2020
@mattleibow
Copy link
Contributor Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request A request for a new feature. needs-more-discussion This needs more discussion or info before discussing it as a proposal. needs-specifications Accepted feature/enhancement and needs specification. proposal Proposed feature or enhancement. up-for-grabs Implementation from community can be started.
Projects
Triage
  
Closed
Triage
  
New
Development

No branches or pull requests

7 participants