我不确定这是否是合适的地方,但是我的devicemotion脚本有问题。
我有一些代码,当页面加载时运行,以检查是否有陀螺仪可用。我通过以下方式完成此操作:
function check_user_hardware(){
if (mobile_size <= 600) {
hidden = true;
}
console.log("checking hardware");
giro_timer = setTimeout(update_gyro_value, 30);
window.addEventListener("devicemotion", function(event){
console.log("device motion?");
if(event.rotationRate.alpha || event.rotationRate.beta || event.rotationRate.gamma){
calculate_rotation_mesh_pos(event.rotationRate.beta, event.rotationRate.gamma);
if (!gyroscope) {
gyroscope = true;
console.log("gyroscope here");
current_interaction_mode = 'gyroscope_option';
set_user_ui_elements();
}
}else{
followMouse = true;
console.log("no gyroscope here");
current_interaction_mode = 'followMouse_option';
set_user_ui_elements();
window.addEventListener('mousemove', get_user_mouse_pos);
}
});
}这在几周前还很好用,但现在不再起作用了。我在console中看到以下打印:
checking hardware就是这样。为什么我的设备情感事件没有触发?即使在我的网站上使用基本的SSL加密,它也不能工作,为什么?我需要某种特殊的SSL加密吗?
这是怎么回事?欢迎所有的建议!
如果需要更多的信息,我将很乐意提供。
您可以在此处查看相关网站: gravient.thomashoek.com
发布于 2018-03-23 17:19:29
我在我的网络应用上也面临着同样的问题。我看到Chromium 62上的加速度计有一个问题,但它似乎已经在v.63中修复了。
然而,'devicemotion‘事件在我这边的chrome Android上也不再起作用了(但在iOS上工作得很好)。
https://stackoverflow.com/questions/49431946
复制相似问题