Google VR View试图加载错误的文件

时间:2017-07-12 19:02:28

标签: google-vr

TL;博士

当我尝试初始化VRView.Player时,它会尝试加载<directory_of_script>/../index.html

我已经采取了蜿蜒的步骤

起初我尝试使用Google's docs中的示例。

<!-- file path: /test3d.htm -->
<html>
    <head>
        <script src="/Include/scripts/jquery.min.js"></script>
        <script src="//storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
        <script>
            $(() => {
                var vrView = new VRView.Player('#vrview', {
                    image: 'https://example.org/Images/image.jpg',
                    width: '100%',
                    height: '100%',
                });
            });
        </script>
    </head>
    <body>
        <div id="vrview">
        </div>
    </body>
</html>

由于跨域问题,这导致加载纹理时出错。

我将vrview.min.js复制到我的/Include/scripts/目录并更改了脚本src参数。

<!-- file path: /test3d.htm -->
<html>
    <head>
        <script src="/Include/scripts/jquery.min.js"></script>
        <script src="/Include/scripts/vrview.min.js"></script>
        <script>
            $(() => {
                var vrView = new VRView.Player('#vrview', {
                    image: '/Images/image.jpg',
                    width: '100%',
                    height: '100%',
                });
            });
        </script>
    </head>
    <body>
        <div id="vrview">
        </div>
    </body>
</html>

令人费解的是,这导致了HTTP 404,因为iframe尝试加载/Include/index.html

作为最后的手段,我尝试直接加载iframe。

<iframe src="https://storage.googleapis.com/vrview/2.0/embed?image=https://example.org/Images/image.jpg"></iframe>

这会从storage.googleapis.com返回HTTP 403错误:

AccessDeniedAccess denied.Anonymous users does not have storage.objects.get access to object vrview/2.0/embed.

有什么想法吗?

0 个答案:

没有答案