问题描述
当我尝试这个例子时:在我的Android 7.0三星Galaxy 7手机上使用Chrome浏览器和Utopia360耳机,一切正常,我可以进入VR模式。当我使用完全相同的代码尝试完全相同的事情时,只能在本地服务器上获得您的浏览器不支持WebVR,请参阅webvr.info以获取帮助。
代码完全相同,three.js和WebVR.js文件除了three.js和WebVR.js文件位于目录结构(即< script src =js / threejs / three.jstype =text / javascript>< / script>
而不是< script src =../ build / three.js>< / script>
)
根据。
Threejs.org是一个使用HTTPS的站点,但您的localhost几乎肯定不会通过安全连接传送内容。这就是为什么你会看到误导性的警告你的浏览器不支持WebVR,事实上它就是这样。
不幸的是,使它听起来像三个选项来获得本地主机的SSL证书不适用于Chrome浏览器(或价格昂贵),因此使用是目前最好的解决方案。
When I try out the example: https://threejs.org/examples/webvr_cubes.html on my Android 7.0 Samsung Galaxy 7 phone using the Chrome browser and the Utopia360 headset, everything works and I can enter VR mode. When I try the exact same thing with exactly the same code, only on my local server, I get "Your browser does not support WebVR. See webvr.info for assistance."
The code is exactly the same and the three.js and WebVR.js files are exactly the same except for where the three.js and WebVR.js files are located in the directory structure (i.e. <script src="js/threejs/three.js" type="text/javascript"></script>
instead of <script src="../build/three.js"></script>
)
The issue is that you must "serve your WebVR content via HTTPS", according to the Google WebVR status documentation.
Threejs.org is a site that uses HTTPS, but your localhost is almost certainly not delivering the content via a secure connection. That's why you're seeing that misleading warning that "Your browser does not support WebVR", when in fact, it does.
Unfortunately, the available methods to deliver HTTPS via Apache make it sound like the three options to get an SSL certificate for localhosts won't work on Chrome for Android (or are pricey), so using the WebVR polyfill is the best solution for the time being.
这篇关于three.js WebVR示例代码适用于threejs.org,但不适用于本地服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!