Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74735

How to increase the refresh rate of DeviceOrientationEvent in Chrome?

$
0
0

I am using the following javascript code to display device orientation information in a webpage/console:

if(window.DeviceOrientationEvent) {
    window.addEventListener('deviceorientation', function(event) {
        var yaw = event.alpha;
        var pitch = event.beta;
        var roll = event.gamma;

        ...

    }, false);
}

If I run this code in the Edge browser on Windows, the orientation information updates at a fast and constant rate. However, in Chrome, the orientation information does not refresh smoothly. If I open a compass app in the background on Windows 10 (Asparion Compass+), then the refresh rate increases in Chrome.

Does anyone know why this happens? And is there any way to increase the device orientation refresh rate in Chrome (without having apps running in the background)? There are other features in Chrome that I want to use in this project, so using Edge is not an option.

Note, I have also tried using AbsoluteOrientationSensor({frequency: 100}), but the device orientation information that is output to the webpage/console does not refresh at 100Hz.


Viewing all articles
Browse latest Browse all 74735

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>