-
Notifications
You must be signed in to change notification settings - Fork 505
[Enhancement] DeviceDisplay/DisplayInfo should report refresh rate #1443
Comments
Getting the refresh rate on iOS and Android seems to be straightforward, but I did not find a way to obtain it on MacOS :( The class In principle there is a However, in the .NET APIs for Xamarin.Mac, I only find a CGDisplay class, but no way to get a fresh rate or even just a |
Maybe one should open a feature request in https://github.com/xamarin/xamarin-macios (or am I just missing something)? |
Just did that: xamarin/xamarin-macios#9958 |
Finally, the following might be relevant for an UWP implementation: https://docs.microsoft.com/en-us/uwp/api/windows.graphics.display.core.hdmidisplaymode.refreshrate |
* with a proper implementation on Android and iOS * MacOS and UWP always give a rate of zero
* with a proper implementation on Android and iOS * MacOS and UWP always give a rate of zero
Thanks for all the work and research on this one! |
* DisplayInfo: add a property 'RefreshRate' (#1443) * Samples: show RefreshRate on DeviceInfoPage (#1443) * Add documentation for DisplayInfo.RefreshRate (#1443) * Add the logic to read the macos refresh rate Based on xamarin-macios issue: xamarin/xamarin-macios#9958 Copied code from: https://gist.github.com/chamons/1eae64a2e5e10cbaf18b140e92ec4ca3 * Try to guess the Hz, but fall back to 60 This is not the most correct way, but is probably good enough. If there are any better ways in future, we can just add them in or replace this logic. Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
Summary
DisplayInfo already contains various information about the display, like width/height, density, orientation, rotation, etc. It should also include the device's screen refresh rate.
API Changes
The DisplayInfo struct should obtain a new property called
RefreshRate
or similar:Example usage:
Intended Use Case
The refresh rate can be useful for example in connection with sensor update rates, which are configurable via
SensorSpeed
(or can be throttled manually). If one knows the screen refresh rate, one can make sharper constraints on the necessary sensor rates. E.g. if my screen updates only with 30 Hz, I probably don't need to sample the OrientationSensor with 50 Hz, because the information can not be displayed that quickly. Or the other way around: If I know that my screen updates with 60 or even 120 Hz, then I might want to increase the sensor updates accordingly, so that I can get a smoother display (e.g. think of an "augmented-reality"-type camera overlay).Implementation
Some pointers that might be useful for the implementation:
The text was updated successfully, but these errors were encountered: