google-ar / codelab-webxr

Building an augmented reality application with the WebXR Device API
https://codelabs.developers.google.com/codelabs/ar-with-webxr/
Apache License 2.0
171 stars 86 forks source link

Can't make example work with Web Server for Chrome #4

Closed iindovina closed 6 years ago

iindovina commented 6 years ago

Hi, Thanks for the great tutorial. I have setup Canary the way you describe in the tutorial. I then tried to host the website using Web Server for Chrome, went into work, but the webpage doesn't seem to load properly and it says "Unsupported Browser". But apparently if I visit https://googlecodelabs.github.io/ar-with-webxr/final/ from the same device and same browser, I can access the AR mode. I have briefly compared the app.js in the two folders but I cannot seem to find any visible difference. I have also tried to debug the webpage on Android using Chrome Dev tools and found out that at line 40 in app.js the navigator.xr is not defined (just on the website I serve with Web Server for Chrome, your final link works fine).

I am not sure what that means.

Am I missing something obvious or there is something odd about it? Thanks in advance

jsantell commented 6 years ago

Hello @iindovina! Are you using http://localhost:8887 when working locally? WebXR requires a secure context, so navigator.xr will only exist on a page with HTTPS/SSL, or a localhost URL. Let me know if that fixes anything for you!

iindovina commented 6 years ago

Thank you @jsantell. I suspected it was something to do with the SSL. I have tried with the USB cable and it works on localhost. It is a bit annoying to use it cabled to the PC. Do you know if Web Server for Chrome allows for SSL connections? Alternatively do you know of other as easy to setup solutions that allow SSL?

jsantell commented 6 years ago

Not sure about other windows HTTPS servers (I was using the serve npm package previously which had an SSL option that was later removed, unfortunately), so I need to find a new one as well 😆 there are handfuls of scripts out there that might be helpful

vziatkov commented 6 years ago

Is it possible to find example of locating few 3d objects at the same time?

iindovina commented 6 years ago

Thanks @jsantell I'll look into that. Unfortunately atm I am on Windows so I need to figure out how to do the OpenSSL thing here. For what concerns the connection to the Web Server for Chrome, I think that issue is solved. Thanks for your help! :)

jsantell commented 6 years ago

@iindovina glad that helped!

@vziatkov I'm not sure what you mean, but check out the corresponding blog post for the features this enables