-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: screenshots #670
Feat: screenshots #670
Conversation
We can also replace this sample then:
|
5ebbaa9
to
780126f
Compare
Out of curiosity, does this feature works with UWP? I recall on Xamarin that when I tried to take a screenshot it usually freezes the app on UWP so I just disabled it on that platform 😅 |
Replace by what though? I'd actually remove that. |
While UWP isn't officially supported (a.k.a tested), the screenshot attachment seems to work fine: {"type":"attachment","length":100262,"filename":"screenshot.jpg","attachment_type":"event.attachment","content_type":"image/jpeg"} Though I can't verify if the actual screenshot looks reasonable because there are HTTP Request errors despite enabling some internet-related permissions in the player settings:
|
src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
Outdated
Show resolved
Hide resolved
[field: SerializeField] public int ScreenshotMaxWidth { get; set; } | ||
[field: SerializeField] public int ScreenshotMaxHeight { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about dealing with absolute pixel sizes here. It does not take into account devices with different aspect ratios or switching from portrait to landscape.
Maybe we should start with a ratio instead e.g. "half the original resolution".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use a single parameter for Width/Height that gets applied to the highest value and if the image is bigger than the given maximum value, resize it while keeping the aspect ratio.
Sample code that I used to use for getting a new size for the image
private static SKImageInfo GetResizedMeasure(int width, int height, int newMax)
{
double ratio;
if (width > newMax)
{
ratio = (double)newMax / width;
height = (int)(height * ratio);
width = (int)(width * ratio);
}
if (height > newMax)
{
ratio = (double)newMax / height;
width = (int)(width * ratio);
height = (int)(height * ratio);
}
return new SKImageInfo(width, height, SKColorType.Rgb565);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've discussed in the call to align across other SDKs. @bitsandfoxes is going to gather inputs
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
Show resolved
Hide resolved
src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
I've disabled for WebGL where the screenshots consistently don't work (they're black), and updated the tooltip with more information. If you think that's OK for now, please merge @bitsandfoxes or @bruno-garcia |
Closes #284
TODO: