Open martdob opened 4 years ago
This won't work for happyfuntimes unfortunately. Pretty much device orientation is dead for hft
It's not just that you need permission it's also that your page has to be served via https or you get an error
Call to requestPermission() failed, reason: Browsing context is not secure.
Serving https is not something hft can do. It requires a domain per game running and getting a certificate for that domain and keeping it up to date. In other words to use it the user (the person running the game not the game developer) would need to register a domain like at godaddy or namecheap or some other place and then some how let hft update the ip address for that domain to point to their home machine (or where ever they are running the game) and get a cert from like letsencrypt, and keep both of those up to date (certs expire every 3 months and ip addresses change)
I looked into it back when I first made hft and it turned out the only solution would require $$$$$$$$
Many thanks for the details on this issue. This saved us tons of time. BTW, we like the concept of htf. you did a tremendous job.
Since iOS and Android does not allow to use the sensor data per default the orientation controller does not. I assume that the code should be enhanced by something like this; DeviceOrientationEvent.requestPermission() .then(response => { if (response == 'granted') { window.addEventListener('deviceorientation', (e) => { // do something with e }) } }) .catch(console.error)