googlearchive / vrview

Library for embedding immersive media into traditional websites.
http://developers.google.com/cardboard/vrview
Apache License 2.0
1.71k stars 1.09k forks source link

[Question] Hosting code on own server #319

Open CaioBrighenti opened 6 years ago

CaioBrighenti commented 6 years ago

Perhaps this is a simpler issue than I realize, but I am somewhat new to HTML/JS and this seems to me to be a specific issue with this code. I am using the Google VR Viewer to embed 360 elements within my web-page.

Their documentation here is simple enough and setting up as laid out on their website works fine if I'm using media hosted on Google's domain as well. This the code I'm using that works just dandy:

<script src="https://storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
<script>
  window.addEventListener('load', onVrViewLoad);
  function onVrViewLoad() {
    vrView = new VRView.Player('#vrview', {
    width: '100%',
    height: 480,
    image: 'https://storage.googleapis.com/vrview/examples/coral.jpg',
    is_stereo: true,
    is_autopan_off: true
    });
  }
</script>

However, I need to have the .js files hosted on my own server, as opposed to just linking to Google. So I tried downloading the script and using following code and I can't get it to work. Can anyone spot what's wrong?

<script src="build/vrview.min.js"></script>
<script>
  window.addEventListener('load', onVrViewLoad);
  function onVrViewLoad() {
    vrView = new VRView.Player('#vrview', {
    width: '100%',
    height: 480,
    image: '360/coral.jpg',
    is_stereo: true,
    is_autopan_off: true
    });
  }
</script>

For reference, the error I get is

Cannot GET /index.html?image=http://127.0.0.1:61060/360/coral.jpg&amp;is_stereo=true&amp;is_autopan_off=true&amp;

Thanks! Hopefully this isn't too dumb of a question.

jjnxpct commented 6 years ago

Did you figure this out? I'm new to this to and want to host js files on our own server to. Not sure why index.html is used to get the image... I'll keep searching and trying more ;-) Any help is appreciated.

CaioBrighenti commented 6 years ago

@jjnxpct I have not actually, ended up going with a different 360 viewer for my project (which is a bummer, given how convenient this one seems to be). I can't even get the demos to work, and live pages that have other demos of vrview seem to be broken too so I suspect there's some unresolved issue going on.

jjnxpct commented 6 years ago

I now use https://pannellum.org/. Excellent script! Works out of the box and with a lot of options.