Skip to content
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

Device motion and orientation #36

Open
martdob opened this issue Nov 24, 2019 · 2 comments
Open

Device motion and orientation #36

martdob opened this issue Nov 24, 2019 · 2 comments

Comments

@martdob
Copy link

martdob commented Nov 24, 2019

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)

@greggman
Copy link
Owner

greggman commented Dec 6, 2019

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 $$$$$$$$

@martdob
Copy link
Author

martdob commented Dec 6, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants