Answer the question
In order to leave comments, you need to log in
How to get gyroscope data on iOS?
You need to create a similar effect on js. There are no issues with android, on Safari iOS, as far as I know, they limited the receipt of gyroscope data. But maybe someone faced similar and know some solutions?
Answer the question
In order to leave comments, you need to log in
As a result:
in Safari, without the permission of the browser, you cannot get gyroscope data.
The solution was to call the request window like this:
btn.onclick = function(e) {
DeviceMotionEvent.requestPermission().then(response => {
if (response == 'granted') {
window.addEventListener('devicemotion', (e) => {
/* разрешение получено */
})
}}).catch(console.error)
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question